summaryrefslogtreecommitdiff
path: root/editeng/source/uno
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2018-03-10 18:00:58 +0100
committerJulien Nabet <serval2412@yahoo.fr>2018-03-11 00:14:56 +0100
commite9171066136868fe89947dda5095e9479d5e50e7 (patch)
treeeda06f3196145b6f3e66c178425ce86735721a24 /editeng/source/uno
parentadc6ba2ad502f095dde8f36242fda9aaa6c276fd (diff)
Use for-range loops in editeng
Change-Id: I6abf56aba1211e1288bd8ee673e0614d1b5dc1d6 Reviewed-on: https://gerrit.libreoffice.org/51050 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'editeng/source/uno')
-rw-r--r--editeng/source/uno/UnoForbiddenCharsTable.cxx5
-rw-r--r--editeng/source/uno/unoedhlp.cxx12
-rw-r--r--editeng/source/uno/unofored.cxx24
-rw-r--r--editeng/source/uno/unotext.cxx7
-rw-r--r--editeng/source/uno/unotext2.cxx12
5 files changed, 30 insertions, 30 deletions
diff --git a/editeng/source/uno/UnoForbiddenCharsTable.cxx b/editeng/source/uno/UnoForbiddenCharsTable.cxx
index 35e0bed8b494..bdc938c690eb 100644
--- a/editeng/source/uno/UnoForbiddenCharsTable.cxx
+++ b/editeng/source/uno/UnoForbiddenCharsTable.cxx
@@ -111,10 +111,9 @@ Sequence< lang::Locale > SAL_CALL SvxUnoForbiddenCharsTable::getLocales()
{
lang::Locale* pLocales = aLocales.getArray();
- for( SvxForbiddenCharactersTable::Map::iterator it = mxForbiddenChars->GetMap().begin();
- it != mxForbiddenChars->GetMap().end(); ++it )
+ for (auto const& elem : mxForbiddenChars->GetMap())
{
- const LanguageType nLanguage = it->first;
+ const LanguageType nLanguage = elem.first;
*pLocales++ = LanguageTag( nLanguage ).getLocale();
}
}
diff --git a/editeng/source/uno/unoedhlp.cxx b/editeng/source/uno/unoedhlp.cxx
index 3c86fddc35dc..e5ca87a63056 100644
--- a/editeng/source/uno/unoedhlp.cxx
+++ b/editeng/source/uno/unoedhlp.cxx
@@ -128,16 +128,16 @@ bool SvxEditSourceHelper::GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nE
// find closest index in front of nIndex
sal_Int32 nCurrIndex;
sal_Int32 nClosestStartIndex_s = 0, nClosestStartIndex_e = 0;
- for(std::vector<EECharAttrib>::iterator i = aCharAttribs.begin(); i < aCharAttribs.end(); ++i)
+ for (auto const& charAttrib : aCharAttribs)
{
- nCurrIndex = i->nStart;
+ nCurrIndex = charAttrib.nStart;
if( nCurrIndex > nClosestStartIndex_s &&
nCurrIndex <= nIndex)
{
nClosestStartIndex_s = nCurrIndex;
}
- nCurrIndex = i->nEnd;
+ nCurrIndex = charAttrib.nEnd;
if ( nCurrIndex > nClosestStartIndex_e &&
nCurrIndex < nIndex )
{
@@ -149,16 +149,16 @@ bool SvxEditSourceHelper::GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nE
// find closest index behind of nIndex
sal_Int32 nClosestEndIndex_s, nClosestEndIndex_e;
nClosestEndIndex_s = nClosestEndIndex_e = rEE.GetTextLen(nPara);
- for(std::vector<EECharAttrib>::iterator i = aCharAttribs.begin(); i < aCharAttribs.end(); ++i)
+ for (auto const& charAttrib : aCharAttribs)
{
- nCurrIndex = i->nEnd;
+ nCurrIndex = charAttrib.nEnd;
if( nCurrIndex > nIndex &&
nCurrIndex < nClosestEndIndex_e )
{
nClosestEndIndex_e = nCurrIndex;
}
- nCurrIndex = i->nStart;
+ nCurrIndex = charAttrib.nStart;
if ( nCurrIndex > nIndex &&
nCurrIndex < nClosestEndIndex_s)
{
diff --git a/editeng/source/uno/unofored.cxx b/editeng/source/uno/unofored.cxx
index 450fadcce02b..406c0d7a13d6 100644
--- a/editeng/source/uno/unofored.cxx
+++ b/editeng/source/uno/unofored.cxx
@@ -193,39 +193,39 @@ SfxItemState GetSvxEditEngineItemState( EditEngine const & rEditEngine, const ES
const SfxPoolItem* pParaItem = nullptr;
- for(std::vector<EECharAttrib>::const_iterator i = aAttribs.begin(); i < aAttribs.end(); ++i)
+ for (auto const& attrib : aAttribs)
{
- DBG_ASSERT(i->pAttr, "GetCharAttribs gives corrupt data");
+ DBG_ASSERT(attrib.pAttr, "GetCharAttribs gives corrupt data");
- const bool bEmptyPortion = i->nStart == i->nEnd;
- if((!bEmptyPortion && i->nStart >= nEndPos) ||
- (bEmptyPortion && i->nStart > nEndPos))
+ const bool bEmptyPortion = attrib.nStart == attrib.nEnd;
+ if((!bEmptyPortion && attrib.nStart >= nEndPos) ||
+ (bEmptyPortion && attrib.nStart > nEndPos))
break; // break if we are already behind our selection
- if((!bEmptyPortion && i->nEnd <= nPos) ||
- (bEmptyPortion && i->nEnd < nPos))
+ if((!bEmptyPortion && attrib.nEnd <= nPos) ||
+ (bEmptyPortion && attrib.nEnd < nPos))
continue; // or if the attribute ends before our selection
- if(i->pAttr->Which() != nWhich)
+ if(attrib.pAttr->Which() != nWhich)
continue; // skip if is not the searched item
// if we already found an item
if( pParaItem )
{
// ... and its different to this one than the state is don't care
- if(*pParaItem != *(i->pAttr))
+ if(*pParaItem != *(attrib.pAttr))
return SfxItemState::DONTCARE;
}
else
- pParaItem = i->pAttr;
+ pParaItem = attrib.pAttr;
if( bEmpty )
bEmpty = false;
- if(!bGaps && i->nStart > nLastEnd)
+ if(!bGaps && attrib.nStart > nLastEnd)
bGaps = true;
- nLastEnd = i->nEnd;
+ nLastEnd = attrib.nEnd;
}
if( !bEmpty && !bGaps && nLastEnd < ( nEndPos - 1 ) )
diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index 93dbfd6c0aef..5ccacadf0637 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -1277,12 +1277,9 @@ void SAL_CALL SvxUnoTextRangeBase::setAllPropertiesToDefault()
if( pForwarder )
{
- PropertyEntryVector_t aEntries = mpPropSet->getPropertyMap().getPropertyEntries();
- PropertyEntryVector_t::const_iterator aIt = aEntries.begin();
- while( aIt != aEntries.end() )
+ for (auto & entry : mpPropSet->getPropertyMap().getPropertyEntries())
{
- _setPropertyToDefault( pForwarder, &(*aIt), -1 );
- ++aIt;
+ _setPropertyToDefault( pForwarder, &entry, -1 );
}
}
}
diff --git a/editeng/source/uno/unotext2.cxx b/editeng/source/uno/unotext2.cxx
index 5adb8f73d3ae..41c5c4e73f2c 100644
--- a/editeng/source/uno/unotext2.cxx
+++ b/editeng/source/uno/unotext2.cxx
@@ -60,9 +60,11 @@ SvxUnoTextContentEnumeration::SvxUnoTextContentEnumeration( const SvxUnoTextBase
if( currentPara == maSelection.nEndPara )
nEndPos = std::min(nEndPos, maSelection.nEndPos);
ESelection aCurrentParaSel = ESelection( currentPara, nStartPos, currentPara, nEndPos );
- for( auto aIter = rRanges.begin(); (aIter != rRanges.end()) && (pContent == nullptr); ++aIter )
+ for (auto const& elemRange : rRanges)
{
- SvxUnoTextContent* pIterContent = dynamic_cast< SvxUnoTextContent* >( ( *aIter ) );
+ if (!pContent)
+ break;
+ SvxUnoTextContent* pIterContent = dynamic_cast< SvxUnoTextContent* >( elemRange );
if( pIterContent && (pIterContent->mnParagraph == currentPara) )
{
ESelection aIterSel = pIterContent->GetSelection();
@@ -405,9 +407,11 @@ SvxUnoTextRangeEnumeration::SvxUnoTextRangeEnumeration(const SvxUnoTextBase& rTe
const SvxUnoTextRangeBaseList& rRanges( mpEditSource->getRanges() );
SvxUnoTextRange* pRange = nullptr;
- for( auto aIter = rRanges.begin(); (aIter != rRanges.end()) && (pRange == nullptr); ++aIter )
+ for (auto const& elemRange : rRanges)
{
- SvxUnoTextRange* pIterRange = dynamic_cast< SvxUnoTextRange* >( ( *aIter ) );
+ if (!pRange)
+ break;
+ SvxUnoTextRange* pIterRange = dynamic_cast< SvxUnoTextRange* >( elemRange );
if( pIterRange && pIterRange->mbPortion && (aSel == pIterRange->maSelection) )
pRange = pIterRange;
}