From a0ec43251e8b8a0805306ca5ad86794550916fce Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 30 Jul 2020 10:35:22 +0200 Subject: loplugin:flatten in sw/core/layout Change-Id: I67fd1a269d960174b88c57da4a0588f5d9252660 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99885 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sw/source/core/layout/ssfrm.cxx | 180 ++++++++++++++++++++-------------------- 1 file changed, 90 insertions(+), 90 deletions(-) (limited to 'sw/source/core/layout/ssfrm.cxx') diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx index 1a92144a5583..76a56ed65508 100644 --- a/sw/source/core/layout/ssfrm.cxx +++ b/sw/source/core/layout/ssfrm.cxx @@ -195,90 +195,90 @@ void SwFrame::CheckDirChange() mbInvalidR2L = true; bool bChg = bOldR2L != IsRightToLeft(); bool bOldVertL2R = IsVertLR(); - if( ( IsVertical() != bOldVert ) || bChg || bOldVertL2R != IsVertLR() ) + if( !(( IsVertical() != bOldVert ) || bChg || bOldVertL2R != IsVertLR()) ) + return; + + InvalidateAll(); + if( IsLayoutFrame() ) { - InvalidateAll(); - if( IsLayoutFrame() ) + // set minimum row height for vertical cells in horizontal table: + if ( IsCellFrame() && GetUpper() ) { - // set minimum row height for vertical cells in horizontal table: - if ( IsCellFrame() && GetUpper() ) + if ( IsVertical() != GetUpper()->IsVertical() && + static_cast(this)->GetTabBox()->getRowSpan() == 1 ) { - if ( IsVertical() != GetUpper()->IsVertical() && - static_cast(this)->GetTabBox()->getRowSpan() == 1 ) - { - enum { - MIN_VERT_CELL_HEIGHT = 1135 - }; - - SwTableLine* pLine = const_cast(static_cast(this)->GetTabBox()->GetUpper()); - SwFrameFormat* pFrameFormat = pLine->GetFrameFormat(); - SwFormatFrameSize aNew( pFrameFormat->GetFrameSize() ); - if ( SwFrameSize::Fixed != aNew.GetHeightSizeType() ) - aNew.SetHeightSizeType( SwFrameSize::Minimum ); - if ( aNew.GetHeight() < MIN_VERT_CELL_HEIGHT ) - aNew.SetHeight( MIN_VERT_CELL_HEIGHT ); - SwDoc* pDoc = pFrameFormat->GetDoc(); - pDoc->SetAttr( aNew, *pLine->ClaimFrameFormat() ); - } + enum { + MIN_VERT_CELL_HEIGHT = 1135 + }; + + SwTableLine* pLine = const_cast(static_cast(this)->GetTabBox()->GetUpper()); + SwFrameFormat* pFrameFormat = pLine->GetFrameFormat(); + SwFormatFrameSize aNew( pFrameFormat->GetFrameSize() ); + if ( SwFrameSize::Fixed != aNew.GetHeightSizeType() ) + aNew.SetHeightSizeType( SwFrameSize::Minimum ); + if ( aNew.GetHeight() < MIN_VERT_CELL_HEIGHT ) + aNew.SetHeight( MIN_VERT_CELL_HEIGHT ); + SwDoc* pDoc = pFrameFormat->GetDoc(); + pDoc->SetAttr( aNew, *pLine->ClaimFrameFormat() ); } + } - SwFrame* pFrame = static_cast(this)->Lower(); - const SwFormatCol* pCol = nullptr; - SwLayoutFrame* pBody = nullptr; - if( pFrame ) + SwFrame* pFrame = static_cast(this)->Lower(); + const SwFormatCol* pCol = nullptr; + SwLayoutFrame* pBody = nullptr; + if( pFrame ) + { + if( IsPageFrame() ) { - if( IsPageFrame() ) - { - // If we're a page frame and we change our layout direction, - // we have to look for columns and rearrange them. - pBody = static_cast(this)->FindBodyCont(); - if(pBody && pBody->Lower() && pBody->Lower()->IsColumnFrame()) - pCol = &static_cast(this)->GetFormat()->GetCol(); - } - else if( pFrame->IsColumnFrame() ) - { - pBody = static_cast(this); - const SwFrameFormat *pFormat = pBody->GetFormat(); - if( pFormat ) - pCol = &pFormat->GetCol(); - } + // If we're a page frame and we change our layout direction, + // we have to look for columns and rearrange them. + pBody = static_cast(this)->FindBodyCont(); + if(pBody && pBody->Lower() && pBody->Lower()->IsColumnFrame()) + pCol = &static_cast(this)->GetFormat()->GetCol(); } - while( pFrame ) + else if( pFrame->IsColumnFrame() ) { - pFrame->CheckDirChange(); - pFrame = pFrame->GetNext(); + pBody = static_cast(this); + const SwFrameFormat *pFormat = pBody->GetFormat(); + if( pFormat ) + pCol = &pFormat->GetCol(); } - if( pCol ) - pBody->AdjustColumns( pCol, true ); } - else if( IsTextFrame() ) - static_cast(this)->Prepare(); + while( pFrame ) + { + pFrame->CheckDirChange(); + pFrame = pFrame->GetNext(); + } + if( pCol ) + pBody->AdjustColumns( pCol, true ); + } + else if( IsTextFrame() ) + static_cast(this)->Prepare(); + + // #i31698# - notify anchored objects also for page frames. + // Remove code above for special handling of page frames + if ( !GetDrawObjs() ) + return; - // #i31698# - notify anchored objects also for page frames. - // Remove code above for special handling of page frames - if ( GetDrawObjs() ) + const SwSortedObjs *pObjs = GetDrawObjs(); + const size_t nCnt = pObjs->size(); + for ( size_t i = 0; i < nCnt; ++i ) + { + SwAnchoredObject* pAnchoredObj = (*pObjs)[i]; + if( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) != nullptr ) + static_cast(pAnchoredObj)->CheckDirChange(); + else { - const SwSortedObjs *pObjs = GetDrawObjs(); - const size_t nCnt = pObjs->size(); - for ( size_t i = 0; i < nCnt; ++i ) - { - SwAnchoredObject* pAnchoredObj = (*pObjs)[i]; - if( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) != nullptr ) - static_cast(pAnchoredObj)->CheckDirChange(); - else - { - // OD 2004-04-06 #i26791# - direct object - // positioning no longer needed. Instead - // invalidate - pAnchoredObj->InvalidateObjPos(); - } - // #i31698# - update layout direction of - // anchored object - { - ::setContextWritingMode( pAnchoredObj->DrawObj(), pAnchoredObj->GetAnchorFrameContainingAnchPos() ); - pAnchoredObj->UpdateLayoutDir(); - } - } + // OD 2004-04-06 #i26791# - direct object + // positioning no longer needed. Instead + // invalidate + pAnchoredObj->InvalidateObjPos(); + } + // #i31698# - update layout direction of + // anchored object + { + ::setContextWritingMode( pAnchoredObj->DrawObj(), pAnchoredObj->GetAnchorFrameContainingAnchPos() ); + pAnchoredObj->UpdateLayoutDir(); } } } @@ -343,30 +343,30 @@ void SwFrame::DestroyImpl() } } - if (m_pDrawObjs) + if (!m_pDrawObjs) + return; + + for (size_t i = m_pDrawObjs->size(); i; ) { - for (size_t i = m_pDrawObjs->size(); i; ) + SwAnchoredObject* pAnchoredObj = (*m_pDrawObjs)[--i]; + if ( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) != nullptr ) { - SwAnchoredObject* pAnchoredObj = (*m_pDrawObjs)[--i]; - if ( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) != nullptr ) - { - SwFrame::DestroyFrame(static_cast(pAnchoredObj)); - } - else + SwFrame::DestroyFrame(static_cast(pAnchoredObj)); + } + else + { + SdrObject* pSdrObj = pAnchoredObj->DrawObj(); + SwDrawContact* pContact = + static_cast(pSdrObj->GetUserCall()); + OSL_ENSURE( pContact, + " - missing contact for drawing object" ); + if ( pContact ) { - SdrObject* pSdrObj = pAnchoredObj->DrawObj(); - SwDrawContact* pContact = - static_cast(pSdrObj->GetUserCall()); - OSL_ENSURE( pContact, - " - missing contact for drawing object" ); - if ( pContact ) - { - pContact->DisconnectObjFromLayout( pSdrObj ); - } + pContact->DisconnectObjFromLayout( pSdrObj ); } } - m_pDrawObjs.reset(); } + m_pDrawObjs.reset(); } SwFrame::~SwFrame() -- cgit v1.2.3