diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-03-04 17:22:14 +0000 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2021-05-25 12:12:32 +0200 |
commit | 9573883d846d1a4653acdcb6eb45e0b0d1849629 (patch) | |
tree | 3f27f2b8b4574d2eaa82bcdf6dad9aee535734e6 /sw | |
parent | 377e946029f2286899d5736ec9fe54f300169aa2 (diff) |
remove intermediate containers in sidebars
tested extension sidebars of:
a) Wollmux extension sidebars
b) Analog Clock Extension demo
https://wiki.openoffice.org/wiki/Sidebar_for_Developers#Example:_Analog_Clock_Extension
Change-Id: If9729e20526681928137989f01a8ae733a9b0cb5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112035
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
29 files changed, 306 insertions, 348 deletions
diff --git a/sw/qa/uitest/navigator/tdf114724.py b/sw/qa/uitest/navigator/tdf114724.py index cf3b8482a5ca..a4db93242afd 100644 --- a/sw/qa/uitest/navigator/tdf114724.py +++ b/sw/qa/uitest/navigator/tdf114724.py @@ -22,7 +22,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 f1e153992e2d..f11c43d9b3d0 100644 --- a/sw/qa/uitest/navigator/tdf137274.py +++ b/sw/qa/uitest/navigator/tdf137274.py @@ -31,9 +31,7 @@ class tdf137274(UITestCase): xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) # wait until the navigator panel is available - self.ui_test.wait_until_child_is_available(xMainWindow, 'NavigatorPanelParent') - - xNavigatorPanel = xWriterEdit.getChild("NavigatorPanelParent") + xNavigatorPanel = xWriterEdit.getChild("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 new file mode 100644 index 000000000000..5427626008d8 --- /dev/null +++ b/sw/qa/uitest/navigator/tdf140257.py @@ -0,0 +1,116 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, type_text +from uitest.uihelper.common import select_pos + +class Tdf140257(UITestCase): + + def change_outline_level(self, sText): + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + + xOutline = xDialog.getChild("comboLB_OUTLINE_LEVEL") + + props = {"TEXT": sText} + actionProps = mkPropertyValues(props) + xOutline.executeAction("SELECT", actionProps) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + def test_tdf140257(self): + self.ui_test.create_doc_in_start_center("writer") + xMainWindow = self.xUITest.getTopFocusWindow() + xWriterEdit = xMainWindow.getChild("writer_edit") + + self.change_outline_level("Level 1") + + for i in range(4): + type_text(xWriterEdit, 'P' + str(i + 1)) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + + type_text(xWriterEdit, 'P5') + + self.xUITest.executeCommand(".uno:Sidebar") + + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) + + # wait until the navigator panel is available + xNavigatorPanel = xWriterEdit.getChild("NavigatorPanel") + + xContentTree = xNavigatorPanel.getChild("contenttree") + xHeadings = xContentTree.getChild('0') + self.assertEqual('Headings', get_state_as_dict(xHeadings)['Text']) + + xHeadings.executeAction("EXPAND", tuple()) + + self.assertEqual(5, len(xHeadings.getChildren())) + + for i in range(5): + self.assertEqual('P' + str(i + 1), get_state_as_dict(xHeadings.getChild(str(i)))['Text']) + + self.xUITest.executeCommand(".uno:Sidebar") + + document = self.ui_test.get_component() + cursor = document.getCurrentController().getViewCursor() + + # Use Adding Selection + selectionProperty = mkPropertyValues({"SelectionMode": 2}) + self.xUITest.executeCommandWithParameters(".uno:SelectionMode", selectionProperty) + + # Go to P2 and select it + cursor.goUp(3, False) + cursor.gotoStartOfLine(False) + cursor.gotoEndOfLine(True) + + # Go to P4 and select it + cursor.goDown(2, False) + cursor.gotoStartOfLine(False) + cursor.gotoEndOfLine(True) + + self.change_outline_level("Level 2") + + self.xUITest.executeCommand(".uno:Sidebar") + + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) + + # wait until the navigator panel is available + xNavigatorPanel = xWriterEdit.getChild("NavigatorPanel") + + xContentTree = xNavigatorPanel.getChild("contenttree") + xHeadings = xContentTree.getChild('0') + self.assertEqual('Headings', get_state_as_dict(xHeadings)['Text']) + + xHeadings.executeAction("EXPAND", tuple()) + + # Without the fix in place, this test would have failed with + # AssertionError: 3 != 4 + self.assertEqual(3, len(xHeadings.getChildren())) + xChild1 = xHeadings.getChild('0') + self.assertEqual('P1', get_state_as_dict(xChild1)['Text']) + xChild1.executeAction("EXPAND", tuple()) + self.assertEqual(1, len(xChild1.getChildren())) + self.assertEqual('P2', get_state_as_dict(xChild1.getChild('0'))['Text']) + + xChild2 = xHeadings.getChild('1') + self.assertEqual('P3', get_state_as_dict(xChild2)['Text']) + xChild2.executeAction("EXPAND", tuple()) + self.assertEqual(1, len(xChild2.getChildren())) + self.assertEqual('P4', get_state_as_dict(xChild2.getChild('0'))['Text']) + + self.assertEqual('P5', get_state_as_dict(xHeadings.getChild('2'))['Text']) + + self.xUITest.executeCommand(".uno:Sidebar") + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/source/uibase/inc/conttree.hxx b/sw/source/uibase/inc/conttree.hxx index bf07a8de5232..741478f02d74 100644 --- a/sw/source/uibase/inc/conttree.hxx +++ b/sw/source/uibase/inc/conttree.hxx @@ -86,7 +86,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; @@ -295,7 +295,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 f0b36d44f0c8..88d166ecacba 100644 --- a/sw/source/uibase/inc/navipi.hxx +++ b/sw/source/uibase/inc/navipi.hxx @@ -76,6 +76,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; @@ -114,6 +116,8 @@ class SwNavigationPI : public PanelLayout bool EditAction(); void UsePage(); + void UpdateInitShow(); + protected: // release ObjectShellLock early enough for app end @@ -124,14 +128,13 @@ protected: public: - static VclPtr<vcl::Window> 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); @@ -143,8 +146,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); @@ -158,6 +159,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 d35ce818709f..61bea73dd92c 100644 --- a/sw/source/uibase/inc/redlndlg.hxx +++ b/sw/source/uibase/inc/redlndlg.hxx @@ -152,9 +152,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 a3af0082fb74..46066d0a1ee7 100644 --- a/sw/source/uibase/sidebar/PageFooterPanel.cxx +++ b/sw/source/uibase/sidebar/PageFooterPanel.cxx @@ -31,17 +31,13 @@ namespace sw::sidebar{ -VclPtr<vcl::Window> 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() @@ -51,10 +47,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), @@ -78,19 +73,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 849a3165d474..3cb3af4dd28a 100644 --- a/sw/source/uibase/sidebar/PageFooterPanel.hxx +++ b/sw/source/uibase/sidebar/PageFooterPanel.hxx @@ -20,30 +20,25 @@ #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/spacinglistbox.hxx> #include <svx/samecontentlistbox.hxx> +#include <svx/rulritem.hxx> namespace sw::sidebar { -class PageFooterPanel: +class PageFooterPanel : public PanelLayout, public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface { public: - static VclPtr<vcl::Window> 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( @@ -57,11 +52,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 31d556ca15ee..61cded7dc56f 100644 --- a/sw/source/uibase/sidebar/PageFormatPanel.cxx +++ b/sw/source/uibase/sidebar/PageFormatPanel.cxx @@ -43,17 +43,14 @@ namespace sw::sidebar{ -VclPtr<vcl::Window> 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 7c2a505618c8..eb3b400a3136 100644 --- a/sw/source/uibase/sidebar/PageFormatPanel.hxx +++ b/sw/source/uibase/sidebar/PageFormatPanel.hxx @@ -19,10 +19,7 @@ #ifndef INCLUDED_SW_SOURCE_UIBASE_SIDEBAR_PAGEFORMATPANEL_HXX #define INCLUDED_SW_SOURCE_UIBASE_SIDEBAR_PAGEFORMATPANEL_HXX -#include <com/sun/star/frame/XFrame.hpp> - #include <sfx2/sidebar/PanelLayout.hxx> - #include <sfx2/sidebar/ControllerItem.hxx> #include <svx/pageitem.hxx> @@ -37,14 +34,13 @@ namespace sw::sidebar { -class PageFormatPanel: +class PageFormatPanel : public PanelLayout, public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface { public: - static VclPtr<vcl::Window> 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( @@ -57,11 +53,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 a59a6f8ce2ff..094c646de0a9 100644 --- a/sw/source/uibase/sidebar/PageHeaderPanel.cxx +++ b/sw/source/uibase/sidebar/PageHeaderPanel.cxx @@ -31,19 +31,16 @@ namespace sw::sidebar{ -VclPtr<vcl::Window> 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() @@ -53,11 +50,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), @@ -81,18 +77,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 251ff3a474dc..90286b5d1437 100644 --- a/sw/source/uibase/sidebar/PageHeaderPanel.hxx +++ b/sw/source/uibase/sidebar/PageHeaderPanel.hxx @@ -20,30 +20,24 @@ #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/spacinglistbox.hxx> #include <svx/samecontentlistbox.hxx> +#include <svx/rulritem.hxx> namespace sw::sidebar { -class PageHeaderPanel: +class PageHeaderPanel : public PanelLayout, public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface { public: - static VclPtr<vcl::Window> 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( @@ -57,11 +51,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 f2ebd9dd03cc..2659fc39dda1 100644 --- a/sw/source/uibase/sidebar/PageStylesPanel.cxx +++ b/sw/source/uibase/sidebar/PageStylesPanel.cxx @@ -20,6 +20,7 @@ #include <svl/intitem.hxx> #include <svx/colorbox.hxx> #include <svx/drawitem.hxx> +#include <svx/itemwin.hxx> #include <svx/xfillit0.hxx> #include <svx/xflclit.hxx> #include <svx/xflgrit.hxx> @@ -67,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) ) @@ -75,27 +75,21 @@ static SvxPageUsage PosToPageUsage_Impl( sal_uInt16 nPos ) return aArr[nPos]; } -VclPtr<vcl::Window> 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) ), @@ -122,11 +116,6 @@ PageStylesPanel::PageStylesPanel( PageStylesPanel::~PageStylesPanel() { - disposeOnce(); -} - -void PageStylesPanel::dispose() -{ mxColumnCount.reset(); mxNumberSelectLB.reset(); mxBgFillType.reset(); @@ -144,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 7e3c09d2eebb..6047d2535666 100644 --- a/sw/source/uibase/sidebar/PageStylesPanel.hxx +++ b/sw/source/uibase/sidebar/PageStylesPanel.hxx @@ -20,21 +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/itemwin.hxx> +#include <svx/pageitem.hxx> #include <svx/pagenumberlistbox.hxx> class List; @@ -46,9 +41,8 @@ class PageStylesPanel: public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface { public: - static VclPtr<vcl::Window> 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( @@ -62,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 12e400b939b9..4d3095e0072e 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<vcl::Window> 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 36b272a08754..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<vcl::Window> 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 68e5c0684d6a..27261caf04a9 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 <comphelper/namedvaluecollection.hxx> #include <cppuhelper/compbase.hxx> @@ -93,8 +92,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); @@ -109,93 +111,93 @@ Reference<ui::XUIElement> SAL_CALL SwPanelFactory::createUIElement ( if(rsResourceURL.endsWith("/PageStylesPanel")) { - VclPtr<vcl::Window> 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<vcl::Window> 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<vcl::Window> 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<vcl::Window> 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<vcl::Window> 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<vcl::Window> 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<vcl::Window> 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<vcl::Window> 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<vcl::Window> 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<vcl::Window> 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 de91b0e37737..ea8c441888ed 100644 --- a/sw/source/uibase/sidebar/TableEditPanel.cxx +++ b/sw/source/uibase/sidebar/TableEditPanel.cxx @@ -25,9 +25,10 @@ namespace sw::sidebar { -VclPtr<vcl::Window> 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( @@ -36,7 +37,7 @@ VclPtr<vcl::Window> 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, @@ -87,10 +88,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))) @@ -138,12 +139,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); @@ -172,7 +169,7 @@ void TableEditPanel::InitColumnWidthToolitem() limitWidthForSidebar(*m_xColumnWidthEdit); } -void TableEditPanel::dispose() +TableEditPanel::~TableEditPanel() { m_xRowHeightEdit.reset(); m_xColumnWidthEdit.reset(); @@ -214,8 +211,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 113455060484..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<vcl::Window> 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 a25b08806d91..15aed1b14594 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<vcl::Window> 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 b2b1c503790f..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<vcl::Window> 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 08c6405f7a31..352abffee68b 100644 --- a/sw/source/uibase/sidebar/WrapPropertyPanel.cxx +++ b/sw/source/uibase/sidebar/WrapPropertyPanel.cxx @@ -37,8 +37,8 @@ namespace sw::sidebar { -VclPtr<vcl::Window> WrapPropertyPanel::Create ( - vcl::Window* pParent, +std::unique_ptr<PanelLayout> WrapPropertyPanel::Create ( + weld::Widget* pParent, const css::uno::Reference< css::frame::XFrame >& rxFrame, SfxBindings* pBindings) { @@ -49,17 +49,14 @@ VclPtr<vcl::Window> 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) @@ -79,26 +76,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 1f4d16d80595..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<vcl::Window> 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 e2c3c15d0e24..ffebff28eb02 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<vcl::Window> 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 5fd3402af222..c3459c8d3b7a 100644 --- a/sw/source/uibase/sidebar/WriterInspectorTextPanel.hxx +++ b/sw/source/uibase/sidebar/WriterInspectorTextPanel.hxx @@ -28,14 +28,11 @@ namespace sw::sidebar class WriterInspectorTextPanel final : public svx::sidebar::InspectorTextPanel { public: - 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); - 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 ebaa3857b2f5..9d59cf92152a 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -914,7 +914,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) @@ -967,7 +967,6 @@ SwContentTree::~SwContentTree() clear(); // If applicable erase content types previously. m_aUpdTimer.Stop(); SetActiveShell(nullptr); - m_xDialog.clear(); } // Drag&Drop methods @@ -4488,7 +4487,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 7cf78d2f5b78..de0bd8b74344 100644 --- a/sw/source/uibase/utlui/glbltree.cxx +++ b/sw/source/uibase/utlui/glbltree.cxx @@ -127,7 +127,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, @@ -155,7 +155,6 @@ SwGlobalTree::~SwGlobalTree() m_pSwGlblDocContents.reset(); m_pDocInserter.reset(); m_aUpdateTimer.Stop(); - m_xDialog.clear(); } SwGlobalTreeDropTarget::SwGlobalTreeDropTarget(SwGlobalTree& rTreeView) @@ -515,7 +514,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() ) @@ -667,7 +667,7 @@ void SwGlobalTree::ExecuteContextMenuAction(const OString& rSelectedPopupEntry) SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); ScopedVclPtr<AbstractMultiTOXTabDialog> pDlg(pFact->CreateMultiTOXTabDialog( - m_xDialog->GetFrameWeld(), aSet, + m_pDialog->GetFrameWeld(), aSet, *m_pActiveShell, nullptr, true)); @@ -965,7 +965,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 21f3a252e642..0b5e8d7b202e 100644 --- a/sw/source/uibase/utlui/navipi.cxx +++ b/sw/source/uibase/utlui/navipi.cxx @@ -197,7 +197,7 @@ IMPL_LINK(SwNavigationPI, ToolBoxSelectHdl, const OString&, rCommand, void) } else if (rCommand == "listbox") { - if (ParentIsFloatingWindow(GetParent())) + if (ParentIsFloatingWindow(m_xNavigatorDlg)) { if (IsZoomedIn()) { @@ -398,7 +398,7 @@ void SwNavigationPI::ZoomOut() { if (!IsZoomedIn()) return; - SfxNavigator* pNav = dynamic_cast<SfxNavigator*>(GetParent()); + SfxNavigator* pNav = m_xNavigatorDlg.get(); if (!pNav) return; m_bIsZoomedIn = false; @@ -415,7 +415,8 @@ void SwNavigationPI::ZoomOut() m_xDocListBox->show(); } - Size aOptimalSize(GetOptimalSize()); + pNav->InvalidateChildSizeCache(); + Size aOptimalSize(pNav->GetOptimalSize()); Size aNewSize(pNav->GetOutputSizePixel()); aNewSize.setHeight( m_aExpandedSize.Height() ); pNav->SetMinOutputSizePixel(aOptimalSize); @@ -430,11 +431,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(); @@ -443,7 +444,8 @@ void SwNavigationPI::ZoomIn() m_xDocListBox->hide(); m_bIsZoomedIn = true; - Size aOptimalSize(GetOptimalSize()); + pNav->InvalidateChildSizeCache(); + Size aOptimalSize(pNav->GetOptimalSize()); Size aNewSize(pNav->GetOutputSizePixel()); aNewSize.setHeight( aOptimalSize.Height() ); pNav->SetMinOutputSizePixel(aOptimalSize); @@ -466,7 +468,7 @@ enum StatusIndex } -VclPtr<vcl::Window> SwNavigationPI::Create(vcl::Window* pParent, +std::unique_ptr<PanelLayout> SwNavigationPI::Create(weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings) { @@ -476,13 +478,13 @@ VclPtr<vcl::Window> 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")) @@ -504,6 +506,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) @@ -516,7 +519,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(); @@ -566,7 +569,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(); @@ -625,17 +628,17 @@ SwNavigationPI::SwNavigationPI(vcl::Window* pParent, m_xGlobalTree->set_accessible_name(SwResId(STR_ACCESS_TL_GLOBAL)); m_xDocListBox->set_accessible_name(m_aStatusArr[3]); - m_aExpandedSize = GetOptimalSize(); - - m_pInitialFocusWidget = m_xContent1ToolBox.get(); + m_aExpandedSize = m_xContainer->get_preferred_size(); } -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()) { @@ -678,8 +681,6 @@ void SwNavigationPI::dispose() m_aDocFullName.dispose(); m_aPageStats.dispose(); - - PanelLayout::dispose(); } void SwNavigationPI::NotifyItemUpdate(sal_uInt16 nSID, SfxItemState /*eState*/, @@ -721,24 +722,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(); } } @@ -1096,12 +1094,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 @@ -1112,9 +1111,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(); @@ -1122,20 +1120,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); |