summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2015-05-03 18:50:45 +0200
committerMatteo Casalin <matteo.casalin@yahoo.com>2015-05-03 22:31:59 +0200
commite5d2f06f29e599617e927409382ff32c4cda62ca (patch)
tree55f0a1cf684322782114d38fb198ace5b9cc3ea1 /sw
parent53e3ab398cc24a23993c5ef64871541877c4fb97 (diff)
Use auto and range-based for loops
Change-Id: I8d18fd9fc0296a9ff54c048698e8c10c77277c42
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/fields/reffld.cxx13
1 files changed, 5 insertions, 8 deletions
diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index d2ce47c6d654..94d5521576a1 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -896,10 +896,8 @@ SwTxtNode* SwGetRefFieldType::FindAnchor( SwDoc* pDoc, const OUString& rRefMark,
case REF_FOOTNOTE:
case REF_ENDNOTE:
{
- sal_uInt16 n, nFtnCnt = pDoc->GetFtnIdxs().size();
- SwTxtFtn* pFtnIdx;
- for( n = 0; n < nFtnCnt; ++n )
- if( nSeqNo == (pFtnIdx = pDoc->GetFtnIdxs()[ n ])->GetSeqRefNo() )
+ for( auto pFtnIdx : pDoc->GetFtnIdxs() )
+ if( nSeqNo == pFtnIdx->GetSeqRefNo() )
{
SwNodeIndex* pIdx = pFtnIdx->GetStartNode();
if( pIdx )
@@ -975,7 +973,7 @@ void _RefIdsMap::GetFieldIdsFromDoc( SwDoc& rDoc, std::set<sal_uInt16> &rIds)
/// @param[in,out] rIds The list of IDs found in the document.
void _RefIdsMap::GetNoteIdsFromDoc( SwDoc& rDoc, std::set<sal_uInt16> &rIds)
{
- for( sal_uInt16 n = rDoc.GetFtnIdxs().size(); n; )
+ for( auto n = rDoc.GetFtnIdxs().size(); n; )
rIds.insert( rDoc.GetFtnIdxs()[ --n ]->GetSeqRefNo() );
}
@@ -1021,9 +1019,8 @@ void _RefIdsMap::Init( SwDoc& rDoc, SwDoc& rDestDoc, bool bField )
AddId( GetFirstUnusedId(aIds), *pIt );
// Change the footnotes/endnotes in the source doc to the new ID
- for (sal_uInt16 i = 0, nCnt = rDoc.GetFtnIdxs().size(); i < nCnt; ++i)
+ for ( const auto pFtnIdx : rDoc.GetFtnIdxs() )
{
- SwTxtFtn *const pFtnIdx = rDoc.GetFtnIdxs()[i];
sal_uInt16 const n = pFtnIdx->GetSeqRefNo();
pFtnIdx->SetSeqNo(sequencedIds[n]);
}
@@ -1110,7 +1107,7 @@ void SwGetRefFieldType::MergeWithOtherDoc( SwDoc& rDestDoc )
case REF_SEQUENCEFLD:
{
_RefIdsMap* pMap = 0;
- for( sal_uInt16 n = aFldMap.size(); n; )
+ for( auto n = aFldMap.size(); n; )
{
if( aFldMap[ --n ].GetName()==rRefFld.GetSetRefName() )
{