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

Julien Nabet serval2412 at yahoo.fr
Thu Feb 8 06:23:43 UTC 2018


 sfx2/source/dialog/itemconnect.cxx      |   20 ++--
 sfx2/source/dialog/tabdlg.cxx           |   64 +++++--------
 sfx2/source/dialog/templdlg.cxx         |   12 +-
 sfx2/source/dialog/versdlg.cxx          |    4 
 sfx2/source/doc/SfxDocumentMetaData.cxx |   28 ++----
 sfx2/source/doc/docfac.cxx              |    4 
 sfx2/source/doc/docinsert.cxx           |    4 
 sfx2/source/doc/oleprops.cxx            |   26 ++---
 sfx2/source/doc/templatedlg.cxx         |   23 ++--
 sfx2/source/sidebar/Deck.cxx            |    4 
 sfx2/source/sidebar/FocusManager.cxx    |   36 +++----
 sfx2/source/sidebar/ResourceManager.cxx |  149 ++++++++++++--------------------
 sfx2/source/sidebar/SidebarToolBox.cxx  |    6 -
 sfx2/source/sidebar/TabBar.cxx          |   76 ++++++----------
 sfx2/source/sidebar/UnoDeck.cxx         |   24 +----
 sfx2/source/sidebar/UnoPanel.cxx        |   37 ++-----
 sfx2/source/uitest/sfx_uiobject.cxx     |   20 +---
 sfx2/source/view/viewsh.cxx             |    4 
 18 files changed, 232 insertions(+), 309 deletions(-)

