basctl/source/basicide/basides1.cxx                           |    6 
 cli_ure/source/climaker/climaker_emit.cxx                     |    7 
 configmgr/source/modifications.cxx                            |    6 
 connectivity/source/drivers/postgresql/pq_tools.cxx           |    7 
 extensions/source/ole/unoobjw.cxx                             |   12 
 reportdesign/source/filter/xml/xmlExport.cxx                  |    6 
 sal/osl/w32/procimpl.cxx                                      |    7 
 sal/qa/osl/process/osl_process.cxx                            |   30 -
 sc/source/core/data/documen2.cxx                              |    4 
 sc/source/core/tool/rangelst.cxx                              |   49 -
 sc/source/filter/ftools/fapihelper.cxx                        |    8 
 sc/source/filter/oox/formulaparser.cxx                        |    7 
 sc/source/filter/oox/pivotcachebuffer.cxx                     |    8 
 sc/source/ui/miscdlgs/conflictsdlg.cxx                        |  107 +---
 scripting/source/provider/BrowseNodeFactoryImpl.cxx           |    7 
 scripting/source/stringresource/stringresource.cxx            |   59 --
 sd/source/ui/animations/CustomAnimationDialog.cxx             |   12 
 sd/source/ui/dlg/RemoteDialogClientBox.cxx                    |    6 
 sd/source/ui/sidebar/MasterPageObserver.cxx                   |    8 
 sd/source/ui/view/ToolBarManager.cxx                          |   24 
 shell/source/tools/lngconvex/lngconvex.cxx                    |    7 
 shell/source/unix/sysshell/recently_used_file_handler.cxx     |    7 
 stoc/source/javavm/javavm.cxx                                 |    3 
 stoc/source/uriproc/UriReferenceFactory.cxx                   |   14 
 svx/source/dialog/framelinkarray.cxx                          |    8 
 sw/source/filter/ww8/writerhelper.cxx                         |    7 
 sw/source/filter/ww8/wrtw8esh.cxx                             |   21 
 sw/source/filter/ww8/wrtw8nds.cxx                             |    7 
 sw/source/filter/ww8/wrtw8sty.cxx                             |    5 
 sw/source/filter/ww8/ww8atr.cxx                               |   21 
 sw/source/filter/ww8/ww8graf2.cxx                             |   12 
 sw/source/filter/ww8/ww8par5.cxx                              |    9 
 sw/source/ui/index/cnttab.cxx                                 |   23 
 sw/source/ui/misc/glosbib.cxx                                 |   57 --
 vcl/source/edit/textdoc.cxx                                   |   12 
 vcl/source/window/splitwin.cxx                                |  267 ++++------
 xmloff/source/text/txtimp.cxx                                 |    6 
 xmlsecurity/source/dialogs/resourcemanager.cxx                |   12 
 xmlsecurity/source/helper/documentsignaturehelper.cxx         |   14 
 xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx |   22 
 40 files changed, 380 insertions(+), 534 deletions(-)

