sc/source/filter/xml/xmlimprt.cxx | 19 ++++++++----------- sc/source/filter/xml/xmlimprt.hxx | 7 ++----- 2 files changed, 10 insertions(+), 16 deletions(-)
New commits: commit 5f0a01ce47133de31a7f8e43d8ef5e9851a7ceb7 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Fri Sep 3 20:20:53 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sat Sep 4 13:59:10 2021 +0200 no need to allocate ScMyImportValidations with unique_ptr Change-Id: I1f720b05834f24e395456d4e82cdf772242be7f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121622 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index bc480798e215..69f7313c58ae 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -393,7 +393,7 @@ ScXMLImport::~ScXMLImport() noexcept m_aMyNamedExpressions.clear(); maMyLabelRanges.clear(); - pValidations.reset(); + maValidations.clear(); pDetectiveOpArray.reset(); //call SvXMLImport dtor contents before deleting pSolarMutexGuard @@ -558,17 +558,14 @@ XMLShapeImportHelper* ScXMLImport::CreateShapeImport() bool ScXMLImport::GetValidation(const OUString& sName, ScMyImportValidation& aValidation) { - if (pValidations) + auto aItr = std::find_if(maValidations.begin(), maValidations.end(), + [&sName](const ScMyImportValidation& rValidation) { return rValidation.sName == sName; }); + if (aItr != maValidations.end()) { - auto aItr = std::find_if(pValidations->begin(), pValidations->end(), - [&sName](const ScMyImportValidation& rValidation) { return rValidation.sName == sName; }); - if (aItr != pValidations->end()) - { - // source position must be set as string, - // so sBaseCellAddress no longer has to be converted here - aValidation = *aItr; - return true; - } + // source position must be set as string, + // so sBaseCellAddress no longer has to be converted here + aValidation = *aItr; + return true; } return false; } diff --git a/sc/source/filter/xml/xmlimprt.hxx b/sc/source/filter/xml/xmlimprt.hxx index efc5d3bacd4c..71c385f50023 100644 --- a/sc/source/filter/xml/xmlimprt.hxx +++ b/sc/source/filter/xml/xmlimprt.hxx @@ -144,7 +144,7 @@ class ScXMLImport: public SvXMLImport SheetNamedExpMap m_SheetNamedExpressions; ScMyLabelRanges maMyLabelRanges; - std::unique_ptr<ScMyImportValidations> pValidations; + ScMyImportValidations maValidations; std::unique_ptr<ScMyImpDetectiveOpArray> pDetectiveOpArray; std::unique_ptr<SolarMutexGuard> pSolarMutexGuard; @@ -235,10 +235,7 @@ public: maMyLabelRanges.push_back(std::move(pMyLabelRange)); } - void AddValidation(const ScMyImportValidation& rValidation) { - if (!pValidations) - pValidations.reset(new ScMyImportValidations); - pValidations->push_back(rValidation); } + void AddValidation(const ScMyImportValidation& rValidation) { maValidations.push_back(rValidation); } bool GetValidation(const OUString& sName, ScMyImportValidation& aValidation); ScMyImpDetectiveOpArray* GetDetectiveOpArray();