summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-10-14 09:25:24 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2021-10-15 10:36:36 +0200
commit2484de6728bd11bb7949003d112f1ece2223c7a1 (patch)
tree1296534e396da284b38d2c478dcd2b31c4714179 /sc
parent88375fd36899d21d3309cf8333712e02a87d3a91 (diff)
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 <sbergman@redhat.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/subsequent_filters_test2.cxx2
-rw-r--r--sc/source/core/data/dpobject.cxx2
-rw-r--r--sc/source/core/data/dptabsrc.cxx7
-rw-r--r--sc/source/core/tool/charthelper.cxx2
-rw-r--r--sc/source/filter/excel/xechart.cxx2
-rw-r--r--sc/source/filter/ftools/fapihelper.cxx2
-rw-r--r--sc/source/ui/Accessibility/AccessibleCell.cxx2
-rw-r--r--sc/source/ui/miscdlgs/optsolver.cxx6
-rw-r--r--sc/source/ui/miscdlgs/solveroptions.cxx2
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx2
-rw-r--r--sc/source/ui/unoobj/chart2uno.cxx4
-rw-r--r--sc/source/ui/unoobj/dapiuno.cxx5
-rw-r--r--sc/source/ui/unoobj/defltuno.cxx2
-rw-r--r--sc/source/ui/unoobj/dispuno.cxx2
-rw-r--r--sc/source/ui/unoobj/docuno.cxx2
-rw-r--r--sc/source/ui/unoobj/funcuno.cxx5
-rw-r--r--sc/source/ui/unoobj/shapeuno.cxx2
-rw-r--r--sc/source/ui/unoobj/styleuno.cxx6
-rw-r--r--sc/source/ui/vba/vbachart.cxx2
-rw-r--r--sc/source/ui/vba/vbaeventshelper.cxx5
-rw-r--r--sc/source/ui/vba/vbaworkbook.cxx11
-rw-r--r--sc/source/ui/vba/vbaworkbook.hxx1
-rw-r--r--sc/source/ui/vba/vbawsfunction.cxx6
23 files changed, 36 insertions, 46 deletions
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;
}