[Libreoffice-commits] core.git: vcl/qa vcl/source vcl/unx vcl/workben

Arkadiy Illarionov (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 18 07:44:15 UTC 2019


 vcl/qa/cppunit/canvasbitmaptest.cxx         |   46 ++++++++-------------
 vcl/source/components/fontident.cxx         |    6 --
 vcl/source/control/edit.cxx                 |   18 ++------
 vcl/source/filter/FilterConfigCache.cxx     |    4 -
 vcl/source/filter/FilterConfigItem.cxx      |   39 ++++++------------
 vcl/source/filter/graphicfilter.cxx         |   32 +++++++-------
 vcl/source/filter/jpeg/JpegWriter.cxx       |    9 +---
 vcl/source/filter/png/pngwrite.cxx          |   15 +++----
 vcl/source/filter/wmf/wmfexternal.cxx       |   10 ++--
 vcl/source/font/fontmetric.cxx              |   10 +---
 vcl/source/gdi/configsettings.cxx           |   14 ++----
 vcl/source/gdi/print3.cxx                   |   49 ++++++++--------------
 vcl/source/graphic/UnoGraphic.cxx           |    3 -
 vcl/source/graphic/UnoGraphicProvider.cxx   |   60 +++++++++++++++-------------
 vcl/source/helper/canvasbitmap.cxx          |   56 +++++++++++++-------------
 vcl/source/helper/canvastools.cxx           |   34 ++++++---------
 vcl/source/helper/commandinfoprovider.cxx   |   47 +++++++++------------
 vcl/source/uitest/logger.cxx                |    7 ---
 vcl/source/uitest/uitest.cxx                |    6 --
 vcl/source/uitest/uno/uiobject_uno.cxx      |    6 +-
 vcl/source/window/printdlg.cxx              |   15 +++----
 vcl/unx/generic/dtrans/X11_selection.cxx    |   21 +++------
 vcl/unx/generic/dtrans/X11_transferable.cxx |   11 ++---
 vcl/unx/gtk/a11y/atkaction.cxx              |   18 ++++----
 vcl/unx/gtk/a11y/atktable.cxx               |    4 -
 vcl/unx/gtk/a11y/atktextattributes.cxx      |   14 ++----
 vcl/unx/gtk/a11y/atkwrapper.cxx             |   11 ++---
 vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx    |   40 ++++++------------
 vcl/unx/gtk/salprn-gtk.cxx                  |   15 +++----
 vcl/unx/gtk3/gtk3gtkinst.cxx                |    4 -
 vcl/workben/vcldemo.cxx                     |    8 +--
 31 files changed, 270 insertions(+), 362 deletions(-)

New commits:
commit 452a8e4abe0c416d664078baddff67c1561025ec
Author:     Arkadiy Illarionov <qarkai at gmail.com>
AuthorDate: Sat Jun 15 17:13:48 2019 +0300
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Jun 18 09:43:08 2019 +0200

    Simplify Sequence iterations in vcl
    
    Use range-based loops or replace with comphelper or STL functions
    
    Change-Id: If046738084c2d13cc1eaea6a03aaf60b63f62767
    Reviewed-on: https://gerrit.libreoffice.org/74104
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/vcl/qa/cppunit/canvasbitmaptest.cxx b/vcl/qa/cppunit/canvasbitmaptest.cxx
index 070b8b6217a4..cf7a82c653ad 100644
--- a/vcl/qa/cppunit/canvasbitmaptest.cxx
+++ b/vcl/qa/cppunit/canvasbitmaptest.cxx
@@ -482,15 +482,13 @@ private:
     virtual uno::Sequence< rendering::RGBColor > SAL_CALL convertIntegerToRGB( const uno::Sequence< ::sal_Int8 >& deviceColor ) override
     {
         const uno::Sequence< rendering::ARGBColor > aTemp( convertIntegerToARGB(deviceColor) );
-        const std::size_t nLen(aTemp.getLength());
-        uno::Sequence< rendering::RGBColor > aRes( nLen );
-        rendering::RGBColor* pOut = aRes.getArray();
-        for( std::size_t i=0; i<nLen; ++i )
-        {
-            *pOut++ = rendering::RGBColor(aTemp[i].Red,
-                                          aTemp[i].Green,
-                                          aTemp[i].Blue);
-        }
+        uno::Sequence< rendering::RGBColor > aRes( aTemp.getLength() );
+        std::transform(aTemp.begin(), aTemp.end(), aRes.begin(),
+            [](const rendering::ARGBColor& rColor) {
+                return rendering::RGBColor(rColor.Red,
+                                           rColor.Green,
+                                           rColor.Blue);
+        });
 
         return aRes;
     }
@@ -503,21 +501,18 @@ private:
                                0, static_cast<int>(nLen%nBytesPerPixel));
 
         uno::Sequence< rendering::ARGBColor > aRes( nLen / nBytesPerPixel );
