diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-08-20 11:15:17 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-08-20 13:59:25 +0200 |
commit | 316b07d0af06948c69c1375c67c01903b8eeb134 (patch) | |
tree | d51f01c2f443c82de5a078b90f189af787308ccf | |
parent | ff6e8c73adef7c86db12287948025954a4fc7746 (diff) |
loplugin:constvars in package..sc
Change-Id: Ibaa9ebd6440d9229ba313f4c130f5752d432b338
Reviewed-on: https://gerrit.libreoffice.org/77792
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
37 files changed, 70 insertions, 69 deletions
diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index fb5ad128dd41..16ae4a9331e0 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -322,7 +322,7 @@ OStorage_Impl::~OStorage_Impl() m_pParent = nullptr; } - for (auto & pair : m_aChildrenMap) + for (const auto & pair : m_aChildrenMap) for (auto pElement : pair.second) delete pElement; m_aChildrenMap.clear(); @@ -654,7 +654,7 @@ void OStorage_Impl::CopyToStorage( const uno::Reference< embed::XStorage >& xDes if ( !m_xPackageFolder.is() ) throw embed::InvalidStorageException( THROW_WHERE ); - for ( auto& pair : m_aChildrenMap ) + for ( const auto& pair : m_aChildrenMap ) for (auto pElement : pair.second) { if ( !pElement->m_bIsRemoved ) @@ -1054,7 +1054,7 @@ void OStorage_Impl::Commit() // there should be no more deleted elements - for ( auto& pair : m_aChildrenMap ) + for ( const auto& pair : m_aChildrenMap ) for (auto pElement : pair.second) { // if it is a 'duplicate commit' inserted elements must be really inserted to package later @@ -1127,7 +1127,7 @@ void OStorage_Impl::Commit() } } - for ( auto& pair : m_aChildrenMap ) + for ( const auto& pair : m_aChildrenMap ) for (auto pElement : pair.second) { // now inserted elements can be inserted to the package @@ -1228,7 +1228,7 @@ void OStorage_Impl::Revert() std::unordered_map<OUString, std::vector<SotElement_Impl*>> oldMap; std::swap(oldMap, m_aChildrenMap); - for (auto & rPair : oldMap) + for (const auto & rPair : oldMap) for (auto pElement : rPair.second) { if ( pElement->m_bIsInserted ) @@ -1855,7 +1855,7 @@ void OStorage::InternalDispose( bool bNotifyImpl ) // deregister m_pData->m_pSubElDispListener and dispose all of them if ( !m_pData->m_aOpenSubComponentsVector.empty() ) { - for ( auto& pComp : m_pData->m_aOpenSubComponentsVector ) + for ( const auto& pComp : m_pData->m_aOpenSubComponentsVector ) { uno::Reference< lang::XComponent > xTmp = pComp; if ( xTmp.is() ) @@ -2399,7 +2399,7 @@ uno::Reference< embed::XStorage > SAL_CALL OStorage::openStorageElement( if ( nStorageMode & embed::ElementModes::TRUNCATE ) { - for (auto & rPair : pElement->m_xStorage->m_aChildrenMap) + for (const auto & rPair : pElement->m_xStorage->m_aChildrenMap) for (auto pElementToDel : rPair.second) m_pImpl->RemoveElement( /*aName*/rPair.first, pElementToDel ); } @@ -3633,7 +3633,7 @@ void SAL_CALL OStorage::revert() throw lang::DisposedException(THROW_WHERE); } - for (auto & rPair : m_pImpl->m_aChildrenMap) + for (const auto & rPair : m_pImpl->m_aChildrenMap) for (auto pElement : rPair.second) { bool bThrow = (pElement->m_xStorage diff --git a/sax/source/tools/fastattribs.cxx b/sax/source/tools/fastattribs.cxx index bc80a5b31f4c..6175c7873882 100644 --- a/sax/source/tools/fastattribs.cxx +++ b/sax/source/tools/fastattribs.cxx @@ -236,7 +236,7 @@ Sequence< Attribute > FastAttributeList::getUnknownAttributes( ) { Sequence< Attribute > aSeq( maUnknownAttributes.size() ); Attribute* pAttr = aSeq.getArray(); - for( auto& rAttr : maUnknownAttributes ) + for( const auto& rAttr : maUnknownAttributes ) rAttr.FillAttribute( pAttr++ ); return aSeq; } diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index 88ff18333622..d95a3f25e435 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -1183,7 +1183,7 @@ void Test::testFormulaCompilerImplicitIntersection2Param() } }; - for (auto& rCase : aTestCases) + for (const auto& rCase : aTestCases) { m_pDoc->SetString(rCase.aCellAddress, rCase.aFormula); const ScFormulaCell* pCell = m_pDoc->GetFormulaCell(rCase.aCellAddress); @@ -1257,7 +1257,7 @@ void Test::testFormulaCompilerImplicitIntersection1ParamNoChange() } }; - for (auto& rCase : aCasesNoChange) + for (const auto& rCase : aCasesNoChange) { if (rCase.bMatrixFormula) { @@ -1364,7 +1364,7 @@ void Test::testFormulaCompilerImplicitIntersection1ParamWithChange() } }; - for (auto& rCase : aCasesWithChange) + for (const auto& rCase : aCasesWithChange) { m_pDoc->SetString(rCase.aCellAddress, rCase.aFormula); diff --git a/sc/source/core/data/bcaslot.cxx b/sc/source/core/data/bcaslot.cxx index d01c9dc32dfe..73e9c749d5c9 100644 --- a/sc/source/core/data/bcaslot.cxx +++ b/sc/source/core/data/bcaslot.cxx @@ -650,7 +650,7 @@ inline SCSIZE ScBroadcastAreaSlotMachine::ComputeSlotOffset( OSL_FAIL( "Row/Col invalid, using first slot!" ); return 0; } - for (ScSlotData & i : aSlotDistribution) + for (const ScSlotData & i : aSlotDistribution) { if (nRow < i.nStopRow) { diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 3177f0adc888..8a0bd5ff47bc 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -204,7 +204,7 @@ bool ScDocument::IsAddressInRangeName( RangeNameScope eScope, const ScAddress& r else pRangeNames= GetRangeName(rAddress.Tab()); - for (auto& rEntry : *pRangeNames) + for (const auto& rEntry : *pRangeNames) { if (rEntry.second->IsValidReference(aNameRange)) { diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx index 98e5321253a2..50ce32431e8f 100644 --- a/sc/source/core/data/documen7.cxx +++ b/sc/source/core/data/documen7.cxx @@ -365,7 +365,7 @@ void ScDocument::CalcFormulaTree( bool bOnlyForced, bool bProgressBar, bool bSet } pCell = pCell->GetNext(); } - for (auto& rpCell : vAlwaysDirty) + for (const auto& rpCell : vAlwaysDirty) { pCell = rpCell; if (!pCell->GetDirty()) diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx index 7440e84a4f95..2c1fd4ec00bd 100644 --- a/sc/source/core/data/documen8.cxx +++ b/sc/source/core/data/documen8.cxx @@ -431,7 +431,7 @@ const ScDocumentThreadSpecific& ScDocument::CalculateInColumnInThread( ScInterpr void ScDocument::HandleStuffAfterParallelCalculation( const ScAddress& rTopPos, size_t nLen ) { assert(!IsThreadedGroupCalcInProgress()); - for( DelayedSetNumberFormat& data : GetNonThreadedContext().maDelayedSetNumberFormat) + for( const DelayedSetNumberFormat& data : GetNonThreadedContext().maDelayedSetNumberFormat) SetNumberFormat( ScAddress( rTopPos.Col(), data.mRow, rTopPos.Tab()), data.mnNumberFormat ); GetNonThreadedContext().maDelayedSetNumberFormat.clear(); diff --git a/sc/source/core/data/document10.cxx b/sc/source/core/data/document10.cxx index 877809901297..064196ef6806 100644 --- a/sc/source/core/data/document10.cxx +++ b/sc/source/core/data/document10.cxx @@ -519,7 +519,7 @@ void ScDocument::StartAllListeners( const ScRange& rRange ) void ScDocument::finalizeOutlineImport() { - for (auto& rxTab : maTabs) + for (const auto& rxTab : maTabs) { ScTable* p = rxTab.get(); p->finalizeOutlineImport(); diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 3daf8c4442af..d82e58ef6ffe 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -583,7 +583,7 @@ sc::FormulaGroupAreaListener* ScFormulaCellGroup::getAreaListener( void ScFormulaCellGroup::endAllGroupListening( ScDocument& rDoc ) { - for (auto& rEntry : mpImpl->m_AreaListeners) + for (const auto& rEntry : mpImpl->m_AreaListeners) { sc::FormulaGroupAreaListener *const pListener = rEntry.second.get(); ScRange aListenRange = pListener->getListeningRange(); diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 25779341e2f5..df0a1517f63a 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -2058,7 +2058,7 @@ bool ScTable::HasAttribSelection( const ScMarkData& rMark, HasAttrFlags nMask ) { std::vector<sc::ColRowSpan> aSpans = rMark.GetMarkedColSpans(); - for (sc::ColRowSpan & aSpan : aSpans) + for (const sc::ColRowSpan & aSpan : aSpans) { for (SCCOLROW j = aSpan.mnStart; j <= aSpan.mnEnd; ++j) { @@ -2361,7 +2361,7 @@ bool ScTable::HasSelectionMatrixFragment( const ScMarkData& rMark ) const { std::vector<sc::ColRowSpan> aSpans = rMark.GetMarkedColSpans(); - for (sc::ColRowSpan & aSpan : aSpans) + for (const sc::ColRowSpan & aSpan : aSpans) { SCCOL nEndCol = ClampToAllocatedColumns(aSpan.mnEnd); for ( SCCOLROW j=aSpan.mnStart; j<=nEndCol; j++ ) diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index 270603aa97e8..94a84b0cf941 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -1177,7 +1177,7 @@ void ScTable::SortReorderByRowRefUpdate( aMoveRange, sc::AreaOverlapType::InsideOrOverlap, sc::ListenerGroupType::Group); { - for (auto& rGrpListener : aGrpListeners) + for (const auto& rGrpListener : aGrpListeners) { assert(rGrpListener.mbGroupListening); SvtListener* pGrpLis = rGrpListener.mpListener; diff --git a/sc/source/core/opencl/op_math.cxx b/sc/source/core/opencl/op_math.cxx index 4ed984941d87..13f341b08a04 100644 --- a/sc/source/core/opencl/op_math.cxx +++ b/sc/source/core/opencl/op_math.cxx @@ -2373,7 +2373,7 @@ void OpSumSQ::GenSlidingWindowFunction(std::stringstream &ss, ss << "{\n"; ss << " int gid0=get_global_id(0);\n"; ss << " double sum = 0.0f, arg;\n"; - for(DynamicKernelArgumentRef & rArg : vSubArguments) + for(const DynamicKernelArgumentRef & rArg : vSubArguments) { FormulaToken *tmpCur = rArg->GetFormulaToken(); assert(tmpCur); diff --git a/sc/source/core/opencl/op_statistical.cxx b/sc/source/core/opencl/op_statistical.cxx index 863f1be4db8c..ad0cf0358223 100644 --- a/sc/source/core/opencl/op_statistical.cxx +++ b/sc/source/core/opencl/op_statistical.cxx @@ -3415,7 +3415,7 @@ void OpGeoMean::GenSlidingWindowFunction( ss << " int offset;\n"; ss << " barrier(CLK_LOCAL_MEM_FENCE);\n"; - for(DynamicKernelArgumentRef & rArg : vSubArguments) + for(const DynamicKernelArgumentRef & rArg : vSubArguments) { assert(rArg->GetFormulaToken()); @@ -4723,7 +4723,7 @@ void OpMedian::GenSlidingWindowFunction( ss << " unsigned int startFlag = 0;\n"; ss << " unsigned int endFlag = 0;\n"; ss << " double dataIna;\n"; - for (DynamicKernelArgumentRef & rArg : vSubArguments) + for (const DynamicKernelArgumentRef & rArg : vSubArguments) { FormulaToken *pCur = rArg->GetFormulaToken(); assert(pCur); diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx index 9d9cab039814..d7f92341a634 100644 --- a/sc/source/core/tool/chgtrack.cxx +++ b/sc/source/core/tool/chgtrack.cxx @@ -2131,7 +2131,7 @@ void ScChangeTrack::DtorClear() pNext = p->GetNext(); delete p; } - for( auto& rEntry : aPasteCutMap ) + for( const auto& rEntry : aPasteCutMap ) { delete rEntry.second; } diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx index c2076413e404..867952b88683 100644 --- a/sc/source/core/tool/dbdata.cxx +++ b/sc/source/core/tool/dbdata.cxx @@ -1427,7 +1427,7 @@ void ScDBCollection::DeleteOnTab( SCTAB nTab ) } // Delete them all. - for (auto& rIter : v) + for (const auto& rIter : v) maNamedDBs.erase(rIter); maAnonDBs.deleteOnTab(nTab); diff --git a/sc/source/core/tool/jumpmatrix.cxx b/sc/source/core/tool/jumpmatrix.cxx index f3eb438cb940..2bf712f649de 100644 --- a/sc/source/core/tool/jumpmatrix.cxx +++ b/sc/source/core/tool/jumpmatrix.cxx @@ -52,7 +52,7 @@ ScJumpMatrix::ScJumpMatrix( OpCode eOp, SCSIZE nColsP, SCSIZE nRowsP ) ScJumpMatrix::~ScJumpMatrix() { - for (auto & i : mvParams) + for (const auto & i : mvParams) i->DecRef(); } diff --git a/sc/source/core/tool/parclass.cxx b/sc/source/core/tool/parclass.cxx index 18c4ad5b84f7..bb6c943299a6 100644 --- a/sc/source/core/tool/parclass.cxx +++ b/sc/source/core/tool/parclass.cxx @@ -329,7 +329,7 @@ void ScParameterClassification::Init() pRun->aData.nParam[CommonData::nMaxParams-1] != Bounds) pRun->nMinParams = CommonData::nMaxParams; } - for (formula::ParamClass & j : pRun->aData.nParam) + for (const formula::ParamClass & j : pRun->aData.nParam) { if ( j == ForceArray || j == ReferenceOrForceArray ) { diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx index 1af32fe41de5..4298bb1ea92e 100644 --- a/sc/source/core/tool/rangelst.cxx +++ b/sc/source/core/tool/rangelst.cxx @@ -404,7 +404,7 @@ bool ScRangeList::UpdateReference( void ScRangeList::InsertRow( SCTAB nTab, SCCOL nColStart, SCCOL nColEnd, SCROW nRowPos, SCSIZE nSize ) { std::vector<ScRange> aNewRanges; - for(auto & rRange : maRanges) + for(const auto & rRange : maRanges) { if(rRange.aStart.Tab() <= nTab && rRange.aEnd.Tab() >= nTab) { @@ -422,7 +422,7 @@ void ScRangeList::InsertRow( SCTAB nTab, SCCOL nColStart, SCCOL nColEnd, SCROW n } } - for(auto & rRange : aNewRanges) + for(const auto & rRange : aNewRanges) { if(!rRange.IsValid()) continue; @@ -434,7 +434,7 @@ void ScRangeList::InsertRow( SCTAB nTab, SCCOL nColStart, SCCOL nColEnd, SCROW n void ScRangeList::InsertCol( SCTAB nTab, SCROW nRowStart, SCROW nRowEnd, SCCOL nColPos, SCSIZE nSize ) { std::vector<ScRange> aNewRanges; - for(auto & rRange : maRanges) + for(const auto & rRange : maRanges) { if(rRange.aStart.Tab() <= nTab && rRange.aEnd.Tab() >= nTab) { @@ -450,7 +450,7 @@ void ScRangeList::InsertCol( SCTAB nTab, SCROW nRowStart, SCROW nRowEnd, SCCOL n } } - for(auto & rRange : aNewRanges) + for(const auto & rRange : aNewRanges) { if(!rRange.IsValid()) continue; @@ -954,7 +954,7 @@ bool ScRangeList::DeleteArea( SCCOL nCol1, SCROW nRow1, SCTAB nTab1, continue; } } - for(auto & rRange : aNewRanges) + for(const auto & rRange : aNewRanges) Join(rRange); return bChanged; diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx index 3ab025d0cb60..4c30945d48e4 100644 --- a/sc/source/filter/excel/xestyle.cxx +++ b/sc/source/filter/excel/xestyle.cxx @@ -583,7 +583,7 @@ void XclExpPaletteImpl::RawReducePalette( sal_uInt32 nPass ) sal_uInt8 nFactor3 = static_cast< sal_uInt8 >( 0x40 >> nPass ); // process each color in the old color list - for(std::unique_ptr<XclListColor> & pOldColor : *xOldList) + for(const std::unique_ptr<XclListColor> & pOldColor : *xOldList) { // get the old list entry const XclListColor* pOldEntry = pOldColor.get(); @@ -2593,14 +2593,14 @@ void XclExpXFBuffer::SaveXml( XclExpXmlStream& rStrm ) sax_fastparser::FSHelperPtr& rStyleSheet = rStrm.GetCurrentStream(); rStyleSheet->startElement(XML_fills, XML_count, OString::number(maFills.size())); - for( auto& rFill : maFills ) + for( const auto& rFill : maFills ) { rFill.SaveXml( rStrm ); } rStyleSheet->endElement( XML_fills ); rStyleSheet->startElement(XML_borders, XML_count, OString::number(maBorders.size())); - for( auto& rBorder : maBorders ) + for( const auto& rBorder : maBorders ) { rBorder.SaveXml( rStrm ); } diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index 3b82ff4732bf..eb547482b0d9 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -1347,7 +1347,7 @@ void ScHTMLLayoutParser::Image( HtmlImportInfo* pInfo ) if (!mxActEntry->maImageList.empty()) { long nWidth = 0; - for (std::unique_ptr<ScHTMLImage> & pI : mxActEntry->maImageList) + for (const std::unique_ptr<ScHTMLImage> & pI : mxActEntry->maImageList) { if ( pI->nDir & nHorizontal ) nWidth += pI->aSize.Width() + 2 * pI->aSpace.X(); diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx index af58c026c4af..bcdd8496ebbe 100644 --- a/sc/source/filter/oox/condformatbuffer.cxx +++ b/sc/source/filter/oox/condformatbuffer.cxx @@ -251,7 +251,7 @@ ScColorScaleEntry* ConvertToModel( const ColorScaleRuleModelEntry& rEntry, ScDoc void ColorScaleRule::AddEntries( ScColorScaleFormat* pFormat, ScDocument* pDoc, const ScAddress& rAddr ) { - for(ColorScaleRuleModelEntry & rEntry : maColorScaleRuleEntries) + for(const ColorScaleRuleModelEntry & rEntry : maColorScaleRuleEntries) { ScColorScaleEntry* pEntry = ConvertToModel( rEntry, pDoc, rAddr ); @@ -379,7 +379,7 @@ void IconSetRule::importIcon(const AttributeList& rAttribs) void IconSetRule::SetData( ScIconSetFormat* pFormat, ScDocument* pDoc, const ScAddress& rPos ) { - for(ColorScaleRuleModelEntry & rEntry : maEntries) + for(const ColorScaleRuleModelEntry & rEntry : maEntries) { ScColorScaleEntry* pModelEntry = ConvertToModel( rEntry, pDoc, rPos ); mxFormatData->m_Entries.push_back(std::unique_ptr<ScColorScaleEntry>(pModelEntry)); diff --git a/sc/source/filter/oox/formulaparser.cxx b/sc/source/filter/oox/formulaparser.cxx index f953fcced3a8..0426e3c433e1 100644 --- a/sc/source/filter/oox/formulaparser.cxx +++ b/sc/source/filter/oox/formulaparser.cxx @@ -619,7 +619,7 @@ ApiTokenSequence FormulaParserImpl::finalizeImport() if( aTokens.hasElements() ) { ApiToken* pToken = aTokens.getArray(); - for( auto& tokenIndex : maTokenIndexes ) + for( const auto& tokenIndex : maTokenIndexes ) { *pToken = maTokenStorage[ tokenIndex ]; ++pToken; diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx index f6f27d1b061c..9c6d36b218b6 100644 --- a/sc/source/filter/rtf/eeimpars.cxx +++ b/sc/source/filter/rtf/eeimpars.cxx @@ -487,7 +487,7 @@ bool ScEEImport::GraphicSize( SCCOL nCol, SCROW nRow, ScEEParseEntry* pE ) long nWidth, nHeight; nWidth = nHeight = 0; sal_Char nDir = nHorizontal; - for (std::unique_ptr<ScHTMLImage> & pImage : pE->maImageList) + for (const std::unique_ptr<ScHTMLImage> & pImage : pE->maImageList) { ScHTMLImage* pI = pImage.get(); if ( pI->pGraphic ) @@ -563,7 +563,7 @@ void ScEEImport::InsertGraphic( SCCOL nCol, SCROW nRow, SCTAB nTab, Point aSpace; Size aLogicSize; sal_Char nDir = nHorizontal; - for (std::unique_ptr<ScHTMLImage> & pImage : pE->maImageList) + for (const std::unique_ptr<ScHTMLImage> & pImage : pE->maImageList) { ScHTMLImage* pI = pImage.get(); if ( nDir & nHorizontal ) diff --git a/sc/source/filter/rtf/rtfparse.cxx b/sc/source/filter/rtf/rtfparse.cxx index 7579f50c4624..9a258823c309 100644 --- a/sc/source/filter/rtf/rtfparse.cxx +++ b/sc/source/filter/rtf/rtfparse.cxx @@ -218,7 +218,7 @@ void ScRTFParser::NewCellRow() } } // Build up TwipCols only after nLastWidth comparison! - for (std::unique_ptr<ScRTFCellDefault> & pCellDefault : maDefaultList) + for (const std::unique_ptr<ScRTFCellDefault> & pCellDefault : maDefaultList) { const ScRTFCellDefault& rD = *pCellDefault; SCCOL nCol; diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index da3bfc0f13d8..0372e9f3d418 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -4022,7 +4022,7 @@ void ScXMLExport::WriteExternalDataMapping() if (!rDataSources.empty()) { SvXMLElementExport aMappings(*this, XML_NAMESPACE_CALC_EXT, XML_DATA_MAPPINGS, true, true); - for (auto& itr : rDataSources) + for (const auto& itr : rDataSources) { AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, itr.getURL()); AddAttribute(XML_NAMESPACE_CALC_EXT, XML_PROVIDER, itr.getProvider()); diff --git a/sc/source/ui/dataprovider/csvdataprovider.cxx b/sc/source/ui/dataprovider/csvdataprovider.cxx index 034f8bef024d..56a5353b0a18 100644 --- a/sc/source/ui/dataprovider/csvdataprovider.cxx +++ b/sc/source/ui/dataprovider/csvdataprovider.cxx @@ -110,7 +110,7 @@ void CSVFetchThread::execute() orcus::csv_parser<CSVHandler> parser(aBuffer.getStr(), aBuffer.getLength(), aHdl, maConfig); parser.parse(); - for (auto& itr : maDataTransformations) + for (const auto& itr : maDataTransformations) { itr->Transform(mrDocument); } diff --git a/sc/source/ui/dbgui/PivotLayoutTreeList.cxx b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx index c8d2aef69234..6882a19ee6e7 100644 --- a/sc/source/ui/dbgui/PivotLayoutTreeList.cxx +++ b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx @@ -69,7 +69,7 @@ void ScPivotLayoutTreeList::FillFields(ScPivotFieldVector& rFieldVector) mxControl->clear(); maItemValues.clear(); - for (ScPivotField& rField : rFieldVector) + for (const ScPivotField& rField : rFieldVector) { OUString aLabel = mpParent->GetItem( rField.nCol )->maName; ScItemValue* pItemValue = new ScItemValue( aLabel, rField.nCol, rField.nFuncMask ); diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx index 5a10cb96a2f9..dec6a897ee95 100644 --- a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx +++ b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx @@ -113,7 +113,7 @@ void ScPivotLayoutTreeListData::FillDataField(ScPivotFieldVector& rDataFields) mxControl->clear(); maDataItemValues.clear(); - for (ScPivotField& rField : rDataFields) + for (const ScPivotField& rField : rDataFields) { if (rField.nCol == PIVOT_DATA_FIELD) continue; diff --git a/sc/source/ui/miscdlgs/conflictsdlg.cxx b/sc/source/ui/miscdlgs/conflictsdlg.cxx index 28d69d0421ba..0660e44a6106 100644 --- a/sc/source/ui/miscdlgs/conflictsdlg.cxx +++ b/sc/source/ui/miscdlgs/conflictsdlg.cxx @@ -217,7 +217,7 @@ bool ScConflictsFinder::Find() if ( !aOwnActions.empty() ) { ScConflictsListEntry& rEntry = GetEntry(pSharedAction->GetActionNumber(), aOwnActions); - for ( auto& aOwnAction : aOwnActions ) + for ( const auto& aOwnAction : aOwnActions ) { if (!ScConflictsListHelper::HasOwnAction(mrConflictsList, aOwnAction)) { @@ -603,7 +603,7 @@ void ScConflictsDlg::UpdateView() std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator()); rTreeView.insert(nullptr, -1, &sString, &sId, nullptr, nullptr, nullptr, false, xRootEntry.get()); - for ( auto& aSharedAction : rConflictEntry.maSharedActions ) + for ( const auto& aSharedAction : rConflictEntry.maSharedActions ) { ScChangeAction* pAction = mpSharedTrack ? mpSharedTrack->GetAction(aSharedAction) : nullptr; if ( pAction ) @@ -623,7 +623,7 @@ void ScConflictsDlg::UpdateView() } } - for ( auto& aOwnAction : rConflictEntry.maOwnActions ) + for ( const auto& aOwnAction : rConflictEntry.maOwnActions ) { ScChangeAction* pAction = mpOwnTrack ? mpOwnTrack->GetAction(aOwnAction) : nullptr; if ( pAction ) diff --git a/sc/source/ui/miscdlgs/dataproviderdlg.cxx b/sc/source/ui/miscdlgs/dataproviderdlg.cxx index 726e4f264d4a..108a0f6b9e74 100644 --- a/sc/source/ui/miscdlgs/dataproviderdlg.cxx +++ b/sc/source/ui/miscdlgs/dataproviderdlg.cxx @@ -72,7 +72,7 @@ ScDataProviderBaseControl::ScDataProviderBaseControl(vcl::Window* pParent, get(maEditID, "ed_id"); auto aDataProvider = sc::DataProviderFactory::getDataProviders(); - for (auto& rDataProvider : aDataProvider) + for (const auto& rDataProvider : aDataProvider) { maProviderList->InsertEntry(rDataProvider); } @@ -297,7 +297,7 @@ std::shared_ptr<sc::DataTransformation> ScDeleteColumnTransformationControl::get OUString aColumnString = maColumnNums->GetText(); std::vector<OUString> aSplitColumns = comphelper::string::split(aColumnString, ';'); std::set<SCCOL> ColNums; - for (auto& rColStr : aSplitColumns) + for (const auto& rColStr : aSplitColumns) { sal_Int32 nCol = rColStr.toInt32(); if (nCol <= 0) @@ -430,7 +430,7 @@ std::shared_ptr<sc::DataTransformation> ScMergeColumnTransformationControl::getT OUString aColumnString = mpEdColumns->GetText(); std::vector<OUString> aSplitColumns = comphelper::string::split(aColumnString, ';'); std::set<SCCOL> aMergedColumns; - for (auto& rColStr : aSplitColumns) + for (const auto& rColStr : aSplitColumns) { sal_Int32 nCol = rColStr.toInt32(); if (nCol <= 0) @@ -559,7 +559,7 @@ std::shared_ptr<sc::DataTransformation> ScColumnTextTransformation::getTransform OUString aColumnString = maColumnNums->GetText(); std::vector<OUString> aSplitColumns = comphelper::string::split(aColumnString, ';'); std::set<SCCOL> aColumns; - for (auto& rColStr : aSplitColumns) + for (const auto& rColStr : aSplitColumns) { sal_Int32 nCol = rColStr.toInt32(); if (nCol <= 0) @@ -641,7 +641,7 @@ std::shared_ptr<sc::DataTransformation> ScAggregateFunction::getTransformation() sal_Int32 nPos = maType->GetSelectedEntryPos(); std::vector<OUString> aSplitColumns = comphelper::string::split(aColumnString, ';'); std::set<SCCOL> aColumns; - for (auto& rColStr : aSplitColumns) + for (const auto& rColStr : aSplitColumns) { sal_Int32 nCol = rColStr.toInt32(); if (nCol <= 0) @@ -721,7 +721,7 @@ std::shared_ptr<sc::DataTransformation> ScNumberTransformation::getTransformatio sal_Int32 nPos = maType->GetSelectedEntryPos(); std::vector<OUString> aSplitColumns = comphelper::string::split(aColumnString, ';'); std::set<SCCOL> aColumns; - for (auto& rColStr : aSplitColumns) + for (const auto& rColStr : aSplitColumns) { sal_Int32 nCol = rColStr.toInt32(); if (nCol <= 0) @@ -818,7 +818,7 @@ std::shared_ptr<sc::DataTransformation> ScReplaceNullTransformation::getTransfor OUString aReplaceWithString = maReplaceString->GetText(); std::vector<OUString> aSplitColumns = comphelper::string::split(aColumnString, ';'); std::set<SCCOL> aColumns; - for (auto& rColStr : aSplitColumns) + for (const auto& rColStr : aSplitColumns) { sal_Int32 nCol = rColStr.toInt32(); if (nCol <= 0) @@ -884,7 +884,7 @@ std::shared_ptr<sc::DataTransformation> ScDateTimeTransformation::getTransformat sal_Int32 nPos = maType->GetSelectedEntryPos(); std::vector<OUString> aSplitColumns = comphelper::string::split(aColumnString, ';'); std::set<SCCOL> aColumns; - for (auto& rColStr : aSplitColumns) + for (const auto& rColStr : aSplitColumns) { sal_Int32 nCol = rColStr.toInt32(); if (nCol <= 0) @@ -991,7 +991,7 @@ void ScDataProviderDlg::InitMenu() { mpBar->InsertItem(MENU_START, "Start"); VclPtrInstance<PopupMenu> pPopup; - for (auto& itrStartData : aStartData) + for (const auto& itrStartData : aStartData) { pPopup->InsertItem(itrStartData.nMenuID, OUString::createFromAscii(itrStartData.aMenuName)); } @@ -1001,7 +1001,7 @@ void ScDataProviderDlg::InitMenu() mpBar->InsertItem(MENU_COLUMN, "Column"); VclPtrInstance<PopupMenu> pColumnMenu; - for (auto& itrColumnData : aColumnData) + for (const auto& itrColumnData : aColumnData) { pColumnMenu->InsertItem(itrColumnData.nMenuID, OUString::createFromAscii(itrColumnData.aMenuName)); } diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx index f56ef4a2051f..5b831552b5b1 100644 --- a/sc/source/ui/undo/undocell.cxx +++ b/sc/source/ui/undo/undocell.cxx @@ -199,7 +199,7 @@ void ScUndoEnterData::SetChangeTrack() { mnEndChangeAction = pChangeTrack->GetActionMax() + 1; ScAddress aPos(maPos); - for (Value & rOldValue : maOldValues) + for (const Value & rOldValue : maOldValues) { aPos.SetTab(rOldValue.mnTab); sal_uLong nFormat = 0; @@ -219,7 +219,7 @@ void ScUndoEnterData::Undo() BeginUndo(); ScDocument& rDoc = pDocShell->GetDocument(); - for (Value & rVal : maOldValues) + for (const Value & rVal : maOldValues) { ScCellValue aNewCell; aNewCell.assign(rVal.maCell, rDoc, ScCloneFlags::StartListening); @@ -255,7 +255,7 @@ void ScUndoEnterData::Redo() BeginRedo(); ScDocument& rDoc = pDocShell->GetDocument(); - for (Value & rOldValue : maOldValues) + for (const Value & rOldValue : maOldValues) { SCTAB nTab = rOldValue.mnTab; if (mpNewEditData) diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 7a6d0d8f5a1b..610e603cd74b 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -1631,7 +1631,7 @@ void ScCellRangesBase::Notify( SfxBroadcaster&, const SfxHint& rHint ) // the EventObject holds a Ref to this object until after the listener calls ScDocument& rDoc = pDocShell->GetDocument(); - for (uno::Reference<util::XModifyListener> & xValueListener : aValueListeners) + for (const uno::Reference<util::XModifyListener> & xValueListener : aValueListeners) rDoc.AddUnoListenerCall( xValueListener, aEvent ); bGotDataChangedHint = false; diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index f0a94b4f75a5..44226d05e2e4 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -2785,7 +2785,7 @@ void ScChart2DataSequence::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint if( m_pDocument ) { - for (uno::Reference<util::XModifyListener> & xListener: m_aValueListeners) + for (const uno::Reference<util::XModifyListener> & xListener: m_aValueListeners) m_pDocument->AddUnoListenerCall( xListener, aEvent ); } diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx index 26809c5190ae..195b2a1b4ac8 100644 --- a/sc/source/ui/unoobj/dapiuno.cxx +++ b/sc/source/ui/unoobj/dapiuno.cxx @@ -1319,7 +1319,7 @@ void ScDataPilotTableObj::Refreshed_Impl() // the EventObject holds a Ref to this object until after the listener calls ScDocument& rDoc = GetDocShell()->GetDocument(); - for (uno::Reference<util::XModifyListener> & xModifyListener : aModifyListeners) + for (const uno::Reference<util::XModifyListener> & xModifyListener : aModifyListeners) rDoc.AddUnoListenerCall( xModifyListener, aEvent ); } diff --git a/sc/source/ui/unoobj/unoreflist.cxx b/sc/source/ui/unoobj/unoreflist.cxx index 2f5bb0ea537d..b2c1fb5f0ca7 100644 --- a/sc/source/ui/unoobj/unoreflist.cxx +++ b/sc/source/ui/unoobj/unoreflist.cxx @@ -35,7 +35,7 @@ void ScUnoRefList::Add( sal_Int64 nId, const ScRangeList& rOldRanges ) void ScUnoRefList::Undo( ScDocument* pDoc ) { - for (auto & entry: aEntries) + for (const auto & entry: aEntries) { ScUnoRefUndoHint aHint(entry); pDoc->BroadcastUno( aHint ); diff --git a/sc/source/ui/vba/vbafiledialog.cxx b/sc/source/ui/vba/vbafiledialog.cxx index 40a4d6246e29..e610f2647ccd 100644 --- a/sc/source/ui/vba/vbafiledialog.cxx +++ b/sc/source/ui/vba/vbafiledialog.cxx @@ -98,7 +98,8 @@ sal_Int32 ScVbaFileDialog::Show() break; } - for( auto& sURL : xFilePicker->getSelectedFiles() ) + const uno::Sequence<OUString> aSelectedFiles = xFilePicker->getSelectedFiles(); + for( const auto& sURL : aSelectedFiles ) { OUString sPath; osl::FileBase::getSystemPathFromFileURL(sURL, sPath); diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index ad9f4a61cd05..021a34619fef 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -1829,7 +1829,7 @@ void ScViewFunc::DeleteMulti( bool bRows ) pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO )); pUndoDoc->InitUndo( &rDoc, nTab, nTab, !bRows, bRows ); // row height - for (sc::ColRowSpan & rSpan : aSpans) + for (const sc::ColRowSpan & rSpan : aSpans) { SCCOLROW nStart = rSpan.mnStart; SCCOLROW nEnd = rSpan.mnEnd; |