summaryrefslogtreecommitdiff
path: root/editeng/source/misc
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/misc
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/misc')
-rw-r--r--editeng/source/misc/SvXMLAutoCorrectExport.cxx9
-rw-r--r--editeng/source/misc/splwrap.cxx8
-rw-r--r--editeng/source/misc/svxacorr.cxx24
-rw-r--r--editeng/source/misc/txtrange.cxx6
4 files changed, 21 insertions, 26 deletions
diff --git a/editeng/source/misc/SvXMLAutoCorrectExport.cxx b/editeng/source/misc/SvXMLAutoCorrectExport.cxx
index 81047abc3475..5c41f5f63b46 100644
--- a/editeng/source/misc/SvXMLAutoCorrectExport.cxx
+++ b/editeng/source/misc/SvXMLAutoCorrectExport.cxx
@@ -51,17 +51,14 @@ ErrCode SvXMLAutoCorrectExport::exportDoc(enum XMLTokenEnum /*eClass*/)
{
SvXMLElementExport aRoot (*this, XML_NAMESPACE_BLOCKLIST, XML_BLOCK_LIST, true, true);
SvxAutocorrWordList::Content aContent = pAutocorr_List->getSortedContent();
- for( SvxAutocorrWordList::Content::iterator it = aContent.begin();
- it != aContent.end(); ++it )
+ for (auto const& content : aContent)
{
- const SvxAutocorrWord* p = *it;
-
AddAttribute( XML_NAMESPACE_BLOCKLIST,
XML_ABBREVIATED_NAME,
- p->GetShort());
+ content->GetShort());
AddAttribute( XML_NAMESPACE_BLOCKLIST,
XML_NAME,
- p->IsTextOnly() ? p->GetLong() : p->GetShort());
+ content->IsTextOnly() ? content->GetLong() : content->GetShort());
SvXMLElementExport aBlock( *this, XML_NAMESPACE_BLOCKLIST, XML_BLOCK, true, true);
}
diff --git a/editeng/source/misc/splwrap.cxx b/editeng/source/misc/splwrap.cxx
index bf883bf72500..d31752d15cc7 100644
--- a/editeng/source/misc/splwrap.cxx
+++ b/editeng/source/misc/splwrap.cxx
@@ -92,11 +92,10 @@ void SvxSpellWrapper::ShowLanguageErrors()
// display message boxes for languages not available for
// spellchecking or hyphenation
LangCheckState_map_t &rLCS = GetLangCheckState();
- LangCheckState_map_t::iterator aIt( rLCS.begin() );
- while (aIt != rLCS.end())
+ for (auto const& elem : rLCS)
{
- LanguageType nLang = aIt->first;
- sal_uInt16 nVal = aIt->second;
+ LanguageType nLang = elem.first;
+ sal_uInt16 nVal = elem.second;
sal_uInt16 nTmpSpell = nVal & 0x00FF;
sal_uInt16 nTmpHyph = (nVal >> 8) & 0x00FF;
@@ -116,7 +115,6 @@ void SvxSpellWrapper::ShowLanguageErrors()
}
rLCS[ nLang ] = (nTmpHyph << 8) | nTmpSpell;
- ++aIt;
}
}
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 302c941b06b7..9ba2b3152618 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -2621,12 +2621,12 @@ struct SvxAutocorrWordList::Impl
void DeleteAndDestroyAll()
{
- for (AutocorrWordHashType::const_iterator it = maHash.begin(); it != maHash.end(); ++it)
- delete it->second;
+ for (auto const& elem : maHash)
+ delete elem.second;
maHash.clear();
- for (AutocorrWordSetType::const_iterator it2 = maSet.begin(); it2 != maSet.end(); ++it2)
- delete *it2;
+ for (auto const& elem : maSet)
+ delete elem;
maSet.clear();
}
};
@@ -2701,12 +2701,12 @@ SvxAutocorrWordList::Content SvxAutocorrWordList::getSortedContent() const
if ( mpImpl->maSet.empty() )
{
// This beast has some O(N log(N)) in a terribly slow ICU collate fn.
- for (AutocorrWordHashType::const_iterator it = mpImpl->maHash.begin(); it != mpImpl->maHash.end(); ++it)
- mpImpl->maSet.insert( it->second );
+ for (auto const& elem : mpImpl->maHash)
+ mpImpl->maSet.insert( elem.second );
mpImpl->maHash.clear();
}
- for (AutocorrWordSetType::const_iterator it = mpImpl->maSet.begin(); it != mpImpl->maSet.end(); ++it)
- aContent.push_back( *it );
+ for (auto const& elem : mpImpl->maSet)
+ aContent.push_back(elem);
return aContent;
}
@@ -2837,15 +2837,15 @@ const SvxAutocorrWord* SvxAutocorrWordList::WordMatches(const SvxAutocorrWord *p
const SvxAutocorrWord* SvxAutocorrWordList::SearchWordsInList(const OUString& rTxt, sal_Int32& rStt,
sal_Int32 nEndPos) const
{
- for (AutocorrWordHashType::const_iterator it = mpImpl->maHash.begin(); it != mpImpl->maHash.end(); ++it)
+ for (auto const& elem : mpImpl->maHash)
{
- if( const SvxAutocorrWord *aTmp = WordMatches( it->second, rTxt, rStt, nEndPos ) )
+ if( const SvxAutocorrWord *aTmp = WordMatches( elem.second, rTxt, rStt, nEndPos ) )
return aTmp;
}
- for (AutocorrWordSetType::const_iterator it2 = mpImpl->maSet.begin(); it2 != mpImpl->maSet.end(); ++it2)
+ for (auto const& elem : mpImpl->maSet)
{
- if( const SvxAutocorrWord *aTmp = WordMatches( *it2, rTxt, rStt, nEndPos ) )
+ if( const SvxAutocorrWord *aTmp = WordMatches( elem, rTxt, rStt, nEndPos ) )
return aTmp;
}
return nullptr;
diff --git a/editeng/source/misc/txtrange.cxx b/editeng/source/misc/txtrange.cxx
index 312d642f3d95..299e568fe404 100644
--- a/editeng/source/misc/txtrange.cxx
+++ b/editeng/source/misc/txtrange.cxx
@@ -633,10 +633,10 @@ LongDqPtr TextRanger::GetTextRanges( const Range& rRange )
{
DBG_ASSERT( rRange.Min() || rRange.Max(), "Zero-Range not allowed, Bye Bye" );
//Can we find the result we need in the cache?
- for (std::deque<RangeCache>::iterator it = mRangeCache.begin(); it != mRangeCache.end(); ++it)
+ for (auto & elem : mRangeCache)
{
- if (it->range == rRange)
- return &(it->results);
+ if (elem.range == rRange)
+ return &(elem.results);
}
//Calculate a new result
RangeCache rngCache(rRange);