From 8f459a738040581be87f74cdd29c77050d9f4e49 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 29 May 2018 11:50:52 +0200 Subject: sw_redlinehide: use unwrapping SwIterator when iterating SwTextNode ... or SwContentNode. Change-Id: Ib05038fd5a5550f5ed6dd90e129a2d7c3da74c1e --- sw/source/core/access/accmap.cxx | 4 ++-- sw/source/core/crsr/crstrvl.cxx | 2 +- sw/source/core/doc/doc.cxx | 2 +- sw/source/core/doc/docnum.cxx | 2 +- sw/source/core/docnode/node.cxx | 6 +++--- sw/source/core/draw/dcontact.cxx | 2 +- sw/source/core/fields/docufld.cxx | 5 ++++- sw/source/core/fields/postithelper.cxx | 2 +- sw/source/core/layout/atrfrm.cxx | 12 +++++++----- sw/source/core/layout/ftnfrm.cxx | 4 ++-- sw/source/core/layout/movedfwdfrmsbyobjpos.cxx | 2 +- sw/source/core/layout/softpagebreak.cxx | 2 +- sw/source/core/text/EnhancedPDFExportHelper.cxx | 2 +- sw/source/core/text/itratr.cxx | 4 ++-- sw/source/core/text/porlay.cxx | 2 +- sw/source/core/text/txtdrop.cxx | 2 +- sw/source/core/text/txtfrm.cxx | 2 +- sw/source/core/txtnode/atrftn.cxx | 4 ++-- sw/source/core/txtnode/ndtxt.cxx | 6 +++--- 19 files changed, 36 insertions(+), 31 deletions(-) diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index 43cc0974625e..9ea331e1e2b6 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -1320,7 +1320,7 @@ void SwAccessibleMap::InvalidateShapeInParaSelection() if(nStartIndex.GetNode().IsContentNode()) { SwContentNode* pCNd = static_cast(&(nStartIndex.GetNode())); - pFrame = SwIterator(*pCNd).First(); + pFrame = SwIterator(*pCNd).First(); } else if( nStartIndex.GetNode().IsTableNode() ) { @@ -3324,7 +3324,7 @@ SwAccessibleSelectedParas_Impl* SwAccessibleMap::BuildSelectedParas() if ( pTextNode ) { // loop on all text frames registered at the text node. - SwIterator aIter( *pTextNode ); + SwIterator aIter(*pTextNode); for( SwTextFrame* pTextFrame = aIter.First(); pTextFrame; pTextFrame = aIter.Next() ) { uno::WeakReference < XAccessible > xWeakAcc; diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index ceca48ae5b1c..8cf9b4b5701f 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -1764,7 +1764,7 @@ bool SwContentAtPos::IsInRTLText()const } if(pNd) { - SwIterator aIter(*pNd); + SwIterator aIter(*pNd); SwTextFrame* pTmpFrame = aIter.First(); while( pTmpFrame ) { diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 56a3d053db5c..43eee2ebad05 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -519,7 +519,7 @@ sal_uInt16 PostItField_::GetPageNo( //Probably only once. For the page number we don't select a random one, //but the PostIt's first occurrence in the selected area. rVirtPgNo = 0; - SwIterator aIter( GetTextField()->GetTextNode() ); + SwIterator aIter(GetTextField()->GetTextNode()); for( SwTextFrame* pFrame = aIter.First(); pFrame; pFrame = aIter.Next() ) { TextFrameIndex const nPos = pFrame->MapModelToView( diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index 4c6716d3ad5b..d38e0955d520 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -1112,7 +1112,7 @@ void SwDoc::StopNumRuleAnimations( OutputDevice* pOut ) aTextNodeIter != aTextNodeList.end(); ++aTextNodeIter ) { SwTextNode* pTNd = *aTextNodeIter; - SwIterator aIter(*pTNd); + SwIterator aIter(*pTNd); for(SwTextFrame* pFrame = aIter.First(); pFrame; pFrame = aIter.Next() ) if( pFrame->HasAnimation() ) pFrame->StopAnimation( pOut ); diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index 193fec401c62..7abe6c8b07e9 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -717,7 +717,7 @@ SwFrameFormat* SwNode::GetFlyFormat() const { if( IsContentNode() ) { - SwContentFrame* pFrame = SwIterator( *static_cast(this) ).First(); + SwContentFrame* pFrame = SwIterator(*static_cast(this)).First(); if( pFrame ) pRet = pFrame->FindFlyFrame()->GetFormat(); } @@ -1315,7 +1315,7 @@ void SwContentNode::DelFrames(bool /*removeme*/) if( !HasWriterListeners() ) return; - SwIterator aIter( *this ); + SwIterator aIter(*this); for( SwContentFrame* pFrame = aIter.First(); pFrame; pFrame = aIter.Next() ) { // #i27138# @@ -1391,7 +1391,7 @@ bool SwContentNode::GetInfo( SfxPoolItem& rInfo ) const case RES_CONTENT_VISIBLE: { static_cast(rInfo).pObject = - SwIterator(*this).First(); + SwIterator(*this).First(); } return false; } diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index 67843b7f70ef..749f4eaee868 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -1803,7 +1803,7 @@ void SwDrawContact::ConnectToLayout( const SwFormatAnchor* pAnch ) { SwNodeIndex aIdx( pAnch->GetContentAnchor()->nNode ); SwContentNode* pCNd = pDrawFrameFormat->GetDoc()->GetNodes().GoNext( &aIdx ); - if ( SwIterator( *pCNd ).First() ) + if (SwIterator(*pCNd).First()) pModify = pCNd; else { diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index 5d362a8bb6d0..1a89038adca3 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -152,7 +152,10 @@ void SwPageNumberFieldType::ChangeExpansion( SwDoc* pDoc, const SwContentNode* pNd = dynamic_cast( pDesc->GetDefinedIn() ); if( pNd ) { - if ( SwIterator(*pNd).First() ) + if (SwIterator(*pNd).First()) + // sw_redlinehide: not sure if this should happen only if + // it's the first node, because that's where RES_PAGEDESC + // is effective? m_bVirtual = true; } else if( dynamic_cast< const SwFormat* >(pDesc->GetDefinedIn()) != nullptr) diff --git a/sw/source/core/fields/postithelper.cxx b/sw/source/core/fields/postithelper.cxx index 6261e0ebc609..6858e7e7daf0 100644 --- a/sw/source/core/fields/postithelper.cxx +++ b/sw/source/core/fields/postithelper.cxx @@ -48,7 +48,7 @@ SwPostItHelper::SwLayoutStatus SwPostItHelper::getLayoutInfos( if ( pTextNode == nullptr ) return aRet; - SwIterator aIter( *pTextNode ); + SwIterator aIter(*pTextNode); for( SwTextFrame* pTextFrame = aIter.First(); pTextFrame != nullptr; pTextFrame = aIter.Next() ) { if( !pTextFrame->IsFollow() ) diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index 57012946c9b5..8d9599e84789 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -2941,7 +2941,7 @@ void SwFlyFrameFormat::MakeFrames() } if ( pCNd ) { - if( SwIterator( *pCNd ).First() ) + if (SwIterator(*pCNd).First()) { pModify = pCNd; } @@ -2972,7 +2972,7 @@ void SwFlyFrameFormat::MakeFrames() if( nPgNum == 0 && aAnchorAttr.GetContentAnchor() ) { SwContentNode *pCNd = aAnchorAttr.GetContentAnchor()->nNode.GetNode().GetContentNode(); - SwIterator aIter( *pCNd ); + SwIterator aIter(*pCNd); for ( SwFrame* pFrame = aIter.First(); pFrame != nullptr; pFrame = aIter.Next() ) { pPage = pFrame->FindPageFrame(); @@ -3004,7 +3004,7 @@ void SwFlyFrameFormat::MakeFrames() if( pModify ) { - SwIterator aIter( *pModify ); + SwIterator aIter(*pModify); for( SwFrame *pFrame = aIter.First(); pFrame; pFrame = aIter.Next() ) { bool bAdd = !pFrame->IsContentFrame() || @@ -3278,14 +3278,16 @@ SwHandleAnchorNodeChg::SwHandleAnchorNodeChg( SwFlyFrameFormat& _rFlyFrameFormat { // determine 'old' number of anchor frames sal_uInt32 nOldNumOfAnchFrame( 0 ); - SwIterator aOldIter( *(aOldAnchorFormat.GetContentAnchor()->nNode.GetNode().GetContentNode()) ); + SwIterator aOldIter( + *(aOldAnchorFormat.GetContentAnchor()->nNode.GetNode().GetContentNode()) ); for( SwFrame* pOld = aOldIter.First(); pOld; pOld = aOldIter.Next() ) { ++nOldNumOfAnchFrame; } // determine 'new' number of anchor frames sal_uInt32 nNewNumOfAnchFrame( 0 ); - SwIterator aNewIter( *(_rNewAnchorFormat.GetContentAnchor()->nNode.GetNode().GetContentNode()) ); + SwIterator aNewIter( + *(_rNewAnchorFormat.GetContentAnchor()->nNode.GetNode().GetContentNode()) ); for( SwFrame* pNew = aNewIter.First(); pNew; pNew = aNewIter.Next() ) { ++nNewNumOfAnchFrame; diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx index e8eddce278c1..e34c2603d7bd 100644 --- a/sw/source/core/layout/ftnfrm.cxx +++ b/sw/source/core/layout/ftnfrm.cxx @@ -1104,7 +1104,7 @@ void SwFootnoteBossFrame::ResetFootnote( const SwFootnoteFrame *pCheck ) if ( !pNd ) pNd = pCheck->GetFormat()->GetDoc()-> GetNodes().GoNextSection( &aIdx, true, false ); - SwIterator aIter( *pNd ); + SwIterator aIter(*pNd); SwFrame* pFrame = aIter.First(); while( pFrame ) { @@ -1612,7 +1612,7 @@ SwFootnoteFrame *SwFootnoteBossFrame::FindFootnote( const SwContentFrame *pRef, GetNodes().GoNextSection( &aIdx, true, false ); if ( !pNd ) return nullptr; - SwIterator aIter( *pNd ); + SwIterator aIter(*pNd); SwFrame* pFrame = aIter.First(); if( pFrame ) do diff --git a/sw/source/core/layout/movedfwdfrmsbyobjpos.cxx b/sw/source/core/layout/movedfwdfrmsbyobjpos.cxx index 3f1dbe34e0cf..c57d2f830361 100644 --- a/sw/source/core/layout/movedfwdfrmsbyobjpos.cxx +++ b/sw/source/core/layout/movedfwdfrmsbyobjpos.cxx @@ -76,7 +76,7 @@ bool SwMovedFwdFramesByObjPos::DoesRowContainMovedFwdFrame( const SwRowFrame& _r const NodeMapEntry& rEntry = *aIter; if ( rEntry.second >= nPageNumOfRow ) { - SwIterator aFrameIter( *rEntry.first ); + SwIterator aFrameIter(*rEntry.first); for( SwTextFrame* pTextFrame = aFrameIter.First(); pTextFrame; pTextFrame = aFrameIter.Next() ) { // #115759# - assure that found text frame diff --git a/sw/source/core/layout/softpagebreak.cxx b/sw/source/core/layout/softpagebreak.cxx index 109730e8cfa0..9113ed72c274 100644 --- a/sw/source/core/layout/softpagebreak.cxx +++ b/sw/source/core/layout/softpagebreak.cxx @@ -27,7 +27,7 @@ void SwTextNode::fillSoftPageBreakList( SwSoftPageBreakList& rBreak ) const { - SwIterator aIter( *this ); + SwIterator aIter(*this); for( const SwTextFrame *pFrame = aIter.First(); pFrame; pFrame = aIter.Next() ) { // No soft page break in header or footer diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index f116dd6cfa9e..d171a5fbef80 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -2249,7 +2249,7 @@ void SwEnhancedPDFExportHelper::MakeHeaderFooterLinks( vcl::PDFExtOutDevData& rP // the offset of the link rectangle calculates as follows: const Point aOffset = rLinkRect.Pos() + mrOut.GetMapMode().GetOrigin(); - SwIterator aIter( rTNd ); + SwIterator aIter(rTNd); for ( SwTextFrame* pTmpFrame = aIter.First(); pTmpFrame; pTmpFrame = aIter.Next() ) { // Add offset to current page: diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx index 50fefde0290e..64e8f3518e74 100644 --- a/sw/source/core/text/itratr.cxx +++ b/sw/source/core/text/itratr.cxx @@ -1335,7 +1335,7 @@ sal_uInt16 SwTextNode::GetScalingOfSelectedText( sal_Int32 nStt, sal_Int32 nEnd nWidth = std::max( nWidth, nProWidth ); // search for a text frame this node belongs to - SwIterator aFrameIter( *this ); + SwIterator aFrameIter(*this); SwTextFrame* pFrame = nullptr; for( SwTextFrame* pTmpFrame = aFrameIter.First(); pTmpFrame; pTmpFrame = aFrameIter.Next() ) { @@ -1390,7 +1390,7 @@ SwTwips SwTextNode::GetWidthOfLeadingTabs() const aPos.nContent += nIdx; // Find the non-follow text frame: - SwIterator aIter( *this ); + SwIterator aIter(*this); for( SwTextFrame* pFrame = aIter.First(); pFrame; pFrame = aIter.Next() ) { // Only consider master frames: diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx index 2ed0ed025939..4834ca64739f 100644 --- a/sw/source/core/text/porlay.cxx +++ b/sw/source/core/text/porlay.cxx @@ -2097,7 +2097,7 @@ SwScriptInfo* SwScriptInfo::GetScriptInfo( const SwTextNode& rTNd, SwTextFrame const**const o_ppFrame, bool const bAllowInvalid) { - SwIterator aIter( rTNd ); + SwIterator aIter(rTNd); SwScriptInfo* pScriptInfo = nullptr; for( SwTextFrame* pLast = aIter.First(); pLast; pLast = aIter.Next() ) diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx index 85138e2cd35f..b4a1b88c0a6d 100644 --- a/sw/source/core/text/txtdrop.cxx +++ b/sw/source/core/text/txtdrop.cxx @@ -246,7 +246,7 @@ bool SwTextNode::GetDropSize(int& rFontHeight, int& rDropHeight, int& rDropDesce } // get text frame - SwIterator aIter( *this ); + SwIterator aIter(*this); for( SwTextFrame* pLastFrame = aIter.First(); pLastFrame; pLastFrame = aIter.Next() ) { // Only (master-) text frames can have a drop cap. diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index 3aaa6f8c1f3d..b1d27f0360e2 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -3100,7 +3100,7 @@ SwTwips SwTextFrame::GetBaseVertOffsetForFly(bool bIgnoreFlysAnchoredAtThisFrame */ void SwTextFrame::repaintTextFrames( const SwTextNode& rNode ) { - SwIterator aIter( rNode ); + SwIterator aIter(rNode); for( const SwTextFrame *pFrame = aIter.First(); pFrame; pFrame = aIter.Next() ) { SwRect aRec( pFrame->GetPaintArea() ); diff --git a/sw/source/core/txtnode/atrftn.cxx b/sw/source/core/txtnode/atrftn.cxx index 8cad3a892f58..26f41e0333eb 100644 --- a/sw/source/core/txtnode/atrftn.cxx +++ b/sw/source/core/txtnode/atrftn.cxx @@ -436,7 +436,7 @@ void SwTextFootnote::DelFrames( const SwFrame* pSib ) const SwRootFrame* pRoot = pSib ? pSib->getRootFrame() : nullptr; bool bFrameFnd = false; { - SwIterator aIter( *m_pTextNode ); + SwIterator aIter(*m_pTextNode); for( SwContentFrame* pFnd = aIter.First(); pFnd; pFnd = aIter.Next() ) { if( pRoot != pFnd->getRootFrame() && pRoot ) @@ -457,7 +457,7 @@ void SwTextFootnote::DelFrames( const SwFrame* pSib ) SwContentNode* pCNd = m_pTextNode->GetNodes().GoNext( &aIdx ); if( pCNd ) { - SwIterator aIter( *pCNd ); + SwIterator aIter(*pCNd); for( SwContentFrame* pFnd = aIter.First(); pFnd; pFnd = aIter.Next() ) { if( pRoot != pFnd->getRootFrame() && pRoot ) diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 8ce3056cff02..134b24cf96c5 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -307,7 +307,7 @@ static void lcl_ChangeFootnoteRef( SwTextNode &rNode ) { if( !pFrame ) { - pFrame = SwIterator(rNode).First(); + pFrame = SwIterator(rNode).First(); if (!pFrame) return; } @@ -321,7 +321,7 @@ static void lcl_ChangeFootnoteRef( SwTextNode &rNode ) if ( !pNd ) continue; - SwIterator aIter( *pNd ); + SwIterator aIter(*pNd); SwContentFrame* pContent = aIter.First(); if( pContent ) { @@ -475,7 +475,7 @@ SwContentNode *SwTextNode::SplitContentNode( const SwPosition &rPos ) } - SwIterator aIter( *this ); + SwIterator aIter(*this); for (SwTextFrame* pFrame = aIter.First(); pFrame; pFrame = aIter.Next()) { pFrame->RegisterToNode( *pNode ); -- cgit