From c7a2bbfa34233953fb7e675ec9ecd22c4ea96e1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Thu, 6 Oct 2016 10:36:33 +0100 Subject: [PATCH] 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 --- include/svx/dialogs.hrc | 4 - include/svx/sidebar/AreaPropertyPanelBase.hxx | 2 - .../sidebar/AreaTransparencyGradientPopup.hxx | 23 +- svx/Library_svx.mk | 1 - svx/UIConfig_svx.mk | 1 + svx/source/sidebar/area/AreaPropertyPanel.cxx | 1 - svx/source/sidebar/area/AreaPropertyPanel.hrc | 2 - svx/source/sidebar/area/AreaPropertyPanel.src | 179 ---------- .../sidebar/area/AreaPropertyPanelBase.cxx | 5 +- .../area/AreaTransparencyGradientControl.cxx | 327 ------------------ .../area/AreaTransparencyGradientControl.hxx | 79 ----- .../area/AreaTransparencyGradientPopup.cxx | 160 ++++++++- svx/uiconfig/ui/floatingareastyle.ui | 308 +++++++++++++++++ 13 files changed, 484 insertions(+), 608 deletions(-) delete mode 100644 svx/source/sidebar/area/AreaTransparencyGradientControl.cxx delete mode 100644 svx/source/sidebar/area/AreaTransparencyGradientControl.hxx create mode 100644 svx/uiconfig/ui/floatingareastyle.ui diff --git a/include/svx/dialogs.hrc b/include/svx/dialogs.hrc index 68d27d30aad9..c6aa5c25005f 100644 --- a/include/svx/dialogs.hrc +++ b/include/svx/dialogs.hrc @@ -197,8 +197,6 @@ #define RID_SVXIMG_NOTCHECKED (RID_SVX_START + 243) #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_EMPTY_PANEL (RID_SVX_START + 327) @@ -1007,8 +1005,6 @@ #define IMG_RADIAL (RID_SVX_SIDEBAR_BEGIN + 33) #define IMG_SQUARE (RID_SVX_SIDEBAR_BEGIN + 34) #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_SVXIMG_GREENCHECK (RID_SVX_START + 1280) diff --git a/include/svx/sidebar/AreaPropertyPanelBase.hxx b/include/svx/sidebar/AreaPropertyPanelBase.hxx index 18c58176bb7a..46ff5a4af928 100644 --- a/include/svx/sidebar/AreaPropertyPanelBase.hxx +++ b/include/svx/sidebar/AreaPropertyPanelBase.hxx @@ -53,8 +53,6 @@ class XFillBitmapItem; namespace svx { namespace sidebar { -class AreaTransparencyGradientControl; - class SVX_DLLPUBLIC AreaPropertyPanelBase : public PanelLayout, public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface diff --git a/include/svx/sidebar/AreaTransparencyGradientPopup.hxx b/include/svx/sidebar/AreaTransparencyGradientPopup.hxx index 519224b66786..833d6d8bb9f5 100644 --- a/include/svx/sidebar/AreaTransparencyGradientPopup.hxx +++ b/include/svx/sidebar/AreaTransparencyGradientPopup.hxx @@ -19,7 +19,10 @@ #ifndef INCLUDED_SVX_SOURCE_SIDEBAR_AREA_AREATRANSPARENCYGRADIENTPOPUP_HXX #define INCLUDED_SVX_SOURCE_SIDEBAR_AREA_AREATRANSPARENCYGRADIENTPOPUP_HXX +#include +#include #include +#include class XFillFloatTransparenceItem; @@ -31,9 +34,25 @@ class AreaPropertyPanelBase; class AreaTransparencyGradientPopup : public FloatingWindow { private: - VclPtr m_xControl; + AreaPropertyPanelBase& mrAreaPropertyPanel; + VclPtr maCenterGrid; + VclPtr maAngleGrid; + VclPtr maMtrTrgrCenterX; + VclPtr maMtrTrgrCenterY; + VclPtr maMtrTrgrAngle; + VclPtr maBtnLeft45; + VclPtr maBtnRight45; + VclPtr maMtrTrgrStartValue; + VclPtr maMtrTrgrEndValue; + VclPtr 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: - AreaTransparencyGradientPopup(vcl::Window* pParent, AreaPropertyPanelBase& rPanel); + AreaTransparencyGradientPopup(AreaPropertyPanelBase& rPanel); virtual ~AreaTransparencyGradientPopup() override; void Rearrange (XFillFloatTransparenceItem* pItem); virtual void dispose() override; diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk index 3f801e7e4bec..e564af8401fd 100644 --- a/svx/Library_svx.mk +++ b/svx/Library_svx.mk @@ -193,7 +193,6 @@ $(eval $(call gb_Library_add_exception_objects,svx,\ svx/source/sidebar/paragraph/ParaSpacingControl \ svx/source/sidebar/area/AreaPropertyPanel \ svx/source/sidebar/area/AreaPropertyPanelBase \ - svx/source/sidebar/area/AreaTransparencyGradientControl \ svx/source/sidebar/area/AreaTransparencyGradientPopup \ svx/source/sidebar/shadow/ShadowPropertyPanel \ svx/source/sidebar/graphic/GraphicPropertyPanel \ diff --git a/svx/UIConfig_svx.mk b/svx/UIConfig_svx.mk index 502e8801881a..bd9c6d8ba288 100644 --- a/svx/UIConfig_svx.mk +++ b/svx/UIConfig_svx.mk @@ -36,6 +36,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\ svx/uiconfig/ui/docrecoverysavedialog \ svx/uiconfig/ui/extrustiondepthdialog \ svx/uiconfig/ui/findreplacedialog \ + svx/uiconfig/ui/floatingareastyle \ svx/uiconfig/ui/floatingcontour \ svx/uiconfig/ui/floatinglineproperty \ svx/uiconfig/ui/floatingundoredo \ diff --git a/svx/source/sidebar/area/AreaPropertyPanel.cxx b/svx/source/sidebar/area/AreaPropertyPanel.cxx index e2610a71d352..e5f762b107bf 100644 --- a/svx/source/sidebar/area/AreaPropertyPanel.cxx +++ b/svx/source/sidebar/area/AreaPropertyPanel.cxx @@ -16,7 +16,6 @@ * 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 #include diff --git a/svx/source/sidebar/area/AreaPropertyPanel.hrc b/svx/source/sidebar/area/AreaPropertyPanel.hrc index d627b637d923..fabe3738274e 100644 --- a/svx/source/sidebar/area/AreaPropertyPanel.hrc +++ b/svx/source/sidebar/area/AreaPropertyPanel.hrc @@ -34,8 +34,6 @@ #define MTR_TRGR_END_VALUE 18 #define FT_TRGR_BORDER 19 #define MTR_TRGR_BORDER 20 -#define STR_HELP_LEFT 24 -#define STR_HELP_RIGHT 25 #define BTN_LEFT_SECOND 22 #define BTN_RIGHT_FIRST 23 diff --git a/svx/source/sidebar/area/AreaPropertyPanel.src b/svx/source/sidebar/area/AreaPropertyPanel.src index 555273c1d292..205de67adc91 100644 --- a/svx/source/sidebar/area/AreaPropertyPanel.src +++ b/svx/source/sidebar/area/AreaPropertyPanel.src @@ -45,184 +45,5 @@ Image IMG_LINEAR { 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: */ diff --git a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx index a62d414ae0ae..7de151ce5624 100644 --- a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx +++ b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx @@ -16,7 +16,6 @@ * 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 #include @@ -1322,10 +1321,10 @@ IMPL_LINK_NOARG(AreaPropertyPanelBase, ModifyTransSliderHdl, Slider*, void) IMPL_LINK( AreaPropertyPanelBase, ClickTrGrHdl_Impl, ToolBox*, pToolBox, void ) { if (!mxTrGrPopup) - mxTrGrPopup = VclPtr::Create(pToolBox, *this); + mxTrGrPopup = VclPtr::Create(*this); mxTrGrPopup->Rearrange(mpFloatTransparenceItem.get()); 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) diff --git a/svx/source/sidebar/area/AreaTransparencyGradientControl.cxx b/svx/source/sidebar/area/AreaTransparencyGradientControl.cxx deleted file mode 100644 index 922f104b6e6e..000000000000 --- a/svx/source/sidebar/area/AreaTransparencyGradientControl.cxx +++ /dev/null @@ -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 -#include "AreaPropertyPanel.hrc" - -#include -#include -#include -#include -#include -#include - -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::Create(this, SVX_RES(FT_TRGR_CENTER_X))), - maMtrTrgrCenterX(VclPtr::Create(this, SVX_RES(MTR_TRGR_CENTER_X))), - maFtTrgrCenterY(VclPtr::Create(this, SVX_RES(FT_TRGR_CENTER_Y))), - maMtrTrgrCenterY(VclPtr::Create(this, SVX_RES(MTR_TRGR_CENTER_Y))), - maFtTrgrAngle(VclPtr::Create(this, SVX_RES(FT_TRGR_ANGLE))), - maMtrTrgrAngle(VclPtr::Create(this, SVX_RES(MTR_TRGR_ANGLE))), - maBtnLeft45(VclPtr::Create(this, SVX_RES(BTN_LEFT_SECOND))), - maBtnRight45(VclPtr::Create(this, SVX_RES(BTN_RIGHT_FIRST))), - maFtTrgrStartValue(VclPtr::Create(this, SVX_RES(FT_TRGR_START_VALUE))), - maMtrTrgrStartValue(VclPtr::Create(this, SVX_RES(MTR_TRGR_START_VALUE))), - maFtTrgrEndValue(VclPtr::Create(this, SVX_RES(FT_TRGR_END_VALUE))), - maMtrTrgrEndValue(VclPtr::Create(this, SVX_RES(MTR_TRGR_END_VALUE))), - maFtTrgrBorder(VclPtr::Create(this, SVX_RES(FT_TRGR_BORDER))), - maMtrTrgrBorder(VclPtr::Create(this, SVX_RES(MTR_TRGR_BORDER))), - maRotLeft( SVX_RES(IMG_ROT_LEFT)), - maRotRight( SVX_RES(IMG_ROT_RIGHT)), - mrAreaPropertyPanel(rPanel) -{ - Link 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: */ diff --git a/svx/source/sidebar/area/AreaTransparencyGradientControl.hxx b/svx/source/sidebar/area/AreaTransparencyGradientControl.hxx deleted file mode 100644 index 452da99030a5..000000000000 --- a/svx/source/sidebar/area/AreaTransparencyGradientControl.hxx +++ /dev/null @@ -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 -#include -#include -#include -#include - -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 maFtTrgrCenterX; - VclPtr maMtrTrgrCenterX; - VclPtr maFtTrgrCenterY; - VclPtr maMtrTrgrCenterY; - VclPtr maFtTrgrAngle; - VclPtr maMtrTrgrAngle; - VclPtr maBtnLeft45; - VclPtr maBtnRight45; - VclPtr maFtTrgrStartValue; - VclPtr maMtrTrgrStartValue; - VclPtr maFtTrgrEndValue; - VclPtr maMtrTrgrEndValue; - VclPtr maFtTrgrBorder; - VclPtr 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: */ diff --git a/svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx b/svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx index 0e646833711d..f05087ec039f 100644 --- a/svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx +++ b/svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx @@ -16,15 +16,39 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ + +#include #include -#include "AreaTransparencyGradientControl.hxx" +#include +#include +#include namespace svx { namespace sidebar { -AreaTransparencyGradientPopup::AreaTransparencyGradientPopup(vcl::Window* pParent, AreaPropertyPanelBase& rPanel) - : FloatingWindow(pParent, WB_BORDER | WB_SYSTEMWINDOW) - , m_xControl(VclPtr::Create(this, rPanel)) +AreaTransparencyGradientPopup::AreaTransparencyGradientPopup(AreaPropertyPanelBase& rPanel) + : FloatingWindow(SfxGetpApp()->GetTopWindow(), "FloatingAreaStyle", "svx/ui/floatingareastyle.ui") + , 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 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() @@ -32,15 +56,135 @@ AreaTransparencyGradientPopup::~AreaTransparencyGradientPopup() disposeOnce(); } -void AreaTransparencyGradientPopup::Rearrange(XFillFloatTransparenceItem* pItem) +void AreaTransparencyGradientPopup::InitStatus(XFillFloatTransparenceItem* pGradientItem) { - m_xControl->Rearrange(pItem); - SetSizePixel(m_xControl->GetOutputSizePixel()); + 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 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() { - 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(); } diff --git a/svx/uiconfig/ui/floatingareastyle.ui b/svx/uiconfig/ui/floatingareastyle.ui new file mode 100644 index 000000000000..74da941bdc24 --- /dev/null +++ b/svx/uiconfig/ui/floatingareastyle.ui @@ -0,0 +1,308 @@ + + + + + + 359 + 1 + 10 + + + 100 + 5 + 10 + + + False + True + True + 4 + False + True + popup-menu + True + False + + + True + False + True + True + vertical + 12 + + + True + False + 6 + + + True + False + start + _Angle: + True + angle:0degrees + + + 0 + 0 + + + + + True + False + 12 + True + + + True + True + Specify the angle of rotation for the gradient shading style. + adjustment1 + + + 0 + 0 + + + + + True + False + + + True + False + + + True + False + Rotate counterclockwise by 45 degrees. + svx/res/symphony/rotate_left.png + + + False + True + + + + + 0 + 0 + + + + + True + False + + + True + False + Rotate clockwise by 45 degrees. + svx/res/symphony/rotate_right.png + + + False + True + + + + + 1 + 0 + + + + + 1 + 0 + + + + + 0 + 1 + + + + + 0 + 1 + + + + + True + False + 6 + 12 + + + True + False + start + _Start value: + True + start:0% + + + 0 + 0 + + + + + True + False + start + _End value: + True + end:0% + + + 1 + 0 + + + + + True + True + Enter a transparency value for the beginning point of the gradient, where 0% is fully opaque and 100% is fully transparent. + adjustment2 + + + 0 + 1 + + + + + True + True + Enter a transparency value for the endpoint of the gradient, where 0% is fully opaque and 100% is fully transparent. + 0 + adjustment2 + + + 1 + 1 + + + + + 0 + 2 + + + + + True + False + 6 + + + True + False + start + _Border: + True + border:0% + + + 0 + 0 + + + + + True + True + Specify the border value of gradient transparency. + 0 + adjustment2 + + + 0 + 1 + + + + + 0 + 3 + + + + + True + False + 6 + 12 + + + True + False + start + Center _X: + True + centerx:0% + + + 0 + 0 + + + + + True + False + start + Center _Y: + True + centery:0% + + + 1 + 0 + + + + + True + True + Specify the horizontal offset percentage from the center for the gradient shading style. 50% is the horizontal center. + 0 + adjustment2 + + + 0 + 1 + + + + + True + True + Specify the vertical offset percentage from the center for the gradient shading style. 50% is the vertical center. + 0 + adjustment2 + + + 1 + 1 + + + + + 0 + 0 + + + + + +