diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2018-11-03 15:10:04 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-11-03 16:00:36 +0100 |
commit | 4284f618557992fdf12574f8fd014be76ec9fffc (patch) | |
tree | fac74828b9a4139d1f74087443c3fcc0b8a1363f /sw/source/filter/ww8/ww8par5.cxx | |
parent | f575cf3320684efe7db9844da89a5ebdb3083498 (diff) |
Simplify containers iterations in sw/source/filter
Use range-based loop or replace with STL functions.
Change-Id: Ifffb7ba08b3a9950ee076558ec4048b0788a38c8
Reviewed-on: https://gerrit.libreoffice.org/62806
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/filter/ww8/ww8par5.cxx')
-rw-r--r-- | sw/source/filter/ww8/ww8par5.cxx | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index 527b9fcba0c5..51f6ca542053 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -2725,21 +2725,18 @@ void SwWW8ImplReader::Read_SubF_Ruby( WW8ReadFieldParams& rReadParam) sal_uInt16 nScript = g_pBreakIt->GetBreakIter()->getScriptType(sRuby, 0); //Check to see if we already have a ruby charstyle that this fits - std::vector<const SwCharFormat*>::const_iterator aEnd = - m_aRubyCharFormats.end(); - for(std::vector<const SwCharFormat*>::const_iterator aIter - = m_aRubyCharFormats.begin(); aIter != aEnd; ++aIter) + for(const auto& rpCharFormat : m_aRubyCharFormats) { const SvxFontHeightItem &rFH = - ItemGet<SvxFontHeightItem>(*(*aIter), + ItemGet<SvxFontHeightItem>(*rpCharFormat, GetWhichOfScript(RES_CHRATR_FONTSIZE,nScript)); if (rFH.GetHeight() == nFontSize*10) { - const SvxFontItem &rF = ItemGet<SvxFontItem>(*(*aIter), + const SvxFontItem &rF = ItemGet<SvxFontItem>(*rpCharFormat, GetWhichOfScript(RES_CHRATR_FONT,nScript)); if (rF.GetFamilyName() == sFontName) { - pCharFormat=*aIter; + pCharFormat = rpCharFormat; break; } } @@ -3244,14 +3241,10 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, OUString& rStr ) } else { - for (SwFormTokens::iterator aItr = aPattern.begin();aItr!= aPattern.end();++aItr) - { - if (aItr->eTokenType == TOKEN_PAGE_NUMS) - { - aPattern.insert(aItr,aLinkStart); - break; - } - } + auto aItr = std::find_if(aPattern.begin(), aPattern.end(), + [](const SwFormToken& rToken) { return rToken.eTokenType == TOKEN_PAGE_NUMS; }); + if (aItr != aPattern.end()) + aPattern.insert(aItr, aLinkStart); } aPattern.push_back(aLinkEnd); aForm.SetPattern(nLevel, aPattern); |