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 | |
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>
143 files changed, 982 insertions, 1551 deletions
diff --git a/chart2/source/controller/sidebar/Chart2PanelFactory.cxx b/chart2/source/controller/sidebar/Chart2PanelFactory.cxx index 62d1ab65753f..b5bde521d031 100644 --- a/chart2/source/controller/sidebar/Chart2PanelFactory.cxx +++ b/chart2/source/controller/sidebar/Chart2PanelFactory.cxx @@ -20,12 +20,11 @@ #include "Chart2PanelFactory.hxx" #include <sfx2/sidebar/SidebarPanelBase.hxx> -#include <toolkit/helper/vclunohelper.hxx> -#include <vcl/window.hxx> #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> #include <cppuhelper/exc_hlp.hxx> #include <comphelper/namedvaluecollection.hxx> #include <cppuhelper/supportsservice.hxx> +#include <vcl/weldutils.hxx> #include "ChartElementsPanel.hxx" #include "ChartTypePanel.hxx" @@ -62,8 +61,11 @@ Reference<css::ui::XUIElement> SAL_CALL ChartPanelFactory::createUIElement ( Reference<css::awt::XWindow> xParentWindow (aArguments.getOrDefault("ParentWindow", Reference<css::awt::XWindow>())); Reference<css::frame::XController> xController (aArguments.getOrDefault("Controller", Reference<css::frame::XController>())); - 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); @@ -82,35 +84,27 @@ Reference<css::ui::XUIElement> SAL_CALL ChartPanelFactory::createUIElement ( "ChartPanelFactory::createUIElement called without valid ChartController", nullptr); - VclPtr<PanelLayout> pPanel; + std::unique_ptr<PanelLayout> xPanel; if (rsResourceURL.endsWith("/ElementsPanel")) - pPanel = ChartElementsPanel::Create( pParentWindow, xFrame, pController ); + xPanel = ChartElementsPanel::Create( pParent, pController ); else if (rsResourceURL.endsWith("/TypePanel")) - { - //pPanel = ChartTypePanel::Create( pParentWindow, xFrame, pController ); - VclPtrInstance<ChartTypePanel> ppPanel(pParentWindow, xFrame, pController); - xElement = sfx2::sidebar::SidebarPanelBase::Create( - rsResourceURL, - xFrame, - ppPanel, - css::ui::LayoutSize(-1,-1,-1)); - } + xPanel = std::make_unique<ChartTypePanel>(pParent, pController); else if (rsResourceURL.endsWith("/SeriesPanel")) - pPanel = ChartSeriesPanel::Create(pParentWindow, xFrame, pController); + xPanel = ChartSeriesPanel::Create(pParent, pController); else if (rsResourceURL.endsWith("/AxisPanel")) - pPanel = ChartAxisPanel::Create(pParentWindow, xFrame, pController); + xPanel = ChartAxisPanel::Create(pParent, pController); else if (rsResourceURL.endsWith("/ErrorBarPanel")) - pPanel = ChartErrorBarPanel::Create(pParentWindow, xFrame, pController); + xPanel = ChartErrorBarPanel::Create(pParent, pController); else if (rsResourceURL.endsWith("/AreaPanel")) - pPanel = ChartAreaPanel::Create(pParentWindow, xFrame, pController); + xPanel = ChartAreaPanel::Create(pParent, xFrame, pController); else if (rsResourceURL.endsWith("/LinePanel")) - pPanel = ChartLinePanel::Create(pParentWindow, xFrame, pController); + xPanel = ChartLinePanel::Create(pParent, xFrame, pController); - if (pPanel) + if (xPanel) xElement = sfx2::sidebar::SidebarPanelBase::Create( rsResourceURL, xFrame, - pPanel, + std::move(xPanel), css::ui::LayoutSize(-1,-1,-1)); } catch (const css::uno::RuntimeException &) diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.cxx b/chart2/source/controller/sidebar/ChartAreaPanel.cxx index 6d25025d460f..51e71e22cf33 100644 --- a/chart2/source/controller/sidebar/ChartAreaPanel.cxx +++ b/chart2/source/controller/sidebar/ChartAreaPanel.cxx @@ -256,8 +256,8 @@ private: } -VclPtr<PanelLayout> ChartAreaPanel::Create( - vcl::Window* pParent, +std::unique_ptr<PanelLayout> ChartAreaPanel::Create( + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, ChartController* pController) { @@ -266,11 +266,10 @@ VclPtr<PanelLayout> ChartAreaPanel::Create( if (!rxFrame.is()) throw css::lang::IllegalArgumentException("no XFrame given to ChartAxisPanel::Create", nullptr, 1); - return VclPtr<ChartAreaPanel>::Create( - pParent, rxFrame, pController); + return std::make_unique<ChartAreaPanel>(pParent, rxFrame, pController); } -ChartAreaPanel::ChartAreaPanel(vcl::Window* pParent, +ChartAreaPanel::ChartAreaPanel(weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, ChartController* pController): svx::sidebar::AreaPropertyPanelBase(pParent, rxFrame), @@ -290,19 +289,12 @@ ChartAreaPanel::ChartAreaPanel(vcl::Window* pParent, ChartAreaPanel::~ChartAreaPanel() { - disposeOnce(); -} - -void ChartAreaPanel::dispose() -{ css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW); xBroadcaster->removeModifyListener(mxListener); css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY); if (xSelectionSupplier.is()) xSelectionSupplier->removeSelectionChangeListener(mxSelectionListener); - - AreaPropertyPanelBase::dispose(); } void ChartAreaPanel::Initialize() diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.hxx b/chart2/source/controller/sidebar/ChartAreaPanel.hxx index c7d171f20e38..01fb9077a178 100644 --- a/chart2/source/controller/sidebar/ChartAreaPanel.hxx +++ b/chart2/source/controller/sidebar/ChartAreaPanel.hxx @@ -37,14 +37,14 @@ class ChartAreaPanel : public svx::sidebar::AreaPropertyPanelBase, public ChartSidebarSelectionListenerParent { public: - static VclPtr<PanelLayout> Create( - vcl::Window* pParent, + static std::unique_ptr<PanelLayout> Create( + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, ChartController* pController); // constructor/destructor ChartAreaPanel( - vcl::Window* pParent, + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, ChartController* pController); @@ -63,8 +63,6 @@ public: virtual void selectionChanged(bool bCorrectType) override; - virtual void dispose() override; - virtual void updateModel(css::uno::Reference<css::frame::XModel> xModel) override; private: diff --git a/chart2/source/controller/sidebar/ChartAxisPanel.cxx b/chart2/source/controller/sidebar/ChartAxisPanel.cxx index bf84d253961d..f35a57bdf232 100644 --- a/chart2/source/controller/sidebar/ChartAxisPanel.cxx +++ b/chart2/source/controller/sidebar/ChartAxisPanel.cxx @@ -204,10 +204,9 @@ double getAxisRotation(const css::uno::Reference<css::frame::XModel>& xModel, } ChartAxisPanel::ChartAxisPanel( - vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, + weld::Widget* pParent, ChartController* pController) - : PanelLayout(pParent, "ChartAxisPanel", "modules/schart/ui/sidebaraxis.ui", rxFrame) + : PanelLayout(pParent, "ChartAxisPanel", "modules/schart/ui/sidebaraxis.ui") , mxCBShowLabel(m_xBuilder->weld_check_button("checkbutton_show_label")) , mxCBReverse(m_xBuilder->weld_check_button("checkbutton_reverse")) , mxLBLabelPos(m_xBuilder->weld_combo_box("comboboxtext_label_position")) @@ -219,17 +218,10 @@ ChartAxisPanel::ChartAxisPanel( , mbModelValid(true) { Initialize(); - - m_pInitialFocusWidget = mxCBShowLabel.get(); } ChartAxisPanel::~ChartAxisPanel() { - disposeOnce(); -} - -void ChartAxisPanel::dispose() -{ css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW); xBroadcaster->removeModifyListener(mxModifyListener); @@ -244,8 +236,6 @@ void ChartAxisPanel::dispose() mxGridLabel.reset(); mxNFRotation.reset(); - - PanelLayout::dispose(); } void ChartAxisPanel::Initialize() @@ -288,23 +278,18 @@ void ChartAxisPanel::updateData() mxNFRotation->set_value(getAxisRotation(mxModel, aCID), FieldUnit::DEGREE); } -VclPtr<PanelLayout> ChartAxisPanel::Create ( - vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, +std::unique_ptr<PanelLayout> ChartAxisPanel::Create ( + weld::Widget* pParent, ChartController* pController) { if (pParent == nullptr) throw lang::IllegalArgumentException("no parent Window given to ChartAxisPanel::Create", nullptr, 0); - if ( ! rxFrame.is()) - throw lang::IllegalArgumentException("no XFrame given to ChartAxisPanel::Create", nullptr, 1); - - return VclPtr<ChartAxisPanel>::Create( - pParent, rxFrame, pController); + return std::make_unique<ChartAxisPanel>(pParent, pController); } -void ChartAxisPanel::DataChanged( - const DataChangedEvent& ) +void ChartAxisPanel::DataChanged(const DataChangedEvent& rEvent) { + PanelLayout::DataChanged(rEvent); updateData(); } diff --git a/chart2/source/controller/sidebar/ChartAxisPanel.hxx b/chart2/source/controller/sidebar/ChartAxisPanel.hxx index f662c9f27cf5..b5f36d90ad89 100644 --- a/chart2/source/controller/sidebar/ChartAxisPanel.hxx +++ b/chart2/source/controller/sidebar/ChartAxisPanel.hxx @@ -14,7 +14,6 @@ #include <sfx2/sidebar/IContextChangeReceiver.hxx> #include <sfx2/sidebar/SidebarModelUpdate.hxx> #include <sfx2/sidebar/PanelLayout.hxx> - #include "ChartSidebarModifyListener.hxx" #include "ChartSidebarSelectionListener.hxx" @@ -35,9 +34,8 @@ class ChartAxisPanel : public PanelLayout, public ChartSidebarSelectionListenerParent { public: - static VclPtr<PanelLayout> Create( - vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, + static std::unique_ptr<PanelLayout> Create( + weld::Widget* pParent, ChartController* pController); virtual void DataChanged( @@ -57,11 +55,9 @@ public: // constructor/destructor ChartAxisPanel( - vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, + weld::Widget* pParent, ChartController* pController); virtual ~ChartAxisPanel() override; - virtual void dispose() override; virtual void updateData() override; virtual void modelInvalid() override; diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx index f740fa7319ac..582ac621ee12 100644 --- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx +++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx @@ -298,9 +298,8 @@ void setLegendPos(const css::uno::Reference<css::frame::XModel>& xModel, sal_Int } ChartElementsPanel::ChartElementsPanel( - vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, - ChartController* pController) - : PanelLayout(pParent, "ChartElementsPanel", "modules/schart/ui/sidebarelements.ui", rxFrame) + weld::Widget* pParent, ChartController* pController) + : PanelLayout(pParent, "ChartElementsPanel", "modules/schart/ui/sidebarelements.ui") , mxCBTitle(m_xBuilder->weld_check_button("checkbutton_title")) , mxEditTitle(m_xBuilder->weld_entry("edit_title")) , mxCBSubtitle(m_xBuilder->weld_check_button("checkbutton_subtitle")) @@ -336,17 +335,10 @@ ChartElementsPanel::ChartElementsPanel( maTextSubTitle = mxTextSubTitle->get_label(); Initialize(); - - m_pInitialFocusWidget = mxCBTitle.get(); } ChartElementsPanel::~ChartElementsPanel() { - disposeOnce(); -} - -void ChartElementsPanel::dispose() -{ css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW); xBroadcaster->removeModifyListener(mxListener); mxCBTitle.reset(); @@ -378,8 +370,6 @@ void ChartElementsPanel::dispose() mxTextTitle.reset(); mxTextSubTitle.reset(); - - PanelLayout::dispose(); } void ChartElementsPanel::Initialize() @@ -540,22 +530,18 @@ void ChartElementsPanel::updateData() mxLBLegendPosition->set_active(getLegendPos(mxModel)); } -VclPtr<PanelLayout> ChartElementsPanel::Create ( - vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, +std::unique_ptr<PanelLayout> ChartElementsPanel::Create ( + weld::Widget* pParent, ChartController* pController) { if (pParent == nullptr) throw lang::IllegalArgumentException("no parent Window given to ChartElementsPanel::Create", nullptr, 0); - if ( ! rxFrame.is()) - throw lang::IllegalArgumentException("no XFrame given to ChartElementsPanel::Create", nullptr, 1); - return VclPtr<ChartElementsPanel>::Create( - pParent, rxFrame, pController); + return std::make_unique<ChartElementsPanel>(pParent, pController); } -void ChartElementsPanel::DataChanged( - const DataChangedEvent& ) +void ChartElementsPanel::DataChanged(const DataChangedEvent& rEvent) { + PanelLayout::DataChanged(rEvent); updateData(); } diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.hxx b/chart2/source/controller/sidebar/ChartElementsPanel.hxx index 75ad788d7319..801b40efdb72 100644 --- a/chart2/source/controller/sidebar/ChartElementsPanel.hxx +++ b/chart2/source/controller/sidebar/ChartElementsPanel.hxx @@ -39,9 +39,8 @@ class ChartElementsPanel : public PanelLayout, public ChartSidebarModifyListenerParent { public: - static VclPtr<PanelLayout> Create( - vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, + static std::unique_ptr<PanelLayout> Create( + weld::Widget* pParent, ChartController* pController); virtual void DataChanged( @@ -52,14 +51,11 @@ public: // constructor/destructor ChartElementsPanel( - vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, + weld::Widget* pParent, ChartController* pController); virtual ~ChartElementsPanel() override; - virtual void dispose() override; - virtual void updateData() override; virtual void modelInvalid() override; diff --git a/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx b/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx index 6799a147339d..943abdbdd66c 100644 --- a/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx +++ b/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx @@ -234,10 +234,8 @@ OUString getCID(const css::uno::Reference<css::frame::XModel>& xModel) } -ChartErrorBarPanel::ChartErrorBarPanel( - vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, ChartController* pController) - : PanelLayout(pParent, "ChartErrorBarPanel", "modules/schart/ui/sidebarerrorbar.ui", rxFrame) +ChartErrorBarPanel::ChartErrorBarPanel(weld::Widget* pParent, ChartController* pController) + : PanelLayout(pParent, "ChartErrorBarPanel", "modules/schart/ui/sidebarerrorbar.ui") , mxRBPosAndNeg(m_xBuilder->weld_radio_button("radiobutton_positive_negative")) , mxRBPos(m_xBuilder->weld_radio_button("radiobutton_positive")) , mxRBNeg(m_xBuilder->weld_radio_button("radiobutton_negative")) @@ -249,17 +247,10 @@ ChartErrorBarPanel::ChartErrorBarPanel( , mbModelValid(true) { Initialize(); - - m_pInitialFocusWidget = mxRBPosAndNeg.get(); } ChartErrorBarPanel::~ChartErrorBarPanel() { - disposeOnce(); -} - -void ChartErrorBarPanel::dispose() -{ css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW); xBroadcaster->removeModifyListener(mxListener); @@ -271,8 +262,6 @@ void ChartErrorBarPanel::dispose() mxMFPos.reset(); mxMFNeg.reset(); - - PanelLayout::dispose(); } void ChartErrorBarPanel::Initialize() @@ -349,23 +338,18 @@ void ChartErrorBarPanel::updateData() } } -VclPtr<PanelLayout> ChartErrorBarPanel::Create ( - vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, +std::unique_ptr<PanelLayout> ChartErrorBarPanel::Create ( + weld::Widget* pParent, ChartController* pController) { if (pParent == nullptr) throw lang::IllegalArgumentException("no parent Window given to ChartErrorBarPanel::Create", nullptr, 0); - if ( ! rxFrame.is()) - throw lang::IllegalArgumentException("no XFrame given to ChartErrorBarPanel::Create", nullptr, 1); - - return VclPtr<ChartErrorBarPanel>::Create( - pParent, rxFrame, pController); + return std::make_unique<ChartErrorBarPanel>(pParent, pController); } -void ChartErrorBarPanel::DataChanged( - const DataChangedEvent& ) +void ChartErrorBarPanel::DataChanged(const DataChangedEvent& rEvent) { + PanelLayout::DataChanged(rEvent); updateData(); } diff --git a/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx b/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx index df8d0b621317..0b95a565bf01 100644 --- a/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx +++ b/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx @@ -14,7 +14,6 @@ #include <sfx2/sidebar/IContextChangeReceiver.hxx> #include <sfx2/sidebar/SidebarModelUpdate.hxx> #include <sfx2/sidebar/PanelLayout.hxx> - #include "ChartSidebarModifyListener.hxx" namespace com::sun::star::util { class XModifyListener; } @@ -32,9 +31,8 @@ class ChartErrorBarPanel : public PanelLayout, public ChartSidebarModifyListenerParent { public: - static VclPtr<PanelLayout> Create( - vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, + static std::unique_ptr<PanelLayout> Create( + weld::Widget* pParent, ChartController* pController); virtual void DataChanged( @@ -54,11 +52,9 @@ public: // constructor/destructor ChartErrorBarPanel( - vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, + weld::Widget* pParent, ChartController* pController); virtual ~ChartErrorBarPanel() override; - virtual void dispose() override; virtual void updateData() override; virtual void modelInvalid() override; diff --git a/chart2/source/controller/sidebar/ChartLinePanel.cxx b/chart2/source/controller/sidebar/ChartLinePanel.cxx index 58280f19fcdb..d36c1bf7ce31 100644 --- a/chart2/source/controller/sidebar/ChartLinePanel.cxx +++ b/chart2/source/controller/sidebar/ChartLinePanel.cxx @@ -107,8 +107,8 @@ private: } -VclPtr<PanelLayout> ChartLinePanel::Create( - vcl::Window* pParent, +std::unique_ptr<PanelLayout> ChartLinePanel::Create( + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, ChartController* pController) { @@ -117,11 +117,10 @@ VclPtr<PanelLayout> ChartLinePanel::Create( if (!rxFrame.is()) throw css::lang::IllegalArgumentException("no XFrame given to ChartAxisPanel::Create", nullptr, 1); - return VclPtr<ChartLinePanel>::Create( - pParent, rxFrame, pController); + return std::make_unique<ChartLinePanel>(pParent, rxFrame, pController); } -ChartLinePanel::ChartLinePanel(vcl::Window* pParent, +ChartLinePanel::ChartLinePanel(weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, ChartController* pController): svx::sidebar::LinePropertyPanelBase(pParent, rxFrame), @@ -144,19 +143,12 @@ ChartLinePanel::ChartLinePanel(vcl::Window* pParent, ChartLinePanel::~ChartLinePanel() { - disposeOnce(); -} - -void ChartLinePanel::dispose() -{ css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW); xBroadcaster->removeModifyListener(mxListener); css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY); if (xSelectionSupplier.is()) xSelectionSupplier->removeSelectionChangeListener(mxSelectionListener); - - LinePropertyPanelBase::dispose(); } void ChartLinePanel::Initialize() diff --git a/chart2/source/controller/sidebar/ChartLinePanel.hxx b/chart2/source/controller/sidebar/ChartLinePanel.hxx index b30775353b08..b46452467fec 100644 --- a/chart2/source/controller/sidebar/ChartLinePanel.hxx +++ b/chart2/source/controller/sidebar/ChartLinePanel.hxx @@ -37,14 +37,14 @@ class ChartLinePanel : public svx::sidebar::LinePropertyPanelBase, public ChartSidebarSelectionListenerParent { public: - static VclPtr<PanelLayout> Create( - vcl::Window* pParent, + static std::unique_ptr<PanelLayout> Create( + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, ChartController* pController); // constructor/destructor ChartLinePanel( - vcl::Window* pParent, + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, ChartController* pController); @@ -55,8 +55,6 @@ public: virtual void selectionChanged(bool bCorrectType) override; - virtual void dispose() override; - virtual void updateModel(css::uno::Reference<css::frame::XModel> xModel) override; virtual void setLineWidth(const XLineWidthItem& rItem) override; diff --git a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx index 80153beaa80d..4ce23d66811c 100644 --- a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx +++ b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx @@ -277,10 +277,9 @@ OUString getCID(const css::uno::Reference<css::frame::XModel>& xModel) } ChartSeriesPanel::ChartSeriesPanel( - vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, + weld::Widget* pParent, ChartController* pController) - : PanelLayout(pParent, "ChartSeriesPanel", "modules/schart/ui/sidebarseries.ui", rxFrame) + : PanelLayout(pParent, "ChartSeriesPanel", "modules/schart/ui/sidebarseries.ui") , mxCBLabel(m_xBuilder->weld_check_button("checkbutton_label")) , mxCBTrendline(m_xBuilder->weld_check_button("checkbutton_trendline")) , mxCBXError(m_xBuilder->weld_check_button("checkbutton_x_error")) @@ -297,17 +296,10 @@ ChartSeriesPanel::ChartSeriesPanel( , mbModelValid(true) { Initialize(); - - m_pInitialFocusWidget = mxCBLabel.get(); } ChartSeriesPanel::~ChartSeriesPanel() { - disposeOnce(); -} - -void ChartSeriesPanel::dispose() -{ css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW); xBroadcaster->removeModifyListener(mxListener); css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY); @@ -327,8 +319,6 @@ void ChartSeriesPanel::dispose() mxFTSeriesName.reset(); mxFTSeriesTemplate.reset(); - - PanelLayout::dispose(); } void ChartSeriesPanel::Initialize() @@ -385,23 +375,19 @@ void ChartSeriesPanel::updateData() mxFTSeriesName->set_label(aFrameLabel); } -VclPtr<PanelLayout> ChartSeriesPanel::Create ( - vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, +std::unique_ptr<PanelLayout> ChartSeriesPanel::Create ( + weld::Widget* pParent, ChartController* pController) { if (pParent == nullptr) throw lang::IllegalArgumentException("no parent Window given to ChartSeriesPanel::Create", nullptr, 0); - if ( ! rxFrame.is()) - throw lang::IllegalArgumentException("no XFrame given to ChartSeriesPanel::Create", nullptr, 1); - return VclPtr<ChartSeriesPanel>::Create( - pParent, rxFrame, pController); + return std::make_unique<ChartSeriesPanel>(pParent, pController); } -void ChartSeriesPanel::DataChanged( - const DataChangedEvent& ) +void ChartSeriesPanel::DataChanged(const DataChangedEvent& rEvent) { + PanelLayout::DataChanged(rEvent); updateData(); } diff --git a/chart2/source/controller/sidebar/ChartSeriesPanel.hxx b/chart2/source/controller/sidebar/ChartSeriesPanel.hxx index 485b46fe68d6..2844051001fe 100644 --- a/chart2/source/controller/sidebar/ChartSeriesPanel.hxx +++ b/chart2/source/controller/sidebar/ChartSeriesPanel.hxx @@ -43,9 +43,8 @@ class ChartSeriesPanel : public PanelLayout, public ChartSidebarSelectionListenerParent { public: - static VclPtr<PanelLayout> Create( - vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, + static std::unique_ptr<PanelLayout> Create( + weld::Widget* pParent, ChartController* pController); virtual void DataChanged( @@ -65,11 +64,9 @@ public: // constructor/destructor ChartSeriesPanel( - vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, + weld::Widget* pParent, ChartController* pController); virtual ~ChartSeriesPanel() override; - virtual void dispose() override; virtual void updateData() override; virtual void modelInvalid() override; diff --git a/chart2/source/controller/sidebar/ChartTypePanel.cxx b/chart2/source/controller/sidebar/ChartTypePanel.cxx index a0e38bdb393a..66ffaa97c819 100644 --- a/chart2/source/controller/sidebar/ChartTypePanel.cxx +++ b/chart2/source/controller/sidebar/ChartTypePanel.cxx @@ -39,10 +39,8 @@ using namespace css::uno; namespace chart::sidebar { -ChartTypePanel::ChartTypePanel(vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, - ::chart::ChartController* pController) - : PanelLayout(pParent, "ChartTypePanel", "modules/schart/ui/sidebartype.ui", rxFrame) +ChartTypePanel::ChartTypePanel(weld::Widget* pParent, ::chart::ChartController* pController) + : PanelLayout(pParent, "ChartTypePanel", "modules/schart/ui/sidebartype.ui") , maContext() , mxModel(pController->getModel()) , mxListener(new ChartSidebarModifyListener(this)) @@ -119,13 +117,9 @@ ChartTypePanel::ChartTypePanel(vcl::Window* pParent, m_pSortByXValuesResourceGroup->setChangeListener(this); Initialize(); - - m_pInitialFocusWidget = m_xMainTypeList.get(); } -ChartTypePanel::~ChartTypePanel() { disposeOnce(); } - -void ChartTypePanel::dispose() +ChartTypePanel::~ChartTypePanel() { css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW); @@ -146,8 +140,6 @@ void ChartTypePanel::dispose() m_xSubTypeListWin.reset(); m_xSubTypeList.reset(); m_xMainTypeList.reset(); - - PanelLayout::dispose(); } IMPL_LINK_NOARG(ChartTypePanel, SelectMainTypeHdl, weld::ComboBox&, void) { selectMainType(); } @@ -251,7 +243,11 @@ void ChartTypePanel::updateData() } } -void ChartTypePanel::DataChanged(const DataChangedEvent&) { updateData(); } +void ChartTypePanel::DataChanged(const DataChangedEvent& rEvent) +{ + PanelLayout::DataChanged(rEvent); + updateData(); +} void ChartTypePanel::HandleContextChange(const vcl::EnumContext& rContext) { diff --git a/chart2/source/controller/sidebar/ChartTypePanel.hxx b/chart2/source/controller/sidebar/ChartTypePanel.hxx index 7c4e27246ca3..6a9036ebaa02 100644 --- a/chart2/source/controller/sidebar/ChartTypePanel.hxx +++ b/chart2/source/controller/sidebar/ChartTypePanel.hxx @@ -62,13 +62,10 @@ public: virtual void HandleContextChange(const vcl::EnumContext& rContext) override; // constructor/destructor - ChartTypePanel(vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, - ::chart::ChartController* pController); + ChartTypePanel(weld::Widget* pParent, ::chart::ChartController* pController); virtual ~ChartTypePanel() override; - virtual void dispose() override; - virtual void updateData() override; virtual void modelInvalid() override; diff --git a/comphelper/source/misc/configuration.cxx b/comphelper/source/misc/configuration.cxx index 56b186dea805..873c34b93a91 100644 --- a/comphelper/source/misc/configuration.cxx +++ b/comphelper/source/misc/configuration.cxx @@ -231,6 +231,7 @@ void comphelper::ConfigurationListener::dispose() listener->dispose(); } maListeners.clear(); + mbDisposed = true; } void SAL_CALL comphelper::ConfigurationListener::disposing(css::lang::EventObject const &) 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; diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu index 5df1db5c1b95..2c37dec8fe65 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu @@ -348,6 +348,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>100</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="TextPropertyPanel" oor:op="replace"> @@ -392,6 +395,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>120</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="InspectorTextPanel" oor:op="replace"> @@ -418,6 +424,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>100</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="MediaPlaybackPanel" oor:op="replace"> @@ -441,6 +450,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>100</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="PageStylesPanel" oor:op="replace"> @@ -467,6 +479,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>200</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="PageFormatPanel" oor:op="replace"> @@ -493,6 +508,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>100</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="PageHeaderPanel" oor:op="replace"> @@ -519,6 +537,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>400</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="PageFooterPanel" oor:op="replace"> @@ -545,6 +566,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>500</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="AreaPropertyPanel" oor:op="replace"> @@ -581,6 +605,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>300</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="EffectPropertyPanel" oor:op="replace"> @@ -607,6 +634,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>300</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="ShadowPropertyPanel" oor:op="replace"> @@ -639,6 +669,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>300</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="LinePropertyPanel" oor:op="replace"> @@ -675,6 +708,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>400</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="GalleryPanel" oor:op="replace"> @@ -701,6 +737,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>100</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="PosSizePropertyPanel" oor:op="replace"> @@ -748,6 +787,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>500</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="GraphicPropertyPanel" oor:op="replace"> @@ -773,6 +815,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>300</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="DefaultShapesPanel" oor:op="replace"> @@ -796,6 +841,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>100</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="SlideBackgroundPanel" oor:op="replace"> @@ -827,7 +875,11 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>100</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> + <node oor:name="SdLayoutsPanel" oor:op="replace"> <prop oor:name="Title" oor:type="xs:string"> <value xml:lang="en-US">Layouts</value> @@ -856,7 +908,11 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>200</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> + <node oor:name="SdUsedMasterPagesPanel" oor:op="replace"> <prop oor:name="Title" oor:type="xs:string"> <value xml:lang="en-US">Used in This Presentation</value> @@ -881,6 +937,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>100</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="SdRecentMasterPagesPanel" oor:op="replace"> @@ -907,6 +966,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>200</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="SdAllMasterPagesPanel" oor:op="replace"> @@ -933,6 +995,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>300</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="SdCustomAnimationPanel" oor:op="replace"> @@ -959,6 +1024,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>100</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="SdSlideTransitionPanel" oor:op="replace"> @@ -985,6 +1053,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>100</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="SdTableDesignPanel" oor:op="replace"> @@ -1011,6 +1082,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>300</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="EmptyPanel" oor:op="replace"> @@ -1037,6 +1111,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>100</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="ScAlignmentPropertyPanel" oor:op="replace"> @@ -1067,6 +1144,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>200</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="ScCellAppearancePropertyPanel" oor:op="replace"> @@ -1097,6 +1177,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>300</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="ScNumberFormatPropertyPanel" oor:op="replace"> @@ -1127,6 +1210,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>150</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="ParaPropertyPanel" oor:op="replace"> @@ -1166,6 +1252,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>200</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="ListsPropertyPanel" oor:op="replace"> @@ -1194,6 +1283,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>120</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="SwWrapPropertyPanel" oor:op="replace"> @@ -1226,6 +1318,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>500</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="SwNavigatorPanel" oor:op="replace"> @@ -1255,6 +1350,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>100</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="ScNavigatorPanel" oor:op="replace"> @@ -1284,6 +1382,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>100</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="SdNavigatorPanel" oor:op="replace"> @@ -1313,6 +1414,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>100</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="SwManageChangesPanel" oor:op="replace"> @@ -1342,6 +1446,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>100</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="StyleListPanel" oor:op="replace"> @@ -1368,6 +1475,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>100</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="ScFunctionsPanel" oor:op="replace"> @@ -1394,7 +1504,11 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>100</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> + <node oor:name="SwStylePresetsPanel" oor:op="replace"> <prop oor:name="Title" oor:type="xs:string"> <value xml:lang="en-US">Style Presets</value> @@ -1419,6 +1533,9 @@ <prop oor:name="IsExperimental" oor:type="xs:boolean"> <value>true</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="SwThemePanel" oor:op="replace"> @@ -1445,6 +1562,9 @@ <prop oor:name="IsExperimental" oor:type="xs:boolean"> <value>true</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="ChartElementsPanel" oor:op="replace"> @@ -1468,6 +1588,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>1</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="ChartSeriesPanel" oor:op="replace"> @@ -1494,6 +1617,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>2</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="ChartErrorBarPanel" oor:op="replace"> @@ -1520,6 +1646,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>4</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="ChartAxisPanel" oor:op="replace"> @@ -1546,6 +1675,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>5</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="ChartAreaPanel" oor:op="replace"> @@ -1573,6 +1705,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>6</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="ChartLinePanel" oor:op="replace"> @@ -1604,6 +1739,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>7</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="TableEditPanel" oor:op="replace"> @@ -1633,6 +1771,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>300</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> <node oor:name="ChartTypePanel" oor:op="replace"> @@ -1656,7 +1797,11 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>0</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <value>false</value> + </prop> </node> + </node> </node> </oor:component-data> diff --git a/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs b/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs index 6ed1d79d80cf..9fbb0fbbcbee 100644 --- a/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs @@ -228,6 +228,14 @@ </info> <value>false</value> </prop> + <prop oor:name="WantsAWT" oor:type="xs:boolean"> + <info> + <desc>This flag controls whether the panel requires a awt::XWindow parent. This option cannot be false if WantsCanvas + is also true. The default of true is suitable for third party sidebar panels, false is only useful for built-in + internal panels.</desc> + </info> + <value>true</value> + </prop> </group> </templates> <component> diff --git a/sc/qa/uitest/calc_tests8/navigator.py b/sc/qa/uitest/calc_tests8/navigator.py index 5e8cb99e01e3..1589e45f4763 100644 --- a/sc/qa/uitest/calc_tests8/navigator.py +++ b/sc/qa/uitest/calc_tests8/navigator.py @@ -18,7 +18,7 @@ class navigator(UITestCase): xGridWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "ScNavigatorPanel"})) xCalcDoc = self.xUITest.getTopFocusWindow() - xNavigatorPanel = xCalcDoc.getChild("NavigatorPanelParent") + xNavigatorPanel = xCalcDoc.getChild("NavigatorPanel") xContentBox = xNavigatorPanel.getChild('contentbox') xSheets = xContentBox.getChild("0") self.assertEqual(get_state_as_dict(xSheets)['Text'], 'Sheets') @@ -45,7 +45,7 @@ class navigator(UITestCase): self.ui_test.close_dialog_through_button(xOKBtn) xCalcDoc = self.xUITest.getTopFocusWindow() - xNavigatorPanel = xCalcDoc.getChild("NavigatorPanelParent") + xNavigatorPanel = xCalcDoc.getChild("NavigatorPanel") xContentBox = xNavigatorPanel.getChild('contentbox') xSheets = xContentBox.getChild("0") self.assertEqual(get_state_as_dict(xSheets)['Text'], 'Sheets') @@ -61,7 +61,7 @@ class navigator(UITestCase): self.xUITest.executeCommand(".uno:Undo") xCalcDoc = self.xUITest.getTopFocusWindow() - xNavigatorPanel = xCalcDoc.getChild("NavigatorPanelParent") + xNavigatorPanel = xCalcDoc.getChild("NavigatorPanel") xContentBox = xNavigatorPanel.getChild('contentbox') xSheets = xContentBox.getChild("0") self.assertEqual(get_state_as_dict(xSheets)['Text'], 'Sheets') @@ -90,7 +90,7 @@ class navigator(UITestCase): xGridWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "ScNavigatorPanel"})) xCalcDoc = self.xUITest.getTopFocusWindow() - xNavigatorPanel = xCalcDoc.getChild("NavigatorPanelParent") + xNavigatorPanel = xCalcDoc.getChild("NavigatorPanel") xToolBar = xNavigatorPanel.getChild("toolbox2") xToolBar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) # 'toggle' button @@ -124,7 +124,7 @@ class navigator(UITestCase): xGridWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "ScNavigatorPanel"})) xCalcDoc = self.xUITest.getTopFocusWindow() - xNavigatorPanel = xCalcDoc.getChild("NavigatorPanelParent") + xNavigatorPanel = xCalcDoc.getChild("NavigatorPanel") xToolBar = xNavigatorPanel.getChild("toolbox2") xToolBar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) # 'toggle' button diff --git a/sc/source/ui/formdlg/dwfunctr.cxx b/sc/source/ui/formdlg/dwfunctr.cxx index e5adb6859be2..68aacb9275ba 100644 --- a/sc/source/ui/formdlg/dwfunctr.cxx +++ b/sc/source/ui/formdlg/dwfunctr.cxx @@ -44,8 +44,8 @@ #* #************************************************************************/ -ScFunctionWin::ScFunctionWin(vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame> &rFrame) - : PanelLayout(pParent, "FunctionPanel", "modules/scalc/ui/functionpanel.ui", rFrame) +ScFunctionWin::ScFunctionWin(weld::Widget* pParent) + : PanelLayout(pParent, "FunctionPanel", "modules/scalc/ui/functionpanel.ui") , xCatBox(m_xBuilder->weld_combo_box("category")) , xFuncList(m_xBuilder->weld_tree_view("funclist")) , xInsertButton(m_xBuilder->weld_button("insert")) @@ -70,8 +70,6 @@ ScFunctionWin::ScFunctionWin(vcl::Window* pParent, const css::uno::Reference<css xCatBox->set_active(0); SelComboHdl(*xCatBox); - - m_pInitialFocusWidget = xCatBox.get(); } /************************************************************************* @@ -90,22 +88,14 @@ ScFunctionWin::ScFunctionWin(vcl::Window* pParent, const css::uno::Reference<css ScFunctionWin::~ScFunctionWin() { - disposeOnce(); -} + xConfigChange.reset(); + xConfigListener->dispose(); + xConfigListener.clear(); -void ScFunctionWin::dispose() -{ - if (xConfigChange) - { - xConfigChange.reset(); - xConfigListener->dispose(); - xConfigListener.clear(); - } xCatBox.reset(); xFuncList.reset(); xInsertButton.reset(); xFiFuncDesc.reset(); - PanelLayout::dispose(); } /************************************************************************* @@ -277,9 +267,10 @@ void ScFunctionWin::DoEnter() ScInputHandler* pHdl = pScMod->GetInputHdl( pViewSh ); if(!pScMod->IsEditMode()) { + rtl::Reference<comphelper::ConfigurationListener> xDetectDisposed(xConfigListener); pScMod->SetInputMode(SC_INPUT_TABLE); // the above call can result in us being disposed - if (OutputDevice::isDisposed()) + if (xDetectDisposed->isDisposed()) return; aString = "=" + xFuncList->get_selected_text(); if (pHdl) @@ -412,8 +403,8 @@ IMPL_LINK_NOARG( ScFunctionWin, SetRowActivatedHdl, weld::TreeView&, bool ) void EnglishFunctionNameChange::setProperty(const css::uno::Any &rProperty) { ConfigurationListenerProperty::setProperty(rProperty); - m_xFunctionWin->InitLRUList(); - m_xFunctionWin->UpdateFunctionList(); + m_pFunctionWin->InitLRUList(); + m_pFunctionWin->UpdateFunctionList(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/inc/content.hxx b/sc/source/ui/inc/content.hxx index a32aab9f48a2..70cf3fff38ba 100644 --- a/sc/source/ui/inc/content.hxx +++ b/sc/source/ui/inc/content.hxx @@ -45,7 +45,7 @@ class ScContentTree std::unique_ptr<weld::TreeView> m_xTreeView; std::unique_ptr<weld::TreeIter> m_xScratchIter; rtl::Reference<ScLinkTransferObj> m_xTransferObj; - VclPtr<ScNavigatorDlg> pParentWindow; + ScNavigatorDlg* pParentWindow; o3tl::enumarray<ScContentId, std::unique_ptr<weld::TreeIter>> m_aRootNodes; ScContentId nRootType; // set as Root OUString aManualDoc; // Switched in Navigator (Title) diff --git a/sc/source/ui/inc/dwfunctr.hxx b/sc/source/ui/inc/dwfunctr.hxx index e9dc66132fa0..742d15c30a5d 100644 --- a/sc/source/ui/inc/dwfunctr.hxx +++ b/sc/source/ui/inc/dwfunctr.hxx @@ -29,13 +29,13 @@ class ScFunctionWin; class EnglishFunctionNameChange : public comphelper::ConfigurationListenerProperty<bool> { - VclPtr<ScFunctionWin> m_xFunctionWin; + ScFunctionWin* m_pFunctionWin; protected: virtual void setProperty(const css::uno::Any &rProperty) override; public: EnglishFunctionNameChange(const rtl::Reference<comphelper::ConfigurationListener> &rListener, ScFunctionWin* pFunctionWin) : ConfigurationListenerProperty(rListener, "EnglishFunctionName") - , m_xFunctionWin(pFunctionWin) + , m_pFunctionWin(pFunctionWin) { } }; @@ -66,10 +66,9 @@ private: DECL_LINK( SelTreeHdl, weld::TreeView&, void ); public: - ScFunctionWin(vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame> &rFrame); + ScFunctionWin(weld::Widget* pParent); virtual ~ScFunctionWin() override; - virtual void dispose() override; void InitLRUList(); void UpdateFunctionList(); diff --git a/sc/source/ui/inc/navipi.hxx b/sc/source/ui/inc/navipi.hxx index 37f6bffffbb1..1229f812a59d 100644 --- a/sc/source/ui/inc/navipi.hxx +++ b/sc/source/ui/inc/navipi.hxx @@ -105,6 +105,8 @@ private: std::unique_ptr<weld::ComboBox> m_xLbDocuments; std::unique_ptr<weld::Menu> m_xDragModeMenu; + VclPtr<SfxNavigator> m_xNavigatorDlg; + Size aExpandedSize; Idle aContentIdle; @@ -168,16 +170,17 @@ private: void StartOfDataArea (); void EndOfDataArea (); + void UpdateInitShow(); + static void ReleaseFocus(); public: - ScNavigatorDlg(SfxBindings* pB, vcl::Window* pParent); + ScNavigatorDlg(SfxBindings* pB, weld::Widget* pParent, SfxNavigator* pNavigatorDlg); + virtual weld::Window* GetFrameWeld() const override; virtual ~ScNavigatorDlg() override; - virtual void dispose() override; virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; - virtual void StateChanged(StateChangedType nStateChange) override; }; class ScNavigatorWrapper final : public SfxNavigatorWrapper diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx index 8a9b221ab8d0..90098d4fa68e 100644 --- a/sc/source/ui/navipi/content.cxx +++ b/sc/source/ui/navipi/content.cxx @@ -160,7 +160,6 @@ ScContentTree::~ScContentTree() Application::RemoveUserEvent(m_nAsyncMouseReleaseId); m_nAsyncMouseReleaseId = nullptr; } - pParentWindow.clear(); } static const char* SCSTR_CONTENT_ARY[] = diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx index 1759bf7cea23..f36a740dce9a 100644 --- a/sc/source/ui/navipi/navipi.cxx +++ b/sc/source/ui/navipi/navipi.cxx @@ -312,12 +312,13 @@ ScNavigatorSettings::ScNavigatorSettings() class ScNavigatorWin : public SfxNavigator { private: - VclPtr<ScNavigatorDlg> pNavigator; + std::unique_ptr<ScNavigatorDlg> m_xNavigator; public: ScNavigatorWin(SfxBindings* _pBindings, SfxChildWindow* pMgr, vcl::Window* pParent); + virtual void StateChanged(StateChangedType nStateChange) override; virtual void dispose() override { - pNavigator.disposeAndClear(); + m_xNavigator.reset(); SfxNavigator::dispose(); } virtual ~ScNavigatorWin() override @@ -329,13 +330,12 @@ public: ScNavigatorWin::ScNavigatorWin(SfxBindings* _pBindings, SfxChildWindow* _pMgr, vcl::Window* _pParent) : SfxNavigator(_pBindings, _pMgr, _pParent) { - pNavigator = VclPtr<ScNavigatorDlg>::Create(_pBindings, this); - pNavigator->Show(); - SetMinOutputSizePixel(pNavigator->GetOptimalSize()); + m_xNavigator = std::make_unique<ScNavigatorDlg>(_pBindings, m_xContainer.get(), this); + SetMinOutputSizePixel(GetOptimalSize()); } -ScNavigatorDlg::ScNavigatorDlg(SfxBindings* pB, vcl::Window* pParent) - : PanelLayout(pParent, "NavigatorPanel", "modules/scalc/ui/navigatorpanel.ui", nullptr) +ScNavigatorDlg::ScNavigatorDlg(SfxBindings* pB, weld::Widget* pParent, SfxNavigator* pNavigatorDlg) + : PanelLayout(pParent, "NavigatorPanel", "modules/scalc/ui/navigatorpanel.ui") , rBindings(*pB) , m_xEdCol(m_xBuilder->weld_spin_button("column")) , m_xEdRow(m_xBuilder->weld_spin_button("row")) @@ -347,6 +347,7 @@ ScNavigatorDlg::ScNavigatorDlg(SfxBindings* pB, vcl::Window* pParent) ScResId(SCSTR_QHLP_SCEN_LISTBOX), ScResId(SCSTR_QHLP_SCEN_COMMENT))) , m_xLbDocuments(m_xBuilder->weld_combo_box("documents")) , m_xDragModeMenu(m_xBuilder->weld_menu("dragmodemenu")) + , m_xNavigatorDlg(pNavigatorDlg) , aStrActiveWin(ScResId(SCSTR_ACTIVEWIN)) , pViewData(nullptr ) , eListMode(NAV_LMODE_NONE) @@ -355,7 +356,7 @@ ScNavigatorDlg::ScNavigatorDlg(SfxBindings* pB, vcl::Window* pParent) , nCurRow(0) , nCurTab(0) { - set_id("NavigatorPanelParent"); // for uitests + UpdateInitShow(); UpdateSheetLimits(); m_xEdRow->set_width_chars(5); @@ -422,10 +423,13 @@ ScNavigatorDlg::ScNavigatorDlg(SfxBindings* pB, vcl::Window* pParent) else eNavMode = NAV_LMODE_AREAS; SetListMode(eNavMode); +} - aExpandedSize = m_xContainer->get_preferred_size(); - - m_pInitialFocusWidget = m_xEdCol.get(); +weld::Window* ScNavigatorDlg::GetFrameWeld() const +{ + if (m_xNavigatorDlg) + return m_xNavigatorDlg->GetFrameWeld(); + return PanelLayout::GetFrameWeld(); } void ScNavigatorDlg::UpdateSheetLimits() @@ -439,24 +443,22 @@ void ScNavigatorDlg::UpdateSheetLimits() } } -void ScNavigatorDlg::StateChanged(StateChangedType nStateChange) +void ScNavigatorDlg::UpdateInitShow() { - PanelLayout::StateChanged(nStateChange); - if (nStateChange == StateChangedType::InitShow) - { - // When the navigator is displayed in the sidebar, or is otherwise - // docked, it has the whole deck to fill. Therefore hide the button that - // hides all controls below the top two rows of buttons. - m_xTbxCmd1->set_item_visible("contents", ParentIsFloatingWindow(GetParent())); - } + // When the navigator is displayed in the sidebar, or is otherwise + // docked, it has the whole deck to fill. Therefore hide the button that + // hides all controls below the top two rows of buttons. + m_xTbxCmd1->set_item_visible("contents", ParentIsFloatingWindow(m_xNavigatorDlg)); } -ScNavigatorDlg::~ScNavigatorDlg() +void ScNavigatorWin::StateChanged(StateChangedType nStateChange) { - disposeOnce(); + SfxNavigator::StateChanged(nStateChange); + if (nStateChange == StateChangedType::InitShow) + m_xNavigator->UpdateInitShow(); } -void ScNavigatorDlg::dispose() +ScNavigatorDlg::~ScNavigatorDlg() { aContentIdle.Stop(); @@ -476,7 +478,6 @@ void ScNavigatorDlg::dispose() m_xWndScenarios.reset(); m_xScenarioBox.reset(); m_xLbDocuments.reset(); - PanelLayout::dispose(); } void ScNavigatorDlg::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -764,11 +765,11 @@ void ScNavigatorDlg::SetListMode(NavListMode eMode) { if (eMode != eListMode) { - bool bForceParentResize = ParentIsFloatingWindow(GetParent()) && + bool bForceParentResize = ParentIsFloatingWindow(m_xNavigatorDlg) && (eMode == NAV_LMODE_NONE || eListMode == NAV_LMODE_NONE); - SfxNavigator* pNav = bForceParentResize ? dynamic_cast<SfxNavigator*>(GetParent()) : nullptr; + SfxNavigator* pNav = bForceParentResize ? m_xNavigatorDlg.get() : nullptr; if (pNav && eMode == NAV_LMODE_NONE) //save last normal size on minimizing - aExpandedSize = GetSizePixel(); + aExpandedSize = pNav->GetSizePixel(); eListMode = eMode; @@ -796,7 +797,8 @@ void ScNavigatorDlg::SetListMode(NavListMode eMode) if (pNav) { - Size aOptimalSize(m_xContainer->get_preferred_size()); + pNav->InvalidateChildSizeCache(); + Size aOptimalSize(pNav->GetOptimalSize()); Size aNewSize(pNav->GetOutputSizePixel()); aNewSize.setHeight( eMode == NAV_LMODE_NONE ? aOptimalSize.Height() : aExpandedSize.Height() ); pNav->SetMinOutputSizePixel(aOptimalSize); diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx index 135772d669d9..ff91ad41c0b0 100644 --- a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx +++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx @@ -37,10 +37,10 @@ using namespace css::uno; namespace sc::sidebar { AlignmentPropertyPanel::AlignmentPropertyPanel( - vcl::Window* pParent, + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings) - : PanelLayout(pParent, "AlignmentPropertyPanel", "modules/scalc/ui/sidebaralignment.ui", rxFrame) + : PanelLayout(pParent, "AlignmentPropertyPanel", "modules/scalc/ui/sidebaralignment.ui") , mxFTLeftIndent(m_xBuilder->weld_label("leftindentlabel")) , mxMFLeftIndent(m_xBuilder->weld_metric_spin_button("leftindent", FieldUnit::POINT)) , mxCBXWrapText(m_xBuilder->weld_check_button("wraptext")) @@ -73,16 +73,10 @@ AlignmentPropertyPanel::AlignmentPropertyPanel( , mpBindings(pBindings) { Initialize(); - m_pInitialFocusWidget = &mxMFLeftIndent->get_widget(); } AlignmentPropertyPanel::~AlignmentPropertyPanel() { - disposeOnce(); -} - -void AlignmentPropertyPanel::dispose() -{ mxIndentButtonsDispatch.reset(); mxIndentButtons.reset(); mxWriteDirectionDispatch.reset(); @@ -111,8 +105,6 @@ void AlignmentPropertyPanel::dispose() maAngleControl.dispose(); maVrtStackControl.dispose(); maRefEdgeControl.dispose(); - - PanelLayout::dispose(); } void AlignmentPropertyPanel::Initialize() @@ -199,8 +191,8 @@ IMPL_LINK_NOARG(AlignmentPropertyPanel, CBOXWrapTextClkHdl, weld::ToggleButton&, SfxCallMode::RECORD, { &aItem }); } -VclPtr<PanelLayout> AlignmentPropertyPanel::Create ( - vcl::Window* pParent, +std::unique_ptr<PanelLayout> AlignmentPropertyPanel::Create ( + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings) { @@ -211,14 +203,9 @@ VclPtr<PanelLayout> AlignmentPropertyPanel::Create ( if (pBindings == nullptr) throw lang::IllegalArgumentException("no SfxBindings given to AlignmentPropertyPanel::Create", nullptr, 2); - return VclPtr<AlignmentPropertyPanel>::Create( - pParent, rxFrame, pBindings); + return std::make_unique<AlignmentPropertyPanel>(pParent, rxFrame, pBindings); } -void AlignmentPropertyPanel::DataChanged( - const DataChangedEvent&) -{} - void AlignmentPropertyPanel::HandleContextChange( const vcl::EnumContext& rContext) { diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx index f6f09c11e992..c849a7e9e3f3 100644 --- a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx +++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx @@ -33,14 +33,11 @@ class AlignmentPropertyPanel public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface { public: - 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); - virtual void DataChanged( - const DataChangedEvent& rEvent) override; - virtual void HandleContextChange( const vcl::EnumContext& rContext) override; @@ -57,11 +54,10 @@ public: // constructor/destructor AlignmentPropertyPanel( - vcl::Window* pParent, + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings); virtual ~AlignmentPropertyPanel() override; - virtual void dispose() override; private: //ui controls diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx index 15b1ffad6396..188a638e7315 100644 --- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx +++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx @@ -44,10 +44,10 @@ constexpr OStringLiteral LINESTYLE = "LineStyle"; namespace sc::sidebar { CellAppearancePropertyPanel::CellAppearancePropertyPanel( - vcl::Window* pParent, + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings) -: PanelLayout(pParent, "CellAppearancePropertyPanel", "modules/scalc/ui/sidebarcellappearance.ui", rxFrame), +: PanelLayout(pParent, "CellAppearancePropertyPanel", "modules/scalc/ui/sidebarcellappearance.ui"), mxTBCellBorder(m_xBuilder->weld_toolbar("cellbordertype")), mxTBCellBackground(m_xBuilder->weld_toolbar("cellbackgroundcolor")), @@ -106,11 +106,6 @@ CellAppearancePropertyPanel::CellAppearancePropertyPanel( CellAppearancePropertyPanel::~CellAppearancePropertyPanel() { - disposeOnce(); -} - -void CellAppearancePropertyPanel::dispose() -{ mxCellBorderPopoverContainer.reset(); mxTBCellBorder.reset(); mxBackColorDispatch.reset(); @@ -126,8 +121,6 @@ void CellAppearancePropertyPanel::dispose() maGridShowControl.dispose(); maBorderTLBRControl.dispose(); maBorderBLTRControl.dispose(); - - PanelLayout::dispose(); } void CellAppearancePropertyPanel::Initialize() @@ -184,8 +177,8 @@ IMPL_LINK_NOARG(CellAppearancePropertyPanel, TbxLineStyleMenuHdl, const OString& pPopup->GrabFocus(); } -VclPtr<PanelLayout> CellAppearancePropertyPanel::Create ( - vcl::Window* pParent, +std::unique_ptr<PanelLayout> CellAppearancePropertyPanel::Create ( + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings) { @@ -196,14 +189,9 @@ VclPtr<PanelLayout> CellAppearancePropertyPanel::Create ( if (pBindings == nullptr) throw lang::IllegalArgumentException("no SfxBindings given to CellAppearancePropertyPanel::Create", nullptr, 2); - return VclPtr<CellAppearancePropertyPanel>::Create( - pParent, rxFrame, pBindings); + return std::make_unique<CellAppearancePropertyPanel>(pParent, rxFrame, pBindings); } -void CellAppearancePropertyPanel::DataChanged( - const DataChangedEvent&) -{} - void CellAppearancePropertyPanel::HandleContextChange(const vcl::EnumContext& rContext) { if (maContext == rContext) diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx index d90e57b0bc35..a0249a7249c2 100644 --- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx +++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx @@ -24,6 +24,7 @@ #include <sfx2/sidebar/PanelLayout.hxx> #include <vcl/EnumContext.hxx> #include <vcl/image.hxx> +#include <com/sun/star/frame/XFrame.hpp> class ToolbarUnoDispatcher; class ToolbarPopupContainer; @@ -40,14 +41,11 @@ private: friend class CellBorderStylePopup; public: - 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); - virtual void DataChanged( - const DataChangedEvent& rEvent) override; - virtual void HandleContextChange( const vcl::EnumContext& rContext) override; @@ -64,11 +62,10 @@ public: // constructor/destructor CellAppearancePropertyPanel( - vcl::Window* pParent, + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings); virtual ~CellAppearancePropertyPanel() override; - virtual void dispose() override; private: //ui controls diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx index e3e95e50a710..93dd19da0c98 100644 --- a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx +++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx @@ -31,10 +31,10 @@ using namespace css::uno; namespace sc::sidebar { NumberFormatPropertyPanel::NumberFormatPropertyPanel( - vcl::Window* pParent, + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings) - : PanelLayout(pParent,"NumberFormatPropertyPanel", "modules/scalc/ui/sidebarnumberformat.ui", rxFrame) + : PanelLayout(pParent,"NumberFormatPropertyPanel", "modules/scalc/ui/sidebarnumberformat.ui") , mxLbCategory(m_xBuilder->weld_combo_box("numberformatcombobox")) , mxTBCategory(m_xBuilder->weld_toolbar("numberformat")) , mxCategoryDispatch(new ToolbarUnoDispatcher(*mxTBCategory, *m_xBuilder, rxFrame)) @@ -54,16 +54,10 @@ NumberFormatPropertyPanel::NumberFormatPropertyPanel( , mpBindings(pBindings) { Initialize(); - m_pInitialFocusWidget = mxLbCategory.get(); } NumberFormatPropertyPanel::~NumberFormatPropertyPanel() { - disposeOnce(); -} - -void NumberFormatPropertyPanel::dispose() -{ mxLbCategory.reset(); mxCategoryDispatch.reset(); mxTBCategory.reset(); @@ -79,8 +73,6 @@ void NumberFormatPropertyPanel::dispose() maNumFormatControl.dispose(); maFormatControl.dispose(); - - PanelLayout::dispose(); } void NumberFormatPropertyPanel::Initialize() @@ -151,8 +143,8 @@ IMPL_LINK_NOARG( NumberFormatPropertyPanel, NumFormatValueHdl, weld::SpinButton& SfxCallMode::RECORD, { &aItem }); } -VclPtr<PanelLayout> NumberFormatPropertyPanel::Create ( - vcl::Window* pParent, +std::unique_ptr<PanelLayout> NumberFormatPropertyPanel::Create ( + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings) { @@ -163,14 +155,9 @@ VclPtr<PanelLayout> NumberFormatPropertyPanel::Create ( if (pBindings == nullptr) throw lang::IllegalArgumentException("no SfxBindings given to NumberFormatPropertyPanel::Create", nullptr, 2); - return VclPtr<NumberFormatPropertyPanel>::Create( - pParent, rxFrame, pBindings); + return std::make_unique<NumberFormatPropertyPanel>(pParent, rxFrame, pBindings); } -void NumberFormatPropertyPanel::DataChanged( - const DataChangedEvent&) -{} - void NumberFormatPropertyPanel::HandleContextChange( const vcl::EnumContext& rContext) { diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx b/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx index 7d67d630dfdf..8505829c5a89 100644 --- a/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx +++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx @@ -34,14 +34,11 @@ class NumberFormatPropertyPanel { public: public: - 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); - virtual void DataChanged( - const DataChangedEvent& rEvent) override; - virtual void HandleContextChange( const vcl::EnumContext& rContext) override; @@ -58,11 +55,10 @@ public: // constructor/destructor NumberFormatPropertyPanel( - vcl::Window* pParent, + weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings); virtual ~NumberFormatPropertyPanel() override; - virtual void dispose() override; private: //ui controls std::unique_ptr<weld::ComboBox> mxLbCategory; diff --git a/sc/source/ui/sidebar/ScPanelFactory.cxx b/sc/source/ui/sidebar/ScPanelFactory.cxx index 9459178886b3..67c949475023 100644 --- a/sc/source/ui/sidebar/ScPanelFactory.cxx +++ b/sc/source/ui/sidebar/ScPanelFactory.cxx @@ -26,8 +26,7 @@ #include <dwfunctr.hxx> #include <sfx2/sidebar/SidebarPanelBase.hxx> -#include <toolkit/helper/vclunohelper.hxx> -#include <vcl/window.hxx> +#include <vcl/weldutils.hxx> #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> #include <comphelper/namedvaluecollection.hxx> #include <cppuhelper/exc_hlp.hxx> @@ -61,8 +60,11 @@ Reference<ui::XUIElement> SAL_CALL ScPanelFactory::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); @@ -76,29 +78,29 @@ Reference<ui::XUIElement> SAL_CALL ScPanelFactory::createUIElement ( nullptr); sal_Int32 nMinimumSize = -1; - VclPtr<PanelLayout> pPanel; + std::unique_ptr<PanelLayout> xPanel; if (rsResourceURL.endsWith("/AlignmentPropertyPanel")) - pPanel = AlignmentPropertyPanel::Create( pParentWindow, xFrame, pBindings ); + xPanel = AlignmentPropertyPanel::Create( pParent, xFrame, pBindings ); else if (rsResourceURL.endsWith("/CellAppearancePropertyPanel")) - pPanel = CellAppearancePropertyPanel::Create( pParentWindow, xFrame, pBindings ); + xPanel = CellAppearancePropertyPanel::Create( pParent, xFrame, pBindings ); else if (rsResourceURL.endsWith("/NumberFormatPropertyPanel")) - pPanel = NumberFormatPropertyPanel::Create( pParentWindow, xFrame, pBindings ); + xPanel = NumberFormatPropertyPanel::Create( pParent, xFrame, pBindings ); else if (rsResourceURL.endsWith("/NavigatorPanel")) { - pPanel = VclPtr<ScNavigatorDlg>::Create(pBindings, pParentWindow); + xPanel = std::make_unique<ScNavigatorDlg>(pBindings, pParent, nullptr); nMinimumSize = 0; } else if (rsResourceURL.endsWith("/FunctionsPanel")) { - pPanel = VclPtr<ScFunctionWin>::Create(pParentWindow, xFrame); + xPanel = std::make_unique<ScFunctionWin>(pParent); nMinimumSize = 0; } - if (pPanel) + if (xPanel) xElement = sfx2::sidebar::SidebarPanelBase::Create( rsResourceURL, xFrame, - pPanel, + std::move(xPanel), ui::LayoutSize(nMinimumSize,-1,-1)); } catch (const uno::RuntimeException &) diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 25a3430b307e..3c7867d1b07a 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -2306,10 +2306,9 @@ void SdTiledRenderingTest::testTdf115873() SfxViewShell* pViewShell = SfxViewShell::Current(); CPPUNIT_ASSERT(pViewShell); SfxBindings& rBindings = pViewShell->GetViewFrame()->GetBindings(); - ScopedVclPtrInstance<SdNavigatorWin> pNavigator(nullptr, &rBindings); - pNavigator->InitTreeLB(pXImpressDocument->GetDoc()); - pNavigator->Show(); - SdPageObjsTLV& rObjects = pNavigator->GetObjects(); + auto xNavigator = std::make_unique<SdNavigatorWin>(nullptr, &rBindings, nullptr); + xNavigator->InitTreeLB(pXImpressDocument->GetDoc()); + SdPageObjsTLV& rObjects = xNavigator->GetObjects(); rObjects.SelectEntry(u"Slide 1"); rObjects.Select(); sd::ViewShell* pSdViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); @@ -2340,9 +2339,9 @@ void SdTiledRenderingTest::testTdf115873Group() SfxViewShell* pViewShell = SfxViewShell::Current(); CPPUNIT_ASSERT(pViewShell); SfxBindings& rBindings = pViewShell->GetViewFrame()->GetBindings(); - ScopedVclPtrInstance<SdNavigatorWin> pNavigator(nullptr, &rBindings); - pNavigator->InitTreeLB(pXImpressDocument->GetDoc()); - SdPageObjsTLV& rObjects = pNavigator->GetObjects(); + auto xNavigator = std::make_unique<SdNavigatorWin>(nullptr, &rBindings, nullptr); + xNavigator->InitTreeLB(pXImpressDocument->GetDoc()); + SdPageObjsTLV& rObjects = xNavigator->GetObjects(); // This failed, Fill() and IsEqualToDoc() were out of sync for group // shapes. CPPUNIT_ASSERT(rObjects.IsEqualToDoc(pXImpressDocument->GetDoc())); diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx index 1764b4541c2d..4d1481872ae4 100644 --- a/sd/source/ui/animations/CustomAnimationPane.cxx +++ b/sd/source/ui/animations/CustomAnimationPane.cxx @@ -54,6 +54,7 @@ #include <svx/unoapi.hxx> #include <svx/svxids.hrc> +#include <svx/colorwindow.hxx> #include <DrawDocShell.hxx> #include <ViewShellBase.hxx> #include <DrawViewShell.hxx> @@ -117,9 +118,8 @@ void fillRepeatComboBox(weld::ComboBox& rBox) rBox.append_text(aEndOfSlide); } -CustomAnimationPane::CustomAnimationPane( Window* pParent, ViewShellBase& rBase, - const css::uno::Reference<css::frame::XFrame>& rxFrame ) - : PanelLayout(pParent, "CustomAnimationsPanel", "modules/simpress/ui/customanimationspanel.ui", rxFrame) +CustomAnimationPane::CustomAnimationPane( weld::Widget* pParent, ViewShellBase& rBase ) + : PanelLayout(pParent, "CustomAnimationsPanel", "modules/simpress/ui/customanimationspanel.ui") , mrBase(rBase) // load resources , mxFTAnimation(m_xBuilder->weld_label("effectlabel")) @@ -154,7 +154,6 @@ CustomAnimationPane::CustomAnimationPane( Window* pParent, ViewShellBase& rBase, , maLateInitTimer() { initialize(); - m_pInitialFocusWidget = &mxCustomAnimationList->get_widget(); } css::ui::LayoutSize CustomAnimationPane::GetHeightForWidth(const sal_Int32 /*nWidth*/) @@ -212,16 +211,10 @@ void CustomAnimationPane::initialize() maLateInitTimer.SetTimeout(100); maLateInitTimer.SetInvokeHandler(LINK(this, CustomAnimationPane, lateInitCallback)); maLateInitTimer.Start(); - UpdateLook(); } CustomAnimationPane::~CustomAnimationPane() { - disposeOnce(); -} - -void CustomAnimationPane::dispose() -{ maLateInitTimer.Stop(); removeListener(); @@ -253,8 +246,6 @@ void CustomAnimationPane::dispose() mxLBCategory.reset(); mxFTAnimation.reset(); mxLBAnimation.reset(); - - PanelLayout::dispose(); } void CustomAnimationPane::addUndo() @@ -866,19 +857,6 @@ void CustomAnimationPane::onContextMenu(const OString &rIdent) updateControls(); } -void CustomAnimationPane::DataChanged (const DataChangedEvent&) -{ - UpdateLook(); -} - -void CustomAnimationPane::UpdateLook() -{ - Color aBackground ( - ::sfx2::sidebar::Theme::GetColor( - ::sfx2::sidebar::Theme::Color_PanelBackground)); - SetBackground(aBackground); -} - static void addValue( const std::unique_ptr<STLPropertySet>& pSet, sal_Int32 nHandle, const Any& rValue ) { switch( pSet->getPropertyState( nHandle ) ) diff --git a/sd/source/ui/animations/SlideTransitionPane.cxx b/sd/source/ui/animations/SlideTransitionPane.cxx index ea56c90f9902..5a509fb448a9 100644 --- a/sd/source/ui/animations/SlideTransitionPane.cxx +++ b/sd/source/ui/animations/SlideTransitionPane.cxx @@ -36,6 +36,7 @@ #include <sal/log.hxx> #include <tools/debug.hxx> #include <svx/gallery.hxx> +#include <svx/colorwindow.hxx> #include <vcl/stdtext.hxx> #include <vcl/svapp.hxx> #include <vcl/weld.hxx> @@ -390,10 +391,9 @@ public: // SlideTransitionPane SlideTransitionPane::SlideTransitionPane( - Window * pParent, - ViewShellBase & rBase, - const css::uno::Reference<css::frame::XFrame>& rxFrame ) : - PanelLayout( pParent, "SlideTransitionsPanel", "modules/simpress/ui/slidetransitionspanel.ui", rxFrame ), + weld::Widget* pParent, + ViewShellBase & rBase) : + PanelLayout( pParent, "SlideTransitionsPanel", "modules/simpress/ui/slidetransitionspanel.ui" ), mrBase( rBase ), mpDrawDoc( rBase.GetDocShell() ? rBase.GetDocShell()->GetDoc() : nullptr ), @@ -477,17 +477,10 @@ void SlideTransitionPane::Initialize(SdDrawDocument* pDoc) maLateInitTimer.SetTimeout(200); maLateInitTimer.SetInvokeHandler(LINK(this, SlideTransitionPane, LateInitCallback)); maLateInitTimer.Start(); - - UpdateLook(); } SlideTransitionPane::~SlideTransitionPane() { - disposeOnce(); -} - -void SlideTransitionPane::dispose() -{ maLateInitTimer.Stop(); removeListener(); mxVS_TRANSITION_ICONSWin.reset(); @@ -505,17 +498,6 @@ void SlideTransitionPane::dispose() mxPB_APPLY_TO_ALL.reset(); mxPB_PLAY.reset(); mxCB_AUTO_PREVIEW.reset(); - PanelLayout::dispose(); -} - -void SlideTransitionPane::DataChanged (const DataChangedEvent&) -{ - UpdateLook(); -} - -void SlideTransitionPane::UpdateLook() -{ - SetBackground(::sfx2::sidebar::Theme::GetColor(::sfx2::sidebar::Theme::Color_PanelBackground)); } void SlideTransitionPane::onSelectionChanged() @@ -888,7 +870,7 @@ void SlideTransitionPane::applyToSelectedPages(bool bPreview = true) if( mbUpdatingControls ) return; - Window *pFocusWindow = Application::GetFocusWindow(); + vcl::Window *pFocusWindow = Application::GetFocusWindow(); ::sd::slidesorter::SharedPageSelection pSelectedPages( getSelectedPages()); impl::TransitionEffect aEffect = getTransitionEffectFromControls(); diff --git a/sd/source/ui/dlg/NavigatorChildWindow.cxx b/sd/source/ui/dlg/NavigatorChildWindow.cxx index 804a7ccad262..ba5d6a6154a9 100644 --- a/sd/source/ui/dlg/NavigatorChildWindow.cxx +++ b/sd/source/ui/dlg/NavigatorChildWindow.cxx @@ -42,29 +42,27 @@ static void RequestNavigatorUpdate (SfxBindings const * pBindings) SdNavigatorFloat::SdNavigatorFloat(SfxBindings* _pBindings, SfxChildWindow* _pMgr, vcl::Window* _pParent) : SfxNavigator(_pBindings, _pMgr, _pParent) + , m_xNavWin(std::make_unique<SdNavigatorWin>(m_xContainer.get(), _pBindings, this)) { - pNavWin = VclPtr<SdNavigatorWin>::Create(this, _pBindings); - pNavWin->Show(); - - pNavWin->SetUpdateRequestFunctor( + m_xNavWin->SetUpdateRequestFunctor( [_pBindings] () { return RequestNavigatorUpdate(_pBindings); }); - SetMinOutputSizePixel(pNavWin->GetOptimalSize()); + SetMinOutputSizePixel(GetOptimalSize()); } void SdNavigatorFloat::InitTreeLB(const SdDrawDocument* pDoc) { - pNavWin->InitTreeLB(pDoc); + m_xNavWin->InitTreeLB(pDoc); } void SdNavigatorFloat::FreshTree(const SdDrawDocument* pDoc) { - pNavWin->FreshTree(pDoc); + m_xNavWin->FreshTree(pDoc); } void SdNavigatorFloat::dispose() { - pNavWin.disposeAndClear(); + m_xNavWin.reset(); SfxNavigator::dispose(); } diff --git a/sd/source/ui/dlg/navigatr.cxx b/sd/source/ui/dlg/navigatr.cxx index 569ff6a615a2..c0e2ec79992e 100644 --- a/sd/source/ui/dlg/navigatr.cxx +++ b/sd/source/ui/dlg/navigatr.cxx @@ -49,13 +49,14 @@ /** * SdNavigatorWin - FloatingWindow */ -SdNavigatorWin::SdNavigatorWin(vcl::Window* pParent, SfxBindings* pInBindings) - : PanelLayout(pParent, "NavigatorPanel", "modules/simpress/ui/navigatorpanel.ui", nullptr) +SdNavigatorWin::SdNavigatorWin(weld::Widget* pParent, SfxBindings* pInBindings, SfxNavigator* pNavigatorDlg) + : PanelLayout(pParent, "NavigatorPanel", "modules/simpress/ui/navigatorpanel.ui") , mxToolbox(m_xBuilder->weld_toolbar("toolbox")) , mxTlbObjects(new SdPageObjsTLV(m_xBuilder->weld_tree_view("tree"))) , mxLbDocs(m_xBuilder->weld_combo_box("documents")) , mxDragModeMenu(m_xBuilder->weld_menu("dragmodemenu")) , mxShapeMenu(m_xBuilder->weld_menu("shapemenu")) + , mxNavigatorDlg(pNavigatorDlg) , mbDocImported ( false ) // On changes of the DragType: adjust SelectionMode of TLB! , meDragType ( NAVIGATOR_DRAGTYPE_EMBEDDED ) @@ -90,8 +91,13 @@ SdNavigatorWin::SdNavigatorWin(vcl::Window* pParent, SfxBindings* pInBindings) mxToolbox->connect_key_press(LINK(this, SdNavigatorWin, KeyInputHdl)); mxTlbObjects->connect_key_press(LINK(this, SdNavigatorWin, KeyInputHdl)); mxLbDocs->connect_key_press(LINK(this, SdNavigatorWin, KeyInputHdl)); +} - m_pInitialFocusWidget = mxToolbox.get(); +weld::Window* SdNavigatorWin::GetFrameWeld() const +{ + if (mxNavigatorDlg) + return mxNavigatorDlg->GetFrameWeld(); + return PanelLayout::GetFrameWeld(); } void SdNavigatorWin::SetUpdateRequestFunctor(const UpdateRequestFunctor& rUpdateRequest) @@ -106,11 +112,6 @@ void SdNavigatorWin::SetUpdateRequestFunctor(const UpdateRequestFunctor& rUpdate SdNavigatorWin::~SdNavigatorWin() { - disposeOnce(); -} - -void SdNavigatorWin::dispose() -{ mpNavigatorCtrlItem.reset(); mpPageNameCtrlItem.reset(); mxDragModeMenu.reset(); @@ -118,7 +119,6 @@ void SdNavigatorWin::dispose() mxToolbox.reset(); mxTlbObjects.reset(); mxLbDocs.reset(); - PanelLayout::dispose(); } //when object is marked , fresh the corresponding entry tree . diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx index 1afad1a87d48..0f44d8971218 100644 --- a/sd/source/ui/dlg/sdtreelb.cxx +++ b/sd/source/ui/dlg/sdtreelb.cxx @@ -386,7 +386,7 @@ bool SdPageObjsTLV::StartDrag() */ bool SdPageObjsTLV::DoDrag() { - if (!m_xNavigator) + if (!m_pNavigator) return true; if (!m_xHelper) @@ -725,7 +725,7 @@ void SdPageObjsTLV::Select() m_aRowActivatedHdl.Call(*m_xTreeView); } - if (!m_xNavigator) + if (!m_pNavigator) { m_xHelper.clear(); return; @@ -733,7 +733,7 @@ void SdPageObjsTLV::Select() ::sd::DrawDocShell* pDocShell = m_pDoc->GetDocSh(); OUString aURL = INetURLObject(pDocShell->GetMedium()->GetPhysicalName(), INetProtocol::File).GetMainURL(INetURLObject::DecodeMechanism::NONE); - NavigatorDragType eDragType = m_xNavigator->GetNavigatorDragType(); + NavigatorDragType eDragType = m_pNavigator->GetNavigatorDragType(); OUString sSelectedEntry = m_xTreeView->get_selected_text(); aURL += "#" + sSelectedEntry; @@ -943,7 +943,7 @@ IMPL_LINK(SdPageObjsTLV, RequestingChildrenHdl, const weld::TreeIter&, rFileEntr void SdPageObjsTLV::SetSdNavigator(SdNavigatorWin* pNavigator) { - m_xNavigator = pNavigator; + m_pNavigator = pNavigator; } void SdPageObjsTLV::SetViewFrame(const SfxViewFrame* pViewFrame) diff --git a/sd/source/ui/inc/CustomAnimationPane.hxx b/sd/source/ui/inc/CustomAnimationPane.hxx index 1d795b20ce68..edb1a0b634dc 100644 --- a/sd/source/ui/inc/CustomAnimationPane.hxx +++ b/sd/source/ui/inc/CustomAnimationPane.hxx @@ -22,6 +22,7 @@ #include <sfx2/sidebar/ILayoutableWindow.hxx> #include <sfx2/sidebar/PanelLayout.hxx> +#include <vcl/idle.hxx> #include "CustomAnimationList.hxx" #include <misc/scopelock.hxx> @@ -50,9 +51,8 @@ class CustomAnimationPane : public PanelLayout { friend class MotionPathTag; public: - CustomAnimationPane( vcl::Window* pParent, ViewShellBase& rBase, const css::uno::Reference<css::frame::XFrame>& rxFrame ); + CustomAnimationPane(weld::Widget* pParent, ViewShellBase& rBase); virtual ~CustomAnimationPane() override; - virtual void dispose() override; // ILayoutableWindow virtual css::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth) override; @@ -76,9 +76,6 @@ public: virtual void onContextMenu(const OString& rIdent) override; virtual void onDragNDropComplete( std::vector< CustomAnimationEffectPtr > pEffectsDragged, CustomAnimationEffectPtr pEffectInsertBefore ) override; - // Window - virtual void DataChanged (const DataChangedEvent& rEvent) override; - void addUndo(); double getDuration() const; @@ -100,7 +97,6 @@ private: static css::uno::Any getProperty1Value( sal_Int32 nType, const CustomAnimationEffectPtr& pEffect ); static bool setProperty1Value( sal_Int32 nType, const CustomAnimationEffectPtr& pEffect, const css::uno::Any& rValue ); - void UpdateLook(); sal_Int32 fillAnimationLB( bool bHasText ); PathKind getCreatePathKind() const; void createPath( PathKind eKind, std::vector< ::com::sun::star::uno::Any >& rTargets, double fDuration ); diff --git a/sd/source/ui/inc/SlideTransitionPane.hxx b/sd/source/ui/inc/SlideTransitionPane.hxx index b68fc63a4662..56d87997af33 100644 --- a/sd/source/ui/inc/SlideTransitionPane.hxx +++ b/sd/source/ui/inc/SlideTransitionPane.hxx @@ -51,18 +51,13 @@ class SlideTransitionPane : public PanelLayout { public: explicit SlideTransitionPane( - Window * pParent, - ViewShellBase & rBase, - const css::uno::Reference<css::frame::XFrame>& rxFrame ); + weld::Widget* pParent, + ViewShellBase & rBase); virtual ~SlideTransitionPane() override; - virtual void dispose() override; // ILayoutableWindow virtual css::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth) override; - // Window - virtual void DataChanged (const DataChangedEvent& rEvent) override; - void onSelectionChanged(); void onChangeCurrentPage(); @@ -84,8 +79,6 @@ private: ::sd::slidesorter::SharedPageSelection getSelectedPages() const; - void UpdateLook(); - void Initialize(SdDrawDocument* pDoc); DECL_LINK( ApplyToAllButtonClicked, weld::Button&, void ); diff --git a/sd/source/ui/inc/TableDesignPane.hxx b/sd/source/ui/inc/TableDesignPane.hxx index 69a8c6142907..138e470d5089 100644 --- a/sd/source/ui/inc/TableDesignPane.hxx +++ b/sd/source/ui/inc/TableDesignPane.hxx @@ -108,23 +108,17 @@ class TableDesignPane : public PanelLayout private: std::unique_ptr<TableDesignWidget> m_xImpl; public: - TableDesignPane( vcl::Window* pParent, ViewShellBase& rBase ) + TableDesignPane( weld::Widget* pParent, ViewShellBase& rBase ) : PanelLayout(pParent, "TableDesignPanel", - "modules/simpress/ui/tabledesignpanel.ui", css::uno::Reference<css::frame::XFrame>()) + "modules/simpress/ui/tabledesignpanel.ui") , m_xImpl(new TableDesignWidget(*m_xBuilder, rBase)) { - m_pInitialFocusWidget = m_xImpl->GetInitialFocusWidget(); } virtual css::ui::LayoutSize GetHeightForWidth(const sal_Int32 /*nWidth*/) override { sal_Int32 nMinimumHeight = get_preferred_size().Height(); return css::ui::LayoutSize(nMinimumHeight, -1, nMinimumHeight); } - virtual void dispose() override - { - m_xImpl.reset(); - PanelLayout::dispose(); - } }; } diff --git a/sd/source/ui/inc/navigatr.hxx b/sd/source/ui/inc/navigatr.hxx index ece000c7371e..041985d6ea47 100644 --- a/sd/source/ui/inc/navigatr.hxx +++ b/sd/source/ui/inc/navigatr.hxx @@ -83,7 +83,7 @@ namespace sd { class SdNavigatorFloat : public SfxNavigator { private: - VclPtr<SdNavigatorWin> pNavWin; + std::unique_ptr<SdNavigatorWin> m_xNavWin; public: SdNavigatorFloat(SfxBindings* _pBindings, SfxChildWindow* pMgr, vcl::Window* pParent); void InitTreeLB(const SdDrawDocument* pDoc); @@ -106,10 +106,9 @@ public: update is necessary. When <FALSE/> the navigator will rely on others to trigger updates. */ - SdNavigatorWin(vcl::Window* pParent, SfxBindings* pBindings); + SdNavigatorWin(weld::Widget* pParent, SfxBindings* pBindings, SfxNavigator* pNavigatorDlg); void SetUpdateRequestFunctor(const UpdateRequestFunctor& rUpdateRequest); virtual ~SdNavigatorWin() override; - virtual void dispose() override; void InitTreeLB( const SdDrawDocument* pDoc ); void RefreshDocumentLB( const OUString* pDocName = nullptr ); @@ -130,6 +129,8 @@ private: std::unique_ptr<weld::Menu> mxDragModeMenu; std::unique_ptr<weld::Menu> mxShapeMenu; + VclPtr<SfxNavigator> mxNavigatorDlg; + bool mbDocImported; OUString maDropFileName; NavigatorDragType meDragType; @@ -159,6 +160,8 @@ private: public: //when object is marked , fresh the corresponding entry tree . void FreshTree ( const SdDrawDocument* pDoc ); + + virtual weld::Window* GetFrameWeld() const override; }; /** @@ -175,7 +178,7 @@ protected: const SfxPoolItem* pState ) override; private: - VclPtr<SdNavigatorWin> pNavigatorWin; + SdNavigatorWin* pNavigatorWin; const SdNavigatorWin::UpdateRequestFunctor maUpdateRequest; }; @@ -192,7 +195,7 @@ protected: const SfxPoolItem* pState ) override; private: - VclPtr<SdNavigatorWin> pNavigatorWin; + SdNavigatorWin* pNavigatorWin; }; #endif diff --git a/sd/source/ui/inc/sdtreelb.hxx b/sd/source/ui/inc/sdtreelb.hxx index ecd98842a1c7..5cc88ba05a7a 100644 --- a/sd/source/ui/inc/sdtreelb.hxx +++ b/sd/source/ui/inc/sdtreelb.hxx @@ -72,7 +72,7 @@ private: std::unique_ptr<weld::TreeIter> m_xScratchIter; std::unique_ptr<SdPageObjsTLVDropTarget> m_xDropTargetHelper; std::unique_ptr<::svt::AcceleratorExecute> m_xAccel; - VclPtr<SdNavigatorWin> m_xNavigator; + SdNavigatorWin* m_pNavigator; const SdDrawDocument* m_pDoc; SdDrawDocument* m_pBookmarkDoc; SfxMedium* m_pMedium; diff --git a/sd/source/ui/sidebar/AllMasterPagesSelector.cxx b/sd/source/ui/sidebar/AllMasterPagesSelector.cxx index 07284b20961a..21fbff298633 100644 --- a/sd/source/ui/sidebar/AllMasterPagesSelector.cxx +++ b/sd/source/ui/sidebar/AllMasterPagesSelector.cxx @@ -74,8 +74,8 @@ public: SortedMasterPageDescriptorList() {} }; -VclPtr<PanelLayout> AllMasterPagesSelector::Create ( - vcl::Window* pParent, +std::unique_ptr<PanelLayout> AllMasterPagesSelector::Create ( + weld::Widget* pParent, ViewShellBase& rViewShellBase, const css::uno::Reference<css::ui::XSidebar>& rxSidebar) { @@ -85,20 +85,20 @@ VclPtr<PanelLayout> AllMasterPagesSelector::Create ( auto pContainer = std::make_shared<MasterPageContainer>(); - VclPtrInstance<AllMasterPagesSelector> pSelector( + auto xSelector(std::make_unique<AllMasterPagesSelector>( pParent, *pDocument, rViewShellBase, pContainer, - rxSidebar); - pSelector->LateInit(); - pSelector->SetHelpId(HID_SD_TASK_PANE_PREVIEW_ALL); + rxSidebar)); + xSelector->LateInit(); + xSelector->SetHelpId(HID_SD_TASK_PANE_PREVIEW_ALL); - return pSelector; + return xSelector; } AllMasterPagesSelector::AllMasterPagesSelector ( - vcl::Window* pParent, + weld::Widget* pParent, SdDrawDocument& rDocument, ViewShellBase& rBase, const std::shared_ptr<MasterPageContainer>& rpContainer, diff --git a/sd/source/ui/sidebar/AllMasterPagesSelector.hxx b/sd/source/ui/sidebar/AllMasterPagesSelector.hxx index c4ca96437a32..9574c9802061 100644 --- a/sd/source/ui/sidebar/AllMasterPagesSelector.hxx +++ b/sd/source/ui/sidebar/AllMasterPagesSelector.hxx @@ -34,11 +34,20 @@ class AllMasterPagesSelector { friend class VclPtrInstance<AllMasterPagesSelector>; public: - static VclPtr<PanelLayout> Create ( - vcl::Window* pParent, + static std::unique_ptr<PanelLayout> Create ( + weld::Widget* pParent, ViewShellBase& rViewShellBase, const css::uno::Reference<css::ui::XSidebar>& rxSidebar); + AllMasterPagesSelector ( + weld::Widget* pParent, + SdDrawDocument& rDocument, + ViewShellBase& rBase, + const std::shared_ptr<MasterPageContainer>& rpContainer, + const css::uno::Reference<css::ui::XSidebar>& rxSidebar); + virtual ~AllMasterPagesSelector() override; + + /** Scan the set of templates for the ones whose first master pages are shown by this control and store them in the MasterPageContainer. */ @@ -53,14 +62,6 @@ private: class SortedMasterPageDescriptorList; ::std::unique_ptr<SortedMasterPageDescriptorList> mpSortedMasterPages; - AllMasterPagesSelector ( - vcl::Window* pParent, - SdDrawDocument& rDocument, - ViewShellBase& rBase, - const std::shared_ptr<MasterPageContainer>& rpContainer, - const css::uno::Reference<css::ui::XSidebar>& rxSidebar); - virtual ~AllMasterPagesSelector() override; - void AddItem (MasterPageContainer::Token aToken); /** Add all items in the internal master page list into the given list. diff --git a/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx b/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx index d729afa273ae..3a7f691ad804 100644 --- a/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx +++ b/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx @@ -37,8 +37,8 @@ using namespace ::com::sun::star; namespace sd::sidebar { -VclPtr<PanelLayout> CurrentMasterPagesSelector::Create ( - vcl::Window* pParent, +std::unique_ptr<PanelLayout> CurrentMasterPagesSelector::Create ( + weld::Widget* pParent, ViewShellBase& rViewShellBase, const css::uno::Reference<css::ui::XSidebar>& rxSidebar) { @@ -48,20 +48,20 @@ VclPtr<PanelLayout> CurrentMasterPagesSelector::Create ( auto pContainer = std::make_shared<MasterPageContainer>(); - VclPtrInstance<CurrentMasterPagesSelector> pSelector( + auto xSelector(std::make_unique<CurrentMasterPagesSelector>( pParent, *pDocument, rViewShellBase, pContainer, - rxSidebar); - pSelector->LateInit(); - pSelector->SetHelpId( HID_SD_TASK_PANE_PREVIEW_CURRENT ); + rxSidebar)); + xSelector->LateInit(); + xSelector->SetHelpId( HID_SD_TASK_PANE_PREVIEW_CURRENT ); - return pSelector; + return xSelector; } CurrentMasterPagesSelector::CurrentMasterPagesSelector ( - vcl::Window* pParent, + weld::Widget* pParent, SdDrawDocument& rDocument, ViewShellBase& rBase, const std::shared_ptr<MasterPageContainer>& rpContainer, @@ -74,11 +74,6 @@ CurrentMasterPagesSelector::CurrentMasterPagesSelector ( CurrentMasterPagesSelector::~CurrentMasterPagesSelector() { - disposeOnce(); -} - -void CurrentMasterPagesSelector::dispose() -{ if (mrDocument.GetDocSh() != nullptr) { EndListening(*mrDocument.GetDocSh()); @@ -90,8 +85,6 @@ void CurrentMasterPagesSelector::dispose() Link<sd::tools::EventMultiplexerEvent&,void> aLink (LINK(this,CurrentMasterPagesSelector,EventMultiplexerListener)); mrBase.GetEventMultiplexer()->RemoveEventListener(aLink); - - MasterPagesSelector::dispose(); } void CurrentMasterPagesSelector::LateInit() diff --git a/sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx b/sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx index f371d7cbc030..a2251b85080c 100644 --- a/sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx +++ b/sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx @@ -36,11 +36,19 @@ class CurrentMasterPagesSelector { friend class VclPtrInstance<CurrentMasterPagesSelector>; public: - static VclPtr<PanelLayout> Create ( - vcl::Window* pParent, + static std::unique_ptr<PanelLayout> Create ( + weld::Widget* pParent, ViewShellBase& rViewShellBase, const css::uno::Reference<css::ui::XSidebar>& rxSidebar); + CurrentMasterPagesSelector ( + weld::Widget* pParent, + SdDrawDocument& rDocument, + ViewShellBase& rBase, + const std::shared_ptr<MasterPageContainer>& rpContainer, + const css::uno::Reference<css::ui::XSidebar>& rxSidebar); + virtual ~CurrentMasterPagesSelector() override; + /** Set the selection so that the master page is selected that is used by the currently selected page of the document in the center pane. @@ -60,15 +68,6 @@ protected: virtual void ExecuteCommand(const OString &rIdent) override; private: - CurrentMasterPagesSelector ( - vcl::Window* pParent, - SdDrawDocument& rDocument, - ViewShellBase& rBase, - const std::shared_ptr<MasterPageContainer>& rpContainer, - const css::uno::Reference<css::ui::XSidebar>& rxSidebar); - virtual ~CurrentMasterPagesSelector() override; - virtual void dispose() override; - virtual void LateInit() override; DECL_LINK(EventMultiplexerListener,sd::tools::EventMultiplexerEvent&, void); diff --git a/sd/source/ui/sidebar/LayoutMenu.cxx b/sd/source/ui/sidebar/LayoutMenu.cxx index 41261b20c17d..2c71b8f921dc 100644 --- a/sd/source/ui/sidebar/LayoutMenu.cxx +++ b/sd/source/ui/sidebar/LayoutMenu.cxx @@ -154,10 +154,10 @@ public: }; LayoutMenu::LayoutMenu ( - vcl::Window* pParent, + weld::Widget* pParent, ViewShellBase& rViewShellBase, const css::uno::Reference<css::ui::XSidebar>& rxSidebar) - : PanelLayout( pParent, "LayoutPanel", "modules/simpress/ui/layoutpanel.ui", nullptr ), + : PanelLayout( pParent, "LayoutPanel", "modules/simpress/ui/layoutpanel.ui" ), mrBase(rViewShellBase), mxLayoutValueSet(new LayoutValueSet(*this)), mxLayoutValueSetWin(new weld::CustomWeld(*m_xBuilder, "valueset", *mxLayoutValueSet)), @@ -171,8 +171,6 @@ LayoutMenu::LayoutMenu ( mxLayoutValueSet->SetStyle(mxLayoutValueSet->GetStyle() | WB_ITEMBORDER | WB_FLATVALUESET | WB_TABSTOP); mxLayoutValueSet->SetColor(sfx2::sidebar::Theme::GetColor(sfx2::sidebar::Theme::Color_PanelBackground)); - - m_pInitialFocusWidget = mxLayoutValueSet->GetDrawingArea(); } void LayoutMenu::implConstruct( DrawDocShell& rDocumentShell ) @@ -207,16 +205,10 @@ void LayoutMenu::implConstruct( DrawDocShell& rDocumentShell ) LayoutMenu::~LayoutMenu() { - disposeOnce(); -} - -void LayoutMenu::dispose() -{ SAL_INFO("sd.ui", "destroying LayoutMenu at " << this); Dispose(); mxLayoutValueSetWin.reset(); mxLayoutValueSet.reset(); - PanelLayout::dispose(); } void LayoutMenu::Dispose() @@ -723,8 +715,9 @@ IMPL_LINK(LayoutMenu, EventMultiplexerListener, ::sd::tools::EventMultiplexerEve } } -void LayoutMenu::DataChanged (const DataChangedEvent& /*rEvent*/) +void LayoutMenu::DataChanged(const DataChangedEvent& rEvent) { + PanelLayout::DataChanged(rEvent); Fill(); mxLayoutValueSet->StyleUpdated(); mxLayoutValueSet->SetColor(sfx2::sidebar::Theme::GetColor(sfx2::sidebar::Theme::Color_PanelBackground)); diff --git a/sd/source/ui/sidebar/LayoutMenu.hxx b/sd/source/ui/sidebar/LayoutMenu.hxx index 327a4939803c..6931d0a942f6 100644 --- a/sd/source/ui/sidebar/LayoutMenu.hxx +++ b/sd/source/ui/sidebar/LayoutMenu.hxx @@ -62,10 +62,9 @@ public: @param i_rPanelViewShell the view shell of the task pane. */ - LayoutMenu(vcl::Window* pParent, ViewShellBase& rViewShellBase, + LayoutMenu(weld::Widget* pParent, ViewShellBase& rViewShellBase, const css::uno::Reference<css::ui::XSidebar>& rxSidebar); virtual ~LayoutMenu() override; - virtual void dispose() override; void Dispose(); @@ -92,8 +91,6 @@ public: */ virtual void DataChanged(const DataChangedEvent& rEvent) override; - using Window::GetWindow; - private: ViewShellBase& mrBase; diff --git a/sd/source/ui/sidebar/MasterPagesSelector.cxx b/sd/source/ui/sidebar/MasterPagesSelector.cxx index bf048f18bebd..a70ba8ce22dd 100644 --- a/sd/source/ui/sidebar/MasterPagesSelector.cxx +++ b/sd/source/ui/sidebar/MasterPagesSelector.cxx @@ -53,12 +53,12 @@ namespace sd::sidebar { constexpr OStringLiteral gsDefaultClickAction = "applyselect"; MasterPagesSelector::MasterPagesSelector ( - vcl::Window* pParent, + weld::Widget* pParent, SdDrawDocument& rDocument, ViewShellBase& rBase, const std::shared_ptr<MasterPageContainer>& rpContainer, const css::uno::Reference<css::ui::XSidebar>& rxSidebar) - : PanelLayout( pParent, "MasterPagePanel", "modules/simpress/ui/masterpagepanel.ui", nullptr ), + : PanelLayout( pParent, "MasterPagePanel", "modules/simpress/ui/masterpagepanel.ui" ), maMutex(), mpContainer(rpContainer), mxPreviewValueSet(new PreviewValueSet), @@ -86,17 +86,10 @@ MasterPagesSelector::MasterPagesSelector ( Link<MasterPageContainerChangeEvent&,void> aChangeListener (LINK(this,MasterPagesSelector,ContainerChangeListener)); mpContainer->AddChangeListener(aChangeListener); - - m_pInitialFocusWidget = mxPreviewValueSet->GetDrawingArea(); } MasterPagesSelector::~MasterPagesSelector() { - disposeOnce(); -} - -void MasterPagesSelector::dispose() -{ Clear(); UpdateLocks(ItemList()); @@ -105,8 +98,6 @@ void MasterPagesSelector::dispose() mpContainer.reset(); mxPreviewValueSetWin.reset(); mxPreviewValueSet.reset(); - - PanelLayout::dispose(); } void MasterPagesSelector::LateInit() diff --git a/sd/source/ui/sidebar/MasterPagesSelector.hxx b/sd/source/ui/sidebar/MasterPagesSelector.hxx index 7ff83a92dadd..3cb60fd797c5 100644 --- a/sd/source/ui/sidebar/MasterPagesSelector.hxx +++ b/sd/source/ui/sidebar/MasterPagesSelector.hxx @@ -48,13 +48,12 @@ class MasterPagesSelector : public PanelLayout { public: MasterPagesSelector ( - vcl::Window* pParent, + weld::Widget* pParent, SdDrawDocument& rDocument, ViewShellBase& rBase, const std::shared_ptr<MasterPageContainer>& rpContainer, const css::uno::Reference<css::ui::XSidebar>& rxSidebar); virtual ~MasterPagesSelector() override; - virtual void dispose() override; virtual void LateInit(); diff --git a/sd/source/ui/sidebar/NavigatorWrapper.cxx b/sd/source/ui/sidebar/NavigatorWrapper.cxx index 1414f238f3a4..95d4a66ae14b 100644 --- a/sd/source/ui/sidebar/NavigatorWrapper.cxx +++ b/sd/source/ui/sidebar/NavigatorWrapper.cxx @@ -19,24 +19,19 @@ #include "NavigatorWrapper.hxx" #include <ViewShellBase.hxx> - -#include <sfx2/sidebar/Theme.hxx> #include <navigatr.hxx> - namespace sd::sidebar { NavigatorWrapper::NavigatorWrapper ( - vcl::Window* pParent, + weld::Widget* pParent, sd::ViewShellBase& rViewShellBase, SfxBindings* pBindings) - : SdNavigatorWin(pParent, pBindings) + : SdNavigatorWin(pParent, pBindings, nullptr) , mrViewShellBase(rViewShellBase) { SetUpdateRequestFunctor( [this] () { return this->UpdateNavigator(); }); - SetBackground(sfx2::sidebar::Theme::GetColor(sfx2::sidebar::Theme::Color_PanelBackground)); - Show(); } css::ui::LayoutSize NavigatorWrapper::GetHeightForWidth (const sal_Int32) diff --git a/sd/source/ui/sidebar/NavigatorWrapper.hxx b/sd/source/ui/sidebar/NavigatorWrapper.hxx index 7483f4b3ad94..330e423ea3d7 100644 --- a/sd/source/ui/sidebar/NavigatorWrapper.hxx +++ b/sd/source/ui/sidebar/NavigatorWrapper.hxx @@ -41,7 +41,7 @@ class NavigatorWrapper { public: NavigatorWrapper ( - vcl::Window* pParent, + weld::Widget* pParent, sd::ViewShellBase& rViewShellBase, SfxBindings* pBindings); diff --git a/sd/source/ui/sidebar/PanelFactory.cxx b/sd/source/ui/sidebar/PanelFactory.cxx index 22fea9773e7f..34e52212cab6 100644 --- a/sd/source/ui/sidebar/PanelFactory.cxx +++ b/sd/source/ui/sidebar/PanelFactory.cxx @@ -35,8 +35,7 @@ #include <com/sun/star/uno/XComponentContext.hpp> #include <comphelper/namedvaluecollection.hxx> #include <comphelper/servicehelper.hxx> -#include <vcl/window.hxx> -#include <toolkit/helper/vclunohelper.hxx> +#include <vcl/weldutils.hxx> using namespace css; using namespace css::uno; @@ -72,8 +71,11 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement ( Reference<ui::XSidebar> xSidebar (aArguments.getOrDefault("Sidebar", Reference<ui::XSidebar>())); // Throw exceptions when the arguments are not as expected. - VclPtr<vcl::Window> pParentWindow = VCLUnoHelper::GetWindow(xParentWindow); - if ( ! xParentWindow.is() || !pParentWindow) + 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"); if ( ! xFrame.is()) @@ -93,7 +95,7 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement ( SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue); // Create a framework view. - VclPtr<PanelLayout> pControl; + std::unique_ptr<PanelLayout> xControl; css::ui::LayoutSize aLayoutSize (-1,-1,-1); /** Note that these names have to be identical to (the tail of) @@ -101,25 +103,25 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement ( for the TaskPanelFactory. */ if (rsUIElementResourceURL.endsWith("/CustomAnimations")) - pControl = VclPtr<CustomAnimationPane>::Create(pParentWindow, *pBase, xFrame); + xControl = std::make_unique<CustomAnimationPane>(pParent, *pBase); else if (rsUIElementResourceURL.endsWith("/Layouts")) - pControl = VclPtr<LayoutMenu>::Create(pParentWindow, *pBase, xSidebar); + xControl = std::make_unique<LayoutMenu>(pParent, *pBase, xSidebar); else if (rsUIElementResourceURL.endsWith("/AllMasterPages")) - pControl = AllMasterPagesSelector::Create(pParentWindow, *pBase, xSidebar); + xControl = AllMasterPagesSelector::Create(pParent, *pBase, xSidebar); else if (rsUIElementResourceURL.endsWith("/RecentMasterPages")) - pControl = RecentMasterPagesSelector::Create(pParentWindow, *pBase, xSidebar); + xControl = RecentMasterPagesSelector::Create(pParent, *pBase, xSidebar); else if (rsUIElementResourceURL.endsWith("/UsedMasterPages")) - pControl = CurrentMasterPagesSelector::Create(pParentWindow, *pBase, xSidebar); + xControl = CurrentMasterPagesSelector::Create(pParent, *pBase, xSidebar); else if (rsUIElementResourceURL.endsWith("/SlideTransitions")) - pControl = VclPtr<SlideTransitionPane>::Create(pParentWindow, *pBase, xFrame); + xControl = std::make_unique<SlideTransitionPane>(pParent, *pBase); else if (rsUIElementResourceURL.endsWith("/TableDesign")) - pControl = VclPtr<TableDesignPane>::Create(pParentWindow, *pBase); + xControl = std::make_unique<TableDesignPane>(pParent, *pBase); else if (rsUIElementResourceURL.endsWith("/NavigatorPanel")) - pControl = VclPtr<NavigatorWrapper>::Create(pParentWindow, *pBase, pBindings); + xControl = std::make_unique<NavigatorWrapper>(pParent, *pBase, pBindings); else if (rsUIElementResourceURL.endsWith("/SlideBackgroundPanel")) - pControl = VclPtr<SlideBackground>::Create(pParentWindow, *pBase, xFrame, pBindings); + xControl = std::make_unique<SlideBackground>(pParent, *pBase, xFrame, pBindings); - if (!pControl) + if (!xControl) throw lang::IllegalArgumentException(); // Create a wrapper around the control that implements the @@ -127,7 +129,7 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement ( return sfx2::sidebar::SidebarPanelBase::Create( rsUIElementResourceURL, xFrame, - pControl, + std::move(xControl), aLayoutSize); } diff --git a/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx b/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx index 7c80beea09dc..4d6cd31ebe94 100644 --- a/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx +++ b/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx @@ -28,8 +28,8 @@ namespace sd::sidebar { -VclPtr<PanelLayout> RecentMasterPagesSelector::Create ( - vcl::Window* pParent, +std::unique_ptr<PanelLayout> RecentMasterPagesSelector::Create ( + weld::Widget* pParent, ViewShellBase& rViewShellBase, const css::uno::Reference<css::ui::XSidebar>& rxSidebar) { @@ -39,20 +39,20 @@ VclPtr<PanelLayout> RecentMasterPagesSelector::Create ( auto pContainer = std::make_shared<MasterPageContainer>(); - VclPtrInstance<RecentMasterPagesSelector> pSelector( + auto xSelector(std::make_unique<RecentMasterPagesSelector>( pParent, *pDocument, rViewShellBase, pContainer, - rxSidebar); - pSelector->LateInit(); - pSelector->SetHelpId(HID_SD_TASK_PANE_PREVIEW_RECENT); + rxSidebar)); + xSelector->LateInit(); + xSelector->SetHelpId(HID_SD_TASK_PANE_PREVIEW_RECENT); - return pSelector; + return xSelector; } RecentMasterPagesSelector::RecentMasterPagesSelector ( - vcl::Window* pParent, + weld::Widget* pParent, SdDrawDocument& rDocument, ViewShellBase& rBase, const std::shared_ptr<MasterPageContainer>& rpContainer, @@ -63,14 +63,8 @@ RecentMasterPagesSelector::RecentMasterPagesSelector ( RecentMasterPagesSelector::~RecentMasterPagesSelector() { - disposeOnce(); -} - -void RecentMasterPagesSelector::dispose() -{ RecentlyUsedMasterPages::Instance().RemoveEventListener ( LINK(this,RecentMasterPagesSelector,MasterPageListListener)); - MasterPagesSelector::dispose(); } void RecentMasterPagesSelector::LateInit() diff --git a/sd/source/ui/sidebar/RecentMasterPagesSelector.hxx b/sd/source/ui/sidebar/RecentMasterPagesSelector.hxx index 0d1ac5f4b2c5..8576ac8d6153 100644 --- a/sd/source/ui/sidebar/RecentMasterPagesSelector.hxx +++ b/sd/source/ui/sidebar/RecentMasterPagesSelector.hxx @@ -31,11 +31,19 @@ class RecentMasterPagesSelector final { friend class VclPtrInstance<RecentMasterPagesSelector>; public: - static VclPtr<PanelLayout> Create ( - vcl::Window* pParent, + static std::unique_ptr<PanelLayout> Create ( + weld::Widget* pParent, ViewShellBase& rViewShellBase, const css::uno::Reference<css::ui::XSidebar>& rxSidebar); + RecentMasterPagesSelector ( + weld::Widget* pParent, + SdDrawDocument& rDocument, + ViewShellBase& rBase, + const std::shared_ptr<MasterPageContainer>& rpContainer, + const css::uno::Reference<css::ui::XSidebar>& rxSidebar); + virtual ~RecentMasterPagesSelector() override; + private: DECL_LINK(MasterPageListListener, LinkParamNone*, void); virtual void Fill (ItemList& rItemList) override; @@ -56,15 +64,6 @@ private: SdPage* pMasterPage, const std::shared_ptr<std::vector<SdPage*> >& rpPageList) override; - RecentMasterPagesSelector ( - vcl::Window* pParent, - SdDrawDocument& rDocument, - ViewShellBase& rBase, - const std::shared_ptr<MasterPageContainer>& rpContainer, - const css::uno::Reference<css::ui::XSidebar>& rxSidebar); - virtual ~RecentMasterPagesSelector() override; - virtual void dispose() override; - virtual void LateInit() override; }; diff --git a/sd/source/ui/sidebar/SlideBackground.cxx b/sd/source/ui/sidebar/SlideBackground.cxx index 8a41a1adeac2..7ee626ec4162 100644 --- a/sd/source/ui/sidebar/SlideBackground.cxx +++ b/sd/source/ui/sidebar/SlideBackground.cxx @@ -86,12 +86,11 @@ enum eFillStyle } SlideBackground::SlideBackground( - Window * pParent, + weld::Widget* pParent, ViewShellBase& rBase, const css::uno::Reference<css::frame::XFrame>& rxFrame, - SfxBindings* pBindings - ) : - PanelLayout( pParent, "SlideBackgroundPanel", "modules/simpress/ui/sidebarslidebackground.ui", rxFrame ), + SfxBindings* pBindings) : + PanelLayout( pParent, "SlideBackgroundPanel", "modules/simpress/ui/sidebarslidebackground.ui" ), mrBase( rBase ), mxPaperSizeBox(new SvxPaperSizeListBox(m_xBuilder->weld_combo_box("paperformat"))), mxPaperOrientation(m_xBuilder->weld_combo_box("orientation")), @@ -161,11 +160,6 @@ SlideBackground::SlideBackground( Initialize(); } -SlideBackground::~SlideBackground() -{ - disposeOnce(); -} - bool SlideBackground::IsDraw() { return ( maContext == maDrawMasterContext || @@ -278,7 +272,7 @@ void SlideBackground::DumpAsPropertyTree(::tools::JsonWriter& rJsonWriter) mpBindings->Update(SID_ATTR_PAGE_SIZE); } - Control::DumpAsPropertyTree(rJsonWriter); + PanelLayout::DumpAsPropertyTree(rJsonWriter); } void SlideBackground::HandleContextChange( @@ -347,9 +341,9 @@ void SlideBackground::HandleContextChange( mxInsertImage->hide(); // Need to do a relayouting, otherwise the panel size is not updated after show / hide controls - sfx2::sidebar::Panel* pPanel = dynamic_cast<sfx2::sidebar::Panel*>(GetParent()); - if(pPanel) - pPanel->TriggerDeckLayouting(); + if (m_xPanel) + m_xPanel->TriggerDeckLayouting(); + } else if ( IsDraw() ) { @@ -688,7 +682,7 @@ void SlideBackground::updateMasterSlideSelection() } } -void SlideBackground::dispose() +SlideBackground::~SlideBackground() { removeListener(); @@ -732,7 +726,6 @@ void SlideBackground::dispose() mpBitmapItem.reset(); mpPageLRMarginItem.reset(); mpPageULMarginItem.reset(); - PanelLayout::dispose(); } void SlideBackground::ExecuteMarginLRChange(const ::tools::Long mnPageLeftMargin, const ::tools::Long mnPageRightMargin) @@ -818,11 +811,6 @@ OUString const & SlideBackground::GetPatternSetOrDefault() return mpBitmapItem->GetName(); } -void SlideBackground::DataChanged (const DataChangedEvent& /*rEvent*/) -{ - -} - void SlideBackground::NotifyItemUpdate( const sal_uInt16 nSID, const SfxItemState eState, diff --git a/sd/source/ui/sidebar/SlideBackground.hxx b/sd/source/ui/sidebar/SlideBackground.hxx index 1303356a3867..459aab1ef9ef 100644 --- a/sd/source/ui/sidebar/SlideBackground.hxx +++ b/sd/source/ui/sidebar/SlideBackground.hxx @@ -51,15 +51,13 @@ class SlideBackground : { public: SlideBackground( - Window * pParent, + weld::Widget* pParent, ViewShellBase& rBase, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings ); virtual ~SlideBackground() override; - virtual void dispose() override; SfxBindings* GetBindings() { return mpBindings; } // Window - virtual void DataChanged (const DataChangedEvent& rEvent) override; virtual void NotifyItemUpdate( const sal_uInt16 nSID, const SfxItemState eState, diff --git a/sfx2/UIConfig_sfx.mk b/sfx2/UIConfig_sfx.mk index a21bbeed53bb..4ecfe459be38 100644 --- a/sfx2/UIConfig_sfx.mk +++ b/sfx2/UIConfig_sfx.mk @@ -49,6 +49,7 @@ $(eval $(call gb_UIConfig_add_uifiles,sfx,\ sfx2/uiconfig/ui/linkeditdialog \ sfx2/uiconfig/ui/loadtemplatedialog \ sfx2/uiconfig/ui/managestylepage \ + sfx2/uiconfig/ui/navigator \ sfx2/uiconfig/ui/newstyle \ sfx2/uiconfig/ui/notebookbar \ sfx2/uiconfig/ui/optprintpage \ diff --git a/sfx2/inc/sidebar/PanelDescriptor.hxx b/sfx2/inc/sidebar/PanelDescriptor.hxx index be85911ac36b..1033379f7de3 100644 --- a/sfx2/inc/sidebar/PanelDescriptor.hxx +++ b/sfx2/inc/sidebar/PanelDescriptor.hxx @@ -36,6 +36,7 @@ public: sal_Int32 mnOrderIndex; bool mbShowForReadOnlyDocuments; bool mbWantsCanvas; + bool mbWantsAWT; bool mbExperimental; OUString msNodeName; // some impress panel nodes names are different from their Id diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx index b833cea80c37..35d3f2ecbaf2 100644 --- a/sfx2/source/appl/childwin.cxx +++ b/sfx2/source/appl/childwin.cxx @@ -435,14 +435,12 @@ void SfxChildWindow::InitializeChildWinFactory_Impl(sal_uInt16 nId, SfxChildWinI bool ParentIsFloatingWindow(vcl::Window *pParent) { + if (!pParent) + return false; if (pParent->GetType() == WindowType::DOCKINGWINDOW || pParent->GetType() == WindowType::TOOLBOX) - { return true; - } if (pParent->GetType() == WindowType::FLOATINGWINDOW) - { return true; - } return false; } diff --git a/sfx2/source/dialog/navigat.cxx b/sfx2/source/dialog/navigat.cxx index 1487bcbcc8f3..90116d8a2064 100644 --- a/sfx2/source/dialog/navigat.cxx +++ b/sfx2/source/dialog/navigat.cxx @@ -48,19 +48,12 @@ void SfxNavigatorWrapper::Initialize(SfxChildWinInfo* pInfo) SfxNavigator::SfxNavigator( SfxBindings* pBind , SfxChildWindow* pChildWin , vcl::Window* pParent ) - : SfxDockingWindow( pBind , - pChildWin , - pParent , - WB_STDDOCKWIN | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK ) + : SfxDockingWindow(pBind , + pChildWin , + pParent , + "Navigator", "sfx/ui/navigator.ui") { SetText(SfxResId(STR_SID_NAVIGATOR)); } -void SfxNavigator::Resize() -{ - SfxDockingWindow::Resize(); - if (vcl::Window *pChild = GetWindow(GetWindowType::FirstChild)) - VclContainer::setLayoutAllocation(*pChild, Point(0, 0), GetSizePixel()); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index 27697a46dbfb..608b1790190d 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -364,23 +364,15 @@ IMPL_LINK(SfxCommonTemplateDialog_Impl, PopupTreeMenuHdl, const CommandEvent&, r return true; } -SfxTemplatePanelControl::SfxTemplatePanelControl(SfxBindings* pBindings, vcl::Window* pParentWindow) - : PanelLayout(pParentWindow, "TemplatePanel", "sfx/ui/templatepanel.ui", nullptr) +SfxTemplatePanelControl::SfxTemplatePanelControl(SfxBindings* pBindings, weld::Widget* pParent) + : PanelLayout(pParent, "TemplatePanel", "sfx/ui/templatepanel.ui") , pImpl(new SfxTemplateDialog_Impl(pBindings, this)) { OSL_ASSERT(pBindings!=nullptr); - m_pInitialFocusWidget = pImpl->m_xActionTbL.get(); } SfxTemplatePanelControl::~SfxTemplatePanelControl() { - disposeOnce(); -} - -void SfxTemplatePanelControl::dispose() -{ - pImpl.reset(); - PanelLayout::dispose(); } static void MakeExpanded_Impl(const weld::TreeView& rBox, std::vector<OUString>& rEntries) diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx index 7f7f3aba1b47..39b9b33eabb9 100644 --- a/sfx2/source/inc/templdgi.hxx +++ b/sfx2/source/inc/templdgi.hxx @@ -38,6 +38,8 @@ class SfxTemplateControllerItem; #include <sfx2/styfitem.hxx> #include <sfx2/templdlg.hxx> +#include <vcl/idle.hxx> + class SfxStyleFamilyItem; class SfxTemplateItem; class SfxBindings; diff --git a/sfx2/source/sidebar/Panel.cxx b/sfx2/source/sidebar/Panel.cxx index 41cfbc096abb..f82ef61dda7b 100644 --- a/sfx2/source/sidebar/Panel.cxx +++ b/sfx2/source/sidebar/Panel.cxx @@ -22,8 +22,8 @@ #include <sidebar/PanelDescriptor.hxx> #include <sfx2/sidebar/Theme.hxx> #include <sfx2/sidebar/ResourceManager.hxx> - #include <sfx2/sidebar/SidebarController.hxx> +#include <sfx2/sidebar/SidebarPanelBase.hxx> #include <tools/json_writer.hxx> @@ -37,6 +37,8 @@ #include <com/sun/star/ui/XSidebarPanel.hpp> #include <com/sun/star/ui/XUIElement.hpp> +#include <vcl/weldutils.hxx> + using namespace css; using namespace css::uno; @@ -51,6 +53,7 @@ Panel::Panel(const PanelDescriptor& rPanelDescriptor, : InterimItemWindow(pParentWindow, "sfx/ui/panel.ui", "Panel") , msPanelId(rPanelDescriptor.msId) , mbIsTitleBarOptional(rPanelDescriptor.mbIsTitleBarOptional) + , mbWantsAWT(rPanelDescriptor.mbWantsAWT) , mxElement() , mxPanelComponent() , mbIsExpanded(bIsInitiallyExpanded) @@ -60,7 +63,6 @@ Panel::Panel(const PanelDescriptor& rPanelDescriptor, , mxFrame(rxFrame) , mxTitleBar(new PanelTitleBar(rPanelDescriptor.msTitle, *m_xBuilder, this)) , mxContents(m_xBuilder->weld_container("contents")) - , mxAwtXWindow(mxContents->CreateChildFrame()) { SetText(rPanelDescriptor.msTitle); mxContents->set_visible(mbIsExpanded); @@ -111,10 +113,10 @@ void Panel::dispose() mxTitleBar.reset(); - if (mxAwtXWindow) + if (mxXWindow) { - mxAwtXWindow->dispose(); - mxAwtXWindow.clear(); + mxXWindow->dispose(); + mxXWindow.clear(); } mxContents.reset(); @@ -134,10 +136,14 @@ void Panel::ShowTitlebar(bool bShowTitlebar) void Panel::SetUIElement (const Reference<ui::XUIElement>& rxElement) { mxElement = rxElement; - if (mxElement.is()) - { - mxPanelComponent.set(mxElement->getRealInterface(), UNO_QUERY); - } + if (!mxElement.is()) + return; + mxPanelComponent.set(mxElement->getRealInterface(), UNO_QUERY); + if (mbWantsAWT) + return; + sfx2::sidebar::SidebarPanelBase* pPanelBase = dynamic_cast<sfx2::sidebar::SidebarPanelBase*>(mxElement.get()); + assert(pPanelBase && "internal panels are all expected to inherit from SidebarPanelBase"); + pPanelBase->SetParentPanel(this); } void Panel::SetExpanded (const bool bIsExpanded) @@ -186,9 +192,14 @@ Reference<awt::XWindow> Panel::GetElementWindow() Reference<awt::XWindow> Panel::GetElementParentWindow() { - if (!mxAwtXWindow) - mxAwtXWindow = mxContents->CreateChildFrame(); - return mxAwtXWindow; + if (!mxXWindow) + { + if (mbWantsAWT) + mxXWindow = mxContents->CreateChildFrame(); + else + mxXWindow = Reference<awt::XWindow>(new weld::TransportAsXWindow(mxContents.get())); + } + return mxXWindow; } } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/PanelDescriptor.cxx b/sfx2/source/sidebar/PanelDescriptor.cxx index bdbec773fcdc..b980d7f1e751 100644 --- a/sfx2/source/sidebar/PanelDescriptor.cxx +++ b/sfx2/source/sidebar/PanelDescriptor.cxx @@ -33,6 +33,7 @@ PanelDescriptor::PanelDescriptor() mnOrderIndex(10000), // Default value as defined in Sidebar.xcs mbShowForReadOnlyDocuments(false), mbWantsCanvas(false), + mbWantsAWT(true), mbExperimental(false) { } @@ -49,6 +50,7 @@ PanelDescriptor::PanelDescriptor (const PanelDescriptor& rOther) mnOrderIndex(rOther.mnOrderIndex), mbShowForReadOnlyDocuments(rOther.mbShowForReadOnlyDocuments), mbWantsCanvas(rOther.mbWantsCanvas), + mbWantsAWT(rOther.mbWantsAWT), mbExperimental(rOther.mbExperimental) { } diff --git a/sfx2/source/sidebar/PanelLayout.cxx b/sfx2/source/sidebar/PanelLayout.cxx index 0e37e2278a73..3a47773175ce 100644 --- a/sfx2/source/sidebar/PanelLayout.cxx +++ b/sfx2/source/sidebar/PanelLayout.cxx @@ -7,124 +7,78 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include <sal/log.hxx> #include <sfx2/sidebar/SidebarController.hxx> -#include <sfx2/sidebar/TabBar.hxx> #include <sfx2/sidebar/PanelLayout.hxx> -#include <vcl/layout.hxx> -#include <vcl/accel.hxx> +#include <sfx2/sidebar/TabBar.hxx> +#include <sfx2/sidebar/Theme.hxx> +#include <vcl/event.hxx> using namespace sfx2::sidebar; -PanelLayout::PanelLayout(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription, - const css::uno::Reference<css::frame::XFrame> &rFrame) - : Control(pParent) - , m_pInitialFocusWidget(nullptr) - , m_bInClose(false) - , mxFrame(rFrame) -{ - m_aPanelLayoutIdle.SetPriority(TaskPriority::RESIZE); - m_aPanelLayoutIdle.SetInvokeHandler( LINK( this, PanelLayout, ImplHandlePanelLayoutTimerHdl ) ); - m_aPanelLayoutIdle.SetDebugName("sfx2::PanelLayout m_aPanelLayoutIdle"); - - SetStyle(GetStyle() | WB_DIALOGCONTROL); - - // Builder will trigger resize and start Idle - m_xVclContentArea = VclPtr<VclVBox>::Create(this); - m_xVclContentArea->Show(); - m_xBuilder.reset(Application::CreateInterimBuilder(m_xVclContentArea, rUIXMLDescription, true)); - m_xContainer = m_xBuilder->weld_container(rID); -} - -void PanelLayout::GetFocus() +PanelLayout::PanelLayout(weld::Widget* pParent, const OString& rID, const OUString& rUIXMLDescription) + : m_xBuilder(Application::CreateBuilder(pParent, rUIXMLDescription)) + , m_xContainer(m_xBuilder->weld_container(rID)) { - Control::GetFocus(); - if (m_pInitialFocusWidget) - m_pInitialFocusWidget->grab_focus(); + m_xContainer->set_background(Theme::GetColor(Theme::Color_PanelBackground)); + m_xContainer->connect_get_property_tree(LINK(this, PanelLayout, DumpAsPropertyTreeHdl)); + ::Application::AddEventListener(LINK(this, PanelLayout, DataChangedEventListener)); } -PanelLayout::~PanelLayout() +IMPL_LINK(PanelLayout, DumpAsPropertyTreeHdl, tools::JsonWriter&, rJsonWriter, void) { - disposeOnce(); + DumpAsPropertyTree(rJsonWriter); } -void PanelLayout::dispose() +void PanelLayout::DumpAsPropertyTree(tools::JsonWriter&) { - m_bInClose = true; - m_pInitialFocusWidget = nullptr; - m_aPanelLayoutIdle.Stop(); - m_xContainer.reset(); - m_xBuilder.reset(); - m_xVclContentArea.disposeAndClear(); - Control::dispose(); } -Size PanelLayout::GetOptimalSize() const +IMPL_LINK(PanelLayout, DataChangedEventListener, VclSimpleEvent&, rEvent, void) { - Size aSize = m_xContainer->get_preferred_size(); - - if (mxFrame) - { - SidebarController* pController - = SidebarController::GetSidebarControllerForFrame(mxFrame); - if (pController) - aSize.setWidth(std::min<tools::Long>( - aSize.Width(), (pController->getMaximumWidth() - TabBar::GetDefaultWidth()) - * GetDPIScaleFactor())); - } + if (rEvent.GetId() != VclEventId::ApplicationDataChanged) + return; - return aSize; + DataChangedEvent* pData = static_cast<DataChangedEvent*>(static_cast<VclWindowEvent&>(rEvent).GetData()); + DataChanged(*pData); } -void PanelLayout::queue_resize(StateChangedType /*eReason*/) +void PanelLayout::DataChanged(const DataChangedEvent& rEvent) { - if (m_bInClose) - return; - if (m_aPanelLayoutIdle.IsActive()) + if (rEvent.GetType() != DataChangedEventType::SETTINGS) return; - InvalidateSizeCache(); - m_aPanelLayoutIdle.Start(); + if (rEvent.GetFlags() & AllSettingsFlags::STYLE) + m_xContainer->set_background(Theme::GetColor(Theme::Color_PanelBackground)); } -IMPL_LINK_NOARG( PanelLayout, ImplHandlePanelLayoutTimerHdl, Timer*, void ) +void PanelLayout::SetPanel(sfx2::sidebar::Panel* pPanel) { - vcl::Window *pChild = GetWindow(GetWindowType::FirstChild); - assert(pChild); - VclContainer::setLayoutAllocation(*pChild, Point(0, 0), GetSizePixel()); + m_xPanel = pPanel; } -void PanelLayout::setPosSizePixel(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, PosSizeFlags nFlags) +weld::Window* PanelLayout::GetFrameWeld() const { - bool bCanHandleSmallerWidth = false; - bool bCanHandleSmallerHeight = false; - - vcl::Window *pChild = GetWindow(GetWindowType::FirstChild); - - if (pChild->GetType() == WindowType::SCROLLWINDOW) + if (!m_xPanel) { - WinBits nStyle = pChild->GetStyle(); - if (nStyle & (WB_AUTOHSCROLL | WB_HSCROLL)) - bCanHandleSmallerWidth = true; - if (nStyle & (WB_AUTOVSCROLL | WB_VSCROLL)) - bCanHandleSmallerHeight = true; + SAL_WARN("sfx.sidebar", "Expected a toplevel Panel to exist"); + return nullptr; } + return m_xPanel->GetFrameWeld(); +} - Size aSize(GetOptimalSize()); - if (!bCanHandleSmallerWidth) - nWidth = std::max(nWidth,aSize.Width()); - if (!bCanHandleSmallerHeight) - nHeight = std::max(nHeight,aSize.Height()); - - Control::setPosSizePixel(nX, nY, nWidth, nHeight, nFlags); +PanelLayout::~PanelLayout() +{ + ::Application::RemoveEventListener(LINK(this, PanelLayout, DataChangedEventListener)); - if (nFlags & PosSizeFlags::Size) - VclContainer::setLayoutAllocation(*pChild, Point(0, 0), Size(nWidth, nHeight)); + m_xContainer.reset(); + m_xBuilder.reset(); } -bool PanelLayout::EventNotify(NotifyEvent& rNEvt) +void PanelLayout::queue_resize() { - if (rNEvt.GetType() == MouseNotifyEvent::COMMAND) - Accelerator::ToggleMnemonicsOnHierarchy(*rNEvt.GetCommandEvent(), this); - return Control::EventNotify( rNEvt ); + if (!m_xContainer) + return; + m_xContainer->queue_resize(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx index b64b64e2c9ea..3fdfcb25a7b1 100644 --- a/sfx2/source/sidebar/ResourceManager.cxx +++ b/sfx2/source/sidebar/ResourceManager.cxx @@ -451,6 +451,7 @@ void ResourceManager::ReadPanelList() rPanelDescriptor.mnOrderIndex = getInt32(aPanelNode, "OrderIndex"); rPanelDescriptor.mbShowForReadOnlyDocuments = getBool(aPanelNode, "ShowForReadOnlyDocument"); rPanelDescriptor.mbWantsCanvas = getBool(aPanelNode, "WantsCanvas"); + rPanelDescriptor.mbWantsAWT = getBool(aPanelNode, "WantsAWT"); rPanelDescriptor.mbExperimental = getBool(aPanelNode, "IsExperimental"); const OUString sDefaultMenuCommand(getString(aPanelNode, "DefaultMenuCommand")); @@ -692,6 +693,8 @@ void ResourceManager::ReadLegacyAddons (const Reference<frame::XController>& rxC rPanelDescriptor.mnOrderIndex = 100000 + nReadIndex; rPanelDescriptor.mbShowForReadOnlyDocuments = false; rPanelDescriptor.mbWantsCanvas = false; + rPanelDescriptor.mbWantsAWT = true; + fprintf(stderr, "THIS PLACE\n"); rPanelDescriptor.maContextList.AddContextDescription(Context(sModuleName, "any"), true, OUString()); } } diff --git a/sfx2/source/sidebar/SidebarPanelBase.cxx b/sfx2/source/sidebar/SidebarPanelBase.cxx index ea98f7659aef..fd46b96b5c2a 100644 --- a/sfx2/source/sidebar/SidebarPanelBase.cxx +++ b/sfx2/source/sidebar/SidebarPanelBase.cxx @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #include <sfx2/sidebar/SidebarPanelBase.hxx> -#include <sfx2/sidebar/Theme.hxx> #include <sfx2/sidebar/ILayoutableWindow.hxx> #include <sfx2/sidebar/IContextChangeReceiver.hxx> #include <sfx2/sidebar/PanelLayout.hxx> @@ -36,14 +35,14 @@ namespace sfx2::sidebar { Reference<ui::XUIElement> SidebarPanelBase::Create ( const OUString& rsResourceURL, const css::uno::Reference<css::frame::XFrame>& rxFrame, - PanelLayout* pWindow, + std::unique_ptr<PanelLayout> xControl, const css::ui::LayoutSize& rLayoutSize) { Reference<ui::XUIElement> xUIElement ( new SidebarPanelBase( rsResourceURL, rxFrame, - pWindow, + std::move(xControl), rLayoutSize)); return xUIElement; } @@ -51,11 +50,11 @@ Reference<ui::XUIElement> SidebarPanelBase::Create ( SidebarPanelBase::SidebarPanelBase ( const OUString& rsResourceURL, const css::uno::Reference<css::frame::XFrame>& rxFrame, - PanelLayout* pWindow, + std::unique_ptr<PanelLayout> xControl, const css::ui::LayoutSize& rLayoutSize) : SidebarPanelBaseInterfaceBase(m_aMutex), mxFrame(rxFrame), - mpControl(pWindow), + mxControl(std::move(xControl)), msResourceURL(rsResourceURL), maLayoutSize(rLayoutSize) { @@ -66,22 +65,24 @@ SidebarPanelBase::SidebarPanelBase ( ::comphelper::getProcessComponentContext())); xMultiplexer->addContextChangeEventListener(this, mxFrame->getController()); } - if (mpControl != nullptr) - { - mpControl->SetBackground(Theme::GetColor(Theme::Color_PanelBackground)); - mpControl->Show(); - } } SidebarPanelBase::~SidebarPanelBase() { } +void SidebarPanelBase::SetParentPanel(sfx2::sidebar::Panel* pPanel) +{ + if (!mxControl) + return; + mxControl->SetPanel(pPanel); +} + void SAL_CALL SidebarPanelBase::disposing() { SolarMutexGuard aGuard; - mpControl.disposeAndClear(); + mxControl.reset(); if (mxFrame.is()) { @@ -100,7 +101,7 @@ void SAL_CALL SidebarPanelBase::notifyContextChangeEvent ( SolarMutexGuard aGuard; IContextChangeReceiver* pContextChangeReceiver - = dynamic_cast<IContextChangeReceiver*>(mpControl.get()); + = dynamic_cast<IContextChangeReceiver*>(mxControl.get()); if (pContextChangeReceiver != nullptr) { const vcl::EnumContext aContext( @@ -116,7 +117,7 @@ void SAL_CALL SidebarPanelBase::disposing ( SolarMutexGuard aGuard; mxFrame = nullptr; - mpControl = nullptr; + mxControl.reset(); } css::uno::Reference<css::frame::XFrame> SAL_CALL SidebarPanelBase::getFrame() @@ -142,20 +143,14 @@ Reference<XInterface> SAL_CALL SidebarPanelBase::getRealInterface() Reference<accessibility::XAccessible> SAL_CALL SidebarPanelBase::createAccessible ( const Reference<accessibility::XAccessible>&) { - // Not yet implemented. + // Not implemented. return nullptr; } Reference<awt::XWindow> SAL_CALL SidebarPanelBase::getWindow() { - SolarMutexGuard aGuard; - - if (mpControl != nullptr) - return Reference<awt::XWindow>( - mpControl->GetComponentInterface(), - UNO_QUERY); - else - return nullptr; + // Not implemented + return nullptr; } ui::LayoutSize SAL_CALL SidebarPanelBase::getHeightForWidth (const sal_Int32 nWidth) @@ -164,46 +159,33 @@ ui::LayoutSize SAL_CALL SidebarPanelBase::getHeightForWidth (const sal_Int32 nWi if (maLayoutSize.Minimum >= 0) return maLayoutSize; + + ILayoutableWindow* pLayoutableWindow = dynamic_cast<ILayoutableWindow*>(mxControl.get()); + if (pLayoutableWindow) + return pLayoutableWindow->GetHeightForWidth(nWidth); else { - ILayoutableWindow* pLayoutableWindow = dynamic_cast<ILayoutableWindow*>(mpControl.get()); - if (pLayoutableWindow) - return pLayoutableWindow->GetHeightForWidth(nWidth); - else if (isLayoutEnabled(mpControl)) - { - // widget layout-based sidebar - mpControl->queue_resize(); - Size aSize(mpControl->get_preferred_size()); - return ui::LayoutSize(aSize.Height(), aSize.Height(), aSize.Height()); - } - else if (mpControl != nullptr) - { - const sal_Int32 nHeight (mpControl->GetSizePixel().Height()); - return ui::LayoutSize(nHeight,nHeight,nHeight); - } + // widget layout-based sidebar + mxControl->queue_resize(); + Size aSize(mxControl->get_preferred_size()); + return ui::LayoutSize(aSize.Height(), aSize.Height(), aSize.Height()); } - - return ui::LayoutSize(0,0,0); } sal_Int32 SAL_CALL SidebarPanelBase::getMinimalWidth () { SolarMutexGuard aGuard; - if (isLayoutEnabled(mpControl)) - { - // widget layout-based sidebar - Size aSize(mpControl->get_preferred_size()); - return aSize.Width(); - } - return 0; + // widget layout-based sidebar + Size aSize(mxControl->get_preferred_size()); + return aSize.Width(); } void SAL_CALL SidebarPanelBase::updateModel(const css::uno::Reference<css::frame::XModel>& xModel) { SolarMutexGuard aGuard; - SidebarModelUpdate* pModelUpdate = dynamic_cast<SidebarModelUpdate*>(mpControl.get()); + SidebarModelUpdate* pModelUpdate = dynamic_cast<SidebarModelUpdate*>(mxControl.get()); if (!pModelUpdate) return; diff --git a/sfx2/uiconfig/ui/navigator.ui b/sfx2/uiconfig/ui/navigator.ui new file mode 100644 index 000000000000..e7dd8ca09087 --- /dev/null +++ b/sfx2/uiconfig/ui/navigator.ui @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.38.2 --> +<interface domain="sfx"> + <requires lib="gtk+" version="3.20"/> + <object class="GtkBox" id="Navigator"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <child> + <placeholder/> + </child> + </object> +</interface> diff --git a/solenv/sanitizers/ui/sfx.suppr b/solenv/sanitizers/ui/sfx.suppr index 31def4bb9fb1..faef6d043fcd 100644 --- a/solenv/sanitizers/ui/sfx.suppr +++ b/solenv/sanitizers/ui/sfx.suppr @@ -45,7 +45,6 @@ sfx2/uiconfig/ui/templatepanel.ui://GtkToggleToolButton[@id='5'] button-no-label sfx2/uiconfig/ui/templatepanel.ui://GtkToggleToolButton[@id='6'] button-no-label sfx2/uiconfig/ui/templatepanel.ui://GtkToggleToolButton[@id='65535'] button-no-label sfx2/uiconfig/ui/templatedlg.ui://GtkLabel[@id='label1'] orphan-label -sfx2/uiconfig/ui/paneltitlebar.ui://GtkImage[@id='addonimage'] no-labelled-by sfx2/uiconfig/ui/versioncommentdialog.ui://GtkLabel[@id='timestamp'] orphan-label sfx2/uiconfig/ui/versioncommentdialog.ui://GtkLabel[@id='author'] orphan-label sfx2/uiconfig/ui/versioncommentdialog.ui://GtkTextView[@id='textview'] no-labelled-by 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: diff --git a/sw/qa/uitest/navigator/tdf114724.py b/sw/qa/uitest/navigator/tdf114724.py index be4c900d579d..fc220f530202 100644 --- a/sw/qa/uitest/navigator/tdf114724.py +++ b/sw/qa/uitest/navigator/tdf114724.py @@ -20,7 +20,7 @@ class tdf114724(UITestCase): self.xUITest.executeCommand(".uno:Sidebar") xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) - xNavigatorPanel = xWriterEdit.getChild("NavigatorPanelParent") + xNavigatorPanel = xWriterEdit.getChild("NavigatorPanel") xToolBar = xNavigatorPanel.getChild("content5") xToolBar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) # 'root' button diff --git a/sw/qa/uitest/navigator/tdf137274.py b/sw/qa/uitest/navigator/tdf137274.py index a4a48dbb9693..36f25f4c2d7a 100644 --- a/sw/qa/uitest/navigator/tdf137274.py +++ b/sw/qa/uitest/navigator/tdf137274.py @@ -31,7 +31,7 @@ class tdf137274(UITestCase): xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) # wait until the navigator panel is available - xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanelParent') + xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel') xContentTree = xNavigatorPanel.getChild("contenttree") xComments = xContentTree.getChild('10') diff --git a/sw/qa/uitest/navigator/tdf140257.py b/sw/qa/uitest/navigator/tdf140257.py index 6a6674d8f7e8..78b6082cea8e 100644 --- a/sw/qa/uitest/navigator/tdf140257.py +++ b/sw/qa/uitest/navigator/tdf140257.py @@ -45,7 +45,7 @@ class Tdf140257(UITestCase): xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) # wait until the navigator panel is available - xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanelParent') + xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel') xContentTree = xNavigatorPanel.getChild("contenttree") xHeadings = xContentTree.getChild('0') @@ -84,7 +84,7 @@ class Tdf140257(UITestCase): xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) # wait until the navigator panel is available - xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanelParent') + xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel') xContentTree = xNavigatorPanel.getChild("contenttree") xHeadings = xContentTree.getChild('0') diff --git a/sw/qa/uitest/navigator/tdf140661.py b/sw/qa/uitest/navigator/tdf140661.py index 421689625f8d..3991105ee78b 100644 --- a/sw/qa/uitest/navigator/tdf140661.py +++ b/sw/qa/uitest/navigator/tdf140661.py @@ -19,7 +19,7 @@ class tdf140661(UITestCase): xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) # wait until the navigator panel is available - xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanelParent') + xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel') xContentTree = xNavigatorPanel.getChild("contenttree") xDrawings = xContentTree.getChild('11') diff --git a/sw/qa/uitest/navigator/tdf40427.py b/sw/qa/uitest/navigator/tdf40427.py index 25c168981a4b..9b125ff941ec 100644 --- a/sw/qa/uitest/navigator/tdf40427.py +++ b/sw/qa/uitest/navigator/tdf40427.py @@ -44,7 +44,7 @@ class tdf40427(UITestCase): xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) # wait until the navigator panel is available - xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanelParent') + xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel') xContentTree = xNavigatorPanel.getChild("contenttree") xSections = xContentTree.getChild('6') diff --git a/sw/source/uibase/inc/conttree.hxx b/sw/source/uibase/inc/conttree.hxx index 24488a8c713b..95eb75efb6cd 100644 --- a/sw/source/uibase/inc/conttree.hxx +++ b/sw/source/uibase/inc/conttree.hxx @@ -89,7 +89,7 @@ class SwContentTree final : public SfxListener std::unique_ptr<weld::TreeView> m_xTreeView; std::unique_ptr<weld::TreeIter> m_xScratchIter; SwContentTreeDropTarget m_aDropTargetHelper; - VclPtr<SwNavigationPI> m_xDialog; + SwNavigationPI* m_pDialog; OUString m_sSpace; AutoTimer m_aUpdTimer; @@ -298,7 +298,7 @@ class SwGlobalTree final private: std::unique_ptr<weld::TreeView> m_xTreeView; SwGlobalTreeDropTarget m_aDropTargetHelper; - VclPtr<SwNavigationPI> m_xDialog; + SwNavigationPI* m_pDialog; AutoTimer m_aUpdateTimer; OUString m_aContextStrings[GLOBAL_CONTEXT_COUNT]; diff --git a/sw/source/uibase/inc/navipi.hxx b/sw/source/uibase/inc/navipi.hxx index 0b0d0134a811..c203284ca500 100644 --- a/sw/source/uibase/inc/navipi.hxx +++ b/sw/source/uibase/inc/navipi.hxx @@ -73,6 +73,8 @@ class SwNavigationPI : public PanelLayout OUString m_sContentFileName; OUString m_aStatusArr[4]; + VclPtr<SfxNavigator> m_xNavigatorDlg; + std::unique_ptr<SfxObjectShellLock> m_pxObjectShell; SwView *m_pContentView; SwWrtShell *m_pContentWrtShell; @@ -111,6 +113,8 @@ class SwNavigationPI : public PanelLayout bool EditAction(); void UsePage(); + void UpdateInitShow(); + protected: // release ObjectShellLock early enough for app end @@ -121,14 +125,13 @@ protected: public: - static VclPtr<PanelLayout> Create(vcl::Window* pParent, + static std::unique_ptr<PanelLayout> Create(weld::Widget* pParent, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame, SfxBindings* pBindings); - SwNavigationPI(vcl::Window* pParent, + SwNavigationPI(weld::Widget* pParent, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame, - SfxBindings* _pBindings); + SfxBindings* _pBindings, SfxNavigator* pNavigatorDlg); virtual ~SwNavigationPI() override; - virtual void dispose() override; void UpdateListBox(); void MoveOutline(SwOutlineNodes::size_type nSource, SwOutlineNodes::size_type nTarget); @@ -140,8 +143,6 @@ public: virtual void GetControlState(const sal_uInt16 /*nSId*/, boost::property_tree::ptree& /*rState*/) override {}; - virtual void StateChanged(StateChangedType nStateChange) override; - static OUString CreateDropFileName( TransferableDataHelper& rData ); static OUString CleanEntry(const OUString& rEntry); @@ -155,6 +156,8 @@ public: bool IsGlobalMode() const {return m_bGlobalMode;} SwView* GetCreateView() const; + + virtual weld::Window* GetFrameWeld() const override; }; class SwNavigatorWrapper final : public SfxNavigatorWrapper diff --git a/sw/source/uibase/inc/redlndlg.hxx b/sw/source/uibase/inc/redlndlg.hxx index faf6d65d34b8..63cfca9d9409 100644 --- a/sw/source/uibase/inc/redlndlg.hxx +++ b/sw/source/uibase/inc/redlndlg.hxx @@ -153,9 +153,8 @@ class SwRedlineAcceptPanel : public PanelLayout, public SfxListener std::unique_ptr<SwRedlineAcceptDlg> mpImplDlg; std::unique_ptr<weld::Container> mxContentArea; public: - SwRedlineAcceptPanel(vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rFrame); + SwRedlineAcceptPanel(weld::Widget* pParent); virtual ~SwRedlineAcceptPanel() override; - virtual void dispose() override; /// We need to be a SfxListener to be able to update the list of changes when we get SfxHintId::DocChanged. virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override; diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index cb7990fcd1fc..ebbb7f0c2a00 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -1246,8 +1246,8 @@ void SwRedlineAcceptDlg::FillInfo(OUString &rExtraData) const rExtraData += ")"; } -SwRedlineAcceptPanel::SwRedlineAcceptPanel(vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rFrame) - : PanelLayout(pParent, "ManageChangesPanel", "modules/swriter/ui/managechangessidebar.ui", rFrame) +SwRedlineAcceptPanel::SwRedlineAcceptPanel(weld::Widget* pParent) + : PanelLayout(pParent, "ManageChangesPanel", "modules/swriter/ui/managechangessidebar.ui") , mxContentArea(m_xBuilder->weld_container("content_area")) { mpImplDlg.reset(new SwRedlineAcceptDlg(nullptr, m_xBuilder.get(), mxContentArea.get())); @@ -1260,14 +1260,6 @@ SwRedlineAcceptPanel::SwRedlineAcceptPanel(vcl::Window* pParent, const css::uno: SwRedlineAcceptPanel::~SwRedlineAcceptPanel() { - disposeOnce(); -} - -void SwRedlineAcceptPanel::dispose() -{ - mpImplDlg.reset(); - mxContentArea.reset(); - PanelLayout::dispose(); } void SwRedlineAcceptPanel::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) diff --git a/sw/source/uibase/sidebar/PageFooterPanel.cxx b/sw/source/uibase/sidebar/PageFooterPanel.cxx index 0cc1037a829f..c85969e29168 100644 --- a/sw/source/uibase/sidebar/PageFooterPanel.cxx +++ b/sw/source/uibase/sidebar/PageFooterPanel.cxx @@ -33,17 +33,13 @@ namespace sw::sidebar{ -VclPtr<PanelLayout> PageFooterPanel::Create( - vcl::Window* pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame, +std::unique_ptr<PanelLayout> PageFooterPanel::Create( + weld::Widget* pParent, SfxBindings* pBindings) { if( pParent == nullptr ) throw ::com::sun::star::lang::IllegalArgumentException("no parent window given to PageFooterPanel::Create", nullptr, 0); - if( !rxFrame.is() ) - throw ::com::sun::star::lang::IllegalArgumentException("no XFrame given to PageFooterPanel::Create", nullptr, 0); - - return VclPtr<PageFooterPanel>::Create(pParent, rxFrame, pBindings); + return std::make_unique<PageFooterPanel>(pParent, pBindings); } void PageFooterPanel::SetMarginsAndSpacingFieldUnit() @@ -53,10 +49,9 @@ void PageFooterPanel::SetMarginsAndSpacingFieldUnit() } PageFooterPanel::PageFooterPanel( - vcl::Window* pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame, + weld::Widget* pParent, SfxBindings* pBindings) : - PanelLayout(pParent, "PageFooterPanel", "modules/swriter/ui/pagefooterpanel.ui", rxFrame), + PanelLayout(pParent, "PageFooterPanel", "modules/swriter/ui/pagefooterpanel.ui"), mpBindings( pBindings ), maHFToggleController(SID_ATTR_PAGE_FOOTER, *pBindings, *this), maMetricController(SID_ATTR_METRIC, *pBindings,*this), @@ -80,19 +75,12 @@ PageFooterPanel::PageFooterPanel( PageFooterPanel::~PageFooterPanel() { - disposeOnce(); -} - -void PageFooterPanel::dispose() -{ mxFooterToggle.reset(); maMetricController.dispose(); mxFooterSpacingLB.reset(); mxFooterLayoutLB.reset(); mxFooterMarginPresetLB.reset(); mxCustomEntry.reset(); - - PanelLayout::dispose(); } FieldUnit PageFooterPanel::GetCurrentUnit(SfxItemState eState, const SfxPoolItem* pState) diff --git a/sw/source/uibase/sidebar/PageFooterPanel.hxx b/sw/source/uibase/sidebar/PageFooterPanel.hxx index 6c4750441950..aa67de6e760d 100644 --- a/sw/source/uibase/sidebar/PageFooterPanel.hxx +++ b/sw/source/uibase/sidebar/PageFooterPanel.hxx @@ -20,28 +20,23 @@ #define INCLUDED_SW_SOURCE_UIBASE_SIDEBAR_PAGEFOOTERPANEL_HXX #include <memory> -#include <com/sun/star/frame/XFrame.hpp> #include <sfx2/sidebar/PanelLayout.hxx> - #include <sfx2/sidebar/ControllerItem.hxx> - -#include <svx/rulritem.hxx> - #include <svl/intitem.hxx> #include <svl/poolitem.hxx> #include <svl/eitem.hxx> +#include <svx/rulritem.hxx> namespace sw::sidebar { -class PageFooterPanel: +class PageFooterPanel : public PanelLayout, public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface { public: - static VclPtr<PanelLayout> Create( - vcl::Window* pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame, + static std::unique_ptr<PanelLayout> Create( + weld::Widget* pParent, SfxBindings* pBindings); virtual void NotifyItemUpdate( @@ -55,11 +50,9 @@ public: SfxBindings* GetBindings() const { return mpBindings; } PageFooterPanel( - vcl::Window* pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame, + weld::Widget* pParent, SfxBindings* pBindings); virtual ~PageFooterPanel() override; - virtual void dispose() override; private: diff --git a/sw/source/uibase/sidebar/PageFormatPanel.cxx b/sw/source/uibase/sidebar/PageFormatPanel.cxx index 442faf4d2ac6..61cded7dc56f 100644 --- a/sw/source/uibase/sidebar/PageFormatPanel.cxx +++ b/sw/source/uibase/sidebar/PageFormatPanel.cxx @@ -43,17 +43,14 @@ namespace sw::sidebar{ -VclPtr<PanelLayout> PageFormatPanel::Create( - vcl::Window* pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame, +std::unique_ptr<PanelLayout> PageFormatPanel::Create( + weld::Widget* pParent, SfxBindings* pBindings) { if( pParent == nullptr ) throw ::com::sun::star::lang::IllegalArgumentException("no parent window given to PageFormatPanel::Create", nullptr, 0); - if( !rxFrame.is() ) - throw ::com::sun::star::lang::IllegalArgumentException("no XFrame given to PageFormatPanel::Create", nullptr, 0); - return VclPtr<PageFormatPanel>::Create(pParent, rxFrame, pBindings); + return std::make_unique<PageFormatPanel>(pParent, pBindings); } void PageFormatPanel::SetMarginFieldUnit() @@ -83,11 +80,8 @@ void PageFormatPanel::SetMarginFieldUnit() mxMarginSelectBox->set_active(nSelected); } -PageFormatPanel::PageFormatPanel( - vcl::Window* pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame, - SfxBindings* pBindings) : - PanelLayout(pParent, "PageFormatPanel", "modules/swriter/ui/pageformatpanel.ui", rxFrame), +PageFormatPanel::PageFormatPanel(weld::Widget* pParent, SfxBindings* pBindings) : + PanelLayout(pParent, "PageFormatPanel", "modules/swriter/ui/pageformatpanel.ui"), mpBindings( pBindings ), mxPaperSizeBox(new SvxPaperSizeListBox(m_xBuilder->weld_combo_box("papersize"))), mxPaperWidth(new SvxRelativeField(m_xBuilder->weld_metric_spin_button("paperwidth", FieldUnit::CM))), @@ -112,11 +106,6 @@ PageFormatPanel::PageFormatPanel( PageFormatPanel::~PageFormatPanel() { - disposeOnce(); -} - -void PageFormatPanel::dispose() -{ mxPaperSizeBox.reset(); mxPaperWidth.reset(); mxPaperHeight.reset(); @@ -132,8 +121,6 @@ void PageFormatPanel::dispose() mpPageULMarginItem.reset(); mpPageLRMarginItem.reset(); mpPageItem.reset(); - - PanelLayout::dispose(); } void PageFormatPanel::Initialize() diff --git a/sw/source/uibase/sidebar/PageFormatPanel.hxx b/sw/source/uibase/sidebar/PageFormatPanel.hxx index fcf60030868c..e5fd689982a8 100644 --- a/sw/source/uibase/sidebar/PageFormatPanel.hxx +++ b/sw/source/uibase/sidebar/PageFormatPanel.hxx @@ -18,10 +18,7 @@ */ #pragma once -#include <com/sun/star/frame/XFrame.hpp> - #include <sfx2/sidebar/PanelLayout.hxx> - #include <sfx2/sidebar/ControllerItem.hxx> #include <svx/pageitem.hxx> @@ -36,14 +33,13 @@ namespace sw::sidebar { -class PageFormatPanel: +class PageFormatPanel : public PanelLayout, public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface { public: - static VclPtr<PanelLayout> Create( - vcl::Window* pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame, + static std::unique_ptr<PanelLayout> Create( + weld::Widget* pParent, SfxBindings* pBindings); virtual void NotifyItemUpdate( @@ -56,11 +52,9 @@ public: boost::property_tree::ptree& /*rState*/) override {}; PageFormatPanel( - vcl::Window* pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame, + weld::Widget* pParent, SfxBindings* pBindings); virtual ~PageFormatPanel() override; - virtual void dispose() override; static FieldUnit GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState ); diff --git a/sw/source/uibase/sidebar/PageHeaderPanel.cxx b/sw/source/uibase/sidebar/PageHeaderPanel.cxx index c47084d14371..9f7cd0b795d6 100644 --- a/sw/source/uibase/sidebar/PageHeaderPanel.cxx +++ b/sw/source/uibase/sidebar/PageHeaderPanel.cxx @@ -33,19 +33,16 @@ namespace sw::sidebar{ -VclPtr<PanelLayout> PageHeaderPanel::Create( - vcl::Window* pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame, +std::unique_ptr<PanelLayout> PageHeaderPanel::Create( + weld::Widget* pParent, SfxBindings* pBindings) { if( pParent == nullptr ) throw ::com::sun::star::lang::IllegalArgumentException("no parent window given to PageHeaderPanel::Create", nullptr, 0); - if( !rxFrame.is() ) - throw ::com::sun::star::lang::IllegalArgumentException("no XFrame given to PageHeaderPanel::Create", nullptr, 0); if( pBindings == nullptr ) throw ::com::sun::star::lang::IllegalArgumentException("no SfxBindings given to PageHeaderPanel::Create", nullptr, 0); - return VclPtr<PageHeaderPanel>::Create(pParent, rxFrame, pBindings); + return std::make_unique<PageHeaderPanel>(pParent, pBindings); } void PageHeaderPanel::SetMarginsAndSpacingFieldUnit() @@ -55,11 +52,10 @@ void PageHeaderPanel::SetMarginsAndSpacingFieldUnit() } PageHeaderPanel::PageHeaderPanel( - vcl::Window* pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame, + weld::Widget* pParent, SfxBindings* pBindings ) : - PanelLayout(pParent, "PageHeaderPanel", "modules/swriter/ui/pageheaderpanel.ui", rxFrame), + PanelLayout(pParent, "PageHeaderPanel", "modules/swriter/ui/pageheaderpanel.ui"), mpBindings( pBindings ), maHFToggleController(SID_ATTR_PAGE_HEADER, *pBindings, *this), maMetricController(SID_ATTR_METRIC, *pBindings,*this), @@ -83,18 +79,11 @@ PageHeaderPanel::PageHeaderPanel( PageHeaderPanel::~PageHeaderPanel() { - disposeOnce(); -} - -void PageHeaderPanel::dispose() -{ mxHeaderToggle.reset(); mxHeaderSpacingLB.reset(); mxHeaderLayoutLB.reset(); mxHeaderMarginPresetLB.reset(); mxCustomEntry.reset(); - - PanelLayout::dispose(); } FieldUnit PageHeaderPanel::GetCurrentUnit(SfxItemState eState, const SfxPoolItem* pState) diff --git a/sw/source/uibase/sidebar/PageHeaderPanel.hxx b/sw/source/uibase/sidebar/PageHeaderPanel.hxx index f695fc675ed8..bffc5d992b75 100644 --- a/sw/source/uibase/sidebar/PageHeaderPanel.hxx +++ b/sw/source/uibase/sidebar/PageHeaderPanel.hxx @@ -20,28 +20,22 @@ #pragma once #include <memory> -#include <com/sun/star/frame/XFrame.hpp> - #include <sfx2/sidebar/PanelLayout.hxx> - #include <sfx2/sidebar/ControllerItem.hxx> - -#include <svx/rulritem.hxx> - #include <svl/intitem.hxx> #include <svl/poolitem.hxx> #include <svl/eitem.hxx> +#include <svx/rulritem.hxx> namespace sw::sidebar { -class PageHeaderPanel: +class PageHeaderPanel : public PanelLayout, public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface { public: - static VclPtr<PanelLayout> Create( - vcl::Window* pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame, + static std::unique_ptr<PanelLayout> Create( + weld::Widget* pParent, SfxBindings* pBindings); virtual void NotifyItemUpdate( @@ -55,11 +49,9 @@ public: SfxBindings* GetBindings() const { return mpBindings; } PageHeaderPanel( - vcl::Window* pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame, + weld::Widget* pParent, SfxBindings* pBindings); virtual ~PageHeaderPanel() override; - virtual void dispose() override; private: diff --git a/sw/source/uibase/sidebar/PageStylesPanel.cxx b/sw/source/uibase/sidebar/PageStylesPanel.cxx index a2cf10cd3faf..b514c628f4bf 100644 --- a/sw/source/uibase/sidebar/PageStylesPanel.cxx +++ b/sw/source/uibase/sidebar/PageStylesPanel.cxx @@ -68,7 +68,6 @@ static sal_uInt16 PageUsageToPos_Impl( SvxPageUsage nUsage ) return 3; } - static SvxPageUsage PosToPageUsage_Impl( sal_uInt16 nPos ) { if ( nPos >= SAL_N_ELEMENTS(aArr) ) @@ -76,27 +75,21 @@ static SvxPageUsage PosToPageUsage_Impl( sal_uInt16 nPos ) return aArr[nPos]; } -VclPtr<PanelLayout> PageStylesPanel::Create( - vcl::Window* pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame, - SfxBindings* pBindings) +std::unique_ptr<PanelLayout> PageStylesPanel::Create(weld::Widget* pParent, SfxBindings* pBindings) { if( pParent == nullptr ) throw ::com::sun::star::lang::IllegalArgumentException("no parent window given to PageStylesPanel::Create", nullptr, 0); - if( !rxFrame.is() ) - throw ::com::sun::star::lang::IllegalArgumentException("no XFrame given to PageStylesPanel::Create", nullptr, 0); if( pBindings == nullptr ) throw ::com::sun::star::lang::IllegalArgumentException("no SfxBindings given to PageStylesPanel::Create", nullptr, 0); - return VclPtr<PageStylesPanel>::Create(pParent, rxFrame, pBindings); + return std::make_unique<PageStylesPanel>(pParent, pBindings); } PageStylesPanel::PageStylesPanel( - vcl::Window* pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame, + weld::Widget* pParent, SfxBindings* pBindings ) : - PanelLayout(pParent, "PageStylesPanel", "modules/swriter/ui/pagestylespanel.ui", rxFrame), + PanelLayout(pParent, "PageStylesPanel", "modules/swriter/ui/pagestylespanel.ui"), mpBindings( pBindings ), mpPageColumnItem( new SfxInt16Item(SID_ATTR_PAGE_COLUMN) ), mpPageItem( new SvxPageItem(SID_ATTR_PAGE) ), @@ -123,11 +116,6 @@ PageStylesPanel::PageStylesPanel( PageStylesPanel::~PageStylesPanel() { - disposeOnce(); -} - -void PageStylesPanel::dispose() -{ mxColumnCount.reset(); mxNumberSelectLB.reset(); mxBgFillType.reset(); @@ -145,7 +133,6 @@ void PageStylesPanel::dispose() maBgHatchingControl.dispose(); maPageColumnControl.dispose(); maPageNumFormatControl.dispose(); - PanelLayout::dispose(); } void PageStylesPanel::Initialize() diff --git a/sw/source/uibase/sidebar/PageStylesPanel.hxx b/sw/source/uibase/sidebar/PageStylesPanel.hxx index 77d2ed462813..6047d2535666 100644 --- a/sw/source/uibase/sidebar/PageStylesPanel.hxx +++ b/sw/source/uibase/sidebar/PageStylesPanel.hxx @@ -20,20 +20,16 @@ #define INCLUDED_SW_SOURCE_UIBASE_SIDEBAR_PAGESTYLESPANEL_HXX #include <memory> -#include <com/sun/star/frame/XFrame.hpp> #include <sfx2/sidebar/PanelLayout.hxx> - #include <sfx2/sidebar/ControllerItem.hxx> - -#include <svx/pageitem.hxx> - #include <svl/intitem.hxx> #include <svl/poolitem.hxx> #include <svx/xbtmpit.hxx> #include <svx/xflclit.hxx> #include <svx/xflgrit.hxx> #include <svx/xflhtit.hxx> +#include <svx/pageitem.hxx> #include <svx/pagenumberlistbox.hxx> class List; @@ -45,9 +41,8 @@ class PageStylesPanel: public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface { public: - static VclPtr<PanelLayout> Create( - vcl::Window* pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame, + static std::unique_ptr<PanelLayout> Create( + weld::Widget* pParent, SfxBindings* pBindings); virtual void NotifyItemUpdate( @@ -61,11 +56,9 @@ public: SfxBindings* GetBindings() const { return mpBindings; } PageStylesPanel( - vcl::Window* pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame, + weld::Widget* pParent, SfxBindings* pBindings); virtual ~PageStylesPanel() override; - virtual void dispose() override; private: diff --git a/sw/source/uibase/sidebar/StylePresetsPanel.cxx b/sw/source/uibase/sidebar/StylePresetsPanel.cxx index 4851bff5f09e..79b1b93ed34c 100644 --- a/sw/source/uibase/sidebar/StylePresetsPanel.cxx +++ b/sw/source/uibase/sidebar/StylePresetsPanel.cxx @@ -130,20 +130,16 @@ BitmapEx CreatePreview(OUString const & aUrl, OUString const & aName) } -VclPtr<PanelLayout> StylePresetsPanel::Create (vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame) +std::unique_ptr<PanelLayout> StylePresetsPanel::Create(weld::Widget* pParent) { if (pParent == nullptr) throw css::lang::IllegalArgumentException("no parent Window given to StylePresetsPanel::Create", nullptr, 0); - if (!rxFrame.is()) - throw css::lang::IllegalArgumentException("no XFrame given to StylePresetsPanel::Create", nullptr, 1); - return VclPtr<StylePresetsPanel>::Create(pParent, rxFrame); + return std::make_unique<StylePresetsPanel>(pParent); } -StylePresetsPanel::StylePresetsPanel(vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame) - : PanelLayout(pParent, "StylePresetsPanel", "modules/swriter/ui/sidebarstylepresets.ui", rxFrame) +StylePresetsPanel::StylePresetsPanel(weld::Widget* pParent) + : PanelLayout(pParent, "StylePresetsPanel", "modules/swriter/ui/sidebarstylepresets.ui") , mxValueSet(new ValueSet(nullptr)) , mxValueSetWin(new weld::CustomWeld(*m_xBuilder, "valueset", *mxValueSet)) { @@ -152,8 +148,6 @@ StylePresetsPanel::StylePresetsPanel(vcl::Window* pParent, mxValueSet->SetDoubleClickHdl(LINK(this, StylePresetsPanel, DoubleClickHdl)); RefreshList(); - - m_pInitialFocusWidget = mxValueSet->GetDrawingArea(); } void StylePresetsPanel::RefreshList() @@ -182,15 +176,6 @@ void StylePresetsPanel::RefreshList() StylePresetsPanel::~StylePresetsPanel() { - disposeOnce(); -} - -void StylePresetsPanel::dispose() -{ - mxValueSetWin.reset(); - mxValueSet.reset(); - - PanelLayout::dispose(); } IMPL_LINK_NOARG(StylePresetsPanel, DoubleClickHdl, ValueSet*, void) diff --git a/sw/source/uibase/sidebar/StylePresetsPanel.hxx b/sw/source/uibase/sidebar/StylePresetsPanel.hxx index 1de8af74db71..75a6cb3c4e0e 100644 --- a/sw/source/uibase/sidebar/StylePresetsPanel.hxx +++ b/sw/source/uibase/sidebar/StylePresetsPanel.hxx @@ -11,12 +11,9 @@ #pragma once #include <memory> -#include <com/sun/star/frame/XFrame.hpp> #include <sfx2/sidebar/PanelLayout.hxx> - #include <sfx2/sidebar/ControllerItem.hxx> - #include <svtools/valueset.hxx> namespace sw::sidebar { @@ -24,10 +21,12 @@ namespace sw::sidebar { class StylePresetsPanel : public PanelLayout, public sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface { - friend class VclPtr<StylePresetsPanel>; public: - static VclPtr<PanelLayout> Create(vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame); + static std::unique_ptr<PanelLayout> Create(weld::Widget* pParent); + + StylePresetsPanel(weld::Widget* pParent); + + virtual ~StylePresetsPanel() override; virtual void NotifyItemUpdate(const sal_uInt16 nSId, const SfxItemState eState, @@ -49,12 +48,6 @@ private: void RefreshList(); - StylePresetsPanel(vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame); - - virtual ~StylePresetsPanel() override; - virtual void dispose() override; - std::unique_ptr<ValueSet> mxValueSet; std::unique_ptr<weld::CustomWeld> mxValueSetWin; diff --git a/sw/source/uibase/sidebar/SwPanelFactory.cxx b/sw/source/uibase/sidebar/SwPanelFactory.cxx index cc34ba5b3fdb..ff5c0e58d93e 100644 --- a/sw/source/uibase/sidebar/SwPanelFactory.cxx +++ b/sw/source/uibase/sidebar/SwPanelFactory.cxx @@ -32,8 +32,7 @@ #include <redlndlg.hxx> #include <sfx2/sidebar/SidebarPanelBase.hxx> -#include <toolkit/helper/vclunohelper.hxx> -#include <vcl/window.hxx> +#include <vcl/weldutils.hxx> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <comphelper/namedvaluecollection.hxx> @@ -94,8 +93,11 @@ Reference<ui::XUIElement> SAL_CALL SwPanelFactory::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); @@ -110,93 +112,93 @@ Reference<ui::XUIElement> SAL_CALL SwPanelFactory::createUIElement ( if(rsResourceURL.endsWith("/PageStylesPanel")) { - VclPtr<PanelLayout> pPanel = sw::sidebar::PageStylesPanel::Create( pParentWindow, xFrame, pBindings ); + std::unique_ptr<PanelLayout> xPanel = sw::sidebar::PageStylesPanel::Create( pParent, pBindings ); xElement = sfx2::sidebar::SidebarPanelBase::Create( rsResourceURL, xFrame, - pPanel, + std::move(xPanel), ui::LayoutSize(-1,-1,-1)); } else if(rsResourceURL.endsWith("/PageFormatPanel")) { - VclPtr<PanelLayout> pPanel = sw::sidebar::PageFormatPanel::Create( pParentWindow, xFrame, pBindings ); + std::unique_ptr<PanelLayout> xPanel = sw::sidebar::PageFormatPanel::Create( pParent, pBindings ); xElement = sfx2::sidebar::SidebarPanelBase::Create( rsResourceURL, xFrame, - pPanel, + std::move(xPanel), ui::LayoutSize(-1,-1,-1)); } else if(rsResourceURL.endsWith("/PageHeaderPanel")) { - VclPtr<PanelLayout> pPanel = sw::sidebar::PageHeaderPanel::Create( pParentWindow, xFrame, pBindings ); + std::unique_ptr<PanelLayout> xPanel = sw::sidebar::PageHeaderPanel::Create( pParent, pBindings ); xElement = sfx2::sidebar::SidebarPanelBase::Create( rsResourceURL, xFrame, - pPanel, + std::move(xPanel), ui::LayoutSize(-1,-1,-1)); } else if(rsResourceURL.endsWith("/PageFooterPanel")) { - VclPtr<PanelLayout> pPanel = sw::sidebar::PageFooterPanel::Create( pParentWindow, xFrame, pBindings ); + std::unique_ptr<PanelLayout> xPanel = sw::sidebar::PageFooterPanel::Create( pParent, pBindings ); xElement = sfx2::sidebar::SidebarPanelBase::Create( rsResourceURL, xFrame, - pPanel, + std::move(xPanel), ui::LayoutSize(-1,-1,-1)); } else if (rsResourceURL.endsWith("/WrapPropertyPanel")) { - VclPtr<PanelLayout> pPanel = sw::sidebar::WrapPropertyPanel::Create( pParentWindow, xFrame, pBindings ); + std::unique_ptr<PanelLayout> xPanel = sw::sidebar::WrapPropertyPanel::Create( pParent, xFrame, pBindings ); xElement = sfx2::sidebar::SidebarPanelBase::Create( rsResourceURL, xFrame, - pPanel, + std::move(xPanel), ui::LayoutSize(-1,-1,-1)); } else if (rsResourceURL.endsWith("/NavigatorPanel")) { - VclPtr<PanelLayout> pPanel = SwNavigationPI::Create( pParentWindow, xFrame, pBindings ); + std::unique_ptr<PanelLayout> xPanel = SwNavigationPI::Create( pParent, xFrame, pBindings ); xElement = sfx2::sidebar::SidebarPanelBase::Create( rsResourceURL, xFrame, - pPanel, + std::move(xPanel), ui::LayoutSize(0,-1,-1)); } else if (rsResourceURL.endsWith("/ManageChangesPanel")) { - VclPtrInstance<SwRedlineAcceptPanel> pPanel(pParentWindow, xFrame); + auto xPanel = std::make_unique<SwRedlineAcceptPanel>(pParent); xElement = sfx2::sidebar::SidebarPanelBase::Create( rsResourceURL, xFrame, - pPanel, + std::move(xPanel), ui::LayoutSize(-1,-1,-1)); } else if (rsResourceURL.endsWith("/WriterInspectorTextPanel")) { - VclPtr<PanelLayout> pPanel = sw::sidebar::WriterInspectorTextPanel::Create( pParentWindow, xFrame); + std::unique_ptr<PanelLayout> xPanel = sw::sidebar::WriterInspectorTextPanel::Create(pParent); xElement = sfx2::sidebar::SidebarPanelBase::Create( rsResourceURL, xFrame, - pPanel, + std::move(xPanel), ui::LayoutSize(0,-1,-1)); } else if (rsResourceURL.endsWith("/StylePresetsPanel")) { - VclPtr<PanelLayout> pPanel = sw::sidebar::StylePresetsPanel::Create(pParentWindow, xFrame); + std::unique_ptr<PanelLayout> xPanel = sw::sidebar::StylePresetsPanel::Create(pParent); xElement = sfx2::sidebar::SidebarPanelBase::Create( - rsResourceURL, xFrame, pPanel, ui::LayoutSize(-1,-1,-1)); + rsResourceURL, xFrame, std::move(xPanel), ui::LayoutSize(-1,-1,-1)); } else if (rsResourceURL.endsWith("/ThemePanel")) { - VclPtr<PanelLayout> pPanel = sw::sidebar::ThemePanel::Create(pParentWindow, xFrame); + std::unique_ptr<PanelLayout> xPanel = sw::sidebar::ThemePanel::Create(pParent); xElement = sfx2::sidebar::SidebarPanelBase::Create( - rsResourceURL, xFrame, pPanel, ui::LayoutSize(-1,-1,-1)); + rsResourceURL, xFrame, std::move(xPanel), ui::LayoutSize(-1,-1,-1)); } else if (rsResourceURL.endsWith("/TableEditPanel")) { - VclPtr<PanelLayout> pPanel = sw::sidebar::TableEditPanel::Create(pParentWindow, xFrame, pBindings ); + std::unique_ptr<PanelLayout> xPanel = sw::sidebar::TableEditPanel::Create(pParent, xFrame, pBindings ); xElement = sfx2::sidebar::SidebarPanelBase::Create( - rsResourceURL, xFrame, pPanel, ui::LayoutSize(-1,-1,-1)); + rsResourceURL, xFrame, std::move(xPanel), ui::LayoutSize(-1,-1,-1)); } return xElement; diff --git a/sw/source/uibase/sidebar/TableEditPanel.cxx b/sw/source/uibase/sidebar/TableEditPanel.cxx index 3b7262e6e673..22b45f7419b4 100644 --- a/sw/source/uibase/sidebar/TableEditPanel.cxx +++ b/sw/source/uibase/sidebar/TableEditPanel.cxx @@ -24,9 +24,10 @@ namespace sw::sidebar { -VclPtr<PanelLayout> TableEditPanel::Create(vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, - SfxBindings* pBindings) +std::unique_ptr<PanelLayout> +TableEditPanel::Create(weld::Widget* pParent, + const css::uno::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings) { if (pParent == nullptr) throw css::lang::IllegalArgumentException( @@ -35,7 +36,7 @@ VclPtr<PanelLayout> TableEditPanel::Create(vcl::Window* pParent, throw css::lang::IllegalArgumentException("no XFrame given to TableEditPanel::Create", nullptr, 1); - return VclPtr<TableEditPanel>::Create(pParent, rxFrame, pBindings); + return std::make_unique<TableEditPanel>(pParent, rxFrame, pBindings); } void TableEditPanel::NotifyItemUpdate(const sal_uInt16 nSID, const SfxItemState eState, @@ -86,10 +87,10 @@ void TableEditPanel::NotifyItemUpdate(const sal_uInt16 nSID, const SfxItemState } } -TableEditPanel::TableEditPanel(vcl::Window* pParent, +TableEditPanel::TableEditPanel(weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings) - : PanelLayout(pParent, "TableEditPanel", "modules/swriter/ui/sidebartableedit.ui", rxFrame) + : PanelLayout(pParent, "TableEditPanel", "modules/swriter/ui/sidebartableedit.ui") , m_pBindings(pBindings) , m_xRowHeightEdit( new SvxRelativeField(m_xBuilder->weld_metric_spin_button("rowheight", FieldUnit::CM))) @@ -137,12 +138,8 @@ TableEditPanel::TableEditPanel(vcl::Window* pParent, if (comphelper::LibreOfficeKit::isActive()) m_xMisc->set_item_visible(".uno:InsertFormula", false); - - m_pInitialFocusWidget = &m_xRowHeightEdit->get_widget(); } -TableEditPanel::~TableEditPanel() { disposeOnce(); } - void TableEditPanel::InitRowHeightToolitem() { Link<weld::MetricSpinButton&, void> aLink = LINK(this, TableEditPanel, RowHeightMofiyHdl); @@ -171,7 +168,7 @@ void TableEditPanel::InitColumnWidthToolitem() limitWidthForSidebar(*m_xColumnWidthEdit); } -void TableEditPanel::dispose() +TableEditPanel::~TableEditPanel() { m_xRowHeightEdit.reset(); m_xColumnWidthEdit.reset(); @@ -213,8 +210,6 @@ void TableEditPanel::dispose() m_aSetOptimalColumnWidthController.dispose(); m_aDistributeColumnsController.dispose(); m_aMergeCellsController.dispose(); - - PanelLayout::dispose(); } IMPL_LINK_NOARG(TableEditPanel, RowHeightMofiyHdl, weld::MetricSpinButton&, void) diff --git a/sw/source/uibase/sidebar/TableEditPanel.hxx b/sw/source/uibase/sidebar/TableEditPanel.hxx index cb8097aaf4cb..01098df5e60f 100644 --- a/sw/source/uibase/sidebar/TableEditPanel.hxx +++ b/sw/source/uibase/sidebar/TableEditPanel.hxx @@ -21,12 +21,14 @@ namespace sw::sidebar class TableEditPanel : public PanelLayout, public sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface { - friend class VclPtr<TableEditPanel>; - public: - 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, const css::uno::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + + TableEditPanel(weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + virtual ~TableEditPanel() override; virtual void NotifyItemUpdate(const sal_uInt16 nSId, const SfxItemState eState, const SfxPoolItem* pState) override; @@ -35,11 +37,6 @@ public: boost::property_tree::ptree& /*rState*/) override{}; private: - TableEditPanel(vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, - SfxBindings* pBindings); - virtual ~TableEditPanel() override; - virtual void dispose() override; - void InitRowHeightToolitem(); void InitColumnWidthToolitem(); diff --git a/sw/source/uibase/sidebar/ThemePanel.cxx b/sw/source/uibase/sidebar/ThemePanel.cxx index 93ee7b557a84..3ff74fcdb016 100644 --- a/sw/source/uibase/sidebar/ThemePanel.cxx +++ b/sw/source/uibase/sidebar/ThemePanel.cxx @@ -397,20 +397,16 @@ BitmapEx GenerateColorPreview(const svx::ColorSet& rColorSet) namespace sw::sidebar { -VclPtr<PanelLayout> ThemePanel::Create (vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame) +std::unique_ptr<PanelLayout> ThemePanel::Create(weld::Widget* pParent) { if (pParent == nullptr) throw css::lang::IllegalArgumentException("no parent Window given to PagePropertyPanel::Create", nullptr, 0); - if (!rxFrame.is()) - throw css::lang::IllegalArgumentException("no XFrame given to PagePropertyPanel::Create", nullptr, 1); - return VclPtr<ThemePanel>::Create(pParent, rxFrame); + return std::make_unique<ThemePanel>(pParent); } -ThemePanel::ThemePanel(vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame) - : PanelLayout(pParent, "ThemePanel", "modules/swriter/ui/sidebartheme.ui", rxFrame) +ThemePanel::ThemePanel(weld::Widget* pParent) + : PanelLayout(pParent, "ThemePanel", "modules/swriter/ui/sidebartheme.ui") , mxListBoxFonts(m_xBuilder->weld_tree_view("listbox_fonts")) , mxValueSetColors(new ValueSet(nullptr)) , mxValueSetColorsWin(new weld::CustomWeld(*m_xBuilder, "valueset_colors", *mxValueSetColors)) @@ -447,23 +443,14 @@ ThemePanel::ThemePanel(vcl::Window* pParent, if (!aColorSets.empty()) mxValueSetColors->SelectItem(1); // ItemId 1, position 0 - - m_pInitialFocusWidget = mxListBoxFonts.get(); } ThemePanel::~ThemePanel() { - disposeOnce(); -} - -void ThemePanel::dispose() -{ mxListBoxFonts.reset(); mxValueSetColorsWin.reset(); mxValueSetColors.reset(); mxApplyButton.reset(); - - PanelLayout::dispose(); } IMPL_LINK_NOARG(ThemePanel, ClickHdl, weld::Button&, void) diff --git a/sw/source/uibase/sidebar/ThemePanel.hxx b/sw/source/uibase/sidebar/ThemePanel.hxx index 34a982bb2d29..14af479e664a 100644 --- a/sw/source/uibase/sidebar/ThemePanel.hxx +++ b/sw/source/uibase/sidebar/ThemePanel.hxx @@ -10,7 +10,6 @@ #pragma once -#include <com/sun/star/frame/XFrame.hpp> #include <sfx2/sidebar/PanelLayout.hxx> #include <sfx2/sidebar/ControllerItem.hxx> #include <svtools/valueset.hxx> @@ -21,10 +20,11 @@ namespace sw::sidebar { class ThemePanel : public PanelLayout, public sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface { - friend class VclPtr<ThemePanel>; public: - static VclPtr<PanelLayout> Create(vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame); + static std::unique_ptr<PanelLayout> Create(weld::Widget* pParent); + + ThemePanel(weld::Widget* pParent); + virtual ~ThemePanel() override; virtual void NotifyItemUpdate(const sal_uInt16 nSId, const SfxItemState eState, @@ -35,12 +35,6 @@ public: boost::property_tree::ptree& /*rState*/) override {}; private: - ThemePanel(vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame); - virtual ~ThemePanel() override; - - virtual void dispose() override; - std::unique_ptr<weld::TreeView> mxListBoxFonts; std::unique_ptr<ValueSet> mxValueSetColors; std::unique_ptr<weld::CustomWeld> mxValueSetColorsWin; diff --git a/sw/source/uibase/sidebar/WrapPropertyPanel.cxx b/sw/source/uibase/sidebar/WrapPropertyPanel.cxx index 33fd16da7764..c45b0a6078ab 100644 --- a/sw/source/uibase/sidebar/WrapPropertyPanel.cxx +++ b/sw/source/uibase/sidebar/WrapPropertyPanel.cxx @@ -33,8 +33,8 @@ namespace sw::sidebar { -VclPtr<PanelLayout> WrapPropertyPanel::Create ( - vcl::Window* pParent, +std::unique_ptr<PanelLayout> WrapPropertyPanel::Create ( + weld::Widget* pParent, const css::uno::Reference< css::frame::XFrame >& rxFrame, SfxBindings* pBindings) { @@ -45,17 +45,14 @@ VclPtr<PanelLayout> WrapPropertyPanel::Create ( if (pBindings == nullptr) throw css::lang::IllegalArgumentException("no SfxBindings given to WrapPropertyPanel::Create", nullptr, 2); - return VclPtr<WrapPropertyPanel>::Create( - pParent, - rxFrame, - pBindings); + return std::make_unique<WrapPropertyPanel>(pParent, rxFrame, pBindings); } WrapPropertyPanel::WrapPropertyPanel( - vcl::Window* pParent, + weld::Widget* pParent, const css::uno::Reference< css::frame::XFrame >& rxFrame, SfxBindings* pBindings ) - : PanelLayout(pParent, "WrapPropertyPanel", "modules/swriter/ui/sidebarwrap.ui", rxFrame) + : PanelLayout(pParent, "WrapPropertyPanel", "modules/swriter/ui/sidebarwrap.ui") , mpBindings(pBindings) // spacing , nTop(0) @@ -75,26 +72,16 @@ WrapPropertyPanel::WrapPropertyPanel( SpacingListBox::Fill(IsInch(eMetric) ? SpacingType::SPACING_INCH : SpacingType::SPACING_CM, *mxSpacingLB); Initialize(); - - m_pInitialFocusWidget = mxWrapOptions.get(); } WrapPropertyPanel::~WrapPropertyPanel() { - disposeOnce(); -} - -void WrapPropertyPanel::dispose() -{ - mxSpacingLB.reset(); mxWrapOptionsDispatch.reset(); mxWrapOptions.reset(); maSwLRSpacingControl.dispose(); maSwULSpacingControl.dispose(); - - PanelLayout::dispose(); } void WrapPropertyPanel::Initialize() diff --git a/sw/source/uibase/sidebar/WrapPropertyPanel.hxx b/sw/source/uibase/sidebar/WrapPropertyPanel.hxx index 7a07ff3be9d7..319085513e1b 100644 --- a/sw/source/uibase/sidebar/WrapPropertyPanel.hxx +++ b/sw/source/uibase/sidebar/WrapPropertyPanel.hxx @@ -32,8 +32,8 @@ namespace sw::sidebar { , public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface { public: - 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 ); @@ -48,10 +48,9 @@ namespace sw::sidebar { boost::property_tree::ptree& /*rState*/) override {}; virtual ~WrapPropertyPanel() override; - virtual void dispose() override; WrapPropertyPanel( - vcl::Window* pParent, + weld::Widget* pParent, const css::uno::Reference< css::frame::XFrame >& rxFrame, SfxBindings* pBindings ); private: diff --git a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx index 83546dec8fc7..959c2bd48a25 100644 --- a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx +++ b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx @@ -28,6 +28,7 @@ #include <com/sun/star/text/XTextRange.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertyState.hpp> +#include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> #include <com/sun/star/table/BorderLine2.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp> @@ -44,22 +45,16 @@ namespace sw::sidebar { static void UpdateTree(SwDocShell* pDocSh, std::vector<svx::sidebar::TreeNode>& aStore); -VclPtr<PanelLayout> WriterInspectorTextPanel::Create(vcl::Window* pParent, - const uno::Reference<frame::XFrame>& rxFrame) +std::unique_ptr<PanelLayout> WriterInspectorTextPanel::Create(weld::Widget* pParent) { if (pParent == nullptr) throw lang::IllegalArgumentException( "no parent Window given to WriterInspectorTextPanel::Create", nullptr, 0); - if (!rxFrame.is()) - throw lang::IllegalArgumentException("no XFrame given to WriterInspectorTextPanel::Create", - nullptr, 1); - - return VclPtr<WriterInspectorTextPanel>::Create(pParent, rxFrame); + return std::make_unique<WriterInspectorTextPanel>(pParent); } -WriterInspectorTextPanel::WriterInspectorTextPanel(vcl::Window* pParent, - const uno::Reference<frame::XFrame>& rxFrame) - : InspectorTextPanel(pParent, rxFrame) +WriterInspectorTextPanel::WriterInspectorTextPanel(weld::Widget* pParent) + : InspectorTextPanel(pParent) { SwDocShell* pDocSh = static_cast<SwDocShell*>(SfxObjectShell::Current()); m_pShell = pDocSh->GetWrtShell(); @@ -76,14 +71,7 @@ WriterInspectorTextPanel::WriterInspectorTextPanel(vcl::Window* pParent, updateEntries(aStore); } -WriterInspectorTextPanel::~WriterInspectorTextPanel() { disposeOnce(); } - -void WriterInspectorTextPanel::dispose() -{ - m_pShell->SetChgLnk(m_oldLink); - - InspectorTextPanel::dispose(); -} +WriterInspectorTextPanel::~WriterInspectorTextPanel() { m_pShell->SetChgLnk(m_oldLink); } static OUString PropertyNametoRID(const OUString& rName) { diff --git a/sw/source/uibase/sidebar/WriterInspectorTextPanel.hxx b/sw/source/uibase/sidebar/WriterInspectorTextPanel.hxx index 56137399c679..2f72c6317523 100644 --- a/sw/source/uibase/sidebar/WriterInspectorTextPanel.hxx +++ b/sw/source/uibase/sidebar/WriterInspectorTextPanel.hxx @@ -27,14 +27,11 @@ namespace sw::sidebar class WriterInspectorTextPanel final : public svx::sidebar::InspectorTextPanel { public: - static VclPtr<PanelLayout> Create(vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame); + static std::unique_ptr<PanelLayout> Create(weld::Widget* pParent); - WriterInspectorTextPanel(vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame); + WriterInspectorTextPanel(weld::Widget* pParent); virtual ~WriterInspectorTextPanel() override; - virtual void dispose() override; private: SwWrtShell* m_pShell; diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 6a1e66bbb1aa..d70494d64cc7 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -925,7 +925,7 @@ SwContentTree::SwContentTree(std::unique_ptr<weld::TreeView> xTreeView, SwNaviga : m_xTreeView(std::move(xTreeView)) , m_xScratchIter(m_xTreeView->make_iterator()) , m_aDropTargetHelper(*this) - , m_xDialog(pDialog) + , m_pDialog(pDialog) , m_sSpace(OUString(" ")) , m_sInvisible(SwResId(STR_INVISIBLE)) , m_pHiddenShell(nullptr) @@ -978,7 +978,6 @@ SwContentTree::~SwContentTree() clear(); // If applicable erase content types previously. m_aUpdTimer.Stop(); SetActiveShell(nullptr); - m_xDialog.clear(); } // Drag&Drop methods @@ -4542,7 +4541,7 @@ bool NaviContentBookmark::Paste( TransferableDataHelper& rData ) SwNavigationPI* SwContentTree::GetParentWindow() { - return m_xDialog; + return m_pDialog; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx index 745ac10ce8d1..fb6326f37ae7 100644 --- a/sw/source/uibase/utlui/glbltree.cxx +++ b/sw/source/uibase/utlui/glbltree.cxx @@ -125,7 +125,7 @@ static const char* GLOBAL_CONTEXT_ARY[] = SwGlobalTree::SwGlobalTree(std::unique_ptr<weld::TreeView> xTreeView, SwNavigationPI* pDialog) : m_xTreeView(std::move(xTreeView)) , m_aDropTargetHelper(*this) - , m_xDialog(pDialog) + , m_pDialog(pDialog) , m_pActiveShell(nullptr) { m_xTreeView->set_size_request(m_xTreeView->get_approximate_digit_width() * 30, @@ -153,7 +153,6 @@ SwGlobalTree::~SwGlobalTree() m_pSwGlblDocContents.reset(); m_pDocInserter.reset(); m_aUpdateTimer.Stop(); - m_xDialog.clear(); } SwGlobalTreeDropTarget::SwGlobalTreeDropTarget(SwGlobalTree& rTreeView) @@ -513,7 +512,8 @@ void SwGlobalTree::InsertRegion( const SwGlblDocContent* pCont, const OUString* Sequence< OUString > aFileNames; if ( !pFileName ) { - m_pDocInserter.reset(new ::sfx2::DocumentInserter(GetParentWindow()->GetFrameWeld(), "swriter", sfx2::DocumentInserter::Mode::InsertMulti)); + SwNavigationPI* pNavi = GetParentWindow(); + m_pDocInserter.reset(new ::sfx2::DocumentInserter(pNavi->GetFrameWeld(), "swriter", sfx2::DocumentInserter::Mode::InsertMulti)); m_pDocInserter->StartExecuteModal( LINK( this, SwGlobalTree, DialogClosedHdl ) ); } else if ( !pFileName->isEmpty() ) @@ -963,7 +963,7 @@ IMPL_LINK_NOARG( SwGlobalTree, DoubleClickHdl, weld::TreeView&, bool) SwNavigationPI* SwGlobalTree::GetParentWindow() { - return m_xDialog; + return m_pDialog; } IMPL_STATIC_LINK_NOARG(SwGlobalTree, ShowFrameHdl, void*, void) diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx index 08ba46dae8e3..bbfc9b062fce 100644 --- a/sw/source/uibase/utlui/navipi.cxx +++ b/sw/source/uibase/utlui/navipi.cxx @@ -193,7 +193,7 @@ IMPL_LINK(SwNavigationPI, ToolBoxSelectHdl, const OString&, rCommand, void) } else if (rCommand == "listbox") { - if (ParentIsFloatingWindow(GetParent())) + if (ParentIsFloatingWindow(m_xNavigatorDlg)) { if (IsZoomedIn()) { @@ -394,7 +394,7 @@ void SwNavigationPI::ZoomOut() { if (!IsZoomedIn()) return; - SfxNavigator* pNav = dynamic_cast<SfxNavigator*>(GetParent()); + SfxNavigator* pNav = m_xNavigatorDlg.get(); if (!pNav) return; m_bIsZoomedIn = false; @@ -411,7 +411,8 @@ void SwNavigationPI::ZoomOut() m_xDocListBox->show(); } - Size aOptimalSize(m_xContainer->get_preferred_size()); + pNav->InvalidateChildSizeCache(); + Size aOptimalSize(pNav->GetOptimalSize()); Size aNewSize(pNav->GetOutputSizePixel()); aNewSize.setHeight( m_aExpandedSize.Height() ); pNav->SetMinOutputSizePixel(aOptimalSize); @@ -426,11 +427,11 @@ void SwNavigationPI::ZoomIn() { if (IsZoomedIn()) return; - SfxNavigator* pNav = dynamic_cast<SfxNavigator*>(GetParent()); + SfxNavigator* pNav = m_xNavigatorDlg.get(); if (!pNav) return; - m_aExpandedSize = GetSizePixel(); + m_aExpandedSize = m_xNavigatorDlg->GetSizePixel(); m_xContentBox->hide(); m_xContentTree->HideTree(); @@ -439,7 +440,8 @@ void SwNavigationPI::ZoomIn() m_xDocListBox->hide(); m_bIsZoomedIn = true; - Size aOptimalSize(m_xContainer->get_preferred_size()); + pNav->InvalidateChildSizeCache(); + Size aOptimalSize(pNav->GetOptimalSize()); Size aNewSize(pNav->GetOutputSizePixel()); aNewSize.setHeight( aOptimalSize.Height() ); pNav->SetMinOutputSizePixel(aOptimalSize); @@ -462,7 +464,7 @@ enum StatusIndex } -VclPtr<PanelLayout> SwNavigationPI::Create(vcl::Window* pParent, +std::unique_ptr<PanelLayout> SwNavigationPI::Create(weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings) { @@ -472,13 +474,13 @@ VclPtr<PanelLayout> SwNavigationPI::Create(vcl::Window* pParent, throw css::lang::IllegalArgumentException("no XFrame given to SwNavigationPI::Create", nullptr, 0); if( pBindings == nullptr ) throw css::lang::IllegalArgumentException("no SfxBindings given to SwNavigationPI::Create", nullptr, 0); - return VclPtr<SwNavigationPI>::Create(pParent, rxFrame, pBindings); + return std::make_unique<SwNavigationPI>(pParent, rxFrame, pBindings, nullptr); } -SwNavigationPI::SwNavigationPI(vcl::Window* pParent, +SwNavigationPI::SwNavigationPI(weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, - SfxBindings* _pBindings) - : PanelLayout(pParent, "NavigatorPanel", "modules/swriter/ui/navigatorpanel.ui", rxFrame) + SfxBindings* _pBindings, SfxNavigator* pNavigatorDlg) + : PanelLayout(pParent, "NavigatorPanel", "modules/swriter/ui/navigatorpanel.ui") , m_aDocFullName(SID_DOCFULLNAME, *_pBindings, *this) , m_aPageStats(FN_STAT_PAGE, *_pBindings, *this) , m_xContent1ToolBox(m_xBuilder->weld_toolbar("content1")) @@ -500,6 +502,7 @@ SwNavigationPI::SwNavigationPI(vcl::Window* pParent, , m_xGlobalBox(m_xBuilder->weld_widget("globalbox")) , m_xGlobalTree(new SwGlobalTree(m_xBuilder->weld_tree_view("globaltree"), this)) , m_xDocListBox(m_xBuilder->weld_combo_box("documents")) + , m_xNavigatorDlg(pNavigatorDlg) , m_pContentView(nullptr) , m_pContentWrtShell(nullptr) , m_pActContView(nullptr) @@ -512,7 +515,7 @@ SwNavigationPI::SwNavigationPI(vcl::Window* pParent, { m_xContainer->connect_container_focus_changed(LINK(this, SwNavigationPI, SetFocusChildHdl)); - set_id("NavigatorPanelParent"); // for uitest/writer_tests5/tdf114724.py + UpdateInitShow(); GetCreateView(); @@ -562,7 +565,7 @@ SwNavigationPI::SwNavigationPI(vcl::Window* pParent, m_aStatusArr[3] = SwResId(STR_ACTIVE_VIEW); - bool bFloatingNavigator = ParentIsFloatingWindow(GetParent()); + bool bFloatingNavigator = ParentIsFloatingWindow(m_xNavigatorDlg); m_xContentTree->set_selection_mode(SelectionMode::Single); m_xContentTree->ShowTree(); @@ -622,16 +625,16 @@ SwNavigationPI::SwNavigationPI(vcl::Window* pParent, m_xDocListBox->set_accessible_name(m_aStatusArr[3]); m_aExpandedSize = m_xContainer->get_preferred_size(); - - m_pInitialFocusWidget = m_xContent1ToolBox.get(); } -SwNavigationPI::~SwNavigationPI() +weld::Window* SwNavigationPI::GetFrameWeld() const { - disposeOnce(); + if (m_xNavigatorDlg) + return m_xNavigatorDlg->GetFrameWeld(); + return PanelLayout::GetFrameWeld(); } -void SwNavigationPI::dispose() +SwNavigationPI::~SwNavigationPI() { if (IsGlobalDoc() && !IsGlobalMode()) { @@ -674,8 +677,6 @@ void SwNavigationPI::dispose() m_aDocFullName.dispose(); m_aPageStats.dispose(); - - PanelLayout::dispose(); } void SwNavigationPI::NotifyItemUpdate(sal_uInt16 nSID, SfxItemState /*eState*/, @@ -717,24 +718,21 @@ void SwNavigationPI::NotifyItemUpdate(sal_uInt16 nSID, SfxItemState /*eState*/, } } -void SwNavigationPI::StateChanged(StateChangedType nStateChange) +void SwNavigationPI::UpdateInitShow() { - PanelLayout::StateChanged(nStateChange); - if (nStateChange == StateChangedType::InitShow) + // if the parent isn't a float, then the navigator is displayed in + // the sidebar or is otherwise docked. While the navigator could change + // its size, the sidebar can not, and the navigator would just waste + // space. Therefore disable this button. + bool bParentIsFloatingWindow(ParentIsFloatingWindow(m_xNavigatorDlg)); + m_xContent6ToolBox->set_item_sensitive("listbox", bParentIsFloatingWindow); + // show content if docked + if (!bParentIsFloatingWindow && IsZoomedIn()) + ZoomOut(); + if (m_xContentTree) { - // if the parent isn't a float, then the navigator is displayed in - // the sidebar or is otherwise docked. While the navigator could change - // its size, the sidebar can not, and the navigator would just waste - // space. Therefore disable this button. - m_xContent6ToolBox->set_item_sensitive("listbox", ParentIsFloatingWindow(GetParent())); - // show content if docked - if (!ParentIsFloatingWindow(GetParent()) && IsZoomedIn()) - ZoomOut(); - if (m_xContentTree) - { - m_xContentTree->SetActiveShell(GetActiveWrtShell()); - m_xContentTree->UpdateTracking(); - } + m_xContentTree->SetActiveShell(GetActiveWrtShell()); + m_xContentTree->UpdateTracking(); } } @@ -1092,12 +1090,13 @@ SwView* SwNavigationPI::GetCreateView() const class SwNavigatorWin : public SfxNavigator { private: - VclPtr<SwNavigationPI> pNavi; + std::unique_ptr<SwNavigationPI> m_xNavi; public: SwNavigatorWin(SfxBindings* _pBindings, SfxChildWindow* _pMgr, vcl::Window* pParent); + virtual void StateChanged(StateChangedType nStateChange) override; virtual void dispose() override { - pNavi.disposeAndClear(); + m_xNavi.reset(); SfxNavigator::dispose(); } virtual ~SwNavigatorWin() override @@ -1108,9 +1107,8 @@ public: SwNavigatorWin::SwNavigatorWin(SfxBindings* _pBindings, SfxChildWindow* _pMgr, vcl::Window* pParent) : SfxNavigator(_pBindings, _pMgr, pParent) + , m_xNavi(std::make_unique<SwNavigationPI>(m_xContainer.get(), _pBindings->GetActiveFrame(), _pBindings, this)) { - Reference< XFrame > xFrame = _pBindings->GetActiveFrame(); - pNavi = VclPtr< SwNavigationPI >::Create( this, xFrame, _pBindings ); _pBindings->Invalidate(SID_NAVIGATOR); SwNavigationConfig* pNaviConfig = SW_MOD()->GetNavigationConfig(); @@ -1118,20 +1116,26 @@ SwNavigatorWin::SwNavigatorWin(SfxBindings* _pBindings, SfxChildWindow* _pMgr, v const ContentTypeId nRootType = pNaviConfig->GetRootType(); if( nRootType != ContentTypeId::UNKNOWN ) { - pNavi->m_xContentTree->SetRootType(nRootType); - pNavi->m_xContent5ToolBox->set_item_active("root", true); + m_xNavi->m_xContentTree->SetRootType(nRootType); + m_xNavi->m_xContent5ToolBox->set_item_active("root", true); if (nRootType == ContentTypeId::OUTLINE) { - pNavi->m_xContentTree->set_selection_mode(SelectionMode::Multiple); + m_xNavi->m_xContentTree->set_selection_mode(SelectionMode::Multiple); } } - pNavi->m_xContentTree->SetOutlineLevel( static_cast< sal_uInt8 >( pNaviConfig->GetOutlineLevel() ) ); - pNavi->SetRegionDropMode( pNaviConfig->GetRegionMode() ); - pNavi->Show(); + m_xNavi->m_xContentTree->SetOutlineLevel( static_cast< sal_uInt8 >( pNaviConfig->GetOutlineLevel() ) ); + m_xNavi->SetRegionDropMode( pNaviConfig->GetRegionMode() ); - SetMinOutputSizePixel(pNavi->GetOptimalSize()); + SetMinOutputSizePixel(GetOptimalSize()); if (pNaviConfig->IsSmall()) - pNavi->ZoomIn(); + m_xNavi->ZoomIn(); +} + +void SwNavigatorWin::StateChanged(StateChangedType nStateChange) +{ + SfxNavigator::StateChanged(nStateChange); + if (nStateChange == StateChangedType::InitShow) + m_xNavi->UpdateInitShow(); } SFX_IMPL_DOCKINGWINDOW(SwNavigatorWrapper, SID_NAVIGATOR); |