convert AreaTransparencyGradientPopup to .ui

and

1) merge with AreaTransparencyGradientControl
2) grab focus for keyboard a11y like similar popups
3) use degree symbol instead of "degrees" text

and it now grows nicely to fit everything in correctly

Change-Id: I326f3393165f7a098d739be70b644b29dd5238f0
This commit is contained in:
Caolán McNamara
2016-10-06 10:36:33 +01:00
parent b15fef02c9
commit c7a2bbfa34
13 changed files with 484 additions and 608 deletions

View File

@@ -197,8 +197,6 @@
#define RID_SVXIMG_NOTCHECKED (RID_SVX_START + 243) #define RID_SVXIMG_NOTCHECKED (RID_SVX_START + 243)
#define RID_SVXIMG_CHECKED (RID_SVX_START + 244) #define RID_SVXIMG_CHECKED (RID_SVX_START + 244)
#define RID_POPUPPANEL_AREAPAGE_TRGR (RID_SVX_START + 320)
#define RID_SIDEBAR_LINE_PANEL (RID_SVX_START + 321) #define RID_SIDEBAR_LINE_PANEL (RID_SVX_START + 321)
#define RID_SIDEBAR_EMPTY_PANEL (RID_SVX_START + 327) #define RID_SIDEBAR_EMPTY_PANEL (RID_SVX_START + 327)
@@ -1007,8 +1005,6 @@
#define IMG_RADIAL (RID_SVX_SIDEBAR_BEGIN + 33) #define IMG_RADIAL (RID_SVX_SIDEBAR_BEGIN + 33)
#define IMG_SQUARE (RID_SVX_SIDEBAR_BEGIN + 34) #define IMG_SQUARE (RID_SVX_SIDEBAR_BEGIN + 34)
#define IMG_LINEAR (RID_SVX_SIDEBAR_BEGIN + 35) #define IMG_LINEAR (RID_SVX_SIDEBAR_BEGIN + 35)
#define IMG_ROT_LEFT (RID_SVX_SIDEBAR_BEGIN + 36)
#define IMG_ROT_RIGHT (RID_SVX_SIDEBAR_BEGIN + 37)
#define RID_SVX_SIDEBAR_END (RID_SVX_START + 1279) #define RID_SVX_SIDEBAR_END (RID_SVX_START + 1279)
#define RID_SVXIMG_GREENCHECK (RID_SVX_START + 1280) #define RID_SVXIMG_GREENCHECK (RID_SVX_START + 1280)

View File

@@ -53,8 +53,6 @@ class XFillBitmapItem;
namespace svx { namespace sidebar { namespace svx { namespace sidebar {
class AreaTransparencyGradientControl;
class SVX_DLLPUBLIC AreaPropertyPanelBase class SVX_DLLPUBLIC AreaPropertyPanelBase
: public PanelLayout, : public PanelLayout,
public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface

View File

@@ -19,7 +19,10 @@
#ifndef INCLUDED_SVX_SOURCE_SIDEBAR_AREA_AREATRANSPARENCYGRADIENTPOPUP_HXX #ifndef INCLUDED_SVX_SOURCE_SIDEBAR_AREA_AREATRANSPARENCYGRADIENTPOPUP_HXX
#define INCLUDED_SVX_SOURCE_SIDEBAR_AREA_AREATRANSPARENCYGRADIENTPOPUP_HXX #define INCLUDED_SVX_SOURCE_SIDEBAR_AREA_AREATRANSPARENCYGRADIENTPOPUP_HXX
#include <vcl/edit.hxx>
#include <vcl/field.hxx>
#include <vcl/floatwin.hxx> #include <vcl/floatwin.hxx>
#include <vcl/toolbox.hxx>
class XFillFloatTransparenceItem; class XFillFloatTransparenceItem;
@@ -31,9 +34,25 @@ class AreaPropertyPanelBase;
class AreaTransparencyGradientPopup : public FloatingWindow class AreaTransparencyGradientPopup : public FloatingWindow
{ {
private: private:
VclPtr<AreaTransparencyGradientControl> m_xControl; AreaPropertyPanelBase& mrAreaPropertyPanel;
VclPtr<VclContainer> maCenterGrid;
VclPtr<VclContainer> maAngleGrid;
VclPtr<MetricField> maMtrTrgrCenterX;
VclPtr<MetricField> maMtrTrgrCenterY;
VclPtr<MetricField> maMtrTrgrAngle;
VclPtr<ToolBox> maBtnLeft45;
VclPtr<ToolBox> maBtnRight45;
VclPtr<MetricField> maMtrTrgrStartValue;
VclPtr<MetricField> maMtrTrgrEndValue;
VclPtr<MetricField> maMtrTrgrBorder;
void InitStatus(XFillFloatTransparenceItem* pGradientItem);
void ExecuteValueModify(sal_uInt8 nStartCol, sal_uInt8 nEndCol);
DECL_LINK(ModifiedTrgrHdl_Impl, Edit&, void);
DECL_LINK(Left_Click45_Impl, ToolBox*, void);
DECL_LINK(Right_Click45_Impl, ToolBox*, void);
public: public:
AreaTransparencyGradientPopup(vcl::Window* pParent, AreaPropertyPanelBase& rPanel); AreaTransparencyGradientPopup(AreaPropertyPanelBase& rPanel);
virtual ~AreaTransparencyGradientPopup() override; virtual ~AreaTransparencyGradientPopup() override;
void Rearrange (XFillFloatTransparenceItem* pItem); void Rearrange (XFillFloatTransparenceItem* pItem);
virtual void dispose() override; virtual void dispose() override;

View File

@@ -193,7 +193,6 @@ $(eval $(call gb_Library_add_exception_objects,svx,\
svx/source/sidebar/paragraph/ParaSpacingControl \ svx/source/sidebar/paragraph/ParaSpacingControl \
svx/source/sidebar/area/AreaPropertyPanel \ svx/source/sidebar/area/AreaPropertyPanel \
svx/source/sidebar/area/AreaPropertyPanelBase \ svx/source/sidebar/area/AreaPropertyPanelBase \
svx/source/sidebar/area/AreaTransparencyGradientControl \
svx/source/sidebar/area/AreaTransparencyGradientPopup \ svx/source/sidebar/area/AreaTransparencyGradientPopup \
svx/source/sidebar/shadow/ShadowPropertyPanel \ svx/source/sidebar/shadow/ShadowPropertyPanel \
svx/source/sidebar/graphic/GraphicPropertyPanel \ svx/source/sidebar/graphic/GraphicPropertyPanel \

View File

@@ -36,6 +36,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\
svx/uiconfig/ui/docrecoverysavedialog \ svx/uiconfig/ui/docrecoverysavedialog \
svx/uiconfig/ui/extrustiondepthdialog \ svx/uiconfig/ui/extrustiondepthdialog \
svx/uiconfig/ui/findreplacedialog \ svx/uiconfig/ui/findreplacedialog \
svx/uiconfig/ui/floatingareastyle \
svx/uiconfig/ui/floatingcontour \ svx/uiconfig/ui/floatingcontour \
svx/uiconfig/ui/floatinglineproperty \ svx/uiconfig/ui/floatinglineproperty \
svx/uiconfig/ui/floatingundoredo \ svx/uiconfig/ui/floatingundoredo \

View File

@@ -16,7 +16,6 @@
* except in compliance with the License. You may obtain a copy of * except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include "AreaTransparencyGradientControl.hxx"
#include <sfx2/sidebar/ResourceDefinitions.hrc> #include <sfx2/sidebar/ResourceDefinitions.hrc>
#include <sfx2/sidebar/ControlFactory.hxx> #include <sfx2/sidebar/ControlFactory.hxx>

View File

@@ -34,8 +34,6 @@
#define MTR_TRGR_END_VALUE 18 #define MTR_TRGR_END_VALUE 18
#define FT_TRGR_BORDER 19 #define FT_TRGR_BORDER 19
#define MTR_TRGR_BORDER 20 #define MTR_TRGR_BORDER 20
#define STR_HELP_LEFT 24
#define STR_HELP_RIGHT 25
#define BTN_LEFT_SECOND 22 #define BTN_LEFT_SECOND 22
#define BTN_RIGHT_FIRST 23 #define BTN_RIGHT_FIRST 23

View File

@@ -45,184 +45,5 @@ Image IMG_LINEAR
{ {
ImageBitmap = Bitmap{File = "symphony/linear.png";}; ImageBitmap = Bitmap{File = "symphony/linear.png";};
}; };
Image IMG_ROT_LEFT
{
ImageBitmap = Bitmap{File = "symphony/rotate_left.png";};
};
Image IMG_ROT_RIGHT
{
ImageBitmap = Bitmap{File = "symphony/rotate_right.png";};
};
Control RID_POPUPPANEL_AREAPAGE_TRGR
{
OutputSize = TRUE;
DialogControl = TRUE;
Border = FALSE;
FixedText FT_TRGR_CENTER_X
{
Size = MAP_APPFONT ( CONTROL_WIDTH , FIXED_TEXT_HEIGHT ) ;
Text [ en-US ] = "Center ~X:";
};
MetricField MTR_TRGR_CENTER_X
{
Border = TRUE ;
Size = MAP_APPFONT ( CONTROL_WIDTH , MBOX_HEIGHT ) ;
HelpID = HID_PPROPERTYPANEL_AREA_MTR_TRGR_CENTER_X ;
QuickHelpText [ en-US ] = "Specify the horizontal offset percentage from the center for the gradient shading style. 50% is the horizontal center." ;
TabStop = TRUE ;
Repeat = TRUE ;
Spin = TRUE ;
Maximum = 100 ;
StrictFormat = TRUE ;
Unit = FUNIT_PERCENT ;
Last = 100 ;
SpinSize = 5 ;
};
FixedText FT_TRGR_CENTER_Y
{
Size = MAP_APPFONT ( CONTROL_WIDTH + POPUPPANEL_MARGIN_HORIZONTAL, FIXED_TEXT_HEIGHT ) ;//wj
Text [ en-US ] = "Center ~Y:";
};
MetricField MTR_TRGR_CENTER_Y
{
Border = TRUE ;
Size = MAP_APPFONT ( CONTROL_WIDTH , MBOX_HEIGHT ) ;
HelpID = HID_PPROPERTYPANEL_AREA_MTR_TRGR_CENTER_Y ;
QuickHelpText [ en-US ] = "Specify the vertical offset percentage from the center for the gradient shading style. 50% is the vertical center." ;
TabStop = TRUE ;
Repeat = TRUE ;
Spin = TRUE ;
Maximum = 100 ;
StrictFormat = TRUE ;
Unit = FUNIT_PERCENT ;
Last = 100 ;
SpinSize = 5 ;
};
FixedText FT_TRGR_ANGLE
{
Size = MAP_APPFONT ( CONTROL_WIDTH * 2 + POPUPPANEL_MARGIN_HORIZONTAL + CONTROL_SPACING_HORIZONTAL, FIXED_TEXT_HEIGHT ) ;//wj
Text [ en-US ] = "~Angle:";
};
MetricField MTR_TRGR_ANGLE
{
Border = TRUE ;
Size = MAP_APPFONT ( CONTROL_WIDTH , MBOX_HEIGHT ) ;
HelpID = HID_PPROPERTYPANEL_AREA_MTR_TRGR_ANGLE ;
QuickHelpText [ en-US ] = "Specify the angle of rotation for the gradient shading style." ;
TabStop = FALSE ;
Repeat = TRUE ;
Spin = TRUE ;
Minimum = -9999 ;
Maximum = 9999 ;
Unit = FUNIT_CUSTOM ;
SpinSize = 1 ;
CustomUnitText [ en-US ] = " degrees";
};
FixedText FT_TRGR_START_VALUE
{
Size = MAP_APPFONT ( CONTROL_WIDTH , FIXED_TEXT_HEIGHT ) ;
Text [ en-US ] = "~Start value:";
};
MetricField MTR_TRGR_START_VALUE
{
Border = TRUE ;
Size = MAP_APPFONT ( CONTROL_WIDTH , MBOX_HEIGHT ) ;
HelpID = HID_PPROPERTYPANEL_AREA_MTR_TRGR_SVALUE ;
QuickHelpText [ en-US ] = "Enter a transparency value for the beginning point of the gradient, where 0% is fully opaque and 100% is fully transparent." ;
TabStop = TRUE ;
Repeat = TRUE ;
Spin = TRUE ;
Maximum = 100 ;
StrictFormat = TRUE ;
Unit = FUNIT_PERCENT ;
Last = 100 ;
SpinSize = 5 ;
};
FixedText FT_TRGR_END_VALUE
{
Size = MAP_APPFONT (CONTROL_WIDTH + POPUPPANEL_MARGIN_HORIZONTAL, FIXED_TEXT_HEIGHT ) ; //wj
Text [ en-US ] = "~End value:";
};
MetricField MTR_TRGR_END_VALUE
{
Border = TRUE ;
Size = MAP_APPFONT ( CONTROL_WIDTH , MBOX_HEIGHT ) ;
HelpID = HID_PPROPERTYPANEL_AREA_MTR_TRGR_EVALUE ;
QuickHelpText [ en-US ] = "Enter a transparency value for the endpoint of the gradient, where 0% is fully opaque and 100% is fully transparent." ;
TabStop = TRUE ;
Repeat = TRUE ;
Spin = TRUE ;
Maximum = 100 ;
StrictFormat = TRUE ;
Unit = FUNIT_PERCENT ;
Last = 100 ;
SpinSize = 5 ;
};
FixedText FT_TRGR_BORDER
{
Size = MAP_APPFONT ( CONTROL_WIDTH * 2 + POPUPPANEL_MARGIN_HORIZONTAL + CONTROL_SPACING_HORIZONTAL, FIXED_TEXT_HEIGHT ) ;
Text [ en-US ] = "~Border:";
};
MetricField MTR_TRGR_BORDER
{
Border = TRUE ;
Size = MAP_APPFONT ( CONTROL_WIDTH , MBOX_HEIGHT ) ;
HelpID = HID_PPROPERTYPANEL_AREA_MTR_TRGR_BORDER ;
QuickHelpText [ en-US ] = "Specify the border value of gradient transparency." ;
TabStop = TRUE ;
Repeat = TRUE ;
Spin = TRUE ;
Maximum = 100 ;
StrictFormat = TRUE ;
Unit = FUNIT_PERCENT ;
Last = 100 ;
SpinSize = 5 ;
};
ToolBox BTN_LEFT_SECOND
{
Border = FALSE ;
HelpID = HID_PPROPERTYPANEL_AREA_BTN_LEFT_SECOND ;
SVLook = TRUE ;
Border = FALSE ;
TabStop = TRUE ;
Text = "Rotate Left";
ItemList =
{
ToolBoxItem
{
Identifier = TBI_LEFT ;
Text = "Rotate Left" ;
};
};
};
ToolBox BTN_RIGHT_FIRST
{
Border = FALSE ;
HelpID = HID_PPROPERTYPANEL_AREA_BTN_RIGHT_FIRST ;
SVLook = TRUE ;
Border = FALSE ;
TabStop = TRUE ;
Text = "Rotate Right";
ItemList =
{
ToolBoxItem
{
Identifier = TBI_RIGHT ;
Text = "Rotate Right" ;
};
};
};
String STR_HELP_LEFT
{
Text [ en-US ] = "Rotate counterclockwise by 45 degrees." ;
};
String STR_HELP_RIGHT
{
Text [ en-US ] = "Rotate clockwise by 45 degrees." ;
};
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -16,7 +16,6 @@
* except in compliance with the License. You may obtain a copy of * except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include "AreaTransparencyGradientControl.hxx"
#include <sfx2/sidebar/ResourceDefinitions.hrc> #include <sfx2/sidebar/ResourceDefinitions.hrc>
#include <sfx2/sidebar/SidebarController.hxx> #include <sfx2/sidebar/SidebarController.hxx>
@@ -1322,10 +1321,10 @@ IMPL_LINK_NOARG(AreaPropertyPanelBase, ModifyTransSliderHdl, Slider*, void)
IMPL_LINK( AreaPropertyPanelBase, ClickTrGrHdl_Impl, ToolBox*, pToolBox, void ) IMPL_LINK( AreaPropertyPanelBase, ClickTrGrHdl_Impl, ToolBox*, pToolBox, void )
{ {
if (!mxTrGrPopup) if (!mxTrGrPopup)
mxTrGrPopup = VclPtr<AreaTransparencyGradientPopup>::Create(pToolBox, *this); mxTrGrPopup = VclPtr<AreaTransparencyGradientPopup>::Create(*this);
mxTrGrPopup->Rearrange(mpFloatTransparenceItem.get()); mxTrGrPopup->Rearrange(mpFloatTransparenceItem.get());
OSL_ASSERT( pToolBox->GetItemCommand(pToolBox->GetCurItemId()) == UNO_SIDEBARGRADIENT); OSL_ASSERT( pToolBox->GetItemCommand(pToolBox->GetCurItemId()) == UNO_SIDEBARGRADIENT);
mxTrGrPopup->StartPopupMode(pToolBox, FloatWinPopupFlags::Down); mxTrGrPopup->StartPopupMode(pToolBox, FloatWinPopupFlags::GrabFocus);
} }
IMPL_LINK_NOARG(AreaPropertyPanelBase, ChangeTrgrTypeHdl_Impl, ListBox&, void) IMPL_LINK_NOARG(AreaPropertyPanelBase, ChangeTrgrTypeHdl_Impl, ListBox&, void)

View File

@@ -1,327 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include "AreaTransparencyGradientControl.hxx"
#include <svx/sidebar/AreaPropertyPanelBase.hxx>
#include "AreaPropertyPanel.hrc"
#include <svx/dialogs.hrc>
#include <svx/dialmgr.hxx>
#include <svx/xflftrit.hxx>
#include <sfx2/sidebar/ResourceDefinitions.hrc>
#include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx>
namespace svx { namespace sidebar {
// positioning helpers
#define APOS1_1 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL), MapUnit::MapAppFont))
#define APOS2_1 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL), MapUnit::MapAppFont))
#define APOS1_2 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL), MapUnit::MapAppFont))
#define APOS2_2 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL), MapUnit::MapAppFont))
#define APOS1_3 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL), MapUnit::MapAppFont))
#define APOS1_4 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL)+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL), MapUnit::MapAppFont))
#define APOS2_3 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL), MapUnit::MapAppFont))
#define APOS2_4 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL)+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL), MapUnit::MapAppFont))
#define APOS1_5 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL)), MapUnit::MapAppFont))
#define APOS1_6 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 3*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL)+2*(MBOX_HEIGHT+CONTROL_SPACING_VERTICAL)), MapUnit::MapAppFont))
#define APOS2_5 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL)), MapUnit::MapAppFont))
#define APOS2_6 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 3*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL)+2*(MBOX_HEIGHT+CONTROL_SPACING_VERTICAL)), MapUnit::MapAppFont))
#define APOS1_7 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 3*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL)), MapUnit::MapAppFont))
#define APOS1_8 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 4*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL)+3*(MBOX_HEIGHT+CONTROL_SPACING_VERTICAL)), MapUnit::MapAppFont))
#define APOS_Left_Right_1 Point(LogicToPixel(Point(LEFT_RIGHT_X1,LEFT_RIGHT_Y1), MapUnit::MapAppFont))
#define APOS_Left_Right_2 Point(LogicToPixel(Point(LEFT_RIGHT_X2,LEFT_RIGHT_Y1), MapUnit::MapAppFont))
#define APOS_Left_Right_3 Point(LogicToPixel(Point(LEFT_RIGHT_X1,LEFT_RIGHT_Y2), MapUnit::MapAppFont))
#define APOS_Left_Right_4 Point(LogicToPixel(Point(LEFT_RIGHT_X2,LEFT_RIGHT_Y2), MapUnit::MapAppFont))
AreaTransparencyGradientControl::AreaTransparencyGradientControl (
vcl::Window* pParent,
AreaPropertyPanelBase& rPanel)
: Control( pParent,SVX_RES(RID_POPUPPANEL_AREAPAGE_TRGR)),
maFtTrgrCenterX(VclPtr<FixedText>::Create(this, SVX_RES(FT_TRGR_CENTER_X))),
maMtrTrgrCenterX(VclPtr<MetricField>::Create(this, SVX_RES(MTR_TRGR_CENTER_X))),
maFtTrgrCenterY(VclPtr<FixedText>::Create(this, SVX_RES(FT_TRGR_CENTER_Y))),
maMtrTrgrCenterY(VclPtr<MetricField>::Create(this, SVX_RES(MTR_TRGR_CENTER_Y))),
maFtTrgrAngle(VclPtr<FixedText>::Create(this, SVX_RES(FT_TRGR_ANGLE))),
maMtrTrgrAngle(VclPtr<MetricField>::Create(this, SVX_RES(MTR_TRGR_ANGLE))),
maBtnLeft45(VclPtr<ToolBox>::Create(this, SVX_RES(BTN_LEFT_SECOND))),
maBtnRight45(VclPtr<ToolBox>::Create(this, SVX_RES(BTN_RIGHT_FIRST))),
maFtTrgrStartValue(VclPtr<FixedText>::Create(this, SVX_RES(FT_TRGR_START_VALUE))),
maMtrTrgrStartValue(VclPtr<MetricField>::Create(this, SVX_RES(MTR_TRGR_START_VALUE))),
maFtTrgrEndValue(VclPtr<FixedText>::Create(this, SVX_RES(FT_TRGR_END_VALUE))),
maMtrTrgrEndValue(VclPtr<MetricField>::Create(this, SVX_RES(MTR_TRGR_END_VALUE))),
maFtTrgrBorder(VclPtr<FixedText>::Create(this, SVX_RES(FT_TRGR_BORDER))),
maMtrTrgrBorder(VclPtr<MetricField>::Create(this, SVX_RES(MTR_TRGR_BORDER))),
maRotLeft( SVX_RES(IMG_ROT_LEFT)),
maRotRight( SVX_RES(IMG_ROT_RIGHT)),
mrAreaPropertyPanel(rPanel)
{
Link<Edit&,void> aLink = LINK( this, AreaTransparencyGradientControl, ModifiedTrgrHdl_Impl);
maMtrTrgrCenterX->SetModifyHdl( aLink );
maMtrTrgrCenterY->SetModifyHdl( aLink );
maMtrTrgrAngle->SetModifyHdl( aLink );
maMtrTrgrBorder->SetModifyHdl( aLink );
maMtrTrgrStartValue->SetModifyHdl( aLink );
maMtrTrgrEndValue->SetModifyHdl( aLink );
maBtnLeft45->SetSelectHdl( LINK( this, AreaTransparencyGradientControl, Left_Click45_Impl) );
maBtnRight45->SetSelectHdl( LINK( this, AreaTransparencyGradientControl, Right_Click45_Impl) );
maBtnLeft45->SetItemImage(1,maRotLeft);
Size aTbxSize = maBtnLeft45->CalcWindowSizePixel();
maBtnLeft45->SetOutputSizePixel( aTbxSize );
maBtnLeft45->SetQuickHelpText(1, SVX_RESSTR(STR_HELP_LEFT)); //acc wj
maBtnRight45->SetItemImage(1,maRotRight);
aTbxSize = maBtnRight45->CalcWindowSizePixel();
maBtnRight45->SetOutputSizePixel( aTbxSize );
maBtnRight45->SetQuickHelpText(1, SVX_RESSTR(STR_HELP_RIGHT)); //acc wj
maBtnLeft45->SetBackground(Wallpaper());
maBtnLeft45->SetPaintTransparent(true);
maBtnRight45->SetBackground(Wallpaper());
maBtnRight45->SetPaintTransparent(true);
FreeResource();
}
AreaTransparencyGradientControl::~AreaTransparencyGradientControl()
{
disposeOnce();
}
void AreaTransparencyGradientControl::dispose()
{
maFtTrgrCenterX.disposeAndClear();
maMtrTrgrCenterX.disposeAndClear();
maFtTrgrCenterY.disposeAndClear();
maMtrTrgrCenterY.disposeAndClear();
maFtTrgrAngle.disposeAndClear();
maMtrTrgrAngle.disposeAndClear();
maBtnLeft45.disposeAndClear();
maBtnRight45.disposeAndClear();
maFtTrgrStartValue.disposeAndClear();
maMtrTrgrStartValue.disposeAndClear();
maFtTrgrEndValue.disposeAndClear();
maMtrTrgrEndValue.disposeAndClear();
maFtTrgrBorder.disposeAndClear();
maMtrTrgrBorder.disposeAndClear();
Control::dispose();
}
void AreaTransparencyGradientControl::Rearrange(XFillFloatTransparenceItem* pGradientItem)
{
InitStatus(pGradientItem);
const XGradient& rGradient = pGradientItem->GetGradientValue();
css::awt::GradientStyle eXGS(rGradient.GetGradientStyle());
Size aSize(POP_WIDTH,POP_HEIGHT);
aSize = LogicToPixel( aSize, MapMode(MapUnit::MapAppFont) );
Size aSize2(POP_WIDTH,POP_HEIGHT2);
aSize2 = LogicToPixel( aSize2, MapMode(MapUnit::MapAppFont) );
long aPosY = 0;
Point aPointAngle;
Size aSizeAngle = maMtrTrgrAngle->GetSizePixel();
Size aTbxSize = maBtnLeft45->CalcWindowSizePixel();
switch(eXGS)
{
case css::awt::GradientStyle_LINEAR:
case css::awt::GradientStyle_AXIAL:
maFtTrgrCenterX->Hide();
maMtrTrgrCenterX->Hide();
maFtTrgrCenterY->Hide();
maMtrTrgrCenterY->Hide();
maFtTrgrAngle->Show();
maFtTrgrAngle->SetPosPixel(APOS1_1);
maMtrTrgrAngle->Show();
maMtrTrgrAngle->SetPosPixel(APOS2_1);
maFtTrgrStartValue->SetPosPixel(APOS1_3);
maMtrTrgrStartValue->SetPosPixel(APOS1_4);
maFtTrgrEndValue->SetPosPixel(APOS2_3);
maMtrTrgrEndValue->SetPosPixel(APOS2_4);
maFtTrgrBorder->SetPosPixel(APOS1_5);
maMtrTrgrBorder->SetPosPixel(APOS1_6);
maBtnLeft45->Show();
maBtnRight45->Show();
aPointAngle = maMtrTrgrAngle->GetPosPixel();
aPosY = aPointAngle.getY() + aSizeAngle.getHeight() - aTbxSize.getHeight();
maBtnLeft45->SetPosPixel(Point(APOS_Left_Right_1.getX(), aPosY));
maBtnRight45->SetPosPixel(Point(APOS_Left_Right_2.getX(), aPosY));
SetSizePixel(aSize2);
break;
case css::awt::GradientStyle_RADIAL:
maFtTrgrCenterX->Show();
maFtTrgrCenterX->SetPosPixel(APOS1_1);
maMtrTrgrCenterX->Show();
maMtrTrgrCenterX->SetPosPixel(APOS2_1);
maFtTrgrCenterY->Show();
maFtTrgrCenterY->SetPosPixel(APOS1_2);
maMtrTrgrCenterY->Show();
maMtrTrgrCenterY->SetPosPixel(APOS2_2);
maFtTrgrAngle->Hide();
maMtrTrgrAngle->Hide();
maFtTrgrStartValue->SetPosPixel(APOS1_3);
maMtrTrgrStartValue->SetPosPixel(APOS1_4);
maFtTrgrEndValue->SetPosPixel(APOS2_3);
maMtrTrgrEndValue->SetPosPixel(APOS2_4);
maFtTrgrBorder->SetPosPixel(APOS1_5);
maMtrTrgrBorder->SetPosPixel(APOS1_6);
maBtnLeft45->Hide();
maBtnRight45->Hide();
SetSizePixel(aSize2);
break;
case css::awt::GradientStyle_ELLIPTICAL:
case css::awt::GradientStyle_SQUARE:
case css::awt::GradientStyle_RECT:
maFtTrgrCenterX->Show();
maFtTrgrCenterX->SetPosPixel(APOS1_1);
maMtrTrgrCenterX->Show();
maMtrTrgrCenterX->SetPosPixel(APOS2_1);
maFtTrgrCenterY->Show();
maFtTrgrCenterY->SetPosPixel(APOS1_2);
maMtrTrgrCenterY->Show();
maMtrTrgrCenterY->SetPosPixel(APOS2_2);
maFtTrgrAngle->Show();
maFtTrgrAngle->SetPosPixel(APOS1_3);
maMtrTrgrAngle->Show();
maMtrTrgrAngle->SetPosPixel(APOS1_4);
maFtTrgrStartValue->SetPosPixel(APOS1_5);
maMtrTrgrStartValue->SetPosPixel(APOS1_6);
maFtTrgrEndValue->SetPosPixel(APOS2_5);
maMtrTrgrEndValue->SetPosPixel(APOS2_6);
maFtTrgrBorder->SetPosPixel(APOS1_7);
maMtrTrgrBorder->SetPosPixel(APOS1_8);
maBtnLeft45->Show();
maBtnRight45->Show();
aPointAngle = maMtrTrgrAngle->GetPosPixel();
aPosY = aPointAngle.getY() + aSizeAngle.getHeight() - aTbxSize.getHeight();
maBtnLeft45->SetPosPixel(Point(APOS_Left_Right_3.getX(), aPosY));
maBtnRight45->SetPosPixel(Point(APOS_Left_Right_4.getX(), aPosY));
SetSizePixel(aSize);
break;
default:
break;
}
}
void AreaTransparencyGradientControl::InitStatus(XFillFloatTransparenceItem* pGradientItem)
{
const XGradient& rGradient = pGradientItem->GetGradientValue();
XGradient aGradient;
if (rGradient.GetXOffset() == AreaPropertyPanelBase::DEFAULT_CENTERX
&& rGradient.GetYOffset() == AreaPropertyPanelBase::DEFAULT_CENTERY
&& (rGradient.GetAngle() / 10) == AreaPropertyPanelBase::DEFAULT_ANGLE
&& ((sal_uInt16)((((sal_uInt16)rGradient.GetStartColor().GetRed() + 1) * 100) / 255))
== AreaPropertyPanelBase::DEFAULT_STARTVALUE
&& ((sal_uInt16)((((sal_uInt16)rGradient.GetEndColor().GetRed() + 1) * 100) / 255))
== AreaPropertyPanelBase::DEFAULT_ENDVALUE
&& rGradient.GetBorder() == AreaPropertyPanelBase::DEFAULT_BORDER)
{
aGradient = mrAreaPropertyPanel.GetGradient(rGradient.GetGradientStyle());
}
else
{
aGradient = rGradient;
}
maMtrTrgrCenterX->SetValue(aGradient.GetXOffset());
maMtrTrgrCenterY->SetValue(aGradient.GetYOffset());
maMtrTrgrAngle->SetValue(aGradient.GetAngle() / 10);
maMtrTrgrStartValue->SetValue((sal_uInt16)((((sal_uInt16)aGradient.GetStartColor().GetRed() + 1) * 100) / 255));
maMtrTrgrEndValue->SetValue((sal_uInt16)((((sal_uInt16)aGradient.GetEndColor().GetRed() + 1) * 100) / 255));
maMtrTrgrBorder->SetValue(aGradient.GetBorder());
}
void AreaTransparencyGradientControl::ExecuteValueModify( sal_uInt8 nStartCol, sal_uInt8 nEndCol )
{
//Added
sal_Int16 aMtrValue = (sal_Int16)maMtrTrgrAngle->GetValue();
while(aMtrValue<0)
aMtrValue += 360;
sal_uInt16 nVal = aMtrValue/360;
nVal = aMtrValue - nVal*360;
maMtrTrgrAngle->SetValue(nVal);
//End of new code
XGradient aTmpGradient(
Color(nStartCol, nStartCol, nStartCol),
Color(nEndCol, nEndCol, nEndCol),
(css::awt::GradientStyle)(mrAreaPropertyPanel.GetSelectedTransparencyTypeIndex()-2),
(sal_uInt16)maMtrTrgrAngle->GetValue() * 10,
(sal_uInt16)maMtrTrgrCenterX->GetValue(),
(sal_uInt16)maMtrTrgrCenterY->GetValue(),
(sal_uInt16)maMtrTrgrBorder->GetValue(),
100, 100);
mrAreaPropertyPanel.SetGradient(aTmpGradient);
SfxItemPool* pPool = nullptr;
bool bEnable = true;
XFillFloatTransparenceItem aGradientItem(pPool,aTmpGradient, bEnable );
mrAreaPropertyPanel.setFillFloatTransparence(aGradientItem);
}
IMPL_LINK_NOARG(AreaTransparencyGradientControl, ModifiedTrgrHdl_Impl, Edit&, void)
{
sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrStartValue->GetValue() * 255) / 100);
sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrEndValue->GetValue() * 255) / 100);
ExecuteValueModify( nStartCol, nEndCol );
}
IMPL_LINK_NOARG(AreaTransparencyGradientControl, Left_Click45_Impl, ToolBox *, void)
{
sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrStartValue->GetValue() * 255) / 100);
sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrEndValue->GetValue() * 255) / 100);
sal_uInt16 aTemp = (sal_uInt16)maMtrTrgrAngle->GetValue();
if(aTemp>=315)
aTemp -= 360;
aTemp += 45;
maMtrTrgrAngle->SetValue(aTemp);
ExecuteValueModify( nStartCol, nEndCol );
}
IMPL_LINK_NOARG(AreaTransparencyGradientControl, Right_Click45_Impl, ToolBox *, void)
{
sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrStartValue->GetValue() * 255) / 100);
sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrEndValue->GetValue() * 255) / 100);
sal_uInt16 aTemp = (sal_uInt16)maMtrTrgrAngle->GetValue();
if(aTemp<45)
aTemp += 360;
aTemp -= 45;
maMtrTrgrAngle->SetValue(aTemp);
ExecuteValueModify( nStartCol, nEndCol );
}
} } // end of namespace svx::sidebar
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -1,79 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_SVX_SOURCE_SIDEBAR_AREA_AREATRANSPARENCYGRADIENTCONTROL_HXX
#define INCLUDED_SVX_SOURCE_SIDEBAR_AREA_AREATRANSPARENCYGRADIENTCONTROL_HXX
#include <vcl/fixed.hxx>
#include <vcl/field.hxx>
#include <vcl/toolbox.hxx>
#include <svx/xenum.hxx>
#include <com/sun/star/awt/GradientStyle.hpp>
class XFillFloatTransparenceItem;
class SfxBindings;
namespace svx { namespace sidebar {
class AreaPropertyPanelBase;
class AreaTransparencyGradientControl : public Control
{
public:
AreaTransparencyGradientControl (
vcl::Window* pParent,
AreaPropertyPanelBase& rPanel);
virtual ~AreaTransparencyGradientControl() override;
virtual void dispose() override;
void Rearrange(XFillFloatTransparenceItem* pGradientItem);
void InitStatus(XFillFloatTransparenceItem* pGradientItem);
void ExecuteValueModify( sal_uInt8 nStartCol, sal_uInt8 nEndCol );
private:
VclPtr<FixedText> maFtTrgrCenterX;
VclPtr<MetricField> maMtrTrgrCenterX;
VclPtr<FixedText> maFtTrgrCenterY;
VclPtr<MetricField> maMtrTrgrCenterY;
VclPtr<FixedText> maFtTrgrAngle;
VclPtr<MetricField> maMtrTrgrAngle;
VclPtr<ToolBox> maBtnLeft45;
VclPtr<ToolBox> maBtnRight45;
VclPtr<FixedText> maFtTrgrStartValue;
VclPtr<MetricField> maMtrTrgrStartValue;
VclPtr<FixedText> maFtTrgrEndValue;
VclPtr<MetricField> maMtrTrgrEndValue;
VclPtr<FixedText> maFtTrgrBorder;
VclPtr<MetricField> maMtrTrgrBorder;
Image maRotLeft;
Image maRotRight;
AreaPropertyPanelBase& mrAreaPropertyPanel;
DECL_LINK( ModifiedTrgrHdl_Impl, Edit&, void );
DECL_LINK( Left_Click45_Impl, ToolBox*, void );
DECL_LINK( Right_Click45_Impl, ToolBox*, void );
};
} } // end of namespace svx::sidebar
#endif // INCLUDED_SVX_SOURCE_SIDEBAR_AREA_AREATRANSPARENCYGRADIENTCONTROL_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -16,15 +16,39 @@
* except in compliance with the License. You may obtain a copy of * except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include <sfx2/app.hxx>
#include <svx/sidebar/AreaTransparencyGradientPopup.hxx> #include <svx/sidebar/AreaTransparencyGradientPopup.hxx>
#include "AreaTransparencyGradientControl.hxx" #include <svx/sidebar/AreaPropertyPanelBase.hxx>
#include <svx/xflftrit.hxx>
#include <svx/xgrad.hxx>
namespace svx { namespace sidebar { namespace svx { namespace sidebar {
AreaTransparencyGradientPopup::AreaTransparencyGradientPopup(vcl::Window* pParent, AreaPropertyPanelBase& rPanel) AreaTransparencyGradientPopup::AreaTransparencyGradientPopup(AreaPropertyPanelBase& rPanel)
: FloatingWindow(pParent, WB_BORDER | WB_SYSTEMWINDOW) : FloatingWindow(SfxGetpApp()->GetTopWindow(), "FloatingAreaStyle", "svx/ui/floatingareastyle.ui")
, m_xControl(VclPtr<AreaTransparencyGradientControl>::Create(this, rPanel)) , mrAreaPropertyPanel(rPanel)
{ {
get(maCenterGrid, "centergrid");
get(maAngleGrid, "anglegrid");
get(maMtrTrgrCenterX, "centerx");
get(maMtrTrgrCenterY, "centery");
get(maMtrTrgrAngle, "angle");
get(maBtnLeft45, "lefttoolbox");
get(maBtnRight45, "righttoolbox");
get(maMtrTrgrStartValue, "start");
get(maMtrTrgrEndValue, "end");
get(maMtrTrgrBorder, "border");
Link<Edit&,void> aLink = LINK(this, AreaTransparencyGradientPopup, ModifiedTrgrHdl_Impl);
maMtrTrgrCenterX->SetModifyHdl(aLink);
maMtrTrgrCenterY->SetModifyHdl(aLink);
maMtrTrgrAngle->SetModifyHdl(aLink);
maMtrTrgrBorder->SetModifyHdl(aLink);
maMtrTrgrStartValue->SetModifyHdl(aLink);
maMtrTrgrEndValue->SetModifyHdl(aLink);
maBtnLeft45->SetSelectHdl(LINK(this, AreaTransparencyGradientPopup, Left_Click45_Impl));
maBtnRight45->SetSelectHdl(LINK(this, AreaTransparencyGradientPopup, Right_Click45_Impl));
} }
AreaTransparencyGradientPopup::~AreaTransparencyGradientPopup() AreaTransparencyGradientPopup::~AreaTransparencyGradientPopup()
@@ -32,15 +56,135 @@ AreaTransparencyGradientPopup::~AreaTransparencyGradientPopup()
disposeOnce(); disposeOnce();
} }
void AreaTransparencyGradientPopup::Rearrange(XFillFloatTransparenceItem* pItem) void AreaTransparencyGradientPopup::InitStatus(XFillFloatTransparenceItem* pGradientItem)
{ {
m_xControl->Rearrange(pItem); const XGradient& rGradient = pGradientItem->GetGradientValue();
SetSizePixel(m_xControl->GetOutputSizePixel());
XGradient aGradient;
if (rGradient.GetXOffset() == AreaPropertyPanelBase::DEFAULT_CENTERX
&& rGradient.GetYOffset() == AreaPropertyPanelBase::DEFAULT_CENTERY
&& (rGradient.GetAngle() / 10) == AreaPropertyPanelBase::DEFAULT_ANGLE
&& ((sal_uInt16)((((sal_uInt16)rGradient.GetStartColor().GetRed() + 1) * 100) / 255))
== AreaPropertyPanelBase::DEFAULT_STARTVALUE
&& ((sal_uInt16)((((sal_uInt16)rGradient.GetEndColor().GetRed() + 1) * 100) / 255))
== AreaPropertyPanelBase::DEFAULT_ENDVALUE
&& rGradient.GetBorder() == AreaPropertyPanelBase::DEFAULT_BORDER)
{
aGradient = mrAreaPropertyPanel.GetGradient(rGradient.GetGradientStyle());
}
else
{
aGradient = rGradient;
}
maMtrTrgrCenterX->SetValue(aGradient.GetXOffset());
maMtrTrgrCenterY->SetValue(aGradient.GetYOffset());
maMtrTrgrAngle->SetValue(aGradient.GetAngle() / 10);
maMtrTrgrStartValue->SetValue((sal_uInt16)((((sal_uInt16)aGradient.GetStartColor().GetRed() + 1) * 100) / 255));
maMtrTrgrEndValue->SetValue((sal_uInt16)((((sal_uInt16)aGradient.GetEndColor().GetRed() + 1) * 100) / 255));
maMtrTrgrBorder->SetValue(aGradient.GetBorder());
}
void AreaTransparencyGradientPopup::Rearrange(XFillFloatTransparenceItem* pGradientItem)
{
InitStatus(pGradientItem);
const XGradient& rGradient = pGradientItem->GetGradientValue();
css::awt::GradientStyle eXGS(rGradient.GetGradientStyle());
switch(eXGS)
{
case css::awt::GradientStyle_LINEAR:
case css::awt::GradientStyle_AXIAL:
maCenterGrid->Hide();
maAngleGrid->Show();
break;
case css::awt::GradientStyle_RADIAL:
maCenterGrid->Show();
maAngleGrid->Hide();
break;
case css::awt::GradientStyle_ELLIPTICAL:
case css::awt::GradientStyle_SQUARE:
case css::awt::GradientStyle_RECT:
maCenterGrid->Show();
maAngleGrid->Show();
break;
default:
break;
}
}
void AreaTransparencyGradientPopup::ExecuteValueModify(sal_uInt8 nStartCol, sal_uInt8 nEndCol)
{
//Added
sal_Int16 aMtrValue = (sal_Int16)maMtrTrgrAngle->GetValue();
while(aMtrValue<0)
aMtrValue += 360;
sal_uInt16 nVal = aMtrValue/360;
nVal = aMtrValue - nVal*360;
maMtrTrgrAngle->SetValue(nVal);
//End of new code
XGradient aTmpGradient(
Color(nStartCol, nStartCol, nStartCol),
Color(nEndCol, nEndCol, nEndCol),
(css::awt::GradientStyle)(mrAreaPropertyPanel.GetSelectedTransparencyTypeIndex()-2),
(sal_uInt16)maMtrTrgrAngle->GetValue() * 10,
(sal_uInt16)maMtrTrgrCenterX->GetValue(),
(sal_uInt16)maMtrTrgrCenterY->GetValue(),
(sal_uInt16)maMtrTrgrBorder->GetValue(),
100, 100);
mrAreaPropertyPanel.SetGradient(aTmpGradient);
SfxItemPool* pPool = nullptr;
bool bEnable = true;
XFillFloatTransparenceItem aGradientItem(pPool, aTmpGradient, bEnable );
mrAreaPropertyPanel.setFillFloatTransparence(aGradientItem);
}
IMPL_LINK_NOARG(AreaTransparencyGradientPopup, ModifiedTrgrHdl_Impl, Edit&, void)
{
sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrStartValue->GetValue() * 255) / 100);
sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrEndValue->GetValue() * 255) / 100);
ExecuteValueModify( nStartCol, nEndCol );
}
IMPL_LINK_NOARG(AreaTransparencyGradientPopup, Left_Click45_Impl, ToolBox *, void)
{
sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrStartValue->GetValue() * 255) / 100);
sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrEndValue->GetValue() * 255) / 100);
sal_uInt16 nTemp = (sal_uInt16)maMtrTrgrAngle->GetValue();
if (nTemp>=315)
nTemp -= 360;
nTemp += 45;
maMtrTrgrAngle->SetValue(nTemp);
ExecuteValueModify(nStartCol, nEndCol);
}
IMPL_LINK_NOARG(AreaTransparencyGradientPopup, Right_Click45_Impl, ToolBox *, void)
{
sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrStartValue->GetValue() * 255) / 100);
sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrEndValue->GetValue() * 255) / 100);
sal_uInt16 nTemp = (sal_uInt16)maMtrTrgrAngle->GetValue();
if (nTemp<45)
nTemp += 360;
nTemp -= 45;
maMtrTrgrAngle->SetValue(nTemp);
ExecuteValueModify(nStartCol, nEndCol);
} }
void AreaTransparencyGradientPopup::dispose() void AreaTransparencyGradientPopup::dispose()
{ {
m_xControl.disposeAndClear(); maCenterGrid.clear();
maAngleGrid.clear();
maMtrTrgrCenterX.clear();
maMtrTrgrCenterY.clear();
maMtrTrgrAngle.clear();
maBtnLeft45.clear();
maBtnRight45.clear();
maMtrTrgrStartValue.clear();
maMtrTrgrEndValue.clear();
maMtrTrgrBorder.clear();
FloatingWindow::dispose(); FloatingWindow::dispose();
} }

