From e867b197540cfc8b75bb1108c8bcd7a0ff65d347 Mon Sep 17 00:00:00 2001 From: Maxim Monastirsky Date: Sun, 17 Sep 2017 23:35:55 +0300 Subject: tdf#106762 Base SvxColorToolBoxControl on svt::PopupWindowController This allows us to support tearoff without breaking gtk3/wayland. SvxColorWindow no longer inherits from FloatingWindow, so several call sites need also to be changed to use DockingManager. Change-Id: I5d0bc611bbd2a8b9bfd4335212d0ae7e8fc10593 --- include/svtools/toolbarmenu.hxx | 5 +++++ include/svx/colorwindow.hxx | 3 ++- include/svx/tbcontrl.hxx | 23 ++++++++++++++++++----- include/vcl/menubtn.hxx | 4 ++-- 4 files changed, 27 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/svtools/toolbarmenu.hxx b/include/svtools/toolbarmenu.hxx index 5f990ef0dcad..88174253548a 100644 --- a/include/svtools/toolbarmenu.hxx +++ b/include/svtools/toolbarmenu.hxx @@ -50,6 +50,9 @@ public: ToolbarPopup(const css::uno::Reference& rFrame, vcl::Window* pParentWindow, WinBits nBits ); + ToolbarPopup(const css::uno::Reference& rFrame, + vcl::Window* pParentWindow, + const OString& rID, const OUString& rUIXMLDescription ); virtual ~ToolbarPopup() override; virtual void dispose() override; @@ -64,6 +67,8 @@ protected: virtual void statusChanged(const css::frame::FeatureStateEvent& Event ); private: + void init(); + css::uno::Reference< css::frame::XFrame > mxFrame; rtl::Reference< svt::FrameStatusListener > mxStatusListener; }; diff --git a/include/svx/colorwindow.hxx b/include/svx/colorwindow.hxx index 3f826fa217e4..a782307df9fa 100644 --- a/include/svx/colorwindow.hxx +++ b/include/svx/colorwindow.hxx @@ -21,6 +21,7 @@ #define INCLUDED_SVX_SOURCE_TBXCTRLS_COLORWINDOW_HXX #include +#include #include #include #include @@ -48,7 +49,7 @@ typedef std::function ColorSelectFunct #define COL_NONE_COLOR TRGB_COLORDATA(0x80, 0xFF, 0xFF, 0xFF) -class SVX_DLLPUBLIC SvxColorWindow : public SfxPopupWindow +class SVX_DLLPUBLIC SvxColorWindow : public svtools::ToolbarPopup { private: const sal_uInt16 theSlotId; diff --git a/include/svx/tbcontrl.hxx b/include/svx/tbcontrl.hxx index 22fd4e72910f..b9b8eb0db7b1 100644 --- a/include/svx/tbcontrl.hxx +++ b/include/svx/tbcontrl.hxx @@ -205,25 +205,34 @@ friend class SfxStyleControllerItem_Impl; typedef std::function ColorSelectFunction; -class SVX_DLLPUBLIC SvxColorToolBoxControl : public cppu::ImplInheritanceHelper< SfxToolBoxControl, +class SVX_DLLPUBLIC SvxColorToolBoxControl : public cppu::ImplInheritanceHelper< svt::PopupWindowController, css::frame::XSubToolbarController > { std::unique_ptr m_xBtnUpdater; std::unique_ptr m_xPaletteManager; BorderColorStatus m_aBorderColorStatus; bool m_bSplitButton; + sal_uInt16 m_nSlotId; ColorSelectFunction m_aColorSelectFunction; DECL_LINK(SelectedHdl, const NamedColor&, void); public: - SFX_DECL_TOOLBOX_CONTROL(); - SvxColorToolBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rToolBox); + explicit SvxColorToolBoxControl( const css::uno::Reference& rContext ); virtual ~SvxColorToolBoxControl() override; + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence& rArguments ) override; + + // XUpdatable + virtual void SAL_CALL update() override; + // XStatusListener virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) override; - virtual VclPtr CreatePopupWindow() override; - virtual void Select(sal_uInt16 nSelectModifier) override; + // XToolbarController + virtual void SAL_CALL execute( sal_Int16 nSelectModifier ) override; + + using svt::ToolboxController::createPopupWindow; + virtual VclPtr createPopupWindow( vcl::Window* pParent ) override; // XSubToolbarController virtual sal_Bool SAL_CALL opensSubToolbar() override; @@ -231,6 +240,10 @@ public: virtual void SAL_CALL functionSelected( const OUString& rCommand ) override; virtual void SAL_CALL updateImage() override; + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence SAL_CALL getSupportedServiceNames() override; + void setColorSelectFunction(const ColorSelectFunction& aColorSelectFunction); void EnsurePaletteManager(); }; diff --git a/include/vcl/menubtn.hxx b/include/vcl/menubtn.hxx index da725103c1c7..dfbb39962139 100644 --- a/include/vcl/menubtn.hxx +++ b/include/vcl/menubtn.hxx @@ -36,7 +36,7 @@ private: Timer* mpMenuTimer; VclPtr mpMenu; - VclPtr mpFloatingWindow; + VclPtr mpFloatingWindow; sal_uInt16 mnCurItemId; bool mbDelayMenu; Link maActivateHdl; @@ -75,7 +75,7 @@ public: void SetPopupMenu(PopupMenu* pNewMenu); PopupMenu* GetPopupMenu() const { return mpMenu; } - void SetPopover(FloatingWindow* pFloatingWindow); + void SetPopover(Window* pWindow); sal_uInt16 GetCurItemId() const { return mnCurItemId; } OString GetCurItemIdent() const; -- cgit