New commits:
commit 0787ce8814e37972a0c968f60008d4e8722b6e27
Author:     Arkadiy Illarionov <qar...@gmail.com>
AuthorDate: Wed Aug 15 21:32:27 2018 +0300
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Aug 20 17:12:11 2018 +0200

    Simplify containers iterations, tdf#96099 follow-up
    
    Use range-based loop or replace with std::any_of, std::find and
    std::find_if where applicable.
    
    Change-Id: I2f80788c49d56094c29b102eb96a7a7c079567c6
    Reviewed-on: https://gerrit.libreoffice.org/59143
    Tested-by: Jenkins
    Reviewed-by: Michael Meeks <michael.me...@collabora.com>
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/basctl/source/basicide/basides1.cxx 
b/basctl/source/basicide/basides1.cxx
index f3ee0773e6d1..9cef7bdd41ec 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -154,10 +154,8 @@ void Shell::ExecuteSearch( SfxRequest& rReq )
                 {
                     // search other modules...
                     bool bChangeCurWindow = false;
-                    auto it = aWindowTable.cbegin();
-                    for ( ; it != aWindowTable.cend(); ++it)
-                        if (it->second == pCurWin)
-                            break;
+                    auto it = std::find_if(aWindowTable.cbegin(), 
aWindowTable.cend(),
+                                           [this](const 
WindowTable::value_type& item) { return item.second == pCurWin; });
                     if (it != aWindowTable.cend())
                         ++it;
                     BaseWindow* pWin = it != aWindowTable.cend() ? 
it->second.get() : nullptr;
diff --git a/cli_ure/source/climaker/climaker_emit.cxx 
b/cli_ure/source/climaker/climaker_emit.cxx
index bfd0b88a05f7..24eb3e455754 100644
--- a/cli_ure/source/climaker/climaker_emit.cxx
+++ b/cli_ure/source/climaker/climaker_emit.cxx
@@ -723,8 +723,11 @@ Assembly ^ TypeEmitter::type_resolve(
                   gcnew array< ::System::Type^>( vecBaseTypes.size() );
 
             int index = 0;
-            for (auto i = vecBaseTypes.begin(); i != vecBaseTypes.end(); ++i, 
++index)
-                base_interfaces[ index ] = get_type( *i );
+            for (auto const & vecBaseType : vecBaseTypes)
+            {
+                base_interfaces[ index ] = get_type( vecBaseType );
+                ++index;
+            }
             type_builder = m_module_builder->DefineType(
                 cts_name, attr, nullptr, base_interfaces );
         }
diff --git a/configmgr/source/modifications.cxx 
b/configmgr/source/modifications.cxx
index f385fc3215bc..d84904c3f14e 100644
--- a/configmgr/source/modifications.cxx
+++ b/configmgr/source/modifications.cxx
@@ -34,13 +34,13 @@ Modifications::~Modifications() {}
 void Modifications::add(std::vector<OUString> const & path) {
     Node * p = &root_;
     bool wasPresent = false;
-    for (auto i(path.begin()); i != path.end(); ++i) {
-        Node::Children::iterator j(p->children.find(*i));
+    for (auto const& pathItem : path) {
+        Node::Children::iterator j(p->children.find(pathItem));
         if (j == p->children.end()) {
             if (wasPresent && p->children.empty()) {
                 return;
             }
-            j = p->children.emplace(*i, Node()).first;
+            j = p->children.emplace(pathItem, Node()).first;
             wasPresent = false;
         } else {
             wasPresent = true;
diff --git a/connectivity/source/drivers/postgresql/pq_tools.cxx 
b/connectivity/source/drivers/postgresql/pq_tools.cxx
index a3730f7ed462..ca1211eaa438 100644
--- a/connectivity/source/drivers/postgresql/pq_tools.cxx
+++ b/connectivity/source/drivers/postgresql/pq_tools.cxx
@@ -1108,9 +1108,12 @@ void extractNameValuePairsFromInsert( String2StringMap & 
map, const OString & la
             {
                 n +=2;
 //                 printf( "3\n" );
-                for (std::vector< OString >::size_type i = 0 ; i < 
names.size() && nSize > n ; i ++ )
+                for (auto& name : names)
                 {
-                    map[names[i]] = vec[n];
+                    if (n >= nSize)
+                        break;
+
+                    map[name] = vec[n];
                     if( nSize > n+1 && vec[n+1].equalsIgnoreAsciiCase(",") )
                     {
                         n ++;
diff --git a/extensions/source/ole/unoobjw.cxx 
b/extensions/source/ole/unoobjw.cxx
index f45b9b5b0000..40c97ddac4f6 100644
--- a/extensions/source/ole/unoobjw.cxx
+++ b/extensions/source/ole/unoobjw.cxx
@@ -1440,14 +1440,10 @@ bool  InterfaceOleWrapper::getInvocationInfoForCall( 
DISPID id, InvocationInfo&
         // there's only one entry in the map.
         OUString sMemberName;
 
-        for(auto ci1= m_nameToDispIdMap.cbegin(); ci1 != 
m_nameToDispIdMap.cend(); ++ci1)
-        {
-            if( (*ci1).second == id) // iterator is a pair< OUString, DISPID>
-            {
-                sMemberName= (*ci1).first;
-                break;
-            }
-        }
+        auto ci1 = std::find_if(m_nameToDispIdMap.cbegin(), 
m_nameToDispIdMap.cend(),
+            [&id](const NameToIdMap::value_type& nameToDispId) { return 
nameToDispId.second == id; }); // item is a pair<OUString, DISPID>
+        if (ci1 != m_nameToDispIdMap.cend())
+            sMemberName= (*ci1).first;
         // Get information for the current call ( property or method).
         // There could be similar names which only differ in the cases
         // of letters. First we assume that the name which was passed into
diff --git a/reportdesign/source/filter/xml/xmlExport.cxx 
b/reportdesign/source/filter/xml/xmlExport.cxx
index 6e11dc0d32e5..19bbceca007e 100644
--- a/reportdesign/source/filter/xml/xmlExport.cxx
+++ b/reportdesign/source/filter/xml/xmlExport.cxx
@@ -737,11 +737,9 @@ void ORptExport::exportTableColumns(const Reference< 
XSection>& _xSection)
     if ( aColFind == m_aColumnStyleNames.end() )
         return;
 
-    auto aColIter = aColFind->second.cbegin();
-    auto aColEnd = aColFind->second.cend();
-    for (; aColIter != aColEnd; ++aColIter)
+    for (auto& aCol : aColFind->second)
     {
-        AddAttribute( m_sTableStyle,*aColIter );
+        AddAttribute(m_sTableStyle, aCol);
         SvXMLElementExport aColumn(*this,XML_NAMESPACE_TABLE, 
XML_TABLE_COLUMN, true, true);
     }
 }
diff --git a/sal/osl/w32/procimpl.cxx b/sal/osl/w32/procimpl.cxx
index af3a967ac2a7..b65a942cb9d4 100644
--- a/sal/osl/w32/procimpl.cxx
+++ b/sal/osl/w32/procimpl.cxx
@@ -168,14 +168,9 @@ namespace /* private */
         // a final '\0'
         environment.resize(calc_sum_of_string_lengths(merged_env) + 1);
 
-        auto iter = merged_env.cbegin();
-        auto iter_end = merged_env.cend();
-
         sal_uInt32 pos = 0;
-        for (/**/; iter != iter_end; ++iter)
+        for (auto& envv : merged_env)
         {
-            rtl::OUString envv = *iter;
-
             OSL_ASSERT(envv.getLength());
 
             sal_uInt32 n = envv.getLength() + 1; // copy the final '\0', too
diff --git a/sal/qa/osl/process/osl_process.cxx 
b/sal/qa/osl/process/osl_process.cxx
index 317682238e49..08b39e1e8357 100644
--- a/sal/qa/osl/process/osl_process.cxx
+++ b/sal/qa/osl/process/osl_process.cxx
@@ -92,10 +92,8 @@ public:
 
     explicit exclude(const std::vector<OString>& exclude_list)
     {
-        auto iter     = exclude_list.cbegin();
-        auto iter_end = exclude_list.cend();
-        for (/**/; iter != iter_end; ++iter)
-            exclude_list_.push_back(env_var_name(*iter));
+        for (auto& exclude_list_item : exclude_list)
+            exclude_list_.push_back(env_var_name(exclude_list_item));
     }
 
     bool operator() (const OString& env_var) const
@@ -259,8 +257,8 @@ public:
         std::vector<OString> parent_env;
         read_parent_environment(&parent_env);
 
-        for (auto iter = parent_env.cbegin(), end = parent_env.cend(); iter != 
end; ++iter)
-            std::cout << "initially parent env: " << *iter << "\n";
+        for (auto& env : parent_env)
+            std::cout << "initially parent env: " << env << "\n";
 
         //remove the environment variables that we have changed
         //in the child environment from the read parent environment
@@ -268,16 +266,16 @@ public:
             std::remove_if(parent_env.begin(), parent_env.end(), 
exclude(different_env_vars)),
             parent_env.end());
 
-        for (auto iter = parent_env.cbegin(), end = parent_env.cend(); iter != 
end; ++iter)
-            std::cout << "stripped parent env: " << *iter << "\n";
+        for (auto& env : parent_env)
+            std::cout << "stripped parent env: " << env << "\n";
 
         //read the child environment and exclude the variables that
         //are different
         std::vector<OString> child_env;
         read_child_environment(&child_env);
 
-        for (auto iter = child_env.cbegin(), end = child_env.cend(); iter != 
end; ++iter)
-            std::cout << "initial child env: " << *iter << "\n";
+        for (auto& env : child_env)
+            std::cout << "initial child env: " << env << "\n";
         //partition the child environment into the variables that
         //are different to the parent environment (they come first)
         //and the variables that should be equal between parent
@@ -288,17 +286,17 @@ public:
         std::vector<OString> different_child_env_vars(child_env.begin(), 
iter_logical_end);
         child_env.erase(child_env.begin(), iter_logical_end);
 
-        for (auto iter = child_env.cbegin(), end = child_env.cend(); iter != 
end; ++iter)
-            std::cout << "stripped child env: " << *iter << "\n";
+        for (auto& env : child_env)
+            std::cout << "stripped child env: " << env << "\n";
 
         bool common_env_size_equals    = (parent_env.size() == 
child_env.size());
         bool common_env_content_equals = std::equal(child_env.begin(), 
child_env.end(), parent_env.begin());
 
-        for (auto iter = different_env_vars.cbegin(), end = 
different_env_vars.cend(); iter != end; ++iter)
-            std::cout << "different should be: " << *iter << "\n";
+        for (auto& env_var : different_env_vars)
+            std::cout << "different should be: " << env_var << "\n";
 
-        for (auto iter = different_child_env_vars.cbegin(), end = 
different_child_env_vars.cend(); iter != end; ++iter)
-            std::cout << "different are: " << *iter << "\n";
+        for (auto& env_var : different_child_env_vars)
+            std::cout << "different are: " << env_var << "\n";
 
         bool different_env_size_equals    = (different_child_env_vars.size() 
== different_env_vars.size());
         bool different_env_content_equals =
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 6cba2a5eda6b..4dde125e4dba 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -128,8 +128,8 @@ struct ScLookupCacheMapImpl
 private:
     void freeCaches()
     {
-        for (auto it( aCacheMap.begin()); it != aCacheMap.end(); ++it)
-            delete (*it).second;
+        for (auto& aCacheItem : aCacheMap)
+            delete aCacheItem.second;
     }
 };
 
diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx
index 394d5d5f09f9..b20efcf1952b 100644
--- a/sc/source/core/tool/rangelst.cxx
+++ b/sc/source/core/tool/rangelst.cxx
@@ -390,10 +390,8 @@ bool ScRangeList::UpdateReference(
     if(maRanges.empty())
         return true;
 
-    auto itr = maRanges.begin(), itrEnd = maRanges.end();
-    for (; itr != itrEnd; ++itr)
+    for (auto& rR : maRanges)
     {
-        ScRange& rR = *itr;
         SCCOL theCol1;
         SCROW theRow1;
         SCTAB theTab1;
@@ -430,10 +428,8 @@ bool ScRangeList::UpdateReference(
 void ScRangeList::InsertRow( SCTAB nTab, SCCOL nColStart, SCCOL nColEnd, SCROW 
nRowPos, SCSIZE nSize )
 {
     std::vector<ScRange> aNewRanges;
-    for(auto it = maRanges.begin(), itEnd = maRanges.end(); it != itEnd;
-            ++it)
+    for(auto & rRange : maRanges)
     {
-        ScRange & rRange = *it;
         if(rRange.aStart.Tab() <= nTab && rRange.aEnd.Tab() >= nTab)
         {
             if(rRange.aEnd.Row() == nRowPos - 1 && (nColStart <= 
rRange.aEnd.Col() || nColEnd >= rRange.aStart.Col()))
@@ -450,23 +446,20 @@ void ScRangeList::InsertRow( SCTAB nTab, SCCOL nColStart, 
SCCOL nColEnd, SCROW n
         }
     }
 
-    for(auto it = aNewRanges.cbegin(), itEnd = aNewRanges.cend();
-            it != itEnd; ++it)
+    for(auto & rRange : aNewRanges)
     {
-        if(!it->IsValid())
+        if(!rRange.IsValid())
             continue;
 
-        Join(*it);
+        Join(rRange);
     }
 }
 
 void ScRangeList::InsertCol( SCTAB nTab, SCROW nRowStart, SCROW nRowEnd, SCCOL 
nColPos, SCSIZE nSize )
 {
     std::vector<ScRange> aNewRanges;
-    for(auto it = maRanges.begin(), itEnd = maRanges.end(); it != itEnd;
-            ++it)
+    for(auto & rRange : maRanges)
     {
-        ScRange & rRange = *it;
         if(rRange.aStart.Tab() <= nTab && rRange.aEnd.Tab() >= nTab)
         {
             if(rRange.aEnd.Col() == nColPos - 1 && (nRowStart <= 
rRange.aEnd.Row() || nRowEnd >= rRange.aStart.Row()))
@@ -481,13 +474,12 @@ void ScRangeList::InsertCol( SCTAB nTab, SCROW nRowStart, 
SCROW nRowEnd, SCCOL n
         }
     }
 
-    for(std::vector<ScRange>::const_iterator it = aNewRanges.begin(), itEnd = 
aNewRanges.end();
-            it != itEnd; ++it)
+    for(auto & rRange : aNewRanges)
     {
-        if(!it->IsValid())
+        if(!rRange.IsValid())
             continue;
 
-        Join(*it);
+        Join(rRange);
     }
 }
 
@@ -934,13 +926,13 @@ bool ScRangeList::DeleteArea( SCCOL nCol1, SCROW nRow1, 
SCTAB nTab1,
 
     std::vector<ScRange> aNewRanges;
 
-    for(auto itr = maRanges.begin(); itr != maRanges.end(); ++itr)
+    for(auto & rRange : maRanges)
     {
         // we have two basic cases here:
         // 1. Delete area and pRange intersect
         // 2. Delete area and pRange are not intersecting
         // checking for 2 and if true skip this range
-        if(!itr->Intersects(aRange))
+        if(!rRange.Intersects(aRange))
             continue;
 
         // We get between 1 and 4 ranges from the difference of the first with 
the second
@@ -951,7 +943,7 @@ bool ScRangeList::DeleteArea( SCCOL nCol1, SCROW nRow1, 
SCTAB nTab1,
         // getting exactly one range is the simple case
         // r.aStart.X() <= p.aStart.X() && r.aEnd.X() >= p.aEnd.X()
         // && ( r.aStart.Y() <= p.aStart.Y() || r.aEnd.Y() >= r.aEnd.Y() )
-        if(handleOneRange( aRange, *itr ))
+        if(handleOneRange( aRange, rRange ))
         {
             bChanged = true;
             continue;
@@ -959,7 +951,7 @@ bool ScRangeList::DeleteArea( SCCOL nCol1, SCROW nRow1, 
SCTAB nTab1,
 
         // getting two ranges
         // r.aStart.X()
-        else if(handleTwoRanges( aRange, *itr, aNewRanges ))
+        else if(handleTwoRanges( aRange, rRange, aNewRanges ))
         {
             bChanged = true;
             continue;
@@ -971,7 +963,7 @@ bool ScRangeList::DeleteArea( SCCOL nCol1, SCROW nRow1, 
SCTAB nTab1,
         // or
         // r.aStart.X() <= p.aStart.X() && r.aEnd.X() < p.aEnd.X()
         // && r.aStart.Y() > p.aStart.Y() && r.aEnd.Y() < p.aEnd.Y()
-        else if(handleThreeRanges( aRange, *itr, aNewRanges ))
+        else if(handleThreeRanges( aRange, rRange, aNewRanges ))
         {
             bChanged = true;
             continue;
@@ -980,14 +972,14 @@ bool ScRangeList::DeleteArea( SCCOL nCol1, SCROW nRow1, 
SCTAB nTab1,
         // getting 4 ranges
         // r.aStart.X() > p.aStart.X() && r.aEnd().X() < p.aEnd.X()
         // && r.aStart.Y() > p.aStart.Y() && r.aEnd().Y() < p.aEnd.Y()
-        else if(handleFourRanges( aRange, *itr, aNewRanges ))
+        else if(handleFourRanges( aRange, rRange, aNewRanges ))
         {
             bChanged = true;
             continue;
         }
     }
-    for(vector<ScRange>::iterator itr = aNewRanges.begin(); itr != 
aNewRanges.end(); ++itr)
-        Join( *itr);
+    for(auto & rRange : aNewRanges)
+        Join(rRange);
 
     return bChanged;
 }
@@ -1134,15 +1126,14 @@ ScAddress ScRangeList::GetTopLeftCorner() const
 ScRangeList ScRangeList::GetIntersectedRange(const ScRange& rRange) const
 {
     ScRangeList aReturn;
-    for(auto itr = maRanges.cbegin(), itrEnd = maRanges.cend();
-            itr != itrEnd; ++itr)
+    for(auto& rR : maRanges)
     {
-        if(itr->Intersects(rRange))
+        if(rR.Intersects(rRange))
         {
             SCCOL nColStart1, nColEnd1, nColStart2, nColEnd2;
             SCROW nRowStart1, nRowEnd1, nRowStart2, nRowEnd2;
             SCTAB nTabStart1, nTabEnd1, nTabStart2, nTabEnd2;
-            itr->GetVars(nColStart1, nRowStart1, nTabStart1,
+            rR.GetVars(nColStart1, nRowStart1, nTabStart1,
                         nColEnd1, nRowEnd1, nTabEnd1);
             rRange.GetVars(nColStart2, nRowStart2, nTabStart2,
                         nColEnd2, nRowEnd2, nTabEnd2);
diff --git a/sc/source/filter/ftools/fapihelper.cxx 
b/sc/source/filter/ftools/fapihelper.cxx
index dab3b5e112f3..146af75aaca5 100644
--- a/sc/source/filter/ftools/fapihelper.cxx
+++ b/sc/source/filter/ftools/fapihelper.cxx
@@ -296,11 +296,11 @@ ScfPropSetHelper::ScfPropSetHelper( const sal_Char* 
const* ppcPropNames ) :
 
     // fill the property name sequence and store original sort order
     sal_Int32 nSeqIdx = 0;
-    for( auto aIt = aPropNameVec.cbegin(), aEnd = aPropNameVec.cend();
-            aIt != aEnd; ++aIt, ++nSeqIdx )
+    for( auto& aPropName : aPropNameVec )
     {
-        maNameSeq[ nSeqIdx ] = aIt->first;
-        maNameOrder[ aIt->second ] = nSeqIdx;
+        maNameSeq[ nSeqIdx ] = aPropName.first;
+        maNameOrder[ aPropName.second ] = nSeqIdx;
+        ++nSeqIdx;
     }
 }
 
diff --git a/sc/source/filter/oox/formulaparser.cxx 
b/sc/source/filter/oox/formulaparser.cxx
index a6d3c0f7a18d..083c1b594aa8 100644
--- a/sc/source/filter/oox/formulaparser.cxx
+++ b/sc/source/filter/oox/formulaparser.cxx
@@ -620,8 +620,11 @@ ApiTokenSequence FormulaParserImpl::finalizeImport()
     if( aTokens.hasElements() )
     {
         ApiToken* pToken = aTokens.getArray();
-        for( auto aIt = maTokenIndexes.cbegin(), aEnd = maTokenIndexes.cend(); 
aIt != aEnd; ++aIt, ++pToken )
-            *pToken = maTokenStorage[ *aIt ];
+        for( auto& tokenIndex : maTokenIndexes )
+        {
+            *pToken = maTokenStorage[ tokenIndex ];
+            ++pToken;
+        }
     }
     return finalizeTokenArray( aTokens );
 }
diff --git a/sc/source/filter/oox/pivotcachebuffer.cxx 
b/sc/source/filter/oox/pivotcachebuffer.cxx
index 2a46606e0111..95f4addfa10c 100644
--- a/sc/source/filter/oox/pivotcachebuffer.cxx
+++ b/sc/source/filter/oox/pivotcachebuffer.cxx
@@ -688,8 +688,8 @@ OUString PivotCacheField::createParentGroupField( const 
Reference< XDataPilotFie
                 names as they are already grouped is used here to resolve the
                 item names. */
             ::std::vector< OUString > aMembers;
-            for( auto aBeg2 = aIt->begin(), aIt2 = aBeg2, aEnd2 = aIt->end(); 
aIt2 != aEnd2; ++aIt2 )
-                if( const PivotCacheGroupItem* pName = 
ContainerHelper::getVectorElement( orItemNames, *aIt2 ) )
+            for( auto i : *aIt )
+                if( const PivotCacheGroupItem* pName = 
ContainerHelper::getVectorElement( orItemNames, i ) )
                     if( ::std::find( aMembers.begin(), aMembers.end(), 
pName->maGroupName ) == aMembers.end() )
                         aMembers.push_back( pName->maGroupName );
 
@@ -756,8 +756,8 @@ OUString PivotCacheField::createParentGroupField( const 
Reference< XDataPilotFie
                         aPropSet.setProperty( PROP_GroupInfo, aGroupInfo );
                     }
                     // replace original item names in passed vector with group 
name
-                    for( auto aIt2 = aIt->begin(), aEnd2 = aIt->end(); aIt2 != 
aEnd2; ++aIt2 )
-                        if( PivotCacheGroupItem* pName = 
ContainerHelper::getVectorElementAccess( orItemNames, *aIt2 ) )
+                    for( auto i : *aIt )
+                        if( PivotCacheGroupItem* pName = 
ContainerHelper::getVectorElementAccess( orItemNames, i ) )
                             pName->maGroupName = aGroupName;
                 }
             }
diff --git a/sc/source/ui/miscdlgs/conflictsdlg.cxx 
b/sc/source/ui/miscdlgs/conflictsdlg.cxx
index 0664058641bb..28ba0dfdf368 100644
--- a/sc/source/ui/miscdlgs/conflictsdlg.cxx
+++ b/sc/source/ui/miscdlgs/conflictsdlg.cxx
@@ -30,71 +30,47 @@
 bool ScConflictsListEntry::HasSharedAction( sal_uLong nSharedAction ) const
 {
     auto aEnd = maSharedActions.cend();
-    for ( auto aItr = maSharedActions.cbegin(); aItr != aEnd; ++aItr )
-    {
-        if ( *aItr == nSharedAction )
-        {
-            return true;
-        }
-    }
+    auto aItr = std::find(maSharedActions.cbegin(), aEnd, nSharedAction);
 
-    return false;
+    return aItr != aEnd;
 }
 
 bool ScConflictsListEntry::HasOwnAction( sal_uLong nOwnAction ) const
 {
     auto aEnd = maOwnActions.cend();
-    for ( auto aItr = maOwnActions.cbegin(); aItr != aEnd; ++aItr )
-    {
-        if ( *aItr == nOwnAction )
-        {
-            return true;
-        }
-    }
+    auto aItr = std::find(maOwnActions.cbegin(), aEnd, nOwnAction);
 
-    return false;
+    return aItr != aEnd;
 }
 
 // class ScConflictsListHelper
 
 bool ScConflictsListHelper::HasOwnAction( ScConflictsList& rConflictsList, 
sal_uLong nOwnAction )
 {
-    ScConflictsList::const_iterator aEnd = rConflictsList.end();
-    for ( ScConflictsList::const_iterator aItr = rConflictsList.begin(); aItr 
!= aEnd; ++aItr )
-    {
-        if ( aItr->HasOwnAction( nOwnAction ) )
-        {
-            return true;
-        }
-    }
-
-    return false;
+    return std::any_of(rConflictsList.begin(), rConflictsList.end(),
+                       [nOwnAction](ScConflictsListEntry& rConflict) { return 
rConflict.HasOwnAction( nOwnAction ); });
 }
 
 ScConflictsListEntry* ScConflictsListHelper::GetSharedActionEntry( 
ScConflictsList& rConflictsList, sal_uLong nSharedAction )
 {
-    ScConflictsList::iterator aEnd = rConflictsList.end();
-    for ( ScConflictsList::iterator aItr = rConflictsList.begin(); aItr != 
aEnd; ++aItr )
-    {
-        if ( aItr->HasSharedAction( nSharedAction ) )
-        {
-            return &(*aItr);
-        }
-    }
+    auto aEnd = rConflictsList.end();
+    auto aItr = std::find_if(rConflictsList.begin(), aEnd,
+        [nSharedAction](ScConflictsListEntry& rConflict) { return 
rConflict.HasSharedAction( nSharedAction ); });
+
+    if (aItr != aEnd)
+        return &(*aItr);
 
     return nullptr;
 }
 
 ScConflictsListEntry* ScConflictsListHelper::GetOwnActionEntry( 
ScConflictsList& rConflictsList, sal_uLong nOwnAction )
 {
-    ScConflictsList::iterator aEnd = rConflictsList.end();
-    for ( ScConflictsList::iterator aItr = rConflictsList.begin(); aItr != 
aEnd; ++aItr )
-    {
-        if ( aItr->HasOwnAction( nOwnAction ) )
-        {
-            return &(*aItr);
-        }
-    }
+    auto aEnd = rConflictsList.end();
+    auto aItr = std::find_if(rConflictsList.begin(), aEnd,
+        [nOwnAction](ScConflictsListEntry& rConflict) { return 
rConflict.HasOwnAction( nOwnAction ); });
+
+    if (aItr != aEnd)
+        return &(*aItr);
 
     return nullptr;
 }
@@ -164,26 +140,15 @@ bool ScConflictsFinder::DoActionsIntersect( const 
ScChangeAction* pAction1, cons
 
 ScConflictsListEntry* ScConflictsFinder::GetIntersectingEntry( const 
ScChangeAction* pAction ) const
 {
-    ScConflictsList::iterator aEnd = mrConflictsList.end();
-    for ( ScConflictsList::iterator aItr = mrConflictsList.begin(); aItr != 
aEnd; ++aItr )
+    auto doActionsIntersect = [this, pAction](const sal_uLong& aAction) { 
return DoActionsIntersect( mpTrack->GetAction( aAction ), pAction ); };
+
+    for ( auto& rConflict : mrConflictsList )
     {
-        auto aEndShared = aItr->maSharedActions.cend();
-        for ( auto aItrShared = aItr->maSharedActions.cbegin(); aItrShared != 
aEndShared; ++aItrShared )
-        {
-            if ( DoActionsIntersect( mpTrack->GetAction( *aItrShared ), 
pAction ) )
-            {
-                return &(*aItr);
-            }
-        }
+        if (std::any_of( rConflict.maSharedActions.cbegin(), 
rConflict.maSharedActions.cend(), doActionsIntersect ))
+            return &rConflict;
 
-        auto aEndOwn = aItr->maOwnActions.cend();
-        for ( auto aItrOwn = aItr->maOwnActions.cbegin(); aItrOwn != aEndOwn; 
++aItrOwn )
-        {
-            if ( DoActionsIntersect( mpTrack->GetAction( *aItrOwn ), pAction ) 
)
-            {
-                return &(*aItr);
-            }
-        }
+        if (std::any_of( rConflict.maOwnActions.cbegin(), 
rConflict.maOwnActions.cend(), doActionsIntersect ))
+            return &rConflict;
     }
 
     return nullptr;
@@ -209,10 +174,9 @@ ScConflictsListEntry* ScConflictsFinder::GetEntry( 
sal_uLong nSharedAction, cons
 
     // try to get a list entry for which any of the own actions intersects with
     // any other action of this entry
-    auto aEnd = rOwnActions.cend();
-    for ( auto aItr = rOwnActions.cbegin(); aItr != aEnd; ++aItr )
+    for ( auto& rOwnAction : rOwnActions )
     {
-        pEntry = GetIntersectingEntry( mpTrack->GetAction( *aItr ) );
+        pEntry = GetIntersectingEntry( mpTrack->GetAction( rOwnAction ) );
         if ( pEntry )
         {
             pEntry->maSharedActions.push_back( nSharedAction );
@@ -253,12 +217,11 @@ bool ScConflictsFinder::Find()
         if ( aOwnActions.size() )
         {
             ScConflictsListEntry* pEntry = GetEntry( 
pSharedAction->GetActionNumber(), aOwnActions );
-            auto aEnd = aOwnActions.end();
-            for ( auto aItr = aOwnActions.begin(); aItr != aEnd; ++aItr )
+            for ( auto& aOwnAction : aOwnActions )
             {
-                if ( pEntry && !ScConflictsListHelper::HasOwnAction( 
mrConflictsList, *aItr ) )
+                if ( pEntry && !ScConflictsListHelper::HasOwnAction( 
mrConflictsList, aOwnAction ) )
                 {
-                    pEntry->maOwnActions.push_back( *aItr );
+                    pEntry->maOwnActions.push_back( aOwnAction );
                 }
             }
             bReturn = true;
@@ -674,10 +637,9 @@ void ScConflictsDlg::UpdateView()
             pRootUserData->pData = static_cast< void* >( pConflictEntry );
             SvTreeListEntry* pRootEntry = m_pLbConflicts->InsertEntry( 
GetConflictString( *aItr ), pRootUserData );
 
-            auto aEndShared = aItr->maSharedActions.cend();
-            for ( auto aItrShared = aItr->maSharedActions.cbegin(); aItrShared 
!= aEndShared; ++aItrShared )
+            for ( auto& aSharedAction : aItr->maSharedActions )
             {
-                ScChangeAction* pAction = mpSharedTrack ? 
mpSharedTrack->GetAction(*aItrShared) : nullptr;
+                ScChangeAction* pAction = mpSharedTrack ? 
mpSharedTrack->GetAction(aSharedAction) : nullptr;
                 if ( pAction )
                 {
                     // only display shared top content entries
@@ -695,10 +657,9 @@ void ScConflictsDlg::UpdateView()
                 }
             }
 
-            auto aEndOwn = aItr->maOwnActions.cend();
-            for ( auto aItrOwn = aItr->maOwnActions.cbegin(); aItrOwn != 
aEndOwn; ++aItrOwn )
+            for ( auto& aOwnAction : aItr->maOwnActions )
             {
-                ScChangeAction* pAction = mpOwnTrack ? 
mpOwnTrack->GetAction(*aItrOwn) : nullptr;
+                ScChangeAction* pAction = mpOwnTrack ? 
mpOwnTrack->GetAction(aOwnAction) : nullptr;
                 if ( pAction )
                 {
                     // only display own top content entries
diff --git a/scripting/source/provider/BrowseNodeFactoryImpl.cxx 
b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
index 122e3e247279..b27ac817329f 100644
--- a/scripting/source/provider/BrowseNodeFactoryImpl.cxx
+++ b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
@@ -195,11 +195,10 @@ public:
         Sequence<  Reference< browse::XBrowseNode > > children( m_hBNA->size() 
);
         sal_Int32 index = 0;
 
-        auto it = m_vStr.begin();
-
-        for ( ; it != m_vStr.end(); ++it, index++ )
+        for ( auto& str : m_vStr )
         {
-            children[ index ].set( m_hBNA->find( *it )->second );
+            children[ index ].set( m_hBNA->find( str )->second );
+            ++index;
         }
 
         return children;
diff --git a/scripting/source/stringresource/stringresource.cxx 
b/scripting/source/stringresource/stringresource.cxx
index 36fcde4f2015..8fdfdec22526 100644
--- a/scripting/source/stringresource/stringresource.cxx
+++ b/scripting/source/stringresource/stringresource.cxx
@@ -112,17 +112,11 @@ StringResourceImpl::StringResourceImpl( const Reference< 
XComponentContext >& rx
 
 StringResourceImpl::~StringResourceImpl()
 {
-    for( auto it = m_aLocaleItemVector.begin(); it != 
m_aLocaleItemVector.end(); ++it )
-    {
-        LocaleItem* pLocaleItem = *it;
+    for( auto& pLocaleItem : m_aLocaleItemVector )
         delete pLocaleItem;
-    }
 
-    for( auto it = m_aDeletedLocaleItemVector.begin(); it != 
m_aDeletedLocaleItemVector.end(); ++it )
-    {
-        LocaleItem* pLocaleItem = *it;
+    for( auto& pLocaleItem : m_aDeletedLocaleItemVector )
         delete pLocaleItem;
-    }
 }
 
 
@@ -291,9 +285,8 @@ Sequence< Locale > StringResourceImpl::getLocales(  )
     Sequence< Locale > aLocalSeq( nSize );
     Locale* pLocales = aLocalSeq.getArray();
     int iTarget = 0;
-    for( auto it = m_aLocaleItemVector.cbegin(); it != 
m_aLocaleItemVector.cend(); ++it )
+    for( auto& pLocaleItem : m_aLocaleItemVector )
     {
-        LocaleItem* pLocaleItem = *it;
         pLocales[iTarget] = pLocaleItem->m_locale;
         iTarget++;
     }
@@ -511,9 +504,8 @@ void StringResourceImpl::removeLocale( const Locale& locale 
)
                 m_pDefaultLocaleItem  == pRemoveItem )
             {
                 LocaleItem* pFallbackItem = nullptr;
-                for( auto it = m_aLocaleItemVector.begin(); it != 
m_aLocaleItemVector.end(); ++it )
+                for( auto& pLocaleItem : m_aLocaleItemVector )
                 {
-                    LocaleItem* pLocaleItem = *it;
                     if( pLocaleItem != pRemoveItem )
                     {
                         pFallbackItem = pLocaleItem;
@@ -606,9 +598,8 @@ LocaleItem* StringResourceImpl::getItemForLocale
     LocaleItem* pRetItem = nullptr;
 
     // Search for locale
-    for( auto it = m_aLocaleItemVector.cbegin(); it != 
m_aLocaleItemVector.cend(); ++it )
+    for( auto& pLocaleItem : m_aLocaleItemVector )
     {
-        LocaleItem* pLocaleItem = *it;
         if( pLocaleItem )
         {
             Locale& cmp_locale = pLocaleItem->m_locale;
@@ -637,10 +628,10 @@ LocaleItem* 
StringResourceImpl::getClosestMatchItemForLocale( const Locale& loca
 
     ::std::vector< Locale > aLocales( m_aLocaleItemVector.size());
     size_t i = 0;
-    for( auto it = m_aLocaleItemVector.cbegin(); it != 
m_aLocaleItemVector.cend(); ++it, ++i )
+    for( auto& pLocaleItem : m_aLocaleItemVector )
     {
-        LocaleItem* pLocaleItem = *it;
         aLocales[i] = (pLocaleItem ? pLocaleItem->m_locale : Locale());
+        ++i;
     }
     ::std::vector< Locale >::const_iterator iFound( 
LanguageTag::getMatchingFallback( aLocales, locale));
     if (iFound != aLocales.end())
@@ -901,10 +892,8 @@ void StringResourcePersistenceImpl::implStoreAtStorage
     // Delete files for deleted locales
     if( bUsedForStore )
     {
-        while( m_aDeletedLocaleItemVector.size() > 0 )
+        for( auto& pLocaleItem : m_aDeletedLocaleItemVector )
         {
-            auto it = m_aDeletedLocaleItemVector.begin();
-            LocaleItem* pLocaleItem = *it;
             if( pLocaleItem != nullptr )
             {
                 OUString aStreamName = implGetFileNameForLocaleItem( 
pLocaleItem, m_aNameBase );
@@ -917,15 +906,14 @@ void StringResourcePersistenceImpl::implStoreAtStorage
                 catch( Exception& )
                 {}
 
-                m_aDeletedLocaleItemVector.erase( it );
                 delete pLocaleItem;
             }
         }
+        m_aDeletedLocaleItemVector.clear();
     }
 
-    for( auto it = m_aLocaleItemVector.cbegin(); it != 
m_aLocaleItemVector.cend(); ++it )
+    for( auto& pLocaleItem : m_aLocaleItemVector )
     {
-        LocaleItem* pLocaleItem = *it;
         if( pLocaleItem != nullptr && (bStoreAll || pLocaleItem->m_bModified) 
&&
             loadLocale( pLocaleItem ) )
         {
@@ -960,10 +948,8 @@ void StringResourcePersistenceImpl::implStoreAtStorage
     // Delete files for changed defaults
     if( bUsedForStore )
     {
-        for( auto it = m_aChangedDefaultLocaleVector.begin();
-             it != m_aChangedDefaultLocaleVector.end(); ++it )
+        for( auto& pLocaleItem : m_aChangedDefaultLocaleVector )
         {
-            LocaleItem* pLocaleItem = *it;
             if( pLocaleItem != nullptr )
             {
                 OUString aStreamName = implGetFileNameForLocaleItem( 
pLocaleItem, m_aNameBase );
@@ -1021,10 +1007,8 @@ void 
StringResourcePersistenceImpl::implKillRemovedLocaleFiles
 )
 {
     // Delete files for deleted locales
-    while( m_aDeletedLocaleItemVector.size() > 0 )
+    for( auto& pLocaleItem : m_aDeletedLocaleItemVector )
     {
-        auto it = m_aDeletedLocaleItemVector.begin();
-        LocaleItem* pLocaleItem = *it;
         if( pLocaleItem != nullptr )
         {
             OUString aCompleteFileName =
@@ -1032,10 +1016,10 @@ void 
StringResourcePersistenceImpl::implKillRemovedLocaleFiles
             if( xFileAccess->exists( aCompleteFileName ) )
                 xFileAccess->kill( aCompleteFileName );
 
-            m_aDeletedLocaleItemVector.erase( it );
             delete pLocaleItem;
         }
     }
+    m_aDeletedLocaleItemVector.clear();
 }
 
 void StringResourcePersistenceImpl::implKillChangedDefaultFiles
@@ -1046,10 +1030,8 @@ void 
StringResourcePersistenceImpl::implKillChangedDefaultFiles
 )
 {
     // Delete files for changed defaults
-    for( auto it = m_aChangedDefaultLocaleVector.begin();
-         it != m_aChangedDefaultLocaleVector.end(); ++it )
+    for( auto& pLocaleItem : m_aChangedDefaultLocaleVector )
     {
-        LocaleItem* pLocaleItem = *it;
         if( pLocaleItem != nullptr )
         {
             OUString aCompleteFileName =
@@ -1078,9 +1060,8 @@ void StringResourcePersistenceImpl::implStoreAtLocation
     if( bUsedForStore || bKillAll )
         implKillRemovedLocaleFiles( Location, aNameBase, xFileAccess );
 
-    for( auto it = m_aLocaleItemVector.cbegin(); it != 
m_aLocaleItemVector.cend(); ++it )
+    for( auto& pLocaleItem : m_aLocaleItemVector )
     {
-        LocaleItem* pLocaleItem = *it;
         if( pLocaleItem != nullptr && (bStoreAll || bKillAll || 
pLocaleItem->m_bModified) &&
             loadLocale( pLocaleItem ) )
         {
@@ -1270,10 +1251,8 @@ Sequence< sal_Int8 > 
StringResourcePersistenceImpl::exportBinary(  )
 
     sal_Int32 iLocale = 0;
     sal_Int32 iDefault = 0;
-    for( auto it = m_aLocaleItemVector.cbegin();
-         it != m_aLocaleItemVector.cend(); ++it,++iLocale )
+    for( auto& pLocaleItem : m_aLocaleItemVector )
     {
-        LocaleItem* pLocaleItem = *it;
         if( pLocaleItem != nullptr && loadLocale( pLocaleItem ) )
         {
             if( m_pDefaultLocaleItem == pLocaleItem )
@@ -1284,6 +1263,7 @@ Sequence< sal_Int8 > 
StringResourcePersistenceImpl::exportBinary(  )
 
             pLocaleDataSeq[iLocale] = aLocaleOut.closeAndGetData();
         }
+        ++iLocale;
     }
 
     // Write header
@@ -1568,12 +1548,9 @@ bool checkNamingSceme( const OUString& aName, const 
OUString& aNameBase,
 
 void StringResourcePersistenceImpl::implLoadAllLocales()
 {
-    for( auto it = m_aLocaleItemVector.begin(); it != 
m_aLocaleItemVector.end(); ++it )
-    {
-        LocaleItem* pLocaleItem = *it;
+    for( auto& pLocaleItem : m_aLocaleItemVector )
         if( pLocaleItem != nullptr )
             loadLocale( pLocaleItem );
-    }
 }
 
 // Scan locale properties files helper
diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx 
b/sd/source/ui/animations/CustomAnimationDialog.cxx
index fe4218cb0ba6..cd2d4c393ea7 100644
--- a/sd/source/ui/animations/CustomAnimationDialog.cxx
+++ b/sd/source/ui/animations/CustomAnimationDialog.cxx
@@ -142,17 +142,15 @@ void PresetPropertyBox::setValue( const Any& rValue, 
const OUString& rPresetId )
             rValue >>= aPropertyValue;
 
             std::vector<OUString> aSubTypes( pDescriptor->getSubTypes() );
-            std::vector<OUString>::iterator aIter( aSubTypes.begin() );
-            const std::vector<OUString>::iterator aEnd( aSubTypes.end() );
 
-            mpControl->Enable( aIter != aEnd );
+            mpControl->Enable( !aSubTypes.empty() );
 
-            while( aIter != aEnd )
+            for( auto& aSubType : aSubTypes )
             {
-                sal_Int32 nPos = mpControl->InsertEntry( 
rPresets.getUINameForProperty( *aIter ) );
-                if( (*aIter) == aPropertyValue )
+                sal_Int32 nPos = mpControl->InsertEntry( 
rPresets.getUINameForProperty( aSubType ) );
+                if( aSubType == aPropertyValue )
                     mpControl->SelectEntryPos( nPos );
-                maPropertyValues[nPos] = (*aIter++);
+                maPropertyValues[nPos] = aSubType;
             }
         }
         else
diff --git a/sd/source/ui/dlg/RemoteDialogClientBox.cxx 
b/sd/source/ui/dlg/RemoteDialogClientBox.cxx
index b19745203198..41066418063a 100644
--- a/sd/source/ui/dlg/RemoteDialogClientBox.cxx
+++ b/sd/source/ui/dlg/RemoteDialogClientBox.cxx
@@ -483,11 +483,11 @@ void ClientBox::Paint(vcl::RenderContext& rRenderContext, 
const ::tools::Rectang
 
     const ::osl::MutexGuard aGuard(m_entriesMutex);
 
-    for (auto iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex)
+    for (auto& vEntry : m_vEntries)
     {
-        aSize.setHeight( (*iIndex)->m_bActive ? m_nActiveHeight : m_nStdHeight 
);
+        aSize.setHeight( vEntry->m_bActive ? m_nActiveHeight : m_nStdHeight );
         ::tools::Rectangle aEntryRect(aStart, aSize);
-        DrawRow(rRenderContext, aEntryRect, *iIndex);
+        DrawRow(rRenderContext, aEntryRect, vEntry);
         aStart.AdjustY(aSize.Height() );
     }
 }
diff --git a/sd/source/ui/sidebar/MasterPageObserver.cxx 
b/sd/source/ui/sidebar/MasterPageObserver.cxx
index 341c02cb090d..501d0f55ceac 100644
--- a/sd/source/ui/sidebar/MasterPageObserver.cxx
+++ b/sd/source/ui/sidebar/MasterPageObserver.cxx
@@ -279,11 +279,11 @@ void 
MasterPageObserver::Implementation::AnalyzeUsedMasterPages (
             aOldMasterPagesDescriptor->second.begin(),
             aOldMasterPagesDescriptor->second.end(),
             std::back_inserter(aNewMasterPages));
-        for (auto I=aNewMasterPages.begin(); I!=aNewMasterPages.end(); ++I)
+        for (auto& aNewMasterPage : aNewMasterPages)
         {
             MasterPageObserverEvent aEvent (
                 MasterPageObserverEvent::ET_MASTER_PAGE_ADDED,
-                *I);
+                aNewMasterPage);
             SendEvent (aEvent);
         }
 
@@ -294,11 +294,11 @@ void 
MasterPageObserver::Implementation::AnalyzeUsedMasterPages (
             aCurrentMasterPages.begin(),
             aCurrentMasterPages.end(),
             std::back_inserter(aRemovedMasterPages));
-        for (auto I=aRemovedMasterPages.begin(); I!=aRemovedMasterPages.end(); 
++I)
+        for (auto& aRemovedMasterPage : aRemovedMasterPages)
         {
             MasterPageObserverEvent aEvent (
                 MasterPageObserverEvent::ET_MASTER_PAGE_REMOVED,
-                *I);
+                aRemovedMasterPage);
             SendEvent (aEvent);
         }
 
diff --git a/sd/source/ui/view/ToolBarManager.cxx 
b/sd/source/ui/view/ToolBarManager.cxx
index 0ebb36dfa481..2b90c9b15252 100644
--- a/sd/source/ui/view/ToolBarManager.cxx
+++ b/sd/source/ui/view/ToolBarManager.cxx
@@ -685,12 +685,12 @@ void ToolBarManager::Implementation::PreUpdate()
         maToolBarList.GetToolBarsToDeactivate(aToolBars);
 
         // Turn off the tool bars.
-        for (auto iToolBar=aToolBars.cbegin(); iToolBar!=aToolBars.cend(); 
++iToolBar)
+        for (auto& aToolBar : aToolBars)
         {
-            OUString sFullName (GetToolBarResourceName(*iToolBar));
+            OUString sFullName (GetToolBarResourceName(aToolBar));
             SAL_INFO("sd.view", OSL_THIS_FUNC << ":    turning off tool bar " 
<< sFullName);
             mxLayouter->destroyElement(sFullName);
-            maToolBarList.MarkToolBarAsNotActive(*iToolBar);
+            maToolBarList.MarkToolBarAsNotActive(aToolBar);
         }
 
         SAL_INFO("sd.view", OSL_THIS_FUNC << ": ToolBarManager::PreUpdate ]");
@@ -714,12 +714,12 @@ void ToolBarManager::Implementation::PostUpdate()
         SAL_INFO("sd.view", OSL_THIS_FUNC << ": ToolBarManager::PostUpdate [");
 
         // Turn on the tool bars that are visible in the new context.
-        for (auto iToolBar=aToolBars.cbegin(); iToolBar!=aToolBars.cend(); 
++iToolBar)
+        for (auto& aToolBar : aToolBars)
         {
-            OUString sFullName (GetToolBarResourceName(*iToolBar));
+            OUString sFullName (GetToolBarResourceName(aToolBar));
             SAL_INFO("sd.view", OSL_THIS_FUNC << ":    turning on tool bar " 
<< sFullName);
             mxLayouter->requestElement(sFullName);
-            maToolBarList.MarkToolBarAsActive(*iToolBar);
+            maToolBarList.MarkToolBarAsActive(aToolBar);
         }
 
         SAL_INFO("sd.view", OSL_THIS_FUNC << ": ToolBarManager::PostUpdate ]");
@@ -1264,12 +1264,12 @@ void ToolBarList::GetToolBarsToActivate 
(std::vector<OUString>& rToolBars) const
     std::vector<OUString> aRequestedToolBars;
     MakeRequestedToolBarList(aRequestedToolBars);
 
-    for (auto iToolBar=aRequestedToolBars.cbegin(); 
iToolBar!=aRequestedToolBars.cend(); ++iToolBar)
+    for (auto& aToolBar : aRequestedToolBars)
     {
-        if 
(::std::find(maActiveToolBars.begin(),maActiveToolBars.end(),*iToolBar)
+        if 
(::std::find(maActiveToolBars.begin(),maActiveToolBars.end(),aToolBar)
             == maActiveToolBars.end())
         {
-            rToolBars.push_back(*iToolBar);
+            rToolBars.push_back(aToolBar);
         }
     }
 }
@@ -1279,12 +1279,12 @@ void ToolBarList::GetToolBarsToDeactivate 
(std::vector<OUString>& rToolBars) con
     std::vector<OUString> aRequestedToolBars;
     MakeRequestedToolBarList(aRequestedToolBars);
 
-    for (auto iToolBar=maActiveToolBars.cbegin(); 
iToolBar!=maActiveToolBars.cend(); ++iToolBar)
+    for (auto& aToolBar : maActiveToolBars)
     {
-        if 
(::std::find(aRequestedToolBars.begin(),aRequestedToolBars.end(),*iToolBar)
+        if 
(::std::find(aRequestedToolBars.begin(),aRequestedToolBars.end(),aToolBar)
             == aRequestedToolBars.end())
         {
-            rToolBars.push_back(*iToolBar);
+            rToolBars.push_back(aToolBar);
         }
     }
 }
diff --git a/shell/source/tools/lngconvex/lngconvex.cxx 
b/shell/source/tools/lngconvex/lngconvex.cxx
index 802cafb6a08b..85f36ae8e28e 100644
--- a/shell/source/tools/lngconvex/lngconvex.cxx
+++ b/shell/source/tools/lngconvex/lngconvex.cxx
@@ -470,15 +470,12 @@ void inflate_rc_template_to_file(
     {
         substitutor.set_language(iso_lang_identifier(iter->first));
 
-        auto rct_iter = rctmpl.cbegin();
-        auto rct_iter_end = rctmpl.cend();
-
         if (!rctmpl.empty())
             start_language_section(oi, iso_lang_identifier(iter->first));
 
-        for ( /**/ ;rct_iter != rct_iter_end; ++rct_iter)
+        for ( auto& rct : rctmpl)
         {
-            std::istringstream iss(*rct_iter);
+            std::istringstream iss(rct);
             std::string line;
 
             while (iss)
diff --git a/shell/source/unix/sysshell/recently_used_file_handler.cxx 
b/shell/source/unix/sysshell/recently_used_file_handler.cxx
index 49c200eb47b6..0742e8b8912d 100644
--- a/shell/source/unix/sysshell/recently_used_file_handler.cxx
+++ b/shell/source/unix/sysshell/recently_used_file_handler.cxx
@@ -125,11 +125,8 @@ namespace /* private */ {
             {
                 write_xml_start_tag(TAG_GROUPS, file, true);
 
-                auto iter = groups_.cbegin();
-                auto iter_end = groups_.cend();
-
-                for ( ; iter != iter_end; ++iter)
-                    write_xml_tag(TAG_GROUP, (*iter), file);
+                for (auto& group : groups_)
+                    write_xml_tag(TAG_GROUP, group, file);
 
                 write_xml_end_tag(TAG_GROUPS, file);
             }
diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx
index a954372b6728..68db4a793265 100644
--- a/stoc/source/javavm/javavm.cxx
+++ b/stoc/source/javavm/javavm.cxx
@@ -1399,9 +1399,8 @@ void JavaVirtualMachine::setINetSettingsInVM(bool 
set_reset)
                 getINetPropsFromConfig( &jvm, m_xContext->getServiceManager(), 
m_xContext);
                 const ::std::vector< OUString> & Props = jvm.getProperties();
 
-                for( auto i= Props.cbegin(); i != Props.cend(); ++i)
+                for( auto& prop : Props)
                 {
-                    OUString prop= *i;
                     sal_Int32 index= prop.indexOf( '=');
                     OUString propName= prop.copy( 0, index);
                     OUString propValue= prop.copy( index + 1);
diff --git a/stoc/source/uriproc/UriReferenceFactory.cxx 
b/stoc/source/uriproc/UriReferenceFactory.cxx
index 600df5e7cde2..402da59393f3 100644
--- a/stoc/source/uriproc/UriReferenceFactory.cxx
+++ b/stoc/source/uriproc/UriReferenceFactory.cxx
@@ -418,11 +418,11 @@ css::uno::Reference< css::uri::XUriReference > 
Factory::makeAbsolute(
             if (slash) {
                 abs.append('/');
             }
-            for (auto i(segments.begin()); i != segments.end(); ++i)
+            for (auto& i : segments)
             {
-                if (*i < -1) {
+                if (i < -1) {
                     OUString segment(
-                        baseUriReference->getPathSegment(-(*i + 2)));
+                        baseUriReference->getPathSegment(-(i + 2)));
                     if (!segment.isEmpty() || segments.size() > 1) {
                         if (!slash) {
                             abs.append('/');
@@ -431,8 +431,8 @@ css::uno::Reference< css::uri::XUriReference > 
Factory::makeAbsolute(
                         slash = true;
                         abs.append('/');
                     }
-                } else if (*i > 1) {
-                    OUString segment(uriReference->getPathSegment(*i - 2));
+                } else if (i > 1) {
+                    OUString segment(uriReference->getPathSegment(i - 2));
                     if (!segment.isEmpty() || segments.size() > 1) {
                         if (!slash) {
                             abs.append('/');
@@ -440,7 +440,7 @@ css::uno::Reference< css::uri::XUriReference > 
Factory::makeAbsolute(
                         abs.append(segment);
                         slash = false;
                     }
-                } else if (*i == 0) {
+                } else if (i == 0) {
                     if (segments.size() > 1 && !slash) {
                         abs.append('/');
                     }
@@ -454,7 +454,7 @@ css::uno::Reference< css::uri::XUriReference > 
Factory::makeAbsolute(
                             abs.append('/');
                         }
                         abs.append("..");
-                        slash = *i < 0;
+                        slash = i < 0;
                         if (slash) {
                             abs.append('/');
                         }
diff --git a/svx/source/dialog/framelinkarray.cxx 
b/svx/source/dialog/framelinkarray.cxx
index 38681286f1f0..5b24b6d75c45 100644
--- a/svx/source/dialog/framelinkarray.cxx
+++ b/svx/source/dialog/framelinkarray.cxx
@@ -151,9 +151,11 @@ void lclRecalcCoordVec( std::vector<long>& rCoords, const 
std::vector<long>& rSi
 {
     DBG_ASSERT( rCoords.size() == rSizes.size() + 1, "lclRecalcCoordVec - 
inconsistent vectors" );
     auto aCIt = rCoords.begin();
-    auto aSIt = rSizes.cbegin(), aSEnd = rSizes.cend();
-    for( ; aSIt != aSEnd; ++aCIt, ++aSIt )
-        *(aCIt + 1) = *aCIt + *aSIt;
+    for( const auto& rSize : rSizes )
+    {
+        *(aCIt + 1) = *aCIt + rSize;
+        ++aCIt;
+    }
 }
 
 void lclSetMergedRange( CellVec& rCells, size_t nWidth, size_t nFirstCol, 
size_t nFirstRow, size_t nLastCol, size_t nLastRow )
diff --git a/sw/source/filter/ww8/writerhelper.cxx 
b/sw/source/filter/ww8/writerhelper.cxx
index 03821f0b1696..2ea8b649d46c 100644
--- a/sw/source/filter/ww8/writerhelper.cxx
+++ b/sw/source/filter/ww8/writerhelper.cxx
@@ -866,11 +866,10 @@ namespace sw
         {
             if (!mbHasRoot)
                 return;
-            auto aEnd = maTables.end();
-            for (auto aIter = maTables.begin(); aIter != aEnd; ++aIter)
+            for (auto& aTable : maTables)
             {
                 // If already a layout exists, then the BoxFrames must 
recreated at this table
-                SwTableNode *pTable = aIter->first->GetTableNode();
+                SwTableNode *pTable = aTable.first->GetTableNode();
                 OSL_ENSURE(pTable, "Why no expected table");
                 if (pTable)
                 {
@@ -878,7 +877,7 @@ namespace sw
 
                     if (pFrameFormat != nullptr)
                     {
-                        SwNodeIndex *pIndex = aIter->second;
+                        SwNodeIndex *pIndex = aTable.second;
                         pTable->DelFrames();
                         pTable->MakeFrames(pIndex);
                     }
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx 
b/sw/source/filter/ww8/wrtw8esh.cxx
index d212c27bb204..aca4539fd21e 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -637,19 +637,16 @@ void PlcDrawObj::WritePlc( WW8Export& rWrt ) const
         WW8Fib& rFib = *rWrt.pFib;
         WW8_CP nCpOffs = GetCpOffset(rFib);
 
-        auto aEnd = maDrawObjs.cend();
-        auto aIter = maDrawObjs.cbegin();
-
-        for ( ; aIter < aEnd; ++aIter)
-            SwWW8Writer::WriteLong(*rWrt.pTableStrm, aIter->mnCp - nCpOffs);
+        for (const auto& rDrawObj : maDrawObjs)
+            SwWW8Writer::WriteLong(*rWrt.pTableStrm, rDrawObj.mnCp - nCpOffs);
 
         SwWW8Writer::WriteLong(*rWrt.pTableStrm, rFib.m_ccpText + 
rFib.m_ccpFootnote +
             rFib.m_ccpHdr + rFib.m_ccpEdn + rFib.m_ccpTxbx + rFib.m_ccpHdrTxbx 
+ 1);
 
-        for (aIter = maDrawObjs.cbegin(); aIter < aEnd; ++aIter)
+        for (const auto& rDrawObj : maDrawObjs)
         {
             // write the fspa-struct
-            const ww8::Frame &rFrameFormat = aIter->maContent;
+            const ww8::Frame &rFrameFormat = rDrawObj.maContent;
             const SwFrameFormat &rFormat = rFrameFormat.GetFrameFormat();
             const SdrObject* pObj = rFormat.FindRealSdrObject();
 
@@ -710,7 +707,7 @@ void PlcDrawObj::WritePlc( WW8Export& rWrt ) const
             }
             else
             {
-                aRect -= aIter->maParentPos;
+                aRect -= rDrawObj.maParentPos;
                 aObjPos = aRect.TopLeft();
                 if (text::VertOrientation::NONE == rVOr.GetVertOrient())
                 {
@@ -726,7 +723,7 @@ void PlcDrawObj::WritePlc( WW8Export& rWrt ) const
                 aRect.SetPos( aObjPos );
             }
 
-            sal_Int32 nThick = aIter->mnThick;
+            sal_Int32 nThick = rDrawObj.mnThick;
 
             //If we are being exported as an inline hack, set
             //corner to 0 and forget about border thickness for positioning
@@ -737,7 +734,7 @@ void PlcDrawObj::WritePlc( WW8Export& rWrt ) const
             }
 
             // spid
-            SwWW8Writer::WriteLong(*rWrt.pTableStrm, aIter->mnShapeId);
+            SwWW8Writer::WriteLong(*rWrt.pTableStrm, rDrawObj.mnShapeId);
 
             SwTwips nLeft = aRect.Left() + nThick;
             SwTwips nRight = aRect.Right() - nThick;
@@ -2255,11 +2252,9 @@ SwEscherEx::SwEscherEx(SvStream* pStrm, WW8Export& 
rWW8Wrt)
         MakeZOrderArrAndFollowIds(pSdrObjs->GetObjArr(), aSorted);
 
         sal_uInt32 nShapeId=0;
-        auto aEnd = aSorted.end();
-        for (auto aIter = aSorted.begin(); aIter != aEnd; ++aIter)
+        for (auto& pObj : aSorted)
         {
             sal_Int32 nBorderThick=0;
-            DrawObj *pObj = (*aIter);
             OSL_ENSURE(pObj, "impossible");
             if (!pObj)
                 continue;
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx 
b/sw/source/filter/ww8/wrtw8nds.cxx
index 1be3d5557355..51fe41d0458c 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -496,11 +496,10 @@ void SwWW8AttrIter::OutAttr( sal_Int32 nSwPos, bool bRuby 
, bool bWriteCombChars
     if( rNd.GetpSwpHints() == nullptr )
         m_rExport.SetCurItemSet(&aExportSet);
 
-    auto aEnd = aRangeItems.cend();
-    for ( auto aI = aRangeItems.cbegin(); aI != aEnd; ++aI )
+    for ( const auto& aRangeItem : aRangeItems )
     {
-        if ( !bRuby || !lcl_isFontsizeItem( *aI->second ) )
-            aExportItems[aI->first] = aI->second;
+        if ( !bRuby || !lcl_isFontsizeItem( *(aRangeItem.second) ) )
+            aExportItems[aRangeItem.first] = aRangeItem.second;
     }
 
     if ( !aExportItems.empty() )
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx 
b/sw/source/filter/ww8/wrtw8sty.cxx
index dc57e91f6c5f..5b6fda114083 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -892,9 +892,8 @@ std::vector< const wwFont* > wwFontHelper::AsVector() const
 {
     std::vector<const wwFont *> aFontList( maFonts.size() );
 
-    auto aEnd = maFonts.cend();
-    for ( auto aIter = maFonts.cbegin(); aIter != aEnd; ++aIter )
-        aFontList[aIter->second] = &aIter->first;
+    for ( const auto& aFont : maFonts )
+        aFontList[aFont.second] = &aFont.first;
 
     return aFontList;
 }
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 9dbb588c24d4..c5cab3f6edf6 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -209,10 +209,9 @@ bool WW8Export::CollapseScriptsforWordOk( sal_uInt16 
nScript, sal_uInt16 nWhich
 
 void MSWordExportBase::ExportPoolItemsToCHP( ww8::PoolItems &rItems, 
sal_uInt16 nScript, const SvxFontItem *pFont, bool bWriteCombChars )
 {
-    auto aEnd = rItems.cend();
-    for ( auto aI = rItems.cbegin(); aI != aEnd; ++aI )
+    for ( const auto& rItem : rItems )
     {
-        const SfxPoolItem *pItem = aI->second;
+        const SfxPoolItem *pItem = rItem.second;
         sal_uInt16 nWhich = pItem->Which();
         if ( ( isCHRATR( nWhich ) || isTXTATR( nWhich ) ) && 
CollapseScriptsforWordOk( nScript, nWhich ) )
         {
@@ -297,10 +296,9 @@ void MSWordExportBase::OutputItemSet( const SfxItemSet& 
rSet, bool bPapFormat, b
             ExportPoolItemsToCHP(aItems, nScript, nullptr);
         if ( bPapFormat )
         {
-            auto aEnd = aItems.cend();
-            for ( auto aI = aItems.cbegin(); aI != aEnd; ++aI )
+            for ( const auto& rItem : aItems )
             {
-                pItem = aI->second;
+                pItem = rItem.second;
                 sal_uInt16 nWhich = pItem->Which();
                 // Handle fill attributes just like frame attributes for now.
                 if ( (nWhich >= RES_PARATR_BEGIN && nWhich < RES_FRMATR_END && 
nWhich != RES_PARATR_NUMRULE ) ||
@@ -345,15 +343,8 @@ bool MSWordExportBase::ContentContainsChapterField(const 
SwFormatContent &rConte
         sal_uLong nStart = aIdx.GetIndex();
         sal_uLong nEnd = aEnd.GetIndex();
         //If the header/footer contains a chapter field
-        auto aIEnd = m_aChapterFieldLocs.cend();
-        for ( auto aI = m_aChapterFieldLocs.cbegin(); aI != aIEnd; ++aI )
-        {
-            if ( ( nStart <= *aI ) && ( *aI <= nEnd ) )
-            {
-                bRet = true;
-                break;
-            }
-        }
+        bRet = std::any_of(m_aChapterFieldLocs.cbegin(), 
m_aChapterFieldLocs.cend(),
+            [nStart, nEnd](sal_uLong i) { return ( nStart <= i ) && ( i <= 
nEnd ); });
     }
     return bRet;
 }
diff --git a/sw/source/filter/ww8/ww8graf2.cxx 
b/sw/source/filter/ww8/ww8graf2.cxx
index 2680a957a71a..ab1183600fc1 100644
--- a/sw/source/filter/ww8/ww8graf2.cxx
+++ b/sw/source/filter/ww8/ww8graf2.cxx
@@ -216,15 +216,9 @@ void wwZOrderer::InsertTextLayerObject(SdrObject* pObject)
  */
 sal_uLong wwZOrderer::GetDrawingObjectPos(short nWwHeight)
 {
-    auto aIter = maDrawHeight.begin();
-    auto aEnd = maDrawHeight.end();
-
-    while (aIter != aEnd)
-    {
-        if ((*aIter & 0x1fff) > (nWwHeight & 0x1fff))
-            break;
-        ++aIter;
-    }
+    auto aIter = std::find_if(
+        maDrawHeight.begin(), maDrawHeight.end(),
+        [nWwHeight](short aHeight){ return (aHeight & 0x1fff) > (nWwHeight & 
0x1fff); });
 
     aIter = maDrawHeight.insert(aIter, nWwHeight);
     return std::distance(maDrawHeight.begin(), aIter);
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index f0ab52c3b900..9ca995ad4486 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -870,13 +870,8 @@ long SwWW8ImplReader::Read_Field(WW8PLCFManResult* pRes)
     bool bNested = false;
     if (!m_aFieldStack.empty())
     {
-        auto aEnd = m_aFieldStack.cend();
-        for(auto aIter = m_aFieldStack.cbegin(); aIter != aEnd; ++aIter)
-        {
-            bNested = !AcceptableNestedField(aIter->mnFieldId);
-            if (bNested)
-                break;
-        }
+        bNested = std::any_of(m_aFieldStack.cbegin(), m_aFieldStack.cend(),
+            [](const WW8FieldEntry& aField) { return 
!AcceptableNestedField(aField.mnFieldId); });
     }
 
     WW8FieldDesc aF;
diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index b3030f87d711..d5187dae1b0c 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -2811,11 +2811,11 @@ void SwTokenWindow::SetForm(SwForm& rForm, sal_uInt16 
nL)
 
     if(m_pForm)
     {
-        for (auto iter = m_aControlList.begin(); iter != m_aControlList.end(); 
++iter)
-            iter->disposeAndClear();
+        for (auto& aControl : m_aControlList)
+            aControl.disposeAndClear();
         //apply current level settings to the form
-        for (auto it = m_aControlList.begin(); it != m_aControlList.end(); 
++it)
-             it->disposeAndClear();
+        for (auto& aControl : m_aControlList)
+            aControl.disposeAndClear();
         m_aControlList.clear();
     }
 
@@ -3395,10 +3395,8 @@ OUString SwTokenWindow::GetPattern() const
 {
     OUStringBuffer sRet;
 
-    for (auto it = m_aControlList.cbegin(); it != m_aControlList.cend(); ++it)
+    for (const Control* pCtrl : m_aControlList)
     {
-        const Control *pCtrl = *it;
-
         const SwFormToken &rNewToken = pCtrl->GetType() == WindowType::EDIT
                 ? const_cast<SwTOXEdit*>(static_cast<const 
SwTOXEdit*>(pCtrl))->GetFormToken()
                 : static_cast<const SwTOXButton*>(pCtrl)->GetFormToken();
@@ -3415,10 +3413,8 @@ bool SwTokenWindow::Contains(FormTokenType eSearchFor) 
const
 {
     bool bRet = false;
 
-    for (auto it = m_aControlList.cbegin(); it != m_aControlList.cend(); ++it)
+    for (const Control* pCtrl : m_aControlList)
     {
-        const Control *pCtrl = *it;
-
         const SwFormToken &rNewToken = pCtrl->GetType() == WindowType::EDIT
                 ? const_cast<SwTOXEdit*>(static_cast<const 
SwTOXEdit*>(pCtrl))->GetFormToken()
                 : static_cast<const SwTOXButton*>(pCtrl)->GetFormToken();
@@ -3555,9 +3551,9 @@ IMPL_LINK(SwTokenWindow, NextItemBtnHdl, SwTOXButton&, 
rBtn, void )
 IMPL_LINK(SwTokenWindow, TbxFocusBtnHdl, Control&, rControl, void )
 {
     SwTOXButton* pBtn = static_cast<SwTOXButton*>(&rControl);
-    for (auto it = m_aControlList.begin(); it != m_aControlList.end(); ++it)
+    for (auto& aControl : m_aControlList)
     {
-        Control *pControl = it->get();
+        Control *pControl = aControl.get();
 
         if (pControl && WindowType::EDIT != pControl->GetType())
             static_cast<SwTOXButton*>(pControl)->Check(pBtn == pControl);
@@ -3602,9 +3598,8 @@ sal_uInt32 SwTokenWindow::GetControlIndex(FormTokenType 
eType) const
     }
 
     sal_uInt32 nIndex = 0;
-    for (auto it = m_aControlList.cbegin(); it != m_aControlList.cend(); ++it)
+    for (const Control* pControl : m_aControlList)
     {
-        const Control* pControl = *it;
         const SwFormToken& rNewToken = WindowType::EDIT == pControl->GetType()
             ? const_cast<SwTOXEdit*>(static_cast<const 
SwTOXEdit*>(pControl))->GetFormToken()
             : static_cast<const SwTOXButton*>(pControl)->GetFormToken();
diff --git a/sw/source/ui/misc/glosbib.cxx b/sw/source/ui/misc/glosbib.cxx
index f5afb1da7a2c..38e26e86d5b8 100644
--- a/sw/source/ui/misc/glosbib.cxx
+++ b/sw/source/ui/misc/glosbib.cxx
@@ -138,9 +138,9 @@ void SwGlossaryGroupDlg::Apply()
 
     OUString aActGroup = SwGlossaryDlg::GetCurrGroup();
 
-    for (auto it(m_RemovedArr.cbegin()); it != m_RemovedArr.cend(); ++it)
+    for (const auto& removedStr : m_RemovedArr)
     {
-        const OUString sDelGroup = it->getToken(0, '\t');
+        const OUString sDelGroup = removedStr.getToken(0, '\t');
         if( sDelGroup == aActGroup )
         {
             //when the current group is deleted, the current group has to be 
relocated
@@ -151,7 +151,7 @@ void SwGlossaryGroupDlg::Apply()
                 pGlosHdl->SetCurGroup(pUserData->sGroupName);
             }
         }
-        OUString sTitle( it->getToken(1, '\t') );
+        OUString sTitle( removedStr.getToken(1, '\t') );
         const OUString sMsg(SwResId(STR_QUERY_DELETE_GROUP1)
                             + sTitle
                             + SwResId(STR_QUERY_DELETE_GROUP2));
@@ -176,9 +176,8 @@ void SwGlossaryGroupDlg::Apply()
             sCreatedGroup = sNew;
         }
     }
-    for (auto it(m_InsertedArr.cbegin()); it != m_InsertedArr.cend(); ++it)
+    for (auto& sNewGroup : m_InsertedArr)
     {
-        OUString sNewGroup = *it;
         OUString sNewTitle = sNewGroup.getToken(0, GLOS_DELIM);
         if( sNewGroup != aActGroup )
         {
@@ -243,27 +242,21 @@ IMPL_LINK( SwGlossaryGroupDlg, DeleteHdl, Button*, 
pButton, void )
     OUString const sEntry(pUserData->sGroupName);
     // if the name to be deleted is among the new ones - get rid of it
     bool bDelete = true;
-    for (auto it(m_InsertedArr.begin()); it != m_InsertedArr.end(); ++it)
+    auto it = std::find(m_InsertedArr.begin(), m_InsertedArr.end(), sEntry);
+    if (it != m_InsertedArr.end())
     {
-        if (*it == sEntry)
-        {
-            m_InsertedArr.erase(it);
-            bDelete = false;
-            break;
-        }
-
+        m_InsertedArr.erase(it);
+        bDelete = false;
     }
     // it should probably be renamed?
     if(bDelete)
     {
-        for (auto it(m_RenamedArr.begin()); it != m_RenamedArr.end(); ++it)
+        it = std::find_if(m_RenamedArr.begin(), m_RenamedArr.end(),
+            [&sEntry](OUString& s) { return s.getToken(0, RENAME_TOKEN_DELIM) 
== sEntry; });
+        if (it != m_RenamedArr.end())
         {
-            if (it->getToken(0, RENAME_TOKEN_DELIM) == sEntry)
-            {
-                m_RenamedArr.erase(it);
-                bDelete = false;
-                break;
-            }
+            m_RenamedArr.erase(it);
+            bDelete = false;
         }
     }
     if(bDelete)
@@ -292,15 +285,12 @@ IMPL_LINK_NOARG(SwGlossaryGroupDlg, RenameHdl, Button*, 
void)
 
     // if the name to be renamed is among the new ones - replace
     bool bDone = false;
-    for (auto it(m_InsertedArr.begin()); it != m_InsertedArr.end(); ++it)
+    auto it = std::find(m_InsertedArr.begin(), m_InsertedArr.end(), sEntry);
+    if (it != m_InsertedArr.end())
     {
-        if (*it == sEntry)
-        {
-            m_InsertedArr.erase(it);
-            m_InsertedArr.push_back(sNewName);
-            bDone = true;
-            break;
-        }
+        m_InsertedArr.erase(it);
+        m_InsertedArr.push_back(sNewName);
+        bDone = true;
     }
     if(!bDone)
     {
@@ -385,14 +375,9 @@ bool SwGlossaryGroupDlg::IsDeleteAllowed(const OUString 
&rGroup)
     // as well! Because for non existing region names ReadOnly issues
     // true.
 
-    for (auto it(m_InsertedArr.cbegin()); it != m_InsertedArr.cend(); ++it)
-    {
-        if (*it == rGroup)
-        {
-            bDel = true;
-            break;
-        }
-    }
+    auto it = std::find(m_InsertedArr.cbegin(), m_InsertedArr.cend(), rGroup);
+    if (it != m_InsertedArr.cend())
+        bDel = true;
 
     return bDel;
 }
diff --git a/vcl/source/edit/textdoc.cxx b/vcl/source/edit/textdoc.cxx
index 1c77a626dbfd..2777cc116813 100644
--- a/vcl/source/edit/textdoc.cxx
+++ b/vcl/source/edit/textdoc.cxx
@@ -65,14 +65,12 @@ void TextCharAttribList::InsertAttrib( TextCharAttrib* 
pAttrib )
 
     const sal_Int32 nStart = pAttrib->GetStart(); // maybe better for Comp.Opt.
     bool bInserted = false;
-    for (std::vector<std::unique_ptr<TextCharAttrib> >::iterator it = 
maAttribs.begin(); it != maAttribs.end(); ++it)
+    auto it = std::find_if(maAttribs.begin(), maAttribs.end(),
+        [nStart](std::unique_ptr<TextCharAttrib>& rAttrib) { return 
rAttrib->GetStart() > nStart; });
+    if (it != maAttribs.end())
     {
-        if ( (*it)->GetStart() > nStart )
-        {
-            maAttribs.insert( it, std::unique_ptr<TextCharAttrib>(pAttrib) );
-            bInserted = true;
-            break;
-        }
+        maAttribs.insert( it, std::unique_ptr<TextCharAttrib>(pAttrib) );
+        bInserted = true;
     }
     if ( !bInserted )
         maAttribs.push_back( std::unique_ptr<TextCharAttrib>(pAttrib) );
diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx
index d43da0bd2411..2674bf7199cf 100644
--- a/vcl/source/window/splitwin.cxx
+++ b/vcl/source/window/splitwin.cxx
@@ -279,20 +279,19 @@ static ImplSplitSet* ImplFindSet( ImplSplitSet* pSet, 
sal_uInt16 nId )
     if ( pSet->mnId == nId )
         return pSet;
 
-    size_t              nItems = pSet->mvItems.size();
     std::vector< ImplSplitItem >&     rItems = pSet->mvItems;
 
-    for ( size_t i = 0; i < nItems; i++ )
+    for ( auto& rItem : rItems )
     {
-        if ( rItems[i].mnId == nId )
-            return rItems[i].mpSet.get();
+        if ( rItem.mnId == nId )
+            return rItem.mpSet.get();
     }
 
-    for ( size_t i = 0; i < nItems; i++ )
+    for ( auto& rItem : rItems )
     {
-        if ( rItems[i].mpSet )
+        if ( rItem.mpSet )
         {
-            ImplSplitSet* pFindSet = ImplFindSet( rItems[i].mpSet.get(), nId );
+            ImplSplitSet* pFindSet = ImplFindSet( rItem.mpSet.get(), nId );
             if ( pFindSet )
                 return pFindSet;
         }
@@ -315,11 +314,11 @@ static ImplSplitSet* ImplFindItem( ImplSplitSet* pSet, 
sal_uInt16 nId, sal_uInt1
         }
     }
 
-    for ( size_t i = 0; i < nItems; i++ )
+    for ( auto& rItem : rItems )
     {
-        if ( rItems[i].mpSet )
+        if ( rItem.mpSet )
         {
-            ImplSplitSet* pFindSet = ImplFindItem( rItems[i].mpSet.get(), nId, 
rPos );
+            ImplSplitSet* pFindSet = ImplFindItem( rItem.mpSet.get(), nId, 
rPos );
             if ( pFindSet )
                 return pFindSet;
         }
@@ -330,18 +329,17 @@ static ImplSplitSet* ImplFindItem( ImplSplitSet* pSet, 
sal_uInt16 nId, sal_uInt1
 
 static sal_uInt16 ImplFindItem( ImplSplitSet* pSet, vcl::Window* pWindow )
 {
-    size_t              nItems = pSet->mvItems.size();
     std::vector< ImplSplitItem >&     rItems = pSet->mvItems;
 
-    for ( size_t i = 0; i < nItems; i++ )
+    for ( auto& rItem : rItems )
     {
-        if ( rItems[i].mpWindow == pWindow )
-            return rItems[i].mnId;
+        if ( rItem.mpWindow == pWindow )
+            return rItem.mnId;
         else
         {
-            if ( rItems[i].mpSet )
+            if ( rItem.mpSet )
             {
-                sal_uInt16 nId = ImplFindItem( rItems[i].mpSet.get(), pWindow 
);
+                sal_uInt16 nId = ImplFindItem( rItem.mpSet.get(), pWindow );
                 if ( nId )
                     return nId;
             }
@@ -354,15 +352,14 @@ static sal_uInt16 ImplFindItem( ImplSplitSet* pSet, 
vcl::Window* pWindow )
 static sal_uInt16 ImplFindItem( ImplSplitSet* pSet, const Point& rPos,
                             bool bRows, bool bDown = true )
 {
-    size_t              nItems = pSet->mvItems.size();
     std::vector< ImplSplitItem >&     rItems = pSet->mvItems;
 
-    for ( size_t i = 0; i < nItems; i++ )
+    for ( auto& rItem : rItems )
     {
-        if ( rItems[i].mnWidth && rItems[i].mnHeight )
+        if ( rItem.mnWidth && rItem.mnHeight )
         {
-            Point       aPoint( rItems[i].mnLeft, rItems[i].mnTop );
-            Size        aSize( rItems[i].mnWidth, rItems[i].mnHeight );
+            Point       aPoint( rItem.mnLeft, rItem.mnTop );
+            Size        aSize( rItem.mnWidth, rItem.mnHeight );
             tools::Rectangle   aRect( aPoint, aSize );
             if ( bRows )
             {
@@ -381,13 +378,13 @@ static sal_uInt16 ImplFindItem( ImplSplitSet* pSet, const 
Point& rPos,
 
             if ( aRect.IsInside( rPos ) )
             {
-                if ( rItems[i].mpSet && !rItems[i].mpSet->mvItems.empty() )
+                if ( rItem.mpSet && !rItem.mpSet->mvItems.empty() )
                 {
-                    return ImplFindItem( rItems[i].mpSet.get(), rPos,
-                                        !(rItems[i].mnBits & 
SplitWindowItemFlags::ColSet) );
+                    return ImplFindItem( rItem.mpSet.get(), rPos,
+                                        !(rItem.mnBits & 
SplitWindowItemFlags::ColSet) );
                 }
                 else
-                    return rItems[i].mnId;
+                    return rItem.mnId;
             }
         }
     }
@@ -416,9 +413,9 @@ static void ImplCalcSet( ImplSplitSet* pSet,
 
     // get number of visible items
     nVisItems = 0;
-    for ( size_t i = 0; i < nItems; i++ )
+    for ( auto& rItem : rItems )
     {
-        if ( !(rItems[i].mnBits & SplitWindowItemFlags::Invisible) )
+        if ( !(rItem.mnBits & SplitWindowItemFlags::Invisible) )
             nVisItems++;
     }
 
@@ -436,16 +433,16 @@ static void ImplCalcSet( ImplSplitSet* pSet,
         long nRelPercent    = 0;
         long nAbsSize       = 0;
         long nCurSize       = 0;
-        for ( size_t i = 0; i < nItems; i++ )
+        for ( auto& rItem : rItems )
         {
-            if ( !(rItems[i].mnBits & SplitWindowItemFlags::Invisible) )
+            if ( !(rItem.mnBits & SplitWindowItemFlags::Invisible) )
             {
-                if ( rItems[i].mnBits & SplitWindowItemFlags::RelativeSize )
-                    nRelCount += rItems[i].mnSize;
-                else if ( rItems[i].mnBits & SplitWindowItemFlags::PercentSize 
)
-                    nPercent += rItems[i].mnSize;
+                if ( rItem.mnBits & SplitWindowItemFlags::RelativeSize )
+                    nRelCount += rItem.mnSize;
+                else if ( rItem.mnBits & SplitWindowItemFlags::PercentSize )
+                    nPercent += rItem.mnSize;
                 else
-                    nAbsSize += rItems[i].mnSize;
+                    nAbsSize += rItem.mnSize;
             }
         }
         // map relative values to percentages (percentage here one tenth of a 
procent)
@@ -469,27 +466,27 @@ static void ImplCalcSet( ImplSplitSet* pSet,
         if ( !nPercent )
             nPercent = 1;
         long nSizeDelta = nCalcSize-nAbsSize;
-        for ( size_t i = 0; i < nItems; i++ )
+        for ( auto& rItem : rItems )
         {
-            if ( rItems[i].mnBits & SplitWindowItemFlags::Invisible )
-                rItems[i].mnPixSize = 0;
-            else if ( rItems[i].mnBits & SplitWindowItemFlags::RelativeSize )
+            if ( rItem.mnBits & SplitWindowItemFlags::Invisible )
+                rItem.mnPixSize = 0;
+            else if ( rItem.mnBits & SplitWindowItemFlags::RelativeSize )
             {
                 if ( nSizeDelta <= 0 )
-                    rItems[i].mnPixSize = 0;
+                    rItem.mnPixSize = 0;
                 else
-                    rItems[i].mnPixSize = 
(nSizeDelta*rItems[i].mnSize*nRelPercent)/nPercent;
+                    rItem.mnPixSize = 
(nSizeDelta*rItem.mnSize*nRelPercent)/nPercent;
             }
-            else if ( rItems[i].mnBits & SplitWindowItemFlags::PercentSize )
+            else if ( rItem.mnBits & SplitWindowItemFlags::PercentSize )
             {
                 if ( nSizeDelta <= 0 )
-                    rItems[i].mnPixSize = 0;
+                    rItem.mnPixSize = 0;
                 else
-                    rItems[i].mnPixSize = 
(nSizeDelta*rItems[i].mnSize*nPercentFactor)/nPercent;
+                    rItem.mnPixSize = 
(nSizeDelta*rItem.mnSize*nPercentFactor)/nPercent;
             }
             else
-                rItems[i].mnPixSize = rItems[i].mnSize;
-            nCurSize += rItems[i].mnPixSize;
+                rItem.mnPixSize = rItem.mnSize;
+            nCurSize += rItem.mnPixSize;
         }
 
         pSet->mbCalcPix  = false;
@@ -503,14 +500,14 @@ static void ImplCalcSet( ImplSplitSet* pSet,
             long nSizeWinSize    = 0;
 
             // first resize absolute items relative
-            for ( size_t i = 0; i < nItems; i++ )
+            for ( auto& rItem : rItems )
             {
-                if ( !(rItems[i].mnBits & SplitWindowItemFlags::Invisible) )
+                if ( !(rItem.mnBits & SplitWindowItemFlags::Invisible) )
                 {
-                    if ( !(rItems[i].mnBits & 
(SplitWindowItemFlags::RelativeSize | SplitWindowItemFlags::PercentSize)) )
+                    if ( !(rItem.mnBits & (SplitWindowItemFlags::RelativeSize 
| SplitWindowItemFlags::PercentSize)) )
                     {
                         nAbsItems++;
-                        nSizeWinSize += rItems[i].mnPixSize;
+                        nSizeWinSize += rItem.mnPixSize;
                     }
                 }
             }
@@ -519,14 +516,14 @@ static void ImplCalcSet( ImplSplitSet* pSet,
             {
                 long nNewSizeWinSize = 0;
 
-                for ( size_t i = 0; i < nItems; i++ )
+                for ( auto& rItem : rItems )
                 {
-                    if ( !(rItems[i].mnBits & SplitWindowItemFlags::Invisible) 
)
+                    if ( !(rItem.mnBits & SplitWindowItemFlags::Invisible) )
                     {
-                        if ( !(rItems[i].mnBits & 
(SplitWindowItemFlags::RelativeSize | SplitWindowItemFlags::PercentSize)) )
+                        if ( !(rItem.mnBits & 
(SplitWindowItemFlags::RelativeSize | SplitWindowItemFlags::PercentSize)) )
                         {
-                            rItems[i].mnPixSize += 
(nSizeDelta*rItems[i].mnPixSize)/nSizeWinSize;
-                            nNewSizeWinSize += rItems[i].mnPixSize;
+                            rItem.mnPixSize += 
(nSizeDelta*rItem.mnPixSize)/nSizeWinSize;
+                            nNewSizeWinSize += rItem.mnPixSize;
                         }
                     }
                 }
@@ -543,30 +540,30 @@ static void ImplCalcSet( ImplSplitSet* pSet,
                 nCalcItems = 0;
                 while ( !nCalcItems )
                 {
-                    for ( size_t i = 0; i < nItems; i++ )
+                    for ( auto& rItem : rItems )
                     {
-                        rItems[i].mbSubSize = false;
+                        rItem.mbSubSize = false;
 
                         if ( j >= 2 )
-                            rItems[i].mbSubSize = true;
+                            rItem.mbSubSize = true;
                         else
                         {
-                            if ( !(rItems[i].mnBits & 
SplitWindowItemFlags::Invisible) )
+                            if ( !(rItem.mnBits & 
SplitWindowItemFlags::Invisible) )
                             {
-                                if ( (nSizeDelta > 0) || rItems[i].mnPixSize )
+                                if ( (nSizeDelta > 0) || rItem.mnPixSize )
                                 {
                                     if ( j >= 1 )
-                                        rItems[i].mbSubSize = true;
+                                        rItem.mbSubSize = true;
                                     else
                                     {
-                                        if ( (j == 0) && (rItems[i].mnBits & 
(SplitWindowItemFlags::RelativeSize | SplitWindowItemFlags::PercentSize)) )
-                                            rItems[i].mbSubSize = true;
+                                        if ( (j == 0) && (rItem.mnBits & 
(SplitWindowItemFlags::RelativeSize | SplitWindowItemFlags::PercentSize)) )
+                                            rItem.mbSubSize = true;
                                     }
                                 }
                             }
                         }
 
-                        if ( rItems[i].mbSubSize )
+                        if ( rItem.mbSubSize )
                             nCalcItems++;
                     }
 
@@ -577,13 +574,13 @@ static void ImplCalcSet( ImplSplitSet* pSet,
                 long nErrorSum       = nSizeDelta % nCalcItems;
                 long nCurSizeDelta   = nSizeDelta / nCalcItems;
                 nMins           = 0;
-                for ( size_t i = 0; i < nItems; i++ )
+                for ( auto& rItem : rItems )
                 {
-                    if ( rItems[i].mnBits & SplitWindowItemFlags::Invisible )
+                    if ( rItem.mnBits & SplitWindowItemFlags::Invisible )
                         nMins++;
-                    else if ( rItems[i].mbSubSize )
+                    else if ( rItem.mbSubSize )
                     {
-                        long* pSize = &(rItems[i].mnPixSize);
+                        long* pSize = &(rItem.mnPixSize);
                         long  nTempErr;
 
                         if ( nErrorSum )
@@ -720,34 +717,34 @@ static void ImplCalcSet( ImplSplitSet* pSet,
     }
 
     // calculate Sub-Set's
-    for ( size_t i = 0; i < nItems; i++ )
+    for ( auto& rItem : rItems )
     {
-        if ( rItems[i].mpSet && rItems[i].mnWidth && rItems[i].mnHeight )
+        if ( rItem.mpSet && rItem.mnWidth && rItem.mnHeight )
         {
-            ImplCalcSet( rItems[i].mpSet.get(),
-                         rItems[i].mnLeft, rItems[i].mnTop,
-                         rItems[i].mnWidth, rItems[i].mnHeight,
-                         !(rItems[i].mnBits & SplitWindowItemFlags::ColSet) );
+            ImplCalcSet( rItem.mpSet.get(),
+                         rItem.mnLeft, rItem.mnTop,
+                         rItem.mnWidth, rItem.mnHeight,
+                         !(rItem.mnBits & SplitWindowItemFlags::ColSet) );
         }
     }
 
     // set fixed
-    for ( size_t i = 0; i < nItems; i++ )
+    for ( auto& rItem : rItems )
     {
-        rItems[i].mbFixed = false;
-        if ( rItems[i].mnBits & SplitWindowItemFlags::Fixed )
-            rItems[i].mbFixed = true;
+        rItem.mbFixed = false;
+        if ( rItem.mnBits & SplitWindowItemFlags::Fixed )
+            rItem.mbFixed = true;
         else
         {
             // this item is also fixed if Child-Set is available,
             // if a child is fixed
-            if ( rItems[i].mpSet )
+            if ( rItem.mpSet )
             {
-                for ( auto const & j: rItems[i].mpSet->mvItems )
+                for ( auto const & j: rItem.mpSet->mvItems )
                 {
                     if ( j.mbFixed )
                     {
-                        rItems[i].mbFixed = true;
+                        rItem.mbFixed = true;
                         break;
                     }
                 }
@@ -759,64 +756,63 @@ static void ImplCalcSet( ImplSplitSet* pSet,
 void SplitWindow::ImplCalcSet2( SplitWindow* pWindow, ImplSplitSet* pSet, bool 
bHide,
                                 bool bRows )
 {
-    size_t              nItems = pSet->mvItems.size();
     std::vector< ImplSplitItem >&     rItems = pSet->mvItems;
 
     if ( pWindow->IsReallyVisible() && pWindow->IsUpdateMode() && 
pWindow->mbInvalidate )
     {
-        for ( size_t i = 0; i < nItems; i++ )
+        for ( auto& rItem : rItems )
         {
-            if ( rItems[i].mnSplitSize )
+            if ( rItem.mnSplitSize )
             {
                 // invalidate all, if applicable or only a small part
-                if ( (rItems[i].mnOldSplitPos  != rItems[i].mnSplitPos)  ||
-                     (rItems[i].mnOldSplitSize != rItems[i].mnSplitSize) ||
-                     (rItems[i].mnOldWidth     != rItems[i].mnWidth)     ||
-                     (rItems[i].mnOldHeight    != rItems[i].mnHeight) )
+                if ( (rItem.mnOldSplitPos  != rItem.mnSplitPos)  ||
+                     (rItem.mnOldSplitSize != rItem.mnSplitSize) ||
+                     (rItem.mnOldWidth     != rItem.mnWidth)     ||
+                     (rItem.mnOldHeight    != rItem.mnHeight) )
                 {
                     tools::Rectangle aRect;
 
                     // invalidate old rectangle
                     if ( bRows )
                     {
-                        aRect.SetLeft( rItems[i].mnLeft );
-                        aRect.SetRight( 
rItems[i].mnLeft+rItems[i].mnOldWidth-1 );
-                        aRect.SetTop( rItems[i].mnOldSplitPos );
-                        aRect.SetBottom( aRect.Top() + 
rItems[i].mnOldSplitSize );
+                        aRect.SetLeft( rItem.mnLeft );
+                        aRect.SetRight( rItem.mnLeft+rItem.mnOldWidth-1 );
+                        aRect.SetTop( rItem.mnOldSplitPos );
+                        aRect.SetBottom( aRect.Top() + rItem.mnOldSplitSize );
                     }
                     else
                     {
-                        aRect.SetTop( rItems[i].mnTop );
-                        aRect.SetBottom( 
rItems[i].mnTop+rItems[i].mnOldHeight-1 );
-                        aRect.SetLeft( rItems[i].mnOldSplitPos );
-                        aRect.SetRight( aRect.Left() + 
rItems[i].mnOldSplitSize );
+                        aRect.SetTop( rItem.mnTop );
+                        aRect.SetBottom( rItem.mnTop+rItem.mnOldHeight-1 );
+                        aRect.SetLeft( rItem.mnOldSplitPos );
+                        aRect.SetRight( aRect.Left() + rItem.mnOldSplitSize );
                     }
                     pWindow->Invalidate( aRect );
                     // invalidate new rectangle
                     if ( bRows )
                     {
-                        aRect.SetLeft( rItems[i].mnLeft );
-                        aRect.SetRight( rItems[i].mnLeft+rItems[i].mnWidth-1 );
-                        aRect.SetTop( rItems[i].mnSplitPos );
-                        aRect.SetBottom( aRect.Top() + rItems[i].mnSplitSize );
+                        aRect.SetLeft( rItem.mnLeft );
+                        aRect.SetRight( rItem.mnLeft+rItem.mnWidth-1 );
+                        aRect.SetTop( rItem.mnSplitPos );
+                        aRect.SetBottom( aRect.Top() + rItem.mnSplitSize );
                     }
                     else
                     {
-                        aRect.SetTop( rItems[i].mnTop );
-                        aRect.SetBottom( rItems[i].mnTop+rItems[i].mnHeight-1 
);
-                        aRect.SetLeft( rItems[i].mnSplitPos );
-                        aRect.SetRight( aRect.Left() + rItems[i].mnSplitSize );
+                        aRect.SetTop( rItem.mnTop );
+                        aRect.SetBottom( rItem.mnTop+rItem.mnHeight-1 );
+                        aRect.SetLeft( rItem.mnSplitPos );
+                        aRect.SetRight( aRect.Left() + rItem.mnSplitSize );
                     }
                     pWindow->Invalidate( aRect );
 
                     // invalidate complete set, as these areas
                     // are not cluttered by windows
-                    if ( rItems[i].mpSet && rItems[i].mpSet->mvItems.empty() )
+                    if ( rItem.mpSet && rItem.mpSet->mvItems.empty() )
                     {
-                        aRect.SetLeft( rItems[i].mnLeft );
-                        aRect.SetTop( rItems[i].mnTop );
-                        aRect.SetRight( rItems[i].mnLeft+rItems[i].mnWidth-1 );
-                        aRect.SetBottom( rItems[i].mnTop+rItems[i].mnHeight-1 
);
+                        aRect.SetLeft( rItem.mnLeft );
+                        aRect.SetTop( rItem.mnTop );
+                        aRect.SetRight( rItem.mnLeft+rItem.mnWidth-1 );
+                        aRect.SetBottom( rItem.mnTop+rItem.mnHeight-1 );
                         pWindow->Invalidate( aRect );
                     }
                 }
@@ -825,34 +821,34 @@ void SplitWindow::ImplCalcSet2( SplitWindow* pWindow, 
ImplSplitSet* pSet, bool b
     }
 
     // position windows
-    for ( size_t i = 0; i < nItems; i++ )
+    for ( auto& rItem : rItems )
     {
-        if ( rItems[i].mpSet )
+        if ( rItem.mpSet )
         {
             bool bTempHide = bHide;
-            if ( !rItems[i].mnWidth || !rItems[i].mnHeight )
+            if ( !rItem.mnWidth || !rItem.mnHeight )
                 bTempHide = true;
-            ImplCalcSet2( pWindow, rItems[i].mpSet.get(), bTempHide,
-                          !(rItems[i].mnBits & SplitWindowItemFlags::ColSet) );
+            ImplCalcSet2( pWindow, rItem.mpSet.get(), bTempHide,
+                          !(rItem.mnBits & SplitWindowItemFlags::ColSet) );
         }
         else
         {
-            if ( rItems[i].mnWidth && rItems[i].mnHeight && !bHide )
+            if ( rItem.mnWidth && rItem.mnHeight && !bHide )
             {
-                Point aPos( rItems[i].mnLeft, rItems[i].mnTop );
-                Size  aSize( rItems[i].mnWidth, rItems[i].mnHeight );
-                rItems[i].mpWindow->SetPosSizePixel( aPos, aSize );
+                Point aPos( rItem.mnLeft, rItem.mnTop );
+                Size  aSize( rItem.mnWidth, rItem.mnHeight );
+                rItem.mpWindow->SetPosSizePixel( aPos, aSize );
             }
             else
-                rItems[i].mpWindow->Hide();
+                rItem.mpWindow->Hide();
         }
     }
 
     // show windows and reset flag
-    for ( size_t i = 0; i < nItems; i++ )
+    for ( auto& rItem : rItems )
     {
-        if ( rItems[i].mpWindow && rItems[i].mnWidth && rItems[i].mnHeight && 
!bHide )
-            rItems[i].mpWindow->Show();
+        if ( rItem.mpWindow && rItem.mnWidth && rItem.mnHeight && !bHide )
+            rItem.mpWindow->Show();
     }
 }
 
@@ -894,28 +890,27 @@ static void ImplCalcLogSize( std::vector< ImplSplitItem > 
& rItems, size_t nItem
 
 void SplitWindow::ImplDrawBack(vcl::RenderContext& rRenderContext, 
ImplSplitSet* pSet)
 {
-    size_t          nItems = pSet->mvItems.size();
     std::vector< ImplSplitItem >& rItems = pSet->mvItems;
 
-    for (size_t i = 0; i < nItems; i++)
+    for ( auto& rItem : rItems )
     {
-        pSet = rItems[i].mpSet.get();
+        pSet = rItem.mpSet.get();
         if (pSet)
         {
             if (pSet->mpWallpaper)
             {
-                Point aPoint(rItems[i].mnLeft, rItems[i].mnTop);
-                Size aSize(rItems[i].mnWidth, rItems[i].mnHeight);
+                Point aPoint(rItem.mnLeft, rItem.mnTop);
+                Size aSize(rItem.mnWidth, rItem.mnHeight);
                 tools::Rectangle aRect(aPoint, aSize);
                 rRenderContext.DrawWallpaper(aRect, *pSet->mpWallpaper);
             }
         }
     }
 
-    for (size_t i = 0; i < nItems; i++)
+    for ( auto& rItem : rItems )
     {
-        if (rItems[i].mpSet)
-            ImplDrawBack(rRenderContext, rItems[i].mpSet.get());
+        if (rItem.mpSet)
+            ImplDrawBack(rRenderContext, rItem.mpSet.get());
     }
 }
 
@@ -990,11 +985,11 @@ static void ImplDrawSplit(vcl::RenderContext& 
rRenderContext, ImplSplitSet* pSet
         }
     }
 
-    for (size_t i = 0; i < nItems; i++)
+    for ( auto& rItem : rItems )
     {
-        if (rItems[i].mpSet && rItems[i].mnWidth && rItems[i].mnHeight)
+        if (rItem.mpSet && rItem.mnWidth && rItem.mnHeight)
         {
-            ImplDrawSplit(rRenderContext, rItems[i].mpSet.get(), 
!(rItems[i].mnBits & SplitWindowItemFlags::ColSet), true/*bDown*/);
+            ImplDrawSplit(rRenderContext, rItem.mpSet.get(), !(rItem.mnBits & 
SplitWindowItemFlags::ColSet), true/*bDown*/);
         }
     }
 }
@@ -1061,13 +1056,13 @@ sal_uInt16 SplitWindow::ImplTestSplit( ImplSplitSet* 
pSet, const Point& rPos,
         }
     }
 
-    for ( size_t i = 0; i < nItems; i++ )
+    for ( auto& rItem : rItems )
     {
-        if ( rItems[i].mpSet )
+        if ( rItem.mpSet )
         {
-            nSplitTest = ImplTestSplit( rItems[i].mpSet.get(), rPos,
+            nSplitTest = ImplTestSplit( rItem.mpSet.get(), rPos,
                                        rMouseOff, ppFoundSet, rFoundPos,
-                                       !(rItems[i].mnBits & 
SplitWindowItemFlags::ColSet) );
+                                       !(rItem.mnBits & 
SplitWindowItemFlags::ColSet) );
             if ( nSplitTest )
                 return nSplitTest;
         }
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index 3f5ac56b279a..eadf77c4d3a3 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -2612,11 +2612,7 @@ bool 
XMLTextImportHelper::FindAndRemoveBookmarkStartRange(
         o_rXmlId = std::get<1>(rEntry);
         o_rpRDFaAttributes = std::get<2>(rEntry);
         m_xImpl->m_BookmarkStartRanges.erase(sName);
-        auto it(m_xImpl->m_BookmarkVector.begin());
-        while (it != m_xImpl->m_BookmarkVector.end() && *it != sName)
-        {
-            ++it;
-        }
+        auto it = std::find(m_xImpl->m_BookmarkVector.begin(), 
m_xImpl->m_BookmarkVector.end(), sName);
         if (it!=m_xImpl->m_BookmarkVector.end())
         {
             m_xImpl->m_BookmarkVector.erase(it);
diff --git a/xmlsecurity/source/dialogs/resourcemanager.cxx 
b/xmlsecurity/source/dialogs/resourcemanager.cxx
index a47cedc3d260..3b2db2a800eb 100644
--- a/xmlsecurity/source/dialogs/resourcemanager.cxx
+++ b/xmlsecurity/source/dialogs/resourcemanager.cxx
@@ -311,14 +311,10 @@ vector< pair< OUString, OUString> > parseDN(const 
OUString& rRawString)
         while ( aIDs[i] )
         {
             OUString sPartId = OUString::createFromAscii( aIDs[i++] );
-            for (auto idn = vecAttrValueOfDN.cbegin(); idn != 
vecAttrValueOfDN.cend(); ++idn)
-            {
-                if (idn->first == sPartId)
-                {
-                    retVal = idn->second;
-                    break;
-                }
-            }
+            auto idn = std::find_if(vecAttrValueOfDN.cbegin(), 
vecAttrValueOfDN.cend(),
+                [&sPartId](const pair< OUString, OUString >& dn) { return 
dn.first == sPartId; });
+            if (idn != vecAttrValueOfDN.cend())
+                retVal = idn->second;
             if (!retVal.isEmpty())
                 break;
         }
diff --git a/xmlsecurity/source/helper/documentsignaturehelper.cxx 
b/xmlsecurity/source/helper/documentsignaturehelper.cxx
index a567b90aa6da..db05059b31df 100644
--- a/xmlsecurity/source/helper/documentsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/documentsignaturehelper.cxx
@@ -142,17 +142,9 @@ bool DocumentSignatureHelper::isODFPre_1_2(const OUString 
& sVersion)
 
 bool DocumentSignatureHelper::isOOo3_2_Signature(const SignatureInformation & 
sigInfo)
 {
-    bool bOOo3_2 = false;
-    for (auto i = sigInfo.vSignatureReferenceInfors.cbegin();
-        i < sigInfo.vSignatureReferenceInfors.cend(); ++i)
-    {
-        if (i->ouURI == "META-INF/manifest.xml")
-        {
-            bOOo3_2 = true;
-            break;
-        }
-    }
-    return  bOOo3_2;
+    return std::any_of(sigInfo.vSignatureReferenceInfors.cbegin(),
+                       sigInfo.vSignatureReferenceInfors.cend(),
+                       [](const SignatureReferenceInformation& info) { return 
info.ouURI == "META-INF/manifest.xml"; });
 }
 
 DocumentSignatureAlgorithm
diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx 
b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index 7fb84e177dfa..3f928b05bcc8 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -113,9 +113,9 @@ SecurityEnvironment_NssImpl::~SecurityEnvironment_NssImpl() 
{
 
     PK11_SetPasswordFunc( nullptr ) ;
 
-    for (auto i = m_Slots.cbegin(); i != m_Slots.cend(); i++)
+    for (auto& slot : m_Slots)
     {
-        PK11_FreeSlot(*i);
+        PK11_FreeSlot(slot);
     }
 
     if( !m_tSymKeyList.empty()  ) {
@@ -185,9 +185,9 @@ const Sequence< sal_Int8>& 
SecurityEnvironment_NssImpl::getUnoTunnelId() {
 OUString SecurityEnvironment_NssImpl::getSecurityEnvironmentInformation()
 {
     OUStringBuffer buff;
-    for (auto is = m_Slots.cbegin(); is != m_Slots.cend(); ++is)
+    for (auto& slot : m_Slots)
     {
-        buff.append(OUString::createFromAscii(PK11_GetTokenName(*is)));
+        buff.append(OUString::createFromAscii(PK11_GetTokenName(slot)));
         buff.append("\n");
     }
     return buff.makeStringAndClear();
@@ -291,9 +291,8 @@ SecurityEnvironment_NssImpl::getPersonalCertificates()
 
     updateSlots();
     //firstly, we try to find private keys in slot
-    for (auto is = m_Slots.cbegin(); is != m_Slots.cend(); ++is)
+    for (auto& slot : m_Slots)
     {
-        PK11SlotInfo *slot = *is;
         SECKEYPrivateKeyList* priKeyList ;
 
         if( PK11_NeedLogin(slot ) ) {
@@ -765,9 +764,9 @@ sal_Int32 
SecurityEnvironment_NssImpl::getCertificateCharacters(
     }
     if(priKey == nullptr)
     {
-        for (auto is = m_Slots.cbegin(); is != m_Slots.cend(); ++is)
+        for (auto& slot : m_Slots)
         {
-            priKey = PK11_FindPrivateKeyFromCert(*is, 
const_cast<CERTCertificate*>(cert), nullptr);
+            priKey = PK11_FindPrivateKeyFromCert(slot, 
const_cast<CERTCertificate*>(cert), nullptr);
             if (priKey)
                 break;
         }
@@ -832,8 +831,11 @@ xmlSecKeysMngrPtr 
SecurityEnvironment_NssImpl::createKeysManager() {
     std::unique_ptr<PK11SlotInfo*[]> sarSlots(new PK11SlotInfo*[cSlots]);
     PK11SlotInfo**  slots = sarSlots.get();
     int count = 0;
-    for (auto islots = m_Slots.cbegin();islots != m_Slots.cend(); ++islots, 
++count)
-        slots[count] = *islots;
+    for (auto& slot : m_Slots)
+    {
+        slots[count] = slot;
+        ++count;
+    }
 
     xmlSecKeysMngrPtr pKeysMngr = xmlSecKeysMngrCreate();
     if (!pKeysMngr)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to