View File

@@ -0,0 +1,308 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">359</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
<object class="GtkAdjustment" id="adjustment2">
<property name="upper">100</property>
<property name="step_increment">5</property>
<property name="page_increment">10</property>
</object>
<object class="GtkWindow" id="FloatingAreaStyle">
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="border_width">4</property>
<property name="resizable">False</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">popup-menu</property>
<property name="skip_pager_hint">True</property>
<property name="deletable">False</property>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="orientation">vertical</property>
<property name="row_spacing">12</property>
<child>
<object class="GtkGrid" id="anglegrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">_Angle:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">angle:0degrees</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="column_spacing">12</property>
<property name="column_homogeneous">True</property>
<child>
<object class="GtkSpinButton" id="angle:0degrees">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Specify the angle of rotation for the gradient shading style.</property>
<property name="adjustment">adjustment1</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkToolbar" id="lefttoolbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkToolButton" id="left">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Rotate counterclockwise by 45 degrees.</property>
<property name="icon_name">svx/res/symphony/rotate_left.png</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkToolbar" id="righttoolbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkToolButton" id="right">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Rotate clockwise by 45 degrees.</property>
<property name="icon_name">svx/res/symphony/rotate_right.png</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">_Start value:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">start:0%</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">_End value:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">end:0%</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="start:0%">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Enter a transparency value for the beginning point of the gradient, where 0% is fully opaque and 100% is fully transparent.</property>
<property name="adjustment">adjustment2</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="end:0%">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Enter a transparency value for the endpoint of the gradient, where 0% is fully opaque and 100% is fully transparent.</property>
<property name="text" translatable="yes">0</property>
<property name="adjustment">adjustment2</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">_Border:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">border:0%</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="border:0%">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Specify the border value of gradient transparency.</property>
<property name="text" translatable="yes">0</property>
<property name="adjustment">adjustment2</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="centergrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">Center _X:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">centerx:0%</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">Center _Y:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">centery:0%</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="centerx:0%">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Specify the horizontal offset percentage from the center for the gradient shading style. 50% is the horizontal center.</property>
<property name="text" translatable="yes">0</property>
<property name="adjustment">adjustment2</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="centery:0%">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Specify the vertical offset percentage from the center for the gradient shading style. 50% is the vertical center.</property>
<property name="text" translatable="yes">0</property>
<property name="adjustment">adjustment2</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
</child>
</object>
</interface>