-        rendering::ARGBColor* pOut( aRes.getArray() );
 
         if( getPalette().is() )
         {
-            for( std::size_t i=0; i<nLen; ++i )
-            {
-                *pOut++ = rendering::ARGBColor(
-                    1.0,
-                    vcl::unotools::toDoubleColor(deviceColor[i]),
-                    vcl::unotools::toDoubleColor(deviceColor[i]),
-                    vcl::unotools::toDoubleColor(deviceColor[i]));
-            }
+            std::transform(deviceColor.begin(), deviceColor.end(), aRes.begin(),
+                [](sal_Int8 nIn) {
+                    auto fColor = vcl::unotools::toDoubleColor(nIn);
+                    return rendering::ARGBColor(1.0, fColor, fColor, fColor);
+                });
         }
         else
         {
+            rendering::ARGBColor* pOut( aRes.getArray() );
             for( std::size_t i=0; i<nLen; i+=4 )
             {
                 *pOut++ = rendering::ARGBColor(
@@ -540,21 +535,18 @@ private:
                                0, static_cast<int>(nLen%nBytesPerPixel));
 
         uno::Sequence< rendering::ARGBColor > aRes( nLen / nBytesPerPixel );
-        rendering::ARGBColor* pOut( aRes.getArray() );
 
         if( getPalette().is() )
         {
-            for( std::size_t i=0; i<nLen; ++i )
-            {
-                *pOut++ = rendering::ARGBColor(
-                    1.0,
-                    vcl::unotools::toDoubleColor(deviceColor[i]),
-                    vcl::unotools::toDoubleColor(deviceColor[i]),
-                    vcl::unotools::toDoubleColor(deviceColor[i]));
-            }
+            std::transform(deviceColor.begin(), deviceColor.end(), aRes.begin(),
+                [](sal_Int8 nIn) {
+                    auto fColor = vcl::unotools::toDoubleColor(nIn);
+                    return rendering::ARGBColor(1.0, fColor, fColor, fColor);
+                });
         }
         else
         {
+            rendering::ARGBColor* pOut( aRes.getArray() );
             for( std::size_t i=0; i<nLen; i+=4 )
             {
                 const double fAlpha=vcl::unotools::toDoubleColor(deviceColor[i+3]);
diff --git a/vcl/source/components/fontident.cxx b/vcl/source/components/fontident.cxx
index 58226634a477..659671ded659 100644
--- a/vcl/source/components/fontident.cxx
+++ b/vcl/source/components/fontident.cxx
@@ -69,12 +69,10 @@ void SAL_CALL FontIdentificator::initialize( const Sequence<Any>& i_rArgs )
     if( !ImplGetSVData() )
         return; // VCL not initialized
 
-    sal_uInt32 nArgs = i_rArgs.getLength();
-    const Any* pArgs = i_rArgs.getConstArray();
     Sequence< sal_Int8 > aFontBuf;
-    for( sal_uInt32 i = 0; i < nArgs; i++ )
+    for( const auto& rArg : i_rArgs )
     {
-        if( pArgs[i] >>= aFontBuf )
+        if( rArg >>= aFontBuf )
         {
             m_aFont = Font::identifyFont( aFontBuf.getConstArray(), aFontBuf.getLength() );
             break;
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index a1b1af252dc5..57d037546c5f 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -2924,18 +2924,12 @@ void Edit::dragEnter( const css::datatransfer::dnd::DropTargetDragEnterEvent& rD
     }
     // search for string data type
     const Sequence< css::datatransfer::DataFlavor >& rFlavors( rDTDE.SupportedDataFlavors );
-    sal_Int32 nEle = rFlavors.getLength();
-    mpDDInfo->bIsStringSupported = false;
-    for( sal_Int32 i = 0; i < nEle; i++ )
-    {
-        sal_Int32 nIndex = 0;
-        const OUString aMimetype = rFlavors[i].MimeType.getToken( 0, ';', nIndex );
-        if ( aMimetype == "text/plain" )
-        {
-            mpDDInfo->bIsStringSupported = true;
-            break;
-        }
-    }
+    mpDDInfo->bIsStringSupported = std::any_of(rFlavors.begin(), rFlavors.end(),
+        [](const css::datatransfer::DataFlavor& rFlavor) {
+            sal_Int32 nIndex = 0;
+            const OUString aMimetype = rFlavor.MimeType.getToken( 0, ';', nIndex );
+            return aMimetype == "text/plain";
+        });
 }
 
 void Edit::dragExit( const css::datatransfer::dnd::DropTargetEvent& )
diff --git a/vcl/source/filter/FilterConfigCache.cxx b/vcl/source/filter/FilterConfigCache.cxx
index 0f9ab8bae3c9..2623f814029b 100644
--- a/vcl/source/filter/FilterConfigCache.cxx
+++ b/vcl/source/filter/FilterConfigCache.cxx
@@ -158,11 +158,9 @@ void FilterConfigCache::ImplInit()
     if ( xTypeAccess.is() && xFilterAccess.is() )
     {
         Sequence< OUString > lAllFilter = xFilterAccess->getElementNames();
-        sal_Int32 nAllFilterCount = lAllFilter.getLength();
 
-        for ( sal_Int32 i = 0; i < nAllFilterCount; i++ )
+        for ( const OUString& sInternalFilterName : lAllFilter )
         {
-            OUString sInternalFilterName = lAllFilter[ i ];
             Reference< XPropertySet > xFilterSet;
             xFilterAccess->getByName( sInternalFilterName ) >>= xFilterSet;
             if (!xFilterSet.is())
diff --git a/vcl/source/filter/FilterConfigItem.cxx b/vcl/source/filter/FilterConfigItem.cxx
index aa86faceddcd..41c9ec401064 100644
--- a/vcl/source/filter/FilterConfigItem.cxx
+++ b/vcl/source/filter/FilterConfigItem.cxx
@@ -219,18 +219,11 @@ bool FilterConfigItem::ImplGetPropertyValue( Any& rAny, const Reference< XProper
 // otherwise the result is null
 PropertyValue* FilterConfigItem::GetPropertyValue( Sequence< PropertyValue >& rPropSeq, const OUString& rName )
 {
-    PropertyValue* pPropValue = nullptr;
-
-    sal_Int32 i, nCount;
-    for ( i = 0, nCount = rPropSeq.getLength(); i < nCount; i++ )
-    {
-        if ( rPropSeq[ i ].Name == rName )
-        {
-            pPropValue = &rPropSeq[ i ];
-            break;
-        }
-    }
-    return pPropValue;
+    auto pProp = std::find_if(rPropSeq.begin(), rPropSeq.end(),
+        [&rName](const PropertyValue& rProp) { return rProp.Name == rName; });
+    if (pProp != rPropSeq.end())
+        return pProp;
+    return nullptr;
 }
 
 /* if PropertySequence already includes a PropertyValue using the same name, the
@@ -242,12 +235,10 @@ bool FilterConfigItem::WritePropertyValue( Sequence< PropertyValue >& rPropSeq,
     bool bRet = false;
     if ( !rPropValue.Name.isEmpty() )
     {
-        sal_Int32 i, nCount;
-        for ( i = 0, nCount = rPropSeq.getLength(); i < nCount; i++ )
-        {
-            if ( rPropSeq[ i ].Name == rPropValue.Name )
-                break;
-        }
+        auto pProp = std::find_if(rPropSeq.begin(), rPropSeq.end(),
+            [&rPropValue](const PropertyValue& rProp) { return rProp.Name == rPropValue.Name; });
+        sal_Int32 i = std::distance(rPropSeq.begin(), pProp);
+        sal_Int32 nCount = rPropSeq.getLength();
         if ( i == nCount )
             rPropSeq.realloc( ++nCount );
 
@@ -389,14 +380,12 @@ Reference< XStatusIndicator > FilterConfigItem::GetStatusIndicator() const
     Reference< XStatusIndicator > xStatusIndicator;
     const OUString sStatusIndicator( "StatusIndicator" );
 
-    sal_Int32 i, nCount = aFilterData.getLength();
-    for ( i = 0; i < nCount; i++ )
+    auto pPropVal = std::find_if(aFilterData.begin(), aFilterData.end(),
+        [&sStatusIndicator](const css::beans::PropertyValue& rPropVal) {
+            return rPropVal.Name == sStatusIndicator; });
+    if (pPropVal != aFilterData.end())
     {
-        if ( aFilterData[ i ].Name == sStatusIndicator )
-        {
-            aFilterData[ i ].Value >>= xStatusIndicator;
-            break;
-        }
+        pPropVal->Value >>= xStatusIndicator;
     }
     return xStatusIndicator;
 }
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index 87aeaefa0ec7..c6b26c6ec2da 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -1440,13 +1440,12 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
 
     if ( pFilterData )
     {
-        sal_Int32 i;
-        for ( i = 0; i < pFilterData->getLength(); i++ )
+        for ( const auto& rPropVal : *pFilterData )
         {
-            if ( (*pFilterData)[ i ].Name == "PreviewSizeHint" )
+            if ( rPropVal.Name == "PreviewSizeHint" )
             {
                 css::awt::Size aSize;
-                if ( (*pFilterData)[ i ].Value >>= aSize )
+                if ( rPropVal.Value >>= aSize )
                 {
                     aPreviewSizeHint = Size( aSize.Width, aSize.Height );
                     if ( aSize.Width || aSize.Height )
@@ -1455,13 +1454,13 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
                         nImportFlags &=~GraphicFilterImportFlags::ForPreview;
                 }
             }
-            else if ( (*pFilterData)[ i ].Name == "AllowPartialStreamRead" )
+            else if ( rPropVal.Name == "AllowPartialStreamRead" )
             {
-                (*pFilterData)[ i ].Value >>= bAllowPartialStreamRead;
+                rPropVal.Value >>= bAllowPartialStreamRead;
             }
-            else if ( (*pFilterData)[ i ].Name == "CreateNativeLink" )
+            else if ( rPropVal.Name == "CreateNativeLink" )
             {
-                (*pFilterData)[ i ].Value >>= bCreateNativeLink;
+                rPropVal.Value >>= bCreateNativeLink;
             }
         }
     }
@@ -2050,26 +2049,25 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r
                 vcl::PNGWriter aPNGWriter( aGraphic.GetBitmapEx(), pFilterData );
                 if ( pFilterData )
                 {
-                    sal_Int32 k, j, i = 0;
-                    for ( i = 0; i < pFilterData->getLength(); i++ )
+                    for ( const auto& rPropVal : *pFilterData )
                     {
-                        if ( (*pFilterData)[ i ].Name == "AdditionalChunks" )
+                        if ( rPropVal.Name == "AdditionalChunks" )
                         {
                             css::uno::Sequence< css::beans::PropertyValue > aAdditionalChunkSequence;
-                            if ( (*pFilterData)[ i ].Value >>= aAdditionalChunkSequence )
+                            if ( rPropVal.Value >>= aAdditionalChunkSequence )
                             {
-                                for ( j = 0; j < aAdditionalChunkSequence.getLength(); j++ )
+                                for ( const auto& rAdditionalChunk : aAdditionalChunkSequence )
                                 {
-                                    if ( aAdditionalChunkSequence[ j ].Name.getLength() == 4 )
+                                    if ( rAdditionalChunk.Name.getLength() == 4 )
                                     {
                                         sal_uInt32 nChunkType = 0;
-                                        for ( k = 0; k < 4; k++ )
+                                        for ( sal_Int32 k = 0; k < 4; k++ )
                                         {
                                             nChunkType <<= 8;
-                                            nChunkType |= static_cast<sal_uInt8>(aAdditionalChunkSequence[ j ].Name[ k ]);
+                                            nChunkType |= static_cast<sal_uInt8>(rAdditionalChunk.Name[ k ]);
                                         }
                                         css::uno::Sequence< sal_Int8 > aByteSeq;
-                                        if ( aAdditionalChunkSequence[ j ].Value >>= aByteSeq )
+                                        if ( rAdditionalChunk.Value >>= aByteSeq )
                                         {
                                             std::vector< vcl::PNGWriter::ChunkData >& rChunkData = aPNGWriter.GetChunks();
                                             if ( !rChunkData.empty() )
diff --git a/vcl/source/filter/jpeg/JpegWriter.cxx b/vcl/source/filter/jpeg/JpegWriter.cxx
index 3164918cc90e..94711f9473e5 100644
--- a/vcl/source/filter/jpeg/JpegWriter.cxx
+++ b/vcl/source/filter/jpeg/JpegWriter.cxx
@@ -123,15 +123,12 @@ JPEGWriter::JPEGWriter( SvStream& rStream, const css::uno::Sequence< css::beans:
 
     if ( pFilterData )
     {
-        int nArgs = pFilterData->getLength();
-        const css::beans::PropertyValue* pValues = pFilterData->getConstArray();
-        while( nArgs-- )
+        for( const auto& rValue : *pFilterData )
         {
-            if ( pValues->Name == "StatusIndicator" )
+            if ( rValue.Name == "StatusIndicator" )
             {
-                pValues->Value >>= mxStatusIndicator;
+                rValue.Value >>= mxStatusIndicator;
             }
-            pValues++;
         }
     }
 }
diff --git a/vcl/source/filter/png/pngwrite.cxx b/vcl/source/filter/png/pngwrite.cxx
index 3d2de8aae5e4..9a3954244cdf 100644
--- a/vcl/source/filter/png/pngwrite.cxx
+++ b/vcl/source/filter/png/pngwrite.cxx
@@ -137,17 +137,16 @@ PNGWriterImpl::PNGWriterImpl( const BitmapEx& rBitmapEx,
 
         if (pFilterData)
         {
-            sal_Int32 i = 0;
-            for (i = 0; i < pFilterData->getLength(); i++)
+            for (const auto& rPropVal : *pFilterData)
             {
-                if ((*pFilterData)[i].Name == "Compression")
-                    (*pFilterData)[i].Value >>= mnCompLevel;
-                else if ((*pFilterData)[i].Name == "Interlaced")
-                    (*pFilterData)[i].Value >>= mnInterlaced;
-                else if ((*pFilterData)[i].Name == "MaxChunkSize")
+                if (rPropVal.Name == "Compression")
+                    rPropVal.Value >>= mnCompLevel;
+                else if (rPropVal.Name == "Interlaced")
+                    rPropVal.Value >>= mnInterlaced;
+                else if (rPropVal.Name == "MaxChunkSize")
                 {
                     sal_Int32 nVal = 0;
-                    if ((*pFilterData)[i].Value >>= nVal)
+                    if (rPropVal.Value >>= nVal)
                         mnMaxChunkSize = static_cast<sal_uInt32>(nVal);
                 }
             }
diff --git a/vcl/source/filter/wmf/wmfexternal.cxx b/vcl/source/filter/wmf/wmfexternal.cxx
index b1486c98ff8e..4080d3f041fe 100644
--- a/vcl/source/filter/wmf/wmfexternal.cxx
+++ b/vcl/source/filter/wmf/wmfexternal.cxx
@@ -50,23 +50,23 @@ bool WmfExternal::setSequence(const css::uno::Sequence< css::beans::PropertyValu
 {
     bool bRetval(false);
 
-    for (sal_Int32 i = 0; i < rSequence.getLength(); ++i)
+    for (const auto& rPropVal : rSequence)
     {
-        const OUString aName(rSequence[i].Name);
+        const OUString aName(rPropVal.Name);
 
         if (aName == "Width")
         {
-            rSequence[i].Value >>= xExt;
+            rPropVal.Value >>= xExt;
             bRetval = true;
         }
         else if (aName == "Height")
         {
-            rSequence[i].Value >>= yExt;
+            rPropVal.Value >>= yExt;
             bRetval = true;
         }
         else if (aName == "MapMode")
         {
-            rSequence[i].Value >>= mapMode;
+            rPropVal.Value >>= mapMode;
             bRetval = true;
         }
     }
diff --git a/vcl/source/font/fontmetric.cxx b/vcl/source/font/fontmetric.cxx
index 4e6c648be3c7..ac19917d9221 100644
--- a/vcl/source/font/fontmetric.cxx
+++ b/vcl/source/font/fontmetric.cxx
@@ -33,6 +33,7 @@
 #include <sft.hxx>
 
 #include <com/sun/star/uno/Sequence.hxx>
+#include <comphelper/sequence.hxx>
 
 #include <vector>
 #include <set>
@@ -408,13 +409,10 @@ bool ImplFontMetricData::ShouldUseWinMetrics(const vcl::TTGlobalFontInfo& rInfo)
 
     css::uno::Sequence<OUString> rWinMetricFontList(
         officecfg::Office::Common::Misc::FontsUseWinMetrics::get());
-    for (int i = 0; i < rWinMetricFontList.getLength(); ++i)
+    if (comphelper::findValue(rWinMetricFontList, aFontIdentifier) != -1)
     {
-        if (aFontIdentifier == rWinMetricFontList[i])
-        {
-            SAL_INFO("vcl.gdi.fontmetric", "Using win metrics for: " << aFontIdentifier);
-            return true;
-        }
+        SAL_INFO("vcl.gdi.fontmetric", "Using win metrics for: " << aFontIdentifier);
+        return true;
     }
     return false;
 }
diff --git a/vcl/source/gdi/configsettings.cxx b/vcl/source/gdi/configsettings.cxx
index 6f531a3e1f00..f04ddd0ffa37 100644
--- a/vcl/source/gdi/configsettings.cxx
+++ b/vcl/source/gdi/configsettings.cxx
@@ -88,21 +88,17 @@ void SettingsConfigItem::getValues()
 
     Sequence< OUString > aNames( GetNodeNames( OUString() ) );
 
-    for( int j = 0; j < aNames.getLength(); j++ )
+    for( const auto& aKeyName : aNames )
     {
 #if OSL_DEBUG_LEVEL > 2
-        SAL_INFO( "vcl", "found settings data for " << aNames.getConstArray()[j] );
+        SAL_INFO( "vcl", "found settings data for " << aKeyName );
 #endif
-        OUString aKeyName( aNames.getConstArray()[j] );
         Sequence< OUString > aKeys( GetNodeNames( aKeyName ) );
         Sequence< OUString > aSettingsKeys( aKeys.getLength() );
-        const OUString* pFrom = aKeys.getConstArray();
-        OUString* pTo = aSettingsKeys.getArray();
-        for( int m = 0; m < aKeys.getLength(); m++ )
-        {
-            pTo[m] = aKeyName + "/" + pFrom[m];
-        }
+        std::transform(aKeys.begin(), aKeys.end(), aSettingsKeys.begin(),
+            [&aKeyName](const OUString& rKey) -> OUString { return aKeyName + "/" + rKey; });
         Sequence< Any > aValues( GetProperties( aSettingsKeys ) );
+        const OUString* pFrom = aKeys.getConstArray();
         const Any* pValue = aValues.getConstArray();
         for( int i = 0; i < aValues.getLength(); i++, pValue++ )
         {
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index b60a2dddc6af..242dbfc79522 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -881,26 +881,26 @@ PrinterController::PageSize vcl::ImplPrinterControllerData::modifyJobSetup( cons
     aPageSize.aSize = mxPrinter->GetPaperSize();
     css::awt::Size aSetSize, aIsSize;
     sal_Int32 nPaperBin = mnDefaultPaperBin;
-    for( sal_Int32 nProperty = 0, nPropertyCount = i_rProps.getLength(); nProperty < nPropertyCount; ++nProperty )
+    for( const auto& rProp : i_rProps )
     {
-        if ( i_rProps[ nProperty ].Name == "PreferredPageSize" )
+        if ( rProp.Name == "PreferredPageSize" )
         {
-            i_rProps[ nProperty ].Value >>= aSetSize;
+            rProp.Value >>= aSetSize;
         }
-        else if ( i_rProps[ nProperty ].Name == "PageSize" )
+        else if ( rProp.Name == "PageSize" )
         {
-            i_rProps[ nProperty ].Value >>= aIsSize;
+            rProp.Value >>= aIsSize;
         }
-        else if ( i_rProps[ nProperty ].Name == "PageIncludesNonprintableArea" )
+        else if ( rProp.Name == "PageIncludesNonprintableArea" )
         {
             bool bVal = false;
-            i_rProps[ nProperty ].Value >>= bVal;
+            rProp.Value >>= bVal;
             aPageSize.bFullPaper = bVal;
         }
-        else if ( i_rProps[ nProperty ].Name == "PrinterPaperTray" )
+        else if ( rProp.Name == "PrinterPaperTray" )
         {
             sal_Int32 nBin = -1;
-            i_rProps[ nProperty ].Value >>= nBin;
+            rProp.Value >>= nBin;
             if( nBin >= 0 && nBin < static_cast<sal_Int32>(mxPrinter->GetPaperBinCount()) )
                 nPaperBin = nBin;
         }
@@ -1423,12 +1423,11 @@ css::uno::Sequence< css::beans::PropertyValue > PrinterController::getJobPropert
 {
     std::unordered_set< OUString > aMergeSet;
     size_t nResultLen = size_t(i_rMergeList.getLength()) + mpImplData->maUIProperties.size() + 3;
-    for( int i = 0; i < i_rMergeList.getLength(); i++ )
-        aMergeSet.insert( i_rMergeList[i].Name );
+    for( const auto& rPropVal : i_rMergeList )
+        aMergeSet.insert( rPropVal.Name );
 
     css::uno::Sequence< css::beans::PropertyValue > aResult( nResultLen );
-    for( int i = 0; i < i_rMergeList.getLength(); i++ )
-        aResult[i] = i_rMergeList[i];
+    std::copy(i_rMergeList.begin(), i_rMergeList.end(), aResult.begin());
     int nCur = i_rMergeList.getLength();
     for(css::beans::PropertyValue & rPropVal : mpImplData->maUIProperties)
     {
@@ -1512,18 +1511,17 @@ void PrinterController::setUIOptions( const css::uno::Sequence< css::beans::Prop
 
     mpImplData->maUIOptions = i_rOptions;
 
-    for( int i = 0; i < i_rOptions.getLength(); i++ )
+    for( const auto& rOpt : i_rOptions )
     {
         css::uno::Sequence< css::beans::PropertyValue > aOptProp;
-        i_rOptions[i].Value >>= aOptProp;
+        rOpt.Value >>= aOptProp;
         bool bIsEnabled = true;
         bool bHaveProperty = false;
         OUString aPropName;
         vcl::ImplPrinterControllerData::ControlDependency aDep;
         css::uno::Sequence< sal_Bool > aChoicesDisabled;
-        for( int n = 0; n < aOptProp.getLength(); n++ )
+        for( const css::beans::PropertyValue& rEntry : aOptProp )
         {
-            const css::beans::PropertyValue& rEntry( aOptProp[ n ] );
             if ( rEntry.Name == "Property" )
             {
                 css::beans::PropertyValue aVal;
@@ -1827,24 +1825,15 @@ bool PrinterOptionsHelper::processProperties( const css::uno::Sequence< css::bea
 {
     bool bChanged = false;
 
-    sal_Int32 nElements = i_rNewProp.getLength();
-    const css::beans::PropertyValue* pVals = i_rNewProp.getConstArray();
-    for( sal_Int32 i = 0; i < nElements; i++ )
+    for( const auto& rVal : i_rNewProp )
     {
-        bool bElementChanged = false;
         std::unordered_map< OUString, css::uno::Any >::iterator it =
-            m_aPropertyMap.find( pVals[ i ].Name );
-        if( it != m_aPropertyMap.end() )
-        {
-            if( it->second != pVals[ i ].Value )
-                bElementChanged = true;
-        }
-        else
-            bElementChanged = true;
+            m_aPropertyMap.find( rVal.Name );
 
+        bool bElementChanged = (it == m_aPropertyMap.end()) || (it->second != rVal.Value);
         if( bElementChanged )
         {
-            m_aPropertyMap[ pVals[i].Name ] = pVals[i].Value;
+            m_aPropertyMap[ rVal.Name ] = rVal.Value;
             bChanged = true;
         }
     }
diff --git a/vcl/source/graphic/UnoGraphic.cxx b/vcl/source/graphic/UnoGraphic.cxx
index 446da50867a4..4fe9d88ada8e 100644
--- a/vcl/source/graphic/UnoGraphic.cxx
+++ b/vcl/source/graphic/UnoGraphic.cxx
@@ -101,8 +101,7 @@ uno::Sequence< OUString > SAL_CALL Graphic::getSupportedServiceNames()
 
     aRet.realloc( nOldCount + aNew.getLength() );
 
-    for( sal_Int32 i = 0; i < aNew.getLength(); ++i )
-        aRet[ nOldCount++ ] = aNew[ i ];
+    std::copy(aNew.begin(), aNew.end(), std::next(aRet.begin(), nOldCount));
 
     return aRet;
 }
diff --git a/vcl/source/graphic/UnoGraphicProvider.cxx b/vcl/source/graphic/UnoGraphicProvider.cxx
index 95292ee13186..d7dcee4b183c 100644
--- a/vcl/source/graphic/UnoGraphicProvider.cxx
+++ b/vcl/source/graphic/UnoGraphicProvider.cxx
@@ -231,10 +231,13 @@ uno::Reference< beans::XPropertySet > SAL_CALL GraphicProvider::queryGraphicDesc
     uno::Reference< io::XInputStream > xIStm;
     uno::Reference< awt::XBitmap >xBtm;
 
-    for( sal_Int32 i = 0; ( i < rMediaProperties.getLength() ) && !xRet.is(); ++i )
+    for( const auto& rMediaProperty : rMediaProperties )
     {
-        const OUString   aName( rMediaProperties[ i ].Name );
-        const uno::Any          aValue( rMediaProperties[ i ].Value );
+        if (xRet.is())
+            break;
+
+        const OUString   aName( rMediaProperty.Name );
+        const uno::Any          aValue( rMediaProperty.Value );
 
         if (aName == "URL")
         {
@@ -303,10 +306,13 @@ uno::Reference< ::graphic::XGraphic > SAL_CALL GraphicProvider::queryGraphic( co
     bool bLazyRead = false;
     bool bLoadAsLink = false;
 
-    for (sal_Int32 i = 0; ( i < rMediaProperties.getLength() ) && !xRet.is(); ++i)
+    for (const auto& rMediaProperty : rMediaProperties)
     {
-        const OUString   aName( rMediaProperties[ i ].Name );
-        const uno::Any          aValue( rMediaProperties[ i ].Value );
+        if (xRet.is())
+            break;
+
+        const OUString   aName( rMediaProperty.Name );
+        const uno::Any          aValue( rMediaProperty.Value );
 
         if (aName == "URL")
         {
@@ -340,10 +346,10 @@ uno::Reference< ::graphic::XGraphic > SAL_CALL GraphicProvider::queryGraphic( co
     sal_uInt16 nExtWidth = 0;
     sal_uInt16 nExtHeight = 0;
     sal_uInt16 nExtMapMode = 0;
-    for( sal_Int32 i = 0; i < aFilterData.getLength(); ++i )
+    for( const auto& rProp : aFilterData )
     {
-        const OUString   aName( aFilterData[ i ].Name );
-        const uno::Any          aValue( aFilterData[ i ].Value );
+        const OUString   aName( rProp.Name );
+        const uno::Any          aValue( rProp.Value );
 
         if (aName == "ExternalWidth")
         {
@@ -446,15 +452,13 @@ uno::Sequence< uno::Reference<graphic::XGraphic> > SAL_CALL GraphicProvider::que
         std::unique_ptr<SvStream> pStream;
         uno::Reference<io::XInputStream> xStream;
 
-        for (sal_Int32 i = 0; rMediaProperties.getLength(); ++i)
+        auto pProp = std::find_if(rMediaProperties.begin(), rMediaProperties.end(),
+            [](const beans::PropertyValue& rProp) { return rProp.Name == "InputStream"; });
+        if (pProp != rMediaProperties.end())
         {
-            if (rMediaProperties[i].Name == "InputStream")
-            {
-                rMediaProperties[i].Value >>= xStream;
-                if (xStream.is())
-                    pStream = utl::UcbStreamHelper::CreateStream(xStream);
-                break;
-            }
+            pProp->Value >>= xStream;
+            if (xStream.is())
+                pStream = utl::UcbStreamHelper::CreateStream(xStream);
         }
 
         aStreams.push_back(std::move(pStream));
@@ -577,10 +581,10 @@ void ImplApplyFilterData( ::Graphic& rGraphic, uno::Sequence< beans::PropertyVal
     text::GraphicCrop aCropLogic( 0, 0, 0, 0 );
     bool bRemoveCropArea = true;
 
-    for( sal_Int32 i = 0; i < rFilterData.getLength(); ++i )
+    for( const auto& rProp : rFilterData )
     {
-        const OUString   aName(  rFilterData[ i ].Name );
-        const uno::Any          aValue( rFilterData[ i ].Value );
+        const OUString   aName(  rProp.Name );
+        const uno::Any          aValue( rProp.Value );
 
         if (aName == "PixelWidth")
             aValue >>= nPixelWidth;
@@ -706,12 +710,11 @@ void SAL_CALL GraphicProvider::storeGraphic( const uno::Reference< ::graphic::XG
 
     std::unique_ptr<SvStream> pOStm;
     OUString    aPath;
-    sal_Int32   i;
 
-    for( i = 0; ( i < rMediaProperties.getLength() ) && !pOStm; ++i )
+    for( const auto& rMediaProperty : rMediaProperties )
     {
-        const OUString   aName( rMediaProperties[ i ].Name );
-        const uno::Any          aValue( rMediaProperties[ i ].Value );
+        const OUString   aName( rMediaProperty.Name );
+        const uno::Any          aValue( rMediaProperty.Value );
 
         if (aName == "URL")
         {
@@ -730,6 +733,9 @@ void SAL_CALL GraphicProvider::storeGraphic( const uno::Reference< ::graphic::XG
             if( xOStm.is() )
                 pOStm = ::utl::UcbStreamHelper::CreateStream( xOStm );
         }
+
+        if( pOStm )
+            break;
     }
 
     if( !pOStm )
@@ -738,10 +744,10 @@ void SAL_CALL GraphicProvider::storeGraphic( const uno::Reference< ::graphic::XG
     uno::Sequence< beans::PropertyValue >   aFilterDataSeq;
     const char*                             pFilterShortName = nullptr;
 
-    for( i = 0; i < rMediaProperties.getLength(); ++i )
+    for( const auto& rMediaProperty : rMediaProperties )
     {
-        const OUString   aName( rMediaProperties[ i ].Name );
-        const uno::Any          aValue( rMediaProperties[ i ].Value );
+        const OUString   aName( rMediaProperty.Name );
+        const uno::Any          aValue( rMediaProperty.Value );
 
         if (aName == "FilterData")
         {
diff --git a/vcl/source/helper/canvasbitmap.cxx b/vcl/source/helper/canvasbitmap.cxx
index 97f1d987e6d5..f28fc734e3de 100644
--- a/vcl/source/helper/canvasbitmap.cxx
+++ b/vcl/source/helper/canvasbitmap.cxx
@@ -902,12 +902,12 @@ uno::Sequence< double > SAL_CALL VclCanvasBitmap::convertFromRGB( const uno::Seq
 
     if( m_bPalette )
     {
-        for( std::size_t i=0; i<nLen; ++i )
+        for( const auto& rIn : rgbColor )
         {
             pColors[m_nIndexIndex] = m_pBmpAcc->GetBestPaletteIndex(
-                    BitmapColor(toByteColor(rgbColor[i].Red),
-                                toByteColor(rgbColor[i].Green),
-                                toByteColor(rgbColor[i].Blue)));
+                    BitmapColor(toByteColor(rIn.Red),
+                                toByteColor(rIn.Green),
+                                toByteColor(rIn.Blue)));
             if( m_nAlphaIndex != -1 )
                 pColors[m_nAlphaIndex] = 1.0;
 
@@ -916,11 +916,11 @@ uno::Sequence< double > SAL_CALL VclCanvasBitmap::convertFromRGB( const uno::Seq
     }
     else
     {
-        for( std::size_t i=0; i<nLen; ++i )
+        for( const auto& rIn : rgbColor )
         {
-            pColors[m_nRedIndex]   = rgbColor[i].Red;
-            pColors[m_nGreenIndex] = rgbColor[i].Green;
-            pColors[m_nBlueIndex]  = rgbColor[i].Blue;
+            pColors[m_nRedIndex]   = rIn.Red;
+            pColors[m_nGreenIndex] = rIn.Green;
+            pColors[m_nBlueIndex]  = rIn.Blue;
             if( m_nAlphaIndex != -1 )
                 pColors[m_nAlphaIndex] = 1.0;
 
@@ -942,27 +942,27 @@ uno::Sequence< double > SAL_CALL VclCanvasBitmap::convertFromARGB( const uno::Se
 
     if( m_bPalette )
     {
-        for( std::size_t i=0; i<nLen; ++i )
+        for( const auto& rIn : rgbColor )
         {
             pColors[m_nIndexIndex] = m_pBmpAcc->GetBestPaletteIndex(
-                    BitmapColor(toByteColor(rgbColor[i].Red),
-                                toByteColor(rgbColor[i].Green),
-                                toByteColor(rgbColor[i].Blue)));
+                    BitmapColor(toByteColor(rIn.Red),
+                                toByteColor(rIn.Green),
+                                toByteColor(rIn.Blue)));
             if( m_nAlphaIndex != -1 )
-                pColors[m_nAlphaIndex] = rgbColor[i].Alpha;
+                pColors[m_nAlphaIndex] = rIn.Alpha;
 
             pColors += nComponentsPerPixel;
         }
     }
     else
     {
-        for( std::size_t i=0; i<nLen; ++i )
+        for( const auto& rIn : rgbColor )
         {
-            pColors[m_nRedIndex]   = rgbColor[i].Red;
-            pColors[m_nGreenIndex] = rgbColor[i].Green;
-            pColors[m_nBlueIndex]  = rgbColor[i].Blue;
+            pColors[m_nRedIndex]   = rIn.Red;
+            pColors[m_nGreenIndex] = rIn.Green;
+            pColors[m_nBlueIndex]  = rIn.Blue;
             if( m_nAlphaIndex != -1 )
-                pColors[m_nAlphaIndex] = rgbColor[i].Alpha;
+                pColors[m_nAlphaIndex] = rIn.Alpha;
 
             pColors += nComponentsPerPixel;
         }
@@ -982,13 +982,13 @@ uno::Sequence< double > SAL_CALL VclCanvasBitmap::convertFromPARGB( const uno::S
 
     if( m_bPalette )
     {
-        for( std::size_t i=0; i<nLen; ++i )
+        for( const auto& rIn : rgbColor )
         {
-            const double nAlpha( rgbColor[i].Alpha );
+            const double nAlpha( rIn.Alpha );
             pColors[m_nIndexIndex] = m_pBmpAcc->GetBestPaletteIndex(
-                    BitmapColor(toByteColor(rgbColor[i].Red / nAlpha),
-                                toByteColor(rgbColor[i].Green / nAlpha),
-                                toByteColor(rgbColor[i].Blue / nAlpha)));
+                    BitmapColor(toByteColor(rIn.Red / nAlpha),
+                                toByteColor(rIn.Green / nAlpha),
+                                toByteColor(rIn.Blue / nAlpha)));
             if( m_nAlphaIndex != -1 )
                 pColors[m_nAlphaIndex] = nAlpha;
 
@@ -997,12 +997,12 @@ uno::Sequence< double > SAL_CALL VclCanvasBitmap::convertFromPARGB( const uno::S
     }
     else
     {
-        for( std::size_t i=0; i<nLen; ++i )
+        for( const auto& rIn : rgbColor )
         {
-            const double nAlpha( rgbColor[i].Alpha );
-            pColors[m_nRedIndex]   = rgbColor[i].Red / nAlpha;
-            pColors[m_nGreenIndex] = rgbColor[i].Green / nAlpha;
-            pColors[m_nBlueIndex]  = rgbColor[i].Blue / nAlpha;
+            const double nAlpha( rIn.Alpha );
+            pColors[m_nRedIndex]   = rIn.Red / nAlpha;
+            pColors[m_nGreenIndex] = rIn.Green / nAlpha;
+            pColors[m_nBlueIndex]  = rIn.Blue / nAlpha;
             if( m_nAlphaIndex != -1 )
                 pColors[m_nAlphaIndex] = nAlpha;
 
diff --git a/vcl/source/helper/canvastools.cxx b/vcl/source/helper/canvastools.cxx
index 495038e4ecd1..a18e7a9ffd84 100644
--- a/vcl/source/helper/canvastools.cxx
+++ b/vcl/source/helper/canvastools.cxx
@@ -518,52 +518,46 @@ namespace vcl
                 }
                 virtual uno::Sequence< double > SAL_CALL convertFromRGB( const uno::Sequence< rendering::RGBColor >& rgbColor ) override
                 {
-                    const rendering::RGBColor* pIn( rgbColor.getConstArray() );
                     const std::size_t             nLen( rgbColor.getLength() );
 
                     uno::Sequence< double > aRes(nLen*4);
                     double* pColors=aRes.getArray();
-                    for( std::size_t i=0; i<nLen; ++i )
+                    for( const auto& rIn : rgbColor )
                     {
-                        *pColors++ = pIn->Red;
-                        *pColors++ = pIn->Green;
-                        *pColors++ = pIn->Blue;
+                        *pColors++ = rIn.Red;
+                        *pColors++ = rIn.Green;
+                        *pColors++ = rIn.Blue;
                         *pColors++ = 1.0;
-                        ++pIn;
                     }
                     return aRes;
                 }
                 virtual uno::Sequence< double > SAL_CALL convertFromARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) override
                 {
-                    const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
                     const std::size_t              nLen( rgbColor.getLength() );
 
                     uno::Sequence< double > aRes(nLen*4);
                     double* pColors=aRes.getArray();
-                    for( std::size_t i=0; i<nLen; ++i )
+                    for( const auto& rIn : rgbColor )
                     {
-                        *pColors++ = pIn->Red;
-                        *pColors++ = pIn->Green;
-                        *pColors++ = pIn->Blue;
-                        *pColors++ = pIn->Alpha;
-                        ++pIn;
+                        *pColors++ = rIn.Red;
+                        *pColors++ = rIn.Green;
+                        *pColors++ = rIn.Blue;
+                        *pColors++ = rIn.Alpha;
                     }
                     return aRes;
                 }
                 virtual uno::Sequence< double > SAL_CALL convertFromPARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) override
                 {
-                    const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
                     const std::size_t              nLen( rgbColor.getLength() );
 
                     uno::Sequence< double > aRes(nLen*4);
                     double* pColors=aRes.getArray();
-                    for( std::size_t i=0; i<nLen; ++i )
+                    for( const auto& rIn : rgbColor )
                     {
-                        *pColors++ = pIn->Red/pIn->Alpha;
-                        *pColors++ = pIn->Green/pIn->Alpha;
-                        *pColors++ = pIn->Blue/pIn->Alpha;
-                        *pColors++ = pIn->Alpha;
-                        ++pIn;
+                        *pColors++ = rIn.Red/rIn.Alpha;
+                        *pColors++ = rIn.Green/rIn.Alpha;
+                        *pColors++ = rIn.Blue/rIn.Alpha;
+                        *pColors++ = rIn.Alpha;
                     }
                     return aRes;
                 }
diff --git a/vcl/source/helper/commandinfoprovider.cxx b/vcl/source/helper/commandinfoprovider.cxx
index 3fd267272bfd..fa5fe17c79b5 100644
--- a/vcl/source/helper/commandinfoprovider.cxx
+++ b/vcl/source/helper/commandinfoprovider.cxx
@@ -22,6 +22,7 @@
 #include <vcl/keycod.hxx>
 #include <vcl/mnemonic.hxx>
 #include <comphelper/string.hxx>
+#include <comphelper/sequence.hxx>
 #include <comphelper/processfactory.hxx>
 #include <cppuhelper/weakref.hxx>
 
@@ -170,11 +171,8 @@ static bool ResourceHasKey(const OUString& rsResourceName, const OUString& rsCom
             if (xNameAccess->getByName(rsModuleName) >>= xUICommandLabels)
             {
                 xUICommandLabels->getByName(rsResourceName) >>= aSequence;
-                for ( sal_Int32 i = 0; i < aSequence.getLength(); i++ )
-                {
-                    if (aSequence[i] == rsCommandName)
-                        return true;
-                }
+                if (comphelper::findValue(aSequence, rsCommandName) != -1)
+                    return true;
             }
         }
     }
@@ -208,14 +206,13 @@ static Sequence<beans::PropertyValue> GetCommandProperties(const OUString& rsCom
 static OUString GetCommandProperty(const OUString& rsProperty, const OUString& rsCommandName, const OUString& rsModuleName)
 {
     const Sequence<beans::PropertyValue> aProperties (GetCommandProperties(rsCommandName, rsModuleName));
-    for (sal_Int32 nIndex=0; nIndex<aProperties.getLength(); ++nIndex)
+    auto pProp = std::find_if(aProperties.begin(), aProperties.end(),
+        [&rsProperty](const beans::PropertyValue& rProp) { return rProp.Name == rsProperty; });
+    if (pProp != aProperties.end())
     {
-        if (aProperties[nIndex].Name == rsProperty)
-        {
-            OUString sLabel;
-            aProperties[nIndex].Value >>= sLabel;
-            return sLabel;
-        }
+        OUString sLabel;
+        pProp->Value >>= sLabel;
+        return sLabel;
     }
     return OUString();
 }
@@ -373,17 +370,14 @@ sal_Int32 GetPropertiesForCommand (
     const OUString& rsCommandName,
     const OUString& rsModuleName)
 {
-
     sal_Int32 nValue = 0;
     const Sequence<beans::PropertyValue> aProperties (GetCommandProperties(rsCommandName, rsModuleName));
-    for (sal_Int32 nIndex=0; nIndex<aProperties.getLength(); ++nIndex)
-    {
-        if (aProperties[nIndex].Name == "Properties")
-        {
-            aProperties[nIndex].Value >>= nValue;
-            break;
-        }
-    }
+
+    auto pProp = std::find_if(aProperties.begin(), aProperties.end(),
+        [](const beans::PropertyValue& rProp) { return rProp.Name == "Properties"; });
+    if (pProp != aProperties.end())
+        pProp->Value >>= nValue;
+
     return nValue;
 }
 
@@ -409,13 +403,12 @@ bool IsExperimental(const OUString& rsCommandName, const OUString& rModuleName)
             if (xNameAccess->getByName( rModuleName ) >>= xUICommandLabels )
                 xUICommandLabels->getByName(rsCommandName) >>= aProperties;
 
-            for (sal_Int32 nIndex=0; nIndex<aProperties.getLength(); ++nIndex)
+            auto pProp = std::find_if(aProperties.begin(), aProperties.end(),
+                [](const beans::PropertyValue& rProp) { return rProp.Name == "IsExperimental"; });
+            if (pProp != aProperties.end())
             {
-                if (aProperties[nIndex].Name == "IsExperimental")
-                {
-                    bool bValue;
-                    return (aProperties[nIndex].Value >>= bValue) && bValue;
-                }
+                bool bValue;
+                return (pProp->Value >>= bValue) && bValue;
             }
         }
     }
diff --git a/vcl/source/uitest/logger.cxx b/vcl/source/uitest/logger.cxx
index f60cb2322367..d100d1bbf125 100644
--- a/vcl/source/uitest/logger.cxx
+++ b/vcl/source/uitest/logger.cxx
@@ -43,15 +43,12 @@ void UITestLogger::logCommand(const OUString& rAction, const css::uno::Sequence<
         return;
 
     OUStringBuffer aBuffer(rAction);
-    sal_Int32 nCount = rArgs.getLength();
 
-    if (nCount > 0)
+    if (rArgs.hasElements())
     {
         aBuffer.append(" {");
-        for (sal_Int32 n = 0; n < nCount; n++)
+        for (const css::beans::PropertyValue& rProp : rArgs)
         {
-            const css::beans::PropertyValue& rProp = rArgs[n];
-
             OUString aTypeName = rProp.Value.getValueTypeName();
 
             if (aTypeName == "long" || aTypeName == "short")
diff --git a/vcl/source/uitest/uitest.cxx b/vcl/source/uitest/uitest.cxx
index b4c89d1e4516..58c58ab3c468 100644
--- a/vcl/source/uitest/uitest.cxx
+++ b/vcl/source/uitest/uitest.cxx
@@ -33,14 +33,12 @@ bool UITest::executeCommandWithParameters(const OUString& rCommand,
         {{"SynchronMode", -1, css::uno::Any(true),
           css::beans::PropertyState_DIRECT_VALUE}};
 
-    sal_uInt32 nArgs = rArgs.getLength();
-    if ( nArgs > 0 )
+    if ( rArgs.hasElements() )
     {
         sal_uInt32 nIndex( lNewArgs.getLength() );
         lNewArgs.realloc( lNewArgs.getLength()+rArgs.getLength() );
 
-        for ( sal_uInt32 i = 0; i < nArgs; i++ )
-            lNewArgs[nIndex++] = rArgs[i];
+        std::copy(rArgs.begin(), rArgs.end(), std::next(lNewArgs.begin(), nIndex));
     }
     return comphelper::dispatchCommand(rCommand,lNewArgs);
 }
diff --git a/vcl/source/uitest/uno/uiobject_uno.cxx b/vcl/source/uitest/uno/uiobject_uno.cxx
index 7406ca6da9af..0b68a5d1cbce 100644
--- a/vcl/source/uitest/uno/uiobject_uno.cxx
+++ b/vcl/source/uitest/uno/uiobject_uno.cxx
@@ -115,13 +115,13 @@ void SAL_CALL UIObjectUnoObj::executeAction(const OUString& rAction, const css::
 
         SolarMutexGuard aGuard;
         StringMap aMap;
-        for (sal_Int32 i = 0, n = mPropValues.getLength(); i < n; ++i)
+        for (const auto& rPropVal : mPropValues)
         {
             OUString aVal;
-            if (!(mPropValues[i].Value >>= aVal))
+            if (!(rPropVal.Value >>= aVal))
                 continue;
 
-            aMap[mPropValues[i].Name] = aVal;
+            aMap[rPropVal.Name] = aVal;
         }
         mpObj->execute(mAction, aMap);
     };
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 52a4c7e8e97a..942c34150c24 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -1332,12 +1332,12 @@ namespace
 void PrintDialog::setupOptionalUI()
 {
     const Sequence< PropertyValue >& rOptions( maPController->getUIOptions() );
-    for( int i = 0; i < rOptions.getLength(); i++ )
+    for( const auto& rOption : rOptions )
     {
-        if (rOptions[i].Name == "OptionsUIFile")
+        if (rOption.Name == "OptionsUIFile")
         {
             OUString sOptionsUIFile;
-            rOptions[i].Value >>= sOptionsUIFile;
+            rOption.Value >>= sOptionsUIFile;
 
             vcl::Window *pCustom = get<vcl::Window>("customcontents");
 
@@ -1348,7 +1348,7 @@ void PrintDialog::setupOptionalUI()
         }
 
         Sequence< beans::PropertyValue > aOptProp;
-        rOptions[i].Value >>= aOptProp;
+        rOption.Value >>= aOptProp;
 
         // extract ui element
         OUString aCtrlType;
@@ -1363,9 +1363,8 @@ void PrintDialog::setupOptionalUI()
         sal_Int64 nMinValue = 0, nMaxValue = 0;
         OUString aGroupingHint;
 
-        for( int n = 0; n < aOptProp.getLength(); n++ )
+        for( const beans::PropertyValue& rEntry : aOptProp )
         {
-            const beans::PropertyValue& rEntry( aOptProp[ n ] );
             if ( rEntry.Name == "ID" )
             {
                 rEntry.Value >>= aIDs;
@@ -1586,9 +1585,9 @@ void PrintDialog::setupOptionalUI()
                 continue;
 
             // iterate options
-            for( sal_Int32 m = 0; m < aChoices.getLength(); m++ )
+            for( const auto& rChoice : aChoices )
             {
-                pList->InsertEntry( aChoices[m] );
+                pList->InsertEntry( rChoice );
             }
             sal_Int32 nSelectVal = 0;
             PropertyValue* pVal = maPController->getValue( aPropertyName );
diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx
index bb396a4b10b6..f8d675284a15 100644
--- a/vcl/unx/generic/dtrans/X11_selection.cxx
+++ b/vcl/unx/generic/dtrans/X11_selection.cxx
@@ -797,15 +797,13 @@ void SelectionManager::getNativeTypeList( const Sequence< DataFlavor >& rTypes,
     rOutTypeList.clear();
 
     int nFormat;
-    int nFlavors = rTypes.getLength();
-    const DataFlavor* pFlavors = rTypes.getConstArray();
     bool bHaveText = false;
-    for( int i = 0; i < nFlavors; i++ )
+    for( const auto& rFlavor : rTypes )
     {
-        if( pFlavors[i].MimeType.startsWith("text/plain"))
+        if( rFlavor.MimeType.startsWith("text/plain"))
             bHaveText = true;
         else
-            convertTypeToNative( pFlavors[i].MimeType, targetselection, nFormat, rOutTypeList );
+            convertTypeToNative( rFlavor.MimeType, targetselection, nFormat, rOutTypeList );
     }
     if( bHaveText )
     {
@@ -1333,19 +1331,16 @@ bool SelectionManager::getPasteDataTypes( Atom selection, Sequence< DataFlavor >
         bSuccess = rTypes.hasElements();
         if( bHaveText && ! bHaveUTF16 )
         {
-            int i = 0;
-
             int nNewFlavors = rTypes.getLength()+1;
+
             Sequence< DataFlavor > aTemp( nNewFlavors );
-            for( i = 0; i < nNewFlavors-1; i++ )
-                aTemp.getArray()[i+1] = rTypes.getConstArray()[i];
-            aTemp.getArray()[0].MimeType = "text/plain;charset=utf-16";
-            aTemp.getArray()[0].DataType = cppu::UnoType<OUString>::get();
+            std::copy(rTypes.begin(), rTypes.end(), std::next(aTemp.begin()));
+            aTemp[0].MimeType = "text/plain;charset=utf-16";
+            aTemp[0].DataType = cppu::UnoType<OUString>::get();
             rTypes = aTemp;
 
             std::vector< Atom > aNativeTemp( nNewFlavors );
-            for( i = 0; i < nNewFlavors-1; i++ )
-                aNativeTemp[ i + 1 ] = aNativeTypes[ i ];
+            std::copy(aNativeTypes.begin(), aNativeTypes.end(), std::next(aNativeTemp.begin()));
             aNativeTemp[0] = None;
             aNativeTypes = aNativeTemp;
         }
diff --git a/vcl/unx/generic/dtrans/X11_transferable.cxx b/vcl/unx/generic/dtrans/X11_transferable.cxx
index f83e6d581d82..1310f70bc234 100644
--- a/vcl/unx/generic/dtrans/X11_transferable.cxx
+++ b/vcl/unx/generic/dtrans/X11_transferable.cxx
@@ -91,12 +91,11 @@ sal_Bool SAL_CALL X11Transferable::isDataFlavorSupported( const DataFlavor& aFla
     }
 
     Sequence< DataFlavor > aFlavors( getTransferDataFlavors() );
-    for( int i = 0; i < aFlavors.getLength(); i++ )
-        if( aFlavor.MimeType.equalsIgnoreAsciiCase( aFlavors.getConstArray()[i].MimeType ) &&
-            aFlavor.DataType == aFlavors.getConstArray()[i].DataType )
-            return true;
-
-    return false;
+    return std::any_of(aFlavors.begin(), aFlavors.end(),
+        [&aFlavor](const DataFlavor& rFlavor) {
+            return aFlavor.MimeType.equalsIgnoreAsciiCase( rFlavor.MimeType )
+                && aFlavor.DataType == rFlavor.DataType;
+        });
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/a11y/atkaction.cxx b/vcl/unx/gtk/a11y/atkaction.cxx
index aff9cee2d91e..81e743238d84 100644
--- a/vcl/unx/gtk/a11y/atkaction.cxx
+++ b/vcl/unx/gtk/a11y/atkaction.cxx
@@ -167,22 +167,22 @@ action_wrapper_get_name (AtkAction *action,
 static void
 appendKeyStrokes(OStringBuffer& rBuffer, const uno::Sequence< awt::KeyStroke >& rKeyStrokes)
 {
-    for( sal_Int32 i = 0; i < rKeyStrokes.getLength(); i++ )
+    for( const auto& rKeyStroke : rKeyStrokes )
     {
-        if( rKeyStrokes[i].Modifiers &  awt::KeyModifier::SHIFT )
+        if( rKeyStroke.Modifiers &  awt::KeyModifier::SHIFT )
             rBuffer.append("<Shift>");
-        if( rKeyStrokes[i].Modifiers &  awt::KeyModifier::MOD1 )
+        if( rKeyStroke.Modifiers &  awt::KeyModifier::MOD1 )
             rBuffer.append("<Control>");
-        if( rKeyStrokes[i].Modifiers &  awt::KeyModifier::MOD2 )
+        if( rKeyStroke.Modifiers &  awt::KeyModifier::MOD2 )
             rBuffer.append("<Alt>");
 
-        if( ( rKeyStrokes[i].KeyCode >= awt::Key::A ) && ( rKeyStrokes[i].KeyCode <= awt::Key::Z ) )
-            rBuffer.append( static_cast<sal_Char>( 'a' + ( rKeyStrokes[i].KeyCode - awt::Key::A ) ) );
+        if( ( rKeyStroke.KeyCode >= awt::Key::A ) && ( rKeyStroke.KeyCode <= awt::Key::Z ) )
+            rBuffer.append( static_cast<sal_Char>( 'a' + ( rKeyStroke.KeyCode - awt::Key::A ) ) );
         else
         {
             sal_Char c = '\0';
 
-            switch( rKeyStrokes[i].KeyCode )
+            switch( rKeyStroke.KeyCode )
             {
                 case awt::Key::TAB:      c = '\t'; break;
                 case awt::Key::SPACE:    c = ' '; break;
@@ -198,7 +198,7 @@ appendKeyStrokes(OStringBuffer& rBuffer, const uno::Sequence< awt::KeyStroke >&
                 case 0:
                     break;
                 default:
-                    g_warning( "Unmapped KeyCode: %d", rKeyStrokes[i].KeyCode );
+                    g_warning( "Unmapped KeyCode: %d", rKeyStroke.KeyCode );
                     break;
             }
 
@@ -208,7 +208,7 @@ appendKeyStrokes(OStringBuffer& rBuffer, const uno::Sequence< awt::KeyStroke >&
             {
                 // The KeyCode approach did not work, probably a non ascii character
                 // let's hope that there is a character given in KeyChar.
-                rBuffer.append( OUStringToGChar( OUString( rKeyStrokes[i].KeyChar ) ) );
+                rBuffer.append( OUStringToGChar( OUString( rKeyStroke.KeyChar ) ) );
             }
         }
     }
diff --git a/vcl/unx/gtk/a11y/atktable.cxx b/vcl/unx/gtk/a11y/atktable.cxx
index 016d697dce59..29ffa48d5b9d 100644
--- a/vcl/unx/gtk/a11y/atktable.cxx
+++ b/vcl/unx/gtk/a11y/atktable.cxx
@@ -20,6 +20,7 @@
 #include "atkwrapper.hxx"
 
 #include <com/sun/star/accessibility/XAccessibleTable.hpp>
+#include <comphelper/sequence.hxx>
 
 using namespace ::com::sun::star;
 
@@ -354,8 +355,7 @@ convertToGIntArray( const uno::Sequence< ::sal_Int32 >& aSequence, gint **pSelec
     {
         *pSelected = g_new( gint, aSequence.getLength() );
 
-        for( sal_Int32 i = 0; i < aSequence.getLength(); i++ )
-            (*pSelected) [i] = aSequence[i];
+        *pSelected = comphelper::sequenceToArray(*pSelected, aSequence);
     }
 
     return aSequence.getLength();
diff --git a/vcl/unx/gtk/a11y/atktextattributes.cxx b/vcl/unx/gtk/a11y/atktextattributes.cxx
index d0d45527055b..6f3a7c5075e0 100644
--- a/vcl/unx/gtk/a11y/atktextattributes.cxx
+++ b/vcl/unx/gtk/a11y/atktextattributes.cxx
@@ -923,22 +923,20 @@ TabStopList2String( const uno::Any& rAny, bool default_tabs )
 
     if( rAny >>= theTabStops)
     {
-        sal_Int32 indexOfTab = 0;
-        sal_Int32 numberOfTabs = theTabStops.getLength();
         sal_Unicode lastFillChar = ' ';
 
-        for( ; indexOfTab < numberOfTabs; ++indexOfTab )
+        for( const auto& rTabStop : theTabStops )
         {
-            bool is_default_tab = (style::TabAlign_DEFAULT == theTabStops[indexOfTab].Alignment);
+            bool is_default_tab = (style::TabAlign_DEFAULT == rTabStop.Alignment);
 
             if( is_default_tab != default_tabs )
                 continue;
 
-            double fValue = theTabStops[indexOfTab].Position;
+            double fValue = rTabStop.Position;
             fValue = fValue * 0.01;
 
             const gchar * tab_align = "";
-            switch( theTabStops[indexOfTab].Alignment )
+            switch( rTabStop.Alignment )
             {
                 case style::TabAlign_LEFT :
                     tab_align = "left ";
@@ -958,9 +956,9 @@ TabStopList2String( const uno::Any& rAny, bool default_tabs )
 
             const gchar * lead_char = "";
 
-            if( theTabStops[indexOfTab].FillChar != lastFillChar )
+            if( rTabStop.FillChar != lastFillChar )
             {
-                lastFillChar = theTabStops[indexOfTab].FillChar;
+                lastFillChar = rTabStop.FillChar;
                 switch (lastFillChar)
                 {
                     case ' ':
diff --git a/vcl/unx/gtk/a11y/atkwrapper.cxx b/vcl/unx/gtk/a11y/atkwrapper.cxx
index 63b4cfa04430..0998553bd927 100644
--- a/vcl/unx/gtk/a11y/atkwrapper.cxx
+++ b/vcl/unx/gtk/a11y/atkwrapper.cxx
@@ -504,10 +504,9 @@ atk_object_wrapper_relation_new(const accessibility::AccessibleRelation& rRelati
 
     std::vector<AtkObject*> aTargets;
 
-    for (sal_uInt32 i = 0; i < nTargetCount; ++i)
+    for (const auto& rTarget : rRelation.TargetSet)
     {
-        uno::Reference< accessibility::XAccessible > xAccessible(
-                rRelation.TargetSet[i], uno::UNO_QUERY );
+        uno::Reference< accessibility::XAccessible > xAccessible( rTarget, uno::UNO_QUERY );
         aTargets.push_back(atk_object_wrapper_ref(xAccessible));
     }
 
@@ -571,12 +570,12 @@ wrapper_ref_state_set( AtkObject *atk_obj )
             {
                 uno::Sequence< sal_Int16 > aStates = xStateSet->getStates();
 
-                for( sal_Int32 n = 0; n < aStates.getLength(); n++ )
+                for( const auto nState : aStates )
                 {
                     // ATK_STATE_LAST_DEFINED is used to check if the state
                     // is unmapped, do not report it to Atk
-                    if ( mapAtkState( aStates[n] ) != ATK_STATE_LAST_DEFINED )
-                        atk_state_set_add_state( pSet, mapAtkState( aStates[n] ) );
+                    if ( mapAtkState( nState ) != ATK_STATE_LAST_DEFINED )
+                        atk_state_set_add_state( pSet, mapAtkState( nState ) );
                 }
 
                 // We need to emulate FOCUS state for menus, menu-items etc.
diff --git a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
index e82674af9040..a6d8ab7d1e76 100644
--- a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
+++ b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
@@ -345,8 +345,8 @@ public:
     void       getSubFilters( css::uno::Sequence< css::beans::StringPair >& _rSubFilterList );
 
     // helpers for iterating the sub filters
-    const css::beans::StringPair*   beginSubFilters() const { return m_aSubFilters.getConstArray(); }
-    const css::beans::StringPair*   endSubFilters() const { return m_aSubFilters.getConstArray() + m_aSubFilters.getLength(); }
+    const css::beans::StringPair*   beginSubFilters() const { return m_aSubFilters.begin(); }
+    const css::beans::StringPair*   endSubFilters() const { return m_aSubFilters.end(); }
 };
 
 bool FilterEntry::hasSubFilters() const
@@ -505,16 +505,9 @@ bool SalGtkFilePicker::FilterNameExists( const css::uno::Sequence< css::beans::S
 
     if( m_pFilterVector )
     {
-        const css::beans::StringPair* pStart = _rGroupedFilters.getConstArray();
-        const css::beans::StringPair* pEnd = pStart + _rGroupedFilters.getLength();
-        for( ; pStart != pEnd; ++pStart )
-            if( ::std::any_of(
-                        m_pFilterVector->begin(),
-                        m_pFilterVector->end(),
-                        FilterTitleMatch( pStart->First ) ) )
-                break;
-
-        bRet = pStart != pEnd;
+        bRet = std::any_of(_rGroupedFilters.begin(), _rGroupedFilters.end(),
+            [&](const css::beans::StringPair& rFilter) {
+                return ::std::any_of( m_pFilterVector->begin(), m_pFilterVector->end(), FilterTitleMatch( rFilter.First ) ); });
     }
 
     return bRet;
@@ -639,10 +632,8 @@ void SAL_CALL SalGtkFilePicker::appendFilterGroup( const OUString& /*sGroupTitle
     ensureFilterVector( sInitialCurrentFilter );
 
     // append the filter
-    const StringPair* pSubFilters   = aFilters.getConstArray();
-    const StringPair* pSubFiltersEnd = pSubFilters + aFilters.getLength();
-    for( ; pSubFilters != pSubFiltersEnd; ++pSubFilters )
-        m_pFilterVector->insert( m_pFilterVector->end(), FilterEntry( pSubFilters->First, pSubFilters->Second ) );
+    for( const auto& rSubFilter : aFilters )
+        m_pFilterVector->insert( m_pFilterVector->end(), FilterEntry( rSubFilter.First, rSubFilter.Second ) );
 
 }
 
@@ -1159,10 +1150,9 @@ void SalGtkFilePicker::HandleSetListValue(GtkComboBox *pWidget, sal_Int16 nContr
             {
                 Sequence< OUString > aStringList;
                 rValue >>= aStringList;
-                sal_Int32 nItemCount = aStringList.getLength();
-                for (sal_Int32 i = 0; i < nItemCount; ++i)
+                for (const auto& rString : aStringList)
                 {
-                    ComboBoxAppendText(pWidget,aStringList[i]);
+                    ComboBoxAppendText(pWidget, rString);
                     if (!bVersionWidthUnset)
                     {
                         HackWidthToFirst(pWidget);
@@ -1909,10 +1899,8 @@ void SalGtkFilePicker::implAddFilterGroup( const OUString& /*_rFilter*/, const S
 {
     // Gtk+ has no filter group concept I think so ...
     // implAddFilter( _rFilter, String() );
-    const StringPair* pSubFilters   = _rFilters.getConstArray();
-    const StringPair* pSubFiltersEnd = pSubFilters + _rFilters.getLength();
-    for( ; pSubFilters != pSubFiltersEnd; ++pSubFilters )
-        implAddFilter( pSubFilters->First, pSubFilters->Second );
+    for( const auto& rSubFilter : _rFilters )
+        implAddFilter( rSubFilter.First, rSubFilter.Second );
 }
 
 void SalGtkFilePicker::SetFilters()
@@ -1932,10 +1920,8 @@ void SalGtkFilePicker::SetFilters()
                 {   // it's a filter group
                     css::uno::Sequence< css::beans::StringPair > aSubFilters;
                     filter.getSubFilters( aSubFilters );
-                    const StringPair* pSubFilters   = aSubFilters.getConstArray();
-                    const StringPair* pSubFiltersEnd = pSubFilters + aSubFilters.getLength();
-                    for( ; pSubFilters != pSubFiltersEnd; ++pSubFilters )
-                        aAllFormats.insert(pSubFilters->Second);
+                    for( const auto& rSubFilter : aSubFilters )
+                        aAllFormats.insert(rSubFilter.Second);
                 }
                 else
                     aAllFormats.insert(filter.getFilter());
diff --git a/vcl/unx/gtk/salprn-gtk.cxx b/vcl/unx/gtk/salprn-gtk.cxx
index feec41bb5b4d..695b778b59ad 100644
--- a/vcl/unx/gtk/salprn-gtk.cxx
+++ b/vcl/unx/gtk/salprn-gtk.cxx
@@ -407,10 +407,10 @@ GtkPrintDialog::impl_initCustomTab()
     GtkWidget* pCurTabPage = nullptr;
     GtkWidget* pCurSubGroup = nullptr;
     bool bIgnoreSubgroup = false;
-    for (int i = 0; i != rOptions.getLength(); i++)
+    for (const auto& rOption : rOptions)
     {
         uno::Sequence<beans::PropertyValue> aOptProp;
-        rOptions[i].Value >>= aOptProp;
+        rOption.Value >>= aOptProp;
 
         OUString aCtrlType;
         OUString aText;
@@ -432,9 +432,8 @@ GtkPrintDialog::impl_initCustomTab()
         if (!aOptProp.hasElements())
             continue;
 
-        for (int n = 0; n != aOptProp.getLength(); n++)
+        for (const beans::PropertyValue& rEntry : aOptProp)
         {
-            const beans::PropertyValue& rEntry(aOptProp[ n ]);
             if ( rEntry.Name == "Text" )
             {
                 OUString aValue;
@@ -472,8 +471,8 @@ GtkPrintDialog::impl_initCustomTab()
                 {
                     const int nLen = aHelpIds.getLength();
                     aHelpTexts.realloc(nLen);
-                    for (int j = 0; j != nLen; ++j)
-                        aHelpTexts[j] = pHelp->GetHelpText(aHelpIds[j], static_cast<weld::Widget*>(nullptr));
+                    std::transform(aHelpIds.begin(), aHelpIds.end(), aHelpTexts.begin(),
+                        [&pHelp](const OUString& rHelpId) { return pHelp->GetHelpText(rHelpId, static_cast<weld::Widget*>(nullptr)); });
                 }
                 else // fallback
                     aHelpTexts = aHelpIds;
@@ -609,10 +608,10 @@ GtkPrintDialog::impl_initCustomTab()
                 {
                    pWidget = lcl_combo_box_text_new();
 
-                   for (sal_Int32 m = 0; m != aChoices.getLength(); m++)
+                   for (const auto& rChoice : aChoices)
                    {
                        lcl_combo_box_text_append(pWidget,
-                           OUStringToOString(aChoices[m], RTL_TEXTENCODING_UTF8).getStr());
+                           OUStringToOString(rChoice, RTL_TEXTENCODING_UTF8).getStr());
                    }
 
                    sal_Int32 nSelectVal = 0;
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index b2c95719c0b4..2ff0f1087a47 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -579,10 +579,8 @@ std::vector<GtkTargetEntry> VclToGtkHelper::FormatsToGtk(const css::uno::Sequenc
     std::vector<GtkTargetEntry> aGtkTargets;
 
     bool bHaveText(false), bHaveUTF8(false);
-    for (int i = 0; i < rFormats.getLength(); ++i)
+    for (const css::datatransfer::DataFlavor& rFlavor : rFormats)
     {
-        const css::datatransfer::DataFlavor& rFlavor = rFormats[i];
-
         sal_Int32 nIndex(0);
         if (rFlavor.MimeType.getToken(0, ';', nIndex) == "text/plain")
         {
diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx
index b9e4f26af815..befde4053660 100644
--- a/vcl/workben/vcldemo.cxx
+++ b/vcl/workben/vcldemo.cxx
@@ -1222,12 +1222,12 @@ public:
             css::uno::Reference<css::container::XNameAccess> xRef(ImageTree::get().getNameAccess());
             css::uno::Sequence< OUString > aAllIcons = xRef->getElementNames();
 
-            for (sal_Int32 i = 0; i < aAllIcons.getLength(); i++)
+            for (const auto& rIcon : aAllIcons)
             {
-                if (aAllIcons[i].endsWithIgnoreAsciiCase("svg"))
+                if (rIcon.endsWithIgnoreAsciiCase("svg"))
                     continue; // too slow to load.
-                maIconNames.push_back(aAllIcons[i]);
-                maIcons.emplace_back(aAllIcons[i]);
+                maIconNames.push_back(rIcon);
+                maIcons.emplace_back(rIcon);
             }
         }
 


More information about the Libreoffice-commits mailing list