diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-03-05 11:50:59 +0000 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2021-05-25 12:12:29 +0200 |
commit | 41866a3b40eaab76624a9f5ea4c1870e50e57d1f (patch) | |
tree | 1c06fd3d7ee5d74f6de6ae82fe3c4de3e63990c6 /sd | |
parent | 5849d85e5d8b77158360e69c00f049fcc892413f (diff) |
move MouseButtonDown logic to LayoutValueSet child
Change-Id: I8d70321856219988618d99ba5884b89950441b7c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112012
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/sidebar/LayoutMenu.cxx | 25 | ||||
-rw-r--r-- | sd/source/ui/sidebar/LayoutMenu.hxx | 4 |
2 files changed, 10 insertions, 19 deletions
diff --git a/sd/source/ui/sidebar/LayoutMenu.cxx b/sd/source/ui/sidebar/LayoutMenu.cxx index f68597e496ed..7624a082ea79 100644 --- a/sd/source/ui/sidebar/LayoutMenu.cxx +++ b/sd/source/ui/sidebar/LayoutMenu.cxx @@ -149,15 +149,7 @@ public: virtual void Resize() override; - virtual bool Command(const CommandEvent& rEvent) override - { - if (rEvent.GetCommand() == CommandEventId::ContextMenu) - { - mrMenu.ShowContextMenu(rEvent.IsMouseEvent() ? &rEvent.GetMousePosPixel() : nullptr); - return true; - } - return false; - } + virtual bool Command(const CommandEvent& rEvent) override; }; LayoutMenu::LayoutMenu ( @@ -321,19 +313,22 @@ void LayoutValueSet::Resize() ValueSet::Resize(); } -void LayoutMenu::MouseButtonDown (const MouseEvent& rEvent) +bool LayoutValueSet::Command(const CommandEvent& rEvent) { + if (rEvent.GetCommand() != CommandEventId::ContextMenu) + return false; + // As a preparation for the context menu the item under the mouse is // selected. - if (rEvent.IsRight()) + if (rEvent.IsMouseEvent()) { - ReleaseMouse(); - sal_uInt16 nIndex = mxLayoutValueSet->GetItemId(rEvent.GetPosPixel()); + sal_uInt16 nIndex = GetItemId(rEvent.GetMousePosPixel()); if (nIndex > 0) - mxLayoutValueSet->SelectItem(nIndex); + SelectItem(nIndex); } - mxLayoutValueSet->MouseButtonDown(rEvent); + mrMenu.ShowContextMenu(rEvent.IsMouseEvent() ? &rEvent.GetMousePosPixel() : nullptr); + return true; } void LayoutMenu::InsertPageWithLayout (AutoLayout aLayout) diff --git a/sd/source/ui/sidebar/LayoutMenu.hxx b/sd/source/ui/sidebar/LayoutMenu.hxx index 86b02b9ea178..a280b3013759 100644 --- a/sd/source/ui/sidebar/LayoutMenu.hxx +++ b/sd/source/ui/sidebar/LayoutMenu.hxx @@ -79,10 +79,6 @@ public: // From ILayoutableWindow virtual css::ui::LayoutSize GetHeightForWidth(const sal_Int32 nWidth) override; - /** Show a context menu when the right mouse button is pressed. - */ - virtual void MouseButtonDown(const MouseEvent& rEvent) override; - /** Call this method when the set of displayed layouts is not up-to-date anymore. It will re-assemble this set according to the current settings. |