diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2022-09-01 20:51:22 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-09-02 11:23:51 +0200 |
commit | 70cab065b4bfc2e68838b0056c52741eab8e32de (patch) | |
tree | cf001e6b3968c2be452545f17fa4a1d5acc4e039 /sc/source/ui/namedlg | |
parent | b5c039a58dde8992c41f7d7e22cf393a15e1033e (diff) |
no need to use unique_ptr for this map in sc::ScRangeName
map is already a node based data structure, so the values will stay
in the same place in memory
Change-Id: I774368091ace3775d9d63b3ed561e323ad3adb9b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139236
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/ui/namedlg')
-rw-r--r-- | sc/source/ui/namedlg/namedlg.cxx | 10 | ||||
-rw-r--r-- | sc/source/ui/namedlg/namemgrtable.cxx | 14 | ||||
-rw-r--r-- | sc/source/ui/namedlg/namepast.cxx | 2 |
3 files changed, 13 insertions, 13 deletions
diff --git a/sc/source/ui/namedlg/namedlg.cxx b/sc/source/ui/namedlg/namedlg.cxx index 05094b81069d..652f0f1125bb 100644 --- a/sc/source/ui/namedlg/namedlg.cxx +++ b/sc/source/ui/namedlg/namedlg.cxx @@ -43,7 +43,7 @@ ScNameDlg::ScNameDlg( SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pParent, ScViewData& rViewData, const ScAddress& aCursorPos, - std::map<OUString, std::unique_ptr<ScRangeName>> *const pRangeMap) + std::map<OUString, ScRangeName> *const pRangeMap) : ScAnyRefDlgController(pB, pCW, pParent, "modules/scalc/ui/managenamesdialog.ui", "ManageNamesDialog") @@ -84,7 +84,7 @@ ScNameDlg::ScNameDlg( SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pParen mrDoc.GetRangeNameMap(aRangeMap); for (const auto& [aTemp, pRangeName] : aRangeMap) { - m_RangeMap.insert(std::make_pair(aTemp, std::make_unique<ScRangeName>(*pRangeName))); + m_RangeMap.insert(std::make_pair(aTemp, *pRangeName)); } } else @@ -281,9 +281,9 @@ bool ScNameDlg::IsFormulaValid() ScRangeName* ScNameDlg::GetRangeName(const OUString& rScope) { if (rScope == maGlobalNameStr) - return m_RangeMap.find(OUString(STR_GLOBAL_RANGE_NAME))->second.get(); + return &m_RangeMap.find(OUString(STR_GLOBAL_RANGE_NAME))->second; else - return m_RangeMap.find(rScope)->second.get(); + return &m_RangeMap.find(rScope)->second; } void ScNameDlg::ShowOptions(const ScRangeNameLine& rLine) @@ -446,7 +446,7 @@ void ScNameDlg::ScopeChanged() NameModified(); } -void ScNameDlg::GetRangeNames(std::map<OUString, std::unique_ptr<ScRangeName>>& rRangeMap) +void ScNameDlg::GetRangeNames(std::map<OUString, ScRangeName>& rRangeMap) { m_RangeMap.swap(rRangeMap); } diff --git a/sc/source/ui/namedlg/namemgrtable.cxx b/sc/source/ui/namedlg/namemgrtable.cxx index 0e5d98856e7c..fbf6b64d3a1f 100644 --- a/sc/source/ui/namedlg/namemgrtable.cxx +++ b/sc/source/ui/namedlg/namemgrtable.cxx @@ -53,9 +53,9 @@ void ScRangeManagerTable::SetEntry(const ScRangeNameLine& rLine) } } -ScRangeManagerTable::ScRangeManagerTable( - std::unique_ptr<weld::TreeView> xTreeView, - const std::map<OUString, std::unique_ptr<ScRangeName>>& rRangeMap, const ScAddress& rPos) +ScRangeManagerTable::ScRangeManagerTable(std::unique_ptr<weld::TreeView> xTreeView, + const std::map<OUString, ScRangeName>& rRangeMap, + const ScAddress& rPos) : m_xTreeView(std::move(xTreeView)) , maGlobalString(ScResId(STR_GLOBAL_SCOPE)) , m_RangeMap(rRangeMap) @@ -83,9 +83,9 @@ const ScRangeData* ScRangeManagerTable::findRangeData(const ScRangeNameLine& rLi { const ScRangeName* pRangeName; if (rLine.aScope == maGlobalString) - pRangeName = m_RangeMap.find(OUString(STR_GLOBAL_RANGE_NAME))->second.get(); + pRangeName = &m_RangeMap.find(OUString(STR_GLOBAL_RANGE_NAME))->second; else - pRangeName = m_RangeMap.find(rLine.aScope)->second.get(); + pRangeName = &m_RangeMap.find(rLine.aScope)->second; return pRangeName->findByUpperName(ScGlobal::getCharClass().uppercase(rLine.aName)); } @@ -144,13 +144,13 @@ void ScRangeManagerTable::Init() m_xTreeView->clear(); for (auto const& itr : m_RangeMap) { - const ScRangeName* const pLocalRangeName = itr.second.get(); + const ScRangeName& rLocalRangeName = itr.second; ScRangeNameLine aLine; if (itr.first == STR_GLOBAL_RANGE_NAME) aLine.aScope = maGlobalString; else aLine.aScope = itr.first; - for (const auto& rEntry : *pLocalRangeName) + for (const auto& rEntry : rLocalRangeName) { if (!rEntry.second->HasType(ScRangeData::Type::Database)) { diff --git a/sc/source/ui/namedlg/namepast.cxx b/sc/source/ui/namedlg/namepast.cxx index c6851abcc426..491ebe7f79f0 100644 --- a/sc/source/ui/namedlg/namepast.cxx +++ b/sc/source/ui/namedlg/namepast.cxx @@ -40,7 +40,7 @@ ScNamePasteDlg::ScNamePasteDlg(weld::Window* pParent, ScDocShell* pShell) rDoc.GetRangeNameMap(aCopyMap); for (const auto & [ aTemp, pName ] : aCopyMap) { - m_RangeMap.insert(std::make_pair(aTemp, std::make_unique<ScRangeName>(*pName))); + m_RangeMap.insert(std::make_pair(aTemp, *pName)); } ScViewData* pViewData = ScDocShell::GetViewData(); |