diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-03-09 15:51:53 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-03-11 10:07:57 +0100 |
commit | 001cf630f14109b4200b218161418350562713fa (patch) | |
tree | 02d0fe2d6a56ac7a0b6d991f455aba90d5b5f780 /sd | |
parent | 5229cacba320f829ca0acd6ef79ddbb09d52b2d9 (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 828ab885e9dd..cbcd201095d3 100644 --- a/sd/source/ui/app/sddll.cxx +++ b/sd/source/ui/app/sddll.cxx @@ -148,8 +148,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); @@ -169,6 +167,8 @@ void SdDLL::RegisterControllers(SdModule* pMod) ::sfx2::sidebar::SidebarChildWindow::RegisterChildWindow(false, pMod); DevelopmentToolChildWindow::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 e43175600d24..ece000c7371e 100644 --- a/sd/source/ui/inc/navigatr.hxx +++ b/sd/source/ui/inc/navigatr.hxx @@ -22,6 +22,7 @@ #include <sfx2/ctrlitem.hxx> #include <sfx2/sidebar/PanelLayout.hxx> +#include <sfx2/navigat.hxx> #include "sdtreelb.hxx" #include <pres.hxx> @@ -30,7 +31,7 @@ namespace vcl { class Window; } namespace sd { class DrawDocShell; -class NavigatorChildWindow; +class SdNavigatorFloat; } class Menu; class SdNavigatorControllerItem; @@ -77,6 +78,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: @@ -103,7 +120,7 @@ public: SdPageObjsTLV& GetObjects(); 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 74844b847d73..fa8d9672e2d5 100644 --- a/sd/source/ui/view/drviews4.cxx +++ b/sd/source/ui/view/drviews4.cxx @@ -271,7 +271,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 879051bc4c1f..763ae13eac91 100644 --- a/sd/source/ui/view/drviewsd.cxx +++ b/sd/source/ui/view/drviewsd.cxx @@ -57,7 +57,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() ); } |