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 /svx | |
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 'svx')
32 files changed, 158 insertions, 405 deletions
diff --git a/svx/inc/GalleryControl.hxx b/svx/inc/GalleryControl.hxx index 8f8e6339df85..d5835fb5759b 100644 --- a/svx/inc/GalleryControl.hxx +++ b/svx/inc/GalleryControl.hxx @@ -36,17 +36,13 @@ namespace svx::sidebar class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) GalleryControl final : public PanelLayout { public: - GalleryControl(vcl::Window* pParentWindow); + GalleryControl(weld::Widget* pParentWindow); + virtual ~GalleryControl() override; private: Gallery* mpGallery; std::unique_ptr<GalleryBrowser1> mxBrowser1; std::unique_ptr<GalleryBrowser2> mxBrowser2; - - virtual void GetFocus() override; - - virtual ~GalleryControl() override; - virtual void dispose() override; }; } // end of namespace svx::sidebar diff --git a/svx/source/gallery2/GalleryControl.cxx b/svx/source/gallery2/GalleryControl.cxx index 7ecbffaa90bf..d7b2a969357f 100644 --- a/svx/source/gallery2/GalleryControl.cxx +++ b/svx/source/gallery2/GalleryControl.cxx @@ -25,8 +25,8 @@ namespace svx::sidebar { -GalleryControl::GalleryControl(vcl::Window* pParent) - : PanelLayout(pParent, "GalleryPanel", "svx/ui/sidebargallery.ui", nullptr) +GalleryControl::GalleryControl(weld::Widget* pParent) + : PanelLayout(pParent, "GalleryPanel", "svx/ui/sidebargallery.ui") , mpGallery(Gallery::GetGalleryInstance()) , mxBrowser1(new GalleryBrowser1( *m_xBuilder, @@ -36,26 +36,10 @@ GalleryControl::GalleryControl(vcl::Window* pParent) , mxBrowser2(new GalleryBrowser2(*m_xBuilder, mpGallery)) { mxBrowser1->SelectTheme(0); - m_pInitialFocusWidget = mxBrowser1->GetInitialFocusWidget(); } GalleryControl::~GalleryControl() { - disposeOnce(); -} - -void GalleryControl::dispose() -{ - mxBrowser2.reset(); - mxBrowser1.reset(); - PanelLayout::dispose(); -} - -void GalleryControl::GetFocus() -{ - Window::GetFocus(); - if (mxBrowser1) - mxBrowser1->GrabFocus(); } } // end of namespace svx::sidebar diff --git a/svx/source/inc/DefaultShapesPanel.hxx b/svx/source/inc/DefaultShapesPanel.hxx index 14f34aba22ad..6c2781b4ef6d 100644 --- a/svx/source/inc/DefaultShapesPanel.hxx +++ b/svx/source/inc/DefaultShapesPanel.hxx @@ -38,13 +38,12 @@ class DefaultShapesPanel { public: DefaultShapesPanel ( - vcl::Window* pParent, + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame); - static VclPtr<PanelLayout> Create( - vcl::Window* pParent, + static std::unique_ptr<PanelLayout> Create( + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame); virtual ~DefaultShapesPanel() override; - virtual void dispose() override; private: std::unique_ptr<ValueSet> mxLineArrowSet; diff --git a/svx/source/sidebar/EmptyPanel.cxx b/svx/source/sidebar/EmptyPanel.cxx index f3640a4e91cc..3bc21636b295 100644 --- a/svx/source/sidebar/EmptyPanel.cxx +++ b/svx/source/sidebar/EmptyPanel.cxx @@ -21,19 +21,13 @@ namespace svx::sidebar { -EmptyPanel::EmptyPanel(vcl::Window* pParent) - : PanelLayout(pParent, "EmptyPanel", "svx/ui/sidebarempty.ui", nullptr) +EmptyPanel::EmptyPanel(weld::Widget* pParent) + : PanelLayout(pParent, "EmptyPanel", "svx/ui/sidebarempty.ui") , mxMessageControl(m_xBuilder->weld_label("message")) { } -EmptyPanel::~EmptyPanel() { disposeOnce(); } - -void EmptyPanel::dispose() -{ - mxMessageControl.reset(); - PanelLayout::dispose(); -} +EmptyPanel::~EmptyPanel() {} } // end of namespace svx::sidebar diff --git a/svx/source/sidebar/EmptyPanel.hxx b/svx/source/sidebar/EmptyPanel.hxx index 8abd46d509c5..26007a5302cc 100644 --- a/svx/source/sidebar/EmptyPanel.hxx +++ b/svx/source/sidebar/EmptyPanel.hxx @@ -29,9 +29,8 @@ namespace svx::sidebar class EmptyPanel final : public PanelLayout { public: - explicit EmptyPanel(vcl::Window* pParent); + explicit EmptyPanel(weld::Widget* pParent); virtual ~EmptyPanel() override; - virtual void dispose() override; private: std::unique_ptr<weld::Label> mxMessageControl; diff --git a/svx/source/sidebar/PanelFactory.cxx b/svx/source/sidebar/PanelFactory.cxx index 2a9a586a438b..1749be913f47 100644 --- a/svx/source/sidebar/PanelFactory.cxx +++ b/svx/source/sidebar/PanelFactory.cxx @@ -37,8 +37,7 @@ #include "EmptyPanel.hxx" #include <sfx2/sidebar/SidebarPanelBase.hxx> #include <sfx2/templdlg.hxx> -#include <toolkit/helper/vclunohelper.hxx> -#include <vcl/window.hxx> +#include <vcl/weldutils.hxx> #include <comphelper/namedvaluecollection.hxx> #include <cppuhelper/basemutex.hxx> #include <cppuhelper/compbase.hxx> @@ -103,8 +102,11 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement ( const sal_uInt64 nBindingsValue (aArguments.getOrDefault("SfxBindings", sal_uInt64(0))); SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue); - VclPtr<vcl::Window> pParentWindow = VCLUnoHelper::GetWindow(xParentWindow); - if ( ! xParentWindow.is() || pParentWindow==nullptr) + weld::Widget* pParent(nullptr); + if (weld::TransportAsXWindow* pTunnel = dynamic_cast<weld::TransportAsXWindow*>(xParentWindow.get())) + pParent = pTunnel->getWidget(); + + if (!pParent) throw RuntimeException( "PanelFactory::createUIElement called without ParentWindow", nullptr); @@ -117,81 +119,81 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement ( "PanelFactory::createUIElement called without SfxBindings", nullptr); - VclPtr<PanelLayout> pControl; + std::unique_ptr<PanelLayout> xControl; ui::LayoutSize aLayoutSize (-1,-1,-1); if (rsResourceURL.endsWith("/TextPropertyPanel")) { - pControl = TextPropertyPanel::Create(pParentWindow, xFrame); + xControl = TextPropertyPanel::Create(pParent, xFrame); } else if (rsResourceURL.endsWith("/StylesPropertyPanel")) { - pControl = StylesPropertyPanel::Create(pParentWindow, xFrame); + xControl = StylesPropertyPanel::Create(pParent, xFrame); } else if (rsResourceURL.endsWith("/ParaPropertyPanel")) { - pControl = ParaPropertyPanel::Create(pParentWindow, xFrame, pBindings, xSidebar); + xControl = ParaPropertyPanel::Create(pParent, xFrame, pBindings, xSidebar); } else if (rsResourceURL.endsWith("/ListsPropertyPanel")) { - pControl = ListsPropertyPanel::Create(pParentWindow, xFrame); + xControl = ListsPropertyPanel::Create(pParent, xFrame); } else if (rsResourceURL.endsWith("/AreaPropertyPanel")) { - pControl = AreaPropertyPanel::Create(pParentWindow, xFrame, pBindings); + xControl = AreaPropertyPanel::Create(pParent, xFrame, pBindings); } else if (rsResourceURL.endsWith("/ShadowPropertyPanel")) { - pControl = ShadowPropertyPanel::Create(pParentWindow, xFrame, pBindings); + xControl = ShadowPropertyPanel::Create(pParent, pBindings); } else if (rsResourceURL.endsWith("/EffectPropertyPanel")) { - pControl = EffectPropertyPanel::Create(pParentWindow, xFrame, pBindings); + xControl = EffectPropertyPanel::Create(pParent, pBindings); } else if (rsResourceURL.endsWith("/GraphicPropertyPanel")) { - pControl = GraphicPropertyPanel::Create(pParentWindow, xFrame, pBindings); + xControl = GraphicPropertyPanel::Create(pParent, pBindings); } else if (rsResourceURL.endsWith("/LinePropertyPanel")) { - pControl = LinePropertyPanel::Create(pParentWindow, xFrame, pBindings); + xControl = LinePropertyPanel::Create(pParent, xFrame, pBindings); } else if (rsResourceURL.endsWith("/PosSizePropertyPanel")) { - pControl = PosSizePropertyPanel::Create(pParentWindow, xFrame, pBindings, xSidebar); + xControl = PosSizePropertyPanel::Create(pParent, xFrame, pBindings, xSidebar); } else if (rsResourceURL.endsWith("/DefaultShapesPanel")) { - pControl = DefaultShapesPanel::Create(pParentWindow, xFrame); + xControl = DefaultShapesPanel::Create(pParent, xFrame); } #if HAVE_FEATURE_AVMEDIA else if (rsResourceURL.endsWith("/MediaPlaybackPanel")) { - pControl = MediaPlaybackPanel::Create(pParentWindow, xFrame, pBindings); + xControl = MediaPlaybackPanel::Create(pParent, pBindings); } #endif else if (rsResourceURL.endsWith("/GalleryPanel")) { - pControl.reset(VclPtr<GalleryControl>::Create(pParentWindow)); + xControl = std::make_unique<GalleryControl>(pParent); aLayoutSize = ui::LayoutSize(300,-1,400); } else if (rsResourceURL.endsWith("/StyleListPanel")) { - pControl.reset(VclPtr<SfxTemplatePanelControl>::Create(pBindings, pParentWindow)); + xControl = std::make_unique<SfxTemplatePanelControl>(pBindings, pParent); aLayoutSize = ui::LayoutSize(0,-1,-1); } else if (rsResourceURL.endsWith("/EmptyPanel")) { - pControl.reset(VclPtr<EmptyPanel>::Create(pParentWindow)); + xControl = std::make_unique<EmptyPanel>(pParent); aLayoutSize = ui::LayoutSize(20,-1, 50); } - if (pControl) + if (xControl) { return sfx2::sidebar::SidebarPanelBase::Create( rsResourceURL, xFrame, - pControl, + std::move(xControl), aLayoutSize); } else diff --git a/svx/source/sidebar/area/AreaPropertyPanel.cxx b/svx/source/sidebar/area/AreaPropertyPanel.cxx index abe43abcd2c6..b4d22f6823ab 100644 --- a/svx/source/sidebar/area/AreaPropertyPanel.cxx +++ b/svx/source/sidebar/area/AreaPropertyPanel.cxx @@ -31,7 +31,7 @@ using namespace css::uno; namespace svx::sidebar { AreaPropertyPanel::AreaPropertyPanel( - vcl::Window* pParent, + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings) : AreaPropertyPanelBase(pParent, rxFrame), @@ -52,11 +52,6 @@ AreaPropertyPanel::AreaPropertyPanel( AreaPropertyPanel::~AreaPropertyPanel() { - disposeOnce(); -} - -void AreaPropertyPanel::dispose() -{ maStyleControl.dispose(); maColorControl.dispose(); maGradientControl.dispose(); @@ -68,12 +63,10 @@ void AreaPropertyPanel::dispose() maPatternListControl.dispose(); maFillTransparenceController.dispose(); maFillFloatTransparenceController.dispose(); - - AreaPropertyPanelBase::dispose(); } -VclPtr<PanelLayout> AreaPropertyPanel::Create ( - vcl::Window* pParent, +std::unique_ptr<PanelLayout> AreaPropertyPanel::Create ( + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings) { @@ -84,10 +77,7 @@ VclPtr<PanelLayout> AreaPropertyPanel::Create ( if (pBindings == nullptr) throw lang::IllegalArgumentException("no SfxBindings given to AreaPropertyPanel::Create", nullptr, 2); - return VclPtr<AreaPropertyPanel>::Create( - pParent, - rxFrame, - pBindings); + return std::make_unique<AreaPropertyPanel>(pParent, rxFrame, pBindings); } void AreaPropertyPanel::setFillTransparence(const XFillTransparenceItem& rItem) diff --git a/svx/source/sidebar/area/AreaPropertyPanel.hxx b/svx/source/sidebar/area/AreaPropertyPanel.hxx index 581ac37224df..ec7c1223d108 100644 --- a/svx/source/sidebar/area/AreaPropertyPanel.hxx +++ b/svx/source/sidebar/area/AreaPropertyPanel.hxx @@ -43,10 +43,8 @@ class AreaTransparencyGradientControl; class AreaPropertyPanel : public AreaPropertyPanelBase { public: - virtual void dispose() override; - - static VclPtr<PanelLayout> Create( - vcl::Window* pParent, + static std::unique_ptr<PanelLayout> Create( + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings); @@ -54,7 +52,7 @@ public: // constructor/destructor AreaPropertyPanel( - vcl::Window* pParent, + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings); diff --git a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx index 876249873c38..2e9df086c7e8 100644 --- a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx +++ b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx @@ -61,9 +61,9 @@ const sal_Int32 AreaPropertyPanelBase::DEFAULT_ENDVALUE = 16777215; const sal_Int32 AreaPropertyPanelBase::DEFAULT_BORDER = 0; AreaPropertyPanelBase::AreaPropertyPanelBase( - vcl::Window* pParent, + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame) - : PanelLayout(pParent, "AreaPropertyPanel", "svx/ui/sidebararea.ui", rxFrame), + : PanelLayout(pParent, "AreaPropertyPanel", "svx/ui/sidebararea.ui"), meLastXFS(static_cast<sal_uInt16>(-1)), mnLastPosHatch(0), mnLastPosBitmap(0), @@ -104,20 +104,11 @@ AreaPropertyPanelBase::AreaPropertyPanelBase( mpFloatTransparenceItem(), mpTransparanceItem() { - mpPanel = dynamic_cast<sfx2::sidebar::Panel*>(pParent); - Initialize(); - - m_pInitialFocusWidget = mxLbFillType.get(); } AreaPropertyPanelBase::~AreaPropertyPanelBase() { - disposeOnce(); -} - -void AreaPropertyPanelBase::dispose() -{ mxTrGrPopup.reset(); mxColorTextFT.reset(); mxLbFillType.reset(); @@ -134,9 +125,6 @@ void AreaPropertyPanelBase::dispose() mxLbFillGradTo.reset(); mxGradientStyle.reset(); mxBmpImport.reset(); - mpPanel.clear(); - - PanelLayout::dispose(); } void AreaPropertyPanelBase::Initialize() @@ -449,8 +437,8 @@ IMPL_LINK_NOARG(AreaPropertyPanelBase, SelectFillTypeHdl, weld::ComboBox&, void) meLastXFS = static_cast<sal_uInt16>(nPos); - if(mpPanel) - mpPanel->TriggerDeckLayouting(); + if (m_xPanel) + m_xPanel->TriggerDeckLayouting(); } IMPL_LINK_NOARG(AreaPropertyPanelBase, SelectFillColorHdl, ColorListBox&, void) @@ -468,11 +456,6 @@ IMPL_LINK_NOARG(AreaPropertyPanelBase, ChangeGradientAngle, weld::MetricSpinButt SelectFillAttrHdl_Impl(); } -void AreaPropertyPanelBase::DataChanged( - const DataChangedEvent& /*rEvent*/) -{ -} - void AreaPropertyPanelBase::SelectFillAttrHdl_Impl() { sal_Int32 nPosFillStyle = static_cast<eFillStyle>(mxLbFillType->get_active()); @@ -613,8 +596,8 @@ void AreaPropertyPanelBase::SelectFillAttrHdl_Impl() break; } } - if(mpPanel) - mpPanel->TriggerDeckLayouting(); + if (m_xPanel) + m_xPanel->TriggerDeckLayouting(); } void AreaPropertyPanelBase::ImpUpdateTransparencies() @@ -869,8 +852,8 @@ void AreaPropertyPanelBase::updateFillStyle(bool bDisabled, bool bDefaultOrSet, mxToolBoxColor->hide(); meLastXFS = static_cast<sal_uInt16>(-1); mpStyleItem.reset(); - if(mpPanel) - mpPanel->TriggerDeckLayouting(); + if (m_xPanel) + m_xPanel->TriggerDeckLayouting(); } void AreaPropertyPanelBase::updateFillGradient(bool bDisabled, bool bDefaultOrSet, const SfxPoolItem* pState) @@ -910,8 +893,8 @@ void AreaPropertyPanelBase::updateFillGradient(bool bDisabled, bool bDefaultOrSe mxLbFillGradTo->SetNoSelection(); } } - if(mpPanel) - mpPanel->TriggerDeckLayouting(); + if (m_xPanel) + m_xPanel->TriggerDeckLayouting(); } void AreaPropertyPanelBase::updateFillHatch(bool bDisabled, bool bDefaultOrSet, const SfxPoolItem* pState) @@ -943,8 +926,8 @@ void AreaPropertyPanelBase::updateFillHatch(bool bDisabled, bool bDefaultOrSet, mxLbFillAttr->set_active(-1); } } - if(mpPanel) - mpPanel->TriggerDeckLayouting(); + if (m_xPanel) + m_xPanel->TriggerDeckLayouting(); } void AreaPropertyPanelBase::updateFillColor(bool bDefaultOrSet, const SfxPoolItem* pState) @@ -962,8 +945,8 @@ void AreaPropertyPanelBase::updateFillColor(bool bDefaultOrSet, const SfxPoolIte mxLbFillType->set_active(SOLID); Update(); } - if(mpPanel) - mpPanel->TriggerDeckLayouting(); + if (m_xPanel) + m_xPanel->TriggerDeckLayouting(); } void AreaPropertyPanelBase::updateFillBitmap(bool bDisabled, bool bDefaultOrSet, const SfxPoolItem* pState) @@ -997,8 +980,8 @@ void AreaPropertyPanelBase::updateFillBitmap(bool bDisabled, bool bDefaultOrSet, mxLbFillAttr->set_active(-1); } } - if(mpPanel) - mpPanel->TriggerDeckLayouting(); + if (m_xPanel) + m_xPanel->TriggerDeckLayouting(); } void AreaPropertyPanelBase::NotifyItemUpdate( @@ -1265,8 +1248,8 @@ void AreaPropertyPanelBase::Update() OSL_ENSURE(false, "Non supported FillType (!)"); break; } - if(mpPanel) - mpPanel->TriggerDeckLayouting(); + if (m_xPanel) + m_xPanel->TriggerDeckLayouting(); } IMPL_LINK_NOARG(AreaPropertyPanelBase, ModifyTransSliderHdl, weld::Scale&, void) diff --git a/svx/source/sidebar/effect/EffectPropertyPanel.cxx b/svx/source/sidebar/effect/EffectPropertyPanel.cxx index 85f43813ecc4..78424ccc2175 100644 --- a/svx/source/sidebar/effect/EffectPropertyPanel.cxx +++ b/svx/source/sidebar/effect/EffectPropertyPanel.cxx @@ -21,10 +21,8 @@ namespace svx::sidebar { -EffectPropertyPanel::EffectPropertyPanel(vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, - SfxBindings* pBindings) - : PanelLayout(pParent, "EffectPropertyPanel", "svx/ui/sidebareffect.ui", rxFrame) +EffectPropertyPanel::EffectPropertyPanel(weld::Widget* pParent, SfxBindings* pBindings) + : PanelLayout(pParent, "EffectPropertyPanel", "svx/ui/sidebareffect.ui") , maGlowColorController(SID_ATTR_GLOW_COLOR, *pBindings, *this) , maGlowRadiusController(SID_ATTR_GLOW_RADIUS, *pBindings, *this) , maGlowTransparencyController(SID_ATTR_GLOW_TRANSPARENCY, *pBindings, *this) @@ -42,13 +40,9 @@ EffectPropertyPanel::EffectPropertyPanel(vcl::Window* pParent, , mxSoftEdgeRadius(m_xBuilder->weld_metric_spin_button("SB_SOFTEDGE_RADIUS", FieldUnit::POINT)) { Initialize(); - - m_pInitialFocusWidget = &mxGlowRadius->get_widget(); } -EffectPropertyPanel::~EffectPropertyPanel() { disposeOnce(); } - -void EffectPropertyPanel::dispose() +EffectPropertyPanel::~EffectPropertyPanel() { mxGlowRadius.reset(); mxLBGlowColor.reset(); @@ -59,7 +53,6 @@ void EffectPropertyPanel::dispose() mxSoftEdgeRadius.reset(); mxFTRadiusGlow.reset(); - PanelLayout::dispose(); maGlowColorController.dispose(); maGlowRadiusController.dispose(); maGlowTransparencyController.dispose(); @@ -168,22 +161,17 @@ void EffectPropertyPanel::NotifyItemUpdate(sal_uInt16 nSID, SfxItemState eState, UpdateControls(); } -VclPtr<PanelLayout> -EffectPropertyPanel::Create(vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, - SfxBindings* pBindings) +std::unique_ptr<PanelLayout> EffectPropertyPanel::Create(weld::Widget* pParent, + SfxBindings* pBindings) { if (pParent == nullptr) throw css::lang::IllegalArgumentException( "no parent Window given to EffectPropertyPanel::Create", nullptr, 0); - if (!rxFrame.is()) - throw css::lang::IllegalArgumentException("no XFrame given to EffectPropertyPanel::Create", - nullptr, 1); if (pBindings == nullptr) throw css::lang::IllegalArgumentException( "no SfxBindings given to EffectPropertyPanel::Create", nullptr, 2); - return VclPtr<EffectPropertyPanel>::Create(pParent, rxFrame, pBindings); + return std::make_unique<EffectPropertyPanel>(pParent, pBindings); } } diff --git a/svx/source/sidebar/effect/EffectPropertyPanel.hxx b/svx/source/sidebar/effect/EffectPropertyPanel.hxx index 294abd46b8bd..d657d83e61ca 100644 --- a/svx/source/sidebar/effect/EffectPropertyPanel.hxx +++ b/svx/source/sidebar/effect/EffectPropertyPanel.hxx @@ -9,7 +9,6 @@ #ifndef INCLUDED_SVX_SOURCE_SIDEBAR_EFFECT_EFFECTPROPERTYPANEL_HXX #define INCLUDED_SVX_SOURCE_SIDEBAR_EFFECT_EFFECTPROPERTYPANEL_HXX -#include <vcl/vclptr.hxx> #include <sfx2/sidebar/ControllerItem.hxx> #include <sfx2/sidebar/PanelLayout.hxx> @@ -21,15 +20,10 @@ class EffectPropertyPanel : public PanelLayout, public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface { public: - EffectPropertyPanel(vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, - SfxBindings* pBindings); + EffectPropertyPanel(weld::Widget* pParent, SfxBindings* pBindings); virtual ~EffectPropertyPanel() override; - virtual void dispose() override; - static VclPtr<PanelLayout> Create(vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, - SfxBindings* pBindings); + static std::unique_ptr<PanelLayout> Create(weld::Widget* pParent, SfxBindings* pBindings); virtual void NotifyItemUpdate(const sal_uInt16 nSId, const SfxItemState eState, const SfxPoolItem* pState) override; diff --git a/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx b/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx index e355a47bcca3..5fb1e4448c71 100644 --- a/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx +++ b/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx @@ -36,10 +36,9 @@ namespace svx::sidebar { GraphicPropertyPanel::GraphicPropertyPanel( - vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, + weld::Widget* pParent, SfxBindings* pBindings) -: PanelLayout(pParent, "GraphicPropertyPanel", "svx/ui/sidebargraphic.ui", rxFrame), +: PanelLayout(pParent, "GraphicPropertyPanel", "svx/ui/sidebargraphic.ui"), maBrightControl(SID_ATTR_GRAF_LUMINANCE, *pBindings, *this), maContrastControl(SID_ATTR_GRAF_CONTRAST, *pBindings, *this), maTransparenceControl(SID_ATTR_GRAF_TRANSPARENCE, *pBindings, *this), @@ -60,11 +59,6 @@ GraphicPropertyPanel::GraphicPropertyPanel( GraphicPropertyPanel::~GraphicPropertyPanel() { - disposeOnce(); -} - -void GraphicPropertyPanel::dispose() -{ mxMtrBrightness.reset(); mxMtrContrast.reset(); mxLBColorMode.reset(); @@ -78,8 +72,6 @@ void GraphicPropertyPanel::dispose() maBlueControl.dispose(); maGammaControl.dispose(); maModeControl.dispose(); - - PanelLayout::dispose(); } void GraphicPropertyPanel::Initialize() @@ -130,30 +122,18 @@ IMPL_LINK_NOARG( GraphicPropertyPanel, ClickColorModeHdl, weld::ComboBox&, void SfxCallMode::RECORD, { &aTransItem }); } -VclPtr<PanelLayout> GraphicPropertyPanel::Create ( - vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, +std::unique_ptr<PanelLayout> GraphicPropertyPanel::Create ( + weld::Widget* pParent, SfxBindings* pBindings) { if (pParent == nullptr) throw lang::IllegalArgumentException("no parent Window given to GraphicPropertyPanel::Create", nullptr, 0); - if ( ! rxFrame.is()) - throw lang::IllegalArgumentException("no XFrame given to GraphicPropertyPanel::Create", nullptr, 1); if (pBindings == nullptr) throw lang::IllegalArgumentException("no SfxBindings given to GraphicPropertyPanel::Create", nullptr, 2); - return VclPtr<GraphicPropertyPanel>::Create( - pParent, - rxFrame, - pBindings); + return std::make_unique<GraphicPropertyPanel>(pParent, pBindings); } -void GraphicPropertyPanel::DataChanged( - const DataChangedEvent& /*rEvent*/) -{ -} - - void GraphicPropertyPanel::NotifyItemUpdate( sal_uInt16 nSID, SfxItemState eState, @@ -260,7 +240,6 @@ void GraphicPropertyPanel::NotifyItemUpdate( } } - // namespace close } // end of namespace svx::sidebar diff --git a/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx b/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx index 3554c01a6266..e7fd4914b3b1 100644 --- a/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx +++ b/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx @@ -31,16 +31,11 @@ class GraphicPropertyPanel { public: virtual ~GraphicPropertyPanel() override; - virtual void dispose() override; - static VclPtr<PanelLayout> Create( - vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, + static std::unique_ptr<PanelLayout> Create( + weld::Widget* pParent, SfxBindings* pBindings); - virtual void DataChanged( - const DataChangedEvent& rEvent) override; - virtual void NotifyItemUpdate( const sal_uInt16 nSId, const SfxItemState eState, @@ -54,8 +49,7 @@ public: // constructor/destructor GraphicPropertyPanel( - vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, + weld::Widget* pParent, SfxBindings* pBindings); private: diff --git a/svx/source/sidebar/inspector/InspectorTextPanel.cxx b/svx/source/sidebar/inspector/InspectorTextPanel.cxx index 493c4e37451f..8054cb9ee4c5 100644 --- a/svx/source/sidebar/inspector/InspectorTextPanel.cxx +++ b/svx/source/sidebar/inspector/InspectorTextPanel.cxx @@ -33,23 +33,16 @@ using namespace css; namespace svx::sidebar { -VclPtr<vcl::Window> -InspectorTextPanel::Create(vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame) +std::unique_ptr<PanelLayout> InspectorTextPanel::Create(weld::Widget* pParent) { if (pParent == nullptr) throw lang::IllegalArgumentException("no parent Window given to InspectorTextPanel::Create", nullptr, 0); - if (!rxFrame.is()) - throw lang::IllegalArgumentException("no XFrame given to InspectorTextPanel::Create", - nullptr, 1); - - return VclPtr<InspectorTextPanel>::Create(pParent, rxFrame); + return std::make_unique<InspectorTextPanel>(pParent); } -InspectorTextPanel::InspectorTextPanel(vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame) - : PanelLayout(pParent, "InspectorTextPanel", "svx/ui/inspectortextpanel.ui", rxFrame) +InspectorTextPanel::InspectorTextPanel(weld::Widget* pParent) + : PanelLayout(pParent, "InspectorTextPanel", "svx/ui/inspectortextpanel.ui") , mpListBoxStyles(m_xBuilder->weld_tree_view("listbox_fonts")) { mpListBoxStyles->set_size_request(-1, -1); @@ -58,7 +51,6 @@ InspectorTextPanel::InspectorTextPanel(vcl::Window* pParent, aWidths.push_back(fWidth * 34); aWidths.push_back(fWidth * 34); mpListBoxStyles->set_column_fixed_widths(aWidths); - m_pInitialFocusWidget = mpListBoxStyles.get(); } static bool GetPropertyValues(const OUString& rPropName, const uno::Any& rAny, OUString& rString) @@ -156,14 +148,7 @@ void InspectorTextPanel::updateEntries(const std::vector<TreeNode>& rStore) mpListBoxStyles->collapse_row(*pEntry); // Collapse "Default Paragraph Style" } -InspectorTextPanel::~InspectorTextPanel() { disposeOnce(); } - -void InspectorTextPanel::dispose() -{ - mpListBoxStyles.reset(); - - PanelLayout::dispose(); -} +InspectorTextPanel::~InspectorTextPanel() {} } // end of namespace svx::sidebar diff --git a/svx/source/sidebar/line/LinePropertyPanel.cxx b/svx/source/sidebar/line/LinePropertyPanel.cxx index e813ea099346..acd75820f58d 100644 --- a/svx/source/sidebar/line/LinePropertyPanel.cxx +++ b/svx/source/sidebar/line/LinePropertyPanel.cxx @@ -33,7 +33,7 @@ using namespace css::uno; namespace svx::sidebar { LinePropertyPanel::LinePropertyPanel( - vcl::Window* pParent, + weld::Widget* pParent, const uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings) : LinePropertyPanelBase(pParent, rxFrame), @@ -51,23 +51,16 @@ LinePropertyPanel::LinePropertyPanel( LinePropertyPanel::~LinePropertyPanel() { - disposeOnce(); -} - -void LinePropertyPanel::dispose() -{ maStyleControl.dispose(); maDashControl.dispose(); maWidthControl.dispose(); maTransControl.dispose(); maEdgeStyle.dispose(); maCapStyle.dispose(); - - LinePropertyPanelBase::dispose(); } -VclPtr<PanelLayout> LinePropertyPanel::Create ( - vcl::Window* pParent, +std::unique_ptr<PanelLayout> LinePropertyPanel::Create ( + weld::Widget* pParent, const uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings) { @@ -78,7 +71,7 @@ VclPtr<PanelLayout> LinePropertyPanel::Create ( if (pBindings == nullptr) throw lang::IllegalArgumentException("no SfxBindings given to LinePropertyPanel::Create", nullptr, 2); - return VclPtr<LinePropertyPanel>::Create(pParent, rxFrame, pBindings); + return std::make_unique<LinePropertyPanel>(pParent, rxFrame, pBindings); } void LinePropertyPanel::NotifyItemUpdate( diff --git a/svx/source/sidebar/line/LinePropertyPanel.hxx b/svx/source/sidebar/line/LinePropertyPanel.hxx index 190de5915e1a..7223cd9f1f5a 100644 --- a/svx/source/sidebar/line/LinePropertyPanel.hxx +++ b/svx/source/sidebar/line/LinePropertyPanel.hxx @@ -42,10 +42,9 @@ class LinePropertyPanel : public LinePropertyPanelBase, { public: virtual ~LinePropertyPanel() override; - virtual void dispose() override; - static VclPtr<PanelLayout> Create( - vcl::Window* pParent, + static std::unique_ptr<PanelLayout> Create( + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings); @@ -65,7 +64,7 @@ public: // constructor/destructor LinePropertyPanel( - vcl::Window* pParent, + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings); diff --git a/svx/source/sidebar/line/LinePropertyPanelBase.cxx b/svx/source/sidebar/line/LinePropertyPanelBase.cxx index 0f373900e206..a15762c3586f 100644 --- a/svx/source/sidebar/line/LinePropertyPanelBase.cxx +++ b/svx/source/sidebar/line/LinePropertyPanelBase.cxx @@ -65,9 +65,9 @@ namespace LinePropertyPanelBase::LinePropertyPanelBase( - vcl::Window* pParent, + weld::Widget* pParent, const uno::Reference<css::frame::XFrame>& rxFrame) -: PanelLayout(pParent, "LinePropertyPanel", "svx/ui/sidebarline.ui", rxFrame), +: PanelLayout(pParent, "LinePropertyPanel", "svx/ui/sidebarline.ui"), mxTBColor(m_xBuilder->weld_toolbar("color")), mxColorDispatch(new ToolbarUnoDispatcher(*mxTBColor, *m_xBuilder, rxFrame)), mxLineStyleTB(m_xBuilder->weld_toolbar("linestyle")), @@ -97,11 +97,6 @@ LinePropertyPanelBase::LinePropertyPanelBase( LinePropertyPanelBase::~LinePropertyPanelBase() { - disposeOnce(); -} - -void LinePropertyPanelBase::dispose() -{ mxLineWidthPopup.reset(); mxFTWidth.reset(); mxTBWidth.reset(); @@ -117,8 +112,6 @@ void LinePropertyPanelBase::dispose() mxLBCapStyle.reset(); mxGridLineProps.reset(); mxBoxArrowProps.reset(); - - PanelLayout::dispose(); } void LinePropertyPanelBase::Initialize() diff --git a/svx/source/sidebar/lists/ListsPropertyPanel.cxx b/svx/source/sidebar/lists/ListsPropertyPanel.cxx index 86df5830cf75..58badf67964d 100644 --- a/svx/source/sidebar/lists/ListsPropertyPanel.cxx +++ b/svx/source/sidebar/lists/ListsPropertyPanel.cxx @@ -24,8 +24,8 @@ using namespace css::uno; namespace svx::sidebar { -VclPtr<PanelLayout> -ListsPropertyPanel::Create(vcl::Window* pParent, +std::unique_ptr<PanelLayout> +ListsPropertyPanel::Create(weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame) { if (pParent == nullptr) @@ -35,31 +35,27 @@ ListsPropertyPanel::Create(vcl::Window* pParent, throw lang::IllegalArgumentException("no XFrame given to ListsPropertyPanel::Create", nullptr, 1); - return VclPtr<ListsPropertyPanel>::Create(pParent, rxFrame); + return std::make_unique<ListsPropertyPanel>(pParent, rxFrame); } -ListsPropertyPanel::ListsPropertyPanel(vcl::Window* pParent, +ListsPropertyPanel::ListsPropertyPanel(weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame) - : PanelLayout(pParent, "ListsPropertyPanel", "svx/ui/sidebarlists.ui", rxFrame) + : PanelLayout(pParent, "ListsPropertyPanel", "svx/ui/sidebarlists.ui") , mxTBxNumBullet(m_xBuilder->weld_toolbar("numberbullet")) , mxNumBulletDispatcher(new ToolbarUnoDispatcher(*mxTBxNumBullet, *m_xBuilder, rxFrame)) , mxTBxOutline(m_xBuilder->weld_toolbar("outline")) , mxOutlineDispatcher(new ToolbarUnoDispatcher(*mxTBxOutline, *m_xBuilder, rxFrame)) { - m_pInitialFocusWidget = mxTBxNumBullet.get(); } -ListsPropertyPanel::~ListsPropertyPanel() { disposeOnce(); } - -void ListsPropertyPanel::dispose() +ListsPropertyPanel::~ListsPropertyPanel() { mxOutlineDispatcher.reset(); mxTBxOutline.reset(); mxNumBulletDispatcher.reset(); mxTBxNumBullet.reset(); - - PanelLayout::dispose(); } + } // end of namespace svx::sidebar /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/sidebar/lists/ListsPropertyPanel.hxx b/svx/source/sidebar/lists/ListsPropertyPanel.hxx index 9c2c71f385c6..ec20bb4308dd 100644 --- a/svx/source/sidebar/lists/ListsPropertyPanel.hxx +++ b/svx/source/sidebar/lists/ListsPropertyPanel.hxx @@ -29,12 +29,11 @@ class ListsPropertyPanel : public PanelLayout { public: virtual ~ListsPropertyPanel() override; - virtual void dispose() override; - static VclPtr<PanelLayout> Create(vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame); + static std::unique_ptr<PanelLayout> + Create(weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame); - ListsPropertyPanel(vcl::Window* pParent, + ListsPropertyPanel(weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame); private: diff --git a/svx/source/sidebar/media/MediaPlaybackPanel.cxx b/svx/source/sidebar/media/MediaPlaybackPanel.cxx index cfb1f75662e6..8909ead9669a 100644 --- a/svx/source/sidebar/media/MediaPlaybackPanel.cxx +++ b/svx/source/sidebar/media/MediaPlaybackPanel.cxx @@ -29,10 +29,9 @@ using namespace avmedia; namespace svx::sidebar { MediaPlaybackPanel::MediaPlaybackPanel ( - vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, + weld::Widget* pParent, SfxBindings* pBindings) - : PanelLayout(pParent, "MediaPlaybackPanel", "svx/ui/mediaplayback.ui", rxFrame), + : PanelLayout(pParent, "MediaPlaybackPanel", "svx/ui/mediaplayback.ui"), MediaControlBase(), maMediaController(SID_AVMEDIA_TOOLBOX, *pBindings, *this), maIdle("MediaPlaybackPanel"), @@ -46,31 +45,18 @@ MediaPlaybackPanel::MediaPlaybackPanel ( mxZoomListBox = m_xBuilder->weld_combo_box("zoombox"); Initialize(); - - m_pInitialFocusWidget = mxTimeEdit.get(); } -VclPtr<PanelLayout> MediaPlaybackPanel::Create( - vcl::Window* pParent, - const Reference< XFrame >& rxFrame, +std::unique_ptr<PanelLayout> MediaPlaybackPanel::Create( + weld::Widget* pParent, SfxBindings* pBindings) { if (pParent == nullptr) throw lang::IllegalArgumentException("no parent Window given to MediaPlaybackPanel::Create", nullptr, 0); - if ( ! rxFrame.is()) - throw lang::IllegalArgumentException("no XFrame given to MediaPlaybackPanel::Create", nullptr, 1); if (pBindings == nullptr) throw lang::IllegalArgumentException("no SfxBindings given to MediaPlaybackPanel::Create", nullptr, 2); - return VclPtr<MediaPlaybackPanel>::Create( - pParent, - rxFrame, - pBindings); -} - -MediaPlaybackPanel::~MediaPlaybackPanel() -{ - disposeOnce(); + return std::make_unique<MediaPlaybackPanel>(pParent, pBindings); } void MediaPlaybackPanel::Initialize() @@ -87,10 +73,9 @@ void MediaPlaybackPanel::Initialize() mpBindings->Invalidate(SID_AVMEDIA_TOOLBOX); } -void MediaPlaybackPanel::dispose() +MediaPlaybackPanel::~MediaPlaybackPanel() { disposeWidgets(); - PanelLayout::dispose(); } void MediaPlaybackPanel::NotifyItemUpdate( diff --git a/svx/source/sidebar/media/MediaPlaybackPanel.hxx b/svx/source/sidebar/media/MediaPlaybackPanel.hxx index 415b6d597948..95f3d6eaa6d4 100644 --- a/svx/source/sidebar/media/MediaPlaybackPanel.hxx +++ b/svx/source/sidebar/media/MediaPlaybackPanel.hxx @@ -19,13 +19,13 @@ #pragma once #include <memory> -#include <com/sun/star/frame/XFrame.hpp> #include <sfx2/sidebar/PanelLayout.hxx> #include <avmedia/mediaitem.hxx> #include <sfx2/bindings.hxx> #include <sfx2/sidebar/ControllerItem.hxx> #include <avmedia/MediaControlBase.hxx> +#include <vcl/idle.hxx> using namespace css; using namespace ::com::sun::star::uno; @@ -42,15 +42,12 @@ class MediaPlaybackPanel { public: MediaPlaybackPanel ( - vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, + weld::Widget* pParent, SfxBindings* pBindings); - static VclPtr<PanelLayout> Create( - vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, + static std::unique_ptr<PanelLayout> Create( + weld::Widget* pParent, SfxBindings* pBindings); virtual ~MediaPlaybackPanel() override; - virtual void dispose() override; protected: virtual void UpdateToolBoxes(const avmedia::MediaItem& rMediaItem) override; diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx index d65f34d3f257..2e54af0a8485 100644 --- a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx +++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx @@ -44,8 +44,8 @@ namespace svx::sidebar { #define MAX_SC_SD 116220200 #define NEGA_MAXVALUE -10000000 -VclPtr<PanelLayout> ParaPropertyPanel::Create ( - vcl::Window* pParent, +std::unique_ptr<PanelLayout> ParaPropertyPanel::Create ( + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings, const css::uno::Reference<css::ui::XSidebar>& rxSidebar) @@ -57,11 +57,7 @@ VclPtr<PanelLayout> ParaPropertyPanel::Create ( if (pBindings == nullptr) throw lang::IllegalArgumentException("no SfxBindings given to ParaPropertyPanel::Create", nullptr, 2); - return VclPtr<ParaPropertyPanel>::Create( - pParent, - rxFrame, - pBindings, - rxSidebar); + return std::make_unique<ParaPropertyPanel>(pParent, rxFrame, pBindings, rxSidebar); } void ParaPropertyPanel::HandleContextChange ( @@ -129,8 +125,6 @@ void ParaPropertyPanel::HandleContextChange ( } } -void ParaPropertyPanel::DataChanged (const DataChangedEvent&) {} - void ParaPropertyPanel::ReSize() { if (mxSidebar.is()) @@ -397,11 +391,11 @@ FieldUnit ParaPropertyPanel::GetCurrentUnit( SfxItemState eState, const SfxPoolI return eUnit; } -ParaPropertyPanel::ParaPropertyPanel(vcl::Window* pParent, +ParaPropertyPanel::ParaPropertyPanel(weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings, const css::uno::Reference<css::ui::XSidebar>& rxSidebar) - : PanelLayout(pParent, "ParaPropertyPanel", "svx/ui/sidebarparagraph.ui", rxFrame), + : PanelLayout(pParent, "ParaPropertyPanel", "svx/ui/sidebarparagraph.ui"), //Alignment mxTBxHorzAlign(m_xBuilder->weld_toolbar("horizontalalignment")), mxHorzAlignDispatch(new ToolbarUnoDispatcher(*mxTBxHorzAlign, *m_xBuilder, rxFrame)), @@ -449,7 +443,6 @@ ParaPropertyPanel::ParaPropertyPanel(vcl::Window* pParent, initial(); m_aMetricCtl.RequestUpdate(); - m_pInitialFocusWidget = mxTBxHorzAlign.get(); } void ParaPropertyPanel::limitMetricWidths() @@ -463,11 +456,6 @@ void ParaPropertyPanel::limitMetricWidths() ParaPropertyPanel::~ParaPropertyPanel() { - disposeOnce(); -} - -void ParaPropertyPanel::dispose() -{ mxHorzAlignDispatch.reset(); mxTBxHorzAlign.reset(); @@ -501,8 +489,6 @@ void ParaPropertyPanel::dispose() maLRSpaceControl.dispose(); maULSpaceControl.dispose(); m_aMetricCtl.dispose(); - - PanelLayout::dispose(); } } // end of namespace svx::sidebar diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx index 9900dce714c7..bd252eb1af8a 100644 --- a/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx +++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx @@ -41,15 +41,13 @@ class ParaPropertyPanel { public: virtual ~ParaPropertyPanel() override; - virtual void dispose() override; - static VclPtr<PanelLayout> Create ( - vcl::Window* pParent, + static std::unique_ptr<PanelLayout> Create ( + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings, const css::uno::Reference<css::ui::XSidebar>& rxSidebar); - virtual void DataChanged (const DataChangedEvent& rEvent) override; SfxBindings* GetBindings() { return mpBindings;} virtual void HandleContextChange ( @@ -67,7 +65,7 @@ public: static FieldUnit GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState ); ParaPropertyPanel ( - vcl::Window* pParent, + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings, const css::uno::Reference<css::ui::XSidebar>& rxSidebar); diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx index 32995f267f5a..f77046e0614e 100644 --- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx @@ -56,11 +56,11 @@ constexpr OUStringLiteral USERITEM_NAME = u"FitItem"; namespace svx::sidebar { PosSizePropertyPanel::PosSizePropertyPanel( - vcl::Window* pParent, + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings, const css::uno::Reference<css::ui::XSidebar>& rxSidebar) -: PanelLayout(pParent, "PosSizePropertyPanel", "svx/ui/sidebarpossize.ui", rxFrame), +: PanelLayout(pParent, "PosSizePropertyPanel", "svx/ui/sidebarpossize.ui"), mxFtPosX(m_xBuilder->weld_label("horizontallabel")), mxMtrPosX(m_xBuilder->weld_metric_spin_button("horizontalpos", FieldUnit::CM)), mxFtPosY(m_xBuilder->weld_label("verticallabel")), @@ -136,11 +136,6 @@ PosSizePropertyPanel::PosSizePropertyPanel( PosSizePropertyPanel::~PosSizePropertyPanel() { - disposeOnce(); -} - -void PosSizePropertyPanel::dispose() -{ mxFtPosX.reset(); mxMtrPosX.reset(); mxFtPosY.reset(); @@ -180,11 +175,8 @@ void PosSizePropertyPanel::dispose() maAutoWidthControl.dispose(); maAutoHeightControl.dispose(); m_aMetricCtl.dispose(); - - PanelLayout::dispose(); } - namespace { bool hasText(const SdrView& rSdrView) @@ -254,8 +246,8 @@ void PosSizePropertyPanel::Initialize() mePoolUnit = maTransfWidthControl.GetCoreMetric(); } -VclPtr<PanelLayout> PosSizePropertyPanel::Create ( - vcl::Window* pParent, +std::unique_ptr<PanelLayout> PosSizePropertyPanel::Create ( + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings, const css::uno::Reference<css::ui::XSidebar>& rxSidebar) @@ -267,16 +259,7 @@ VclPtr<PanelLayout> PosSizePropertyPanel::Create ( if (pBindings == nullptr) throw lang::IllegalArgumentException("no SfxBindings given to PosSizePropertyPanel::Create", nullptr, 2); - return VclPtr<PosSizePropertyPanel>::Create( - pParent, - rxFrame, - pBindings, - rxSidebar); -} - -void PosSizePropertyPanel::DataChanged( - const DataChangedEvent& /*rEvent*/) -{ + return std::make_unique<PosSizePropertyPanel>(pParent, rxFrame, pBindings, rxSidebar); } void PosSizePropertyPanel::HandleContextChange( diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx index a67a05ac035c..0bac867d7c55 100644 --- a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx @@ -47,17 +47,13 @@ class PosSizePropertyPanel { public: virtual ~PosSizePropertyPanel() override; - virtual void dispose() override; - static VclPtr<PanelLayout> Create( - vcl::Window* pParent, + static std::unique_ptr<PanelLayout> Create( + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings, const css::uno::Reference<css::ui::XSidebar>& rxSidebar); - virtual void DataChanged( - const DataChangedEvent& rEvent) override; - virtual void HandleContextChange( const vcl::EnumContext& rContext) override; @@ -72,7 +68,7 @@ public: // constructor/destructor PosSizePropertyPanel( - vcl::Window* pParent, + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings, const css::uno::Reference<css::ui::XSidebar>& rxSidebar); diff --git a/svx/source/sidebar/shadow/ShadowPropertyPanel.cxx b/svx/source/sidebar/shadow/ShadowPropertyPanel.cxx index c180e4f3d712..dd3477c5868f 100644 --- a/svx/source/sidebar/shadow/ShadowPropertyPanel.cxx +++ b/svx/source/sidebar/shadow/ShadowPropertyPanel.cxx @@ -29,10 +29,9 @@ using namespace css::uno; namespace svx::sidebar { ShadowPropertyPanel::ShadowPropertyPanel( - vcl::Window* pParent, - const uno::Reference<css::frame::XFrame>& rxFrame, + weld::Widget* pParent, SfxBindings* pBindings) -: PanelLayout(pParent, "ShadowPropertyPanel", "svx/ui/sidebarshadow.ui", rxFrame), +: PanelLayout(pParent, "ShadowPropertyPanel", "svx/ui/sidebarshadow.ui"), maShadowController(SID_ATTR_FILL_SHADOW, *pBindings, *this), maShadowTransController(SID_ATTR_SHADOW_TRANSPARENCE, *pBindings, *this), maShadowBlurController(SID_ATTR_SHADOW_BLUR, *pBindings, *this), @@ -61,11 +60,6 @@ ShadowPropertyPanel::ShadowPropertyPanel( ShadowPropertyPanel::~ShadowPropertyPanel() { - disposeOnce(); -} - -void ShadowPropertyPanel::dispose() -{ mxShowShadow.reset(); mxFTAngle.reset(); mxShadowAngle.reset(); @@ -85,7 +79,6 @@ void ShadowPropertyPanel::dispose() maShadowColorController.dispose(); maShadowXDistanceController.dispose(); maShadowYDistanceController.dispose(); - PanelLayout::dispose(); } void ShadowPropertyPanel::Initialize() @@ -250,10 +243,6 @@ void ShadowPropertyPanel::SetTransparencyValue(tools::Long nVal) mxShadowTransMetric->set_value(nVal, FieldUnit::PERCENT); } -void ShadowPropertyPanel::DataChanged(const DataChangedEvent& /*rEvent*/) -{ -} - void ShadowPropertyPanel::InsertAngleValues() { OUString sSuffix = weld::MetricSpinButton::MetricToString(FieldUnit::DEGREE); @@ -362,19 +351,16 @@ void ShadowPropertyPanel::NotifyItemUpdate( UpdateControls(); } -VclPtr<PanelLayout> ShadowPropertyPanel::Create ( - vcl::Window* pParent, - const uno::Reference<css::frame::XFrame>& rxFrame, +std::unique_ptr<PanelLayout> ShadowPropertyPanel::Create ( + weld::Widget* pParent, SfxBindings* pBindings) { if(pParent == nullptr) throw lang::IllegalArgumentException("no parent Window given to ShadowPropertyPanel::Create", nullptr, 0); - if( !rxFrame.is() ) - throw lang::IllegalArgumentException("no XFrame given to ShadowPropertyPanel::Create", nullptr, 1); if(pBindings == nullptr) throw lang::IllegalArgumentException("no SfxBindings given to ShadowPropertyPanel::Create", nullptr, 2); - return VclPtr<ShadowPropertyPanel>::Create(pParent, rxFrame, pBindings); + return std::make_unique<ShadowPropertyPanel>(pParent, pBindings); } } diff --git a/svx/source/sidebar/shadow/ShadowPropertyPanel.hxx b/svx/source/sidebar/shadow/ShadowPropertyPanel.hxx index 6c2041092a2a..ef4438cd5cdb 100644 --- a/svx/source/sidebar/shadow/ShadowPropertyPanel.hxx +++ b/svx/source/sidebar/shadow/ShadowPropertyPanel.hxx @@ -9,7 +9,6 @@ #ifndef INCLUDED_SVX_SOURCE_SIDEBAR_AREA_SHADOWPROPERTYPANEL_HXX #define INCLUDED_SVX_SOURCE_SIDEBAR_AREA_SHADOWPROPERTYPANEL_HXX -#include <vcl/vclptr.hxx> #include <sfx2/sidebar/ControllerItem.hxx> #include <sfx2/sidebar/PanelLayout.hxx> @@ -23,16 +22,11 @@ class ShadowPropertyPanel { public: virtual ~ShadowPropertyPanel() override; - virtual void dispose() override; - static VclPtr<PanelLayout> Create( - vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, + static std::unique_ptr<PanelLayout> Create( + weld::Widget* pParent, SfxBindings* pBindings); - virtual void DataChanged( - const DataChangedEvent& rEvent) override; - virtual void NotifyItemUpdate( const sal_uInt16 nSId, const SfxItemState eState, @@ -47,8 +41,7 @@ public: void Initialize(); ShadowPropertyPanel( - vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, + weld::Widget* pParent, SfxBindings* pBindings); private: diff --git a/svx/source/sidebar/shapes/DefaultShapesPanel.cxx b/svx/source/sidebar/shapes/DefaultShapesPanel.cxx index f754bd011a16..8b97bb5ee4d1 100644 --- a/svx/source/sidebar/shapes/DefaultShapesPanel.cxx +++ b/svx/source/sidebar/shapes/DefaultShapesPanel.cxx @@ -22,13 +22,14 @@ #include <comphelper/dispatchcommand.hxx> #include <vcl/commandinfoprovider.hxx> #include <vcl/settings.hxx> +#include <vcl/svapp.hxx> namespace svx::sidebar { DefaultShapesPanel::DefaultShapesPanel ( - vcl::Window* pParent, + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame) - : PanelLayout(pParent, "DefaultShapesPanel", "svx/ui/defaultshapespanel.ui", rxFrame) + : PanelLayout(pParent, "DefaultShapesPanel", "svx/ui/defaultshapespanel.ui") , SvxShapeCommandsMap() , mxLineArrowSet(new ValueSet(nullptr)) , mxLineArrowSetWin(new weld::CustomWeld(*m_xBuilder, "LinesArrows", *mxLineArrowSet)) @@ -53,12 +54,10 @@ DefaultShapesPanel::DefaultShapesPanel ( , mxFrame(rxFrame) { Initialize(); - - m_pInitialFocusWidget = mxLineArrowSet->GetDrawingArea(); } -VclPtr<PanelLayout> DefaultShapesPanel::Create( - vcl::Window* pParent, +std::unique_ptr<PanelLayout> DefaultShapesPanel::Create( + weld::Widget* pParent, const Reference< XFrame >& rxFrame) { if (pParent == nullptr) @@ -66,14 +65,7 @@ VclPtr<PanelLayout> DefaultShapesPanel::Create( if ( ! rxFrame.is()) throw lang::IllegalArgumentException("no XFrame given to DefaultShapesPanel::Create", nullptr, 1); - return VclPtr<DefaultShapesPanel>::Create( - pParent, - rxFrame); -} - -DefaultShapesPanel::~DefaultShapesPanel() -{ - disposeOnce(); + return std::make_unique<DefaultShapesPanel>(pParent, rxFrame); } void DefaultShapesPanel::Initialize() @@ -93,12 +85,12 @@ void DefaultShapesPanel::Initialize() populateShapes(); for(auto& aSetMap: mpShapesSetMap) { - aSetMap.first->SetColor(GetSettings().GetStyleSettings().GetDialogColor()); + aSetMap.first->SetColor(Application::GetSettings().GetStyleSettings().GetDialogColor()); aSetMap.first->SetSelectHdl(LINK(this, DefaultShapesPanel, ShapeSelectHdl)); } } -void DefaultShapesPanel::dispose() +DefaultShapesPanel::~DefaultShapesPanel() { mpShapesSetMap.clear(); mxLineArrowSetWin.reset(); @@ -121,7 +113,6 @@ void DefaultShapesPanel::dispose() mxStarSet.reset(); mx3DObjectSetWin.reset(); mx3DObjectSet.reset(); - PanelLayout::dispose(); } IMPL_LINK(DefaultShapesPanel, ShapeSelectHdl, ValueSet*, rValueSet, void) diff --git a/svx/source/sidebar/styles/StylesPropertyPanel.cxx b/svx/source/sidebar/styles/StylesPropertyPanel.cxx index bbfa86190b8c..4e6b2235d104 100644 --- a/svx/source/sidebar/styles/StylesPropertyPanel.cxx +++ b/svx/source/sidebar/styles/StylesPropertyPanel.cxx @@ -17,8 +17,8 @@ using namespace css::uno; namespace svx::sidebar { -VclPtr<PanelLayout> StylesPropertyPanel::Create ( - vcl::Window* pParent, +std::unique_ptr<PanelLayout> StylesPropertyPanel::Create ( + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame) { if (pParent == nullptr) @@ -26,37 +26,24 @@ VclPtr<PanelLayout> StylesPropertyPanel::Create ( if ( ! rxFrame.is()) throw lang::IllegalArgumentException("no XFrame given to StylesPropertyPanel::Create", nullptr, 1); - return VclPtr<StylesPropertyPanel>::Create(pParent,rxFrame); + return std::make_unique<StylesPropertyPanel>(pParent, rxFrame); } -StylesPropertyPanel::StylesPropertyPanel ( vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame ) - : PanelLayout(pParent, "SidebarStylesPanel", "svx/ui/sidebarstylespanel.ui", rxFrame) +StylesPropertyPanel::StylesPropertyPanel(weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame) + : PanelLayout(pParent, "SidebarStylesPanel", "svx/ui/sidebarstylespanel.ui") , m_xFontStyle(m_xBuilder->weld_toolbar("fontstyletoolbox")) , m_xFontStyleDispatch(new ToolbarUnoDispatcher(*m_xFontStyle, *m_xBuilder, rxFrame)) , m_xStyle(m_xBuilder->weld_toolbar("style")) , m_xStyleDispatch(new ToolbarUnoDispatcher(*m_xStyle, *m_xBuilder, rxFrame)) { - m_pInitialFocusWidget = m_xFontStyle.get(); } StylesPropertyPanel::~StylesPropertyPanel() { - disposeOnce(); -} - -void StylesPropertyPanel::dispose() -{ m_xStyleDispatch.reset(); m_xStyle.reset(); m_xFontStyleDispatch.reset(); m_xFontStyle.reset(); - - PanelLayout::dispose(); -} - -void StylesPropertyPanel::DataChanged( const DataChangedEvent& /*rEvent*/) -{ - } } diff --git a/svx/source/sidebar/styles/StylesPropertyPanel.hxx b/svx/source/sidebar/styles/StylesPropertyPanel.hxx index 0d32a38e3f88..66f773ae95a3 100644 --- a/svx/source/sidebar/styles/StylesPropertyPanel.hxx +++ b/svx/source/sidebar/styles/StylesPropertyPanel.hxx @@ -25,16 +25,12 @@ private: public: virtual ~StylesPropertyPanel() override; - static VclPtr<PanelLayout> Create ( - vcl::Window* pParent, + static std::unique_ptr<PanelLayout> Create ( + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame); - virtual void DataChanged( const DataChangedEvent& rEvent ) override; - - virtual void dispose() override; - StylesPropertyPanel( - vcl::Window* pParent, + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame); }; diff --git a/svx/source/sidebar/text/TextPropertyPanel.cxx b/svx/source/sidebar/text/TextPropertyPanel.cxx index 48542ac7476a..1b59a79aa6ed 100644 --- a/svx/source/sidebar/text/TextPropertyPanel.cxx +++ b/svx/source/sidebar/text/TextPropertyPanel.cxx @@ -27,8 +27,8 @@ using namespace css; namespace svx::sidebar { -VclPtr<PanelLayout> TextPropertyPanel::Create ( - vcl::Window* pParent, +std::unique_ptr<PanelLayout> TextPropertyPanel::Create ( + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame) { if (pParent == nullptr) @@ -36,11 +36,11 @@ VclPtr<PanelLayout> TextPropertyPanel::Create ( if ( ! rxFrame.is()) throw lang::IllegalArgumentException("no XFrame given to TextPropertyPanel::Create", nullptr, 1); - return VclPtr<TextPropertyPanel>::Create(pParent, rxFrame); + return std::make_unique<TextPropertyPanel>(pParent, rxFrame); } -TextPropertyPanel::TextPropertyPanel ( vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame ) - : PanelLayout(pParent, "SidebarTextPanel", "svx/ui/sidebartextpanel.ui", rxFrame) +TextPropertyPanel::TextPropertyPanel(weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame) + : PanelLayout(pParent, "SidebarTextPanel", "svx/ui/sidebartextpanel.ui") , mxFont(m_xBuilder->weld_toolbar("font")) , mxFontDispatch(new ToolbarUnoDispatcher(*mxFont, *m_xBuilder, rxFrame)) , mxFontHeight(m_xBuilder->weld_toolbar("fontheight")) @@ -70,17 +70,10 @@ TextPropertyPanel::TextPropertyPanel ( vcl::Window* pParent, const css::uno::Ref pViewShell && pViewShell->isLOKMobilePhone()) isMobilePhone = true; mxSpacingBar->set_visible(!isMobilePhone); - - m_pInitialFocusWidget = mxFont.get(); } TextPropertyPanel::~TextPropertyPanel() { - disposeOnce(); -} - -void TextPropertyPanel::dispose() -{ mxResetBarDispatch.reset(); mxDefaultBarDispatch.reset(); mxPositionBarDispatch.reset(); @@ -104,8 +97,6 @@ void TextPropertyPanel::dispose() mxFontEffects.reset(); mxFontHeight.reset(); mxFont.reset(); - - PanelLayout::dispose(); } void TextPropertyPanel::HandleContextChange ( diff --git a/svx/source/sidebar/text/TextPropertyPanel.hxx b/svx/source/sidebar/text/TextPropertyPanel.hxx index 5a99da71dc0e..3ad44bde78ac 100644 --- a/svx/source/sidebar/text/TextPropertyPanel.hxx +++ b/svx/source/sidebar/text/TextPropertyPanel.hxx @@ -32,17 +32,16 @@ class TextPropertyPanel { public: virtual ~TextPropertyPanel() override; - virtual void dispose() override; - static VclPtr<PanelLayout> Create ( - vcl::Window* pParent, + static std::unique_ptr<PanelLayout> Create ( + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame); virtual void HandleContextChange ( const vcl::EnumContext& rContext) override; TextPropertyPanel ( - vcl::Window* pParent, + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame); private: |