[Libreoffice-commits] core.git: filter/source forms/qa forms/source fpicker/source framework/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Thu May 21 06:49:02 UTC 2020


 filter/source/config/cache/filtercache.cxx                        |   10 
 filter/source/graphic/GraphicExportFilter.cxx                     |   14 
 filter/source/msfilter/eschesdo.cxx                               |    6 
 filter/source/pdf/pdfdecomposer.cxx                               |    5 
 filter/source/pdf/pdfdialog.cxx                                   |    6 
 filter/source/pdf/pdfexport.cxx                                   |  266 +++++-----
 filter/source/pdf/pdffilter.cxx                                   |    6 
 filter/source/svg/svgfilter.cxx                                   |   30 -
 filter/source/xsltdialog/xmlfiltertestdialog.cxx                  |    9 
 filter/source/xsltfilter/LibXSLTTransformer.cxx                   |    4 
 forms/qa/org/openoffice/xforms/Instance.java                      |    2 
 forms/source/xforms/model_helper.hxx                              |   10 
 forms/source/xforms/xpathlib/extension.cxx                        |    4 
 fpicker/source/office/OfficeControlAccess.cxx                     |    4 
 fpicker/source/office/fpinteraction.cxx                           |   11 
 framework/source/dispatch/closedispatcher.cxx                     |    6 
 framework/source/dispatch/dispatchdisabler.cxx                    |    4 
 framework/source/fwe/classes/addonmenu.cxx                        |   20 
 framework/source/fwe/classes/addonsoptions.cxx                    |   16 
 framework/source/fwe/xml/menudocumenthandler.cxx                  |   26 
 framework/source/fwe/xml/statusbardocumenthandler.cxx             |   22 
 framework/source/fwe/xml/toolboxdocumenthandler.cxx               |   22 
 framework/source/fwi/helper/mischelper.cxx                        |   16 
 framework/source/helper/uiconfigelementwrapperbase.cxx            |    4 
 framework/source/helper/uielementwrapperbase.cxx                  |    4 
 framework/source/layoutmanager/layoutmanager.cxx                  |   52 -
 framework/source/layoutmanager/toolbarlayoutmanager.cxx           |   41 -
 framework/source/services/modulemanager.cxx                       |   13 
 framework/source/services/sessionlistener.cxx                     |    4 
 framework/source/uiconfiguration/imagemanagerimpl.cxx             |   31 -
 framework/source/uiconfiguration/moduleuicfgsupplier.cxx          |   11 
 framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx |   20 
 framework/source/uiconfiguration/uicategorydescription.cxx        |    9 
 framework/source/uiconfiguration/uiconfigurationmanager.cxx       |   20 
 framework/source/uiconfiguration/windowstateconfiguration.cxx     |   10 
 framework/source/uielement/FixedTextToolbarController.cxx         |    6 
 framework/source/uielement/addonstoolbarmanager.cxx               |    4 
 framework/source/uielement/addonstoolbarwrapper.cxx               |    4 
 framework/source/uielement/buttontoolbarcontroller.cxx            |    4 
 framework/source/uielement/comboboxtoolbarcontroller.cxx          |   44 -
 framework/source/uielement/complextoolbarcontroller.cxx           |    6 
 framework/source/uielement/dropdownboxtoolbarcontroller.cxx       |   38 -
 framework/source/uielement/edittoolbarcontroller.cxx              |    6 
 framework/source/uielement/fontmenucontroller.cxx                 |    5 
 framework/source/uielement/fontsizemenucontroller.cxx             |    8 
 framework/source/uielement/generictoolbarcontroller.cxx           |    6 
 framework/source/uielement/imagebuttontoolbarcontroller.cxx       |    6 
 framework/source/uielement/macrosmenucontroller.cxx               |   30 -
 framework/source/uielement/menubarmanager.cxx                     |   26 
 framework/source/uielement/menubarmerger.cxx                      |   12 
 framework/source/uielement/menubarwrapper.cxx                     |    4 
 framework/source/uielement/newmenucontroller.cxx                  |    6 
 framework/source/uielement/recentfilesmenucontroller.cxx          |   12 
 framework/source/uielement/spinfieldtoolbarcontroller.cxx         |   38 -
 framework/source/uielement/statusbarmanager.cxx                   |   26 
 framework/source/uielement/statusbarmerger.cxx                    |    8 
 framework/source/uielement/subtoolbarcontroller.cxx               |    6 
 framework/source/uielement/togglebuttontoolbarcontroller.cxx      |   48 -
 framework/source/uielement/toolbarmanager.cxx                     |   38 -
 framework/source/uielement/toolbarmerger.cxx                      |   30 -
 framework/source/uielement/toolbarsmenucontroller.cxx             |   38 -
 framework/source/uielement/toolbarwrapper.cxx                     |    4 
 framework/source/uielement/uicommanddescription.cxx               |   16 
 framework/source/uifactory/addonstoolbarfactory.cxx               |   27 -
 framework/source/uifactory/factoryconfiguration.cxx               |    6 
 framework/source/uifactory/uicontrollerfactory.cxx                |    4 
 framework/source/uifactory/uielementfactorymanager.cxx            |   16 
 framework/source/uifactory/windowcontentfactorymanager.cxx        |    4 
 68 files changed, 617 insertions(+), 657 deletions(-)

New commits:
commit 89340fcb6509afd1bffea7b6060d5ff5a444b3f1
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed May 20 13:45:07 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu May 21 08:48:26 2020 +0200

    use for-range on Sequence in f*
    
    Change-Id: I820255001c1b96d1f4b76a203f3c0f76fa09fe66
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94567
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx
index bb928a784c37..b3ac1594fade 100644
--- a/filter/source/config/cache/filtercache.cxx
+++ b/filter/source/config/cache/filtercache.cxx
@@ -2061,9 +2061,8 @@ void FilterCache::impl_readOldFormat()
             css::uno::Reference< css::container::XNameAccess > xSet;
             xCfg->getByName(TYPES_SET) >>= xSet;
             const css::uno::Sequence< OUString > lItems = xSet->getElementNames();
-            const OUString*                      pItems = lItems.getConstArray();
-            for (sal_Int32 i=0; i<lItems.getLength(); ++i)
-                m_lTypes[pItems[i]] = impl_readOldItem(xSet, E_TYPE, pItems[i]);
+            for (const OUString& rName : lItems)
+                m_lTypes[rName] = impl_readOldItem(xSet, E_TYPE, rName);
         }
 
         OUString FILTER_SET("Filters");
@@ -2073,9 +2072,8 @@ void FilterCache::impl_readOldFormat()
             css::uno::Reference< css::container::XNameAccess > xSet;
             xCfg->getByName(FILTER_SET) >>= xSet;
             const css::uno::Sequence< OUString > lItems = xSet->getElementNames();
