diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2014-07-24 00:15:46 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2014-07-24 14:18:24 +0200 |
commit | 61cfe89eedf22834d9567d3f6a8c1df9c61b22ea (patch) | |
tree | c77bcc205406472c2798d156de605ea2c3b9ecff /sw | |
parent | 607390eff8e122ea8618eb65171ecd8d44cba978 (diff) |
remove superfluous scope
Change-Id: I7174fdafe6750d45ed8f537825dc1dfa637f1a53
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/doc/docbm.cxx | 126 |
1 files changed, 62 insertions, 64 deletions
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx index 3a568744c49c..4cd5c595767b 100644 --- a/sw/source/core/doc/docbm.cxx +++ b/sw/source/core/doc/docbm.cxx @@ -1677,80 +1677,37 @@ void CntntIdxStoreImpl::SaveFlys(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt, { // Paragraph anchored objects MarkEntry aSave; + SwCntntNode *pNode = pDoc->GetNodes()[nNode]->GetCntntNode(); + if( pNode ) { - SwCntntNode *pNode = pDoc->GetNodes()[nNode]->GetCntntNode(); - if( pNode ) - { - SwFrm* pFrm = pNode->getLayoutFrm( pDoc->GetCurrentLayout() ); + SwFrm* pFrm = pNode->getLayoutFrm( pDoc->GetCurrentLayout() ); #if OSL_DEBUG_LEVEL > 1 - static bool bViaDoc = false; - if( bViaDoc ) - pFrm = NULL; + static bool bViaDoc = false; + if( bViaDoc ) + pFrm = NULL; #endif - if( pFrm ) // Do we have a layout? Then it's a bit cheaper ... - { - if( pFrm->GetDrawObjs() ) - { - const SwSortedObjs& rDObj = *pFrm->GetDrawObjs(); - for( sal_uInt32 n = rDObj.Count(); n; ) - { - SwAnchoredObject* pObj = rDObj[ --n ]; - const SwFrmFmt& rFmt = pObj->GetFrmFmt(); - const SwFmtAnchor& rAnchor = rFmt.GetAnchor(); - SwPosition const*const pAPos = rAnchor.GetCntntAnchor(); - if ( pAPos && - ( ( nSaveFly && - FLY_AT_PARA == rAnchor.GetAnchorId() ) || - ( FLY_AT_CHAR == rAnchor.GetAnchorId() ) ) ) - { - aSave.m_bOther = false; - aSave.m_nCntnt = pAPos->nContent.GetIndex(); - - OSL_ENSURE( nNode == pAPos->nNode.GetIndex(), - "_SaveCntntIdx: Wrong Node-Index" ); - if ( FLY_AT_CHAR == rAnchor.GetAnchorId() ) - { - if( nCntnt <= aSave.m_nCntnt ) - { - if( SAVEFLY_SPLIT == nSaveFly ) - aSave.m_bOther = true; - else - continue; - } - } - aSave.m_nIdx = pDoc->GetSpzFrmFmts()->size(); - while( aSave.m_nIdx && - &rFmt != (*pDoc->GetSpzFrmFmts())[ - --aSave.m_nIdx ] ) - ; // nothing - OSL_ENSURE( &rFmt == (*pDoc->GetSpzFrmFmts())[ - aSave.m_nIdx ], - "_SaveCntntIdx: Lost FrameFormat" ); - m_aFlyEntries.push_back(aSave); - } - } - } - } - else // No layout, so it's a bit more expensive ... + if( pFrm ) // Do we have a layout? Then it's a bit cheaper ... + { + if( pFrm->GetDrawObjs() ) { - for( aSave.m_nIdx = pDoc->GetSpzFrmFmts()->size(); - aSave.m_nIdx ; ) + const SwSortedObjs& rDObj = *pFrm->GetDrawObjs(); + for( sal_uInt32 n = rDObj.Count(); n; ) { - SwFrmFmt* pFrmFmt = (*pDoc->GetSpzFrmFmts())[ - --aSave.m_nIdx ]; - if ( RES_FLYFRMFMT != pFrmFmt->Which() && - RES_DRAWFRMFMT != pFrmFmt->Which() ) - continue; - - const SwFmtAnchor& rAnchor = pFrmFmt->GetAnchor(); + SwAnchoredObject* pObj = rDObj[ --n ]; + const SwFrmFmt& rFmt = pObj->GetFrmFmt(); + const SwFmtAnchor& rAnchor = rFmt.GetAnchor(); SwPosition const*const pAPos = rAnchor.GetCntntAnchor(); - if ( pAPos && ( nNode == pAPos->nNode.GetIndex() ) && - ( FLY_AT_PARA == rAnchor.GetAnchorId() || - FLY_AT_CHAR == rAnchor.GetAnchorId() ) ) + if ( pAPos && + ( ( nSaveFly && + FLY_AT_PARA == rAnchor.GetAnchorId() ) || + ( FLY_AT_CHAR == rAnchor.GetAnchorId() ) ) ) { aSave.m_bOther = false; aSave.m_nCntnt = pAPos->nContent.GetIndex(); + + OSL_ENSURE( nNode == pAPos->nNode.GetIndex(), + "_SaveCntntIdx: Wrong Node-Index" ); if ( FLY_AT_CHAR == rAnchor.GetAnchorId() ) { if( nCntnt <= aSave.m_nCntnt ) @@ -1761,11 +1718,52 @@ void CntntIdxStoreImpl::SaveFlys(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt, continue; } } + aSave.m_nIdx = pDoc->GetSpzFrmFmts()->size(); + while( aSave.m_nIdx && + &rFmt != (*pDoc->GetSpzFrmFmts())[ + --aSave.m_nIdx ] ) + ; // nothing + OSL_ENSURE( &rFmt == (*pDoc->GetSpzFrmFmts())[ + aSave.m_nIdx ], + "_SaveCntntIdx: Lost FrameFormat" ); m_aFlyEntries.push_back(aSave); } } } } + else // No layout, so it's a bit more expensive ... + { + for( aSave.m_nIdx = pDoc->GetSpzFrmFmts()->size(); + aSave.m_nIdx ; ) + { + SwFrmFmt* pFrmFmt = (*pDoc->GetSpzFrmFmts())[ + --aSave.m_nIdx ]; + if ( RES_FLYFRMFMT != pFrmFmt->Which() && + RES_DRAWFRMFMT != pFrmFmt->Which() ) + continue; + + const SwFmtAnchor& rAnchor = pFrmFmt->GetAnchor(); + SwPosition const*const pAPos = rAnchor.GetCntntAnchor(); + if ( pAPos && ( nNode == pAPos->nNode.GetIndex() ) && + ( FLY_AT_PARA == rAnchor.GetAnchorId() || + FLY_AT_CHAR == rAnchor.GetAnchorId() ) ) + { + aSave.m_bOther = false; + aSave.m_nCntnt = pAPos->nContent.GetIndex(); + if ( FLY_AT_CHAR == rAnchor.GetAnchorId() ) + { + if( nCntnt <= aSave.m_nCntnt ) + { + if( SAVEFLY_SPLIT == nSaveFly ) + aSave.m_bOther = true; + else + continue; + } + } + m_aFlyEntries.push_back(aSave); + } + } + } } } |