cui/source/customize/SvxConfigPageHelper.cxx  |   39 ++---
 cui/source/customize/SvxMenuConfigPage.cxx    |    6 
 cui/source/customize/SvxToolbarConfigPage.cxx |   14 --
 cui/source/customize/cfg.cxx                  |  170 ++++++++------------------
 cui/source/customize/cfgutil.cxx              |   14 --
 cui/source/customize/macropg.cxx              |   33 +----
 cui/source/dialogs/SpellDialog.cxx            |   60 ++++-----
 cui/source/dialogs/hangulhanjadlg.cxx         |   12 +
 cui/source/dialogs/linkdlg.cxx                |    7 -
 cui/source/dialogs/pastedlg.cxx               |    6 
 cui/source/options/connpoolconfig.cxx         |   24 +--
 cui/source/options/connpooloptions.cxx        |    7 -
 cui/source/options/connpoolsettings.cxx       |    7 -
 cui/source/options/dbregister.cxx             |    8 -
 cui/source/options/optasian.cxx               |   17 +-
 cui/source/options/optcolor.cxx               |    8 -
 cui/source/options/optgdlg.cxx                |   15 --
 cui/source/options/optlingu.cxx               |   26 +--
 cui/source/options/personalization.cxx        |    6 
 cui/source/options/tsaurls.cxx                |    8 -
 cui/source/tabpages/autocdlg.cxx              |   36 ++---
 cui/source/tabpages/numpages.cxx              |   33 ++---
 cui/source/tabpages/swpossizetabpage.cxx      |   10 -
 cui/source/tabpages/tpcolor.cxx               |    4 
 cui/source/tabpages/tpline.cxx                |    9 -
 25 files changed, 230 insertions(+), 349 deletions(-)

New commits:
commit 81260c448911069ce8cb051d3a973ec52b9b43a3
Author: Julien Nabet <serval2...@yahoo.fr>
Date:   Tue Feb 27 22:34:17 2018 +0100

    Use for-range loops in cui
    
    Change-Id: I82cbea6d221ec0fd0e0d4620bdda698f2bed520e
    Reviewed-on: https://gerrit.libreoffice.org/50472
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Julien Nabet <serval2...@yahoo.fr>

