diff options
-rw-r--r-- | cui/source/tabpages/tpshadow.cxx | 5 | ||||
-rw-r--r-- | include/svx/svxids.hrc | 6 | ||||
-rw-r--r-- | officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu | 32 | ||||
-rw-r--r-- | sc/sdi/drawsh.sdi | 8 | ||||
-rw-r--r-- | sc/source/ui/app/typemap.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/drawsh.cxx | 9 | ||||
-rw-r--r-- | sd/sdi/_drvwsh.sdi | 20 | ||||
-rw-r--r-- | sd/source/ui/view/drviews2.cxx | 8 | ||||
-rw-r--r-- | sd/source/ui/view/drviewsf.cxx | 4 | ||||
-rw-r--r-- | svx/Library_svx.mk | 1 | ||||
-rw-r--r-- | svx/UIConfig_svx.mk | 1 | ||||
-rw-r--r-- | svx/sdi/svx.sdi | 108 | ||||
-rw-r--r-- | svx/sdi/svxitems.sdi | 3 | ||||
-rw-r--r-- | svx/source/sidebar/PanelFactory.cxx | 5 | ||||
-rw-r--r-- | svx/source/sidebar/shadow/ShadowPropertyPanel.cxx | 383 | ||||
-rw-r--r-- | svx/source/sidebar/shadow/ShadowPropertyPanel.hxx | 97 | ||||
-rw-r--r-- | svx/source/svdraw/svdattr.cxx | 4 | ||||
-rw-r--r-- | svx/uiconfig/ui/sidebarshadow.ui | 210 |
18 files changed, 903 insertions, 3 deletions
diff --git a/cui/source/tabpages/tpshadow.cxx b/cui/source/tabpages/tpshadow.cxx index 67abb5de2f59..dd6db29a9e29 100644 --- a/cui/source/tabpages/tpshadow.cxx +++ b/cui/source/tabpages/tpshadow.cxx @@ -41,7 +41,10 @@ const sal_uInt16 SvxShadowTabPage::pShadowRanges[] = SDRATTR_SHADOWCOLOR, SDRATTR_SHADOWTRANSPARENCE, SID_ATTR_FILL_SHADOW, - SID_ATTR_FILL_SHADOW, + SID_ATTR_SHADOW_COLOR, + SID_ATTR_SHADOW_TRANSPARENCE, + SID_ATTR_SHADOW_XDISTANCE, + SID_ATTR_SHADOW_YDISTANCE, 0 }; diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc index 81cecffa5627..f59e3e4db035 100644 --- a/include/svx/svxids.hrc +++ b/include/svx/svxids.hrc @@ -1008,8 +1008,12 @@ #define SID_PARASPACE_DECREASE ( SID_SVX_START + 1146 ) #define SID_OBJECT_CROP ( SID_SVX_START + 1147 ) +#define SID_ATTR_SHADOW_TRANSPARENCE ( SID_SVX_START + 1148 ) +#define SID_ATTR_SHADOW_COLOR ( SID_SVX_START + 1149 ) +#define SID_ATTR_SHADOW_XDISTANCE ( SID_SVX_START + 1150 ) +#define SID_ATTR_SHADOW_YDISTANCE ( SID_SVX_START + 1151 ) -#define SID_EDIT_POSTIT ( SID_SVX_START + 1148 ) +#define SID_EDIT_POSTIT ( SID_SVX_START + 1152 ) // IMPORTANT NOTE: adjust SID_SVX_FIRSTFREE, when adding new slot id #define SID_SVX_FIRSTFREE (SID_EDIT_POSTIT + 1) diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu index 653d826a2ccb..e20b1b0cfe8a 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu @@ -368,6 +368,38 @@ </prop> </node> + <node oor:name="ShadowPropertyPanel" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Shadow</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>ShadowPropertyPanel</value> + </prop> + <prop oor:name="DeckId" oor:type="xs:string"> + <value>PropertyDeck</value> + </prop> + <prop oor:name="DefaultMenuCommand"> + <value>.uno:FormatArea</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + Calc, Draw, visible ; + Calc, OLE, hidden ; + DrawImpress, 3DObject, visible ; + DrawImpress, Draw, visible ; + DrawImpress, Graphic, hidden ; + DrawImpress, TextObject, hidden ; + DrawImpress, OLE, hidden ; + </value> + </prop> + <prop oor:name="ImplementationURL" oor:type="xs:string"> + <value>private:resource/toolpanel/SvxPanelFactory/ShadowPropertyPanel</value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>300</value> + </prop> + </node> + <node oor:name="LinePropertyPanel" oor:op="replace"> <prop oor:name="Title" oor:type="xs:string"> <value xml:lang="en-US">Line</value> diff --git a/sc/sdi/drawsh.sdi b/sc/sdi/drawsh.sdi index d4a1eec593f1..7fb2639ef6ea 100644 --- a/sc/sdi/drawsh.sdi +++ b/sc/sdi/drawsh.sdi @@ -72,6 +72,14 @@ interface TableDraw StateMethod = GetDrawAttrState; Export = FALSE; ] + SID_ATTR_SHADOW_COLOR + [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ] + SID_ATTR_SHADOW_TRANSPARENCE + [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ] + SID_ATTR_SHADOW_XDISTANCE + [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ] + SID_ATTR_SHADOW_YDISTANCE + [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ] SID_ATTR_FILL_COLOR [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ] SID_ATTR_FILL_GRADIENT [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ] diff --git a/sc/source/ui/app/typemap.cxx b/sc/source/ui/app/typemap.cxx index 171e4c3980ee..e2f0fbfc3be3 100644 --- a/sc/source/ui/app/typemap.cxx +++ b/sc/source/ui/app/typemap.cxx @@ -96,6 +96,8 @@ #include <avmedia/mediaitem.hxx> #include <sfx2/frame.hxx> #include "attrib.hxx" +#include <svx/sdprcitm.hxx> +#include <svx/sdmetitm.hxx> #define SvxDrawToolItem SfxAllEnumItem #define SvxDrawAlignItem SfxAllEnumItem diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx index b1bf52957ada..3958b3745709 100644 --- a/sc/source/ui/drawfunc/drawsh.cxx +++ b/sc/source/ui/drawfunc/drawsh.cxx @@ -147,6 +147,10 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq ) // #i25616# case SID_ATTR_FILL_SHADOW: + case SID_ATTR_SHADOW_TRANSPARENCE: + case SID_ATTR_SHADOW_COLOR: + case SID_ATTR_SHADOW_XDISTANCE: + case SID_ATTR_SHADOW_YDISTANCE: { // Wenn ToolBar vertikal : if ( !rReq.GetArgs() ) @@ -173,7 +177,10 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq ) // #i25616# case SID_ATTR_FILL_SHADOW: - + case SID_ATTR_SHADOW_TRANSPARENCE: + case SID_ATTR_SHADOW_COLOR: + case SID_ATTR_SHADOW_XDISTANCE: + case SID_ATTR_SHADOW_YDISTANCE: ExecuteAreaDlg( rReq ); break; diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi index 6b2f17ccbe08..827bdff668e4 100644 --- a/sd/sdi/_drvwsh.sdi +++ b/sd/sdi/_drvwsh.sdi @@ -1849,6 +1849,26 @@ interface DrawView ExecMethod = FuTemporary ; StateMethod = GetAttrState ; ] + SID_ATTR_SHADOW_COLOR + [ + ExecMethod = FuTemporary ; + StateMethod = GetAttrState ; + ] + SID_ATTR_SHADOW_TRANSPARENCE + [ + ExecMethod = FuTemporary ; + StateMethod = GetAttrState ; + ] + SID_ATTR_SHADOW_XDISTANCE + [ + ExecMethod = FuTemporary; + StateMethod = GetAttrState; + ] + SID_ATTR_SHADOW_YDISTANCE + [ + ExecMethod = FuTemporary; + StateMethod = GetAttrState; + ] SID_ATTR_TEXT_FITTOSIZE // ole : no, status : ? [ ExecMethod = FuTemporary ; diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index 90c3d599291d..83262d4999c7 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -243,6 +243,10 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) case SID_ATTR_FILL_HATCH: case SID_ATTR_FILL_BITMAP: case SID_ATTR_FILL_SHADOW: + case SID_ATTR_SHADOW_COLOR: + case SID_ATTR_SHADOW_TRANSPARENCE: + case SID_ATTR_SHADOW_XDISTANCE: + case SID_ATTR_SHADOW_YDISTANCE: case SID_ATTR_FILL_TRANSPARENCE: case SID_ATTR_FILL_FLOATTRANSPARENCE: @@ -269,6 +273,10 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) switch( rReq.GetSlot() ) { case SID_ATTR_FILL_SHADOW: + case SID_ATTR_SHADOW_COLOR: + case SID_ATTR_SHADOW_TRANSPARENCE: + case SID_ATTR_SHADOW_XDISTANCE: + case SID_ATTR_SHADOW_YDISTANCE: case SID_ATTR_FILL_STYLE: case SID_ATTR_FILL_COLOR: case SID_ATTR_FILL_GRADIENT: diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx index f92c0f0fa9b7..aada4c5cdc37 100644 --- a/sd/source/ui/view/drviewsf.cxx +++ b/sd/source/ui/view/drviewsf.cxx @@ -390,6 +390,10 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet ) case SID_ATTR_FILL_HATCH: case SID_ATTR_FILL_BITMAP: case SID_ATTR_FILL_SHADOW: + case SID_ATTR_SHADOW_COLOR: + case SID_ATTR_SHADOW_TRANSPARENCE: + case SID_ATTR_SHADOW_XDISTANCE: + case SID_ATTR_SHADOW_YDISTANCE: case SID_ATTR_FILL_TRANSPARENCE: case SID_ATTR_FILL_FLOATTRANSPARENCE: case SID_ATTR_LINE_STYLE: diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk index 7cc76cb00650..44ea48a62320 100644 --- a/svx/Library_svx.mk +++ b/svx/Library_svx.mk @@ -189,6 +189,7 @@ $(eval $(call gb_Library_add_exception_objects,svx,\ svx/source/sidebar/area/AreaPropertyPanel \ svx/source/sidebar/area/AreaTransparencyGradientControl \ svx/source/sidebar/area/AreaTransparencyGradientPopup \ + svx/source/sidebar/shadow/ShadowPropertyPanel \ svx/source/sidebar/graphic/GraphicPropertyPanel \ svx/source/sidebar/line/LinePropertyPanel \ svx/source/sidebar/line/LineWidthControl \ diff --git a/svx/UIConfig_svx.mk b/svx/UIConfig_svx.mk index ba19a9c14d3c..650ecf917408 100644 --- a/svx/UIConfig_svx.mk +++ b/svx/UIConfig_svx.mk @@ -59,6 +59,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\ svx/uiconfig/ui/redlineviewpage \ svx/uiconfig/ui/savemodifieddialog \ svx/uiconfig/ui/sidebararea \ + svx/uiconfig/ui/sidebarshadow \ svx/uiconfig/ui/sidebargraphic \ svx/uiconfig/ui/sidebarinsert \ svx/uiconfig/ui/sidebarline \ diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index b301c58b1176..ec3bbec8d89c 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -10375,6 +10375,7 @@ SdrOnOffItem FillShadow SID_ATTR_FILL_SHADOW [ /* flags: */ + AutoUpdate = TRUE, Cachable = Cachable, FastCall = FALSE, @@ -10397,6 +10398,113 @@ SdrOnOffItem FillShadow SID_ATTR_FILL_SHADOW GroupId = GID_DOCUMENT; ] +XColorItem FillShadowColor SID_ATTR_SHADOW_COLOR + +[ + /* flags: */ + + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_DOCUMENT; +] + +SdrPercentItem FillShadowTransparency SID_ATTR_SHADOW_TRANSPARENCE + +[ + /* flags: */ + + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_DOCUMENT; +] + +SdrMetricItem FillShadowXDistance SID_ATTR_SHADOW_XDISTANCE + +[ + /* flags: */ + + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_DOCUMENT; +] + +SdrMetricItem FillShadowYDistance SID_ATTR_SHADOW_YDISTANCE + +[ + /* flags: */ + + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_DOCUMENT; +] SvxShadowedItem Shadowed SID_ATTR_CHAR_SHADOWED diff --git a/svx/sdi/svxitems.sdi b/svx/sdi/svxitems.sdi index 6887062ebdfb..5664a2b77173 100644 --- a/svx/sdi/svxitems.sdi +++ b/svx/sdi/svxitems.sdi @@ -362,6 +362,9 @@ item String SvxBitmapListItem; item String SfxLockBytesItem; item String SvxFontListItem; item String avmedia_MediaItem; +item INT32 XColorItem; +item INT16 SdrPercentItem; +item INT32 SdrMetricItem; item BYTE SfxGlobalNameItem; diff --git a/svx/source/sidebar/PanelFactory.cxx b/svx/source/sidebar/PanelFactory.cxx index a89b9e0282a3..a1c479855d52 100644 --- a/svx/source/sidebar/PanelFactory.cxx +++ b/svx/source/sidebar/PanelFactory.cxx @@ -21,6 +21,7 @@ #include "styles/StylesPropertyPanel.hxx" #include "paragraph/ParaPropertyPanel.hxx" #include "area/AreaPropertyPanel.hxx" +#include "shadow/ShadowPropertyPanel.hxx" #include "graphic/GraphicPropertyPanel.hxx" #include "line/LinePropertyPanel.hxx" #include "possize/PosSizePropertyPanel.hxx" @@ -157,6 +158,10 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement ( { pControl = AreaPropertyPanel::Create(pParentWindow, xFrame, pBindings); } + else if (rsResourceURL.endsWith("/ShadowPropertyPanel")) + { + pControl = ShadowPropertyPanel::Create(pParentWindow, xFrame, pBindings); + } else if (rsResourceURL.endsWith("/GraphicPropertyPanel")) { pControl = GraphicPropertyPanel::Create(pParentWindow, xFrame, pBindings); diff --git a/svx/source/sidebar/shadow/ShadowPropertyPanel.cxx b/svx/source/sidebar/shadow/ShadowPropertyPanel.cxx new file mode 100644 index 000000000000..bfb1d0a8f73c --- /dev/null +++ b/svx/source/sidebar/shadow/ShadowPropertyPanel.cxx @@ -0,0 +1,383 @@ +#include <ShadowPropertyPanel.hxx> +#include <comphelper/string.hxx> +#include <sfx2/sidebar/ControlFactory.hxx> +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <sfx2/sidebar/Theme.hxx> +#include <svx/dialogs.hrc> +#include <svx/dialmgr.hxx> +#include <sfx2/objsh.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <svx/xlineit0.hxx> +#include <svx/xtable.hxx> +#include <svtools/valueset.hxx> +#include <unotools/pathoptions.hxx> +#include <boost/bind.hpp> +#include <svx/xattr.hxx> +#include <svx/svddef.hxx> +#include <svx/sdooitm.hxx> +#include <svx/sdshitm.hxx> +#include <svx/sdshtitm.hxx> +#include <svx/sdprcitm.hxx> +#include <svx/sdsxyitm.hxx> +#include <svx/svdmodel.hxx> +#include <svx/drawitem.hxx> +#include <svx/sdshcitm.hxx> + +using namespace css; +using namespace css::uno; +using sfx2::sidebar::Theme; + + +namespace svx { namespace sidebar { + +ShadowPropertyPanel::ShadowPropertyPanel( + vcl::Window* pParent, + const uno::Reference<frame::XFrame>& rxFrame, + SfxBindings* pBindings) +: PanelLayout(pParent, "ShadowPropertyPanel", "svx/ui/sidebarshadow.ui", rxFrame), + maShadowController(SID_ATTR_FILL_SHADOW, *pBindings, *this), + maShadowTransController(SID_ATTR_SHADOW_TRANSPARENCE, *pBindings, *this), + maShadowColorController(SID_ATTR_SHADOW_COLOR, *pBindings, *this), + maShadowXDistanceController(SID_ATTR_SHADOW_XDISTANCE, *pBindings, *this), + maShadowYDistanceController(SID_ATTR_SHADOW_YDISTANCE, *pBindings, *this), + mxFrame(rxFrame), + mpBindings(pBindings) +{ + get(mpShowShadow,"SHOW_SHADOW"); + get(mpFTAngle,"angle"); + get(mpShadowAngle,"LB_ANGLE"); + get(mpFTDistance,"distance"); + get(mpShadowDistance,"LB_DISTANCE"); + get(mpFTTransparency,"transparency_label"); + get(mpShadowTransSlider,"transparency_slider"); + get(mpShadowTransMetric,"FIELD_TRANSPARENCY"); + get(mpFTColor,"color"); + get(mpLBShadowColor,"LB_SHADOW_COLOR"); + + Initialize(); +} + +ShadowPropertyPanel::~ShadowPropertyPanel() +{ + disposeOnce(); +} + +void ShadowPropertyPanel::dispose() +{ + mpShowShadow.clear(); + mpFTAngle.clear(); + mpShadowAngle.clear(); + mpFTDistance.clear(); + mpShadowDistance.clear(); + mpFTTransparency.clear(); + mpShadowTransSlider.clear(); + mpShadowTransMetric.clear(); + mpFTColor.clear(); + mpLBShadowColor.clear(); + + maShadowController.dispose(); + maShadowTransController.dispose(); + maShadowColorController.dispose(); + maShadowXDistanceController.dispose(); + maShadowYDistanceController.dispose(); + PanelLayout::dispose(); +} + +void ShadowPropertyPanel::Initialize() +{ + SfxObjectShell* pDocSh = SfxObjectShell::Current(); + const SfxPoolItem* pItem = pDocSh->GetItem(SID_COLOR_TABLE); + pColorList = static_cast<const SvxColorListItem*>(pItem) ->GetColorList(); + mpLBShadowColor->Fill(pColorList); + mpShowShadow->SetState( TRISTATE_FALSE ); + Link<> bLink = LINK(this, ShadowPropertyPanel, ClickShadowHdl ); + mpShowShadow->SetClickHdl( bLink ); + Link<> aLink = LINK( this, ShadowPropertyPanel, ModifyShadowColorHdl ); + mpShadowTransMetric->SetMax(100); + mpShadowTransMetric->SetModifyHdl( LINK(this, ShadowPropertyPanel, ModifyShadowTransMetricHdl) ); + mpLBShadowColor->SetSelectHdl( aLink ); + mpShadowAngle->SetModifyHdl( LINK(this, ShadowPropertyPanel, ModifyShadowDistanceHdl) ); + mpShadowDistance->SetModifyHdl( LINK(this, ShadowPropertyPanel, ModifyShadowDistanceHdl) ); + mpShadowTransSlider->SetRange(Range(0,100)); + mpShadowTransSlider->SetUpdateMode(true); + mpShadowTransSlider->SetSlideHdl( LINK(this, ShadowPropertyPanel, ModifyShadowTransSliderHdl) ); + SetupIcons(); + InsertDistanceValues(); + InsertAngleValues(); +} + +IMPL_LINK_NOARG(ShadowPropertyPanel, ClickShadowHdl) +{ + if( mpShowShadow->GetState() == TRISTATE_FALSE ) + { + SdrOnOffItem aItem(makeSdrShadowItem(false)); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_SHADOW, SfxCallMode::RECORD, &aItem, 0L); + } + + else + { + SdrOnOffItem aItem(makeSdrShadowItem(true)); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_SHADOW, SfxCallMode::RECORD, &aItem, 0L); + } + + return 0L; +} + +IMPL_LINK_NOARG(ShadowPropertyPanel, ModifyShadowColorHdl) +{ + XColorItem aItem(makeSdrShadowColorItem(mpLBShadowColor->GetSelectEntryColor())); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_SHADOW_COLOR, SfxCallMode::RECORD, &aItem, 0L); + return 0; +} + +IMPL_LINK_NOARG(ShadowPropertyPanel, ModifyShadowTransMetricHdl) +{ + sal_uInt16 nVal = mpShadowTransMetric->GetValue(); + SetTransparencyValue(nVal); + SdrPercentItem aItem( makeSdrShadowTransparenceItem(nVal) ); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_SHADOW_TRANSPARENCE, SfxCallMode::RECORD, &aItem , 0L); + return 0; +} + +IMPL_LINK_NOARG(ShadowPropertyPanel, ModifyShadowTransSliderHdl) +{ + sal_uInt16 nVal = mpShadowTransSlider->GetThumbPos(); + SetTransparencyValue(nVal); + SdrPercentItem aItem( makeSdrShadowTransparenceItem(nVal) ); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_SHADOW_TRANSPARENCE, SfxCallMode::RECORD, &aItem, 0L); + return 0; +} + +IMPL_LINK_NOARG(ShadowPropertyPanel, ModifyShadowDistanceHdl) +{ + OUString sAngle = mpShadowAngle->GetText(); + nXY = mpShadowDistance->GetValue(FUNIT_100TH_MM); + switch(ParseText(sAngle)) + { + case 0: nX = nXY; nY = 0; break; + case 45: nX = nXY; nY = -nXY; break; + case 90: nX = 0; nY = - nXY; break; + case 135: nX = nY = -nXY; break; + case 180: nX = -nXY; nY = 0; break; + case 225: nX = -nXY; nY = nXY; break; + case 270: nX = 0; nY = nXY; break; + case 315: nX = nY = nXY; break; + } + SdrMetricItem aXItem(makeSdrShadowXDistItem(nX)); + SdrMetricItem aYItem(makeSdrShadowYDistItem(nY)); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_SHADOW_XDISTANCE, SfxCallMode::RECORD, &aXItem, 0L); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_SHADOW_YDISTANCE, SfxCallMode::RECORD, &aYItem, 0L); + return 0; +} + +sal_uInt32 ShadowPropertyPanel::ParseText(OUString sTmp) +{ + if (sTmp.isEmpty()) + return 0; + sal_Unicode nChar = sTmp[0]; + if( nChar == '-' ) + { + if (sTmp.getLength() < 2) + return 0; + nChar = sTmp[1]; + } + + if( (nChar < '0') || (nChar > '9') ) + return 0; + + const LocaleDataWrapper& rLocaleWrapper( Application::GetSettings().GetLocaleDataWrapper() ); + const sal_Unicode cSep = rLocaleWrapper.getNumDecimalSep()[0]; + + rtl_math_ConversionStatus eStatus; + double fTmp = rtl::math::stringToDouble( sTmp, cSep, 0, &eStatus); + if (eStatus != rtl_math_ConversionStatus_Ok) + return 0; + + return fTmp; + +} + +void ShadowPropertyPanel::UpdateControls() +{ + if(mpShowShadow->GetState() == TRISTATE_FALSE) + { + mpShadowDistance->Disable(); + mpLBShadowColor->Disable(); + mpShadowAngle->Disable(); + mpFTAngle->Disable(); + mpFTDistance->Disable(); + mpFTTransparency->Disable(); + mpFTColor->Disable(); + mpShadowTransSlider->Disable(); + mpShadowTransMetric->Disable(); + return; + } + else + { + mpShadowDistance->Enable(); + mpLBShadowColor->Enable(); + mpShadowAngle->Enable(); + mpFTAngle->Enable(); + mpFTDistance->Enable(); + mpFTTransparency->Enable(); + mpFTColor->Enable(); + mpShadowTransSlider->Enable(); + mpShadowTransMetric->Enable(); + } + + if(nX > 0 && nY == 0) { mpShadowAngle->SelectEntryPos(0); nXY = nX; } + else if( nX > 0 && nY < 0 ) { mpShadowAngle->SelectEntryPos(1); nXY = nX; } + else if( nX == 0 && nY < 0 ) { mpShadowAngle->SelectEntryPos(2); nXY = -nY; } + else if( nX < 0 && nY < 0 ) { mpShadowAngle->SelectEntryPos(3); nXY = -nY; } + else if( nX < 0 && nY == 0 ) { mpShadowAngle->SelectEntryPos(4); nXY = -nX; } + else if( nX < 0 && nY > 0 ) { mpShadowAngle->SelectEntryPos(5); nXY = nY; } + else if( nX == 0 && nY > 0 ) { mpShadowAngle->SelectEntryPos(6); nXY = nY; } + else if( nX > 0 && nY > 0 ) { mpShadowAngle->SelectEntryPos(7); nXY = nX; } + else { nXY = 0; } + mpShadowDistance->SetValue(nXY, FUNIT_100TH_MM); +} + +void ShadowPropertyPanel::SetTransparencyValue(long nVal) +{ + mpShadowTransSlider->SetThumbPos(nVal); + mpShadowTransMetric->SetValue(nVal); +} + +void ShadowPropertyPanel::SetupIcons() +{ + if(Theme::GetBoolean(Theme::Bool_UseSymphonyIcons)) + { + // todo + } + else + { + // todo + } +} + +void ShadowPropertyPanel::DataChanged(const DataChangedEvent& /*rEvent*/) +{ + SetupIcons(); +} + +void ShadowPropertyPanel::InsertDistanceValues() +{ + for(sal_uInt16 i = 0; i <= 20 ; i++) + mpShadowDistance->InsertValue(i*2,FUNIT_POINT); +} + +void ShadowPropertyPanel::InsertAngleValues() +{ + mpShadowAngle->InsertValue(0, FUNIT_CUSTOM); + mpShadowAngle->InsertValue(45, FUNIT_CUSTOM); + mpShadowAngle->InsertValue(90, FUNIT_CUSTOM); + mpShadowAngle->InsertValue(135, FUNIT_CUSTOM); + mpShadowAngle->InsertValue(180, FUNIT_CUSTOM); + mpShadowAngle->InsertValue(225,FUNIT_CUSTOM); + mpShadowAngle->InsertValue(270, FUNIT_CUSTOM); + mpShadowAngle->InsertValue(315,FUNIT_CUSTOM); +} + +void ShadowPropertyPanel::NotifyItemUpdate( + sal_uInt16 nSID, + SfxItemState eState, + const SfxPoolItem* pState, + const bool /*bIsEnabled*/) +{ + switch(nSID) + { + case SID_ATTR_FILL_SHADOW: + { + if(eState >= SfxItemState::DEFAULT) + { + const SdrOnOffItem* pItem = dynamic_cast< const SdrOnOffItem* >(pState); + if(pItem) + { + if(pItem->GetValue()) + mpShowShadow->SetState( TRISTATE_TRUE ); + else + mpShowShadow->SetState( TRISTATE_FALSE ); + } + else + mpShowShadow.reset(); + } + } + break; + + case SID_ATTR_SHADOW_TRANSPARENCE: + { + if(eState >= SfxItemState::DEFAULT) + { + const SdrPercentItem* pTransparencyItem = dynamic_cast< const SdrPercentItem* >(pState); + if(pTransparencyItem) + { + const sal_uInt16 nVal = pTransparencyItem->GetValue(); + SetTransparencyValue(nVal); + } + else + SetTransparencyValue(0); + } + } + break; + + case SID_ATTR_SHADOW_COLOR: + { + if(eState >= SfxItemState::DEFAULT) + { + const XColorItem* pColorItem = dynamic_cast< const XColorItem* >(pState); + if(pColorItem) + { + mpLBShadowColor->SelectEntry(pColorItem->GetColorValue()); + } + else + { + } + } + } + break; + case SID_ATTR_SHADOW_XDISTANCE: + { + if(eState >= SfxItemState::DEFAULT) + { + const SdrMetricItem* pXDistItem = dynamic_cast< const SdrMetricItem* >(pState); + if(pXDistItem) + { + nX = pXDistItem->GetValue(); + } + } + } + break; + case SID_ATTR_SHADOW_YDISTANCE: + { + if(eState >= SfxItemState::DEFAULT) + { + const SdrMetricItem* pYDistItem = dynamic_cast< const SdrMetricItem* >(pState); + if(pYDistItem) + { + nY = pYDistItem->GetValue(); + } + } + } + break; + } + UpdateControls(); +} + +VclPtr<vcl::Window> ShadowPropertyPanel::Create ( + vcl::Window* pParent, + const uno::Reference<frame::XFrame>& rxFrame, + SfxBindings* pBindings) +{ + if(pParent == NULL) + throw lang::IllegalArgumentException("no parent Window given to ShadowPropertyPanel::Create", NULL, 0); + if( !rxFrame.is() ) + throw lang::IllegalArgumentException("no XFrame given to ShadowPropertyPanel::Create", NULL, 1); + if(pBindings == NULL) + throw lang::IllegalArgumentException("no SfxBindings given to ShadowPropertyPanel::Create", NULL, 2); + + return VclPtr<ShadowPropertyPanel>::Create(pParent, rxFrame, pBindings); +} +} + +} diff --git a/svx/source/sidebar/shadow/ShadowPropertyPanel.hxx b/svx/source/sidebar/shadow/ShadowPropertyPanel.hxx new file mode 100644 index 000000000000..c32f327232c9 --- /dev/null +++ b/svx/source/sidebar/shadow/ShadowPropertyPanel.hxx @@ -0,0 +1,97 @@ +#ifndef INCLUDED_SVX_SOURCE_SIDEBAR_AREA_SHADOWPROPERTYPANEL_HXX +#define INCLUDED_SVX_SOURCE_SIDEBAR_AREA_SHADOWPROPERTYPANEL_HXX + +#include <vcl/slider.hxx> +#include <vcl/button.hxx> +#include <vcl/fixed.hxx> +#include <vcl/vclptr.hxx> +#include <sfx2/sidebar/SidebarPanelBase.hxx> +#include <vcl/ctrl.hxx> +#include <sfx2/sidebar/ControllerItem.hxx> +#include <svx/sidebar/PanelLayout.hxx> +#include <svl/intitem.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/field.hxx> +#include <vcl/slider.hxx> +#include <boost/scoped_ptr.hpp> +#include <com/sun/star/ui/XUIElement.hpp> +#include <sfx2/request.hxx> +#include <svx/dlgctrl.hxx> + + + +namespace svx { namespace sidebar { + +class ShadowPropertyPanel +: public PanelLayout, + public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface +{ +public: + virtual ~ShadowPropertyPanel(); + virtual void dispose() SAL_OVERRIDE; + + static VclPtr<vcl::Window> Create( + vcl::Window* pParent, + const css::uno::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + + virtual void DataChanged( + const DataChangedEvent& rEvent) SAL_OVERRIDE; + + virtual void NotifyItemUpdate( + const sal_uInt16 nSId, + const SfxItemState eState, + const SfxPoolItem* pState, + const bool bIsEnabled) SAL_OVERRIDE; + + SfxBindings* GetBindings() { return mpBindings;} + + void Initialize(); + + ShadowPropertyPanel( + vcl::Window* pParent, + const css::uno::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + +private: + VclPtr<CheckBox> mpShowShadow; + VclPtr<MetricBox> mpShadowDistance; + VclPtr<ColorLB> mpLBShadowColor; + VclPtr<MetricBox> mpShadowAngle; + VclPtr<FixedText> mpFTAngle; + VclPtr<FixedText> mpFTDistance; + VclPtr<FixedText> mpFTTransparency; + VclPtr<FixedText> mpFTColor; + VclPtr<Slider> mpShadowTransSlider; + VclPtr<MetricField> mpShadowTransMetric; + XColorListRef pColorList; + bool bDisabled; + + ::sfx2::sidebar::ControllerItem maShadowController; + ::sfx2::sidebar::ControllerItem maShadowTransController; + ::sfx2::sidebar::ControllerItem maShadowColorController; + ::sfx2::sidebar::ControllerItem maShadowXDistanceController; + ::sfx2::sidebar::ControllerItem maShadowYDistanceController; + + css::uno::Reference<css::frame::XFrame> mxFrame; + + SfxBindings* mpBindings; + long nX,nY,nXY; + + static void SetupIcons(); + void InsertDistanceValues(); + void InsertAngleValues(); + void SetTransparencyValue(long); + void UpdateControls(); + sal_uInt32 ParseText(OUString pStr); + DECL_LINK(ClickShadowHdl, void*); + DECL_LINK(ModifyShadowColorHdl, void*); + DECL_LINK(ModifyShadowTransMetricHdl, void*); + DECL_LINK(ModifyShadowDistanceHdl, void*); + DECL_LINK(ModifyShadowTransSliderHdl, void*); +}; +} +} + +#endif + diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx index 18368c537d32..2b2269268745 100644 --- a/svx/source/svdraw/svdattr.cxx +++ b/svx/source/svdraw/svdattr.cxx @@ -323,6 +323,10 @@ SdrItemPool::SdrItemPool( // set own ItemInfos mpLocalItemInfos[SDRATTR_SHADOW-SDRATTR_START]._nSID=SID_ATTR_FILL_SHADOW; + mpLocalItemInfos[SDRATTR_SHADOWCOLOR-SDRATTR_START]._nSID=SID_ATTR_SHADOW_COLOR; + mpLocalItemInfos[SDRATTR_SHADOWTRANSPARENCE-SDRATTR_START]._nSID=SID_ATTR_SHADOW_TRANSPARENCE; + mpLocalItemInfos[SDRATTR_SHADOWXDIST-SDRATTR_START]._nSID=SID_ATTR_SHADOW_XDISTANCE; + mpLocalItemInfos[SDRATTR_SHADOWYDIST-SDRATTR_START]._nSID=SID_ATTR_SHADOW_YDISTANCE; mpLocalItemInfos[SDRATTR_TEXT_FITTOSIZE-SDRATTR_START]._nSID=SID_ATTR_TEXT_FITTOSIZE; mpLocalItemInfos[SDRATTR_GRAFCROP-SDRATTR_START]._nSID=SID_ATTR_GRAF_CROP; diff --git a/svx/uiconfig/ui/sidebarshadow.ui b/svx/uiconfig/ui/sidebarshadow.ui new file mode 100644 index 000000000000..1eca4d95e932 --- /dev/null +++ b/svx/uiconfig/ui/sidebarshadow.ui @@ -0,0 +1,210 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.18.3 --> +<interface> + <requires lib="gtk+" version="3.0"/> + <object class="GtkAdjustment" id="adjustment1"> + <property name="lower">-180</property> + <property name="upper">360</property> + </object> + <object class="GtkGrid" id="ShadowPropertyPanel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkGrid" id="grid3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="border_width">6</property> + <child> + <object class="GtkBox" id="box2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child> + <object class="GtkCheckButton" id="SHOW_SHADOW"> + <property name="label" translatable="yes">Enable</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkGrid" id="grid1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="row_spacing">6</property> + <property name="column_spacing">6</property> + <child> + <object class="GtkLabel" id="angle"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Angle</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="distance"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Distance</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="VclComboBoxNumeric" id="LB_ANGLE:0degrees"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="adjustment">adjustment1</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="VclComboBoxNumeric" id="LB_DISTANCE:0pt"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <child> + <object class="GtkLabel" id="transparency_label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Transparency:</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkGrid" id="grid2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="column_spacing">6</property> + <child> + <object class="GtkSpinButton" id="FIELD_TRANSPARENCY:0%"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="halign">end</property> + </object> + <packing> + <property name="left_attach">2</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkScale" id="transparency_slider"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="round_digits">1</property> + <property name="draw_value">False</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">2</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkGrid" id="grid4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="column_spacing">6</property> + <child> + <object class="GtkLabel" id="color"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="label" translatable="yes">Color:</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="svxlo-ColorLB" id="LB_SHADOW_COLOR"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">end</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + </object> +</interface> |