diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-11-17 15:20:33 +0000 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2021-11-18 12:10:14 +0100 |
commit | 6bd1cb73480d2b20926f964b8db8c31a522c5ec3 (patch) | |
tree | b01fb78c7bd1ddef1492212786841000f5448cc8 | |
parent | postgresql: upgrade to release 13.5 (diff) | |
download | core-6bd1cb73480d2b20926f964b8db8c31a522c5ec3.tar.gz core-6bd1cb73480d2b20926f964b8db8c31a522c5ec3.zip |
tdf#142420 color menu should be a child of the autofilter, not a sibling
which is why it doesn't appear at all under wayland. This should also
get it positioned better rather than using a fixed pixel offset.
Change-Id: I9a4193c27b4172469cea3d980c86cff9ca701ca2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125361
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
-rw-r--r-- | sc/source/ui/cctrl/checklistmenu.cxx | 9 | ||||
-rw-r--r-- | sc/source/ui/inc/checklistmenu.hxx | 5 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 6 |
3 files changed, 16 insertions, 4 deletions
diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx index 95ab21cb74ae..123c76fdc293 100644 --- a/sc/source/ui/cctrl/checklistmenu.cxx +++ b/sc/source/ui/cctrl/checklistmenu.cxx @@ -276,6 +276,13 @@ void ScCheckListMenuControl::queueCloseSubMenu() maCloseTimer.maTimer.Start(); } +tools::Rectangle ScCheckListMenuControl::GetSubMenuParentRect() +{ + if (!mxMenu->get_selected(mxScratchIter.get())) + return tools::Rectangle(); + return mxMenu->get_row_area(*mxScratchIter); +} + void ScCheckListMenuControl::launchSubMenu(bool bSetMenuPos) { ScCheckListMenuWindow* pSubMenu = maOpenTimer.mpSubMenu; @@ -285,7 +292,7 @@ void ScCheckListMenuControl::launchSubMenu(bool bSetMenuPos) if (!mxMenu->get_selected(mxScratchIter.get())) return; - tools::Rectangle aRect = mxMenu->get_row_area(*mxScratchIter); + tools::Rectangle aRect = GetSubMenuParentRect(); ScCheckListMenuControl& rSubMenuControl = pSubMenu->get_widget(); rSubMenuControl.StartPopupMode(aRect, FloatWinPopupFlags::Right); if (bSetMenuPos) diff --git a/sc/source/ui/inc/checklistmenu.hxx b/sc/source/ui/inc/checklistmenu.hxx index 7ebb95fb0caf..b0ddc9188bd2 100644 --- a/sc/source/ui/inc/checklistmenu.hxx +++ b/sc/source/ui/inc/checklistmenu.hxx @@ -177,6 +177,11 @@ public: */ void terminateAllPopupMenus(); + /** + * Get the area of the active row. Suitable as the parent rectangle + * argument for Executing a popup + */ + tools::Rectangle GetSubMenuParentRect(); private: std::vector<MenuItemData> maMenuItems; diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index c5382ef2747b..242ca40b3530 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -957,9 +957,9 @@ void ScGridWindow::UpdateAutoFilterFromMenu(AutoFilterMode eMode) } i++; } - Point pos(mpAutoFilterPopup->GetPosPixel()); - pos.Move(150, 0); - sal_uInt16 nSelected = pColorMenu->Execute(this, pos); + + tools::Rectangle aRect = rControl.GetSubMenuParentRect(); + sal_uInt16 nSelected = pColorMenu->Execute(mpAutoFilterPopup, aRect, PopupMenuFlags::ExecuteRight); pColorMenu.disposeAndClear(); rControl.terminateAllPopupMenus(); |