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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sun Nov 18 16:37:19 UTC 2018


 svx/source/sdr/animation/scheduler.cxx            |   11 +-
 svx/source/sdr/overlay/overlaymanager.cxx         |   20 ++---
 svx/source/sdr/overlay/overlaymanagerbuffered.cxx |   14 +--
 svx/source/sdr/properties/defaultproperties.cxx   |    4 -
 svx/source/sdr/properties/textproperties.cxx      |   29 +++----
 svx/source/smarttags/SmartTagMgr.cxx              |    9 --
 svx/source/stbctrls/zoomsliderctrl.cxx            |   17 +---
 svx/source/svdraw/sdrpaintwindow.cxx              |   15 +---
 svx/source/svdraw/svddrgmt.cxx                    |    9 --
 svx/source/svdraw/svdedtv2.cxx                    |   12 +--
 svx/source/svdraw/svdglev.cxx                     |   16 +---
 svx/source/svdraw/svdhdl.cxx                      |   10 --
 svx/source/svdraw/svdmark.cxx                     |   12 ---
 svx/source/svdraw/svdmrkv.cxx                     |    3 
 svx/source/svdraw/svdoashp.cxx                    |   82 ++++++++++------------
 svx/source/svdraw/svdobj.cxx                      |    3 
 svx/source/svdraw/svdotextpathdecomposition.cxx   |    4 -
 svx/source/svdraw/svdotxat.cxx                    |    8 --
 svx/source/svdraw/svdouno.cxx                     |   15 +---
 svx/source/svdraw/svdpage.cxx                     |   12 +--
 svx/source/svdraw/svdpagv.cxx                     |   14 +--
 svx/source/svdraw/svdpntv.cxx                     |   15 +---
 svx/source/svdraw/svdpoev.cxx                     |   26 ++----
 svx/source/table/accessibletableshape.cxx         |    8 +-
 svx/source/table/cell.cxx                         |    4 -
 svx/source/table/propertyset.cxx                  |    4 -
 svx/source/table/tabledesign.cxx                  |   67 ++++++-----------
 svx/source/table/tablehandles.cxx                 |    5 -
 svx/source/table/tablelayouter.cxx                |    8 --
 svx/source/table/tablemodel.cxx                   |   24 ++----
 svx/source/table/tablerow.cxx                     |    8 --
 svx/source/table/tableundo.cxx                    |   15 +---
 svx/source/tbxctrls/Palette.cxx                   |   16 ++--
 svx/source/tbxctrls/SvxColorValueSet.cxx          |   24 +++---
 svx/source/tbxctrls/tbcontrl.cxx                  |   13 +--
 svx/source/tbxctrls/tbunosearchcontrollers.cxx    |   24 ++----
 svx/source/unodraw/UnoGraphicExporter.cxx         |    6 -
 svx/source/unodraw/UnoNameItemTable.cxx           |   47 +++++-------
 svx/source/unodraw/unomtabl.cxx                   |   54 ++++++--------
 svx/source/unodraw/unoprov.cxx                    |    9 +-
 svx/source/unodraw/unoshape.cxx                   |   20 +----
 41 files changed, 288 insertions(+), 428 deletions(-)

New commits:
commit 587ef41f75b8ea0bcd03366178d42a324dcf481c
Author:     Arkadiy Illarionov <qarkai at gmail.com>
AuthorDate: Sun Nov 18 13:43:28 2018 +0300
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Nov 18 17:36:54 2018 +0100

    Simplify containers iterations in svx/source/[s-u]*
    
    Use range-based loop or replace with STL functions
    
    Change-Id: I2ec3e58cc46c9286ef863c732912ca7a729bab62
    Reviewed-on: https://gerrit.libreoffice.org/63522
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/svx/source/sdr/animation/scheduler.cxx b/svx/source/sdr/animation/scheduler.cxx
index a8fc3272be8b..4f32f101f999 100644
--- a/svx/source/sdr/animation/scheduler.cxx
+++ b/svx/source/sdr/animation/scheduler.cxx
@@ -88,12 +88,10 @@ namespace sdr
             }
 
             // execute events from the vector
-            ::std::vector< Event* >::const_iterator aEnd = aToBeExecutedList.end();
-            for(::std::vector< Event* >::iterator aCandidate = aToBeExecutedList.begin();
-                aCandidate != aEnd; ++aCandidate)
+            for(auto& rpCandidate : aToBeExecutedList)
             {
                 // trigger event. This may re-insert the event to the scheduler again
-                (*aCandidate)->Trigger(mnTime);
+                rpCandidate->Trigger(mnTime);
             }
         }
 
@@ -146,9 +144,8 @@ namespace sdr
         void Scheduler::InsertEvent(Event& rNew)
         {
             // insert maintaining time ordering
-            auto it = mvEvents.begin();
-            while (it != mvEvents.end() && rNew.GetTime() >= (*it)->GetTime())
-                it++;
+            auto it = std::find_if(mvEvents.begin(), mvEvents.end(),
+                [&rNew](const Event* pEvent) { return rNew.GetTime() < pEvent->GetTime(); });
             mvEvents.insert(it, &rNew);
             checkTimeout();
         }
