sc/source/ui/app/inputwin.cxx | 30 +++++++++++++++++------------- sc/source/ui/inc/inputwin.hxx | 8 +++++--- 2 files changed, 22 insertions(+), 16 deletions(-)
New commits: commit 115776004c875b3a8a861d070129187c893b136a Author: Rashesh <rashesh.pa...@collabora.com> AuthorDate: Thu Oct 17 12:46:01 2024 +0530 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Sat Oct 19 14:16:46 2024 +0200 sc: fix: unnecessary updates to ScPosWnd even if NamedRanges are same Change-Id: Idd32343f38d6294f5140835d99137dae9f1237ab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175061 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 151cc34fec35..3395c1a5fe84 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -2335,19 +2335,13 @@ OUString ScPosWnd::createLocalRangeName(std::u16string_view rName, std::u16strin void ScPosWnd::FillRangeNames() { - m_xWidget->clear(); - m_xWidget->freeze(); - + std::set<OUString> aSet; SfxObjectShell* pObjSh = SfxObjectShell::Current(); - if ( auto pDocShell = dynamic_cast<ScDocShell*>( pObjSh) ) + if (auto pDocShell = dynamic_cast<ScDocShell*>(pObjSh)) { ScDocument& rDoc = pDocShell->GetDocument(); - m_xWidget->append_text(ScResId(STR_MANAGE_NAMES)); - m_xWidget->append_separator("separator"); - ScRange aDummy; - std::set<OUString> aSet; ScRangeName* pRangeNames = rDoc.GetRangeName(); for (const auto& rEntry : *pRangeNames) { @@ -2368,14 +2362,24 @@ void ScPosWnd::FillRangeNames() } } } + } - for (const auto& rItem : aSet) - { - m_xWidget->append_text(rItem); - } + if (aSet == aRangeNames && !aSet.empty()) + return; + + aRangeNames = aSet; + + m_xWidget->clear(); + m_xWidget->freeze(); + m_xWidget->append_text(ScResId(STR_MANAGE_NAMES)); + m_xWidget->append_separator("separator"); + for (const auto& rItem : aSet) + { + m_xWidget->append_text(rItem); } m_xWidget->thaw(); - m_xWidget->set_entry_text(aPosStr); + if (!aPosStr.isEmpty()) + m_xWidget->set_entry_text(aPosStr); } void ScPosWnd::FillFunctions() diff --git a/sc/source/ui/inc/inputwin.hxx b/sc/source/ui/inc/inputwin.hxx index d98b5a85c56f..ee1a6151a0e0 100644 --- a/sc/source/ui/inc/inputwin.hxx +++ b/sc/source/ui/inc/inputwin.hxx @@ -19,6 +19,7 @@ #pragma once +#include <set> #include <vector> #include <memory> #include <vcl/customweld.hxx> @@ -167,9 +168,10 @@ private: ImplSVEvent* m_nAsyncGetFocusId; - OUString aPosStr; - void* nTipVisible; - bool bFormulaMode; + OUString aPosStr; + void* nTipVisible; + bool bFormulaMode; + std::set<OUString> aRangeNames; public: ScPosWnd( vcl::Window* pParent );