[Libreoffice-commits] core.git: sd/qa sd/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Dec 19 06:08:30 UTC 2018


 sd/qa/unit/export-tests-ooxml1.cxx             |   17 --
 sd/qa/unit/import-tests.cxx                    |   32 +---
 sd/source/core/CustomAnimationEffect.cxx       |  100 ++++--------
 sd/source/core/CustomAnimationPreset.cxx       |    6 
 sd/source/core/EffectMigration.cxx             |  193 +++++++++----------------
 sd/source/core/annotations/Annotation.cxx      |    9 -
 sd/source/core/drawdoc.cxx                     |   12 -
 sd/source/core/drawdoc2.cxx                    |    8 -
 sd/source/core/drawdoc3.cxx                    |   91 ++++-------
 sd/source/core/drawdoc4.cxx                    |   10 -
 sd/source/core/sdpage.cxx                      |  108 ++++++-------
 sd/source/core/sdpage2.cxx                     |   20 --
 sd/source/core/shapelist.cxx                   |    9 -
 sd/source/core/stlfamily.cxx                   |   14 -
 sd/source/core/stlpool.cxx                     |   68 +++-----
 sd/source/filter/eppt/eppt.cxx                 |   29 +--
 sd/source/filter/eppt/epptso.cxx               |   11 -
 sd/source/filter/eppt/pptexanimations.cxx      |   23 --
 sd/source/filter/eppt/pptexsoundcollection.cxx |   25 +--
 sd/source/filter/html/buttonset.cxx            |    5 
 sd/source/filter/html/htmlex.cxx               |    4 
 sd/source/filter/html/pubdlg.cxx               |   22 --
 sd/source/filter/ppt/ppt97animations.cxx       |    5 
 sd/source/filter/ppt/pptin.cxx                 |    9 -
 sd/source/filter/ppt/pptinanimations.cxx       |   10 -
 sd/source/filter/ppt/propread.cxx              |   42 ++---
 26 files changed, 340 insertions(+), 542 deletions(-)