diff --git a/svx/source/sdr/overlay/overlaymanager.cxx b/svx/source/sdr/overlay/overlaymanager.cxx
index 3660598a23f7..14460a3ac605 100644
--- a/svx/source/sdr/overlay/overlaymanager.cxx
+++ b/svx/source/sdr/overlay/overlaymanager.cxx
@@ -52,10 +52,10 @@ namespace sdr
 
                 if(pProcessor)
                 {
-                    for(OverlayObjectVector::const_iterator aIter(maOverlayObjects.begin()); aIter != maOverlayObjects.end(); ++aIter)
+                    for(const auto& rpOverlayObject : maOverlayObjects)
                     {
-                        OSL_ENSURE(*aIter, "Corrupted OverlayObject List (!)");
-                        const OverlayObject& rCandidate = **aIter;
+                        OSL_ENSURE(rpOverlayObject, "Corrupted OverlayObject List (!)");
+                        const OverlayObject& rCandidate = *rpOverlayObject;
 
                         if(rCandidate.isVisible())
                         {
@@ -94,11 +94,10 @@ namespace sdr
 
             if(nSize)
             {
-                OverlayObjectVector::const_iterator aEnd(maOverlayObjects.end());
-                for(OverlayObjectVector::iterator aIter(maOverlayObjects.begin()); aIter != aEnd; ++aIter)
+                for(const auto& rpOverlayObject : maOverlayObjects)
                 {
-                    OSL_ENSURE(*aIter, "Corrupted OverlayObject List (!)");
-                    OverlayObject& rCandidate = **aIter;
+                    OSL_ENSURE(rpOverlayObject, "Corrupted OverlayObject List (!)");
+                    OverlayObject& rCandidate = *rpOverlayObject;
                     rCandidate.stripeDefinitionHasChanged();
                 }
             }
@@ -224,11 +223,10 @@ namespace sdr
 
             if(nSize)
             {
-                OverlayObjectVector::const_iterator aEnd = maOverlayObjects.end();
-                for(OverlayObjectVector::iterator aIter(maOverlayObjects.begin()); aIter != aEnd; ++aIter)
+                for(const auto& rpOverlayObject : maOverlayObjects)
                 {
-                    OSL_ENSURE(*aIter, "Corrupted OverlayObject List (!)");
-                    OverlayObject& rCandidate = **aIter;
+                    OSL_ENSURE(rpOverlayObject, "Corrupted OverlayObject List (!)");
+                    OverlayObject& rCandidate = *rpOverlayObject;
                     impApplyRemoveActions(rCandidate);
                 }
 
diff --git a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx
index 2d4514c90046..6a88e7633944 100644
--- a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx
+++ b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx
@@ -121,7 +121,7 @@ namespace sdr
             RectangleVector aRectangles;
             rRegionPixel.GetRegionRectangles(aRectangles);
 
-            for(RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); ++aRectIter)
+            for(const auto& rRect : aRectangles)
             {
 #ifdef DBG_UTIL
                 // #i72754# possible graphical region test only with non-pro
@@ -131,13 +131,13 @@ namespace sdr
                 {
                     getOutputDevice().SetLineColor(COL_LIGHTGREEN);
                     getOutputDevice().SetFillColor();
-                    getOutputDevice().DrawRect(*aRectIter);
+                    getOutputDevice().DrawRect(rRect);
                 }
 #endif
 
                 // restore the area
-                const Point aTopLeft(aRectIter->TopLeft());
-                const Size aSize(aRectIter->GetSize());
+                const Point aTopLeft(rRect.TopLeft());
+                const Size aSize(rRect.GetSize());
 
                 getOutputDevice().DrawOutDev(
                     aTopLeft, aSize, // destination
@@ -188,11 +188,11 @@ namespace sdr
             RectangleVector aRectangles;
             aRegion.GetRegionRectangles(aRectangles);
 
-            for(RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); ++aRectIter)
+            for(const auto& rRect : aRectangles)
             {
                 // for each rectangle, save the area
-                const Point aTopLeft(aRectIter->TopLeft());
-                const Size aSize(aRectIter->GetSize());
+                const Point aTopLeft(rRect.TopLeft());
+                const Size aSize(rRect.GetSize());
 
                 mpBufferDevice->DrawOutDev(
                     aTopLeft, aSize, // destination
diff --git a/svx/source/sdr/properties/defaultproperties.cxx b/svx/source/sdr/properties/defaultproperties.cxx
index c39a827b02fd..063205ff405c 100644
--- a/svx/source/sdr/properties/defaultproperties.cxx
+++ b/svx/source/sdr/properties/defaultproperties.cxx
@@ -188,9 +188,9 @@ namespace sdr
 
             if(bDidChange)
             {
-                for (std::vector< sal_uInt16 >::const_iterator aIter(aPostItemChangeList.begin()), aEnd(aPostItemChangeList.end()); aIter != aEnd; ++aIter)
+                for (const auto& rItem : aPostItemChangeList)
                 {
-                    PostItemChange(*aIter);
+                    PostItemChange(rItem);
                 }
 
                 ItemSetChanged(aSet);
diff --git a/svx/source/sdr/properties/textproperties.cxx b/svx/source/sdr/properties/textproperties.cxx
index 9926586837f8..7aeacdf7e3fc 100644
--- a/svx/source/sdr/properties/textproperties.cxx
+++ b/svx/source/sdr/properties/textproperties.cxx
@@ -451,23 +451,20 @@ namespace sdr
                                     std::vector<EECharAttrib> aAttribs;
                                     pEditEngine->GetCharAttribs(nPara, aAttribs);
 
-                                    for(std::vector<EECharAttrib>::const_iterator i = aAttribs.begin(), aEnd = aAttribs.end(); i != aEnd; ++i)
+                                    for(const auto& rAttrib : aAttribs)
                                     {
-                                        if(EE_FEATURE_FIELD == i->pAttr->Which())
+                                        if(rAttrib.pAttr && EE_FEATURE_FIELD == rAttrib.pAttr->Which())
                                         {
-                                            if(i->pAttr)
+                                            const SvxFieldItem* pFieldItem = static_cast<const SvxFieldItem*>(rAttrib.pAttr);
+
+                                            if(pFieldItem)
                                             {
-                                                const SvxFieldItem* pFieldItem = static_cast<const SvxFieldItem*>(i->pAttr);
+                                                const SvxFieldData* pData = pFieldItem->GetField();
 
-                                                if(pFieldItem)
+                                                if(dynamic_cast<const SvxURLField*>( pData))
                                                 {
-                                                    const SvxFieldData* pData = pFieldItem->GetField();
-
-                                                    if(dynamic_cast<const SvxURLField*>( pData))
-                                                    {
-                                                        bHasURL = true;
-                                                        break;
-                                                    }
+                                                    bHasURL = true;
+                                                    break;
                                                 }
                                             }
                                         }
@@ -480,16 +477,16 @@ namespace sdr
 
                                         ESelection aSel(nPara, 0);
 
-                                        for(std::vector<EECharAttrib>::const_iterator i = aAttribs.begin(), aEnd = aAttribs.end(); i != aEnd; ++i)
+                                        for(const auto& rAttrib : aAttribs)
                                         {
-                                            if(EE_FEATURE_FIELD == i->pAttr->Which())
+                                            if(EE_FEATURE_FIELD == rAttrib.pAttr->Which())
                                             {
-                                                aSel.nEndPos = i->nStart;
+                                                aSel.nEndPos = rAttrib.nStart;
 
                                                 if(aSel.nStartPos != aSel.nEndPos)
                                                     pEditEngine->QuickSetAttribs(aColorSet, aSel);
 
-                                                aSel.nStartPos = i->nEnd;
+                                                aSel.nStartPos = rAttrib.nEnd;
                                             }
                                         }
 
diff --git a/svx/source/smarttags/SmartTagMgr.cxx b/svx/source/smarttags/SmartTagMgr.cxx
index b6c1d7f90c2d..2c95e074205b 100644
--- a/svx/source/smarttags/SmartTagMgr.cxx
+++ b/svx/source/smarttags/SmartTagMgr.cxx
@@ -42,6 +42,7 @@
 #include <com/sun/star/util/XChangesBatch.hpp>
 #include <com/sun/star/util/XChangesNotifier.hpp>
 #include <comphelper/processfactory.hxx>
+#include <comphelper/sequence.hxx>
 #include <rtl/ustring.hxx>
 
 #include <com/sun/star/text/XTextRange.hpp>
@@ -227,13 +228,7 @@ void SmartTagMgr::WriteConfiguration( const bool* pIsLabelTextWithSmartTags,
 
         if ( pDisabledTypes )
         {
-            const sal_Int32 nNumberOfDisabledSmartTagTypes = pDisabledTypes->size();
-            Sequence< OUString > aTypes( nNumberOfDisabledSmartTagTypes );
-
-            std::vector< OUString >::const_iterator aIter;
-            sal_Int32 nCount = 0;
-            for ( aIter = pDisabledTypes->begin(); aIter != pDisabledTypes->end(); ++aIter )
-                aTypes[ nCount++ ] = *aIter;
+            Sequence< OUString > aTypes = comphelper::containerToSequence(*pDisabledTypes);
 
             const Any aNewTypes = makeAny( aTypes );
 
diff --git a/svx/source/stbctrls/zoomsliderctrl.cxx b/svx/source/stbctrls/zoomsliderctrl.cxx
index 37254da36d50..ec51b6eb2cf2 100644
--- a/svx/source/stbctrls/zoomsliderctrl.cxx
+++ b/svx/source/stbctrls/zoomsliderctrl.cxx
@@ -80,12 +80,8 @@ sal_uInt16 SvxZoomSliderControl::Offset2Zoom( long nOffset ) const
 
     // check for snapping points:
     sal_uInt16 nCount = 0;
-    for ( std::vector< long >::const_iterator aSnappingPointIter = mxImpl->maSnappingPointOffsets.begin(),
-           aEnd = mxImpl->maSnappingPointOffsets.end();
-          aSnappingPointIter != aEnd;
-          ++aSnappingPointIter )
+    for ( const long nCurrent : mxImpl->maSnappingPointOffsets )
     {
-        const long nCurrent = *aSnappingPointIter;
         if ( std::abs(nCurrent - nOffset) < nSnappingEpsilon )
         {
             nOffset = nCurrent;
@@ -207,10 +203,8 @@ void SvxZoomSliderControl::StateChanged( sal_uInt16 /*nSID*/, SfxItemState eStat
         // remove snapping points that are to close to each other:
         long nLastOffset = 0;
 
-        for ( std::set< sal_uInt16 >::const_iterator aSnappingPointIter = aTmpSnappingPoints.begin(),
-              aEnd = aTmpSnappingPoints.end(); aSnappingPointIter != aEnd; ++aSnappingPointIter )
+        for ( const sal_uInt16 nCurrent : aTmpSnappingPoints )
         {
-            const sal_uInt16 nCurrent = *aSnappingPointIter;
             const long nCurrentOffset = Zoom2Offset( nCurrent );
 
             if ( nCurrentOffset - nLastOffset >= nSnappingPointsMinDist )
@@ -258,12 +252,9 @@ void SvxZoomSliderControl::Paint( const UserDrawEvent& rUsrEvt )
     pDev->SetLineColor( rStyleSettings.GetDarkShadowColor() );
 
     // draw snapping points:
-    for ( std::vector< long >::const_iterator aSnappingPointIter = mxImpl->maSnappingPointOffsets.begin(),
-            aEnd = mxImpl->maSnappingPointOffsets.end();
-          aSnappingPointIter != aEnd;
-          ++aSnappingPointIter )
+    for ( const auto& rSnappingPoint : mxImpl->maSnappingPointOffsets )
     {
-        long nSnapPosX = aRect.Left() + *aSnappingPointIter;
+        long nSnapPosX = aRect.Left() + rSnappingPoint;
 
         pDev->DrawRect( tools::Rectangle( nSnapPosX - 1, aSlider.Top() - nSnappingHeight,
                     nSnapPosX, aSlider.Bottom() + nSnappingHeight ) );
diff --git a/svx/source/svdraw/sdrpaintwindow.cxx b/svx/source/svdraw/sdrpaintwindow.cxx
index 0eb8e5c0db29..e6ee0bf0f289 100644
--- a/svx/source/svdraw/sdrpaintwindow.cxx
+++ b/svx/source/svdraw/sdrpaintwindow.cxx
@@ -53,9 +53,8 @@ IMPL_LINK(CandidateMgr, WindowEventListener, VclWindowEvent&, rEvent, void)
 
 CandidateMgr::~CandidateMgr()
 {
-    for (auto aI = m_aCandidates.begin(); aI != m_aCandidates.end(); ++aI)
+    for (VclPtr<vcl::Window>& pCandidate : m_aCandidates)
     {
-        VclPtr<vcl::Window> pCandidate = *aI;
         if (m_aDeletedCandidates.find(pCandidate) != m_aDeletedCandidates.end())
             continue;
         pCandidate->RemoveEventListener(LINK(this, CandidateMgr, WindowEventListener));
@@ -91,9 +90,9 @@ void CandidateMgr::PaintTransparentChildren(vcl::Window const & rWindow, tools::
         pCandidate = pCandidate->GetWindow( GetWindowType::Next );
     }
 
-    for (auto aI = m_aCandidates.begin(); aI != m_aCandidates.end(); ++aI)
+    for (const auto& rpCandidate : m_aCandidates)
     {
-        pCandidate = aI->get();
+        pCandidate = rpCandidate.get();
         if (m_aDeletedCandidates.find(pCandidate) != m_aDeletedCandidates.end())
             continue;
         //rhbz#1007697 this can cause the window itself to be
@@ -153,11 +152,11 @@ void SdrPreRenderDevice::OutputPreRenderDevice(const vcl::Region& rExpandedRegio
     RectangleVector aRectangles;
     aRegionPixel.GetRegionRectangles(aRectangles);
 
-    for(RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); ++aRectIter)
+    for(const auto& rRect : aRectangles)
     {
         // for each rectangle, copy the area
-        const Point aTopLeft(aRectIter->TopLeft());
-        const Size aSize(aRectIter->GetSize());
+        const Point aTopLeft(rRect.TopLeft());
+        const Size aSize(rRect.GetSize());
 
         mpOutputDevice->DrawOutDev(
             aTopLeft, aSize,
@@ -177,7 +176,7 @@ void SdrPreRenderDevice::OutputPreRenderDevice(const vcl::Region& rExpandedRegio
 
             mpOutputDevice->SetLineColor(aColor);
             mpOutputDevice->SetFillColor();
-            mpOutputDevice->DrawRect(*aRectIter);
+            mpOutputDevice->DrawRect(rRect);
         }
 #endif
     }
diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx
index cb0c3d1fa2c5..2c89ca4aabcb 100644
--- a/svx/source/svdraw/svddrgmt.cxx
+++ b/svx/source/svdraw/svddrgmt.cxx
@@ -476,10 +476,9 @@ void SdrDragMethod::createSdrDragEntries_PointDrag()
 
                     if(aPathXPP.count())
                     {
-                        for(SdrUShortCont::const_iterator it = rPts.begin(); it != rPts.end(); ++it)
+                        for(const sal_uInt16 nObjPt : rPts)
                         {
                             sal_uInt32 nPolyNum, nPointNum;
-                            const sal_uInt16 nObjPt = *it;
 
                             if(sdr::PolyPolygonEditor::GetRelativePolyPoint(aPathXPP, nObjPt, nPolyNum, nPointNum))
                             {
@@ -518,9 +517,8 @@ void SdrDragMethod::createSdrDragEntries_GlueDrag()
 
                 if (pGPL)
                 {
-                    for(SdrUShortCont::const_iterator it = rPts.begin(); it != rPts.end(); ++it)
+                    for(const sal_uInt16 nObjPt : rPts)
                     {
-                        const sal_uInt16 nObjPt = *it;
                         const sal_uInt16 nGlueNum(pGPL->FindGluePoint(nObjPt));
 
                         if(SDRGLUEPOINT_NOTFOUND != nGlueNum)
@@ -1620,9 +1618,8 @@ void SdrDragMove::MoveSdrDrag(const Point& rNoSnapPnt_)
                     const SdrGluePointList* pGPL=pObj->GetGluePointList();
                     tools::Rectangle aBound(pObj->GetCurrentBoundRect());
 
-                    for (SdrUShortCont::const_iterator it = rPts.begin(); it != rPts.end(); ++it)
+                    for (sal_uInt16 nId : rPts)
                     {
-                        sal_uInt16 nId = *it;
                         sal_uInt16 nGlueNum=pGPL->FindGluePoint(nId);
 
                         if (nGlueNum!=SDRGLUEPOINT_NOTFOUND)
diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx
index 4c9dc54612b8..732bd1ce63f8 100644
--- a/svx/source/svdraw/svdedtv2.cxx
+++ b/svx/source/svdraw/svdedtv2.cxx
@@ -826,10 +826,8 @@ void SdrEditView::DistributeMarkedObjects(weld::Window* pParent)
                         default: break;
                     }
 
-                    for ( itEntryList = aEntryList.begin();
-                          itEntryList < aEntryList.end() && (*itEntryList)->mnPos < pNew->mnPos;
-                          ++itEntryList )
-                    {};
+                    itEntryList = std::find_if(aEntryList.begin(), aEntryList.end(),
+                        [&pNew](const ImpDistributeEntry* pEntry) { return pEntry->mnPos >= pNew->mnPos; });
                     if ( itEntryList < aEntryList.end() )
                         aEntryList.insert( itEntryList, pNew );
                     else
@@ -921,10 +919,8 @@ void SdrEditView::DistributeMarkedObjects(weld::Window* pParent)
                         default: break;
                     }
 
-                    for ( itEntryList = aEntryList.begin();
-                          itEntryList < aEntryList.end() && (*itEntryList)->mnPos < pNew->mnPos;
-                          ++itEntryList )
-                    {};
+                    itEntryList = std::find_if(aEntryList.begin(), aEntryList.end(),
+                        [&pNew](const ImpDistributeEntry* pEntry) { return pEntry->mnPos >= pNew->mnPos; });
                     if ( itEntryList < aEntryList.end() )
                         aEntryList.insert( itEntryList, pNew );
                     else
diff --git a/svx/source/svdraw/svdglev.cxx b/svx/source/svdraw/svdglev.cxx
index c3badca8c0c6..a160b4610027 100644
--- a/svx/source/svdraw/svdglev.cxx
+++ b/svx/source/svdraw/svdglev.cxx
@@ -61,9 +61,8 @@ void SdrGlueEditView::ImpDoMarkedGluePoints(PGlueDoFunc pDoFunc, bool bConst, co
                 if(!bConst && IsUndoEnabled() )
                     AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
 
-                for(SdrUShortCont::const_iterator it = rPts.begin(); it != rPts.end(); ++it)
+                for(sal_uInt16 nPtId : rPts)
                 {
-                    sal_uInt16 nPtId=*it;
                     sal_uInt16 nGlueIdx=pGPL->FindGluePoint(nPtId);
                     if (nGlueIdx!=SDRGLUEPOINT_NOTFOUND)
                     {
@@ -242,9 +241,8 @@ void SdrGlueEditView::DeleteMarkedGluePoints()
                 if( bUndo )
                     AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
 
-                for(SdrUShortCont::const_iterator it = rPts.begin(); it != rPts.end(); ++it)
+                for(sal_uInt16 nPtId : rPts)
                 {
-                    sal_uInt16 nPtId=*it;
                     sal_uInt16 nGlueIdx=pGPL->FindGluePoint(nPtId);
                     if (nGlueIdx!=SDRGLUEPOINT_NOTFOUND)
                     {
@@ -285,9 +283,8 @@ void SdrGlueEditView::ImpCopyMarkedGluePoints()
 
             SdrUShortCont aIdsToErase;
             SdrUShortCont aIdsToInsert;
-            for(SdrUShortCont::const_iterator it = rPts.begin(); it != rPts.end(); ++it)
+            for(sal_uInt16 nPtId : rPts)
             {
-                sal_uInt16 nPtId=*it;
                 sal_uInt16 nGlueIdx=pGPL->FindGluePoint(nPtId);
                 if (nGlueIdx!=SDRGLUEPOINT_NOTFOUND)
                 {
@@ -298,8 +295,8 @@ void SdrGlueEditView::ImpCopyMarkedGluePoints()
                     aIdsToInsert.insert(nNewId);
                 }
             }
-            for(SdrUShortCont::const_iterator it = aIdsToErase.begin(); it != aIdsToErase.end(); ++it)
-                rPts.erase(*it);
+            for(const auto& rId : aIdsToErase)
+                rPts.erase(rId);
             rPts.insert(aIdsToInsert.begin(), aIdsToInsert.end());
         }
     }
@@ -325,9 +322,8 @@ void SdrGlueEditView::ImpTransformMarkedGluePoints(PGlueTrFunc pTrFunc, const vo
                 if( IsUndoEnabled() )
                     AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
 
-                for(SdrUShortCont::const_iterator it = rPts.begin(); it != rPts.end(); ++it)
+                for(sal_uInt16 nPtId : rPts)
                 {
-                    sal_uInt16 nPtId=*it;
                     sal_uInt16 nGlueIdx=pGPL->FindGluePoint(nPtId);
                     if (nGlueIdx!=SDRGLUEPOINT_NOTFOUND) {
                         SdrGluePoint& rGP=(*pGPL)[nGlueIdx];
diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx
index a53725c6ee1e..93621e714802 100644
--- a/svx/source/svdraw/svdhdl.cxx
+++ b/svx/source/svdraw/svdhdl.cxx
@@ -2184,13 +2184,9 @@ std::unique_ptr<SdrHdl> SdrHdlList::RemoveHdl(size_t nNum)
 
 void SdrHdlList::RemoveAllByKind(SdrHdlKind eKind)
 {
-    for(auto it = maList.begin(); it != maList.end(); )
-    {
-        if ((*it)->GetKind() == eKind)
-            it = maList.erase( it );
-        else
-            ++it;
-    }
+    maList.erase(std::remove_if(maList.begin(), maList.end(),
+        [&eKind](std::unique_ptr<SdrHdl>& rItem) { return rItem->GetKind() == eKind; }),
+        maList.end());
 }
 
 void SdrHdlList::Clear()
diff --git a/svx/source/svdraw/svdmark.cxx b/svx/source/svdraw/svdmark.cxx
index 5c2760f495d8..c1b591404d3f 100644
--- a/svx/source/svdraw/svdmark.cxx
+++ b/svx/source/svdraw/svdmark.cxx
@@ -161,15 +161,9 @@ void SdrMarkList::ImpForceSort()
         // remove invalid
         if(nCount > 0 )
         {
-            for(auto it = maList.begin(); it != maList.end(); )
-            {
-                if(it->get()->GetMarkedSdrObj() == nullptr)
-                {
-                    it = maList.erase( it );
-                }
-                else
-                    ++it;
-            }
+            maList.erase(std::remove_if(maList.begin(), maList.end(),
+                [](std::unique_ptr<SdrMark>& rItem) { return rItem.get()->GetMarkedSdrObj() == nullptr; }),
+                maList.end());
             nCount = maList.size();
         }
 
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index 6123ce0e8a98..00475d96a959 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -947,9 +947,8 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell)
 
         SdrPageView* pPV=pM->GetPageView();
         const SdrUShortCont& rMrkGlue=pM->GetMarkedGluePoints();
-        for (SdrUShortCont::const_iterator it = rMrkGlue.begin(); it != rMrkGlue.end(); ++it)
+        for (sal_uInt16 nId : rMrkGlue)
         {
-            sal_uInt16 nId=*it;
             //nNum changed to nNumGP because already used in for loop
             sal_uInt16 nNumGP=pGPL->FindGluePoint(nId);
             if (nNumGP!=SDRGLUEPOINT_NOTFOUND)
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index 9bacffb665c7..4f04204be823 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -1498,27 +1498,26 @@ void SdrObjCustomShape::NbcResize( const Point& rRef, const Fraction& rxFact, co
         }
     }
 
-    for (std::vector< SdrCustomShapeInteraction >::const_iterator aIter( aInteractionHandles.begin() ), aEnd( aInteractionHandles.end() );
-         aIter != aEnd; ++aIter )
+    for (const auto& rInteraction : aInteractionHandles)
     {
         try
         {
-            if ( aIter->nMode & CustomShapeHandleModes::RESIZE_FIXED )
-                aIter->xInteraction->setControllerPosition( aIter->aPosition );
-            if ( aIter->nMode & CustomShapeHandleModes::RESIZE_ABSOLUTE_X )
+            if ( rInteraction.nMode & CustomShapeHandleModes::RESIZE_FIXED )
+                rInteraction.xInteraction->setControllerPosition( rInteraction.aPosition );
+            if ( rInteraction.nMode & CustomShapeHandleModes::RESIZE_ABSOLUTE_X )
             {
-                sal_Int32 nX = ( aIter->aPosition.X - aOld.Left() ) + maRect.Left();
-                aIter->xInteraction->setControllerPosition( css::awt::Point( nX, aIter->xInteraction->getPosition().Y ) );
+                sal_Int32 nX = ( rInteraction.aPosition.X - aOld.Left() ) + maRect.Left();
+                rInteraction.xInteraction->setControllerPosition( css::awt::Point( nX, rInteraction.xInteraction->getPosition().Y ) );
             }
-            else if ( aIter->nMode & CustomShapeHandleModes::RESIZE_ABSOLUTE_NEGX )
+            else if ( rInteraction.nMode & CustomShapeHandleModes::RESIZE_ABSOLUTE_NEGX )
             {
-                sal_Int32 nX = maRect.Right() - (aOld.Right() - aIter->aPosition.X);
-                aIter->xInteraction->setControllerPosition( css::awt::Point( nX, aIter->xInteraction->getPosition().Y ) );
+                sal_Int32 nX = maRect.Right() - (aOld.Right() - rInteraction.aPosition.X);
+                rInteraction.xInteraction->setControllerPosition( css::awt::Point( nX, rInteraction.xInteraction->getPosition().Y ) );
             }
-            if ( aIter->nMode & CustomShapeHandleModes::RESIZE_ABSOLUTE_Y )
+            if ( rInteraction.nMode & CustomShapeHandleModes::RESIZE_ABSOLUTE_Y )
             {
-                sal_Int32 nY = ( aIter->aPosition.Y - aOld.Top() ) + maRect.Top();
-                aIter->xInteraction->setControllerPosition( css::awt::Point( aIter->xInteraction->getPosition().X, nY ) );
+                sal_Int32 nY = ( rInteraction.aPosition.Y - aOld.Top() ) + maRect.Top();
+                rInteraction.xInteraction->setControllerPosition( css::awt::Point( rInteraction.xInteraction->getPosition().X, nY ) );
             }
         }
         catch ( const uno::RuntimeException& )
@@ -1911,23 +1910,22 @@ void SdrObjCustomShape::DragResizeCustomShape( const tools::Rectangle& rNewRect
             NbcMirror( aLeft, aRight );
         }
 
-        for (std::vector< SdrCustomShapeInteraction >::const_iterator aIter( aInteractionHandles.begin() ), aEnd( aInteractionHandles.end() );
-             aIter != aEnd ; ++aIter )
+        for (const auto& rInteraction : aInteractionHandles)
         {
             try
             {
-                if ( aIter->nMode & CustomShapeHandleModes::RESIZE_FIXED )
-                    aIter->xInteraction->setControllerPosition( aIter->aPosition );
-                if ( aIter->nMode & CustomShapeHandleModes::RESIZE_ABSOLUTE_X ||
-                     aIter->nMode & CustomShapeHandleModes::RESIZE_ABSOLUTE_NEGX )
+                if ( rInteraction.nMode & CustomShapeHandleModes::RESIZE_FIXED )
+                    rInteraction.xInteraction->setControllerPosition( rInteraction.aPosition );
+                if ( rInteraction.nMode & CustomShapeHandleModes::RESIZE_ABSOLUTE_X ||
+                     rInteraction.nMode & CustomShapeHandleModes::RESIZE_ABSOLUTE_NEGX )
                 {
-                    if (aIter->nMode & CustomShapeHandleModes::RESIZE_ABSOLUTE_NEGX)
+                    if (rInteraction.nMode & CustomShapeHandleModes::RESIZE_ABSOLUTE_NEGX)
                         bOldMirroredX = !bOldMirroredX;
 
                     sal_Int32 nX;
                     if ( bOldMirroredX )
                     {
-                        nX = ( aIter->aPosition.X - aOld.Right() );
+                        nX = ( rInteraction.aPosition.X - aOld.Right() );
                         if ( rNewRect.Left() > rNewRect.Right() )
                             nX = maRect.Left() - nX;
                         else
@@ -1935,20 +1933,20 @@ void SdrObjCustomShape::DragResizeCustomShape( const tools::Rectangle& rNewRect
                     }
                     else
                     {
-                        nX = ( aIter->aPosition.X - aOld.Left() );
+                        nX = ( rInteraction.aPosition.X - aOld.Left() );
                         if ( rNewRect.Left() > rNewRect.Right() )
                             nX = maRect.Right() - nX;
                         else
                             nX += maRect.Left();
                     }
-                    aIter->xInteraction->setControllerPosition( css::awt::Point( nX, aIter->xInteraction->getPosition().Y ) );
+                    rInteraction.xInteraction->setControllerPosition( css::awt::Point( nX, rInteraction.xInteraction->getPosition().Y ) );
                 }
-                if ( aIter->nMode & CustomShapeHandleModes::RESIZE_ABSOLUTE_Y )
+                if ( rInteraction.nMode & CustomShapeHandleModes::RESIZE_ABSOLUTE_Y )
                 {
                     sal_Int32 nY;
                     if ( bOldMirroredY )
                     {
-                        nY = ( aIter->aPosition.Y - aOld.Bottom() );
+                        nY = ( rInteraction.aPosition.Y - aOld.Bottom() );
                         if ( rNewRect.Top() > rNewRect.Bottom() )
                             nY = maRect.Top() - nY;
                         else
@@ -1956,13 +1954,13 @@ void SdrObjCustomShape::DragResizeCustomShape( const tools::Rectangle& rNewRect
                     }
                     else
                     {
-                        nY = ( aIter->aPosition.Y - aOld.Top() );
+                        nY = ( rInteraction.aPosition.Y - aOld.Top() );
                         if ( rNewRect.Top() > rNewRect.Bottom() )
                             nY = maRect.Bottom() - nY;
                         else
                             nY += maRect.Top();
                     }
-                    aIter->xInteraction->setControllerPosition( css::awt::Point( aIter->xInteraction->getPosition().X, nY ) );
+                    rInteraction.xInteraction->setControllerPosition( css::awt::Point( rInteraction.xInteraction->getPosition().X, nY ) );
                 }
             }
             catch ( const uno::RuntimeException& )
@@ -1995,13 +1993,12 @@ void SdrObjCustomShape::DragMoveCustomShapeHdl( const Point& rDestination,
                     SetRectsDirty(true);
                     InvalidateRenderGeometry();
 
-                    for (std::vector< SdrCustomShapeInteraction >::const_iterator aIter( aInteractionHandles.begin() ), aEnd( aInteractionHandles.end() ) ;
-                      aIter != aEnd; ++aIter)
+                    for (const auto& rInteraction : aInteractionHandles)
                     {
-                        if ( aIter->nMode & CustomShapeHandleModes::RESIZE_FIXED )
+                        if ( rInteraction.nMode & CustomShapeHandleModes::RESIZE_FIXED )
                         {
-                            if ( aIter->xInteraction.is() )
-                                aIter->xInteraction->setControllerPosition( aIter->aPosition );
+                            if ( rInteraction.xInteraction.is() )
+                                rInteraction.xInteraction->setControllerPosition( rInteraction.aPosition );
                         }
                     }
                 }
@@ -2082,13 +2079,12 @@ void SdrObjCustomShape::DragCreateObject( SdrDragStat& rStat )
     maRect = aRect1;
     SetRectsDirty();
 
-    for (std::vector< SdrCustomShapeInteraction >::const_iterator aIter( aInteractionHandles.begin() ), aEnd( aInteractionHandles.end() );
-        aIter != aEnd ; ++aIter)
+    for (const auto& rInteraction : aInteractionHandles)
     {
         try
         {
-            if ( aIter->nMode & CustomShapeHandleModes::CREATE_FIXED )
-                aIter->xInteraction->setControllerPosition( awt::Point( rStat.GetStart().X(), rStat.GetStart().Y() ) );
+            if ( rInteraction.nMode & CustomShapeHandleModes::CREATE_FIXED )
+                rInteraction.xInteraction->setControllerPosition( awt::Point( rStat.GetStart().X(), rStat.GetStart().Y() ) );
         }
         catch ( const uno::RuntimeException& )
         {
@@ -2412,13 +2408,12 @@ bool SdrObjCustomShape::NbcAdjustTextFrameWidthAndHeight(bool bHgt, bool bWdt)
         SetRectsDirty();
         SetChanged();
 
-        for (std::vector< SdrCustomShapeInteraction >::const_iterator aIter( aInteractionHandles.begin() ), aEnd ( aInteractionHandles.end() );
-            aIter != aEnd ; ++aIter)
+        for (const auto& rInteraction : aInteractionHandles)
         {
             try
             {
-                if ( aIter->nMode & CustomShapeHandleModes::RESIZE_FIXED )
-                    aIter->xInteraction->setControllerPosition( aIter->aPosition );
+                if ( rInteraction.nMode & CustomShapeHandleModes::RESIZE_FIXED )
+                    rInteraction.xInteraction->setControllerPosition( rInteraction.aPosition );
             }
             catch ( const uno::RuntimeException& )
             {
@@ -2447,13 +2442,12 @@ bool SdrObjCustomShape::AdjustTextFrameWidthAndHeight()
         maRect = aNewTextRect;
         SetRectsDirty();
 
-        for (std::vector< SdrCustomShapeInteraction >::const_iterator aIter( aInteractionHandles.begin() ), aEnd( aInteractionHandles.end() ) ;
-            aIter != aEnd ; ++aIter)
+        for (const auto& rInteraction : aInteractionHandles)
         {
             try
             {
-                if ( aIter->nMode & CustomShapeHandleModes::RESIZE_FIXED )
-                    aIter->xInteraction->setControllerPosition( aIter->aPosition );
+                if ( rInteraction.nMode & CustomShapeHandleModes::RESIZE_FIXED )
+                    rInteraction.xInteraction->setControllerPosition( rInteraction.aPosition );
             }
             catch ( const uno::RuntimeException& )
             {
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index 4306767a56be..cb104cba5358 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -390,9 +390,8 @@ SdrObject::~SdrObject()
 {
     // tell all the registered ObjectUsers that the page is in destruction
     sdr::ObjectUserVector aListCopy(mpImpl->maObjectUsers.begin(), mpImpl->maObjectUsers.end());
-    for(sdr::ObjectUserVector::iterator aIterator = aListCopy.begin(); aIterator != aListCopy.end(); ++aIterator)
+    for(sdr::ObjectUser* pObjectUser : aListCopy)
     {
-        sdr::ObjectUser* pObjectUser = *aIterator;
         DBG_ASSERT(pObjectUser, "SdrObject::~SdrObject: corrupt ObjectUser list (!)");
         pObjectUser->ObjectInDestruction(*this);
     }
diff --git a/svx/source/svdraw/svdotextpathdecomposition.cxx b/svx/source/svdraw/svdotextpathdecomposition.cxx
index 770bd440a86a..bb70c3e8e9c4 100644
--- a/svx/source/svdraw/svdotextpathdecomposition.cxx
+++ b/svx/source/svdraw/svdotextpathdecomposition.cxx
@@ -567,10 +567,10 @@ namespace
         const drawinglayer::attribute::StrokeAttribute& rStrokeAttribute,
         std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& rTarget)
     {
-        for(basegfx::B2DPolyPolygonVector::const_iterator aPolygon(rB2DPolyPolyVector.begin()); aPolygon != rB2DPolyPolyVector.end(); ++aPolygon)
+        for(const auto& rB2DPolyPolygon : rB2DPolyPolyVector)
         {
             // prepare PolyPolygons
-            basegfx::B2DPolyPolygon aB2DPolyPolygon = *aPolygon;
+            basegfx::B2DPolyPolygon aB2DPolyPolygon = rB2DPolyPolygon;
             aB2DPolyPolygon.transform(rTransform);
 
             for(auto const& rPolygon : aB2DPolyPolygon)
diff --git a/svx/source/svdraw/svdotxat.cxx b/svx/source/svdraw/svdotxat.cxx
index 7a3490e3722d..b83732f51b30 100644
--- a/svx/source/svdraw/svdotxat.cxx
+++ b/svx/source/svdraw/svdotxat.cxx
@@ -376,8 +376,7 @@ void SdrTextObj::ImpSetTextStyleSheetListeners()
             }
         }
         // and finally, merge all stylesheets that are contained in aStyles with previous broadcasters
-        for(std::set<SfxStyleSheet*>::const_iterator it = aStyleSheets.begin(); it != aStyleSheets.end(); ++it) {
-            SfxStyleSheet* pStyle=*it;
+        for(SfxStyleSheet* pStyle : aStyleSheets) {
             // let StartListening see for itself if there's already a listener registered
             StartListening(*pStyle, DuplicateHandling::Prevent);
         }
@@ -411,10 +410,9 @@ void SdrTextObj::RemoveOutlinerCharacterAttribs( const std::vector<sal_uInt16>&
             }
 
             ESelection aSelAll( 0, 0, EE_PARA_ALL, EE_TEXTPOS_ALL );
-            std::vector<sal_uInt16>::const_iterator aIter( rCharWhichIds.begin() );
-            while( aIter != rCharWhichIds.end() )
+            for( const auto& rWhichId : rCharWhichIds )
             {
-                pOutliner->RemoveAttribs( aSelAll, false, (*aIter++) );
+                pOutliner->RemoveAttribs( aSelAll, false, rWhichId );
             }
 
             if(!pEdtOutl || (pText != getActiveText()) )
diff --git a/svx/source/svdraw/svdouno.cxx b/svx/source/svdraw/svdouno.cxx
index 38ea6471ebe4..390baaab60ef 100644
--- a/svx/source/svdraw/svdouno.cxx
+++ b/svx/source/svdraw/svdouno.cxx
@@ -384,22 +384,15 @@ void SdrUnoObj::NbcSetLayer( SdrLayerID _nLayer )
     }
 
     // now aPreviouslyVisible contains all views where we became invisible
-    ::std::set< SdrView* >::const_iterator aLoopViews;
-    for (   aLoopViews = aPreviouslyVisible.begin();
-            aLoopViews != aPreviouslyVisible.end();
-            ++aLoopViews
-        )
+    for (const auto& rpView : aPreviouslyVisible)
     {
-        lcl_ensureControlVisibility( *aLoopViews, this, false );
+        lcl_ensureControlVisibility( rpView, this, false );
     }
 
     // and aNewlyVisible all views where we became visible
-    for (   aLoopViews = aNewlyVisible.begin();
-            aLoopViews != aNewlyVisible.end();
-            ++aLoopViews
-        )
+    for (const auto& rpView : aNewlyVisible)
     {
-        lcl_ensureControlVisibility( *aLoopViews, this, true );
+        lcl_ensureControlVisibility( rpView, this, true );
     }
 }
 
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
index c56b06d6c954..5e38b25e043f 100644
--- a/svx/source/svdraw/svdpage.cxx
+++ b/svx/source/svdraw/svdpage.cxx
@@ -786,11 +786,12 @@ bool SdrObjList::RecalcNavigationPositions()
         {
             mbIsNavigationOrderDirty = false;
 
-            WeakSdrObjectContainerType::iterator iObject;
-            WeakSdrObjectContainerType::const_iterator iEnd (mxNavigationOrder->end());
             sal_uInt32 nIndex (0);
-            for (iObject=mxNavigationOrder->begin(); iObject!=iEnd; ++iObject,++nIndex)
-                (*iObject)->SetNavigationPosition(nIndex);
+            for (auto& rpObject : *mxNavigationOrder)
+            {
+                rpObject->SetNavigationPosition(nIndex);
+                ++nIndex;
+            }
         }
     }
 
@@ -1132,9 +1133,8 @@ SdrPage::~SdrPage()
     // of page users.  Therefore we have to use a copy of the list for the
     // iteration.
     sdr::PageUserVector aListCopy (maPageUsers.begin(), maPageUsers.end());
-    for(sdr::PageUserVector::iterator aIterator = aListCopy.begin(); aIterator != aListCopy.end(); ++aIterator)
+    for(sdr::PageUser* pPageUser : aListCopy)
     {
-        sdr::PageUser* pPageUser = *aIterator;
         DBG_ASSERT(pPageUser, "SdrPage::~SdrPage: corrupt PageUser list (!)");
         pPageUser->PageInDestruction(*this);
     }
diff --git a/svx/source/svdraw/svdpagv.cxx b/svx/source/svdraw/svdpagv.cxx
index 6f2720601d77..ed73fadf7acd 100644
--- a/svx/source/svdraw/svdpagv.cxx
+++ b/svx/source/svdraw/svdpagv.cxx
@@ -146,14 +146,12 @@ void SdrPageView::AddPaintWindowToPageView(SdrPaintWindow& rPaintWindow)
 
 void SdrPageView::RemovePaintWindowFromPageView(SdrPaintWindow& rPaintWindow)
 {
-    for(auto it = maPageWindows.begin(); it != maPageWindows.end(); ++it)
-    {
-        if(&((*it)->GetPaintWindow()) == &rPaintWindow)
-        {
-            maPageWindows.erase(it);
-            break;
-        }
-    }
+    auto it = std::find_if(maPageWindows.begin(), maPageWindows.end(),
+        [&rPaintWindow](const std::unique_ptr<SdrPageWindow>& rpWindow) {
+            return &(rpWindow->GetPaintWindow()) == &rPaintWindow;
+        });
+    if (it != maPageWindows.end())
+        maPageWindows.erase(it);
 }
 
 css::uno::Reference< css::awt::XControlContainer > SdrPageView::GetControlContainer( const OutputDevice& _rDevice ) const
diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx
index e40fe93eed7f..e03397d8d285 100644
--- a/svx/source/svdraw/svdpntv.cxx
+++ b/svx/source/svdraw/svdpntv.cxx
@@ -67,13 +67,10 @@ using namespace ::com::sun::star;
 
 SdrPaintWindow* SdrPaintView::FindPaintWindow(const OutputDevice& rOut) const
 {
-    for(SdrPaintWindowVector::const_iterator a = maPaintWindows.begin(); a != maPaintWindows.end(); ++a)
-    {
-        if(&((*a)->GetOutputDevice()) == &rOut)
-        {
-            return *a;
-        }
-    }
+    auto a = std::find_if(maPaintWindows.begin(), maPaintWindows.end(),
+        [&rOut](const SdrPaintWindow* pWindow) { return &(pWindow->GetOutputDevice()) == &rOut; });
+    if (a != maPaintWindows.end())
+        return *a;
 
     return nullptr;
 }
@@ -578,9 +575,9 @@ void SdrPaintView::CompleteRedraw(OutputDevice* pOut, const vcl::Region& rReg, s
                     pWindow->SetLineColor(COL_LIGHTGREEN);
                     pWindow->SetFillColor();
 
-                    for(RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); ++aRectIter)
+                    for(const auto& rRect : aRectangles)
                     {
-                        pWindow->DrawRect(*aRectIter);
+                        pWindow->DrawRect(rRect);
                     }
 
                     //RegionHandle aRegionHandle(aOptimizedRepaintRegion.BeginEnumRects());
diff --git a/svx/source/svdraw/svdpoev.cxx b/svx/source/svdraw/svdpoev.cxx
index cc9b8005fe2c..e04f8f8ca13c 100644
--- a/svx/source/svdraw/svdpoev.cxx
+++ b/svx/source/svdraw/svdpoev.cxx
@@ -98,9 +98,9 @@ void SdrPolyEditView::CheckPolyPossibilitiesHelper( SdrMark* pM, bool& b1stSmoot
         bSetMarkedSegmentsKindPossible = true;
     }
 
-    for (SdrUShortCont::const_iterator it = rPts.begin(); it != rPts.end(); ++it)
+    for (const auto& rPt : rPts)
     {
-        sal_uInt32 nNum(*it);
+        sal_uInt32 nNum(rPt);
         sal_uInt32 nPolyNum, nPntNum;
 
         if(PolyPolygonEditor::GetRelativePolyPoint(pPath->GetPathPoly(), nNum, nPolyNum, nPntNum))
@@ -384,9 +384,9 @@ void SdrPolyEditView::RipUpAtMarkedPoints()
                         bCorrectionFlag = true;
 
                         SdrUShortCont aReplaceSet;
-                        for(SdrUShortCont::const_iterator it2 = rPts.begin(); it2 != rPts.end(); ++it2)
+                        for(const auto& rPt : rPts)
                         {
-                            sal_uInt32 nPntNum(*it2);
+                            sal_uInt32 nPntNum(rPt);
                             nPntNum += nNewPt0Idx;
 
                             if(nPntNum >= nMax)
@@ -439,15 +439,11 @@ bool SdrPolyEditView::IsRipUpAtMarkedPointsPossible() const
 
             if(nPointCount >= 3)
             {
-                bRetval = pMarkedPathObject->IsClosedObj(); // #i76617#
-
-                for(SdrUShortCont::const_iterator it = rSelectedPoints.begin();
-                    !bRetval && it != rSelectedPoints.end(); ++it)
-                {
-                    const sal_uInt16 nMarkedPointNum(*it);
-
-                    bRetval = (nMarkedPointNum > 0 && nMarkedPointNum < nPointCount - 1);
-                }
+                bRetval = pMarkedPathObject->IsClosedObj() // #i76617#
+                    || std::any_of(rSelectedPoints.begin(), rSelectedPoints.end(),
+                        [nPointCount](const sal_uInt16 nMarkedPointNum) {
+                            return nMarkedPointNum > 0 && nMarkedPointNum < nPointCount - 1;
+                        });
             }
         }
     }
@@ -545,9 +541,9 @@ void SdrPolyEditView::ImpTransformMarkedPoints(PPolyTrFunc pTrFunc, const void*
 
         basegfx::B2DPolyPolygon aXPP(pPath->GetPathPoly());
 
-        for (SdrUShortCont::const_iterator it = rPts.begin(); it != rPts.end(); ++it)
+        for (const auto& rPt : rPts)
         {
-            sal_uInt32 nPt = *it;
+            sal_uInt32 nPt = rPt;
             sal_uInt32 nPolyNum, nPointNum;
 
             if(PolyPolygonEditor::GetRelativePolyPoint(aXPP, nPt, nPolyNum, nPointNum))
diff --git a/svx/source/table/accessibletableshape.cxx b/svx/source/table/accessibletableshape.cxx
index 5f4a82a0d00f..7a17b1027768 100644
--- a/svx/source/table/accessibletableshape.cxx
+++ b/svx/source/table/accessibletableshape.cxx
@@ -126,9 +126,9 @@ void AccessibleTableShapeImpl::dispose()
     if( mxTable.is() )
     {
         //remove all the cell's acc object in table's dispose.
-        for( AccessibleCellMap::iterator iter( maChildMap.begin() ); iter != maChildMap.end(); ++iter )
+        for( auto& rEntry : maChildMap )
         {
-            (*iter).second->dispose();
+            rEntry.second->dispose();
         }
         maChildMap.clear();
         Reference< XModifyListener > xListener( this );
@@ -302,9 +302,9 @@ void SAL_CALL AccessibleTableShapeImpl::modified( const EventObject& /*aEvent*/
         // all accessible cell instances still left in aTempChildMap must be disposed
         // as they are no longer part of the table
 
-        for( AccessibleCellMap::iterator iter( aTempChildMap.begin() ); iter != aTempChildMap.end(); ++iter )
+        for( auto& rEntry : aTempChildMap )
         {
-            (*iter).second->dispose();
+            rEntry.second->dispose();
         }
         //notify bridge to update the acc cache.
         AccessibleTableShape *pAccTable = dynamic_cast <AccessibleTableShape *> (mxAccessible.get());
diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx
index 8eba9c1b4cd8..d2908706168a 100644
--- a/svx/source/table/cell.cxx
+++ b/svx/source/table/cell.cxx
@@ -260,9 +260,9 @@ namespace sdr
                         SfxItemSet aSet(pOutliner->GetParaAttribs(nPara));
                         aSet.Put(rSet);
 
-                        for (std::vector<sal_uInt16>::const_iterator aI = aCharWhichIds.begin(); aI != aCharWhichIds.end(); ++aI)
+                        for (const auto& rWhichId : aCharWhichIds)
                         {
-                            pOutliner->RemoveCharAttribs(nPara, *aI);
+                            pOutliner->RemoveCharAttribs(nPara, rWhichId);
                         }
 
                         pOutliner->SetParaAttribs(nPara, aSet);
diff --git a/svx/source/table/propertyset.cxx b/svx/source/table/propertyset.cxx
index 1b5e081e444b..643a4879d907 100644
--- a/svx/source/table/propertyset.cxx
+++ b/svx/source/table/propertyset.cxx
@@ -42,10 +42,8 @@ void FastPropertySetInfo::addProperties( const PropertyVector& rProps )
     sal_uInt32 nIndex = maProperties.size();
     sal_uInt32 nCount = rProps.size();
     maProperties.resize( nIndex + nCount );
-    PropertyVector::const_iterator aIter( rProps.begin() );
-    while( nCount-- )
+    for( const Property& rProperty : rProps )
     {
-        const Property& rProperty = (*aIter++);
         maProperties[nIndex] = rProperty;
         maMap[ rProperty.Name ] = nIndex++;
     }
diff --git a/svx/source/table/tabledesign.cxx b/svx/source/table/tabledesign.cxx
index 69701ad708d7..770944c0dc28 100644
--- a/svx/source/table/tabledesign.cxx
+++ b/svx/source/table/tabledesign.cxx
@@ -487,13 +487,10 @@ Any SAL_CALL TableDesignFamily::getByName( const OUString& rName )
 {
     SolarMutexGuard aGuard;
 
-    const TableDesignStyleVector::const_iterator aEnd( maDesigns.end() );
-    for( TableDesignStyleVector::const_iterator iter( maDesigns.begin() );
-        iter != aEnd; ++iter)
-    {
-        if( (*iter)->getName() == rName )
-            return Any( (*iter) );
-    }
+    auto iter = std::find_if(maDesigns.begin(), maDesigns.end(),
+        [&rName](const Reference<XStyle>& rpStyle) { return rpStyle->getName() == rName; });
+    if (iter != maDesigns.end())
+        return Any( (*iter) );
 
     throw NoSuchElementException();
 }
@@ -506,10 +503,8 @@ Sequence< OUString > SAL_CALL TableDesignFamily::getElementNames()
     Sequence< OUString > aRet( maDesigns.size() );
     OUString* pNames = aRet.getArray();
 
-    const TableDesignStyleVector::const_iterator aEnd( maDesigns.end() );
-    for( TableDesignStyleVector::const_iterator iter( maDesigns.begin() );
-         iter != aEnd; ++iter)
-        *pNames++ = (*iter)->getName();
+    for( const auto& rpStyle : maDesigns )
+        *pNames++ = rpStyle->getName();
 
     return aRet;
 }
@@ -519,13 +514,8 @@ sal_Bool SAL_CALL TableDesignFamily::hasByName( const OUString& aName )
 {
     SolarMutexGuard aGuard;
 
-    const TableDesignStyleVector::const_iterator aEnd( maDesigns.end() );
-    for( TableDesignStyleVector::const_iterator iter( maDesigns.begin() );
-        iter != aEnd; ++iter)
-        if( (*iter)->getName() == aName )
-            return true;
-
-    return false;
+    return std::any_of(maDesigns.begin(), maDesigns.end(),
+        [&aName](const Reference<XStyle>& rpStyle) { return rpStyle->getName() == aName; });
 }
 
 
@@ -580,11 +570,9 @@ void SAL_CALL TableDesignFamily::insertByName( const OUString& rName, const Any&
         throw IllegalArgumentException();
 
     xStyle->setName( rName );
-    const TableDesignStyleVector::const_iterator aEnd( maDesigns.end() );
-    for( TableDesignStyleVector::const_iterator iter( maDesigns.begin() );
-        iter != aEnd; ++iter)
-        if( (*iter)->getName() == rName )
-            throw ElementExistException();
+    if (std::any_of(maDesigns.begin(), maDesigns.end(),
+            [&rName](const Reference<XStyle>& rpStyle) { return rpStyle->getName() == rName; }))
+        throw ElementExistException();
 
     maDesigns.push_back( xStyle );
 }
@@ -594,18 +582,14 @@ void SAL_CALL TableDesignFamily::removeByName( const OUString& rName )
 {
     SolarMutexGuard aGuard;
 
-    const TableDesignStyleVector::const_iterator aEnd( maDesigns.end() );
-    for( TableDesignStyleVector::iterator iter( maDesigns.begin() );
-        iter != aEnd; ++iter)
+    auto iter = std::find_if(maDesigns.begin(), maDesigns.end(),
+        [&rName](const Reference<XStyle>& rpStyle) { return rpStyle->getName() == rName; });
+    if (iter != maDesigns.end())
     {
-        if( (*iter)->getName() == rName )
-        {
-            maDesigns.erase( iter );
-            return;
-        }
+        maDesigns.erase( iter );
+        return;
     }
 
-
     throw NoSuchElementException();
 }
 
@@ -621,16 +605,13 @@ void SAL_CALL TableDesignFamily::replaceByName( const OUString& rName, const Any
     if( !xStyle.is() )
         throw IllegalArgumentException();
 
-    const TableDesignStyleVector::const_iterator aEnd( maDesigns.end() );
-    for( TableDesignStyleVector::iterator iter( maDesigns.begin() );
-        iter != aEnd; ++iter)
+    auto iter = std::find_if(maDesigns.begin(), maDesigns.end(),
+        [&rName](const Reference<XStyle>& rpStyle) { return rpStyle->getName() == rName; });
+    if (iter != maDesigns.end())
     {
-        if( (*iter)->getName() == rName )
-        {
-            (*iter) = xStyle;
-            xStyle->setName( rName );
-            return;
-        }
+        (*iter) = xStyle;
+        xStyle->setName( rName );
+        return;
     }
 
     throw NoSuchElementException();
@@ -662,9 +643,9 @@ void SAL_CALL TableDesignFamily::dispose(  )
     TableDesignStyleVector aDesigns;
     aDesigns.swap( maDesigns );
 
-    for( TableDesignStyleVector::iterator iter( aDesigns.begin() ); iter != aDesigns.end(); ++iter )
+    for( const auto& rStyle : aDesigns )
     {
-        Reference< XComponent > xComp( (*iter), UNO_QUERY );
+        Reference< XComponent > xComp( rStyle, UNO_QUERY );
         if( xComp.is() )
             xComp->dispose();
     }
diff --git a/svx/source/table/tablehandles.cxx b/svx/source/table/tablehandles.cxx
index 4d2dec6fd78f..accbad2739d0 100644
--- a/svx/source/table/tablehandles.cxx
+++ b/svx/source/table/tablehandles.cxx
@@ -119,12 +119,9 @@ void TableEdgeHdl::getPolyPolygon(basegfx::B2DPolyPolygon& rVisible, basegfx::B2
 
     basegfx::B2DPoint aStart(aOffset), aEnd(aOffset);
     int nPos = mbHorizontal ? 0 : 1;
-    TableEdgeVector::const_iterator aIter( maEdges.begin() );
 
-    while( aIter != maEdges.end() )
+    for( const TableEdge& aEdge : maEdges )
     {
-        TableEdge aEdge(*aIter++);
-
         aStart[nPos] = aOffset[nPos] + aEdge.mnStart;
         aEnd[nPos] = aOffset[nPos] + aEdge.mnEnd;
 
diff --git a/svx/source/table/tablelayouter.cxx b/svx/source/table/tablelayouter.cxx
index 4012f2fa429a..5560d86e57e0 100644
--- a/svx/source/table/tablelayouter.cxx
+++ b/svx/source/table/tablelayouter.cxx
@@ -643,13 +643,11 @@ void TableLayouter::LayoutTableWidth( tools::Rectangle& rArea, bool bFit )
     for( nCol = 1; nCol < nColCount; ++nCol )
     {
         bool bChanges = false;
-        MergeableCellVector::iterator iter( aMergedCells[nCol].begin() );
 
         const sal_Int32 nOldSize = maColumns[nCol].mnSize;
 
-        while( iter != aMergedCells[nCol].end() )
+        for( const CellRef& xCell : aMergedCells[nCol] )
         {
-            CellRef xCell( (*iter++) );
             sal_Int32 nMinWidth = xCell->getMinimumWidth();
 
             for( sal_Int32 nMCol = nCol - xCell->getColumnSpan() + 1; (nMCol > 0) && (nMCol < nCol); ++nMCol )
@@ -806,10 +804,8 @@ void TableLayouter::LayoutTableHeight( tools::Rectangle& rArea, bool bFit )
         bool bChanges = false;
         sal_Int32 nOldSize = maRows[nRow].mnSize;
 
-        MergeableCellVector::iterator iter( aMergedCells[nRow].begin() );
-        while( iter != aMergedCells[nRow].end() )
+        for( const CellRef& xCell : aMergedCells[nRow] )
         {
-            CellRef xCell( (*iter++) );
             sal_Int32 nMinHeight = xCell->getMinimumHeight();
 
             for( sal_Int32 nMRow = nRow - xCell->getRowSpan() + 1; (nMRow > 0) && (nMRow < nRow); ++nMRow )
diff --git a/svx/source/table/tablemodel.cxx b/svx/source/table/tablemodel.cxx
index 1b934d7731b1..386d00b455b6 100644
--- a/svx/source/table/tablemodel.cxx
+++ b/svx/source/table/tablemodel.cxx
@@ -88,10 +88,8 @@ template< class Vec, class Iter, class Entry > static sal_Int32 insert_range( Ve
         else
         {
             // insert
-            sal_Int32 nFind = nIndex;
             Iter aIter( rVector.begin() );
-            while( nFind-- )
-                ++aIter;
+            std::advance( aIter, nIndex );
 
             Entry aEmpty;
             rVector.insert( aIter, nCount, aEmpty );
@@ -499,17 +497,15 @@ void TableModel::disposing()
 {
     if( !maRows.empty() )
     {
-        RowVector::iterator aIter( maRows.begin() );
-        while( aIter != maRows.end() )
-            (*aIter++)->dispose();
+        for( auto& rpRow : maRows )
+            rpRow->dispose();
         RowVector().swap(maRows);
     }
 
     if( !maColumns.empty() )
     {
-        ColumnVector::iterator aIter( maColumns.begin() );
-        while( aIter != maColumns.end() )
-            (*aIter++)->dispose();
+        for( auto& rpCol : maColumns )
+            rpCol->dispose();
         ColumnVector().swap(maColumns);
     }
 
@@ -1091,20 +1087,18 @@ void TableModel::merge( sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nColSpan, sal_
 void TableModel::updateRows()
 {
     sal_Int32 nRow = 0;
-    RowVector::iterator iter = maRows.begin();
-    while( iter != maRows.end() )
+    for( auto& rpRow : maRows )
     {
-        (*iter++)->mnRow = nRow++;
+        rpRow->mnRow = nRow++;
     }
 }
 
 void TableModel::updateColumns()
 {
     sal_Int32 nColumn = 0;
-    ColumnVector::iterator iter = maColumns.begin();
-    while( iter != maColumns.end() )
+    for( auto& rpCol : maColumns )
     {
-        (*iter++)->mnColumn = nColumn++;
+        rpCol->mnColumn = nColumn++;
     }
 }
 
diff --git a/svx/source/table/tablerow.cxx b/svx/source/table/tablerow.cxx
index d1dd1f371800..f7ca4d8d40d0 100644
--- a/svx/source/table/tablerow.cxx
+++ b/svx/source/table/tablerow.cxx
@@ -73,9 +73,8 @@ void TableRow::dispose()
     mxTableModel.clear();
     if( !maCells.empty() )
     {
-        CellVector::iterator aIter( maCells.begin() );
-        while( aIter != maCells.end() )
-            (*aIter++)->dispose();
+        for( auto& rpCell : maCells )
+            rpCell->dispose();
         CellVector().swap(maCells);
     }
 }
@@ -128,8 +127,7 @@ void TableRow::removeColumns( sal_Int32 nIndex, sal_Int32 nCount )
         if( (nIndex + nCount) < static_cast< sal_Int32 >( maCells.size() ) )
         {
             CellVector::iterator aBegin( maCells.begin() );
-            while( nIndex-- && (aBegin != maCells.end()) )
-                ++aBegin;
+            std::advance(aBegin, nIndex);
 
             if( nCount > 1 )
             {
diff --git a/svx/source/table/tableundo.cxx b/svx/source/table/tableundo.cxx
index 1f444ae0f660..c7f53e7c0306 100644
--- a/svx/source/table/tableundo.cxx
+++ b/svx/source/table/tableundo.cxx
@@ -155,9 +155,8 @@ void CellUndo::getDataFromCell( Data& rData )
 
 static void Dispose( RowVector& rRows )
 {
-    RowVector::iterator aIter( rRows.begin() );
-    while( aIter != rRows.end() )
-        (*aIter++)->dispose();
+    for( auto& rpRow : rRows )
+        rpRow->dispose();
 }
 
 
@@ -243,17 +242,15 @@ void RemoveRowUndo::Redo()
 
 static void Dispose( ColumnVector& rCols )
 {
-    ColumnVector::iterator aIter( rCols.begin() );
-    while( aIter != rCols.end() )
-        (*aIter++)->dispose();
+    for( auto& rpCol : rCols )
+        rpCol->dispose();
 }
 
 
 static void Dispose( CellVector& rCells )
 {
-    CellVector::iterator aIter( rCells.begin() );
-    while( aIter != rCells.end() )
-        (*aIter++)->dispose();
+    for( auto& rpCell : rCells )
+        rpCell->dispose();
 }
 
 
diff --git a/svx/source/tbxctrls/Palette.cxx b/svx/source/tbxctrls/Palette.cxx
index 6f90ec00e4f3..fe9b27de95c5 100644
--- a/svx/source/tbxctrls/Palette.cxx
+++ b/svx/source/tbxctrls/Palette.cxx
@@ -42,9 +42,9 @@ void PaletteASE::LoadColorSet( SvxColorValueSet& rColorSet )
 {
     rColorSet.Clear();
     int nIx = 1;
-    for (ColorList::const_iterator it = maColors.begin(); it != maColors.end(); ++it)
+    for (const auto& rColor : maColors)
     {
-        rColorSet.InsertItem(nIx, it->first, it->second);
+        rColorSet.InsertItem(nIx, rColor.first, rColor.second);
         ++nIx;
     }
 }
@@ -53,9 +53,9 @@ void PaletteASE::LoadColorSet( ColorValueSet& rColorSet )
 {
     rColorSet.Clear();
     int nIx = 1;
-    for (ColorList::const_iterator it = maColors.begin(); it != maColors.end(); ++it)
+    for (const auto& rColor : maColors)
     {
-        rColorSet.InsertItem(nIx, it->first, it->second);
+        rColorSet.InsertItem(nIx, rColor.first, rColor.second);
         ++nIx;
     }
 }
@@ -214,9 +214,9 @@ void PaletteGPL::LoadColorSet( SvxColorValueSet& rColorSet )
 
     rColorSet.Clear();
     int nIx = 1;
-    for (ColorList::const_iterator it = maColors.begin(); it != maColors.end(); ++it)
+    for (const auto& rColor : maColors)
     {
-        rColorSet.InsertItem(nIx, it->first, it->second);
+        rColorSet.InsertItem(nIx, rColor.first, rColor.second);
         ++nIx;
     }
 }
@@ -227,9 +227,9 @@ void PaletteGPL::LoadColorSet( ColorValueSet& rColorSet )
 
     rColorSet.Clear();
     int nIx = 1;
-    for (ColorList::const_iterator it = maColors.begin(); it != maColors.end(); ++it)
+    for (const auto& rColor : maColors)
     {
-        rColorSet.InsertItem(nIx, it->first, it->second);
+        rColorSet.InsertItem(nIx, rColor.first, rColor.second);
         ++nIx;
     }
 }
diff --git a/svx/source/tbxctrls/SvxColorValueSet.cxx b/svx/source/tbxctrls/SvxColorValueSet.cxx
index fed3bb9c50f9..9e9546df1740 100644
--- a/svx/source/tbxctrls/SvxColorValueSet.cxx
+++ b/svx/source/tbxctrls/SvxColorValueSet.cxx
@@ -99,18 +99,18 @@ void ColorValueSet::addEntriesForColorSet(const std::set<Color>& rColorSet, cons
     sal_uInt32 nStartIndex = 1;
     if(rNamePrefix.getLength() != 0)
     {
-        for(std::set<Color>::const_iterator it = rColorSet.begin();
-            it != rColorSet.end(); ++it, nStartIndex++)
+        for(const auto& rColor : rColorSet)
         {
-            InsertItem(nStartIndex, *it, rNamePrefix + OUString::number(nStartIndex));
+            InsertItem(nStartIndex, rColor, rNamePrefix + OUString::number(nStartIndex));
+            nStartIndex++;
         }
     }
     else
     {
-        for(std::set<Color>::const_iterator it = rColorSet.begin();
-            it != rColorSet.end(); ++it, nStartIndex++)
+        for(const auto& rColor : rColorSet)
         {
-            InsertItem(nStartIndex, *it, "");
+            InsertItem(nStartIndex, rColor, "");
+            nStartIndex++;
         }
     }
 }
@@ -120,18 +120,18 @@ void SvxColorValueSet::addEntriesForColorSet(const std::set<Color>& rColorSet, c
     sal_uInt32 nStartIndex = 1;
     if(rNamePrefix.getLength() != 0)
     {
-        for(std::set<Color>::const_iterator it = rColorSet.begin();
-            it != rColorSet.end(); ++it, nStartIndex++)
+        for(const auto& rColor : rColorSet)
         {
-            InsertItem(nStartIndex, *it, rNamePrefix + OUString::number(nStartIndex));
+            InsertItem(nStartIndex, rColor, rNamePrefix + OUString::number(nStartIndex));
+            nStartIndex++;
         }
     }
     else
     {
-        for(std::set<Color>::const_iterator it = rColorSet.begin();
-            it != rColorSet.end(); ++it, nStartIndex++)
+        for(const auto& rColor : rColorSet)
         {
-            InsertItem(nStartIndex, *it, "");
+            InsertItem(nStartIndex, rColor, "");
+            nStartIndex++;
         }
     }
 }
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index a379d919f268..127e479d6e16 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1327,9 +1327,9 @@ SvxColorWindow::SvxColorWindow(const OUString&            rCommand,
     mpPaletteListBox->SetSelectHdl( LINK( this, SvxColorWindow, SelectPaletteHdl ) );
     mpPaletteListBox->AdaptDropDownLineCountToMaximum();
     std::vector<OUString> aPaletteList = mxPaletteManager->GetPaletteList();
-    for( std::vector<OUString>::iterator it = aPaletteList.begin(); it != aPaletteList.end(); ++it )
+    for (const auto& rPalette : aPaletteList )
     {
-        mpPaletteListBox->InsertEntry( *it );
+        mpPaletteListBox->InsertEntry( rPalette );
     }
     OUString aPaletteName( officecfg::Office::Common::UserColors::PaletteName::get() );
     mpPaletteListBox->SelectEntry( aPaletteName );
@@ -1439,8 +1439,8 @@ ColorWindow::ColorWindow(std::shared_ptr<PaletteManager> const & rPaletteManager
     mxPaletteListBox->connect_changed(LINK(this, ColorWindow, SelectPaletteHdl));
     std::vector<OUString> aPaletteList = mxPaletteManager->GetPaletteList();
     mxPaletteListBox->freeze();
-    for (std::vector<OUString>::iterator it = aPaletteList.begin(); it != aPaletteList.end(); ++it)
-        mxPaletteListBox->append_text(*it);
+    for (const auto& rPalette : aPaletteList)
+        mxPaletteListBox->append_text(rPalette);
     mxPaletteListBox->thaw();
     OUString aPaletteName( officecfg::Office::Common::UserColors::PaletteName::get() );
     mxPaletteListBox->set_active_text(aPaletteName);
@@ -2261,12 +2261,12 @@ SvxCurrencyList_Impl::SvxCurrencyList_Impl(
     bool bIsSymbol;
     NfWSStringsDtor aStringsDtor;
 
-    for( std::vector< OUString >::iterator i = aList.begin(); i != aList.end(); ++i, ++nCount )
+    for( const auto& rItem : aList )
     {
         sal_uInt16& rCurrencyIndex = aCurrencyList[ nCount ];
         if ( rCurrencyIndex < nLen )
         {
-            m_pCurrencyLb->InsertEntry( *i );
+            m_pCurrencyLb->InsertEntry( rItem );
             const NfCurrencyEntry& aCurrencyEntry = rCurrencyTable[ rCurrencyIndex ];
 
             bIsSymbol = nPos >= nLen;
@@ -2278,6 +2278,7 @@ SvxCurrencyList_Impl::SvxCurrencyList_Impl(
                 nSelectedPos = nPos;
             ++nPos;
         }
+        ++nCount;
     }
     m_pCurrencyLb->SetSelectHdl( LINK( this, SvxCurrencyList_Impl, SelectHdl ) );
     SetText( SvxResId( RID_SVXSTR_TBLAFMT_CURRENCY ) );
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
index 969cd1852b7c..323712913699 100644
--- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
@@ -377,14 +377,10 @@ void SearchToolbarControllersManager::freeController( const css::uno::Reference<
     SearchToolbarControllersMap::iterator pIt = aSearchToolbarControllersMap.find(xFrame);
     if (pIt != aSearchToolbarControllersMap.end())
     {
-        for (SearchToolbarControllersVec::iterator pItCtrl=pIt->second.begin(); pItCtrl!=pIt->second.end(); ++pItCtrl)
-        {
-            if (pItCtrl->Name == sCommandURL)
-            {
-                pIt->second.erase(pItCtrl);
-                break;
-            }
-        }
+        auto pItCtrl = std::find_if(pIt->second.begin(), pIt->second.end(),
+            [&sCommandURL](const css::beans::PropertyValue& rCtrl) { return rCtrl.Name == sCommandURL; });
+        if (pItCtrl != pIt->second.end())
+            pIt->second.erase(pItCtrl);
 
         if (pIt->second.empty())
             aSearchToolbarControllersMap.erase(pIt);
@@ -398,14 +394,10 @@ css::uno::Reference< css::frame::XStatusListener > SearchToolbarControllersManag
     SearchToolbarControllersMap::iterator pIt = aSearchToolbarControllersMap.find(xFrame);
     if (pIt != aSearchToolbarControllersMap.end())
     {
-        for (SearchToolbarControllersVec::iterator pItCtrl =pIt->second.begin(); pItCtrl != pIt->second.end(); ++pItCtrl)
-        {
-            if (pItCtrl->Name == sCommandURL)
-            {
-                pItCtrl->Value >>= xStatusListener;
-                break;
-            }
-        }
+        auto pItCtrl = std::find_if(pIt->second.begin(), pIt->second.end(),
+            [&sCommandURL](const css::beans::PropertyValue& rCtrl) { return rCtrl.Name == sCommandURL; });
+        if (pItCtrl != pIt->second.end())
+            pItCtrl->Value >>= xStatusListener;
     }
 
     return xStatusListener;
diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx
index 80ff5b14c23b..3e66c0ae1f26 100644
--- a/svx/source/unodraw/UnoGraphicExporter.cxx
+++ b/svx/source/unodraw/UnoGraphicExporter.cxx
@@ -905,12 +905,8 @@ bool GraphicExporter::GetGraphic( ExportSettings const & rSettings, Graphic& aGr
             tools::Rectangle aBound;
 
             {
-                std::vector< SdrObject* >::iterator aIter = aShapes.begin();
-                const std::vector< SdrObject* >::iterator aEnd = aShapes.end();
-
-                while( aIter != aEnd )
+                for( SdrObject* pObj : aShapes )
                 {
-                    SdrObject* pObj = (*aIter++);
                     tools::Rectangle aR1(pObj->GetCurrentBoundRect());
                     if (aBound.IsEmpty())
                         aBound=aR1;
diff --git a/svx/source/unodraw/UnoNameItemTable.cxx b/svx/source/unodraw/UnoNameItemTable.cxx
index dee7a834d726..b10dfbdfe369 100644
--- a/svx/source/unodraw/UnoNameItemTable.cxx
+++ b/svx/source/unodraw/UnoNameItemTable.cxx
@@ -119,19 +119,15 @@ void SAL_CALL SvxUnoNameItemTable::removeByName( const OUString& aApiName )
 
     OUString sName = SvxUnogetInternalNameForItem(mnWhich, aApiName);
 
-    ItemPoolVector::iterator aIter = maItemSetVector.begin();
-    const ItemPoolVector::iterator aEnd = maItemSetVector.end();
-
-
-    while( aIter != aEnd )
+    auto aIter = std::find_if(maItemSetVector.begin(), maItemSetVector.end(),
+        [&](const std::unique_ptr<SfxItemSet>& rpItem) {
+            const NameOrIndex *pItem = static_cast<const NameOrIndex *>(&(rpItem->Get( mnWhich ) ));
+            return sName == pItem->GetName();
+        });
+    if (aIter != maItemSetVector.end())
     {
-        const NameOrIndex *pItem = static_cast<const NameOrIndex *>(&((*aIter)->Get( mnWhich ) ));
-        if (sName == pItem->GetName())
-        {
-            maItemSetVector.erase( aIter );
-            return;
-        }
-        ++aIter;
+        maItemSetVector.erase( aIter );
+        return;
     }
 
     if (!hasByName(sName))
@@ -145,22 +141,19 @@ void SAL_CALL SvxUnoNameItemTable::replaceByName( const OUString& aApiName, cons
 
     OUString aName = SvxUnogetInternalNameForItem(mnWhich, aApiName);
 
-    ItemPoolVector::iterator aIter = maItemSetVector.begin();
-    const ItemPoolVector::iterator aEnd = maItemSetVector.end();
-
-    while( aIter != aEnd )
+    auto aIter = std::find_if(maItemSetVector.begin(), maItemSetVector.end(),
+        [&](const std::unique_ptr<SfxItemSet>& rpItem) {
+            const NameOrIndex *pItem = static_cast<const NameOrIndex *>(&(rpItem->Get( mnWhich ) ));
+            return aName == pItem->GetName();
+        });
+    if (aIter != maItemSetVector.end())
     {
-        const NameOrIndex *pItem = static_cast<const NameOrIndex *>(&((*aIter)->Get( mnWhich ) ));
-        if (aName == pItem->GetName())
-        {
-            std::unique_ptr<NameOrIndex> xNewItem(createItem());
-            xNewItem->SetName(aName);
-            if (!xNewItem->PutValue(aElement, mnMemberId) || !isValid(xNewItem.get()))
-                throw lang::IllegalArgumentException();
-            (*aIter)->Put(*xNewItem);
-            return;
-        }
-        ++aIter;
+        std::unique_ptr<NameOrIndex> xNewItem(createItem());
+        xNewItem->SetName(aName);
+        if (!xNewItem->PutValue(aElement, mnMemberId) || !isValid(xNewItem.get()))
+            throw lang::IllegalArgumentException();
+        (*aIter)->Put(*xNewItem);
+        return;
     }
 
     // if it is not in our own sets, modify the pool!
diff --git a/svx/source/unodraw/unomtabl.cxx b/svx/source/unodraw/unomtabl.cxx
index de686a031822..1de895279a5e 100644
--- a/svx/source/unodraw/unomtabl.cxx
+++ b/svx/source/unodraw/unomtabl.cxx
@@ -185,18 +185,15 @@ void SAL_CALL SvxUnoMarkerTable::removeByName( const OUString& aApiName )
 
     OUString aName = SvxUnogetInternalNameForItem(XATTR_LINEEND, aApiName);
 
-    ItemPoolVector::iterator aIter = maItemSetVector.begin();
-    const ItemPoolVector::iterator aEnd = maItemSetVector.end();
-
-    while( aIter != aEnd )
+    auto aIter = std::find_if(maItemSetVector.begin(), maItemSetVector.end(),
+        [&aName](const std::unique_ptr<SfxItemSet>& rpItem) {
+            const NameOrIndex *pItem = static_cast<const NameOrIndex *>(&(rpItem->Get( XATTR_LINEEND ) ));
+            return pItem->GetName() == aName;
+        });
+    if (aIter != maItemSetVector.end())
     {
-        const NameOrIndex *pItem = static_cast<const NameOrIndex *>(&((*aIter)->Get( XATTR_LINEEND ) ));
-        if( pItem->GetName() == aName )
-        {
-            maItemSetVector.erase( aIter );
-            return;
-        }
-        ++aIter;
+        maItemSetVector.erase( aIter );
+        return;
     }
 
     if( !hasByName( aName ) )
@@ -210,29 +207,26 @@ void SAL_CALL SvxUnoMarkerTable::replaceByName( const OUString& aApiName, const
 
     const OUString aName = SvxUnogetInternalNameForItem(XATTR_LINEEND, aApiName);
 
-    ItemPoolVector::iterator aIter = maItemSetVector.begin();
-    const ItemPoolVector::iterator aEnd = maItemSetVector.end();
-
-    while( aIter != aEnd )
+    auto aIter = std::find_if(maItemSetVector.begin(), maItemSetVector.end(),
+        [&aName](const std::unique_ptr<SfxItemSet>& rpItem) {
+            const NameOrIndex *pItem = static_cast<const NameOrIndex *>(&(rpItem->Get( XATTR_LINEEND ) ));
+            return pItem->GetName() == aName;
+        });
+    if (aIter != maItemSetVector.end())
     {
-        const NameOrIndex *pItem = static_cast<const NameOrIndex *>(&((*aIter)->Get( XATTR_LINEEND ) ));
-        if( pItem->GetName() == aName )
-        {
-            XLineEndItem aEndMarker(XATTR_LINEEND);
-            aEndMarker.SetName( aName );
-            if( !aEndMarker.PutValue( aElement, 0 ) )
-                throw lang::IllegalArgumentException();
+        XLineEndItem aEndMarker(XATTR_LINEEND);
+        aEndMarker.SetName( aName );
+        if( !aEndMarker.PutValue( aElement, 0 ) )
+            throw lang::IllegalArgumentException();
 
-            (*aIter)->Put( aEndMarker );
+        (*aIter)->Put( aEndMarker );
 
-            XLineStartItem aStartMarker(XATTR_LINESTART);
-            aStartMarker.SetName( aName );
-            aStartMarker.PutValue( aElement, 0 );
+        XLineStartItem aStartMarker(XATTR_LINESTART);
+        aStartMarker.SetName( aName );
+        aStartMarker.PutValue( aElement, 0 );
 
-            (*aIter)->Put( aStartMarker );
-            return;
-        }
-        ++aIter;
+        (*aIter)->Put( aStartMarker );
+        return;
     }
 
     // if it is not in our own sets, modify the pool!
diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx
index 64e2649d7d7c..2d4def595acb 100644
--- a/svx/source/unodraw/unoprov.cxx
+++ b/svx/source/unodraw/unoprov.cxx
@@ -833,11 +833,10 @@ OUString UHashMap::getNameFromId(sal_uInt32 nId)
 {
     const UHashMapImpl &rMap = GetUHashImpl();
 
-    for (UHashMapImpl::const_iterator it = rMap.begin(); it != rMap.end(); ++it)
-    {
-        if (it->second == nId)
-            return it->first;
-    }
+    auto it = std::find_if(rMap.begin(), rMap.end(),
+        [nId](const UHashMapImpl::value_type& rEntry) { return rEntry.second == nId; });
+    if (it != rMap.end())
+        return it->first;
     OSL_FAIL("[CL] unknown SdrObject identifier");
     return OUString();
 }
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index 5314fffc2050..8d7f3e6f6271 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -612,28 +612,25 @@ static void SvxItemPropertySet_ObtainSettingsFromPropertySet(const SvxItemProper
     {
         const SfxItemPropertyMap& rSrc = rPropSet.getPropertyMap();
         PropertyEntryVector_t aSrcPropVector = rSrc.getPropertyEntries();
-        PropertyEntryVector_t::const_iterator aSrcIt = aSrcPropVector.begin();
 
-        while(aSrcIt != aSrcPropVector.end())
+        for(const auto& rSrcProp : aSrcPropVector)
         {
-            const sal_uInt16 nWID = aSrcIt->nWID;
+            const sal_uInt16 nWID = rSrcProp.nWID;
             if(SfxItemPool::IsWhich(nWID)
                     && (nWID < OWN_ATTR_VALUE_START || nWID > OWN_ATTR_VALUE_END)
                     && rPropSet.GetUsrAnyForID(nWID))
                 rSet.Put(rSet.GetPool()->GetDefaultItem(nWID));
-            ++aSrcIt;
         }
 
-        aSrcIt = aSrcPropVector.begin();
-        while(aSrcIt != aSrcPropVector.end())
+        for(const auto& rSrcProp : aSrcPropVector)
         {
-            if(aSrcIt->nWID)
+            if(rSrcProp.nWID)
             {
-                uno::Any* pUsrAny = rPropSet.GetUsrAnyForID(aSrcIt->nWID);
+                uno::Any* pUsrAny = rPropSet.GetUsrAnyForID(rSrcProp.nWID);
                 if(pUsrAny)
                 {
                     // search for equivalent entry in pDst
-                    const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( aSrcIt->sName );
+                    const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( rSrcProp.sName );
                     if(pEntry)
                     {
                         // entry found
@@ -641,7 +638,7 @@ static void SvxItemPropertySet_ObtainSettingsFromPropertySet(const SvxItemProper
                         {
                             // special ID in PropertySet, can only be set
                             // directly at the object
-                            xSet->setPropertyValue( aSrcIt->sName, *pUsrAny);
+                            xSet->setPropertyValue( rSrcProp.sName, *pUsrAny);
                         }
                         else
                         {
@@ -650,9 +647,6 @@ static void SvxItemPropertySet_ObtainSettingsFromPropertySet(const SvxItemProper
                     }
                 }
             }
-
-            // next entry
-            ++aSrcIt;
         }
         const_cast< SvxItemPropertySet& >(rPropSet).ClearAllUsrAny();
     }


More information about the Libreoffice-commits mailing list