[Libreoffice-commits] core.git: sd/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Mar 5 18:30:46 UTC 2021


 sd/source/ui/sidebar/LayoutMenu.cxx |   25 ++++++++++---------------
 sd/source/ui/sidebar/LayoutMenu.hxx |    4 ----
 2 files changed, 10 insertions(+), 19 deletions(-)

New commits:
commit 1986f8a3a577c68d8fd984f06108a4fc5769173e
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Mar 5 11:50:59 2021 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Mar 5 19:29:59 2021 +0100

    move MouseButtonDown logic to LayoutValueSet child
    
    Change-Id: I8d70321856219988618d99ba5884b89950441b7c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112012
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sd/source/ui/sidebar/LayoutMenu.cxx b/sd/source/ui/sidebar/LayoutMenu.cxx
index 513623a47fe9..1f245ea2c688 100644
--- a/sd/source/ui/sidebar/LayoutMenu.cxx
+++ b/sd/source/ui/sidebar/LayoutMenu.cxx
@@ -150,15 +150,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 (
@@ -312,19 +304,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 c93ac3e410d7..327a4939803c 100644
--- a/sd/source/ui/sidebar/LayoutMenu.hxx
+++ b/sd/source/ui/sidebar/LayoutMenu.hxx
@@ -77,10 +77,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.


More information about the Libreoffice-commits mailing list