diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-03-14 18:34:28 +0100 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-03-16 13:24:07 +0100 |
commit | 0d97d25d56a5a8466d698e0f5831f2072c8e8baf (patch) | |
tree | 9fc8a433f22f588248e931d22ea5f70286d48d8a /sw | |
parent | 5111ad57871ed2473337fbf2cc351bf1b18a756f (diff) |
use SwIterator for typed iteration
Change-Id: Icc1a04304e182687a306e9d08cbf7d46b0adbee6
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/doc/doc.cxx | 48 |
1 files changed, 18 insertions, 30 deletions
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 2af2a44a89d3..5a659daf69ef 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1434,45 +1434,33 @@ bool SwDoc::RemoveInvisibleContent() bool SwDoc::HasInvisibleContent() const { - bool bRet = false; - - SwClientIter aIter( *getIDocumentFieldsAccess().GetSysFldType( RES_HIDDENPARAFLD ) ); - if( aIter.First( TYPE( SwFmtFld ) ) ) - bRet = true; + if(SwIterator<SwFmtFld,SwFieldType>(*getIDocumentFieldsAccess().GetSysFldType( RES_HIDDENPARAFLD)).First()) + return true; // Search for any hidden paragraph (hidden text attribute) - if( ! bRet ) + for( sal_uLong n = GetNodes().Count()-1; n; --n) { - for( sal_uLong n = GetNodes().Count(); !bRet && (n > 0); ) + SwTxtNode* pTxtNd = GetNodes()[ n ]->GetTxtNode(); + if ( pTxtNd ) { - SwTxtNode* pTxtNd = GetNodes()[ --n ]->GetTxtNode(); - if ( pTxtNd ) - { - SwPaM aPam(*pTxtNd, 0, *pTxtNd, pTxtNd->GetTxt().getLength()); - if( pTxtNd->HasHiddenCharAttribute( true ) || ( pTxtNd->HasHiddenCharAttribute( false ) ) ) - { - bRet = true; - } - } + SwPaM aPam(*pTxtNd, 0, *pTxtNd, pTxtNd->GetTxt().getLength()); + if( pTxtNd->HasHiddenCharAttribute( true ) || ( pTxtNd->HasHiddenCharAttribute( false ) ) ) + return true; } } - if( ! bRet ) + const SwSectionFmts& rSectFmts = GetSections(); + for( SwSectionFmts::size_type n = rSectFmts.size()-1; n; --n ) { - const SwSectionFmts& rSectFmts = GetSections(); - - for( SwSectionFmts::size_type n = rSectFmts.size(); !bRet && (n > 0); ) - { - SwSectionFmt* pSectFmt = rSectFmts[ --n ]; - // don't add sections in Undo/Redo - if( !pSectFmt->IsInNodesArr()) - continue; - SwSection* pSect = pSectFmt->GetSection(); - if( pSect->IsHidden() ) - bRet = true; - } + SwSectionFmt* pSectFmt = rSectFmts[ n ]; + // don't add sections in Undo/Redo + if( !pSectFmt->IsInNodesArr()) + continue; + SwSection* pSect = pSectFmt->GetSection(); + if( pSect->IsHidden() ) + return true; } - return bRet; + return false; } bool SwDoc::RestoreInvisibleContent() |