summaryrefslogtreecommitdiff
path: root/sw/source/core/undo
diff options
context:
space:
mode:
authorArkadiy Illarionov <qarkai@gmail.com>2018-11-05 14:57:19 +0300
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-11-07 08:13:49 +0100
commitdb601f697acff89e216228f2d5828b1563e58aa0 (patch)
tree109c256e249cc270480c7130807699c51d8b75cf /sw/source/core/undo
parent9476ecb71b1acc66506a768a5fe0c123afd46b93 (diff)
Simplify containers iterations in sw/source/core/[t-v]*
Use range-based loop or replace with STL functions Change-Id: Ib4a0da0c452dbfa00a1d7ec79f9570e41eda0d41 Reviewed-on: https://gerrit.libreoffice.org/62893 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/core/undo')
-rw-r--r--sw/source/core/undo/SwRewriter.cxx4
-rw-r--r--sw/source/core/undo/unnum.cxx6
-rw-r--r--sw/source/core/undo/unsort.cxx8
-rw-r--r--sw/source/core/undo/untbl.cxx10
4 files changed, 13 insertions, 15 deletions
diff --git a/sw/source/core/undo/SwRewriter.cxx b/sw/source/core/undo/SwRewriter.cxx
index cd63f3e551a8..22105f0a2aa8 100644
--- a/sw/source/core/undo/SwRewriter.cxx
+++ b/sw/source/core/undo/SwRewriter.cxx
@@ -46,9 +46,9 @@ OUString SwRewriter::Apply(const OUString & rStr) const
{
OUString aResult = rStr;
- for (std::vector<SwRewriteRule>::const_iterator aIt = mRules.begin(); aIt != mRules.end(); ++aIt)
+ for (const auto& rRule : mRules)
{
- aResult = aResult.replaceAll(GetPlaceHolder(aIt->first), aIt->second);
+ aResult = aResult.replaceAll(GetPlaceHolder(rRule.first), rRule.second);
}
return aResult;
diff --git a/sw/source/core/undo/unnum.cxx b/sw/source/core/undo/unnum.cxx
index 309c37803c98..480c9008f0bf 100644
--- a/sw/source/core/undo/unnum.cxx
+++ b/sw/source/core/undo/unnum.cxx
@@ -172,11 +172,11 @@ void SwUndoDelNum::UndoImpl(::sw::UndoRedoContext & rContext)
pHistory->TmpRollback( &rDoc, 0 );
pHistory->SetTmpEnd( pHistory->Count() );
- for( std::vector<NodeLevel>::const_iterator i = aNodes.begin(); i != aNodes.end(); ++i )
+ for( const auto& rNode : aNodes )
{
- SwTextNode* pNd = rDoc.GetNodes()[ i->index ]->GetTextNode();
+ SwTextNode* pNd = rDoc.GetNodes()[ rNode.index ]->GetTextNode();
OSL_ENSURE( pNd, "Where has the TextNode gone?" );
- pNd->SetAttrListLevel( i->level );
+ pNd->SetAttrListLevel( rNode.level );
if( pNd->GetCondFormatColl() )
pNd->ChkCondColl();
diff --git a/sw/source/core/undo/unsort.cxx b/sw/source/core/undo/unsort.cxx
index e3c640c3eca2..ac354d889be4 100644
--- a/sw/source/core/undo/unsort.cxx
+++ b/sw/source/core/undo/unsort.cxx
@@ -145,8 +145,8 @@ void SwUndoSort::UndoImpl(::sw::UndoRedoContext & rContext)
SwMoveFlags::DEFAULT);
}
// delete indices
- for(SwUndoSortList::const_iterator it = aIdxList.begin(); it != aIdxList.end(); ++it)
- delete *it;
+ for(auto& rpIdx : aIdxList)
+ delete rpIdx;
aIdxList.clear();
SetPaM(rPam, true);
}
@@ -220,8 +220,8 @@ void SwUndoSort::RedoImpl(::sw::UndoRedoContext & rContext)
SwMoveFlags::DEFAULT);
}
// delete indices
- for(SwUndoSortList::const_iterator it = aIdxList.begin(); it != aIdxList.end(); ++it)
- delete *it;
+ for(auto& rpIdx : aIdxList)
+ delete rpIdx;
aIdxList.clear();
SetPaM(rPam, true);
SwTextNode const*const pTNd = rPam.GetNode().GetTextNode();
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index aa4ff1cfdcf4..d1d349ae9615 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -1811,10 +1811,9 @@ void SwUndoTableNdsChg::RedoImpl(::sw::UndoRedoContext & rContext)
CHECK_TABLE( pTableNd->GetTable() )
SwSelBoxes aSelBoxes;
- for (std::set<sal_uLong>::iterator it = m_Boxes.begin();
- it != m_Boxes.end(); ++it)
+ for (const auto& rBox : m_Boxes)
{
- SwTableBox* pBox = pTableNd->GetTable().GetTableBox( *it );
+ SwTableBox* pBox = pTableNd->GetTable().GetTableBox( rBox );
aSelBoxes.insert( pBox );
}
@@ -1962,10 +1961,9 @@ CHECKTABLE(pTableNd->GetTable())
SwSelBoxes aSelBoxes;
SwTextFormatColl* pColl = rDoc.getIDocumentStylePoolAccess().GetTextCollFromPool( RES_POOLCOLL_STANDARD );
- std::set<sal_uLong>::iterator it;
- for (it = m_Boxes.begin(); it != m_Boxes.end(); ++it)
+ for (const auto& rBox : m_Boxes)
{
- aIdx = *it;
+ aIdx = rBox;
SwStartNode* pSttNd = rDoc.GetNodes().MakeTextSection( aIdx,
SwTableBoxStartNode, pColl );
pBox = new SwTableBox( static_cast<SwTableBoxFormat*>(pCpyBox->GetFrameFormat()), *pSttNd,