New commits:
commit 31bd7e8c531a9a8e470d96540d730a98da0e81b7
Author:     Arkadiy Illarionov <qarkai at gmail.com>
AuthorDate: Sat Dec 15 20:47:43 2018 +0300
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Dec 19 07:08:04 2018 +0100

    Simplify containers iterations in sd/*
    
    Use range-based loop or replace with STL functions
    
    Change-Id: I29ccc94be73ec3ab22c4915f4a18ad0247038cc4
    Reviewed-on: https://gerrit.libreoffice.org/65204
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx
index f649d2723044..1a3a818f929d 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -345,18 +345,11 @@ void SdOOXMLExportTest1::testN828390()
         CPPUNIT_ASSERT( pTxtObj );
         const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
         aEdit.GetCharAttribs(0, rLst);
-        for( std::vector<EECharAttrib>::reverse_iterator it = rLst.rbegin(); it!=rLst.rend(); ++it)
-        {
-            const SvxEscapementItem *pFontEscapement = dynamic_cast<const SvxEscapementItem *>((*it).pAttr);
-            if(pFontEscapement)
-            {
-                if( pFontEscapement->GetEsc() == -25 )
-                {
-                    bPassed = true;
-                    break;
-                }
-            }
-        }
+        bPassed = std::any_of(rLst.rbegin(), rLst.rend(),
+            [](const EECharAttrib& rCharAttr) {
+                const SvxEscapementItem *pFontEscapement = dynamic_cast<const SvxEscapementItem *>(rCharAttr.pAttr);
+                return pFontEscapement && (pFontEscapement->GetEsc() == -25);
+            });
     }
     CPPUNIT_ASSERT_MESSAGE("Subscript not exported properly", bPassed);
 
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 7323fd300718..e8827df1b946 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -393,16 +393,14 @@ void SdImportTest::testN759180()
         CPPUNIT_ASSERT(pULSpace);
         CPPUNIT_ASSERT_EQUAL_MESSAGE( "Para bottom spacing is wrong!", static_cast<sal_uInt16>(0), pULSpace->GetLower());
         aEdit.GetCharAttribs(1, rLst);
-        for( std::vector<EECharAttrib>::reverse_iterator it = rLst.rbegin(); it!=rLst.rend(); ++it)
+        auto it = std::find_if(rLst.rbegin(), rLst.rend(),
+            [](const EECharAttrib& rCharAttr) { return dynamic_cast<const SvxFontHeightItem *>(rCharAttr.pAttr) != nullptr; });
+        if (it != rLst.rend())
         {
             const SvxFontHeightItem * pFontHeight = dynamic_cast<const SvxFontHeightItem *>((*it).pAttr);
-            if(pFontHeight)
-            {
-                // nStart == 9
-                // font height = 5 => 5*2540/72
-                CPPUNIT_ASSERT_EQUAL_MESSAGE( "Font height is wrong", static_cast<sal_uInt32>(176), pFontHeight->GetHeight() );
-                break;
-            }
+            // nStart == 9
+            // font height = 5 => 5*2540/72
+            CPPUNIT_ASSERT_EQUAL_MESSAGE( "Font height is wrong", static_cast<sal_uInt32>(176), pFontHeight->GetHeight() );
         }
     }
 
@@ -486,7 +484,6 @@ void SdImportTest::testN828390_2()
 
 void SdImportTest::testN828390_3()
 {
-    bool bPassed = true;
     sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/n828390_3.pptx"), PPTX );
     const SdrPage *pPage = GetPage( 1, xDocShRef );
 
@@ -496,18 +493,11 @@ void SdImportTest::testN828390_3()
     const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
     std::vector<EECharAttrib> rLst;
     aEdit.GetCharAttribs(1, rLst);
-    for( std::vector<EECharAttrib>::reverse_iterator it = rLst.rbegin(); it!=rLst.rend(); ++it)
-    {
-        const SvxEscapementItem *pFontEscapement = dynamic_cast<const SvxEscapementItem *>((*it).pAttr);
-        if(pFontEscapement)
-        {
-            if( pFontEscapement->GetEsc() != 0 )
-            {
-                bPassed = false;
-                break;
-            }
-        }
-    }
+    bool bPassed = std::none_of(rLst.rbegin(), rLst.rend(),
+        [](const EECharAttrib& rCharAttr) {
+            const SvxEscapementItem *pFontEscapement = dynamic_cast<const SvxEscapementItem *>(rCharAttr.pAttr);
+            return pFontEscapement && (pFontEscapement->GetEsc() != 0);
+        });
     CPPUNIT_ASSERT_MESSAGE("CharEscapment not imported properly", bPassed);
 
     xDocShRef->DoClose();
diff --git a/sd/source/core/CustomAnimationEffect.cxx b/sd/source/core/CustomAnimationEffect.cxx
index 89c53c25f263..f62d18f49e8b 100644
--- a/sd/source/core/CustomAnimationEffect.cxx
+++ b/sd/source/core/CustomAnimationEffect.cxx
@@ -65,6 +65,7 @@
 
 #include <algorithm>
 #include <deque>
+#include <numeric>
 
 #include <cppuhelper/implbase.hxx>
 
@@ -1615,11 +1616,8 @@ EffectSequenceHelper::~EffectSequenceHelper()
 
 void EffectSequenceHelper::reset()
 {
-    EffectSequence::iterator aIter( maEffects.begin() );
-    EffectSequence::iterator aEnd( maEffects.end() );
-    if( aIter != aEnd )
+    for( CustomAnimationEffectPtr& pEffect : maEffects )
     {
-        CustomAnimationEffectPtr pEffect = *aIter++;
         pEffect->setEffectSequence(nullptr);
     }
     maEffects.clear();
@@ -2079,29 +2077,19 @@ CustomAnimationEffectPtr EffectSequenceHelper::findEffect( const css::uno::Refer
 {
     CustomAnimationEffectPtr pEffect;
 
-    EffectSequence::const_iterator aIter( maEffects.begin() );
-    for( ; aIter != maEffects.end(); ++aIter )
-    {
-        if( (*aIter)->getNode() == xNode )
-        {
-            pEffect = *aIter;
-            break;
-        }
-    }
+    EffectSequence::const_iterator aIter = std::find_if(maEffects.begin(), maEffects.end(),
+        [&xNode](const CustomAnimationEffectPtr& rxEffect) { return rxEffect->getNode() == xNode; });
+    if (aIter != maEffects.end())
+        pEffect = *aIter;
 
     return pEffect;
 }
 
 sal_Int32 EffectSequenceHelper::getOffsetFromEffect( const CustomAnimationEffectPtr& xEffect ) const
 {
-    sal_Int32 nOffset = 0;
-
-    EffectSequence::const_iterator aIter( maEffects.begin() );
-    for( ; aIter != maEffects.end(); ++aIter, nOffset++ )
-    {
-        if( (*aIter) == xEffect )
-            return nOffset;
-    }
+    auto aIter = std::find(maEffects.begin(), maEffects.end(), xEffect);
+    if (aIter != maEffects.end())
+        return static_cast<sal_Int32>(std::distance(maEffects.begin(), aIter));
 
     return -1;
 }
@@ -2109,8 +2097,8 @@ sal_Int32 EffectSequenceHelper::getOffsetFromEffect( const CustomAnimationEffect
 CustomAnimationEffectPtr EffectSequenceHelper::getEffectFromOffset( sal_Int32 nOffset ) const
 {
     EffectSequence::const_iterator aIter( maEffects.begin() );
-    while( nOffset-- && aIter != maEffects.end() )
-        ++aIter;
+    nOffset = std::min(nOffset, static_cast<sal_Int32>(maEffects.size()));
+    std::advance(aIter, nOffset);
 
     CustomAnimationEffectPtr pEffect;
     if( aIter != maEffects.end() )
@@ -2143,32 +2131,23 @@ bool EffectSequenceHelper::disposeShape( const Reference< XShape >& xShape )
 
 bool EffectSequenceHelper::hasEffect( const css::uno::Reference< css::drawing::XShape >& xShape )
 {
-    EffectSequence::iterator aIter( maEffects.begin() );
-    while( aIter != maEffects.end() )
-    {
-        if( (*aIter)->getTargetShape() == xShape )
-            return true;
-        ++aIter;
-    }
-
-    return false;
+    return std::any_of(maEffects.begin(), maEffects.end(),
+        [&xShape](const CustomAnimationEffectPtr& rxEffect) { return rxEffect->getTargetShape() == xShape; });
 }
 
 void EffectSequenceHelper::insertTextRange( const css::uno::Any& aTarget )
 {
-    bool bChanges = false;
-
     ParagraphTarget aParaTarget;
     if( !(aTarget >>= aParaTarget ) )
         return;
 
-    EffectSequence::iterator aIter( maEffects.begin() );
-    while( aIter != maEffects.end() )
-    {
-        if( (*aIter)->getTargetShape() == aParaTarget.Shape )
-            bChanges |= (*aIter)->checkForText();
-        ++aIter;
-    }
+    bool bChanges = std::accumulate(maEffects.begin(), maEffects.end(), false,
+        [&aParaTarget](const bool bCheck, const CustomAnimationEffectPtr& rxEffect) {
+            bool bRes = bCheck;
+            if (rxEffect->getTargetShape() == aParaTarget.Shape)
+                bRes |= rxEffect->checkForText();
+            return bRes;
+        });
 
     if( bChanges )
         rebuild();
@@ -2313,12 +2292,8 @@ void EffectSequenceHelper::updateTextGroups()
     maGroupMap.clear();
 
     // first create all the groups
-    EffectSequence::iterator aIter( maEffects.begin() );
-    const EffectSequence::iterator aEnd( maEffects.end() );
-    while( aIter != aEnd )
+    for( CustomAnimationEffectPtr& pEffect : maEffects )
     {
-        CustomAnimationEffectPtr pEffect( *aIter++ );
-
         const sal_Int32 nGroupId = pEffect->getGroupId();
 
         if( nGroupId == -1 )
@@ -2519,12 +2494,8 @@ void EffectSequenceHelper::setTextGrouping( const CustomAnimationTextGroupPtr& p
         EffectSequence aEffects( pTextGroup->maEffects );
         pTextGroup->reset();
 
-        EffectSequence::iterator aIter( aEffects.begin() );
-        const EffectSequence::iterator aEnd( aEffects.end() );
-        while( aIter != aEnd )
+        for( CustomAnimationEffectPtr& pEffect : aEffects )
         {
-            CustomAnimationEffectPtr pEffect( *aIter++ );
-
             if( pEffect->getTarget().getValueType() == ::cppu::UnoType<ParagraphTarget>::get() )
                 remove( pEffect );
             else
@@ -2540,12 +2511,8 @@ void EffectSequenceHelper::setTextGrouping( const CustomAnimationTextGroupPtr& p
         EffectSequence aEffects( pTextGroup->maEffects );
         pTextGroup->reset();
 
-        EffectSequence::iterator aIter( aEffects.begin() );
-        const EffectSequence::iterator aEnd( aEffects.end() );
-        while( aIter != aEnd )
+        for( CustomAnimationEffectPtr& pEffect : aEffects )
         {
-            CustomAnimationEffectPtr pEffect( *aIter++ );
-
             if( pEffect->getTarget().getValueType() == ::cppu::UnoType<ParagraphTarget>::get() )
             {
                 // set correct node type
@@ -2655,12 +2622,8 @@ void EffectSequenceHelper::setTextGroupingAuto( const CustomAnimationTextGroupPt
     EffectSequence aEffects( pTextGroup->maEffects );
     pTextGroup->reset();
 
-    EffectSequence::iterator aIter( aEffects.begin() );
-    const EffectSequence::iterator aEnd( aEffects.end() );
-    while( aIter != aEnd )
+    for( CustomAnimationEffectPtr& pEffect : aEffects )
     {
-        CustomAnimationEffectPtr pEffect( *aIter++ );
-
         if( pEffect->getTarget().getValueType() == ::cppu::UnoType<ParagraphTarget>::get() )
         {
             // set correct node type
@@ -3238,14 +3201,13 @@ void MainSequence::onTextChanged( const Reference< XShape >& xShape )
 
 void EffectSequenceHelper::onTextChanged( const Reference< XShape >& xShape )
 {
-    bool bChanges = false;
-
-    EffectSequence::iterator aIter;
-    for( aIter = maEffects.begin(); aIter != maEffects.end(); ++aIter )
-    {
-        if( (*aIter)->getTargetShape() == xShape )
-            bChanges |= (*aIter)->checkForText();
-    }
+    bool bChanges = std::accumulate(maEffects.begin(), maEffects.end(), false,
+        [&xShape](const bool bCheck, const CustomAnimationEffectPtr& rxEffect) {
+            bool bRes = bCheck;
+            if (rxEffect->getTargetShape() == xShape)
+                bRes |= rxEffect->checkForText();
+            return bRes;
+        });
 
     if( bChanges )
         EffectSequenceHelper::implRebuild();
diff --git a/sd/source/core/CustomAnimationPreset.cxx b/sd/source/core/CustomAnimationPreset.cxx
index 5735c5df9f13..3c481acbf3ca 100644
--- a/sd/source/core/CustomAnimationPreset.cxx
+++ b/sd/source/core/CustomAnimationPreset.cxx
@@ -165,10 +165,8 @@ std::vector<OUString> CustomAnimationPreset::getSubTypes()
 
     if( maSubTypes.size() > 1 )
     {
-        EffectsSubTypeMap::iterator aIter( maSubTypes.begin() );
-        const EffectsSubTypeMap::iterator aEnd( maSubTypes.end() );
-        while( aIter != aEnd )
-            aSubTypes.push_back( (*aIter++).first );
+        std::transform(maSubTypes.begin(), maSubTypes.end(), std::back_inserter(aSubTypes),
+            [](EffectsSubTypeMap::value_type& rEntry) -> OUString { return rEntry.first; });
     }
 
     return aSubTypes;
diff --git a/sd/source/core/EffectMigration.cxx b/sd/source/core/EffectMigration.cxx
index b0fc5ea41570..7a701a38436b 100644
--- a/sd/source/core/EffectMigration.cxx
+++ b/sd/source/core/EffectMigration.cxx
@@ -170,18 +170,14 @@ void EffectMigration::SetFadeEffect( SdPage* pPage, css::presentation::FadeEffec
 
         const TransitionPresetList& rPresetList = TransitionPreset::getTransitionPresetList();
 
-        TransitionPresetList::const_iterator aIt( rPresetList.begin());
-        const TransitionPresetList::const_iterator aEndIt( rPresetList.end());
-        for( ; aIt != aEndIt; ++aIt )
+        auto aIt = std::find_if(rPresetList.begin(), rPresetList.end(),
+            [&aPresetId](const TransitionPresetPtr& rxPreset) { return rxPreset->getPresetId() == aPresetId; });
+        if (aIt != rPresetList.end())
         {
-            if( (*aIt)->getPresetId() == aPresetId)
-            {
-                pPage->setTransitionType( (*aIt)->getTransition() );
-                pPage->setTransitionSubtype( (*aIt)->getSubtype() );
-                pPage->setTransitionDirection( (*aIt)->getDirection() );
-                pPage->setTransitionFadeColor( (*aIt)->getFadeColor() );
-                break;
-            }
+            pPage->setTransitionType( (*aIt)->getTransition() );
+            pPage->setTransitionSubtype( (*aIt)->getSubtype() );
+            pPage->setTransitionDirection( (*aIt)->getDirection() );
+            pPage->setTransitionFadeColor( (*aIt)->getFadeColor() );
         }
     }
     else
@@ -196,23 +192,22 @@ void EffectMigration::SetFadeEffect( SdPage* pPage, css::presentation::FadeEffec
 FadeEffect EffectMigration::GetFadeEffect( const SdPage* pPage )
 {
     const TransitionPresetList & rPresetList = TransitionPreset::getTransitionPresetList();
-    TransitionPresetList::const_iterator aIt( rPresetList.begin());
-    const TransitionPresetList::const_iterator aEndIt( rPresetList.end());
-    for( ; aIt != aEndIt; ++aIt )
+    auto aIt = std::find_if(rPresetList.begin(), rPresetList.end(),
+        [&pPage](const TransitionPresetPtr& rxPreset) {
+            return (rxPreset->getTransition() == pPage->getTransitionType())
+                && (rxPreset->getSubtype() == pPage->getTransitionSubtype())
+                && (rxPreset->getDirection() == pPage->getTransitionDirection())
+                && (rxPreset->getFadeColor() == pPage->getTransitionFadeColor());
+        });
+    if (aIt != rPresetList.end())
     {
-        if( ( (*aIt)->getTransition() == pPage->getTransitionType() ) &&
-            ( (*aIt)->getSubtype() == pPage->getTransitionSubtype() ) &&
-            ( (*aIt)->getDirection() == pPage->getTransitionDirection() ) &&
-            ( (*aIt)->getFadeColor() == pPage->getTransitionFadeColor() ) )
-        {
-            const OUString& aPresetId = (*aIt)->getPresetId();
+        const OUString& aPresetId = (*aIt)->getPresetId();
 
-            deprecated_FadeEffect_conversion_table_entry const * pEntry = deprecated_FadeEffect_conversion_table;
-            while( (pEntry->meFadeEffect != FadeEffect_NONE) && (!aPresetId.equalsAscii( pEntry->mpPresetId ) ) )
-                pEntry++;
+        deprecated_FadeEffect_conversion_table_entry const * pEntry = deprecated_FadeEffect_conversion_table;
+        while( (pEntry->meFadeEffect != FadeEffect_NONE) && (!aPresetId.equalsAscii( pEntry->mpPresetId ) ) )
+            pEntry++;
 
-            return pEntry->meFadeEffect;
-        }
+        return pEntry->meFadeEffect;
     }
     return FadeEffect_NONE;
 }
@@ -392,16 +387,11 @@ const deprecated_AnimationEffect_conversion_table[] =
 
 static EffectSequence::iterator ImplFindEffect( MainSequencePtr const & pMainSequence, const Reference< XShape >& rShape, sal_Int16 nSubItem )
 {
-    EffectSequence::iterator aIter;
-
-    for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter )
-    {
-        CustomAnimationEffectPtr pEffect( *aIter );
-        if( (pEffect->getTargetShape() == rShape) && (pEffect->getTargetSubItem() == nSubItem) )
-            break;
-    }
-
-    return aIter;
+    return std::find_if(pMainSequence->getBegin(), pMainSequence->getEnd(),
+        [&rShape, &nSubItem](const CustomAnimationEffectPtr& pEffect) {
+            return (pEffect->getTargetShape() == rShape)
+                && (pEffect->getTargetSubItem() == nSubItem);
+        });
 }
 
 static bool implIsInsideGroup( SdrObject const * pObj )
@@ -561,24 +551,18 @@ AnimationEffect EffectMigration::GetAnimationEffect( SvxShape* pShape )
     {
         const Reference< XShape > xShape( pShape );
 
-        EffectSequence::iterator aIter;
+        EffectSequence::iterator aIter = std::find_if(pMainSequence->getBegin(), pMainSequence->getEnd(),
+            [&xShape](const CustomAnimationEffectPtr& pEffect) {
+                return (pEffect->getTargetShape() == xShape)
+                    && ((pEffect->getTargetSubItem() == ShapeAnimationSubType::ONLY_BACKGROUND)
+                        || (pEffect->getTargetSubItem() == ShapeAnimationSubType::AS_WHOLE))
+                    && (pEffect->getDuration() != 0.1); // ignore appear effects created from old text effect import
+            });
 
-        for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter )
+        if (aIter != pMainSequence->getEnd())
         {
-            CustomAnimationEffectPtr pEffect( *aIter );
-            if( pEffect->getTargetShape() == xShape )
-            {
-                if( (pEffect->getTargetSubItem() == ShapeAnimationSubType::ONLY_BACKGROUND) ||
-                    (pEffect->getTargetSubItem() == ShapeAnimationSubType::AS_WHOLE))
-                {
-                    if( pEffect->getDuration() != 0.1 ) // ignore appear effects created from old text effect import
-                    {
-                        aPresetId = (*aIter)->getPresetId();
-                        aPresetSubType = (*aIter)->getPresetSubType();
-                        break;
-                    }
-                }
-            }
+            aPresetId = (*aIter)->getPresetId();
+            aPresetSubType = (*aIter)->getPresetSubType();
         }
     }
 
@@ -698,22 +682,21 @@ void EffectMigration::SetTextAnimationEffect( SvxShape* pShape, AnimationEffect
             // now we have a group, so check if all effects are same as we like to have them
             const EffectSequence& rEffects = pGroup->getEffects();
 
-            EffectSequence::const_iterator aIter;
-            for( aIter = rEffects.begin(); aIter != rEffects.end(); ++aIter )
+            for( auto& rxEffect : rEffects )
             {
                 // only work on paragraph targets
-                if( (*aIter)->getTarget().getValueType() == ::cppu::UnoType<ParagraphTarget>::get() )
+                if( rxEffect->getTarget().getValueType() == ::cppu::UnoType<ParagraphTarget>::get() )
                 {
-                    if( ((*aIter)->getPresetId() != aPresetId) ||
-                        ((*aIter)->getPresetSubType() != aPresetSubType) )
+                    if( (rxEffect->getPresetId() != aPresetId) ||
+                        (rxEffect->getPresetSubType() != aPresetSubType) )
                     {
-                        (*aIter)->replaceNode( pPreset->create( aPresetSubType ) );
+                        rxEffect->replaceNode( pPreset->create( aPresetSubType ) );
                     }
 
                     if( bLaserEffect )
                     {
-                        (*aIter)->setIterateType( TextAnimationType::BY_LETTER );
-                        (*aIter)->setIterateInterval( 0.5 );// TODO:
+                        rxEffect->setIterateType( TextAnimationType::BY_LETTER );
+                        rxEffect->setIterateInterval( 0.5 );// TODO:
                                                              // Determine
                                                              // interval
                                                              // according
@@ -860,21 +843,17 @@ AnimationSpeed EffectMigration::GetAnimationSpeed( SvxShape* pShape )
 
     const Reference< XShape > xShape( pShape );
 
-    EffectSequence::iterator aIter;
-
     double fDuration = 1.0;
 
-    for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter )
+    EffectSequence::iterator aIter = std::find_if(pMainSequence->getBegin(), pMainSequence->getEnd(),
+        [&xShape](const CustomAnimationEffectPtr& pEffect) {
+            return (pEffect->getTargetShape() == xShape)
+                && (pEffect->getDuration() != 0.1);
+        });
+    if (aIter != pMainSequence->getEnd())
     {
         CustomAnimationEffectPtr pEffect( *aIter );
-        if( pEffect->getTargetShape() == xShape )
-        {
-            if( pEffect->getDuration() != 0.1 )
-            {
-                fDuration = pEffect->getDuration();
-                break;
-            }
-        }
+        fDuration = pEffect->getDuration();
     }
 
     return ConvertDuration( fDuration );
@@ -939,18 +918,16 @@ sal_Int32 EffectMigration::GetDimColor( SvxShape* pShape )
             sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->getSdrPageFromSdrObject())->getMainSequence();
 
             const Reference< XShape > xShape( pShape );
-            EffectSequence::iterator aIter;
-
-            for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter )
+            EffectSequence::iterator aIter = std::find_if(pMainSequence->getBegin(), pMainSequence->getEnd(),
+                [&xShape](const CustomAnimationEffectPtr& pEffect) {
+                    return (pEffect->getTargetShape() == xShape)
+                        && pEffect->getDimColor().hasValue()
+                        && pEffect->hasAfterEffect();
+                });
+            if (aIter != pMainSequence->getEnd())
             {
                 CustomAnimationEffectPtr pEffect( *aIter );
-                if( (pEffect->getTargetShape() == xShape) &&
-                    pEffect->getDimColor().hasValue() &&
-                    pEffect->hasAfterEffect())
-                {
-                    pEffect->getDimColor() >>= nColor;
-                    break;
-                }
+                pEffect->getDimColor() >>= nColor;
             }
         }
     }
@@ -1007,17 +984,14 @@ bool EffectMigration::GetDimHide( SvxShape* pShape )
 
             const Reference< XShape > xShape( pShape );
 
-            EffectSequence::iterator aIter;
-            for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter )
+            EffectSequence::iterator aIter = std::find_if(pMainSequence->getBegin(), pMainSequence->getEnd(),
+                [&xShape](const CustomAnimationEffectPtr& pEffect) { return pEffect->getTargetShape() == xShape; });
+            if (aIter != pMainSequence->getEnd())
             {
                 CustomAnimationEffectPtr pEffect( *aIter );
-                if( pEffect->getTargetShape() == xShape )
-                {
-                    bRet = pEffect->hasAfterEffect() &&
-                            !pEffect->getDimColor().hasValue() &&
-                            (!pEffect->IsAfterEffectOnNext());
-                    break;
-                }
+                bRet = pEffect->hasAfterEffect() &&
+                        !pEffect->getDimColor().hasValue() &&
+                        (!pEffect->IsAfterEffectOnNext());
             }
         }
     }
@@ -1077,17 +1051,14 @@ bool EffectMigration::GetDimPrevious( SvxShape* pShape )
 
             const Reference< XShape > xShape( pShape );
 
-            EffectSequence::iterator aIter;
-            for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter )
+            EffectSequence::iterator aIter = std::find_if(pMainSequence->getBegin(), pMainSequence->getEnd(),
+                [&xShape](const CustomAnimationEffectPtr& pEffect) { return pEffect->getTargetShape() == xShape; });
+            if (aIter != pMainSequence->getEnd())
             {
                 CustomAnimationEffectPtr pEffect( *aIter );
-                if( pEffect->getTargetShape() == xShape )
-                {
-                    bRet = pEffect->hasAfterEffect() &&
-                            pEffect->getDimColor().hasValue() &&
-                            pEffect->IsAfterEffectOnNext();
-                    break;
-                }
+                bRet = pEffect->hasAfterEffect() &&
+                        pEffect->getDimColor().hasValue() &&
+                        pEffect->IsAfterEffectOnNext();
             }
         }
     }
@@ -1152,33 +1123,25 @@ void EffectMigration::SetPresentationOrder( SvxShape* pShape, sal_Int32 nNewPos
     {
         std::vector< CustomAnimationEffectPtr > aEffects;
 
-        std::vector< EffectSequence::iterator >::iterator aIter( aEffectVector[nCurrentPos].begin() );
-        std::vector< EffectSequence::iterator >::iterator aEnd( aEffectVector[nCurrentPos].end() );
-        while( aIter != aEnd )
+        for( auto& rIter : aEffectVector[nCurrentPos] )
         {
-            aEffects.push_back( *(*aIter) );
-            rSequence.erase( *aIter++ );
+            aEffects.push_back( *rIter );
+            rSequence.erase( rIter );
         }
 
         if( nNewPos > nCurrentPos )
             nNewPos++;
 
-        std::vector< CustomAnimationEffectPtr >::iterator aTempIter( aEffects.begin() );
-        std::vector< CustomAnimationEffectPtr >::iterator aTempEnd( aEffects.end() );
-
         if( nNewPos == static_cast<sal_Int32>(aEffectVector.size()) )
         {
-            while( aTempIter != aTempEnd )
-            {
-                rSequence.push_back( *aTempIter++ );
-            }
+            std::copy(aEffects.begin(), aEffects.end(), std::back_inserter(rSequence));
         }
         else
         {
             EffectSequence::iterator aPos( aEffectVector[nNewPos][0] );
-            while( aTempIter != aTempEnd )
+            for( const auto& rEffect : aEffects )
             {
-                rSequence.insert( aPos, (*aTempIter++) );
+                rSequence.insert( aPos, rEffect );
             }
         }
     }
@@ -1200,12 +1163,8 @@ sal_Int32 EffectMigration::GetPresentationOrder( SvxShape* pShape )
     Reference< XShape > xThis( pShape );
     Reference< XShape > xCurrent;
 
-    EffectSequence::iterator aIter( rSequence.begin() );
-    EffectSequence::iterator aEnd( rSequence.end() );
-    for( ; aIter != aEnd; ++aIter )
+    for( CustomAnimationEffectPtr& pEffect : rSequence )
     {
-        CustomAnimationEffectPtr pEffect = *aIter;
-
         if( !xCurrent.is() || pEffect->getTargetShape() != xCurrent )
         {
             nPos++;
diff --git a/sd/source/core/annotations/Annotation.cxx b/sd/source/core/annotations/Annotation.cxx
index 6a80ef841429..563555cf2825 100644
--- a/sd/source/core/annotations/Annotation.cxx
+++ b/sd/source/core/annotations/Annotation.cxx
@@ -478,13 +478,8 @@ UndoInsertOrRemoveAnnotation::UndoInsertOrRemoveAnnotation( Annotation& rAnnotat
         Reference< XAnnotation > xAnnotation( &rAnnotation );
 
         const AnnotationVector& rVec = pPage->getAnnotations();
-        for( AnnotationVector::const_iterator iter = rVec.begin(); iter != rVec.end(); ++iter )
-        {
-            if( (*iter) == xAnnotation )
-                break;
-
-            mnIndex++;
-        }
+        auto iter = std::find(rVec.begin(), rVec.end(), xAnnotation);
+        mnIndex += std::distance(rVec.begin(), iter);
     }
 }
 
diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx
index ec92d4ae0a36..81fc4ade1891 100644
--- a/sd/source/core/drawdoc.cxx
+++ b/sd/source/core/drawdoc.cxx
@@ -1105,16 +1105,8 @@ sal_uInt16 SdDrawDocument::GetAnnotationAuthorIndex( const OUString& rAuthor )
         maAnnotationAuthors.push_back( aUserOptions.GetFullName() );
     }
 
-    sal_uInt16 idx = 0;
-    const std::vector< OUString >::const_iterator aEnd( maAnnotationAuthors.end());
-    for( std::vector< OUString >::const_iterator iter( maAnnotationAuthors.begin() ); iter != aEnd; ++iter )
-    {
-        if( (*iter) == rAuthor )
-        {
-            break;
-        }
-        idx++;
-    }
+    auto iter = std::find(maAnnotationAuthors.begin(), maAnnotationAuthors.end(), rAuthor);
+    sal_uInt16 idx = static_cast<sal_uInt16>(std::distance(maAnnotationAuthors.begin(), iter));
 
     if( idx == maAnnotationAuthors.size() )
     {
diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index 91613f50c961..f4ecee1d518d 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ -817,11 +817,9 @@ bool SdDrawDocument::MovePages(sal_uInt16 nTargetPage)
         nTargetPage = nPage;
         nTargetPage = 2 * nTargetPage + 1;    // PageKind::Standard --> absolute
 
-        std::vector<SdPage*>::iterator iter;
-        for (iter = aPageList.begin(); iter != aPageList.end(); ++iter)
+        for (const auto& rpPage : aPageList)
         {
-            pPage = *iter;
-            nPage = pPage->GetPageNum();
+            nPage = rpPage->GetPageNum();
             if (nPage > nTargetPage)
             {
                 nTargetPage += 2;        // Insert _after_ the page
@@ -854,7 +852,7 @@ bool SdDrawDocument::MovePages(sal_uInt16 nTargetPage)
                     bSomethingHappened = true;
                 }
             }
-            nTargetPage = pPage->GetPageNum();
+            nTargetPage = rpPage->GetPageNum();
         }
     }
 
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index e340a930cd78..0a68485c2dff 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -304,17 +304,12 @@ void SdDrawDocument::InsertBookmark(
         else
             bOK = false;
 
-        std::vector<OUString>::const_iterator pIter;
-        for ( pIter = rBookmarkList.begin(); bOK && pIter != rBookmarkList.end() && !bInsertPages; ++pIter )
-        {
-            // Is there a page name in the bookmark list?
-            bool    bIsMasterPage;
-            if( pBookmarkDoc->GetPageByName( *pIter, bIsMasterPage ) != SDRPAGE_NOTFOUND )
-            {
-                // Found the page
-                bInsertPages = true;
-            }
-        }
+        bInsertPages = bOK && std::any_of(rBookmarkList.begin(), rBookmarkList.end(),
+            [&pBookmarkDoc](const OUString& rBookmark) {
+                // Is there a page name in the bookmark list?
+                bool    bIsMasterPage;
+                return pBookmarkDoc->GetPageByName(rBookmark, bIsMasterPage) != SDRPAGE_NOTFOUND;
+            });
     }
 
     bool bCalcObjCount = !rExchangeList.empty();
@@ -503,11 +498,9 @@ bool SdDrawDocument::InsertBookmarkAsPage(
     if( !aLayoutsToTransfer.empty() )
         bMergeMasterPages = true;
 
-    std::vector<OUString>::const_iterator pIter;
-    for ( pIter = aLayoutsToTransfer.begin(); pIter != aLayoutsToTransfer.end(); ++pIter )
+    for ( const OUString& layoutName : aLayoutsToTransfer )
     {
         StyleSheetCopyResultVector aCreatedStyles;
-        OUString layoutName = *pIter;
 
         rStyleSheetPool.CopyLayoutSheets(layoutName, rBookmarkStyleSheetPool,aCreatedStyles);
 
@@ -1006,11 +999,10 @@ bool SdDrawDocument::InsertBookmarkAsObject(
         SdrPage* pPage;
         SdrPageView* pPV;
 
-        std::vector<OUString>::const_iterator pIter;
-        for ( pIter = rBookmarkList.begin(); pIter != rBookmarkList.end(); ++pIter )
+        for ( const auto& rBookmark : rBookmarkList )
         {
             // Get names of bookmarks from the list
-            SdrObject* pObj = pBookmarkDoc->GetObj(*pIter);
+            SdrObject* pObj = pBookmarkDoc->GetObj(rBookmark);
 
             if (pObj)
             {
@@ -1109,24 +1101,22 @@ bool SdDrawDocument::InsertBookmarkAsObject(
 
         delete pView;
 
-        if (!rExchangeList.empty())
+        // Get number of objects after inserting.
+        const size_t nCount = pPage->GetObjCount();
+        if (nCountBefore < nCount)
         {
-            // Get number of objects after inserting.
-            const size_t nCount = pPage->GetObjCount();
-
-            std::vector<OUString>::const_iterator pIter = rExchangeList.begin();
-            for (size_t nObj = nCountBefore; nObj < nCount; ++nObj)
+            size_t nObj = nCountBefore;
+            for (const auto& rExchange : rExchangeList)
             {
                 // Get the name to use from the Exchange list
-                if (pIter != rExchangeList.end())
+                if (pPage->GetObj(nObj))
                 {
-                    if (pPage->GetObj(nObj))
-                    {
-                        pPage->GetObj(nObj)->SetName(*pIter);
-                    }
-
-                    ++pIter;
+                    pPage->GetObj(nObj)->SetName(rExchange);
                 }
+
+                ++nObj;
+                if (nObj >= nCount)
+                    break;
             }
         }
     }
@@ -1312,8 +1302,8 @@ void SdDrawDocument::RemoveUnnecessaryMasterPages(SdPage* pMasterPage, bool bOnl
                             pUndoMgr->AddUndoAction(o3tl::make_unique<SdMoveStyleSheetsUndoAction>(this, aUndoRemove, false));
                     }
 
-                    for( SdStyleSheetVector::iterator iter = aRemove.begin(); iter != aRemove.end(); ++iter )
-                        static_cast<SdStyleSheetPool*>( mxStyleSheetPool.get())->Remove((*iter).get());
+                    for( const auto& a : aRemove )
+                        static_cast<SdStyleSheetPool*>( mxStyleSheetPool.get())->Remove(a.get());
                 }
             }
         }
@@ -1604,11 +1594,10 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
             // sets in the styles.
             if(!aCreatedStyles.empty())
             {
-                std::vector<StyleReplaceData>::iterator pRDataIter;
-                for ( pRDataIter = aReplList.begin(); pRDataIter != aReplList.end(); ++pRDataIter )
+                for ( const auto& rRData : aReplList )
                 {
-                    SfxStyleSheetBase* pSOld = mxStyleSheetPool->Find(pRDataIter->aName);
-                    SfxStyleSheetBase* pSNew = mxStyleSheetPool->Find(pRDataIter->aNewName);
+                    SfxStyleSheetBase* pSOld = mxStyleSheetPool->Find(rRData.aName);
+                    SfxStyleSheetBase* pSNew = mxStyleSheetPool->Find(rRData.aNewName);
 
                     if (pSOld && pSNew)
                     {
@@ -1617,15 +1606,12 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
 
                         if (!rParentOfOld.isEmpty() && rParentOfNew.isEmpty())
                         {
-                            std::vector<StyleReplaceData>::iterator pRDIter;
-                            for ( pRDIter = aReplList.begin(); pRDIter != aReplList.end(); ++pRDIter )
+                            std::vector<StyleReplaceData>::iterator pRDIter = std::find_if(aReplList.begin(), aReplList.end(),
+                                [&rParentOfOld](const StyleReplaceData& rRD) { return (rRD.aName == rParentOfOld) && (rRD.aName != rRD.aNewName); });
+                            if (pRDIter != aReplList.end())
                             {
-                                if ((pRDIter->aName == rParentOfOld) && (pRDIter->aName != pRDIter->aNewName))
-                                {
-                                    OUString aParentOfNew(pRDIter->aNewName);
-                                    pSNew->SetParent(aParentOfNew);
-                                    break;
-                                }
+                                OUString aParentOfNew(pRDIter->aNewName);
+                                pSNew->SetParent(aParentOfNew);
                             }
                         }
                     }
@@ -1720,9 +1706,8 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
             aPageList.push_back(pNotes);
         }
 
-        for (std::vector<SdPage*>::iterator pIter = aPageList.begin(); pIter != aPageList.end(); ++pIter)
+        for (SdPage* pPage : aPageList)
         {
-            SdPage* pPage = *pIter;
             AutoLayout eAutoLayout = pPage->GetAutoLayout();
 
             if( bUndo )
@@ -1731,7 +1716,7 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
                         (this,
                         pPage->IsMasterPage() ? aLayoutName : aOldLayoutName,
                         aLayoutName,
-                         eAutoLayout, eAutoLayout, false, *pIter));
+                         eAutoLayout, eAutoLayout, false, pPage));
             }
             pPage->SetPresentationLayout(aLayoutName);
             pPage->SetAutoLayout(eAutoLayout);
@@ -1854,22 +1839,22 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
         }
 
         // Set presentation layout and AutoLayout for the affected pages
-        for ( std::vector<SdPage*>::iterator pIter = aPageList.begin(); pIter != aPageList.end(); ++pIter )
+        for ( auto& rpPage : aPageList )
         {
-            AutoLayout eOldAutoLayout = (*pIter)->GetAutoLayout();
+            AutoLayout eOldAutoLayout = rpPage->GetAutoLayout();
             AutoLayout eNewAutoLayout =
-                (*pIter)->GetPageKind() == PageKind::Standard ? AUTOLAYOUT_NONE : AUTOLAYOUT_NOTES;
+                rpPage->GetPageKind() == PageKind::Standard ? AUTOLAYOUT_NONE : AUTOLAYOUT_NOTES;
 
             if( bUndo )
             {
                 pUndoMgr->AddUndoAction(o3tl::make_unique<SdPresentationLayoutUndoAction>
                             (this, aOldLayoutName, aName,
                              eOldAutoLayout, eNewAutoLayout, true,
-                             *pIter));
+                             rpPage));
             }
 
-            (*pIter)->SetPresentationLayout(aName);
-            (*pIter)->SetAutoLayout(eNewAutoLayout);
+            rpPage->SetPresentationLayout(aName);
+            rpPage->SetAutoLayout(eNewAutoLayout);
         }
     }
 
diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx
index 412a05e74ca1..bf77df7a95a2 100644
--- a/sd/source/core/drawdoc4.cxx
+++ b/sd/source/core/drawdoc4.cxx
@@ -1168,9 +1168,8 @@ void SdDrawDocument::RenameLayoutTemplate(const OUString& rOldLayoutName, const
 
                             if (pOPO)
                             {
-                                std::vector<StyleReplaceData>::iterator it;
-                                for (it = aReplList.begin(); it != aReplList.end(); ++it)
-                                    pOPO->ChangeStyleSheets( it->aName, it->nFamily, it->aNewName, it->nNewFamily );
+                                for (const auto& rRepl : aReplList)
+                                    pOPO->ChangeStyleSheets( rRepl.aName, rRepl.nFamily, rRepl.aNewName, rRepl.nNewFamily );
                             }
                         }
                         break;
@@ -1211,9 +1210,8 @@ void SdDrawDocument::RenameLayoutTemplate(const OUString& rOldLayoutName, const
 
                             if (pOPO)
                             {
-                                std::vector<StyleReplaceData>::iterator it;
-                                for (it = aReplList.begin(); it != aReplList.end(); ++it)
-                                    pOPO->ChangeStyleSheets( it->aName, it->nFamily, it->aNewName, it->nNewFamily );
+                                for (const auto& rRepl : aReplList)
+                                    pOPO->ChangeStyleSheets( rRepl.aName, rRepl.nFamily, rRepl.aNewName, rRepl.nNewFamily );
                             }
                         }
                         break;
diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index f073d5a8bda3..e1f033dd5e7b 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -905,11 +905,10 @@ void getPresObjProp( const SdPage& rPage, const char* sObjKind, const char* sPag
     bool bNoObjectFound = true;  //used to break from outer loop
 
     const std::vector< Reference<XNode> >& objectInfo = static_cast< const SdDrawDocument& >(rPage.getSdrModelFromSdrPage()).GetObjectVector();
-    for( std::vector< Reference<XNode> >::const_iterator aIter=objectInfo.begin(); aIter != objectInfo.end(); ++aIter )
+    for( const Reference<XNode>& objectNode : objectInfo )
     {
         if(bNoObjectFound)
         {
-            Reference<XNode> objectNode = *aIter;      //get i'th object element
             Reference<XNamedNodeMap> objectattrlist = objectNode->getAttributes();
             Reference<XNode> objectattr = objectattrlist->getNamedItem("type");
             OUString sObjType = objectattr->getNodeValue();
@@ -1369,71 +1368,70 @@ static void CalcAutoLayoutRectangles( SdPage const & rPage,::tools::Rectangle* r
     double propvalue[] = {0,0,0,0};
 
     const std::vector< Reference<XNode> >& layoutInfo = static_cast< const SdDrawDocument& >(rPage.getSdrModelFromSdrPage()).GetLayoutVector();
-    for( std::vector< Reference<XNode> >::const_iterator aIter=layoutInfo.begin(); aIter != layoutInfo.end(); ++aIter )
+    auto aIter = std::find_if(layoutInfo.begin(), layoutInfo.end(),
+        [&sLayoutType](const Reference<XNode>& layoutNode) {
+            Reference<XNamedNodeMap> layoutAttrList = layoutNode->getAttributes();
+
+            // get the attribute value of layout (i.e it's type)
+            OUString sLayoutAttName = layoutAttrList->getNamedItem("type")->getNodeValue();
+            return sLayoutAttName == sLayoutType;
+        });
+    if (aIter != layoutInfo.end())
     {
+        int count=0;
         Reference<XNode> layoutNode = *aIter;
-        Reference<XNamedNodeMap> layoutAttrList =layoutNode->getAttributes();
-
-        // get the attribute value of layout (i.e it's type)
-        OUString sLayoutAttName =
-            layoutAttrList->getNamedItem("type")->getNodeValue();
-        if(sLayoutAttName == sLayoutType)
+        Reference<XNodeList> layoutChildren = layoutNode->getChildNodes();
+        const int presobjsize = layoutChildren->getLength();
+        for( int j=0; j< presobjsize ; j++)
         {
-            int count=0;
-            Reference<XNodeList> layoutChildren = layoutNode->getChildNodes();
-            const int presobjsize = layoutChildren->getLength();
-            for( int j=0; j< presobjsize ; j++)
-            {
-                OUString nodename;
-                Reference<XNode> presobj = layoutChildren->item(j);
-                nodename=presobj->getNodeName();
+            OUString nodename;
+            Reference<XNode> presobj = layoutChildren->item(j);
+            nodename=presobj->getNodeName();
 
-                //check whether children is blank 'text-node' or 'presobj' node
-                if(nodename == "presobj")
-                {
-                    // TODO: rework sd to permit arbitrary number of presentation objects
-                    assert(count < MAX_PRESOBJS);
+            //check whether children is blank 'text-node' or 'presobj' node
+            if(nodename == "presobj")
+            {
+                // TODO: rework sd to permit arbitrary number of presentation objects
+                assert(count < MAX_PRESOBJS);
 
-                    Reference<XNamedNodeMap> presObjAttributes = presobj->getAttributes();
+                Reference<XNamedNodeMap> presObjAttributes = presobj->getAttributes();
 
-                    Reference<XNode> presObjSizeHeight = presObjAttributes->getNamedItem("relative-height");
-                    OUString sValue = presObjSizeHeight->getNodeValue();
-                    propvalue[0] = sValue.toDouble();
+                Reference<XNode> presObjSizeHeight = presObjAttributes->getNamedItem("relative-height");
+                OUString sValue = presObjSizeHeight->getNodeValue();
+                propvalue[0] = sValue.toDouble();
 
-                    Reference<XNode> presObjSizeWidth = presObjAttributes->getNamedItem("relative-width");
-                    sValue = presObjSizeWidth->getNodeValue();
-                    propvalue[1] = sValue.toDouble();
+                Reference<XNode> presObjSizeWidth = presObjAttributes->getNamedItem("relative-width");
+                sValue = presObjSizeWidth->getNodeValue();
+                propvalue[1] = sValue.toDouble();
 
-                    Reference<XNode> presObjPosX = presObjAttributes->getNamedItem("relative-posX");
-                    sValue = presObjPosX->getNodeValue();
-                    propvalue[2] = sValue.toDouble();
+                Reference<XNode> presObjPosX = presObjAttributes->getNamedItem("relative-posX");
+                sValue = presObjPosX->getNodeValue();
+                propvalue[2] = sValue.toDouble();
 
-                    Reference<XNode> presObjPosY = presObjAttributes->getNamedItem("relative-posY");
-                    sValue = presObjPosY->getNodeValue();
-                    propvalue[3] = sValue.toDouble();
+                Reference<XNode> presObjPosY = presObjAttributes->getNamedItem("relative-posY");
+                sValue = presObjPosY->getNodeValue();
+                propvalue[3] = sValue.toDouble();
 
-                    if(count == 0)
-                    {
-                        Size aSize ( aTitleRect.GetSize() );
-                        aSize.setHeight( basegfx::fround(aSize.Height() * propvalue[0]) );
-                        aSize.setWidth( basegfx::fround(aSize.Width() * propvalue[1]) );
-                        Point aPos( basegfx::fround(aTitlePos.X() +(aSize.Width() * propvalue[2])),
-                                    basegfx::fround(aTitlePos.Y() + (aSize.Height() * propvalue[3])) );
-                        rRectangle[count] = ::tools::Rectangle(aPos, aSize);
-                        count = count+1;
-                    }
-                    else
-                    {
-                        Size aSize( basegfx::fround(aLayoutSize.Width() * propvalue[1]),
-                                    basegfx::fround(aLayoutSize.Height() * propvalue[0]) );
-                        Point aPos( basegfx::fround(aLayoutPos.X() +(aSize.Width() * propvalue[2])),
-                                    basegfx::fround(aLayoutPos.Y() + (aSize.Height() * propvalue[3])) );
-                        rRectangle[count] = ::tools::Rectangle (aPos, aSize);
-                        count = count+1;
-                    }
+                if(count == 0)
+                {
+                    Size aSize ( aTitleRect.GetSize() );
+                    aSize.setHeight( basegfx::fround(aSize.Height() * propvalue[0]) );
+                    aSize.setWidth( basegfx::fround(aSize.Width() * propvalue[1]) );
+                    Point aPos( basegfx::fround(aTitlePos.X() +(aSize.Width() * propvalue[2])),
+                                basegfx::fround(aTitlePos.Y() + (aSize.Height() * propvalue[3])) );
+                    rRectangle[count] = ::tools::Rectangle(aPos, aSize);
+                    count = count+1;
+                }
+                else
+                {
+                    Size aSize( basegfx::fround(aLayoutSize.Width() * propvalue[1]),
+                                basegfx::fround(aLayoutSize.Height() * propvalue[0]) );
+                    Point aPos( basegfx::fround(aLayoutPos.X() +(aSize.Width() * propvalue[2])),
+                                basegfx::fround(aLayoutPos.Y() + (aSize.Height() * propvalue[3])) );
+                    rRectangle[count] = ::tools::Rectangle (aPos, aSize);
+                    count = count+1;
                 }
             }
-            break;
         }
     }
 }
diff --git a/sd/source/core/sdpage2.cxx b/sd/source/core/sdpage2.cxx
index 996f9760f121..6a6355c7de68 100644
--- a/sd/source/core/sdpage2.cxx
+++ b/sd/source/core/sdpage2.cxx
@@ -198,12 +198,11 @@ void SdPage::SetPresentationLayout(const OUString& rLayoutName,
             }
 
 
-            std::vector<SfxStyleSheetBase*>::iterator iterOut = aOutlineStyles.begin();
             std::vector<SfxStyleSheetBase*>::iterator iterOldOut = aOldOutlineStyles.begin();
 
-            while (iterOut != aOutlineStyles.end())
+            for (auto& rpOut : aOutlineStyles)
             {
-                SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>(*iterOut);
+                SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>(rpOut);
                 SfxStyleSheet* pOldSheet = static_cast<SfxStyleSheet*>(*iterOldOut);
 
                 if (pSheet != pOldSheet)
@@ -215,18 +214,15 @@ void SdPage::SetPresentationLayout(const OUString& rLayoutName,
                         pObj->StartListening(*pSheet);
                 }
 
-                ++iterOut;
                 ++iterOldOut;
             }
 
             OutlinerParaObject* pOPO = pObj->GetOutlinerParaObject();
             if ( bReplaceStyleSheets && pOPO )
             {
-                std::vector<StyleReplaceData>::const_iterator it = aReplList.begin();
-                while (it != aReplList.end())
+                for (const auto& rRepl : aReplList)
                 {
-                    pOPO->ChangeStyleSheets( it->aName, it->nFamily, it->aNewName, it->nNewFamily );
-                    ++it;
+                    pOPO->ChangeStyleSheets( rRepl.aName, rRepl.nFamily, rRepl.aNewName, rRepl.nNewFamily );
                 }
             }
         }
@@ -273,10 +269,9 @@ void SdPage::EndListenOutlineText()
         std::vector<SfxStyleSheetBase*> aOutlineStyles;
         pSPool->CreateOutlineSheetList(aTrueLayoutName,aOutlineStyles);
 
-        std::vector<SfxStyleSheetBase*>::iterator iter;
-        for (iter = aOutlineStyles.begin(); iter != aOutlineStyles.end(); ++iter)
+        for (auto& rpStyle : aOutlineStyles)
         {
-            SfxStyleSheet *pSheet = static_cast<SfxStyleSheet*>(*iter);
+            SfxStyleSheet *pSheet = static_cast<SfxStyleSheet*>(rpStyle);
             pOutlineTextObj->EndListening(*pSheet);
         }
     }
@@ -380,9 +375,8 @@ void SdPage::lateInit(const SdPage& rSrcPage)
 
     // use shape list directly to preserve constness of rSrcPage
     const std::list< SdrObject* >& rShapeList = rSrcPage.maPresentationShapeList.getList();
-    for( std::list< SdrObject* >::const_iterator aIter = rShapeList.begin(); aIter != rShapeList.end(); ++aIter )
+    for( SdrObject* pObj : rShapeList )
     {
-        SdrObject* pObj = *aIter;
         InsertPresObj(GetObj(pObj->GetOrdNum()), rSrcPage.GetPresObjKind(pObj));
     }
 
diff --git a/sd/source/core/shapelist.cxx b/sd/source/core/shapelist.cxx
index b6969592a826..879302f5fa43 100644
--- a/sd/source/core/shapelist.cxx
+++ b/sd/source/core/shapelist.cxx
@@ -76,9 +76,8 @@ void ShapeList::clear()
     ListImpl aShapeList;
     aShapeList.swap( maShapeList );
 
-    ListImpl::iterator aIter( aShapeList.begin() );
-    while( aIter != aShapeList.end() )
-        (*aIter++)->RemoveObjectUser(*this);
+    for( auto& rpShape : aShapeList )
+        rpShape->RemoveObjectUser(*this);
 
     maIter = aShapeList.end();
 }
@@ -128,8 +127,8 @@ SdrObject* ShapeList::getNextShape()
 void ShapeList::seekShape( sal_uInt32 nIndex )
 {
     maIter = maShapeList.begin();
-    while( nIndex-- && (maIter != maShapeList.end()) )
-        ++maIter;
+    nIndex = std::min(nIndex, static_cast<sal_uInt32>(maShapeList.size()));
+    std::advance(maIter, nIndex);
 }
 
 bool ShapeList::hasMore() const
diff --git a/sd/source/core/stlfamily.cxx b/sd/source/core/stlfamily.cxx
index 62eab7b25e43..98b8a33685aa 100644
--- a/sd/source/core/stlfamily.cxx
+++ b/sd/source/core/stlfamily.cxx
@@ -227,11 +227,10 @@ Sequence< OUString > SAL_CALL SdStyleFamily::getElementNames()
         PresStyleMap& rStyleMap = mpImpl->getStyleSheets();
         Sequence< OUString > aNames( rStyleMap.size() );
 
-        PresStyleMap::iterator iter( rStyleMap.begin() );
         OUString* pNames = aNames.getArray();
-        while( iter != rStyleMap.end() )
+        for( const auto& rEntry : rStyleMap )
         {
-            rtl::Reference< SdStyleSheet > xStyle( (*iter++).second );
+            rtl::Reference< SdStyleSheet > xStyle( rEntry.second );
             if( xStyle.is() )
             {
                 *pNames++ = xStyle->GetApiName();
@@ -350,14 +349,11 @@ Any SAL_CALL SdStyleFamily::getByIndex( sal_Int32 Index )
         if( mnFamily == SfxStyleFamily::Page )
         {
             PresStyleMap& rStyleSheets = mpImpl->getStyleSheets();
-            if( !rStyleSheets.empty() )
+            if( Index < static_cast<sal_Int32>(rStyleSheets.size()) )
             {
                 PresStyleMap::iterator iter( rStyleSheets.begin() );
-                while( Index-- && (iter != rStyleSheets.end()) )
-                    ++iter;
-
-                if( (Index==-1) && (iter != rStyleSheets.end()) )
-                    return Any( Reference< XStyle >( (*iter).second.get() ) );
+                std::advance(iter, Index);
+                return Any( Reference< XStyle >( (*iter).second.get() ) );
             }
         }
         else
diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx
index 2cb12ccfcf79..67651c71e21f 100644
--- a/sd/source/core/stlpool.cxx
+++ b/sd/source/core/stlpool.cxx
@@ -81,12 +81,10 @@ namespace
 
 OUString lcl_findRenamedStyleName(std::vector< std::pair< OUString, OUString > > &rRenamedList, OUString const & aOriginalName )
 {
-    std::vector< std::pair< OUString, OUString > >::iterator aIter;
-    for( aIter = rRenamedList.begin(); aIter != rRenamedList.end(); ++aIter )
-    {
-        if((*aIter).first == aOriginalName )
-            return (*aIter).second;
-    }
+    auto aIter = std::find_if(rRenamedList.begin(), rRenamedList.end(),
+        [&aOriginalName](const std::pair<OUString, OUString>& rItem) { return rItem.first == aOriginalName; });
+    if (aIter != rRenamedList.end())
+        return (*aIter).second;
     return OUString();
 }
 
@@ -633,10 +631,9 @@ void SdStyleSheetPool::CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily
     HasFamilyPredicate aHasFamilyPredicate(eFamily);
     std::vector<unsigned> aSheetsWithFamily = rSourcePool.GetIndexedStyleSheets().FindPositionsByPredicate(aHasFamilyPredicate);
 
-    for (std::vector<unsigned>::const_iterator it = aSheetsWithFamily.begin();
-         it != aSheetsWithFamily.end(); ++it )
+    for (const auto& rPos : aSheetsWithFamily)
     {
-        SfxStyleSheetBase* pSheet = rSourcePool.GetStyleSheetByPositionInIndex( *it );
+        SfxStyleSheetBase* pSheet = rSourcePool.GetStyleSheetByPositionInIndex( rPos );
         if( !pSheet )
             continue;
         OUString aName( pSheet->GetName() );
@@ -701,20 +698,19 @@ void SdStyleSheetPool::CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily
     }
 
     // set parents on newly added stylesheets
-    std::vector< std::pair< rtl::Reference< SfxStyleSheetBase >, OUString > >::iterator aIter;
-    for( aIter = aNewStyles.begin(); aIter != aNewStyles.end(); ++aIter )
+    for( auto& rStyle : aNewStyles )
     {
         if( !rRenameSuffix.isEmpty() )
         {
-            SfxStyleSheet *pParent = lcl_findStyle(rCreatedSheets, lcl_findRenamedStyleName(aRenamedList, (*aIter).second));
+            SfxStyleSheet *pParent = lcl_findStyle(rCreatedSheets, lcl_findRenamedStyleName(aRenamedList, rStyle.second));
             if( pParent )
             {
-                (*aIter).first->SetParent( pParent->GetName() );
+                rStyle.first->SetParent( pParent->GetName() );
                 continue;
             }
         }
-        DBG_ASSERT( rSourcePool.Find( (*aIter).second, eFamily ), "StyleSheet has invalid parent: Family mismatch" );
-        (*aIter).first->SetParent( (*aIter).second );
+        DBG_ASSERT( rSourcePool.Find( rStyle.second, eFamily ), "StyleSheet has invalid parent: Family mismatch" );
+        rStyle.first->SetParent( rStyle.second );
     }
     // we have changed names of style sheets. Trigger reindexing.
     Reindex();
@@ -738,17 +734,17 @@ void SdStyleSheetPool::CopyLayoutSheets(const OUString& rLayoutName, SdStyleShee
     std::vector<OUString> aNameList;
     CreateLayoutSheetNames(rLayoutName,aNameList);
 
-    for (std::vector<OUString>::const_iterator it = aNameList.begin(); it != aNameList.end(); ++it)
+    for (const auto& rName : aNameList)
     {
-        pSheet = Find(*it, SfxStyleFamily::Page);
+        pSheet = Find(rName, SfxStyleFamily::Page);
         if (!pSheet)
         {
-            SfxStyleSheetBase* pSourceSheet = rSourcePool.Find(*it, SfxStyleFamily::Page);
+            SfxStyleSheetBase* pSourceSheet = rSourcePool.Find(rName, SfxStyleFamily::Page);
             DBG_ASSERT(pSourceSheet, "CopyLayoutSheets: Style sheet missing");
             if (pSourceSheet)
             {
                 // In the case one comes with Methusalem-Docs.
-                SfxStyleSheetBase& rNewSheet = Make(*it, SfxStyleFamily::Page);
+                SfxStyleSheetBase& rNewSheet = Make(rName, SfxStyleFamily::Page);
                 OUString file;
                 rNewSheet.SetHelpId( file, pSourceSheet->GetHelpId( file ) );
                 rNewSheet.GetItemSet().Put(pSourceSheet->GetItemSet());
@@ -933,10 +929,9 @@ void SdStyleSheetPool::UpdateStdNames()
     StyleSheetIsUserDefinedPredicate aPredicate;
     std::vector<SfxStyleSheetBase*> aEraseList;
     std::vector<unsigned> aUserDefinedStyles = GetIndexedStyleSheets().FindPositionsByPredicate(aPredicate);
-    for (std::vector<unsigned>::const_iterator it = aUserDefinedStyles.begin();
-            it != aUserDefinedStyles.end(); ++it)
+    for (const auto& rStyle : aUserDefinedStyles)
     {
-        SfxStyleSheetBase* pStyle = GetStyleSheetByPositionInIndex(*it);
+        SfxStyleSheetBase* pStyle = GetStyleSheetByPositionInIndex(rStyle);
 
         if( !pStyle->IsUserDefined() )
         {
@@ -1259,11 +1254,10 @@ Any SAL_CALL SdStyleSheetPool::getByName( const OUString& aName )
     if( msTableFamilyName == aName )
         return Any( mxTableFamily );
 
-    for( SdStyleFamilyMap::iterator iter( maStyleFamilyMap.begin() ); iter != maStyleFamilyMap.end(); ++iter )
-    {
-        if( (*iter).second->getName() == aName )
-            return Any( Reference< XNameAccess >( static_cast< XNameAccess* >( (*iter).second.get() ) ) );
-    }
+    auto iter = std::find_if(maStyleFamilyMap.begin(), maStyleFamilyMap.end(),
+            [&aName](const SdStyleFamilyMap::value_type& rEntry) { return rEntry.second->getName() == aName; });
+    if (iter != maStyleFamilyMap.end())
+        return Any( Reference< XNameAccess >( static_cast< XNameAccess* >( (*iter).second.get() ) ) );
 
     throw NoSuchElementException();
 }
@@ -1279,9 +1273,9 @@ Sequence< OUString > SAL_CALL SdStyleSheetPool::getElementNames()
     *pNames++ = mxCellFamily->getName();
     *pNames++ = msTableFamilyName;
 
-    for( SdStyleFamilyMap::iterator iter( maStyleFamilyMap.begin() ); iter != maStyleFamilyMap.end(); ++iter )
+    for( const auto& rEntry : maStyleFamilyMap )
     {
-        *pNames++ = (*iter).second->getName();
+        *pNames++ = rEntry.second->getName();
     }
 
     return aNames;
@@ -1300,13 +1294,8 @@ sal_Bool SAL_CALL SdStyleSheetPool::hasByName( const OUString& aName )
     if( msTableFamilyName == aName )
         return true;
 
-    for( SdStyleFamilyMap::iterator iter( maStyleFamilyMap.begin() ); iter != maStyleFamilyMap.end(); ++iter )
-    {
-        if( (*iter).second->getName() == aName )
-            return true;
-    }
-
-    return false;
+    return std::any_of(maStyleFamilyMap.begin(), maStyleFamilyMap.end(),
+        [&aName](const SdStyleFamilyMap::value_type& rEntry) { return rEntry.second->getName() == aName; });
 }
 
 // XElementAccess
@@ -1351,8 +1340,7 @@ Any SAL_CALL SdStyleSheetPool::getByIndex( sal_Int32 Index )
             if( (Index < 0) || (Index >= sal::static_int_cast<sal_Int32>(maStyleFamilyMap.size())) )
                 throw IndexOutOfBoundsException();
             SdStyleFamilyMap::iterator iter( maStyleFamilyMap.begin() );
-            while( Index-- )
-                ++iter;
+            std::advance(iter, Index);
 
             return Any( Reference< XNameAccess >( static_cast< XNameAccess* >( (*iter).second.get() ) ) );
         }
@@ -1378,9 +1366,9 @@ void SAL_CALL SdStyleSheetPool::dispose()
         SdStyleFamilyMap aTempMap;
         aTempMap.swap( maStyleFamilyMap );
 
-        for( SdStyleFamilyMap::iterator iter( aTempMap.begin() ); iter != aTempMap.end(); ++iter ) try
+        for( auto& rEntry : aTempMap ) try
         {
-            (*iter).second->dispose();
+            rEntry.second->dispose();
         }
         catch( Exception& )
         {
diff --git a/sd/source/filter/eppt/eppt.cxx b/sd/source/filter/eppt/eppt.cxx
index 65a9413b9441..7da772eb2ad2 100644
--- a/sd/source/filter/eppt/eppt.cxx
+++ b/sd/source/filter/eppt/eppt.cxx
@@ -125,15 +125,10 @@ void PPTWriter::exportPPTPre( const std::vector< css::beans::PropertyValue >& rM
     if ( !mpPicStrm )
         mpPicStrm.reset( mrStg->OpenSotStream( "Pictures" ) );
 
-    for (std::vector< css::beans::PropertyValue >::const_iterator aIter( rMediaData.begin() ), aEnd( rMediaData.end() );
-        aIter != aEnd ; ++aIter)
-    {
-        if ( (*aIter).Name == "BaseURI" )
-        {
-            (*aIter).Value >>= maBaseURI;
-            break;
-        }
-    }
+    auto aIter = std::find_if(rMediaData.begin(), rMediaData.end(),
+        [](const css::beans::PropertyValue& rProp) { return rProp.Name == "BaseURI"; });
+    if (aIter != rMediaData.end())
+        (*aIter).Value >>= maBaseURI;
     mpPptEscherEx.reset( new PptEscherEx( *mpStrm, maBaseURI ) );
 }
 
@@ -925,7 +920,7 @@ void PPTWriter::ImplCreateHyperBlob( SvMemoryStream& rStrm )
     rStrm.WriteUInt32( 0 );         // property size
     rStrm.WriteUInt32( 0 );         // property count
 
-    for ( std::vector<EPPTHyperlink>::const_iterator pIter = maHyperlink.begin(); pIter != maHyperlink.end(); ++pIter )
+    for ( const auto& rHyperlink : maHyperlink )
     {
         nParaCount += 6;
         rStrm  .WriteUInt32( 3 )    // Type VT_I4
@@ -949,15 +944,15 @@ void PPTWriter::ImplCreateHyperBlob( SvMemoryStream& rStrm )
         //          = 7 :    "         "      " " (PPT) text range
         //          = 8 :    "         "      " " (Project) task
 
-        sal_Int32 nUrlLen = pIter->aURL.getLength();
-        const OUString& rUrl = pIter->aURL;
+        sal_Int32 nUrlLen = rHyperlink.aURL.getLength();
+        const OUString& rUrl = rHyperlink.aURL;
 
         sal_uInt32 const nInfo = 7;
 
         rStrm  .WriteUInt32( 3 )    // Type VT_I4
                .WriteUInt32( nInfo );       // Info
 
-        switch( pIter->nType & 0xff )
+        switch( rHyperlink.nType & 0xff )
         {
             case 1 :        // click action to slidenumber
             {
@@ -1250,9 +1245,9 @@ void PPTWriter::ImplWriteOLE( )
 
     SvxMSExportOLEObjects aOleExport( mnCnvrtFlags );
 
-    for ( auto it = maExOleObj.begin(); it != maExOleObj.end(); ++it )
+    for ( auto& rxExOleObjEntry : maExOleObj )
     {
-        PPTExOleObjEntry* pPtr = it->get();
+        PPTExOleObjEntry* pPtr = rxExOleObjEntry.get();
         std::unique_ptr<SvMemoryStream> pStrm;
         pPtr->nOfsB = mpStrm->Tell();
         switch ( pPtr->eType )
@@ -1374,9 +1369,9 @@ void PPTWriter::ImplWriteAtomEnding()
         }
     }
     // Ole persists
-    for ( auto it = maExOleObj.begin(); it != maExOleObj.end(); ++it )
+    for ( auto& rxExOleObjEntry : maExOleObj )
     {
-        PPTExOleObjEntry* pPtr = it->get();
+        PPTExOleObjEntry* pPtr = rxExOleObjEntry.get();
         nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_ExObj );
         if ( nOfs )
         {
diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx
index 0001d90e2bb1..a48ea1e6d1b4 100644
--- a/sd/source/filter/eppt/epptso.cxx
+++ b/sd/source/filter/eppt/epptso.cxx
@@ -1462,10 +1462,9 @@ void PPTWriter::ImplWriteClickAction( SvStream& rSt, css::presentation::ClickAct
             {
                 OUString  aBookmark( *o3tl::doAccess<OUString>(mAny) );
                 sal_uInt32 nIndex = 0;
-                std::vector<OUString>::const_iterator pIter;
-                for ( pIter = maSlideNameList.begin(); pIter != maSlideNameList.end(); ++pIter, nIndex++ )
+                for ( const auto& rSlideName : maSlideNameList )
                 {
-                    if ( *pIter == aBookmark )
+                    if ( rSlideName == aBookmark )
                     {
                         // Bookmark is a link to a document page
                         nAction = 4;
@@ -1478,6 +1477,7 @@ void PPTWriter::ImplWriteClickAction( SvStream& rSt, css::presentation::ClickAct
                         aHyperString += OUString::number(nIndex + 1);
                         nHyperLinkID = ImplInsertBookmarkURL( aHyperString, 1 | ( nIndex << 8 ) | ( 1U << 31 ), aBookmark, "", "", aHyperString );
                     }
+                    nIndex++;
                 }
             }
         }
@@ -3141,9 +3141,8 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape > const & rXSha
                     .WriteUInt16( nRowCount )
                     .WriteUInt16( 4 );
 
-            std::vector< std::pair< sal_Int32, sal_Int32 > >::const_iterator aIter( aRows.begin() );
-            while( aIter != aRows.end() )
-                aMemStrm.WriteInt32( (*aIter++).second );
+            for( const auto& rRow : aRows )
+                aMemStrm.WriteInt32( rRow.second );
 
             aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x1000100 );
             aPropOpt2.AddOpt( ESCHER_Prop_tableProperties, 1 );
diff --git a/sd/source/filter/eppt/pptexanimations.cxx b/sd/source/filter/eppt/pptexanimations.cxx
index 9157fd18f93e..59b9d2bca504 100644
--- a/sd/source/filter/eppt/pptexanimations.cxx
+++ b/sd/source/filter/eppt/pptexanimations.cxx
@@ -409,27 +409,18 @@ void AnimationExporter::processAfterEffectNodes( const Reference< XAnimationNode
 
 bool AnimationExporter::isAfterEffectNode( const Reference< XAnimationNode >& xNode ) const
 {
-    const std::vector< AfterEffectNodePtr >::const_iterator aEnd( maAfterEffectNodes.end() );
-    for (std::vector< AfterEffectNodePtr >::const_iterator aIter( maAfterEffectNodes.begin() );
-         aIter != aEnd ; ++aIter)
-    {
-        if( (*aIter)->mxNode == xNode )
-            return true;
-    }
-    return false;
+    return std::any_of(maAfterEffectNodes.begin(), maAfterEffectNodes.end(),
+        [&xNode](const AfterEffectNodePtr& rxNode) { return rxNode->mxNode == xNode; });
 }
 
 bool AnimationExporter::hasAfterEffectNode( const Reference< XAnimationNode >& xNode, Reference< XAnimationNode >& xAfterEffectNode ) const
 {
-    const std::vector< AfterEffectNodePtr >::const_iterator aEnd( maAfterEffectNodes.end() );
-    for (std::vector< AfterEffectNodePtr >::const_iterator aIter( maAfterEffectNodes.begin() );
-        aIter != aEnd ; ++aIter)
+    auto aIter = std::find_if(maAfterEffectNodes.begin(), maAfterEffectNodes.end(),
+        [&xNode](const AfterEffectNodePtr& rxNode) { return rxNode->mxMaster == xNode; });
+    if (aIter != maAfterEffectNodes.end())
     {
-        if( (*aIter)->mxMaster == xNode )
-        {
-            xAfterEffectNode = (*aIter)->mxNode;
-            return true;
-        }
+        xAfterEffectNode = (*aIter)->mxNode;
+        return true;
     }
 
     return false;
diff --git a/sd/source/filter/eppt/pptexsoundcollection.cxx b/sd/source/filter/eppt/pptexsoundcollection.cxx
index 8a3330237fa0..9d3342ca6497 100644
--- a/sd/source/filter/eppt/pptexsoundcollection.cxx
+++ b/sd/source/filter/eppt/pptexsoundcollection.cxx
@@ -152,13 +152,10 @@ sal_uInt32 ExSoundCollection::GetId(const OUString& rString)
     if (!rString.isEmpty())
     {
         const sal_uInt32 nSoundCount = maEntries.size();
-        std::vector<ExSoundEntry>::const_iterator iter;
 
-        for (iter = maEntries.begin(); iter != maEntries.end(); ++iter, ++nSoundId)
-        {
-            if (iter->IsSameURL(rString))
-                break;
-        }
+        auto iter = std::find_if(maEntries.begin(), maEntries.end(),
+            [&rString](const ExSoundEntry& rEntry) { return rEntry.IsSameURL(rString); });
+        nSoundId = static_cast<sal_uInt32>(std::distance(maEntries.begin(), iter));
 
         if ( nSoundId++ == nSoundCount )
         {
@@ -180,10 +177,12 @@ sal_uInt32 ExSoundCollection::GetSize() const
     if (!maEntries.empty())
     {
         nSize += 8 + 12;    // size of SoundCollectionContainerHeader + SoundCollAtom
-        std::vector<ExSoundEntry>::const_iterator iter;
         sal_uInt32 i = 1;
-        for ( iter = maEntries.begin(); iter != maEntries.end(); ++iter, ++i)
-            nSize += iter->GetSize(i);
+        for ( const auto& rEntry : maEntries )
+        {
+            nSize += rEntry.GetSize(i);
+            ++i;
+        }
     }
     return nSize;
 }
@@ -201,9 +200,11 @@ void ExSoundCollection::Write( SvStream& rSt ) const
         // create SoundCollAtom ( reference to the next free SoundId );
         rSt.WriteUInt32( EPP_SoundCollAtom << 16 ).WriteUInt32( 4 ).WriteUInt32( nSoundCount );
 
-        std::vector<ExSoundEntry>::const_iterator iter;
-        for ( iter = maEntries.begin(); iter != maEntries.end(); ++iter, ++i)
-            iter->Write(rSt,i);
+        for ( const auto& rEntry : maEntries )
+        {
+            rEntry.Write(rSt,i);
+            ++i;
+        }
     }
 }
 
diff --git a/sd/source/filter/html/buttonset.cxx b/sd/source/filter/html/buttonset.cxx
index da0bdd77023f..d79ebc862450 100644
--- a/sd/source/filter/html/buttonset.cxx
+++ b/sd/source/filter/html/buttonset.cxx
@@ -223,11 +223,8 @@ bool ButtonSetImpl::getPreview( int nSet, const std::vector< OUString >& rButton
 
         Point aPos;
 
-        std::vector< Graphic >::iterator aGraphIter( aGraphics.begin() );
-        while( aGraphIter != aGraphics.end() )
+        for( Graphic& aGraphic : aGraphics )
         {
-            Graphic aGraphic( *aGraphIter++ );
-
             aGraphic.Draw( pDev, aPos );
 
             aPos.AdjustX(aGraphic.GetSizePixel().Width() + 3 );
diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx
index a8afa9567e42..745c42d88bd1 100644
--- a/sd/source/filter/html/htmlex.cxx
+++ b/sd/source/filter/html/htmlex.cxx
@@ -1428,10 +1428,8 @@ OUString HtmlExport::ParagraphToHTMLString( SdrOutliner const * pOutliner, sal_I
     rEditEngine.GetPortions( nPara, aPortionList );
 
     sal_Int32 nPos1 = 0;
-    for( std::vector<sal_Int32>::const_iterator it( aPortionList.begin() ); it != aPortionList.end(); ++it )
+    for( sal_Int32 nPos2 : aPortionList )
     {
-        sal_Int32 nPos2 = *it;
-
         ESelection aSelection( nPara, nPos1, nPara, nPos2);
 
         SfxItemSet aSet( rEditEngine.GetAttribs( aSelection ) );
diff --git a/sd/source/filter/html/pubdlg.cxx b/sd/source/filter/html/pubdlg.cxx
index b41707a6d370..6d12c5d0ae9c 100644
--- a/sd/source/filter/html/pubdlg.cxx
+++ b/sd/source/filter/html/pubdlg.cxx
@@ -18,6 +18,7 @@
  */
 
 #include <com/sun/star/beans/PropertyValue.hpp>
