diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-10-14 11:52:35 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-10-14 12:53:01 +0200 |
commit | 3e6c930842eea53a1faa0721c0807e07466c8fb2 (patch) | |
tree | 841dc0febaecc3d569ae759852d18d916da23b16 /sfx2 | |
parent | 11570275c601496bd709da1454cd8ffde50823e7 (diff) |
loplugin:mergeclasses merge SfxWorkWindow with SfxFrameWorkWin_Impl
Change-Id: If6cab49904fdb044d85a4fd29f79faa7b52c9959
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/appl/workwin.cxx | 123 | ||||
-rw-r--r-- | sfx2/source/inc/workwin.hxx | 23 | ||||
-rw-r--r-- | sfx2/source/view/frame.cxx | 2 |
3 files changed, 57 insertions, 91 deletions
diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx index 21982e6e6d65..f98235a262b2 100644 --- a/sfx2/source/appl/workwin.cxx +++ b/sfx2/source/appl/workwin.cxx @@ -461,47 +461,9 @@ void SfxWorkWindow::Sort_Impl() // constructor for workwin of a Frame -SfxFrameWorkWin_Impl::SfxFrameWorkWin_Impl( vcl::Window *pWin, SfxFrame *pFrm, SfxFrame* pMaster ) - : SfxWorkWindow( - pWin, - pFrm->GetCurrentViewFrame()->GetBindings(), - pFrm->GetParentFrame() ? pFrm->GetParentFrame()->GetWorkWindow_Impl() : nullptr ) - , pMasterFrame( pMaster ) - , pFrame( pFrm ) -{ - pConfigShell = pFrm->GetCurrentViewFrame(); - if ( pConfigShell && pConfigShell->GetObjectShell() ) - { - bShowStatusBar = ( !pConfigShell->GetObjectShell()->IsInPlaceActive() ); - bDockingAllowed = true; - bInternalDockingAllowed = true; - } - - // The required split windows (one for each side) can be created - for ( sal_uInt16 n=0; n<SFX_SPLITWINDOWS_MAX; n++ ) - { - // The SplitWindows excludes direct ChildWindows of the WorkWindows - // and receives the docked window. - - SfxChildAlignment eAlign = - ( n == SFX_SPLITWINDOWS_LEFT ? SfxChildAlignment::LEFT : - n == SFX_SPLITWINDOWS_RIGHT ? SfxChildAlignment::RIGHT : - n == SFX_SPLITWINDOWS_TOP ? SfxChildAlignment::TOP : - SfxChildAlignment::BOTTOM ); - VclPtr<SfxSplitWindow> pSplitWin = VclPtr<SfxSplitWindow>::Create(pWorkWin, eAlign, this, pParent==nullptr ); - pSplit[n] = pSplitWin; - } - - nOrigMode = SFX_VISIBILITY_STANDARD; - nUpdateMode = SFX_VISIBILITY_STANDARD; -} - - -// Constructor of the base class - -SfxWorkWindow::SfxWorkWindow( vcl::Window *pWin, SfxBindings& rB, SfxWorkWindow* pParentWorkwin ) : - pParent( pParentWorkwin ), - pBindings(&rB), +SfxWorkWindow::SfxWorkWindow( vcl::Window *pWin, SfxFrame *pFrm, SfxFrame* pMaster ) : + pParent( pFrm->GetParentFrame() ? pFrm->GetParentFrame()->GetWorkWindow_Impl() : nullptr ), + pBindings(&pFrm->GetCurrentViewFrame()->GetBindings()), pWorkWin (pWin), pConfigShell( nullptr ), pActiveChild( nullptr ), @@ -523,7 +485,9 @@ SfxWorkWindow::SfxWorkWindow( vcl::Window *pWin, SfxBindings& rB, SfxWorkWindow* m_aStatusBarResName( "private:resource/statusbar/statusbar" ), m_aLayoutManagerPropName( "LayoutManager" ), m_aTbxTypeName( "private:resource/toolbar/" ), - m_aProgressBarResName( "private:resource/progressbar/progressbar" ) + m_aProgressBarResName( "private:resource/progressbar/progressbar" ), + pMasterFrame( pMaster ), + pFrame( pFrm ) { DBG_ASSERT (pBindings, "No Bindings!"); @@ -539,6 +503,32 @@ SfxWorkWindow::SfxWorkWindow( vcl::Window *pWin, SfxBindings& rB, SfxWorkWindow* m_xLayoutManagerListener.set( static_cast< cppu::OWeakObject* >( pLayoutManagerListener ), css::uno::UNO_QUERY ); pLayoutManagerListener->setFrame( xFrame ); + + pConfigShell = pFrm->GetCurrentViewFrame(); + if ( pConfigShell && pConfigShell->GetObjectShell() ) + { + bShowStatusBar = ( !pConfigShell->GetObjectShell()->IsInPlaceActive() ); + bDockingAllowed = true; + bInternalDockingAllowed = true; + } + + // The required split windows (one for each side) can be created + for ( sal_uInt16 n=0; n<SFX_SPLITWINDOWS_MAX; n++ ) + { + // The SplitWindows excludes direct ChildWindows of the WorkWindows + // and receives the docked window. + + SfxChildAlignment eAlign = + ( n == SFX_SPLITWINDOWS_LEFT ? SfxChildAlignment::LEFT : + n == SFX_SPLITWINDOWS_RIGHT ? SfxChildAlignment::RIGHT : + n == SFX_SPLITWINDOWS_TOP ? SfxChildAlignment::TOP : + SfxChildAlignment::BOTTOM ); + VclPtr<SfxSplitWindow> pSplitWin = VclPtr<SfxSplitWindow>::Create(pWorkWin, eAlign, this, pParent==nullptr ); + pSplit[n] = pSplitWin; + } + + nOrigMode = SFX_VISIBILITY_STANDARD; + nUpdateMode = SFX_VISIBILITY_STANDARD; } @@ -669,14 +659,9 @@ void SfxWorkWindow::DeleteControllers_Impl() } -// Virtual method for placing the child window. +// for placing the child window. -void SfxWorkWindow::ArrangeChildren_Impl( bool /*bForce*/) -{ - Arrange_Impl(); -} - -void SfxFrameWorkWin_Impl::ArrangeChildren_Impl( bool bForce ) +void SfxWorkWindow::ArrangeChildren_Impl( bool bForce ) { if ( pFrame->IsClosing_Impl() || ( m_nLock && !bForce )) return; @@ -1079,7 +1064,7 @@ bool SfxWorkWindow::IsVisible_Impl( sal_uInt16 nMode ) const } } -void SfxFrameWorkWin_Impl::UpdateObjectBars_Impl() +void SfxWorkWindow::UpdateObjectBars_Impl() { if ( pFrame->IsClosing_Impl() ) return; @@ -1087,11 +1072,11 @@ void SfxFrameWorkWin_Impl::UpdateObjectBars_Impl() SfxWorkWindow *pWork = pParent; while ( pWork ) { - pWork->SfxWorkWindow::UpdateObjectBars_Impl(); + pWork->UpdateObjectBars_Impl2(); pWork = pWork->GetParent_Impl(); } - SfxWorkWindow::UpdateObjectBars_Impl(); + UpdateObjectBars_Impl2(); { pWork = pParent; @@ -1164,16 +1149,16 @@ css::uno::Reference< css::frame::XFrame > SfxWorkWindow::GetFrameInterface() SfxDispatcher* pDispatcher( GetBindings().GetDispatcher() ); if ( pDispatcher ) { - SfxViewFrame* pFrame = pDispatcher->GetFrame(); - if ( pFrame ) - xFrame = pFrame->GetFrame().GetFrameInterface(); + SfxViewFrame* pViewFrame = pDispatcher->GetFrame(); + if ( pViewFrame ) + xFrame = pViewFrame->GetFrame().GetFrameInterface(); } return xFrame; } -void SfxWorkWindow::UpdateObjectBars_Impl() +void SfxWorkWindow::UpdateObjectBars_Impl2() { // Lock SplitWindows (which means suppressing the Resize-Reaction of the // DockingWindows) @@ -1205,9 +1190,9 @@ void SfxWorkWindow::UpdateObjectBars_Impl() if ( pDispatcher ) { - SfxViewFrame* pFrame = pDispatcher->GetFrame(); - if ( pFrame ) - bPluginMode = IsPluginMode( pFrame->GetObjectShell() ); + SfxViewFrame* pViewFrame = pDispatcher->GetFrame(); + if ( pViewFrame ) + bPluginMode = IsPluginMode( pViewFrame->GetObjectShell() ); } // Iterate over all Toolboxes @@ -2197,21 +2182,11 @@ void SfxWorkWindow::ResetChildWindows_Impl() } } - -// Virtual method that returns the size of the area (client area) of the +// returns the size of the area (client area) of the // parent windows, in which the ChildWindow can be fitted. Rectangle SfxWorkWindow::GetTopRect_Impl() { - return Rectangle (Point(), pWorkWin->GetOutputSizePixel() ); -} - - -// Virtual method that returns the size of the area (client area) of the -// parent windows, in which the ChildWindow can be fitted. - -Rectangle SfxFrameWorkWin_Impl::GetTopRect_Impl() -{ return pMasterFrame->GetTopOuterRectPixel_Impl(); } @@ -2239,18 +2214,18 @@ void SfxWorkWindow::SaveStatus_Impl(SfxChildWindow *pChild, const SfxChildWinInf void SfxWorkWindow::InitializeChild_Impl(SfxChildWin_Impl *pCW) { SfxDispatcher *pDisp = pBindings->GetDispatcher_Impl(); - SfxViewFrame *pFrame = pDisp ? pDisp->GetFrame() :nullptr; - SfxModule *pMod = pFrame ? SfxModule::GetActiveModule(pFrame) :nullptr; + SfxViewFrame *pViewFrame = pDisp ? pDisp->GetFrame() :nullptr; + SfxModule *pMod = pViewFrame ? SfxModule::GetActiveModule(pViewFrame) :nullptr; OUString sModule; - if (pFrame) + if (pViewFrame) { try { using namespace ::com::sun::star; uno::Reference< frame::XModuleManager2 > xModuleManager( frame::ModuleManager::create(::comphelper::getProcessComponentContext())); - sModule = xModuleManager->identify(pFrame->GetFrame().GetFrameInterface()); + sModule = xModuleManager->identify(pViewFrame->GetFrame().GetFrameInterface()); SvtModuleOptions::EFactory eFac = SvtModuleOptions::ClassifyFactoryByServiceName(sModule); sModule = SvtModuleOptions::GetFactoryShortName(eFac); } diff --git a/sfx2/source/inc/workwin.hxx b/sfx2/source/inc/workwin.hxx index 78fe13049ca9..d0fe42d5c8c4 100644 --- a/sfx2/source/inc/workwin.hxx +++ b/sfx2/source/inc/workwin.hxx @@ -222,6 +222,8 @@ protected: OUString m_aTbxTypeName; OUString m_aProgressBarResName; css::uno::Reference< css::lang::XComponent > m_xLayoutManagerListener; + SfxFrame* pMasterFrame; + SfxFrame* pFrame; protected: void CreateChildWin_Impl(SfxChildWin_Impl*,bool); @@ -229,13 +231,13 @@ protected: void Sort_Impl(); SfxChild_Impl* FindChild_Impl( const vcl::Window& rWindow ) const; bool RequestTopToolSpacePixel_Impl( SvBorder aBorder ); - virtual Rectangle GetTopRect_Impl(); + Rectangle GetTopRect_Impl(); SvBorder Arrange_Impl(); void SaveStatus_Impl(SfxChildWindow*, const SfxChildWinInfo&); static bool IsPluginMode( SfxObjectShell* pObjShell ); public: - SfxWorkWindow( vcl::Window *pWin, SfxBindings& rBindings, SfxWorkWindow* pParent = nullptr); + SfxWorkWindow( vcl::Window* pWin, SfxFrame* pFrm, SfxFrame* pMaster ); virtual ~SfxWorkWindow(); SfxBindings& GetBindings() { return *pBindings; } @@ -260,7 +262,7 @@ public: void ShowChildren_Impl(); void HideChildren_Impl(); bool PrepareClose_Impl(); - virtual void ArrangeChildren_Impl( bool bForce = true ); + void ArrangeChildren_Impl( bool bForce = true ); void DeleteControllers_Impl(); void HidePopups_Impl(bool bHide, bool bParent, sal_uInt16 nId=0); void ConfigChild_Impl(SfxChildIdentifier, @@ -272,7 +274,8 @@ public: void SetFullScreen_Impl( bool bSet ) { bIsFullScreen = bSet; } // Methods for Objectbars - virtual void UpdateObjectBars_Impl(); + void UpdateObjectBars_Impl(); + void UpdateObjectBars_Impl2(); void ResetObjectBars_Impl(); void SetObjectBar_Impl(sal_uInt16 nPos, sal_uInt32 nResId, SfxInterface *pIFace); @@ -307,18 +310,6 @@ public: css::uno::Reference< css::frame::XFrame > GetFrameInterface(); }; -class SfxFrameWorkWin_Impl : public SfxWorkWindow -{ - SfxFrame* pMasterFrame; - SfxFrame* pFrame; -public: - SfxFrameWorkWin_Impl( vcl::Window* pWin, SfxFrame* pFrm, SfxFrame* pMaster ); - virtual void ArrangeChildren_Impl( bool bForce = true ) override; - virtual void UpdateObjectBars_Impl() override; - virtual Rectangle GetTopRect_Impl() override; -}; - - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx index ba1e6152fef6..a4617bf3a1b4 100644 --- a/sfx2/source/view/frame.cxx +++ b/sfx2/source/view/frame.cxx @@ -788,7 +788,7 @@ void SfxFrame::CreateWorkWindow_Impl() } } - pImpl->pWorkWin = new SfxFrameWorkWin_Impl( &pFrame->GetWindow(), this, pFrame ); + pImpl->pWorkWin = new SfxWorkWindow( &pFrame->GetWindow(), this, pFrame ); } void SfxFrame::GrabFocusOnComponent_Impl() |