sc/source/filter/xml/XMLStylesImportHelper.cxx | 11 ++++++----- sc/source/filter/xml/XMLStylesImportHelper.hxx | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-)
New commits: commit cafe239cbb94e3f6d24120fa31e52241bb8bac87 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Fri Sep 2 18:26:50 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Sep 2 21:03:46 2022 +0200 no need to use unique_ptr for this map in ScMyStylesMap map is already a node based data structure, so the values will stay in the same place in memory Change-Id: I29cceec51b1c09bf97eb428d363ad5143f28d902 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139270 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sc/source/filter/xml/XMLStylesImportHelper.cxx b/sc/source/filter/xml/XMLStylesImportHelper.cxx index 3d4bade0e2b8..3d317b886964 100644 --- a/sc/source/filter/xml/XMLStylesImportHelper.cxx +++ b/sc/source/filter/xml/XMLStylesImportHelper.cxx @@ -225,7 +225,8 @@ ScMyStylesMap::iterator ScMyStylesImportHelper::GetIterator(const OUString & rSt { auto it = aCellStyles.find(rStyleName); if (it == aCellStyles.end()) - it = aCellStyles.emplace_hint(it, rStyleName, std::make_unique<ScMyStyleRanges>()); + it = aCellStyles.emplace_hint(it, std::piecewise_construct, + std::forward_as_tuple(rStyleName), std::forward_as_tuple()); return it; } @@ -281,9 +282,9 @@ void ScMyStylesImportHelper::AddSingleRange(const ScRange& rRange) { ScMyStylesMap::iterator aItr(GetIterator(*pPrevStyleName)); if (nPrevCellType != util::NumberFormat::CURRENCY) - aItr->second->AddRange(rRange, nPrevCellType); + aItr->second.AddRange(rRange, nPrevCellType); else - aItr->second->AddCurrencyRange(rRange, pPrevCurrency); + aItr->second.AddCurrencyRange(rRange, pPrevCurrency); } void ScMyStylesImportHelper::AddRange() @@ -375,7 +376,7 @@ void ScMyStylesImportHelper::InsertCol(const sal_Int32 nCol, const sal_Int32 nTa ScXMLImport::MutexGuard aGuard(rImport); for (auto& rCellStyle : aCellStyles) { - rCellStyle.second->InsertCol(nCol, nTab); + rCellStyle.second.InsertCol(nCol, nTab); } } @@ -392,7 +393,7 @@ void ScMyStylesImportHelper::SetStylesToRanges() { for (auto& rCellStyle : aCellStyles) { - rCellStyle.second->SetStylesToRanges(&rCellStyle.first, rImport); + rCellStyle.second.SetStylesToRanges(&rCellStyle.first, rImport); } aColDefaultStyles.clear(); aCellStyles.clear(); diff --git a/sc/source/filter/xml/XMLStylesImportHelper.hxx b/sc/source/filter/xml/XMLStylesImportHelper.hxx index 49a1616ec9d9..13fc31a66505 100644 --- a/sc/source/filter/xml/XMLStylesImportHelper.hxx +++ b/sc/source/filter/xml/XMLStylesImportHelper.hxx @@ -105,7 +105,7 @@ public: }; /** map from style name to ScMyStyleRanges */ -typedef std::map<OUString, std::unique_ptr<ScMyStyleRanges>> ScMyStylesMap; +typedef std::map<OUString, ScMyStyleRanges> ScMyStylesMap; class ScMyStylesImportHelper {