diff options
author | Rashesh <rashesh.padia@collabora.com> | 2024-10-17 12:46:01 +0530 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2024-12-20 21:30:01 +0100 |
commit | 767fc7cfe567c33e80f12cf19140dba8c586b377 (patch) | |
tree | d790a618beace3a34391ed5977f32559add84c0f | |
parent | 5e2bd2bb4c1a2f8a5467009b4ab7007401a14446 (diff) |
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 <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
(cherry picked from commit 115776004c875b3a8a861d070129187c893b136a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177647
Tested-by: Jenkins
-rw-r--r-- | sc/source/ui/app/inputwin.cxx | 30 | ||||
-rw-r--r-- | sc/source/ui/inc/inputwin.hxx | 8 |
2 files changed, 22 insertions, 16 deletions
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index f9d76b365959..feceafffbe2b 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -2334,19 +2334,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(u"separator"_ustr); - ScRange aDummy; - std::set<OUString> aSet; ScRangeName* pRangeNames = rDoc.GetRangeName(); for (const auto& rEntry : *pRangeNames) { @@ -2367,14 +2361,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(u"separator"_ustr); + 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 832a37356424..1c5d5b73962f 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, ScTabViewShell* pViewSh); |