diff --git a/chart2/source/controller/sidebar/ChartColorWrapper.cxx b/chart2/source/controller/sidebar/ChartColorWrapper.cxx index 189b55059492..9a8c568a863d 100644 --- a/chart2/source/controller/sidebar/ChartColorWrapper.cxx +++ b/chart2/source/controller/sidebar/ChartColorWrapper.cxx @@ -10,11 +10,17 @@ #include "ChartColorWrapper.hxx" #include +#include #include +#include +#include #include #include +#include #include +#include +#include namespace chart::sidebar { @@ -104,6 +110,101 @@ void ChartColorWrapper::updateData() mpControl->statusChanged(aEvent); } +ChartLineStyleWrapper::ChartLineStyleWrapper( + css::uno::Reference const & xModel, + SvxLineStyleToolBoxControl* pControl) + : mxModel(xModel) + , mpControl(pControl) +{ +} + +void ChartLineStyleWrapper::updateModel(const css::uno::Reference& xModel) +{ + mxModel = xModel; +} + +namespace +{ + css::uno::Any getLineDash( + const css::uno::Reference& xModel, const OUString& rDashName) + { + css::uno::Reference xFact(xModel, css::uno::UNO_QUERY); + css::uno::Reference xNameAccess( + xFact->createInstance("com.sun.star.drawing.DashTable"), + css::uno::UNO_QUERY ); + if(xNameAccess.is()) + { + if (!xNameAccess->hasByName(rDashName)) + return css::uno::Any(); + + return xNameAccess->getByName(rDashName); + } + + return css::uno::Any(); + } +} + +void ChartLineStyleWrapper::updateData() +{ + css::uno::Reference xPropSet = getPropSet(mxModel); + if (!xPropSet.is()) + return; + + css::util::URL aUrl; + aUrl.Complete = ".uno:XLineStyle"; + + css::frame::FeatureStateEvent aEvent; + aEvent.IsEnabled = true; + + aEvent.FeatureURL = aUrl; + aEvent.State = xPropSet->getPropertyValue("LineStyle"); + mpControl->statusChanged(aEvent); + + aUrl.Complete = ".uno:LineDash"; + + auto aLineDashName = xPropSet->getPropertyValue("LineDashName"); + OUString aDashName; + aLineDashName >>= aDashName; + css::uno::Any aLineDash = getLineDash(mxModel, aDashName); + XLineDashItem aDashItem; + aDashItem.PutValue(aLineDash, MID_LINEDASH); + + aEvent.FeatureURL = aUrl; + aDashItem.QueryValue(aEvent.State); + mpControl->statusChanged(aEvent); +} + +bool ChartLineStyleWrapper::operator()(const OUString& rCommand, const css::uno::Any& rValue) +{ + css::uno::Reference xPropSet = getPropSet(mxModel); + + if (!xPropSet.is()) + { + SAL_WARN("chart2", "Invalid reference to xPropSet"); + return false; + } + + if (rCommand == ".uno:XLineStyle") + { + xPropSet->setPropertyValue("LineStyle", rValue); + return true; + } + else if (rCommand == ".uno:LineDash") + { + XLineDashItem aDashItem; + aDashItem.PutValue(rValue, 0); + css::uno::Any aAny; + aDashItem.QueryValue(aAny, MID_LINEDASH); + OUString aDashName = PropertyHelper::addLineDashUniqueNameToTable(aAny, + css::uno::Reference(mxModel, css::uno::UNO_QUERY), + ""); + xPropSet->setPropertyValue("LineDash", aAny); + xPropSet->setPropertyValue("LineDashName", css::uno::Any(aDashName)); + return true; + } + return false; +} + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/sidebar/ChartColorWrapper.hxx b/chart2/source/controller/sidebar/ChartColorWrapper.hxx index 05b0e9f38fea..8f16c1b1dd33 100644 --- a/chart2/source/controller/sidebar/ChartColorWrapper.hxx +++ b/chart2/source/controller/sidebar/ChartColorWrapper.hxx @@ -16,13 +16,12 @@ namespace com { namespace sun { namespace star { namespace frame { class XModel; } } } } class SvxColorToolBoxControl; +class SvxLineStyleToolBoxControl; namespace chart { namespace sidebar { class ChartColorWrapper { -private: - public: ChartColorWrapper(css::uno::Reference const & xModel, SvxColorToolBoxControl* pControl, @@ -43,6 +42,25 @@ private: OUString maPropertyName; }; +class ChartLineStyleWrapper +{ +public: + ChartLineStyleWrapper(css::uno::Reference const & xModel, + SvxLineStyleToolBoxControl* pControl); + + bool operator()(const OUString& rCommand, const css::uno::Any& rValue); + + void updateModel(const css::uno::Reference& xModel); + + void updateData(); + +private: + + css::uno::Reference mxModel; + + SvxLineStyleToolBoxControl* mpControl; +}; + } } #endif diff --git a/chart2/source/controller/sidebar/ChartLinePanel.cxx b/chart2/source/controller/sidebar/ChartLinePanel.cxx index 2e410084466d..944b709cac56 100644 --- a/chart2/source/controller/sidebar/ChartLinePanel.cxx +++ b/chart2/source/controller/sidebar/ChartLinePanel.cxx @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -31,9 +32,16 @@ namespace chart::sidebar { namespace { -SvxColorToolBoxControl* getColorToolBoxControl(ToolbarUnoDispatcher& rToolBoxColor) +SvxLineStyleToolBoxControl* getLineStyleToolBoxControl(ToolbarUnoDispatcher& rToolBoxColor) { - css::uno::Reference xController = rToolBoxColor.GetControllerForCommand(".uno:XLineColor"); + css::uno::Reference xController = rToolBoxColor.GetControllerForCommand(".uno:XLineStyle"); + SvxLineStyleToolBoxControl* pToolBoxLineStyleControl = dynamic_cast(xController.get()); + return pToolBoxLineStyleControl; +} + +SvxColorToolBoxControl* getColorToolBoxControl(ToolbarUnoDispatcher& rToolBoxLineStyle) +{ + css::uno::Reference xController = rToolBoxLineStyle.GetControllerForCommand(".uno:XLineColor"); SvxColorToolBoxControl* pToolBoxColorControl = dynamic_cast(xController.get()); return pToolBoxColorControl; } @@ -76,24 +84,6 @@ css::uno::Reference getPropSet( return xPropSet; } -css::uno::Any getLineDash( - const css::uno::Reference& xModel, const OUString& rDashName) -{ - css::uno::Reference xFact(xModel, css::uno::UNO_QUERY); - css::uno::Reference xNameAccess( - xFact->createInstance("com.sun.star.drawing.DashTable"), - css::uno::UNO_QUERY ); - if(xNameAccess.is()) - { - if (!xNameAccess->hasByName(rDashName)) - return css::uno::Any(); - - return xNameAccess->getByName(rDashName); - } - - return css::uno::Any(); -} - class PreventUpdate { public: @@ -137,7 +127,8 @@ ChartLinePanel::ChartLinePanel(vcl::Window* pParent, mxSelectionListener(new ChartSidebarSelectionListener(this)), mbUpdate(true), mbModelValid(true), - maLineColorWrapper(mxModel, getColorToolBoxControl(*mxColorDispatch), "LineColor") + maLineColorWrapper(mxModel, getColorToolBoxControl(*mxColorDispatch), "LineColor"), + maLineStyleWrapper(mxModel, getLineStyleToolBoxControl(*mxLineStyleDispatch)) { disableArrowHead(); std::vector aAcceptedTypes { OBJECTTYPE_PAGE, OBJECTTYPE_DIAGRAM, @@ -177,6 +168,9 @@ void ChartLinePanel::Initialize() SvxColorToolBoxControl* pToolBoxColor = getColorToolBoxControl(*mxColorDispatch); pToolBoxColor->setColorSelectFunction(maLineColorWrapper); + SvxLineStyleToolBoxControl* pToolBoxLineStyle = getLineStyleToolBoxControl(*mxLineStyleDispatch); + pToolBoxLineStyle->setLineStyleSelectFunction(maLineStyleWrapper); + setMapUnit(MapUnit::Map100thMM); updateData(); } @@ -196,19 +190,7 @@ void ChartLinePanel::updateData() XLineTransparenceItem aLineTransparenceItem(nLineTransparence); updateLineTransparence(false, true, &aLineTransparenceItem); - css::drawing::LineStyle eStyle = css::drawing::LineStyle_SOLID; - xPropSet->getPropertyValue("LineStyle") >>= eStyle; - XLineStyleItem aStyleItem(eStyle); - updateLineStyle(false, true, &aStyleItem); - - css::uno::Any aLineDashName = xPropSet->getPropertyValue("LineDashName"); - OUString aDashName; - aLineDashName >>= aDashName; - css::uno::Any aLineDash = getLineDash(mxModel, aDashName); - XLineDashItem aDashItem; - aDashItem.PutValue(aLineDash, MID_LINEDASH); - updateLineDash(false, true, &aDashItem); - + maLineStyleWrapper.updateData(); maLineColorWrapper.updateData(); } @@ -235,6 +217,7 @@ void ChartLinePanel::updateModel( mxModel = xModel; mbModelValid = true; + maLineStyleWrapper.updateModel(mxModel); maLineColorWrapper.updateModel(mxModel); css::uno::Reference xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW); @@ -245,44 +228,6 @@ void ChartLinePanel::updateModel( xSelectionSupplier->addSelectionChangeListener(mxSelectionListener.get()); } -void ChartLinePanel::setLineStyle(const XLineStyleItem& rItem) -{ - css::uno::Reference xPropSet = - getPropSet(mxModel); - - if (!xPropSet.is()) - return; - - PreventUpdate aPreventUpdate(mbUpdate); - xPropSet->setPropertyValue("LineStyle", css::uno::Any(rItem.GetValue())); -} - -void ChartLinePanel::setLineDash(const XLineDashItem& rItem) -{ - css::uno::Reference xPropSet = - getPropSet(mxModel); - - if (!xPropSet.is()) - return; - - PreventUpdate aPreventUpdate(mbUpdate); - css::uno::Any aAny; - rItem.QueryValue(aAny, MID_LINEDASH); - OUString aDashName = PropertyHelper::addLineDashUniqueNameToTable(aAny, - css::uno::Reference(mxModel, css::uno::UNO_QUERY), - ""); - xPropSet->setPropertyValue("LineDash", aAny); - xPropSet->setPropertyValue("LineDashName", css::uno::Any(aDashName)); -} - -void ChartLinePanel::setLineEndStyle(const XLineEndItem* /*pItem*/) -{ -} - -void ChartLinePanel::setLineStartStyle(const XLineStartItem* /*pItem*/) -{ -} - void ChartLinePanel::setLineJoint(const XLineJointItem* pItem) { css::uno::Reference xPropSet = diff --git a/chart2/source/controller/sidebar/ChartLinePanel.hxx b/chart2/source/controller/sidebar/ChartLinePanel.hxx index c2e5d1fee7e1..2f1c520dd426 100644 --- a/chart2/source/controller/sidebar/ChartLinePanel.hxx +++ b/chart2/source/controller/sidebar/ChartLinePanel.hxx @@ -64,10 +64,6 @@ public: protected: - virtual void setLineStyle(const XLineStyleItem& rItem) override; - virtual void setLineDash(const XLineDashItem& rItem) override; - virtual void setLineEndStyle(const XLineEndItem* pItem) override; - virtual void setLineStartStyle(const XLineStartItem* pItem) override; virtual void setLineTransparency(const XLineTransparenceItem& rItem) override; virtual void setLineJoint(const XLineJointItem* pItem) override; virtual void setLineCap(const XLineCapItem* pItem) override; @@ -83,6 +79,7 @@ private: bool mbUpdate; bool mbModelValid; ChartColorWrapper maLineColorWrapper; + ChartLineStyleWrapper maLineStyleWrapper; }; } } // end of namespace svx::sidebar diff --git a/compilerplugins/clang/unusedfields.writeonly.results b/compilerplugins/clang/unusedfields.writeonly.results index 4f6409bb1e30..ba25b0627e70 100644 --- a/compilerplugins/clang/unusedfields.writeonly.results +++ b/compilerplugins/clang/unusedfields.writeonly.results @@ -772,8 +772,6 @@ svx/source/sidebar/line/LinePropertyPanel.hxx:85 svx::sidebar::LinePropertyPanel maStyleControl sfx2::sidebar::ControllerItem svx/source/sidebar/line/LinePropertyPanel.hxx:86 svx::sidebar::LinePropertyPanel maDashControl sfx2::sidebar::ControllerItem -svx/source/sidebar/line/LinePropertyPanel.hxx:91 - svx::sidebar::LinePropertyPanel maLineStyleListControl sfx2::sidebar::ControllerItem svx/source/sidebar/line/LinePropertyPanel.hxx:92 svx::sidebar::LinePropertyPanel maTransControl sfx2::sidebar::ControllerItem svx/source/sidebar/line/LinePropertyPanel.hxx:93 diff --git a/include/svx/itemwin.hxx b/include/svx/itemwin.hxx index 889a513586fe..e1a31d428724 100644 --- a/include/svx/itemwin.hxx +++ b/include/svx/itemwin.hxx @@ -20,40 +20,31 @@ #define INCLUDED_SVX_ITEMWIN_HXX #include - +#include #include #include class XLineWidthItem; class SfxObjectShell; +class SvtValueSet; +class SvxLineStyleToolBoxControl; -class SvxLineBox final : public ListBox +class SvxLineBox final : public WeldToolbarPopup { - sal_uInt16 nCurPos; - Timer aDelayTimer; - Size const aLogicalSize; - bool bRelease; - SfxObjectShell* mpSh; - css::uno::Reference< css::frame::XFrame > mxFrame; - - DECL_LINK(DelayHdl_Impl, Timer *, void); - - void ReleaseFocus_Impl(); - -public: - SvxLineBox( vcl::Window* pParent, - const css::uno::Reference< css::frame::XFrame >& rFrame ); + rtl::Reference mxControl; + std::unique_ptr mxLineStyleSet; + std::unique_ptr mxLineStyleSetWin; void FillControl(); - void Fill(const XDashListRef &pList); -private: - virtual void Select() override; - virtual bool PreNotify( NotifyEvent& rNEvt ) override; - virtual bool EventNotify( NotifyEvent& rNEvt ) override; - virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; + DECL_LINK(SelectHdl, SvtValueSet*, void); + virtual void GrabFocus() override; + +public: + SvxLineBox(SvxLineStyleToolBoxControl* pControl, weld::Widget* pParent, int nInitialIndex); + virtual ~SvxLineBox() override; }; class SVX_DLLPUBLIC SvxMetricField : public MetricField diff --git a/include/svx/linectrl.hxx b/include/svx/linectrl.hxx index 68f92e9a64fa..7fc9fc742cea 100644 --- a/include/svx/linectrl.hxx +++ b/include/svx/linectrl.hxx @@ -19,42 +19,58 @@ #ifndef INCLUDED_SVX_LINECTRL_HXX #define INCLUDED_SVX_LINECTRL_HXX - #include +#include #include #include +namespace svx { + class ToolboxButtonLineStyleUpdater; +} + class XLineStyleItem; class XLineDashItem; +typedef std::function LineStyleSelectFunction; // SvxLineStyleController: - - -class SVX_DLLPUBLIC SvxLineStyleToolBoxControl final : public SfxToolBoxControl +class SVX_DLLPUBLIC SvxLineStyleToolBoxControl final : public svt::PopupWindowController { private: std::unique_ptr pStyleItem; std::unique_ptr pDashItem; + std::unique_ptr m_xBtnUpdater; - bool bUpdate; + LineStyleSelectFunction m_aLineStyleSelectFunction; public: - SFX_DECL_TOOLBOX_CONTROL(); + SvxLineStyleToolBoxControl( const css::uno::Reference& rContext ); + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence& rArguments ) override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence SAL_CALL getSupportedServiceNames() override; + + virtual void SAL_CALL execute(sal_Int16 nKeyModifier) override; + virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent& rEvent) override; - SvxLineStyleToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); virtual ~SvxLineStyleToolBoxControl() override; - virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, - const SfxPoolItem* pState ) override; - void Update( const SfxPoolItem* pState ); - virtual VclPtr CreateItemWindow( vcl::Window *pParent ) override; + void setLineStyleSelectFunction(const LineStyleSelectFunction& aLineStyleSelectFunction); + void dispatchLineStyleCommand(const OUString& rCommand, const css::uno::Sequence& rArgs); + + int GetStyleIndex() const; + +private: + virtual std::unique_ptr weldPopupWindow() override; + virtual VclPtr createVclPopupWindow( vcl::Window* pParent ) override; + }; - // SvxLineWidthController: - class SVX_DLLPUBLIC SvxLineWidthToolBoxControl final : public SfxToolBoxControl { public: diff --git a/include/svx/sidebar/LinePropertyPanelBase.hxx b/include/svx/sidebar/LinePropertyPanelBase.hxx index 1a68126513cc..f8e534ddf1a4 100644 --- a/include/svx/sidebar/LinePropertyPanelBase.hxx +++ b/include/svx/sidebar/LinePropertyPanelBase.hxx @@ -45,15 +45,14 @@ namespace svx namespace sidebar { +class DisableArrowsWrapper; + class SVX_DLLPUBLIC LinePropertyPanelBase : public PanelLayout { public: virtual ~LinePropertyPanelBase() override; virtual void dispose() override; - virtual void DataChanged( - const DataChangedEvent& rEvent) override; - void SetWidth(long nWidth); void SetWidthIcon(int n); void SetWidthIcon(); @@ -67,28 +66,28 @@ public: virtual void setLineWidth(const XLineWidthItem& rItem) = 0; + void SetNoneLineStyle(bool bNoneLineStyle) + { + if (bNoneLineStyle != mbNoneLineStyle) + { + mbNoneLineStyle = bNoneLineStyle; + ActivateControls(); + } + } + protected: - virtual void setLineStyle(const XLineStyleItem& rItem) = 0; - virtual void setLineDash(const XLineDashItem& rItem) = 0; - virtual void setLineEndStyle(const XLineEndItem* pItem) = 0; - virtual void setLineStartStyle(const XLineStartItem* pItem) = 0; + void ActivateControls(); + virtual void setLineTransparency(const XLineTransparenceItem& rItem) = 0; virtual void setLineJoint(const XLineJointItem* pItem) = 0; virtual void setLineCap(const XLineCapItem* pItem) = 0; - void updateLineStyle(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem); - void updateLineDash(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem); void updateLineTransparence(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem); void updateLineWidth(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem); void updateLineJoint(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem); void updateLineCap(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem); - void FillLineStyleList(); - - void SelectLineStyle(); - void ActivateControls(); - void setMapUnit(MapUnit eMapUnit); void enableArrowHead(); @@ -99,15 +98,15 @@ protected: std::unique_ptr mxTBColor; std::unique_ptr mxColorDispatch; + std::unique_ptr mxLineStyleTB; + std::unique_ptr mxLineStyleDispatch; + private: //ui controls std::unique_ptr mxFTWidth; std::unique_ptr mxTBWidth; - std::unique_ptr mxLBStyle; std::unique_ptr mxFTTransparency; std::unique_ptr mxMFTransparent; - std::unique_ptr mxArrowsTB; - std::unique_ptr mxArrowsDispatch; std::unique_ptr mxFTEdgeStyle; std::unique_ptr mxLBEdgeStyle; std::unique_ptr mxFTCapStyle; @@ -117,13 +116,11 @@ private: //popup windows std::unique_ptr mxLineWidthPopup; - std::unique_ptr mpStyleItem; - std::unique_ptr mpDashItem; + std::unique_ptr mxDisableArrowsWrapper; sal_uInt16 mnTrans; MapUnit meMapUnit; sal_Int32 mnWidthCoreValue; - XDashListRef mxLineStyleList; // images from resource OUString maIMGNone; @@ -133,6 +130,7 @@ private: bool mbWidthValuable : 1; bool mbArrowSupported; + bool mbNoneLineStyle; void Initialize(); diff --git a/include/svx/tbxcolorupdate.hxx b/include/svx/tbxcolorupdate.hxx index 460635c0ac52..d9feb8da06f1 100644 --- a/include/svx/tbxcolorupdate.hxx +++ b/include/svx/tbxcolorupdate.hxx @@ -27,6 +27,8 @@ #include #include #include +#include +#include #include class ToolBox; @@ -122,6 +124,17 @@ namespace svx virtual vcl::ImageType GetImageSize() const override; virtual Size GetItemSize() const override; }; + + class ToolboxButtonLineStyleUpdater + { + private: + css::drawing::LineStyle m_eXLS; + int m_nDashStyleIndex; + public: + ToolboxButtonLineStyleUpdater(); + void Update(const css::frame::FeatureStateEvent& rEvent); + int GetStyleIndex() const; + }; } #endif // INCLUDED_SVX_TBXCOLORUPDATE_HXX diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu index bad60fb6b38f..8ed8d5c901de 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu @@ -1371,6 +1371,17 @@ com.sun.star.comp.svx.LineEndToolBoxControl + + + .uno:XLineStyle + + + + + + com.sun.star.comp.svx.LineStyleToolBoxControl + + .uno:LineSpacing diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx index dfcb7d5edc11..03d431fc2d5b 100644 --- a/sc/source/ui/app/scdll.cxx +++ b/sc/source/ui/app/scdll.cxx @@ -146,7 +146,6 @@ void ScDLL::Init() // SvxToolboxController SvxTbxCtlDraw ::RegisterControl(SID_INSERT_DRAW, pMod); SvxFillToolBoxControl ::RegisterControl(0, pMod); - SvxLineStyleToolBoxControl ::RegisterControl(0, pMod); SvxLineWidthToolBoxControl ::RegisterControl(0, pMod); SvxStyleToolBoxControl ::RegisterControl(SID_STYLE_APPLY, pMod); SvxClipBoardControl ::RegisterControl(SID_PASTE, pMod ); diff --git a/sd/source/ui/app/sddll.cxx b/sd/source/ui/app/sddll.cxx index a4805671b59e..4df9b7774d33 100644 --- a/sd/source/ui/app/sddll.cxx +++ b/sd/source/ui/app/sddll.cxx @@ -177,7 +177,6 @@ void SdDLL::RegisterControllers(SdModule* pMod) ::sfx2::sidebar::SidebarChildWindow::RegisterChildWindow(false, pMod); SvxFillToolBoxControl::RegisterControl(0, pMod); - SvxLineStyleToolBoxControl::RegisterControl(0, pMod); SvxLineWidthToolBoxControl::RegisterControl(0, pMod); SvxStyleToolBoxControl::RegisterControl(0, pMod); diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist index be77724e432c..4cb6e4feec2d 100644 --- a/solenv/clang-format/blacklist +++ b/solenv/clang-format/blacklist @@ -14444,6 +14444,7 @@ svx/source/tbxctrls/itemwin.cxx svx/source/tbxctrls/layctrl.cxx svx/source/tbxctrls/lboxctrl.cxx svx/source/tbxctrls/linectrl.cxx +svx/source/tbxctrls/linewidthctrl.cxx svx/source/tbxctrls/tbcontrl.cxx svx/source/tbxctrls/tbunocontroller.cxx svx/source/tbxctrls/tbunosearchcontrollers.cxx diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk index a2f22cd7c700..2b9b96f04a3b 100644 --- a/svx/Library_svx.mk +++ b/svx/Library_svx.mk @@ -232,7 +232,7 @@ $(eval $(call gb_Library_add_exception_objects,svx,\ svx/source/tbxctrls/itemwin \ svx/source/tbxctrls/layctrl \ svx/source/tbxctrls/lboxctrl \ - svx/source/tbxctrls/linectrl \ + svx/source/tbxctrls/linewidthctrl \ svx/source/tbxctrls/tbunocontroller \ svx/source/tbxctrls/tbunosearchcontrollers \ svx/source/tbxctrls/tbxcolor \ diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk index e07289cc80f7..cd3abc58e624 100644 --- a/svx/Library_svxcore.mk +++ b/svx/Library_svxcore.mk @@ -370,6 +370,7 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\ svx/source/table/viewcontactoftableobj \ svx/source/tbxctrls/extrusioncontrols \ svx/source/tbxctrls/fontworkgallery \ + svx/source/tbxctrls/linectrl \ svx/source/tbxctrls/Palette \ svx/source/tbxctrls/PaletteManager \ svx/source/tbxctrls/tbcontrl \ diff --git a/svx/UIConfig_svx.mk b/svx/UIConfig_svx.mk index dd0ac621adcc..3d52a8369b3f 100644 --- a/svx/UIConfig_svx.mk +++ b/svx/UIConfig_svx.mk @@ -51,6 +51,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\ svx/uiconfig/ui/floatingframeborder \ svx/uiconfig/ui/floatinglineend \ svx/uiconfig/ui/floatinglineproperty \ + svx/uiconfig/ui/floatinglinestyle \ svx/uiconfig/ui/floatingundoredo \ svx/uiconfig/ui/fontworkgallerydialog \ svx/uiconfig/ui/fontworkspacingdialog \ diff --git a/svx/source/sidebar/line/LinePropertyPanel.cxx b/svx/source/sidebar/line/LinePropertyPanel.cxx index cf6dc5505f72..bd0fde7a8674 100644 --- a/svx/source/sidebar/line/LinePropertyPanel.cxx +++ b/svx/source/sidebar/line/LinePropertyPanel.cxx @@ -54,7 +54,6 @@ LinePropertyPanel::LinePropertyPanel( maStyleControl(SID_ATTR_LINE_STYLE, *pBindings, *this), maDashControl (SID_ATTR_LINE_DASH, *pBindings, *this), maWidthControl(SID_ATTR_LINE_WIDTH, *pBindings, *this), - maLineStyleListControl(SID_DASH_LIST, *pBindings, *this), maTransControl(SID_ATTR_LINE_TRANSPARENCE, *pBindings, *this), maEdgeStyle(SID_ATTR_LINE_JOINT, *pBindings, *this), maCapStyle(SID_ATTR_LINE_CAP, *pBindings, *this), @@ -74,7 +73,6 @@ void LinePropertyPanel::dispose() maStyleControl.dispose(); maDashControl.dispose(); maWidthControl.dispose(); - maLineStyleListControl.dispose(); maTransControl.dispose(); maEdgeStyle.dispose(); maCapStyle.dispose(); @@ -107,16 +105,6 @@ void LinePropertyPanel::NotifyItemUpdate( switch(nSID) { - case SID_ATTR_LINE_DASH: - { - updateLineDash(bDisabled, bSetOrDefault, pState); - break; - } - case SID_ATTR_LINE_STYLE: - { - updateLineStyle(bDisabled, bSetOrDefault, pState); - break; - } case SID_ATTR_LINE_TRANSPARENCE: { updateLineTransparence(bDisabled, bSetOrDefault, pState); @@ -127,12 +115,6 @@ void LinePropertyPanel::NotifyItemUpdate( updateLineWidth(bDisabled, bSetOrDefault, pState); break; } - case SID_DASH_LIST: - { - FillLineStyleList(); - SelectLineStyle(); - break; - } case SID_ATTR_LINE_JOINT: { updateLineJoint(bDisabled, bSetOrDefault, pState); @@ -176,30 +158,6 @@ void LinePropertyPanel::HandleContextChange( enableArrowHead(); } -void LinePropertyPanel::setLineStyle(const XLineStyleItem& rItem) -{ - GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_LINE_STYLE, - SfxCallMode::RECORD, { &rItem }); -} - -void LinePropertyPanel::setLineDash(const XLineDashItem& rItem) -{ - GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_LINE_DASH, - SfxCallMode::RECORD, { &rItem }); -} - -void LinePropertyPanel::setLineEndStyle(const XLineEndItem* pItem) -{ - GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_LINEEND_STYLE, - SfxCallMode::RECORD, { pItem }); -} - -void LinePropertyPanel::setLineStartStyle(const XLineStartItem* pItem) -{ - GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_LINEEND_STYLE, - SfxCallMode::RECORD, { pItem }); -} - void LinePropertyPanel::setLineJoint(const XLineJointItem* pItem) { GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_LINE_JOINT, diff --git a/svx/source/sidebar/line/LinePropertyPanel.hxx b/svx/source/sidebar/line/LinePropertyPanel.hxx index 00585290f579..c2ae25639db7 100644 --- a/svx/source/sidebar/line/LinePropertyPanel.hxx +++ b/svx/source/sidebar/line/LinePropertyPanel.hxx @@ -72,10 +72,6 @@ public: protected: - virtual void setLineStyle(const XLineStyleItem& rItem) override; - virtual void setLineDash(const XLineDashItem& rItem) override; - virtual void setLineEndStyle(const XLineEndItem* pItem) override; - virtual void setLineStartStyle(const XLineStartItem* pItem) override; virtual void setLineTransparency(const XLineTransparenceItem& rItem) override; virtual void setLineJoint(const XLineJointItem* pItem) override; virtual void setLineCap(const XLineCapItem* pItem) override; @@ -85,7 +81,6 @@ private: sfx2::sidebar::ControllerItem maStyleControl; sfx2::sidebar::ControllerItem maDashControl; sfx2::sidebar::ControllerItem maWidthControl; - sfx2::sidebar::ControllerItem maLineStyleListControl; sfx2::sidebar::ControllerItem maTransControl; sfx2::sidebar::ControllerItem maEdgeStyle; sfx2::sidebar::ControllerItem maCapStyle; diff --git a/svx/source/sidebar/line/LinePropertyPanelBase.cxx b/svx/source/sidebar/line/LinePropertyPanelBase.cxx index cee744ebd3b1..e0bba5977fe6 100644 --- a/svx/source/sidebar/line/LinePropertyPanelBase.cxx +++ b/svx/source/sidebar/line/LinePropertyPanelBase.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -55,19 +56,53 @@ const char SELECTWIDTH[] = "SelectWidth"; namespace svx::sidebar { +// trigger disabling the arrows if the none line style is selected +class DisableArrowsWrapper +{ +private: + LinePropertyPanelBase& m_rPanel; + +public: + DisableArrowsWrapper(LinePropertyPanelBase& rPanel) + : m_rPanel(rPanel) + { + } + + bool operator()(const OUString& rCommand, const css::uno::Any& rValue) + { + if (rCommand == ".uno:XLineStyle") + { + css::drawing::LineStyle eLineStyle(css::drawing::LineStyle_NONE); + rValue >>= eLineStyle; + m_rPanel.SetNoneLineStyle(eLineStyle == css::drawing::LineStyle_NONE); + } + return false; + } +}; + +namespace +{ + SvxLineStyleToolBoxControl* getLineStyleToolBoxControl(ToolbarUnoDispatcher& rToolBoxColor) + { + css::uno::Reference xController = rToolBoxColor.GetControllerForCommand(".uno:XLineStyle"); + SvxLineStyleToolBoxControl* pToolBoxLineStyleControl = dynamic_cast(xController.get()); + return pToolBoxLineStyleControl; + } +} + + LinePropertyPanelBase::LinePropertyPanelBase( vcl::Window* pParent, const uno::Reference& rxFrame) : PanelLayout(pParent, "LinePropertyPanel", "svx/ui/sidebarline.ui", rxFrame, true), mxTBColor(m_xBuilder->weld_toolbar("color")), mxColorDispatch(new ToolbarUnoDispatcher(*mxTBColor, rxFrame)), + mxLineStyleTB(m_xBuilder->weld_toolbar("linestyle")), + mxLineStyleDispatch(new ToolbarUnoDispatcher(*mxLineStyleTB, rxFrame)), mxFTWidth(m_xBuilder->weld_label("widthlabel")), mxTBWidth(m_xBuilder->weld_toolbar("width")), - mxLBStyle(new SvxLineLB(m_xBuilder->weld_combo_box("linestyle"))), mxFTTransparency(m_xBuilder->weld_label("translabel")), mxMFTransparent(m_xBuilder->weld_metric_spin_button("linetransparency", FieldUnit::PERCENT)), - mxArrowsTB(m_xBuilder->weld_toolbar("arrowheads")), - mxArrowsDispatch(new ToolbarUnoDispatcher(*mxArrowsTB, rxFrame)), mxFTEdgeStyle(m_xBuilder->weld_label("cornerlabel")), mxLBEdgeStyle(m_xBuilder->weld_combo_box("edgestyle")), mxFTCapStyle(m_xBuilder->weld_label("caplabel")), @@ -75,14 +110,14 @@ LinePropertyPanelBase::LinePropertyPanelBase( mxGridLineProps(m_xBuilder->weld_widget("lineproperties")), mxBoxArrowProps(m_xBuilder->weld_widget("arrowproperties")), mxLineWidthPopup(new LineWidthPopup(mxTBWidth.get(), *this)), - mpStyleItem(), - mpDashItem(), + mxDisableArrowsWrapper(new DisableArrowsWrapper(*this)), mnTrans(0), meMapUnit(MapUnit::MapMM), mnWidthCoreValue(0), maIMGNone(BMP_NONE_ICON), mbWidthValuable(true), - mbArrowSupported(true) + mbArrowSupported(true), + mbNoneLineStyle(false) { Initialize(); } @@ -99,11 +134,10 @@ void LinePropertyPanelBase::dispose() mxTBWidth.reset(); mxColorDispatch.reset(); mxTBColor.reset(); - mxLBStyle.reset(); mxFTTransparency.reset(); mxMFTransparent.reset(); - mxArrowsDispatch.reset(); - mxArrowsTB.reset(); + mxLineStyleDispatch.reset(); + mxLineStyleTB.reset(); mxFTEdgeStyle.reset(); mxLBEdgeStyle.reset(); mxFTCapStyle.reset(); @@ -127,10 +161,6 @@ void LinePropertyPanelBase::Initialize() maIMGWidthIcon[6] = BMP_WIDTH7_ICON; maIMGWidthIcon[7] = BMP_WIDTH8_ICON; - FillLineStyleList(); - SelectLineStyle(); - mxLBStyle->connect_changed( LINK( this, LinePropertyPanelBase, ChangeLineStyleHdl ) ); - mxTBWidth->set_item_icon_name(SELECTWIDTH, maIMGWidthIcon[0]); mxTBWidth->connect_clicked(LINK(this, LinePropertyPanelBase, ToolboxWidthSelectHdl)); @@ -139,62 +169,9 @@ void LinePropertyPanelBase::Initialize() mxLBEdgeStyle->connect_changed( LINK( this, LinePropertyPanelBase, ChangeEdgeStyleHdl ) ); mxLBCapStyle->connect_changed( LINK( this, LinePropertyPanelBase, ChangeCapStyleHdl ) ); -} -void LinePropertyPanelBase::DataChanged(const DataChangedEvent& /*rEvent*/) -{ -} - -void LinePropertyPanelBase::updateLineStyle(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem) -{ - if(bDisabled) - { - mxLBStyle->set_sensitive(false); - } - else - { - mxLBStyle->set_sensitive(true); - } - - if(bSetOrDefault) - { - if(pItem) - { - mpStyleItem.reset(static_cast(pItem->Clone())); - } - } - else - { - mpStyleItem.reset(); - } - - SelectLineStyle(); -} - -void LinePropertyPanelBase::updateLineDash(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem) -{ - if(bDisabled) - { - mxLBStyle->set_sensitive(false); - } - else - { - mxLBStyle->set_sensitive(true); - } - - if(bSetOrDefault) - { - if(pItem) - { - mpDashItem.reset(static_cast(pItem->Clone())); - } - } - else - { - mpDashItem.reset(); - } - - SelectLineStyle(); + SvxLineStyleToolBoxControl* pLineStyleControl = getLineStyleToolBoxControl(*mxLineStyleDispatch); + pLineStyleControl->setLineStyleSelectFunction(*mxDisableArrowsWrapper); } void LinePropertyPanelBase::updateLineTransparence(bool bDisabled, bool bSetOrDefault, @@ -366,44 +343,6 @@ void LinePropertyPanelBase::updateLineCap(bool bDisabled, bool bSetOrDefault, mxLBCapStyle->set_active(-1); } -IMPL_LINK_NOARG(LinePropertyPanelBase, ChangeLineStyleHdl, weld::ComboBox&, void) -{ - const sal_Int32 nPos(mxLBStyle->get_active()); - - if (nPos != -1 && mxLBStyle->get_value_changed_from_saved()) - { - if(0 == nPos) - { - // drawing::LineStyle_NONE - const XLineStyleItem aItem(drawing::LineStyle_NONE); - - setLineStyle(aItem); - } - else if(1 == nPos) - { - // drawing::LineStyle_SOLID - const XLineStyleItem aItem(drawing::LineStyle_SOLID); - - setLineStyle(aItem); - } - else if (mxLineStyleList.is() && mxLineStyleList->Count() > static_cast(nPos - 2)) - { - // drawing::LineStyle_DASH - const XLineStyleItem aItemA(drawing::LineStyle_DASH); - const XDashEntry* pDashEntry = mxLineStyleList->GetDash(nPos - 2); - OSL_ENSURE(pDashEntry, "OOps, got empty XDash from XDashList (!)"); - const XLineDashItem aItemB( - pDashEntry ? pDashEntry->GetName() : OUString(), - pDashEntry ? pDashEntry->GetDash() : XDash()); - - setLineStyle(aItemA); - setLineDash(aItemB); - } - } - - ActivateControls(); -} - IMPL_LINK_NOARG(LinePropertyPanelBase, ChangeEdgeStyleHdl, weld::ComboBox&, void) { const sal_Int32 nPos(mxLBEdgeStyle->get_active()); @@ -533,79 +472,12 @@ void LinePropertyPanelBase::SetWidth(long nWidth) mxLineWidthPopup->SetWidthSelect(mnWidthCoreValue, mbWidthValuable, meMapUnit); } -void LinePropertyPanelBase::FillLineStyleList() -{ - SfxObjectShell* pSh = SfxObjectShell::Current(); - if ( pSh && pSh->GetItem( SID_DASH_LIST ) ) - { - mxLBStyle->set_sensitive(true); - mxLineStyleList = pSh->GetItem( SID_DASH_LIST )->GetDashList(); - - if (mxLineStyleList.is()) - { - mxLBStyle->Fill(mxLineStyleList); - } - - mxLBStyle->set_active(0); - } - else - { - mxLBStyle->set_sensitive(false); - } -} - -void LinePropertyPanelBase::SelectLineStyle() -{ - if (!mpStyleItem || !mpDashItem) - { - mxLBStyle->set_active(-1); - mxLBStyle->set_sensitive(false); - return; - } - - const drawing::LineStyle eXLS(mpStyleItem->GetValue()); - bool bSelected(false); - - switch(eXLS) - { - case drawing::LineStyle_NONE: - break; - case drawing::LineStyle_SOLID: - mxLBStyle->set_active(1); - bSelected = true; - break; - default: - if(mxLineStyleList.is()) - { - const XDash& rDash = mpDashItem->GetDashValue(); - for(long a(0);!bSelected && a < mxLineStyleList->Count(); a++) - { - const XDashEntry* pEntry = mxLineStyleList->GetDash(a); - const XDash& rEntry = pEntry->GetDash(); - if(rDash == rEntry) - { - mxLBStyle->set_active(a + 2); - bSelected = true; - } - } - } - break; - } - - if(!bSelected) - mxLBStyle->set_active( 0 ); - - ActivateControls(); -} - void LinePropertyPanelBase::ActivateControls() { - const sal_Int32 nPos(mxLBStyle->get_active()); - bool bLineStyle( nPos != 0 ); - - mxGridLineProps->set_sensitive( bLineStyle ); - mxBoxArrowProps->set_sensitive( bLineStyle ); - mxArrowsTB->set_sensitive( bLineStyle && mbArrowSupported ); + mxGridLineProps->set_sensitive(mbNoneLineStyle); + mxBoxArrowProps->set_sensitive(mbNoneLineStyle); + mxLineStyleTB->set_item_visible(".uno:LineEndStyle", mbArrowSupported); + mxLineStyleTB->set_item_sensitive(".uno:LineEndStyle", !mbNoneLineStyle); } void LinePropertyPanelBase::setMapUnit(MapUnit eMapUnit) diff --git a/svx/source/tbxctrls/itemwin.cxx b/svx/source/tbxctrls/itemwin.cxx index 5443d4f12751..7e6b661f9ec4 100644 --- a/svx/source/tbxctrls/itemwin.cxx +++ b/svx/source/tbxctrls/itemwin.cxx @@ -34,8 +34,6 @@ #include -#define DELAY_TIMEOUT 100 - #include #include #include @@ -47,6 +45,7 @@ #include #include #include +#include #include @@ -56,231 +55,6 @@ using namespace ::com::sun::star::frame; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; -SvxLineBox::SvxLineBox( vcl::Window* pParent, const Reference< XFrame >& rFrame ) : - ListBox(pParent, WB_BORDER | WB_DROPDOWN | WB_AUTOHSCROLL), - nCurPos ( 0 ), - aLogicalSize(40,140), - bRelease ( true ), - mpSh ( nullptr ), - mxFrame ( rFrame ) -{ - SetSizePixel(LogicToPixel(aLogicalSize, MapMode(MapUnit::MapAppFont))); - Show(); - - aDelayTimer.SetTimeout( DELAY_TIMEOUT ); - aDelayTimer.SetInvokeHandler( LINK( this, SvxLineBox, DelayHdl_Impl ) ); - aDelayTimer.Start(); -} - - -// Fills the listbox (provisional) with strings - -void SvxLineBox::Fill( const XDashListRef &pList ) -{ - Clear(); - - if( !pList.is() ) - return; - - // entry for 'none' - InsertEntry(pList->GetStringForUiNoLine()); - - // entry for solid line - InsertEntry(pList->GetStringForUiSolidLine(), - Image(pList->GetBitmapForUISolidLine())); - - // entries for dashed lines - - long nCount = pList->Count(); - SetUpdateMode( false ); - - for( long i = 0; i < nCount; i++ ) - { - const XDashEntry* pEntry = pList->GetDash(i); - const BitmapEx aBitmap = pList->GetUiBitmap( i ); - if( !aBitmap.IsEmpty() ) - { - InsertEntry(pEntry->GetName(), Image(aBitmap)); - } - else - InsertEntry( pEntry->GetName() ); - } - - AdaptDropDownLineCountToMaximum(); - SetUpdateMode( true ); -} - -IMPL_LINK_NOARG(SvxLineBox, DelayHdl_Impl, Timer *, void) -{ - if ( GetEntryCount() == 0 ) - { - mpSh = SfxObjectShell::Current(); - FillControl(); - } -} - - -void SvxLineBox::Select() -{ - // Call the parent's Select() member to trigger accessibility events. - ListBox::Select(); - - if ( IsTravelSelect() ) - return; - - drawing::LineStyle eXLS; - sal_Int32 nPos = GetSelectedEntryPos(); - - switch ( nPos ) - { - case 0: - eXLS = drawing::LineStyle_NONE; - break; - - case 1: - eXLS = drawing::LineStyle_SOLID; - break; - - default: - { - eXLS = drawing::LineStyle_DASH; - - if ( nPos != LISTBOX_ENTRY_NOTFOUND && - SfxObjectShell::Current() && - SfxObjectShell::Current()->GetItem( SID_DASH_LIST ) ) - { - // LineDashItem will only be sent if it also has a dash. - // Notify cares! - SvxDashListItem const * pItem = SfxObjectShell::Current()->GetItem( SID_DASH_LIST ); - XLineDashItem aLineDashItem( GetSelectedEntry(), - pItem->GetDashList()->GetDash( nPos - 2 )->GetDash() ); - - Any a; - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = "LineDash"; - aLineDashItem.QueryValue ( a ); - aArgs[0].Value = a; - SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( mxFrame->getController(), UNO_QUERY ), - ".uno:LineDash", - aArgs ); - } - } - break; - } - - XLineStyleItem aLineStyleItem( eXLS ); - Any a; - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = "XLineStyle"; - aLineStyleItem.QueryValue ( a ); - aArgs[0].Value = a; - SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( mxFrame->getController(), UNO_QUERY ), - ".uno:XLineStyle", - aArgs ); - - nCurPos = GetSelectedEntryPos(); - ReleaseFocus_Impl(); -} - - -bool SvxLineBox::PreNotify( NotifyEvent& rNEvt ) -{ - MouseNotifyEvent nType = rNEvt.GetType(); - - switch(nType) - { - case MouseNotifyEvent::MOUSEBUTTONDOWN: - case MouseNotifyEvent::GETFOCUS: - nCurPos = GetSelectedEntryPos(); - break; - case MouseNotifyEvent::LOSEFOCUS: - SelectEntryPos(nCurPos); - break; - case MouseNotifyEvent::KEYINPUT: - { - const KeyEvent* pKEvt = rNEvt.GetKeyEvent(); - if( pKEvt->GetKeyCode().GetCode() == KEY_TAB) - { - bRelease = false; - Select(); - } - } - break; - default: - break; - } - return ListBox::PreNotify( rNEvt ); -} - - -bool SvxLineBox::EventNotify( NotifyEvent& rNEvt ) -{ - bool bHandled = ListBox::EventNotify( rNEvt ); - - if ( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT ) - { - const KeyEvent* pKEvt = rNEvt.GetKeyEvent(); - - switch ( pKEvt->GetKeyCode().GetCode() ) - { - case KEY_RETURN: - Select(); - bHandled = true; - break; - - case KEY_ESCAPE: - SelectEntryPos( nCurPos ); - ReleaseFocus_Impl(); - bHandled = true; - break; - } - } - return bHandled; -} - - -void SvxLineBox::ReleaseFocus_Impl() -{ - if(!bRelease) - { - bRelease = true; - return; - } - - if( SfxViewShell::Current() ) - { - vcl::Window* pShellWnd = SfxViewShell::Current()->GetWindow(); - - if ( pShellWnd ) - pShellWnd->GrabFocus(); - } -} - -void SvxLineBox::DataChanged( const DataChangedEvent& rDCEvt ) -{ - if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && - (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) ) - { - SetSizePixel(LogicToPixel(aLogicalSize, MapMode(MapUnit::MapAppFont))); - } - - ListBox::DataChanged( rDCEvt ); -} - -void SvxLineBox::FillControl() -{ - // FillStyles(); - if ( !mpSh ) - mpSh = SfxObjectShell::Current(); - - if( mpSh ) - { - const SvxDashListItem* pItem = mpSh->GetItem( SID_DASH_LIST ); - if ( pItem ) - Fill( pItem->GetDashList() ); - } -} - SvxMetricField::SvxMetricField( vcl::Window* pParent, const Reference< XFrame >& rFrame ) : MetricField(pParent, WB_BORDER | WB_SPIN | WB_REPEAT) @@ -303,7 +77,6 @@ SvxMetricField::SvxMetricField( Show(); } - void SvxMetricField::Update( const XLineWidthItem* pItem ) { if ( pItem ) @@ -315,7 +88,6 @@ void SvxMetricField::Update( const XLineWidthItem* pItem ) SetText( "" ); } - void SvxMetricField::Modify() { MetricField::Modify(); @@ -332,7 +104,6 @@ void SvxMetricField::Modify() aArgs ); } - void SvxMetricField::ReleaseFocus_Impl() { if( SfxViewShell::Current() ) diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx index 80c36beb55d5..31233a13e5ea 100644 --- a/svx/source/tbxctrls/linectrl.cxx +++ b/svx/source/tbxctrls/linectrl.cxx @@ -19,6 +19,8 @@ #include +#include +#include #include #include #include @@ -42,6 +44,7 @@ #include #include #include +#include #include #include @@ -55,198 +58,171 @@ using namespace ::com::sun::star; // For End Line Controller #define MAX_LINES 12 -SFX_IMPL_TOOLBOX_CONTROL( SvxLineStyleToolBoxControl, XLineStyleItem ); -SFX_IMPL_TOOLBOX_CONTROL( SvxLineWidthToolBoxControl, XLineWidthItem ); - -SvxLineStyleToolBoxControl::SvxLineStyleToolBoxControl( sal_uInt16 nSlotId, - sal_uInt16 nId, - ToolBox& rTbx ) : - SfxToolBoxControl( nSlotId, nId, rTbx ), - bUpdate ( false ) +SvxLineStyleToolBoxControl::SvxLineStyleToolBoxControl( const css::uno::Reference& rContext ) + : svt::PopupWindowController( rContext, nullptr, OUString() ) { - addStatusListener( ".uno:LineDash"); - addStatusListener( ".uno:DashListState"); + addStatusListener(".uno:LineDash"); } - SvxLineStyleToolBoxControl::~SvxLineStyleToolBoxControl() { } - -void SvxLineStyleToolBoxControl::StateChanged ( - - sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) - +void SAL_CALL SvxLineStyleToolBoxControl::statusChanged( const frame::FeatureStateEvent& rEvent ) { - SvxLineBox* pBox = static_cast( GetToolBox().GetItemWindow( GetId() ) ); - DBG_ASSERT( pBox, "Window not found!" ); + ToolBox* pToolBox = nullptr; + sal_uInt16 nId = 0; + if (!getToolboxId(nId, &pToolBox) && !m_pToolbar) + return; - if( eState == SfxItemState::DISABLED ) + OString sId(m_aCommandURL.toUtf8()); + + if ( rEvent.FeatureURL.Complete == m_aCommandURL ) { - pBox->Disable(); - pBox->SetNoSelection(); - } - else - { - pBox->Enable(); - - if ( eState == SfxItemState::DEFAULT ) - { - if( nSID == SID_ATTR_LINE_STYLE ) - { - pStyleItem.reset( static_cast(pState->Clone()) ); - } - else if( nSID == SID_ATTR_LINE_DASH ) - { - pDashItem.reset( static_cast(pState->Clone()) ); - } - - bUpdate = true; - Update( pState ); - } - else if ( nSID != SID_DASH_LIST ) - { - // no or ambiguous status - pBox->SetNoSelection(); - } - } -} - - -void SvxLineStyleToolBoxControl::Update( const SfxPoolItem* pState ) -{ - if ( pState && bUpdate ) - { - bUpdate = false; - - SvxLineBox* pBox = static_cast(GetToolBox().GetItemWindow( GetId() )); - DBG_ASSERT( pBox, "Window not found!" ); - - // Since the timer can strike unexpectedly, it may happen that - // the LB is not yet filled. A ClearCache() on the control - // in DelayHdl () was unsuccessful. - if( pBox->GetEntryCount() == 0 ) - pBox->FillControl(); - - drawing::LineStyle eXLS; - - if ( pStyleItem ) - eXLS = pStyleItem->GetValue(); + if (m_pToolbar) + m_pToolbar->set_item_sensitive(sId, rEvent.IsEnabled); else - eXLS = drawing::LineStyle_NONE; + pToolBox->EnableItem( nId, rEvent.IsEnabled ); + } - switch( eXLS ) + m_xBtnUpdater->Update(rEvent); + + SfxObjectShell* pSh = SfxObjectShell::Current(); + if (pSh) + { + const SvxDashListItem* pItem = pSh->GetItem( SID_DASH_LIST ); + if (pItem) { - case drawing::LineStyle_NONE: - pBox->SelectEntryPos( 0 ); - break; - - case drawing::LineStyle_SOLID: - pBox->SelectEntryPos( 1 ); - break; - - case drawing::LineStyle_DASH: + XDashListRef xList = pItem->GetDashList(); + int nIndex = m_xBtnUpdater->GetStyleIndex(); + switch (nIndex) { - if( pDashItem ) + case -1: + case 0: { - OUString aString = SvxUnogetInternalNameForItem( - XATTR_LINEDASH, pDashItem->GetName()); - pBox->SelectEntry( aString ); + BitmapEx aEmpty(xList->GetBitmapForUISolidLine()); + aEmpty.Erase(Application::GetSettings().GetStyleSettings().GetFieldColor()); + if (m_pToolbar) + { + Graphic aGraf(aEmpty); + m_pToolbar->set_item_image(sId, aGraf.GetXGraphic()); + } + else + pToolBox->SetItemImage(nId, Image(aEmpty)); + break; } - else - pBox->SetNoSelection(); + case 1: + if (m_pToolbar) + { + Graphic aGraf(xList->GetBitmapForUISolidLine()); + m_pToolbar->set_item_image(sId, aGraf.GetXGraphic()); + } + else + pToolBox->SetItemImage(nId, Image(xList->GetBitmapForUISolidLine())); + break; + default: + if (m_pToolbar) + { + Graphic aGraf(xList->GetUiBitmap(nIndex - 2)); + m_pToolbar->set_item_image(sId, aGraf.GetXGraphic()); + } + else + pToolBox->SetItemImage(nId, Image(xList->GetUiBitmap(nIndex - 2))); + break; } - break; - - default: - OSL_FAIL( "Unsupported type of line" ); - break; } } +} - if ( auto pDashListItem = dynamic_cast( pState) ) +void SAL_CALL SvxLineStyleToolBoxControl::execute(sal_Int16 /*KeyModifier*/) +{ + if (m_pToolbar) { - // The list of line styles has changed - SvxLineBox* pBox = static_cast(GetToolBox().GetItemWindow( GetId() )); - DBG_ASSERT( pBox, "Window not found!" ); - - OUString aString( pBox->GetSelectedEntry() ); - pBox->Clear(); - pBox->InsertEntry( SvxResId(RID_SVXSTR_INVISIBLE) ); - pBox->InsertEntry( SvxResId(RID_SVXSTR_SOLID) ); - pBox->Fill( pDashListItem->GetDashList() ); - pBox->SelectEntry( aString ); - } -} - - -VclPtr SvxLineStyleToolBoxControl::CreateItemWindow( vcl::Window *pParent ) -{ - return VclPtr::Create( pParent, m_xFrame ).get(); -} - -SvxLineWidthToolBoxControl::SvxLineWidthToolBoxControl( - sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) : - SfxToolBoxControl( nSlotId, nId, rTbx ) -{ - addStatusListener( ".uno:MetricUnit"); -} - - -SvxLineWidthToolBoxControl::~SvxLineWidthToolBoxControl() -{ -} - - -void SvxLineWidthToolBoxControl::StateChanged( - sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) -{ - SvxMetricField* pFld = static_cast( - GetToolBox().GetItemWindow( GetId() )); - DBG_ASSERT( pFld, "Window not found" ); - - if ( nSID == SID_ATTR_METRIC ) - { - pFld->RefreshDlgUnit(); + // Toggle the popup also when toolbutton is activated + const OString aId(m_aCommandURL.toUtf8()); + m_pToolbar->set_menu_item_active(aId, !m_pToolbar->get_menu_item_active(aId)); } else { - if ( eState == SfxItemState::DISABLED ) - { - pFld->Disable(); - pFld->SetText( "" ); - } - else - { - pFld->Enable(); - - if ( eState == SfxItemState::DEFAULT ) - { - DBG_ASSERT( dynamic_cast( pState) != nullptr, "wrong ItemType" ); - - // Core-Unit handed over to MetricField - // Should not happen in CreateItemWin ()! - // CD!!! GetCoreMetric(); - pFld->SetCoreUnit( MapUnit::Map100thMM ); - - pFld->Update( static_cast(pState) ); - } - else - pFld->Update( nullptr ); - } + // Open the popup also when Enter key is pressed. + createPopupWindow(); } } - -VclPtr SvxLineWidthToolBoxControl::CreateItemWindow( vcl::Window *pParent ) +void SvxLineStyleToolBoxControl::initialize( const css::uno::Sequence& rArguments ) { - return VclPtr::Create( pParent, m_xFrame ).get(); + svt::PopupWindowController::initialize( rArguments ); + + if (m_pToolbar) + { + mxPopoverContainer.reset(new ToolbarPopupContainer(m_pToolbar)); + m_pToolbar->set_item_popover(m_aCommandURL.toUtf8(), mxPopoverContainer->getTopLevel()); + } + + ToolBox* pToolBox = nullptr; + sal_uInt16 nId = 0; + if ( getToolboxId( nId, &pToolBox ) ) + { + pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ToolBoxItemBits::DROPDOWNONLY ); + } + + m_xBtnUpdater.reset(new svx::ToolboxButtonLineStyleUpdater); +} + +void SvxLineStyleToolBoxControl::setLineStyleSelectFunction(const LineStyleSelectFunction& rLineStyleSelectFunction) +{ + m_aLineStyleSelectFunction = rLineStyleSelectFunction; +} + +void SvxLineStyleToolBoxControl::dispatchLineStyleCommand(const OUString& rCommand, const Sequence& rArgs) +{ + if (m_aLineStyleSelectFunction && m_aLineStyleSelectFunction(rCommand, rArgs[0].Value)) + return; + + dispatchCommand(rCommand, rArgs); +} + +int SvxLineStyleToolBoxControl::GetStyleIndex() const +{ + return m_xBtnUpdater->GetStyleIndex(); +} + +std::unique_ptr SvxLineStyleToolBoxControl::weldPopupWindow() +{ + return std::make_unique(this, m_pToolbar, m_xBtnUpdater->GetStyleIndex()); +} + +VclPtr SvxLineStyleToolBoxControl::createVclPopupWindow( vcl::Window* pParent ) +{ + mxInterimPopover = VclPtr::Create(getFrameInterface(), pParent, + std::make_unique(this, pParent->GetFrameWeld(), m_xBtnUpdater->GetStyleIndex())); + + mxInterimPopover->Show(); + + return mxInterimPopover; +} + +OUString SvxLineStyleToolBoxControl::getImplementationName() +{ + return "com.sun.star.comp.svx.LineStyleToolBoxControl"; +} + +css::uno::Sequence SvxLineStyleToolBoxControl::getSupportedServiceNames() +{ + return { "com.sun.star.frame.ToolbarController" }; +} + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * +com_sun_star_comp_svx_LineStyleToolBoxControl_get_implementation( + css::uno::XComponentContext* rContext, + css::uno::Sequence const & ) +{ + return cppu::acquire( new SvxLineStyleToolBoxControl( rContext ) ); } namespace { -class SvxLineEndToolBoxControl : public svt::PopupWindowController +class SvxLineEndToolBoxControl final : public svt::PopupWindowController { public: explicit SvxLineEndToolBoxControl( const css::uno::Reference& rContext ); @@ -529,4 +505,136 @@ com_sun_star_comp_svx_LineEndToolBoxControl_get_implementation( return cppu::acquire( new SvxLineEndToolBoxControl( rContext ) ); } +SvxLineBox::SvxLineBox(SvxLineStyleToolBoxControl* pControl, weld::Widget* pParent, int nInitialIndex) + : WeldToolbarPopup(pControl->getFrameInterface(), pParent, "svx/ui/floatinglinestyle.ui", "FloatingLineStyle") + , mxControl(pControl) + , mxLineStyleSet(new SvtValueSet(m_xBuilder->weld_scrolled_window("valuesetwin"))) + , mxLineStyleSetWin(new weld::CustomWeld(*m_xBuilder, "valueset", *mxLineStyleSet)) +{ + mxLineStyleSet->SetStyle(WB_FLATVALUESET | WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT); + + FillControl(); + + mxLineStyleSet->SelectItem(nInitialIndex + 1); + + mxLineStyleSet->SetSelectHdl( LINK( this, SvxLineBox, SelectHdl ) ); +} + +void SvxLineBox::GrabFocus() +{ + mxLineStyleSet->GrabFocus(); +} + +SvxLineBox::~SvxLineBox() +{ +} + +// Fills the listbox (provisional) with strings + +void SvxLineBox::Fill( const XDashListRef &pList ) +{ + mxLineStyleSet->Clear(); + + if( !pList.is() ) + return; + + // entry for 'none' + mxLineStyleSet->InsertItem(1, Image(), pList->GetStringForUiNoLine()); + + // entry for solid line + auto aBmp = pList->GetBitmapForUISolidLine(); + Size aBmpSize = aBmp.GetSizePixel(); + mxLineStyleSet->InsertItem(2, Image(aBmp), pList->GetStringForUiSolidLine()); + + // entries for dashed lines + long nCount = pList->Count(); + for( long i = 0; i < nCount; i++ ) + { + const XDashEntry* pEntry = pList->GetDash(i); + const BitmapEx aBitmap = pList->GetUiBitmap(i); + + mxLineStyleSet->InsertItem(i + 3, Image(aBitmap), pEntry->GetName()); + } + + sal_uInt16 nLines = std::min( static_cast(nCount + 2), sal_uInt16(MAX_LINES) ); + mxLineStyleSet->SetLineCount(nLines); + + WinBits nBits = mxLineStyleSet->GetStyle(); + if ( nLines == mxLineStyleSet->GetItemCount() ) + nBits &= ~WB_VSCROLL; + else + nBits |= WB_VSCROLL; + mxLineStyleSet->SetStyle( nBits ); + + Size aSize(aBmpSize); + aSize.AdjustWidth(6); + aSize.AdjustHeight(6); + aSize = mxLineStyleSet->CalcWindowSizePixel(aSize); + mxLineStyleSet->GetDrawingArea()->set_size_request(aSize.Width(), aSize.Height()); + mxLineStyleSet->SetOutputSizePixel(aSize); +} + +IMPL_LINK_NOARG(SvxLineBox, SelectHdl, SvtValueSet*, void) +{ + drawing::LineStyle eXLS; + sal_Int32 nPos = mxLineStyleSet->GetSelectedItemId(); + --nPos; // ids start at 1, get the pos of the id + + switch ( nPos ) + { + case 0: + eXLS = drawing::LineStyle_NONE; + break; + + case 1: + eXLS = drawing::LineStyle_SOLID; + break; + + default: + { + eXLS = drawing::LineStyle_DASH; + + if ( nPos != -1 && + SfxObjectShell::Current() && + SfxObjectShell::Current()->GetItem( SID_DASH_LIST ) ) + { + // LineDashItem will only be sent if it also has a dash. + // Notify cares! + SvxDashListItem const * pItem = SfxObjectShell::Current()->GetItem( SID_DASH_LIST ); + const XDashEntry* pEntry = pItem->GetDashList()->GetDash(nPos - 2); + XLineDashItem aLineDashItem(pEntry->GetName(), pEntry->GetDash()); + + Any a; + Sequence< PropertyValue > aArgs( 1 ); + aArgs[0].Name = "LineDash"; + aLineDashItem.QueryValue ( a ); + aArgs[0].Value = a; + mxControl->dispatchLineStyleCommand(".uno:LineDash", aArgs); + } + } + break; + } + + XLineStyleItem aLineStyleItem( eXLS ); + Any a; + Sequence< PropertyValue > aArgs( 1 ); + aArgs[0].Name = "XLineStyle"; + aLineStyleItem.QueryValue ( a ); + aArgs[0].Value = a; + mxControl->dispatchLineStyleCommand(".uno:XLineStyle", aArgs); + + mxControl->EndPopupMode(); +} + +void SvxLineBox::FillControl() +{ + SfxObjectShell* pSh = SfxObjectShell::Current(); + if (pSh) + { + const SvxDashListItem* pItem = pSh->GetItem( SID_DASH_LIST ); + if (pItem) + Fill(pItem->GetDashList()); + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/tbxctrls/linewidthctrl.cxx b/svx/source/tbxctrls/linewidthctrl.cxx new file mode 100644 index 000000000000..0a6d75446819 --- /dev/null +++ b/svx/source/tbxctrls/linewidthctrl.cxx @@ -0,0 +1,116 @@ +/* -*- 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 + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::util; +using namespace ::com::sun::star::frame; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star; + +SFX_IMPL_TOOLBOX_CONTROL( SvxLineWidthToolBoxControl, XLineWidthItem ); + +SvxLineWidthToolBoxControl::SvxLineWidthToolBoxControl( + sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) : + SfxToolBoxControl( nSlotId, nId, rTbx ) +{ + addStatusListener( ".uno:MetricUnit"); +} + + +SvxLineWidthToolBoxControl::~SvxLineWidthToolBoxControl() +{ +} + + +void SvxLineWidthToolBoxControl::StateChanged( + sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) +{ + SvxMetricField* pFld = static_cast( + GetToolBox().GetItemWindow( GetId() )); + DBG_ASSERT( pFld, "Window not found" ); + + if ( nSID == SID_ATTR_METRIC ) + { + pFld->RefreshDlgUnit(); + } + else + { + if ( eState == SfxItemState::DISABLED ) + { + pFld->Disable(); + pFld->SetText( "" ); + } + else + { + pFld->Enable(); + + if ( eState == SfxItemState::DEFAULT ) + { + DBG_ASSERT( dynamic_cast( pState) != nullptr, "wrong ItemType" ); + + // Core-Unit handed over to MetricField + // Should not happen in CreateItemWin ()! + // CD!!! GetCoreMetric(); + pFld->SetCoreUnit( MapUnit::Map100thMM ); + + pFld->Update( static_cast(pState) ); + } + else + pFld->Update( nullptr ); + } + } +} + + +VclPtr SvxLineWidthToolBoxControl::CreateItemWindow( vcl::Window *pParent ) +{ + return VclPtr::Create( pParent, m_xFrame ).get(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/tbxctrls/tbxcolorupdate.cxx b/svx/source/tbxctrls/tbxcolorupdate.cxx index 2895f258590b..554bf0205c7b 100644 --- a/svx/source/tbxctrls/tbxcolorupdate.cxx +++ b/svx/source/tbxctrls/tbxcolorupdate.cxx @@ -17,9 +17,14 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include +#include #include #include +#include #include +#include +#include #include #include @@ -275,6 +280,67 @@ namespace svx return Size(nWidth, nHeight); } + ToolboxButtonLineStyleUpdater::ToolboxButtonLineStyleUpdater() + : m_eXLS(css::drawing::LineStyle_NONE) + , m_nDashStyleIndex(-1) + { + } + + void ToolboxButtonLineStyleUpdater::Update(const com::sun::star::frame::FeatureStateEvent& rEvent) + { + if (rEvent.FeatureURL.Complete == ".uno:LineDash") + { + m_nDashStyleIndex = -1; + + SfxObjectShell* pSh = SfxObjectShell::Current(); + if (!pSh) + return; + const SvxDashListItem* pItem = pSh->GetItem( SID_DASH_LIST ); + if (!pItem) + return; + + XLineDashItem aDashItem; + aDashItem.PutValue(rEvent.State, 0); + const XDash& rDash = aDashItem.GetDashValue(); + + XDashListRef xLineStyleList = pItem->GetDashList(); + for (long i = 0; i < xLineStyleList->Count(); ++i) + { + const XDashEntry* pEntry = xLineStyleList->GetDash(i); + const XDash& rEntry = pEntry->GetDash(); + if (rDash == rEntry) + { + m_nDashStyleIndex = i; + break; + } + } + } + else if (rEvent.FeatureURL.Complete == ".uno:XLineStyle") + { + XLineStyleItem aLineStyleItem; + aLineStyleItem.PutValue(rEvent.State, 0); + + m_eXLS = aLineStyleItem.GetValue(); + } + } + + int ToolboxButtonLineStyleUpdater::GetStyleIndex() const + { + int nRet; + switch (m_eXLS) + { + case css::drawing::LineStyle_NONE: + nRet = 0; + break; + case css::drawing::LineStyle_SOLID: + nRet = 1; + break; + default: + nRet = m_nDashStyleIndex + 2; + break; + } + return nRet; + } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/uiconfig/ui/floatinglinestyle.ui b/svx/uiconfig/ui/floatinglinestyle.ui new file mode 100644 index 000000000000..126d8f6aa758 --- /dev/null +++ b/svx/uiconfig/ui/floatinglinestyle.ui @@ -0,0 +1,49 @@ + + + + + + False + True + 4 + + + True + False + vertical + 6 + + + True + True + True + True + never + never + in + + + True + False + + + True + True + GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK + True + True + + + + + + + False + True + 0 + + + + + + diff --git a/svx/uiconfig/ui/sidebarline.ui b/svx/uiconfig/ui/sidebarline.ui index 997255fc5e80..5ae3faa288d3 100644 --- a/svx/uiconfig/ui/sidebarline.ui +++ b/svx/uiconfig/ui/sidebarline.ui @@ -7,18 +7,6 @@ 10 20 - - - - - - - - - - - - True False @@ -42,33 +30,13 @@ False 3 - - 105 + True False - Select the style of the line. - center - True - liststore5 - 0 - 1 - - - - 0 - - - - - - 3 - - - - - Style - - + _Line: + True + linestyle + 0 False @@ -77,18 +45,17 @@ - + True True - Select the style of the arrowheads. icons False 2 - + True False - Select the style of the arrowheads. + Select the style of the line. True @@ -96,10 +63,17 @@ False - - - Arrow Styles + + + True + False + Select the style of the arrowheads. + True + + False + False + @@ -360,4 +334,24 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/svx/util/svx.component b/svx/util/svx.component index e54318dea597..81cae7623bd2 100644 --- a/svx/util/svx.component +++ b/svx/util/svx.component @@ -100,10 +100,6 @@ constructor="com_sun_star_comp_svx_SmartTagMenuController_get_implementation"> - - - diff --git a/svx/util/svxcore.component b/svx/util/svxcore.component index 50fedcc67feb..2c5a103857c4 100644 --- a/svx/util/svxcore.component +++ b/svx/util/svxcore.component @@ -62,6 +62,14 @@ constructor="com_sun_star_comp_svx_FontNameToolBoxControl_get_implementation"> + + + + + + diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx index 95e3c9eecd39..b62455e83aac 100644 --- a/sw/source/uibase/app/swmodule.cxx +++ b/sw/source/uibase/app/swmodule.cxx @@ -284,7 +284,6 @@ void SwDLL::RegisterControls() svx::FormatPaintBrushToolBoxControl::RegisterControl(SID_FORMATPAINTBRUSH, pMod ); SvxFillToolBoxControl::RegisterControl(SID_ATTR_FILL_STYLE, pMod ); - SvxLineStyleToolBoxControl::RegisterControl(SID_ATTR_LINE_STYLE, pMod ); SvxLineWidthToolBoxControl::RegisterControl(SID_ATTR_LINE_WIDTH, pMod ); SvxStyleToolBoxControl::RegisterControl(SID_STYLE_APPLY, pMod ); diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index ce6ff16be044..c4b58aaebc67 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -7405,7 +7405,7 @@ private: gtk_tool_button_set_icon_widget(pItem, pImage); } - static void set_item_image(GtkToolButton* pItem, VirtualDevice* pDevice) + void set_item_image(GtkToolButton* pItem, VirtualDevice* pDevice) { GtkWidget* pImage = nullptr; @@ -7416,6 +7416,7 @@ private: } gtk_tool_button_set_icon_widget(pItem, pImage); + gtk_widget_queue_draw(GTK_WIDGET(m_pToolbar)); } public: