[Libreoffice-commits] core.git: framework/source

Julien Nabet serval2412 at yahoo.fr
Sat Mar 17 22:09:10 UTC 2018


 framework/source/accelerators/acceleratorcache.cxx                |   16 
 framework/source/accelerators/acceleratorconfiguration.cxx        |   78 +--
 framework/source/accelerators/storageholder.cxx                   |   62 --
 framework/source/classes/framecontainer.cxx                       |   14 
 framework/source/dispatch/dispatchdisabler.cxx                    |    4 
 framework/source/dispatch/interceptionhelper.cxx                  |   19 
 framework/source/fwe/xml/saxnamespacefilter.cxx                   |    8 
 framework/source/fwi/classes/protocolhandlercache.cxx             |    6 
 framework/source/jobs/jobexecutor.cxx                             |    7 
 framework/source/layoutmanager/toolbarlayoutmanager.cxx           |  197 +++-----
 framework/source/recording/dispatchrecorder.cxx                   |    5 
 framework/source/services/ContextChangeEventMultiplexer.cxx       |   24 -
 framework/source/services/autorecovery.cxx                        |  182 +++----
 framework/source/services/frame.cxx                               |    7 
 framework/source/services/modulemanager.cxx                       |   10 
 framework/source/services/pathsettings.cxx                        |   90 +--
 framework/source/uiconfiguration/ImplImageList.cxx                |    8 
 framework/source/uiconfiguration/imagemanagerimpl.cxx             |   29 -
 framework/source/uiconfiguration/moduleuicfgsupplier.cxx          |    6 
 framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx |   64 +-
 framework/source/uiconfiguration/uiconfigurationmanager.cxx       |   39 -
 framework/source/uielement/langselectionmenucontroller.cxx        |   16 
 framework/source/uielement/langselectionstatusbarcontroller.cxx   |   29 -
 framework/source/uielement/menubarmanager.cxx                     |  235 ++++------
 framework/source/uielement/toolbarmanager.cxx                     |    7 
 framework/source/uielement/toolbarsmenucontroller.cxx             |   12 
 framework/source/xml/acceleratorconfigurationwriter.cxx           |   15 
 27 files changed, 480 insertions(+), 709 deletions(-)

New commits:
commit 823ef9ef3238efd92895254e0f8042ff1e543bb6
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Sat Mar 17 21:42:27 2018 +0100

    Use for-range loops in framework
    
    Change-Id: I72ea832848fd7c76863bcee70a3303de488c0b0f
    Reviewed-on: https://gerrit.libreoffice.org/51471
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/framework/source/accelerators/acceleratorcache.cxx b/framework/source/accelerators/acceleratorcache.cxx
index ec5d35323953..18512cc826cf 100644
--- a/framework/source/accelerators/acceleratorcache.cxx
+++ b/framework/source/accelerators/acceleratorcache.cxx
@@ -71,13 +71,9 @@ AcceleratorCache::TKeyList AcceleratorCache::getAllKeys() const
     TKeyList lKeys;
     lKeys.reserve(m_lKey2Commands.size());
 
-    TKey2Commands::const_iterator pIt;
-    TKey2Commands::const_iterator pEnd = m_lKey2Commands.end();
-    for (  pIt  = m_lKey2Commands.begin();
-           pIt != pEnd;
-         ++pIt                           )
+    for (auto const& key2Command : m_lKey2Commands)
     {
-        lKeys.push_back(pIt->first);
+        lKeys.push_back(key2Command.first);
     }
 
     return lKeys;
@@ -141,13 +137,9 @@ void AcceleratorCache::removeCommand(const OUString& sCommand)
     SolarMutexGuard g;
 
     const TKeyList&                            lKeys = getKeysByCommand(sCommand);
-    AcceleratorCache::TKeyList::const_iterator pKey;
-    for (  pKey  = lKeys.begin();
-           pKey != lKeys.end();
-         ++pKey                 )
+    for (auto const& lKey : lKeys)
     {
-        const css::awt::KeyEvent& rKey = *pKey;
-        removeKey(rKey);
+        removeKey(lKey);
     }
     m_lCommand2Keys.erase(sCommand);
 }
diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx
index 935d9f399fda..276cb4547936 100644
--- a/framework/source/accelerators/acceleratorconfiguration.cxx
+++ b/framework/source/accelerators/acceleratorconfiguration.cxx
@@ -507,10 +507,8 @@ css::uno::Sequence< css::awt::KeyEvent > SAL_CALL XCUBasedAcceleratorConfigurati
 
     AcceleratorCache::TKeyList lSecondaryKeys = impl_getCFG(false).getAllKeys(); //get keys from SecondaryKeys set
     lKeys.reserve(lKeys.size()+lSecondaryKeys.size());
-    AcceleratorCache::TKeyList::const_iterator pIt;
-    AcceleratorCache::TKeyList::const_iterator pEnd = lSecondaryKeys.end();
-    for ( pIt  = lSecondaryKeys.begin(); pIt != pEnd; ++pIt )
-        lKeys.push_back(*pIt);
+    for (auto const& secondaryKey : lSecondaryKeys)
+        lKeys.push_back(secondaryKey);
 
     return comphelper::containerToSequence(lKeys);
 }
@@ -671,9 +669,8 @@ css::uno::Sequence< css::awt::KeyEvent > SAL_CALL XCUBasedAcceleratorConfigurati
     AcceleratorCache::TKeyList lKeys  = rPrimaryCache.getKeysByCommand(sCommand);
 
     AcceleratorCache::TKeyList lSecondaryKeys = rSecondaryCache.getKeysByCommand(sCommand);
-    AcceleratorCache::TKeyList::const_iterator pIt;
-    for (pIt = lSecondaryKeys.begin(); pIt != lSecondaryKeys.end(); ++pIt)
-        lKeys.push_back(*pIt);
+    for (auto const& secondaryKey : lSecondaryKeys)
+        lKeys.push_back(secondaryKey);
 
     return comphelper::containerToSequence(lKeys);
 }
@@ -845,14 +842,14 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::storeToStorage(const css::uno::R
         if (m_pSecondaryWriteCache!=nullptr)
         {
             lKeys = m_pSecondaryWriteCache->getAllKeys();
-            for ( pIt=lKeys.begin(); pIt!=lKeys.end(); ++pIt )
-                aCache.setKeyCommandPair(*pIt, m_pSecondaryWriteCache->getCommandByKey(*pIt));
+            for (auto const& lKey : lKeys)
+                aCache.setKeyCommandPair(lKey, m_pSecondaryWriteCache->getCommandByKey(lKey));
         }
         else
         {
             lKeys = m_aSecondaryReadCache.getAllKeys();
-            for ( pIt=lKeys.begin(); pIt!=lKeys.end(); ++pIt )
-                aCache.setKeyCommandPair(*pIt, m_aSecondaryReadCache.getCommandByKey(*pIt));
+            for (auto const& lKey : lKeys)
+                aCache.setKeyCommandPair(lKey, m_aSecondaryReadCache.getCommandByKey(lKey));
         }
     }
 
@@ -1019,26 +1016,31 @@ void XCUBasedAcceleratorConfiguration::impl_ts_load( bool bPreferred, const css:
             for ( sal_Int32 j=0; j<nLocales; ++j )
                 aLocales.push_back(lLocales[j]);
 
-            ::std::vector< OUString >::const_iterator pFound;
-            for ( pFound = aLocales.begin(); pFound != aLocales.end(); ++pFound )
+            OUString sLocale;
+            for (auto const& locale : aLocales)
             {
-                if ( *pFound == sIsoLang )
+                if ( locale == sIsoLang )
+                {
+                    sLocale = locale;
                     break;
+                }
             }
 
-            if ( pFound == aLocales.end() )
+            if (sLocale.isEmpty())
             {
-                for ( pFound = aLocales.begin(); pFound != aLocales.end(); ++pFound )
+                for (auto const& locale : aLocales)
                 {
-                    if ( *pFound == sDefaultLocale )
+                    if ( locale == sDefaultLocale )
+                    {
+                        sLocale = locale;
                         break;
+                    }
                 }
 
-                if ( pFound == aLocales.end() )
+                if (sLocale.isEmpty())
                     continue;
             }
 
-            OUString sLocale = *pFound;
             OUString sCommand;
             xCommand->getByName(sLocale) >>= sCommand;
             if (sCommand.isEmpty())
@@ -1096,28 +1098,27 @@ void XCUBasedAcceleratorConfiguration::impl_ts_save(bool bPreferred)
 {
     if (bPreferred)
     {
-        AcceleratorCache::TKeyList::const_iterator pIt;
         AcceleratorCache::TKeyList lPrimaryReadKeys  = m_aPrimaryReadCache.getAllKeys();
         AcceleratorCache::TKeyList lPrimaryWriteKeys = m_pPrimaryWriteCache->getAllKeys();
 
-        for ( pIt  = lPrimaryReadKeys.begin(); pIt != lPrimaryReadKeys.end(); ++pIt )
+        for (auto const& primaryReadKey : lPrimaryReadKeys)
         {
-            if (!m_pPrimaryWriteCache->hasKey(*pIt))
-                removeKeyFromConfiguration(*pIt, true);
+            if (!m_pPrimaryWriteCache->hasKey(primaryReadKey))
+                removeKeyFromConfiguration(primaryReadKey, true);
         }
 
-        for ( pIt  = lPrimaryWriteKeys.begin(); pIt != lPrimaryWriteKeys.end(); ++pIt )
+        for (auto const& primaryWriteKey : lPrimaryWriteKeys)
         {
-            OUString sCommand = m_pPrimaryWriteCache->getCommandByKey(*pIt);
-            if (!m_aPrimaryReadCache.hasKey(*pIt))
+            OUString sCommand = m_pPrimaryWriteCache->getCommandByKey(primaryWriteKey);
+            if (!m_aPrimaryReadCache.hasKey(primaryWriteKey))
             {
-                insertKeyToConfiguration(*pIt, sCommand, true);
+                insertKeyToConfiguration(primaryWriteKey, sCommand, true);
             }
             else
             {
-                OUString sReadCommand = m_aPrimaryReadCache.getCommandByKey(*pIt);
+                OUString sReadCommand = m_aPrimaryReadCache.getCommandByKey(primaryWriteKey);
                 if (sReadCommand != sCommand)
-                    insertKeyToConfiguration(*pIt, sCommand, true);
+                    insertKeyToConfiguration(primaryWriteKey, sCommand, true);
             }
         }
 
@@ -1135,28 +1136,27 @@ void XCUBasedAcceleratorConfiguration::impl_ts_save(bool bPreferred)
 
     else
     {
-        AcceleratorCache::TKeyList::const_iterator pIt;
         AcceleratorCache::TKeyList lSecondaryReadKeys  = m_aSecondaryReadCache.getAllKeys();
         AcceleratorCache::TKeyList lSecondaryWriteKeys = m_pSecondaryWriteCache->getAllKeys();
 
-        for ( pIt  = lSecondaryReadKeys.begin(); pIt != lSecondaryReadKeys.end(); ++pIt)
+        for (auto const& secondaryReadKey : lSecondaryReadKeys)
         {
-            if (!m_pSecondaryWriteCache->hasKey(*pIt))
-                removeKeyFromConfiguration(*pIt, false);
+            if (!m_pSecondaryWriteCache->hasKey(secondaryReadKey))
+                removeKeyFromConfiguration(secondaryReadKey, false);
         }
 
-        for ( pIt  = lSecondaryWriteKeys.begin(); pIt != lSecondaryWriteKeys.end(); ++pIt )
+        for (auto const& secondaryWriteKey : lSecondaryWriteKeys)
         {
-            OUString sCommand = m_pSecondaryWriteCache->getCommandByKey(*pIt);
-            if (!m_aSecondaryReadCache.hasKey(*pIt))
+            OUString sCommand = m_pSecondaryWriteCache->getCommandByKey(secondaryWriteKey);
+            if (!m_aSecondaryReadCache.hasKey(secondaryWriteKey))
             {
-                insertKeyToConfiguration(*pIt, sCommand, false);
+                insertKeyToConfiguration(secondaryWriteKey, sCommand, false);
             }
             else
             {
-                OUString sReadCommand = m_aSecondaryReadCache.getCommandByKey(*pIt);
+                OUString sReadCommand = m_aSecondaryReadCache.getCommandByKey(secondaryWriteKey);
                 if (sReadCommand != sCommand)
-                    insertKeyToConfiguration(*pIt, sCommand, false);
+                    insertKeyToConfiguration(secondaryWriteKey, sCommand, false);
             }
         }
 
diff --git a/framework/source/accelerators/storageholder.cxx b/framework/source/accelerators/storageholder.cxx
index b444fa30da27..1cf4ca98719d 100644
--- a/framework/source/accelerators/storageholder.cxx
+++ b/framework/source/accelerators/storageholder.cxx
@@ -59,12 +59,9 @@ StorageHolder::~StorageHolder()
 void StorageHolder::forgetCachedStorages()
 {
     osl::MutexGuard g(m_mutex);
-    TPath2StorageInfo::iterator pIt;
-    for (  pIt  = m_lStorages.begin();
-           pIt != m_lStorages.end();
-         ++pIt                       )
+    for (auto & lStorage : m_lStorages)
     {
-        TStorageInfo& rInfo = pIt->second;
+        TStorageInfo& rInfo = lStorage.second;
         // TODO think about listener !
         rInfo.Storage.clear();
     }
@@ -97,14 +94,10 @@ css::uno::Reference< css::embed::XStorage > StorageHolder::openPath(const OUStri
 
     css::uno::Reference< css::embed::XStorage > xChild;
     OUString                             sRelPath;
-    std::vector<OUString>::const_iterator                pIt;
 
-    for (  pIt  = lFolders.begin();
-           pIt != lFolders.end();
-         ++pIt                    )
+    for (auto const& lFolder : lFolders)
     {
-        const OUString& sChild     = *pIt;
-              OUString  sCheckPath (sRelPath + sChild + PATH_SEPARATOR);
+        OUString  sCheckPath (sRelPath + lFolder + PATH_SEPARATOR);
 
         // SAFE -> ------------------------------
         aReadLock.reset();
@@ -129,7 +122,7 @@ css::uno::Reference< css::embed::XStorage > StorageHolder::openPath(const OUStri
 
             try
             {
-                xChild = StorageHolder::openSubStorageWithFallback(xParent, sChild, nOpenMode); // TODO think about delegating fallback decision to our own caller!
+                xChild = StorageHolder::openSubStorageWithFallback(xParent, lFolder, nOpenMode); // TODO think about delegating fallback decision to our own caller!
             }
             catch(const css::uno::RuntimeException&)
                 { throw; }
@@ -155,7 +148,7 @@ css::uno::Reference< css::embed::XStorage > StorageHolder::openPath(const OUStri
         }
 
         xParent   = xChild;
-        sRelPath += sChild + PATH_SEPARATOR;
+        sRelPath += lFolder + PATH_SEPARATOR;
     }
 
     // TODO think about return last storage as working storage ... but don't caching it inside this holder!
@@ -171,16 +164,12 @@ StorageHolder::TStorageList StorageHolder::getAllPathStorages(const OUString& sP
 
     StorageHolder::TStorageList  lStoragesOfPath;
     OUString              sRelPath;
-    std::vector<OUString>::const_iterator pIt;
 
     osl::MutexGuard g(m_mutex);
 
-    for (  pIt  = lFolders.begin();
-           pIt != lFolders.end();
-         ++pIt                    )
+    for (auto const& lFolder : lFolders)
     {
-        const OUString& sChild     = *pIt;
-              OUString  sCheckPath (sRelPath + sChild + PATH_SEPARATOR);
+        OUString  sCheckPath (sRelPath + lFolder + PATH_SEPARATOR);
 
         TPath2StorageInfo::iterator pCheck = m_lStorages.find(sCheckPath);
         if (pCheck == m_lStorages.end())
@@ -194,7 +183,7 @@ StorageHolder::TStorageList StorageHolder::getAllPathStorages(const OUString& sP
         TStorageInfo& rInfo = pCheck->second;
         lStoragesOfPath.push_back(rInfo.Storage);
 
-        sRelPath += sChild + PATH_SEPARATOR;
+        sRelPath += lFolder + PATH_SEPARATOR;
     }
 
     return lStoragesOfPath;
@@ -236,14 +225,11 @@ void StorageHolder::closePath(const OUString& rPath)
         [1] = "path_2" => "path_1/path_2"
         [2] = "path_3" => "path_1/path_2/path_3"
     */
-    std::vector<OUString>::iterator pIt1;
     OUString        sParentPath;
-    for (  pIt1  = lFolders.begin();
-           pIt1 != lFolders.end();
-         ++pIt1                    )
+    for (auto & lFolder : lFolders)
     {
-        OUString sCurrentRelPath(sParentPath + *pIt1 + PATH_SEPARATOR);
-        *pIt1       = sCurrentRelPath;
+        OUString sCurrentRelPath(sParentPath + lFolder + PATH_SEPARATOR);
+        lFolder = sCurrentRelPath;
         sParentPath = sCurrentRelPath;
     }
 
@@ -280,14 +266,10 @@ void StorageHolder::notifyPath(const OUString& sPath)
         return;
 
     TStorageInfo& rInfo = pIt1->second;
-    TStorageListenerList::iterator pIt2;
-    for (  pIt2  = rInfo.Listener.begin();
-           pIt2 != rInfo.Listener.end();
-         ++pIt2                          )
+    for (auto const& listener : rInfo.Listener)
     {
-        XMLBasedAcceleratorConfiguration* pListener = *pIt2;
-        if (pListener)
-            pListener->changesOccurred();
+        if (listener)
+            listener->changesOccurred();
     }
 }
 
@@ -329,20 +311,14 @@ OUString StorageHolder::getPathOfStorage(const css::uno::Reference< css::embed::
 {
     osl::MutexGuard g(m_mutex);
 
-    TPath2StorageInfo::const_iterator pIt;
-    for (  pIt  = m_lStorages.begin();
-           pIt != m_lStorages.end();
-         ++pIt                       )
+    for (auto const& lStorage : m_lStorages)
     {
-        const TStorageInfo& rInfo = pIt->second;
+        const TStorageInfo& rInfo = lStorage.second;
         if (rInfo.Storage == xStorage)
-            break;
+            return lStorage.first;
     }
 
-    if (pIt == m_lStorages.end())
-        return OUString();
-
-    return pIt->first;
+    return OUString();
 }
 
 css::uno::Reference< css::embed::XStorage > StorageHolder::getParentStorage(const css::uno::Reference< css::embed::XStorage >& xChild)
diff --git a/framework/source/classes/framecontainer.cxx b/framework/source/classes/framecontainer.cxx
index a8b028e57822..2e994423e89e 100644
--- a/framework/source/classes/framecontainer.cxx
+++ b/framework/source/classes/framecontainer.cxx
@@ -242,16 +242,16 @@ css::uno::Reference< css::frame::XFrame > FrameContainer::searchOnAllChildrens(
     // Step over all child frames. But if direct child isn't the right one search on his children first - before
     // you go to next direct child of this container!
     css::uno::Reference< css::frame::XFrame > xSearchedFrame;
-    for( TFrameContainer::const_iterator pIterator=m_aContainer.begin(); pIterator!=m_aContainer.end(); ++pIterator )
+    for (auto const& container : m_aContainer)
     {
-        if ((*pIterator)->getName()==sName)
+        if (container->getName()==sName)
         {
-            xSearchedFrame = *pIterator;
+            xSearchedFrame = container;
             break;
         }
         else
         {
-            xSearchedFrame = (*pIterator)->findFrame( sName, css::frame::FrameSearchFlag::CHILDREN );
+            xSearchedFrame = container->findFrame( sName, css::frame::FrameSearchFlag::CHILDREN );
             if (xSearchedFrame.is())
                 break;
         }
@@ -274,11 +274,11 @@ css::uno::Reference< css::frame::XFrame > FrameContainer::searchOnDirectChildren
 {
     SolarMutexGuard g;
     css::uno::Reference< css::frame::XFrame > xSearchedFrame;
-    for( TFrameContainer::const_iterator pIterator=m_aContainer.begin(); pIterator!=m_aContainer.end(); ++pIterator )
+    for (auto const& container : m_aContainer)
     {
-        if ((*pIterator)->getName()==sName)
+        if (container->getName()==sName)
         {
-            xSearchedFrame = *pIterator;
+            xSearchedFrame = container;
             break;
         }
     }
diff --git a/framework/source/dispatch/dispatchdisabler.cxx b/framework/source/dispatch/dispatchdisabler.cxx
index 9fa3f99b3d30..b847031bf742 100644
--- a/framework/source/dispatch/dispatchdisabler.cxx
+++ b/framework/source/dispatch/dispatchdisabler.cxx
@@ -87,8 +87,8 @@ uno::Sequence< OUString > SAL_CALL
 {
     uno::Sequence< OUString > aDisabledURLs(maDisabledURLs.size());
     sal_Int32 n = 0;
-    for (auto i = maDisabledURLs.begin(); i != maDisabledURLs.end(); ++i)
-        aDisabledURLs[n++] = *i;
+    for (auto const& disabledURL : maDisabledURLs)
+        aDisabledURLs[n++] = disabledURL;
     return aDisabledURLs;
 }
 
diff --git a/framework/source/dispatch/interceptionhelper.cxx b/framework/source/dispatch/interceptionhelper.cxx
index 8e478f2dc101..819e96475393 100644
--- a/framework/source/dispatch/interceptionhelper.cxx
+++ b/framework/source/dispatch/interceptionhelper.cxx
@@ -54,13 +54,12 @@ css::uno::Reference< css::frame::XDispatch > SAL_CALL InterceptionHelper::queryD
     //    Find first interceptor w/o pattern, so we need to query it
     if (!xInterceptor.is() && m_lInterceptionRegs.size()>0)
     {
-        InterceptorList::const_iterator pIt2;
-        for (pIt2=m_lInterceptionRegs.begin(); pIt2!=m_lInterceptionRegs.end(); ++pIt2)
+        for (auto const& lInterceptionReg : m_lInterceptionRegs)
         {
-            if (!pIt2->lURLPattern.getLength())
+            if (!lInterceptionReg.lURLPattern.getLength())
             {
                 // no pattern -> need to ask this guy!
-                xInterceptor = pIt2->xInterceptor;
+                xInterceptor = lInterceptionReg.xInterceptor;
                 break;
             }
         }
@@ -229,17 +228,13 @@ void SAL_CALL InterceptionHelper::disposing(const css::lang::EventObject& aEvent
     aReadLock.clear();
     // <- SAFE
 
-    InterceptionHelper::InterceptorList::iterator pIt;
-    for (  pIt  = aCopy.begin();
-           pIt != aCopy.end();
-         ++pIt                 )
+    for (auto & elem : aCopy)
     {
-        InterceptionHelper::InterceptorInfo& rInfo = *pIt;
-        if (rInfo.xInterceptor.is())
+        if (elem.xInterceptor.is())
         {
-            css::uno::Reference< css::frame::XDispatchProviderInterceptor > xInterceptor(rInfo.xInterceptor, css::uno::UNO_QUERY_THROW);
+            css::uno::Reference< css::frame::XDispatchProviderInterceptor > xInterceptor(elem.xInterceptor, css::uno::UNO_QUERY_THROW);
             releaseDispatchProviderInterceptor(xInterceptor);
-            rInfo.xInterceptor.clear();
+            elem.xInterceptor.clear();
         }
     }
 
diff --git a/framework/source/fwe/xml/saxnamespacefilter.cxx b/framework/source/fwe/xml/saxnamespacefilter.cxx
index 9f24552d3232..44abd1d03aef 100644
--- a/framework/source/fwe/xml/saxnamespacefilter.cxx
+++ b/framework/source/fwe/xml/saxnamespacefilter.cxx
@@ -84,12 +84,10 @@ void SAL_CALL SaxNamespaceFilter::startElement(
     try
     {
         // apply namespaces to all remaining attributes
-        for ( ::std::vector< sal_Int16 >::const_iterator i(
-                  aAttributeIndexes.begin());
-              i != aAttributeIndexes.end(); ++i )
+        for (auto const& attributeIndex : aAttributeIndexes)
         {
-            OUString aAttributeName           = xAttribs->getNameByIndex( *i );
-            OUString aValue                   = xAttribs->getValueByIndex( *i );
+            OUString aAttributeName           = xAttribs->getNameByIndex(attributeIndex);
+            OUString aValue                   = xAttribs->getValueByIndex(attributeIndex);
             OUString aNamespaceAttributeName = aXMLNamespaces.applyNSToAttributeName( aAttributeName );
             pNewList->AddAttribute( aNamespaceAttributeName, m_aXMLAttributeType, aValue );
         }
diff --git a/framework/source/fwi/classes/protocolhandlercache.cxx b/framework/source/fwi/classes/protocolhandlercache.cxx
index 917990fef18d..8ae9441727ab 100644
--- a/framework/source/fwi/classes/protocolhandlercache.cxx
+++ b/framework/source/fwi/classes/protocolhandlercache.cxx
@@ -240,11 +240,9 @@ void HandlerCFGAccess::read( HandlerHash** ppHandler ,
         aHandler.m_lProtocols = Converter::convert_seqOUString2OUStringList(lTemp);
 
         // register his pattern into the performance search hash
-        for (std::vector<OUString>::iterator pItem =aHandler.m_lProtocols.begin();
-                                    pItem!=aHandler.m_lProtocols.end();
-                                    ++pItem                             )
+        for (auto const& item : aHandler.m_lProtocols)
         {
-            (**ppPattern)[*pItem] = lNames[nSource];
+            (**ppPattern)[item] = lNames[nSource];
         }
 
         // insert the handler info into the normal handler cache
diff --git a/framework/source/jobs/jobexecutor.cxx b/framework/source/jobs/jobexecutor.cxx
index 7c9d70479120..ac76776a2934 100644
--- a/framework/source/jobs/jobexecutor.cxx
+++ b/framework/source/jobs/jobexecutor.cxx
@@ -293,17 +293,14 @@ void SAL_CALL JobExecutor::notifyEvent( const css::document::EventObject& aEvent
     } /* SAFE */
 
     // step over all enabled jobs and execute it
-    ::std::vector< JobData::TJob2DocEventBinding >::const_iterator pIt;
-    for (  pIt  = lJobs.begin();
-           pIt != lJobs.end();
-         ++pIt                 )
+    for (auto const& lJob : lJobs)
     {
         rtl::Reference<Job> pJob;
 
         /* SAFE */ {
         SolarMutexGuard g2;
 
-        const JobData::TJob2DocEventBinding& rBinding = *pIt;
+        const JobData::TJob2DocEventBinding& rBinding = lJob;
 
         JobData aCfg(m_xContext);
         aCfg.setEvent(rBinding.m_sDocEvent, rBinding.m_sJobName);
diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
index c261e2bc23ae..e8925e9de098 100644
--- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx
+++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
@@ -258,7 +258,6 @@ tools::Rectangle ToolbarLayoutManager::implts_calcDockingArea()
     sal_Int32                nCurrPos( 0 );
     ui::DockingArea          nCurrDockingArea( ui::DockingArea_DOCKINGAREA_TOP );
     std::vector< sal_Int32 > aRowColumnSizes[DOCKINGAREAS_COUNT];
-    UIElementVector::const_iterator pConstIter;
 
     // initialize rectangle with zero values!
     aBorderSpace.setWidth(0);
@@ -267,9 +266,9 @@ tools::Rectangle ToolbarLayoutManager::implts_calcDockingArea()
     aRowColumnSizes[static_cast<int>(nCurrDockingArea)].clear();
     aRowColumnSizes[static_cast<int>(nCurrDockingArea)].push_back( 0 );
 
-    for ( pConstIter = aWindowVector.begin(); pConstIter != aWindowVector.end(); ++pConstIter )
+    for (auto const& window : aWindowVector)
     {
-        uno::Reference< ui::XUIElement > xUIElement( pConstIter->m_xUIElement, uno::UNO_QUERY );
+        uno::Reference< ui::XUIElement > xUIElement( window.m_xUIElement, uno::UNO_QUERY );
         if ( xUIElement.is() )
         {
             uno::Reference< awt::XWindow > xWindow( xUIElement->getRealInterface(), uno::UNO_QUERY );
@@ -279,26 +278,26 @@ tools::Rectangle ToolbarLayoutManager::implts_calcDockingArea()
                 SolarMutexGuard aGuard;
 
                 VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
-                if ( pWindow && !xDockWindow->isFloating() && pConstIter->m_bVisible && !pConstIter->m_bMasterHide )
+                if ( pWindow && !xDockWindow->isFloating() && window.m_bVisible && !window.m_bMasterHide )
                 {
                     awt::Rectangle aPosSize = xWindow->getPosSize();
-                    if ( pConstIter->m_aDockedData.m_nDockedArea != nCurrDockingArea )
+                    if ( window.m_aDockedData.m_nDockedArea != nCurrDockingArea )
                     {
-                        nCurrDockingArea = pConstIter->m_aDockedData.m_nDockedArea;
+                        nCurrDockingArea = window.m_aDockedData.m_nDockedArea;
                         nCurrRowColumn   = 0;
                         nCurrPos         = 0;
                         aRowColumnSizes[static_cast<int>(nCurrDockingArea)].clear();
                         aRowColumnSizes[static_cast<int>(nCurrDockingArea)].push_back( 0 );
                     }
 
-                    if ( pConstIter->m_aDockedData.m_nDockedArea == nCurrDockingArea )
+                    if ( window.m_aDockedData.m_nDockedArea == nCurrDockingArea )
                     {
-                        if ( isHorizontalDockingArea( pConstIter->m_aDockedData.m_nDockedArea ))
+                        if ( isHorizontalDockingArea( window.m_aDockedData.m_nDockedArea ))
                         {
-                            if ( pConstIter->m_aDockedData.m_aPos.Y > nCurrPos )
+                            if ( window.m_aDockedData.m_aPos.Y > nCurrPos )
                             {
                                 ++nCurrRowColumn;
-                                nCurrPos = pConstIter->m_aDockedData.m_aPos.Y;
+                                nCurrPos = window.m_aDockedData.m_aPos.Y;
                                 aRowColumnSizes[static_cast<int>(nCurrDockingArea)].push_back( 0 );
                             }
 
@@ -307,10 +306,10 @@ tools::Rectangle ToolbarLayoutManager::implts_calcDockingArea()
                         }
                         else
                         {
-                            if ( pConstIter->m_aDockedData.m_aPos.X > nCurrPos )
+                            if ( window.m_aDockedData.m_aPos.X > nCurrPos )
                             {
                                 ++nCurrRowColumn;
-                                nCurrPos = pConstIter->m_aDockedData.m_aPos.X;
+                                nCurrPos = window.m_aDockedData.m_aPos.X;
                                 aRowColumnSizes[static_cast<int>(nCurrDockingArea)].push_back( 0 );
                             }
 
@@ -566,7 +565,6 @@ bool ToolbarLayoutManager::createToolbar( const OUString& rResourceURL )
 
 bool ToolbarLayoutManager::destroyToolbar( const OUString& rResourceURL )
 {
-    UIElementVector::iterator pIter;
     uno::Reference< lang::XComponent > xComponent;
 
     bool bNotify( false );
@@ -575,15 +573,15 @@ bool ToolbarLayoutManager::destroyToolbar( const OUString& rResourceURL )
     bool bMustBeDestroyed( !rResourceURL.startsWith("private:resource/toolbar/addon_") );
 
     SolarMutexClearableGuard aWriteLock;
-    for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); ++pIter )
+    for (auto & elem : m_aUIElements)
     {
-        if ( pIter->m_aName == rResourceURL )
+        if ( elem.m_aName == rResourceURL )
         {
-            xComponent.set( pIter->m_xUIElement, uno::UNO_QUERY );
+            xComponent.set( elem.m_xUIElement, uno::UNO_QUERY );
             if ( bMustBeDestroyed )
-                pIter->m_xUIElement.clear();
+                elem.m_xUIElement.clear();
             else
-                pIter->m_bVisible = false;
+                elem.m_bVisible = false;
             break;
         }
     }
@@ -655,10 +653,9 @@ void ToolbarLayoutManager::destroyToolbars()
     m_bLayoutDirty = true;
     aWriteLock.clear();
 
-    UIElementVector::iterator pIter;
-    for ( pIter = aUIElementVector.begin(); pIter != aUIElementVector.end(); ++pIter )
+    for (auto const& elem : aUIElementVector)
     {
-        uno::Reference< lang::XComponent > xComponent( pIter->m_xUIElement, uno::UNO_QUERY );
+        uno::Reference< lang::XComponent > xComponent( elem.m_xUIElement, uno::UNO_QUERY );
         if ( xComponent.is() )
             xComponent->dispose();
     }
@@ -727,15 +724,14 @@ void ToolbarLayoutManager::refreshToolbarsVisibility( bool bAutomaticToolbars )
 
     UIElement aUIElement;
     SolarMutexGuard aGuard;
-    UIElementVector::iterator pIter;
-    for ( pIter = aUIElementVector.begin(); pIter != aUIElementVector.end(); ++pIter )
+    for (auto const& elem : aUIElementVector)
     {
-        if ( implts_readWindowStateData( pIter->m_aName, aUIElement ) &&
-             ( pIter->m_bVisible != aUIElement.m_bVisible ) && !pIter->m_bMasterHide )
+        if ( implts_readWindowStateData( elem.m_aName, aUIElement ) &&
+             ( elem.m_bVisible != aUIElement.m_bVisible ) && !elem.m_bMasterHide )
         {
             SolarMutexGuard g;
-            UIElement& rUIElement = impl_findToolbar( pIter->m_aName );
-            if ( rUIElement.m_aName == pIter->m_aName )
+            UIElement& rUIElement = impl_findToolbar( elem.m_aName );
+            if ( rUIElement.m_aName == elem.m_aName )
             {
                 rUIElement.m_bVisible = aUIElement.m_bVisible;
                 implts_setLayoutDirty();
@@ -750,15 +746,14 @@ void ToolbarLayoutManager::setFloatingToolbarsVisibility( bool bVisible )
     implts_getUIElementVectorCopy( aUIElementVector );
 
     SolarMutexGuard aGuard;
-    UIElementVector::iterator pIter;
-    for ( pIter = aUIElementVector.begin(); pIter != aUIElementVector.end(); ++pIter )
+    for (auto const& elem : aUIElementVector)
     {
-        vcl::Window* pWindow = getWindowFromXUIElement( pIter->m_xUIElement );
-        if ( pWindow && pIter->m_bFloating )
+        vcl::Window* pWindow = getWindowFromXUIElement( elem.m_xUIElement );
+        if ( pWindow && elem.m_bFloating )
         {
             if ( bVisible )
             {
-                if ( pIter->m_bVisible && !pIter->m_bMasterHide )
+                if ( elem.m_bVisible && !elem.m_bMasterHide )
                     pWindow->Show( true, ShowFlags::NoFocusChange | ShowFlags::NoActivate );
             }
             else
@@ -773,26 +768,24 @@ void ToolbarLayoutManager::setVisible( bool bVisible )
     implts_getUIElementVectorCopy( aUIElementVector );
 
     SolarMutexGuard aGuard;
-    UIElementVector::iterator pIter;
-    for ( pIter = aUIElementVector.begin(); pIter != aUIElementVector.end(); ++pIter )
+    for (auto & elem : aUIElementVector)
     {
-        if (!pIter->m_bFloating)
+        if (!elem.m_bFloating)
         {
-            UIElement aUIElement(*pIter);
-            aUIElement.m_bMasterHide = !bVisible;
-            implts_setToolbar(aUIElement);
+            elem.m_bMasterHide = !bVisible;
+            implts_setToolbar(elem);
             implts_setLayoutDirty();
         }
 
-        vcl::Window* pWindow = getWindowFromXUIElement( pIter->m_xUIElement );
+        vcl::Window* pWindow = getWindowFromXUIElement( elem.m_xUIElement );
         if ( pWindow )
         {
-            bool bSetVisible( pIter->m_bVisible && bVisible );
+            bool bSetVisible( elem.m_bVisible && bVisible );
             if ( !bSetVisible )
                 pWindow->Hide();
             else
             {
-                if ( pIter->m_bFloating )
+                if ( elem.m_bFloating )
                     pWindow->Show(true, ShowFlags::NoFocusChange | ShowFlags::NoActivate );
             }
         }
@@ -891,11 +884,10 @@ bool ToolbarLayoutManager::dockAllToolbars()
     std::vector< OUString > aToolBarNameVector;
 
     SolarMutexClearableGuard aReadLock;
-    UIElementVector::iterator pIter;
-    for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); ++pIter )
+    for (auto const& elem : m_aUIElements)
     {
-        if ( pIter->m_aType == "toolbar" && pIter->m_xUIElement.is() && pIter->m_bFloating && pIter->m_bVisible )
-            aToolBarNameVector.push_back( pIter->m_aName );
+        if ( elem.m_aType == "toolbar" && elem.m_xUIElement.is() && elem.m_bFloating && elem.m_bVisible )
+            aToolBarNameVector.push_back( elem.m_aName );
     }
     aReadLock.clear();
 
@@ -936,13 +928,12 @@ long ToolbarLayoutManager::childWindowEvent( VclSimpleEvent const * pEvent )
             {
                 SolarMutexClearableGuard aReadLock;
                 ::std::vector< uno::Reference< ui::XUIFunctionListener > > aListenerArray;
-                UIElementVector::iterator pIter;
 
-                for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); ++pIter )
+                for (auto const& elem : m_aUIElements)
                 {
-                    if ( pIter->m_xUIElement.is() )
+                    if ( elem.m_xUIElement.is() )
                     {
-                        uno::Reference< ui::XUIFunctionListener > xListener( pIter->m_xUIElement, uno::UNO_QUERY );
+                        uno::Reference< ui::XUIFunctionListener > xListener( elem.m_xUIElement, uno::UNO_QUERY );
                         if ( xListener.is() )
                             aListenerArray.push_back( xListener );
                     }
@@ -1345,10 +1336,9 @@ void ToolbarLayoutManager::implts_reparentToolbars()
     SolarMutexGuard aGuard;
     if ( pContainerWindow )
     {
-        UIElementVector::iterator pIter;
-        for ( pIter = aUIElementVector.begin(); pIter != aUIElementVector.end(); ++pIter )
+        for (auto const& elem : aUIElementVector)
         {
-            uno::Reference< ui::XUIElement > xUIElement( pIter->m_xUIElement );
+            uno::Reference< ui::XUIElement > xUIElement( elem.m_xUIElement );
             if ( xUIElement.is() )
             {
                 uno::Reference< awt::XWindow > xWindow;
@@ -1370,15 +1360,15 @@ void ToolbarLayoutManager::implts_reparentToolbars()
                 if ( pWindow )
                 {
                     // Reparent our child windows according to their current state.
-                    if ( pIter->m_bFloating )
+                    if ( elem.m_bFloating )
                         pWindow->SetParent( pContainerWindow );
                     else
                     {
-                        if ( pIter->m_aDockedData.m_nDockedArea == ui::DockingArea_DOCKINGAREA_TOP )
+                        if ( elem.m_aDockedData.m_nDockedArea == ui::DockingArea_DOCKINGAREA_TOP )
                             pWindow->SetParent( pTopDockWindow );
-                        else if ( pIter->m_aDockedData.m_nDockedArea == ui::DockingArea_DOCKINGAREA_BOTTOM )
+                        else if ( elem.m_aDockedData.m_nDockedArea == ui::DockingArea_DOCKINGAREA_BOTTOM )
                             pWindow->SetParent( pBottomDockWindow );
-                        else if ( pIter->m_aDockedData.m_nDockedArea == ui::DockingArea_DOCKINGAREA_LEFT )
+                        else if ( elem.m_aDockedData.m_nDockedArea == ui::DockingArea_DOCKINGAREA_LEFT )
                             pWindow->SetParent( pLeftDockWindow );
                         else
                             pWindow->SetParent( pRightDockWindow );
@@ -1639,13 +1629,12 @@ void ToolbarLayoutManager::implts_writeWindowStateData( const UIElement& rElemen
 UIElement& ToolbarLayoutManager::impl_findToolbar( const OUString& aName )
 {
     static UIElement aEmptyElement;
-    UIElementVector::iterator pIter;
 
     SolarMutexGuard g;
-    for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); ++pIter )
+    for (auto & elem : m_aUIElements)
     {
-        if ( pIter->m_aName == aName )
-            return *pIter;
+        if ( elem.m_aName == aName )
+            return elem;
     }
 
     return aEmptyElement;
@@ -1660,17 +1649,16 @@ UIElement ToolbarLayoutManager::implts_findToolbar( const OUString& aName )
 UIElement ToolbarLayoutManager::implts_findToolbar( const uno::Reference< uno::XInterface >& xToolbar )
 {
     UIElement                       aToolbar;
-    UIElementVector::const_iterator pIter;
 
     SolarMutexGuard g;
-    for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); ++pIter )
+    for (auto const& elem : m_aUIElements)
     {
-        if ( pIter->m_xUIElement.is() )
+        if ( elem.m_xUIElement.is() )
         {
-            uno::Reference< uno::XInterface > xIfac( pIter->m_xUIElement->getRealInterface(), uno::UNO_QUERY );
+            uno::Reference< uno::XInterface > xIfac( elem.m_xUIElement->getRealInterface(), uno::UNO_QUERY );
             if ( xIfac == xToolbar )
             {
-                aToolbar = *pIter;
+                aToolbar = elem;
                 break;
             }
         }
@@ -1681,15 +1669,14 @@ UIElement ToolbarLayoutManager::implts_findToolbar( const uno::Reference< uno::X
 
 uno::Reference< awt::XWindow > ToolbarLayoutManager::implts_getXWindow( const OUString& aName )
 {
-    UIElementVector::iterator pIter;
     uno::Reference< awt::XWindow > xWindow;
 
     SolarMutexGuard g;
-    for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); ++pIter )
+    for (auto const& elem : m_aUIElements)
     {
-        if ( pIter->m_aName == aName && pIter->m_xUIElement.is() )
+        if ( elem.m_aName == aName && elem.m_xUIElement.is() )
         {
-             xWindow.set( pIter->m_xUIElement->getRealInterface(), uno::UNO_QUERY );
+             xWindow.set( elem.m_xUIElement->getRealInterface(), uno::UNO_QUERY );
              break;
         }
     }
@@ -1772,12 +1759,11 @@ awt::Point ToolbarLayoutManager::implts_findNextCascadeFloatingPos()
     aCurrPos = aStartPos;
 
     // Try to find a cascaded position for the new floating window
-    UIElementVector::const_iterator pIter;
-    for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); ++pIter )
+    for (auto const& elem : m_aUIElements)
     {
-        if ( pIter->m_xUIElement.is() )
+        if ( elem.m_xUIElement.is() )
         {
-            uno::Reference< awt::XDockableWindow > xDockWindow( pIter->m_xUIElement->getRealInterface(), uno::UNO_QUERY );
+            uno::Reference< awt::XDockableWindow > xDockWindow( elem.m_xUIElement->getRealInterface(), uno::UNO_QUERY );
             uno::Reference< awt::XWindow > xWindow( xDockWindow, uno::UNO_QUERY );
             if ( xDockWindow.is() && xDockWindow->isFloating() )
             {
@@ -1805,15 +1791,12 @@ awt::Point ToolbarLayoutManager::implts_findNextCascadeFloatingPos()
 void ToolbarLayoutManager::implts_sortUIElements()
 {
     SolarMutexGuard g;
-    UIElementVector::iterator pIterStart = m_aUIElements.begin();
-    UIElementVector::iterator pIterEnd   = m_aUIElements.end();
 
-    std::stable_sort( pIterStart, pIterEnd ); // first created element should first
+    std::stable_sort( m_aUIElements.begin(), m_aUIElements.end()); // first created element should first
 
     // We have to reset our temporary flags.
-    UIElementVector::iterator pIter;
-    for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); ++pIter )
-        pIter->m_bUserActive = false;
+    for (auto & elem : m_aUIElements)
+        elem.m_bUserActive = false;
 }
 
 void ToolbarLayoutManager::implts_getUIElementVectorCopy( UIElementVector& rCopy )
@@ -1854,12 +1837,11 @@ void ToolbarLayoutManager::implts_getDockingAreaElementInfos( ui::DockingArea eD
     SolarMutexClearableGuard aReadLock;
     aWindowVector.reserve(m_aUIElements.size());
     xDockAreaWindow = m_xDockAreaWindows[static_cast<int>(eDockingArea)];
-    UIElementVector::iterator   pIter;
-    for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); ++pIter )
+    for (auto const& elem : m_aUIElements)
     {
-        if ( pIter->m_aDockedData.m_nDockedArea == eDockingArea && pIter->m_bVisible && !pIter->m_bFloating )
+        if ( elem.m_aDockedData.m_nDockedArea == eDockingArea && elem.m_bVisible && !elem.m_bFloating )
         {
-            uno::Reference< ui::XUIElement > xUIElement( pIter->m_xUIElement );
+            uno::Reference< ui::XUIElement > xUIElement( elem.m_xUIElement );
             if ( xUIElement.is() )
             {
                 uno::Reference< awt::XWindow > xWindow( xUIElement->getRealInterface(), uno::UNO_QUERY );
@@ -1867,7 +1849,7 @@ void ToolbarLayoutManager::implts_getDockingAreaElementInfos( ui::DockingArea eD
                 if ( xDockWindow.is() )
                 {
                     // docked windows
-                    aWindowVector.push_back( *pIter );
+                    aWindowVector.push_back(elem);
                 }
             }
         }
@@ -2037,14 +2019,12 @@ void ToolbarLayoutManager::implts_getDockingAreaElementInfoOnSingleRowCol( ui::D
 
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
     SolarMutexClearableGuard aReadLock;
-    UIElementVector::iterator   pIter;
-    UIElementVector::iterator   pEnd = m_aUIElements.end();
-    for ( pIter = m_aUIElements.begin(); pIter != pEnd; ++pIter )
+    for (auto const& elem : m_aUIElements)
     {
-        if ( pIter->m_aDockedData.m_nDockedArea == eDockingArea )
+        if ( elem.m_aDockedData.m_nDockedArea == eDockingArea )
         {
-            bool bSameRowCol = bHorzDockArea ? ( pIter->m_aDockedData.m_aPos.Y == nRowCol ) : ( pIter->m_aDockedData.m_aPos.X == nRowCol );
-            uno::Reference< ui::XUIElement > xUIElement( pIter->m_xUIElement );
+            bool bSameRowCol = bHorzDockArea ? ( elem.m_aDockedData.m_aPos.Y == nRowCol ) : ( elem.m_aDockedData.m_aPos.X == nRowCol );
+            uno::Reference< ui::XUIElement > xUIElement( elem.m_xUIElement );
 
             if ( bSameRowCol && xUIElement.is() )
             {
@@ -2054,8 +2034,8 @@ void ToolbarLayoutManager::implts_getDockingAreaElementInfoOnSingleRowCol( ui::D
                     SolarMutexGuard aGuard;
                     VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
                     uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY );
-                    if ( pWindow && pIter->m_bVisible && xDockWindow.is() && !pIter->m_bFloating )
-                        aWindowVector.push_back( *pIter ); // docked windows
+                    if ( pWindow && elem.m_bVisible && xDockWindow.is() && !elem.m_bFloating )
+                        aWindowVector.push_back(elem); // docked windows
                 }
             }
         }
@@ -3106,22 +3086,21 @@ void ToolbarLayoutManager::implts_renumberRowColumnData(
 
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
     SolarMutexClearableGuard aWriteLock;
-    UIElementVector::iterator pIter;
-    for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); ++pIter )
+    for (auto & elem : m_aUIElements)
     {
-        if (( pIter->m_aDockedData.m_nDockedArea == eDockingArea ) && ( pIter->m_aName != rUIElement.m_aName ))
+        if (( elem.m_aDockedData.m_nDockedArea == eDockingArea ) && ( elem.m_aName != rUIElement.m_aName ))
         {
             // Don't change toolbars without a valid docking position!
-            if ( isDefaultPos( pIter->m_aDockedData.m_aPos ))
+            if ( isDefaultPos( elem.m_aDockedData.m_aPos ))
                 continue;
 
-            sal_Int32 nWindowRowCol = bHorzDockingArea ? pIter->m_aDockedData.m_aPos.Y : pIter->m_aDockedData.m_aPos.X;
+            sal_Int32 nWindowRowCol = bHorzDockingArea ? elem.m_aDockedData.m_aPos.Y : elem.m_aDockedData.m_aPos.X;
             if ( nWindowRowCol >= nRowCol )
             {
                 if ( bHorzDockingArea )
-                    pIter->m_aDockedData.m_aPos.Y += 1;
+                    elem.m_aDockedData.m_aPos.Y += 1;
                 else
-                    pIter->m_aDockedData.m_aPos.X += 1;
+                    elem.m_aDockedData.m_aPos.X += 1;
             }
         }
     }
@@ -3741,26 +3720,25 @@ void SAL_CALL ToolbarLayoutManager::closed( const lang::EventObject& e )
 {
     OUString aName;
     UIElement     aUIElement;
-    UIElementVector::iterator pIter;
 
     SolarMutexClearableGuard aWriteLock;
-    for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); ++pIter )
+    for (auto & elem : m_aUIElements)
     {
-        uno::Reference< ui::XUIElement > xUIElement( pIter->m_xUIElement );
+        uno::Reference< ui::XUIElement > xUIElement( elem.m_xUIElement );
         if ( xUIElement.is() )
         {
             uno::Reference< uno::XInterface > xIfac( xUIElement->getRealInterface(), uno::UNO_QUERY );
             if ( xIfac == e.Source )
             {
-                aName = pIter->m_aName;
+                aName = elem.m_aName;
 
                 // user closes a toolbar =>
                 // context sensitive toolbar: only destroy toolbar and store state.
                 // non context sensitive toolbar: make it invisible, store state and destroy it.
-                if ( !pIter->m_bContextSensitive )
-                    pIter->m_bVisible = false;
+                if ( !elem.m_bContextSensitive )
+                    elem.m_bVisible = false;
 
-                aUIElement = *pIter;
+                aUIElement = elem;
                 break;
             }
         }
@@ -3944,14 +3922,13 @@ uno::Sequence< uno::Reference< ui::XUIElement > > ToolbarLayoutManager::getToolb
     if ( m_aUIElements.size() > 0 )
     {
         sal_uInt32 nCount(0);
-        UIElementVector::iterator pIter;
-        for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); ++pIter )
+        for (auto const& elem : m_aUIElements)
         {
-            if ( pIter->m_xUIElement.is() )
+            if ( elem.m_xUIElement.is() )
             {
                 ++nCount;
                 aSeq.realloc( nCount );
-                aSeq[nCount-1] = pIter->m_xUIElement;
+                aSeq[nCount-1] = elem.m_xUIElement;
             }
         }
     }
diff --git a/framework/source/recording/dispatchrecorder.cxx b/framework/source/recording/dispatchrecorder.cxx
index 62de449cef3c..1c2d07a25a47 100644
--- a/framework/source/recording/dispatchrecorder.cxx
+++ b/framework/source/recording/dispatchrecorder.cxx
@@ -150,9 +150,8 @@ OUString SAL_CALL DispatchRecorder::getRecordedMacro()
     aScriptBuffer.append("document   = ThisComponent.CurrentController.Frame\n");
     aScriptBuffer.append("dispatcher = createUnoService(\"com.sun.star.frame.DispatchHelper\")\n\n");
 
-    std::vector< css::frame::DispatchStatement>::iterator p;
-    for ( p = m_aStatements.begin(); p != m_aStatements.end(); ++p )
-        implts_recordMacro( p->aCommand, p->aArgs, p->bIsComment, aScriptBuffer );
+    for (auto const& statement : m_aStatements)
+        implts_recordMacro( statement.aCommand, statement.aArgs, statement.bIsComment, aScriptBuffer );
     OUString sScript = aScriptBuffer.makeStringAndClear();
     return sScript;
 }
diff --git a/framework/source/services/ContextChangeEventMultiplexer.cxx b/framework/source/services/ContextChangeEventMultiplexer.cxx
index 596242d654f7..f8f68a1c8a14 100644
--- a/framework/source/services/ContextChangeEventMultiplexer.cxx
+++ b/framework/source/services/ContextChangeEventMultiplexer.cxx
@@ -119,24 +119,18 @@ void SAL_CALL ContextChangeEventMultiplexer::disposing()
 
     cssu::Reference<cssu::XInterface> xThis (static_cast<XWeak*>(this));
     css::lang::EventObject aEvent (xThis);
-    for (ListenerMap::const_iterator iContainer(aListeners.begin()), iEnd(aListeners.end());
-         iContainer!=iEnd;
-         ++iContainer)
+    for (auto const& container : aListeners)
     {
         // Unregister from the focus object.
-        Reference<lang::XComponent> xComponent (iContainer->first, UNO_QUERY);
+        Reference<lang::XComponent> xComponent (container.first, UNO_QUERY);
         if (xComponent.is())
             xComponent->removeEventListener(this);
 
         // Tell all listeners that we are being disposed.
-        const FocusDescriptor& rFocusDescriptor (iContainer->second);
-        for (ListenerContainer::const_iterator
-                 iListener(rFocusDescriptor.maListeners.begin()),
-                 iContainerEnd(rFocusDescriptor.maListeners.end());
-             iListener!=iContainerEnd;
-             ++iListener)
+        const FocusDescriptor& rFocusDescriptor (container.second);
+        for (auto const& listener : rFocusDescriptor.maListeners)
         {
-            (*iListener)->disposing(aEvent);
+            listener->disposing(aEvent);
         }
     }
 }
@@ -259,13 +253,9 @@ void ContextChangeEventMultiplexer::BroadcastEventToSingleContainer (
         // Create a copy of the listener container to avoid problems
         // when one of the called listeners calls add... or remove...
         ListenerContainer aContainer (pFocusDescriptor->maListeners);
-        for (ListenerContainer::const_iterator
-                 iListener(aContainer.begin()),
-                 iEnd(aContainer.end());
-             iListener!=iEnd;
-             ++iListener)
+        for (auto const& listener : aContainer)
         {
-            (*iListener)->notifyContextChangeEvent(rEventObject);
+            listener->notifyContextChangeEvent(rEventObject);
         }
     }
 }
diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx
index 227c34f7bc7a..8512293fecb5 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -1502,13 +1502,9 @@ void SAL_CALL AutoRecovery::addStatusListener(const css::uno::Reference< css::fr
     /* SAFE */ {
     osl::ResettableMutexGuard g(cppu::WeakComponentImplHelperBase::rBHelper.rMutex);
 
-    AutoRecovery::TDocumentList::iterator pIt;
-    for(  pIt  = m_lDocCache.begin();
-          pIt != m_lDocCache.end();
-        ++pIt                       )
+    for (auto const& elem : m_lDocCache)
     {
-        AutoRecovery::TDocumentInfo&  rInfo = *pIt;
-        css::frame::FeatureStateEvent aEvent = AutoRecovery::implst_createFeatureStateEvent(m_eJob, OPERATION_UPDATE, &rInfo);
+        css::frame::FeatureStateEvent aEvent = AutoRecovery::implst_createFeatureStateEvent(m_eJob, OPERATION_UPDATE, &elem);
 
         // } /* SAFE */
         g.clear();
@@ -1980,13 +1976,10 @@ void AutoRecovery::implts_persistAllActiveViewNames()
     osl::MutexGuard g(cppu::WeakComponentImplHelperBase::rBHelper.rMutex);
 
     // This list will be filled with every document
-    AutoRecovery::TDocumentList::iterator pIt;
-    for (  pIt  = m_lDocCache.begin();
-           pIt != m_lDocCache.end();
-         ++pIt                       )
+    for (auto & elem : m_lDocCache)
     {
-        implts_collectActiveViewNames( *pIt );
-        implts_flushConfigItem( *pIt );
+        implts_collectActiveViewNames(elem);
+        implts_flushConfigItem(elem);
     }
 }
 
@@ -2749,39 +2742,34 @@ void AutoRecovery::implts_prepareSessionShutdown()
     /* SAFE */ {
     CacheLockGuard aCacheLock(this, cppu::WeakComponentImplHelperBase::rBHelper.rMutex, m_nDocCacheLock, LOCK_FOR_CACHE_USE);
 
-    AutoRecovery::TDocumentList::iterator pIt;
-    for (  pIt  = m_lDocCache.begin();
-           pIt != m_lDocCache.end();
-         ++pIt                       )
+    for (auto & info : m_lDocCache)
     {
-        AutoRecovery::TDocumentInfo& rInfo = *pIt;
-
         // WORKAROUND... Since the documents are not closed the lock file must be removed explicitly
         // it is not done on documents saving since shutdown can be cancelled
-        lc_removeLockFile( rInfo );
+        lc_removeLockFile( info );
 
         // Prevent us from deregistration of these documents.
         // Because we close these documents by ourself (see XClosable below) ...
         // it's fact, that we reach our deregistration method. There we
         // must not(!) update our configuration ... Otherwise all
         // session data are lost !!!
-        rInfo.IgnoreClosing = true;
+        info.IgnoreClosing = true;
 
         // reset modified flag of these documents (ignoring the notification about it!)
         // Otherwise a message box is shown on closing these models.
-        implts_stopModifyListeningOnDoc(rInfo);
+        implts_stopModifyListeningOnDoc(info);
 
         // if the session save is still running the documents should not be thrown away,
         // actually that would be a bad sign, that means that the SessionManager tries
         // to kill the session before the saving is ready
         if ((m_eJob & AutoRecovery::E_SESSION_SAVE) != AutoRecovery::E_SESSION_SAVE)
         {
-            css::uno::Reference< css::util::XModifiable > xModify(rInfo.Document, css::uno::UNO_QUERY);
+            css::uno::Reference< css::util::XModifiable > xModify(info.Document, css::uno::UNO_QUERY);
             if (xModify.is())
                 xModify->setModified(false);
 
             // close the model.
-            css::uno::Reference< css::util::XCloseable > xClose(rInfo.Document, css::uno::UNO_QUERY);
+            css::uno::Reference< css::util::XCloseable > xClose(info.Document, css::uno::UNO_QUERY);
             if (xClose.is())
             {
                 try
@@ -2794,7 +2782,7 @@ void AutoRecovery::implts_prepareSessionShutdown()
                     // So it seems to be possible to ignore any error here .-)
                 }
 
-                rInfo.Document.clear();
+                info.Document.clear();
             }
         }
     }
@@ -2978,12 +2966,9 @@ AutoRecovery::ETimerType AutoRecovery::implts_saveDocs(       bool        bAllow
 
     // Did we have some "dangerous candidates" ?
     // Try to save it ... but may be it will fail !
-    ::std::vector< AutoRecovery::TDocumentList::iterator >::iterator pIt2;
-    for (  pIt2  = lDangerousDocs.begin();
-           pIt2 != lDangerousDocs.end();
-         ++pIt2                          )
+    for (auto const& dangerousDoc : lDangerousDocs)
     {
-        pIt = *pIt2;
+        pIt = dangerousDoc;
         AutoRecovery::TDocumentInfo aInfo = *pIt;
 
         // } /* SAFE */
@@ -3154,21 +3139,16 @@ AutoRecovery::ETimerType AutoRecovery::implts_openDocs(const DispatchParams& aPa
     osl::ResettableMutexGuard g(cppu::WeakComponentImplHelperBase::rBHelper.rMutex);
 
     sal_Int32                             eJob = m_eJob;
-    AutoRecovery::TDocumentList::iterator pIt;
-    for (  pIt  = m_lDocCache.begin();
-           pIt != m_lDocCache.end();
-         ++pIt                       )
+    for (auto & info : m_lDocCache)
     {
-        AutoRecovery::TDocumentInfo& rInfo = *pIt;
-
         // Such documents are already loaded by the last loop.
         // Don't check E_SUCCEDED here! It may be the final state of an AutoSave
         // operation before!!!
-        if ((rInfo.DocumentState & AutoRecovery::E_HANDLED) == AutoRecovery::E_HANDLED)
+        if ((info.DocumentState & AutoRecovery::E_HANDLED) == AutoRecovery::E_HANDLED)
             continue;
 
         // a1,b1,c1,d2,e2,f2)
-        if ((rInfo.DocumentState & AutoRecovery::E_DAMAGED) == AutoRecovery::E_DAMAGED)
+        if ((info.DocumentState & AutoRecovery::E_DAMAGED) == AutoRecovery::E_DAMAGED)
         {
             // don't forget to inform listener! May be this document was
             // damaged on last saving time ...
@@ -3178,7 +3158,7 @@ AutoRecovery::ETimerType AutoRecovery::implts_openDocs(const DispatchParams& aPa
             // } /* SAFE */
             g.clear();
             implts_informListener(eJob,
-                AutoRecovery::implst_createFeatureStateEvent(eJob, OPERATION_UPDATE, &rInfo));
+                AutoRecovery::implst_createFeatureStateEvent(eJob, OPERATION_UPDATE, &info));
             g.reset();
             // /* SAFE */ {
             continue;
@@ -3197,21 +3177,21 @@ AutoRecovery::ETimerType AutoRecovery::implts_openDocs(const DispatchParams& aPa
             lDescriptor[utl::MediaDescriptor::PROP_STATUSINDICATOR()] <<= aParams.m_xProgress;
 
         bool bBackupWasTried   = (
-                                        ((rInfo.DocumentState & AutoRecovery::E_TRY_LOAD_BACKUP  ) == AutoRecovery::E_TRY_LOAD_BACKUP) || // temp. state!
-                                        ((rInfo.DocumentState & AutoRecovery::E_INCOMPLETE       ) == AutoRecovery::E_INCOMPLETE     )    // transport TRY_LOAD_BACKUP from last loop to this new one!
+                                        ((info.DocumentState & AutoRecovery::E_TRY_LOAD_BACKUP  ) == AutoRecovery::E_TRY_LOAD_BACKUP) || // temp. state!
+                                        ((info.DocumentState & AutoRecovery::E_INCOMPLETE       ) == AutoRecovery::E_INCOMPLETE     )    // transport TRY_LOAD_BACKUP from last loop to this new one!
                                      );
-        bool bOriginalWasTried = ((rInfo.DocumentState & AutoRecovery::E_TRY_LOAD_ORIGINAL) == AutoRecovery::E_TRY_LOAD_ORIGINAL);
+        bool bOriginalWasTried = ((info.DocumentState & AutoRecovery::E_TRY_LOAD_ORIGINAL) == AutoRecovery::E_TRY_LOAD_ORIGINAL);
 
         if (bBackupWasTried)
         {
             if (!bOriginalWasTried)
             {
-                rInfo.DocumentState |= AutoRecovery::E_INCOMPLETE;
+                info.DocumentState |= AutoRecovery::E_INCOMPLETE;
                 // try original URL ... ! don't continue with next item here ...
             }
             else
             {
-                rInfo.DocumentState |= AutoRecovery::E_DAMAGED;
+                info.DocumentState |= AutoRecovery::E_DAMAGED;
                 continue;
             }
         }
@@ -3220,21 +3200,21 @@ AutoRecovery::ETimerType AutoRecovery::implts_openDocs(const DispatchParams& aPa
         OUString sLoadBackupURL;
 
         if (!bBackupWasTried)
-            sLoadBackupURL = rInfo.OldTempURL;
+            sLoadBackupURL = info.OldTempURL;
 
-        if (!rInfo.OrgURL.isEmpty())
+        if (!info.OrgURL.isEmpty())
         {
-            sLoadOriginalURL = rInfo.OrgURL;
+            sLoadOriginalURL = info.OrgURL;
         }
-        else if (!rInfo.TemplateURL.isEmpty())
+        else if (!info.TemplateURL.isEmpty())
         {
-            sLoadOriginalURL = rInfo.TemplateURL;
+            sLoadOriginalURL = info.TemplateURL;
             lDescriptor[utl::MediaDescriptor::PROP_ASTEMPLATE()]   <<= true;
-            lDescriptor[utl::MediaDescriptor::PROP_TEMPLATENAME()] <<= rInfo.TemplateURL;
+            lDescriptor[utl::MediaDescriptor::PROP_TEMPLATENAME()] <<= info.TemplateURL;
         }
-        else if (!rInfo.FactoryURL.isEmpty())
+        else if (!info.FactoryURL.isEmpty())
         {
-            sLoadOriginalURL = rInfo.FactoryURL;
+            sLoadOriginalURL = info.FactoryURL;
             lDescriptor[utl::MediaDescriptor::PROP_ASTEMPLATE()] <<= true;
         }
 
@@ -3244,13 +3224,13 @@ AutoRecovery::ETimerType AutoRecovery::implts_openDocs(const DispatchParams& aPa
         if (!sLoadBackupURL.isEmpty())
         {
             sURL = sLoadBackupURL;
-            rInfo.DocumentState |= AutoRecovery::E_TRY_LOAD_BACKUP;
+            info.DocumentState |= AutoRecovery::E_TRY_LOAD_BACKUP;
             lDescriptor[utl::MediaDescriptor::PROP_SALVAGEDFILE()] <<= sLoadOriginalURL;
         }
         else if (!sLoadOriginalURL.isEmpty())
         {
             sURL = sLoadOriginalURL;
-            rInfo.DocumentState |= AutoRecovery::E_TRY_LOAD_ORIGINAL;
+            info.DocumentState |= AutoRecovery::E_TRY_LOAD_ORIGINAL;
         }
         else
             continue; // TODO ERROR!
@@ -3260,32 +3240,32 @@ AutoRecovery::ETimerType AutoRecovery::implts_openDocs(const DispatchParams& aPa
         // } /* SAFE */
         g.clear();
 
-        implts_flushConfigItem(rInfo);
+        implts_flushConfigItem(info);
         implts_informListener(eJob,
-            AutoRecovery::implst_createFeatureStateEvent(eJob, OPERATION_UPDATE, &rInfo));
+            AutoRecovery::implst_createFeatureStateEvent(eJob, OPERATION_UPDATE, &info));
 
         try
         {
-            implts_openOneDoc(sURL, lDescriptor, rInfo);
+            implts_openOneDoc(sURL, lDescriptor, info);
         }
         catch(const css::uno::Exception&)
         {
-            rInfo.DocumentState &= ~AutoRecovery::E_TRY_LOAD_BACKUP;
-            rInfo.DocumentState &= ~AutoRecovery::E_TRY_LOAD_ORIGINAL;
+            info.DocumentState &= ~AutoRecovery::E_TRY_LOAD_BACKUP;
+            info.DocumentState &= ~AutoRecovery::E_TRY_LOAD_ORIGINAL;
             if (!sLoadBackupURL.isEmpty())
             {
-                rInfo.DocumentState |= AutoRecovery::E_INCOMPLETE;
+                info.DocumentState |= AutoRecovery::E_INCOMPLETE;
                 eTimer               = AutoRecovery::E_CALL_ME_BACK;
             }
             else
             {
-                rInfo.DocumentState |=  AutoRecovery::E_HANDLED;
-                rInfo.DocumentState |=  AutoRecovery::E_DAMAGED;
+                info.DocumentState |=  AutoRecovery::E_HANDLED;
+                info.DocumentState |=  AutoRecovery::E_DAMAGED;
             }
 
-            implts_flushConfigItem(rInfo, true);
+            implts_flushConfigItem(info, true);
             implts_informListener(eJob,
-                AutoRecovery::implst_createFeatureStateEvent(eJob, OPERATION_UPDATE, &rInfo));
+                AutoRecovery::implst_createFeatureStateEvent(eJob, OPERATION_UPDATE, &info));
 
             // /* SAFE */ {
             // Needed for next loop!
@@ -3293,31 +3273,31 @@ AutoRecovery::ETimerType AutoRecovery::implts_openDocs(const DispatchParams& aPa
             continue;
         }
 
-        if (!rInfo.RealFilter.isEmpty())
+        if (!info.RealFilter.isEmpty())
         {
-            utl::MediaDescriptor lPatchDescriptor(rInfo.Document->getArgs());
-            lPatchDescriptor[utl::MediaDescriptor::PROP_FILTERNAME()] <<= rInfo.RealFilter;
-            rInfo.Document->attachResource(rInfo.Document->getURL(), lPatchDescriptor.getAsConstPropertyValueList());
+            utl::MediaDescriptor lPatchDescriptor(info.Document->getArgs());
+            lPatchDescriptor[utl::MediaDescriptor::PROP_FILTERNAME()] <<= info.RealFilter;
+            info.Document->attachResource(info.Document->getURL(), lPatchDescriptor.getAsConstPropertyValueList());
                 // do *not* use sURL here. In case this points to the recovery file, it has already been passed
                 // to recoverFromFile. Also, passing it here is logically wrong, as attachResource is intended
                 // to take the logical file URL.
         }
 
-        css::uno::Reference< css::util::XModifiable > xModify(rInfo.Document, css::uno::UNO_QUERY);
+        css::uno::Reference< css::util::XModifiable > xModify(info.Document, css::uno::UNO_QUERY);
         if ( xModify.is() )
         {
-            bool bModified = ((rInfo.DocumentState & AutoRecovery::E_MODIFIED) == AutoRecovery::E_MODIFIED);
+            bool bModified = ((info.DocumentState & AutoRecovery::E_MODIFIED) == AutoRecovery::E_MODIFIED);
             xModify->setModified(bModified);
         }
 
-        rInfo.DocumentState &= ~AutoRecovery::E_TRY_LOAD_BACKUP;
-        rInfo.DocumentState &= ~AutoRecovery::E_TRY_LOAD_ORIGINAL;
-        rInfo.DocumentState |=  AutoRecovery::E_HANDLED;
-        rInfo.DocumentState |=  AutoRecovery::E_SUCCEDED;
+        info.DocumentState &= ~AutoRecovery::E_TRY_LOAD_BACKUP;
+        info.DocumentState &= ~AutoRecovery::E_TRY_LOAD_ORIGINAL;
+        info.DocumentState |=  AutoRecovery::E_HANDLED;
+        info.DocumentState |=  AutoRecovery::E_SUCCEDED;
 
-        implts_flushConfigItem(rInfo);
+        implts_flushConfigItem(info);
         implts_informListener(eJob,
-            AutoRecovery::implst_createFeatureStateEvent(eJob, OPERATION_UPDATE, &rInfo));
+            AutoRecovery::implst_createFeatureStateEvent(eJob, OPERATION_UPDATE, &info));
 
         /* Normally we listen as XModifyListener on a document to know if a document was changed
            since our last AutoSave. And we deregister us in case we know this state.
@@ -3326,7 +3306,7 @@ AutoRecovery::ETimerType AutoRecovery::implts_openDocs(const DispatchParams& aPa
            on the document via API. And currently we don't listen for any events (not at theGlobalEventBroadcaster
            nor at any document!).
         */
-        implts_startModifyListeningOnDoc(rInfo);
+        implts_startModifyListeningOnDoc(info);
 
         // /* SAFE */ {
         // Needed for next loop. Don't unlock it again!
@@ -3392,10 +3372,7 @@ void AutoRecovery::implts_openOneDoc(const OUString&               sURL       ,
         if ( aViewsToRestore.empty() )
             aViewsToRestore.emplace_back( );
 
-        for (   ::std::vector< OUString >::const_iterator viewName = aViewsToRestore.begin();
-                viewName != aViewsToRestore.end();
-                ++viewName
-            )
+        for (auto const& viewToRestore : aViewsToRestore)
         {
             // create a frame
             Reference< XFrame > xTargetFrame = xDesktop->findFrame( SPECIALTARGET_BLANK, 0 );
@@ -3403,9 +3380,9 @@ void AutoRecovery::implts_openOneDoc(const OUString&               sURL       ,
 
             // create a view to the document
             Reference< XController2 > xController;
-            if ( viewName->getLength() )
+            if ( viewToRestore.getLength() )
             {
-                xController.set( xModel->createViewController( *viewName, Sequence< css::beans::PropertyValue >(), xTargetFrame ), UNO_SET_THROW );
+                xController.set( xModel->createViewController( viewToRestore, Sequence< css::beans::PropertyValue >(), xTargetFrame ), UNO_SET_THROW );
             }
             else
             {
@@ -3431,16 +3408,13 @@ void AutoRecovery::implts_openOneDoc(const OUString&               sURL       ,
         Any aCaughtException( ::cppu::getCaughtException() );
 
         // clean up
-        for (   ::std::vector< Reference< XComponent > >::const_iterator component = aCleanup.begin();
-                component != aCleanup.end();
-                ++component
-            )
+        for (auto const& component : aCleanup)
         {
-            css::uno::Reference< css::util::XCloseable > xClose( *component, css::uno::UNO_QUERY );
+            css::uno::Reference< css::util::XCloseable > xClose(component, css::uno::UNO_QUERY);
             if ( xClose.is() )
                 xClose->close( true );
             else
-                (*component)->dispose();
+                component->dispose();
         }
 
         // re-throw
@@ -3615,18 +3589,14 @@ void AutoRecovery::implts_resetHandleStates()
     /* SAFE */ {
     osl::ResettableMutexGuard g(cppu::WeakComponentImplHelperBase::rBHelper.rMutex);
 
-    AutoRecovery::TDocumentList::iterator pIt;
-    for (  pIt  = m_lDocCache.begin();
-           pIt != m_lDocCache.end();
-         ++pIt                       )
+    for (auto & info : m_lDocCache)
     {
-        AutoRecovery::TDocumentInfo& rInfo = *pIt;
-        rInfo.DocumentState &= ~AutoRecovery::E_HANDLED;
-        rInfo.DocumentState &= ~AutoRecovery::E_POSTPONED;
+        info.DocumentState &= ~AutoRecovery::E_HANDLED;
+        info.DocumentState &= ~AutoRecovery::E_POSTPONED;
 
         // } /* SAFE */
         g.clear();
-        implts_flushConfigItem(rInfo);
+        implts_flushConfigItem(info);
         g.reset();
         // /* SAFE */ {
     }
@@ -3811,23 +3781,19 @@ void AutoRecovery::implts_backupWorkingEntry(const DispatchParams& aParams)
 {
     CacheLockGuard aCacheLock(this, cppu::WeakComponentImplHelperBase::rBHelper.rMutex, m_nDocCacheLock, LOCK_FOR_CACHE_USE);
 
-    AutoRecovery::TDocumentList::iterator pIt;
-    for (  pIt  = m_lDocCache.begin();
-           pIt != m_lDocCache.end();
-         ++pIt                       )
+    for (auto const& info : m_lDocCache)
     {
-        const AutoRecovery::TDocumentInfo& rInfo = *pIt;
-        if (rInfo.ID != aParams.m_nWorkingEntryID)
+        if (info.ID != aParams.m_nWorkingEntryID)
             continue;
 
         OUString sSourceURL;
         // Prefer temp file. It contains the changes against the original document!
-        if (!rInfo.OldTempURL.isEmpty())
-            sSourceURL = rInfo.OldTempURL;
-        else if (!rInfo.NewTempURL.isEmpty())
-            sSourceURL = rInfo.NewTempURL;
-        else if (!rInfo.OrgURL.isEmpty())
-            sSourceURL = rInfo.OrgURL;
+        if (!info.OldTempURL.isEmpty())
+            sSourceURL = info.OldTempURL;
+        else if (!info.NewTempURL.isEmpty())
+            sSourceURL = info.NewTempURL;
+        else if (!info.OrgURL.isEmpty())
+            sSourceURL = info.OrgURL;
         else
             continue; // nothing real to save! An unmodified but new created document.
 
diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx
index 0357a4955b82..4597eedb4549 100644
--- a/framework/source/services/frame.cxx
+++ b/framework/source/services/frame.cxx
@@ -1981,13 +1981,10 @@ css::uno::Sequence< css::beans::Property > SAL_CALL Frame::getProperties()
 
     sal_Int32 c = static_cast<sal_Int32>(m_lProps.size());
     css::uno::Sequence< css::beans::Property > lProps(c);
-    TPropInfoHash::const_iterator pIt;
 
-    for (  pIt  = m_lProps.begin();
-           pIt != m_lProps.end();
-         ++pIt                    )
+    for (auto const& elem : m_lProps)
     {
-        lProps[--c] = pIt->second;
+        lProps[--c] = elem.second;
     }
 
     return lProps;
diff --git a/framework/source/services/modulemanager.cxx b/framework/source/services/modulemanager.cxx
index bf4a153ec3ee..25c7cda3048b 100644
--- a/framework/source/services/modulemanager.cxx
+++ b/framework/source/services/modulemanager.cxx
@@ -229,17 +229,11 @@ void SAL_CALL ModuleManager::replaceByName(const OUString& sName ,
                 static_cast< cppu::OWeakObject * >(this));
     }
 
-    ::comphelper::SequenceAsHashMap::const_iterator pProp;
-    for (  pProp  = lProps.begin();
-           pProp != lProps.end()  ;
-         ++pProp                  )
+    for (auto const& prop : lProps)
     {
-        const OUString& sPropName  = pProp->first;
-        const css::uno::Any&   aPropValue = pProp->second;
-
         // let "NoSuchElementException" out ! We support the same API ...
         // and without a flush() at the end all changed data before will be ignored !
-        xModule->replaceByName(sPropName, aPropValue);
+        xModule->replaceByName(prop.first, prop.second);
     }
 
     ::comphelper::ConfigurationHelper::flush(xCfg);
diff --git a/framework/source/services/pathsettings.cxx b/framework/source/services/pathsettings.cxx
index a4169b48f1f7..82feb855a636 100644
--- a/framework/source/services/pathsettings.cxx
+++ b/framework/source/services/pathsettings.cxx
@@ -683,27 +683,22 @@ void PathSettings::impl_storePath(const PathSettings::PathInfo& aPath)
 void PathSettings::impl_mergeOldUserPaths(      PathSettings::PathInfo& rPath,
                                           const std::vector<OUString>& lOld )
 {
-    std::vector<OUString>::const_iterator pIt;
-    for (  pIt  = lOld.begin();
-           pIt != lOld.end();
-         ++pIt                )
+    for (auto const& old : lOld)
     {
-        const OUString& sOld = *pIt;
-
         if (rPath.bIsSinglePath)
         {
             SAL_WARN_IF(lOld.size()>1, "fwk", "PathSettings::impl_mergeOldUserPaths(): Single path has more than one path value inside old configuration (Common.xcu)!");
-            if ( rPath.sWritePath != sOld )
-               rPath.sWritePath = sOld;
+            if ( rPath.sWritePath != old )
+               rPath.sWritePath = old;
         }
         else
         {
             if (
-                (  std::find(rPath.lInternalPaths.begin(), rPath.lInternalPaths.end(), sOld) == rPath.lInternalPaths.end()) &&
-                (  std::find(rPath.lUserPaths.begin(), rPath.lUserPaths.end(), sOld)     == rPath.lUserPaths.end()    ) &&
-                (  rPath.sWritePath != sOld                                     )
+                (  std::find(rPath.lInternalPaths.begin(), rPath.lInternalPaths.end(), old) == rPath.lInternalPaths.end()) &&
+                (  std::find(rPath.lUserPaths.begin(), rPath.lUserPaths.end(), old)     == rPath.lUserPaths.end()    ) &&
+                (  rPath.sWritePath != old                                     )
                )
-               rPath.lUserPaths.push_back(sOld);
+               rPath.lUserPaths.push_back(old);
         }
     }
 }
@@ -936,20 +931,15 @@ void PathSettings::impl_subst(std::vector<OUString>& lVals   ,
                               const css::uno::Reference< css::util::XStringSubstitution >& xSubst  ,
                                     bool                                               bReSubst)
 {
-    std::vector<OUString>::iterator pIt;
-
-    for (  pIt  = lVals.begin();
-           pIt != lVals.end();
-         ++pIt                 )
+    for (auto & old : lVals)
     {
-        const OUString& sOld = *pIt;
-              OUString  sNew;
+        OUString  sNew;
         if (bReSubst)
-            sNew = xSubst->reSubstituteVariables(sOld);
+            sNew = xSubst->reSubstituteVariables(old);
         else
-            sNew = xSubst->substituteVariables(sOld, false);
+            sNew = xSubst->substituteVariables(old, false);
 
-        *pIt = sNew;
+        old = sNew;
     }
 }
 
@@ -968,28 +958,23 @@ void PathSettings::impl_subst(PathSettings::PathInfo& aPath   ,
 
 OUString PathSettings::impl_convertPath2OldStyle(const PathSettings::PathInfo& rPath) const
 {
-    std::vector<OUString>::const_iterator pIt;
     std::vector<OUString> lTemp;
     lTemp.reserve(rPath.lInternalPaths.size() + rPath.lUserPaths.size() + 1);
 
-    for (  pIt  = rPath.lInternalPaths.begin();
-           pIt != rPath.lInternalPaths.end();
-         ++pIt                                 )
+    for (auto const& internalPath : rPath.lInternalPaths)
     {
-        lTemp.push_back(*pIt);
+        lTemp.push_back(internalPath);
     }
-    for (  pIt  = rPath.lUserPaths.begin();
-           pIt != rPath.lUserPaths.end();
-         ++pIt                             )
+    for (auto const& userPath : rPath.lUserPaths)
     {
-        lTemp.push_back(*pIt);
+        lTemp.push_back(userPath);
     }
 
     if (!rPath.sWritePath.isEmpty())
         lTemp.push_back(rPath.sWritePath);
 
     OUStringBuffer sPathVal(256);
-    for (  pIt  = lTemp.begin();
+    for (  auto pIt  = lTemp.begin();
            pIt != lTemp.end();
                                )
     {
@@ -1024,15 +1009,12 @@ void PathSettings::impl_purgeKnownPaths(PathSettings::PathInfo& rPath,
 
     // Erase items in the internal path list from lList.
     // Also erase items in the internal path list from the user path list.
-    for (  pIt  = rPath.lInternalPaths.begin();
-           pIt != rPath.lInternalPaths.end();
-         ++pIt                                 )
+    for (auto const& internalPath : rPath.lInternalPaths)
     {
-        const OUString& rItem = *pIt;
-        std::vector<OUString>::iterator pItem = std::find(lList.begin(), lList.end(), rItem);
+        std::vector<OUString>::iterator pItem = std::find(lList.begin(), lList.end(), internalPath);
         if (pItem != lList.end())
             lList.erase(pItem);
-        pItem = std::find(rPath.lUserPaths.begin(), rPath.lUserPaths.end(), rItem);
+        pItem = std::find(rPath.lUserPaths.begin(), rPath.lUserPaths.end(), internalPath);
         if (pItem != rPath.lUserPaths.end())
             rPath.lUserPaths.erase(pItem);
     }
@@ -1045,8 +1027,7 @@ void PathSettings::impl_purgeKnownPaths(PathSettings::PathInfo& rPath,
         std::vector<OUString>::iterator pItem = std::find(lList.begin(), lList.end(), rItem);
         if ( pItem == lList.end() )
         {
-            rPath.lUserPaths.erase(pIt);
-            pIt = rPath.lUserPaths.begin();
+            pIt = rPath.lUserPaths.erase(pIt);
         }
         else
         {
@@ -1055,12 +1036,9 @@ void PathSettings::impl_purgeKnownPaths(PathSettings::PathInfo& rPath,
     }
 
     // Erase items in the user path list from lList.
-    for (  pIt  = rPath.lUserPaths.begin();
-           pIt != rPath.lUserPaths.end();
-         ++pIt                             )
+    for (auto const& userPath : rPath.lUserPaths)
     {
-        const OUString& rItem = *pIt;
-        std::vector<OUString>::iterator pItem = std::find(lList.begin(), lList.end(), rItem);
+        std::vector<OUString>::iterator pItem = std::find(lList.begin(), lList.end(), userPath);
         if (pItem != lList.end())
             lList.erase(pItem);
     }
@@ -1080,12 +1058,9 @@ void PathSettings::impl_rebuildPropertyDescriptor()
     sal_Int32 i = 0;
     m_lPropDesc.realloc(c*IDGROUP_COUNT);
 
-    PathHash::const_iterator pIt;
-    for (  pIt  = m_lPaths.begin();
-           pIt != m_lPaths.end();
-         ++pIt                     )
+    for (auto const& path : m_lPaths)
     {
-        const PathSettings::PathInfo& rPath = pIt->second;
+        const PathSettings::PathInfo& rPath = path.second;
               css::beans::Property*   pProp = nullptr;
 
         pProp             = &(m_lPropDesc[i]);
@@ -1201,12 +1176,9 @@ void PathSettings::impl_setPathValue(      sal_Int32      nID ,
                 }
                 else
                 {
-                    std::vector<OUString>::const_iterator pIt;
-                    for (  pIt  = lList.begin();
-                           pIt != lList.end();
-                         ++pIt                 )
+                    for (auto const& elem : lList)
                     {
-                        aChangePath.lUserPaths.push_back(*pIt);
+                        aChangePath.lUserPaths.push_back(elem);
                     }
                 }
              }
@@ -1274,13 +1246,9 @@ void PathSettings::impl_setPathValue(      sal_Int32      nID ,
 
 bool PathSettings::impl_isValidPath(const std::vector<OUString>& lPath) const
 {
-    std::vector<OUString>::const_iterator pIt;
-    for (  pIt  = lPath.begin();
-           pIt != lPath.end();
-         ++pIt                 )
+    for (auto const& path : lPath)
     {
-        const OUString& rVal = *pIt;
-        if (! impl_isValidPath(rVal))
+        if (! impl_isValidPath(path))
             return false;
     }
 
diff --git a/framework/source/uiconfiguration/ImplImageList.cxx b/framework/source/uiconfiguration/ImplImageList.cxx
index 19bb1e8a1266..c759acd6fdf4 100644
--- a/framework/source/uiconfiguration/ImplImageList.cxx
+++ b/framework/source/uiconfiguration/ImplImageList.cxx
@@ -38,9 +38,9 @@ ImplImageList::ImplImageList( const ImplImageList &aSrc )
     , maImageSize(aSrc.maImageSize)
 {
     maImages.reserve( aSrc.maImages.size() );
-    for ( std::vector<ImageAryData *>::const_iterator aIt = aSrc.maImages.begin(), aEnd = aSrc.maImages.end(); aIt != aEnd; ++aIt )
+    for (auto const& elem : aSrc.maImages)
     {
-        ImageAryData* pAryData = new ImageAryData( **aIt );
+        ImageAryData* pAryData = new ImageAryData(*elem);
         maImages.push_back( pAryData );
         if( !pAryData->maName.isEmpty() )
             maNameHash [ pAryData->maName ] = pAryData;
@@ -49,8 +49,8 @@ ImplImageList::ImplImageList( const ImplImageList &aSrc )
 
 ImplImageList::~ImplImageList()
 {
-    for ( std::vector<ImageAryData *>::iterator aIt = maImages.begin(), aEnd = maImages.end(); aIt != aEnd; ++aIt )
-        delete *aIt;
+    for (auto const& elem : maImages)
+        delete elem;
 }
 
 void ImplImageList::AddImage( const OUString &aName,
diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx b/framework/source/uiconfiguration/imagemanagerimpl.cxx
index ee88e2756541..080ac0db8aa7 100644
--- a/framework/source/uiconfiguration/imagemanagerimpl.cxx
+++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx
@@ -995,24 +995,23 @@ void ImageManagerImpl::reload()
                 GraphicNameAccess* pReplacedImages( nullptr );
                 GraphicNameAccess* pRemovedImages( nullptr );
 
-                const sal_uInt32 nNewCount = aNewUserCmdImageSet.size();
-                for ( j = 0; j < nNewCount; j++ )
+                for (auto const& newUserCmdImage : aNewUserCmdImageSet)
                 {
-                    CommandMap::iterator pIter = aOldUserCmdImageSet.find( aNewUserCmdImageSet[j] );
+                    CommandMap::iterator pIter = aOldUserCmdImageSet.find(newUserCmdImage);
                     if ( pIter != aOldUserCmdImageSet.end() )
                     {
                         pIter->second = true; // mark entry as replaced
                         if ( !pReplacedImages )
                             pReplacedImages = new GraphicNameAccess();
-                        pReplacedImages->addElement( aNewUserCmdImageSet[j],
-                                                     GetXGraphic(pImageList->GetImage(aNewUserCmdImageSet[j])) );
+                        pReplacedImages->addElement( newUserCmdImage,
+                                                     GetXGraphic(pImageList->GetImage(newUserCmdImage)) );
                     }
                     else
                     {
                         if ( !pInsertedImages )
                             pInsertedImages = new GraphicNameAccess();
-                        pInsertedImages->addElement( aNewUserCmdImageSet[j],
-                                                     GetXGraphic(pImageList->GetImage(aNewUserCmdImageSet[j])) );
+                        pInsertedImages->addElement( newUserCmdImage,
+                                                     GetXGraphic(pImageList->GetImage(newUserCmdImage)) );
                     }
                 }
 
@@ -1027,30 +1026,29 @@ void ImageManagerImpl::reload()
                     pDefaultImageList = implts_getDefaultImageList();
                 }
                 uno::Reference<XGraphic> xEmptyGraphic;
-                CommandMap::const_iterator pIter = aOldUserCmdImageSet.begin();
-                while ( pIter != aOldUserCmdImageSet.end() )
+                for (auto const& oldUserCmdImage : aOldUserCmdImageSet)
                 {
-                    if ( !pIter->second )
+                    if ( !oldUserCmdImage.second )
                     {
                         if ( m_bUseGlobal )
                         {
-                            Image aImage = pDefaultImageList->getImageFromCommandURL( i, pIter->first );
+                            Image aImage = pDefaultImageList->getImageFromCommandURL( i, oldUserCmdImage.first );
                             if ( !aImage )
-                                aImage = rGlobalImageList->getImageFromCommandURL( i, pIter->first );
+                                aImage = rGlobalImageList->getImageFromCommandURL( i, oldUserCmdImage.first );
 
                             if ( !aImage )
                             {
                                 // No image in the module/global image list => remove user image
                                 if ( !pRemovedImages )
                                     pRemovedImages = new GraphicNameAccess();
-                                pRemovedImages->addElement( pIter->first, xEmptyGraphic );
+                                pRemovedImages->addElement( oldUserCmdImage.first, xEmptyGraphic );
                             }
                             else
                             {
                                 // Image has been found in the module/global image list => replace user image
                                 if ( !pReplacedImages )
                                     pReplacedImages = new GraphicNameAccess();
-                                pReplacedImages->addElement(pIter->first, GetXGraphic(aImage));
+                                pReplacedImages->addElement(oldUserCmdImage.first, GetXGraphic(aImage));
                             }
                         } // if ( m_bUseGlobal )
                         else
@@ -1058,10 +1056,9 @@ void ImageManagerImpl::reload()
                             // No image in the user image list => remove user image
                             if ( !pRemovedImages )
                                 pRemovedImages = new GraphicNameAccess();
-                            pRemovedImages->addElement( pIter->first, xEmptyGraphic );
+                            pRemovedImages->addElement( oldUserCmdImage.first, xEmptyGraphic );
                         }
                     }
-                    ++pIter;
                 }
 
                 aGuard.clear();
diff --git a/framework/source/uiconfiguration/moduleuicfgsupplier.cxx b/framework/source/uiconfiguration/moduleuicfgsupplier.cxx
index e451113d9aa1..095fcb5b0f66 100644
--- a/framework/source/uiconfiguration/moduleuicfgsupplier.cxx
+++ b/framework/source/uiconfiguration/moduleuicfgsupplier.cxx
@@ -124,13 +124,11 @@ void SAL_CALL ModuleUIConfigurationManagerSupplier::disposing()
     osl::MutexGuard g(rBHelper.rMutex);
 
     // dispose all our module user interface configuration managers
-    ModuleToModuleCfgMgr::iterator pIter = m_aModuleToModuleUICfgMgrMap.begin();
-    while ( pIter != m_aModuleToModuleUICfgMgrMap.end() )
+    for (auto const& elem : m_aModuleToModuleUICfgMgrMap)
     {
-        Reference< XComponent > xComponent( pIter->second, UNO_QUERY );
+        Reference< XComponent > xComponent( elem.second, UNO_QUERY );
         if ( xComponent.is() )
             xComponent->dispose();
-        ++pIter;
     }
     m_aModuleToModuleUICfgMgrMap.clear();
     m_xModuleMgr.clear();
diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
index 49f3db5ca722..92dfa66c1a00 100644
--- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
@@ -278,17 +278,16 @@ void ModuleUIConfigurationManager::impl_fillSequenceWithElementTypeInfo( UIEleme
     impl_preloadUIElementTypeList( LAYER_DEFAULT, nElementType );
 
     UIElementDataHashMap& rUserElements = m_aUIElements[LAYER_USERDEFINED][nElementType].aElementsHashMap;
-    UIElementDataHashMap::const_iterator pUserIter = rUserElements.begin();
 
     OUString aCustomUrlPrefix( "custom_" );
-    while ( pUserIter != rUserElements.end() )
+    for (auto const& userElement : rUserElements)
     {
-        sal_Int32 nIndex = pUserIter->second.aResourceURL.indexOf( aCustomUrlPrefix, RESOURCEURL_PREFIX_SIZE );
+        sal_Int32 nIndex = userElement.second.aResourceURL.indexOf( aCustomUrlPrefix, RESOURCEURL_PREFIX_SIZE );
         if ( nIndex > RESOURCEURL_PREFIX_SIZE )
         {
             // Performance: Retrieve user interface name only for custom user interface elements.
             // It's only used by them!
-            UIElementData* pDataSettings = impl_findUIElementData( pUserIter->second.aResourceURL, nElementType );
+            UIElementData* pDataSettings = impl_findUIElementData( userElement.second.aResourceURL, nElementType );
             if ( pDataSettings )
             {
                 // Retrieve user interface name from XPropertySet interface
@@ -300,33 +299,31 @@ void ModuleUIConfigurationManager::impl_fillSequenceWithElementTypeInfo( UIEleme
                     a >>= aUIName;
                 }
 
-                UIElementInfo aInfo( pUserIter->second.aResourceURL, aUIName );
-                aUIElementInfoCollection.emplace( pUserIter->second.aResourceURL, aInfo );
+                UIElementInfo aInfo( userElement.second.aResourceURL, aUIName );
+                aUIElementInfoCollection.emplace( userElement.second.aResourceURL, aInfo );
             }
         }
         else
         {
             // The user interface name for standard user interface elements is stored in the WindowState.xcu file
-            UIElementInfo aInfo( pUserIter->second.aResourceURL, OUString() );
-            aUIElementInfoCollection.emplace( pUserIter->second.aResourceURL, aInfo );
+            UIElementInfo aInfo( userElement.second.aResourceURL, OUString() );
+            aUIElementInfoCollection.emplace( userElement.second.aResourceURL, aInfo );
         }
-        ++pUserIter;
     }
 
     UIElementDataHashMap& rDefaultElements = m_aUIElements[LAYER_DEFAULT][nElementType].aElementsHashMap;
-    UIElementDataHashMap::const_iterator pDefIter = rDefaultElements.begin();
 
-    while ( pDefIter != rDefaultElements.end() )
+    for (auto const& defaultElement : rDefaultElements)
     {
-        UIElementInfoHashMap::const_iterator pIterInfo = aUIElementInfoCollection.find( pDefIter->second.aResourceURL );
+        UIElementInfoHashMap::const_iterator pIterInfo = aUIElementInfoCollection.find( defaultElement.second.aResourceURL );
         if ( pIterInfo == aUIElementInfoCollection.end() )
         {
-            sal_Int32 nIndex = pDefIter->second.aResourceURL.indexOf( aCustomUrlPrefix, RESOURCEURL_PREFIX_SIZE );
+            sal_Int32 nIndex = defaultElement.second.aResourceURL.indexOf( aCustomUrlPrefix, RESOURCEURL_PREFIX_SIZE );
             if ( nIndex > RESOURCEURL_PREFIX_SIZE )
             {
                 // Performance: Retrieve user interface name only for custom user interface elements.
                 // It's only used by them!
-                UIElementData* pDataSettings = impl_findUIElementData( pDefIter->second.aResourceURL, nElementType );
+                UIElementData* pDataSettings = impl_findUIElementData( defaultElement.second.aResourceURL, nElementType );
                 if ( pDataSettings )
                 {
                     // Retrieve user interface name from XPropertySet interface
@@ -337,20 +334,17 @@ void ModuleUIConfigurationManager::impl_fillSequenceWithElementTypeInfo( UIEleme
                         Any a = xPropSet->getPropertyValue( m_aPropUIName );
                         a >>= aUIName;
                     }
-
-                    UIElementInfo aInfo( pDefIter->second.aResourceURL, aUIName );
-                    aUIElementInfoCollection.emplace( pDefIter->second.aResourceURL, aInfo );
+                    UIElementInfo aInfo( defaultElement.second.aResourceURL, aUIName );
+                    aUIElementInfoCollection.emplace( defaultElement.second.aResourceURL, aInfo );
                 }
             }
             else
             {
                 // The user interface name for standard user interface elements is stored in the WindowState.xcu file
-                UIElementInfo aInfo( pDefIter->second.aResourceURL, OUString() );
-                aUIElementInfoCollection.emplace( pDefIter->second.aResourceURL, aInfo );
+                UIElementInfo aInfo( defaultElement.second.aResourceURL, OUString() );
+                aUIElementInfoCollection.emplace( defaultElement.second.aResourceURL, aInfo );
             }
         }
-
-        ++pDefIter;
     }
 }
 
@@ -542,11 +536,10 @@ ModuleUIConfigurationManager::UIElementData*  ModuleUIConfigurationManager::impl
 void ModuleUIConfigurationManager::impl_storeElementTypeData( const Reference< XStorage >& xStorage, UIElementType& rElementType, bool bResetModifyState )
 {
     UIElementDataHashMap& rHashMap          = rElementType.aElementsHashMap;
-    UIElementDataHashMap::iterator pIter    = rHashMap.begin();
 
-    while ( pIter != rHashMap.end() )
+    for (auto & elem : rHashMap)
     {
-        UIElementData& rElement = pIter->second;
+        UIElementData& rElement = elem.second;
         if ( rElement.bModified )
         {
             if ( rElement.bDefault )
@@ -612,8 +605,6 @@ void ModuleUIConfigurationManager::impl_storeElementTypeData( const Reference< X
                     rElement.bModified = false;
             }
         }
-
-        ++pIter;
     }
 
     // commit element type storage
@@ -634,7 +625,6 @@ void ModuleUIConfigurationManager::impl_resetElementTypeData(
     ConfigEventNotifyContainer& rReplaceNotifyContainer )
 {
     UIElementDataHashMap& rHashMap          = rUserElementType.aElementsHashMap;
-    UIElementDataHashMap::iterator pIter    = rHashMap.begin();
 
     Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
     Reference< XInterface >  xIfac( xThis, UNO_QUERY );
@@ -643,9 +633,9 @@ void ModuleUIConfigurationManager::impl_resetElementTypeData(
 
     // Make copies of the event structures to be thread-safe. We have to unlock our mutex before calling
     // our listeners!
-    while ( pIter != rHashMap.end() )
+    for (auto & elem : rHashMap)
     {
-        UIElementData& rElement = pIter->second;
+        UIElementData& rElement = elem.second;
         if ( !rElement.bDefault )
         {
             if ( xDefaultNameAccess->hasByName( rElement.aName ))
@@ -685,8 +675,6 @@ void ModuleUIConfigurationManager::impl_resetElementTypeData(
                 rElement.bDefault  = true;
             }
         }
-
-        ++pIter;
     }
 
     // Remove all settings from our user interface elements
@@ -700,7 +688,6 @@ void ModuleUIConfigurationManager::impl_reloadElementTypeData(
     ConfigEventNotifyContainer& rReplaceNotifyContainer )
 {
     UIElementDataHashMap& rHashMap          = rUserElementType.aElementsHashMap;
-    UIElementDataHashMap::iterator pIter    = rHashMap.begin();
     Reference< XNameAccess > xUserNameAccess( rUserElementType.xStorage, UNO_QUERY );
     Reference< XNameAccess > xDefaultNameAccess( rDefaultElementType.xStorage, UNO_QUERY );
 
@@ -708,9 +695,9 @@ void ModuleUIConfigurationManager::impl_reloadElementTypeData(
     Reference< XInterface > xIfac( xThis, UNO_QUERY );
     sal_Int16 nType = rUserElementType.nElementType;
 
-    while ( pIter != rHashMap.end() )
+    for (auto & elem : rHashMap)
     {
-        UIElementData& rElement = pIter->second;
+        UIElementData& rElement = elem.second;
         if ( rElement.bModified )
         {
             if ( xUserNameAccess->hasByName( rElement.aName ))
@@ -770,7 +757,6 @@ void ModuleUIConfigurationManager::impl_reloadElementTypeData(
                 rElement.bDefault  = true;
             }
         }
-        ++pIter;
     }
 
     rUserElementType.bModified = false;
@@ -1096,15 +1082,13 @@ Sequence< Sequence< PropertyValue > > SAL_CALL ModuleUIConfigurationManager::get
     aUIElementInfo[1].Name = m_aPropUIName;
 
     aElementInfoSeq.resize( aUIElementInfoCollection.size() );
-    UIElementInfoHashMap::const_iterator pIter = aUIElementInfoCollection.begin();
 
     sal_Int32 n = 0;
-    while ( pIter != aUIElementInfoCollection.end() )
+    for (auto const& elem : aUIElementInfoCollection)
     {
-        aUIElementInfo[0].Value <<= pIter->second.aResourceURL;
-        aUIElementInfo[1].Value <<= pIter->second.aUIName;
+        aUIElementInfo[0].Value <<= elem.second.aResourceURL;
+        aUIElementInfo[1].Value <<= elem.second.aUIName;
         aElementInfoSeq[n++] = aUIElementInfo;
-        ++pIter;
     }
 
     return comphelper::containerToSequence(aElementInfoSeq);
diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx b/framework/source/uiconfiguration/uiconfigurationmanager.cxx
index 45dd1bf4e00a..9fb4b42ea11d 100644
--- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx
@@ -253,11 +253,10 @@ void UIConfigurationManager::impl_fillSequenceWithElementTypeInfo( UIElementInfo
     impl_preloadUIElementTypeList( nElementType );
 
     UIElementDataHashMap& rUserElements = m_aUIElements[nElementType].aElementsHashMap;
-    UIElementDataHashMap::const_iterator pUserIter = rUserElements.begin();
 
-    while ( pUserIter != rUserElements.end() )
+    for (auto const& elem : rUserElements)
     {
-        UIElementData* pDataSettings = impl_findUIElementData( pUserIter->second.aResourceURL, nElementType );
+        UIElementData* pDataSettings = impl_findUIElementData( elem.second.aResourceURL, nElementType );
         if ( pDataSettings && !pDataSettings->bDefault )
         {
             // Retrieve user interface name from XPropertySet interface
@@ -269,10 +268,9 @@ void UIConfigurationManager::impl_fillSequenceWithElementTypeInfo( UIElementInfo
                 a >>= aUIName;
             }
 
-            UIElementInfo aInfo( pUserIter->second.aResourceURL, aUIName );
-            aUIElementInfoCollection.emplace( pUserIter->second.aResourceURL, aInfo );
+            UIElementInfo aInfo( elem.second.aResourceURL, aUIName );
+            aUIElementInfoCollection.emplace( elem.second.aResourceURL, aInfo );
         }
-        ++pUserIter;
     }
 }
 
@@ -450,11 +448,10 @@ UIConfigurationManager::UIElementData* UIConfigurationManager::impl_findUIElemen
 void UIConfigurationManager::impl_storeElementTypeData( Reference< XStorage > const & xStorage, UIElementType& rElementType, bool bResetModifyState )
 {
     UIElementDataHashMap& rHashMap          = rElementType.aElementsHashMap;
-    UIElementDataHashMap::iterator pIter    = rHashMap.begin();
 
-    while ( pIter != rHashMap.end() )
+    for (auto & elem : rHashMap)
     {
-        UIElementData& rElement = pIter->second;
+        UIElementData& rElement = elem.second;
         if ( rElement.bModified )
         {
             if ( rElement.bDefault )
@@ -520,8 +517,6 @@ void UIConfigurationManager::impl_storeElementTypeData( Reference< XStorage > co
                     rElement.bModified = false;
             }
         }
-
-        ++pIter;
     }
 
     // commit element type storage
@@ -539,16 +534,15 @@ void UIConfigurationManager::impl_resetElementTypeData(
     ConfigEventNotifyContainer& rRemoveNotifyContainer )
 {
     UIElementDataHashMap& rHashMap          = rDocElementType.aElementsHashMap;
-    UIElementDataHashMap::iterator pIter    = rHashMap.begin();
 
     Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
     Reference< XInterface > xIfac( xThis, UNO_QUERY );
 
     // Make copies of the event structures to be thread-safe. We have to unlock our mutex before calling
     // our listeners!
-    while ( pIter != rHashMap.end() )
+    for (auto & elem : rHashMap)
     {
-        UIElementData& rElement = pIter->second;
+        UIElementData& rElement = elem.second;
         if ( !rElement.bDefault )
         {
             // Remove user-defined settings from document
@@ -566,8 +560,6 @@ void UIConfigurationManager::impl_resetElementTypeData(
         }
         else
             rElement.bModified = false;
-
-        ++pIter;
     }
 
     // Remove all settings from our user interface elements
@@ -580,16 +572,15 @@ void UIConfigurationManager::impl_reloadElementTypeData(
     ConfigEventNotifyContainer& rReplaceNotifyContainer )
 {
     UIElementDataHashMap& rHashMap          = rDocElementType.aElementsHashMap;
-    UIElementDataHashMap::iterator pIter    = rHashMap.begin();
     Reference< XStorage > xElementStorage( rDocElementType.xStorage );
 
     Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
     Reference< XInterface > xIfac( xThis, UNO_QUERY );
     sal_Int16 nType = rDocElementType.nElementType;
 
-    while ( pIter != rHashMap.end() )
+    for (auto & elem : rHashMap)
     {
-        UIElementData& rElement = pIter->second;
+        UIElementData& rElement = elem.second;
         if ( rElement.bModified )
         {
             if ( xElementStorage->hasByName( rElement.aName ))
@@ -627,7 +618,6 @@ void UIConfigurationManager::impl_reloadElementTypeData(
                 rElement.bDefault  = true;
             }
         }

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list