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/view/frame.cxx | |
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/view/frame.cxx')
-rw-r--r-- | sfx2/source/view/frame.cxx | 49 |
1 files changed, 3 insertions, 46 deletions
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; } |