UnoControls/source/base/basecontainercontrol.cxx                       |    2 
 accessibility/source/standard/vclxaccessibleedit.cxx                   |    5 
 basctl/source/basicide/scriptdocument.cxx                              |    2 
 chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx |    2 
 chart2/source/model/template/ColumnLineDataInterpreter.cxx             |    4 
 chart2/source/tools/ReferenceSizeProvider.cxx                          |    4 
 chart2/source/view/axes/VCoordinateSystem.cxx                          |    4 
 chart2/source/view/main/VDataSeries.cxx                                |    2 
 comphelper/source/property/opropertybag.cxx                            |    2 
 comphelper/source/property/property.cxx                                |   18 
--
 comphelper/source/property/propertycontainerhelper.cxx                 |    2 
 compilerplugins/clang/sequenceloop.cxx                                 |   83 
----------
 compilerplugins/clang/test/constvars.cxx                               |   15 -
 compilerplugins/clang/test/sequenceloop.cxx                            |   35 
----
 configmgr/source/writemodfile.cxx                                      |    4 
 connectivity/source/commontools/ConnectionWrapper.cxx                  |    2 
 connectivity/source/commontools/dbtools.cxx                            |    9 -
 connectivity/source/drivers/jdbc/JStatement.cxx                        |    2 
 connectivity/source/drivers/odbc/OStatement.cxx                        |    2 
 connectivity/source/sdbcx/VDescriptor.cxx                              |    2 
 cppuhelper/source/factory.cxx                                          |    2 
 cui/source/customize/cfg.cxx                                           |    2 
 cui/source/dialogs/AdditionsDialog.cxx                                 |    2 
 cui/source/options/optaboutconfig.cxx                                  |    4 
 cui/source/options/optgenrl.cxx                                        |    2 
 dbaccess/source/core/api/TableDeco.cxx                                 |    2 
 dbaccess/source/core/api/definitioncolumn.cxx                          |    2 
 dbaccess/source/core/api/table.cxx                                     |    2 
 dbaccess/source/core/dataaccess/databasedocument.cxx                   |    2 
 dbaccess/source/core/dataaccess/datasource.cxx                         |    4 
 dbaccess/source/filter/xml/xmlExport.cxx                               |    2 
 dbaccess/source/ui/browser/formadapter.cxx                             |    2 
 dbaccess/source/ui/browser/sbamultiplex.cxx                            |    2 
 dbaccess/source/ui/browser/unodatbr.cxx                                |    2 
 dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx                   |    2 
 dbaccess/source/ui/querydesign/querycontroller.cxx                     |    2 
 desktop/source/lib/init.cxx                                            |   14 -
 editeng/source/accessibility/AccessibleEditableTextPara.cxx            |    2 
 embeddedobj/source/commonembedding/embedobj.cxx                        |    2 
 extensions/source/propctrlr/formcomponenthandler.cxx                   |    2 
 extensions/source/propctrlr/stringrepresentation.cxx                   |    2 
 filter/source/pdf/pdffilter.cxx                                        |    2 
 forms/source/misc/InterfaceContainer.cxx                               |    2 
 framework/source/fwe/classes/addonsoptions.cxx                         |    6 
 i18npool/source/calendar/calendarImpl.cxx                              |    2 
 i18npool/source/collator/collatorImpl.cxx                              |    4 
 i18npool/source/localedata/localedata.cxx                              |    6 
 i18npool/source/transliteration/ignoreIandEfollowedByYa_ja_JP.cxx      |    2 
 i18npool/source/transliteration/ignoreIterationMark_ja_JP.cxx          |    2 
 i18npool/source/transliteration/ignoreKiKuFollowedBySa_ja_JP.cxx       |    2 
 i18npool/source/transliteration/ignoreProlongedSoundMark_ja_JP.cxx     |    2 
 i18npool/source/transliteration/transliterationImpl.cxx                |   10 -
 i18npool/source/transliteration/transliteration_OneToOne.cxx           |    2 
 i18npool/source/transliteration/transliteration_body.cxx               |    2 
 include/com/sun/star/uno/Sequence.h                                    |    4 
 include/com/sun/star/uno/Sequence.hxx                                  |    8 
 include/comphelper/basicio.hxx                                         |    2 
 include/comphelper/propertysequence.hxx                                |    4 
 include/comphelper/sequence.hxx                                        |    2 
 linguistic/source/lngsvcmgr.cxx                                        |    8 
 oox/source/drawingml/customshapeproperties.cxx                         |    2 
 oox/source/export/chartexport.cxx                                      |    2 
 oox/source/export/drawingml.cxx                                        |    4 
 oox/source/vml/vmlformatting.cxx                                       |    2 
 package/source/xstor/owriteablestream.cxx                              |   18 
+-
 package/source/zipapi/ThreadedDeflater.cxx                             |    6 
 pyuno/source/module/pyuno_adapter.cxx                                  |    4 
 reportdesign/source/core/api/ReportDefinition.cxx                      |    7 
 reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx            |    2 
 reportdesign/source/ui/report/ReportSection.cxx                        |    2 
 sc/qa/unit/subsequent_filters_test2.cxx                                |    2 
 sc/source/core/data/dpobject.cxx                                       |    2 
 sc/source/core/data/dptabsrc.cxx                                       |    7 
 sc/source/core/tool/charthelper.cxx                                    |    2 
 sc/source/filter/excel/xechart.cxx                                     |    2 
 sc/source/filter/ftools/fapihelper.cxx                                 |    2 
 sc/source/ui/Accessibility/AccessibleCell.cxx                          |    2 
 sc/source/ui/miscdlgs/optsolver.cxx                                    |    6 
 sc/source/ui/miscdlgs/solveroptions.cxx                                |    2 
 sc/source/ui/unoobj/cellsuno.cxx                                       |    2 
 sc/source/ui/unoobj/chart2uno.cxx                                      |    4 
 sc/source/ui/unoobj/dapiuno.cxx                                        |    5 
 sc/source/ui/unoobj/defltuno.cxx                                       |    2 
 sc/source/ui/unoobj/dispuno.cxx                                        |    2 
 sc/source/ui/unoobj/docuno.cxx                                         |    2 
 sc/source/ui/unoobj/funcuno.cxx                                        |    5 
 sc/source/ui/unoobj/shapeuno.cxx                                       |    2 
 sc/source/ui/unoobj/styleuno.cxx                                       |    6 
 sc/source/ui/vba/vbachart.cxx                                          |    2 
 sc/source/ui/vba/vbaeventshelper.cxx                                   |    5 
 sc/source/ui/vba/vbaworkbook.cxx                                       |   11 -
 sc/source/ui/vba/vbaworkbook.hxx                                       |    1 
 sc/source/ui/vba/vbawsfunction.cxx                                     |    6 
 sccomp/source/solver/SwarmSolver.cxx                                   |    2 
 scripting/source/protocolhandler/scripthandler.cxx                     |    2 
 scripting/source/provider/BrowseNodeFactoryImpl.cxx                    |    2 
 sd/source/core/CustomAnimationCloner.cxx                               |    4 
 sd/source/core/CustomAnimationEffect.cxx                               |    6 
 sd/source/core/stlsheet.cxx                                            |    2 
 sd/source/filter/eppt/pptx-epptooxml.cxx                               |    2 
 sd/source/filter/grf/sdgrffilter.cxx                                   |    2 
 sd/source/filter/ppt/pptinanimations.cxx                               |    2 
 sd/source/ui/unoidl/unomodule.cxx                                      |    2 
 sd/source/ui/unoidl/unopage.cxx                                        |    2 
 sd/source/ui/unoidl/unopback.cxx                                       |    2 
 sdext/source/minimizer/pppoptimizerdialog.cxx                          |    2 
 sfx2/source/appl/appdispatchprovider.cxx                               |    2 
 sfx2/source/appl/helpinterceptor.cxx                                   |    2 
 sfx2/source/appl/macroloader.cxx                                       |    2 
 sfx2/source/control/templatelocalview.cxx                              |    2 
 sfx2/source/control/unoctitm.cxx                                       |    8 
 sfx2/source/dialog/backingcomp.cxx                                     |    2 
 sfx2/source/dialog/dinfdlg.cxx                                         |    4 
 sfx2/source/dialog/filedlghelper.cxx                                   |    2 
 sfx2/source/dialog/filtergrouping.cxx                                  |    2 
 sfx2/source/doc/doctemplates.cxx                                       |    8 
 sfx2/source/doc/sfxbasemodel.cxx                                       |    6 
 sfx2/source/view/sfxbasecontroller.cxx                                 |    2 
 sfx2/source/view/viewprn.cxx                                           |    2 
 slideshow/source/engine/opengl/TransitionerImpl.cxx                    |    2 
 solenv/CompilerTest_compilerplugins_clang.mk                           |    1 
 starmath/source/cfgitem.cxx                                            |    4 
 starmath/source/mathml/mathmlexport.cxx                                |    2 
 stoc/source/implementationregistration/implreg.cxx                     |   14 -
 stoc/source/invocation/invocation.cxx                                  |    2 
 stoc/source/servicemanager/servicemanager.cxx                          |    2 
 svl/qa/unit/lockfiles/test_lockfiles.cxx                               |    2 
 svl/source/config/asiancfg.cxx                                         |    2 
 svl/source/misc/PasswordHelper.cxx                                     |    4 
 svl/source/numbers/zforlist.cxx                                        |    5 
 svl/source/passwordcontainer/passwordcontainer.cxx                     |    2 
 svtools/source/config/extcolorcfg.cxx                                  |    6 
 svtools/source/uno/popupmenucontrollerbase.cxx                         |    2 
 svx/source/accessibility/AccessibleControlShape.cxx                    |    4 
 svx/source/dialog/SvxNumOptionsTabPageHelper.cxx                       |    2 
 svx/source/dialog/rubydialog.cxx                                       |   18 
--
 svx/source/fmcomp/fmgridcl.cxx                                         |    2 
 svx/source/fmcomp/fmgridif.cxx                                         |    2 
 svx/source/form/formdispatchinterceptor.cxx                            |    2 
 svx/source/table/cell.cxx                                              |    4 
 svx/source/tbxctrls/tbunosearchcontrollers.cxx                         |    2 
 svx/source/unodraw/UnoGraphicExporter.cxx                              |    2 
 svx/source/unodraw/unoshape.cxx                                        |    2 
 sw/qa/extras/globalfilter/globalfilter.cxx                             |    2 
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx                             |    2 
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx                               |    2 
 sw/source/core/access/accpara.cxx                                      |    5 
 sw/source/core/unocore/SwXTextDefaults.cxx                             |    2 
 sw/source/core/unocore/unochart.cxx                                    |   10 -
 sw/source/core/unocore/unodraw.cxx                                     |    4 
 sw/source/core/unocore/unofield.cxx                                    |    2 
 sw/source/core/unocore/unoframe.cxx                                    |    2 
 sw/source/core/unocore/unoftn.cxx                                      |    2 
 sw/source/core/unocore/unoobj.cxx                                      |    2 
 sw/source/core/unocore/unoparagraph.cxx                                |    2 
 sw/source/core/unocore/unoport.cxx                                     |    2 
 sw/source/core/unocore/unostyle.cxx                                    |    4 
 sw/source/core/unocore/unotbl.cxx                                      |   10 -
 sw/source/filter/ww8/ww8par3.cxx                                       |    2 
 sw/source/filter/xml/wrtxml.cxx                                        |    5 
 sw/source/ui/dbui/mmaddressblockpage.cxx                               |    2 
 sw/source/ui/envelp/mailmrge.cxx                                       |    2 
 sw/source/ui/vba/vbadocumentproperties.cxx                             |    4 
 sw/source/ui/vba/vbafilterpropsfromformat.hxx                          |    2 
 sw/source/ui/vba/vbatabstops.cxx                                       |    4 
 sw/source/uibase/dbui/dbtree.cxx                                       |    2 
 sw/source/uibase/dbui/mmconfigitem.cxx                                 |    6 
 sw/source/uibase/fldui/fldmgr.cxx                                      |    4 
 sw/source/uibase/misc/numberingtypelistbox.cxx                         |    2 
 sw/source/uibase/uno/unodispatch.cxx                                   |    2 
 sw/source/uibase/uno/unomodule.cxx                                     |    2 
 sw/source/uibase/uno/unotxdoc.cxx                                      |    4 
 test/source/sheet/databaseimportdescriptor.cxx                         |    2 
 toolkit/source/controls/controlmodelcontainerbase.cxx                  |    2 
 toolkit/source/controls/geometrycontrolmodel.cxx                       |    2 
 toolkit/source/controls/stdtabcontroller.cxx                           |    4 
 toolkit/source/controls/unocontrol.cxx                                 |    4 
 toolkit/source/controls/unocontrolcontainer.cxx                        |    4 
 toolkit/source/controls/unocontrolmodel.cxx                            |    6 
 toolkit/source/controls/unocontrols.cxx                                |    8 
 ucb/source/cacher/cachedcontentresultset.cxx                           |    2 
 ucb/source/cacher/dynamicresultsetwrapper.cxx                          |    2 
 ucb/source/ucp/cmis/cmis_content.cxx                                   |   10 -
 ucb/source/ucp/ext/ucpext_content.cxx                                  |    2 
 ucb/source/ucp/file/filnot.cxx                                         |    2 
 ucb/source/ucp/file/filtask.cxx                                        |    4 
 ucbhelper/source/provider/contentinfo.cxx                              |    2 
 ucbhelper/source/provider/resultsetmetadata.cxx                        |    2 
 unotools/source/config/cmdoptions.cxx                                  |    2 
 unotools/source/config/configitem.cxx                                  |    6 
 unotools/source/config/confignode.cxx                                  |    2 
 unotools/source/config/lingucfg.cxx                                    |    2 
 unotools/source/config/moduleoptions.cxx                               |    4 
 unotools/source/config/viewoptions.cxx                                 |    2 
 unotools/source/i18n/localedatawrapper.cxx                             |    7 
 vbahelper/source/msforms/vbalistcontrolhelper.cxx                      |    2 
 vbahelper/source/vbahelper/vbahelper.cxx                               |    9 -
 vcl/qa/cppunit/canvasbitmaptest.cxx                                    |    6 
 vcl/qt5/QtAccessibleWidget.cxx                                         |    2 
 vcl/source/filter/graphicfilter.cxx                                    |    6 
 vcl/source/gdi/configsettings.cxx                                      |    2 
 vcl/source/gdi/print3.cxx                                              |    2 
 vcl/source/gdi/vectorgraphicdata.cxx                                   |    9 -
 vcl/source/graphic/UnoGraphic.cxx                                      |    2 
 vcl/source/uitest/uitest.cxx                                           |    2 
 vcl/unx/generic/dtrans/X11_transferable.cxx                            |    2 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx                      |    8 
 xmlhelp/source/cxxhelp/provider/content.cxx                            |    2 
 xmloff/source/chart/SchXMLExport.cxx                                   |    4 
 xmloff/source/chart/SchXMLSeries2Context.cxx                           |    2 
 xmloff/source/core/PropertySetMerger.cxx                               |    2 
 xmloff/source/draw/shapeexport.cxx                                     |    4 
 xmloff/source/forms/elementimport.cxx                                  |    2 
 xmloff/source/forms/propertyexport.cxx                                 |    2 
 xmloff/source/text/txtimp.cxx                                          |    2 
 xmloff/source/transform/OOo2Oasis.cxx                                  |    2 
 xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx                          |    2 
 217 files changed, 372 insertions(+), 511 deletions(-)

