sc/source/ui/cctrl/checklistmenu.cxx | 4 +++- sc/source/ui/inc/checklistmenu.hxx | 3 ++- sc/source/ui/view/gridwin.cxx | 8 ++++++-- sc/source/ui/view/gridwin2.cxx | 6 ++++-- 4 files changed, 15 insertions(+), 6 deletions(-)
New commits: commit 3509a42a042db1628acc59dfc13298639745f62e Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Fri Nov 12 15:39:49 2021 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Fri Nov 12 21:32:56 2021 +0100 Resolves: tdf#145645 pivot table popups don't dismiss when item activated Change-Id: I5a68a08600b7792d924ec77694a60651df5d9c83 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125112 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx index e96f06c4d63d..5fcfa27c0c1b 100644 --- a/sc/source/ui/cctrl/checklistmenu.cxx +++ b/sc/source/ui/cctrl/checklistmenu.cxx @@ -202,7 +202,9 @@ void ScCheckListMenuControl::executeMenuItem(size_t nPos) // no action is defined. return; - maMenuItems[nPos].mxAction->execute(); + const bool bClosePopup = maMenuItems[nPos].mxAction->execute(); + if (bClosePopup) + terminateAllPopupMenus(); } void ScCheckListMenuControl::setSelectedMenuItem(size_t nPos, bool bSubMenuTimer) diff --git a/sc/source/ui/inc/checklistmenu.hxx b/sc/source/ui/inc/checklistmenu.hxx index 465a259d5463..302f2bd0b55d 100644 --- a/sc/source/ui/inc/checklistmenu.hxx +++ b/sc/source/ui/inc/checklistmenu.hxx @@ -62,7 +62,8 @@ public: { public: virtual ~Action() {} - virtual void execute() = 0; + // return true to dismiss the popup + virtual bool execute() = 0; }; struct ResultEntry diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 5d5e2a3a6667..d850ac042872 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -499,9 +499,12 @@ class AutoFilterAction : public ScCheckListMenuControl::Action public: AutoFilterAction(ScGridWindow* p, ScGridWindow::AutoFilterMode eMode) : mpWindow(p), meMode(eMode) {} - virtual void execute() override + virtual bool execute() override { mpWindow->UpdateAutoFilterFromMenu(meMode); + // RefreshAutoFilterButton manually closes the popup so return + // false to not attempt a second close + return false; } }; @@ -512,9 +515,10 @@ class AutoFilterPopupEndAction : public ScCheckListMenuControl::Action public: AutoFilterPopupEndAction(ScGridWindow* p, const ScAddress& rPos) : mpWindow(p), maPos(rPos) {} - virtual void execute() override + virtual bool execute() override { mpWindow->RefreshAutoFilterButton(maPos); + return false; // this is called after the popup has been closed } }; diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx index 0baef4a4aa96..db6c8c6066d3 100644 --- a/sc/source/ui/view/gridwin2.cxx +++ b/sc/source/ui/view/gridwin2.cxx @@ -382,9 +382,10 @@ public: explicit DPFieldPopupOKAction(ScGridWindow* p) : mpGridWindow(p) {} - virtual void execute() override + virtual bool execute() override { mpGridWindow->UpdateDPFromFieldPopupMenu(); + return true; } private: VclPtr<ScGridWindow> mpGridWindow; @@ -404,7 +405,7 @@ public: , mpViewShell(pViewShell) {} - virtual void execute() override + virtual bool execute() override { switch (meType) { @@ -420,6 +421,7 @@ public: default: ; } + return true; } private: