summaryrefslogtreecommitdiff
path: root/editeng/source/editeng/impedit4.cxx
diff options
context:
space:
mode:
authorArkadiy Illarionov <qarkai@gmail.com>2019-02-20 01:10:07 +0300
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-02-20 07:17:38 +0100
commit6a143985bdc5d12d1f9e8cf8592440282986c099 (patch)
tree346e09d6ba1146b52a6a484a2883f3e898184648 /editeng/source/editeng/impedit4.cxx
parentd707a5e64ba53ddb7669cca725915527aa788a6b (diff)
Simplify containers iterations in desktop, dtrans, editeng, extensions
Use range-based loop or replace with STL functions Change-Id: Ic5389d123d0a6a32a8bb46b081165e94a7c55292 Reviewed-on: https://gerrit.libreoffice.org/68036 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'editeng/source/editeng/impedit4.cxx')
-rw-r--r--editeng/source/editeng/impedit4.cxx19
1 files changed, 7 insertions, 12 deletions
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index bf235228a05d..2ac00ef7481c 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -652,9 +652,8 @@ ErrCode ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel )
rOutput.WriteCharPtr( "}}" ); // 1xparentheses paragraphs, 1xparentheses RTF document
rOutput.Flush();
- std::vector<SvxFontItem*>::iterator it;
- for (it = aFontTable.begin(); it != aFontTable.end(); ++it)
- delete *it;
+ for (auto& pItem : aFontTable)
+ delete pItem;
return rOutput.GetError();
}
@@ -2122,8 +2121,6 @@ void ImpEditEngine::ApplyChangedSentence(EditView const & rEditView,
aSet.Put(SvxLanguageItem(aCurrentNewPortion->eLanguage, nLangWhichId));
SetAttribs( *aCurrentOldPosition, aSet );
}
- if(aCurrentNewPortion == rNewPortions.begin())
- break;
}
while(aCurrentNewPortion != rNewPortions.begin());
}
@@ -2139,15 +2136,14 @@ void ImpEditEngine::ApplyChangedSentence(EditView const & rEditView,
//delete the sentence completely
ImpDeleteSelection( aAllSentence );
- svx::SpellPortions::const_iterator aCurrentNewPortion = rNewPortions.begin();
EditPaM aCurrentPaM = aAllSentence.Min();
- while(aCurrentNewPortion != rNewPortions.end())
+ for(const auto& rCurrentNewPortion : rNewPortions)
{
//set the language attribute
LanguageType eCurLanguage = GetLanguage( aCurrentPaM );
- if(eCurLanguage != aCurrentNewPortion->eLanguage)
+ if(eCurLanguage != rCurrentNewPortion.eLanguage)
{
- SvtScriptType nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( aCurrentNewPortion->eLanguage );
+ SvtScriptType nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( rCurrentNewPortion.eLanguage );
sal_uInt16 nLangWhichId = EE_CHAR_LANGUAGE;
switch(nScriptType)
{
@@ -2156,12 +2152,11 @@ void ImpEditEngine::ApplyChangedSentence(EditView const & rEditView,
default: break;
}
SfxItemSet aSet( aEditDoc.GetItemPool(), {{nLangWhichId, nLangWhichId}});
- aSet.Put(SvxLanguageItem(aCurrentNewPortion->eLanguage, nLangWhichId));
+ aSet.Put(SvxLanguageItem(rCurrentNewPortion.eLanguage, nLangWhichId));
SetAttribs( aCurrentPaM, aSet );
}
//insert the new string and set the cursor to the end of the inserted string
- aCurrentPaM = ImpInsertText( aCurrentPaM , aCurrentNewPortion->sText );
- ++aCurrentNewPortion;
+ aCurrentPaM = ImpInsertText( aCurrentPaM , rCurrentNewPortion.sText );
}
}
UndoActionEnd();