diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-08-10 16:43:55 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-08-11 12:38:32 +0200 |
commit | d347c2403605c5aa3ddd98fb605366914acab79f (patch) | |
tree | e39624030741234c514bccd858e69d6318dfba68 /sc/source | |
parent | f0e68d4feaaa43f7450432ad1ebd92c2b572400f (diff) |
convert std::map::insert to std::map::emplace
which is considerably less verbose
Change-Id: Ifa373e8eb09e39bd6c8d3578641610a6055a187b
Reviewed-on: https://gerrit.libreoffice.org/40978
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source')
36 files changed, 72 insertions, 76 deletions
diff --git a/sc/source/core/data/bcaslot.cxx b/sc/source/core/data/bcaslot.cxx index a55fbcb5b533..294e5a3eb5dd 100644 --- a/sc/source/core/data/bcaslot.cxx +++ b/sc/source/core/data/bcaslot.cxx @@ -743,8 +743,7 @@ void ScBroadcastAreaSlotMachine::StartListeningArea( { TableSlotsMap::iterator iTab( aTableSlotsMap.find( nTab)); if (iTab == aTableSlotsMap.end()) - iTab = aTableSlotsMap.insert( TableSlotsMap::value_type( - nTab, new TableSlots)).first; + iTab = aTableSlotsMap.emplace(nTab, new TableSlots).first; ScBroadcastAreaSlot** ppSlots = (*iTab).second->getSlots(); SCSIZE nStart, nEnd, nRowBreak; ComputeAreaPoints( rRange, nStart, nEnd, nRowBreak ); @@ -1057,8 +1056,7 @@ void ScBroadcastAreaSlotMachine::UpdateBroadcastAreas( { TableSlotsMap::iterator iTab( aTableSlotsMap.find( nTab)); if (iTab == aTableSlotsMap.end()) - iTab = aTableSlotsMap.insert( TableSlotsMap::value_type( - nTab, new TableSlots)).first; + iTab = aTableSlotsMap.emplace(nTab, new TableSlots).first; ScBroadcastAreaSlot** ppSlots = (*iTab).second->getSlots(); SCSIZE nStart, nEnd, nRowBreak; ComputeAreaPoints( aRange, nStart, nEnd, nRowBreak ); diff --git a/sc/source/core/data/columnset.cxx b/sc/source/core/data/columnset.cxx index 1af137117f5d..fbaf4c5d30ff 100644 --- a/sc/source/core/data/columnset.cxx +++ b/sc/source/core/data/columnset.cxx @@ -18,7 +18,7 @@ void ColumnSet::set(SCTAB nTab, SCCOL nCol) if (itTab == maTabs.end()) { std::pair<TabsType::iterator,bool> r = - maTabs.insert(TabsType::value_type(nTab, ColsType())); + maTabs.emplace(nTab, ColsType()); if (!r.second) // insertion failed. diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index 6ad833f37370..74ebcd147b01 100644 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -1547,7 +1547,7 @@ public: assert(nEndRow >= nFirstRow); mnHighIndex = nEndRow - nFirstRow; - maBlockMap.insert(BlockMapType::value_type(aLoPos.first->size, aLoPos.first)); + maBlockMap.emplace(aLoPos.first->size, aLoPos.first); return; } @@ -1582,7 +1582,7 @@ public: } nPos += itBlk->size; - maBlockMap.insert(BlockMapType::value_type(nPos, itBlk)); + maBlockMap.emplace(nPos, itBlk); ++itBlk; if (itBlk->type == sc::element_type_empty) @@ -1593,7 +1593,7 @@ public: assert(itBlk == aHiPos.first); nPos += itBlk->size; - maBlockMap.insert(BlockMapType::value_type(nPos, itBlk)); + maBlockMap.emplace(nPos, itBlk); // Calculate the high index. BlockMapType::const_reverse_iterator ri = maBlockMap.rbegin(); diff --git a/sc/source/core/data/dpdimsave.cxx b/sc/source/core/data/dpdimsave.cxx index 539ee2c7b16c..d8dc218b4cd8 100644 --- a/sc/source/core/data/dpdimsave.cxx +++ b/sc/source/core/data/dpdimsave.cxx @@ -635,7 +635,7 @@ void ScDPDimensionSaveData::ReplaceNumGroupDimension( const ScDPSaveNumGroupDime { ScDPSaveNumGroupDimMap::iterator aIt = maNumGroupDims.find( rGroupDim.GetDimensionName() ); if( aIt == maNumGroupDims.end() ) - maNumGroupDims.insert( ScDPSaveNumGroupDimMap::value_type( rGroupDim.GetDimensionName(), rGroupDim ) ); + maNumGroupDims.emplace( rGroupDim.GetDimensionName(), rGroupDim ); else aIt->second = rGroupDim; } diff --git a/sc/source/core/data/dpresfilter.cxx b/sc/source/core/data/dpresfilter.cxx index 5ba161d7dc82..44e7f4a275c6 100644 --- a/sc/source/core/data/dpresfilter.cxx +++ b/sc/source/core/data/dpresfilter.cxx @@ -114,7 +114,7 @@ void ScDPResultTree::add( { // New dimension. Insert it. std::pair<DimensionsType::iterator, bool> r = - rDims.insert(DimensionsType::value_type(aUpperName, new DimensionNode)); + rDims.emplace(aUpperName, new DimensionNode); if (!r.second) // Insertion failed! @@ -135,7 +135,7 @@ void ScDPResultTree::add( // New member. Insert it. std::shared_ptr<MemberNode> pNode( new MemberNode); std::pair<MembersType::iterator, bool> r = - rMembersValueNames.insert( MembersType::value_type(aUpperName, pNode)); + rMembersValueNames.emplace(aUpperName, pNode); if (!r.second) // Insertion failed! @@ -154,7 +154,7 @@ void ScDPResultTree::add( { // New member. Insert it. std::pair<MembersType::iterator, bool> it = - rMembersValues.insert( MembersType::value_type(aUpperName, pNode)); + rMembersValues.emplace(aUpperName, pNode); // If insertion failed do not bail out anymore. SAL_WARN_IF( !it.second, "sc.core", "ScDPResultTree::add - rMembersValues.insert failed"); } @@ -175,7 +175,7 @@ void ScDPResultTree::add( if (it == maLeafValues.end()) { // This name pair doesn't exist. Associate a new value for it. - maLeafValues.insert(LeafValuesType::value_type(aNames, fVal)); + maLeafValues.emplace(aNames, fVal); } else { diff --git a/sc/source/core/data/dpsave.cxx b/sc/source/core/data/dpsave.cxx index 26476d059911..e70a695e7bd2 100644 --- a/sc/source/core/data/dpsave.cxx +++ b/sc/source/core/data/dpsave.cxx @@ -696,7 +696,7 @@ void ScDPSaveDimension::RemoveObsoleteMembers(const MemberSetType& rMembers) if (rMembers.count(pMem->GetName())) { // This member still exists. - maMemberHash.insert(MemberHash::value_type(pMem->GetName(), pMem)); + maMemberHash.emplace(pMem->GetName(), pMem); aNew.push_back(pMem); } else @@ -1297,7 +1297,7 @@ void ScDPSaveData::BuildAllDimensionMembers(ScDPTableData* pData) NameIndexMap aMap; long nColCount = pData->GetColumnCount(); for (long i = 0; i < nColCount; ++i) - aMap.insert( NameIndexMap::value_type(pData->getDimensionName(i), i)); + aMap.emplace(pData->getDimensionName(i), i); NameIndexMap::const_iterator itrEnd = aMap.end(); @@ -1341,7 +1341,7 @@ void ScDPSaveData::SyncAllDimensionMembers(ScDPTableData* pData) NameIndexMap aMap; long nColCount = pData->GetColumnCount(); for (long i = 0; i < nColCount; ++i) - aMap.insert(NameIndexMap::value_type(pData->getDimensionName(i), i)); + aMap.emplace(pData->getDimensionName(i), i); NameIndexMap::const_iterator itMapEnd = aMap.end(); @@ -1405,7 +1405,7 @@ void ScDPSaveData::CheckDuplicateName(ScDPSaveDimension& rDim) } else // New name. - maDupNameCounts.insert(DupNameCountType::value_type(aName, 0)); + maDupNameCounts.emplace(aName, 0); } void ScDPSaveData::RemoveDuplicateNameCount(const OUString& rName) @@ -1436,7 +1436,7 @@ ScDPSaveDimension* ScDPSaveData::AppendNewDimension(const OUString& rName, bool ScDPSaveDimension* pNew = new ScDPSaveDimension(rName, bDataLayout); m_DimList.push_back(std::unique_ptr<ScDPSaveDimension>(pNew)); if (!maDupNameCounts.count(rName)) - maDupNameCounts.insert(DupNameCountType::value_type(rName, 0)); + maDupNameCounts.emplace(rName, 0); DimensionsChanged(); return pNew; diff --git a/sc/source/core/data/mtvelements.cxx b/sc/source/core/data/mtvelements.cxx index 0bb50aa09f6a..c8234922ed9e 100644 --- a/sc/source/core/data/mtvelements.cxx +++ b/sc/source/core/data/mtvelements.cxx @@ -64,7 +64,7 @@ ColumnBlockPosition* ColumnBlockPositionSet::getBlockPosition(SCTAB nTab, SCCOL if (itTab == maTables.end()) { std::pair<TablesType::iterator,bool> r = - maTables.insert(TablesType::value_type(nTab, ColumnsType())); + maTables.emplace(nTab, ColumnsType()); if (!r.second) // insertion failed. return nullptr; diff --git a/sc/source/core/data/refupdatecontext.cxx b/sc/source/core/data/refupdatecontext.cxx index c065b35e9210..e704ae57925c 100644 --- a/sc/source/core/data/refupdatecontext.cxx +++ b/sc/source/core/data/refupdatecontext.cxx @@ -25,7 +25,7 @@ void UpdatedRangeNames::setUpdatedName(SCTAB nTab, sal_uInt16 nIndex) // Insert a new container for this sheet index. NameIndicesType aIndices; std::pair<UpdatedNamesType::iterator,bool> r = - maUpdatedNames.insert(UpdatedNamesType::value_type(nTab, aIndices)); + maUpdatedNames.emplace( nTab, aIndices); if (!r.second) // Insertion failed for whatever reason. diff --git a/sc/source/core/tool/cellkeytranslator.cxx b/sc/source/core/tool/cellkeytranslator.cxx index 91e38c0e64b1..ed90ed626d51 100644 --- a/sc/source/core/tool/cellkeytranslator.cxx +++ b/sc/source/core/tool/cellkeytranslator.cxx @@ -216,7 +216,7 @@ void ScCellKeywordTranslator::addToMap(const OUString& rKey, const sal_Char* pNa // New keyword. list<ScCellKeyword> aList; aList.push_back(aKeyItem); - maStringNameMap.insert( ScCellKeywordHashMap::value_type(rKey, aList) ); + maStringNameMap.emplace(rKey, aList); } else itr->second.push_back(aKeyItem); diff --git a/sc/source/core/tool/chartpos.cxx b/sc/source/core/tool/chartpos.cxx index b441563237d5..6ca9cc9af5d1 100644 --- a/sc/source/core/tool/chartpos.cxx +++ b/sc/source/core/tool/chartpos.cxx @@ -376,7 +376,7 @@ void ScChartPositioner::CreatePositionMap() if ( it == pCols->end() ) { pCol = new RowMap; - pCols->insert( ColumnMap::value_type( nInsCol, pCol ) ); + pCols->emplace(nInsCol, pCol); } else pCol = it->second; @@ -388,7 +388,7 @@ void ScChartPositioner::CreatePositionMap() { if ( pCol->find( nInsRow ) == pCol->end() ) { - pCol->insert( RowMap::value_type( nInsRow, new ScAddress( nCol, nRow, nTab ) ) ); + pCol->emplace( nInsRow, new ScAddress( nCol, nRow, nTab ) ); } } } @@ -451,7 +451,7 @@ void ScChartPositioner::CreatePositionMap() { sal_uLong nKey = it1->first; for (ColumnMap::const_iterator it2 = ++pCols->begin(); it2 != pCols->end(); ++it2 ) - it2->second->insert( RowMap::value_type( nKey, nullptr )); // no data + it2->second->emplace( nKey, nullptr ); // no data } } } diff --git a/sc/source/core/tool/formulagroup.cxx b/sc/source/core/tool/formulagroup.cxx index cea77f9c90ac..859dd8dffae3 100644 --- a/sc/source/core/tool/formulagroup.cxx +++ b/sc/source/core/tool/formulagroup.cxx @@ -231,7 +231,7 @@ bool FormulaGroupInterpreterSoftware::interpret(ScDocument& rDoc, const ScAddres aRefRange.aEnd.SetRow(rTopPos.Row() + nRowEnd); aRef.InitRange(aRefRange); formula::FormulaTokenRef xTok(new ScMatrixRangeToken(pMat, aRef)); - aCachedTokens.insert(CachedTokensType::value_type(p, xTok)); + aCachedTokens.emplace(p, xTok); aCode2.AddToken(*xTok); } else diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 60df984f637f..7471dd9161d2 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -170,7 +170,7 @@ void ScInterpreter::ScIfJump() } } xNew = new ScJumpMatrixToken( pJumpMat ); - GetTokenMatrixMap().insert( ScTokenMatrixMap::value_type(pCur, xNew)); + GetTokenMatrixMap().emplace(pCur, xNew); } if (!xNew.get()) { @@ -376,7 +376,7 @@ void ScInterpreter::ScIfError( bool bNAonly ) nR = 0; } xNew = new ScJumpMatrixToken( pJumpMat ); - GetTokenMatrixMap().insert( ScTokenMatrixMap::value_type( pCur, xNew )); + GetTokenMatrixMap().emplace( pCur, xNew ); } nGlobalError = nOldGlobalError; PushTokenRef( xNew ); @@ -473,8 +473,7 @@ void ScInterpreter::ScChooseJump() } } xNew = new ScJumpMatrixToken( pJumpMat ); - GetTokenMatrixMap().insert( ScTokenMatrixMap::value_type( - pCur, xNew)); + GetTokenMatrixMap().emplace(pCur, xNew); } if (xNew.get()) { @@ -827,7 +826,7 @@ bool ScInterpreter::JumpMatrix( short nStackLevel ) if (pTokenMatrixMap) { pTokenMatrixMap->erase( pCur); - pTokenMatrixMap->insert( ScTokenMatrixMap::value_type( pCur, pStack[sp-1])); + pTokenMatrixMap->emplace(pCur, pStack[sp-1]); } } return true; diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index 64a72ac34f47..acd8f21d184a 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -1592,7 +1592,7 @@ bool ScInterpreter::ConvertMatrixParameters() } pJumpMat->SetJumpParameters( pParams); xNew = new ScJumpMatrixToken( pJumpMat ); - GetTokenMatrixMap().insert( ScTokenMatrixMap::value_type( pCur, xNew)); + GetTokenMatrixMap().emplace(pCur, xNew); } PushTempTokenWithoutError( xNew.get()); // set continuation point of path for main code line @@ -4446,8 +4446,7 @@ StackVar ScInterpreter::Interpret() // Remember result matrix in case it could be reused. if (pTokenMatrixMap && sp && GetStackType() == svMatrix) - pTokenMatrixMap->insert( ScTokenMatrixMap::value_type( pCur, - pStack[sp-1])); + pTokenMatrixMap->emplace(pCur, pStack[sp-1]); // outer function determines format of an expression if ( nFuncFmtType != css::util::NumberFormat::UNDEFINED ) diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx index 7aba82b116db..1293ed7a597d 100644 --- a/sc/source/core/tool/interpr5.cxx +++ b/sc/source/core/tool/interpr5.cxx @@ -341,7 +341,7 @@ ScMatrixRef ScInterpreter::CreateMatrixFromDoubleRef( const FormulaToken* pToken pDok->FillMatrix(*pMat, nTab1, nCol1, nRow1, nCol2, nRow2); if (pToken && pTokenMatrixMap) - pTokenMatrixMap->insert( ScTokenMatrixMap::value_type( pToken, new ScMatrixToken( pMat))); + pTokenMatrixMap->emplace(pToken, new ScMatrixToken( pMat)); return pMat; } diff --git a/sc/source/core/tool/listenerquery.cxx b/sc/source/core/tool/listenerquery.cxx index e31b759b9521..a36957e1c943 100644 --- a/sc/source/core/tool/listenerquery.cxx +++ b/sc/source/core/tool/listenerquery.cxx @@ -38,7 +38,7 @@ void RefQueryFormulaGroup::add( const ScAddress& rPos ) if (itTab == maTabs.end()) { std::pair<TabsType::iterator,bool> r = - maTabs.insert(TabsType::value_type(rPos.Tab(), ColsType())); + maTabs.emplace(rPos.Tab(), ColsType()); if (!r.second) // Insertion failed. return; @@ -51,7 +51,7 @@ void RefQueryFormulaGroup::add( const ScAddress& rPos ) if (itCol == rCols.end()) { std::pair<ColsType::iterator,bool> r = - rCols.insert(ColsType::value_type(rPos.Col(), ColType())); + rCols.emplace(rPos.Col(), ColType()); if (!r.second) // Insertion failed. return; diff --git a/sc/source/core/tool/simplerangelist.cxx b/sc/source/core/tool/simplerangelist.cxx index 326f87dff2f1..6cc3fdfc6cce 100644 --- a/sc/source/core/tool/simplerangelist.cxx +++ b/sc/source/core/tool/simplerangelist.cxx @@ -182,7 +182,7 @@ ScSimpleRangeList::RangeListRef ScSimpleRangeList::findTab(SCTAB nTab) if (itr == maTabs.end()) { RangeListRef p(new list<Range>); - pair<TabType::iterator, bool> r = maTabs.insert(TabType::value_type(nTab, p)); + pair<TabType::iterator, bool> r = maTabs.emplace(nTab, p); if (!r.second) return RangeListRef(); itr = r.first; diff --git a/sc/source/core/tool/tokenstringcontext.cxx b/sc/source/core/tool/tokenstringcontext.cxx index 1e40afed7003..7837fee5a670 100644 --- a/sc/source/core/tool/tokenstringcontext.cxx +++ b/sc/source/core/tool/tokenstringcontext.cxx @@ -76,7 +76,7 @@ TokenStringContext::TokenStringContext( const ScDocument* pDoc, formula::Formula SCTAB nTab = it->first; IndexNameMapType aNames; insertAllNames(aNames, *pSheetNames); - maSheetRangeNames.insert(TabIndexMapType::value_type(nTab, aNames)); + maSheetRangeNames.emplace(nTab, aNames); } } @@ -89,7 +89,7 @@ TokenStringContext::TokenStringContext( const ScDocument* pDoc, formula::Formula for (; it != itEnd; ++it) { const ScDBData& rData = **it; - maNamedDBs.insert(IndexNameMapType::value_type(rData.GetIndex(), rData.GetName())); + maNamedDBs.emplace(rData.GetIndex(), rData.GetName()); } } diff --git a/sc/source/filter/excel/namebuff.cxx b/sc/source/filter/excel/namebuff.cxx index d2dce76c2c22..0a80cf8e6c9b 100644 --- a/sc/source/filter/excel/namebuff.cxx +++ b/sc/source/filter/excel/namebuff.cxx @@ -67,7 +67,7 @@ void SharedFormulaBuffer::Store( const ScAddress& rPos, const ScTokenArray& rArr { ScTokenArray* pCode = rArray.Clone(); pCode->GenHash(); - maTokenArrays.insert(TokenArraysType::value_type(rPos, pCode)); + maTokenArrays.emplace(rPos, pCode); } const ScTokenArray* SharedFormulaBuffer::Find( const ScAddress& rRefPos ) const diff --git a/sc/source/filter/excel/xepivotxml.cxx b/sc/source/filter/excel/xepivotxml.cxx index 92e24cf74a3a..9f1da86dcb9b 100644 --- a/sc/source/filter/excel/xepivotxml.cxx +++ b/sc/source/filter/excel/xepivotxml.cxx @@ -349,7 +349,7 @@ void XclExpXmlPivotTableManager::Initialize() const ScDPCache::ScDPObjectSet& rRefs = pCache->GetAllReferences(); ScDPCache::ScDPObjectSet::const_iterator it = rRefs.begin(), itEnd = rRefs.end(); for (; it != itEnd; ++it) - maCacheIdMap.insert(CacheIdMapType::value_type(*it, aCaches.size()+1)); + maCacheIdMap.emplace(*it, aCaches.size()+1); XclExpXmlPivotCaches::Entry aEntry; aEntry.meType = XclExpXmlPivotCaches::Worksheet; @@ -505,7 +505,7 @@ void XclExpXmlPivotTables::SavePivotTableXml( XclExpXmlStream& rStrm, const ScDP for (size_t i = 0; i < nFieldCount; ++i) { OUString aName = rCache.GetDimensionName(i); - aNameToIdMap.insert(NameToIdMapType::value_type(aName, aCachedDims.size())); + aNameToIdMap.emplace(aName, aCachedDims.size()); const ScDPSaveDimension* pDim = rSaveData.GetExistingDimensionByName(aName); aCachedDims.push_back(pDim); } diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index da8698aeebda..10cc23f57a09 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -2413,7 +2413,7 @@ XclExpRow& XclExpRowBuffer::GetOrCreateRow( sal_uInt32 nXclRow, bool bRowAlwaysE mnHighestOutlineLevel = maOutlineBfr.GetLevel(); } RowRef p(new XclExpRow(GetRoot(), nFrom, maOutlineBfr, bRowAlwaysEmpty, bHidden, nHeight)); - maRowMap.insert(RowMap::value_type(nFrom, p)); + maRowMap.emplace(nFrom, p); pPrevEntry = p; } ++nFrom; diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx index cc433f9ceb8a..509eb68acdc3 100644 --- a/sc/source/filter/excel/xicontent.cxx +++ b/sc/source/filter/excel/xicontent.cxx @@ -1428,7 +1428,7 @@ XclImpSheetProtectBuffer::Sheet* XclImpSheetProtectBuffer::GetSheetItem( SCTAB n if (itr == maProtectedSheets.end()) { // new sheet - if ( !maProtectedSheets.insert( ProtectedSheetMap::value_type(nTab, Sheet()) ).second ) + if ( !maProtectedSheets.emplace( nTab, Sheet() ).second ) return nullptr; itr = maProtectedSheets.find(nTab); diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index 11795a5ff086..d5b406c1e0e6 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -177,7 +177,7 @@ void ScHTMLStyles::insertProp( } PropsType *const pProps = itr->second.get(); - pProps->insert(PropsType::value_type(aProp, aValue)); + pProps->emplace(aProp, aValue); } // BASE class for HTML parser classes diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx index e7dbc948c5aa..a677ce01abf5 100644 --- a/sc/source/filter/oox/formulabuffer.cxx +++ b/sc/source/filter/oox/formulabuffer.cxx @@ -86,7 +86,7 @@ public: { // Create an entry for this column. std::pair<ColCacheType::iterator,bool> r = - maCache.insert(ColCacheType::value_type(rPos.Col(), new Item)); + maCache.emplace(rPos.Col(), new Item); if (!r.second) // Insertion failed. return; diff --git a/sc/source/filter/oox/revisionfragment.cxx b/sc/source/filter/oox/revisionfragment.cxx index ec95dcffab13..d7eb692c361d 100644 --- a/sc/source/filter/oox/revisionfragment.cxx +++ b/sc/source/filter/oox/revisionfragment.cxx @@ -298,7 +298,7 @@ void RevisionHeadersFragment::importHeader( const AttributeList& rAttribs ) aMetadata.maUserName = rAttribs.getString(XML_userName, OUString()); - mpImpl->maRevData.insert(RevDataType::value_type(aRId, aMetadata)); + mpImpl->maRevData.emplace(aRId, aMetadata); } struct RevisionLogFragment::Impl diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx index 1f59aa1f6675..b6ed7040a934 100644 --- a/sc/source/filter/orcus/interface.cxx +++ b/sc/source/filter/orcus/interface.cxx @@ -187,7 +187,7 @@ size_t ScOrcusFactory::appendString(const OUString& rStr) { size_t nPos = maStrings.size(); maStrings.push_back(rStr); - maStringHash.insert(StringHashType::value_type(rStr, nPos)); + maStringHash.emplace(rStr, nPos); return nPos; } diff --git a/sc/source/filter/xml/XMLExportDatabaseRanges.cxx b/sc/source/filter/xml/XMLExportDatabaseRanges.cxx index 9321cdb3b231..f9128fbd59e9 100644 --- a/sc/source/filter/xml/XMLExportDatabaseRanges.cxx +++ b/sc/source/filter/xml/XMLExportDatabaseRanges.cxx @@ -694,7 +694,7 @@ void ScXMLExportDatabaseRanges::WriteDatabaseRanges() { const ScDBData* p = pDoc->GetAnonymousDBData(i); if (p) - aSheetDBs.insert(SheetLocalDBs::value_type(i, p)); + aSheetDBs.emplace(i, p); } bool bHasRanges = !aSheetDBs.empty(); diff --git a/sc/source/filter/xml/xmldpimp.cxx b/sc/source/filter/xml/xmldpimp.cxx index 9f431889385c..7a00a7809b1a 100644 --- a/sc/source/filter/xml/xmldpimp.cxx +++ b/sc/source/filter/xml/xmldpimp.cxx @@ -397,7 +397,7 @@ void ScXMLDataPilotTableContext::SetButtons() void ScXMLDataPilotTableContext::SetSelectedPage( const OUString& rDimName, const OUString& rSelected ) { - maSelectedPages.insert(SelectedPagesType::value_type(rDimName, rSelected)); + maSelectedPages.emplace(rDimName, rSelected); } void ScXMLDataPilotTableContext::AddDimension(ScDPSaveDimension* pDim) diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index 60113982f85a..fd209338b7f2 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -929,7 +929,7 @@ void ScXMLExport::ExportExternalRefCacheStyles() } // store the number format to index mapping for later use. - aNumFmtIndexMap.insert(NumberFormatIndexMap::value_type(nNumFmt, nIndex)); + aNumFmtIndexMap.emplace(nNumFmt, nIndex); } } diff --git a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx index 79ba53882d7f..a7a8e1f750a6 100644 --- a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx +++ b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx @@ -600,7 +600,7 @@ void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, const SfxHint& rHint aEvent.NewValue <<= xChild; CommitChange(aEvent); OSL_ASSERT(m_mapSelectionSend.count(aNewCell) == 0 ); - m_mapSelectionSend.insert(MAP_ADDR_XACC::value_type(aNewCell,xChild)); + m_mapSelectionSend.emplace(aNewCell,xChild); } else @@ -639,7 +639,7 @@ void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, const SfxHint& rHint aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_ADD; aEvent.NewValue <<= xChild; CommitChange(aEvent); - m_mapSelectionSend.insert(MAP_ADDR_XACC::value_type(*viAddr,xChild)); + m_mapSelectionSend.emplace(*viAddr,xChild); } } } @@ -1542,7 +1542,7 @@ void ScAccessibleSpreadsheet::NotifyRefMode() aEvent.EventId = AccessibleEventId::SELECTION_CHANGED; aEvent.NewValue <<= xNew; CommitChange(aEvent); - m_mapFormulaSelectionSend.insert(MAP_ADDR_XACC::value_type(aFormulaAddr,xNew)); + m_mapFormulaSelectionSend.emplace(aFormulaAddr,xNew); m_vecFormulaLastMyAddr.clear(); m_vecFormulaLastMyAddr.push_back(aFormulaAddr); } @@ -1591,7 +1591,7 @@ void ScAccessibleSpreadsheet::NotifyRefMode() aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_ADD; aEvent.NewValue <<= xChild; CommitChange(aEvent); - m_mapFormulaSelectionSend.insert(MAP_ADDR_XACC::value_type(*viAddr,xChild)); + m_mapFormulaSelectionSend.emplace(*viAddr,xChild); } } m_vecFormulaLastMyAddr.swap(vecCurSel); diff --git a/sc/source/ui/dbgui/pvfundlg.cxx b/sc/source/ui/dbgui/pvfundlg.cxx index d0e68d7eb950..ecd99a44dd6a 100644 --- a/sc/source/ui/dbgui/pvfundlg.cxx +++ b/sc/source/ui/dbgui/pvfundlg.cxx @@ -403,7 +403,7 @@ IMPL_LINK( ScDPFunctionDlg, SelectHdl, ListBox&, rLBox, void ) NameMapType aMap; vector<ScDPLabelData::Member>::const_iterator itr = rMembers.begin(), itrEnd = rMembers.end(); for (; itr != itrEnd; ++itr) - aMap.insert(NameMapType::value_type(itr->getDisplayName(), itr->maName)); + aMap.emplace(itr->getDisplayName(), itr->maName); maBaseItemNameMap.swap(aMap); } @@ -661,7 +661,7 @@ void ScDPSubtotalOptDlg::Init( const ScDPNameVec& rDataFields, bool bEnableLayou for( ScDPNameVec::const_iterator aIt = rDataFields.begin(), aEnd = rDataFields.end(); aIt != aEnd; ++aIt ) { // Cache names for later lookup. - maDataFieldNameMap.insert(NameMapType::value_type(aIt->maLayoutName, *aIt)); + maDataFieldNameMap.emplace(aIt->maLayoutName, *aIt); m_pLbSortBy->InsertEntry( aIt->maLayoutName ); m_pLbShowUsing->InsertEntry( aIt->maLayoutName ); // for AutoShow @@ -840,7 +840,7 @@ ScDPShowDetailDlg::ScDPShowDetailDlg( vcl::Window* pParent, ScDPObject& rDPObj, aName = *pLayoutName; } mpLbDims->InsertEntry( aName ); - maNameIndexMap.insert(DimNameIndexMap::value_type(aName, nDim)); + maNameIndexMap.emplace(aName, nDim); } } } diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx index 3baad956e02d..402975e39693 100644 --- a/sc/source/ui/docshell/externalrefmgr.cxx +++ b/sc/source/ui/docshell/externalrefmgr.cxx @@ -293,7 +293,7 @@ void ScExternalRefCache::Table::setCell(SCCOL nCol, SCROW nRow, TokenRef const & ScExternalRefCache::Cell aCell; aCell.mxToken = pToken; aCell.mnFmtIndex = nFmtIndex; - rRow.insert(RowDataType::value_type(nCol, aCell)); + rRow.emplace(nCol, aCell); if (bSetCacheRange) setCachedCell(nCol, nRow); } @@ -717,9 +717,9 @@ ScExternalRefCache::TokenArrayRef ScExternalRefCache::getCellRangeData( } } - rDoc.maRangeArrays.insert( RangeArrayMap::value_type(aCacheRange, pArray)); + rDoc.maRangeArrays.emplace(aCacheRange, pArray); if (pNewRange && *pNewRange != aCacheRange) - rDoc.maRangeArrays.insert( RangeArrayMap::value_type(*pNewRange, pArray)); + rDoc.maRangeArrays.emplace(*pNewRange, pArray); return pArray; } @@ -751,8 +751,8 @@ void ScExternalRefCache::setRangeNameTokens(sal_uInt16 nFileId, const OUString& OUString aUpperName = ScGlobal::pCharClass->uppercase(rName); RangeNameMap& rMap = pDoc->maRangeNames; - rMap.insert(RangeNameMap::value_type(aUpperName, pArray)); - pDoc->maRealRangeNameMap.insert(NamePairMap::value_type(aUpperName, rName)); + rMap.emplace(aUpperName, pArray); + pDoc->maRealRangeNameMap.emplace(aUpperName, rName); } bool ScExternalRefCache::isValidRangeName(sal_uInt16 nFileId, const OUString& rName) const @@ -776,7 +776,7 @@ void ScExternalRefCache::setRangeName(sal_uInt16 nFileId, const OUString& rName) return; OUString aUpperName = ScGlobal::pCharClass->uppercase(rName); - pDoc->maRealRangeNameMap.insert(NamePairMap::value_type(aUpperName, rName)); + pDoc->maRealRangeNameMap.emplace(aUpperName, rName); } void ScExternalRefCache::setCellData(sal_uInt16 nFileId, const OUString& rTabName, SCCOL nCol, SCROW nRow, @@ -887,7 +887,7 @@ void ScExternalRefCache::setCellRangeData(sal_uInt16 nFileId, const ScRange& rRa size_t nTabLastId = nTabFirstId + rRange.aEnd.Tab() - rRange.aStart.Tab(); ScRange aCacheRange( nCol1, nRow1, static_cast<SCTAB>(nTabFirstId), nCol2, nRow2, static_cast<SCTAB>(nTabLastId)); - rDoc.maRangeArrays.insert( RangeArrayMap::value_type( aCacheRange, pArray)); + rDoc.maRangeArrays.emplace(aCacheRange, pArray); } bool ScExternalRefCache::isDocInitialized(sal_uInt16 nFileId) @@ -968,7 +968,7 @@ void ScExternalRefCache::initializeDoc(sal_uInt16 nFileId, const vector<OUString // name index map TableNameIndexMap aNewNameIndex; for (size_t i = 0; i < n; ++i) - aNewNameIndex.insert(TableNameIndexMap::value_type(pDoc->maTableNames[i].maUpperName, i)); + aNewNameIndex.emplace(pDoc->maTableNames[i].maUpperName, i); pDoc->maTableNameIndex.swap(aNewNameIndex); // Setup name for Sheet1 vs base name to be able to load documents @@ -2393,7 +2393,7 @@ ScDocument* ScExternalRefManager::getInMemorySrcDocument(sal_uInt16 nFileId) // Found ! SrcShell aSrcDoc; aSrcDoc.maShell = pShell; - maUnsavedDocShells.insert(DocShellMap::value_type(nFileId, aSrcDoc)); + maUnsavedDocShells.emplace(nFileId, aSrcDoc); StartListening(*pShell); pSrcDoc = &pShell->GetDocument(); break; @@ -2565,7 +2565,7 @@ ScDocument& ScExternalRefManager::cacheNewDocShell( sal_uInt16 nFileId, SrcShell // If this is the first source document insertion, start up the timer. maSrcDocTimer.Start(); - maDocShells.insert(DocShellMap::value_type(nFileId, rSrcShell)); + maDocShells.emplace(nFileId, rSrcShell); SfxObjectShell& rShell = *rSrcShell.maShell; ScDocument& rSrcDoc = static_cast<ScDocShell&>(rShell).GetDocument(); initDocInCache(maRefCache, &rSrcDoc, nFileId); @@ -2633,7 +2633,7 @@ void ScExternalRefManager::maybeLinkExternalFile( sal_uInt16 nFileId, bool bDefe pLink->Update(); pLink->SetDoReferesh(true); - maLinkedDocs.insert(LinkedDocMap::value_type(nFileId, true)); + maLinkedDocs.emplace(nFileId, true); } void ScExternalRefManager::addFilesToLinkManager() diff --git a/sc/source/ui/miscdlgs/crnrdlg.cxx b/sc/source/ui/miscdlgs/crnrdlg.cxx index aa01ad485303..f68c9a06ccad 100644 --- a/sc/source/ui/miscdlgs/crnrdlg.cxx +++ b/sc/source/ui/miscdlgs/crnrdlg.cxx @@ -405,7 +405,7 @@ void ScColRowNameRangesDlg::UpdateNames() OUString aInsStr = aString; aInsStr += strShow; nPos = pLbRange->InsertEntry( aInsStr ); - aRangeMap.insert( NameRangeMap::value_type(aInsStr, aRange) ); + aRangeMap.emplace( aInsStr, aRange ); pLbRange->SetEntryData( nPos, reinterpret_cast<void*>(nEntryDataCol) ); } } @@ -446,7 +446,7 @@ void ScColRowNameRangesDlg::UpdateNames() OUString aInsStr = aString; aInsStr += strShow; nPos = pLbRange->InsertEntry( aInsStr ); - aRangeMap.insert( NameRangeMap::value_type(aInsStr, aRange) ); + aRangeMap.emplace( aInsStr, aRange ); pLbRange->SetEntryData( nPos, reinterpret_cast<void*>(nEntryDataRow) ); } } diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 84d97df0f383..a764af6f594a 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -9321,7 +9321,7 @@ void ScUniqueFormatsEntry::Join( const ScRange& rNewRange ) } SCROW nSingleRow = aSingleRange.aStart.Row(); - aJoinedRanges.insert( ScRowRangeHashMap::value_type( nSingleRow, aSingleRange ) ); + aJoinedRanges.emplace( nSingleRow, aSingleRange ); eState = STATE_COMPLEX; // continue normally } @@ -9353,7 +9353,7 @@ void ScUniqueFormatsEntry::Join( const ScRange& rNewRange ) else { // keep rNewRange for joining - aJoinedRanges.insert( ScRowRangeHashMap::value_type( nStartRow, rNewRange ) ); + aJoinedRanges.emplace( nStartRow, rNewRange ); } } diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx index c0b91e6d1056..8443f0bc54ef 100644 --- a/sc/source/ui/view/dbfunc3.cxx +++ b/sc/source/ui/view/dbfunc3.cxx @@ -1677,7 +1677,7 @@ void ScDBFunc::DataPilotSort(ScDPObject* pDPObj, long nDimIndex, bool bAscending // This string doesn't exist in the member name set. Don't add this. continue; - aSubStrs.insert(UserSortMap::value_type(aSub, nSubCount++)); + aSubStrs.emplace(aSub, nSubCount++); } } diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx index e5d007bc8d71..b22a8b09f389 100644 --- a/sc/source/ui/view/gridwin2.cxx +++ b/sc/source/ui/view/gridwin2.cxx @@ -565,7 +565,7 @@ void ScGridWindow::UpdateDPFromFieldPopupMenu() MemNameMapType aMemNameMap; for (vector<ScDPLabelData::Member>::const_iterator itr = rLabelData.maMembers.begin(), itrEnd = rLabelData.maMembers.end(); itr != itrEnd; ++itr) - aMemNameMap.insert(MemNameMapType::value_type(itr->maLayoutName, itr->maName)); + aMemNameMap.emplace(itr->maLayoutName, itr->maName); // The raw result may contain a mixture of layout names and original names. ScCheckListMenuWindow::ResultType aRawResult; diff --git a/sc/source/ui/view/spellcheckcontext.cxx b/sc/source/ui/view/spellcheckcontext.cxx index ac615fdbe52e..025cfb41e1e5 100644 --- a/sc/source/ui/view/spellcheckcontext.cxx +++ b/sc/source/ui/view/spellcheckcontext.cxx @@ -72,7 +72,7 @@ void SpellCheckContext::setMisspellRanges( if (pRanges) { if (it == maMisspellCells.end()) - maMisspellCells.insert(CellMapType::value_type(aPos, *pRanges)); + maMisspellCells.emplace(aPos, *pRanges); else it->second = *pRanges; } |