New commits:
commit 2484de6728bd11bb7949003d112f1ece2223c7a1
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Thu Oct 14 09:25:24 2021 +0200
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Fri Oct 15 10:36:36 2021 +0200

    Remove non-const Sequence::begin()/end() in internal code
    
    ... to avoid hidden cost of multiple COW checks, because they
    call getArray() internally.
    This obsoletes [loplugin:sequenceloop].
    
    Also rename toNonConstRange to asNonConstRange, to reflect that
    the result is a view of the sequence, not an independent object.
    
    TODO: also drop non-const operator[], but introduce operator[]
    in SequenceRange.
    
    Change-Id: Idd5fd7a3400fe65274d2a6343025e2ef8911635d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123518
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/UnoControls/source/base/basecontainercontrol.cxx 
b/UnoControls/source/base/basecontainercontrol.cxx
index a20059d100b8..20eea9eb315f 100644
--- a/UnoControls/source/base/basecontainercontrol.cxx
+++ b/UnoControls/source/base/basecontainercontrol.cxx
@@ -123,7 +123,7 @@ void SAL_CALL BaseContainerControl::createPeer( const   
Reference< XToolkit >&
     // create peers at all children
     Sequence< Reference< XControl > >   seqControlList  = getControls();
 
-    for ( auto& rxControl : seqControlList )
+    for ( auto& rxControl : asNonConstRange(seqControlList) )
     {
         rxControl->createPeer( xToolkit, getPeer() );
     }
diff --git a/accessibility/source/standard/vclxaccessibleedit.cxx 
b/accessibility/source/standard/vclxaccessibleedit.cxx
index 56fe32010939..87cfcdb62f30 100644
--- a/accessibility/source/standard/vclxaccessibleedit.cxx
+++ b/accessibility/source/standard/vclxaccessibleedit.cxx
@@ -301,6 +301,7 @@ Sequence< PropertyValue > 
VCLXAccessibleEdit::getCharacterAttributes( sal_Int32
 {
     OExternalLockGuard aGuard( this );
     Sequence< PropertyValue > aProperties = 
VCLXAccessibleTextComponent::getCharacterAttributes( nIndex, 
aRequestedAttributes );
+    auto aNonConstRange = asNonConstRange(aProperties);
 
     // Handle multiline edit character properties
     VclPtr<VclMultiLineEdit> pMulitLineEdit = GetAsDynamic< VclMultiLineEdit 
>();
@@ -311,7 +312,7 @@ Sequence< PropertyValue > 
VCLXAccessibleEdit::getCharacterAttributes( sal_Int32
         const TextAttribFontColor* pFontColor = static_cast<const 
TextAttribFontColor* >(pTextEngine->FindAttrib( aCursor, TEXTATTR_FONTCOLOR ));
         if ( pFontColor )
         {
-            for (PropertyValue& aValue : aProperties )
+            for (PropertyValue& aValue : aNonConstRange )
             {
                 if (aValue.Name == "CharColor")
                 {
@@ -323,7 +324,7 @@ Sequence< PropertyValue > 
VCLXAccessibleEdit::getCharacterAttributes( sal_Int32
     }
 
     // Set default character color if it is not set yet to a valid value
-    for (PropertyValue& aValue : aProperties )
+    for (PropertyValue& aValue : aNonConstRange )
     {
         if (aValue.Name == "CharColor")
         {
diff --git a/basctl/source/basicide/scriptdocument.cxx 
b/basctl/source/basicide/scriptdocument.cxx
index d0c37e89ef07..fcef9e78802b 100644
--- a/basctl/source/basicide/scriptdocument.cxx
+++ b/basctl/source/basicide/scriptdocument.cxx
@@ -1213,7 +1213,7 @@ namespace basctl
         auto const sort = comphelper::string::NaturalStringSorter(
             comphelper::getProcessComponentContext(),
             Application::GetSettings().GetUILanguageTag().getLocale());
-        auto [begin, end] = toNonConstRange(aModuleNames);
+        auto [begin, end] = asNonConstRange(aModuleNames);
         std::sort(begin, end,
                   [&sort](const OUString& rLHS, const OUString& rRHS) {
                       return sort.compare(rLHS, rRHS) < 0;
diff --git 
a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx 
b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx
index adaa328e636d..e48ba0b3f443 100644
--- a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx
@@ -219,7 +219,7 @@ bool SeriesOptionsItemConverter::ApplySpecialItem( 
sal_uInt16 nWhichId, const Sf
                             if(!bGroupBarsPerAxis)
                             {
                                 //set the same value for all axes
-                                for( auto & pos : aBarPositionSequence )
+                                for( auto & pos : 
asNonConstRange(aBarPositionSequence) )
                                     pos = rBarPosition;
                             }
                             else if( nAxisIndex >= 0 && nAxisIndex < 
aBarPositionSequence.getLength() )
diff --git a/chart2/source/model/template/ColumnLineDataInterpreter.cxx 
b/chart2/source/model/template/ColumnLineDataInterpreter.cxx
index f59c98c489b6..6069255d3f1d 100644
--- a/chart2/source/model/template/ColumnLineDataInterpreter.cxx
+++ b/chart2/source/model/template/ColumnLineDataInterpreter.cxx
@@ -64,8 +64,8 @@ InterpretedData SAL_CALL 
ColumnLineDataInterpreter::interpretDataSource(
             Sequence< Reference< XDataSeries > > & rColumnDataSeries = 
aResult.Series[0];
             Sequence< Reference< XDataSeries > > & rLineDataSeries   = 
aResult.Series[1];
             rLineDataSeries.realloc( nNumOfLines );
-            std::copy( rColumnDataSeries.begin() + nNumberOfSeries - 
nNumOfLines,
-                         rColumnDataSeries.begin() + nNumberOfSeries,
+            std::copy( std::cbegin(rColumnDataSeries) + nNumberOfSeries - 
nNumOfLines,
+                         std::cbegin(rColumnDataSeries) + nNumberOfSeries,
                          rLineDataSeries.getArray() );
             rColumnDataSeries.realloc( nNumberOfSeries - nNumOfLines );
         }
diff --git a/chart2/source/tools/ReferenceSizeProvider.cxx 
b/chart2/source/tools/ReferenceSizeProvider.cxx
index b5b928e9e843..b409c1730e39 100644
--- a/chart2/source/tools/ReferenceSizeProvider.cxx
+++ b/chart2/source/tools/ReferenceSizeProvider.cxx
@@ -108,7 +108,7 @@ void ReferenceSizeProvider::setValuesAtAllDataSeries()
             {
                 if( xSeriesProp->getPropertyValue( "AttributedDataPoints") >>= 
aPointIndexes )
                 {
-                    for( sal_Int32 idx : aPointIndexes )
+                    for( sal_Int32 idx : std::as_const(aPointIndexes) )
                         setValuesAtPropertySet(
                             elem->getDataPointByIndex( idx ) );
                 }
@@ -282,7 +282,7 @@ ReferenceSizeProvider::AutoResizeState 
ReferenceSizeProvider::getAutoResizeState
             {
                 if( xSeriesProp->getPropertyValue( "AttributedDataPoints") >>= 
aPointIndexes )
                 {
-                    for( sal_Int32 idx : aPointIndexes )
+                    for( sal_Int32 idx : std::as_const(aPointIndexes) )
                     {
                         getAutoResizeFromPropSet(
                             elem->getDataPointByIndex( idx ), eResult );
diff --git a/chart2/source/view/axes/VCoordinateSystem.cxx 
b/chart2/source/view/axes/VCoordinateSystem.cxx
index 7259f3e92043..a320c85cb497 100644
--- a/chart2/source/view/axes/VCoordinateSystem.cxx
+++ b/chart2/source/view/axes/VCoordinateSystem.cxx
@@ -141,7 +141,7 @@ uno::Sequence< sal_Int32 > 
VCoordinateSystem::getCoordinateSystemResolution(
     uno::Sequence<sal_Int32> aResolution(
         std::max<sal_Int32>(m_xCooSysModel->getDimension(), 2));
 
-    for( auto& i : aResolution )
+    for( auto& i : asNonConstRange(aResolution) )
         i = 1000;
 
     ::basegfx::B3DTuple aScale( BaseGFXHelper::GetScaleFromMatrix(
@@ -177,7 +177,7 @@ uno::Sequence< sal_Int32 > 
VCoordinateSystem::getCoordinateSystemResolution(
         //this maybe can be optimized further ...
         sal_Int32 nMaxResolution = std::max( nXResolution, nYResolution );
         nMaxResolution*=2;
-        for( auto& i : aResolution )
+        for( auto& i : asNonConstRange(aResolution) )
             i = nMaxResolution;
     }
 
diff --git a/chart2/source/view/main/VDataSeries.cxx 
b/chart2/source/view/main/VDataSeries.cxx
index b3047d4126b3..0d3123a8cb13 100644
--- a/chart2/source/view/main/VDataSeries.cxx
+++ b/chart2/source/view/main/VDataSeries.cxx
@@ -582,7 +582,7 @@ sal_Int32 VDataSeries::getLabelPlacement( sal_Int32 
nPointIndex, const uno::Refe
         if( xPointProps.is() )
             xPointProps->getPropertyValue("LabelPlacement") >>= 
nLabelPlacement;
 
-        uno::Sequence < sal_Int32 > aAvailablePlacements( 
ChartTypeHelper::getSupportedLabelPlacements(
+        const uno::Sequence < sal_Int32 > aAvailablePlacements( 
ChartTypeHelper::getSupportedLabelPlacements(
                 xChartType, bSwapXAndY, m_xDataSeries ) );
 
         for( sal_Int32 n : aAvailablePlacements )
diff --git a/comphelper/source/property/opropertybag.cxx 
b/comphelper/source/property/opropertybag.cxx
index f84d509847eb..e0b389c19199 100644
--- a/comphelper/source/property/opropertybag.cxx
+++ b/comphelper/source/property/opropertybag.cxx
@@ -425,7 +425,7 @@ namespace comphelper
     {
         // sort (the XMultiPropertySet interface requires this)
         Sequence< PropertyValue > aProperties( _rProps );
-        auto [begin, end] = toNonConstRange(aProperties);
+        auto [begin, end] = asNonConstRange(aProperties);
         std::sort(
             begin,
             end,
diff --git a/comphelper/source/property/property.cxx 
b/comphelper/source/property/property.cxx
index 75208c2c51b4..49a7a108f09a 100644
--- a/comphelper/source/property/property.cxx
+++ b/comphelper/source/property/property.cxx
@@ -138,31 +138,25 @@ bool hasProperty(const OUString& _rName, const 
Reference<XPropertySet>& _rxSet)
 
 void RemoveProperty(Sequence<Property>& _rProps, const OUString& _rPropName)
 {
-    sal_Int32 nLen = _rProps.getLength();
-
     // binary search
-    const Property* pProperties = _rProps.getConstArray();
     Property aNameProp(_rPropName, 0, Type(), 0);
-    const Property* pResult = std::lower_bound(pProperties, pProperties + 
nLen, aNameProp, PropertyCompareByName());
+    const Property* pResult = std::lower_bound(std::cbegin(_rProps), 
std::cend(_rProps), aNameProp, PropertyCompareByName());
 
-    if ( pResult != _rProps.end() && pResult->Name == _rPropName )
+    if ( pResult != std::cend(_rProps) && pResult->Name == _rPropName)
     {
-        OSL_ENSURE(pResult->Name == _rPropName, "::RemoveProperty Properties 
not sorted");
-        removeElementAt(_rProps, pResult - pProperties);
+        removeElementAt(_rProps, pResult - std::cbegin(_rProps));
     }
 }
 
 
 void ModifyPropertyAttributes(Sequence<Property>& seqProps, const OUString& 
sPropName, sal_Int16 nAddAttrib, sal_Int16 nRemoveAttrib)
 {
-    sal_Int32 nLen = seqProps.getLength();
-
     // binary search
-    Property* pProperties = seqProps.getArray();
+    auto [begin, end] = asNonConstRange(seqProps);
     Property aNameProp(sPropName, 0, Type(), 0);
-    Property* pResult = std::lower_bound(pProperties, pProperties + nLen, 
aNameProp, PropertyCompareByName());
+    Property* pResult = std::lower_bound(begin, end, aNameProp, 
PropertyCompareByName());
 
-    if ( (pResult != seqProps.end()) && (pResult->Name == sPropName) )
+    if ( (pResult != end) && (pResult->Name == sPropName) )
     {
         pResult->Attributes |= nAddAttrib;
         pResult->Attributes &= ~nRemoveAttrib;
diff --git a/comphelper/source/property/propertycontainerhelper.cxx 
b/comphelper/source/property/propertycontainerhelper.cxx
index 73dcbd2e862b..5fd6053ce100 100644
--- a/comphelper/source/property/propertycontainerhelper.cxx
+++ b/comphelper/source/property/propertycontainerhelper.cxx
@@ -469,7 +469,7 @@ void OPropertyContainerHelper::describeProperties(Sequence< 
Property >& _rProps)
     }
 
     // as our property vector is sorted by handles, not by name, we have to 
sort aOwnProps
-    auto [begin, end] = toNonConstRange(aOwnProps);
+    auto [begin, end] = asNonConstRange(aOwnProps);
     std::sort(begin, end, PropertyCompareByName());
 
     // unfortunately the STL merge function does not allow the output range to 
overlap one of the input ranges,
diff --git a/compilerplugins/clang/sequenceloop.cxx 
b/compilerplugins/clang/sequenceloop.cxx
deleted file mode 100644
index 8c931d70d5d1..000000000000
--- a/compilerplugins/clang/sequenceloop.cxx
+++ /dev/null
@@ -1,83 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-#ifndef LO_CLANG_SHARED_PLUGINS
-
-#include <cassert>
-#include <string>
-#include <iostream>
-#include <fstream>
-#include <set>
-
-#include <clang/AST/CXXInheritance.h>
-#include "plugin.hxx"
-#include "check.hxx"
-
-/**
-  When used in "for" loops, css::uno::Sequence objects tend to end up calling 
the non-const begin()/end(),
-  which is considerably more expensive than the const variants because it 
forces a local copy
-  of the internal ref-counted impl object.
-*/
-
-namespace
-{
-class SequenceLoop : public loplugin::FilteringPlugin<SequenceLoop>
-{
-public:
-    explicit SequenceLoop(loplugin::InstantiationData const& data)
-        : FilteringPlugin(data)
-    {
-    }
-
-    virtual void run() override
-    {
-        if (preRun())
-            TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
-    }
-
-    bool VisitCXXForRangeStmt(CXXForRangeStmt const*);
-};
-
-bool SequenceLoop::VisitCXXForRangeStmt(CXXForRangeStmt const* forStmt)
-{
-    if (ignoreLocation(forStmt))
-        return true;
-
-    auto tc = loplugin::TypeCheck(forStmt->getRangeInit()->getType());
-    if (tc.Const())
-        return true;
-    if (!tc.Class("Sequence")
-             .Namespace("uno")
-             .Namespace("star")
-             .Namespace("sun")
-             .Namespace("com")
-             .GlobalNamespace()
-        // B2DPolyPolygon is similar in that accessing the non-const 
begin()/end() methods
-        // might trigger unnecessary copying
-        && !tc.Class("B2DPolyPolygon").Namespace("basegfx").GlobalNamespace())
-        return true;
-    const VarDecl* varDecl = forStmt->getLoopVariable();
-    auto tc2 = loplugin::TypeCheck(varDecl->getType());
-    if (!tc2.LvalueReference().Const())
-        return true;
-
-    report(DiagnosticsEngine::Warning,
-           ("use std::as_const, or otherwise make the for-range-initializer 
expression const, to"
-            " avoid creating a copy of the Sequence"),
-           compat::getBeginLoc(forStmt->getRangeInit()))
-        << forStmt->getSourceRange();
-    return true;
-}
-
-loplugin::Plugin::Registration<SequenceLoop> sequenceloop("sequenceloop");
-
-} // namespace
-
-#endif // LO_CLANG_SHARED_PLUGINS
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/compilerplugins/clang/test/constvars.cxx 
b/compilerplugins/clang/test/constvars.cxx
index dc3c1ecb9c6b..88df50f8e199 100644
--- a/compilerplugins/clang/test/constvars.cxx
+++ b/compilerplugins/clang/test/constvars.cxx
@@ -12,7 +12,6 @@
 #else
 
 #include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
 #include <com/sun/star/uno/XInterface.hpp>
 #include <map>
 #include <list>
@@ -79,20 +78,8 @@ void foo(std::list<Struct1*> aList)
 }
 };
 
-namespace test6
-{
-void foo(css::uno::Sequence<css::uno::Reference<css::uno::XInterface>>& aSeq)
-{
-    // expected-error@+1 {{var can be const [loplugin:constvars]}}
-    for (css::uno::Reference<css::uno::XInterface>& x : aSeq)
-    {
-        x.get();
-    }
-}
-};
-
 // no warning expected
-namespace test7
+namespace test6
 {
 void foo(std::vector<std::vector<int>> aVecVec)
 {
diff --git a/compilerplugins/clang/test/sequenceloop.cxx 
b/compilerplugins/clang/test/sequenceloop.cxx
deleted file mode 100644
index e124fda27093..000000000000
--- a/compilerplugins/clang/test/sequenceloop.cxx
+++ /dev/null
@@ -1,35 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/uno/XInterface.hpp>
-#include <utility>
-
-namespace test1
-{
-void foo(css::uno::Sequence<css::uno::Reference<css::uno::XInterface>>& aSeq)
-{
-    // expected-error@+1 {{use std::as_const, or otherwise make the 
for-range-initializer expression const, to avoid creating a copy of the 
Sequence [loplugin:sequenceloop]}}
-    for (const auto& x : aSeq)
-        x.get();
-    // no warning expected
-    for (auto& x : aSeq)
-        x.get();
-    for (const auto& x : std::as_const(aSeq))
-        x.get();
-}
-// no warning expected
-void foo2(const css::uno::Sequence<css::uno::Reference<css::uno::XInterface>>& 
aSeq)
-{
-    for (const auto& x : aSeq)
-        x.get();
-}
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/configmgr/source/writemodfile.cxx 
b/configmgr/source/writemodfile.cxx
index 759959ab3bb7..359b5d7a9a06 100644
--- a/configmgr/source/writemodfile.cxx
+++ b/configmgr/source/writemodfile.cxx
@@ -209,7 +209,7 @@ template< typename T > void writeListValue(
         if (i != 0) {
             handle.writeString(" ");
         }
-        writeValueContent_(handle, val[i]);
+        writeValueContent_(handle, std::as_const(val)[i]);
     }
     handle.writeString("</value>");
 }
@@ -220,7 +220,7 @@ template< typename T > void writeItemListValue(
     handle.writeString(">");
     css::uno::Sequence< T > val;
     value >>= val;
-    for (const auto & i : val) {
+    for (const auto & i : std::as_const(val)) {
         handle.writeString("<it>");
         writeValueContent_(handle, i);
         handle.writeString("</it>");
diff --git a/connectivity/source/commontools/ConnectionWrapper.cxx 
b/connectivity/source/commontools/ConnectionWrapper.cxx
index 252882067865..8a0cc852ed98 100644
--- a/connectivity/source/commontools/ConnectionWrapper.cxx
+++ b/connectivity/source/commontools/ConnectionWrapper.cxx
@@ -199,7 +199,7 @@ void OConnectionWrapper::createUniqueId( const OUString& 
_rURL
     if ( !_rPassword.isEmpty() )
         sha1.update(reinterpret_cast<unsigned char 
const*>(_rPassword.getStr()), _rPassword.getLength() * sizeof(sal_Unicode));
     // now we need to sort the properties
-    auto [begin, end] = toNonConstRange(_rInfo);
+    auto [begin, end] = asNonConstRange(_rInfo);
     std::sort(begin,end,TPropertyValueLessFunctor());
 
     for (PropertyValue const & prop : std::as_const(_rInfo))
diff --git a/connectivity/source/commontools/dbtools.cxx 
b/connectivity/source/commontools/dbtools.cxx
index 40a07679ba96..88f9e37760c0 100644
--- a/connectivity/source/commontools/dbtools.cxx
+++ b/connectivity/source/commontools/dbtools.cxx
@@ -947,10 +947,7 @@ try
     Reference< XPropertySetInfo> xNewInfo( xNewProps->getPropertySetInfo());
 
     const Sequence< Property> aOldProperties = xOldInfo->getProperties();
-    Sequence< Property> aNewProperties = xNewInfo->getProperties();
-    int nNewLen = aNewProperties.getLength();
-
-    Property* pNewProps = aNewProperties.getArray();
+    const Sequence< Property> aNewProperties = xNewInfo->getProperties();
 
     static constexpr OUStringLiteral sPropFormatsSupplier(u"FormatsSupplier");
     static constexpr OUStringLiteral sPropCurrencySymbol(u"CurrencySymbol");
@@ -972,8 +969,8 @@ try
         if ( rOldProp.Name != "DefaultControl" && rOldProp.Name != 
"LabelControl" )
         {
             // binary search
-            Property* pResult = std::lower_bound(
-                pNewProps, pNewProps + nNewLen, rOldProp, 
::comphelper::PropertyCompareByName());
+            const Property* pResult = std::lower_bound(
+                aNewProperties.begin(), aNewProperties.end(), rOldProp, 
::comphelper::PropertyCompareByName());
 
             if (   ( pResult != aNewProperties.end() )
                 && ( pResult->Name == rOldProp.Name )
diff --git a/connectivity/source/drivers/jdbc/JStatement.cxx 
b/connectivity/source/drivers/jdbc/JStatement.cxx
index da06ef77f2c3..df9d660f554c 100644
--- a/connectivity/source/drivers/jdbc/JStatement.cxx
+++ b/connectivity/source/drivers/jdbc/JStatement.cxx
@@ -124,7 +124,7 @@ Sequence< Type > SAL_CALL 
java_sql_Statement_Base::getTypes(  )
     Sequence< Type > aOldTypes = java_sql_Statement_BASE::getTypes();
     if ( m_pConnection.is() && !m_pConnection->isAutoRetrievingEnabled() )
     {
-        auto [begin, end] = toNonConstRange(aOldTypes);
+        auto [begin, end] = asNonConstRange(aOldTypes);
         auto newEnd = std::remove(begin, end,
                                   cppu::UnoType<XGeneratedResultSet>::get());
         aOldTypes.realloc(std::distance(begin, newEnd));
diff --git a/connectivity/source/drivers/odbc/OStatement.cxx 
b/connectivity/source/drivers/odbc/OStatement.cxx
index 13ffeda8e4ba..d44f86e58469 100644
--- a/connectivity/source/drivers/odbc/OStatement.cxx
+++ b/connectivity/source/drivers/odbc/OStatement.cxx
@@ -131,7 +131,7 @@ Sequence< Type > SAL_CALL OStatement_Base::getTypes(  )
     Sequence< Type > aOldTypes = OStatement_BASE::getTypes();
     if ( m_pConnection.is() && !m_pConnection->isAutoRetrievingEnabled() )
     {
-        auto [begin, end] = toNonConstRange(aOldTypes);
+        auto [begin, end] = asNonConstRange(aOldTypes);
         auto newEnd = std::remove(begin, end,
                                   cppu::UnoType<XGeneratedResultSet>::get());
         aOldTypes.realloc(std::distance(begin, newEnd));
diff --git a/connectivity/source/sdbcx/VDescriptor.cxx 
b/connectivity/source/sdbcx/VDescriptor.cxx
index 2392e2d5f1d2..7800aaf075be 100644
--- a/connectivity/source/sdbcx/VDescriptor.cxx
+++ b/connectivity/source/sdbcx/VDescriptor.cxx
@@ -74,7 +74,7 @@ namespace connectivity::sdbcx
             Sequence< Property > aProperties;
             describeProperties( aProperties );
 
-            auto [begin, end] = toNonConstRange(aProperties);
+            auto [begin, end] = asNonConstRange(aProperties);
             if ( isNew() )
                 std::for_each( begin, end, ResetROAttribute() );
             else
diff --git a/cppuhelper/source/factory.cxx b/cppuhelper/source/factory.cxx
index 09535a15690f..8768d9817ab7 100644
--- a/cppuhelper/source/factory.cxx
+++ b/cppuhelper/source/factory.cxx
@@ -773,7 +773,7 @@ Sequence< OUString > 
ORegistryFactoryHelper::getSupportedServiceNames()
 
                 // Full qualified names like 
"IMPLEMENTATIONS/TEST/UNO/SERVICES/com.sun.star..."
                 Sequence<OUString> seqKeys = xKey->getKeyNames();
-                for( OUString & key : toNonConstRange(seqKeys) )
+                for( OUString & key : asNonConstRange(seqKeys) )
                     key = key.copy(nPrefixLen);
 
                 aServiceNames = seqKeys;
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index eb7f4ce17c62..dbf17c120e4d 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -2057,7 +2057,7 @@ void ToolbarSaveInData::SetSystemStyle(
 
         if ( a >>= aProps )
         {
-            for ( beans::PropertyValue& prop : aProps )
+            for ( beans::PropertyValue& prop : asNonConstRange(aProps) )
             {
                 if ( prop.Name == ITEM_DESCRIPTOR_STYLE )
                 {
diff --git a/cui/source/dialogs/AdditionsDialog.cxx 
b/cui/source/dialogs/AdditionsDialog.cxx
index 8fcea1b99f0e..ac633177ef36 100644
--- a/cui/source/dialogs/AdditionsDialog.cxx
+++ b/cui/source/dialogs/AdditionsDialog.cxx
@@ -374,7 +374,7 @@ void SearchAndParseThread::Search()
 
 void SearchAndParseThread::CheckInstalledExtensions()
 {
-    uno::Sequence<uno::Sequence<uno::Reference<deployment::XPackage>>> 
xAllPackages
+    const uno::Sequence<uno::Sequence<uno::Reference<deployment::XPackage>>> 
xAllPackages
         = m_pAdditionsDialog->getInstalledExtensions();
 
     if (!xAllPackages.hasElements())
diff --git a/cui/source/options/optaboutconfig.cxx 
b/cui/source/options/optaboutconfig.cxx
index 39abfbedbadb..8a976277ca7c 100644
--- a/cui/source/options/optaboutconfig.cxx
+++ b/cui/source/options/optaboutconfig.cxx
@@ -352,7 +352,7 @@ void CuiAboutConfigTabPage::FillItems(const Reference< 
XNameAccess >& xNameAcces
                     }
                     else if( sType == "[]byte" )
                     {
-                        uno::Sequence<sal_Int8> seq = aNode.get< 
uno::Sequence<sal_Int8> >();
+                        const uno::Sequence<sal_Int8> seq = aNode.get< 
uno::Sequence<sal_Int8> >();
                         for( sal_Int8 j : seq )
                         {
                             OUString s = OUString::number(
@@ -366,7 +366,7 @@ void CuiAboutConfigTabPage::FillItems(const Reference< 
XNameAccess >& xNameAcces
                     }
                     else if( sType == "[][]byte" )
                     {
-                        uno::Sequence< uno::Sequence<sal_Int8> > seq = 
aNode.get< uno::Sequence< uno::Sequence<sal_Int8> > >();
+                        const uno::Sequence< uno::Sequence<sal_Int8> > seq = 
aNode.get< uno::Sequence< uno::Sequence<sal_Int8> > >();
                         for( sal_Int32 j = 0; j != seq.getLength(); ++j )
                         {
                             if( j != 0 )
diff --git a/cui/source/options/optgenrl.cxx b/cui/source/options/optgenrl.cxx
index df31ee10522d..9c657176527f 100644
--- a/cui/source/options/optgenrl.cxx
+++ b/cui/source/options/optgenrl.cxx
@@ -302,7 +302,7 @@ void SvxGeneralTabPage::InitCryptography()
 
             if (xCertificates.hasElements())
             {
-                for (auto& xCert : xCertificates)
+                for (auto& xCert : asNonConstRange(xCertificates))
                 {
                     m_xSigningKeyLB->append_text( xCert->getIssuerName());
                     m_xEncryptionKeyLB->append_text( xCert->getIssuerName());
diff --git a/dbaccess/source/core/api/TableDeco.cxx 
b/dbaccess/source/core/api/TableDeco.cxx
index f40593b8598d..1448c657abd4 100644
--- a/dbaccess/source/core/api/TableDeco.cxx
+++ b/dbaccess/source/core/api/TableDeco.cxx
@@ -310,7 +310,7 @@ void ODBTableDecorator::construct()
     Reference<XPropertySetInfo> xInfo = xProp->getPropertySetInfo();
 
     Sequence< Property > aTableProps = xInfo->getProperties();
-    for (Property & prop : aTableProps)
+    for (Property & prop : asNonConstRange(aTableProps))
     {
         if (prop.Name == PROPERTY_CATALOGNAME)
             prop.Handle = PROPERTY_ID_CATALOGNAME;
diff --git a/dbaccess/source/core/api/definitioncolumn.cxx 
b/dbaccess/source/core/api/definitioncolumn.cxx
index 7854a97f1816..beff8adf7f03 100644
--- a/dbaccess/source/core/api/definitioncolumn.cxx
+++ b/dbaccess/source/core/api/definitioncolumn.cxx
@@ -487,7 +487,7 @@ Sequence< OUString > 
OTableColumnDescriptorWrapper::getSupportedServiceNames(  )
 
     if ( !m_bIsDescriptor )
     {
-        for ( auto & prop : aDescriptor )
+        for ( auto & prop : asNonConstRange(aDescriptor) )
         {
             prop.Attributes |= PropertyAttribute::READONLY;
         }
diff --git a/dbaccess/source/core/api/table.cxx 
b/dbaccess/source/core/api/table.cxx
index f11008555ca9..b4b6e47cd57d 100644
--- a/dbaccess/source/core/api/table.cxx
+++ b/dbaccess/source/core/api/table.cxx
@@ -211,7 +211,7 @@ void ODBTable::construct()
     describeProperties(aProps);
     if(!_nId)
     {
-        for(Property & prop : aProps)
+        for(Property & prop : asNonConstRange(aProps))
         {
             if (prop.Name == PROPERTY_CATALOGNAME)
                 prop.Attributes = PropertyAttribute::READONLY;
diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx 
b/dbaccess/source/core/dataaccess/databasedocument.cxx
index e9867def1b99..c38dc9429cfc 100644
--- a/dbaccess/source/core/dataaccess/databasedocument.cxx
+++ b/dbaccess/source/core/dataaccess/databasedocument.cxx
@@ -223,7 +223,7 @@ Sequence< Type > SAL_CALL ODatabaseDocument::getTypes(  )
     // allowed to contain macros, too.
     if ( !m_bAllowDocumentScripting )
     {
-        auto [begin, end] = toNonConstRange(aTypes);
+        auto [begin, end] = asNonConstRange(aTypes);
         auto newEnd = std::remove_if( begin, end,
                                       [](const Type& t)
                                       { return t == 
cppu::UnoType<XEmbeddedScripts>::get() ||
diff --git a/dbaccess/source/core/dataaccess/datasource.cxx 
b/dbaccess/source/core/dataaccess/datasource.cxx
index 48039c3e6943..b36ac6ea67b6 100644
--- a/dbaccess/source/core/dataaccess/datasource.cxx
+++ b/dbaccess/source/core/dataaccess/datasource.cxx
@@ -866,7 +866,7 @@ sal_Bool ODatabaseSource::convertFastPropertyValue(Any & 
rConvertedValue, Any &
                 {
                     const PropertyValue* pInfoIter = aSettings.getConstArray();
                     const PropertyValue* checkValue = aValues.getConstArray();
-                    for ( ;!bModified && checkValue != aValues.end() ; 
++checkValue,++pInfoIter)
+                    for ( ;!bModified && checkValue != std::cend(aValues) ; 
++checkValue,++pInfoIter)
                     {
                         bModified = checkValue->Name != pInfoIter->Name;
                         if ( !bModified )
@@ -1046,7 +1046,7 @@ void ODatabaseSource::getFastPropertyValue( Any& rValue, 
sal_Int32 nHandle ) con
                 // transform them so that only property values which fulfill 
certain
                 // criteria survive
                 Sequence< PropertyValue > aNonDefaultOrUserDefined( 
aValues.getLength() );
-                auto [begin, end] = toNonConstRange(aValues);
+                auto [begin, end] = asNonConstRange(aValues);
                 auto pCopyStart = aNonDefaultOrUserDefined.getArray();
                 const PropertyValue* pCopyEnd = std::remove_copy_if(
                     begin,
diff --git a/dbaccess/source/filter/xml/xmlExport.cxx 
b/dbaccess/source/filter/xml/xmlExport.cxx
index e0c1304c8cc6..b2b6ae0ce395 100644
--- a/dbaccess/source/filter/xml/xmlExport.cxx
+++ b/dbaccess/source/filter/xml/xmlExport.cxx
@@ -595,7 +595,7 @@ template< typename T > void 
ODBExport::exportDataSourceSettingsSequence(
     css::uno::Sequence<T> anySeq;
     bool bSuccess = in->Value >>= anySeq;
     assert(bSuccess); (void)bSuccess;
-    for (T const & i : anySeq )
+    for (T const & i : std::as_const(anySeq) )
     {
         SvXMLElementExport aDataValue(*this,XML_NAMESPACE_DB, 
XML_DATA_SOURCE_SETTING_VALUE, true, false);
         // (no whitespace inside the tag)
diff --git a/dbaccess/source/ui/browser/formadapter.cxx 
b/dbaccess/source/ui/browser/formadapter.cxx
index 7a07f0a9d206..37f35a0472ee 100644
--- a/dbaccess/source/ui/browser/formadapter.cxx
+++ b/dbaccess/source/ui/browser/formadapter.cxx
@@ -1326,7 +1326,7 @@ Sequence< css::beans::PropertyState> SAL_CALL 
SbaXFormAdapter::getPropertyStates
 
     // set them all to DEFAULT
     Sequence< css::beans::PropertyState> aReturn(aPropertyName.getLength());
-    for (css::beans::PropertyState& rState : aReturn)
+    for (css::beans::PropertyState& rState : asNonConstRange(aReturn))
         rState = css::beans::PropertyState_DEFAULT_VALUE;
     return aReturn;
 }
diff --git a/dbaccess/source/ui/browser/sbamultiplex.cxx 
b/dbaccess/source/ui/browser/sbamultiplex.cxx
index 68673fd06ff2..f31b4c7ac27f 100644
--- a/dbaccess/source/ui/browser/sbamultiplex.cxx
+++ b/dbaccess/source/ui/browser/sbamultiplex.cxx
@@ -85,7 +85,7 @@ void SbaXPropertiesChangeMultiplexer::propertiesChange(const 
css::uno::Sequence<
     // forwards _all_ changes to _all_ listeners
 
     css::uno::Sequence< css::beans::PropertyChangeEvent> aMulti(aEvts);
-    for (css::beans::PropertyChangeEvent & rEvent : aMulti)
+    for (css::beans::PropertyChangeEvent & rEvent : asNonConstRange(aMulti))
         rEvent.Source = &m_rParent;
 
     ::comphelper::OInterfaceIteratorHelper2 aIt(*this);
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx 
b/dbaccess/source/ui/browser/unodatbr.cxx
index b6bf10274b8b..035a0e1ef8c2 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -214,7 +214,7 @@ Sequence< Type > SAL_CALL SbaTableQueryBrowser::getTypes(  )
     OSL_PRECOND( !!m_aDocScriptSupport, "SbaTableQueryBrowser::getTypes: did 
not initialize this, yet!" );
     if ( !m_aDocScriptSupport || !*m_aDocScriptSupport )
     {
-        auto [begin, end] = toNonConstRange(aTypes);
+        auto [begin, end] = asNonConstRange(aTypes);
         auto newEnd = std::remove_if( begin, end,
                                       [](const Type& type)
                                       { return type == 
cppu::UnoType<XScriptInvocationContext>::get(); } );
diff --git a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx 
b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
index 82ce80f71333..b77953316ec7 100644
--- a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
+++ b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
@@ -222,7 +222,7 @@ namespace dbaui
         Sequence< Type > aTypes( DBSubComponentController_Base::getTypes() );
         if ( !m_pImpl->documentHasScriptSupport() )
         {
-            auto [begin, end] = toNonConstRange(aTypes);
+            auto [begin, end] = asNonConstRange(aTypes);
             auto newEnd = std::remove_if( begin, end,
                                           [](const Type& type)
                                           { return type == 
cppu::UnoType<XScriptInvocationContext>::get(); } );
diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx 
b/dbaccess/source/ui/querydesign/querycontroller.cxx
index 4f7bd55bde1e..9500281a7275 100644
--- a/dbaccess/source/ui/querydesign/querycontroller.cxx
+++ b/dbaccess/source/ui/querydesign/querycontroller.cxx
@@ -288,7 +288,7 @@ void SAL_CALL OQueryController::getFastPropertyValue( Any& 
o_rValue, sal_Int32 i
         PropertyAttribute::READONLY
     );
 
-    auto [begin, end] = toNonConstRange(aProps);
+    auto [begin, end] = asNonConstRange(aProps);
     std::sort(
         begin,
         end,
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 1d9c482c8f14..63795517a812 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2548,7 +2548,7 @@ static bool lo_signDocument(LibreOfficeKit* /*pThis*/,
     else
     {
         aCertificateSequence.realloc(nCertificateBinarySize);
-        std::copy(pCertificateBinary, pCertificateBinary + 
nCertificateBinarySize, aCertificateSequence.begin());
+        std::copy(pCertificateBinary, pCertificateBinary + 
nCertificateBinarySize, aCertificateSequence.getArray());
     }
 
     uno::Sequence<sal_Int8> aPrivateKeySequence;
@@ -2562,7 +2562,7 @@ static bool lo_signDocument(LibreOfficeKit* /*pThis*/,
     else
     {
         aPrivateKeySequence.realloc(nPrivateKeyBinarySize);
-        std::copy(pPrivateKeyBinary, pPrivateKeyBinary + 
nPrivateKeyBinarySize, aPrivateKeySequence.begin());
+        std::copy(pPrivateKeyBinary, pPrivateKeyBinary + 
nPrivateKeyBinarySize, aPrivateKeySequence.getArray());
     }
 
     uno::Reference<xml::crypto::XSEInitializer> xSEInitializer = 
xml::crypto::SEInitializer::create(xContext);
@@ -5624,7 +5624,7 @@ static bool doc_insertCertificate(LibreOfficeKitDocument* 
pThis,
     else
     {
         aCertificateSequence.realloc(nCertificateBinarySize);
-        std::copy(pCertificateBinary, pCertificateBinary + 
nCertificateBinarySize, aCertificateSequence.begin());
+        std::copy(pCertificateBinary, pCertificateBinary + 
nCertificateBinarySize, aCertificateSequence.getArray());
     }
 
     uno::Sequence<sal_Int8> aPrivateKeySequence;
@@ -5638,7 +5638,7 @@ static bool doc_insertCertificate(LibreOfficeKitDocument* 
pThis,
     else
     {
         aPrivateKeySequence.realloc(nPrivateKeySize);
-        std::copy(pPrivateKeyBinary, pPrivateKeyBinary + nPrivateKeySize, 
aPrivateKeySequence.begin());
+        std::copy(pPrivateKeyBinary, pPrivateKeyBinary + nPrivateKeySize, 
aPrivateKeySequence.getArray());
     }
 
     uno::Reference<security::XCertificate> xCertificate = 
xCertificateCreator->createDERCertificateWithPrivateKey(aCertificateSequence, 
aPrivateKeySequence);
@@ -5696,7 +5696,7 @@ static bool doc_addCertificate(LibreOfficeKitDocument* 
pThis,
     else
     {
         aCertificateSequence.realloc(nCertificateBinarySize);
-        std::copy(pCertificateBinary, pCertificateBinary + 
nCertificateBinarySize, aCertificateSequence.begin());
+        std::copy(pCertificateBinary, pCertificateBinary + 
nCertificateBinarySize, aCertificateSequence.getArray());
     }
 
     uno::Reference<security::XCertificate> xCertificate = 
xCertificateCreator->addDERCertificateToTheDatabase(aCertificateSequence, 
"TCu,Cu,Tu");
@@ -6080,7 +6080,7 @@ static void preloadData()
     std::cerr << "Preloading dictionaries: ";
     css::uno::Reference<linguistic2::XSupportedLocales> 
xSpellLocales(xSpellChecker, css::uno::UNO_QUERY_THROW);
     uno::Sequence< css::lang::Locale > aLocales = xSpellLocales->getLocales();
-    for (auto &it : aLocales)
+    for (auto &it : std::as_const(aLocales))
     {
         std::cerr << LanguageTag::convertToBcp47(it) << " ";
         css::beans::PropertyValues aNone;
@@ -6101,7 +6101,7 @@ static void preloadData()
     css::uno::Reference<linguistic2::XSupportedLocales> 
xThesLocales(xSpellChecker, css::uno::UNO_QUERY_THROW);
     aLocales = xThesLocales->getLocales();
     std::cerr << "Preloading thesauri: ";
-    for (auto &it : aLocales)
+    for (auto &it : std::as_const(aLocales))
     {
         std::cerr << LanguageTag::convertToBcp47(it) << " ";
         css::beans::PropertyValues aNone;
diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx 
b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
index b2c672234137..79fb443c6d85 100644
--- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx
+++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
@@ -1229,7 +1229,7 @@ namespace accessibility
         // since SequenceAsHashMap ignores property handles and property state
         // we have to restore the property state here (property handles are
         // of no use to the accessibility API).
-        for (beans::PropertyValue & rRes : aRes)
+        for (beans::PropertyValue & rRes : asNonConstRange(aRes))
         {
             bool bIsDirectVal = false;
             for (auto const& rRunAttrib : aRunAttribs)
diff --git a/embeddedobj/source/commonembedding/embedobj.cxx 
b/embeddedobj/source/commonembedding/embedobj.cxx
index 933ddb60a3db..0b1154394651 100644
--- a/embeddedobj/source/commonembedding/embedobj.cxx
+++ b/embeddedobj/source/commonembedding/embedobj.cxx
@@ -453,7 +453,7 @@ void SAL_CALL OCommonEmbeddedObject::changeState( sal_Int32 
nNewState )
         StateChangeNotification_Impl( true, nOldState, nNewState,aGuard );
 
         try {
-            for ( sal_Int32 state : aIntermediateStates )
+            for ( sal_Int32 state : std::as_const(aIntermediateStates) )
                 SwitchStateTo_Impl( state );
 
             SwitchStateTo_Impl( nNewState );
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx 
b/extensions/source/propctrlr/formcomponenthandler.cxx
index a005a33e7019..bf3feb4acb1a 100644
--- a/extensions/source/propctrlr/formcomponenthandler.cxx
+++ b/extensions/source/propctrlr/formcomponenthandler.cxx
@@ -814,7 +814,7 @@ namespace pcr
         PropertyId nPropId( 0 );
         OUString sDisplayName;
 
-        for ( Property & rProperty : aAllProperties )
+        for ( Property & rProperty : asNonConstRange(aAllProperties) )
         {
             nPropId = m_pInfoService->getPropertyId( rProperty.Name );
             if ( nPropId == -1 )
diff --git a/extensions/source/propctrlr/stringrepresentation.cxx 
b/extensions/source/propctrlr/stringrepresentation.cxx
index 073cbbedd130..da468e5b51ef 100644
--- a/extensions/source/propctrlr/stringrepresentation.cxx
+++ b/extensions/source/propctrlr/stringrepresentation.cxx
@@ -255,7 +255,7 @@ void SAL_CALL StringRepresentation::initialize(const 
uno::Sequence< uno::Any > &
     uno::Sequence<
         uno::Reference< reflection::XConstantTypeDescription > >
         cs(m_xTypeDescription->getConstants());
-    auto [begin, end] = toNonConstRange(cs);
+    auto [begin, end] = asNonConstRange(cs);
     std::sort(begin, end, CompareConstants());
     m_aConstants = cs;
 }
diff --git a/filter/source/pdf/pdffilter.cxx b/filter/source/pdf/pdffilter.cxx
index 4d8580420670..8c115b1018b5 100644
--- a/filter/source/pdf/pdffilter.cxx
+++ b/filter/source/pdf/pdffilter.cxx
@@ -132,7 +132,7 @@ bool PDFFilter::implExport( const Sequence< PropertyValue 
>& rDescriptor )
     {
         bool bFound = false;
 
-        for (PropertyValue& rProp : aFilterData)
+        for (PropertyValue& rProp : asNonConstRange(aFilterData))
         {
             if (rProp.Name == "IsRedactMode")
             {
diff --git a/forms/source/misc/InterfaceContainer.cxx 
b/forms/source/misc/InterfaceContainer.cxx
index 837baa838dab..61d1265aa4be 100644
--- a/forms/source/misc/InterfaceContainer.cxx
+++ b/forms/source/misc/InterfaceContainer.cxx
@@ -394,7 +394,7 @@ void OInterfaceContainer::transformEvents()
             if ( aChildEvents.hasElements() )
             {
                 // do the transformation
-                auto [begin, end] = toNonConstRange(aChildEvents);
+                auto [begin, end] = asNonConstRange(aChildEvents);
                 ::std::for_each( begin, end, TransformEventTo52Format() );
 
                 // revoke the script events
diff --git a/framework/source/fwe/classes/addonsoptions.cxx 
b/framework/source/fwe/classes/addonsoptions.cxx
index 6ef5f46f440c..cd638a979522 100644
--- a/framework/source/fwe/classes/addonsoptions.cxx
+++ b/framework/source/fwe/classes/addonsoptions.cxx
@@ -997,7 +997,7 @@ void AddonsOptions_Impl::ReadMergeMenuData( 
std::u16string_view aMergeAddonInstr
     aMergeMenuBaseNode += m_aPathDelimiter;
 
     // extend the node names to have full path strings
-    for ( OUString& rName : aSubMenuNodeNames )
+    for ( OUString& rName : asNonConstRange(aSubMenuNodeNames) )
         rName = aMergeMenuBaseNode + rName;
 
     ReadSubMenuEntries( aSubMenuNodeNames, rMergeMenu );
@@ -1302,7 +1302,7 @@ bool AddonsOptions_Impl::ReadMenuItem( 
std::u16string_view aMenuNodeName, Sequen
             // Continue to read the sub menu nodes
             Sequence< Sequence< PropertyValue > > aSubMenuSeq;
             OUString aSubMenuRootNodeName( aRootSubMenuName + m_aPathDelimiter 
);
-            for ( OUString& rName : aRootSubMenuNodeNames )
+            for ( OUString& rName : asNonConstRange(aRootSubMenuNodeNames) )
                 rName = aSubMenuRootNodeName + rName;
             ReadSubMenuEntries( aRootSubMenuNodeNames, aSubMenuSeq );
             aMenuItem[ OFFSET_MENUITEM_SUBMENU ].Value <<= aSubMenuSeq;
@@ -1366,7 +1366,7 @@ bool AddonsOptions_Impl::ReadPopupMenu( 
std::u16string_view aPopupMenuNodeName,
             // Continue to read the sub menu nodes
             Sequence< Sequence< PropertyValue > > aSubMenuSeq;
             OUString aSubMenuRootNodeName( aRootSubMenuName + m_aPathDelimiter 
);
-            for ( OUString& rName : aRootSubMenuNodeNames )
+            for ( OUString& rName : asNonConstRange(aRootSubMenuNodeNames) )
                 rName = aSubMenuRootNodeName + rName;
             ReadSubMenuEntries( aRootSubMenuNodeNames, aSubMenuSeq );
             aPopupMenu[ OFFSET_POPUPMENU_SUBMENU ].Value <<= aSubMenuSeq;
diff --git a/i18npool/source/calendar/calendarImpl.cxx 
b/i18npool/source/calendar/calendarImpl.cxx
index c3ac0d54460a..4e364696cf20 100644
--- a/i18npool/source/calendar/calendarImpl.cxx
+++ b/i18npool/source/calendar/calendarImpl.cxx
@@ -139,7 +139,7 @@ CalendarImpl::getAllCalendars( const css::lang::Locale& 
rLocale )
 {
     const Sequence< Calendar2 > xC = 
LocaleDataImpl::get()->getAllCalendars2(rLocale);
     Sequence< OUString > xSeq( xC.getLength() );
-    std::transform(xC.begin(), xC.end(), xSeq.begin(),
+    std::transform(xC.begin(), xC.end(), xSeq.getArray(),
         [](const Calendar2& rCal) { return rCal.Name; });
     return xSeq;
 }
diff --git a/i18npool/source/collator/collatorImpl.cxx 
b/i18npool/source/collator/collatorImpl.cxx
index 56fb4bf90502..fff944d6ff7e 100644
--- a/i18npool/source/collator/collatorImpl.cxx
+++ b/i18npool/source/collator/collatorImpl.cxx
@@ -107,7 +107,7 @@ CollatorImpl::listCollatorAlgorithms( const lang::Locale& 
rLocale )
     nLocale = rLocale;
     const Sequence< Implementation > &imp = 
mxLocaleData->getCollatorImplementations(rLocale);
     Sequence< OUString > list(imp.getLength());
-    auto pBegin = list.begin();
+    auto pBegin = list.getArray();
     auto pId = pBegin;
 
     for (const auto& rImpl : imp) {
@@ -126,7 +126,7 @@ CollatorImpl::listCollatorOptions( const OUString& 
/*collatorAlgorithmName*/ )
     const Sequence< OUString > option_str = 
mxLocaleData->getCollationOptions(nLocale);
     Sequence< sal_Int32 > option_int(option_str.getLength());
 
-    std::transform(option_str.begin(), option_str.end(), option_int.begin(), 
[](const OUString& rOpt) {
+    std::transform(option_str.begin(), option_str.end(), 
option_int.getArray(), [](const OUString& rOpt) {
         return rOpt == "IGNORE_CASE" ?  
CollatorOptions::CollatorOptions_IGNORE_CASE :
                rOpt == "IGNORE_KANA" ?  
CollatorOptions::CollatorOptions_IGNORE_KANA :
                rOpt == "IGNORE_WIDTH" ?  
CollatorOptions::CollatorOptions_IGNORE_WIDTH : 0; });
diff --git a/i18npool/source/localedata/localedata.cxx 
b/i18npool/source/localedata/localedata.cxx
index 3dc113fe7eed..145b576f16fc 100644
--- a/i18npool/source/localedata/localedata.cxx
+++ b/i18npool/source/localedata/localedata.cxx
@@ -719,7 +719,7 @@ Sequence< CalendarItem2 > LocaleDataImpl::getCalendarItems(
             case REF_MONTHS:
             case REF_GMONTHS:
             case REF_PMONTHS:
-                for (CalendarItem2& rItem : aItems)
+                for (CalendarItem2& rItem : asNonConstRange(aItems))
                 {
                     rItem = CalendarItem2{ OUString(allCalendars[rnOffset]),
                             OUString(allCalendars[rnOffset+1]),
@@ -729,7 +729,7 @@ Sequence< CalendarItem2 > LocaleDataImpl::getCalendarItems(
                 break;
             case REF_ERAS:
                 // Absent narrow name.
-                for (CalendarItem2& rItem : aItems)
+                for (CalendarItem2& rItem : asNonConstRange(aItems))
                 {
                     rItem = CalendarItem2{ OUString(allCalendars[rnOffset]),
                             OUString(allCalendars[rnOffset+1]),
@@ -1260,7 +1260,7 @@ LocaleDataImpl::getContinuousNumberingLevels( const 
lang::Locale& rLocale )
 
         // allocate memory for nAttributes attributes for each of the nStyles 
styles.
         Sequence< Sequence<beans::PropertyValue> > pv( nStyles );
-        for( auto& i : pv ) {
+        for( auto& i : asNonConstRange(pv) ) {
             i = Sequence<beans::PropertyValue>( nAttributes );
         }
 
diff --git a/i18npool/source/transliteration/ignoreIandEfollowedByYa_ja_JP.cxx 
b/i18npool/source/transliteration/ignoreIandEfollowedByYa_ja_JP.cxx
index 5a071a3887fa..5e8659027992 100644
--- a/i18npool/source/transliteration/ignoreIandEfollowedByYa_ja_JP.cxx
+++ b/i18npool/source/transliteration/ignoreIandEfollowedByYa_ja_JP.cxx
@@ -77,7 +77,7 @@ ignoreIandEfollowedByYa_ja_JP::foldingImpl( const OUString& 
inStr, sal_Int32 sta
     if (pOffset) {
         // Allocate nCount length to offset argument.
         pOffset->realloc( nCount );
-        auto [begin, end] = toNonConstRange(*pOffset);
+        auto [begin, end] = asNonConstRange(*pOffset);
         std::iota(begin, end, startPos);
     }
 
diff --git a/i18npool/source/transliteration/ignoreIterationMark_ja_JP.cxx 
b/i18npool/source/transliteration/ignoreIterationMark_ja_JP.cxx
index bdee0d87d6fa..c5a3cb04565c 100644
--- a/i18npool/source/transliteration/ignoreIterationMark_ja_JP.cxx
+++ b/i18npool/source/transliteration/ignoreIterationMark_ja_JP.cxx
@@ -95,7 +95,7 @@ ignoreIterationMark_ja_JP::foldingImpl( const OUString& 
inStr, sal_Int32 startPo
     if (pOffset) {
         // Allocate nCount length to offset argument.
         pOffset->realloc( nCount );
-        auto [begin, end] = toNonConstRange(*pOffset);
+        auto [begin, end] = asNonConstRange(*pOffset);
         std::iota(begin, end, startPos);
     }
 
diff --git a/i18npool/source/transliteration/ignoreKiKuFollowedBySa_ja_JP.cxx 
b/i18npool/source/transliteration/ignoreKiKuFollowedBySa_ja_JP.cxx
index 1c64d65104d9..113c80f9aeeb 100644
--- a/i18npool/source/transliteration/ignoreKiKuFollowedBySa_ja_JP.cxx
+++ b/i18npool/source/transliteration/ignoreKiKuFollowedBySa_ja_JP.cxx
@@ -38,7 +38,7 @@ ignoreKiKuFollowedBySa_ja_JP::foldingImpl( const OUString& 
inStr, sal_Int32 star
     if (pOffset) {
         // Allocate nCount length to offset argument.
         pOffset->realloc( nCount );
-        auto [begin, end] = toNonConstRange(*pOffset);
+        auto [begin, end] = asNonConstRange(*pOffset);
         std::iota(begin, end, startPos);
     }
 
diff --git a/i18npool/source/transliteration/ignoreProlongedSoundMark_ja_JP.cxx 
b/i18npool/source/transliteration/ignoreProlongedSoundMark_ja_JP.cxx
index fc87d206dc3e..3291afa9ba7d 100644
--- a/i18npool/source/transliteration/ignoreProlongedSoundMark_ja_JP.cxx
+++ b/i18npool/source/transliteration/ignoreProlongedSoundMark_ja_JP.cxx
@@ -300,7 +300,7 @@ ignoreProlongedSoundMark_ja_JP::foldingImpl( const 
OUString& inStr, sal_Int32 st
     if (pOffset) {
         // Allocate nCount length to offset argument.
         pOffset->realloc( nCount );
-        auto [begin, end] = toNonConstRange(*pOffset);
+        auto [begin, end] = asNonConstRange(*pOffset);
         std::iota(begin, end, startPos);
     }
 
diff --git a/i18npool/source/transliteration/transliterationImpl.cxx 
b/i18npool/source/transliteration/transliterationImpl.cxx
index 4a1e2eab6147..55236ec3dfa9 100644
--- a/i18npool/source/transliteration/transliterationImpl.cxx
+++ b/i18npool/source/transliteration/transliterationImpl.cxx
@@ -306,7 +306,7 @@ TransliterationImpl::transliterate( const OUString& inStr, 
sal_Int32 startPos, s
             tmpStr = bodyCascade[0]->transliterate(tmpStr, 0, nCount, offset);
             if ( startPos )
             {
-                for (sal_Int32 & j : toNonConstRange(offset))
+                for (sal_Int32 & j : asNonConstRange(offset))
                     j += startPos;
             }
             return tmpStr;
@@ -316,7 +316,7 @@ TransliterationImpl::transliterate( const OUString& inStr, 
sal_Int32 startPos, s
     {
         OUString tmpStr = inStr.copy(startPos, nCount);
 
-        auto [begin, end] = toNonConstRange(offset);
+        auto [begin, end] = asNonConstRange(offset);
         std::iota(begin, end, startPos);
 
         Sequence<sal_Int32> from(nCount);
@@ -328,7 +328,7 @@ TransliterationImpl::transliterate( const OUString& inStr, 
sal_Int32 startPos, s
 
             assert(from.getLength() == nCount);
             from.swap(to);
-            for (sal_Int32& ix : toNonConstRange(to))
+            for (sal_Int32& ix : asNonConstRange(to))
                 ix = std::as_const(from)[ix];
         }
         offset = to;
@@ -356,7 +356,7 @@ TransliterationImpl::folding( const OUString& inStr, 
sal_Int32 startPos, sal_Int
             tmpStr = bodyCascade[0]->folding(tmpStr, 0, nCount, offset);
             if ( startPos )
             {
-                for (sal_Int32 & j : offset)
+                for (sal_Int32 & j : asNonConstRange(offset))
                     j += startPos;
             }
             return tmpStr;
@@ -366,7 +366,7 @@ TransliterationImpl::folding( const OUString& inStr, 
sal_Int32 startPos, sal_Int
     {
         OUString tmpStr = inStr.copy(startPos, nCount);
 
-        auto [begin, end] = toNonConstRange(offset);
+        auto [begin, end] = asNonConstRange(offset);
         std::iota(begin, end, startPos);
 
         sal_Int16 from = 0, to = 1;
diff --git a/i18npool/source/transliteration/transliteration_OneToOne.cxx 
b/i18npool/source/transliteration/transliteration_OneToOne.cxx
index 34f4902f79bb..233f3dfe7051 100644
--- a/i18npool/source/transliteration/transliteration_OneToOne.cxx
+++ b/i18npool/source/transliteration/transliteration_OneToOne.cxx
@@ -68,7 +68,7 @@ transliteration_OneToOne::transliterateImpl( const OUString& 
inStr, sal_Int32 st
     // Allocate nCount length to offset argument.
     if (pOffset) {
         pOffset->realloc( nCount );
-        auto [begin, end] = toNonConstRange(*pOffset);
+        auto [begin, end] = asNonConstRange(*pOffset);
         std::iota(begin, end, startPos);
     }
 
diff --git a/i18npool/source/transliteration/transliteration_body.cxx 
b/i18npool/source/transliteration/transliteration_body.cxx
index b0c710c6c696..a64c8050bb79 100644
--- a/i18npool/source/transliteration/transliteration_body.cxx
+++ b/i18npool/source/transliteration/transliteration_body.cxx
@@ -260,7 +260,7 @@ static OUString transliterate_titlecase_Impl(
                xCharClassImpl->toLower( aText, 1, aText.getLength() - 1, 
rLocale );
         pOffset->realloc( aRes.getLength() );
 
-        auto [begin, end] = toNonConstRange(*pOffset);
+        auto [begin, end] = asNonConstRange(*pOffset);
         sal_Int32* pOffsetInt = std::fill_n(begin, nResolvedLen, 0);
         std::iota(pOffsetInt, end, 1);
     }
diff --git a/include/com/sun/star/uno/Sequence.h 
b/include/com/sun/star/uno/Sequence.h
index 39caf8ff768f..cc2c515f1322 100644
--- a/include/com/sun/star/uno/Sequence.h
+++ b/include/com/sun/star/uno/Sequence.h
@@ -185,12 +185,14 @@ public:
     */
     inline E * SAL_CALL getArray();
 
+#if !defined LIBO_INTERNAL_ONLY
     /** This function allows to use Sequence in standard algorithms, like 
std::find
         and others.
 
         @since LibreOffice 4.2
     */
     inline E * begin();
+#endif
 
     /** This function allows to use Sequence in standard algorithms, like 
std::find
         and others.
@@ -199,12 +201,14 @@ public:
     */
     inline E const * begin() const;
 
+#if !defined LIBO_INTERNAL_ONLY
     /** This function allows to use Sequence in standard algorithms, like 
std::find
         and others.
 
         @since LibreOffice 4.2
     */
     inline E * end();
+#endif
 
     /** This function allows to use Sequence in standard algorithms, like 
std::find
         and others.
diff --git a/include/com/sun/star/uno/Sequence.hxx 
b/include/com/sun/star/uno/Sequence.hxx
index 08a74d73789f..5356872b1378 100644
--- a/include/com/sun/star/uno/Sequence.hxx
+++ b/include/com/sun/star/uno/Sequence.hxx
@@ -166,12 +166,16 @@ inline E * Sequence< E >::getArray()
     return reinterpret_cast< E * >( _pSequence->elements );
 }
 
+#if !defined LIBO_INTERNAL_ONLY
 template<class E> E * Sequence<E>::begin() { return getArray(); }
+#endif
 
 template<class E> E const * Sequence<E>::begin() const
 { return getConstArray(); }
 
+#if !defined LIBO_INTERNAL_ONLY
 template<class E> E * Sequence<E>::end() { return begin() + getLength(); }
+#endif
 
 template<class E> E const * Sequence<E>::end() const
 { return begin() + getLength(); }
@@ -279,7 +283,7 @@ inline std::basic_ostream<charT, traits> 
&operator<<(std::basic_ostream<charT, t
     return os;
 }
 
-template <class E> inline auto toNonConstRange(css::uno::Sequence<E>& s)
+template <class E> inline auto asNonConstRange(css::uno::Sequence<E>& s)
 {
     // Two iterators [begin, end] representing the non-const range of the 
Sequence.
     // It only calls Sequence::getArray once, to avoid the second COW overhead 
when
@@ -292,7 +296,7 @@ template <class E> inline auto 
toNonConstRange(css::uno::Sequence<E>& s)
         E* begin() { return std::pair<E*, E*>::first; }
         E* end() { return std::pair<E*, E*>::second; }
     };
-    return SequenceRange(s.begin(), s.getLength());
+    return SequenceRange(s.getArray(), s.getLength());
 };
 
 /// @endcond
diff --git a/include/comphelper/basicio.hxx b/include/comphelper/basicio.hxx
index 96e185d78838..62260e3da360 100644
--- a/include/comphelper/basicio.hxx
+++ b/include/comphelper/basicio.hxx
@@ -65,7 +65,7 @@ template <class ELEMENT>
 const css::uno::Reference<css::io::XObjectInputStream>& operator >> (const 
css::uno::Reference<css::io::XObjectInputStream>& _rxInStream, 
css::uno::Sequence<ELEMENT>& _rSeq)
 {
     _rSeq.realloc(_rxInStream->readLong());
-    for (ELEMENT& rElement : _rSeq)
+    for (ELEMENT& rElement : asNonConstRange(_rSeq))
         _rxInStream >> rElement;
     return _rxInStream;
 }
diff --git a/include/comphelper/propertysequence.hxx 
b/include/comphelper/propertysequence.hxx
index 3f9838f9ab8f..2c143aa9ed7a 100644
--- a/include/comphelper/propertysequence.hxx
+++ b/include/comphelper/propertysequence.hxx
@@ -24,7 +24,7 @@ namespace comphelper
         ::std::initializer_list< ::std::pair< OUString, css::uno::Any > > 
vInit)
     {
         css::uno::Sequence< css::beans::PropertyValue> 
vResult{static_cast<sal_Int32>(vInit.size())};
-        std::transform(vInit.begin(), vInit.end(), vResult.begin(),
+        std::transform(vInit.begin(), vInit.end(), vResult.getArray(),
                        [](const std::pair<OUString, css::uno::Any>& rInit) {
                            return css::beans::PropertyValue(rInit.first, -1, 
rInit.second,
                                                             
css::beans::PropertyState_DIRECT_VALUE);
@@ -40,7 +40,7 @@ namespace comphelper
         ::std::initializer_list< ::std::pair< OUString, css::uno::Any > > 
vInit)
     {
         css::uno::Sequence<css::uno::Any> 
vResult{static_cast<sal_Int32>(vInit.size())};
-        std::transform(vInit.begin(), vInit.end(), vResult.begin(),
+        std::transform(vInit.begin(), vInit.end(), vResult.getArray(),
                        [](const std::pair<OUString, css::uno::Any>& rInit) {
                            return css::uno::Any(
                                css::beans::PropertyValue(rInit.first, -1, 
rInit.second,
diff --git a/include/comphelper/sequence.hxx b/include/comphelper/sequence.hxx
index 18e269173627..7c999ec25059 100644
--- a/include/comphelper/sequence.hxx
+++ b/include/comphelper/sequence.hxx
@@ -50,7 +50,7 @@ namespace comphelper
     {
         // unary fold to disallow empty parameter pack: at least have one 
sequence in rSn
         css::uno::Sequence<T> aReturn(std::size(rS1) + (... + std::size(rSn)));
-        T* pReturn = std::copy(std::begin(rS1), std::end(rS1), 
aReturn.begin());
+        T* pReturn = std::copy(std::begin(rS1), std::end(rS1), 
aReturn.getArray());
         (..., (pReturn = std::copy(std::begin(rSn), std::end(rSn), pReturn)));
         return aReturn;
     }
diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index 278e7942828b..2ae09ee4d16e 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -1145,7 +1145,7 @@ void LngSvcMgr::SetCfgServiceLists( 
SpellCheckerDispatcher &rSpellDsp )
 
     // append path prefix need for 'GetProperties' call below
     OUString aPrefix = aNode + "/";
-    for (OUString & name : aNames)
+    for (OUString & name : asNonConstRange(aNames))
     {
         name = aPrefix + name;
     }
@@ -1178,7 +1178,7 @@ void LngSvcMgr::SetCfgServiceLists( 
GrammarCheckingIterator &rGrammarDsp )
 
     // append path prefix need for 'GetProperties' call below
     OUString aPrefix = aNode  + "/";
-    for (OUString & name : aNames)
+    for (OUString & name : asNonConstRange(aNames))
     {
         name = aPrefix + name;
     }
@@ -1215,7 +1215,7 @@ void LngSvcMgr::SetCfgServiceLists( HyphenatorDispatcher 
&rHyphDsp )
 
     // append path prefix need for 'GetProperties' call below
     OUString aPrefix = aNode + "/";
-    for (OUString & name : aNames)
+    for (OUString & name : asNonConstRange(aNames))
     {
         name = aPrefix + name;
     }
@@ -1252,7 +1252,7 @@ void LngSvcMgr::SetCfgServiceLists( ThesaurusDispatcher 
&rThesDsp )
 
     // append path prefix need for 'GetProperties' call below
     OUString aPrefix = aNode + "/";
-    for (OUString & name : aNames)
+    for (OUString & name : asNonConstRange(aNames))
     {
         name = aPrefix + name;
     }
diff --git a/oox/source/drawingml/customshapeproperties.cxx 
b/oox/source/drawingml/customshapeproperties.cxx
index 1066b67aac76..62bc860ee7b2 100644
--- a/oox/source/drawingml/customshapeproperties.cxx
+++ b/oox/source/drawingml/customshapeproperties.cxx
@@ -180,7 +180,7 @@ void CustomShapeProperties::pushToPropSet(
             static const OUStringLiteral sType = u"Type";
             if ( aGeoPropSet >>= aGeoPropSeq )
             {
-                for ( auto& rGeoProp : aGeoPropSeq )
+                for ( auto& rGeoProp : asNonConstRange(aGeoPropSeq) )
                 {
                     if ( rGeoProp.Name == sAdjustmentValues )
                     {
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index 32736e67fad0..e78ca42af24f 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -702,7 +702,7 @@ Sequence< Sequence< OUString > > 
ChartExport::getSplitCategoriesList( const OUSt
                             //sort the categories name
                             Sequence<Sequence<OUString>> 
aFinalSplitSource(aCategories.getLength());
                             std::transform(aCategories.begin(), 
aCategories.end(),
-                                std::reverse_iterator(aFinalSplitSource.end()),
+                                
std::reverse_iterator(asNonConstRange(aFinalSplitSource).end()),
                                 [](const 
Reference<chart2::data::XLabeledDataSequence>& xCat) {
                                     return 
lcl_getLabelSequence(xCat->getValues()); });
                             return aFinalSplitSource;
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 4326ce2fa01d..6b05b15546cc 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -4471,7 +4471,7 @@ void DrawingML::WriteShapeEffects( const Reference< 
XPropertySet >& rXPropSet )
     }
     else
     {
-        for( auto& rOuterShdwProp : aOuterShdwProps )
+        for( auto& rOuterShdwProp : asNonConstRange(aOuterShdwProps) )
         {
             if( rOuterShdwProp.Name == "Attribs" )
             {
@@ -4485,7 +4485,7 @@ void DrawingML::WriteShapeEffects( const Reference< 
XPropertySet >& rXPropSet )
                 rXPropSet->getPropertyValue( "ShadowBlur" ) >>= nBlur;
 
 
-                for( auto& rAttribsProp : aAttribsProps )
+                for( auto& rAttribsProp : asNonConstRange(aAttribsProps) )
                 {
                     if( rAttribsProp.Name == "dist" )
                     {
diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx
index 94f87a772c00..72c967d103c4 100644
--- a/oox/source/vml/vmlformatting.cxx
+++ b/oox/source/vml/vmlformatting.cxx
@@ -927,7 +927,7 @@ void TextpathModel::pushToPropMap(ShapePropertyMap& 
rPropMap, const uno::Referen
         uno::Reference<beans::XPropertySet> xPropertySet(xShape, 
uno::UNO_QUERY);
         uno::Sequence<beans::PropertyValue> aGeomPropSeq = 
xPropertySet->getPropertyValue("CustomShapeGeometry").get< 
uno::Sequence<beans::PropertyValue> >();
         bool bFound = false;
-        for (beans::PropertyValue& rProp : aGeomPropSeq)
+        for (beans::PropertyValue& rProp : asNonConstRange(aGeomPropSeq))
         {
             if (rProp.Name == "TextPath")
             {
diff --git a/package/source/xstor/owriteablestream.cxx 
b/package/source/xstor/owriteablestream.cxx
index f821fd2494c8..c91996d0756c 100644
--- a/package/source/xstor/owriteablestream.cxx
+++ b/package/source/xstor/owriteablestream.cxx
@@ -423,7 +423,7 @@ void OWriteStream_Impl::SetDecrypted()
     m_bHasCachedEncryptionData = false;
     m_aEncryptionData.clear();
 
-    for ( auto& rProp : m_aProps )
+    for ( auto& rProp : asNonConstRange(m_aProps) )
     {
         if ( rProp.Name == "Encrypted" )
             rProp.Value <<= false;
@@ -446,7 +446,7 @@ void OWriteStream_Impl::SetEncrypted( const 
::comphelper::SequenceAsHashMap& aEn
     m_bHasDataToFlush = true;
 
     // introduce encryption info
-    for ( auto& rProp : m_aProps )
+    for ( auto& rProp : asNonConstRange(m_aProps) )
     {
         if ( rProp.Name == "Encrypted" )
             rProp.Value <<= true;
@@ -735,7 +735,7 @@ void OWriteStream_Impl::InsertStreamDirectly( const 
uno::Reference< io::XInputSt
 
         // if there are cached properties update them
         if ( rProp.Name == aMedTypePropName || rProp.Name == aComprPropName )
-            for ( auto& rMemProp : m_aProps )
+            for ( auto& rMemProp : asNonConstRange(m_aProps) )
             {
                 if ( rProp.Name == rMemProp.Name )
                     rMemProp.Value = rProp.Value;
@@ -825,7 +825,7 @@ void OWriteStream_Impl::Commit()
     // copy properties to the package stream
     uno::Reference< beans::XPropertySet > xPropertySet( xNewPackageStream, 
uno::UNO_QUERY_THROW );
 
-    for ( auto& rProp : m_aProps )
+    for ( auto& rProp : asNonConstRange(m_aProps) )
     {
         if ( rProp.Name == "Size" )
         {
@@ -1053,7 +1053,7 @@ uno::Sequence< beans::PropertyValue > 
OWriteStream_Impl::ReadPackageStreamProper
     // TODO: may be also raw stream should be marked
 
     uno::Reference< beans::XPropertySet > xPropSet( m_xPackageStream, 
uno::UNO_QUERY_THROW );
-    for ( auto& rProp : aResult )
+    for ( auto& rProp : asNonConstRange(aResult) )
     {
         try {
             rProp.Value = xPropSet->getPropertyValue( rProp.Name );
@@ -2177,7 +2177,7 @@ void OWriteStream::CloseOutput_Impl()
     if ( !m_xSeekable.is() )
         throw uno::RuntimeException();
 
-    for ( auto& rProp : m_pImpl->m_aProps )
+    for ( auto& rProp : asNonConstRange(m_pImpl->m_aProps) )
     {
         if ( rProp.Name == "Size" )
             rProp.Value <<= m_xSeekable->getLength();
@@ -2785,7 +2785,7 @@ void SAL_CALL OWriteStream::setPropertyValue( const 
OUString& aPropertyName, con
                 bCompressedValueFromType = false;
         }
 
-        for ( auto& rProp : m_pImpl->m_aProps )
+        for ( auto& rProp : asNonConstRange(m_pImpl->m_aProps) )
         {
             if ( aPropertyName == rProp.Name )
                 rProp.Value = aValue;
@@ -2797,7 +2797,7 @@ void SAL_CALL OWriteStream::setPropertyValue( const 
OUString& aPropertyName, con
     {
         // if the "Compressed" property is not set explicitly, the MediaType 
can change the default value
         m_pImpl->m_bCompressedSetExplicit = true;
-        for ( auto& rProp : m_pImpl->m_aProps )
+        for ( auto& rProp : asNonConstRange(m_pImpl->m_aProps) )
         {
             if ( aPropertyName == rProp.Name )
                 rProp.Value = aValue;
@@ -2828,7 +2828,7 @@ void SAL_CALL OWriteStream::setPropertyValue( const 
OUString& aPropertyName, con
     }
     else if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML && 
aPropertyName == aMediaTypeString )
     {
-        for ( auto& rProp : m_pImpl->m_aProps )
+        for ( auto& rProp : asNonConstRange(m_pImpl->m_aProps) )
         {
             if ( aPropertyName == rProp.Name )
                 rProp.Value = aValue;
diff --git a/package/source/zipapi/ThreadedDeflater.cxx 
b/package/source/zipapi/ThreadedDeflater.cxx
index 73725c580c02..f574105ad4ef 100644
--- a/package/source/zipapi/ThreadedDeflater.cxx
+++ b/package/source/zipapi/ThreadedDeflater.cxx
@@ -114,8 +114,8 @@ void ThreadedDeflater::deflateWrite(
         if (!lastBatch)
         {
             assert(inputBytes == batchSize);
-            std::copy_n(inBuffer.begin() + (batchSize - MaxBlockSize), 
MaxBlockSize,
-                        prevDataBlock.begin());
+            std::copy_n(std::cbegin(inBuffer) + (batchSize - MaxBlockSize), 
MaxBlockSize,
+                        prevDataBlock.getArray());
         }
 
         processDeflatedBuffers();
@@ -130,7 +130,7 @@ void ThreadedDeflater::processDeflatedBuffers()
 
     css::uno::Sequence<sal_Int8> outBuffer(batchOutputSize);
 
-    auto pos = outBuffer.begin();
+    auto pos = outBuffer.getArray();
     for (auto& buffer : outBuffers)
     {
         pos = std::copy(buffer.begin(), buffer.end(), pos);
diff --git a/pyuno/source/module/pyuno_adapter.cxx 
b/pyuno/source/module/pyuno_adapter.cxx
index daef59488cc2..4d31da9dadb2 100644
--- a/pyuno/source/module/pyuno_adapter.cxx
+++ b/pyuno/source/module/pyuno_adapter.cxx
@@ -273,8 +273,8 @@ Any Adapter::invoke( const OUString &aFunctionName,
                     }
 
                     aOutParam.realloc( nOutLength );
-                    ret = seq[0];
-                    std::copy_n(std::next(seq.begin()), nOutLength, 
aOutParam.begin());
+                    ret = std::as_const(seq)[0];
+                    std::copy_n(std::next(std::cbegin(seq)), nOutLength, 
aOutParam.getArray());
                 }
                 // else { sequence is a return value !}
             }
diff --git a/reportdesign/source/core/api/ReportDefinition.cxx 
b/reportdesign/source/core/api/ReportDefinition.cxx
index f296561bf62e..82776672d8ee 100644
--- a/reportdesign/source/core/api/ReportDefinition.cxx
+++ b/reportdesign/source/core/api/ReportDefinition.cxx
@@ -443,7 +443,7 @@ void SAL_CALL OStyle::setPropertiesToDefault( const 
uno::Sequence< OUString >& a
 uno::Sequence< uno::Any > SAL_CALL OStyle::getPropertyDefaults( const 
uno::Sequence< OUString >& aPropertyNames )
 {
     uno::Sequence< uno::Any > aRet(aPropertyNames.getLength());
-    std::transform(aPropertyNames.begin(), aPropertyNames.end(), aRet.begin(),
+    std::transform(aPropertyNames.begin(), aPropertyNames.end(), 
aRet.getArray(),
         [this](const OUString& rName) -> uno::Any { return 
getPropertyDefault(rName); });
     return aRet;
 }
@@ -1512,8 +1512,9 @@ bool OReportDefinition::WriteThroughComponent(
 
     // prepare arguments (prepend doc handler to given arguments)
     uno::Sequence<uno::Any> aArgs( 1 + rArguments.getLength() );
-    aArgs[0] <<= xSaxWriter;
-    std::copy(rArguments.begin(), rArguments.end(), std::next(aArgs.begin()));
+    auto pArgs = aArgs.getArray();
+    *pArgs <<= xSaxWriter;
+    std::copy(rArguments.begin(), rArguments.end(), std::next(pArgs));
 
     // get filter component
     uno::Reference< document::XExporter > xExporter(
diff --git a/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx 
b/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx
index 933b00dc2fe0..3d8b2c1be603 100644
--- a/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx
+++ b/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx
@@ -261,7 +261,7 @@ void SAL_CALL ImportDocumentHandler::startElement(const 
OUString & _sName, const
                 break;
             }
         }
-        for(beans::PropertyValue & propVal : m_aArguments)
+        for(beans::PropertyValue & propVal : asNonConstRange(m_aArguments))
         {
             if ( propVal.Name == "HasCategories" )
             {
diff --git a/reportdesign/source/ui/report/ReportSection.cxx 
b/reportdesign/source/ui/report/ReportSection.cxx
index 056951c82216..d757fce2de3d 100644
--- a/reportdesign/source/ui/report/ReportSection.cxx
+++ b/reportdesign/source/ui/report/ReportSection.cxx
@@ -759,7 +759,7 @@ sal_Int8 OReportSection::ExecuteDrop( const 
ExecuteDropEvent& _rEvt )
         else
             aValues = 
svx::OMultiColumnTransferable::extractDescriptor(aDropped);
 
-        for(beans::PropertyValue & propVal : aValues)
+        for(beans::PropertyValue & propVal : asNonConstRange(aValues))
         {
             uno::Sequence<beans::PropertyValue> aCurrent;
             propVal.Value >>= aCurrent;
diff --git a/sc/qa/unit/subsequent_filters_test2.cxx 
b/sc/qa/unit/subsequent_filters_test2.cxx
index db2291da0edf..754aa687c7c5 100644
--- a/sc/qa/unit/subsequent_filters_test2.cxx
+++ b/sc/qa/unit/subsequent_filters_test2.cxx
@@ -2597,7 +2597,7 @@ void ScFiltersTest2::testTextBoxBodyUpright()
     {
         uno::Sequence<beans::PropertyValue> aGrabBag;
         xShapeProperties->getPropertyValue("InteropGrabBag") >>= aGrabBag;
-        for (auto& aProp : aGrabBag)
+        for (auto& aProp : std::as_const(aGrabBag))
         {
             if (aProp.Name == "Upright")
             {
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index f46bf21d5694..1bab5ce8ba40 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -2118,7 +2118,7 @@ static PivotFunc lcl_FirstSubTotal( const 
uno::Reference<beans::XPropertySet>& x
                 if ( aSubAny >>= aSeq )
                 {
                     PivotFunc nMask = PivotFunc::NONE;
-                    for (const sal_Int16 nElem : aSeq)
+                    for (const sal_Int16 nElem : std::as_const(aSeq))
                         nMask |= ScDataPilotConversion::FunctionBit(nElem);
                     return nMask;
                 }
diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx
index f02a510bcdeb..03b3d2280e79 100644
--- a/sc/source/core/data/dptabsrc.cxx
+++ b/sc/source/core/data/dptabsrc.cxx
@@ -2096,7 +2096,7 @@ void SAL_CALL ScDPLevel::setPropertyValue( const 
OUString& aPropertyName, const
         uno::Sequence<sheet::GeneralFunction> aSeq;
         aValue >>= aSeq;
         aSubTotals.realloc(aSeq.getLength());
-        std::transform(std::cbegin(aSeq), std::cend(aSeq), aSubTotals.begin(),
+        std::transform(std::cbegin(aSeq), std::cend(aSeq), 
aSubTotals.getArray(),
             [](const sheet::GeneralFunction& rFunc) -> sal_Int16 {
                 return static_cast<sal_Int16>(rFunc); });
     }
@@ -2124,9 +2124,8 @@ uno::Any SAL_CALL ScDPLevel::getPropertyValue( const 
OUString& aPropertyName )
     else if ( aPropertyName == SC_UNO_DP_SUBTOTAL )
     {
         const uno::Sequence<sal_Int16> aSeq = getSubTotals();
-        uno::Sequence<sheet::GeneralFunction> aNewSeq;
-        aNewSeq.realloc(aSeq.getLength());
-        std::transform(aSeq.begin(), aSeq.end(), aNewSeq.begin(),
+        uno::Sequence<sheet::GeneralFunction> aNewSeq(aSeq.getLength());
+        std::transform(aSeq.begin(), aSeq.end(), aNewSeq.getArray(),
             [](const sal_Int16 nFunc) -> sheet::GeneralFunction {
                 if (nFunc == sheet::GeneralFunction2::MEDIAN)
                     return sheet::GeneralFunction_NONE;
diff --git a/sc/source/core/tool/charthelper.cxx 
b/sc/source/core/tool/charthelper.cxx
index aeb3c53bdc80..b3bda1c529f0 100644
--- a/sc/source/core/tool/charthelper.cxx
+++ b/sc/source/core/tool/charthelper.cxx
@@ -232,7 +232,7 @@ void ScChartHelper::SetChartRanges( const uno::Reference< 
chart2::XChartDocument
 
         uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > 
aLabeledDataSequences( xDataSource->getDataSequences() );
         sal_Int32 nRange=0;
-        for( uno::Reference<chart2::data::XLabeledDataSequence>& 
xLabeledSequence : aLabeledDataSequences )
+        for( uno::Reference<chart2::data::XLabeledDataSequence>& 
xLabeledSequence : asNonConstRange(aLabeledDataSequences) )
         {
             if( nRange >= rRanges.getLength() )
                 break;
diff --git a/sc/source/filter/excel/xechart.cxx 
b/sc/source/filter/excel/xechart.cxx
index fb1a5f35d793..089f578b3e10 100644
--- a/sc/source/filter/excel/xechart.cxx
+++ b/sc/source/filter/excel/xechart.cxx
@@ -1935,7 +1935,7 @@ bool XclExpChSeries::ConvertDataSeries(
                 Sequence< sal_Int32 > aPointIndexes;
                 if( aSeriesProp.GetProperty( aPointIndexes, 
EXC_CHPROP_ATTRIBDATAPOINTS ) && aPointIndexes.hasElements() )
                 {
-                    for( const sal_Int32 nPointIndex : aPointIndexes )
+                    for( const sal_Int32 nPointIndex : 
std::as_const(aPointIndexes) )
                     {
                         if (nPointIndex >= nMaxPointCount)
                             break;
diff --git a/sc/source/filter/ftools/fapihelper.cxx 
b/sc/source/filter/ftools/fapihelper.cxx
index a1271eb81602..b08f3bed1c5a 100644
--- a/sc/source/filter/ftools/fapihelper.cxx
+++ b/sc/source/filter/ftools/fapihelper.cxx
@@ -219,7 +219,7 @@ void ScfPropertySet::GetProperties( Sequence< Any >& 
rValues, const Sequence< OU
         {
             sal_Int32 nLen = rPropNames.getLength();
             rValues.realloc( nLen );
-            std::transform(rPropNames.begin(), rPropNames.end(), 
rValues.begin(),
+            std::transform(rPropNames.begin(), rPropNames.end(), 
rValues.getArray(),
                 [this](const OUString& rPropName) -> Any { return 
mxPropSet->getPropertyValue(rPropName); });
         }
     }
diff --git a/sc/source/ui/Accessibility/AccessibleCell.cxx 
b/sc/source/ui/Accessibility/AccessibleCell.cxx
index a7a8d442533d..ed1dbd8ebeda 100644
--- a/sc/source/ui/Accessibility/AccessibleCell.cxx
+++ b/sc/source/ui/Accessibility/AccessibleCell.cxx
@@ -522,7 +522,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL 
ScAccessibleCell::getCharacterAtt
     sal_uInt16 nParaIndent = mpDoc->GetAttr( maCellAddress, ATTR_INDENT 
)->GetValue();
     if (nParaIndent > 0)
     {
-        auto [begin, end] = toNonConstRange(aAttribs);
+        auto [begin, end] = asNonConstRange(aAttribs);
         auto pAttrib = std::find_if(begin, end,
             [](const beans::PropertyValue& rAttrib) { return "ParaLeftMargin" 
== rAttrib.Name; });
         if (pAttrib != end)
diff --git a/sc/source/ui/miscdlgs/optsolver.cxx 
b/sc/source/ui/miscdlgs/optsolver.cxx
index c81819b3027a..c331dddcb539 100644
--- a/sc/source/ui/miscdlgs/optsolver.cxx
+++ b/sc/source/ui/miscdlgs/optsolver.cxx
@@ -862,11 +862,11 @@ bool ScOptSolverDlg::CallSolver()       // return true -> 
close dialog after cal
         sal_Int32 nAdd = ( aRange.aEnd.Col() - aRange.aStart.Col() + 1 ) *
                          ( aRange.aEnd.Row() - aRange.aStart.Row() + 1 );
         aVariables.realloc( nVarPos + nAdd );
-        auto it = aVariables.begin() + nVarPos;
+        auto pVariables = aVariables.getArray();
 
         for (SCROW nRow = aRange.aStart.Row(); nRow <= aRange.aEnd.Row(); 
++nRow)
             for (SCCOL nCol = aRange.aStart.Col(); nCol <= aRange.aEnd.Col(); 
++nCol)
-                *it++ = table::CellAddress( nTab, nCol, nRow );
+                pVariables[nVarPos++] = table::CellAddress( nTab, nCol, nRow );
     }
 
     uno::Sequence<sheet::SolverConstraint> aConstraints;
@@ -971,7 +971,7 @@ bool ScOptSolverDlg::CallSolver()       // return true -> 
close dialog after cal
 
     sal_Int32 nVarCount = aVariables.getLength();
     uno::Sequence<double> aOldValues( nVarCount );
-    std::transform(std::cbegin(aVariables), std::cend(aVariables), 
aOldValues.begin(),
+    std::transform(std::cbegin(aVariables), std::cend(aVariables), 
aOldValues.getArray(),
         [this](const table::CellAddress& rVariable) -> double {
             ScAddress aCellPos;
             ScUnoConversion::FillScAddress( aCellPos, rVariable );
diff --git a/sc/source/ui/miscdlgs/solveroptions.cxx 
b/sc/source/ui/miscdlgs/solveroptions.cxx
index 4c849959399a..770520785b39 100644
--- a/sc/source/ui/miscdlgs/solveroptions.cxx
+++ b/sc/source/ui/miscdlgs/solveroptions.cxx
@@ -171,7 +171,7 @@ void ScSolverOptionsDialog::FillListBox()
 
     uno::Sequence<beans::PropertyValue> aNewSeq;
     aNewSeq.realloc( nCount );
-    std::transform(aDescriptions.begin(), aDescriptions.end(), aNewSeq.begin(),
+    std::transform(aDescriptions.begin(), aDescriptions.end(), 
aNewSeq.getArray(),
         [this](const ScSolverOptionsEntry& rDescr) -> beans::PropertyValue { 
return maProperties[ rDescr.nPosition ]; });
     maProperties = aNewSeq;
 
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 30b41197dc55..6720b9823929 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -1834,7 +1834,7 @@ uno::Sequence<beans::PropertyState> SAL_CALL 
ScCellRangesBase::getPropertyStates
     const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap();     // from 
derived class
 
     uno::Sequence<beans::PropertyState> aRet(aPropertyNames.getLength());
-    std::transform(aPropertyNames.begin(), aPropertyNames.end(), aRet.begin(),
+    std::transform(aPropertyNames.begin(), aPropertyNames.end(), 
aRet.getArray(),
         [this, &rPropertyMap](const auto& rName) -> beans::PropertyState {
             sal_uInt16 nItemWhich = 0;
             const SfxItemPropertyMapEntry* pEntry  = rPropertyMap.getByName( 
rName );
diff --git a/sc/source/ui/unoobj/chart2uno.cxx 
b/sc/source/ui/unoobj/chart2uno.cxx
index 5eb7f2cc75e0..7f9d23a7d143 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -1549,7 +1549,7 @@ ScChart2DataProvider::createDataSource(
         aSeqVector.push_back(aSeq);
     }
 
-    for( const sal_Int32 nNewIndex : aSequenceMapping )
+    for( const sal_Int32 nNewIndex : std::as_const(aSequenceMapping) )
     {
         // note: assuming that the values in the sequence mapping are always 
non-negative
         ::std::vector< uno::Reference< chart2::data::XLabeledDataSequence > 
>::size_type nOldIndex( static_cast< sal_uInt32 >( nNewIndex ) );
@@ -2579,7 +2579,7 @@ void ScChart2DataSequence::BuildDataCache()
     // convert the hidden cell list to sequence.
     m_aHiddenValues.realloc(aHiddenValues.size());
     std::copy(
-        aHiddenValues.begin(), aHiddenValues.end(), m_aHiddenValues.begin());
+        aHiddenValues.begin(), aHiddenValues.end(), 
m_aHiddenValues.getArray());
 
     // Clear the data series cache when the array is re-built.
     m_aMixedDataCache.realloc(0);
diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx
index dd85f6ff8ba5..99de5a326b62 100644
--- a/sc/source/ui/unoobj/dapiuno.cxx
+++ b/sc/source/ui/unoobj/dapiuno.cxx
@@ -1843,9 +1843,8 @@ Any SAL_CALL ScDataPilotFieldObj::getPropertyValue( const 
OUString& aPropertyNam
     else if ( aPropertyName == SC_UNONAME_SUBTOTALS )
     {
         const uno::Sequence<sal_Int16> aSeq = getSubtotals();
-        uno::Sequence<sheet::GeneralFunction>  aNewSeq;
-        aNewSeq.realloc(aSeq.getLength());
-        std::transform(aSeq.begin(), aSeq.end(), aNewSeq.begin(),
+        uno::Sequence<sheet::GeneralFunction>  aNewSeq(aSeq.getLength());
+        std::transform(aSeq.begin(), aSeq.end(), aNewSeq.getArray(),
             [](sal_Int16 nFunc) -> sheet::GeneralFunction {
                 if (nFunc == sheet::GeneralFunction2::MEDIAN)
                     return sheet::GeneralFunction_NONE;
diff --git a/sc/source/ui/unoobj/defltuno.cxx b/sc/source/ui/unoobj/defltuno.cxx
index 7015985e5a74..62a399b6b3c8 100644
--- a/sc/source/ui/unoobj/defltuno.cxx
+++ b/sc/source/ui/unoobj/defltuno.cxx
@@ -284,7 +284,7 @@ uno::Sequence<beans::PropertyState> SAL_CALL 
ScDocDefaultsObj::getPropertyStates
 
     SolarMutexGuard aGuard;
     uno::Sequence<beans::PropertyState> aRet(aPropertyNames.getLength());
-    std::transform(aPropertyNames.begin(), aPropertyNames.end(), aRet.begin(),
+    std::transform(aPropertyNames.begin(), aPropertyNames.end(), 
aRet.getArray(),
         [this](const OUString& rName) -> beans::PropertyState { return 
getPropertyState(rName); });
     return aRet;
 }
diff --git a/sc/source/ui/unoobj/dispuno.cxx b/sc/source/ui/unoobj/dispuno.cxx
index 0a5d29c2a467..93ea182a05b3 100644
--- a/sc/source/ui/unoobj/dispuno.cxx
+++ b/sc/source/ui/unoobj/dispuno.cxx
@@ -119,7 +119,7 @@ uno::Sequence< uno::Reference<frame::XDispatch> > SAL_CALL
     SolarMutexGuard aGuard;
 
     uno::Sequence< uno::Reference< frame::XDispatch> > 
aReturn(aDescripts.getLength());
-    std::transform(aDescripts.begin(), aDescripts.end(), aReturn.begin(),
+    std::transform(aDescripts.begin(), aDescripts.end(), aReturn.getArray(),
         [this](const frame::DispatchDescriptor& rDescr) -> 
uno::Reference<frame::XDispatch> {
             return queryDispatch(rDescr.FeatureURL, rDescr.FrameName, 
rDescr.SearchFlags); });
     return aReturn;
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index d1131d6f967b..6a9d0d890556 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -344,7 +344,7 @@ void ScPrintUIOptions::SetDefaults()
         uno::Sequence<beans::PropertyValue> aUIProp;
         if ( rPropValue.Value >>= aUIProp )
         {
-            for (auto& rProp : aUIProp)
+            for (auto& rProp : asNonConstRange(aUIProp))
             {
                 OUString aName = rProp.Name;
                 if ( aName == "Property" )
diff --git a/sc/source/ui/unoobj/funcuno.cxx b/sc/source/ui/unoobj/funcuno.cxx
index 4c0dacb079ab..18cfd2eef580 100644
--- a/sc/source/ui/unoobj/funcuno.cxx
+++ b/sc/source/ui/unoobj/funcuno.cxx
@@ -410,15 +410,14 @@ public:
         sal_Int32 nStartRow = mrDocRow;
         sal_Int32 nRowCount = maSeq.getLength();
         sal_Int32 nMaxColCount = 0;
-        for ( const uno::Sequence< seq >& rRow : maSeq )
+        for ( const uno::Sequence< seq >& rRow : std::as_const(maSeq) )
         {
             sal_Int32 nColCount = rRow.getLength();
             if ( nColCount > nMaxColCount )
                 nMaxColCount = nColCount;
-            const seq* pColArr = rRow.getConstArray();
             for (sal_Int32 nCol=0; nCol<nColCount; nCol++)
                 if ( nCol <= mpDoc->MaxCol() && mrDocRow <= mpDoc->MaxRow() )
-                    aVisitor.visitElem( nCol, mrDocRow, pColArr[ nCol ] );
+                    aVisitor.visitElem( nCol, mrDocRow, rRow[ nCol ] );
                 else
                     mbOverflow=true;
             mrDocRow++;
diff --git a/sc/source/ui/unoobj/shapeuno.cxx b/sc/source/ui/unoobj/shapeuno.cxx
index 97fcb17b01b7..5649fe26060a 100644
--- a/sc/source/ui/unoobj/shapeuno.cxx
+++ b/sc/source/ui/unoobj/shapeuno.cxx
@@ -936,7 +936,7 @@ uno::Sequence<beans::PropertyState> SAL_CALL 
ScShapeObj::getPropertyStates(
     //  simple loop to get own and aggregated states
 
     uno::Sequence<beans::PropertyState> aRet(aPropertyNames.getLength());
-    std::transform(aPropertyNames.begin(), aPropertyNames.end(), aRet.begin(),
+    std::transform(aPropertyNames.begin(), aPropertyNames.end(), 
aRet.getArray(),
         [this](const OUString& rName) -> beans::PropertyState { return 
getPropertyState(rName); });
     return aRet;
 }
diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx
index 58924e653e46..4baa85a35476 100644
--- a/sc/source/ui/unoobj/styleuno.cxx
+++ b/sc/source/ui/unoobj/styleuno.cxx
@@ -1212,7 +1212,7 @@ uno::Sequence<beans::PropertyState> SAL_CALL 
ScStyleObj::getPropertyStates( cons
     GetStyle_Impl();
 
     uno::Sequence<beans::PropertyState> aRet( aPropertyNames.getLength() );
-    std::transform(aPropertyNames.begin(), aPropertyNames.end(), aRet.begin(),
+    std::transform(aPropertyNames.begin(), aPropertyNames.end(), 
aRet.getArray(),
         [this](const OUString& rName) -> beans::PropertyState { return 
getPropertyState_Impl(rName); });
     return aRet;
 }
@@ -1326,7 +1326,7 @@ uno::Sequence<uno::Any> SAL_CALL 
ScStyleObj::getPropertyDefaults( const uno::Seq
     GetStyle_Impl();
 
     uno::Sequence<uno::Any> aSequence( aPropertyNames.getLength() );
-    std::transform(aPropertyNames.begin(), aPropertyNames.end(), 
aSequence.begin(),
+    std::transform(aPropertyNames.begin(), aPropertyNames.end(), 
aSequence.getArray(),
         [this](const OUString& rName) -> uno::Any { return 
getPropertyDefault_Impl(rName); });
     return aSequence;
 }
@@ -1358,7 +1358,7 @@ uno::Sequence<uno::Any> SAL_CALL 
ScStyleObj::getPropertyValues( const uno::Seque
     GetStyle_Impl();
 
     uno::Sequence<uno::Any> aSequence( aPropertyNames.getLength() );
-    std::transform(aPropertyNames.begin(), aPropertyNames.end(), 
aSequence.begin(),
+    std::transform(aPropertyNames.begin(), aPropertyNames.end(), 
aSequence.getArray(),
         [this](const OUString& rName) -> uno::Any { return 
getPropertyValue_Impl(rName); });
     return aSequence;
 }
diff --git a/sc/source/ui/vba/vbachart.cxx b/sc/source/ui/vba/vbachart.cxx
index 09c061a36ced..adc1b7f4467e 100644
--- a/sc/source/ui/vba/vbachart.cxx
+++ b/sc/source/ui/vba/vbachart.cxx
@@ -624,7 +624,7 @@ uno::Sequence< OUString >
 ScVbaChart::getDefaultSeriesDescriptions( sal_Int32 _nCount )
 {
     uno::Sequence< OUString > sDescriptions ( _nCount );
-    std::generate_n(sDescriptions.begin(), _nCount,
+    std::generate_n(sDescriptions.getArray(), _nCount,
         [i = 1]() mutable -> OUString { return DEFAULTSERIESPREFIX + 
OUString::number(i++); });
     return sDescriptions;
 }
diff --git a/sc/source/ui/vba/vbaeventshelper.cxx 
b/sc/source/ui/vba/vbaeventshelper.cxx
index 8eec39dca899..e5acba5fff5f 100644
--- a/sc/source/ui/vba/vbaeventshelper.cxx
+++ b/sc/source/ui/vba/vbaeventshelper.cxx
@@ -771,8 +771,9 @@ uno::Sequence< uno::Any > 
ScVbaEventsHelper::implBuildArgumentList( const EventH
     {
         sal_Int32 nLength = aVbaArgs.getLength();
         uno::Sequence< uno::Any > aVbaArgs2( nLength + 1 );
-        aVbaArgs2[ 0 ] = createWorksheet( rArgs, 0 );
-        std::copy_n(aVbaArgs.begin(), nLength, std::next(aVbaArgs2.begin()));
+        auto pVbaArgs2 = aVbaArgs2.getArray();
+        *pVbaArgs2 = createWorksheet( rArgs, 0 );
+        std::copy_n(std::cbegin(aVbaArgs), nLength, std::next(pVbaArgs2));
         aVbaArgs = aVbaArgs2;
     }
 
diff --git a/sc/source/ui/vba/vbaworkbook.cxx b/sc/source/ui/vba/vbaworkbook.cxx
index fb23ab02fcc4..8b2b9fbc724f 100644
--- a/sc/source/ui/vba/vbaworkbook.cxx
+++ b/sc/source/ui/vba/vbaworkbook.cxx
@@ -48,11 +48,6 @@ using namespace ::com::sun::star;
 
 uno::Sequence< sal_Int32 > ScVbaWorkbook::ColorData;
 
-void ScVbaWorkbook::initColorData( const uno::Sequence< sal_Int32 >& sColors )
-{
-    std::copy(sColors.begin(), sColors.end(), ColorData.begin());
-}
-
 void SAL_CALL
 ScVbaWorkbook::ResetColors(  )
 {
@@ -60,11 +55,9 @@ ScVbaWorkbook::ResetColors(  )
         sal_Int32 nLen = xIndexAccess->getCount();
         ColorData.realloc( nLen );
 
-        uno::Sequence< sal_Int32 > dDefaultColors( nLen );
-        sal_Int32* pDest = dDefaultColors.getArray();
+        sal_Int32* pDest = ColorData.getArray();
         for ( sal_Int32 index=0; index < nLen; ++pDest, ++index )
             xIndexAccess->getByIndex( index )  >>= *pDest;
-        initColorData( dDefaultColors );
 }
 
 ::uno::Any SAL_CALL
@@ -84,7 +77,7 @@ ScVbaWorkbook::Colors( const ::uno::Any& Index )
 
 bool ScVbaWorkbook::setFilterPropsFromFormat( sal_Int32 nFormat, 
uno::Sequence< beans::PropertyValue >& rProps )
 {
-    auto [begin, end] = toNonConstRange(rProps);
+    auto [begin, end] = asNonConstRange(rProps);
     auto pProp = std::find_if(begin, end,
         [](const beans::PropertyValue& rProp) { return rProp.Name == 
"FilterName"; });
     bool bRes = pProp != end;
diff --git a/sc/source/ui/vba/vbaworkbook.hxx b/sc/source/ui/vba/vbaworkbook.hxx
index 0afc88a3c17f..886f771bf5e7 100644
--- a/sc/source/ui/vba/vbaworkbook.hxx
+++ b/sc/source/ui/vba/vbaworkbook.hxx
@@ -29,7 +29,6 @@ class ScVbaWorkbook : public ScVbaWorkbook_BASE
 {
     static css::uno::Sequence< sal_Int32 > ColorData;
     static bool setFilterPropsFromFormat( sal_Int32 nFormat, 
css::uno::Sequence< css::beans::PropertyValue >& rProps );
-    static void initColorData( const css::uno::Sequence< sal_Int32 >& sColors 
);
     void init();
 
 public:
diff --git a/sc/source/ui/vba/vbawsfunction.cxx 
b/sc/source/ui/vba/vbawsfunction.cxx
index 350be038192b..e9119c67a0ba 100644
--- a/sc/source/ui/vba/vbawsfunction.cxx
+++ b/sc/source/ui/vba/vbawsfunction.cxx
@@ -76,7 +76,7 @@ ScVbaWSFunction::invoke(const OUString& FunctionName, const 
uno::Sequence< uno::
     uno::Sequence< uno::Any > aParamTemp( Params );
     if( aParamTemp.hasElements() )
     {
-        for( uno::Any & rArray : aParamTemp )
+        for( uno::Any & rArray : asNonConstRange(aParamTemp) )
         {
             switch( rArray.getValueType().getTypeClass()  )
             {
@@ -186,8 +186,8 @@ ScVbaWSFunction::invoke(const OUString& FunctionName, const 
uno::Sequence< uno::
         if( aRet.has< AnySeqSeq >() )
         {
             AnySeqSeq aAnySeqSeq = aRet.get< AnySeqSeq >();
-            for( auto& rAnySeq : aAnySeqSeq )
-                for( auto& rAny : rAnySeq )
+            for( auto& rAnySeq : asNonConstRange(aAnySeqSeq) )
+                for( auto& rAny : asNonConstRange(rAnySeq) )
                     lclConvertDoubleToBoolean( rAny );
             aRet <<= aAnySeqSeq;
         }
diff --git a/sccomp/source/solver/SwarmSolver.cxx 
b/sccomp/source/solver/SwarmSolver.cxx
index c0dad8a4471d..4aac9f81e23e 100644
--- a/sccomp/source/solver/SwarmSolver.cxx
+++ b/sccomp/source/solver/SwarmSolver.cxx
@@ -582,7 +582,7 @@ void SAL_CALL SwarmSolver::solve()
     mbSuccess = true;
 
     maSolution.realloc(aSolution.size());
-    std::copy(aSolution.begin(), aSolution.end(), maSolution.begin());
+    std::copy(aSolution.begin(), aSolution.end(), maSolution.getArray());
 }
 
 extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
diff --git a/scripting/source/protocolhandler/scripthandler.cxx 
b/scripting/source/protocolhandler/scripthandler.cxx
index e8fe67a1c502..db9d746c81be 100644
--- a/scripting/source/protocolhandler/scripthandler.cxx
+++ b/scripting/source/protocolhandler/scripthandler.cxx
@@ -107,7 +107,7 @@ const Sequence < DispatchDescriptor >& seqDescriptor )
 {
     sal_Int32 nCount = seqDescriptor.getLength();
     Sequence< Reference< XDispatch > > lDispatcher( nCount );
-    std::transform(seqDescriptor.begin(), seqDescriptor.end(), 
lDispatcher.begin(),
+    std::transform(seqDescriptor.begin(), seqDescriptor.end(), 
lDispatcher.getArray(),
         [this](const DispatchDescriptor& rDescr) -> Reference<XDispatch> {
             return queryDispatch(rDescr.FeatureURL, rDescr.FrameName, 
rDescr.SearchFlags); });
     return lDispatcher;
diff --git a/scripting/source/provider/BrowseNodeFactoryImpl.cxx 
b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
index 1366f0d24f6b..6caa71c406b6 100644
--- a/scripting/source/provider/BrowseNodeFactoryImpl.cxx
+++ b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
@@ -104,7 +104,7 @@ public:
         sal_Int32 index = 0;
         for ( const Sequence< Reference < browse::XBrowseNode > >& children : 
seqs )
         {
-            std::copy(children.begin(), children.end(), 
std::next(result.begin(), index));
+            std::copy(children.begin(), children.end(), 
std::next(result.getArray(), index));
             index += children.getLength();
 
             if (index >= numChildren)
diff --git a/sd/source/core/CustomAnimationCloner.cxx 
b/sd/source/core/CustomAnimationCloner.cxx
index f81e7f522e63..7f8d79ce7c89 100644
--- a/sd/source/core/CustomAnimationCloner.cxx
+++ b/sd/source/core/CustomAnimationCloner.cxx
@@ -190,7 +190,7 @@ namespace sd
             Sequence< NamedValue > aUserData( xNode->getUserData() );
             if( aUserData.hasElements() )
             {
-                for( NamedValue & namedValue : aUserData )
+                for( NamedValue & namedValue : asNonConstRange(aUserData) )
                 {
                     namedValue.Value = transformValue( namedValue.Value );
                 }
@@ -223,7 +223,7 @@ namespace sd
                 Sequence<Any> aSequence;
                 rValue >>= aSequence;
 
-                for( Any& rAny : aSequence )
+                for( Any& rAny : asNonConstRange(aSequence) )
                     rAny = transformValue( rAny );
 
                 return makeAny( aSequence );
diff --git a/sd/source/core/CustomAnimationEffect.cxx 
b/sd/source/core/CustomAnimationEffect.cxx
index 83a3e674e710..cb4e7db67b92 100644
--- a/sd/source/core/CustomAnimationEffect.cxx
+++ b/sd/source/core/CustomAnimationEffect.cxx
@@ -418,7 +418,7 @@ void CustomAnimationEffect::setPresetClassAndId( sal_Int16 
nPresetClass, const O
     bool bFoundPresetId = false;
     if( nLength )
     {
-        auto [begin, end] = toNonConstRange(aUserData);
+        auto [begin, end] = asNonConstRange(aUserData);
         NamedValue* pProp = std::find_if(begin, end,
             [](const NamedValue& rProp) { return rProp.Name == "preset-class"; 
});
         if (pProp != end)
@@ -473,7 +473,7 @@ void CustomAnimationEffect::setNodeType( sal_Int16 
nNodeType )
     bool bFound = false;
     if( nLength )
     {
-        auto [begin, end] = toNonConstRange(aUserData);
+        auto [begin, end] = asNonConstRange(aUserData);
         NamedValue* pProp = std::find_if(begin, end,
             [](const NamedValue& rProp) { return rProp.Name == "node-type"; });
         if (pProp != end)
@@ -508,7 +508,7 @@ void CustomAnimationEffect::setGroupId( sal_Int32 nGroupId )
     bool bFound = false;
     if( nLength )
     {
-        auto [begin, end] = toNonConstRange(aUserData);
+        auto [begin, end] = asNonConstRange(aUserData);
         NamedValue* pProp = std::find_if(begin, end,
             [](const NamedValue& rProp) { return rProp.Name == "group-id"; });
         if (pProp != end)
diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx
index 72298f94d951..30b4bc38eee8 100644
--- a/sd/source/core/stlsheet.cxx
+++ b/sd/source/core/stlsheet.cxx
@@ -1332,7 +1332,7 @@ Sequence< PropertyState > SAL_CALL 
SdStyleSheet::getPropertyStates( const Sequen
 
     Sequence< PropertyState > aPropertyStateSequence( nCount );
 
-    std::transform(aPropertyName.begin(), aPropertyName.end(), 
aPropertyStateSequence.begin(),
+    std::transform(aPropertyName.begin(), aPropertyName.end(), 
aPropertyStateSequence.getArray(),
         [this](const OUString& rName) -> PropertyState { return 
getPropertyState(rName); });
 
     return aPropertyStateSequence;
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx 
b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 9070b6135259..c06c109cd0d4 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -2069,7 +2069,7 @@ bool PowerPointExport::WriteColorSchemes(const 
FSHelperPtr& pFS, const OUString&
                     OUString sName = 
PredefinedClrNames[static_cast<PredefinedClrSchemeId>(nId)];
                     sal_Int32 nColor = 0;
 
-                    for (auto aIt = aCurrentTheme.begin(); aIt != 
aCurrentTheme.end(); aIt++)
+                    for (auto aIt = std::cbegin(aCurrentTheme); aIt != 
std::cend(aCurrentTheme); aIt++)
                     {
                         if (aIt->Name == sName)
                         {
diff --git a/sd/source/filter/grf/sdgrffilter.cxx 
b/sd/source/filter/grf/sdgrffilter.cxx
index edf39df51513..4e3fefb797ea 100644
--- a/sd/source/filter/grf/sdgrffilter.cxx
+++ b/sd/source/filter/grf/sdgrffilter.cxx
@@ -246,7 +246,7 @@ bool SdGRFFilter::Export()
                     OUString sShortName( 
rGraphicFilter.GetExportFormatShortName( nFilter ) );
 
                     bool    bFilterNameFound = false;
-                    for ( auto& rArg : aArgs )
+                    for ( auto& rArg : asNonConstRange(aArgs) )

... etc. - the rest is truncated

Reply via email to