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 /sc/source | |
parent | lok: avoid a set of invalidations per view on re-size. (diff) | |
download | core-1653bb9bffaa84a40b7d81a8277e887ea28df4e4.tar.gz core-1653bb9bffaa84a40b7d81a8277e887ea28df4e4.zip |
remove intermediate containers in sidebars
tested extension sidebars of:
a) Wollmux extension sidebars
b) Analog Clock Extension demo
https://wiki.openoffice.org/wiki/Sidebar_for_Developers#Example:_Analog_Clock_Extension
Change-Id: If9729e20526681928137989f01a8ae733a9b0cb5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112035
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/ui/formdlg/dwfunctr.cxx | 27 | ||||
-rw-r--r-- | sc/source/ui/inc/content.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/inc/dwfunctr.hxx | 7 | ||||
-rw-r--r-- | sc/source/ui/inc/navipi.hxx | 9 | ||||
-rw-r--r-- | sc/source/ui/navipi/content.cxx | 1 | ||||
-rw-r--r-- | sc/source/ui/navipi/navipi.cxx | 58 | ||||
-rw-r--r-- | sc/source/ui/sidebar/AlignmentPropertyPanel.cxx | 23 | ||||
-rw-r--r-- | sc/source/ui/sidebar/AlignmentPropertyPanel.hxx | 10 | ||||
-rw-r--r-- | sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx | 22 | ||||
-rw-r--r-- | sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx | 11 | ||||
-rw-r--r-- | sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx | 23 | ||||
-rw-r--r-- | sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx | 10 | ||||
-rw-r--r-- | sc/source/ui/sidebar/ScPanelFactory.cxx | 26 |
13 files changed, 88 insertions, 141 deletions
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 &) |