-            const OUString*                      pItems = lItems.getConstArray();
-            for (sal_Int32 i=0; i<lItems.getLength(); ++i)
-                m_lFilters[pItems[i]] = impl_readOldItem(xSet, E_FILTER, pItems[i]);
+            for (const OUString& rName : lItems)
+                m_lFilters[rName] = impl_readOldItem(xSet, E_FILTER, rName);
         }
     }
     /* corrupt filter addon? Because it's external (optional) code... we can ignore it. Addon won't work then...
diff --git a/filter/source/graphic/GraphicExportFilter.cxx b/filter/source/graphic/GraphicExportFilter.cxx
index 457949ab770d..548a2c4e1407 100644
--- a/filter/source/graphic/GraphicExportFilter.cxx
+++ b/filter/source/graphic/GraphicExportFilter.cxx
@@ -44,10 +44,8 @@ void GraphicExportFilter::gatherProperties( const uno::Sequence< beans::Property
 {
     OUString aInternalFilterName;
 
-    for ( sal_Int32 i = 0; i < rProperties.getLength(); i++ )
+    for ( const beans::PropertyValue& rProperty : rProperties )
     {
-        const beans::PropertyValue& rProperty = rProperties[i];
-
         if ( rProperty.Name == "FilterName" )
         {
             rProperty.Value >>= aInternalFilterName;
@@ -76,15 +74,15 @@ void GraphicExportFilter::gatherProperties( const uno::Sequence< beans::Property
         }
     }
 
-    for ( sal_Int32 i = 0; i < maFilterDataSequence.getLength(); i++ )
+    for ( const beans::PropertyValue& rProp : std::as_const(maFilterDataSequence) )
     {
-        if ( maFilterDataSequence[i].Name == "PixelWidth" )
+        if ( rProp.Name == "PixelWidth" )
         {
-            maFilterDataSequence[i].Value >>= mnTargetWidth;
+            rProp.Value >>= mnTargetWidth;
         }
-        else if ( maFilterDataSequence[i].Name == "PixelHeight" )
+        else if ( rProp.Name == "PixelHeight" )
         {
-            maFilterDataSequence[i].Value >>= mnTargetHeight;
+            rProp.Value >>= mnTargetHeight;
         }
     }
 
diff --git a/filter/source/msfilter/eschesdo.cxx b/filter/source/msfilter/eschesdo.cxx
index af78b7be323e..22f47daa15af 100644
--- a/filter/source/msfilter/eschesdo.cxx
+++ b/filter/source/msfilter/eschesdo.cxx
@@ -166,12 +166,12 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj,
                 if ( xPropInfo.is() && xPropInfo->hasPropertyByName( "InteropGrabBag" ) )
                 {
                     xPropertySet->getPropertyValue( "InteropGrabBag" ) >>= aGrabBag;
-                    for (int i=0; i< aGrabBag.getLength();  i++)
+                    for (const beans::PropertyValue& rProp : std::as_const(aGrabBag))
                     {
-                        if (aGrabBag[i].Name == "mso-edit-as")
+                        if (rProp.Name == "mso-edit-as")
                         {
                             OUString rEditAs;
-                            aGrabBag[i].Value >>= rEditAs;
+                            rProp.Value >>= rEditAs;
                             mpEscherEx->SetEditAs(rEditAs);
                             break;
                         }
diff --git a/filter/source/pdf/pdfdecomposer.cxx b/filter/source/pdf/pdfdecomposer.cxx
index 15e500343f8f..e053fd215369 100644
--- a/filter/source/pdf/pdfdecomposer.cxx
+++ b/filter/source/pdf/pdfdecomposer.cxx
@@ -57,13 +57,12 @@ uno::Sequence<uno::Reference<graphic::XPrimitive2D>> SAL_CALL XPdfDecomposer::ge
 {
     sal_Int32 nPageIndex = -1;
 
-    for (sal_Int32 index = 0; index < xParameters.getLength(); index++)
+    for (const beans::PropertyValue& rProperty : xParameters)
     {
-        const beans::PropertyValue& rProperty = xParameters[index];
-
         if (rProperty.Name == "PageIndex")
         {
             rProperty.Value >>= nPageIndex;
+            break;
         }
     }
 
diff --git a/filter/source/pdf/pdfdialog.cxx b/filter/source/pdf/pdfdialog.cxx
index 7380a3ec0894..5a9fc177dc2c 100644
--- a/filter/source/pdf/pdfdialog.cxx
+++ b/filter/source/pdf/pdfdialog.cxx
@@ -138,11 +138,11 @@ void SAL_CALL PDFDialog::setPropertyValues( const Sequence< PropertyValue >& rPr
 {
     maMediaDescriptor = rProps;
 
-    for( sal_Int32 i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ )
+    for( const PropertyValue& rProp : std::as_const(maMediaDescriptor) )
     {
-        if ( maMediaDescriptor[ i ].Name == "FilterData" )
+        if ( rProp.Name == "FilterData" )
         {
-            maMediaDescriptor[ i ].Value >>= maFilterData;
+            rProp.Value >>= maFilterData;
             break;
         }
     }
diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx
index 787bcab4398b..169b78bfea75 100644
--- a/filter/source/pdf/pdfexport.cxx
+++ b/filter/source/pdf/pdfexport.cxx
@@ -179,14 +179,14 @@ bool PDFExport::ExportSelection( vcl::PDFWriter& rPDFWriter,
                 StringRangeEnumerator::Iterator aEnd  = rRangeEnum.end();
                 while ( aIter != aEnd )
                 {
-                    Sequence< PropertyValue >   aRenderer( rRenderable->getRenderer( *aIter, rSelection, rRenderOptions ) );
+                    const Sequence< PropertyValue > aRenderer( rRenderable->getRenderer( *aIter, rSelection, rRenderOptions ) );
                     awt::Size                   aPageSize;
 
-                    for( sal_Int32 nProperty = 0, nPropertyCount = aRenderer.getLength(); nProperty < nPropertyCount; ++nProperty )
+                    for( const PropertyValue& rProp : aRenderer )
                     {
-                        if ( aRenderer[ nProperty ].Name == "PageSize" )
+                        if ( rProp.Name == "PageSize" )
                         {
-                            aRenderer[ nProperty].Value >>= aPageSize;
+                            rProp.Value >>= aPageSize;
                             break;
                         }
                     }
@@ -359,9 +359,9 @@ static OUString getMimetypeForDocument( const Reference< XComponentContext >& xC
 
                         Sequence< beans::PropertyValue > aFilterData;
                         xFilterFactory->getByName( aFilterName ) >>= aFilterData;
-                        for ( sal_Int32 nInd = 0; nInd < aFilterData.getLength(); nInd++ )
-                            if ( aFilterData[nInd].Name == "Type" )
-                                aFilterData[nInd].Value >>= aTypeName;
+                        for ( const beans::PropertyValue& rProp : std::as_const(aFilterData) )
+                            if ( rProp.Name == "Type" )
+                                rProp.Value >>= aTypeName;
 
                         if ( !aTypeName.isEmpty() )
                         {
@@ -372,9 +372,9 @@ static OUString getMimetypeForDocument( const Reference< XComponentContext >& xC
 
                             Sequence< beans::PropertyValue > aTypeData;
                             xTypeDetection->getByName( aTypeName ) >>= aTypeData;
-                            for ( sal_Int32 nInd = 0; nInd < aTypeData.getLength(); nInd++ )
-                                if ( aTypeData[nInd].Name == "MediaType" )
-                                    aTypeData[nInd].Value >>= aDocMimetype;
+                            for ( const beans::PropertyValue& rProp : std::as_const(aTypeData) )
+                                if ( rProp.Name == "MediaType" )
+                                    rProp.Value >>= aDocMimetype;
                         }
                     }
                 }
@@ -454,134 +454,134 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
                 utl::ConfigManager::getProductVersion();
             aContext.DocumentInfo.Creator = aCreator;
 
-            for( sal_Int32 nData = 0, nDataCount = rFilterData.getLength(); nData < nDataCount; ++nData )
+            for ( const beans::PropertyValue& rProp : rFilterData )
             {
-                if ( rFilterData[ nData ].Name == "PageRange" )
-                    rFilterData[ nData ].Value >>= aPageRange;
-                else if ( rFilterData[ nData ].Name == "Selection" )
-                    aSelection = rFilterData[ nData ].Value;
-                else if ( rFilterData[ nData ].Name == "UseLosslessCompression" )
-                    rFilterData[ nData ].Value >>= mbUseLosslessCompression;
-                else if ( rFilterData[ nData ].Name == "Quality" )
-                    rFilterData[ nData ].Value >>= mnQuality;
-                else if ( rFilterData[ nData ].Name == "ReduceImageResolution" )
-                    rFilterData[ nData ].Value >>= mbReduceImageResolution;
-                else if ( rFilterData[ nData ].Name == "IsSkipEmptyPages" )
-                    rFilterData[ nData ].Value >>= mbSkipEmptyPages;
-                else if ( rFilterData[ nData ].Name == "MaxImageResolution" )
-                    rFilterData[ nData ].Value >>= mnMaxImageResolution;
-                else if ( rFilterData[ nData ].Name == "UseTaggedPDF" )
-                    rFilterData[ nData ].Value >>= mbUseTaggedPDF;
-                else if ( rFilterData[ nData ].Name == "SelectPdfVersion" )
-                    rFilterData[ nData ].Value >>= mnPDFTypeSelection;
-                else if ( rFilterData[ nData ].Name == "PDFUACompliance" )
-                    rFilterData[ nData ].Value >>= mbPDFUACompliance;
-                else if ( rFilterData[ nData ].Name == "ExportNotes" )
-                    rFilterData[ nData ].Value >>= mbExportNotes;
-                else if ( rFilterData[ nData ].Name == "ExportNotesPages" )
-                    rFilterData[ nData ].Value >>= mbExportNotesPages;
-                else if ( rFilterData[ nData ].Name == "ExportOnlyNotesPages" )
-                    rFilterData[ nData ].Value >>= mbExportOnlyNotesPages;
-                else if ( rFilterData[ nData ].Name == "UseTransitionEffects" )
-                    rFilterData[ nData ].Value >>= mbUseTransitionEffects;
-                else if ( rFilterData[ nData ].Name == "ExportFormFields" )
-                    rFilterData[ nData ].Value >>= mbExportFormFields;
-                else if ( rFilterData[ nData ].Name == "FormsType" )
-                    rFilterData[ nData ].Value >>= mnFormsFormat;
-                else if ( rFilterData[ nData ].Name == "AllowDuplicateFieldNames" )
-                    rFilterData[ nData ].Value >>= mbAllowDuplicateFieldNames;
+                if ( rProp.Name == "PageRange" )
+                    rProp.Value >>= aPageRange;
+                else if ( rProp.Name == "Selection" )
+                    aSelection = rProp.Value;
+                else if ( rProp.Name == "UseLosslessCompression" )
+                    rProp.Value >>= mbUseLosslessCompression;
+                else if ( rProp.Name == "Quality" )
+                    rProp.Value >>= mnQuality;
+                else if ( rProp.Name == "ReduceImageResolution" )
+                    rProp.Value >>= mbReduceImageResolution;
+                else if ( rProp.Name == "IsSkipEmptyPages" )
+                    rProp.Value >>= mbSkipEmptyPages;
+                else if ( rProp.Name == "MaxImageResolution" )
+                    rProp.Value >>= mnMaxImageResolution;
+                else if ( rProp.Name == "UseTaggedPDF" )
+                    rProp.Value >>= mbUseTaggedPDF;
+                else if ( rProp.Name == "SelectPdfVersion" )
+                    rProp.Value >>= mnPDFTypeSelection;
+                else if ( rProp.Name == "PDFUACompliance" )
+                    rProp.Value >>= mbPDFUACompliance;
+                else if ( rProp.Name == "ExportNotes" )
+                    rProp.Value >>= mbExportNotes;
+                else if ( rProp.Name == "ExportNotesPages" )
+                    rProp.Value >>= mbExportNotesPages;
+                else if ( rProp.Name == "ExportOnlyNotesPages" )
+                    rProp.Value >>= mbExportOnlyNotesPages;
+                else if ( rProp.Name == "UseTransitionEffects" )
+                    rProp.Value >>= mbUseTransitionEffects;
+                else if ( rProp.Name == "ExportFormFields" )
+                    rProp.Value >>= mbExportFormFields;
+                else if ( rProp.Name == "FormsType" )
+                    rProp.Value >>= mnFormsFormat;
+                else if ( rProp.Name == "AllowDuplicateFieldNames" )
+                    rProp.Value >>= mbAllowDuplicateFieldNames;
                 // viewer properties
-                else if ( rFilterData[ nData ].Name == "HideViewerToolbar" )
-                    rFilterData[ nData ].Value >>= mbHideViewerToolbar;
-                else if ( rFilterData[ nData ].Name == "HideViewerMenubar" )
-                    rFilterData[ nData ].Value >>= mbHideViewerMenubar;
-                else if ( rFilterData[ nData ].Name == "HideViewerWindowControls" )
-                    rFilterData[ nData ].Value >>= mbHideViewerWindowControls;
-                else if ( rFilterData[ nData ].Name == "ResizeWindowToInitialPage" )
-                    rFilterData[ nData ].Value >>= mbFitWindow;
-                else if ( rFilterData[ nData ].Name == "CenterWindow" )
-                    rFilterData[ nData ].Value >>= mbCenterWindow;
-                else if ( rFilterData[ nData ].Name == "OpenInFullScreenMode" )
-                    rFilterData[ nData ].Value >>= mbOpenInFullScreenMode;
-                else if ( rFilterData[ nData ].Name == "DisplayPDFDocumentTitle" )
-                    rFilterData[ nData ].Value >>= mbDisplayPDFDocumentTitle;
-                else if ( rFilterData[ nData ].Name == "InitialView" )
-                    rFilterData[ nData ].Value >>= mnPDFDocumentMode;
-                else if ( rFilterData[ nData ].Name == "Magnification" )
-                    rFilterData[ nData ].Value >>= mnPDFDocumentAction;
-                else if ( rFilterData[ nData ].Name == "Zoom" )
-                    rFilterData[ nData ].Value >>= mnZoom;
-                else if ( rFilterData[ nData ].Name == "InitialPage" )
-                    rFilterData[ nData ].Value >>= mnInitialPage;
-                else if ( rFilterData[ nData ].Name == "PageLayout" )
-                    rFilterData[ nData ].Value >>= mnPDFPageLayout;
-                else if ( rFilterData[ nData ].Name == "FirstPageOnLeft" )
-                    rFilterData[ nData ].Value >>= aContext.FirstPageLeft;
-                else if ( rFilterData[ nData ].Name == "IsAddStream" )
-                    rFilterData[ nData ].Value >>= mbAddStream;
-                else if ( rFilterData[ nData ].Name == "Watermark" )
-                    rFilterData[ nData ].Value >>= msWatermark;
-                else if ( rFilterData[ nData ].Name == "TiledWatermark" )
-                    rFilterData[ nData ].Value >>= msTiledWatermark;
+                else if ( rProp.Name == "HideViewerToolbar" )
+                    rProp.Value >>= mbHideViewerToolbar;
+                else if ( rProp.Name == "HideViewerMenubar" )
+                    rProp.Value >>= mbHideViewerMenubar;
+                else if ( rProp.Name == "HideViewerWindowControls" )
+                    rProp.Value >>= mbHideViewerWindowControls;
+                else if ( rProp.Name == "ResizeWindowToInitialPage" )
+                    rProp.Value >>= mbFitWindow;
+                else if ( rProp.Name == "CenterWindow" )
+                    rProp.Value >>= mbCenterWindow;
+                else if ( rProp.Name == "OpenInFullScreenMode" )
+                    rProp.Value >>= mbOpenInFullScreenMode;
+                else if ( rProp.Name == "DisplayPDFDocumentTitle" )
+                    rProp.Value >>= mbDisplayPDFDocumentTitle;
+                else if ( rProp.Name == "InitialView" )
+                    rProp.Value >>= mnPDFDocumentMode;
+                else if ( rProp.Name == "Magnification" )
+                    rProp.Value >>= mnPDFDocumentAction;
+                else if ( rProp.Name == "Zoom" )
+                    rProp.Value >>= mnZoom;
+                else if ( rProp.Name == "InitialPage" )
+                    rProp.Value >>= mnInitialPage;
+                else if ( rProp.Name == "PageLayout" )
+                    rProp.Value >>= mnPDFPageLayout;
+                else if ( rProp.Name == "FirstPageOnLeft" )
+                    rProp.Value >>= aContext.FirstPageLeft;
+                else if ( rProp.Name == "IsAddStream" )
+                    rProp.Value >>= mbAddStream;
+                else if ( rProp.Name == "Watermark" )
+                    rProp.Value >>= msWatermark;
+                else if ( rProp.Name == "TiledWatermark" )
+                    rProp.Value >>= msTiledWatermark;
                 // now all the security related properties...
-                else if ( rFilterData[ nData ].Name == "EncryptFile" )
-                    rFilterData[ nData ].Value >>= mbEncrypt;
-                else if ( rFilterData[ nData ].Name == "DocumentOpenPassword" )
-                    rFilterData[ nData ].Value >>= aOpenPassword;
-                else if ( rFilterData[ nData ].Name == "RestrictPermissions" )
-                    rFilterData[ nData ].Value >>= mbRestrictPermissions;
-                else if ( rFilterData[ nData ].Name == "PermissionPassword" )
-                    rFilterData[ nData ].Value >>= aPermissionPassword;
-                else if ( rFilterData[ nData ].Name == "PreparedPasswords" )
-                    rFilterData[ nData ].Value >>= xEnc;
-                else if ( rFilterData[ nData ].Name == "PreparedPermissionPassword" )
-                    rFilterData[ nData ].Value >>= aPreparedPermissionPassword;
-                else if ( rFilterData[ nData ].Name == "Printing" )
-                    rFilterData[ nData ].Value >>= mnPrintAllowed;
-                else if ( rFilterData[ nData ].Name == "Changes" )
-                    rFilterData[ nData ].Value >>= mnChangesAllowed;
-                else if ( rFilterData[ nData ].Name == "EnableCopyingOfContent" )
-                    rFilterData[ nData ].Value >>= mbCanCopyOrExtract;
-                else if ( rFilterData[ nData ].Name == "EnableTextAccessForAccessibilityTools" )
-                    rFilterData[ nData ].Value >>= mbCanExtractForAccessibility;
+                else if ( rProp.Name == "EncryptFile" )
+                    rProp.Value >>= mbEncrypt;
+                else if ( rProp.Name == "DocumentOpenPassword" )
+                    rProp.Value >>= aOpenPassword;
+                else if ( rProp.Name == "RestrictPermissions" )
+                    rProp.Value >>= mbRestrictPermissions;
+                else if ( rProp.Name == "PermissionPassword" )
+                    rProp.Value >>= aPermissionPassword;
+                else if ( rProp.Name == "PreparedPasswords" )
+                    rProp.Value >>= xEnc;
+                else if ( rProp.Name == "PreparedPermissionPassword" )
+                    rProp.Value >>= aPreparedPermissionPassword;
+                else if ( rProp.Name == "Printing" )
+                    rProp.Value >>= mnPrintAllowed;
+                else if ( rProp.Name == "Changes" )
+                    rProp.Value >>= mnChangesAllowed;
+                else if ( rProp.Name == "EnableCopyingOfContent" )
+                    rProp.Value >>= mbCanCopyOrExtract;
+                else if ( rProp.Name == "EnableTextAccessForAccessibilityTools" )
+                    rProp.Value >>= mbCanExtractForAccessibility;
                 // i56629 links extra (relative links and other related stuff)
-                else if ( rFilterData[ nData ].Name == "ExportLinksRelativeFsys" )
-                    rFilterData[ nData ].Value >>= mbExportRelativeFsysLinks;
-                else if ( rFilterData[ nData ].Name == "PDFViewSelection" )
-                    rFilterData[ nData ].Value >>= mnDefaultLinkAction;
-                else if ( rFilterData[ nData ].Name == "ConvertOOoTargetToPDFTarget" )
-                    rFilterData[ nData ].Value >>= mbConvertOOoTargetToPDFTarget;
-                else if ( rFilterData[ nData ].Name == "ExportBookmarksToPDFDestination" )
-                    rFilterData[ nData ].Value >>= mbExportBmkToDest;
-                else if ( rFilterData[ nData ].Name == "ExportBookmarks" )
-                    rFilterData[ nData ].Value >>= mbExportBookmarks;
-                else if ( rFilterData[ nData ].Name == "ExportHiddenSlides" )
-                    rFilterData[ nData ].Value >>= mbExportHiddenSlides;
-                else if ( rFilterData[ nData ].Name == "SinglePageSheets" )
-                    rFilterData[ nData ].Value >>= mbSinglePageSheets;
-                else if ( rFilterData[ nData ].Name == "OpenBookmarkLevels" )
-                    rFilterData[ nData ].Value >>= mnOpenBookmarkLevels;
-                else if ( rFilterData[ nData ].Name == "SignPDF" )
-                    rFilterData[ nData ].Value >>= mbSignPDF;
-                else if ( rFilterData[ nData ].Name == "SignatureLocation" )
-                    rFilterData[ nData ].Value >>= msSignLocation;
-                else if ( rFilterData[ nData ].Name == "SignatureReason" )
-                    rFilterData[ nData ].Value >>= msSignReason;
-                else if ( rFilterData[ nData ].Name == "SignatureContactInfo" )
-                    rFilterData[ nData ].Value >>= msSignContact;
-                else if ( rFilterData[ nData ].Name == "SignaturePassword" )
-                    rFilterData[ nData ].Value >>= msSignPassword;
-                else if ( rFilterData[ nData ].Name == "SignatureCertificate" )
-                    rFilterData[ nData ].Value >>= maSignCertificate;
-                else if ( rFilterData[ nData ].Name == "SignatureTSA" )
-                    rFilterData[ nData ].Value >>= msSignTSA;
-                else if ( rFilterData[ nData ].Name == "ExportPlaceholders" )
-                    rFilterData[ nData ].Value >>= mbExportPlaceholders;
-                else if ( rFilterData[ nData ].Name == "UseReferenceXObject" )
-                    rFilterData[ nData ].Value >>= mbUseReferenceXObject;
+                else if ( rProp.Name == "ExportLinksRelativeFsys" )
+                    rProp.Value >>= mbExportRelativeFsysLinks;
+                else if ( rProp.Name == "PDFViewSelection" )
+                    rProp.Value >>= mnDefaultLinkAction;
+                else if ( rProp.Name == "ConvertOOoTargetToPDFTarget" )
+                    rProp.Value >>= mbConvertOOoTargetToPDFTarget;
+                else if ( rProp.Name == "ExportBookmarksToPDFDestination" )
+                    rProp.Value >>= mbExportBmkToDest;
+                else if ( rProp.Name == "ExportBookmarks" )
+                    rProp.Value >>= mbExportBookmarks;
+                else if ( rProp.Name == "ExportHiddenSlides" )
+                    rProp.Value >>= mbExportHiddenSlides;
+                else if ( rProp.Name == "SinglePageSheets" )
+                    rProp.Value >>= mbSinglePageSheets;
+                else if ( rProp.Name == "OpenBookmarkLevels" )
+                    rProp.Value >>= mnOpenBookmarkLevels;
+                else if ( rProp.Name == "SignPDF" )
+                    rProp.Value >>= mbSignPDF;
+                else if ( rProp.Name == "SignatureLocation" )
+                    rProp.Value >>= msSignLocation;
+                else if ( rProp.Name == "SignatureReason" )
+                    rProp.Value >>= msSignReason;
+                else if ( rProp.Name == "SignatureContactInfo" )
+                    rProp.Value >>= msSignContact;
+                else if ( rProp.Name == "SignaturePassword" )
+                    rProp.Value >>= msSignPassword;
+                else if ( rProp.Name == "SignatureCertificate" )
+                    rProp.Value >>= maSignCertificate;
+                else if ( rProp.Name == "SignatureTSA" )
+                    rProp.Value >>= msSignTSA;
+                else if ( rProp.Name == "ExportPlaceholders" )
+                    rProp.Value >>= mbExportPlaceholders;
+                else if ( rProp.Name == "UseReferenceXObject" )
+                    rProp.Value >>= mbUseReferenceXObject;
                 // Redaction & bitmap related stuff
-                else if ( rFilterData[ nData ].Name == "IsRedactMode" )
-                    rFilterData[ nData ].Value >>= mbIsRedactMode;
+                else if ( rProp.Name == "IsRedactMode" )
+                    rProp.Value >>= mbIsRedactMode;
             }
 
             aContext.URL        = aURL.GetMainURL(INetURLObject::DecodeMechanism::ToIUri);
diff --git a/filter/source/pdf/pdffilter.cxx b/filter/source/pdf/pdffilter.cxx
index 175604d8a99c..fdbdae95784b 100644
--- a/filter/source/pdf/pdffilter.cxx
+++ b/filter/source/pdf/pdffilter.cxx
@@ -133,11 +133,11 @@ bool PDFFilter::implExport( const Sequence< PropertyValue >& rDescriptor )
     {
         bool bFound = false;
 
-        for (int i = 0; i < aFilterData.getLength(); ++i)
+        for (PropertyValue& rProp : aFilterData)
         {
-            if (aFilterData[i].Name == "IsRedactMode")
+            if (rProp.Name == "IsRedactMode")
             {
-                aFilterData[i].Value <<= bIsRedactMode;
+                rProp.Value <<= bIsRedactMode;
                 bFound = true;
                 break;
             }
diff --git a/filter/source/svg/svgfilter.cxx b/filter/source/svg/svgfilter.cxx
index 0440ac94e1c9..7808b633b74e 100644
--- a/filter/source/svg/svgfilter.cxx
+++ b/filter/source/svg/svgfilter.cxx
@@ -112,12 +112,12 @@ sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescripto
 
     if(mxSrcDoc.is())
     {
-        for (sal_Int32 nInd = 0; nInd < rDescriptor.getLength(); nInd++)
+        for (const PropertyValue& rProp : rDescriptor)
         {
-            if (rDescriptor[nInd].Name == "FilterName")
+            if (rProp.Name == "FilterName")
             {
                 OUString sFilterName;
-                rDescriptor[nInd].Value >>= sFilterName;
+                rProp.Value >>= sFilterName;
                 if(sFilterName == "impress_svg_Export")
                 {
                     mbImpressFilter = true;
@@ -374,17 +374,17 @@ bool SVGFilter::filterImpressOrDraw( const Sequence< PropertyValue >& rDescripto
         bool bPageProvided = comphelper::LibreOfficeKit::isActive();
         sal_Int32 nPageToExport = -1;
 
-        for (sal_Int32 nInd = 0; nInd < rDescriptor.getLength(); nInd++)
+        for( const PropertyValue& rProp : rDescriptor )
         {
-            if (rDescriptor[nInd].Name == "SelectionOnly")
+            if (rProp.Name == "SelectionOnly")
             {
                 // #i124608# extract single selection wanted from dialog return values
-                rDescriptor[nInd].Value >>= bSelectionOnly;
+                rProp.Value >>= bSelectionOnly;
                 bPageProvided = false;
             }
-            else if (rDescriptor[nInd].Name == "PagePos")
+            else if (rProp.Name == "PagePos")
             {
-                rDescriptor[nInd].Value >>= nPageToExport;
+                rProp.Value >>= nPageToExport;
                 bPageProvided = true;
             }
         }
@@ -404,20 +404,20 @@ bool SVGFilter::filterImpressOrDraw( const Sequence< PropertyValue >& rDescripto
             // * traverse Impress resources to find slide preview pane, grab selection from there
             // * otherwise, fallback to current slide
             //
-            uno::Sequence<uno::Reference<drawing::framework::XResourceId> > aResIds(
+            const uno::Sequence<uno::Reference<drawing::framework::XResourceId> > aResIds(
                 xConfigController->getCurrentConfiguration()->getResources(
                     uno::Reference<drawing::framework::XResourceId>(),
                     "",
                     drawing::framework::AnchorBindingMode_INDIRECT));
 
-            for( sal_Int32 i=0; i<aResIds.getLength(); ++i )
+            for( const uno::Reference<drawing::framework::XResourceId>& rResId : aResIds )
             {
                 // can we somehow obtain the slidesorter from the Impress framework?
-                if( aResIds[i]->getResourceURL() == "private:resource/view/SlideSorter" )
+                if( rResId->getResourceURL() == "private:resource/view/SlideSorter" )
                 {
                     // got it, grab current selection from there
                     uno::Reference<drawing::framework::XResource> xRes(
-                        xConfigController->getResource(aResIds[i]));
+                        xConfigController->getResource(rResId));
 
                     uno::Reference< view::XSelectionSupplier > xSelectionSupplier(
                         xRes,
@@ -548,11 +548,11 @@ bool SVGFilter::filterWriterOrCalc( const Sequence< PropertyValue >& rDescriptor
 {
     bool bSelectionOnly = false;
 
-    for (sal_Int32 nInd = 0; nInd < rDescriptor.getLength(); nInd++)
+    for (const PropertyValue& rProp : rDescriptor)
     {
-        if (rDescriptor[nInd].Name == "SelectionOnly")
+        if (rProp.Name == "SelectionOnly")
         {
-            rDescriptor[nInd].Value >>= bSelectionOnly;
+            rProp.Value >>= bSelectionOnly;
             break;
         }
     }
diff --git a/filter/source/xsltdialog/xmlfiltertestdialog.cxx b/filter/source/xsltdialog/xmlfiltertestdialog.cxx
index e4a659a3653c..0499e0a5e615 100644
--- a/filter/source/xsltdialog/xmlfiltertestdialog.cxx
+++ b/filter/source/xsltdialog/xmlfiltertestdialog.cxx
@@ -345,16 +345,13 @@ void XMLFilterTestDialog::onExportBrowse()
 
                         if( aAny >>= aValues2 )
                         {
-                            PropertyValue* pValues2 = aValues2.getArray();
-                            sal_Int32 nValue;
-
                             OUString aExtension;
-                            for( nValue = 0; nValue < aValues2.getLength(); nValue++, pValues2++ )
+                            for( const PropertyValue& rProp : std::as_const(aValues2) )
                             {
-                                if ( pValues2->Name == "Extensions" )
+                                if ( rProp.Name == "Extensions" )
                                 {
                                     Sequence< OUString > aExtensions;
-                                    if( pValues2->Value >>= aExtensions )
+                                    if( rProp.Value >>= aExtensions )
                                     {
                                         const sal_Int32 nCount( aExtensions.getLength() );
                                         OUString* pExtensions = aExtensions.getArray();
diff --git a/filter/source/xsltfilter/LibXSLTTransformer.cxx b/filter/source/xsltfilter/LibXSLTTransformer.cxx
index 2d1c148a8c0f..1403664d4331 100644
--- a/filter/source/xsltfilter/LibXSLTTransformer.cxx
+++ b/filter/source/xsltfilter/LibXSLTTransformer.cxx
@@ -473,10 +473,10 @@ namespace XSLT
         }
         xmlSubstituteEntitiesDefault(0);
         m_parameters.clear();
-        for (int i = 0; i < params.getLength(); i++)
+        for (const Any& p : std::as_const(params))
         {
             NamedValue nv;
-            params[i] >>= nv;
+            p >>= nv;
             OString nameUTF8 = OUStringToOString(nv.Name,
                     RTL_TEXTENCODING_UTF8);
             OUString value;
diff --git a/forms/qa/org/openoffice/xforms/Instance.java b/forms/qa/org/openoffice/xforms/Instance.java
index d98c647a959f..53e9452df72a 100644
--- a/forms/qa/org/openoffice/xforms/Instance.java
+++ b/forms/qa/org/openoffice/xforms/Instance.java
@@ -92,7 +92,7 @@ public class Instance
     private XNode removeNode( XNode _parentElement, String _elementName ) throws DOMException
     {
         XNodeList nodes = _parentElement.getChildNodes();
-        for ( int i=0; i<nodes.getLength(); ++i )
+        for ( int i=0; i<nodes.(); ++i )
         {
             XNode node = nodes.item(i);
             if ( node.getLocalName().equals( _elementName ) )
diff --git a/forms/source/xforms/model_helper.hxx b/forms/source/xforms/model_helper.hxx
index 592649f839de..59056bf26e62 100644
--- a/forms/source/xforms/model_helper.hxx
+++ b/forms/source/xforms/model_helper.hxx
@@ -109,14 +109,12 @@ class InstanceCollection : public Collection<css::uno::Sequence<css::beans::Prop
 public:
     virtual bool isValid( const T& t ) const override
     {
-        const css::beans::PropertyValue* pValues = t.getConstArray();
-        OUString sInstance( "Instance" );
-        bool bFound = false;
-        for( sal_Int32 i = 0; ( ! bFound ) && ( i < t.getLength() ); i++ )
+        for( const css::beans::PropertyValue& rProp : t )
         {
-            bFound |= ( pValues[i].Name == sInstance );
+            if (rProp.Name == "Instance" )
+                return true;
         }
-        return bFound;
+        return false;
     }
 };
 
diff --git a/forms/source/xforms/xpathlib/extension.cxx b/forms/source/xforms/xpathlib/extension.cxx
index d5c26c1e63f6..0af6a3eb17db 100644
--- a/forms/source/xforms/xpathlib/extension.cxx
+++ b/forms/source/xforms/xpathlib/extension.cxx
@@ -53,9 +53,9 @@ void SAL_CALL CLibxml2XFormsExtension::initialize(const Sequence< Any >& aSequen
     }
 
     NamedValue aValue;
-    for (sal_Int32 i = 0; i < aSequence.getLength(); i++)
+    for (const Any& rArg : aSequence)
     {
-        if (! (aSequence[i] >>= aValue))
+        if (! (rArg >>= aValue))
             throw RuntimeException();
         if ( aValue.Name == "Model" )
             aValue.Value >>= m_aModel;
diff --git a/fpicker/source/office/OfficeControlAccess.cxx b/fpicker/source/office/OfficeControlAccess.cxx
index e8f4e3929d79..47796ec4e58e 100644
--- a/fpicker/source/office/OfficeControlAccess.cxx
+++ b/fpicker/source/office/OfficeControlAccess.cxx
@@ -509,8 +509,8 @@ namespace svt
 
                 if ( aTemplateList.hasElements() )
                 {
-                    for ( long i=0; i < aTemplateList.getLength(); i++ )
-                        pListbox->append_text( aTemplateList[i] );
+                    for ( const OUString& s : std::as_const(aTemplateList) )
+                        pListbox->append_text( s );
                 }
             }
             break;
diff --git a/fpicker/source/office/fpinteraction.cxx b/fpicker/source/office/fpinteraction.cxx
index eaaecaf305be..16ea3368ae08 100644
--- a/fpicker/source/office/fpinteraction.cxx
+++ b/fpicker/source/office/fpinteraction.cxx
@@ -63,17 +63,16 @@ namespace svt
         Reference< XInteractionRetry >       xRetry;
 
         const Sequence< Reference< XInteractionContinuation > > lConts = _rxRequest->getContinuations();
-        const Reference< XInteractionContinuation >*            pConts = lConts.getConstArray();
-        for (sal_Int32 i=0; i<lConts.getLength(); ++i)
+        for (const Reference< XInteractionContinuation >& rCont : lConts)
         {
             if (!xAbort.is())
-                xAbort.set(pConts[i], UNO_QUERY);
+                xAbort.set(rCont, UNO_QUERY);
             if (!xApprove.is())
-                xApprove.set(pConts[i], UNO_QUERY);
+                xApprove.set(rCont, UNO_QUERY);
             if (!xDisapprove.is())
-                xDisapprove.set(pConts[i], UNO_QUERY);
+                xDisapprove.set(rCont, UNO_QUERY);
             if (!xRetry.is())
-                xRetry.set(pConts[i], UNO_QUERY);
+                xRetry.set(rCont, UNO_QUERY);
         }
 
         // safe the original request for later analyzing!
diff --git a/framework/source/dispatch/closedispatcher.cxx b/framework/source/dispatch/closedispatcher.cxx
index f5fe3eecefdc..4724857b847f 100644
--- a/framework/source/dispatch/closedispatcher.cxx
+++ b/framework/source/dispatch/closedispatcher.cxx
@@ -210,11 +210,11 @@ void SAL_CALL CloseDispatcher::dispatchWithNotification(const css::util::URL&
     // <- SAFE ----------------------------------
 
     bool bIsSynchron = false;
-    for (sal_Int32 nArgs=0; nArgs<lArguments.getLength(); nArgs++ )
+    for (const css::beans::PropertyValue& rArg : lArguments )
     {
-        if ( lArguments[nArgs].Name == "SynchronMode" )
+        if ( rArg.Name == "SynchronMode" )
         {
-            lArguments[nArgs].Value >>= bIsSynchron;
+            rArg.Value >>= bIsSynchron;
             break;
         }
     }
diff --git a/framework/source/dispatch/dispatchdisabler.cxx b/framework/source/dispatch/dispatchdisabler.cxx
index 76fe27d8cf4a..098942c4b5a8 100644
--- a/framework/source/dispatch/dispatchdisabler.cxx
+++ b/framework/source/dispatch/dispatchdisabler.cxx
@@ -28,8 +28,8 @@ void SAL_CALL DispatchDisabler::initialize( const uno::Sequence< uno::Any >& aAr
     if( aArguments.hasElements() &&
         ( aArguments[0] >>= aDisabledURLs ) )
     {
-        for( sal_Int32 i = 0; i < aDisabledURLs.getLength(); ++i )
-            maDisabledURLs.insert(aDisabledURLs[i]);
+        for( OUString const & url : std::as_const(aDisabledURLs) )
+            maDisabledURLs.insert(url);
     }
 }
 
diff --git a/framework/source/fwe/classes/addonmenu.cxx b/framework/source/fwe/classes/addonmenu.cxx
index 0ce25ceca88f..80ac7c0e0850 100644
--- a/framework/source/fwe/classes/addonmenu.cxx
+++ b/framework/source/fwe/classes/addonmenu.cxx
@@ -152,9 +152,9 @@ void AddonMenuManager::MergeAddonPopupMenus( const Reference< XFrame >& rFrame,
     OUString aModuleIdentifier = vcl::CommandInfoProvider::GetModuleIdentifier(rFrame);
 
     const Sequence< Sequence< PropertyValue > >&    rAddonMenuEntries = aAddonsOptions.GetAddonsMenuBarPart();
-    for ( sal_Int32 i = 0; i < rAddonMenuEntries.getLength(); i++ )
+    for ( const Sequence< PropertyValue >& rEntry : rAddonMenuEntries )
     {
-        AddonMenuManager::GetMenuEntry( rAddonMenuEntries[i],
+        AddonMenuManager::GetMenuEntry( rEntry,
                                         aTitle,
                                         aURL,
                                         aTarget,
@@ -270,21 +270,21 @@ void AddonMenuManager::GetMenuEntry( const Sequence< PropertyValue >& rAddonMenu
     // Reset submenu parameter
     rAddonSubMenu   = Sequence< Sequence< PropertyValue > >();
 
-    for ( int i = 0; i < rAddonMenuEntry.getLength(); i++ )
+    for ( const PropertyValue& rEntry : rAddonMenuEntry )
     {
-        OUString aMenuEntryPropName = rAddonMenuEntry[i].Name;
+        OUString aMenuEntryPropName = rEntry.Name;
         if ( aMenuEntryPropName == ADDONSMENUITEM_STRING_URL )
-            rAddonMenuEntry[i].Value >>= rURL;
+            rEntry.Value >>= rURL;
         else if ( aMenuEntryPropName == ADDONSMENUITEM_STRING_TITLE )
-            rAddonMenuEntry[i].Value >>= rTitle;
+            rEntry.Value >>= rTitle;
         else if ( aMenuEntryPropName == ADDONSMENUITEM_STRING_TARGET )
-            rAddonMenuEntry[i].Value >>= rTarget;
+            rEntry.Value >>= rTarget;
         else if ( aMenuEntryPropName == ADDONSMENUITEM_STRING_IMAGEIDENTIFIER )
-            rAddonMenuEntry[i].Value >>= rImageId;
+            rEntry.Value >>= rImageId;
         else if ( aMenuEntryPropName == ADDONSMENUITEM_STRING_SUBMENU )
-            rAddonMenuEntry[i].Value >>= rAddonSubMenu;
+            rEntry.Value >>= rAddonSubMenu;
         else if ( aMenuEntryPropName == ADDONSMENUITEM_STRING_CONTEXT )
-            rAddonMenuEntry[i].Value >>= rContext;
+            rEntry.Value >>= rContext;
     }
 }
 
diff --git a/framework/source/fwe/classes/addonsoptions.cxx b/framework/source/fwe/classes/addonsoptions.cxx
index efba924622ab..725bec2f5405 100644
--- a/framework/source/fwe/classes/addonsoptions.cxx
+++ b/framework/source/fwe/classes/addonsoptions.cxx
@@ -997,8 +997,8 @@ void AddonsOptions_Impl::ReadMergeMenuData( const OUString& aMergeAddonInstructi
     aMergeMenuBaseNode += m_aPathDelimiter;
 
     // extend the node names to have full path strings
-    for ( sal_Int32 i = 0; i < aSubMenuNodeNames.getLength(); i++ )
-        aSubMenuNodeNames[i] = aMergeMenuBaseNode + aSubMenuNodeNames[i];
+    for ( OUString& rName : aSubMenuNodeNames )
+        rName = aMergeMenuBaseNode + rName;
 
     ReadSubMenuEntries( aSubMenuNodeNames, rMergeMenu );
 }
@@ -1324,8 +1324,8 @@ bool AddonsOptions_Impl::ReadMenuItem( const OUString& aMenuNodeName, Sequence<
             // Continue to read the sub menu nodes
             Sequence< Sequence< PropertyValue > > aSubMenuSeq;
             OUString aSubMenuRootNodeName( aRootSubMenuName + m_aPathDelimiter );
-            for ( sal_Int32 n = 0; n < aRootSubMenuNodeNames.getLength(); n++ )
-                aRootSubMenuNodeNames[n] = aSubMenuRootNodeName + aRootSubMenuNodeNames[n];
+            for ( OUString& rName : aRootSubMenuNodeNames )
+                rName = aSubMenuRootNodeName + rName;
             ReadSubMenuEntries( aRootSubMenuNodeNames, aSubMenuSeq );
             aMenuItem[ OFFSET_MENUITEM_SUBMENU ].Value <<= aSubMenuSeq;
             bResult = true;
@@ -1388,8 +1388,8 @@ bool AddonsOptions_Impl::ReadPopupMenu( const OUString& aPopupMenuNodeName, Sequ
             // Continue to read the sub menu nodes
             Sequence< Sequence< PropertyValue > > aSubMenuSeq;
             OUString aSubMenuRootNodeName( aRootSubMenuName + m_aPathDelimiter );
-            for ( sal_Int32 n = 0; n < aRootSubMenuNodeNames.getLength(); n++ )
-                aRootSubMenuNodeNames[n] = aSubMenuRootNodeName + aRootSubMenuNodeNames[n];
+            for ( OUString& rName : aRootSubMenuNodeNames )
+                rName = aSubMenuRootNodeName + rName;
             ReadSubMenuEntries( aRootSubMenuNodeNames, aSubMenuSeq );
             aPopupMenu[ OFFSET_POPUPMENU_SUBMENU ].Value <<= aSubMenuSeq;
             bResult = true;
@@ -1409,8 +1409,8 @@ void AddonsOptions_Impl::AppendPopupMenu( Sequence< PropertyValue >& rTargetPopu
     {
         sal_uInt32 nIndex = aTargetSubMenuSeq.getLength();
         aTargetSubMenuSeq.realloc( nIndex + aSourceSubMenuSeq.getLength() );
-        for ( sal_Int32 i = 0; i < aSourceSubMenuSeq.getLength(); i++ )
-            aTargetSubMenuSeq[nIndex++] = aSourceSubMenuSeq[i];
+        for ( Sequence<PropertyValue> const & rSeq : std::as_const(aSourceSubMenuSeq) )
+            aTargetSubMenuSeq[nIndex++] = rSeq;
         rTargetPopupMenu[ OFFSET_POPUPMENU_SUBMENU ].Value <<= aTargetSubMenuSeq;
     }
 }
diff --git a/framework/source/fwe/xml/menudocumenthandler.cxx b/framework/source/fwe/xml/menudocumenthandler.cxx
index a9bc60525af1..84de0f40bd39 100644
--- a/framework/source/fwe/xml/menudocumenthandler.cxx
+++ b/framework/source/fwe/xml/menudocumenthandler.cxx
@@ -118,32 +118,32 @@ static void ExtractMenuParameters( const Sequence< PropertyValue >& rProp,
                                    sal_Int16&                      rType,
                                    sal_Int16&                      rStyle )
 {
-    for ( sal_Int32 i = 0; i < rProp.getLength(); i++ )
+    for ( const PropertyValue& p : rProp )
     {
-        if ( rProp[i].Name == ITEM_DESCRIPTOR_COMMANDURL )
+        if ( p.Name == ITEM_DESCRIPTOR_COMMANDURL )
         {
-            rProp[i].Value >>= rCommandURL;
+            p.Value >>= rCommandURL;
             rCommandURL = rCommandURL.intern();
         }
-        else if ( rProp[i].Name == ITEM_DESCRIPTOR_HELPURL )
+        else if ( p.Name == ITEM_DESCRIPTOR_HELPURL )
         {
-            rProp[i].Value >>= rHelpURL;
+            p.Value >>= rHelpURL;
         }
-        else if ( rProp[i].Name == ITEM_DESCRIPTOR_CONTAINER )
+        else if ( p.Name == ITEM_DESCRIPTOR_CONTAINER )
         {
-            rProp[i].Value >>= rSubMenu;
+            p.Value >>= rSubMenu;
         }
-        else if ( rProp[i].Name == ITEM_DESCRIPTOR_LABEL )
+        else if ( p.Name == ITEM_DESCRIPTOR_LABEL )
         {
-            rProp[i].Value >>= rLabel;
+            p.Value >>= rLabel;
         }
-        else if ( rProp[i].Name == ITEM_DESCRIPTOR_TYPE )
+        else if ( p.Name == ITEM_DESCRIPTOR_TYPE )
         {
-            rProp[i].Value >>= rType;
+            p.Value >>= rType;
         }
-        else if ( rProp[i].Name == ITEM_DESCRIPTOR_STYLE )
+        else if ( p.Name == ITEM_DESCRIPTOR_STYLE )
         {
-            rProp[i].Value >>= rStyle;
+            p.Value >>= rStyle;
         }
     }
 }
diff --git a/framework/source/fwe/xml/statusbardocumenthandler.cxx b/framework/source/fwe/xml/statusbardocumenthandler.cxx
index e9e6d0038ea1..b0e836600fdc 100644
--- a/framework/source/fwe/xml/statusbardocumenthandler.cxx
+++ b/framework/source/fwe/xml/statusbardocumenthandler.cxx
@@ -100,28 +100,28 @@ static void ExtractStatusbarItemParameters(
     sal_Int16&                       rStyle,
     sal_Int16&                       rWidth )
 {
-    for ( sal_Int32 i = 0; i < rProp.getLength(); i++ )
+    for ( const PropertyValue& rEntry : rProp )
     {
-        if ( rProp[i].Name == ITEM_DESCRIPTOR_COMMANDURL )
+        if ( rEntry.Name == ITEM_DESCRIPTOR_COMMANDURL )
         {
-            rProp[i].Value >>= rCommandURL;
+            rEntry.Value >>= rCommandURL;
             rCommandURL = rCommandURL.intern();
         }
-        else if ( rProp[i].Name == ITEM_DESCRIPTOR_HELPURL )
+        else if ( rEntry.Name == ITEM_DESCRIPTOR_HELPURL )
         {
-            rProp[i].Value >>= rHelpURL;
+            rEntry.Value >>= rHelpURL;
         }
-        else if ( rProp[i].Name == ITEM_DESCRIPTOR_OFFSET )
+        else if ( rEntry.Name == ITEM_DESCRIPTOR_OFFSET )
         {
-            rProp[i].Value >>= rOffset;
+            rEntry.Value >>= rOffset;
         }
-        else if ( rProp[i].Name == ITEM_DESCRIPTOR_STYLE )
+        else if ( rEntry.Name == ITEM_DESCRIPTOR_STYLE )
         {
-            rProp[i].Value >>= rStyle;
+            rEntry.Value >>= rStyle;
         }
-        else if ( rProp[i].Name == ITEM_DESCRIPTOR_WIDTH )
+        else if ( rEntry.Name == ITEM_DESCRIPTOR_WIDTH )
         {
-            rProp[i].Value >>= rWidth;
+            rEntry.Value >>= rWidth;
         }
     }
 }
diff --git a/framework/source/fwe/xml/toolboxdocumenthandler.cxx b/framework/source/fwe/xml/toolboxdocumenthandler.cxx
index 1027d18af4b8..ea5facd7247d 100644
--- a/framework/source/fwe/xml/toolboxdocumenthandler.cxx
+++ b/framework/source/fwe/xml/toolboxdocumenthandler.cxx
@@ -63,21 +63,21 @@ static void ExtractToolbarParameters( const Sequence< PropertyValue >& rProp,
                                       bool&                            rVisible,
                                       sal_Int16&                       rType )
 {
-    for ( sal_Int32 i = 0; i < rProp.getLength(); i++ )
+    for ( const PropertyValue& rEntry : rProp )
     {
-        if ( rProp[i].Name == ITEM_DESCRIPTOR_COMMANDURL )
+        if ( rEntry.Name == ITEM_DESCRIPTOR_COMMANDURL )
         {
-            rProp[i].Value >>= rCommandURL;
+            rEntry.Value >>= rCommandURL;
             rCommandURL = rCommandURL.intern();
         }
-        else if ( rProp[i].Name == ITEM_DESCRIPTOR_LABEL )
-            rProp[i].Value >>= rLabel;
-        else if ( rProp[i].Name == ITEM_DESCRIPTOR_TYPE )
-            rProp[i].Value >>= rType;
-        else if ( rProp[i].Name == ITEM_DESCRIPTOR_VISIBLE )
-            rProp[i].Value >>= rVisible;
-        else if ( rProp[i].Name == ITEM_DESCRIPTOR_STYLE )
-            rProp[i].Value >>= rStyle;
+        else if ( rEntry.Name == ITEM_DESCRIPTOR_LABEL )
+            rEntry.Value >>= rLabel;
+        else if ( rEntry.Name == ITEM_DESCRIPTOR_TYPE )
+            rEntry.Value >>= rType;
+        else if ( rEntry.Name == ITEM_DESCRIPTOR_VISIBLE )
+            rEntry.Value >>= rVisible;
+        else if ( rEntry.Name == ITEM_DESCRIPTOR_STYLE )
+            rEntry.Value >>= rStyle;
     }
 }
 
diff --git a/framework/source/fwi/helper/mischelper.cxx b/framework/source/fwi/helper/mischelper.cxx
index 75e560e7a975..b53cd0f2672d 100644
--- a/framework/source/fwi/helper/mischelper.cxx
+++ b/framework/source/fwi/helper/mischelper.cxx
@@ -122,17 +122,13 @@ void FillLangItems( std::set< OUString > &rLangItems,
     if ( !xDocumentLanguages.is() )
         return;
 
-    Sequence< Locale > rLocales( xDocumentLanguages->getDocumentLanguages( static_cast<sal_Int16>(nScriptType), nMaxCount ));
-    if ( rLocales.hasElements() )
+    const Sequence< Locale > rLocales( xDocumentLanguages->getDocumentLanguages( static_cast<sal_Int16>(nScriptType), nMaxCount ));
+    for ( const Locale& rLocale : rLocales )
     {
-        for ( sal_Int32 i = 0; i < rLocales.getLength(); ++i )
-        {
-            if ( rLangItems.size() == static_cast< size_t >(nMaxCount) )
-                break;
-            const Locale& rLocale=rLocales[i];
-            if( IsScriptTypeMatchingToLanguage( nScriptType, SvtLanguageTable::GetLanguageType( rLocale.Language )))
-                rLangItems.insert( rLocale.Language );
-        }
+        if ( rLangItems.size() == static_cast< size_t >(nMaxCount) )
+            break;
+        if( IsScriptTypeMatchingToLanguage( nScriptType, SvtLanguageTable::GetLanguageType( rLocale.Language )))
+            rLangItems.insert( rLocale.Language );
     }
 }
 
diff --git a/framework/source/helper/uiconfigelementwrapperbase.cxx b/framework/source/helper/uiconfigelementwrapperbase.cxx
index 0ba8470628c3..b0138d04a77c 100644
--- a/framework/source/helper/uiconfigelementwrapperbase.cxx
+++ b/framework/source/helper/uiconfigelementwrapperbase.cxx
@@ -114,10 +114,10 @@ void SAL_CALL UIConfigElementWrapperBase::initialize( const Sequence< Any >& aAr
     if ( m_bInitialized )
         return;
 
-    for ( sal_Int32 n = 0; n < aArguments.getLength(); n++ )
+    for ( const Any& rArg : aArguments )
     {
         PropertyValue aPropValue;
-        if ( aArguments[n] >>= aPropValue )
+        if ( rArg >>= aPropValue )
         {
             if ( aPropValue.Name == UIELEMENT_PROPNAME_CONFIGSOURCE )
                 setFastPropertyValue_NoBroadcast( UIELEMENT_PROPHANDLE_CONFIGSOURCE, aPropValue.Value );
diff --git a/framework/source/helper/uielementwrapperbase.cxx b/framework/source/helper/uielementwrapperbase.cxx
index d02e8954c2cf..76cf234ff94f 100644
--- a/framework/source/helper/uielementwrapperbase.cxx
+++ b/framework/source/helper/uielementwrapperbase.cxx
@@ -86,10 +86,10 @@ void SAL_CALL UIElementWrapperBase::initialize( const Sequence< Any >& aArgument
     if ( m_bInitialized )
         return;
 
-    for ( sal_Int32 n = 0; n < aArguments.getLength(); n++ )
+    for ( const Any& rArg : aArguments )
     {
         PropertyValue aPropValue;
-        if ( aArguments[n] >>= aPropValue )
+        if ( rArg >>= aPropValue )
         {
             if ( aPropValue.Name == "ResourceURL" )
                 aPropValue.Value >>= m_aResourceURL;
diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx
index e63466746b44..e11371f1f27b 100644
--- a/framework/source/layoutmanager/layoutmanager.cxx
+++ b/framework/source/layoutmanager/layoutmanager.cxx
@@ -534,28 +534,28 @@ bool LayoutManager::readWindowStateData( const OUString& aName, UIElement& rElem
             if ( rPersistentWindowState->hasByName( aName ) && (rPersistentWindowState->getByName( aName ) >>= aWindowState) )
             {
                 bool bValue( false );
-                for ( sal_Int32 n = 0; n < aWindowState.getLength(); n++ )
+                for ( PropertyValue const & rProp : std::as_const(aWindowState) )
                 {
-                    if ( aWindowState[n].Name == WINDOWSTATE_PROPERTY_DOCKED )
+                    if ( rProp.Name == WINDOWSTATE_PROPERTY_DOCKED )
                     {
-                        if ( aWindowState[n].Value >>= bValue )
+                        if ( rProp.Value >>= bValue )
                             rElementData.m_bFloating = !bValue;
                     }
-                    else if ( aWindowState[n].Name == WINDOWSTATE_PROPERTY_VISIBLE )
+                    else if ( rProp.Name == WINDOWSTATE_PROPERTY_VISIBLE )
                     {
-                        if ( aWindowState[n].Value >>= bValue )
+                        if ( rProp.Value >>= bValue )
                             rElementData.m_bVisible = bValue;
                     }
-                    else if ( aWindowState[n].Name == WINDOWSTATE_PROPERTY_DOCKINGAREA )
+                    else if ( rProp.Name == WINDOWSTATE_PROPERTY_DOCKINGAREA )
                     {
                         ui::DockingArea eDockingArea;
-                        if ( aWindowState[n].Value >>= eDockingArea )
+                        if ( rProp.Value >>= eDockingArea )
                             rElementData.m_aDockedData.m_nDockedArea = eDockingArea;
                     }
-                    else if ( aWindowState[n].Name == WINDOWSTATE_PROPERTY_DOCKPOS )
+                    else if ( rProp.Name == WINDOWSTATE_PROPERTY_DOCKPOS )
                     {
                         awt::Point aPoint;
-                        if (aWindowState[n].Value >>= aPoint)
+                        if (rProp.Value >>= aPoint)
                         {
                             //tdf#90256 repair these broken Docking positions
                             if (aPoint.X < 0)
@@ -565,39 +565,39 @@ bool LayoutManager::readWindowStateData( const OUString& aName, UIElement& rElem
                             rElementData.m_aDockedData.m_aPos = aPoint;
                         }
                     }
-                    else if ( aWindowState[n].Name == WINDOWSTATE_PROPERTY_POS )
+                    else if ( rProp.Name == WINDOWSTATE_PROPERTY_POS )
                     {
                         awt::Point aPoint;
-                        if ( aWindowState[n].Value >>= aPoint )
+                        if ( rProp.Value >>= aPoint )
                             rElementData.m_aFloatingData.m_aPos = aPoint;
                     }
-                    else if ( aWindowState[n].Name == WINDOWSTATE_PROPERTY_SIZE )
+                    else if ( rProp.Name == WINDOWSTATE_PROPERTY_SIZE )
                     {
                         awt::Size aSize;
-                        if ( aWindowState[n].Value >>= aSize )
+                        if ( rProp.Value >>= aSize )
                             rElementData.m_aFloatingData.m_aSize = aSize;
                     }
-                    else if ( aWindowState[n].Name == WINDOWSTATE_PROPERTY_UINAME )
-                        aWindowState[n].Value >>= rElementData.m_aUIName;
-                    else if ( aWindowState[n].Name == WINDOWSTATE_PROPERTY_STYLE )
+                    else if ( rProp.Name == WINDOWSTATE_PROPERTY_UINAME )
+                        rProp.Value >>= rElementData.m_aUIName;
+                    else if ( rProp.Name == WINDOWSTATE_PROPERTY_STYLE )
                     {
                         sal_Int32 nStyle = 0;
-                        if ( aWindowState[n].Value >>= nStyle )
+                        if ( rProp.Value >>= nStyle )
                             rElementData.m_nStyle = static_cast<ButtonType>( nStyle );
                     }
-                    else if ( aWindowState[n].Name == WINDOWSTATE_PROPERTY_LOCKED )
+                    else if ( rProp.Name == WINDOWSTATE_PROPERTY_LOCKED )
                     {
-                        if ( aWindowState[n].Value >>= bValue )
+                        if ( rProp.Value >>= bValue )
                             rElementData.m_aDockedData.m_bLocked = bValue;
                     }
-                    else if ( aWindowState[n].Name == WINDOWSTATE_PROPERTY_CONTEXT )
+                    else if ( rProp.Name == WINDOWSTATE_PROPERTY_CONTEXT )
                     {
-                        if ( aWindowState[n].Value >>= bValue )
+                        if ( rProp.Value >>= bValue )
                             rElementData.m_bContextSensitive = bValue;
                     }
-                    else if ( aWindowState[n].Name == WINDOWSTATE_PROPERTY_NOCLOSE )
+                    else if ( rProp.Name == WINDOWSTATE_PROPERTY_NOCLOSE )
                     {
-                        if ( aWindowState[n].Value >>= bValue )
+                        if ( rProp.Value >>= bValue )
                             rElementData.m_bNoClose = bValue;
                     }
                 }
@@ -2519,11 +2519,11 @@ void LayoutManager::implts_createMSCompatibleMenuBar( const OUString& aName )
         uno::Sequence< beans::PropertyValue > aProps;
         xMenuIndex->getByIndex( nIndex ) >>= aProps;
         OUString aCommand;
-        for (sal_Int32 nSeqInd = 0; nSeqInd < aProps.getLength(); ++nSeqInd)
+        for ( beans::PropertyValue const & rProp : std::as_const(aProps) )
         {
-            if (aProps[nSeqInd].Name == "CommandURL")
+            if (rProp.Name == "CommandURL")
             {
-                aProps[nSeqInd].Value >>= aCommand;
+                rProp.Value >>= aCommand;
                 break;
             }
         }
diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
index b5418af17d96..17d2be8ca2ab 100644
--- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx
+++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
@@ -1224,22 +1224,19 @@ void ToolbarLayoutManager::implts_createNonContextSensitiveToolBars()
 
     try
     {
-        uno::Sequence< OUString > aToolbarNames = xPersistentWindowState->getElementNames();
+        const uno::Sequence< OUString > aToolbarNames = xPersistentWindowState->getElementNames();
 
         if ( aToolbarNames.hasElements() )
         {
             OUString aElementType;
             OUString aElementName;
-            OUString aName;
 
             aMakeVisibleToolbars.reserve(aToolbarNames.getLength());
 
             SolarMutexGuard g;
 
-            const OUString* pTbNames = aToolbarNames.getConstArray();
-            for ( sal_Int32 i = 0; i < aToolbarNames.getLength(); i++ )
+            for ( OUString const & aName : aToolbarNames )
             {
-                aName = pTbNames[i];
                 parseResourceURL( aName, aElementType, aElementName );
 
                 // Check that we only create:
@@ -1279,18 +1276,16 @@ void ToolbarLayoutManager::implts_createNonContextSensitiveToolBars()
 
 void ToolbarLayoutManager::implts_createCustomToolBars( const uno::Sequence< uno::Sequence< beans::PropertyValue > >& aTbxSeqSeq )
 {
-    const uno::Sequence< beans::PropertyValue >* pTbxSeq = aTbxSeqSeq.getConstArray();
-    for ( sal_Int32 i = 0; i < aTbxSeqSeq.getLength(); i++ )
+    for ( const uno::Sequence< beans::PropertyValue >& rTbxSeq : aTbxSeqSeq )
     {
-        const uno::Sequence< beans::PropertyValue >& rTbxSeq = pTbxSeq[i];
         OUString aTbxResName;
         OUString aTbxTitle;
-        for ( sal_Int32 j = 0; j < rTbxSeq.getLength(); j++ )
+        for ( const beans::PropertyValue& rProp : rTbxSeq )
         {
-            if ( rTbxSeq[j].Name == "ResourceURL" )
-                rTbxSeq[j].Value >>= aTbxResName;
-            else if ( rTbxSeq[j].Name == "UIName" )
-                rTbxSeq[j].Value >>= aTbxTitle;
+            if ( rProp.Name == "ResourceURL" )
+                rProp.Value >>= aTbxResName;
+            else if ( rProp.Name == "UIName" )
+                rProp.Value >>= aTbxTitle;
         }
 
         // Only create custom toolbars. Their name have to start with "custom_"!
@@ -3138,10 +3133,10 @@ void ToolbarLayoutManager::implts_renumberRowColumnData(
 
     try
     {
-        uno::Sequence< OUString > aWindowElements = xPersistentWindowState->getElementNames();
-        for ( sal_Int32 i = 0; i < aWindowElements.getLength(); i++ )
+        const uno::Sequence< OUString > aWindowElements = xPersistentWindowState->getElementNames();
+        for ( OUString const & rWindowElementName : aWindowElements )
         {
-            if ( rUIElement.m_aName != aWindowElements[i] )
+            if ( rUIElement.m_aName != rWindowElementName )
             {
                 try
                 {
@@ -3149,13 +3144,13 @@ void ToolbarLayoutManager::implts_renumberRowColumnData(
                     awt::Point                            aDockedPos;
                     ui::DockingArea                       nDockedArea( ui::DockingArea_DOCKINGAREA_DEFAULT );
 
-                    xPersistentWindowState->getByName( aWindowElements[i] ) >>= aPropValueSeq;
-                    for ( sal_Int32 j = 0; j < aPropValueSeq.getLength(); j++ )
+                    xPersistentWindowState->getByName( rWindowElementName ) >>= aPropValueSeq;
+                    for ( beans::PropertyValue const & rProp : std::as_const(aPropValueSeq) )
                     {
-                        if ( aPropValueSeq[j].Name == WINDOWSTATE_PROPERTY_DOCKINGAREA )
-                            aPropValueSeq[j].Value >>= nDockedArea;
-                        else if ( aPropValueSeq[j].Name == WINDOWSTATE_PROPERTY_DOCKPOS )
-                            aPropValueSeq[j].Value >>= aDockedPos;
+                        if ( rProp.Name == WINDOWSTATE_PROPERTY_DOCKINGAREA )
+                            rProp.Value >>= nDockedArea;
+                        else if ( rProp.Name == WINDOWSTATE_PROPERTY_DOCKPOS )
+                            rProp.Value >>= aDockedPos;
                     }
 
                     // Don't change toolbars without a valid docking position!
@@ -3171,7 +3166,7 @@ void ToolbarLayoutManager::implts_renumberRowColumnData(
                             aDockedPos.X += 1;
 
                         uno::Reference< container::XNameReplace > xReplace( xPersistentWindowState, uno::UNO_QUERY );
-                        xReplace->replaceByName( aWindowElements[i], makeAny( aPropValueSeq ));
+                        xReplace->replaceByName( rWindowElementName, makeAny( aPropValueSeq ));
                     }
                 }
                 catch (const uno::Exception&)
diff --git a/framework/source/services/modulemanager.cxx b/framework/source/services/modulemanager.cxx
index 96d400bb5ecc..5c066d034d74 100644
--- a/framework/source/services/modulemanager.cxx
+++ b/framework/source/services/modulemanager.cxx
@@ -256,9 +256,8 @@ css::uno::Any SAL_CALL ModuleManager::getByName(const OUString& sName)
     comphelper::SequenceAsHashMap lProps;
 
     lProps[OUString("ooSetupFactoryModuleIdentifier")] <<= sName;
-    for (sal_Int32 i = 0; i < lPropNames.getLength(); ++i)
+    for (const OUString& sPropName : lPropNames)
     {
-        const OUString& sPropName = lPropNames[i];
         lProps[sPropName] = xModule->getByName(sPropName);
     }
 
@@ -296,11 +295,11 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL ModuleManager::crea
     const css::uno::Sequence< OUString > lModules = getElementNames();
     ::std::vector< css::uno::Any > lResult;
 
-    for (sal_Int32 i = 0; i < lModules.getLength(); ++i)
+    for (const OUString& rModuleName : lModules)
     {
         try
         {
-            ::comphelper::SequenceAsHashMap lModuleProps = getByName(lModules[i]);
+            ::comphelper::SequenceAsHashMap lModuleProps = getByName(rModuleName);
             if (lModuleProps.match(lSearchProps))
                 lResult.push_back(css::uno::makeAny(lModuleProps.getAsConstPropertyValueList()));
         }
@@ -331,10 +330,10 @@ OUString ModuleManager::implts_identify(const css::uno::Reference< css::uno::XIn
         return OUString();
 
     const css::uno::Sequence< OUString > lKnownModules = getElementNames();
-    for (sal_Int32 i = 0; i < lKnownModules.getLength(); ++i)
+    for (const OUString& rName : lKnownModules)
     {
-        if (xInfo->supportsService(lKnownModules[i]))
-            return lKnownModules[i];
+        if (xInfo->supportsService(rName))
+            return rName;
     }
 
     return OUString();
diff --git a/framework/source/services/sessionlistener.cxx b/framework/source/services/sessionlistener.cxx
index 0bf1665ae2ed..b0c7e70eb725 100644
--- a/framework/source/services/sessionlistener.cxx
+++ b/framework/source/services/sessionlistener.cxx
@@ -233,9 +233,9 @@ void SAL_CALL SessionListener::initialize(const Sequence< Any  >& args)
     else if (args.hasElements())
     {
         NamedValue v;
-        for (int i = 0; i < args.getLength(); i++)
+        for (const Any& rArg : args)
         {
-            if (args[i] >>= v)
+            if (rArg >>= v)
             {
                 if ( v.Name == "SessionManagerName" )
                     v.Value >>= aSMgr;
diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx b/framework/source/uiconfiguration/imagemanagerimpl.cxx
index 67c38860164b..be00e8bd5a6b 100644
--- a/framework/source/uiconfiguration/imagemanagerimpl.cxx
+++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx
@@ -562,10 +562,10 @@ void ImageManagerImpl::initialize( const Sequence< Any >& aArguments )
     if ( m_bInitialized )
         return;
 
-    for ( sal_Int32 n = 0; n < aArguments.getLength(); n++ )
+    for ( const Any& rArg : aArguments )
     {
         PropertyValue aPropValue;
-        if ( aArguments[n] >>= aPropValue )
+        if ( rArg >>= aPropValue )
         {
             if ( aPropValue.Name == "UserConfigStorage" )
             {
@@ -716,8 +716,6 @@ Sequence< uno::Reference< XGraphic > > ImageManagerImpl::getImages(
 
     Sequence< uno::Reference< XGraphic > > aGraphSeq( aCommandURLSequence.getLength() );
 
-    const OUString* aStrArray = aCommandURLSequence.getConstArray();
-
     vcl::ImageType                    nIndex            = implts_convertImageTypeToIndex( nImageType );
     rtl::Reference< GlobalImageList > rGlobalImageList;
     CmdImageList*                     pDefaultImageList = nullptr;
@@ -732,17 +730,18 @@ Sequence< uno::Reference< XGraphic > > ImageManagerImpl::getImages(
     // 1. user image list (read/write)
     // 2. module image list (read)
     // 3. global image list (read)
-    for ( sal_Int32 n = 0; n < aCommandURLSequence.getLength(); n++ )
+    sal_Int32 n = 0;
+    for ( const OUString& rURL : aCommandURLSequence )
     {
-        Image aImage = pUserImageList->GetImage( aStrArray[n] );
+        Image aImage = pUserImageList->GetImage( rURL );
         if ( !aImage && m_bUseGlobal )
         {
-            aImage = pDefaultImageList->getImageFromCommandURL( nIndex, aStrArray[n] );
+            aImage = pDefaultImageList->getImageFromCommandURL( nIndex, rURL );
             if ( !aImage )
-                aImage = rGlobalImageList->getImageFromCommandURL( nIndex, aStrArray[n] );
+                aImage = rGlobalImageList->getImageFromCommandURL( nIndex, rURL );
         }
 
-        aGraphSeq[n] = GetXGraphic(aImage);
+        aGraphSeq[n++] = GetXGraphic(aImage);
     }
 
     return aGraphSeq;
@@ -860,9 +859,9 @@ void ImageManagerImpl::removeImages( ::sal_Int16 nImageType, const Sequence< OUS
         ImageList*                        pImageList        = implts_getUserImageList(nIndex);
         uno::Reference<XGraphic> xEmptyGraphic;
 
-        for ( sal_Int32 i = 0; i < aCommandURLSequence.getLength(); i++ )
+        for ( const OUString& rURL : aCommandURLSequence )
         {
-            sal_uInt16 nPos = pImageList->GetImagePos( aCommandURLSequence[i] );
+            sal_uInt16 nPos = pImageList->GetImagePos( rURL );
             if ( nPos != IMAGELIST_IMAGE_NOTFOUND )
             {
                 sal_uInt16 nId   = pImageList->GetImageId( nPos );
@@ -872,27 +871,27 @@ void ImageManagerImpl::removeImages( ::sal_Int16 nImageType, const Sequence< OUS
                 {
                     // Check, if we have an image in our module/global image list. If we find one =>
                     // this is a replace instead of a remove operation!
-                    Image aNewImage = pDefaultImageList->getImageFromCommandURL( nIndex, aCommandURLSequence[i] );
+                    Image aNewImage = pDefaultImageList->getImageFromCommandURL( nIndex, rURL );
                     if ( !aNewImage )
-                        aNewImage = rGlobalImageList->getImageFromCommandURL( nIndex, aCommandURLSequence[i] );
+                        aNewImage = rGlobalImageList->getImageFromCommandURL( nIndex, rURL );
                     if ( !aNewImage )
                     {
                         if ( !pRemovedImages )
                             pRemovedImages = new GraphicNameAccess();
-                        pRemovedImages->addElement( aCommandURLSequence[i], xEmptyGraphic );
+                        pRemovedImages->addElement( rURL, xEmptyGraphic );
                     }
                     else
                     {
                         if ( !pReplacedImages )
                             pReplacedImages = new GraphicNameAccess();
-                        pReplacedImages->addElement(aCommandURLSequence[i], GetXGraphic(aNewImage));
+                        pReplacedImages->addElement(rURL, GetXGraphic(aNewImage));
                     }
                 } // if ( m_bUseGlobal )
                 else
                 {
                     if ( !pRemovedImages )
                         pRemovedImages = new GraphicNameAccess();
-                    pRemovedImages->addElement( aCommandURLSequence[i], xEmptyGraphic );
+                    pRemovedImages->addElement( rURL, xEmptyGraphic );
                 }
             }
         }
diff --git a/framework/source/uiconfiguration/moduleuicfgsupplier.cxx b/framework/source/uiconfiguration/moduleuicfgsupplier.cxx
index 5f29f804d8ec..31d61d8d0ad5 100644
--- a/framework/source/uiconfiguration/moduleuicfgsupplier.cxx
+++ b/framework/source/uiconfiguration/moduleuicfgsupplier.cxx
@@ -101,9 +101,8 @@ ModuleUIConfigurationManagerSupplier::ModuleUIConfigurationManagerSupplier( cons
         // Retrieve known modules and insert them into our unordered_map to speed-up access time.
         Reference< XNameAccess > xNameAccess( m_xModuleMgr, UNO_QUERY_THROW );
         const Sequence< OUString >     aNameSeq   = xNameAccess->getElementNames();
-        const OUString*                pNameSeq   = aNameSeq.getConstArray();
-        for ( sal_Int32 n = 0; n < aNameSeq.getLength(); n++ )
-            m_aModuleToModuleUICfgMgrMap.emplace( pNameSeq[n], Reference< XModuleUIConfigurationManager2 >() );
+        for ( const OUString& rName : aNameSeq )
+            m_aModuleToModuleUICfgMgrMap.emplace( rName, Reference< XModuleUIConfigurationManager2 >() );
     }
     catch(...)
     {
@@ -149,11 +148,11 @@ Reference< XUIConfigurationManager > SAL_CALL ModuleUIConfigurationManagerSuppli
         {
             Sequence< PropertyValue > lProps;
             m_xModuleMgr->getByName(sModuleIdentifier) >>= lProps;
-            for (sal_Int32 i=0; i<lProps.getLength(); ++i)
+            for (PropertyValue const & rProp : std::as_const(lProps))
             {
-                if ( lProps[i].Name == "ooSetupFactoryShortName" )
+                if ( rProp.Name == "ooSetupFactoryShortName" )
                 {
-                    lProps[i].Value >>= sShort;
+                    rProp.Value >>= sShort;
                     break;
                 }
             }
diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
index 1b9926d7f7eb..793d8ed18f4c 100644
--- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
@@ -361,23 +361,23 @@ void ModuleUIConfigurationManager::impl_preloadUIElementTypeList( Layer eLayer,
         "/";
 
     UIElementDataHashMap& rHashMap = rElementTypeData.aElementsHashMap;
-    Sequence< OUString > aUIElementNames = xElementTypeStorage->getElementNames();
-    for ( sal_Int32 n = 0; n < aUIElementNames.getLength(); n++ )
+    const Sequence< OUString > aUIElementNames = xElementTypeStorage->getElementNames();
+    for ( OUString const & rElementName : aUIElementNames )
     {
         UIElementData aUIElementData;
 
         // Resource name must be without ".xml"
-        sal_Int32 nIndex = aUIElementNames[n].lastIndexOf( '.' );
-        if (( nIndex > 0 ) && ( nIndex < aUIElementNames[n].getLength() ))
+        sal_Int32 nIndex = rElementName.lastIndexOf( '.' );
+        if (( nIndex > 0 ) && ( nIndex < rElementName.getLength() ))
         {
-            OUString aExtension( aUIElementNames[n].copy( nIndex+1 ));
-            OUString aUIElementName( aUIElementNames[n].copy( 0, nIndex ));
+            OUString aExtension( rElementName.copy( nIndex+1 ));
+            OUString aUIElementName( rElementName.copy( 0, nIndex ));
 
             if (!aUIElementName.isEmpty() &&
                 ( aExtension.equalsIgnoreAsciiCase("xml")))
             {
                 aUIElementData.aResourceURL = aResURLPrefix + aUIElementName;
-                aUIElementData.aName        = aUIElementNames[n];
+                aUIElementData.aName        = rElementName;
 
                 if ( eLayer == LAYER_USERDEFINED )
                 {
@@ -982,10 +982,10 @@ void SAL_CALL ModuleUIConfigurationManager::reset()
             if ( rElementType.xStorage.is() )
             {
                 bool bCommitSubStorage( false );
-                Sequence< OUString > aUIElementStreamNames = rElementType.xStorage->getElementNames();
-                for ( sal_Int32 j = 0; j < aUIElementStreamNames.getLength(); j++ )
+                const Sequence< OUString > aUIElementStreamNames = rElementType.xStorage->getElementNames();
+                for ( OUString const & rName : aUIElementStreamNames )
                 {
-                    rElementType.xStorage->removeElement( aUIElementStreamNames[j] );
+                    rElementType.xStorage->removeElement( rName );
                     bCommitSubStorage = true;
                 }
 
diff --git a/framework/source/uiconfiguration/uicategorydescription.cxx b/framework/source/uiconfiguration/uicategorydescription.cxx
index 2c27f0403914..517a8d47f5b4 100644
--- a/framework/source/uiconfiguration/uicategorydescription.cxx
+++ b/framework/source/uiconfiguration/uicategorydescription.cxx
@@ -164,20 +164,19 @@ void ConfigurationAccess_UICategory::fillCache()
     if ( m_bCacheFilled )
         return;
 
-    sal_Int32            i( 0 );
     OUString        aUIName;
-    Sequence< OUString > aNameSeq = m_xConfigAccess->getElementNames();
+    const Sequence< OUString > aNameSeq = m_xConfigAccess->getElementNames();
 
-    for ( i = 0; i < aNameSeq.getLength(); i++ )
+    for ( OUString const & rName : aNameSeq )
     {
         try
         {
-            Reference< XNameAccess > xNameAccess(m_xConfigAccess->getByName( aNameSeq[i] ),UNO_QUERY);
+            Reference< XNameAccess > xNameAccess(m_xConfigAccess->getByName( rName ),UNO_QUERY);
             if ( xNameAccess.is() )
             {
                 xNameAccess->getByName( m_aPropUIName ) >>= aUIName;
 
-                m_aIdCache.emplace( aNameSeq[i], aUIName );
+                m_aIdCache.emplace( rName, aUIName );
             }
         }
         catch ( const css::lang::WrappedTargetException& )
diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx b/framework/source/uiconfiguration/uiconfigurationmanager.cxx
index 5ec6a167131e..be337b580987 100644
--- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx
@@ -287,23 +287,23 @@ void UIConfigurationManager::impl_preloadUIElementTypeList( sal_Int16 nElementTy
                 "/";
 
             UIElementDataHashMap& rHashMap = rElementTypeData.aElementsHashMap;
-            Sequence< OUString > aUIElementNames = xElementTypeStorage->getElementNames();
-            for ( sal_Int32 n = 0; n < aUIElementNames.getLength(); n++ )
+            const Sequence< OUString > aUIElementNames = xElementTypeStorage->getElementNames();
+            for ( OUString const & rElementName : aUIElementNames )
             {
                 UIElementData aUIElementData;
 
                 // Resource name must be without ".xml"
-                sal_Int32 nIndex = aUIElementNames[n].lastIndexOf( '.' );
-                if (( nIndex > 0 ) && ( nIndex < aUIElementNames[n].getLength() ))
+                sal_Int32 nIndex = rElementName.lastIndexOf( '.' );
+                if (( nIndex > 0 ) && ( nIndex < rElementName.getLength() ))
                 {
-                    OUString aExtension( aUIElementNames[n].copy( nIndex+1 ));
-                    OUString aUIElementName( aUIElementNames[n].copy( 0, nIndex ));
+                    OUString aExtension( rElementName.copy( nIndex+1 ));
+                    OUString aUIElementName( rElementName.copy( 0, nIndex ));
 
                     if (!aUIElementName.isEmpty() &&
                         ( aExtension.equalsIgnoreAsciiCase("xml")))
                     {
                         aUIElementData.aResourceURL = aResURLPrefix + aUIElementName;
-                        aUIElementData.aName        = aUIElementNames[n];
+                        aUIElementData.aName        = rElementName;
                         aUIElementData.bModified    = false;
                         aUIElementData.bDefault     = false;
 
@@ -769,10 +769,10 @@ void SAL_CALL UIConfigurationManager::reset()
             if ( rElementType.xStorage.is() )
             {
                 bool bCommitSubStorage( false );
-                Sequence< OUString > aUIElementStreamNames = rElementType.xStorage->getElementNames();
-                for ( sal_Int32 j = 0; j < aUIElementStreamNames.getLength(); j++ )
+                const Sequence< OUString > aUIElementStreamNames = rElementType.xStorage->getElementNames();
+                for ( OUString const & rStreamName : aUIElementStreamNames )
                 {
-                    rElementType.xStorage->removeElement( aUIElementStreamNames[j] );
+                    rElementType.xStorage->removeElement( rStreamName );
                     bCommitSubStorage = true;
                     bCommit = true;
                 }
diff --git a/framework/source/uiconfiguration/windowstateconfiguration.cxx b/framework/source/uiconfiguration/windowstateconfiguration.cxx
index 536f4b2d048f..f44b5cf1305b 100644
--- a/framework/source/uiconfiguration/windowstateconfiguration.cxx
+++ b/framework/source/uiconfiguration/windowstateconfiguration.cxx
@@ -1289,19 +1289,17 @@ WindowStateConfiguration::WindowStateConfiguration( const Reference< XComponentC
     {
     }
     Sequence< PropertyValue > aSeq;
-    OUString                  aModuleIdentifier;
 
-    for ( sal_Int32 i = 0; i < aElementNames.getLength(); i++ )
+    for ( OUString const & aModuleIdentifier : std::as_const(aElementNames) )
     {
-        aModuleIdentifier = aElementNames[i];
         if ( xModuleManager->getByName( aModuleIdentifier ) >>= aSeq )
         {
             OUString aWindowStateFileStr;
-            for ( sal_Int32 y = 0; y < aSeq.getLength(); y++ )
+            for ( PropertyValue const & rProp : std::as_const(aSeq) )
             {
-                if ( aSeq[y].Name == "ooSetupFactoryWindowStateConfigRef" )
+                if ( rProp.Name == "ooSetupFactoryWindowStateConfigRef" )
                 {
-                    aSeq[y].Value >>= aWindowStateFileStr;
+                    rProp.Value >>= aWindowStateFileStr;
                     break;
                 }
             }
diff --git a/framework/source/uielement/FixedTextToolbarController.cxx b/framework/source/uielement/FixedTextToolbarController.cxx
index 374ad33798aa..531c0f8b64a5 100644
--- a/framework/source/uielement/FixedTextToolbarController.cxx
+++ b/framework/source/uielement/FixedTextToolbarController.cxx
@@ -73,12 +73,12 @@ void FixedTextToolbarController::executeControlCommand(
     if (rControlCommand.Command != "SetText")
         return;
 
-    for (sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++)
+    for (const NamedValue& rArg : rControlCommand.Arguments)
     {
-        if (rControlCommand.Arguments[i].Name == "Text")
+        if (rArg.Name == "Text")
         {
             OUString aText;
-            rControlCommand.Arguments[i].Value >>= aText;
+            rArg.Value >>= aText;
             m_pFixedTextControl->SetText(aText);
             m_pFixedTextControl->SetSizePixel(m_pFixedTextControl->GetOptimalSize());
 
diff --git a/framework/source/uielement/addonstoolbarmanager.cxx b/framework/source/uielement/addonstoolbarmanager.cxx
index 3fc54f1ad00c..e2d61259943f 100644
--- a/framework/source/uielement/addonstoolbarmanager.cxx
+++ b/framework/source/uielement/addonstoolbarmanager.cxx
@@ -200,7 +200,7 @@ void AddonsToolBarManager::FillToolbar( const Sequence< Sequence< PropertyValue
     sal_uInt32  nElements( 0 );
     bool    bAppendSeparator( false );
     Reference< XWindow > xToolbarWindow = VCLUnoHelper::GetInterface( m_pToolBar );
-    for ( sal_uInt32 n = 0; n < o3tl::make_unsigned(rAddonToolbar.getLength()); n++ )
+    for ( const Sequence< PropertyValue >& rSeq : rAddonToolbar )
     {
         OUString   aURL;
         OUString   aTitle;
@@ -210,8 +210,6 @@ void AddonsToolBarManager::FillToolbar( const Sequence< Sequence< PropertyValue
         OUString   aControlType;
         sal_uInt16 nWidth( 0 );
 
-        const Sequence< PropertyValue >& rSeq = rAddonToolbar[n];
-
         ToolBarMerger::ConvertSequenceToValues( rSeq, aURL, aTitle, aImageId, aTarget, aContext, aControlType, nWidth );
 
         if ( IsCorrectContext( aModuleIdentifier, aContext ))
diff --git a/framework/source/uielement/addonstoolbarwrapper.cxx b/framework/source/uielement/addonstoolbarwrapper.cxx
index 025b57904ff1..5d08fb5c7224 100644
--- a/framework/source/uielement/addonstoolbarwrapper.cxx
+++ b/framework/source/uielement/addonstoolbarwrapper.cxx
@@ -81,10 +81,10 @@ void SAL_CALL AddonsToolBarWrapper::initialize( const Sequence< Any >& aArgument
 
     UIElementWrapperBase::initialize( aArguments );
 
-    for ( sal_Int32 n = 0; n < aArguments.getLength(); n++ )
+    for ( const Any& rArg : aArguments )
     {
         PropertyValue aPropValue;
-        if ( aArguments[n] >>= aPropValue )
+        if ( rArg >>= aPropValue )
         {
             if ( aPropValue.Name == "ConfigurationData" )
                 aPropValue.Value >>= m_aConfigData;
diff --git a/framework/source/uielement/buttontoolbarcontroller.cxx b/framework/source/uielement/buttontoolbarcontroller.cxx
index c13d645f57f0..6c5c3fdeb88c 100644
--- a/framework/source/uielement/buttontoolbarcontroller.cxx
+++ b/framework/source/uielement/buttontoolbarcontroller.cxx
@@ -107,9 +107,9 @@ void SAL_CALL ButtonToolbarController::initialize(
     m_bInitialized = true;
 
     PropertyValue aPropValue;
-    for ( int i = 0; i < aArguments.getLength(); i++ )
+    for ( const css::uno::Any& rArg : aArguments )
     {
-        if ( aArguments[i] >>= aPropValue )
+        if ( rArg >>= aPropValue )
         {
             if ( aPropValue.Name == "Frame" )
                 m_xFrame.set(aPropValue.Value,UNO_QUERY);
diff --git a/framework/source/uielement/comboboxtoolbarcontroller.cxx b/framework/source/uielement/comboboxtoolbarcontroller.cxx
index 352fe7bd0833..1fc8d1e89c5e 100644
--- a/framework/source/uielement/comboboxtoolbarcontroller.cxx
+++ b/framework/source/uielement/comboboxtoolbarcontroller.cxx
@@ -215,12 +215,12 @@ void ComboboxToolbarController::executeControlCommand( const css::frame::Control
 {
     if ( rControlCommand.Command == "SetText" )
     {
-        for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ )
+        for ( const NamedValue& rArg : rControlCommand.Arguments )
         {
-            if ( rControlCommand.Arguments[i].Name == "Text" )
+            if ( rArg.Name == "Text" )
             {
                 OUString aText;
-                rControlCommand.Arguments[i].Value >>= aText;
+                rArg.Value >>= aText;
                 m_pComboBox->set_active_or_entry_text(aText);
 
                 // send notification
@@ -231,16 +231,16 @@ void ComboboxToolbarController::executeControlCommand( const css::frame::Control
     }
     else if ( rControlCommand.Command == "SetList" )
     {
-        for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ )
+        for ( const NamedValue& rArg : rControlCommand.Arguments )
         {
-            if ( rControlCommand.Arguments[i].Name == "List" )
+            if ( rArg.Name == "List" )
             {
                 Sequence< OUString > aList;
                 m_pComboBox->clear();
 
-                rControlCommand.Arguments[i].Value >>= aList;
-                for (sal_Int32 j = 0; j < aList.getLength(); ++j)
-                    m_pComboBox->append_text(aList[j]);
+                rArg.Value >>= aList;
+                for (OUString const & rName : std::as_const(aList))
+                    m_pComboBox->append_text(rName);
 
                 // send notification
                 uno::Sequence< beans::NamedValue > aInfo { { "List", css::uno::makeAny(aList) } };
@@ -255,11 +255,11 @@ void ComboboxToolbarController::executeControlCommand( const css::frame::Control
     else if ( rControlCommand.Command == "AddEntry" )
     {
         OUString   aText;
-        for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ )
+        for ( const NamedValue& rArg : rControlCommand.Arguments )
         {
-            if ( rControlCommand.Arguments[i].Name == "Text" )
+            if ( rArg.Name == "Text" )
             {
-                if ( rControlCommand.Arguments[i].Value >>= aText )
+                if ( rArg.Value >>= aText )
                     m_pComboBox->append_text(aText);
                 break;
             }
@@ -269,32 +269,32 @@ void ComboboxToolbarController::executeControlCommand( const css::frame::Control
     {
         sal_Int32 nPos(-1);
         OUString   aText;
-        for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ )
+        for ( const NamedValue& rArg : rControlCommand.Arguments )
         {
-            if ( rControlCommand.Arguments[i].Name == "Pos" )
+            if ( rArg.Name == "Pos" )
             {
                 sal_Int32 nTmpPos = 0;
-                if ( rControlCommand.Arguments[i].Value >>= nTmpPos )
+                if ( rArg.Value >>= nTmpPos )
                 {
                     if (( nTmpPos >= 0 ) &&
                         ( nTmpPos < m_pComboBox->get_count() ))
                         nPos = nTmpPos;
                 }
             }
-            else if ( rControlCommand.Arguments[i].Name == "Text" )
-                rControlCommand.Arguments[i].Value >>= aText;
+            else if ( rArg.Name == "Text" )
+                rArg.Value >>= aText;
         }
 
         m_pComboBox->insert_text(nPos, aText);
     }
     else if ( rControlCommand.Command == "RemoveEntryPos" )
     {
-        for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ )
+        for ( const NamedValue& rArg : rControlCommand.Arguments )
         {
-            if ( rControlCommand.Arguments[i].Name == "Pos" )
+            if ( rArg.Name == "Pos" )
             {
                 sal_Int32 nPos( -1 );
-                if ( rControlCommand.Arguments[i].Value >>= nPos )
+                if ( rArg.Value >>= nPos )
                 {
                     if (0 <= nPos && nPos < m_pComboBox->get_count())
                         m_pComboBox->remove(nPos);
@@ -305,12 +305,12 @@ void ComboboxToolbarController::executeControlCommand( const css::frame::Control
     }
     else if ( rControlCommand.Command == "RemoveEntryText" )
     {
-        for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ )
+        for ( const NamedValue& rArg : rControlCommand.Arguments )
         {
-            if ( rControlCommand.Arguments[i].Name == "Text")
+            if ( rArg.Name == "Text")
             {
                 OUString aText;
-                if ( rControlCommand.Arguments[i].Value >>= aText )
+                if ( rArg.Value >>= aText )
                 {
                     auto nPos = m_pComboBox->find_text(aText);
                     if (nPos != -1)
diff --git a/framework/source/uielement/complextoolbarcontroller.cxx b/framework/source/uielement/complextoolbarcontroller.cxx
index 9b985a039e78..06da77962f4a 100644
--- a/framework/source/uielement/complextoolbarcontroller.cxx
+++ b/framework/source/uielement/complextoolbarcontroller.cxx
@@ -178,12 +178,12 @@ void ComplexToolbarController::statusChanged( const FeatureStateEvent& Event )
     {
         if (aControlCommand.Command == "SetQuickHelpText")
         {
-            for (sal_Int32 i = 0; i < aControlCommand.Arguments.getLength(); i++)
+            for (NamedValue const & rArg : std::as_const(aControlCommand.Arguments))
             {
-                if (aControlCommand.Arguments[i].Name == "HelpText")
+                if (rArg.Name == "HelpText")
                 {
                     OUString aHelpText;
-                    aControlCommand.Arguments[i].Value >>= aHelpText;
+                    rArg.Value >>= aHelpText;
                     m_xToolbar->SetQuickHelpText(m_nID, aHelpText);
                     break;
                 }
diff --git a/framework/source/uielement/dropdownboxtoolbarcontroller.cxx b/framework/source/uielement/dropdownboxtoolbarcontroller.cxx
index 84865f0a0f80..56acf0a018c9 100644
--- a/framework/source/uielement/dropdownboxtoolbarcontroller.cxx
+++ b/framework/source/uielement/dropdownboxtoolbarcontroller.cxx
@@ -177,16 +177,16 @@ void DropdownToolbarController::executeControlCommand( const css::frame::Control
 {
     if ( rControlCommand.Command == "SetList" )
     {
-        for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ )
+        for ( const NamedValue& rArg : rControlCommand.Arguments )
         {
-            if ( rControlCommand.Arguments[i].Name == "List" )
+            if ( rArg.Name == "List" )
             {
                 Sequence< OUString > aList;
                 m_pListBoxControl->clear();
 
-                rControlCommand.Arguments[i].Value >>= aList;
-                for (sal_Int32 j = 0; j < aList.getLength(); ++j)
-                    m_pListBoxControl->append_text(aList[j]);
+                rArg.Value >>= aList;
+                for (OUString const & rName : std::as_const(aList))
+                    m_pListBoxControl->append_text(rName);
 
                 m_pListBoxControl->set_active(0);
 
@@ -203,11 +203,11 @@ void DropdownToolbarController::executeControlCommand( const css::frame::Control
     else if ( rControlCommand.Command == "AddEntry" )
     {
         OUString   aText;
-        for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ )
+        for ( const NamedValue& rArg : rControlCommand.Arguments )
         {
-            if ( rControlCommand.Arguments[i].Name == "Text" )
+            if ( rArg.Name == "Text" )
             {
-                if ( rControlCommand.Arguments[i].Value >>= aText )
+                if ( rArg.Value >>= aText )
                     m_pListBoxControl->append_text(aText);
                 break;
             }
@@ -217,32 +217,32 @@ void DropdownToolbarController::executeControlCommand( const css::frame::Control
     {
         sal_Int32 nPos(-1);
         OUString   aText;
-        for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ )
+        for ( const NamedValue& rArg : rControlCommand.Arguments )
         {
-            if ( rControlCommand.Arguments[i].Name == "Pos" )
+            if ( rArg.Name == "Pos" )
             {
                 sal_Int32 nTmpPos = 0;
-                if ( rControlCommand.Arguments[i].Value >>= nTmpPos )
+                if ( rArg.Value >>= nTmpPos )
                 {
                     if (( nTmpPos >= 0 ) &&
                         ( nTmpPos < m_pListBoxControl->get_count() ))
                         nPos = nTmpPos;
                 }
             }
-            else if ( rControlCommand.Arguments[i].Name == "Text" )
-                rControlCommand.Arguments[i].Value >>= aText;
+            else if ( rArg.Name == "Text" )
+                rArg.Value >>= aText;
         }
 
         m_pListBoxControl->insert_text(nPos, aText);
     }
     else if ( rControlCommand.Command == "RemoveEntryPos" )
     {
-        for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ )
+        for ( const NamedValue& rArg : rControlCommand.Arguments )
         {
-            if ( rControlCommand.Arguments[i].Name == "Pos" )
+            if ( rArg.Name == "Pos" )
             {
                 sal_Int32 nPos( -1 );
-                if ( rControlCommand.Arguments[i].Value >>= nPos )
+                if ( rArg.Value >>= nPos )
                 {
                     if ( 0 <= nPos && nPos < m_pListBoxControl->get_count() )
                         m_pListBoxControl->remove(nPos);
@@ -253,12 +253,12 @@ void DropdownToolbarController::executeControlCommand( const css::frame::Control
     }
     else if ( rControlCommand.Command == "RemoveEntryText" )
     {
-        for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ )
+        for ( const NamedValue& rArg : rControlCommand.Arguments )
         {
-            if ( rControlCommand.Arguments[i].Name == "Text" )
+            if ( rArg.Name == "Text" )
             {
                 OUString aText;
-                if ( rControlCommand.Arguments[i].Value >>= aText )
+                if ( rArg.Value >>= aText )
                 {
                     auto nPos = m_pListBoxControl->find_text(aText);
                     if (nPos != -1)
diff --git a/framework/source/uielement/edittoolbarcontroller.cxx b/framework/source/uielement/edittoolbarcontroller.cxx
index 6bdcd18c3cc4..1d863c596b3f 100644
--- a/framework/source/uielement/edittoolbarcontroller.cxx
+++ b/framework/source/uielement/edittoolbarcontroller.cxx
@@ -185,12 +185,12 @@ void EditToolbarController::executeControlCommand( const css::frame::ControlComm
     if ( !rControlCommand.Command.startsWith( "SetText" ))
         return;
 
-    for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ )
+    for ( const NamedValue& rArg : rControlCommand.Arguments )
     {
-        if ( rControlCommand.Arguments[i].Name.startsWith( "Text" ))
+        if ( rArg.Name.startsWith( "Text" ))
         {
             OUString aText;
-            rControlCommand.Arguments[i].Value >>= aText;
+            rArg.Value >>= aText;
             m_pEditControl->set_text(aText);
 
             // send notification
diff --git a/framework/source/uielement/fontmenucontroller.cxx b/framework/source/uielement/fontmenucontroller.cxx
index ed7bb926c3ad..70c0043aede5 100644
--- a/framework/source/uielement/fontmenucontroller.cxx
+++ b/framework/source/uielement/fontmenucontroller.cxx
@@ -75,7 +75,6 @@ FontMenuController::~FontMenuController()
 // private function
 void FontMenuController::fillPopupMenu( const Sequence< OUString >& rFontNameSeq, Reference< css::awt::XPopupMenu > const & rPopupMenu )
 {
-    const OUString*    pFontNameArray = rFontNameSeq.getConstArray();
     VCLXPopupMenu*     pPopupMenu = static_cast<VCLXPopupMenu *>(comphelper::getUnoTunnelImplementation<VCLXMenu>( rPopupMenu ));
     PopupMenu*         pVCLPopupMenu = nullptr;
 
@@ -90,9 +89,9 @@ void FontMenuController::fillPopupMenu( const Sequence< OUString >& rFontNameSeq
 
     vector<OUString> aVector;
     aVector.reserve(rFontNameSeq.getLength());
-    for ( sal_Int32 i = 0; i < rFontNameSeq.getLength(); i++ )
+    for ( OUString const & s : rFontNameSeq )
     {
-        aVector.push_back(MnemonicGenerator::EraseAllMnemonicChars(pFontNameArray[i]));
+        aVector.push_back(MnemonicGenerator::EraseAllMnemonicChars(s));
     }
     sort(aVector.begin(), aVector.end(), lcl_I18nCompareString );
 
diff --git a/framework/source/uielement/fontsizemenucontroller.cxx b/framework/source/uielement/fontsizemenucontroller.cxx
index 5fa645d68a1a..79259c2e5e98 100644
--- a/framework/source/uielement/fontsizemenucontroller.cxx
+++ b/framework/source/uielement/fontsizemenucontroller.cxx
@@ -78,12 +78,12 @@ OUString FontSizeMenuController::retrievePrinterName( css::uno::Reference< css::
             Reference< XPrintable > xPrintable( xController->getModel(), UNO_QUERY );
             if ( xPrintable.is() )
             {
-                Sequence< PropertyValue > aPrinterSeq = xPrintable->getPrinter();
-                for ( int i = 0; i < aPrinterSeq.getLength(); i++ )
+                const Sequence< PropertyValue > aPrinterSeq = xPrintable->getPrinter();
+                for ( PropertyValue const & prop : aPrinterSeq )
                 {
-                    if ( aPrinterSeq[i].Name == "Name" )
+                    if ( prop.Name == "Name" )
                     {
-                        aPrinterSeq[i].Value >>= aPrinterName;
+                        prop.Value >>= aPrinterName;
                         break;
                     }
                 }
diff --git a/framework/source/uielement/generictoolbarcontroller.cxx b/framework/source/uielement/generictoolbarcontroller.cxx
index ec0f64c146f1..b13739932b32 100644
--- a/framework/source/uielement/generictoolbarcontroller.cxx
+++ b/framework/source/uielement/generictoolbarcontroller.cxx
@@ -242,12 +242,12 @@ void GenericToolbarController::statusChanged( const FeatureStateEvent& Event )
     {
         if (aControlCommand.Command == "SetQuickHelpText")
         {
-            for (sal_Int32 i = 0; i < aControlCommand.Arguments.getLength(); i++)
+            for ( NamedValue const & rArg : std::as_const(aControlCommand.Arguments) )
             {
-                if (aControlCommand.Arguments[i].Name == "HelpText")
+                if (rArg.Name == "HelpText")
                 {
                     OUString aHelpText;
-                    aControlCommand.Arguments[i].Value >>= aHelpText;
+                    rArg.Value >>= aHelpText;
                     m_xToolbar->SetQuickHelpText(m_nID, aHelpText);
                     break;
                 }
diff --git a/framework/source/uielement/imagebuttontoolbarcontroller.cxx b/framework/source/uielement/imagebuttontoolbarcontroller.cxx
index 340999620c68..5c0cbeba873f 100644
--- a/framework/source/uielement/imagebuttontoolbarcontroller.cxx

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list