diff --git a/cui/source/customize/SvxConfigPageHelper.cxx 
b/cui/source/customize/SvxConfigPageHelper.cxx
index 334bef8f7cf1..cc81e230ddfa 100644
--- a/cui/source/customize/SvxConfigPageHelper.cxx
+++ b/cui/source/customize/SvxConfigPageHelper.cxx
@@ -132,20 +132,17 @@ SvxConfigPageHelper::generateCustomName(
         return name;
 
     // now check if there is an already existing entry with this name
-    SvxEntries::const_iterator iter = entries->begin();
-
-    while ( iter != entries->end() )
+    bool bFoundEntry = false;
+    for (auto const& entry : *entries)
     {
-        SvxConfigEntry* pEntry = *iter;
-
-        if ( name.equals( pEntry->GetName() ) )
+        if ( name.equals(entry->GetName()) )
         {
+            bFoundEntry = true;
             break;
         }
-        ++iter;
     }
 
-    if ( iter != entries->end() )
+    if (bFoundEntry)
     {
         // name already exists so try the next number up
         return generateCustomName( prefix, entries, ++suffix );
@@ -163,20 +160,17 @@ OUString SvxConfigPageHelper::generateCustomMenuURL(
         return url;
 
     // now check is there is an already existing entry with this url
-    SvxEntries::const_iterator iter = entries->begin();
-
-    while ( iter != entries->end() )
+    bool bFoundEntry = false;
+    for (auto const& entry : *entries)
     {
-        SvxConfigEntry* pEntry = *iter;
-
-        if ( url.equals( pEntry->GetCommand() ) )
+        if ( url.equals(entry->GetCommand()) )
         {
+            bFoundEntry = true;
             break;
         }
-        ++iter;
     }
 
-    if ( iter != entries->end() )
+    if (bFoundEntry)
     {
         // url already exists so try the next number up
         return generateCustomMenuURL( entries, ++suffix );
@@ -199,20 +193,17 @@ OUString SvxConfigPageHelper::generateCustomURL( 
SvxEntries* entries )
     url += OUString::number( generateRandomValue(), 16 );
 
     // now check is there is an already existing entry with this url
-    SvxEntries::const_iterator iter = entries->begin();
-
-    while ( iter != entries->end() )
+    bool bFoundEntry = false;
+    for (auto const& entry : *entries)
     {
-        SvxConfigEntry* pEntry = *iter;
-
-        if ( url.equals( pEntry->GetCommand() ) )
+        if ( url.equals(entry->GetCommand()) )
         {
+            bFoundEntry = true;
             break;
         }
-        ++iter;
     }
 
-    if ( iter != entries->end() )
+    if (bFoundEntry)
     {
         // url already exists so try the next number up
         return generateCustomURL( entries );
diff --git a/cui/source/customize/SvxMenuConfigPage.cxx 
b/cui/source/customize/SvxMenuConfigPage.cxx
index 046a8eef0e68..cedbaa457f91 100644
--- a/cui/source/customize/SvxMenuConfigPage.cxx
+++ b/cui/source/customize/SvxMenuConfigPage.cxx
@@ -302,12 +302,10 @@ IMPL_LINK_NOARG( SvxMenuConfigPage, SelectMenu, ListBox&, 
void )
         m_pMinusBtn->Enable( pMenuData->IsDeletable() );
 
         SvxEntries* pEntries = pMenuData->GetEntries();
-        SvxEntries::const_iterator iter = pEntries->begin();
 
-        for ( ; iter != pEntries->end(); ++iter )
+        for (auto const& entry : *pEntries)
         {
-            SvxConfigEntry* pEntry = *iter;
-            InsertEntryIntoUI( pEntry );
+            InsertEntryIntoUI(entry);
         }
     }
 
diff --git a/cui/source/customize/SvxToolbarConfigPage.cxx 
b/cui/source/customize/SvxToolbarConfigPage.cxx
index 26169bb8be80..2b485738c6b3 100644
--- a/cui/source/customize/SvxToolbarConfigPage.cxx
+++ b/cui/source/customize/SvxToolbarConfigPage.cxx
@@ -751,21 +751,17 @@ IMPL_LINK_NOARG( SvxToolbarConfigPage, SelectToolbar, 
ListBox&, void )
     }
 
     SvxEntries* pEntries = pToolbar->GetEntries();
-    SvxEntries::const_iterator iter = pEntries->begin();
-
-    for ( ; iter != pEntries->end(); ++iter )
+    for (auto const& entry : *pEntries)
     {
-        SvxConfigEntry* pEntry = *iter;
-
-        SvTreeListEntry* pNewLBEntry = InsertEntryIntoUI( pEntry );
+        SvTreeListEntry* pNewLBEntry = InsertEntryIntoUI(entry);
 
-        if(pEntry->IsSeparator())
+        if(entry->IsSeparator())
             m_pContentsListBox->SetCheckButtonInvisible( pNewLBEntry );
 
-        if (pEntry->IsBinding())
+        if (entry->IsBinding())
         {
             m_pContentsListBox->SetCheckButtonState( pNewLBEntry,
-                pEntry->IsVisible() ? SvButtonState::Checked : 
SvButtonState::Unchecked );
+                entry->IsVisible() ? SvButtonState::Checked : 
SvButtonState::Unchecked );
         }
         else
         {
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index 2c25f1125153..b7aa0a21d7dc 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -158,13 +158,9 @@ void printProperties(
 
 void printEntries(SvxEntries* entries)
 {
-    SvxEntries::const_iterator iter = entries->begin();
-
-    for ( ; iter != entries->end(); ++iter )
+    for (auto const& entry : *entries)
     {
-        SvxConfigEntry* entry = *iter;
-
-        SAL_WARN("cui", "printEntries: " << entry->GetName());
+        SAL_WARN("cui", "printEntries: " << entry.GetName());
     }
 }
 
@@ -621,17 +617,12 @@ void MenuSaveInData::Apply(
     uno::Reference< container::XIndexContainer > const & rMenuBar,
     uno::Reference< lang::XSingleComponentFactory >& rFactory )
 {
-    SvxEntries::const_iterator iter = GetEntries()->begin();
-    SvxEntries::const_iterator end = GetEntries()->end();
-
     uno::Reference<uno::XComponentContext> xContext = 
::comphelper::getProcessComponentContext();
 
-    for ( ; iter != end; ++iter )
+    for (auto const& entryData : *GetEntries())
     {
-        SvxConfigEntry* pEntryData = *iter;
-
         uno::Sequence< beans::PropertyValue > aPropValueSeq =
-            SvxConfigPageHelper::ConvertSvxConfigEntry( pEntryData );
+            SvxConfigPageHelper::ConvertSvxConfigEntry(entryData);
 
         uno::Reference< container::XIndexContainer > xSubMenuBar(
             rFactory->createInstanceWithContext( xContext ),
@@ -643,7 +634,7 @@ void MenuSaveInData::Apply(
         aPropValueSeq[nIndex].Value <<= xSubMenuBar;
         rMenuBar->insertByIndex(
             rMenuBar->getCount(), uno::Any( aPropValueSeq ));
-        ApplyMenu( xSubMenuBar, rFactory, pEntryData );
+        ApplyMenu( xSubMenuBar, rFactory, entryData );
     }
 }
 
@@ -654,17 +645,12 @@ void SaveInData::ApplyMenu(
 {
     uno::Reference<uno::XComponentContext> xContext = 
::comphelper::getProcessComponentContext();
 
-    SvxEntries::const_iterator iter = pMenuData->GetEntries()->begin();
-    SvxEntries::const_iterator end = pMenuData->GetEntries()->end();
-
-    for ( ; iter != end; ++iter )
+    for (auto const& entry : *pMenuData->GetEntries())
     {
-        SvxConfigEntry* pEntry = *iter;
-
-        if ( pEntry->IsPopup() )
+        if (entry->IsPopup())
         {
             uno::Sequence< beans::PropertyValue > aPropValueSeq =
-                SvxConfigPageHelper::ConvertSvxConfigEntry( pEntry );
+                SvxConfigPageHelper::ConvertSvxConfigEntry(entry);
 
             uno::Reference< container::XIndexContainer > xSubMenuBar(
                 rFactory->createInstanceWithContext( xContext ),
@@ -678,10 +664,10 @@ void SaveInData::ApplyMenu(
             rMenuBar->insertByIndex(
                 rMenuBar->getCount(), uno::Any( aPropValueSeq ));
 
-            ApplyMenu( xSubMenuBar, rFactory, pEntry );
-            pEntry->SetModified( false );
+            ApplyMenu( xSubMenuBar, rFactory, entry );
+            entry->SetModified( false );
         }
-        else if ( pEntry->IsSeparator() )
+        else if (entry->IsSeparator())
         {
             rMenuBar->insertByIndex(
                 rMenuBar->getCount(), uno::Any( m_aSeparatorSeq ));
@@ -689,7 +675,7 @@ void SaveInData::ApplyMenu(
         else
         {
             uno::Sequence< beans::PropertyValue > aPropValueSeq =
-                SvxConfigPageHelper::ConvertSvxConfigEntry( pEntry );
+                SvxConfigPageHelper::ConvertSvxConfigEntry(entry);
             rMenuBar->insertByIndex(
                 rMenuBar->getCount(), uno::Any( aPropValueSeq ));
         }
@@ -1544,19 +1530,15 @@ void SvxConfigPage::ReloadTopLevelListBox( 
SvxConfigEntry const * pToSelect )
 
     if ( GetSaveInData() && GetSaveInData()->GetEntries() )
     {
-        SvxEntries::const_iterator iter = 
GetSaveInData()->GetEntries()->begin();
-        SvxEntries::const_iterator end = GetSaveInData()->GetEntries()->end();
-
-        for ( ; iter != end; ++iter )
+        for (auto const& entryData : *GetSaveInData()->GetEntries())
         {
-            SvxConfigEntry* pEntryData = *iter;
-            const sal_Int32 nPos = m_pTopLevelListBox->InsertEntry( 
SvxConfigPageHelper::stripHotKey( pEntryData->GetName() ) );
-            m_pTopLevelListBox->SetEntryData( nPos, pEntryData );
+            const sal_Int32 nPos = m_pTopLevelListBox->InsertEntry( 
SvxConfigPageHelper::stripHotKey(entryData->GetName()) );
+            m_pTopLevelListBox->SetEntryData( nPos, entryData );
 
-            if ( pEntryData == pToSelect )
+            if ( entryData == pToSelect )
                 nSelectionPos = nPos;
 
-            AddSubMenusToUI( SvxConfigPageHelper::stripHotKey( 
pEntryData->GetName() ), pEntryData );
+            AddSubMenusToUI( SvxConfigPageHelper::stripHotKey( 
entryData->GetName() ), entryData );
         }
     }
 #ifdef DBG_UTIL
@@ -1578,21 +1560,16 @@ void SvxConfigPage::ReloadTopLevelListBox( 
SvxConfigEntry const * pToSelect )
 void SvxConfigPage::AddSubMenusToUI(
     const OUString& rBaseTitle, SvxConfigEntry const * pParentData )
 {
-    SvxEntries::const_iterator iter = pParentData->GetEntries()->begin();
-    SvxEntries::const_iterator end = pParentData->GetEntries()->end();
-
-    for ( ; iter != end; ++iter )
+    for (auto const& entryData : *pParentData->GetEntries())
     {
-        SvxConfigEntry* pEntryData = *iter;
-
-        if ( pEntryData->IsPopup() )
+        if (entryData->IsPopup())
         {
-            OUString subMenuTitle = rBaseTitle + aMenuSeparatorStr + 
SvxConfigPageHelper::stripHotKey( pEntryData->GetName() );
+            OUString subMenuTitle = rBaseTitle + aMenuSeparatorStr + 
SvxConfigPageHelper::stripHotKey(entryData->GetName());
 
             const sal_Int32 nPos = m_pTopLevelListBox->InsertEntry( 
subMenuTitle );
-            m_pTopLevelListBox->SetEntryData( nPos, pEntryData );
+            m_pTopLevelListBox->SetEntryData( nPos, entryData );
 
-            AddSubMenusToUI( subMenuTitle, pEntryData );
+            AddSubMenusToUI( subMenuTitle, entryData );
         }
     }
 }
@@ -1600,21 +1577,17 @@ void SvxConfigPage::AddSubMenusToUI(
 SvxEntries* SvxConfigPage::FindParentForChild(
     SvxEntries* pRootEntries, SvxConfigEntry* pChildData )
 {
-    SvxEntries::const_iterator iter = pRootEntries->begin();
-    SvxEntries::const_iterator end = pRootEntries->end();
-
-    for ( ; iter != end; ++iter )
+    for (auto const& entryData : *pRootEntries)
     {
-        SvxConfigEntry* pEntryData = *iter;
 
-        if ( pEntryData == pChildData )
+        if (entryData == pChildData)
         {
             return pRootEntries;
         }
-        else if ( pEntryData->IsPopup() )
+        else if (entryData->IsPopup())
         {
             SvxEntries* result =
-                FindParentForChild( pEntryData->GetEntries(), pChildData );
+                FindParentForChild( entryData->GetEntries(), pChildData );
 
             if ( result != nullptr )
             {
@@ -1657,12 +1630,9 @@ SvTreeListEntry* SvxConfigPage::AddFunction(
 
     if ( !bAllowDuplicates )
     {
-        for (SvxEntries::const_iterator iter(pParent->GetEntries()->begin()), 
end(pParent->GetEntries()->end());
-             iter != end ; ++iter)
+        for (auto const& entry : *pParent->GetEntries())
         {
-            SvxConfigEntry *pCurEntry = *iter;
-
-            if ( pCurEntry->GetCommand() == pNewEntryData->GetCommand() )
+            if ( entry->GetCommand() == pNewEntryData->GetCommand() )
             {
                 std::unique_ptr<weld::MessageDialog> 
xBox(Application::CreateMessageDialog(GetFrameWeld(),
                                                           
VclMessageType::Info, VclButtonsType::Ok, 
CuiResId(RID_SVXSTR_MNUCFG_ALREADY_INCLUDED)));
@@ -1932,21 +1902,17 @@ SvxMainMenuOrganizerDialog::SvxMainMenuOrganizerDialog(
     if ( entries != nullptr )
     {
         mpEntries = new SvxEntries;
-        SvxEntries::const_iterator iter = entries->begin();
-
-        while ( iter != entries->end() )
+        for (auto const& entry : *entries)
         {
-            SvxConfigEntry* pEntry = *iter;
             SvTreeListEntry* pLBEntry =
-                m_pMenuListBox->InsertEntry( SvxConfigPageHelper::stripHotKey( 
pEntry->GetName() ) );
-            pLBEntry->SetUserData( pEntry );
-            mpEntries->push_back( pEntry );
+                m_pMenuListBox->InsertEntry( SvxConfigPageHelper::stripHotKey( 
entry->GetName() ) );
+            pLBEntry->SetUserData(entry);
+            mpEntries->push_back(entry);
 
-            if ( pEntry == selection )
+            if (entry == selection)
             {
                 m_pMenuListBox->Select( pLBEntry );
             }
-            ++iter;
         }
     }
 
@@ -2127,11 +2093,9 @@ SvxConfigEntry::~SvxConfigEntry()
 {
     if ( mpEntries != nullptr )
     {
-        SvxEntries::const_iterator iter = mpEntries->begin();
-
-        for ( ; iter != mpEntries->end(); ++iter )
+        for (auto const& entry : *mpEntries)
         {
-            delete *iter;
+            delete entry;
         }
         delete mpEntries;
     }
@@ -2445,19 +2409,12 @@ ToolbarSaveInData::SetEntries( SvxEntries* pNewEntries )
 bool
 ToolbarSaveInData::HasURL( const OUString& rURL )
 {
-    SvxEntries::const_iterator iter = GetEntries()->begin();
-    SvxEntries::const_iterator end = GetEntries()->end();
-
-    while ( iter != end )
+    for (auto const& entry : *GetEntries())
     {
-        SvxConfigEntry* pEntry = *iter;
-
-        if ( pEntry->GetCommand() == rURL )
+        if (entry->GetCommand() == rURL)
         {
-            return !pEntry->IsParentData();
+            return !entry->IsParentData();
         }
-
-        ++iter;
     }
     return false;
 }
@@ -2470,17 +2427,12 @@ bool ToolbarSaveInData::HasSettings()
 
 void ToolbarSaveInData::Reset()
 {
-    SvxEntries::const_iterator toolbars = GetEntries()->begin();
-    SvxEntries::const_iterator end = GetEntries()->end();
-
     // reset each toolbar by calling removeSettings for its toolbar URL
-    for ( ; toolbars != end; ++toolbars )
+    for (auto const& entry : *GetEntries())
     {
-        SvxConfigEntry* pToolbar = *toolbars;
-
         try
         {
-            OUString url = pToolbar->GetCommand();
+            OUString url = entry->GetCommand();
             GetConfigManager()->removeSettings( url );
         }
         catch ( uno::Exception& )
@@ -2522,17 +2474,12 @@ void ToolbarSaveInData::ApplyToolbar(
 {
     uno::Reference<uno::XComponentContext> xContext = 
::comphelper::getProcessComponentContext();
 
-    SvxEntries::const_iterator iter = pToolbarData->GetEntries()->begin();
-    SvxEntries::const_iterator end = pToolbarData->GetEntries()->end();
-
-    for ( ; iter != end; ++iter )
+    for (auto const& entry : *pToolbarData->GetEntries())
     {
-        SvxConfigEntry* pEntry = *iter;
-
-        if ( pEntry->IsPopup() )
+        if (entry->IsPopup())
         {
             uno::Sequence< beans::PropertyValue > aPropValueSeq =
-                SvxConfigPageHelper::ConvertToolbarEntry( pEntry );
+                SvxConfigPageHelper::ConvertToolbarEntry(entry);
 
             uno::Reference< container::XIndexContainer > xSubMenuBar(
                 rFactory->createInstanceWithContext( xContext ),
@@ -2545,9 +2492,9 @@ void ToolbarSaveInData::ApplyToolbar(
             rToolbarBar->insertByIndex(
                 rToolbarBar->getCount(), uno::Any( aPropValueSeq ));
 
-            ApplyToolbar( xSubMenuBar, rFactory, pEntry );
+            ApplyToolbar(xSubMenuBar, rFactory, entry);
         }
-        else if ( pEntry->IsSeparator() )
+        else if (entry->IsSeparator())
         {
             rToolbarBar->insertByIndex(
                 rToolbarBar->getCount(), uno::Any( m_aSeparatorSeq ));
@@ -2555,7 +2502,7 @@ void ToolbarSaveInData::ApplyToolbar(
         else
         {
             uno::Sequence< beans::PropertyValue > aPropValueSeq =
-                SvxConfigPageHelper::ConvertToolbarEntry( pEntry );
+                SvxConfigPageHelper::ConvertToolbarEntry(entry);
 
             rToolbarBar->insertByIndex(
                 rToolbarBar->getCount(), uno::Any( aPropValueSeq ));
@@ -2720,12 +2667,10 @@ void ToolbarSaveInData::RestoreToolbar( SvxConfigEntry* 
pToolbar )
 
         // After reloading, ensure that the icon is reset of each entry
         // in the toolbar
-        SvxEntries::const_iterator iter = pToolbar->GetEntries()->begin();
         uno::Sequence< OUString > aURLSeq( 1 );
-        for ( ; iter != pToolbar->GetEntries()->end(); ++iter )
+        for (auto const& entry : *pToolbar->GetEntries())
         {
-            SvxConfigEntry* pEntry = *iter;
-            aURLSeq[ 0 ] = pEntry->GetCommand();
+            aURLSeq[ 0 ] = entry->GetCommand();
 
             try
             {
@@ -2940,16 +2885,15 @@ SvxIconSelectorDialog::SvxIconSelectorDialog( 
vcl::Window *pWindow,
             aImageInfo1.emplace( names[n], false );
     }
     sal_uInt16 nId = 1;
-    ImageInfo::const_iterator pConstIter = aImageInfo1.begin();
     uno::Sequence< OUString > name( 1 );
-    while ( pConstIter != aImageInfo1.end() )
+    for (auto const& elem : aImageInfo1)
     {
-        name[ 0 ] = pConstIter->first;
+        name[ 0 ] = elem.first;
         uno::Sequence< uno::Reference< graphic::XGraphic> > graphics = 
m_xImportedImageManager->getImages( SvxConfigPageHelper::GetImageType(), name );
         if ( graphics.getLength() > 0 )
         {
             Image img = Image( graphics[ 0 ] );
-            pTbSymbol->InsertItem( nId, img, pConstIter->first );
+            pTbSymbol->InsertItem( nId, img, elem.first );
 
             graphics[ 0 ]->acquire();
 
@@ -2958,7 +2902,6 @@ SvxIconSelectorDialog::SvxIconSelectorDialog( vcl::Window 
*pWindow,
 
             ++nId;
         }
-        ++pConstIter;
     }
 
     ImageInfo                 aImageInfo;
@@ -2981,15 +2924,14 @@ SvxIconSelectorDialog::SvxIconSelectorDialog( 
vcl::Window *pWindow,
     }
 
     // large growth factor, expecting many entries
-    pConstIter = aImageInfo.begin();
-    while ( pConstIter != aImageInfo.end() )
+    for (auto const& elem : aImageInfo)
     {
-        name[ 0 ] = pConstIter->first;
+        name[ 0 ] = elem.first;
 
         uno::Sequence< uno::Reference< graphic::XGraphic> > graphics;
         try
         {
-            if ( pConstIter->second )
+            if (elem.second)
                 graphics = m_xImageManager->getImages( 
SvxConfigPageHelper::GetImageType(), name );
             else
                 graphics = m_xParentImageManager->getImages( 
SvxConfigPageHelper::GetImageType(), name );
@@ -3005,7 +2947,7 @@ SvxIconSelectorDialog::SvxIconSelectorDialog( vcl::Window 
*pWindow,
             Image img = Image( graphics[ 0 ] );
             if ( !img.GetBitmapEx().IsEmpty() )
             {
-                pTbSymbol->InsertItem( nId, img, pConstIter->first );
+                pTbSymbol->InsertItem( nId, img, elem.first );
 
                 uno::Reference< graphic::XGraphic > xGraphic = graphics[ 0 ];
 
@@ -3018,8 +2960,6 @@ SvxIconSelectorDialog::SvxIconSelectorDialog( vcl::Window 
*pWindow,
                 ++nId;
             }
         }
-
-        ++pConstIter;
     }
 
     pBtnDelete->Enable( false );
diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx
index 75ab89474532..74318258fd5b 100644
--- a/cui/source/customize/cfgutil.cxx
+++ b/cui/source/customize/cfgutil.cxx
@@ -959,12 +959,9 @@ void SfxConfigGroupListBox::GroupSelected()
             if (pFamily)
             {
                 const std::vector< SfxStyleInfo_Impl > lStyles = 
pStylesInfo->getStyles(pFamily->sFamily);
-                std::vector< SfxStyleInfo_Impl >::const_iterator pIt;
-                for (  pIt  = lStyles.begin();
-                       pIt != lStyles.end()  ;
-                     ++pIt                   )
+                for (auto const& lStyle : lStyles)
                 {
-                    SfxStyleInfo_Impl* pStyle = new SfxStyleInfo_Impl(*pIt);
+                    SfxStyleInfo_Impl* pStyle = new SfxStyleInfo_Impl(lStyle);
                     SvTreeListEntry* pFuncEntry = 
pFunctionListBox->InsertEntry( pStyle->sLabel );
                     pFunctionListBox->aArr.push_back( 
o3tl::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_STYLES, 0, pStyle ) );
                     pFunctionListBox->aArr.back()->sCommand = pStyle->sCommand;
@@ -1042,12 +1039,9 @@ void SfxConfigGroupListBox::RequestingChildren( 
SvTreeListEntry *pEntry )
             if ( !GetChildCount( pEntry ) )
             {
                 const std::vector< SfxStyleInfo_Impl >                 
lStyleFamilies = pStylesInfo->getStyleFamilies();
-                      std::vector< SfxStyleInfo_Impl >::const_iterator pIt;
-                for (  pIt  = lStyleFamilies.begin();
-                       pIt != lStyleFamilies.end()  ;
-                     ++pIt                          )
+                for (auto const& lStyleFamily : lStyleFamilies)
                 {
-                    SfxStyleInfo_Impl* pFamily = new SfxStyleInfo_Impl(*pIt);
+                    SfxStyleInfo_Impl* pFamily = new 
SfxStyleInfo_Impl(lStyleFamily);
                     SvTreeListEntry* pStyleEntry = InsertEntry( 
pFamily->sLabel, pEntry );
                     aArr.push_back( o3tl::make_unique<SfxGroupInfo_Impl>( 
SfxCfgKind::GROUP_STYLES, 0, pFamily ));
                     pStyleEntry->SetUserData( aArr.back().get() );
diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx
index 3c6e3be3fa1b..9dc247da8ab2 100644
--- a/cui/source/customize/macropg.cxx
+++ b/cui/source/customize/macropg.cxx
@@ -326,11 +326,9 @@ bool SvxMacroTabPage_::FillItemSet( SfxItemSet* /*rSet*/ )
         OUString eventName;
         if( m_xAppEvents.is() )
         {
-            EventsHash::iterator h_itEnd =  m_appEventsHash.end();
-            EventsHash::iterator h_it = m_appEventsHash.begin();
-            for ( ; h_it !=  h_itEnd; ++h_it )
+            for (auto const& appEvent : m_appEventsHash)
             {
-                eventName = h_it->first;
+                eventName = appEvent.first;
                 try
                 {
                     m_xAppEvents->replaceByName( eventName, GetPropsByName( 
eventName, m_appEventsHash ) );
@@ -343,11 +341,9 @@ bool SvxMacroTabPage_::FillItemSet( SfxItemSet* /*rSet*/ )
         }
         if( m_xDocEvents.is() && bDocModified )
         {
-            EventsHash::iterator h_itEnd =  m_docEventsHash.end();
-            EventsHash::iterator h_it = m_docEventsHash.begin();
-            for ( ; h_it !=  h_itEnd; ++h_it )
+            for (auto const& docEvent : m_docEventsHash)
             {
-                eventName = h_it->first;
+                eventName = docEvent.first;
                 try
                 {
                     m_xDocEvents->replaceByName( eventName, GetPropsByName( 
eventName, m_docEventsHash ) );
@@ -387,20 +383,16 @@ void SvxMacroTabPage_::Reset( const SfxItemSet* )
     {
             if( m_xAppEvents.is() )
             {
-                EventsHash::iterator h_itEnd =  m_appEventsHash.end();
-                EventsHash::iterator h_it = m_appEventsHash.begin();
-                for ( ; h_it !=  h_itEnd; ++h_it )
+                for (auto & appEvent : m_appEventsHash)
                 {
-                    h_it->second.second.clear();
+                    appEvent.second.second.clear();
                 }
             }
             if( m_xDocEvents.is() && bDocModified )
             {
-                EventsHash::iterator h_itEnd =  m_docEventsHash.end();
-                EventsHash::iterator h_it = m_docEventsHash.begin();
-                for ( ; h_it !=  h_itEnd; ++h_it )
+                for (auto & docEvent : m_docEventsHash)
                 {
-                    h_it->second.second.clear();
+                    docEvent.second.second.clear();
                 }
                 // if we have a valid XModifiable (in the case of doc events)
                 // call setModified(true)
@@ -511,12 +503,9 @@ void SvxMacroTabPage_::DisplayAppEvents( bool appEvents)
         std::insert_iterator< std::set< OUString > >( aEventNamesCache, 
aEventNamesCache.end() )
     );
 
-    for (   EventDisplayNames::const_iterator displayableEvent = 
aDisplayNames.begin();
-            displayableEvent != aDisplayNames.end();
-            ++displayableEvent
-        )
+    for (auto const& displayableEvent : aDisplayNames)
     {
-        OUString sEventName( OUString::createFromAscii( 
displayableEvent->pAsciiEventName ) );
+        OUString sEventName( OUString::createFromAscii( 
displayableEvent.pAsciiEventName ) );
         if ( !nameReplace->hasByName( sEventName ) )
             continue;
 
@@ -528,7 +517,7 @@ void SvxMacroTabPage_::DisplayAppEvents( bool appEvents)
         }
 
         OUString eventURL = h_it->second.second;
-        OUString displayName(CuiResId(displayableEvent->pEventResourceID));
+        OUString displayName(CuiResId(displayableEvent.pEventResourceID));
 
         displayName += "\t";
 
diff --git a/cui/source/dialogs/SpellDialog.cxx 
b/cui/source/dialogs/SpellDialog.cxx
index 2bc16dc0df0e..3943b3b474cc 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -1034,39 +1034,36 @@ bool SpellDialog::GetNextSentence_Impl(bool 
bUseSavedSentence, bool bRecheck)
 
     if(!aSentence.empty())
     {
-        SpellPortions::iterator aStart = aSentence.begin();
         OUString sText;
-        while(aStart != aSentence.end())
+        for (auto const& elem : aSentence)
         {
             // hidden text has to be ignored
-            if(!aStart->bIsHidden)
-                sText += aStart->sText;
-            ++aStart;
+            if(!elem.bIsHidden)
+                sText += elem.sText;
         }
         m_pSentenceED->SetText(sText);
-        aStart = aSentence.begin();
         sal_Int32 nStartPosition = 0;
         sal_Int32 nEndPosition = 0;
 
-        while(aStart != aSentence.end())
+        for (auto const& elem : aSentence)
         {
             // hidden text has to be ignored
-            if(!aStart->bIsHidden)
+            if(!elem.bIsHidden)
             {
-                nEndPosition += aStart->sText.getLength();
-                if(aStart->xAlternatives.is())
+                nEndPosition += elem.sText.getLength();
+                if(elem.xAlternatives.is())
                 {
-                    uno::Reference< container::XNamed > xNamed( 
aStart->xAlternatives, uno::UNO_QUERY );
+                    uno::Reference< container::XNamed > xNamed( 
elem.xAlternatives, uno::UNO_QUERY );
                     OUString sServiceName;
                     if( xNamed.is() )
                         sServiceName = xNamed->getName();
-                    SpellErrorDescription aDesc( false, 
aStart->xAlternatives->getWord(),
-                                    aStart->xAlternatives->getLocale(), 
aStart->xAlternatives->getAlternatives(), nullptr);
+                    SpellErrorDescription aDesc( false, 
elem.xAlternatives->getWord(),
+                                    elem.xAlternatives->getLocale(), 
elem.xAlternatives->getAlternatives(), nullptr);
                     m_pSentenceED->SetAttrib( SpellErrorAttrib(aDesc), 0, 
nStartPosition, nEndPosition );
                 }
-                else if(aStart->bIsGrammarError )
+                else if(elem.bIsGrammarError )
                 {
-                    beans::PropertyValues  aProperties = 
aStart->aGrammarError.aProperties;
+                    beans::PropertyValues  aProperties = 
elem.aGrammarError.aProperties;
                     OUString sFullCommentURL;
                     sal_Int32 i = 0;
                     while ( sFullCommentURL.isEmpty() && i < 
aProperties.getLength() )
@@ -1080,22 +1077,21 @@ bool SpellDialog::GetNextSentence_Impl(bool 
bUseSavedSentence, bool bRecheck)
                     }
 
                     SpellErrorDescription aDesc( true,
-                        aStart->sText,
-                        LanguageTag::convertToLocale( aStart->eLanguage ),
-                        aStart->aGrammarError.aSuggestions,
-                        aStart->xGrammarChecker,
-                        &aStart->sDialogTitle,
-                        &aStart->aGrammarError.aFullComment,
-                        &aStart->aGrammarError.aRuleIdentifier,
+                        elem.sText,
+                        LanguageTag::convertToLocale( elem.eLanguage ),
+                        elem.aGrammarError.aSuggestions,
+                        elem.xGrammarChecker,
+                        &elem.sDialogTitle,
+                        &elem.aGrammarError.aFullComment,
+                        &elem.aGrammarError.aRuleIdentifier,
                         &sFullCommentURL );
                     m_pSentenceED->SetAttrib( SpellErrorAttrib(aDesc), 0, 
nStartPosition, nEndPosition );
                 }
-                if(aStart->bIsField)
+                if(elem.bIsField)
                     m_pSentenceED->SetAttrib( 
SpellBackgroundAttrib(COL_LIGHTGRAY), 0, nStartPosition, nEndPosition );
-                m_pSentenceED->SetAttrib( 
SpellLanguageAttrib(aStart->eLanguage), 0, nStartPosition, nEndPosition );
+                m_pSentenceED->SetAttrib( SpellLanguageAttrib(elem.eLanguage), 
0, nStartPosition, nEndPosition );
                 nStartPosition = nEndPosition;
             }
-            ++aStart;
         }
         //the edit field needs to be modified to apply the change from the 
ApplyChangeAllList
         if(!bHasReplaced)
@@ -1114,31 +1110,29 @@ bool 
SpellDialog::ApplyChangeAllList_Impl(SpellPortions& rSentence, bool &bHasRe
 {
     bHasReplaced = false;
     bool bRet = true;
-    SpellPortions::iterator aStart = rSentence.begin();
     Reference<XDictionary> xChangeAll( LinguMgr::GetChangeAllList(), UNO_QUERY 
);
     if(!xChangeAll->getCount())
         return bRet;
     bRet = false;
-    while(aStart != rSentence.end())
+    for (auto & elem : rSentence)
     {
-        if(aStart->xAlternatives.is())
+        if(elem.xAlternatives.is())
         {
-            const OUString &rString = aStart->sText;
+            const OUString &rString = elem.sText;
 
             Reference<XDictionaryEntry> xEntry = xChangeAll->getEntry(rString);
 
             if(xEntry.is())
             {
-                aStart->sText = getDotReplacementString(rString, 
xEntry->getReplacementText());
-                aStart->xAlternatives = nullptr;
+                elem.sText = getDotReplacementString(rString, 
xEntry->getReplacementText());
+                elem.xAlternatives = nullptr;
                 bHasReplaced = true;
             }
             else
                 bRet = true;
         }
-        else if( aStart->bIsGrammarError )
+        else if( elem.bIsGrammarError )
             bRet = true;
-        ++aStart;
     }
     return bRet;
 }
diff --git a/cui/source/dialogs/hangulhanjadlg.cxx 
b/cui/source/dialogs/hangulhanjadlg.cxx
index 75b4ad9317f4..64870256f944 100644
--- a/cui/source/dialogs/hangulhanjadlg.cxx
+++ b/cui/source/dialogs/hangulhanjadlg.cxx
@@ -1301,12 +1301,14 @@ namespace svx
     {
         if( m_nNumOfEntries )
         {
-            for( std::vector<OUString*>::iterator it = m_vElements.begin(); it 
!= m_vElements.end(); ++it )
-                if( *it != nullptr )
+            for (auto & vElement : m_vElements)
+            {
+                if( vElement != nullptr )
                 {
-                    delete *it;
-                    *it = nullptr;
-                 }
+                    delete vElement;
+                    vElement = nullptr;
+                }
+            }
 
             m_nNumOfEntries = m_nAct = 0;
         }
diff --git a/cui/source/dialogs/linkdlg.cxx b/cui/source/dialogs/linkdlg.cxx
index 9b2478f8f746..e4501d4dc837 100644
--- a/cui/source/dialogs/linkdlg.cxx
+++ b/cui/source/dialogs/linkdlg.cxx
@@ -59,11 +59,10 @@ private:
 public:
     ~SvBaseLinkMemberList()
     {
-        for( std::vector<SvBaseLink*>::const_iterator it = mLinks.begin(); it 
!= mLinks.end(); ++it )
+        for (auto const& link : mLinks)
         {
-            SvBaseLink* p = *it;
-            if( p )
-                p->ReleaseRef();
+            if( link )
+                link->ReleaseRef();
         }
     }
 
diff --git a/cui/source/dialogs/pastedlg.cxx b/cui/source/dialogs/pastedlg.cxx
index 6aa845b39001..30205888f936 100644
--- a/cui/source/dialogs/pastedlg.cxx
+++ b/cui/source/dialogs/pastedlg.cxx
@@ -111,11 +111,9 @@ SotClipboardFormatId SvPasteObjectDialog::GetFormat( const 
TransferableDataHelpe
 
     ObjectLB().SetUpdateMode( false );
 
-    DataFlavorExVector::iterator aIter( 
const_cast<DataFlavorExVector&>(*pFormats).begin() ),
-                                 aEnd( 
const_cast<DataFlavorExVector&>(*pFormats).end() );
-    while( aIter != aEnd )
+    for (auto const& format : *pFormats)
     {
-        SotClipboardFormatId nFormat = (*aIter++).mnSotId;
+        SotClipboardFormatId nFormat = format.mnSotId;
 
         std::map< SotClipboardFormatId, OUString >::iterator itName =
             aSupplementMap.find( nFormat );
diff --git a/cui/source/options/connpoolconfig.cxx 
b/cui/source/options/connpoolconfig.cxx
index ffe935acee68..a2af0e7ba3c2 100644
--- a/cui/source/options/connpoolconfig.cxx
+++ b/cui/source/options/connpoolconfig.cxx
@@ -88,12 +88,9 @@ namespace offapp
         DriverPoolingSettings aSettings;
         // first get all the drivers register at the driver manager
         ODriverEnumeration aEnumDrivers;
-        for (   ODriverEnumeration::const_iterator aLoopDrivers = 
aEnumDrivers.begin();
-                aLoopDrivers != aEnumDrivers.end();
-                ++aLoopDrivers
-            )
+        for (auto const& elem : aEnumDrivers)
         {
-            aSettings.push_back(DriverPooling(*aLoopDrivers));
+            aSettings.push_back(DriverPooling(elem));
         }
 
         // then look for which of them settings are stored in the configuration
@@ -170,24 +167,21 @@ namespace offapp
             OConfigurationNode aThisDriverSettings;
 
             const DriverPoolingSettings& rNewSettings = 
pDriverSettings->getSettings();
-            for (   DriverPoolingSettings::const_iterator aLoop = 
rNewSettings.begin();
-                    aLoop != rNewSettings.end();
-                    ++aLoop
-                )
+            for (auto const& newSetting : rNewSettings)
             {
                 // need the name as OUString
-                sThisDriverName = aLoop->sName;
+                sThisDriverName = newSetting.sName;
 
                 // the sub-node for this driver
-                if (aDriverSettings.hasByName(aLoop->sName))
-                    aThisDriverSettings = 
aDriverSettings.openNode(aLoop->sName);
+                if (aDriverSettings.hasByName(newSetting.sName))
+                    aThisDriverSettings = 
aDriverSettings.openNode(newSetting.sName);
                 else
-                    aThisDriverSettings = 
aDriverSettings.createNode(aLoop->sName);
+                    aThisDriverSettings = 
aDriverSettings.createNode(newSetting.sName);
 
                 // set the values
                 aThisDriverSettings.setNodeValue(getDriverNameNodeName(), 
Any(sThisDriverName));
-                aThisDriverSettings.setNodeValue(getEnableNodeName(), 
Any(aLoop->bEnabled));
-                aThisDriverSettings.setNodeValue(getTimeoutNodeName(), 
Any(aLoop->nTimeoutSeconds));
+                aThisDriverSettings.setNodeValue(getEnableNodeName(), 
Any(newSetting.bEnabled));
+                aThisDriverSettings.setNodeValue(getTimeoutNodeName(), 
Any(newSetting.nTimeoutSeconds));
             }
             bNeedCommit = true;
         }
diff --git a/cui/source/options/connpooloptions.cxx 
b/cui/source/options/connpooloptions.cxx
index ec42ee41d7c2..3a542707997c 100644
--- a/cui/source/options/connpooloptions.cxx
+++ b/cui/source/options/connpooloptions.cxx
@@ -109,13 +109,12 @@ namespace offapp
         if (m_aSettings.size() != m_aSavedSettings.size())
             return true;
 
-        DriverPoolingSettings::const_iterator aCurrent = m_aSettings.begin();
-        DriverPoolingSettings::const_iterator aCurrentEnd = m_aSettings.end();
         DriverPoolingSettings::const_iterator aSaved = 
m_aSavedSettings.begin();
-        for (;aCurrent != aCurrentEnd; ++aCurrent, ++aSaved)
+        for (auto const& currentSetting : m_aSettings)
         {
-            if (*aCurrent != *aSaved)
+            if (currentSetting != *aSaved)
                 return true;
+            ++aSaved;
         }
 
         return false;
diff --git a/cui/source/options/connpoolsettings.cxx 
b/cui/source/options/connpoolsettings.cxx
index 8dd0e483f673..0f23b3fe9bd2 100644
--- a/cui/source/options/connpoolsettings.cxx
+++ b/cui/source/options/connpoolsettings.cxx
@@ -59,16 +59,13 @@ namespace offapp
         if (m_aSettings.size() != pItem->m_aSettings.size())
             return false;
 
-        DriverPoolingSettings::const_iterator aOwn = m_aSettings.begin();
-        DriverPoolingSettings::const_iterator aOwnEnd = m_aSettings.end();
         DriverPoolingSettings::const_iterator aForeign = 
pItem->m_aSettings.begin();
-        while (aOwn < aOwnEnd)
+        for (auto const& ownSetting : m_aSettings)
         {
-            if (*aOwn != *aForeign)
+            if (ownSetting != *aForeign)
                 return false;
 
             ++aForeign;
-            ++aOwn;
         }
 
         return true;
diff --git a/cui/source/options/dbregister.cxx 
b/cui/source/options/dbregister.cxx
index b5ff1f0a2f07..4b40959ec0e5 100644
--- a/cui/source/options/dbregister.cxx
+++ b/cui/source/options/dbregister.cxx
@@ -223,12 +223,10 @@ void DbRegistrationOptionsPage::Reset( const SfxItemSet* 
rSet )
 
     const DatabaseRegistrations& rRegistrations = 
pRegistrations->getRegistrations();
     m_nOldCount = rRegistrations.size();
-    DatabaseRegistrations::const_iterator aIter = rRegistrations.begin();
-    DatabaseRegistrations::const_iterator aEnd = rRegistrations.end();
-    for ( ; aIter != aEnd; ++aIter )
+    for (auto const& elem : rRegistrations)
     {
-        OFileNotation aTransformer( aIter->second.sLocation );
-        insertNewEntry( aIter->first, aTransformer.get( 
OFileNotation::N_SYSTEM ), aIter->second.bReadOnly );
+        OFileNotation aTransformer( elem.second.sLocation );
+        insertNewEntry( elem.first, aTransformer.get( OFileNotation::N_SYSTEM 
), elem.second.bReadOnly );
     }
 
     OUString aUserData = GetUserData();
diff --git a/cui/source/options/optasian.cxx b/cui/source/options/optasian.cxx
index 05c13741bd19..a6b6297aa4e7 100644
--- a/cui/source/options/optasian.cxx
+++ b/cui/source/options/optasian.cxx
@@ -73,10 +73,9 @@ struct SvxAsianLayoutPage_Impl
 
 SvxAsianLayoutPage_Impl::~SvxAsianLayoutPage_Impl()
 {
-    SvxForbiddenCharacterMap_Impl::iterator it;
-    for( it = aChangedLanguagesMap.begin(); it != aChangedLanguagesMap.end(); 
++it )
+    for (auto const& changedLanguage : aChangedLanguagesMap)
     {
-        delete it->second;
+        delete changedLanguage.second;
     }
 }
 
@@ -202,15 +201,13 @@ bool SvxAsianLayoutPage::FillItemSet( SfxItemSet* )
     {
         try
         {
-            SvxForbiddenCharacterMap_Impl::iterator itElem;
-            for( itElem = pImpl->aChangedLanguagesMap.begin();
-                itElem != pImpl->aChangedLanguagesMap.end(); ++itElem )
+            for (auto const& changedLanguage : pImpl->aChangedLanguagesMap)
             {
-                Locale aLocale( LanguageTag::convertToLocale( itElem->first ));
-                if(itElem->second->bRemoved)
+                Locale aLocale( 
LanguageTag::convertToLocale(changedLanguage.first));
+                if(changedLanguage.second->bRemoved)
                     pImpl->xForbidden->removeForbiddenCharacters( aLocale );
-                else if(itElem->second->pCharacters)
-                    pImpl->xForbidden->setForbiddenCharacters( aLocale, *( 
itElem->second->pCharacters ) );
+                else if(changedLanguage.second->pCharacters)
+                    pImpl->xForbidden->setForbiddenCharacters( aLocale, *( 
changedLanguage.second->pCharacters ) );
             }
         }
         catch (const Exception&)
diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx
index d40a46766302..e161cced7a68 100644
--- a/cui/source/options/optcolor.cxx
+++ b/cui/source/options/optcolor.cxx
@@ -455,10 +455,10 @@ void ColorConfigWindow_Impl::dispose()
     m_pGrid.clear();
     m_pVScroll.clear();
     m_pHeaderHB.clear();
-    for (auto i = vChapters.begin(); i != vChapters.end(); ++i)
-        (*i)->dispose();
-    for (auto i = vEntries.begin(); i != vEntries.end(); ++i)
-        (*i)->dispose();
+    for (auto const& chapter : vChapters)
+        chapter->dispose();
+    for (auto const& entry : vEntries)
+        entry->dispose();
     disposeBuilder();
     VclContainer::dispose();
 }
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 892be4c7ad44..90661cbecede 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -535,12 +535,10 @@ bool CanvasSettings::IsHardwareAccelerationAvailable() 
const
 
         // check whether any of the service lists has an
         // implementation that presents the "HardwareAcceleration" property
-        ServiceVector::const_iterator       
aCurr=maAvailableImplementations.begin();
-        const ServiceVector::const_iterator 
aEnd=maAvailableImplementations.end();
-        while( aCurr != aEnd )
+        for (auto const& availableImpl : maAvailableImplementations)
         {
-            const OUString* pCurrImpl = aCurr->second.getConstArray();
-            const OUString* const pEndImpl = pCurrImpl + 
aCurr->second.getLength();
+            const OUString* pCurrImpl = availableImpl.second.getConstArray();
+            const OUString* const pEndImpl = pCurrImpl + 
availableImpl.second.getLength();
 
             while( pCurrImpl != pEndImpl )
             {
@@ -563,8 +561,6 @@ bool CanvasSettings::IsHardwareAccelerationAvailable() const
 
                 ++pCurrImpl;
             }
-
-            ++aCurr;
         }
     }
 
@@ -679,8 +675,9 @@ OfaViewTabPage::OfaViewTabPage(vcl::Window* pParent, const 
SfxItemSet& rSet)
                                 ")";
     m_pIconStyleLB->InsertEntry(entryForAuto);
 
-    for (std::vector<vcl::IconThemeInfo>::const_iterator aI = 
mInstalledIconThemes.begin(); aI != mInstalledIconThemes.end(); ++aI) {
-        m_pIconStyleLB->InsertEntry(aI->GetDisplayName());
+    for (auto const& installIconTheme : mInstalledIconThemes)
+    {
+        m_pIconStyleLB->InsertEntry(installIconTheme.GetDisplayName());
     }
 
     // separate auto and other icon themes
diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx
index 12f641aa5151..7c7d1f501ba4 100644
--- a/cui/source/options/optlingu.cxx
+++ b/cui/source/options/optlingu.cxx
@@ -1076,14 +1076,12 @@ bool SvxLinguTabPage::FillItemSet( SfxItemSet* rCoreSet 
)
         if (!pLinguData)
             pLinguData = new SvxLinguData_Impl;
 
-        LangImplNameTable::const_iterator aIt;
-
         // update spellchecker configuration entries
         const LangImplNameTable *pTable = &pLinguData->GetSpellTable();
-        for (aIt = pTable->begin();  aIt != pTable->end();  ++aIt)
+        for (auto const& elem : *pTable)
         {
-            LanguageType nLang = aIt->first;
-            const Sequence< OUString > aImplNames( aIt->second );
+            LanguageType nLang = elem.first;
+            const Sequence< OUString > aImplNames(elem.second);
             uno::Reference< XLinguServiceManager2 > xMgr( 
pLinguData->GetManager() );
             Locale aLocale( LanguageTag::convertToLocale(nLang) );
             if (xMgr.is())
@@ -1092,10 +1090,10 @@ bool SvxLinguTabPage::FillItemSet( SfxItemSet* rCoreSet 
)
 
         // update grammar checker configuration entries
         pTable = &pLinguData->GetGrammarTable();
-        for (aIt = pTable->begin();  aIt != pTable->end();  ++aIt)
+        for (auto const& elem : *pTable)
         {
-            LanguageType nLang = aIt->first;
-            const Sequence< OUString > aImplNames( aIt->second );
+            LanguageType nLang = elem.first;
+            const Sequence< OUString > aImplNames(elem.second);
             uno::Reference< XLinguServiceManager2 > xMgr( 
pLinguData->GetManager() );
             Locale aLocale( LanguageTag::convertToLocale(nLang) );
             if (xMgr.is())
@@ -1104,10 +1102,10 @@ bool SvxLinguTabPage::FillItemSet( SfxItemSet* rCoreSet 
)
 
         // update hyphenator configuration entries
         pTable = &pLinguData->GetHyphTable();
-        for (aIt = pTable->begin();  aIt != pTable->end();  ++aIt)
+        for (auto const& elem : *pTable)
         {
-            LanguageType nLang = aIt->first;
-            const Sequence< OUString > aImplNames( aIt->second );
+            LanguageType nLang = elem.first;
+            const Sequence< OUString > aImplNames(elem.second);
             uno::Reference< XLinguServiceManager2 > xMgr( 
pLinguData->GetManager() );
             Locale aLocale( LanguageTag::convertToLocale(nLang) );
             if (xMgr.is())
@@ -1116,10 +1114,10 @@ bool SvxLinguTabPage::FillItemSet( SfxItemSet* rCoreSet 
)
 
         // update thesaurus configuration entries
         pTable = &pLinguData->GetThesTable();
-        for (aIt = pTable->begin();  aIt != pTable->end();  ++aIt)
+        for (auto const& elem : *pTable)
         {
-            LanguageType nLang = aIt->first;
-            const Sequence< OUString > aImplNames( aIt->second );
+            LanguageType nLang = elem.first;
+            const Sequence< OUString > aImplNames(elem.second);
             uno::Reference< XLinguServiceManager2 > xMgr( 
pLinguData->GetManager() );
             Locale aLocale( LanguageTag::convertToLocale(nLang) );
             if (xMgr.is())
diff --git a/cui/source/options/personalization.cxx 
b/cui/source/options/personalization.cxx
index b6af6903d0c7..f1a1235f6641 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -755,10 +755,10 @@ void SearchAndParseThread::execute()
         else
             vLearnmoreURLs.push_back( m_aURL );
 
-        for( it = vLearnmoreURLs.begin(); it!=vLearnmoreURLs.end() && nIndex < 
MAX_RESULTS; ++it )
+        for (auto const& learnMoreUrl : vLearnmoreURLs)
         {
             OUString sPreviewFile, aPersonaSetting;
-            bool bResult = getPreviewFile( *it, &sPreviewFile, 
&aPersonaSetting );
+            bool bResult = getPreviewFile( learnMoreUrl, &sPreviewFile, 
&aPersonaSetting );
             // parsing is buggy at times, as HTML is not proper. Skip it.
             if(aPersonaSetting.isEmpty() || !bResult)
             {
@@ -788,6 +788,8 @@ void SearchAndParseThread::execute()
             m_pPersonaDialog->SetImages( Image( aBmp ), nIndex++ );
             m_pPersonaDialog->setOptimalLayoutSize();
             m_pPersonaDialog->AddPersonaSetting( aPersonaSetting );
+            if (nIndex >= MAX_RESULTS)
+                break;
         }
 
         if( !m_bExecute )
diff --git a/cui/source/options/tsaurls.cxx b/cui/source/options/tsaurls.cxx
index 7674c64581f6..aa3de388ff8c 100644
--- a/cui/source/options/tsaurls.cxx
+++ b/cui/source/options/tsaurls.cxx
@@ -40,9 +40,9 @@ TSAURLsDialog::TSAURLsDialog(vcl::Window* pParent)
         if (aUserSetTSAURLs)
         {
             const css::uno::Sequence<OUString>& rUserSetTSAURLs = 
aUserSetTSAURLs.get();
-            for (auto i = rUserSetTSAURLs.begin(); i != rUserSetTSAURLs.end(); 
++i)
+            for (auto const& userSetTSAURL : rUserSetTSAURLs)
             {
-                AddTSAURL(*i);
+                AddTSAURL(userSetTSAURL);
             }
         }
     }
@@ -89,9 +89,9 @@ void TSAURLsDialog::AddTSAURL(const OUString& rURL)
     m_pURLListBox->SetUpdateMode(false);
     m_pURLListBox->Clear();
 
-    for (auto i = m_aURLs.cbegin(); i != m_aURLs.cend(); ++i)
+    for (auto const& url : m_aURLs)
     {
-        m_pURLListBox->InsertEntry(*i);
+        m_pURLListBox->InsertEntry(url);
     }
 
     m_pURLListBox->SetUpdateMode(true);
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index 9fc095c3c9cf..d65a0a05bafc 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -1051,23 +1051,21 @@ void OfaAutocorrReplacePage::RefillReplaceBox(bool 
bFromReset,
         SvxAutocorrWordList* pWordList = 
pAutoCorrect->LoadAutocorrWordList(eLang);
         m_pReplaceTLB->SetUpdateMode(false);
         SvxAutocorrWordList::Content aContent = pWordList->getSortedContent();
-        for( SvxAutocorrWordList::Content::const_iterator it = 
aContent.begin();
-             it != aContent.end(); ++it )
+        for (auto const& elem : aContent)
         {
-            SvxAutocorrWord* pWordPtr = *it;
-            bool bTextOnly = pWordPtr->IsTextOnly();
+            bool bTextOnly = elem->IsTextOnly();
             // formatted text is only in Writer
             if(bSWriter || bTextOnly)
             {
-                OUString sEntry = pWordPtr->GetShort() + "\t" + 
pWordPtr->GetLong();
+                OUString sEntry = elem->GetShort() + "\t" + elem->GetLong();
                 SvTreeListEntry* pEntry = m_pReplaceTLB->InsertEntry(sEntry);
-                m_pTextOnlyCB->Check(pWordPtr->IsTextOnly());
+                m_pTextOnlyCB->Check(elem->IsTextOnly());
                 if(!bTextOnly)
                     pEntry->SetUserData(m_pTextOnlyCB); // that means: with 
format info
             }
             else
             {
-                aFormatText.insert(pWordPtr->GetShort());
+                aFormatText.insert(elem->GetShort());
             }
         }
         m_pNewReplacePB->Enable(false);
@@ -1358,9 +1356,9 @@ IMPL_LINK(OfaAutocorrReplacePage, ModifyHdl, Edit&, rEdt, 
void)
                                 SvTabListBox::GetEntryText( pFirstSel, 1 ) );
     if( bEnableNew )
     {
-        for(std::set<OUString>::iterator i = aFormatText.begin(); i != 
aFormatText.end(); ++i)
+        for (auto const& elem : aFormatText)
         {
-            if((*i) == rShortTxt)
+            if(elem == rShortTxt)
             {
                 bEnableNew = false;
                 break;
@@ -1372,9 +1370,9 @@ IMPL_LINK(OfaAutocorrReplacePage, ModifyHdl, Edit&, rEdt, 
void)
 
 static bool lcl_FindInArray(std::vector<OUString>& rStrings, const OUString& 
rString)
 {
-    for(std::vector<OUString>::iterator i = rStrings.begin(); i != 
rStrings.end(); ++i)
+    for (auto const& elem : rStrings)
     {
-        if((*i) == rString)
+        if(elem == rString)
         {
             return true;
         }
@@ -1485,9 +1483,9 @@ bool OfaAutocorrExceptPage::FillItemSet( SfxItemSet*  )
                     }
                 }
 
-                for(std::vector<OUString>::iterator it = 
rArrays.aDoubleCapsStrings.begin(); it != rArrays.aDoubleCapsStrings.end(); 
++it)
+                for (auto const& elem : rArrays.aDoubleCapsStrings)
                 {
-                    pWrdList->insert(*it);
+                    pWrdList->insert(elem);
                 }
                 pAutoCorrect->SaveWrdSttExceptList(eCurLang);
             }
@@ -1507,9 +1505,9 @@ bool OfaAutocorrExceptPage::FillItemSet( SfxItemSet*  )
                     }
                 }
 
-                for(std::vector<OUString>::iterator it = 
rArrays.aAbbrevStrings.begin(); it != rArrays.aAbbrevStrings.end(); ++it)
+                for (auto const& elem : rArrays.aAbbrevStrings)
                 {
-                    pCplList->insert(*it);
+                    pCplList->insert(elem);
                 }
 
                 pAutoCorrect->SaveCplSttExceptList(eCurLang);
@@ -1621,11 +1619,11 @@ void OfaAutocorrExceptPage::RefillReplaceBoxes(bool 
bFromReset,
     if(aStringsTable.find(eLang) != aStringsTable.end())
     {
         StringsArrays& rArrays = aStringsTable[eLang];
-        for(std::vector<OUString>::iterator i = 
rArrays.aAbbrevStrings.begin(); i != rArrays.aAbbrevStrings.end(); ++i)
-            m_pAbbrevLB->InsertEntry(*i);
+        for (auto const& elem : rArrays.aAbbrevStrings)
+            m_pAbbrevLB->InsertEntry(elem);
 
-        for(std::vector<OUString>::iterator i = 
rArrays.aDoubleCapsStrings.begin(); i != rArrays.aDoubleCapsStrings.end(); ++i)
-            m_pDoubleCapsLB->InsertEntry(*i);
+        for (auto const& elem : rArrays.aDoubleCapsStrings)
+            m_pDoubleCapsLB->InsertEntry(elem);
     }
     else
     {
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 330da2a248cc..e4ecdd842a25 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -806,15 +806,16 @@ SvxBitmapPickTabPage::SvxBitmapPickTabPage(vcl::Window* 
pParent,
     GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames);
 
     size_t i = 0;
-    for(std::vector<OUString>::iterator it = aGrfNames.begin(); it != 
aGrfNames.end(); ++it, ++i)
+    for (auto & grfName : aGrfNames)
     {
         m_pExamplesVS->InsertItem( i + 1, i);
 
-        INetURLObject aObj(*it);
+        INetURLObject aObj(grfName);
         if(aObj.GetProtocol() == INetProtocol::File)
-            *it = aObj.PathToFileName();
+            grfName = aObj.PathToFileName();
 
-        m_pExamplesVS->SetItemText( i + 1, *it );
+        m_pExamplesVS->SetItemText( i + 1, grfName );
+        ++i;
     }
 
     if(aGrfNames.empty())
@@ -1048,13 +1049,14 @@ IMPL_LINK_NOARG(SvxBitmapPickTabPage, 
ClickAddBrowseHdl_Impl, Button*, void)
 
                 aGrfNames.push_back(aUserGalleryURL);
                 size_t i = 0;
-                for(std::vector<OUString>::iterator it = aGrfNames.begin(); it 
!= aGrfNames.end(); ++it, ++i)
+                for (auto & grfName : aGrfNames)
                 {
                     m_pExamplesVS->InsertItem( i + 1, i);
-                    INetURLObject aObj(*it);
+                    INetURLObject aObj(grfName);
                     if(aObj.GetProtocol() == INetProtocol::File)
-                        *it = aObj.PathToFileName();
-                    m_pExamplesVS->SetItemText( i + 1, *it );
+                        grfName = aObj.PathToFileName();
+                    m_pExamplesVS->SetItemText( i + 1, grfName );
+                    ++i;
                 }
 
                 if(aGrfNames.empty())
@@ -1994,14 +1996,12 @@ IMPL_LINK_NOARG(SvxNumOptionsTabPage, 
PopupActivateHdl_Impl, MenuButton *, void)
             GalleryExplorer::BeginLocking(GALLERY_THEME_BULLETS);
 
             Graphic aGraphic;
-            OUString sGrfName;
-            std::vector<OUString>::const_iterator it = aGrfNames.begin();
-            for(size_t i = 0; it != aGrfNames.end(); ++it, ++i)
+            size_t i = 0;
+            for (auto & grfName : aGrfNames)
             {
-                sGrfName = *it;
-                INetURLObject aObj(sGrfName);
+                INetURLObject aObj(grfName);
                 if(aObj.GetProtocol() == INetProtocol::File)
-                    sGrfName = aObj.PathToFileName();
+                    grfName = aObj.PathToFileName();
 
                 if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, i, 
&aGraphic))
                 {
@@ -2018,14 +2018,15 @@ IMPL_LINK_NOARG(SvxNumOptionsTabPage, 
PopupActivateHdl_Impl, MenuButton *, void)
                     }
                     Image aImage(aBitmap);
 
-                    pPopup->InsertItem(MN_GALLERY_ENTRY + i, sGrfName, aImage 
);
+                    pPopup->InsertItem(MN_GALLERY_ENTRY + i, grfName, aImage );
                 }
                 else
                 {
                     Image aImage;
                     pPopup->InsertItem(
-                        MN_GALLERY_ENTRY + i, sGrfName, aImage );
+                        MN_GALLERY_ENTRY + i, grfName, aImage );
                 }
+                ++i;
             }
             GalleryExplorer::EndLocking(GALLERY_THEME_BULLETS);
         }
diff --git a/cui/source/tabpages/swpossizetabpage.cxx 
b/cui/source/tabpages/swpossizetabpage.cxx
index 5b35baf2ecf0..77fa63d5b430 100644
--- a/cui/source/tabpages/swpossizetabpage.cxx
+++ b/cui/source/tabpages/swpossizetabpage.cxx
@@ -680,10 +680,9 @@ void SvxSwPosSizeTabPage::setOptimalFrmWidth()
     std::sort(aFrames.begin(), aFrames.end());
     aFrames.erase(std::unique(aFrames.begin(), aFrames.end()), aFrames.end());
 
-    for (std::vector<SvxSwFramePosString::StringId>::const_iterator aI = 
aFrames.begin(), aEnd = aFrames.end();
-        aI != aEnd; ++aI)
+    for (auto const& frame : aFrames)
     {
-        m_pHoriLB->InsertEntry(SvxSwFramePosString::GetString(*aI));
+        m_pHoriLB->InsertEntry(SvxSwFramePosString::GetString(frame));
     }
 
     Size aBiggest(m_pHoriLB->GetOptimalSize());
@@ -721,10 +720,9 @@ void SvxSwPosSizeTabPage::setOptimalRelWidth()
     std::sort(aRels.begin(), aRels.end());
     aRels.erase(std::unique(aRels.begin(), aRels.end()), aRels.end());
 
-    for (std::vector<SvxSwFramePosString::StringId>::const_iterator aI = 
aRels.begin(), aEnd = aRels.end();
-        aI != aEnd; ++aI)
+    for (auto const& elem : aRels)
     {
-        m_pHoriLB->InsertEntry(SvxSwFramePosString::GetString(*aI));
+        m_pHoriLB->InsertEntry(SvxSwFramePosString::GetString(elem));
     }
 
     Size aBiggest(m_pHoriLB->GetOptimalSize());
diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx
index d9519b32baa0..d33173d9b83b 100644
--- a/cui/source/tabpages/tpcolor.cxx
+++ b/cui/source/tabpages/tpcolor.cxx
@@ -212,9 +212,9 @@ void SvxColorTabPage::FillPaletteLB()
 {
     m_pSelectPalette->Clear();
     std::vector<OUString> aPaletteList = maPaletteManager.GetPaletteList();
-    for( std::vector<OUString>::iterator it = aPaletteList.begin(); it != 
aPaletteList.end(); ++it )
+    for (auto const& palette : aPaletteList)
     {
-        m_pSelectPalette->InsertEntry( *it );
+        m_pSelectPalette->InsertEntry(palette);
     }
     OUString aPaletteName( 
officecfg::Office::Common::UserColors::PaletteName::get() );
     m_pSelectPalette->SelectEntry(aPaletteName);
diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx
index c45d56bc5dc0..36fae228bc34 100644
--- a/cui/source/tabpages/tpline.cxx
+++ b/cui/source/tabpages/tpline.cxx
@@ -282,19 +282,19 @@ void SvxLineTabPage::InitSymbols(MenuButton const * 
pButton)
         VclPtrInstance<PopupMenu> pPopup;
         sal_uInt32 i = 0;
         m_nNumMenuGalleryItems = m_aGrfNames.size();
-        for(std::vector<OUString>::iterator it = m_aGrfNames.begin(); it != 
m_aGrfNames.end(); ++it, ++i)
+        for (auto const& grfName : m_aGrfNames)
         {
-            const OUString *pUIName = &(*it);
+            const OUString *pUIName = &grfName;
 
             // Convert URL encodings to UI characters (e.g. %20 for spaces)
             OUString aPhysicalName;
-            if (osl::FileBase::getSystemPathFromFileURL(*it, aPhysicalName)
+            if (osl::FileBase::getSystemPathFromFileURL(grfName, aPhysicalName)
                 == osl::FileBase::E_None)
             {
                 pUIName = &aPhysicalName;
             }
 
-            SvxBrushItem* pBrushItem = new SvxBrushItem(*it, "", GPOS_AREA, 
SID_ATTR_BRUSH);
+            SvxBrushItem* pBrushItem = new SvxBrushItem(grfName, "", 
GPOS_AREA, SID_ATTR_BRUSH);
 
             SvxBmpItemInfo* pInfo = new SvxBmpItemInfo;
             pInfo->pBrushItem = pBrushItem;
@@ -329,6 +329,7 @@ void SvxLineTabPage::InitSymbols(MenuButton const * pButton)
                 Image aImage;
                 pPopup->InsertItem(pInfo->nItemId, *pUIName, aImage );
             }
+            ++i;
         }
         m_pSymbolMB->GetPopupMenu()->SetPopupMenu( MN_GALLERY, pPopup );
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to