diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-03-04 17:22:14 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-03-11 17:42:22 +0100 |
commit | 1653bb9bffaa84a40b7d81a8277e887ea28df4e4 (patch) | |
tree | 5e56142b7b63ab66fb1dcc781ffeb3ae5afda2ad /include | |
parent | 40c58f6039fb02cff74e442f6adc5ba38adcff1d (diff) |
remove intermediate containers in sidebars
tested extension sidebars of:
a) Wollmux extension sidebars
b) Analog Clock Extension demo
https://wiki.openoffice.org/wiki/Sidebar_for_Developers#Example:_Analog_Clock_Extension
Change-Id: If9729e20526681928137989f01a8ae733a9b0cb5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112035
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/comphelper/configurationlistener.hxx | 4 | ||||
-rw-r--r-- | include/sfx2/navigat.hxx | 2 | ||||
-rw-r--r-- | include/sfx2/sidebar/Panel.hxx | 3 | ||||
-rw-r--r-- | include/sfx2/sidebar/PanelLayout.hxx | 48 | ||||
-rw-r--r-- | include/sfx2/sidebar/SidebarPanelBase.hxx | 12 | ||||
-rw-r--r-- | include/sfx2/templdlg.hxx | 3 | ||||
-rw-r--r-- | include/svx/sidebar/AreaPropertyPanelBase.hxx | 9 | ||||
-rw-r--r-- | include/svx/sidebar/InspectorTextPanel.hxx | 7 | ||||
-rw-r--r-- | include/svx/sidebar/LinePropertyPanelBase.hxx | 4 |
9 files changed, 44 insertions, 48 deletions
diff --git a/include/comphelper/configurationlistener.hxx b/include/comphelper/configurationlistener.hxx index 29a2b578b588..bc7994a12c3a 100644 --- a/include/comphelper/configurationlistener.hxx +++ b/include/comphelper/configurationlistener.hxx @@ -64,6 +64,7 @@ class COMPHELPER_DLLPUBLIC ConfigurationListener : { css::uno::Reference< css::beans::XPropertySet > mxConfig; std::vector< ConfigurationListenerPropertyBase * > maListeners; + bool mbDisposed; public: /// Public health warning, you -must- dispose this if you use it. ConfigurationListener(const OUString &rPath, @@ -71,6 +72,7 @@ public: const & xContext = comphelper::getProcessComponentContext()) : mxConfig( ConfigurationHelper::openConfig( xContext, rPath, EConfigurationModes::ReadOnly ), css::uno::UNO_QUERY_THROW ) + , mbDisposed(false) { } virtual ~ConfigurationListener() override @@ -93,6 +95,8 @@ public: /// Notify of the property change virtual void SAL_CALL propertyChange( css::beans::PropertyChangeEvent const &rEvt ) override; + + bool isDisposed() const { return mbDisposed; } }; template< typename uno_type > ConfigurationListenerProperty< uno_type >::ConfigurationListenerProperty(const rtl::Reference< ConfigurationListener > &xListener, const OUString &rProp ) diff --git a/include/sfx2/navigat.hxx b/include/sfx2/navigat.hxx index f5fc9acb3fd7..f26321d658c3 100644 --- a/include/sfx2/navigat.hxx +++ b/include/sfx2/navigat.hxx @@ -39,8 +39,6 @@ class SFX2_DLLPUBLIC SfxNavigator : public SfxDockingWindow public: SfxNavigator(SfxBindings* pBindings, SfxChildWindow* pChildWin, vcl::Window* pParent); - - virtual void Resize() override; }; #endif diff --git a/include/sfx2/sidebar/Panel.hxx b/include/sfx2/sidebar/Panel.hxx index 92e57abc13fd..28fa9cdda1b7 100644 --- a/include/sfx2/sidebar/Panel.hxx +++ b/include/sfx2/sidebar/Panel.hxx @@ -89,6 +89,7 @@ public: private: const OUString msPanelId; const bool mbIsTitleBarOptional; + const bool mbWantsAWT; css::uno::Reference<css::ui::XUIElement> mxElement; css::uno::Reference<css::ui::XSidebarPanel> mxPanelComponent; bool mbIsExpanded; @@ -98,7 +99,7 @@ private: const css::uno::Reference<css::frame::XFrame>& mxFrame; std::unique_ptr<PanelTitleBar> mxTitleBar; std::unique_ptr<weld::Container> mxContents; - css::uno::Reference<css::awt::XWindow> mxAwtXWindow; + css::uno::Reference<css::awt::XWindow> mxXWindow; }; typedef std::vector<VclPtr<Panel>> SharedPanelContainer; diff --git a/include/sfx2/sidebar/PanelLayout.hxx b/include/sfx2/sidebar/PanelLayout.hxx index 0e9e56875ff1..b03ebf97bb22 100644 --- a/include/sfx2/sidebar/PanelLayout.hxx +++ b/include/sfx2/sidebar/PanelLayout.hxx @@ -10,41 +10,43 @@ #pragma once #include <sfx2/dllapi.h> - -#include <vcl/ctrl.hxx> -#include <vcl/timer.hxx> -#include <vcl/idle.hxx> #include <vcl/weld.hxx> -#include <com/sun/star/frame/XFrame.hpp> +class DataChangedEvent; +class VclSimpleEvent; +namespace sfx2 { namespace sidebar { class Panel; } } +namespace tools { class JsonWriter; } /// This class is the base for the Widget Layout-based sidebar panels. -class SFX2_DLLPUBLIC PanelLayout : public Control +class SFX2_DLLPUBLIC PanelLayout { protected: + VclPtr<sfx2::sidebar::Panel> m_xPanel; std::unique_ptr<weld::Builder> m_xBuilder; - VclPtr<vcl::Window> m_xVclContentArea; std::unique_ptr<weld::Container> m_xContainer; - weld::Widget* m_pInitialFocusWidget; -private: - Idle m_aPanelLayoutIdle; - bool m_bInClose; - css::uno::Reference<css::frame::XFrame> mxFrame; + virtual void DataChanged(const DataChangedEvent& rEvent); + virtual void DumpAsPropertyTree(tools::JsonWriter&); - DECL_DLLPRIVATE_LINK(ImplHandlePanelLayoutTimerHdl, Timer*, void); + virtual weld::Window* GetFrameWeld() const; + +private: + DECL_LINK(DataChangedEventListener, VclSimpleEvent&, void); + DECL_LINK(DumpAsPropertyTreeHdl, tools::JsonWriter&, void); public: - PanelLayout(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription, - const css::uno::Reference<css::frame::XFrame> &rFrame); - virtual ~PanelLayout() override; - virtual void dispose() override; - - virtual Size GetOptimalSize() const override; - virtual void GetFocus() override; - virtual void setPosSizePixel(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, PosSizeFlags nFlags = PosSizeFlags::All) override; - virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout) override; - virtual bool EventNotify(NotifyEvent& rNEvt) override; + PanelLayout(weld::Widget* pParent, const OString& rID, const OUString& rUIXMLDescription); + + void SetPanel(sfx2::sidebar::Panel* pPanel); + + virtual ~PanelLayout(); + + Size get_preferred_size() const + { + return m_xContainer->get_preferred_size(); + } + + void queue_resize(); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/sidebar/SidebarPanelBase.hxx b/include/sfx2/sidebar/SidebarPanelBase.hxx index a12727cfafad..971e286ca74f 100644 --- a/include/sfx2/sidebar/SidebarPanelBase.hxx +++ b/include/sfx2/sidebar/SidebarPanelBase.hxx @@ -29,12 +29,12 @@ #include <com/sun/star/ui/XSidebarPanel.hpp> #include <com/sun/star/ui/XUpdateModel.hpp> -#include <vcl/vclptr.hxx> - class PanelLayout; namespace sfx2::sidebar { +class Panel; + typedef cppu::WeakComponentImplHelper<css::ui::XContextChangeEventListener, css::ui::XUIElement, css::ui::XToolPanel, @@ -51,7 +51,7 @@ class SFX2_DLLPUBLIC SidebarPanelBase final : private ::cppu::BaseMutex, public: static css::uno::Reference<css::ui::XUIElement> Create(const OUString& rsResourceURL, const css::uno::Reference<css::frame::XFrame>& rxFrame, - PanelLayout* pControl, + std::unique_ptr<PanelLayout> xControl, const css::ui::LayoutSize& rLayoutSize); // XContextChangeEventListener @@ -78,9 +78,11 @@ public: // XUpdateModel virtual void SAL_CALL updateModel(const css::uno::Reference<css::frame::XModel>& xModel) override; + void SetParentPanel(sfx2::sidebar::Panel* pPanel); + private: SidebarPanelBase(const OUString& rsResourceURL, const css::uno::Reference<css::frame::XFrame>& rxFrame, - PanelLayout* pWindow, const css::ui::LayoutSize& rLayoutSize); + std::unique_ptr<PanelLayout> xControl, const css::ui::LayoutSize& rLayoutSize); virtual ~SidebarPanelBase() override; SidebarPanelBase(const SidebarPanelBase&) = delete; SidebarPanelBase& operator=( const SidebarPanelBase& ) = delete; @@ -88,7 +90,7 @@ private: virtual void SAL_CALL disposing() override; css::uno::Reference<css::frame::XFrame> mxFrame; - VclPtr<PanelLayout> mpControl; + std::unique_ptr<PanelLayout> mxControl; const OUString msResourceURL; const css::ui::LayoutSize maLayoutSize; }; diff --git a/include/sfx2/templdlg.hxx b/include/sfx2/templdlg.hxx index 81febcf7f01f..5dd5b8b6b178 100644 --- a/include/sfx2/templdlg.hxx +++ b/include/sfx2/templdlg.hxx @@ -31,9 +31,8 @@ class SfxTemplateDialog_Impl; class UNLESS_MERGELIBS(SFX2_DLLPUBLIC) SfxTemplatePanelControl final : public PanelLayout { public: - SfxTemplatePanelControl(SfxBindings* pBindings, vcl::Window* pParentWindow); + SfxTemplatePanelControl(SfxBindings* pBindings, weld::Widget* pParent); virtual ~SfxTemplatePanelControl() override; - virtual void dispose() override; weld::Builder* get_builder() { return m_xBuilder.get(); } weld::Container* get_container() { return m_xContainer.get(); } diff --git a/include/svx/sidebar/AreaPropertyPanelBase.hxx b/include/svx/sidebar/AreaPropertyPanelBase.hxx index a3103b6c04c2..434a6397d4e2 100644 --- a/include/svx/sidebar/AreaPropertyPanelBase.hxx +++ b/include/svx/sidebar/AreaPropertyPanelBase.hxx @@ -51,11 +51,6 @@ class SVX_DLLPUBLIC AreaPropertyPanelBase { public: - virtual void dispose() override; - - virtual void DataChanged( - const DataChangedEvent& rEvent) override; - virtual void NotifyItemUpdate( const sal_uInt16 nSId, const SfxItemState eState, @@ -78,7 +73,7 @@ public: // constructor/destructor AreaPropertyPanelBase( - vcl::Window* pParent, + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame); virtual ~AreaPropertyPanelBase() override; @@ -148,8 +143,6 @@ protected: OUString maImgSquare; OUString maImgLinear; - VclPtr<sfx2::sidebar::Panel> mpPanel; - std::unique_ptr< XFillFloatTransparenceItem > mpFloatTransparenceItem; std::unique_ptr< SfxUInt16Item > mpTransparanceItem; diff --git a/include/svx/sidebar/InspectorTextPanel.hxx b/include/svx/sidebar/InspectorTextPanel.hxx index 10ddf932fe06..ce4eecf8ad64 100644 --- a/include/svx/sidebar/InspectorTextPanel.hxx +++ b/include/svx/sidebar/InspectorTextPanel.hxx @@ -45,13 +45,10 @@ class SVX_DLLPUBLIC InspectorTextPanel : public PanelLayout { public: virtual ~InspectorTextPanel() override; - virtual void dispose() override; - static VclPtr<vcl::Window> Create(vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame); + static std::unique_ptr<PanelLayout> Create(weld::Widget* pParent); - InspectorTextPanel(vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame); + InspectorTextPanel(weld::Widget* pParent); void updateEntries(const std::vector<TreeNode>& rStore); diff --git a/include/svx/sidebar/LinePropertyPanelBase.hxx b/include/svx/sidebar/LinePropertyPanelBase.hxx index 52411be57d2c..34668f486061 100644 --- a/include/svx/sidebar/LinePropertyPanelBase.hxx +++ b/include/svx/sidebar/LinePropertyPanelBase.hxx @@ -25,6 +25,7 @@ #include <sfx2/sidebar/PanelLayout.hxx> #include <svx/sidebar/LineWidthPopup.hxx> #include <svx/svxdllapi.h> +#include <com/sun/star/frame/XFrame.hpp> class ToolbarUnoDispatcher; class XLineStyleItem; @@ -46,7 +47,6 @@ class SVX_DLLPUBLIC LinePropertyPanelBase : public PanelLayout { public: virtual ~LinePropertyPanelBase() override; - virtual void dispose() override; void SetWidth(tools::Long nWidth); void SetWidthIcon(int n); @@ -55,7 +55,7 @@ public: void EndLineWidthPopup(); // constructor/destructor - LinePropertyPanelBase(vcl::Window* pParent, + LinePropertyPanelBase(weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame); virtual void setLineWidth(const XLineWidthItem& rItem) = 0; |