New commits:
commit d761be572b6a49dff64db47bbdda309e7b984f95
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Wed Feb 7 21:47:10 2018 +0100

    Use for-range loops in sfx2 (part2)
    
    Change-Id: Ie13b5836eff2e9b5dfec4bb95935de9560ab4be0
    Reviewed-on: https://gerrit.libreoffice.org/49393
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sfx2/source/dialog/itemconnect.cxx b/sfx2/source/dialog/itemconnect.cxx
index 02627738bb7b..217fef3f09c5 100644
--- a/sfx2/source/dialog/itemconnect.cxx
+++ b/sfx2/source/dialog/itemconnect.cxx
@@ -155,22 +155,26 @@ void MultiControlWrapperHelper::RegisterControlWrapper( ControlWrapperBase& rWra
 
 void MultiControlWrapperHelper::ModifyControl( TriState eShow )
 {
-    for( ControlWrpVec::iterator aIt = mxImpl->maVec.begin(), aEnd = mxImpl->maVec.end(); aIt != aEnd; ++aIt )
-        (*aIt)->ModifyControl( eShow );
+    for (auto const& elem : mxImpl->maVec)
+        elem->ModifyControl( eShow );
 }
 
 bool MultiControlWrapperHelper::IsControlDontKnow() const
 {
-    bool bIs = !mxImpl->maVec.empty();
-    for( ControlWrpVec::const_iterator aIt = mxImpl->maVec.begin(), aEnd = mxImpl->maVec.end(); bIs && (aIt != aEnd); ++aIt )
-        bIs &= (*aIt)->IsControlDontKnow();
-    return bIs;
+    if (mxImpl->maVec.empty())
+        return false;
+    for (auto const& elem : mxImpl->maVec)
+    {
+        if (!elem->IsControlDontKnow())
+            return false;
+    }
+    return true;
 }
 
 void MultiControlWrapperHelper::SetControlDontKnow( bool bSet )
 {
-    for( ControlWrpVec::iterator aIt = mxImpl->maVec.begin(), aEnd = mxImpl->maVec.end(); aIt != aEnd; ++aIt )
-        (*aIt)->SetControlDontKnow( bSet );
+    for (auto const& elem : mxImpl->maVec)
+        elem->SetControlDontKnow(bSet);
 }
 
 
diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index 4eb7a29d1c49..22d03b7073af 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -342,34 +342,32 @@ void SfxTabDialog::dispose()
 {
     SavePosAndId();
 
-    for ( SfxTabDlgData_Impl::const_iterator it = m_pImpl->aData.begin(); it != m_pImpl->aData.end(); ++it )
+    for (auto & elem : m_pImpl->aData)
     {
-        Data_Impl* pDataObject = *it;
-
-        if ( pDataObject->pTabPage )
+        if ( elem->pTabPage )
         {
             // save settings of all pages (user data)
-            pDataObject->pTabPage->FillUserData();
-            OUString aPageData( pDataObject->pTabPage->GetUserData() );
+            elem->pTabPage->FillUserData();
+            OUString aPageData( elem->pTabPage->GetUserData() );
             if ( !aPageData.isEmpty() )
             {
                 // save settings of all pages (user data)
-                OUString sConfigId = OStringToOUString(pDataObject->pTabPage->GetConfigId(),
+                OUString sConfigId = OStringToOUString(elem->pTabPage->GetConfigId(),
                     RTL_TEXTENCODING_UTF8);
                 if (sConfigId.isEmpty())
                 {
                     SAL_WARN("sfx.dialog", "Tabpage needs to be converted to .ui format");
-                    sConfigId = OUString::number(pDataObject->nId);
+                    sConfigId = OUString::number(elem->nId);
                 }
 
                 SvtViewOptions aPageOpt(EViewType::TabPage, sConfigId);
                 aPageOpt.SetUserItem( USERITEM_NAME, makeAny( aPageData ) );
             }
 
-            pDataObject->pTabPage.disposeAndClear();
+            elem->pTabPage.disposeAndClear();
         }
-        delete pDataObject;
-        pDataObject = nullptr;
+        delete elem;
+        elem = nullptr;
     }
 
     m_pImpl.reset();
@@ -785,10 +783,9 @@ short SfxTabDialog::Ok()
     }
     bool bModified = false;
 
-    for ( SfxTabDlgData_Impl::const_iterator it = m_pImpl->aData.begin(); it != m_pImpl->aData.end(); ++it )
+    for (auto const& elem : m_pImpl->aData)
     {
-        Data_Impl* pDataObject = *it;
-        SfxTabPage* pTabPage = pDataObject->pTabPage;
+        SfxTabPage* pTabPage = elem->pTabPage;
 
         if ( pTabPage )
         {
@@ -1196,14 +1193,9 @@ IMPL_LINK( SfxTabDialog, DeactivatePageHdl, TabControl *, pTabCtrl, bool )
         RefreshInputSet();
         // Flag all Pages as to be initialized as new
 
-        for ( SfxTabDlgData_Impl::const_iterator it = m_pImpl->aData.begin(); it != m_pImpl->aData.end(); ++it )
+        for (auto const& elem : m_pImpl->aData)
         {
-            Data_Impl* pObj = *it;
-
-            if ( pObj->pTabPage.get() != pPage ) // Do not refresh own Page anymore
-                pObj->bRefresh = true;
-            else
-                pObj->bRefresh = false;
+            elem->bRefresh = ( elem->pTabPage.get() != pPage ); // Do not refresh own Page anymore
         }
     }
     return static_cast<bool>(nRet & DeactivateRC::LeavePage);
@@ -1269,13 +1261,12 @@ const sal_uInt16* SfxTabDialog::GetInputRanges( const SfxItemPool& rPool )
         return m_pRanges;
     std::vector<sal_uInt16> aUS;
 
-    for ( SfxTabDlgData_Impl::const_iterator it = m_pImpl->aData.begin(); it != m_pImpl->aData.end(); ++it )
+    for (auto const& elem : m_pImpl->aData)
     {
-        Data_Impl* pDataObject = *it;
 
-        if ( pDataObject->fnGetRanges )
+        if ( elem->fnGetRanges )
         {
-            const sal_uInt16* pTmpRanges = (pDataObject->fnGetRanges)();
+            const sal_uInt16* pTmpRanges = (elem->fnGetRanges)();
             const sal_uInt16* pIter = pTmpRanges;
 
             sal_uInt16 nLen;
@@ -1287,9 +1278,8 @@ const sal_uInt16* SfxTabDialog::GetInputRanges( const SfxItemPool& rPool )
 
     //! Remove duplicated Ids?
     {
-        sal_uInt16 nCount = aUS.size();
-        for ( sal_uInt16 i = 0; i < nCount; ++i )
-            aUS[i] = rPool.GetWhich( aUS[i] );
+        for (auto & elem : aUS)
+            elem = rPool.GetWhich(elem);
     }
 
     // sort
@@ -1333,15 +1323,15 @@ std::vector<OString> SfxTabDialog::getAllPageUIXMLDescriptions() const
 {
     std::vector<OString> aRetval;
 
-    for (SfxTabDlgData_Impl::const_iterator it = m_pImpl->aData.begin(); it != m_pImpl->aData.end(); ++it)
+    for (auto const& elem : m_pImpl->aData)
     {
-        SfxTabPage* pCandidate = GetTabPage((*it)->nId);
+        SfxTabPage* pCandidate = GetTabPage(elem->nId);
 
         if (!pCandidate)
         {
             // force SfxTabPage creation
-            const_cast<SfxTabDialog*>(this)->ShowPage((*it)->nId);
-            pCandidate = GetTabPage((*it)->nId);
+            const_cast<SfxTabDialog*>(this)->ShowPage(elem->nId);
+            pCandidate = GetTabPage(elem->nId);
         }
 
         if (pCandidate)
@@ -1356,20 +1346,20 @@ std::vector<OString> SfxTabDialog::getAllPageUIXMLDescriptions() const
 
 bool SfxTabDialog::selectPageByUIXMLDescription(const OString& rUIXMLDescription)
 {
-    for (SfxTabDlgData_Impl::const_iterator it = m_pImpl->aData.begin(); it != m_pImpl->aData.end(); ++it)
+    for (auto const& elem : m_pImpl->aData)
     {
-        SfxTabPage* pCandidate = (*it)->pTabPage;
+        SfxTabPage* pCandidate = elem->pTabPage;
 
         if (!pCandidate)
         {
             // force SfxTabPage creation
-            ShowPage((*it)->nId);
-            pCandidate = GetTabPage((*it)->nId);
+            ShowPage(elem->nId);
+            pCandidate = GetTabPage(elem->nId);
         }
 
         if (pCandidate && pCandidate->getUIFile() == rUIXMLDescription)
         {
-            ShowPage((*it)->nId);
+            ShowPage(elem->nId);
             return true;
         }
     }
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index 204a7346d6d5..a25f4685c4e7 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -522,8 +522,8 @@ public:
 
 StyleTree_Impl::~StyleTree_Impl()
 {
-    for(StyleTreeArr_Impl::const_iterator it = pChildren.begin(); it != pChildren.end(); ++it)
-        delete *it;
+    for (auto const& child : pChildren)
+        delete child;
 }
 
 StyleTreeArr_Impl& MakeTree_Impl(StyleTreeArr_Impl& rArr)
@@ -1898,18 +1898,16 @@ void SfxCommonTemplateDialog_Impl::DeleteHdl()
         // if there are no used styles selected or the user approved the changes
         if ( !bUsedStyle || aApproved )
         {
-            std::vector<SvTreeListEntry*>::const_iterator it = aList.begin(), itEnd = aList.end();
-
-            for (; it != itEnd; ++it)
+            for (auto const& elem : aList)
             {
-                const OUString aTemplName(pTreeBox ? pTreeBox->GetEntryText(*it) : aFmtLb->GetEntryText(*it));
+                const OUString aTemplName(pTreeBox ? pTreeBox->GetEntryText(elem) : aFmtLb->GetEntryText(elem));
                 bDontUpdate = true; // To prevent the Treelistbox to shut down while deleting
                 Execute_Impl( SID_STYLE_DELETE, aTemplName,
                               OUString(), static_cast<sal_uInt16>(GetFamilyItem_Impl()->GetFamily()) );
 
                 if ( pTreeBox )
                 {
-                    pTreeBox->RemoveParentKeepChildren( *it );
+                    pTreeBox->RemoveParentKeepChildren(elem);
                     bDontUpdate = false;
                 }
             }
diff --git a/sfx2/source/dialog/versdlg.cxx b/sfx2/source/dialog/versdlg.cxx
index c5da37418639..f3d9715c26e2 100644
--- a/sfx2/source/dialog/versdlg.cxx
+++ b/sfx2/source/dialog/versdlg.cxx
@@ -163,9 +163,9 @@ void SfxVersionsTabListBox_Impl::setColSizes()
     }
 
     long nMaxAuthorWidth = nRest/4;
-    for (std::set<OUString>::iterator aI = aAuthors.begin(), aEnd = aAuthors.end(); aI != aEnd; ++aI)
+    for (auto const& author : aAuthors)
     {
-        nMaxAuthorWidth = std::max(nMaxAuthorWidth, GetTextWidth(*aI));
+        nMaxAuthorWidth = std::max(nMaxAuthorWidth, GetTextWidth(author));
         if (nMaxAuthorWidth > nRest/2)
         {
             nMaxAuthorWidth = nRest/2;
diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx
index 9f50689b0c9e..a15ea43e0ed6 100644
--- a/sfx2/source/doc/SfxDocumentMetaData.cxx
+++ b/sfx2/source/doc/SfxDocumentMetaData.cxx
@@ -794,12 +794,11 @@ SfxDocumentMetaData::setMetaList(const char* i_name,
                 m_xDoc->createTextNode(i_rValue[i]), css::uno::UNO_QUERY_THROW);
             // set attributes
             if (i_pAttrs != nullptr) {
-                for (std::vector<std::pair<const char*, OUString> >
-                                ::const_iterator it = (*i_pAttrs)[i].begin();
-                        it != (*i_pAttrs)[i].end(); ++it) {
-                    xElem->setAttributeNS(getNameSpace(it->first),
-                        OUString::createFromAscii(it->first),
-                        it->second);
+                for (auto const& elem : (*i_pAttrs)[i])
+                {
+                    xElem->setAttributeNS(getNameSpace(elem.first),
+                        OUString::createFromAscii(elem.first),
+                        elem.second);
                 }
             }
             xNode->appendChild(xTextNode);
@@ -939,11 +938,10 @@ SfxDocumentMetaData::updateElement(const char *i_name,
                     css::uno::UNO_QUERY_THROW);
             xNode.set(xElem, css::uno::UNO_QUERY_THROW);
             // set attributes
-            for (std::vector<std::pair<const char *, OUString> >
-                    ::const_iterator it = i_pAttrs->begin();
-                    it != i_pAttrs->end(); ++it) {
-                xElem->setAttributeNS(getNameSpace(it->first),
-                    OUString::createFromAscii(it->first), it->second);
+            for (auto const& elem : *i_pAttrs)
+            {
+                xElem->setAttributeNS(getNameSpace(elem.first),
+                    OUString::createFromAscii(elem.first), elem.second);
             }
             m_xParent->appendChild(xNode);
         }
@@ -1163,14 +1161,14 @@ void SfxDocumentMetaData::init(
     }
 
     // user-defined meta data: initialize PropertySet from DOM nodes
-    for (std::vector<css::uno::Reference<css::xml::dom::XNode> >::iterator
-            it = vec.begin(); it != vec.end(); ++it) {
-        css::uno::Reference<css::xml::dom::XElement> xElem(*it,
+    for (auto const& elem : vec)
+    {
+        css::uno::Reference<css::xml::dom::XElement> xElem(elem,
             css::uno::UNO_QUERY_THROW);
         css::uno::Any any;
         OUString name = xElem->getAttributeNS(s_nsODFMeta, "name");
         OUString type = xElem->getAttributeNS(s_nsODFMeta, "value-type");
-        OUString text = getNodeText(*it);
+        OUString text = getNodeText(elem);
         if ( type == "float" ) {
             double d;
             if (::sax::Converter::convertDouble(d, text)) {
diff --git a/sfx2/source/doc/docfac.cxx b/sfx2/source/doc/docfac.cxx
index f190667ee87f..8371c921b422 100644
--- a/sfx2/source/doc/docfac.cxx
+++ b/sfx2/source/doc/docfac.cxx
@@ -103,9 +103,9 @@ void SfxObjectFactory::RegisterViewFactory
 #if OSL_DEBUG_LEVEL > 0
     {
         const OUString sViewName( rFactory.GetAPIViewName() );
-        for ( SfxViewFactoryArr_Impl::const_iterator it = pImpl->aViewFactoryArr.begin(); it != pImpl->aViewFactoryArr.end(); ++it )
+        for (auto const& viewFactory : pImpl->aViewFactoryArr)
         {
-            if ( (*it)->GetAPIViewName() != sViewName )
+            if ( viewFactory->GetAPIViewName() != sViewName )
                 continue;
             SAL_WARN( "sfx", "SfxObjectFactory::RegisterViewFactory: duplicate view name: " << sViewName );
             break;
diff --git a/sfx2/source/doc/docinsert.cxx b/sfx2/source/doc/docinsert.cxx
index 2ddb5b876164..de150152f6a2 100644
--- a/sfx2/source/doc/docinsert.cxx
+++ b/sfx2/source/doc/docinsert.cxx
@@ -142,10 +142,10 @@ SfxMediumList* DocumentInserter::CreateMediumList()
     SfxMediumList* pMediumList = new SfxMediumList;
     if (!m_nError && m_pItemSet && !m_pURLList.empty())
     {
-        for(std::vector<OUString>::const_iterator i = m_pURLList.begin(); i != m_pURLList.end(); ++i)
+        for (auto const& url : m_pURLList)
         {
             SfxMedium* pMedium = new SfxMedium(
-                    *i, SFX_STREAM_READONLY,
+                    url, SFX_STREAM_READONLY,
                     SfxGetpApp()->GetFilterMatcher().GetFilter4FilterName( m_sFilter ), m_pItemSet );
 
             pMedium->UseInteractionHandler( true );
diff --git a/sfx2/source/doc/oleprops.cxx b/sfx2/source/doc/oleprops.cxx
index f69d0ab219f2..bdbf7d8dac65 100644
--- a/sfx2/source/doc/oleprops.cxx
+++ b/sfx2/source/doc/oleprops.cxx
@@ -696,11 +696,11 @@ void SfxOleDictionaryProperty::ImplLoad( SvStream& rStrm )
 void SfxOleDictionaryProperty::ImplSave( SvStream& rStrm )
 {
     // write property ID/name pairs
-    for( SfxOlePropNameMap::const_iterator aIt = maPropNameMap.begin(), aEnd = maPropNameMap.end(); aIt != aEnd; ++aIt )
+    for (auto const& propName : maPropNameMap)
     {
-        rStrm.WriteInt32( aIt->first );
+        rStrm.WriteInt32( propName.first );
         // name always stored as byte string
-        SaveString8( rStrm, aIt->second );
+        SaveString8( rStrm, propName.second );
     }
 }
 
@@ -929,8 +929,8 @@ void SfxOleSection::SetPropertyName( sal_Int32 nPropId, const OUString& rPropNam
 void SfxOleSection::GetPropertyIds( ::std::vector< sal_Int32 >& rPropIds ) const
 {
     rPropIds.clear();
-    for( SfxOlePropMap::const_iterator aIt = maPropMap.begin(), aEnd = maPropMap.end(); aIt != aEnd; ++aIt )
-        rPropIds.push_back( aIt->first );
+    for (auto const& prop : maPropMap)
+        rPropIds.push_back(prop.first);
 }
 
 sal_Int32 SfxOleSection::GetFreePropertyId() const
@@ -989,9 +989,9 @@ void SfxOleSection::ImplLoad( SvStream& rStrm )
 
     // read other properties
     maPropMap.clear();
-    for( SfxOlePropPosMap::const_iterator aIt = aPropPosMap.begin(), aEnd = aPropPosMap.end(); aIt != aEnd; ++aIt )
-        if( SeekToPropertyPos( rStrm, aIt->second ) )
-            LoadProperty( rStrm, aIt->first );
+    for (auto const& propPos : aPropPosMap)
+        if( SeekToPropertyPos( rStrm, propPos.second ) )
+            LoadProperty( rStrm, propPos.first );
 }
 
 void SfxOleSection::ImplSave( SvStream& rStrm )
@@ -1017,8 +1017,8 @@ void SfxOleSection::ImplSave( SvStream& rStrm )
     // write codepage property
     SaveProperty( rStrm, maCodePageProp, nPropPosPos );
     // write other properties
-    for( SfxOlePropMap::const_iterator aIt = maPropMap.begin(), aEnd = maPropMap.end(); aIt != aEnd; ++aIt )
-        SaveProperty( rStrm, *aIt->second, nPropPosPos );
+    for (auto const& prop : maPropMap)
+        SaveProperty( rStrm, *prop.second, nPropPosPos );
 
     // write section size (first field in section header)
     rStrm.Seek( STREAM_SEEK_TO_END );
@@ -1207,16 +1207,16 @@ void SfxOlePropertySet::ImplSave( SvStream& rStrm )
     rStrm.SeekRel( static_cast< sal_sSize >( 20 * nSectCount ) );
 
     // write sections
-    for( SfxOleSectionMap::const_iterator aIt = maSectionMap.begin(), aEnd = maSectionMap.end(); aIt != aEnd; ++aIt )
+    for (auto const& section : maSectionMap)
     {
-        SfxOleSection& rSection = *aIt->second;
+        SfxOleSection& rSection = *section.second;
         rStrm.Seek( STREAM_SEEK_TO_END );
         sal_uInt32 nSectPos = static_cast< sal_uInt32 >( rStrm.Tell() );
         // write the section
         SaveObject( rStrm, rSection );
         // write section guid/position pair
         rStrm.Seek( nSectPosPos );
-        WriteSvGlobalName( rStrm, aIt->first );
+        WriteSvGlobalName( rStrm, section.first );
         rStrm.WriteUInt32( nSectPos );
         nSectPosPos = rStrm.Tell();
     }
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index c5612f1b6c0b..6ab085296433 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -994,10 +994,9 @@ void SfxTemplateManagerDlg::OnTemplateExport()
         {
             sal_uInt16 i = 1;
 
-            std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator pIter = maSelTemplates.begin();
-            for (pIter = maSelTemplates.begin(); pIter != maSelTemplates.end(); ++pIter, ++i)
+            for (auto const& selTemplate : maSelTemplates)
             {
-                const TemplateSearchViewItem *pItem = static_cast<const TemplateSearchViewItem*>(*pIter);
+                const TemplateSearchViewItem *pItem = static_cast<const TemplateSearchViewItem*>(selTemplate);
 
                 INetURLObject aItemPath(pItem->getPath());
 
@@ -1015,6 +1014,7 @@ void SfxTemplateManagerDlg::OnTemplateExport()
                     else
                         aTemplateList = aTemplateList + "\n" + pItem->maTitle;
                 }
+                ++i;
             }
 
             mpSearchView->deselectItems();
@@ -1025,10 +1025,9 @@ void SfxTemplateManagerDlg::OnTemplateExport()
 
             sal_uInt16 i = 1;
 
-            std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator pIter = maSelTemplates.begin();
-            for (pIter = maSelTemplates.begin(); pIter != maSelTemplates.end(); ++pIter, ++i)
+            for (auto const& selTemplate : maSelTemplates)
             {
-                const TemplateViewItem *pItem = static_cast<const TemplateViewItem*>(*pIter);
+                const TemplateViewItem *pItem = static_cast<const TemplateViewItem*>(selTemplate);
 
                 INetURLObject aItemPath(pItem->getPath());
 
@@ -1048,6 +1047,7 @@ void SfxTemplateManagerDlg::OnTemplateExport()
                     else
                         aTemplateList = aTemplateList + "\n" + pItem->maTitle;
                 }
+                ++i;
             }
 
             mpLocalView->deselectItems();
@@ -1199,12 +1199,12 @@ void SfxTemplateManagerDlg::createDefaultTemplateMenu ()
         mpTemplateDefaultMenu->Clear();
 
         sal_uInt16 nItemId = MNI_ACTION_DEFAULT + 1;
-        for( std::vector<OUString>::const_iterator i = aList.begin(); i != aList.end(); ++i )
+        for (auto const& elem : aList)
         {
-            INetURLObject aObj(*i);
+            INetURLObject aObj(elem);
             OUString aTitle = SvFileInformationManager::GetDescription(aObj);
             mpTemplateDefaultMenu->InsertItem(nItemId, aTitle, SvFileInformationManager::GetImage(aObj));
-            mpTemplateDefaultMenu->SetItemCommand(nItemId++, *i);
+            mpTemplateDefaultMenu->SetItemCommand(nItemId++, elem);
         }
 
         mpActionMenu->ShowItem(MNI_ACTION_DEFAULT);
@@ -1229,13 +1229,12 @@ void SfxTemplateManagerDlg::localSearchMoveTo(sal_uInt16 nItemId)
     {
         // Move templates to desired folder if for some reason move fails
         // try copying them.
-        std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator aIter;
         std::set<const ThumbnailViewItem*,selection_cmp_fn> aSelTemplates = maSelTemplates; //Copy to avoid invalidating an iterator
 
-        for (aIter = aSelTemplates.begin(); aIter != aSelTemplates.end(); ++aIter)
+        for (auto const& selTemplate : aSelTemplates)
         {
             const TemplateSearchViewItem *pItem =
-                    static_cast<const TemplateSearchViewItem*>(*aIter);
+                    static_cast<const TemplateSearchViewItem*>(selTemplate);
 
             if(!mpLocalView->moveTemplate(pItem,pItem->mnRegionId,nItemId))
             {
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index f1396cb38bea..ff736a4896a5 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -320,9 +320,9 @@ void Deck::ScrollContainerWindow::Paint(vcl::RenderContext& rRenderContext, cons
     const sal_Int32 nLeft(0);
     const sal_Int32 nRight(GetSizePixel().Width() - 1);
     const sfx2::sidebar::Paint& rHorizontalBorderPaint(Theme::GetPaint(Theme::Paint_HorizontalBorder));
-    for (std::vector<sal_Int32>::const_iterator iY(maSeparators.begin()); iY != maSeparators.end(); ++iY)
+    for (auto const& separator : maSeparators)
     {
-        DrawHelper::DrawHorizontalLine(rRenderContext, nLeft, nRight, *iY,
+        DrawHelper::DrawHorizontalLine(rRenderContext, nLeft, nRight, separator,
                                        nSeparatorHeight, rHorizontalBorderPaint);
     }
 }
diff --git a/sfx2/source/sidebar/FocusManager.cxx b/sfx2/source/sidebar/FocusManager.cxx
index 2f9730958252..78cb149ba0bf 100644
--- a/sfx2/source/sidebar/FocusManager.cxx
+++ b/sfx2/source/sidebar/FocusManager.cxx
@@ -67,16 +67,16 @@ void FocusManager::ClearPanels()
 {
     std::vector<VclPtr<Panel> > aPanels;
     aPanels.swap(maPanels);
-    for (auto iPanel(aPanels.begin()),iEnd(aPanels.end()); iPanel != iEnd; ++iPanel)
+    for (auto const& panel : aPanels)
     {
-        UnregisterWindow(**iPanel);
-        if ((*iPanel)->GetTitleBar())
+        UnregisterWindow(*panel);
+        if (panel->GetTitleBar())
         {
-            UnregisterWindow(*(*iPanel)->GetTitleBar());
-            UnregisterWindow((*iPanel)->GetTitleBar()->GetToolBox());
+            UnregisterWindow(*panel->GetTitleBar());
+            UnregisterWindow(panel->GetTitleBar()->GetToolBox());
         }
 
-        (*iPanel)->RemoveChildEventListener(LINK(this, FocusManager, ChildEventListener));
+        panel->RemoveChildEventListener(LINK(this, FocusManager, ChildEventListener));
     }
 }
 
@@ -84,9 +84,9 @@ void FocusManager::ClearButtons()
 {
     std::vector<VclPtr<Button> > aButtons;
     aButtons.swap(maButtons);
-    for (auto iButton = aButtons.begin(); iButton != aButtons.end(); ++iButton)
+    for (auto const& button : aButtons)
     {
-        UnregisterWindow(**iButton);
+        UnregisterWindow(*button);
     }
 }
 
@@ -109,29 +109,29 @@ void FocusManager::SetDeckTitle (DeckTitleBar* pDeckTitleBar)
 void FocusManager::SetPanels (const SharedPanelContainer& rPanels)
 {
     ClearPanels();
-    for (auto iPanel = rPanels.begin(); iPanel != rPanels.end(); ++iPanel)
+    for (auto const& panel : rPanels)
     {
-        RegisterWindow(**iPanel);
-        if ((*iPanel)->GetTitleBar())
+        RegisterWindow(*panel);
+        if (panel->GetTitleBar())
         {
-            RegisterWindow(*(*iPanel)->GetTitleBar());
-            RegisterWindow((*iPanel)->GetTitleBar()->GetToolBox());
+            RegisterWindow(*panel->GetTitleBar());
+            RegisterWindow(panel->GetTitleBar()->GetToolBox());
         }
 
         // Register also as child event listener at the panel.
-        (*iPanel)->AddChildEventListener(LINK(this, FocusManager, ChildEventListener));
+        panel->AddChildEventListener(LINK(this, FocusManager, ChildEventListener));
 
-        maPanels.emplace_back(iPanel->get());
+        maPanels.emplace_back(panel.get());
     }
 }
 
 void FocusManager::SetButtons (const ::std::vector<Button*>& rButtons)
 {
     ClearButtons();
-    for (auto iButton = rButtons.begin(); iButton != rButtons.end(); ++iButton)
+    for (auto const& button : rButtons)
     {
-        RegisterWindow(**iButton);
-        maButtons.emplace_back(*iButton);
+        RegisterWindow(*button);
+        maButtons.emplace_back(button);
     }
 }
 
diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx
index ead0ce7d7f11..7f77303833b6 100644
--- a/sfx2/source/sidebar/ResourceManager.cxx
+++ b/sfx2/source/sidebar/ResourceManager.cxx
@@ -60,31 +60,30 @@ css::uno::Sequence<OUString> BuildContextList (const ContextList& rContextList)
 {
     const ::std::vector<ContextList::Entry>& entries = rContextList.GetEntries();
 
-     css::uno::Sequence<OUString> result(entries.size());
-     long i = 0;
-
-    for (::std::vector<ContextList::Entry>::const_iterator iEntry(entries.begin()), iEnd(entries.end());
-                                                            iEntry!=iEnd; ++iEntry)
-         {
-            OUString appName = iEntry->maContext.msApplication;
-            OUString contextName = iEntry->maContext.msContext;
-            OUString menuCommand = iEntry->msMenuCommand;
-
-            OUString visibility;
-            if (iEntry->mbIsInitiallyVisible)
-                visibility = "visible";
-            else
-                visibility = "hidden";
+    css::uno::Sequence<OUString> result(entries.size());
+    long i = 0;
 
-            OUString element = appName + ", " + contextName +", " + visibility;
+    for (auto const& entry : entries)
+    {
+        OUString appName = entry.maContext.msApplication;
+        OUString contextName = entry.maContext.msContext;
+        OUString menuCommand = entry.msMenuCommand;
 
-            if (!menuCommand.isEmpty())
-                element += ", "+menuCommand;
+        OUString visibility;
+        if (entry.mbIsInitiallyVisible)
+            visibility = "visible";
+        else
+            visibility = "hidden";
 
-            result[i] = element;
+        OUString element = appName + ", " + contextName +", " + visibility;
 
-            i++;
-        }
+        if (!menuCommand.isEmpty())
+            element += ", "+menuCommand;
+
+        result[i] = element;
+
+        ++i;
+    }
 
     return result;
 
@@ -109,12 +108,9 @@ ResourceManager::~ResourceManager()
 
 void ResourceManager::InitDeckContext(const Context& rContext)
 {
-    DeckContainer::iterator iDeck;
-    for (iDeck = maDecks.begin(); iDeck != maDecks.end(); ++iDeck)
+    for (auto const& deck : maDecks)
     {
-        std::shared_ptr<DeckDescriptor>& rDeck = *iDeck;
-
-        const ContextList::Entry* pMatchingEntry = rDeck->maContextList.GetMatch(rContext);
+        const ContextList::Entry* pMatchingEntry = deck->maContextList.GetMatch(rContext);
 
         bool bIsEnabled;
         if (pMatchingEntry)
@@ -122,22 +118,18 @@ void ResourceManager::InitDeckContext(const Context& rContext)
         else
             bIsEnabled = false;
 
-        rDeck->mbIsEnabled = bIsEnabled;
+        deck->mbIsEnabled = bIsEnabled;
     }
 }
 
 std::shared_ptr<DeckDescriptor> ResourceManager::ImplGetDeckDescriptor(const OUString& rsDeckId) const
 {
-    DeckContainer::const_iterator iDeck;
-
-    for (iDeck = maDecks.begin(); iDeck != maDecks.end(); ++iDeck)
+    for (auto const& deck : maDecks)
     {
-        const std::shared_ptr<DeckDescriptor>& rDeck = *iDeck;
-
-        if (rDeck->mbExperimental && !maMiscOptions.IsExperimentalMode())
+        if (deck->mbExperimental && !maMiscOptions.IsExperimentalMode())
             continue;
-        if (rDeck->msId == rsDeckId)
-            return rDeck;
+        if (deck->msId == rsDeckId)
+            return deck;
     }
     return nullptr;
 }
@@ -149,13 +141,10 @@ std::shared_ptr<DeckDescriptor> ResourceManager::GetDeckDescriptor(const OUStrin
 
 std::shared_ptr<PanelDescriptor> ResourceManager::ImplGetPanelDescriptor(const OUString& rsPanelId) const
 {
-    PanelContainer::const_iterator iPanel;
-    for (iPanel = maPanels.begin(); iPanel != maPanels.end(); ++iPanel)
+    for (auto const& panel : maPanels)
     {
-        const std::shared_ptr<PanelDescriptor>& rPanel = *iPanel;
-
-        if (rPanel->msId == rsPanelId)
-            return rPanel;
+        if (panel->msId == rsPanelId)
+            return panel;
     }
     return nullptr;
 }
@@ -174,15 +163,12 @@ const ResourceManager::DeckContextDescriptorContainer& ResourceManager::GetMatch
     ReadLegacyAddons(rxController);
 
     std::multimap<sal_Int32,DeckContextDescriptor> aOrderedIds;
-    DeckContainer::const_iterator iDeck;
-    for (iDeck = maDecks.begin(); iDeck != maDecks.end(); ++iDeck)
+    for (auto const& deck : maDecks)
     {
-        const std::shared_ptr<DeckDescriptor>& rDeck = *iDeck;
-
-        if (rDeck->mbExperimental && !maMiscOptions.IsExperimentalMode())
+        if (deck->mbExperimental && !maMiscOptions.IsExperimentalMode())
             continue;
 
-        const DeckDescriptor& rDeckDescriptor (*rDeck);
+        const DeckDescriptor& rDeckDescriptor (*deck);
         if (rDeckDescriptor.maContextList.GetMatch(rContext) == nullptr)
             continue;
 
@@ -196,10 +182,9 @@ const ResourceManager::DeckContextDescriptorContainer& ResourceManager::GetMatch
         aOrderedIds.emplace(rDeckDescriptor.mnOrderIndex, aDeckContextDescriptor);
     }
 
-    std::multimap<sal_Int32,DeckContextDescriptor>::const_iterator iId;
-    for (iId = aOrderedIds.begin(); iId != aOrderedIds.end(); ++iId)
+    for (auto const& orderId : aOrderedIds)
     {
-        rDecks.push_back(iId->second);
+        rDecks.push_back(orderId.second);
     }
 
     return rDecks;
@@ -215,11 +200,9 @@ const ResourceManager::PanelContextDescriptorContainer& ResourceManager::GetMatc
     ReadLegacyAddons(rxController);
 
     std::multimap<sal_Int32, PanelContextDescriptor> aOrderedIds;
-    PanelContainer::const_iterator iPanel;
-    for (iPanel = maPanels.begin(); iPanel != maPanels.end(); ++iPanel)
+    for (auto const& panel : maPanels)
     {
-        const std::shared_ptr<PanelDescriptor>& rPanel = *iPanel;
-        const PanelDescriptor& rPanelDescriptor (*rPanel);
+        const PanelDescriptor& rPanelDescriptor (*panel);
         if (rPanelDescriptor.mbExperimental && !maMiscOptions.IsExperimentalMode())
             continue;
         if ( rPanelDescriptor.msDeckId != sDeckId )
@@ -237,10 +220,9 @@ const ResourceManager::PanelContextDescriptorContainer& ResourceManager::GetMatc
         aOrderedIds.emplace(rPanelDescriptor.mnOrderIndex, aPanelContextDescriptor);
     }
 
-    std::multimap<sal_Int32,PanelContextDescriptor>::const_iterator iId;
-    for (iId = aOrderedIds.begin(); iId != aOrderedIds.end(); ++iId)
+    for (auto const& orderId : aOrderedIds)
     {
-        rPanelIds.push_back(iId->second);
+        rPanelIds.push_back(orderId.second);
     }
 
     return rPanelIds;
@@ -298,15 +280,12 @@ void ResourceManager::ReadDeckList()
 
 void ResourceManager::SaveDecksSettings(const Context& rContext)
 {
-    DeckContainer::const_iterator iDeck;
-    for (iDeck = maDecks.begin(); iDeck != maDecks.end(); ++iDeck)
+    for (auto const& deck : maDecks)
     {
-       const std::shared_ptr<DeckDescriptor>& rDeck = *iDeck;
-
-       const ContextList::Entry* pMatchingEntry = rDeck->maContextList.GetMatch(rContext);
+       const ContextList::Entry* pMatchingEntry = deck->maContextList.GetMatch(rContext);
        if (pMatchingEntry)
        {
-            std::shared_ptr<DeckDescriptor> xDeckDesc = GetDeckDescriptor(rDeck->msId);
+            std::shared_ptr<DeckDescriptor> xDeckDesc = GetDeckDescriptor(deck->msId);
             if (xDeckDesc)
                 SaveDeckSettings(xDeckDesc.get());
        }
@@ -369,11 +348,9 @@ void ResourceManager::SaveDeckSettings(const DeckDescriptor* pDeckDesc)
     SharedPanelContainer rPanels = pDeckDesc->mpDeck->GetPanels();
 
     bChanged = false;
-    for ( SharedPanelContainer::iterator iPanel(rPanels.begin()), iEnd(rPanels.end());
-              iPanel!=iEnd; ++iPanel)
+    for (auto const& panel : rPanels)
     {
-        VclPtr<Panel> const & aPanel = *iPanel;
-        OUString panelId = aPanel->GetId();
+        OUString panelId = panel->GetId();
         std::shared_ptr<PanelDescriptor> xPanelDesc = GetPanelDescriptor(panelId);
 
         ::uno::Sequence< OUString > sPanelContextList = BuildContextList(xPanelDesc->maContextList);
@@ -617,14 +594,13 @@ void ResourceManager::ReadContextList (
 
 
         // Add context descriptors.
-        std::vector<vcl::EnumContext::Application>::const_iterator iApplication;
-        for (iApplication = aApplications.begin(); iApplication != aApplications.end(); ++iApplication)
+        for (auto const& application : aApplications)
         {
-            if (*iApplication != vcl::EnumContext::Application::NONE)
+            if (application != vcl::EnumContext::Application::NONE)
             {
                 rContextList.AddContextDescription(
                     Context(
-                        vcl::EnumContext::GetApplicationName(*iApplication),
+                        vcl::EnumContext::GetApplicationName(application),
                         vcl::EnumContext::GetContextName(eContext)),
                     bIsInitiallyVisible,
                     sMenuCommand);
@@ -710,14 +686,11 @@ void ResourceManager::StorePanelExpansionState (
                         const bool bExpansionState,
                         const Context& rContext)
 {
-    PanelContainer::iterator iPanel;
-    for (iPanel = maPanels.begin(); iPanel != maPanels.end(); ++iPanel)
+    for (auto const& panel : maPanels)
     {
-        const std::shared_ptr<PanelDescriptor>& rPanel = *iPanel;
-
-        if (rPanel->msId == rsPanelId)
+        if (panel->msId == rsPanelId)
         {
-            ContextList::Entry* pEntry(rPanel->maContextList.GetMatch(rContext));
+            ContextList::Entry* pEntry(panel->maContextList.GetMatch(rContext));
             if (pEntry != nullptr)
                 pEntry->mbIsInitiallyVisible = bExpansionState;
         }
@@ -775,10 +748,9 @@ bool ResourceManager::IsDeckEnabled (
 
     GetMatchingPanels(aPanelContextDescriptors, rContext, rsDeckId, rxController);
 
-    PanelContextDescriptorContainer::const_iterator iPanel;
-    for (iPanel = aPanelContextDescriptors.begin(); iPanel != aPanelContextDescriptors.end(); ++iPanel)
+    for (auto const& panelContextDescriptor : aPanelContextDescriptors)
     {
-        if (iPanel->mbShowForReadOnlyDocuments)
+        if (panelContextDescriptor.mbShowForReadOnlyDocuments)
             return true;
     }
     return false;
@@ -786,18 +758,16 @@ bool ResourceManager::IsDeckEnabled (
 
 void ResourceManager::UpdateModel(const css::uno::Reference<css::frame::XModel>& xModel)
 {
-    for (DeckContainer::iterator itr = maDecks.begin(); itr != maDecks.end(); ++itr)
+    for (auto const& deck : maDecks)
     {
-        std::shared_ptr<DeckDescriptor>& rDeck = *itr;
-
-        if (!rDeck->mpDeck)
+        if (!deck->mpDeck)
             continue;
 
-        const SharedPanelContainer& rContainer = rDeck->mpDeck->GetPanels();
+        const SharedPanelContainer& rContainer = deck->mpDeck->GetPanels();
 
-        for (SharedPanelContainer::const_iterator it = rContainer.begin(); it != rContainer.end(); ++it)
+        for (auto const& elem : rContainer)
         {
-            css::uno::Reference<css::ui::XUpdateModel> xPanel((*it)->GetPanelComponent(), css::uno::UNO_QUERY);
+            css::uno::Reference<css::ui::XUpdateModel> xPanel(elem->GetPanelComponent(), css::uno::UNO_QUERY);
             if (xPanel.is()) // tdf#108814 interface is optional
             {
                 xPanel->updateModel(xModel);
@@ -808,10 +778,9 @@ void ResourceManager::UpdateModel(const css::uno::Reference<css::frame::XModel>&
 
 void ResourceManager::disposeDecks()
 {
-    for (DeckContainer::iterator itr = maDecks.begin(); itr != maDecks.end(); ++itr)
+    for (auto const& deck : maDecks)
     {
-        std::shared_ptr<DeckDescriptor>& rDeck = *itr;
-        rDeck->mpDeck.disposeAndClear();
+        deck->mpDeck.disposeAndClear();
     }
 }
 
diff --git a/sfx2/source/sidebar/SidebarToolBox.cxx b/sfx2/source/sidebar/SidebarToolBox.cxx
index 44d8afcfe7c7..ba44d821371e 100644
--- a/sfx2/source/sidebar/SidebarToolBox.cxx
+++ b/sfx2/source/sidebar/SidebarToolBox.cxx
@@ -79,11 +79,9 @@ void SidebarToolBox::dispose()
 
     ControllerContainer aControllers;
     aControllers.swap(maControllers);
-    for (ControllerContainer::iterator iController(aControllers.begin()), iEnd(aControllers.end());
-         iController!=iEnd;
-         ++iController)
+    for (auto const& controller : aControllers)
     {
-        Reference<lang::XComponent> xComponent(iController->second, UNO_QUERY);
+        Reference<lang::XComponent> xComponent(controller.second, UNO_QUERY);
         if (xComponent.is())
             xComponent->dispose();
     }
diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx
index b8b97872e09f..ccb6c6e27a61 100644
--- a/sfx2/source/sidebar/TabBar.cxx
+++ b/sfx2/source/sidebar/TabBar.cxx
@@ -77,11 +77,8 @@ TabBar::~TabBar()
 
 void TabBar::dispose()
 {
-    for(ItemContainer::iterator
-            iItem(maItems.begin()), iEnd(maItems.end());
-        iItem!=iEnd;
-        ++iItem)
-        iItem->mpButton.disposeAndClear();
+    for (auto & item : maItems)
+        item.mpButton.disposeAndClear();
     maItems.clear();
     mpMenuButton.disposeAndClear();
     vcl::Window::dispose();
@@ -108,18 +105,17 @@ void TabBar::SetDecks(const ResourceManager::DeckContextDescriptorContainer& rDe
 {
     // Remove the current buttons.
     {
-        for(ItemContainer::iterator iItem(maItems.begin()); iItem != maItems.end(); ++iItem)
+        for (auto & item : maItems)
         {
-            iItem->mpButton.disposeAndClear();
+            item.mpButton.disposeAndClear();
         }
         maItems.clear();
     }
     maItems.resize(rDecks.size());
     sal_Int32 nIndex (0);
-    for (ResourceManager::DeckContextDescriptorContainer::const_iterator
-             iDeck(rDecks.begin()); iDeck != rDecks.end(); ++iDeck)
+    for (auto const& deck : rDecks)
     {
-        std::shared_ptr<DeckDescriptor> xDescriptor = pParentSidebarController->GetResourceManager()->GetDeckDescriptor(iDeck->msId);
+        std::shared_ptr<DeckDescriptor> xDescriptor = pParentSidebarController->GetResourceManager()->GetDeckDescriptor(deck.msId);
         if (xDescriptor == nullptr)
         {
             OSL_ASSERT(xDescriptor!=nullptr);
@@ -135,7 +131,7 @@ void TabBar::SetDecks(const ResourceManager::DeckContextDescriptorContainer& rDe
         rItem.mbIsHidden = ! xDescriptor->mbIsEnabled;
         rItem.mbIsHiddenByDefault = rItem.mbIsHidden; // the default is the state while creating
 
-        rItem.mpButton->Enable(iDeck->mbIsEnabled);
+        rItem.mpButton->Enable(deck.mbIsEnabled);
     }
 
     UpdateButtonIcons();
@@ -147,17 +143,14 @@ void TabBar::UpdateButtonIcons()
     Image aImage = Theme::GetImage(Theme::Image_TabBarMenu);
     mpMenuButton->SetModeImage(aImage);
 
-    for(ItemContainer::const_iterator
-            iItem(maItems.begin()), iEnd(maItems.end());
-        iItem!=iEnd;
-        ++iItem)
+    for (auto const& item : maItems)
     {
-        std::shared_ptr<DeckDescriptor> xDeckDescriptor = pParentSidebarController->GetResourceManager()->GetDeckDescriptor(iItem->msDeckId);
+        std::shared_ptr<DeckDescriptor> xDeckDescriptor = pParentSidebarController->GetResourceManager()->GetDeckDescriptor(item.msDeckId);
 
         if (xDeckDescriptor)
         {
             aImage = GetItemImage(*xDeckDescriptor);
-            iItem->mpButton->SetModeImage(aImage);
+            item.mpButton->SetModeImage(aImage);
         }
     }
 
@@ -189,15 +182,12 @@ void TabBar::Layout()
     }
 
     // Place the deck selection buttons.
-    for(ItemContainer::const_iterator
-            iItem(maItems.begin()), iEnd(maItems.end());
-        iItem!=iEnd;
-        ++iItem)
+    for (auto const& item : maItems)
     {
-        Button& rButton (*iItem->mpButton);
-        rButton.Show( ! iItem->mbIsHidden);
+        Button& rButton (*item.mpButton);
+        rButton.Show( ! item.mbIsHidden);
 
-        if (iItem->mbIsHidden)
+        if (item.mbIsHidden)
             continue;
 
         // Place and size the icon.
@@ -213,22 +203,20 @@ void TabBar::Layout()
 
 void TabBar::HighlightDeck (const OUString& rsDeckId)
 {
-    for (ItemContainer::iterator iItem(maItems.begin()); iItem != maItems.end(); ++iItem)
+    for (auto const& item : maItems)
     {
-        if (iItem->msDeckId == rsDeckId)
-            iItem->mpButton->Check();
+        if (item.msDeckId == rsDeckId)
+            item.mpButton->Check();
         else
-            iItem->mpButton->Check(false);
+            item.mpButton->Check(false);
     }
 }
 
 void TabBar::RemoveDeckHighlight ()
 {
-    for (ItemContainer::iterator iItem(maItems.begin()),iEnd(maItems.end());
-         iItem!=iEnd;
-         ++iItem)
+    for (auto const& item : maItems)
     {
-        iItem->mpButton->Check(false);
+        item.mpButton->Check(false);
     }
 }
 
@@ -341,16 +329,16 @@ void TabBar::ToggleHideFlag (const sal_Int32 nIndex)
 void TabBar::RestoreHideFlags()
 {
     bool bNeedsLayout(false);
-    for (ItemContainer::iterator iItem(maItems.begin()); iItem != maItems.end(); ++iItem)
+    for (auto & item : maItems)
     {
-        if (iItem->mbIsHidden != iItem->mbIsHiddenByDefault)
+        if (item.mbIsHidden != item.mbIsHiddenByDefault)
         {
-            iItem->mbIsHidden = iItem->mbIsHiddenByDefault;
+            item.mbIsHidden = item.mbIsHiddenByDefault;
             bNeedsLayout = true;
 
-            std::shared_ptr<DeckDescriptor> xDeckDescriptor = pParentSidebarController->GetResourceManager()->GetDeckDescriptor(iItem->msDeckId);
+            std::shared_ptr<DeckDescriptor> xDeckDescriptor = pParentSidebarController->GetResourceManager()->GetDeckDescriptor(item.msDeckId);
             if (xDeckDescriptor)
-                xDeckDescriptor->mbIsEnabled = ! iItem->mbIsHidden;
+                xDeckDescriptor->mbIsEnabled = ! item.mbIsHidden;
 
         }
     }
@@ -364,9 +352,9 @@ void TabBar::UpdateFocusManager(FocusManager& rFocusManager)
     aButtons.reserve(maItems.size()+1);
 
     aButtons.push_back(mpMenuButton.get());
-    for (ItemContainer::const_iterator iItem(maItems.begin()); iItem != maItems.end(); ++iItem)
+    for (auto const& item : maItems)
     {
-        aButtons.push_back(iItem->mpButton.get());
+        aButtons.push_back(item.mpButton.get());
     }
     rFocusManager.SetButtons(aButtons);
 }
@@ -378,18 +366,18 @@ IMPL_LINK_NOARG(TabBar, OnToolboxClicked, Button*, void)
 
     std::vector<DeckMenuData> aMenuData;
 
-    for (ItemContainer::const_iterator iItem(maItems.begin()); iItem != maItems.end(); ++iItem)
+    for (auto const& item : maItems)
     {
-        std::shared_ptr<DeckDescriptor> xDeckDescriptor = pParentSidebarController->GetResourceManager()->GetDeckDescriptor(iItem->msDeckId);
+        std::shared_ptr<DeckDescriptor> xDeckDescriptor = pParentSidebarController->GetResourceManager()->GetDeckDescriptor(item.msDeckId);
 
         if (xDeckDescriptor)
         {
             DeckMenuData aData;
             aData.msDisplayName = xDeckDescriptor->msTitle;
             aData.msDeckId = xDeckDescriptor->msId;
-            aData.mbIsCurrentDeck = iItem->mpButton->IsChecked();
-            aData.mbIsActive = !iItem->mbIsHidden;
-            aData.mbIsEnabled = iItem->mpButton->IsEnabled();
+            aData.mbIsCurrentDeck = item.mpButton->IsChecked();
+            aData.mbIsActive = !item.mbIsHidden;
+            aData.mbIsEnabled = item.mpButton->IsEnabled();
 
             aMenuData.push_back(aData);
         }
diff --git a/sfx2/source/sidebar/UnoDeck.cxx b/sfx2/source/sidebar/UnoDeck.cxx
index a87dcb7194d8..1bcc0d8f7e86 100644
--- a/sfx2/source/sidebar/UnoDeck.cxx
+++ b/sfx2/source/sidebar/UnoDeck.cxx
@@ -192,10 +192,9 @@ void SAL_CALL SfxUnoDeck::moveUp()
     sal_Int32 curOrderIndex = getOrderIndex();
     sal_Int32 previousIndex = GetMinOrderIndex(aDecks);
 
-    ResourceManager::DeckContextDescriptorContainer::const_iterator iDeck;
-    for (iDeck = aDecks.begin(); iDeck != aDecks.end(); ++iDeck)
+    for (auto const& deck : aDecks)
     {
-        sal_Int32 index = pSidebarController->GetResourceManager()->GetDeckDescriptor(iDeck->msId)->mnOrderIndex;
+        sal_Int32 index = pSidebarController->GetResourceManager()->GetDeckDescriptor(deck.msId)->mnOrderIndex;
         if( index < curOrderIndex && index > previousIndex)
             previousIndex = index;
     }
@@ -224,11 +223,9 @@ void SAL_CALL SfxUnoDeck::moveDown()
     sal_Int32 curOrderIndex = getOrderIndex();
     sal_Int32 nextIndex = GetMaxOrderIndex(aDecks);
 
-
-    ResourceManager::DeckContextDescriptorContainer::const_iterator iDeck;
-    for (iDeck = aDecks.begin(); iDeck != aDecks.end(); ++iDeck)
+    for (auto const& deck : aDecks)
     {
-        sal_Int32 index = pSidebarController->GetResourceManager()->GetDeckDescriptor(iDeck->msId)->mnOrderIndex;
+        sal_Int32 index = pSidebarController->GetResourceManager()->GetDeckDescriptor(deck.msId)->mnOrderIndex;
         if( index > curOrderIndex && index < nextIndex)
             nextIndex = index;
     }
@@ -255,9 +252,9 @@ sal_Int32 SfxUnoDeck::GetMinOrderIndex(ResourceManager::DeckContextDescriptorCon
     iDeck = aDecks.begin();
     sal_Int32 minIndex = pSidebarController->GetResourceManager()->GetDeckDescriptor(iDeck->msId)->mnOrderIndex;
 
-    for (iDeck = aDecks.begin(); iDeck != aDecks.end(); ++iDeck)
+    for (auto const& deck : aDecks)
     {
-        sal_Int32 index = pSidebarController->GetResourceManager()->GetDeckDescriptor(iDeck->msId)->mnOrderIndex;
+        sal_Int32 index = pSidebarController->GetResourceManager()->GetDeckDescriptor(deck.msId)->mnOrderIndex;
         if(minIndex > index)
             minIndex = index;
     }
@@ -268,14 +265,11 @@ sal_Int32 SfxUnoDeck::GetMaxOrderIndex(ResourceManager::DeckContextDescriptorCon
 {
     SidebarController* pSidebarController = getSidebarController();
 
-    ResourceManager::DeckContextDescriptorContainer::const_iterator iDeck;
-
-    iDeck = aDecks.begin();
-    sal_Int32 maxIndex = pSidebarController->GetResourceManager()->GetDeckDescriptor(iDeck->msId)->mnOrderIndex;
+    sal_Int32 maxIndex = pSidebarController->GetResourceManager()->GetDeckDescriptor(aDecks.begin()->msId)->mnOrderIndex;
 
-    for (iDeck = aDecks.begin(); iDeck != aDecks.end(); ++iDeck)
+    for (auto const& deck : aDecks)
     {
-        sal_Int32 index = pSidebarController->GetResourceManager()->GetDeckDescriptor(iDeck->msId)->mnOrderIndex;
+        sal_Int32 index = pSidebarController->GetResourceManager()->GetDeckDescriptor(deck.msId)->mnOrderIndex;
         if(maxIndex < index)
             maxIndex = index;
     }
diff --git a/sfx2/source/sidebar/UnoPanel.cxx b/sfx2/source/sidebar/UnoPanel.cxx
index a382fe133b4c..f4f022ca74c0 100644
--- a/sfx2/source/sidebar/UnoPanel.cxx
+++ b/sfx2/source/sidebar/UnoPanel.cxx
@@ -93,13 +93,10 @@ void SAL_CALL SfxUnoPanel::expand( const sal_Bool bCollapseOther )
     if (bCollapseOther)
     {
         SharedPanelContainer aPanels = mpDeck->GetPanels();
-        for ( SharedPanelContainer::iterator iPanel(aPanels.begin()), iEnd(aPanels.end());
-              iPanel!=iEnd; ++iPanel)
+        for (auto const& panel : aPanels)
         {
-            VclPtr<Panel> const & aPanel = *iPanel;
-
-            if (! aPanel->HasIdPredicate(mPanelId))
-                aPanel->SetExpanded(false);
+            if (! panel->HasIdPredicate(mPanelId))
+                panel->SetExpanded(false);
         }
     }
 
@@ -206,10 +203,9 @@ void SAL_CALL SfxUnoPanel::moveUp()
     sal_Int32 curOrderIndex = getOrderIndex();
     sal_Int32 previousIndex = GetMinOrderIndex(aPanels);
 
-    ResourceManager::PanelContextDescriptorContainer::const_iterator iPanel;
-    for (iPanel = aPanels.begin(); iPanel != aPanels.end(); ++iPanel)
+    for (auto const& panel : aPanels)
     {
-        sal_Int32 index = pSidebarController->GetResourceManager()->GetPanelDescriptor(iPanel->msId)->mnOrderIndex;
+        sal_Int32 index = pSidebarController->GetResourceManager()->GetPanelDescriptor(panel.msId)->mnOrderIndex;
         if( index < curOrderIndex && index > previousIndex)
             previousIndex = index;
     }
@@ -238,10 +234,9 @@ void SAL_CALL SfxUnoPanel::moveDown()
     sal_Int32 curOrderIndex = getOrderIndex();
     sal_Int32 nextIndex = GetMaxOrderIndex(aPanels);
 
-    ResourceManager::PanelContextDescriptorContainer::const_iterator iPanel;
-    for (iPanel = aPanels.begin(); iPanel != aPanels.end(); ++iPanel)
+    for (auto const& panel : aPanels)
     {
-        sal_Int32 index = pSidebarController->GetResourceManager()->GetPanelDescriptor(iPanel->msId)->mnOrderIndex;
+        sal_Int32 index = pSidebarController->GetResourceManager()->GetPanelDescriptor(panel.msId)->mnOrderIndex;
         if( index > curOrderIndex && index < nextIndex)
             nextIndex = index;
     }
@@ -263,14 +258,11 @@ sal_Int32 SfxUnoPanel::GetMinOrderIndex(ResourceManager::PanelContextDescriptorC
 {
     SidebarController* pSidebarController = getSidebarController();
 
-    ResourceManager::PanelContextDescriptorContainer::iterator iPanel;
-
-    iPanel = aPanels.begin();
-    sal_Int32 minIndex = pSidebarController->GetResourceManager()->GetPanelDescriptor(iPanel->msId)->mnOrderIndex;
+    sal_Int32 minIndex = pSidebarController->GetResourceManager()->GetPanelDescriptor(aPanels.begin()->msId)->mnOrderIndex;
 
-    for (iPanel = aPanels.begin(); iPanel != aPanels.end(); ++iPanel)
+    for (auto const& panel : aPanels)
     {
-        sal_Int32 index = pSidebarController->GetResourceManager()->GetPanelDescriptor(iPanel->msId)->mnOrderIndex;
+        sal_Int32 index = pSidebarController->GetResourceManager()->GetPanelDescriptor(panel.msId)->mnOrderIndex;
         if(minIndex > index)
             minIndex = index;
     }
@@ -281,14 +273,11 @@ sal_Int32 SfxUnoPanel::GetMaxOrderIndex(ResourceManager::PanelContextDescriptorC
 {
     SidebarController* pSidebarController = getSidebarController();
 
-    ResourceManager::PanelContextDescriptorContainer::iterator iPanel;
-
-    iPanel = aPanels.begin();
-    sal_Int32 maxIndex = pSidebarController->GetResourceManager()->GetPanelDescriptor(iPanel->msId)->mnOrderIndex;
+    sal_Int32 maxIndex = pSidebarController->GetResourceManager()->GetPanelDescriptor(aPanels.begin()->msId)->mnOrderIndex;
 
-    for (iPanel = aPanels.begin(); iPanel != aPanels.end(); ++iPanel)
+    for (auto const& panel : aPanels)
     {
-        sal_Int32 index = pSidebarController->GetResourceManager()->GetPanelDescriptor(iPanel->msId)->mnOrderIndex;
+        sal_Int32 index = pSidebarController->GetResourceManager()->GetPanelDescriptor(panel.msId)->mnOrderIndex;
         if(maxIndex < index)
             maxIndex = index;
     }
diff --git a/sfx2/source/uitest/sfx_uiobject.cxx b/sfx2/source/uitest/sfx_uiobject.cxx
index cdc7698fdabe..37cfab79200b 100644
--- a/sfx2/source/uitest/sfx_uiobject.cxx
+++ b/sfx2/source/uitest/sfx_uiobject.cxx
@@ -29,11 +29,10 @@ StringMap SfxTabDialogUIObject::get_state()
     std::vector<sal_uInt16> aPageIds = mxTabDialog->m_pTabCtrl->GetPageIDs();
     OUString aStrIds;
     OUString aStrNames;
-    for (auto itr = aPageIds.begin(), itrEnd = aPageIds.end();
-            itr != itrEnd; ++itr)
+    for (auto const& pageId : aPageIds)
     {
-        aStrIds = aStrIds + OUString::number(*itr) + ";";
-        aStrNames = aStrNames + mxTabDialog->GetPageText(*itr) + ";";
+        aStrIds = aStrIds + OUString::number(pageId) + ";";
+        aStrNames = aStrNames + mxTabDialog->GetPageText(pageId) + ";";
     }
 
     aMap["PageIds"] = aStrIds;
@@ -61,17 +60,14 @@ void SfxTabDialogUIObject::execute(const OUString& rAction,
             auto itr = rParameters.find("NAME");
             OUString aName = itr->second;
             std::vector<sal_uInt16> aIds = mxTabDialog->m_pTabCtrl->GetPageIDs();
-            auto it = aIds.begin(), itEnd = aIds.end();
-            for (; it != itEnd; ++it)
+            for (auto const& elem : aIds)
             {
-                if (mxTabDialog->GetPageText(*it) == aName)
+                if (mxTabDialog->GetPageText(elem) == aName)
+                {
+                    mxTabDialog->ShowPage(elem);
                     break;
+                }
             }
-
-            if (it == aIds.end())
-                return;
-
-            mxTabDialog->ShowPage(*it);
         }
     }
 }
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index c64a50031119..30f90c4e26c8 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -1267,8 +1267,8 @@ void SfxViewShell::PushSubShells_Impl( bool bPush )
     SfxDispatcher *pDisp = pFrame->GetDispatcher();
     if ( bPush )
     {
-        for(SfxShellArr_Impl::const_iterator i = pImpl->aArr.begin(); i != pImpl->aArr.end(); ++i)
-            pDisp->Push(**i);
+        for (auto const& elem : pImpl->aArr)
+            pDisp->Push(*elem);
     }
     else if(!pImpl->aArr.empty())
     {


More information about the Libreoffice-commits mailing list