diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-03-09 15:51:53 +0000 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2021-05-25 12:12:25 +0200 |
commit | 9142876e208d714508984b192eb8ba35af30c100 (patch) | |
tree | e6396edacd73ae0c837038d9e52226061623dbc6 /sd | |
parent | bcde3d560198a834bce8f1f129f1d3c665baa3df (diff) |
register navigator individually in each module that it exists in
instead of globally. This makes the navigators the same
as everything else and easier to deal with.
Change-Id: I882612e73d36485b84161a2d3fbc1188f734c0fb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112244
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/app/sddll.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/dlg/NavigatorChildWindow.cxx | 51 | ||||
-rw-r--r-- | sd/source/ui/inc/NavigatorChildWindow.hxx | 17 | ||||
-rw-r--r-- | sd/source/ui/inc/navigatr.hxx | 21 | ||||
-rw-r--r-- | sd/source/ui/view/drviews4.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/drviewsd.cxx | 2 |
6 files changed, 64 insertions, 33 deletions
diff --git a/sd/source/ui/app/sddll.cxx b/sd/source/ui/app/sddll.cxx index 63ab45f8b6cd..1ca34749d669 100644 --- a/sd/source/ui/app/sddll.cxx +++ b/sd/source/ui/app/sddll.cxx @@ -156,8 +156,6 @@ void SdDLL::RegisterControllers(SdModule* pMod) SdTbxCtlGlueEscDir::RegisterControl( SID_GLUE_ESCDIR, pMod ); ::sd::AnimationChildWindow::RegisterChildWindow(false, pMod); - ::sd::NavigatorChildWindow::RegisterChildWindowContext( static_cast<sal_uInt16>(::sd::DrawViewShell::GetInterfaceId()), pMod ); - ::sd::NavigatorChildWindow::RegisterChildWindowContext( static_cast<sal_uInt16>(::sd::GraphicViewShell::GetInterfaceId()), pMod ); Svx3DChildWindow::RegisterChildWindow(false, pMod); SvxFontWorkChildWindow::RegisterChildWindow(false, pMod); @@ -176,6 +174,8 @@ void SdDLL::RegisterControllers(SdModule* pMod) ::sd::LeftPaneDrawChildWindow::RegisterChildWindow(false, pMod); ::sfx2::sidebar::SidebarChildWindow::RegisterChildWindow(false, pMod); + ::sd::SdNavigatorWrapper::RegisterChildWindow(false, pMod, SfxChildWindowFlags::NEVERHIDE); + SvxFillToolBoxControl::RegisterControl(0, pMod); SvxLineWidthToolBoxControl::RegisterControl(0, pMod); diff --git a/sd/source/ui/dlg/NavigatorChildWindow.cxx b/sd/source/ui/dlg/NavigatorChildWindow.cxx index 1773734dd64c..804a7ccad262 100644 --- a/sd/source/ui/dlg/NavigatorChildWindow.cxx +++ b/sd/source/ui/dlg/NavigatorChildWindow.cxx @@ -22,14 +22,11 @@ #include <app.hrc> #include <sfx2/bindings.hxx> #include <sfx2/dispatch.hxx> -#include <sfx2/navigat.hxx> #include <sfx2/sfxsids.hrc> #include <svl/eitem.hxx> namespace sd { -SFX_IMPL_CHILDWINDOWCONTEXT(NavigatorChildWindow, SID_NAVIGATOR) - static void RequestNavigatorUpdate (SfxBindings const * pBindings) { if (pBindings != nullptr @@ -43,23 +40,47 @@ static void RequestNavigatorUpdate (SfxBindings const * pBindings) } } -NavigatorChildWindow::NavigatorChildWindow ( - vcl::Window* pParent, - sal_uInt16 nId, - SfxBindings* pBindings, - SfxChildWinInfo* ) - : SfxChildWindowContext( nId ) +SdNavigatorFloat::SdNavigatorFloat(SfxBindings* _pBindings, SfxChildWindow* _pMgr, vcl::Window* _pParent) + : SfxNavigator(_pBindings, _pMgr, _pParent) { - VclPtr<SdNavigatorWin> pNavWin = VclPtr<SdNavigatorWin>::Create( - pParent, pBindings); + pNavWin = VclPtr<SdNavigatorWin>::Create(this, _pBindings); + pNavWin->Show(); pNavWin->SetUpdateRequestFunctor( - [pBindings] () { return RequestNavigatorUpdate(pBindings); }); + [_pBindings] () { return RequestNavigatorUpdate(_pBindings); }); + + SetMinOutputSizePixel(pNavWin->GetOptimalSize()); +} + +void SdNavigatorFloat::InitTreeLB(const SdDrawDocument* pDoc) +{ + pNavWin->InitTreeLB(pDoc); +} + +void SdNavigatorFloat::FreshTree(const SdDrawDocument* pDoc) +{ + pNavWin->FreshTree(pDoc); +} + +void SdNavigatorFloat::dispose() +{ + pNavWin.disposeAndClear(); + SfxNavigator::dispose(); +} - if (SfxNavigator* pNav = dynamic_cast<SfxNavigator*>(pParent)) - pNav->SetMinOutputSizePixel(pNavWin->GetOptimalSize()); +SdNavigatorFloat::~SdNavigatorFloat() +{ + disposeOnce(); +} - SetWindow( pNavWin ); +SFX_IMPL_DOCKINGWINDOW(SdNavigatorWrapper, SID_NAVIGATOR); + +SdNavigatorWrapper::SdNavigatorWrapper(vcl::Window *_pParent, sal_uInt16 nId, + SfxBindings* pBindings, SfxChildWinInfo* pInfo) + : SfxNavigatorWrapper(_pParent, nId, pBindings, pInfo) +{ + SetWindow(VclPtr<SdNavigatorFloat>::Create(pBindings, this, _pParent)); + Initialize(pInfo); } } // end of namespace sd diff --git a/sd/source/ui/inc/NavigatorChildWindow.hxx b/sd/source/ui/inc/NavigatorChildWindow.hxx index 4654c23a0ef6..4199cab677ba 100644 --- a/sd/source/ui/inc/NavigatorChildWindow.hxx +++ b/sd/source/ui/inc/NavigatorChildWindow.hxx @@ -20,26 +20,19 @@ #pragma once #include <sfx2/childwin.hxx> +#include <sfx2/navigat.hxx> namespace vcl { class Window; } class SfxBindings; namespace sd { -/** - * Derivative of SfxChildWindowContext as "container" for navigator - */ -class NavigatorChildWindow - : public SfxChildWindowContext +class SdNavigatorWrapper final : public SfxNavigatorWrapper { public: - NavigatorChildWindow ( - vcl::Window*, - sal_uInt16, - SfxBindings*, - SfxChildWinInfo*); - - SFX_DECL_CHILDWINDOWCONTEXT(NavigatorChildWindow) + SdNavigatorWrapper(vcl::Window *pParent, sal_uInt16 nId, + SfxBindings* pBindings, SfxChildWinInfo* pInfo); + SFX_DECL_CHILDWINDOW(SdNavigatorWrapper); }; } // end of namespace sd diff --git a/sd/source/ui/inc/navigatr.hxx b/sd/source/ui/inc/navigatr.hxx index 1a0d9b1407b5..157151306f9f 100644 --- a/sd/source/ui/inc/navigatr.hxx +++ b/sd/source/ui/inc/navigatr.hxx @@ -23,6 +23,7 @@ #include <vcl/toolbox.hxx> #include <sfx2/ctrlitem.hxx> #include <sfx2/sidebar/PanelLayout.hxx> +#include <sfx2/navigat.hxx> #include "sdtreelb.hxx" #include <pres.hxx> @@ -31,7 +32,7 @@ namespace vcl { class Window; } namespace sd { class DrawDocShell; -class NavigatorChildWindow; +class SdNavigatorFloat; } class Menu; class SdNavigatorControllerItem; @@ -76,6 +77,22 @@ private: ::sd::DrawDocShell* mpDocShell; }; +namespace sd { + +class SdNavigatorFloat : public SfxNavigator +{ +private: + VclPtr<SdNavigatorWin> pNavWin; +public: + SdNavigatorFloat(SfxBindings* _pBindings, SfxChildWindow* pMgr, vcl::Window* pParent); + void InitTreeLB(const SdDrawDocument* pDoc); + void FreshTree(const SdDrawDocument* pDoc); + virtual void dispose() override; + virtual ~SdNavigatorFloat() override; +}; + +} + class SD_DLLPUBLIC SdNavigatorWin : public PanelLayout { public: @@ -107,7 +124,7 @@ protected: virtual bool EventNotify(NotifyEvent& rNEvt) override; private: - friend class ::sd::NavigatorChildWindow; + friend class SdNavigatorFloat; friend class SdNavigatorControllerItem; friend class SdPageNameControllerItem; diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx index ec59d54aaf0d..b3e7a81c16c5 100644 --- a/sd/source/ui/view/drviews4.cxx +++ b/sd/source/ui/view/drviews4.cxx @@ -303,7 +303,7 @@ void DrawViewShell::FreshNavigatrTree() SfxChildWindow* pWindow = GetViewFrame()->GetChildWindow( SID_NAVIGATOR ); if( pWindow ) { - SdNavigatorWin* pNavWin = static_cast<SdNavigatorWin*>( pWindow->GetContextWindow( SD_MOD() ) ); + SdNavigatorFloat* pNavWin = static_cast<SdNavigatorFloat*>( pWindow->GetWindow() ); if( pNavWin ) pNavWin->FreshTree( GetDoc() ); } diff --git a/sd/source/ui/view/drviewsd.cxx b/sd/source/ui/view/drviewsd.cxx index 8f6e627029d4..461a69261aaa 100644 --- a/sd/source/ui/view/drviewsd.cxx +++ b/sd/source/ui/view/drviewsd.cxx @@ -58,7 +58,7 @@ void DrawViewShell::ExecNavigatorWin( SfxRequest& rReq ) SfxChildWindow* pWindow = GetViewFrame()->GetChildWindow( SID_NAVIGATOR ); if( pWindow ) { - SdNavigatorWin* pNavWin = static_cast<SdNavigatorWin*>( pWindow->GetContextWindow( SD_MOD() ) ); + SdNavigatorFloat* pNavWin = static_cast<SdNavigatorFloat*>(pWindow->GetWindow()); if( pNavWin ) pNavWin->InitTreeLB( GetDoc() ); } |