diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-08-10 22:20:30 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2019-08-12 15:23:53 +0200 |
commit | 4721cbb1bb118d33ac9fcf93dda8c083b364003d (patch) | |
tree | f958d6b46d40fd573483139512b4c31dbd6e153b /sc | |
parent | a684613daf9ed5670c5f80267cc1bea0b878b1f6 (diff) |
Mark Sequence const in sc
It ensures that const begin()/end() methods will be called,
removing any overhead.
fca94779872b8ba0b0583d0b7068f1a46beb88c5 follow-up.
Change-Id: Id680744abb1b3887f25c9bfa033106de18a9c2d0
Reviewed-on: https://gerrit.libreoffice.org/77250
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sc')
29 files changed, 68 insertions, 81 deletions
diff --git a/sc/source/core/data/documen5.cxx b/sc/source/core/data/documen5.cxx index 198cba53017e..2000121fa892 100644 --- a/sc/source/core/data/documen5.cxx +++ b/sc/source/core/data/documen5.cxx @@ -55,7 +55,7 @@ static void lcl_GetChartParameters( const uno::Reference< chart2::XChartDocument if ( xProvider.is() ) { - uno::Sequence< beans::PropertyValue > aArgs( xProvider->detectArguments( xDataSource ) ); + const uno::Sequence< beans::PropertyValue > aArgs( xProvider->detectArguments( xDataSource ) ); for (const beans::PropertyValue& rProp : aArgs) { @@ -372,7 +372,7 @@ void ScDocument::RestoreChartListener( const OUString& rName ) uno::Reference< chart2::data::XDataReceiver > xReceiver( xComponent, uno::UNO_QUERY ); if ( xChartDoc.is() && xReceiver.is() && !xChartDoc->hasInternalDataProvider()) { - uno::Sequence<OUString> aRepresentations( xReceiver->getUsedRangeRepresentations() ); + const uno::Sequence<OUString> aRepresentations( xReceiver->getUsedRangeRepresentations() ); ScRangeListRef aRanges = new ScRangeList; for ( const auto& rRepresentation : aRepresentations ) { diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index 16e8e794d019..4c7d02baa957 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -1174,7 +1174,7 @@ bool ScDPObject::IsDimNameInUse(const OUString& rName) const return false; Reference<container::XNameAccess> xDims = xSource->getDimensions(); - Sequence<OUString> aDimNames = xDims->getElementNames(); + const Sequence<OUString> aDimNames = xDims->getElementNames(); for (const OUString& rDimName : aDimNames) { if (rDimName.equalsIgnoreAsciiCase(rName)) diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx index 1fc5a06a4739..2ea984303bbf 100644 --- a/sc/source/core/data/dpoutput.cxx +++ b/sc/source/core/data/dpoutput.cxx @@ -466,7 +466,7 @@ uno::Sequence<sheet::MemberResult> getVisiblePageMembersAsResults( const uno::Re return uno::Sequence<sheet::MemberResult>(); std::vector<sheet::MemberResult> aRes; - uno::Sequence<OUString> aNames = xNA->getElementNames(); + const uno::Sequence<OUString> aNames = xNA->getElementNames(); for (const OUString& rName : aNames) { xNA->getByName(rName); @@ -1158,31 +1158,24 @@ void ScDPOutput::GetMemberResultNames(ScDPUniqueStringSet& rNames, long nDimensi // Only the dimension has to be compared because this is only used with table data, // where each dimension occurs only once. - uno::Sequence<sheet::MemberResult> aMemberResults; - bool bFound = false; + auto lFindDimension = [nDimension](const ScDPOutLevelData& rField) { return rField.mnDim == nDimension; }; // look in column fields + auto it = std::find_if(pColFields.begin(), pColFields.end(), lFindDimension); + bool bFound = it != pColFields.end(); - for (size_t nField=0; nField<pColFields.size() && !bFound; nField++) - if ( pColFields[nField].mnDim == nDimension ) - { - aMemberResults = pColFields[nField].maResult; - bFound = true; - } - - // look in row fields - - for (size_t nField=0; nField<pRowFields.size() && !bFound; nField++) - if ( pRowFields[nField].mnDim == nDimension ) - { - aMemberResults = pRowFields[nField].maResult; - bFound = true; - } + if (!bFound) + { + // look in row fields + it = std::find_if(pRowFields.begin(), pRowFields.end(), lFindDimension); + bFound = it != pRowFields.end(); + } // collect the member names if ( bFound ) { + const uno::Sequence<sheet::MemberResult> aMemberResults = it->maResult; for (const sheet::MemberResult& rMemberResult : aMemberResults) { if ( rMemberResult.Flags & sheet::MemberResultFlags::HASMEMBER ) diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx index fac81c88e24a..870217cfa4ca 100644 --- a/sc/source/core/data/dptabsrc.cxx +++ b/sc/source/core/data/dptabsrc.cxx @@ -2116,7 +2116,7 @@ uno::Any SAL_CALL ScDPLevel::getPropertyValue( const OUString& aPropertyName ) aRet <<= bRepeatItemLabels; else if ( aPropertyName == SC_UNO_DP_SUBTOTAL ) { - uno::Sequence<sal_Int16> aSeq = getSubTotals(); + const uno::Sequence<sal_Int16> aSeq = getSubTotals(); uno::Sequence<sheet::GeneralFunction> aNewSeq; aNewSeq.realloc(aSeq.getLength()); std::transform(aSeq.begin(), aSeq.end(), aNewSeq.begin(), diff --git a/sc/source/core/tool/addincol.cxx b/sc/source/core/tool/addincol.cxx index 63eb607e9264..9dbe56cb70fb 100644 --- a/sc/source/core/tool/addincol.cxx +++ b/sc/source/core/tool/addincol.cxx @@ -113,7 +113,7 @@ const ::std::vector<ScUnoAddInFuncData::LocalizedName>& ScUnoAddInFuncData::GetC if ( xComp.is() && xFunction.is() ) { OUString aMethodName = xFunction->getName(); - uno::Sequence< sheet::LocalizedName> aCompNames( xComp->getCompatibilityNames( aMethodName )); + const uno::Sequence< sheet::LocalizedName> aCompNames( xComp->getCompatibilityNames( aMethodName )); maCompNames.clear(); for (const sheet::LocalizedName& rCompName : aCompNames) { @@ -348,7 +348,7 @@ void ScUnoAddInCollection::ReadConfiguration() const OUString sSlash('/'); // get the list of add-ins (services) - uno::Sequence<OUString> aServiceNames = rAddInConfig.GetNodeNames( "" ); + const uno::Sequence<OUString> aServiceNames = rAddInConfig.GetNodeNames( "" ); for ( const OUString& aServiceName : aServiceNames ) { @@ -459,7 +459,7 @@ void ScUnoAddInCollection::ReadConfiguration() OUString aArgumentsPath(aFuncPropPath + CFGSTR_PARAMETERS); - uno::Sequence<OUString> aArgumentNames = rAddInConfig.GetNodeNames( aArgumentsPath ); + const uno::Sequence<OUString> aArgumentNames = rAddInConfig.GetNodeNames( aArgumentsPath ); sal_Int32 nArgumentCount = aArgumentNames.getLength(); if ( nArgumentCount ) { @@ -985,7 +985,7 @@ void ScUnoAddInCollection::UpdateFromAddIn( const uno::Reference<uno::XInterface uno::Reference<beans::XIntrospectionAccess> xAcc = xIntro->inspect(aObject); if (xAcc.is()) { - uno::Sequence< uno::Reference<reflection::XIdlMethod> > aMethods = + const uno::Sequence< uno::Reference<reflection::XIdlMethod> > aMethods = xAcc->getMethods( beans::MethodConcept::ALL ); for (const uno::Reference<reflection::XIdlMethod>& xFunc : aMethods) { @@ -1013,7 +1013,7 @@ void ScUnoAddInCollection::UpdateFromAddIn( const uno::Reference<uno::XInterface long nVisibleCount = 0; long nCallerPos = SC_CALLERPOS_NONE; - uno::Sequence<reflection::ParamInfo> aParams = + const uno::Sequence<reflection::ParamInfo> aParams = xFunc->getParameterInfos(); long nParamCount = aParams.getLength(); const reflection::ParamInfo* pParArr = aParams.getConstArray(); diff --git a/sc/source/core/tool/charthelper.cxx b/sc/source/core/tool/charthelper.cxx index b9a2de4f0ac5..6acca9ce3666 100644 --- a/sc/source/core/tool/charthelper.cxx +++ b/sc/source/core/tool/charthelper.cxx @@ -201,7 +201,7 @@ void ScChartHelper::GetChartRanges( const uno::Reference< chart2::XChartDocument if( !xDataSource.is() ) return; - uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aLabeledDataSequences( xDataSource->getDataSequences() ); + const uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aLabeledDataSequences( xDataSource->getDataSequences() ); rRanges.reserve(2*aLabeledDataSequences.getLength()); for(const uno::Reference<chart2::data::XLabeledDataSequence>& xLabeledSequence : aLabeledDataSequences) { diff --git a/sc/source/core/tool/unitconv.cxx b/sc/source/core/tool/unitconv.cxx index 0030bbc86772..354c1ca5ab36 100644 --- a/sc/source/core/tool/unitconv.cxx +++ b/sc/source/core/tool/unitconv.cxx @@ -57,7 +57,7 @@ ScUnitConverter::ScUnitConverter() ScLinkConfigItem aConfigItem( CFGPATH_UNIT ); // empty node name -> use the config item's path itself - Sequence<OUString> aNodeNames = aConfigItem.GetNodeNames( "" ); + const Sequence<OUString> aNodeNames = aConfigItem.GetNodeNames( "" ); long nNodeCount = aNodeNames.getLength(); if ( nNodeCount ) diff --git a/sc/source/core/tool/userlist.cxx b/sc/source/core/tool/userlist.cxx index 049fadbe47b4..e650383c26bc 100644 --- a/sc/source/core/tool/userlist.cxx +++ b/sc/source/core/tool/userlist.cxx @@ -204,7 +204,7 @@ ScUserList::ScUserList() sal_Unicode cDelimiter = ScGlobal::cListDelimiter; uno::Sequence< i18n::CalendarItem2 > xCal; - uno::Sequence< i18n::Calendar2 > xCalendars( + const uno::Sequence< i18n::Calendar2 > xCalendars( ScGlobal::pLocaleData->getAllCalendars() ); for ( const auto& rCalendar : xCalendars ) diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx index 0d3733d6e722..fbaeb04ba3b3 100644 --- a/sc/source/filter/excel/xechart.cxx +++ b/sc/source/filter/excel/xechart.cxx @@ -1763,7 +1763,7 @@ bool XclExpChSerErrorBar::Convert( XclExpChSourceLink& rValueLink, sal_uInt16& r OUString aRole = XclChartHelper::GetErrorBarValuesRole( maData.mnBarType ); Reference< XDataSequence > xValueSeq; - Sequence< Reference< XLabeledDataSequence > > aLabeledSeqVec = xDataSource->getDataSequences(); + const Sequence< Reference< XLabeledDataSequence > > aLabeledSeqVec = xDataSource->getDataSequences(); for( const Reference< XLabeledDataSequence >& rLabeledSeq : aLabeledSeqVec ) { Reference< XDataSequence > xTmpValueSeq = rLabeledSeq->getValues(); @@ -1845,7 +1845,7 @@ bool XclExpChSeries::ConvertDataSeries( Reference< XDataSequence > xYValueSeq, xTitleSeq, xXValueSeq, xBubbleSeq; // find first sequence with role 'values-y' - Sequence< Reference< XLabeledDataSequence > > aLabeledSeqVec = xDataSource->getDataSequences(); + const Sequence< Reference< XLabeledDataSequence > > aLabeledSeqVec = xDataSource->getDataSequences(); for( const Reference< XLabeledDataSequence >& rLabeledSeq : aLabeledSeqVec ) { Reference< XDataSequence > xTmpValueSeq = rLabeledSeq->getValues(); @@ -1963,7 +1963,7 @@ bool XclExpChSeries::ConvertStockSeries( css::uno::Reference< css::chart2::XData Reference< XDataSequence > xYValueSeq, xTitleSeq; // find first sequence with passed role - Sequence< Reference< XLabeledDataSequence > > aLabeledSeqVec = xDataSource->getDataSequences(); + const Sequence< Reference< XLabeledDataSequence > > aLabeledSeqVec = xDataSource->getDataSequences(); for( const Reference< XLabeledDataSequence >& rLabeledSeq : aLabeledSeqVec ) { Reference< XDataSequence > xTmpValueSeq = rLabeledSeq->getValues(); @@ -2065,7 +2065,7 @@ void XclExpChSeries::CreateTrendLines( css::uno::Reference< css::chart2::XDataSe Reference< XRegressionCurveContainer > xRegCurveCont( xDataSeries, UNO_QUERY ); if( xRegCurveCont.is() ) { - Sequence< Reference< XRegressionCurve > > aRegCurveSeq = xRegCurveCont->getRegressionCurves(); + const Sequence< Reference< XRegressionCurve > > aRegCurveSeq = xRegCurveCont->getRegressionCurves(); for( const Reference< XRegressionCurve >& rRegCurve : aRegCurveSeq ) { XclExpChSeriesRef xSeries = GetChartData().CreateSeries(); @@ -2427,7 +2427,7 @@ void XclExpChTypeGroup::ConvertSeries( XDataSeriesVec aSeriesVec; // copy data series attached to the current axes set to the vector - Sequence< Reference< XDataSeries > > aSeriesSeq = xSeriesCont->getDataSeries(); + const Sequence< Reference< XDataSeries > > aSeriesSeq = xSeriesCont->getDataSeries(); for( const Reference< XDataSeries >& rSeries : aSeriesSeq ) { ScfPropertySet aSeriesProp( rSeries ); @@ -3115,7 +3115,7 @@ sal_uInt16 XclExpChAxesSet::Convert( Reference< XDiagram > const & xDiagram, sal Reference< XChartTypeContainer > xChartTypeCont( xCoordSystem, UNO_QUERY ); if( xChartTypeCont.is() ) { - Sequence< Reference< XChartType > > aChartTypeSeq = xChartTypeCont->getChartTypes(); + const Sequence< Reference< XChartType > > aChartTypeSeq = xChartTypeCont->getChartTypes(); for( const Reference< XChartType >& rChartType : aChartTypeSeq ) { XclExpChTypeGroupRef xTypeGroup( new XclExpChTypeGroup( GetChRoot(), nGroupIdx ) ); diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index f7b27bfc8f15..e2b8593c88f0 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -190,7 +190,7 @@ bool IsValidObject( const XclObj& rObj ) if (!xCooSysContainer.is()) return false; - uno::Sequence<uno::Reference<chart2::XCoordinateSystem> > xCooSysSeq = xCooSysContainer->getCoordinateSystems(); + const uno::Sequence<uno::Reference<chart2::XCoordinateSystem> > xCooSysSeq = xCooSysContainer->getCoordinateSystems(); if (!xCooSysSeq.hasElements()) return false; diff --git a/sc/source/filter/xml/XMLExportDatabaseRanges.cxx b/sc/source/filter/xml/XMLExportDatabaseRanges.cxx index 4ab20b0932f6..e494b2486c6f 100644 --- a/sc/source/filter/xml/XMLExportDatabaseRanges.cxx +++ b/sc/source/filter/xml/XMLExportDatabaseRanges.cxx @@ -141,7 +141,7 @@ ScMyEmptyDatabaseRangesContainer ScXMLExportDatabaseRanges::GetEmptyDatabaseRang rExport.CheckAttrList(); if (xDatabaseRanges.is()) { - uno::Sequence <OUString> aRanges(xDatabaseRanges->getElementNames()); + const uno::Sequence <OUString> aRanges(xDatabaseRanges->getElementNames()); for (const OUString& sDatabaseRangeName : aRanges) { uno::Reference <sheet::XDatabaseRange> xDatabaseRange(xDatabaseRanges->getByName(sDatabaseRangeName), uno::UNO_QUERY); @@ -151,7 +151,7 @@ ScMyEmptyDatabaseRangesContainer ScXMLExportDatabaseRanges::GetEmptyDatabaseRang if (xDatabaseRangePropertySet.is() && ::cppu::any2bool(xDatabaseRangePropertySet->getPropertyValue(SC_UNONAME_STRIPDAT))) { - uno::Sequence <beans::PropertyValue> aImportProperties(xDatabaseRange->getImportDescriptor()); + const uno::Sequence <beans::PropertyValue> aImportProperties(xDatabaseRange->getImportDescriptor()); sheet::DataImportMode nSourceType = sheet::DataImportMode_NONE; for (const auto& rProp : aImportProperties) if ( rProp.Name == SC_UNONAME_SRCTYPE ) diff --git a/sc/source/ui/dbgui/dapidata.cxx b/sc/source/ui/dbgui/dapidata.cxx index 638d6a20b8f3..75e895f25a5f 100644 --- a/sc/source/ui/dbgui/dapidata.cxx +++ b/sc/source/ui/dbgui/dapidata.cxx @@ -54,7 +54,7 @@ ScDataPilotDatabaseDlg::ScDataPilotDatabaseDlg(weld::Window* pParent) uno::Reference<sdb::XDatabaseContext> xContext = sdb::DatabaseContext::create( comphelper::getProcessComponentContext() ); - uno::Sequence<OUString> aNames = xContext->getElementNames(); + const uno::Sequence<OUString> aNames = xContext->getElementNames(); for( const OUString& aName : aNames ) { m_xLbDatabase->append_text(aName); @@ -131,7 +131,7 @@ void ScDataPilotDatabaseDlg::FillObjects() uno::Reference<sdbc::XConnection> xConnection = xSource->connectWithCompletion( xHandler ); - uno::Sequence<OUString> aNames; + uno::Reference<container::XNameAccess> xItems; if ( nSelect == DP_TYPELIST_TABLE ) { // get all tables @@ -139,10 +139,7 @@ void ScDataPilotDatabaseDlg::FillObjects() uno::Reference<sdbcx::XTablesSupplier> xTablesSupp( xConnection, uno::UNO_QUERY ); if ( !xTablesSupp.is() ) return; - uno::Reference<container::XNameAccess> xTables = xTablesSupp->getTables(); - if ( !xTables.is() ) return; - - aNames = xTables->getElementNames(); + xItems = xTablesSupp->getTables(); } else { @@ -151,14 +148,13 @@ void ScDataPilotDatabaseDlg::FillObjects() uno::Reference<sdb::XQueriesSupplier> xQueriesSupp( xConnection, uno::UNO_QUERY ); if ( !xQueriesSupp.is() ) return; - uno::Reference<container::XNameAccess> xQueries = xQueriesSupp->getQueries(); - if ( !xQueries.is() ) return; - - aNames = xQueries->getElementNames(); + xItems = xQueriesSupp->getQueries(); } - // fill list + if ( !xItems.is() ) return; + // fill list + const uno::Sequence<OUString> aNames = xItems->getElementNames(); for( const OUString& aName : aNames ) { m_xCbObject->append_text(aName); diff --git a/sc/source/ui/dbgui/tpsort.cxx b/sc/source/ui/dbgui/tpsort.cxx index d4654e3b83f4..1df0446cf722 100644 --- a/sc/source/ui/dbgui/tpsort.cxx +++ b/sc/source/ui/dbgui/tpsort.cxx @@ -887,7 +887,7 @@ void ScTabPageSortOptions::FillAlgor() else { lang::Locale aLocale( LanguageTag::convertToLocale( eLang )); - uno::Sequence<OUString> aAlgos = m_xColWrap->listCollatorAlgorithms( aLocale ); + const uno::Sequence<OUString> aAlgos = m_xColWrap->listCollatorAlgorithms( aLocale ); long nCount = aAlgos.getLength(); for (const OUString& sAlg : aAlgos) diff --git a/sc/source/ui/docshell/docsh2.cxx b/sc/source/ui/docshell/docsh2.cxx index 00ecfe4b293d..3749d4eff038 100644 --- a/sc/source/ui/docshell/docsh2.cxx +++ b/sc/source/ui/docshell/docsh2.cxx @@ -123,7 +123,7 @@ void ScDocShell::InitItems() if (!m_aDocument.GetForbiddenCharacters()) { // set forbidden characters if necessary - uno::Sequence<lang::Locale> aLocales = aAsian.GetStartEndCharLocales(); + const uno::Sequence<lang::Locale> aLocales = aAsian.GetStartEndCharLocales(); if (aLocales.hasElements()) { std::shared_ptr<SvxForbiddenCharactersTable> xForbiddenTable( diff --git a/sc/source/ui/miscdlgs/solverutil.cxx b/sc/source/ui/miscdlgs/solverutil.cxx index 48af88892c21..c5f3752bdfb4 100644 --- a/sc/source/ui/miscdlgs/solverutil.cxx +++ b/sc/source/ui/miscdlgs/solverutil.cxx @@ -152,7 +152,7 @@ uno::Sequence<beans::PropertyValue> ScSolverUtil::GetDefaults( const OUString& r if ( !xInfo.is() ) return aDefaults; - uno::Sequence<beans::Property> aPropSeq = xInfo->getProperties(); + const uno::Sequence<beans::Property> aPropSeq = xInfo->getProperties(); const sal_Int32 nSize = aPropSeq.getLength(); aDefaults.realloc(nSize); sal_Int32 nValid = 0; diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index a6237eb32731..7a6d0d8f5a1b 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -904,7 +904,7 @@ static void lcl_CopyProperties( beans::XPropertySet& rDest, beans::XPropertySet& uno::Reference<beans::XPropertySetInfo> xInfo(rSource.getPropertySetInfo()); if (xInfo.is()) { - uno::Sequence<beans::Property> aSeq(xInfo->getProperties()); + const uno::Sequence<beans::Property> aSeq(xInfo->getProperties()); for (const beans::Property& rProp : aSeq) { OUString aName(rProp.Name); @@ -1112,9 +1112,8 @@ static bool lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange, long nCols = 0; long nRows = aData.getLength(); - const uno::Sequence<uno::Any>* pArray = aData.getConstArray(); if ( nRows ) - nCols = pArray[0].getLength(); + nCols = aData[0].getLength(); if ( nCols != nEndCol-nStartCol+1 || nRows != nEndRow-nStartRow+1 ) { @@ -1248,9 +1247,8 @@ static bool lcl_PutFormulaArray( ScDocShell& rDocShell, const ScRange& rRange, long nCols = 0; long nRows = aData.getLength(); - const uno::Sequence<OUString>* pArray = aData.getConstArray(); if ( nRows ) - nCols = pArray[0].getLength(); + nCols = aData[0].getLength(); if ( nCols != nEndCol-nStartCol+1 || nRows != nEndRow-nStartRow+1 ) { diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index 797784786db0..f0a94b4f75a5 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -1746,7 +1746,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL ScChart2DataProvider::detectArgum sal_Int32 nDataInCols = 0; bool bRowSourceAmbiguous = false; - Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aSequences( xDataSource->getDataSequences()); + const Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aSequences( xDataSource->getDataSequences()); const sal_Int32 nCount( aSequences.getLength()); RangeAnalyzer aPrevLabel,aPrevValues; for( const uno::Reference< chart2::data::XLabeledDataSequence >& xLS : aSequences ) diff --git a/sc/source/ui/unoobj/chartuno.cxx b/sc/source/ui/unoobj/chartuno.cxx index 9818888a7197..01bff2042eb8 100644 --- a/sc/source/ui/unoobj/chartuno.cxx +++ b/sc/source/ui/unoobj/chartuno.cxx @@ -446,7 +446,7 @@ void ScChartObj::GetData_Impl( ScRangeListRef& rRanges, bool& rColHeaders, bool& uno::Reference< chart2::data::XDataProvider > xProvider = xChartDoc->getDataProvider(); if( xReceiver.is() && xProvider.is() ) { - uno::Sequence< beans::PropertyValue > aArgs( xProvider->detectArguments( xReceiver->getUsedData() ) ); + const uno::Sequence< beans::PropertyValue > aArgs( xProvider->detectArguments( xReceiver->getUsedData() ) ); OUString aRanges; chart::ChartDataRowSource eDataRowSource = chart::ChartDataRowSource_COLUMNS; diff --git a/sc/source/ui/unoobj/condformatuno.cxx b/sc/source/ui/unoobj/condformatuno.cxx index 747b31402778..813ad3515d43 100644 --- a/sc/source/ui/unoobj/condformatuno.cxx +++ b/sc/source/ui/unoobj/condformatuno.cxx @@ -340,7 +340,7 @@ sal_Int32 ScCondFormatsObj::createByRange(const uno::Reference< sheet::XSheetCel if (!xRanges.is()) throw lang::IllegalArgumentException(); - uno::Sequence<table::CellRangeAddress> aRanges = + const uno::Sequence<table::CellRangeAddress> aRanges = xRanges->getRangeAddresses(); ScRangeList aCoreRange; @@ -576,7 +576,7 @@ void SAL_CALL ScCondFormatObj::setPropertyValue( if (aValue >>= xRange) { ScConditionalFormat* pFormat = getCoreObject(); - uno::Sequence<table::CellRangeAddress> aRanges = + const uno::Sequence<table::CellRangeAddress> aRanges = xRange->getRangeAddresses(); ScRangeList aTargetRange; for (const auto& rRange : aRanges) diff --git a/sc/source/ui/unoobj/cursuno.cxx b/sc/source/ui/unoobj/cursuno.cxx index 196fef8c1c88..e5aef385d361 100644 --- a/sc/source/ui/unoobj/cursuno.cxx +++ b/sc/source/ui/unoobj/cursuno.cxx @@ -440,7 +440,7 @@ sal_Bool SAL_CALL ScCellCursorObj::supportsService( const OUString& rServiceName uno::Sequence<OUString> SAL_CALL ScCellCursorObj::getSupportedServiceNames() { // get all service names from cell range - uno::Sequence<OUString> aParentSeq(ScCellRangeObj::getSupportedServiceNames()); + const uno::Sequence<OUString> aParentSeq(ScCellRangeObj::getSupportedServiceNames()); sal_Int32 nParentLen = aParentSeq.getLength(); // SheetCellCursor should be first (?) @@ -450,7 +450,7 @@ uno::Sequence<OUString> SAL_CALL ScCellCursorObj::getSupportedServiceNames() pTotalArr[1] = SCCELLCURSOR_SERVICE; // append cell range services - std::copy_n(aParentSeq.begin(), nParentLen, std::next(aTotalSeq.begin(), 2)); + std::copy_n(aParentSeq.begin(), nParentLen, std::next(pTotalArr, 2)); return aTotalSeq; } diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx index 8228df10868c..3a3f51600f06 100644 --- a/sc/source/ui/unoobj/dapiuno.cxx +++ b/sc/source/ui/unoobj/dapiuno.cxx @@ -1905,7 +1905,7 @@ Any SAL_CALL ScDataPilotFieldObj::getPropertyValue( const OUString& aPropertyNam aRet <<= getFunction(); else if ( aPropertyName == SC_UNONAME_SUBTOTALS ) { - uno::Sequence<sal_Int16> aSeq = getSubtotals(); + const uno::Sequence<sal_Int16> aSeq = getSubtotals(); uno::Sequence<sheet::GeneralFunction> aNewSeq; aNewSeq.realloc(aSeq.getLength()); std::transform(aSeq.begin(), aSeq.end(), aNewSeq.begin(), diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 7148fce0b323..30067f6ada2d 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -1538,7 +1538,7 @@ bool ScModelObj::FillRenderMarkData( const uno::Any& aSelection, uno::Reference<sheet::XSelectedSheetsSupplier> xSelectedSheets(xView, uno::UNO_QUERY); if (bSelectedSheetsOnly && xSelectedSheets.is()) { - uno::Sequence<sal_Int32> aSelected = xSelectedSheets->getSelectedSheets(); + const uno::Sequence<sal_Int32> aSelected = xSelectedSheets->getSelectedSheets(); ScMarkData::MarkedTabsType aSelectedTabs; SCTAB nMaxTab = pDocShell->GetDocument().GetTableCount() -1; for (const auto& rSelected : aSelected) diff --git a/sc/source/ui/vba/vbachartobjects.cxx b/sc/source/ui/vba/vbachartobjects.cxx index 148fe7b94bce..f817dd8fbb90 100644 --- a/sc/source/ui/vba/vbachartobjects.cxx +++ b/sc/source/ui/vba/vbachartobjects.cxx @@ -107,11 +107,11 @@ ScVbaChartObjects::getChartObjectNames() uno::Reference< sheet::XSpreadsheets > xSpreadsheets = xSpreadsheetDocument->getSheets(); std::vector< OUString > aChartNamesVector; - uno::Sequence< OUString > sSheetNames = xSpreadsheets->getElementNames(); + const uno::Sequence< OUString > sSheetNames = xSpreadsheets->getElementNames(); for (const auto& rSheetName : sSheetNames) { uno::Reference< table::XTableChartsSupplier > xLocTableChartsSupplier( xSpreadsheets->getByName(rSheetName), uno::UNO_QUERY_THROW ); - uno::Sequence< OUString > scurchartnames = xLocTableChartsSupplier->getCharts()->getElementNames(); + const uno::Sequence< OUString > scurchartnames = xLocTableChartsSupplier->getCharts()->getElementNames(); std::copy(scurchartnames.begin(), scurchartnames.end(), std::back_inserter(aChartNamesVector)); } sChartNames = comphelper::containerToSequence( aChartNamesVector ); @@ -150,7 +150,7 @@ ScVbaChartObjects::Add( double _nX, double _nY, double _nWidth, double _nHeight } void SAL_CALL ScVbaChartObjects::Delete( ) { - uno::Sequence< OUString > sChartNames = xTableCharts->getElementNames(); + const uno::Sequence< OUString > sChartNames = xTableCharts->getElementNames(); for (const auto& rChartName : sChartNames) removeByName(rChartName); } diff --git a/sc/source/ui/vba/vbapagebreaks.cxx b/sc/source/ui/vba/vbapagebreaks.cxx index 5372c32a5079..89c871edd3a8 100644 --- a/sc/source/ui/vba/vbapagebreaks.cxx +++ b/sc/source/ui/vba/vbapagebreaks.cxx @@ -113,7 +113,7 @@ sal_Int32 SAL_CALL RangePageBreaks::getCount( ) uno::Reference< excel::XRange > xRange = xWorksheet->getUsedRange(); sal_Int32 nUsedStart = getAPIStartofRange( xRange ); sal_Int32 nUsedEnd = getAPIEndIndexofRange( xRange, nUsedStart ); - uno::Sequence<sheet::TablePageBreakData> aTablePageBreakData = getAllPageBreaks(); + const uno::Sequence<sheet::TablePageBreakData> aTablePageBreakData = getAllPageBreaks(); auto pPageBreak = std::find_if(aTablePageBreakData.begin(), aTablePageBreakData.end(), [nUsedEnd](const sheet::TablePageBreakData& rPageBreak) { return rPageBreak.Position > nUsedEnd + 1; }); @@ -147,7 +147,7 @@ sheet::TablePageBreakData RangePageBreaks::getTablePageBreakData( sal_Int32 nAPI uno::Reference< excel::XRange > xRange = xWorksheet->getUsedRange(); sal_Int32 nUsedStart = getAPIStartofRange( xRange ); sal_Int32 nUsedEnd = getAPIEndIndexofRange( xRange, nUsedStart ); - uno::Sequence<sheet::TablePageBreakData> aTablePageBreakDataList = getAllPageBreaks(); + const uno::Sequence<sheet::TablePageBreakData> aTablePageBreakDataList = getAllPageBreaks(); for( const auto& rTablePageBreakData : aTablePageBreakDataList ) { diff --git a/sc/source/ui/vba/vbapagesetup.cxx b/sc/source/ui/vba/vbapagesetup.cxx index f7a4ac9e6585..f06dbbe701b9 100644 --- a/sc/source/ui/vba/vbapagesetup.cxx +++ b/sc/source/ui/vba/vbapagesetup.cxx @@ -66,7 +66,7 @@ OUString SAL_CALL ScVbaPageSetup::getPrintArea() { OUString aPrintArea; uno::Reference< sheet::XPrintAreas > xPrintAreas( mxSheet, uno::UNO_QUERY_THROW ); - uno::Sequence< table::CellRangeAddress > aSeq = xPrintAreas->getPrintAreas(); + const uno::Sequence< table::CellRangeAddress > aSeq = xPrintAreas->getPrintAreas(); if( aSeq.hasElements() ) { ScAddress::Details aDetails( formula::FormulaGrammar::CONV_XL_A1, 0, 0 ); diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index 4776e6750048..ae253133be66 100644 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -204,7 +204,7 @@ static uno::Any lcl_makeRange( const uno::Reference< XHelperInterface >& rParent static uno::Reference< excel::XRange > lcl_makeXRangeFromSheetCellRanges( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< sheet::XSheetCellRanges >& xLocSheetCellRanges, ScDocShell* pDoc ) { uno::Reference< excel::XRange > xRange; - uno::Sequence< table::CellRangeAddress > sAddresses = xLocSheetCellRanges->getRangeAddresses(); + const uno::Sequence< table::CellRangeAddress > sAddresses = xLocSheetCellRanges->getRangeAddresses(); ScRangeList aCellRanges; if ( sAddresses.hasElements() ) { @@ -2286,7 +2286,7 @@ ScVbaRange::Activate() if ( xRanges.is() ) { - uno::Sequence< table::CellRangeAddress > nAddrs = xRanges->getRangeAddresses(); + const uno::Sequence< table::CellRangeAddress > nAddrs = xRanges->getRangeAddresses(); for ( const auto& rAddr : nAddrs ) { if ( cellInRange( rAddr, thisRangeAddress.StartColumn, thisRangeAddress.StartRow ) ) @@ -4076,7 +4076,7 @@ static uno::Reference< sheet::XCellRangeReferrer > getNamedRange( const uno::Ref uno::Reference< beans::XPropertySet > xProps( xIf, uno::UNO_QUERY_THROW ); uno::Reference< container::XNameAccess > xNameAccess( xProps->getPropertyValue( "NamedRanges" ), uno::UNO_QUERY_THROW ); - uno::Sequence< OUString > sNames = xNameAccess->getElementNames(); + const uno::Sequence< OUString > sNames = xNameAccess->getElementNames(); // uno::Reference< table::XCellRange > thisRange( getCellRange(), uno::UNO_QUERY_THROW ); uno::Reference< sheet::XCellRangeReferrer > xNamedRange; for ( const auto& rName : sNames ) diff --git a/sc/source/ui/vba/vbasheetobject.cxx b/sc/source/ui/vba/vbasheetobject.cxx index bf88b991f05d..2df219af7874 100644 --- a/sc/source/ui/vba/vbasheetobject.cxx +++ b/sc/source/ui/vba/vbasheetobject.cxx @@ -318,7 +318,7 @@ OUString SAL_CALL ScVbaControlObjectBase::getOnAction() { uno::Reference< script::XEventAttacherManager > xEventMgr( mxFormIC, uno::UNO_QUERY_THROW ); sal_Int32 nIndex = getModelIndexInForm(); - uno::Sequence< script::ScriptEventDescriptor > aEvents = xEventMgr->getScriptEvents( nIndex ); + const uno::Sequence< script::ScriptEventDescriptor > aEvents = xEventMgr->getScriptEvents( nIndex ); if( aEvents.hasElements() ) { const OUString aScriptType = "Script"; diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx index 2af1ee854489..e1f0d04da7a4 100644 --- a/sc/source/ui/view/drawvie4.cxx +++ b/sc/source/ui/view/drawvie4.cxx @@ -105,7 +105,7 @@ namespace { void getRangeFromDataSource( uno::Reference< chart2::data::XDataSource > const & xDataSource, std::vector<OUString>& rRangeRep) { - uno::Sequence<uno::Reference<chart2::data::XLabeledDataSequence> > xSeqs = xDataSource->getDataSequences(); + const uno::Sequence<uno::Reference<chart2::data::XLabeledDataSequence> > xSeqs = xDataSource->getDataSequences(); for (const uno::Reference<chart2::data::XLabeledDataSequence>& xLS : xSeqs) { uno::Reference<chart2::data::XDataSequence> xSeq = xLS->getValues(); @@ -133,21 +133,21 @@ void getRangeFromErrorBar(const uno::Reference< chart2::XChartDocument >& rChart if(!xCooSysContainer.is()) return; - uno::Sequence< uno::Reference< chart2::XCoordinateSystem > > xCooSysSequence( xCooSysContainer->getCoordinateSystems()); + const uno::Sequence< uno::Reference< chart2::XCoordinateSystem > > xCooSysSequence( xCooSysContainer->getCoordinateSystems()); for(const auto& rCooSys : xCooSysSequence) { uno::Reference< chart2::XChartTypeContainer > xChartTypeContainer( rCooSys, uno::UNO_QUERY); if(!xChartTypeContainer.is()) continue; - uno::Sequence< uno::Reference< chart2::XChartType > > xChartTypeSequence( xChartTypeContainer->getChartTypes() ); + const uno::Sequence< uno::Reference< chart2::XChartType > > xChartTypeSequence( xChartTypeContainer->getChartTypes() ); for(const auto& rChartType : xChartTypeSequence) { uno::Reference< chart2::XDataSeriesContainer > xDataSequenceContainer( rChartType, uno::UNO_QUERY); if(!xDataSequenceContainer.is()) continue; - uno::Sequence< uno::Reference< chart2::XDataSeries > > xSeriesSequence( xDataSequenceContainer->getDataSeries() ); + const uno::Sequence< uno::Reference< chart2::XDataSeries > > xSeriesSequence( xDataSequenceContainer->getDataSeries() ); for(const uno::Reference<chart2::XDataSeries>& xSeries : xSeriesSequence) { uno::Reference< beans::XPropertySet > xPropSet( xSeries, uno::UNO_QUERY); diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 4bc2f0947a84..a87dc2dd3ed8 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -3312,7 +3312,7 @@ void ScViewData::ReadUserDataSequence(const uno::Sequence <beans::PropertyValue> uno::Reference<container::XNameContainer> xNameContainer; if ((rSetting.Value >>= xNameContainer) && xNameContainer->hasElements()) { - uno::Sequence< OUString > aNames(xNameContainer->getElementNames()); + const uno::Sequence< OUString > aNames(xNameContainer->getElementNames()); for (const OUString& sTabName : aNames) { SCTAB nTab(0); |