[Libreoffice-commits] core.git: 2 commits - basctl/source basegfx/source basic/source bridges/source canvas/source chart2/source comphelper/source configmgr/source connectivity/source cppcanvas/source cppuhelper/source cppu/source cui/source

Noel Grandin noel at peralex.com
Thu Apr 21 09:13:50 UTC 2016


 basctl/source/accessibility/accessibledialogwindow.cxx            |   20 +-
 basctl/source/basicide/baside2b.cxx                               |    4 
 basctl/source/basicide/bastype3.cxx                               |    6 
 basctl/source/basicide/breakpoint.cxx                             |   13 -
 basctl/source/basicide/doceventnotifier.cxx                       |    6 
 basegfx/source/polygon/b2dpolygonclipper.cxx                      |    4 
 basegfx/source/polygon/b2dpolygoncutandtouch.cxx                  |    3 
 basegfx/source/polygon/b2dpolypolygon.cxx                         |    4 
 basegfx/source/polygon/b2dpolypolygoncutter.cxx                   |    4 
 basegfx/source/polygon/b2dtrapezoid.cxx                           |    3 
 basic/source/comp/parser.cxx                                      |    4 
 basic/source/comp/symtbl.cxx                                      |    7 
 basic/source/runtime/ddectrl.cxx                                  |    4 
 basic/source/runtime/iosys.cxx                                    |    4 
 bridges/source/cpp_uno/shared/component.cxx                       |    4 
 canvas/source/cairo/cairo_textlayout.cxx                          |    6 
 canvas/source/opengl/ogl_canvastools.cxx                          |    4 
 chart2/source/controller/dialogs/tp_SeriesToAxis.cxx              |    3 
 chart2/source/controller/sidebar/ChartAxisPanel.cxx               |   12 -
 chart2/source/controller/sidebar/ChartErrorBarPanel.cxx           |   12 -
 chart2/source/controller/sidebar/ChartSeriesPanel.cxx             |   12 -
 chart2/source/model/main/BaseCoordinateSystem.cxx                 |    4 
 chart2/source/tools/InternalDataProvider.cxx                      |    8 
 chart2/source/view/charttypes/GL3DBarChart.cxx                    |   18 +-
 chart2/source/view/charttypes/VSeriesPlotter.cxx                  |   14 -
 chart2/source/view/main/ChartView.cxx                             |   45 ++---
 chart2/source/view/main/GL3DRenderer.cxx                          |   84 ++++------
 chart2/source/view/main/OpenGLRender.cxx                          |    4 
 comphelper/source/misc/threadpool.cxx                             |    8 
 configmgr/source/access.cxx                                       |   60 +++----
 configmgr/source/writemodfile.cxx                                 |    8 
 connectivity/source/drivers/mork/MDatabaseMetaData.cxx            |   21 +-
 connectivity/source/drivers/mork/MDatabaseMetaDataHelper.cxx      |    3 
 connectivity/source/drivers/mork/MResultSet.cxx                   |    6 
 connectivity/source/drivers/postgresql/pq_connection.cxx          |    6 
 connectivity/source/drivers/postgresql/pq_preparedstatement.cxx   |    7 
 connectivity/source/drivers/postgresql/pq_updateableresultset.cxx |    6 
 connectivity/source/parse/sqlnode.cxx                             |    8 
 cppcanvas/source/mtfrenderer/implrenderer.cxx                     |    4 
 cppu/source/uno/lbenv.cxx                                         |    4 
 cppuhelper/source/bootstrap.cxx                                   |    4 
 cui/source/customize/acccfg.cxx                                   |    4 
 cui/source/dialogs/cuifmsearch.cxx                                |   28 +--
 cui/source/dialogs/cuigaldlg.cxx                                  |   14 -
 cui/source/dialogs/cuiimapwnd.cxx                                 |    4 
 cui/source/dialogs/iconcdlg.cxx                                   |   13 -
 cui/source/dialogs/linkdlg.cxx                                    |    7 
 cui/source/dialogs/thesdlg.cxx                                    |    4 
 cui/source/options/optaboutconfig.cxx                             |    6 
 cui/source/options/optupdt.cxx                                    |    6 
 cui/source/options/personalization.cxx                            |   22 +-
 cui/source/options/treeopt.cxx                                    |   23 +-
 cui/source/tabpages/autocdlg.cxx                                  |   10 -
 cui/source/tabpages/border.cxx                                    |   12 -
 cui/source/tabpages/labdlg.cxx                                    |    8 
 cui/source/tabpages/numpages.cxx                                  |    6 
 cui/source/tabpages/swpossizetabpage.cxx                          |   22 +-
 cui/source/tabpages/tpline.cxx                                    |    3 
 58 files changed, 300 insertions(+), 353 deletions(-)

New commits:
commit e1af7f0c438bc242e4562aa0286c99787b5ad544
Author: Noel Grandin <noel at peralex.com>
Date:   Thu Apr 21 11:03:55 2016 +0200

    clang-tidy modernize-loop-convert in c*
    
    Change-Id: I77d2548f8be97792660761e6156cd24734a95aaf

diff --git a/canvas/source/cairo/cairo_textlayout.cxx b/canvas/source/cairo/cairo_textlayout.cxx
index c787f02..fa3d5b1 100644
--- a/canvas/source/cairo/cairo_textlayout.cxx
+++ b/canvas/source/cairo/cairo_textlayout.cxx
@@ -512,10 +512,10 @@ namespace cairocanvas
                 // loop to draw the text for every half pixel of displacement
                 for (int nSteps = 0; nSteps < total_steps; nSteps++)
                 {
-                    for(int nGlyphIdx = 0; nGlyphIdx < (int) cairo_glyphs.size(); nGlyphIdx++)
+                    for(cairo_glyph_t & cairo_glyph : cairo_glyphs)
                     {
-                        cairo_glyphs[nGlyphIdx].x += (bold_dx * nSteps / total_steps) / 4;
-                        cairo_glyphs[nGlyphIdx].y -= (bold_dx * nSteps / total_steps) / 4;
+                        cairo_glyph.x += (bold_dx * nSteps / total_steps) / 4;
+                        cairo_glyph.y -= (bold_dx * nSteps / total_steps) / 4;
                     }
                     cairo_show_glyphs(pSCairo.get(), &cairo_glyphs[0], cairo_glyphs.size());
                 }
diff --git a/canvas/source/opengl/ogl_canvastools.cxx b/canvas/source/opengl/ogl_canvastools.cxx
index 1a37c69..657a220 100644
--- a/canvas/source/opengl/ogl_canvastools.cxx
+++ b/canvas/source/opengl/ogl_canvastools.cxx
@@ -113,14 +113,14 @@ namespace oglcanvas
         aScaleShear.shearX(-0.1);
         aScaleShear.scale(scale,scale);
 