+#include <comphelper/sequence.hxx>
 #include <unotools/ucbstreamhelper.hxx>
 #include <vcl/lstbox.hxx>
 #include <vcl/FilterConfigItem.hxx>
@@ -464,9 +465,8 @@ SdPublishingDlg::SdPublishingDlg(vcl::Window* pWindow, DocumentType eDocType)
     pPage5_Buttons->SetLineCount( 4 );
     pPage5_Buttons->SetExtraSpacing( 1 );
 
-    std::vector<SdPublishingDesign>::iterator it;
-    for( it = m_aDesignList.begin(); it != m_aDesignList.end(); ++it )
-        pPage1_Designs->InsertEntry(it->m_aDesignName);
+    for( const auto& rDesign : m_aDesignList )
+        pPage1_Designs->InsertEntry(rDesign.m_aDesignName);
 
     pPage6_Preview->SetBorderStyle(WindowBorderStyle::MONO);
 
@@ -924,13 +924,7 @@ void SdPublishingDlg::GetParameterSequence( Sequence< PropertyValue >& rParams )
         aProps.push_back( aValue );
     }
 
-    rParams.realloc( aProps.size() );
-    PropertyValue* pParams = rParams.getArray();
-
-    for( std::vector< PropertyValue >::iterator i = aProps.begin(); i != aProps.end(); ++i )
-    {
-        *pParams++ = *i;
-    }
+    rParams = comphelper::containerToSequence(aProps);
 }
 
 // Clickhandler for the radiobuttons of the design-selection
