diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-11-02 12:03:28 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-11-03 06:30:11 +0000 |
commit | 2b3de550ef1e28cd4231352c91634f67aa6d642f (patch) | |
tree | 6177171ab6f12306f93e66f7b43429dcd81fa9fd /sfx2/source | |
parent | 063593972e556f8f0e65881ccd77d5ea64175e8b (diff) |
remove pParentFrame from SfxFrame
Found by the singlevalfields loplugin.
Dead as least as far back as
commit 93a7b558588be1f12e137329548b706daccc07df
Author: Frank Schoenheit [fs] <frank.schoenheit@sun.com>
Date: Fri Nov 27 21:16:24 2009 +0100
[CWS autorecovery] merged SfxTopFrame into SfxFrame
SfxTopFrame was the only class deriving from the abstract class SfxFrame, so both
can effectively be treated as one class.
Arguably when that commit was done, SfxFrame should also have been renamed
to SfxTopFrame, since that it was it now seems to be.
Expanding the nullptr value off that field means that:
SfxFrame::GetTopFrame
always return this
SfxFrame::IsParent
always returns false
SfxViewFrame::GetTopFrame
is now the same as SfxViewFrame::GetFrame
SfxViewFrame::GetParentViewFrame
now returns null
Change-Id: Iac088fa485c3d7299d1553845ced2f5ced3c85f2
Reviewed-on: https://gerrit.libreoffice.org/30485
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2/source')
-rw-r--r-- | sfx2/source/appl/workwin.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/control/dispatch.cxx | 16 | ||||
-rw-r--r-- | sfx2/source/doc/objserv.cxx | 50 | ||||
-rw-r--r-- | sfx2/source/doc/objxtor.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/view/frame.cxx | 49 | ||||
-rw-r--r-- | sfx2/source/view/frame2.cxx | 1 | ||||
-rw-r--r-- | sfx2/source/view/ipclient.cxx | 12 | ||||
-rw-r--r-- | sfx2/source/view/viewfrm.cxx | 37 |
8 files changed, 21 insertions, 148 deletions
diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx index f98235a262b2..61a688ce6f4e 100644 --- a/sfx2/source/appl/workwin.cxx +++ b/sfx2/source/appl/workwin.cxx @@ -462,7 +462,7 @@ void SfxWorkWindow::Sort_Impl() // constructor for workwin of a Frame SfxWorkWindow::SfxWorkWindow( vcl::Window *pWin, SfxFrame *pFrm, SfxFrame* pMaster ) : - pParent( pFrm->GetParentFrame() ? pFrm->GetParentFrame()->GetWorkWindow_Impl() : nullptr ), + pParent( nullptr ), pBindings(&pFrm->GetCurrentViewFrame()->GetBindings()), pWorkWin (pWin), pConfigShell( nullptr ), diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index 11d950e5b02f..80936ae91a69 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -464,16 +464,7 @@ SfxDispatcher::SfxDispatcher() */ SfxDispatcher::SfxDispatcher(SfxViewFrame *pViewFrame) { - if ( pViewFrame ) - { - SfxViewFrame *pFrame = pViewFrame->GetParentViewFrame(); - if ( pFrame ) - Construct_Impl( pFrame->GetDispatcher() ); - else - Construct_Impl( nullptr ); - } - else - Construct_Impl( nullptr ); + Construct_Impl( nullptr ); xImp->pFrame = pViewFrame; } @@ -1299,8 +1290,7 @@ void SfxDispatcher::Update_Impl( bool bForce ) SetMenu_Impl(); SfxWorkWindow *pWorkWin = xImp->pFrame->GetFrame().GetWorkWindow_Impl(); - SfxWorkWindow *pTaskWin = xImp->pFrame->GetTopFrame().GetWorkWindow_Impl(); - pTaskWin->ResetStatusBar_Impl(); + pWorkWin->ResetStatusBar_Impl(); SfxDispatcher *pDispat = this; while ( pDispat ) @@ -1326,7 +1316,7 @@ void SfxDispatcher::Update_Impl( bool bForce ) pActDispat = pActDispat->xImp->pParent; } - Update_Impl_( bUIActive, !bIsIPActive, bIsIPActive, pTaskWin ); + Update_Impl_( bUIActive, !bIsIPActive, bIsIPActive, pWorkWin ); if ( (bUIActive || bIsActive) && !comphelper::LibreOfficeKit::isActive() ) pWorkWin->UpdateObjectBars_Impl(); diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 1cccb0af6089..4f5b420ee178 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -422,12 +422,6 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) if ( !pFrame ) return; - if ( pFrame->GetFrame().GetParentFrame() ) - { - pFrame->GetTopViewFrame()->GetObjectShell()->ExecuteSlot( rReq ); - return; - } - if ( !IsOwnStorageFormat( *GetMedium() ) ) return; @@ -757,31 +751,13 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) case SID_CLOSEDOC: { SfxViewFrame *pFrame = GetFrame(); - if ( pFrame && pFrame->GetFrame().GetParentFrame() ) - { - // If SID_CLOSEDOC is executed through menu and so on, but - // the current document is in a frame, then the - // FrameSetDocument should actually be closed. - pFrame->GetTopViewFrame()->GetObjectShell()->ExecuteSlot( rReq ); - rReq.Done(); - return; - } bool bInFrameSet = false; sal_uInt16 nFrames=0; pFrame = SfxViewFrame::GetFirst( this ); while ( pFrame ) { - if ( pFrame->GetFrame().GetParentFrame() ) - { - // In this document there still exists a view that is - // in a FrameSet , which of course may not be closed - // geclosed werden - bInFrameSet = true; - } - else - nFrames++; - + nFrames++; pFrame = SfxViewFrame::GetNext( *pFrame, this ); } @@ -791,8 +767,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) pFrame = SfxViewFrame::GetFirst( this ); while ( pFrame ) { - if ( !pFrame->GetFrame().GetParentFrame() ) - pFrame->GetFrame().DoClose(); + pFrame->GetFrame().DoClose(); pFrame = SfxViewFrame::GetNext( *pFrame, this ); } } @@ -985,14 +960,6 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet) SfxViewFrame* pFrame = GetFrame(); if ( !pFrame ) pFrame = SfxViewFrame::GetFirst( this ); - if ( pFrame ) - { - if ( pFrame->GetFrame().GetParentFrame() ) - { - pFrame = pFrame->GetTopViewFrame(); - pDoc = pFrame->GetObjectShell(); - } - } if ( !pFrame || !pDoc->HasName() || !IsOwnStorageFormat( *pDoc->GetMedium() ) ) @@ -1016,18 +983,7 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet) case SID_CLOSEDOC: { - SfxObjectShell *pDoc = this; - SfxViewFrame *pFrame = GetFrame(); - if ( pFrame && pFrame->GetFrame().GetParentFrame() ) - { - - // If SID_CLOSEDOC is executed through menu and so on, but - // the current document is in a frame, then the - // FrameSetDocument should actually be closed. - pDoc = pFrame->GetTopViewFrame()->GetObjectShell(); - } - - if ( pDoc->GetFlags() & SfxObjectShellFlags::DONTCLOSE ) + if ( GetFlags() & SfxObjectShellFlags::DONTCLOSE ) rSet.DisableItem(nWhich); else rSet.Put(SfxStringItem(nWhich, SfxResId(STR_CLOSEDOC).toString())); diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index d6a8a5ac7669..55f256cf2121 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -583,7 +583,7 @@ bool SfxObjectShell::PrepareClose if ( bUI && IsModified() && pFrame ) { // restore minimized - SfxFrame& rTop = pFrame->GetTopFrame(); + SfxFrame& rTop = pFrame->GetFrame(); SfxViewFrame::SetViewFrame( rTop.GetCurrentViewFrame() ); pFrame->GetFrame().Appear(); diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx index fa2376f89cb6..9e80816a2633 100644 --- a/sfx2/source/view/frame.cxx +++ b/sfx2/source/view/frame.cxx @@ -100,12 +100,6 @@ SfxFrame::~SfxFrame() if ( it != pFramesArr_Impl->end() ) pFramesArr_Impl->erase( it ); - if ( pParentFrame ) - { - pParentFrame->RemoveChildFrame_Impl( this ); - pParentFrame = nullptr; - } - delete pImpl->pDescr; if ( pChildArr ) @@ -253,14 +247,6 @@ void SfxFrame::RemoveChildFrame_Impl( SfxFrame* pFrame ) pChildArr->erase( it ); }; -SfxFrame& SfxFrame::GetTopFrame() const -{ - const SfxFrame* pParent = this; - while ( pParent->pParentFrame ) - pParent = pParent->pParentFrame; - return *const_cast< SfxFrame* >( pParent ); -} - bool SfxFrame::IsClosing_Impl() const { return pImpl->bClosing; @@ -315,9 +301,7 @@ SfxViewFrame* SfxFrame::GetCurrentViewFrame() const SfxDispatcher* SfxFrame::GetDispatcher_Impl() const { - if ( pImpl->pCurrentViewFrame ) - return pImpl->pCurrentViewFrame->GetDispatcher(); - return GetParentFrame()->GetDispatcher_Impl(); + return pImpl->pCurrentViewFrame->GetDispatcher(); } bool SfxFrame::IsAutoLoadLocked_Impl() const @@ -410,7 +394,6 @@ void SfxFrame::UpdateDescriptor( SfxObjectShell *pDoc ) assert(pDoc && "NULL-Document inserted ?!"); - GetParentFrame(); const SfxMedium *pMed = pDoc->GetMedium(); GetDescriptor()->SetActualURL( pMed->GetOrigURL() ); @@ -458,7 +441,7 @@ SfxFrameDescriptor* SfxFrame::GetDescriptor() const if ( !pImpl->pDescr ) { - DBG_ASSERT( !GetParentFrame(), "No TopLevel-Frame, but no Descriptor!" ); + DBG_ASSERT( true, "No TopLevel-Frame, but no Descriptor!" ); pImpl->pDescr = new SfxFrameDescriptor; if ( GetCurrentDocument() ) pImpl->pDescr->SetURL( GetCurrentDocument()->GetMedium()->GetOrigURL() ); @@ -478,10 +461,7 @@ void SfxFrame::GetDefaultTargetList(TargetList& rList) void SfxFrame::GetTargetList( TargetList& rList ) const { - if ( !GetParentFrame() ) - { - SfxFrame::GetDefaultTargetList(rList); - } + SfxFrame::GetDefaultTargetList(rList); SfxViewFrame* pView = GetCurrentViewFrame(); if( pView && pView->GetViewShell() && pChildArr ) @@ -495,19 +475,6 @@ void SfxFrame::GetTargetList( TargetList& rList ) const } } -bool SfxFrame::IsParent( SfxFrame *pFrame ) const -{ - SfxFrame *pParent = pParentFrame; - while ( pParent ) - { - if ( pParent == pFrame ) - return true; - pParent = pParent->pParentFrame; - } - - return false; -} - void SfxFrame::InsertTopFrame_Impl( SfxFrame* pFrame ) { SfxFrameArr_Impl& rArr = *SfxGetpApp()->Get_Impl()->pTopFrames; @@ -676,8 +643,6 @@ void SfxFrame::Appear() GetCurrentViewFrame()->Show(); GetWindow().Show(); pImpl->xFrame->getContainerWindow()->setVisible( true ); - if ( pParentFrame ) - pParentFrame->Appear(); Reference < css::awt::XTopWindow > xTopWindow( pImpl->xFrame->getContainerWindow(), UNO_QUERY ); if ( xTopWindow.is() ) xTopWindow->toFront(); @@ -721,12 +686,6 @@ void SfxFrame::SetToolSpaceBorderPixel_Impl( const SvBorder& rBorder ) else aSize.Height() = 0; - if ( GetParentFrame() ) - { - bool bHasTools = rBorder.Left() != rBorder.Right() || rBorder.Top() != rBorder.Bottom(); - pF->GetWindow().SetBorderStyle( bHasTools ? WindowBorderStyle::NORMAL : WindowBorderStyle::NOBORDER ); - } - pF->GetWindow().SetPosSizePixel( aPos, aSize ); } } @@ -742,8 +701,6 @@ SfxWorkWindow* SfxFrame::GetWorkWindow_Impl() const { if ( pImpl->pWorkWin ) return pImpl->pWorkWin; - else if ( pParentFrame ) - return pParentFrame->GetWorkWindow_Impl(); else return nullptr; } diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx index 2672aa511926..6f8e7d43f577 100644 --- a/sfx2/source/view/frame2.cxx +++ b/sfx2/source/view/frame2.cxx @@ -290,7 +290,6 @@ SfxFrame* SfxFrame::Create( const Reference < XFrame >& i_rFrame ) SfxFrame::SfxFrame( vcl::Window& i_rContainerWindow ) :SvCompatWeakBase<SfxFrame>( this ) - ,pParentFrame( nullptr ) ,pChildArr( nullptr ) ,pWindow( nullptr ) { diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx index bc98810fe4c1..3b080e8b7856 100644 --- a/sfx2/source/view/ipclient.cxx +++ b/sfx2/source/view/ipclient.cxx @@ -929,7 +929,7 @@ ErrCode SfxInPlaceClient::DoVerb( long nVerb ) if ( !nError ) { - m_pViewSh->GetViewFrame()->GetTopFrame().LockResize_Impl(true); + m_pViewSh->GetViewFrame()->GetFrame().LockResize_Impl(true); try { m_pImp->m_xObject->setClientSite( m_pImp->m_xClient ); @@ -982,8 +982,8 @@ ErrCode SfxInPlaceClient::DoVerb( long nVerb ) } SfxViewFrame* pFrame = m_pViewSh->GetViewFrame(); - pFrame->GetTopFrame().LockResize_Impl(false); - pFrame->GetTopFrame().Resize(); + pFrame->GetFrame().LockResize_Impl(false); + pFrame->GetFrame().Resize(); } } } @@ -1041,7 +1041,7 @@ void SfxInPlaceClient::DeactivateObject() } } - m_pViewSh->GetViewFrame()->GetTopFrame().LockResize_Impl(true); + m_pViewSh->GetViewFrame()->GetFrame().LockResize_Impl(true); if ( (m_pImp->m_xObject->getStatus( m_pImp->m_nAspect ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) || svt::EmbeddedObjectRef::IsGLChart(m_pImp->m_xObject) ) @@ -1062,8 +1062,8 @@ void SfxInPlaceClient::DeactivateObject() SfxViewFrame* pFrame = m_pViewSh->GetViewFrame(); SfxViewFrame::SetViewFrame( pFrame ); - pFrame->GetTopFrame().LockResize_Impl(false); - pFrame->GetTopFrame().Resize(); + pFrame->GetFrame().LockResize_Impl(false); + pFrame->GetFrame().Resize(); } catch (css::uno::Exception& ) {} diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 2d698dbaa76b..5ce84bed4e76 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -204,7 +204,6 @@ static bool AskPasswordToModify_Impl( const uno::Reference< task::XInteractionHa void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) { - SfxFrame *pParent = GetFrame().GetParentFrame(); if ( rReq.GetSlot() == SID_RELOAD ) { // When CTRL-Reload, reload the active Frame @@ -222,18 +221,6 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) } } } - else - { - // When CTRL-Edit, edit the TopFrame. - sal_uInt16 nModifier = rReq.GetModifier(); - - if ( ( nModifier & KEY_MOD1 ) && pParent ) - { - SfxViewFrame *pTop = GetTopViewFrame(); - pTop->ExecReload_Impl( rReq ); - return; - } - } SfxObjectShell* pSh = GetObjectShell(); switch ( rReq.GetSlot() ) @@ -1510,7 +1497,7 @@ void SfxViewFrame::Enable( bool bEnable ) { m_pImpl->bEnabled = bEnable; - vcl::Window *pWindow = &GetFrame().GetTopFrame().GetWindow(); + vcl::Window *pWindow = &GetFrame().GetWindow(); if ( !bEnable ) m_pImpl->bWindowWasEnabled = pWindow->IsInputEnabled(); if ( !bEnable || m_pImpl->bWindowWasEnabled ) @@ -1595,12 +1582,6 @@ void SfxViewFrame::MakeActive_Impl( bool bGrabFocus ) { bPreview = true; } - else - { - SfxViewFrame* pParent = GetParentViewFrame(); - if ( pParent ) - pParent->SetActiveChildFrame_Impl( this ); - } css::uno::Reference< css::frame::XFrame > xFrame = GetFrame().GetFrameInterface(); if ( !bPreview ) @@ -2218,16 +2199,6 @@ void SfxViewFrame::ToTop() /* [Description] - The ParentViewFrame is the ViewFrame of the ParentFrames. -*/ -SfxViewFrame* SfxViewFrame::GetParentViewFrame() const -{ - SfxFrame *pFrame = GetFrame().GetParentFrame(); - return pFrame ? pFrame->GetCurrentViewFrame() : nullptr; -} - -/* [Description] - GetFrame returns the Frame, in which the ViewFrame is located. */ SfxFrame& SfxViewFrame::GetFrame() const @@ -2237,7 +2208,7 @@ SfxFrame& SfxViewFrame::GetFrame() const SfxViewFrame* SfxViewFrame::GetTopViewFrame() const { - return GetFrame().GetTopFrame().GetCurrentViewFrame(); + return GetFrame().GetCurrentViewFrame(); } vcl::Window& SfxViewFrame::GetWindow() const @@ -2843,7 +2814,7 @@ void SfxViewFrame::ChildWindowExecute( SfxRequest &rReq ) { if (!SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::EModule::DATABASE)) return; - Reference < XFrame > xFrame = GetFrame().GetTopFrame().GetFrameInterface(); + Reference < XFrame > xFrame = GetFrame().GetFrameInterface(); Reference < XFrame > xBeamer( xFrame->findFrame( "_beamer", FrameSearchFlag::CHILDREN ) ); bool bHasChild = xBeamer.is(); bool bShow = pShowItem ? pShowItem->GetValue() : !bHasChild; @@ -2950,7 +2921,7 @@ void SfxViewFrame::ChildWindowState( SfxItemSet& rState ) } else if ( nSID == SID_BROWSER ) { - Reference < XFrame > xFrame = GetFrame().GetTopFrame().GetFrameInterface()-> + Reference < XFrame > xFrame = GetFrame().GetFrameInterface()-> findFrame( "_beamer", FrameSearchFlag::CHILDREN ); if ( !xFrame.is() ) rState.DisableItem( nSID ); |