-        for( size_t i=0; i<rNumbers.size(); ++i )
+        for(double rNumber : rNumbers)
         {
             aTmp.identity();
             aTmp.translate(0,y);
             y += 1.2*scale;
 
             basegfx::B2DPolyPolygon aPoly=
-                basegfx::tools::number2PolyPolygon(rNumbers[i],10,3);
+                basegfx::tools::number2PolyPolygon(rNumber,10,3);
 
             aTmp=aTmp*aScaleShear;
             aPoly.transform(aTmp);
diff --git a/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx b/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx
index 8e15393..b8c6a7a 100644
--- a/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx
+++ b/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx
@@ -199,9 +199,8 @@ void SchOptionTabPage::Reset(const SfxItemSet* rInAttrs)
             m_pRB_AssumeZero->Enable(false);
             m_pRB_ContinueLine->Enable(false);
 
-            for( size_t nN =0; nN<aMissingValueTreatments.size(); nN++ )
+            for(int nVal : aMissingValueTreatments)
             {
-                sal_Int32 nVal = aMissingValueTreatments[nN];
                 if(nVal==css::chart::MissingValueTreatment::LEAVE_GAP)
                     m_pRB_DontPaint->Enable();
                 else if(nVal==css::chart::MissingValueTreatment::USE_ZERO)
diff --git a/chart2/source/controller/sidebar/ChartAxisPanel.cxx b/chart2/source/controller/sidebar/ChartAxisPanel.cxx
index 22cda88..be80a4c 100644
--- a/chart2/source/controller/sidebar/ChartAxisPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAxisPanel.cxx
@@ -100,10 +100,10 @@ sal_Int32 getLabelPosition(const css::uno::Reference<css::frame::XModel>& xModel
 
     css::chart::ChartAxisLabelPosition ePos;
     aAny >>= ePos;
-    for (size_t i = 0; i < SAL_N_ELEMENTS(aLabelPosMap); ++i)
+    for (AxisLabelPosMap & i : aLabelPosMap)
     {
-        if (aLabelPosMap[i].ePos == ePos)
-            return aLabelPosMap[i].nPos;
+        if (i.ePos == ePos)
+            return i.nPos;
     }
 
     return 0;
@@ -119,10 +119,10 @@ void setLabelPosition(const css::uno::Reference<css::frame::XModel>& xModel,
         return;
 
     css::chart::ChartAxisLabelPosition ePos;
-    for (size_t i = 0; i < SAL_N_ELEMENTS(aLabelPosMap); ++i)
+    for (AxisLabelPosMap & i : aLabelPosMap)
     {
-        if (aLabelPosMap[i].nPos == nPos)
-            ePos = aLabelPosMap[i].ePos;
+        if (i.nPos == nPos)
+            ePos = i.ePos;
     }
 
     xAxis->setPropertyValue("LabelPosition", css::uno::makeAny(ePos));
diff --git a/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx b/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
index f845dfa..401e7cf 100644
--- a/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
@@ -150,10 +150,10 @@ sal_Int32 getTypePos(const css::uno::Reference<css::frame::XModel>& xModel,
     sal_Int32 nApi = 0;
     aAny >>= nApi;
 
-    for (size_t i = 0; i < SAL_N_ELEMENTS(aErrorBarType); ++i)
+    for (ErrorBarTypeMap & i : aErrorBarType)
     {
-        if (aErrorBarType[i].nApi == nApi)
-            return aErrorBarType[i].nPos;
+        if (i.nApi == nApi)
+            return i.nPos;
     }
 
     return 0;
@@ -169,10 +169,10 @@ void setTypePos(const css::uno::Reference<css::frame::XModel>& xModel,
         return;
 
     sal_Int32 nApi = 0;
-    for (size_t i = 0; i < SAL_N_ELEMENTS(aErrorBarType); ++i)
+    for (ErrorBarTypeMap & i : aErrorBarType)
     {
-        if (aErrorBarType[i].nPos == nPos)
-            nApi = aErrorBarType[i].nApi;
+        if (i.nPos == nPos)
+            nApi = i.nApi;
     }
 
     xPropSet->setPropertyValue("ErrorBarStyle", css::uno::makeAny(nApi));
diff --git a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
index c255fb1..b2a71cc 100644
--- a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
@@ -110,10 +110,10 @@ sal_Int32 getDataLabelPlacement(const css::uno::Reference<css::frame::XModel>& x
     sal_Int32 nPlacement = 0;
     aAny >>= nPlacement;
 
-    for (size_t i = 0; i < SAL_N_ELEMENTS(aLabelPlacementMap); ++i)
+    for (LabelPlacementMap & i : aLabelPlacementMap)
     {
-        if (aLabelPlacementMap[i].nApi == nPlacement)
-            return aLabelPlacementMap[i].nPos;
+        if (i.nApi == nPlacement)
+            return i.nPos;
     }
 
     return 0;
@@ -129,11 +129,11 @@ void setDataLabelPlacement(const css::uno::Reference<css::frame::XModel>& xModel
         return;
 
     sal_Int32 nApi = 0;
-    for (size_t i = 0; i < SAL_N_ELEMENTS(aLabelPlacementMap); ++i)
+    for (LabelPlacementMap & i : aLabelPlacementMap)
     {
-        if (aLabelPlacementMap[i].nPos == nPos)
+        if (i.nPos == nPos)
         {
-            nApi = aLabelPlacementMap[i].nApi;
+            nApi = i.nApi;
             break;
         }
     }
diff --git a/chart2/source/model/main/BaseCoordinateSystem.cxx b/chart2/source/model/main/BaseCoordinateSystem.cxx
index 6eb5cae..5930000 100644
--- a/chart2/source/model/main/BaseCoordinateSystem.cxx
+++ b/chart2/source/model/main/BaseCoordinateSystem.cxx
@@ -184,8 +184,8 @@ BaseCoordinateSystem::~BaseCoordinateSystem()
 {
     try
     {
-        for( tAxisVecVecType::size_type nN=0; nN<m_aAllAxis.size(); nN++ )
-            ModifyListenerHelper::removeListenerFromAllElements( m_aAllAxis[nN], m_xModifyEventForwarder );
+        for(tAxisVecVecType::value_type & m_aAllAxi : m_aAllAxis)
+            ModifyListenerHelper::removeListenerFromAllElements( m_aAllAxi, m_xModifyEventForwarder );
         ModifyListenerHelper::removeListenerFromAllElements( m_aChartTypes, m_xModifyEventForwarder );
     }
     catch( const uno::Exception & ex )
diff --git a/chart2/source/tools/InternalDataProvider.cxx b/chart2/source/tools/InternalDataProvider.cxx
index 44de6cb..fb8004f 100644
--- a/chart2/source/tools/InternalDataProvider.cxx
+++ b/chart2/source/tools/InternalDataProvider.cxx
@@ -582,8 +582,8 @@ InternalDataProvider::createDataSequenceFromArray( const OUString& rArrayStr, co
 
         std::vector<double> aValues;
         aValues.reserve(aRawElems.size());
-        for (size_t i = 0; i < aRawElems.size(); ++i)
-            aValues.push_back(aRawElems[i].toDouble());
+        for (OUString & aRawElem : aRawElems)
+            aValues.push_back(aRawElem.toDouble());
         sal_Int32 n = m_aInternalData.appendColumn();
 
         m_aInternalData.setColumnValues(n, aValues);
@@ -598,8 +598,8 @@ InternalDataProvider::createDataSequenceFromArray( const OUString& rArrayStr, co
         aValues.reserve(aRawElems.size());
         if (bAllNumeric)
         {
-            for (size_t i = 0; i < aRawElems.size(); ++i)
-                aValues.push_back(aRawElems[i].toDouble());
+            for (OUString & aRawElem : aRawElems)
+                aValues.push_back(aRawElem.toDouble());
         }
         else
         {
diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index 424b502..497609f 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -1302,9 +1302,9 @@ void GL3DBarChart::updateClickEvent()
             }
             nIdex++;
         }
-        for (sal_uInt32 i = 0; i < DISPLAY_BARS_NUM; i++)
+        for (unsigned int i : nBarIdArray)
         {
-            addMovementScreenText(nBarIdArray[i]);
+            addMovementScreenText(i);
         }
         //add translucent back ground
         aTitle = " ";
@@ -1417,10 +1417,10 @@ void GL3DBarChart::updateScroll()
     {
         float fMinDistance = 0.0f;
         std::vector<BarInformation> aBarInfoList;
-        for(size_t i= 0;i < maVectorNearest.size(); i++)
+        for(sal_uInt32 i : maVectorNearest)
         {
             //get bar height position
-            std::map<sal_uInt32, const BarInformation>::const_iterator itr = maBarMap.find(maVectorNearest[i]);
+            std::map<sal_uInt32, const BarInformation>::const_iterator itr = maBarMap.find(i);
             const BarInformation& rBarInfo = itr->second;
             aBarInfoList.push_back(rBarInfo);
             glm::vec3 aPos = rBarInfo.maPos;
@@ -1431,15 +1431,15 @@ void GL3DBarChart::updateScroll()
         if (fMinDistance <= SHOW_SCROLL_TEXT_DISTANCE)
         {
             //update scroll value
-            for(size_t i = 0; i < aBarInfoList.size(); i++)
+            for(BarInformation & i : aBarInfoList)
             {
-                OUString aBarValue = "Value: " + OUString::number(aBarInfoList[i].mnVal);
+                OUString aBarValue = "Value: " + OUString::number(i.mnVal);
                 maScreenTextShapes.push_back(o3tl::make_unique<opengl3D::ScreenText>(mpRenderer.get(), *mpTextCache, aBarValue, glm::vec4(0.0f, 0.0f, 1.0f, 0.0f), CALC_POS_EVENT_ID, true));
                 const opengl3D::TextCacheItem& rTextCache = mpTextCache->getText(aBarValue);
                 float nRectWidth = (float)rTextCache.maSize.Width() / (float)rTextCache.maSize.Height() * 0.024;
-                glm::vec3 aTextPos = glm::vec3(aBarInfoList[i].maPos.x + BAR_SIZE_X / 2.0f,
-                                      aBarInfoList[i].maPos.y + BAR_SIZE_Y / 2.0f,
-                                      aBarInfoList[i].maPos.z);
+                glm::vec3 aTextPos = glm::vec3(i.maPos.x + BAR_SIZE_X / 2.0f,
+                                      i.maPos.y + BAR_SIZE_Y / 2.0f,
+                                      i.maPos.z);
                 opengl3D::ScreenText* pScreenText = static_cast<opengl3D::ScreenText*>(maScreenTextShapes.back().get());
                 pScreenText->setPosition(glm::vec2(-nRectWidth / 2, 0.03f), glm::vec2(nRectWidth / 2, -0.03f), aTextPos);
             }
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index d50ace0..fff2eeb 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -1406,13 +1406,12 @@ double VSeriesPlotter::getMinimumYInRange( double fMinimumX, double fMaximumX, s
     double fMinimum, fMaximum;
     ::rtl::math::setInf(&fMinimum, false);
     ::rtl::math::setInf(&fMaximum, true);
-    for(size_t nZ =0; nZ<m_aZSlots.size();nZ++ )
+    for(std::vector<VDataSeriesGroup> & rXSlots : m_aZSlots)
     {
-        ::std::vector< VDataSeriesGroup >& rXSlots = m_aZSlots[nZ];
-        for(size_t nN =0; nN<rXSlots.size();nN++ )
+        for(VDataSeriesGroup & rXSlot : rXSlots)
         {
             double fLocalMinimum, fLocalMaximum;
-            rXSlots[nN].calculateYMinAndMaxForCategoryRange(
+            rXSlot.calculateYMinAndMaxForCategoryRange(
                                 static_cast<sal_Int32>(fMinimumX-1.0) //first category (index 0) matches with real number 1.0
                                 , static_cast<sal_Int32>(fMaximumX-1.0) //first category (index 0) matches with real number 1.0
                                 , isSeparateStackingForDifferentSigns( 1 )
@@ -1440,13 +1439,12 @@ double VSeriesPlotter::getMaximumYInRange( double fMinimumX, double fMaximumX, s
     double fMinimum, fMaximum;
     ::rtl::math::setInf(&fMinimum, false);
     ::rtl::math::setInf(&fMaximum, true);
-    for(size_t nZ =0; nZ<m_aZSlots.size();nZ++ )
+    for( std::vector< VDataSeriesGroup > & rXSlots : m_aZSlots)
     {
-        ::std::vector< VDataSeriesGroup >& rXSlots = m_aZSlots[nZ];
-        for(size_t nN =0; nN<rXSlots.size();nN++ )
+        for(VDataSeriesGroup & rXSlot : rXSlots)
         {
             double fLocalMinimum, fLocalMaximum;
-            rXSlots[nN].calculateYMinAndMaxForCategoryRange(
+            rXSlot.calculateYMinAndMaxForCategoryRange(
                                 static_cast<sal_Int32>(fMinimumX-1.0) //first category (index 0) matches with real number 1.0
                                 , static_cast<sal_Int32>(fMaximumX-1.0) //first category (index 0) matches with real number 1.0
                                 , isSeparateStackingForDifferentSigns( 1 )
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 82cf455..bd8b50a 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -238,16 +238,16 @@ sal_Int32 AxisUsage::getMaxAxisIndexForDimension( sal_Int32 nDimensionIndex )
 void AxisUsage::prepareAutomaticAxisScaling( ScaleAutomatism& rScaleAutomatism, sal_Int32 nDimIndex, sal_Int32 nAxisIndex )
 {
     std::vector<VCoordinateSystem*> aVCooSysList = getCoordinateSystems(nDimIndex, nAxisIndex);
-    for (size_t i = 0, n = aVCooSysList.size(); i < n; ++i)
-        aVCooSysList[i]->prepareAutomaticAxisScaling(rScaleAutomatism, nDimIndex, nAxisIndex);
+    for (VCoordinateSystem * i : aVCooSysList)
+        i->prepareAutomaticAxisScaling(rScaleAutomatism, nDimIndex, nAxisIndex);
 }
 
 void AxisUsage::setExplicitScaleAndIncrement(
     sal_Int32 nDimIndex, sal_Int32 nAxisIndex, const ExplicitScaleData& rScale, const ExplicitIncrementData& rInc )
 {
     std::vector<VCoordinateSystem*> aVCooSysList = getCoordinateSystems(nDimIndex, nAxisIndex);
-    for (size_t i = 0, n = aVCooSysList.size(); i < n; ++i)
-        aVCooSysList[i]->setExplicitScaleAndIncrement(nDimIndex, nAxisIndex, rScale, rInc);
+    for (VCoordinateSystem* i : aVCooSysList)
+        i->setExplicitScaleAndIncrement(nDimIndex, nAxisIndex, rScale, rInc);
 }
 
 typedef std::vector<std::unique_ptr<VSeriesPlotter> > SeriesPlottersType;
@@ -380,8 +380,8 @@ SeriesPlotterContainer::SeriesPlotterContainer( std::vector< VCoordinateSystem*
 SeriesPlotterContainer::~SeriesPlotterContainer()
 {
     // - remove plotter from coordinatesystems
-    for( size_t nC=0; nC < m_rVCooSysList.size(); nC++)
-        m_rVCooSysList[nC]->clearMinimumAndMaximumSupplierList();
+    for(VCoordinateSystem* nC : m_rVCooSysList)
+        nC->clearMinimumAndMaximumSupplierList();
 }
 
 std::vector< LegendEntryProvider* > SeriesPlotterContainer::getLegendEntryProviderList()
@@ -396,9 +396,8 @@ std::vector< LegendEntryProvider* > SeriesPlotterContainer::getLegendEntryProvid
 VCoordinateSystem* findInCooSysList( const std::vector< VCoordinateSystem* >& rVCooSysList
                                     , const uno::Reference< XCoordinateSystem >& xCooSys )
 {
-    for( size_t nC=0; nC < rVCooSysList.size(); nC++)
+    for(VCoordinateSystem* pVCooSys : rVCooSysList)
     {
-        VCoordinateSystem* pVCooSys = rVCooSysList[nC];
         if(pVCooSys->getModel()==xCooSys)
             return pVCooSys;
     }
@@ -409,9 +408,8 @@ VCoordinateSystem* lcl_getCooSysForPlotter( const std::vector< VCoordinateSystem
 {
     if(!pMinimumAndMaximumSupplier)
         return nullptr;
-    for( size_t nC=0; nC < rVCooSysList.size(); nC++)
+    for(VCoordinateSystem* pVCooSys : rVCooSysList)
     {
-        VCoordinateSystem* pVCooSys = rVCooSysList[nC];
         if(pVCooSys->hasMinimumAndMaximumSupplier( pMinimumAndMaximumSupplier ))
             return pVCooSys;
     }
@@ -621,9 +619,8 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(
     {
         uno::Sequence< OUString > aSeriesNames;
         bool bSeriesNamesInitialized = false;
-        for( size_t nC=0; nC < m_rVCooSysList.size(); nC++)
+        for(VCoordinateSystem* pVCooSys : m_rVCooSysList)
         {
-            VCoordinateSystem* pVCooSys = m_rVCooSysList[nC];
             if(!pVCooSys)
                 continue;
             if( pVCooSys->needSeriesNamesForAxis() )
@@ -663,9 +660,8 @@ void SeriesPlotterContainer::initAxisUsageList(const Date& rNullDate)
 
     // Loop through coordinate systems in the diagram (though for now
     // there should only be one coordinate system per diagram).
-    for (size_t i = 0, n = m_rVCooSysList.size(); i < n; ++i)
+    for (VCoordinateSystem* pVCooSys : m_rVCooSysList)
     {
-        VCoordinateSystem* pVCooSys = m_rVCooSysList[i];
         uno::Reference<XCoordinateSystem> xCooSys = pVCooSys->getModel();
         sal_Int32 nDimCount = xCooSys->getDimension();
 
@@ -708,9 +704,8 @@ void SeriesPlotterContainer::initAxisUsageList(const Date& rNullDate)
     ::std::map< uno::Reference< XAxis >, AxisUsage >::iterator             aAxisIter    = m_aAxisUsageList.begin();
     const ::std::map< uno::Reference< XAxis >, AxisUsage >::const_iterator aAxisEndIter = m_aAxisUsageList.end();
     m_nMaxAxisIndex = 0;
-    for (size_t i = 0, n = m_rVCooSysList.size(); i < n; ++i)
+    for (VCoordinateSystem* pVCooSys : m_rVCooSysList)
     {
-        VCoordinateSystem* pVCooSys = m_rVCooSysList[i];
         uno::Reference<XCoordinateSystem> xCooSys = pVCooSys->getModel();
         sal_Int32 nDimCount = xCooSys->getDimension();
 
@@ -790,8 +785,8 @@ void SeriesPlotterContainer::setNumberFormatsFromAxes()
 
 void SeriesPlotterContainer::updateScalesAndIncrementsOnAxes()
 {
-    for( size_t nC=0; nC < m_rVCooSysList.size(); nC++)
-        m_rVCooSysList[nC]->updateScalesAndIncrementsOnAxes();
+    for(VCoordinateSystem* nC : m_rVCooSysList)
+        nC->updateScalesAndIncrementsOnAxes();
 }
 
 void SeriesPlotterContainer::doAutoScaling( ChartModel& rChartModel )
@@ -882,15 +877,15 @@ void SeriesPlotterContainer::AdaptScaleOfYAxisWithoutAttachedSeries( ChartModel&
             if (bSeriesAttachedToThisAxis || nAttachedAxisIndex < 0)
                 continue;
 
-            for( size_t nC = 0; nC < aVCooSysList_Y.size(); ++nC )
+            for(VCoordinateSystem* nC : aVCooSysList_Y)
             {
-                aVCooSysList_Y[nC]->prepareAutomaticAxisScaling( rAxisUsage.aAutoScaling, 1, nAttachedAxisIndex );
+                nC->prepareAutomaticAxisScaling( rAxisUsage.aAutoScaling, 1, nAttachedAxisIndex );
 
-                ExplicitScaleData aExplicitScaleSource = aVCooSysList_Y[nC]->getExplicitScale( 1,nAttachedAxisIndex );
-                ExplicitIncrementData aExplicitIncrementSource = aVCooSysList_Y[nC]->getExplicitIncrement( 1,nAttachedAxisIndex );
+                ExplicitScaleData aExplicitScaleSource = nC->getExplicitScale( 1,nAttachedAxisIndex );
+                ExplicitIncrementData aExplicitIncrementSource = nC->getExplicitIncrement( 1,nAttachedAxisIndex );
 
-                ExplicitScaleData aExplicitScaleDest = aVCooSysList_Y[nC]->getExplicitScale( 1,nAxisIndex );
-                ExplicitIncrementData aExplicitIncrementDest = aVCooSysList_Y[nC]->getExplicitIncrement( 1,nAxisIndex );
+                ExplicitScaleData aExplicitScaleDest = nC->getExplicitScale( 1,nAxisIndex );
+                ExplicitIncrementData aExplicitIncrementDest = nC->getExplicitIncrement( 1,nAxisIndex );
 
                 aExplicitScaleDest.Orientation = aExplicitScaleSource.Orientation;
                 aExplicitScaleDest.Scaling = aExplicitScaleSource.Scaling;
@@ -936,7 +931,7 @@ void SeriesPlotterContainer::AdaptScaleOfYAxisWithoutAttachedSeries( ChartModel&
                             aExplicitIncrementSource.SubIncrements[0].IntervalCount;
                 }
 
-                aVCooSysList_Y[nC]->setExplicitScaleAndIncrement( 1, nAxisIndex, aExplicitScaleDest, aExplicitIncrementDest );
+                nC->setExplicitScaleAndIncrement( 1, nAxisIndex, aExplicitScaleDest, aExplicitIncrementDest );
             }
         }
     }
diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx
index 1f68959..61916f9 100644
--- a/chart2/source/view/main/GL3DRenderer.cxx
+++ b/chart2/source/view/main/GL3DRenderer.cxx
@@ -134,9 +134,9 @@ OpenGL3DRenderer::~OpenGL3DRenderer()
     glDeleteRenderbuffers(1, &mnPickingRboDepth);
     glDeleteRenderbuffers(1, &mnPickingRboColor);
 
-    for (size_t i = 0; i < m_TextInfoBatch.texture.size(); i++)
+    for (TextureArrayInfo & i : m_TextInfoBatch.texture)
     {
-        glDeleteTextures(1, &m_TextInfoBatch.texture[i].textureID);
+        glDeleteTextures(1, &i.textureID);
     }
     m_TextInfoBatch.texture.clear();
 
@@ -568,9 +568,9 @@ void OpenGL3DRenderer::CreateActualRoundedCube(float fRadius, int iSubDivY, int
     {
         m_RoundBarMesh.iElementSizes[k] = indices[k].size() - m_RoundBarMesh.iElementStartIndices[k];
         m_RoundBarMesh.iElementStartIndices[k] = m_Indices.size() * sizeof(unsigned short);
-        for (size_t IdxCnt = 0; IdxCnt < indices[k].size(); IdxCnt++)
+        for (unsigned short & IdxCnt : indices[k])
         {
-            m_Indices.push_back(indices[k][IdxCnt]);
+            m_Indices.push_back(IdxCnt);
         }
         indices[k].clear();
     }
@@ -680,9 +680,8 @@ int OpenGL3DRenderer::GenerateRoundCornerBar(std::vector<glm::vec3> &vertices, s
                 glm::normalize(vQuadPoints[2]),
                 glm::normalize(vQuadPoints[3])
             };
-            for (int i = 0; i < 6; i++)
+            for (int index : iIndices)
             {
-                int index = iIndices[i];
                 vertices.push_back(vActualQuadPoints[index]);
                 normals.push_back(vNormals[index]);
             }
@@ -706,9 +705,8 @@ int OpenGL3DRenderer::GenerateRoundCornerBar(std::vector<glm::vec3> &vertices, s
                     glm::normalize(vQuadPoints[2]),
                     glm::normalize(vQuadPoints[3])
                 };
-                for (int i = 0; i < 6; i++)
+                for (int index : iIndices)
                 {
-                    int index = iIndices[i];
                     vertices.push_back(vXZQuadNextPoints[index]);
                     normals.push_back(vXZNextNormals[index]);
                 }
@@ -730,9 +728,8 @@ int OpenGL3DRenderer::GenerateRoundCornerBar(std::vector<glm::vec3> &vertices, s
                     glm::normalize(vQuadPoints[2]),
                     glm::normalize(vQuadPoints[2])
                 };
-                for (int i = 0; i < 6; i++)
+                for (int index : iIndices)
                 {
-                    int index = iIndices[i];
                     vertices.push_back(vYQuadNextPoints[index]);
                     normals.push_back(vYNextNormals[index]);
                 }
@@ -762,9 +759,8 @@ int OpenGL3DRenderer::GenerateRoundCornerBar(std::vector<glm::vec3> &vertices, s
         glm::vec3(xOffset[3], height / 2, zOffset[3])
     };
     glm::vec3 vTopNormal = glm::vec3(0.0f, 1.0f, 0.0f);
-    for (int i = 0; i < 6; i++)
+    for (int index : iIndices)
     {
-        int index = iIndices[i];
         vertices.push_back(vTopPoints[index]);
         normals.push_back(vTopNormal);
     }
@@ -778,9 +774,8 @@ int OpenGL3DRenderer::GenerateRoundCornerBar(std::vector<glm::vec3> &vertices, s
         glm::vec3(xOffset[0], -height / 2, zOffset[0])
     };
     glm::vec3 vBottomNormal = glm::vec3(0.0f, -1.0f, 0.0f);
-    for (int i = 0; i < 6; i++)
+    for (int index : iIndices)
     {
-        int index = iIndices[i];
         vertices.push_back(vBottomPoints[index]);
         normals.push_back(vBottomNormal);
     }
@@ -794,9 +789,8 @@ int OpenGL3DRenderer::GenerateRoundCornerBar(std::vector<glm::vec3> &vertices, s
         glm::vec3(-width / 2, yOffset[0], zOffset[3])
     };
     glm::vec3 vLeftNormal = glm::vec3(-1.0f, 0.0f, 0.0f);
-    for (int i = 0; i < 6; i++)
+    for (int index : iIndices)
     {
-        int index = iIndices[i];
         vertices.push_back(vLeftPoints[index]);
         normals.push_back(vLeftNormal);
     }
@@ -809,9 +803,8 @@ int OpenGL3DRenderer::GenerateRoundCornerBar(std::vector<glm::vec3> &vertices, s
         glm::vec3(width / 2, yOffset[0], zOffset[0])
     };
     glm::vec3 vRightNormal = glm::vec3(1.0f, 0.0f, 0.0f);
-    for (int i = 0; i < 6; i++)
+    for (int index : iIndices)
     {
-        int index = iIndices[i];
         vertices.push_back(vRightPoints[index]);
         normals.push_back(vRightNormal);
     }
@@ -825,9 +818,8 @@ int OpenGL3DRenderer::GenerateRoundCornerBar(std::vector<glm::vec3> &vertices, s
         glm::vec3(xOffset[3], yOffset[1], depth / 2)
     };
     glm::vec3 vFrontNormal = glm::vec3(0.0f, 0.0f, 1.0f);
-    for (int i = 0; i < 6; i++)
+    for (int index : iIndices)
     {
-        int index = iIndices[i];
         vertices.push_back(vFrontPoints[index]);
         normals.push_back(vFrontNormal);
     }
@@ -840,9 +832,8 @@ int OpenGL3DRenderer::GenerateRoundCornerBar(std::vector<glm::vec3> &vertices, s
         glm::vec3(xOffset[3], yOffset[0], -depth / 2)
     };
     glm::vec3 vBackNormal = glm::vec3(0.0f, 0.0f, -1.0f);
-    for (int i = 0; i < 6; i++)
+    for (int index : iIndices)
     {
-        int index = iIndices[i];
         vertices.push_back(vBackPoints[index]);
         normals.push_back(vBackNormal);
     }
@@ -1066,9 +1057,8 @@ struct DeletePointer
 
 void OpenGL3DRenderer::ReleasePolygonShapes()
 {
-    for (size_t i = 0; i < m_Polygon3DInfoList.size(); i++)
+    for (Polygon3DInfo & polygon : m_Polygon3DInfoList)
     {
-        Polygon3DInfo &polygon = m_Polygon3DInfoList[i];
         std::for_each(polygon.verticesList.begin(),
                 polygon.verticesList.end(), DeletePointer<Vertices3D>());
         std::for_each(polygon.normalsList.begin(),
@@ -1083,9 +1073,8 @@ void OpenGL3DRenderer::RenderPolygon3DObject()
 {
     glDepthMask(GL_FALSE);
     CHECK_GL_ERROR();
-    for (size_t i = 0; i < m_Polygon3DInfoList.size(); i++)
+    for (Polygon3DInfo & polygon : m_Polygon3DInfoList)
     {
-        Polygon3DInfo &polygon = m_Polygon3DInfoList[i];
         if (polygon.lineOnly || (!polygon.fillStyle))
         {
             //just use the common shader is ok for lines
@@ -1908,9 +1897,9 @@ void OpenGL3DRenderer::ReleaseTextShapes()
 
 void OpenGL3DRenderer::ReleaseTextTexture()
 {
-    for (size_t i = 0; i < m_Texturelist.size(); i++)
+    for (unsigned int & i : m_Texturelist)
     {
-        glDeleteTextures(1, &m_Texturelist[i]);
+        glDeleteTextures(1, &i);
     }
     m_Texturelist.clear();
 }
@@ -1922,9 +1911,9 @@ void OpenGL3DRenderer::ReleaseScreenTextShapes()
 
 void OpenGL3DRenderer::ReleaseScreenTextTexture()
 {
-    for (size_t i = 0; i < m_ScreenTexturelist.size(); i++)
+    for (unsigned int & i : m_ScreenTexturelist)
     {
-        glDeleteTextures(1, &m_ScreenTexturelist[i]);
+        glDeleteTextures(1, &i);
     }
     m_ScreenTexturelist.clear();
 }
@@ -1936,9 +1925,8 @@ void OpenGL3DRenderer::RenderScreenTextShape()
         return;
     glUseProgram(maResources.m_ScreenTextProID);
     CHECK_GL_ERROR();
-    for (size_t i = 0; i < m_ScreenTextInfoList.size(); i++)
+    for (TextInfo & textInfo : m_ScreenTextInfoList)
     {
-        TextInfo textInfo = m_ScreenTextInfoList[i];
         //calc the position and check whether it can be displayed
         if (textInfo.uniqueId)
         {
@@ -2009,9 +1997,9 @@ void OpenGL3DRenderer::RenderScreenTextShape()
 }
 void OpenGL3DRenderer::ReleaseTextShapesBatch()
 {
-    for (size_t i = 0; i < m_TextInfoBatch.texture.size(); i++)
+    for (TextureArrayInfo & i : m_TextInfoBatch.texture)
     {
-        m_TextInfoBatch.texture[i].subTextureNum = 0;
+        i.subTextureNum = 0;
     }
     m_TextInfoBatch.vertexList.clear();
     m_TextInfoBatch.textureCoordList.clear();
@@ -2075,9 +2063,8 @@ void OpenGL3DRenderer::RenderTextShapeBatch()
 void OpenGL3DRenderer::RenderTextShape()
 {
     CHECK_GL_ERROR();
-    for (size_t i = 0; i < m_TextInfoList.size(); i++)
+    for (TextInfo & textInfo : m_TextInfoList)
     {
-        TextInfo &textInfo = m_TextInfoList[i];
         PosVecf3 trans = {0, 0, 0};
         PosVecf3 angle = {0.0f, 0.0f, 0.0f};
         PosVecf3 scale = {1.0, 1.0, 1.0f};
@@ -2265,12 +2252,12 @@ sal_uInt32 OpenGL3DRenderer::GetPixelColorFromPoint(long nX, long nY)
 
 void OpenGL3DRenderer::ReleaseBatchBarInfo()
 {
-    for (int i = 0; i < 3; i++)
+    for (BatchBarInfo & i : m_BarSurface)
     {
-        m_BarSurface[i].modelMatrixList.clear();
-        m_BarSurface[i].normalMatrixList.clear();
-        m_BarSurface[i].colorList.clear();
-        m_BarSurface[i].mapId2Color.clear();
+        i.modelMatrixList.clear();
+        i.normalMatrixList.clear();
+        i.colorList.clear();
+        i.mapId2Color.clear();
     }
 }
 
@@ -2363,9 +2350,8 @@ void OpenGL3DRenderer::GetBatchTopAndFlatInfo(const Extrude3DInfo &extrude3D)
 
 void OpenGL3DRenderer::GetBatchBarsInfo()
 {
-    for (size_t i = 0; i < m_Extrude3DList.size(); i++)
+    for (Extrude3DInfo & extrude3DInfo : m_Extrude3DList)
     {
-        Extrude3DInfo &extrude3DInfo = m_Extrude3DList[i];
         if (m_Extrude3DInfo.rounded)
         {
             GetBatchTopAndFlatInfo(extrude3DInfo);
@@ -2412,18 +2398,18 @@ void OpenGL3DRenderer::StartClick(sal_uInt32 &selectID)
 {
     m_bHighLighting = true;
     m_uiSelectID = selectID;
-    for (unsigned int i = 0; i < 3; i++)
+    for (BatchBarInfo & i : m_BarSurface)
     {
-        SetHighLightBar(m_BarSurface[i]);
+        SetHighLightBar(i);
     }
 }
 
 void OpenGL3DRenderer::EndClick()
 {
     m_bHighLighting = false;
-    for (unsigned int i = 0; i < 3; i++)
+    for (BatchBarInfo & i : m_BarSurface)
     {
-        DisableHighLightBar(m_BarSurface[i]);
+        DisableHighLightBar(i);
     }
 }
 
@@ -2501,9 +2487,9 @@ void OpenGL3DRenderer::RenderBatchBars(bool bNewScene)
         GetBatchBarsInfo();
         if (m_bHighLighting)
         {
-            for (unsigned int i = 0; i < 3; i++)
+            for (BatchBarInfo & i : m_BarSurface)
             {
-                SetHighLightBar(m_BarSurface[i]);
+                SetHighLightBar(i);
             }
         }
     }
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 03eb7f0..83c6f51 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -329,9 +329,9 @@ OpenGLRender::OpenGLRender()
     , m_SymbolShapeID(0)
 {
     //TODO: moggi: use STL
-    for (size_t i = 0; i < SAL_N_ELEMENTS(m_BackgroundColor); i++)
+    for (float & i : m_BackgroundColor)
     {
-        m_BackgroundColor[i] = 1.0;
+        i = 1.0;
     }
 }
 
diff --git a/comphelper/source/misc/threadpool.cxx b/comphelper/source/misc/threadpool.cxx
index 9837ea6..ddc1502 100644
--- a/comphelper/source/misc/threadpool.cxx
+++ b/comphelper/source/misc/threadpool.cxx
@@ -102,8 +102,8 @@ ThreadPool::ThreadPool( sal_Int32 nWorkers ) :
     maTasksComplete.set();
 
     osl::MutexGuard aGuard( maGuard );
-    for( size_t i = 0; i < maWorkers.size(); i++ )
-        maWorkers[ i ]->launch();
+    for(rtl::Reference<ThreadWorker> & maWorker : maWorkers)
+        maWorker->launch();
 }
 
 ThreadPool::~ThreadPool()
@@ -154,8 +154,8 @@ void ThreadPool::pushTask( ThreadTask *pTask )
     maTasks.insert( maTasks.begin(), pTask );
 
     // horrible beyond belief:
-    for( size_t i = 0; i < maWorkers.size(); i++ )
-        maWorkers[ i ]->signalNewWork();
+    for(rtl::Reference<ThreadWorker> & maWorker : maWorkers)
+        maWorker->signalNewWork();
     maTasksComplete.reset();
 }
 
diff --git a/configmgr/source/access.cxx b/configmgr/source/access.cxx
index 3506beb..8742dcf 100644
--- a/configmgr/source/access.cxx
+++ b/configmgr/source/access.cxx
@@ -1689,18 +1689,16 @@ void Access::initBroadcasterAndChanges(
     assert(broadcaster != nullptr);
     std::vector< css::beans::PropertyChangeEvent > propChanges;
     bool collectPropChanges = !propertiesChangeListeners_.empty();
-    for (Modifications::Node::Children::const_iterator i(
-             modifications.children.begin());
-         i != modifications.children.end(); ++i)
+    for (const auto & i : modifications.children)
     {
-        rtl::Reference< ChildAccess > child(getChild(i->first));
+        rtl::Reference< ChildAccess > child(getChild(i.first));
         if (child.is()) {
             switch (child->getNode()->kind()) {
             case Node::KIND_LOCALIZED_PROPERTY:
-                if (!i->second.children.empty()) {
+                if (!i.second.children.empty()) {
                     if (Components::allLocales(getRootAccess()->getLocale())) {
                         child->initBroadcasterAndChanges(
-                            i->second, broadcaster, allChanges);
+                            i.second, broadcaster, allChanges);
                             //TODO: if allChanges==0, recurse only into children
                             // w/ listeners
                     } else {
@@ -1716,12 +1714,12 @@ void Access::initBroadcasterAndChanges(
                                     css::container::ContainerEvent(
                                         static_cast< cppu::OWeakObject * >(
                                             this),
-                                        css::uno::makeAny(i->first),
+                                        css::uno::makeAny(i.first),
                                         css::uno::Any(), css::uno::Any()));
                                 //TODO: non-void Element, ReplacedElement
                         }
                         PropertyChangeListeners::iterator j(
-                            propertyChangeListeners_.find(i->first));
+                            propertyChangeListeners_.find(i.first));
                         if (j != propertyChangeListeners_.end()) {
                             for (PropertyChangeListenersElement::iterator k(
                                      j->second.begin());
@@ -1732,7 +1730,7 @@ void Access::initBroadcasterAndChanges(
                                     css::beans::PropertyChangeEvent(
                                         static_cast< cppu::OWeakObject * >(
                                             this),
-                                        i->first, false, -1, css::uno::Any(),
+                                        i.first, false, -1, css::uno::Any(),
                                         css::uno::Any()));
                             }
                         }
@@ -1747,7 +1745,7 @@ void Access::initBroadcasterAndChanges(
                                     css::beans::PropertyChangeEvent(
                                         static_cast< cppu::OWeakObject * >(
                                             this),
-                                        i->first, false, -1, css::uno::Any(),
+                                        i.first, false, -1, css::uno::Any(),
                                         css::uno::Any()));
                             }
                         }
@@ -1763,7 +1761,7 @@ void Access::initBroadcasterAndChanges(
                             propChanges.push_back(
                                 css::beans::PropertyChangeEvent(
                                     static_cast< cppu::OWeakObject * >(this),
-                                    i->first, false, -1, css::uno::Any(),
+                                    i.first, false, -1, css::uno::Any(),
                                     css::uno::Any()));
                         }
                     }
@@ -1780,7 +1778,7 @@ void Access::initBroadcasterAndChanges(
                         *j,
                         css::container::ContainerEvent(
                             static_cast< cppu::OWeakObject * >(this),
-                            css::uno::makeAny(i->first), child->asValue(),
+                            css::uno::makeAny(i.first), child->asValue(),
                             css::uno::Any()));
                         //TODO: distinguish add/modify; non-void ReplacedElement
                 }
@@ -1804,13 +1802,13 @@ void Access::initBroadcasterAndChanges(
                             *j,
                             css::container::ContainerEvent(
                                 static_cast< cppu::OWeakObject * >(this),
-                                css::uno::makeAny(i->first), child->asValue(),
+                                css::uno::makeAny(i.first), child->asValue(),
                                 css::uno::Any()));
                             //TODO: distinguish add/remove/modify; non-void
                             // ReplacedElement
                     }
                     PropertyChangeListeners::iterator j(
-                        propertyChangeListeners_.find(i->first));
+                        propertyChangeListeners_.find(i.first));
                     if (j != propertyChangeListeners_.end()) {
                         for (PropertyChangeListenersElement::iterator k(
                                  j->second.begin());
@@ -1820,7 +1818,7 @@ void Access::initBroadcasterAndChanges(
                                 *k,
                                 css::beans::PropertyChangeEvent(
                                     static_cast< cppu::OWeakObject * >(this),
-                                    i->first, false, -1, css::uno::Any(),
+                                    i.first, false, -1, css::uno::Any(),
                                     css::uno::Any()));
                         }
                     }
@@ -1834,7 +1832,7 @@ void Access::initBroadcasterAndChanges(
                                 *k,
                                 css::beans::PropertyChangeEvent(
                                     static_cast< cppu::OWeakObject * >(this),
-                                    i->first, false, -1, css::uno::Any(),
+                                    i.first, false, -1, css::uno::Any(),
                                     css::uno::Any()));
                         }
                     }
@@ -1850,14 +1848,14 @@ void Access::initBroadcasterAndChanges(
                         propChanges.push_back(
                             css::beans::PropertyChangeEvent(
                                 static_cast< cppu::OWeakObject * >(this),
-                                i->first, false, -1, css::uno::Any(),
+                                i.first, false, -1, css::uno::Any(),
                                 css::uno::Any()));
                     }
                 }
                 break;
             case Node::KIND_GROUP:
             case Node::KIND_SET:
-                if (i->second.children.empty()) {
+                if (i.second.children.empty()) {
                     if (!child->getNode()->getTemplateName().isEmpty()) {
                         for (ContainerListeners::iterator j(
                                  containerListeners_.begin());
@@ -1869,7 +1867,7 @@ void Access::initBroadcasterAndChanges(
                                     css::container::ContainerEvent(
                                         static_cast< cppu::OWeakObject * >(
                                             this),
-                                        css::uno::makeAny(i->first),
+                                        css::uno::makeAny(i.first),
                                         child->asValue(), css::uno::Any()));
                         }
                         if (allChanges != nullptr) {
@@ -1885,7 +1883,7 @@ void Access::initBroadcasterAndChanges(
                     // change
                 } else {
                     child->initBroadcasterAndChanges(
-                        i->second, broadcaster, allChanges);
+                        i.second, broadcaster, allChanges);
                         //TODO: if allChanges==0, recurse only into children w/
                         // listeners
                 }
@@ -1907,7 +1905,7 @@ void Access::initBroadcasterAndChanges(
                         *j,
                         css::container::ContainerEvent(
                             static_cast< cppu::OWeakObject * >(this),
-                            css::uno::makeAny(i->first), css::uno::Any(),
+                            css::uno::makeAny(i.first), css::uno::Any(),
                             css::uno::Any()));
                         //TODO: non-void ReplacedElement
                 }
@@ -1916,7 +1914,7 @@ void Access::initBroadcasterAndChanges(
                     if (!path.isEmpty()) {
                         path.append('/');
                     }
-                    path.append(Data::createSegment("*", i->first));
+                    path.append(Data::createSegment("*", i.first));
                     allChanges->push_back(
                         css::util::ElementChange(
                             css::uno::makeAny(path.makeStringAndClear()),
@@ -1936,12 +1934,12 @@ void Access::initBroadcasterAndChanges(
                             *j,
                             css::container::ContainerEvent(
                                 static_cast< cppu::OWeakObject * >(this),
-                                css::uno::makeAny(i->first), css::uno::Any(),
+                                css::uno::makeAny(i.first), css::uno::Any(),
                                 css::uno::Any()));
                             //TODO: non-void ReplacedElement
                     }
                     PropertyChangeListeners::iterator j(
-                        propertyChangeListeners_.find(i->first));
+                        propertyChangeListeners_.find(i.first));
                     if (j != propertyChangeListeners_.end()) {
                         for (PropertyChangeListenersElement::iterator k(
                                  j->second.begin());
@@ -1951,7 +1949,7 @@ void Access::initBroadcasterAndChanges(
                                 *k,
                                 css::beans::PropertyChangeEvent(
                                     static_cast< cppu::OWeakObject * >(this),
-                                    i->first, false, -1, css::uno::Any(),
+                                    i.first, false, -1, css::uno::Any(),
                                     css::uno::Any()));
                         }
                     }
@@ -1965,7 +1963,7 @@ void Access::initBroadcasterAndChanges(
                                 *k,
                                 css::beans::PropertyChangeEvent(
                                     static_cast< cppu::OWeakObject * >(this),
-                                    i->first, false, -1, css::uno::Any(),
+                                    i.first, false, -1, css::uno::Any(),
                                     css::uno::Any()));
                         }
                     }
@@ -1975,7 +1973,7 @@ void Access::initBroadcasterAndChanges(
                         if (!path.isEmpty()) {
                             path.append('/');
                         }
-                        path.append(i->first);
+                        path.append(i.first);
                         allChanges->push_back(
                             css::util::ElementChange(
                                 css::uno::makeAny(path.makeStringAndClear()),
@@ -1986,14 +1984,14 @@ void Access::initBroadcasterAndChanges(
                         propChanges.push_back(
                             css::beans::PropertyChangeEvent(
                                 static_cast< cppu::OWeakObject * >(this),
-                                i->first, false, -1, css::uno::Any(),
+                                i.first, false, -1, css::uno::Any(),
                                 css::uno::Any()));
                     }
                 }
                 break;
             case Node::KIND_SET:
                 // Removed set member:
-                if (i->second.children.empty()) {
+                if (i.second.children.empty()) {
                     for (ContainerListeners::iterator j(
                              containerListeners_.begin());
                          j != containerListeners_.end(); ++j)
@@ -2002,7 +2000,7 @@ void Access::initBroadcasterAndChanges(
                             *j,
                             css::container::ContainerEvent(
                                 static_cast< cppu::OWeakObject * >(this),
-                                css::uno::makeAny(i->first),
+                                css::uno::makeAny(i.first),
                                 css::uno::Any(), css::uno::Any()));
                             //TODO: non-void ReplacedElement
                     }
@@ -2012,7 +2010,7 @@ void Access::initBroadcasterAndChanges(
                         if (!path.isEmpty()) {
                             path.append('/');
                         }
-                        path.append(Data::createSegment("*", i->first));
+                        path.append(Data::createSegment("*", i.first));
                         allChanges->push_back(
                             css::util::ElementChange(
                                 css::uno::makeAny(path.makeStringAndClear()),
diff --git a/configmgr/source/writemodfile.cxx b/configmgr/source/writemodfile.cxx
index d04818e..1d20c18 100644
--- a/configmgr/source/writemodfile.cxx
+++ b/configmgr/source/writemodfile.cxx
@@ -459,13 +459,11 @@ void writeModifications(
         OUString pathRep(
             parentPathRepresentation + "/" +
             Data::createSegment(node->getTemplateName(), nodeName));
-        for (Modifications::Node::Children::const_iterator i(
-                 modifications.children.begin());
-             i != modifications.children.end(); ++i)
+        for (const auto & i : modifications.children)
         {
             writeModifications(
-                components, handle, pathRep, node, i->first,
-                node->getMember(i->first), i->second);
+                components, handle, pathRep, node, i.first,
+                node->getMember(i.first), i.second);
         }
     }
 }
diff --git a/connectivity/source/drivers/mork/MDatabaseMetaData.cxx b/connectivity/source/drivers/mork/MDatabaseMetaData.cxx
index 26b103c..db1b65a 100644
--- a/connectivity/source/drivers/mork/MDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/mork/MDatabaseMetaData.cxx
@@ -109,14 +109,14 @@ ODatabaseMetaDataResultSet::ORows& SAL_CALL ODatabaseMetaData::getColumnRows(
     aRow[18] = new ORowSetValueDecorator(OUString("YES"));
 
     // Iterate over all tables
-    for(size_t j = 0; j < tables.size(); j++ ) {
-        if(match(tableNamePattern, tables[j],'\0')) {
+    for(OUString & table : tables) {
+        if(match(tableNamePattern, table,'\0')) {
             // TABLE_NAME
-            aRow[3] = new ORowSetValueDecorator( tables[j] );
+            aRow[3] = new ORowSetValueDecorator( table );
 
             const OColumnAlias& colNames = m_pConnection->getColumnAlias();
 
-            SAL_INFO("connectivity.mork", "\tTableName = : " << tables[j]);
+            SAL_INFO("connectivity.mork", "\tTableName = : " << table);
             // Iterate over all collumns in the table.
             for (   OColumnAlias::AliasMap::const_iterator compare = colNames.begin();
                     compare != colNames.end();
@@ -853,13 +853,12 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes(  ) throw(SQLE
     Reference< XResultSet > xRef = pResult;
 
     // here we fill the rows which should be visible when ask for data from the resultset returned here
-    const sal_Int32  nSize = sizeof(sTableTypes) / sizeof(OUString);
     ODatabaseMetaDataResultSet::ORows aRows;
-    for(sal_Int32 i=0;i < nSize;++i)
+    for(const auto & sTableType : sTableTypes)
     {
         ODatabaseMetaDataResultSet::ORow aRow;
         aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
-        aRow.push_back(new ORowSetValueDecorator(sTableTypes[i]));
+        aRow.push_back(new ORowSetValueDecorator(sTableType));
         // bound row
         aRows.push_back(aRow);
     }
@@ -975,13 +974,13 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
 
 
     // Iterate over all tables
-    for(size_t j = 0; j < tables.size(); j++ ) {
-       if(match(tableNamePattern, tables[j],'\0'))
+    for(OUString & table : tables) {
+       if(match(tableNamePattern, table,'\0'))
            {
             // TABLE_NAME
-            aRow[2] = new ORowSetValueDecorator( tables[j] );
+            aRow[2] = new ORowSetValueDecorator( table );
 
-            SAL_INFO("connectivity.mork", "\tTableName = : " << tables[j]);
+            SAL_INFO("connectivity.mork", "\tTableName = : " << table);
 
                 aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getSelectValue();
                 aRows.push_back(aRow);
diff --git a/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.cxx b/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.cxx
index 86e4f65..3ffb800 100644
--- a/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.cxx
+++ b/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.cxx
@@ -96,10 +96,9 @@ bool MDatabaseMetaDataHelper::getTables( OConnection* _pCon,
     if ( !getTableStrings( _pCon, tables ) )
         return false;
 
-    for ( size_t i = 0; i < tables.size(); i++ ) {
+    for (OUString& aTableName : tables) {
         ODatabaseMetaDataResultSet::ORow aRow { nullptr, nullptr, nullptr };
 
-        OUString aTableName  = tables[i];
         SAL_INFO("connectivity.mork", "TableName: " << aTableName );
 
 
diff --git a/connectivity/source/drivers/mork/MResultSet.cxx b/connectivity/source/drivers/mork/MResultSet.cxx
index e84eacd..10b2be9 100644
--- a/connectivity/source/drivers/mork/MResultSet.cxx
+++ b/connectivity/source/drivers/mork/MResultSet.cxx
@@ -1248,12 +1248,12 @@ void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLExcep
                 {
                     OValueRow aSearchRow = new OValueVector( m_aRow->get().size() );
 
-                    for( OKeySet::Vector::size_type i = 0; i < m_pKeySet->get().size(); i++ )
+                    for(sal_Int32 i : m_pKeySet->get())
                     {
-                        fetchRow( (m_pKeySet->get())[i] );        // Fills m_aRow
+                        fetchRow( i );        // Fills m_aRow
                         if ( matchRow( m_aRow, aSearchRow ) )
                         {
-                            (m_pKeySet->get())[i] = 0;   // Marker for later to be removed
+                            i = 0;   // Marker for later to be removed
                         }
                         else
                         {
diff --git a/connectivity/source/drivers/postgresql/pq_connection.cxx b/connectivity/source/drivers/postgresql/pq_connection.cxx
index 8d1d3b2..ebe1aaa 100644
--- a/connectivity/source/drivers/postgresql/pq_connection.cxx
+++ b/connectivity/source/drivers/postgresql/pq_connection.cxx
@@ -465,11 +465,11 @@ static void properties2arrays( const Sequence< PropertyValue > & args,
     for( int i = 0; i < args.getLength() ; ++i )
     {
         bool append = false;
-        for( size_t j = 0; j < SAL_N_ELEMENTS( keyword_list ); j++)
+        for(const char* j : keyword_list)
         {
-            if( args[i].Name.equalsIgnoreAsciiCaseAscii( keyword_list[j] ))
+            if( args[i].Name.equalsIgnoreAsciiCaseAscii( j ))
             {
-                keywords.push_back( keyword_list[j], SAL_NO_ACQUIRE );
+                keywords.push_back( j, SAL_NO_ACQUIRE );
                 append = true;
                 break;
             }
diff --git a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
index fe2c200..15c9b1e 100644
--- a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
+++ b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
@@ -180,9 +180,8 @@ PreparedStatement::PreparedStatement(
 
     splitSQL( m_stmt, m_splittedStatement );
     int elements = 0;
-    for( int i = 0, max = m_splittedStatement.size(); i < max ; i ++ )
+    for(OString & str : m_splittedStatement)
     {
-        const OString &str = m_splittedStatement[i];
         // ignore quoted strings ....
         if( ! isQuoted( str ) )
         {
@@ -329,13 +328,13 @@ sal_Bool PreparedStatement::execute( )
     OStringBuffer buf( m_stmt.getLength() *2 );
 
     OStringVector::size_type vars = 0;
-    for( OStringVector::size_type i = 0 ; i < m_splittedStatement.size() ; ++i )
+    for(OString & str : m_splittedStatement)
     {
         // LEM TODO: instead of this manual mucking with SQL
         // could we use PQexecParams / PQExecPrepared / ...?
         // Only snafu is giving the types of the parameters and
         // that it needs $1, $2, etc instead of "?"
-        const OString &str = m_splittedStatement[i];
+
 //         printf( "Splitted %d %s\n" , i , str.getStr() );
         if( isQuoted( str ) )
         {
diff --git a/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx b/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx
index ab2b83b..5934f94 100644
--- a/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx
+++ b/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx
@@ -226,14 +226,14 @@ void UpdateableResultSet::insertRow(  ) throw (SQLException, RuntimeException, s
     buf.append( " ) VALUES ( " );
 
     columns = 0;
-    for( UpdateableFieldVector::size_type i = 0 ; i < m_updateableField.size() ; i ++ )
+    for(UpdateableField & i : m_updateableField)
     {
-        if( m_updateableField[i].isTouched )
+        if( i.isTouched )
         {
             if( columns > 0 )
                 buf.append( " , " );
             columns ++;
-            bufferQuoteAnyConstant( buf, m_updateableField[i].value, *m_ppSettings );
+            bufferQuoteAnyConstant( buf, i.value, *m_ppSettings );
 
 //             OUString val;
 //             m_updateableField[i].value >>= val;
diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx
index 72862fd..61d4b5f 100644
--- a/connectivity/source/parse/sqlnode.cxx
+++ b/connectivity/source/parse/sqlnode.cxx
@@ -1444,14 +1444,14 @@ OSQLParser::OSQLParser(const ::com::sun::star::uno::Reference< ::com::sun::star:
         // +1 for UNKNOWN_RULE
         static_assert(nRuleMapCount + 1 == static_cast<size_t>(OSQLParseNode::rule_count), "must be equal");
 
-        for ( size_t mapEntry = 0; mapEntry < nRuleMapCount; ++mapEntry )
+        for (const auto & aRuleDescription : aRuleDescriptions)
         {
             // look up the rule description in the our identifier map
-            sal_uInt32 nParserRuleID = StrToRuleID( aRuleDescriptions[ mapEntry ].sRuleName );
+            sal_uInt32 nParserRuleID = StrToRuleID( aRuleDescription.sRuleName );
             // map the parser's rule ID to the OSQLParseNode::Rule
-            s_aReverseRuleIDLookup[ nParserRuleID ] = aRuleDescriptions[ mapEntry ].eRule;
+            s_aReverseRuleIDLookup[ nParserRuleID ] = aRuleDescription.eRule;
             // and map the OSQLParseNode::Rule to the parser's rule ID
-            s_nRuleIDs[ aRuleDescriptions[ mapEntry ].eRule ] = nParserRuleID;
+            s_nRuleIDs[ aRuleDescription.eRule ] = nParserRuleID;
         }
     }
     ++s_nRefCount;
diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx
index 8d2b32d..3368e74 100644
--- a/cppcanvas/source/mtfrenderer/implrenderer.cxx
+++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx
@@ -2998,8 +2998,8 @@ namespace cppcanvas
         ImplRenderer::~ImplRenderer()
         {
             // don't leak EMFPObjects
-            for(unsigned int i=0; i<SAL_N_ELEMENTS(aObjects); ++i)
-                delete aObjects[i];
+            for(EMFPObject* aObject : aObjects)
+                delete aObject;
         }
 
         bool ImplRenderer::drawSubset( sal_Int32    nStartIndex,
diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx
index b847a86..978f463 100644
--- a/cppu/source/uno/lbenv.cxx
+++ b/cppu/source/uno/lbenv.cxx
@@ -819,8 +819,8 @@ namespace
             sal_uInt8 ar[16];
             ::rtl_getGlobalProcessId( ar );
             aRet.append( ';' );
-            for ( sal_Int32 i = 0; i < 16; ++i )
-                aRet.append( (sal_Int32)ar[i], 16 );
+            for (unsigned char i : ar)
+                aRet.append( (sal_Int32)i, 16 );
 
             m_sOidPart = aRet.makeStringAndClear();
         }
diff --git a/cppuhelper/source/bootstrap.cxx b/cppuhelper/source/bootstrap.cxx
index fe98cfc..ebc913e 100644
--- a/cppuhelper/source/bootstrap.cxx
+++ b/cppuhelper/source/bootstrap.cxx
@@ -144,8 +144,8 @@ Reference< XComponentContext > SAL_CALL bootstrap()
             throw BootstrapException( "random pool error!" );
         rtl_random_destroyPool( hPool );
         ::rtl::OUStringBuffer buf("uno");
-        for ( sal_uInt32 i = 0; i < ARLEN( bytes ); ++i )
-            buf.append( static_cast< sal_Int32 >( bytes[ i ] ) );
+        for (unsigned char byte : bytes)
+            buf.append( static_cast< sal_Int32 >( byte ) );
         OUString sPipeName( buf.makeStringAndClear() );
 
         // arguments
diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx
index a885da1..758975b 100644
--- a/cui/source/customize/acccfg.cxx
+++ b/cui/source/customize/acccfg.cxx
@@ -803,9 +803,9 @@ SfxAcceleratorConfigPage::SfxAcceleratorConfigPage( vcl::Window* pParent, const
 
     // detect max keyname width
     long nMaxWidth  = 0;
-    for ( sal_uInt16 i = 0; i < KEYCODE_ARRAY_SIZE; ++i )
+    for (unsigned short i : KEYCODE_ARRAY)
     {
-        long nTmp = GetTextWidth( vcl::KeyCode( KEYCODE_ARRAY[i] ).GetName() );
+        long nTmp = GetTextWidth( vcl::KeyCode( i ).GetName() );
         if ( nTmp > nMaxWidth )
             nMaxWidth = nTmp;
     }
diff --git a/cui/source/dialogs/cuifmsearch.cxx b/cui/source/dialogs/cuifmsearch.cxx
index 17d6da8..e7d30c6 100644
--- a/cui/source/dialogs/cuifmsearch.cxx
+++ b/cui/source/dialogs/cuifmsearch.cxx
@@ -120,8 +120,8 @@ FmSearchDialog::FmSearchDialog(vcl::Window* pParent, const OUString& sInitialTex
     DBG_ASSERT(comphelper::string::getTokenCount(fmscInitial.strUsedFields, ';') == (sal_Int32)fmscInitial.arrFields.size(),
         "FmSearchDialog::FmSearchDialog : invalid data supplied by ContextSupplied !");
 #if (OSL_DEBUG_LEVEL > 1) || defined DBG_UTIL
-    for (sal_Int32 i=0; i<(sal_Int32)fmscInitial.arrFields.size(); ++i)
-        DBG_ASSERT(fmscInitial.arrFields.at(i).is(), "FmSearchDialog::FmSearchDialog : invalid data supplied by ContextSupplier !");
+    for (Reference<XInterface> & arrField : fmscInitial.arrFields)
+        DBG_ASSERT(arrField.is(), "FmSearchDialog::FmSearchDialog : invalid data supplied by ContextSupplier !");
 #endif // (OSL_DEBUG_LEVEL > 1) || DBG_UTIL
 
     for (   ::std::vector< OUString >::const_iterator context = _rContexts.begin();
@@ -245,8 +245,8 @@ void FmSearchDialog::Init(const OUString& strVisibleFields, const OUString& sIni
         RID_STR_SEARCH_END,
         RID_STR_SEARCH_WHOLE
     };
-    for ( size_t i=0; i<SAL_N_ELEMENTS(nResIds); ++i )
-        m_plbPosition->InsertEntry( OUString( CUI_RES( nResIds[i] ) ) );
+    for (unsigned short nResId : nResIds)
+        m_plbPosition->InsertEntry( OUString( CUI_RES( nResId ) ) );
     m_plbPosition->SelectEntryPos(MATCHING_ANYWHERE);
 
     // the field listbox
@@ -446,14 +446,14 @@ IMPL_LINK_TYPED(FmSearchDialog, OnCheckBoxToggled, CheckBox&, rBox, void)
     else if ((&rBox == m_pcbApprox) || (&rBox == m_pcbRegular) || (&rBox == m_pcbWildCard))
     {
         CheckBox* pBoxes[] = { m_pcbWildCard, m_pcbRegular, m_pcbApprox };
-        for (sal_uInt32 i=0; i< SAL_N_ELEMENTS(pBoxes); ++i)
+        for (CheckBox* pBoxe : pBoxes)
         {
-            if (pBoxes[i] != &rBox)
+            if (pBoxe != &rBox)
             {
                 if (bChecked)
-                    pBoxes[i]->Disable();
+                    pBoxe->Disable();
                 else
-                    pBoxes[i]->Enable();
+                    pBoxe->Enable();
             }
         }
 
@@ -659,16 +659,16 @@ void FmSearchDialog::EnableControlPaint(bool bEnable)
         m_pbSearchAgain, m_pbClose };
 
     if (!bEnable)
-        for (sal_uInt32 i=0; i<SAL_N_ELEMENTS(pAffectedControls); ++i)
+        for (Control* pAffectedControl : pAffectedControls)
         {
-            pAffectedControls[i]->SetUpdateMode(bEnable);
-            pAffectedControls[i]->EnablePaint(bEnable);
+            pAffectedControl->SetUpdateMode(bEnable);
+            pAffectedControl->EnablePaint(bEnable);
         }
     else
-        for (sal_uInt32 i=0; i<SAL_N_ELEMENTS(pAffectedControls); ++i)
+        for (Control* pAffectedControl : pAffectedControls)
         {
-            pAffectedControls[i]->EnablePaint(bEnable);
-            pAffectedControls[i]->SetUpdateMode(bEnable);
+            pAffectedControl->EnablePaint(bEnable);
+            pAffectedControl->SetUpdateMode(bEnable);
         }
 }
 
diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx
index 4a10d6f..ca99ba8 100644
--- a/cui/source/dialogs/cuigaldlg.cxx
+++ b/cui/source/dialogs/cuigaldlg.cxx
@@ -800,8 +800,8 @@ void TPGalleryThemeProperties::dispose()
     xMediaPlayer.clear();
     xDialogListener.clear();
 
-    for ( size_t i = 0, n = aFilterEntryList.size(); i < n; ++i ) {
-        delete aFilterEntryList[ i ];
+    for (FilterEntry* i : aFilterEntryList) {
+        delete i;
     }
     aFilterEntryList.clear();
 
@@ -901,17 +901,17 @@ void TPGalleryThemeProperties::FillFilterList()
     ::avmedia::FilterNameVector     aFilters;
     ::avmedia::MediaWindow::getMediaFilters( aFilters );
 
-    for( unsigned long l = 0; l < aFilters.size(); ++l )
+    for(std::pair<OUString,OUString> & aFilter : aFilters)
     {
         for( sal_Int32 nIndex = 0; nIndex >= 0; )
         {
             OUString aFilterWildcard( aWildcard );
 
             pFilterEntry = new FilterEntry;
-            pFilterEntry->aFilterName = aFilters[ l ].second.getToken( 0, ';', nIndex );
+            pFilterEntry->aFilterName = aFilter.second.getToken( 0, ';', nIndex );
             nFirstExtFilterPos = m_pCbbFileType->InsertEntry(
                 addExtension(
-                    aFilters[ l ].first,
+                    aFilter.first,
                     aFilterWildcard += pFilterEntry->aFilterName
                 )
             );
@@ -950,13 +950,13 @@ void TPGalleryThemeProperties::FillFilterList()
     }
 
     // media filters
-    for( unsigned long k = 0; k < aFilters.size(); ++k )
+    for(std::pair<OUString,OUString> & aFilter : aFilters)
     {
         for( sal_Int32 nIndex = 0; nIndex >= 0; )
         {
             if ( !aExtensions.isEmpty() )
                 aExtensions += ";";
-            aExtensions += aWildcard + aFilters[ k ].second.getToken( 0, ';', nIndex );
+            aExtensions += aWildcard + aFilter.second.getToken( 0, ';', nIndex );
         }
      }
 
diff --git a/cui/source/dialogs/cuiimapwnd.cxx b/cui/source/dialogs/cuiimapwnd.cxx
index 98e059a..99c7135 100644
--- a/cui/source/dialogs/cuiimapwnd.cxx
+++ b/cui/source/dialogs/cuiimapwnd.cxx
@@ -64,8 +64,8 @@ URLDlg::URLDlg( vcl::Window* pWindow, const OUString& rURL, const OUString& rAlt
     m_pEdtDescription->SetText( rDescription );
     m_pEdtName->SetText( rName );
 
-    for( size_t i = 0, n = rTargetList.size(); i < n; ++i )
-        m_pCbbTargets->InsertEntry( rTargetList[ i ] );
+    for(OUString & i : rTargetList)
+        m_pCbbTargets->InsertEntry( i );
 
     if( rTarget.isEmpty() )
         m_pCbbTargets->SetText( "_self");
diff --git a/cui/source/dialogs/iconcdlg.cxx b/cui/source/dialogs/iconcdlg.cxx
index 66d042d..1ce8a53 100644
--- a/cui/source/dialogs/iconcdlg.cxx
+++ b/cui/source/dialogs/iconcdlg.cxx
@@ -220,10 +220,8 @@ void IconChoiceDialog::dispose()
     //aTabDlgOpt.SetWindowState(OStringToOUString(GetWindowState((WINDOWSTATE_MASK_X | WINDOWSTATE_MASK_Y | WINDOWSTATE_MASK_STATE | WINDOWSTATE_MASK_MINIMIZED)), RTL_TEXTENCODING_ASCII_US));
     //aTabDlgOpt.SetPageID( mnCurrentPageId );
 
-    for ( size_t i = 0, nCount = maPageList.size(); i < nCount; ++i )
+    for (IconChoicePageData* pData : maPageList)
     {
-        IconChoicePageData* pData = maPageList[ i ];
-
         if ( pData->pPage )
         {
             OUString aPageData(pData->pPage->GetUserData());
@@ -529,9 +527,8 @@ void IconChoiceDialog::DeActivatePageImpl ()
         {
             RefreshInputSet();
             // flag all pages to be newly initialized
-            for ( size_t i = 0, nCount = maPageList.size(); i < nCount; ++i )
+            for (IconChoicePageData* pObj : maPageList)
             {
-                IconChoicePageData* pObj = maPageList[ i ];
                 if ( pObj->pPage.get() != pPage )
                     pObj->bRefresh = true;
                 else
@@ -668,9 +665,8 @@ void IconChoiceDialog::Start()
 bool IconChoiceDialog::QueryClose()
 {
     bool bRet = true;
-    for ( size_t i = 0, nCount = maPageList.size(); i < nCount; ++i )
+    for (IconChoicePageData* pData : maPageList)
     {
-        IconChoicePageData* pData = maPageList[i ];
         if ( pData->pPage && !pData->pPage->QueryClose() )
         {
             bRet = false;
@@ -700,9 +696,8 @@ void IconChoiceDialog::RefreshInputSet()
 IconChoicePageData* IconChoiceDialog::GetPageData ( sal_uInt16 nId )
 {
     IconChoicePageData *pRet = nullptr;
-    for ( size_t i=0; i < maPageList.size(); i++ )
+    for (IconChoicePageData* pData : maPageList)
     {
-        IconChoicePageData* pData = maPageList[ i ];
         if ( pData->nId == nId )
         {
             pRet = pData;
diff --git a/cui/source/dialogs/linkdlg.cxx b/cui/source/dialogs/linkdlg.cxx
index 2403bb9..b5a840f 100644
--- a/cui/source/dialogs/linkdlg.cxx
+++ b/cui/source/dialogs/linkdlg.cxx
@@ -299,8 +299,8 @@ IMPL_LINK_NOARG_TYPED(SvBaseLinksDlg, UpdateNowClickHdl, Button*, void)
             tools::SvRef<SvBaseLink> xLink = aLnkArr[ n ];
 
             // first look for the entry in the array
-            for( size_t i = 0; i < pLinkMgr->GetLinks().size(); ++i )
-                if( xLink == pLinkMgr->GetLinks()[ i ] )
+            for(const auto & i : pLinkMgr->GetLinks())
+                if( xLink == i )
                 {
                     xLink->SetUseCache( false );
                     SetType( *xLink, aPosArr[ n ], xLink->GetUpdateMode() );
@@ -689,9 +689,8 @@ void SvBaseLinksDlg::SetActLink( SvBaseLink * pLink )
     {
         const SvBaseLinks& rLnks = pLinkMgr->GetLinks();
         sal_uLong nSelect = 0;
-        for( size_t n = 0; n < rLnks.size(); ++n )
+        for(const auto & rLinkRef : rLnks)
         {
-            const tools::SvRef<SvBaseLink>& rLinkRef = rLnks[ n ];
             // #109573# only visible links have been inserted into the TreeListBox,
             // invisible ones have to be skipped here
             if( rLinkRef->IsVisible() )
diff --git a/cui/source/dialogs/thesdlg.cxx b/cui/source/dialogs/thesdlg.cxx
index 3e95c31..3c9854f 100644
--- a/cui/source/dialogs/thesdlg.cxx
+++ b/cui/source/dialogs/thesdlg.cxx
@@ -501,8 +501,8 @@ SvxThesaurusDialog::SvxThesaurusDialog(
         aLangVec.push_back( SvtLanguageTable::GetLanguageString( nLang ) );
     }
     std::sort( aLangVec.begin(), aLangVec.end() );
-    for (size_t i = 0;  i < aLangVec.size();  ++i)
-        m_pLangLB->InsertEntry( aLangVec[i] );
+    for (OUString & i : aLangVec)
+        m_pLangLB->InsertEntry( i );
 
     std::vector< OUString >::iterator aI = std::find(aLangVec.begin(), aLangVec.end(),
             SvtLanguageTable::GetLanguageString(nLanguage));
diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx
index 112dbf2..3661856 100644
--- a/cui/source/options/optaboutconfig.cxx
+++ b/cui/source/options/optaboutconfig.cxx
@@ -507,13 +507,13 @@ void CuiAboutConfigTabPage::AddToModifiedVector( const std::shared_ptr< Prop_Imp
 {
     bool isModifiedBefore = false;
     //Check if value modified before
-    for( size_t nInd = 0; nInd < m_vectorOfModified.size() ; ++nInd )
+    for(std::shared_ptr<Prop_Impl> & nInd : m_vectorOfModified)
     {
-        if( rProp->Name == m_vectorOfModified[nInd]->Name && rProp->Property == m_vectorOfModified[nInd]->Property )
+        if( rProp->Name == nInd->Name && rProp->Property == nInd->Property )
         {
             //property modified before. Assign reference to the modified value
             //do your changes on this object. They will be saved later.
-            m_vectorOfModified[nInd] = rProp;
+            nInd = rProp;
             isModifiedBefore = true;
             break;
         }
diff --git a/cui/source/options/optupdt.cxx b/cui/source/options/optupdt.cxx
index 9da2bb42..3623bd6 100644
--- a/cui/source/options/optupdt.cxx
+++ b/cui/source/options/optupdt.cxx
@@ -180,11 +180,11 @@ void SvxOnlineUpdateTabPage::UpdateUserAgent()
         uno::Sequence< beans::StringPair > aHeaders
             = xDav->getUserRequestHeaders( aPseudoURL, ucb::WebDAVHTTPMethod(0) );
 
-        for ( auto i = aHeaders.begin(); i != aHeaders.end(); ++i )
+        for (css::beans::StringPair & aHeader : aHeaders)
         {
-            if ( i->First == "User-Agent" )
+            if ( aHeader.First == "User-Agent" )
             {
-                OUString aText = i->Second;
+                OUString aText = aHeader.Second;
                 aText = aText.replaceAll(";", ";\n");
                 aText = aText.replaceAll("(", "\n(");
                 m_pUserAgentLabel->SetText( aText );
diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx
index 2e990cf..57298ae 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -85,10 +85,10 @@ SelectPersonaDialog::SelectPersonaDialog( vcl::Window *pParent )
     get( m_vResultList[7], "result8" );
     get( m_vResultList[8], "result9" );
 
-    for (sal_Int32 nIndex = 0; nIndex < 9; ++nIndex)
+    for (VclPtr<PushButton> & nIndex : m_vResultList)
     {
-        m_vResultList[nIndex]->SetClickHdl( LINK( this, SelectPersonaDialog, SelectPersona ) );
-        m_vResultList[nIndex]->Disable();
+        nIndex->SetClickHdl( LINK( this, SelectPersonaDialog, SelectPersona ) );
+        nIndex->Disable();
     }
 }
 
@@ -129,11 +129,11 @@ IMPL_LINK_TYPED( SelectPersonaDialog, SearchPersonas, Button*, pButton, void )
         searchTerm = m_pEdit->GetText();
     else
     {
-        for( sal_Int32 nIndex = 0; nIndex < 5; nIndex++ )
+        for(VclPtr<PushButton> & m_vSearchSuggestion : m_vSearchSuggestions)
         {
-            if( pButton == m_vSearchSuggestions[nIndex] )
+            if( pButton == m_vSearchSuggestion )
             {
-                searchTerm = m_vSearchSuggestions[nIndex]->GetDisplayText();
+                searchTerm = m_vSearchSuggestion->GetDisplayText();
                 break;
             }
         }
@@ -235,10 +235,10 @@ void SelectPersonaDialog::ClearSearchResults()
 {
     m_vPersonaSettings.clear();
     m_aSelectedPersona.clear();
-    for( sal_Int32 nIndex = 0; nIndex < 9; nIndex++ )
+    for(VclPtr<PushButton> & nIndex : m_vResultList)
     {
-        m_vResultList[nIndex]->Disable();
-        m_vResultList[nIndex]->SetModeImage(Image());
+        nIndex->Disable();
+        nIndex->SetModeImage(Image());
     }
 }
 
@@ -286,8 +286,8 @@ void SvxPersonalizationTabPage::dispose()
     m_pDefaultPersona.clear();
     m_pOwnPersona.clear();
     m_pSelectPersona.clear();
-    for (int i=0; i<3; ++i)
-        m_vDefaultPersonaImages[i].clear();
+    for (VclPtr<PushButton> & m_vDefaultPersonaImage : m_vDefaultPersonaImages)
+        m_vDefaultPersonaImage.clear();
     m_pExtensionPersonaPreview.clear();
     m_pPersonaList.clear();
     m_pExtensionLabel.clear();
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index d5b6b93..1450f67 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -1803,8 +1803,8 @@ bool isNodeActive( OptionsNode* pNode, Module* pModule )
         // search node in active module
         if ( pModule->m_bActive )
         {
-            for ( size_t j = 0; j < pModule->m_aNodeList.size(); ++j )
-                if ( pModule->m_aNodeList[j]->m_sId == pNode->m_sId )
+            for (OrderedEntry* j : pModule->m_aNodeList)
+                if ( j->m_sId == pNode->m_sId )
                     return true;
         }
     }
@@ -1997,22 +1997,21 @@ VectorOfNodes OfaTreeOptionsDialog::LoadNodes(
                                 bool bAlreadyOpened = false;
                                 if ( pNode->m_aGroupedLeaves.size() > 0 )
                                 {
-                                    for ( size_t k = 0;
-                                          k < pNode->m_aGroupedLeaves.size(); ++k )
+                                    for (std::vector<OptionsLeaf*> & m_aGroupedLeave : pNode->m_aGroupedLeaves)
                                     {
-                                        if ( pNode->m_aGroupedLeaves[k].size() > 0 &&
-                                             pNode->m_aGroupedLeaves[k][0]->m_sGroupId
+                                        if ( m_aGroupedLeave.size() > 0 &&
+                                             m_aGroupedLeave[0]->m_sGroupId
                                              == sLeafGrpId )
                                         {
                                             sal_uInt32 l = 0;
-                                            for ( ; l < pNode->m_aGroupedLeaves[k].size(); ++l )
+                                            for ( ; l < m_aGroupedLeave.size(); ++l )
                                             {
-                                                if ( pNode->m_aGroupedLeaves[k][l]->
+                                                if ( m_aGroupedLeave[l]->
                                                      m_nGroupIndex >= nLeafGrpIdx )
                                                     break;
                                             }
-                                            pNode->m_aGroupedLeaves[k].insert(
-                                                pNode->m_aGroupedLeaves[k].begin() + l, pLeaf );
+                                            m_aGroupedLeave.insert(
+                                                m_aGroupedLeave.begin() + l, pLeaf );
                                             bAlreadyOpened = true;
                                             break;
                                         }
@@ -2112,10 +2111,8 @@ static void lcl_insertLeaf(
 
 void  OfaTreeOptionsDialog::InsertNodes( const VectorOfNodes& rNodeList )
 {
-    for ( size_t i = 0; i < rNodeList.size(); ++i )
+    for (OptionsNode* pNode : rNodeList)
     {
-        OptionsNode* pNode = rNodeList[i];
-
         if ( pNode->m_aLeaves.size() > 0 || pNode->m_aGroupedLeaves.size() > 0 )
         {
             sal_uInt32 j = 0;
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index 4dccaf5..2922a9c 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -961,17 +961,14 @@ bool OfaAutocorrReplacePage::FillItemSet( SfxItemSet* )
         std::vector<SvxAutocorrWord> aDeleteWords;
         std::vector<SvxAutocorrWord> aNewWords;
 
-        for (size_t i = 0; i < rStringChangeList.aDeletedEntries.size(); i++)
+        for (DoubleString & deleteEntry : rStringChangeList.aDeletedEntries)
         {
-            DoubleString& deleteEntry = rStringChangeList.aDeletedEntries[i];
             SvxAutocorrWord aDeleteWord( deleteEntry.sShort, deleteEntry.sLong );
             aDeleteWords.push_back( aDeleteWord );
         }
 
-        for (size_t i = 0; i < rStringChangeList.aNewEntries.size(); i++)
+        for (DoubleString & newEntry : rStringChangeList.aNewEntries)
         {
-            DoubleString& newEntry = rStringChangeList.aNewEntries[i];
-
             //fdo#67697 if the user data is set then we want to retain the
             //source formatting of the entry, so don't use the optimized
             //text-only MakeCombinedChanges for this entry
@@ -1034,9 +1031,8 @@ void OfaAutocorrReplacePage::RefillReplaceBox(bool bFromReset,
     if( aDoubleStringTable.find(eLang) != aDoubleStringTable.end() )
     {
         DoubleStringArray& rArray = aDoubleStringTable[eNewLanguage];
-        for( size_t i = 0; i < rArray.size(); i++ )
+        for(DoubleString & rDouble : rArray)
         {
-            DoubleString& rDouble = rArray[i];
             bool bTextOnly = nullptr == rDouble.pUserData;
             // formatted text is only in Writer
             if(bSWriter || bTextOnly)
diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx
index 416a582..69c4adb 100644
--- a/cui/source/tabpages/border.cxx
+++ b/cui/source/tabpages/border.cxx
@@ -169,8 +169,8 @@ SvxBorderTabPage::SvxBorderTabPage(vcl::Window* pParent, const SfxItemSet& rCore
     {
         const SfxIntegerListItem* p = static_cast<const SfxIntegerListItem*>(pItem);
         std::vector<sal_Int32> aUsedStyles = p->GetList();
-        for (size_t i = 0, n = aUsedStyles.size(); i < n; ++i)
-            maUsedBorderStyles.insert(static_cast<sal_Int16>(aUsedStyles[i]));
+        for (int aUsedStyle : aUsedStyles)
+            maUsedBorderStyles.insert(static_cast<sal_Int16>(aUsedStyle));
     }
 
     if (rCoreAttrs.HasItem(SID_ATTR_BORDER_DEFAULT_WIDTH, &pItem))
@@ -665,8 +665,8 @@ bool SvxBorderTabPage::FillItemSet( SfxItemSet* rCoreAttrs )
                                 { svx::FRAMEBORDER_RIGHT,SvxBoxItemLine::RIGHT },
                             };
 
-    for (sal_uInt32 i=0; i < SAL_N_ELEMENTS(eTypes1); ++i)
-        aBoxItem.SetLine( m_pFrameSel->GetFrameBorderStyle( eTypes1[i].first ), eTypes1[i].second );
+    for (std::pair<svx::FrameBorderType,SvxBoxItemLine> i : eTypes1)
+        aBoxItem.SetLine( m_pFrameSel->GetFrameBorderStyle( i.first ), i.second );
 
 
     aBoxItem.SetRemoveAdjacentCellBorder( mbRemoveAdjacentCellBorders );
@@ -676,8 +676,8 @@ bool SvxBorderTabPage::FillItemSet( SfxItemSet* rCoreAttrs )
                                 { svx::FRAMEBORDER_HOR,SvxBoxInfoItemLine::HORI },
                                 { svx::FRAMEBORDER_VER,SvxBoxInfoItemLine::VERT }
                             };
-    for (sal_uInt32 j=0; j < SAL_N_ELEMENTS(eTypes2); ++j)
-        aBoxInfoItem.SetLine( m_pFrameSel->GetFrameBorderStyle( eTypes2[j].first ), eTypes2[j].second );
+    for (std::pair<svx::FrameBorderType,SvxBoxInfoItemLine> j : eTypes2)
+        aBoxInfoItem.SetLine( m_pFrameSel->GetFrameBorderStyle( j.first ), j.second );
 
     aBoxInfoItem.EnableHor( mbHorEnabled );
     aBoxInfoItem.EnableVer( mbVerEnabled );
diff --git a/cui/source/tabpages/labdlg.cxx b/cui/source/tabpages/labdlg.cxx
index da59014..e99c26b 100644
--- a/cui/source/tabpages/labdlg.cxx
+++ b/cui/source/tabpages/labdlg.cxx
@@ -390,8 +390,8 @@ void SvxCaptionTabPage::SetupAnsatz_Impl( sal_uInt16 nType )
 
         case AZ_HORIZONTAL:
         m_pLB_ANSATZ_REL->Clear();
-        for (size_t i = 0 ; i < m_aStrHorzList.size(); ++i)
-            m_pLB_ANSATZ_REL->InsertEntry(m_aStrHorzList[i]);
+        for (OUString & i : m_aStrHorzList)
+            m_pLB_ANSATZ_REL->InsertEntry(i);
         m_pLB_ANSATZ_REL->SelectEntryPos(nAnsatzRelPos);
 
         m_pMF_ANSATZ->Hide();
@@ -403,8 +403,8 @@ void SvxCaptionTabPage::SetupAnsatz_Impl( sal_uInt16 nType )
 
         case AZ_VERTIKAL:
         m_pLB_ANSATZ_REL->Clear();
-        for (size_t i = 0 ; i < m_aStrVertList.size(); ++i)
-            m_pLB_ANSATZ_REL->InsertEntry(m_aStrVertList[i]);
+        for (OUString & i : m_aStrVertList)
+            m_pLB_ANSATZ_REL->InsertEntry(i);
         m_pLB_ANSATZ_REL->SelectEntryPos(nAnsatzRelPos);
 
         m_pMF_ANSATZ->Hide();
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 9d7bdd7..763e701 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -1136,11 +1136,11 @@ void SvxNumOptionsTabPage::GetI18nNumbering( ListBox& rFmtLB, sal_uInt16 nDoNotR
             }
         }
     }
-    for (size_t i=0; i<aRemove.size(); ++i)
+    for (unsigned short i : aRemove)
     {
-        if (aRemove[i] != nDontRemove)
+        if (i != nDontRemove)
         {
-            sal_Int32 nPos = rFmtLB.GetEntryPos( reinterpret_cast<void*>((sal_uLong)aRemove[i]));
+            sal_Int32 nPos = rFmtLB.GetEntryPos( reinterpret_cast<void*>((sal_uLong)i));
             rFmtLB.RemoveEntry( nPos);
         }
     }
diff --git a/cui/source/tabpages/swpossizetabpage.cxx b/cui/source/tabpages/swpossizetabpage.cxx
index 30e1cd6..eb5cf57 100644
--- a/cui/source/tabpages/swpossizetabpage.cxx
+++ b/cui/source/tabpages/swpossizetabpage.cxx
@@ -468,11 +468,11 @@ static sal_uLong lcl_GetLBRelationsForRelations( const sal_uInt16 _nRel )
 {
     sal_uLong nLBRelations = 0L;
 
-    for ( sal_uInt16 nRelMapPos = 0; nRelMapPos < SAL_N_ELEMENTS(aRelationMap); ++nRelMapPos )
+    for (RelationMap & nRelMapPos : aRelationMap)
     {
-        if ( aRelationMap[nRelMapPos].nRelation == _nRel )
+        if ( nRelMapPos.nRelation == _nRel )
         {
-            nLBRelations |= aRelationMap[nRelMapPos].nLBRelation;
+            nLBRelations |= nRelMapPos.nLBRelation;
         }
     }
 
@@ -659,12 +659,12 @@ void SvxSwPosSizeTabPage::setOptimalFrmWidth()
     };
 
     std::vector<SvxSwFramePosString::StringId> aFrames;
-    for (size_t i = 0; i < SAL_N_ELEMENTS(aMaps); ++i)
+    for (const FrmMaps& aMap : aMaps)
     {
-        for (size_t j = 0; j < aMaps[i].nCount; ++j)
+        for (size_t j = 0; j < aMap.nCount; ++j)
         {
-            aFrames.push_back(aMaps[i].pMap[j].eStrId);
-            aFrames.push_back(aMaps[i].pMap[j].eMirrorStrId);
+            aFrames.push_back(aMap.pMap[j].eStrId);
+            aFrames.push_back(aMap.pMap[j].eMirrorStrId);
         }
     }
 
@@ -700,12 +700,12 @@ void SvxSwPosSizeTabPage::setOptimalRelWidth()
     };
 
     std::vector<SvxSwFramePosString::StringId> aRels;
-    for (size_t i = 0; i < SAL_N_ELEMENTS(aMaps); ++i)
+    for (const RelationMaps& aMap : aMaps)
     {
-        for (size_t j = 0; j < aMaps[i].nCount; ++j)
+        for (size_t j = 0; j < aMap.nCount; ++j)
         {
-            aRels.push_back(aMaps[i].pMap[j].eStrId);
-            aRels.push_back(aMaps[i].pMap[j].eMirrorStrId);
+            aRels.push_back(aMap.pMap[j].eStrId);
+            aRels.push_back(aMap.pMap[j].eMirrorStrId);
         }
     }
 
diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx
index a360db9..e983748 100644
--- a/cui/source/tabpages/tpline.cxx
+++ b/cui/source/tabpages/tpline.cxx
@@ -236,9 +236,8 @@ void SvxLineTabPage::dispose()
         m_pSymbolMB = nullptr;
     }
 
-    for ( size_t i = 0, n = m_aGrfBrushItems.size(); i < n; ++i )
+    for (SvxBmpItemInfo* pInfo : m_aGrfBrushItems)
     {
-        SvxBmpItemInfo* pInfo = m_aGrfBrushItems[ i ];
         delete pInfo->pBrushItem;
         delete pInfo;
     }
commit 8762aa986dbca42e61cc8fb1b2c1d2ca66bcfcbe
Author: Noel Grandin <noel at peralex.com>
Date:   Thu Apr 21 10:26:48 2016 +0200

    clang-tidy modernize-loop-convert in b*
    
    Change-Id: I8ac6eb59e213eafa78e3dc4578738b53e8adef5b

diff --git a/basctl/source/accessibility/accessibledialogwindow.cxx b/basctl/source/accessibility/accessibledialogwindow.cxx
index 13f104d..dc56db4 100644
--- a/basctl/source/accessibility/accessibledialogwindow.cxx
+++ b/basctl/source/accessibility/accessibledialogwindow.cxx
@@ -149,9 +149,9 @@ AccessibleDialogWindow::~AccessibleDialogWindow()
 
 void AccessibleDialogWindow::UpdateFocused()
 {
-    for ( size_t i = 0; i < m_aAccessibleChildren.size(); ++i )
+    for (ChildDescriptor & i : m_aAccessibleChildren)
     {
-        Reference< XAccessible > xChild( m_aAccessibleChildren[i].rxAccessible );
+        Reference< XAccessible > xChild( i.rxAccessible );
         if ( xChild.is() )
         {
             AccessibleDialogControlShape* pShape = static_cast< AccessibleDialogControlShape* >( xChild.get() );
@@ -166,9 +166,9 @@ void AccessibleDialogWindow::UpdateSelected()
 {
     NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
 
-    for ( size_t i = 0; i < m_aAccessibleChildren.size(); ++i )
+    for (ChildDescriptor & i : m_aAccessibleChildren)
     {
-        Reference< XAccessible > xChild( m_aAccessibleChildren[i].rxAccessible );
+        Reference< XAccessible > xChild( i.rxAccessible );
         if ( xChild.is() )
         {
             AccessibleDialogControlShape* pShape = static_cast< AccessibleDialogControlShape* >( xChild.get() );
@@ -181,9 +181,9 @@ void AccessibleDialogWindow::UpdateSelected()
 
 void AccessibleDialogWindow::UpdateBounds()
 {
-    for ( size_t i = 0; i < m_aAccessibleChildren.size(); ++i )
+    for (ChildDescriptor & i : m_aAccessibleChildren)
     {
-        Reference< XAccessible > xChild( m_aAccessibleChildren[i].rxAccessible );
+        Reference< XAccessible > xChild( i.rxAccessible );
         if ( xChild.is() )
         {
             AccessibleDialogControlShape* pShape = static_cast< AccessibleDialogControlShape* >( xChild.get() );
@@ -413,9 +413,9 @@ void AccessibleDialogWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindo
                 m_pDlgEdModel = nullptr;
 
                 // dispose all children
-                for ( size_t i = 0; i < m_aAccessibleChildren.size(); ++i )
+                for (ChildDescriptor & i : m_aAccessibleChildren)
                 {
-                    Reference< XComponent > xComponent( m_aAccessibleChildren[i].rxAccessible, UNO_QUERY );
+                    Reference< XComponent > xComponent( i.rxAccessible, UNO_QUERY );
                     if ( xComponent.is() )
                         xComponent->dispose();
                 }
@@ -562,9 +562,9 @@ void AccessibleDialogWindow::disposing()
         m_pDlgEdModel = nullptr;
 
         // dispose all children
-        for ( size_t i = 0; i < m_aAccessibleChildren.size(); ++i )
+        for (ChildDescriptor & i : m_aAccessibleChildren)
         {
-            Reference< XComponent > xComponent( m_aAccessibleChildren[i].rxAccessible, UNO_QUERY );
+            Reference< XComponent > xComponent( i.rxAccessible, UNO_QUERY );
             if ( xComponent.is() )
                 xComponent->dispose();
         }
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index f612545..2371342 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -890,9 +890,9 @@ void EditorWindow::SetupAndShowCodeCompleteWnd( const std::vector< OUString >& a
     // clear the listbox
     pCodeCompleteWnd->ClearListBox();
     // fill the listbox
-    for(size_t l = 0; l < aEntryVect.size(); ++l)
+    for(const auto & l : aEntryVect)
     {
-        pCodeCompleteWnd->InsertEntry( aEntryVect[l] );
+        pCodeCompleteWnd->InsertEntry( l );
     }
     // show it
     pCodeCompleteWnd->Show();
diff --git a/basctl/source/basicide/bastype3.cxx b/basctl/source/basicide/bastype3.cxx
index 071ebaf..98782ea 100644
--- a/basctl/source/basicide/bastype3.cxx
+++ b/basctl/source/basicide/bastype3.cxx
@@ -193,9 +193,8 @@ SbxVariable* TreeListBox::FindVariable( SvTreeListEntry* pEntry )
     if ( !aEntries.empty() )
     {
         bool bDocumentObjects = false;
-        for ( size_t n = 0; n < aEntries.size(); n++ )
+        for (SvTreeListEntry* pLE : aEntries)
         {
-            SvTreeListEntry* pLE = aEntries[n];
             assert(pLE && "Can not find entry in array");
             Entry* pBE = static_cast<Entry*>(pLE->GetUserData());
             assert(pBE && "The data in the entry not found!");
@@ -296,9 +295,8 @@ EntryDescriptor TreeListBox::GetEntryDescriptor( SvTreeListEntry* pEntry )
 
     if ( !aEntries.empty() )
     {
-        for ( size_t n = 0; n < aEntries.size(); n++ )
+        for (SvTreeListEntry* pLE : aEntries)
         {
-            SvTreeListEntry* pLE = aEntries[n];
             assert(pLE && "Entrie im Array nicht gefunden");
             Entry* pBE = static_cast<Entry*>(pLE->GetUserData());
             assert(pBE && "Keine Daten im Eintrag gefunden!");
diff --git a/basctl/source/basicide/breakpoint.cxx b/basctl/source/basicide/breakpoint.cxx
index 5c59bea..31321fe 100644
--- a/basctl/source/basicide/breakpoint.cxx
+++ b/basctl/source/basicide/breakpoint.cxx
@@ -42,8 +42,8 @@ BreakPointList::~BreakPointList()
 
 void BreakPointList::reset()
 {
-    for ( size_t i = 0, n = maBreakPoints.size(); i < n; ++i )
-        delete maBreakPoints[ i ];
+    for (BreakPoint* maBreakPoint : maBreakPoints)
+        delete maBreakPoint;
     maBreakPoints.clear();
 }
 
@@ -74,9 +74,8 @@ void BreakPointList::SetBreakPointsInBasic(SbModule* pModule)
 {
     pModule->ClearAllBP();
 
-    for ( size_t i = 0, n = maBreakPoints.size(); i < n; ++i )
+    for (BreakPoint* pBrk : maBreakPoints)
     {
-        BreakPoint* pBrk = maBreakPoints[ i ];
         if ( pBrk->bEnabled )
             pModule->SetBP( (sal_uInt16)pBrk->nLine );
     }
@@ -84,9 +83,8 @@ void BreakPointList::SetBreakPointsInBasic(SbModule* pModule)
 
 BreakPoint* BreakPointList::FindBreakPoint(size_t nLine)
 {
-    for ( size_t i = 0, n = maBreakPoints.size(); i < n; ++i )
+    for (BreakPoint* pBrk : maBreakPoints)
     {
-        BreakPoint* pBrk = maBreakPoints[ i ];
         if ( pBrk->nLine == nLine )
             return pBrk;
     }
@@ -127,9 +125,8 @@ void BreakPointList::AdjustBreakPoints(size_t nLine, bool bInserted)
 
 void BreakPointList::ResetHitCount()
 {
-    for ( size_t i = 0, n = maBreakPoints.size(); i < n; ++i )
+    for (BreakPoint* pBrk : maBreakPoints)
     {
-        BreakPoint* pBrk = maBreakPoints[ i ];
         pBrk->nHitCount = 0;
     }
 }
diff --git a/basctl/source/basicide/doceventnotifier.cxx b/basctl/source/basicide/doceventnotifier.cxx
index 9fa7064..872cb64 100644
--- a/basctl/source/basicide/doceventnotifier.cxx
+++ b/basctl/source/basicide/doceventnotifier.cxx
@@ -145,9 +145,9 @@ namespace basctl
             { "OnModeChanged",  &DocumentEventListener::onDocumentModeChanged }
         };
 
-        for ( size_t i=0; i < SAL_N_ELEMENTS( aEvents ); ++i )
+        for (EventEntry & aEvent : aEvents)
         {
-            if ( !_rEvent.EventName.equalsAscii( aEvents[i].pEventName ) )
+            if ( !_rEvent.EventName.equalsAscii( aEvent.pEventName ) )
                 continue;
 
             ScriptDocument aDocument( xDocument );
@@ -162,7 +162,7 @@ namespace basctl
                     // somebody took the chance to dispose us -> bail out
                     return;
 
-                (m_pListener->*aEvents[i].listenerMethod)( aDocument );
+                (m_pListener->*aEvent.listenerMethod)( aDocument );
             }
             break;
         }
diff --git a/basegfx/source/polygon/b2dpolygonclipper.cxx b/basegfx/source/polygon/b2dpolygonclipper.cxx
index d8123ed..7b49169 100644
--- a/basegfx/source/polygon/b2dpolygonclipper.cxx
+++ b/basegfx/source/polygon/b2dpolygonclipper.cxx
@@ -828,8 +828,8 @@ namespace basegfx
                                 else
                                 {
                                     // the last triangle has not been altered, simply copy to result
-                                    for(sal_uInt32 i=0; i<3; ++i)
-                                        aResult.append(stack[i]);
+                                    for(basegfx::B2DPoint & i : stack)
+                                        aResult.append(i);
                                 }
                             }
                         }
diff --git a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx
index e72c6ba..22ee496 100644
--- a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx
+++ b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx
@@ -412,9 +412,8 @@ namespace basegfx
             }
 
             // append remapped tempVector entries for edge to tempPoints for edge
-            for(size_t a(0); a < aTempPointVectorEdge.size(); a++)
+            for(temporaryPoint & rTempPoint : aTempPointVectorEdge)
             {
-                const temporaryPoint& rTempPoint = aTempPointVectorEdge[a];
                 rTempPointsB.push_back(temporaryPoint(rTempPoint.getPoint(), nIndB, rTempPoint.getCut()));
             }
         }
diff --git a/basegfx/source/polygon/b2dpolypolygon.cxx b/basegfx/source/polygon/b2dpolypolygon.cxx
index f58dcec..2f71066 100644
--- a/basegfx/source/polygon/b2dpolypolygon.cxx
+++ b/basegfx/source/polygon/b2dpolypolygon.cxx
@@ -105,9 +105,9 @@ public:
 
     void setClosed(bool bNew)
     {
-        for(size_t a(0); a < maPolygons.size(); a++)
+        for(basegfx::B2DPolygon & maPolygon : maPolygons)
         {
-            maPolygons[a].setClosed(bNew);
+            maPolygon.setClosed(bNew);
         }
     }
 
diff --git a/basegfx/source/polygon/b2dpolypolygoncutter.cxx b/basegfx/source/polygon/b2dpolypolygoncutter.cxx
index 3332976..e7bf5a0 100644
--- a/basegfx/source/polygon/b2dpolypolygoncutter.cxx
+++ b/basegfx/source/polygon/b2dpolypolygoncutter.cxx
@@ -1038,9 +1038,9 @@ namespace basegfx
                 B2DPolyPolygonVector aResult;
                 aResult.reserve(aInput.size());
 
-                for(size_t a(0); a < aInput.size(); a++)
+                for(basegfx::B2DPolyPolygon & a : aInput)
                 {
-                    const basegfx::B2DPolyPolygon aCandidate(prepareForPolygonOperation(aInput[a]));
+                    const basegfx::B2DPolyPolygon aCandidate(prepareForPolygonOperation(a));
 
                     if(!aResult.empty())
                     {
diff --git a/basegfx/source/polygon/b2dtrapezoid.cxx b/basegfx/source/polygon/b2dtrapezoid.cxx
index e36d2af..f25b7bf 100644
--- a/basegfx/source/polygon/b2dtrapezoid.cxx
+++ b/basegfx/source/polygon/b2dtrapezoid.cxx
@@ -423,10 +423,9 @@ namespace basegfx
                     // there were horizontal edges. These can be excluded, but
                     // cuts with other edges need to be solved and added before
                     // ignoring them
-                    for(size_t a = 0; a < rTrDeSimpleEdges.size(); a++)
+                    for(TrDeSimpleEdge & rHorEdge : rTrDeSimpleEdges)
                     {
                         // get horizontal edge as candidate; prepare its range and fixed Y
-                        const TrDeSimpleEdge& rHorEdge = rTrDeSimpleEdges[a];
                         const B1DRange aRange(rHorEdge.getStart().getX(), rHorEdge.getEnd().getX());
                         const double fFixedY(rHorEdge.getStart().getY());
 
diff --git a/basic/source/comp/parser.cxx b/basic/source/comp/parser.cxx
index a26f5e6..87af412 100644
--- a/basic/source/comp/parser.cxx
+++ b/basic/source/comp/parser.cxx
@@ -133,8 +133,8 @@ SbiParser::SbiParser( StarBASIC* pb, SbModule* pm )
     bClassModule = ( pm->GetModuleType() == css::script::ModuleType::CLASS );
     OSL_TRACE("Parser - %s, bClassModule %d", OUStringToOString( pm->GetName(), RTL_TEXTENCODING_UTF8 ).getStr(), bClassModule );
     pPool    = &aPublics;
-    for( short i = 0; i < 26; i++ )
-        eDefTypes[ i ] = SbxVARIANT;    // no explicit default type
+    for(SbxDataType & eDefType : eDefTypes)
+        eDefType = SbxVARIANT;    // no explicit default type
 
     aPublics.SetParent( &aGlobals );
     aGlobals.SetParent( &aRtlSyms );
diff --git a/basic/source/comp/symtbl.cxx b/basic/source/comp/symtbl.cxx
index 7d96926..94f1be3 100644
--- a/basic/source/comp/symtbl.cxx
+++ b/basic/source/comp/symtbl.cxx
@@ -245,12 +245,11 @@ sal_uInt32 SbiSymPool::Reference( const OUString& rName )
 
 void SbiSymPool::CheckRefs()
 {
-    for (size_t i = 0; i < m_Data.size(); ++i)
+    for (std::unique_ptr<SbiSymDef> & r : m_Data)
     {
-        SbiSymDef &r = *m_Data[ i ];
-        if( !r.IsDefined() )
+        if( !r->IsDefined() )
         {
-            pParser->Error( ERRCODE_BASIC_UNDEF_LABEL, r.GetName() );
+            pParser->Error( ERRCODE_BASIC_UNDEF_LABEL, r->GetName() );
         }
     }
 }
diff --git a/basic/source/runtime/ddectrl.cxx b/basic/source/runtime/ddectrl.cxx
index 4e965d3..384d19d 100644
--- a/basic/source/runtime/ddectrl.cxx
+++ b/basic/source/runtime/ddectrl.cxx
@@ -138,10 +138,8 @@ SbError SbiDdeControl::Terminate( size_t nChannel )
 
 SbError SbiDdeControl::TerminateAll()
 {
-    for (size_t nChannel = 0; nChannel < aConvList.size(); ++nChannel)
+    for (DdeConnection* conv : aConvList)
     {
-        DdeConnection *conv = aConvList[nChannel];
-
         if (conv != DDE_FREECHANNEL)
         {
             delete conv;
diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx
index 8e72688..f08edc8 100644
--- a/basic/source/runtime/iosys.cxx
+++ b/basic/source/runtime/iosys.cxx
@@ -657,9 +657,9 @@ SbError SbiStream::Write( const OString& rBuf )
 
 SbiIoSystem::SbiIoSystem()
 {
-    for( short i = 0; i < CHANNELS; i++ )
+    for(SbiStream* & i : pChan)
     {
-        pChan[ i ] = nullptr;
+        i = nullptr;
     }
     nChan  = 0;
     nError = 0;
diff --git a/bridges/source/cpp_uno/shared/component.cxx b/bridges/source/cpp_uno/shared/component.cxx
index 02b6838..97a0214 100644
--- a/bridges/source/cpp_uno/shared/component.cxx
+++ b/bridges/source/cpp_uno/shared/component.cxx
@@ -60,9 +60,9 @@ const OUString & SAL_CALL cppu_cppenv_getStaticOIdPart()
             // good guid
             sal_uInt8 ar[16];
             ::rtl_getGlobalProcessId( ar );
-            for ( sal_Int32 i = 0; i < 16; ++i )
+            for (unsigned char i : ar)
             {
-                aRet.append( (sal_Int32)ar[i], 16 );
+                aRet.append( (sal_Int32)i, 16 );
             }
 #if (defined(__GNUC__) && defined(__APPLE__))
             s_pStaticOidPart = new OUString( aRet.makeStringAndClear() );


More information about the Libreoffice-commits mailing list