@@ -1146,12 +1140,8 @@ IMPL_LINK_NOARG(SdPublishingDlg, FinishHdl, Button*, void)
             {
                 aDesign.m_aDesignName = aDlg.GetDesignName();
 
-                std::vector<SdPublishingDesign>::iterator iter;
-                for (iter = m_aDesignList.begin(); iter != m_aDesignList.end(); ++iter)
-                {
-                    if (iter->m_aDesignName == aDesign.m_aDesignName)
-                        break;
-                }
+                auto iter = std::find_if(m_aDesignList.begin(), m_aDesignList.end(),
+                    [&aDesign](const SdPublishingDesign& rDesign) { return rDesign.m_aDesignName == aDesign.m_aDesignName; });
 
                 if (iter != m_aDesignList.end())
                 {
diff --git a/sd/source/filter/ppt/ppt97animations.cxx b/sd/source/filter/ppt/ppt97animations.cxx
index fe2f9010846e..6b65319ba2f3 100644
--- a/sd/source/filter/ppt/ppt97animations.cxx
+++ b/sd/source/filter/ppt/ppt97animations.cxx
@@ -646,13 +646,12 @@ void Ppt97Animation::createAndSetCustomAnimationEffect( SdrObject* pObj )
         if( pGroup )
         {
             const ::sd::EffectSequence& rEffects = pGroup->getEffects();
-            ::sd::EffectSequence::const_iterator aIter = rEffects.begin();
 
             ::sd::CustomAnimationEffectPtr pLastEffect;
             sal_Int32 nIndex = 0;
-            for( ; aIter != rEffects.end(); ++aIter )
+            for( const auto& rxEffect : rEffects )
             {
-                ::sd::CustomAnimationEffectPtr pGroupEffect(*aIter);
+                ::sd::CustomAnimationEffectPtr pGroupEffect(rxEffect);
 
                 ////todo? if( nIndex > 1 && pLastEffect && HasSoundEffect() )
                 ////          pLastEffect->setStopAudio();
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index f5d10bfde69b..066b8ef203e0 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -1854,14 +1854,11 @@ void ImplSdPPTImport::ImportPageEffect( SdPage* pPage, const bool bNewAnimations
 
         std::sort( aAnimationsOnThisPage.begin(), aAnimationsOnThisPage.end(), Ppt97AnimationStlSortHelper() );
 
-        tAnimationVector::iterator aIter( aAnimationsOnThisPage.begin() );
-        const tAnimationVector::iterator aEnd( aAnimationsOnThisPage.end() );
-
-        for( ;aIter != aEnd; ++aIter )
+        for( auto& rEntry : aAnimationsOnThisPage )
         {
-            Ppt97AnimationPtr pPpt97Animation = (*aIter).second;
+            Ppt97AnimationPtr pPpt97Animation = rEntry.second;
             if( pPpt97Animation.get() )
-                pPpt97Animation->createAndSetCustomAnimationEffect( (*aIter).first );
+                pPpt97Animation->createAndSetCustomAnimationEffect( rEntry.first );
         }
     }
     rStCtrl.Seek( nFilePosMerk );
diff --git a/sd/source/filter/ppt/pptinanimations.cxx b/sd/source/filter/ppt/pptinanimations.cxx
index fa29ba6bf1f5..b8e24a39f9d8 100644
--- a/sd/source/filter/ppt/pptinanimations.cxx
+++ b/sd/source/filter/ppt/pptinanimations.cxx
@@ -2910,14 +2910,12 @@ void AnimationImporter::dump( const PropertySet& rSet )
 {
     // dump property set
 
-    map< sal_Int32, Any >::const_iterator aIter( rSet.maProperties.begin() );
-    const map< sal_Int32, Any >::const_iterator aEnd( rSet.maProperties.end() );
-    while( aIter != aEnd )
+    for( const auto& rProp : rSet.maProperties )
     {
         bool bKnown = false;
 
-        const sal_Int32 nInstance = (*aIter).first;
-        Any aAny( (*aIter).second );
+        const sal_Int32 nInstance = rProp.first;
+        Any aAny( rProp.second );
 
         switch ( nInstance )
         {
@@ -3158,8 +3156,6 @@ void AnimationImporter::dump( const PropertySet& rSet )
             dump( aAny );
             fprintf( mpFile, "\"" );
         }
-
-        ++aIter;
     }
 }
 
diff --git a/sd/source/filter/ppt/propread.cxx b/sd/source/filter/ppt/propread.cxx
index 629efdca58df..a70995286764 100644
--- a/sd/source/filter/ppt/propread.cxx
+++ b/sd/source/filter/ppt/propread.cxx
@@ -220,12 +220,8 @@ bool Section::GetProperty( sal_uInt32 nId, PropItem& rPropItem )
 {
     if ( nId )
     {
-        std::vector<std::unique_ptr<PropEntry> >::const_iterator iter;
-        for (iter = maEntries.begin(); iter != maEntries.end(); ++iter)
-        {
-            if ((*iter)->mnId == nId)
-                break;
-        }
+        auto iter = std::find_if(maEntries.begin(), maEntries.end(),
+            [nId](const std::unique_ptr<PropEntry>& rxEntry) { return rxEntry->mnId == nId; });
 
         if (iter != maEntries.end())
         {
@@ -249,29 +245,25 @@ void Section::AddProperty( sal_uInt32 nId, const sal_uInt8* pBuf, sal_uInt32 nBu
         nId = 0;
 
     // do not allow same PropId's, sort
-    std::vector<std::unique_ptr<PropEntry> >::iterator iter;
-    for ( iter = maEntries.begin(); iter != maEntries.end(); ++iter )
+    auto iter = std::find_if(maEntries.begin(), maEntries.end(),
+        [nId](const std::unique_ptr<PropEntry>& rxEntry) { return rxEntry->mnId >= nId; });
+    if (iter != maEntries.end())
     {
         if ( (*iter)->mnId == nId )
             (*iter).reset(new PropEntry( nId, pBuf, nBufSize ));
-        else if ( (*iter)->mnId > nId )
-            maEntries.insert( iter, o3tl::make_unique<PropEntry>( nId, pBuf, nBufSize ));
         else
-            continue;
-        return;
+            maEntries.insert( iter, o3tl::make_unique<PropEntry>( nId, pBuf, nBufSize ));
+    }
+    else
+    {
+        maEntries.push_back( o3tl::make_unique<PropEntry>( nId, pBuf, nBufSize ) );
     }
-
-    maEntries.push_back( o3tl::make_unique<PropEntry>( nId, pBuf, nBufSize ) );
 }
 
 void Section::GetDictionary(Dictionary& rDict)
 {
-    std::vector<std::unique_ptr<PropEntry> >::iterator iter;
-    for (iter = maEntries.begin(); iter != maEntries.end(); ++iter)
-    {
-        if ( (*iter)->mnId == 0 )
-            break;
-    }
+    auto iter = std::find_if(maEntries.begin(), maEntries.end(),
+        [](const std::unique_ptr<PropEntry>& rxEntry) { return rxEntry->mnId == 0; });
 
     if (iter == maEntries.end())
         return;
@@ -551,12 +543,10 @@ PropRead::PropRead( SotStorage& rStorage, const OUString& rName ) :
 
 const Section* PropRead::GetSection( const sal_uInt8* pFMTID )
 {
-    std::vector<std::unique_ptr<Section> >::iterator it;
-    for ( it = maSections.begin(); it != maSections.end(); ++it)
-    {
-        if ( memcmp( (*it)->GetFMTID(), pFMTID, 16 ) == 0 )
-            return it->get();
-    }
+    auto it = std::find_if(maSections.begin(), maSections.end(),
+        [&pFMTID](const std::unique_ptr<Section>& rxSection) { return memcmp( rxSection->GetFMTID(), pFMTID, 16 ) == 0; });
+    if (it != maSections.end())
+        return it->get();
     return nullptr;
 }
 


More information about the Libreoffice-commits mailing list