[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - 4 commits - include/LibreOfficeKit include/vcl sc/source sd/source sfx2/source sw/source vcl/inc vcl/source vcl/unx

Jan Holesovsky kendy at collabora.com
Fri Apr 8 14:41:53 UTC 2016


 include/LibreOfficeKit/LibreOfficeKitEnums.h |   23 +++++
 include/vcl/menu.hxx                         |    8 -
 sc/source/ui/inc/gridwin.hxx                 |    2 
 sc/source/ui/unoobj/docuno.cxx               |   10 ++
 sd/source/ui/unoidl/unomodel.cxx             |   10 ++
 sfx2/source/menu/mnumgr.cxx                  |  118 ++++++++++++++++++++++++++-
 sw/source/uibase/inc/edtwin.hxx              |    4 
 sw/source/uibase/uno/unotxdoc.cxx            |    9 +-
 vcl/inc/unx/gtk/gtksalmenu.hxx               |    4 
 vcl/source/window/menu.cxx                   |   15 +--
 vcl/unx/gtk/window/gtksalmenu.cxx            |   10 --
 11 files changed, 184 insertions(+), 29 deletions(-)

New commits:
commit 421a67af7ee2ffcd4faa53866482cb96a444b8a9
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Fri Apr 8 16:35:57 2016 +0200

    lok context menu: Handle the case we only get the slot-id.
    
    Change-Id: I7a2537ccebf80c79bf61f041bfb18cd6ddc93ca2

diff --git a/sfx2/source/menu/mnumgr.cxx b/sfx2/source/menu/mnumgr.cxx
index f6fbd3c..b666b13 100644
--- a/sfx2/source/menu/mnumgr.cxx
+++ b/sfx2/source/menu/mnumgr.cxx
@@ -364,7 +364,14 @@ namespace {
             else
             {
                 const sal_uInt16 nItemId = pMenu->GetItemId(nPos);
-                const OUString aCommandURL = pMenu->GetItemCommand(nItemId);
+                OUString aCommandURL = pMenu->GetItemCommand(nItemId);
+
+                if (aCommandURL.isEmpty())
+                {
+                    const SfxSlot *pSlot = SFX_SLOTPOOL().GetSlot(nItemId);
+                    if (pSlot)
+                        aCommandURL = pSlot->GetCommandString();
+                }
 
                 const OUString aItemText = pMenu->GetItemText(nItemId);
                 Menu* pPopupSubmenu = pMenu->GetPopupMenu(nItemId);
commit 728233b1afccbb27ee09994aaceea840d5537284
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Fri Apr 8 09:15:55 2016 +0200

    lok context menu: Expose the disabled commands too.
    
    OTOH, don't show choices that don't have the .uno: command, we have no way to
    handle them.
    
    Change-Id: I0df6ffe2049bbf11ba4b8931164be6a3381d3916

diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 88098b1..c1d8508 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -284,15 +284,22 @@ typedef enum
     /**
      * Context menu structure
      *
-     * Returns the structure of context menu
+     * Returns the structure of context menu.  Contains all the separators &
+     * submenus, example of the returned structure:
      *
      * {
-     *      "menu": [
-     *          {"text": "label text", "type": "command | separator | menu",
-     *      "command | menu": "..." },
-     *          ...
-     *      ]
+     *     "menu": [
+     *         { "text": "label text1", "type": "command", "command": ".uno:Something1", "enabled": "true" },
+     *         { "text": "label text2", "type": "command", "command": ".uno:Something2", "enabled": "false" },
+     *         { "type": "separator" },
+     *         { "text": "label text2", "type": "menu", "menu": [ { ... }, { ... }, ... ] },
+     *         ...
+     *     ]
      * }
+     *
+     * The 'command' can additionally have a checkable status, like:
+     *
+     *     {"text": "label text3", "type": "command", "command": ".uno:Something3", "checktype": "checkmark|radio|auto", "checked": "true|false"}
      */
     LOK_CALLBACK_CONTEXT_MENU,
 
diff --git a/sfx2/source/menu/mnumgr.cxx b/sfx2/source/menu/mnumgr.cxx
index b3a8961..f6fbd3c 100644
--- a/sfx2/source/menu/mnumgr.cxx
+++ b/sfx2/source/menu/mnumgr.cxx
@@ -369,57 +369,44 @@ namespace {
                 const OUString aItemText = pMenu->GetItemText(nItemId);
                 Menu* pPopupSubmenu = pMenu->GetPopupMenu(nItemId);
 
-                if (!pMenu->IsItemEnabled(nItemId))
-                    continue;
-
                 if (!aItemText.isEmpty())
-                    aItemTree.put("text", std::string(aItemText.toUtf8().getStr()));
+                    aItemTree.put("text", aItemText.toUtf8().getStr());
 
                 if (pPopupSubmenu)
                 {
                     boost::property_tree::ptree aSubmenu = fillPopupMenu(pPopupSubmenu);
-                    if (!aSubmenu.empty())
-                    {
-                        aItemTree.put("type", "menu");
-                        aItemTree.push_back(std::make_pair("menu", aSubmenu));
-                    }
-                    else
-                        aItemTree.clear();
+                    if (aSubmenu.empty())
+                        continue;
+
+                    aItemTree.put("type", "menu");
+                    aItemTree.push_back(std::make_pair("menu", aSubmenu));
                 }
                 else
                 {
-                    if (!aCommandURL.isEmpty())
-                    {
-                        aItemTree.put("type", "command");
-                        aItemTree.put("command", std::string(aCommandURL.toUtf8().getStr()));
-                    }
+                    // no point in exposing choices that don't have the .uno:
+                    // command
+                    if (aCommandURL.isEmpty())
+                        continue;
+
+                    aItemTree.put("type", "command");
+                    aItemTree.put("command", aCommandURL.toUtf8().getStr());
                 }
 
+                aItemTree.put("enabled", pMenu->IsItemEnabled(nItemId));
+
                 MenuItemBits aItemBits = pMenu->GetItemBits(nItemId);
-                bool bHasChecks = false;
+                bool bHasChecks = true;
                 if (aItemBits & MenuItemBits::CHECKABLE)
-                {
                     aItemTree.put("checktype", "checkmark");
-                    bHasChecks = true;
-                }
                 else if (aItemBits & MenuItemBits::RADIOCHECK)
-                {
                     aItemTree.put("checktype", "radio");
-                    bHasChecks = true;
-                }
                 else if (aItemBits & MenuItemBits::AUTOCHECK)
-                {
                     aItemTree.put("checktype", "auto");
-                    bHasChecks = true;
-                }
+                else
+                    bHasChecks = false;
 
                 if (bHasChecks)
-                {
-                    if (pMenu->IsItemChecked(nItemId))
-                        aItemTree.put("checked", "true");
-                    else
-                        aItemTree.put("checked", "false");
-                }
+                    aItemTree.put("checked", pMenu->IsItemChecked(nItemId));
             }
 
             if (!aItemTree.empty())
commit 6be044e919d28b93332f04bdc18f6def2925b098
Author: Pranav Kant <pranavk at collabora.com>
Date:   Thu Mar 31 14:47:27 2016 +0530

    lok context menu: Expose context menu
    
    Change-Id: I0968689630e10f838c075e86357eb36a9a220d0d

diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 343d169..88098b1 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -280,6 +280,22 @@ typedef enum
      * }
      */
     LOK_CALLBACK_ERROR,
+
+    /**
+     * Context menu structure
+     *
+     * Returns the structure of context menu
+     *
+     * {
+     *      "menu": [
+     *          {"text": "label text", "type": "command | separator | menu",
+     *      "command | menu": "..." },
+     *          ...
+     *      ]
+     * }
+     */
+    LOK_CALLBACK_CONTEXT_MENU,
+
 }
 LibreOfficeKitCallbackType;
 
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index dc1cec7..a39320c 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -301,7 +301,6 @@ protected:
     virtual void    LoseFocus() SAL_OVERRIDE;
 
     virtual void    RequestHelp( const HelpEvent& rEvt ) SAL_OVERRIDE;
-    virtual void    Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
 
     virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) SAL_OVERRIDE;
     virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) SAL_OVERRIDE;
@@ -319,6 +318,7 @@ public:
     rtl::Reference<sdr::overlay::OverlayManager> getOverlayManager();
     void flushOverlayManager();
 
+    virtual void    Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
     virtual void    DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
 
     virtual void    MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index d21a7a2..cba78bd 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -597,13 +597,21 @@ void ScModelObj::postMouseEvent(int nType, int nX, int nY, int nCount, int nButt
                        Fraction(nTilePixelHeight * TWIPS_PER_PIXEL, nTileTwipHeight), true);
 
     // Calc operates in pixels...
-    MouseEvent aEvent(Point(nX * pViewData->GetPPTX(), nY * pViewData->GetPPTY()), nCount,
+    Point aPos(nX * pViewData->GetPPTX(), nY * pViewData->GetPPTY());
+    MouseEvent aEvent(aPos, nCount,
             MouseEventModifiers::SIMPLECLICK, nButtons, nModifier);
 
     switch (nType)
     {
     case LOK_MOUSEEVENT_MOUSEBUTTONDOWN:
         pGridWindow->MouseButtonDown(aEvent);
+
+        // Invoke the context menu
+        if (nButtons & MOUSE_RIGHT)
+        {
+            const CommandEvent aCEvt(aPos, CommandEventId::ContextMenu, true, nullptr);
+            pGridWindow->Command(aCEvt);
+        }
         break;
     case LOK_MOUSEEVENT_MOUSEBUTTONUP:
         pGridWindow->MouseButtonUp(aEvent);
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 61e2bbc..57fca72 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2454,16 +2454,24 @@ void SdXImpressDocument::postMouseEvent(int nType, int nX, int nY, int nCount, i
     SolarMutexGuard aGuard;
 
     DrawViewShell* pViewShell = GetViewShell();
+    Window* pWindow = pViewShell->GetActiveWindow();
     if (!pViewShell)
         return;
 
-    MouseEvent aEvent(Point(convertTwipToMm100(nX), convertTwipToMm100(nY)), nCount,
+    Point aPos(Point(convertTwipToMm100(nX), convertTwipToMm100(nY)));
+    MouseEvent aEvent(aPos, nCount,
             MouseEventModifiers::SIMPLECLICK, nButtons, nModifier);
 
     switch (nType)
     {
     case LOK_MOUSEEVENT_MOUSEBUTTONDOWN:
         pViewShell->LogicMouseButtonDown(aEvent);
+
+        if (nButtons & MOUSE_RIGHT)
+        {
+            const CommandEvent aCEvt(aPos, CommandEventId::ContextMenu, true, nullptr);
+            pViewShell->Command(aCEvt, pWindow);
+        }
         break;
     case LOK_MOUSEEVENT_MOUSEBUTTONUP:
         pViewShell->LogicMouseButtonUp(aEvent);
diff --git a/sfx2/source/menu/mnumgr.cxx b/sfx2/source/menu/mnumgr.cxx
index 782d041..b3a8961 100644
--- a/sfx2/source/menu/mnumgr.cxx
+++ b/sfx2/source/menu/mnumgr.cxx
@@ -17,6 +17,8 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <boost/property_tree/json_parser.hpp>
+
 #include <com/sun/star/embed/VerbDescriptor.hpp>
 #include <com/sun/star/embed/VerbAttributes.hpp>
 #include <com/sun/star/container/XNamed.hpp>
@@ -64,6 +66,9 @@
 #include <sfx2/objface.hxx>
 #include "thessubmenu.hxx"
 
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
+#include <comphelper/lok.hxx>
+
 // static member initialization
 PopupMenu * SfxPopupMenuManager::pStaticThesSubMenu = NULL;
 
@@ -330,6 +335,105 @@ SfxPopupMenuManager* SfxPopupMenuManager::Popup( const ResId& rResId, SfxViewFra
     return 0;
 }
 
+namespace {
+
+    boost::property_tree::ptree fillPopupMenu(Menu* pMenu)
+    {
+        // Activate this menu first
+        pMenu->HandleMenuActivateEvent(pMenu);
+        pMenu->HandleMenuDeActivateEvent(pMenu);
+
+        boost::property_tree::ptree aTree;
+        // If last item inserted is some valid text
+        bool bIsLastItemText = false;
+        sal_uInt16 nCount = pMenu->GetItemCount();
+        for (sal_uInt16 nPos = 0; nPos < nCount; nPos++)
+        {
+            boost::property_tree::ptree aItemTree;
+            const MenuItemType aItemType = pMenu->GetItemType(nPos);
+
+            if (aItemType == MenuItemType::DONTKNOW)
+                continue;
+
+            if (aItemType == MenuItemType::SEPARATOR)
+            {
+                if (bIsLastItemText)
+                    aItemTree.put("type", "separator");
+                bIsLastItemText = false;
+            }
+            else
+            {
+                const sal_uInt16 nItemId = pMenu->GetItemId(nPos);
+                const OUString aCommandURL = pMenu->GetItemCommand(nItemId);
+
+                const OUString aItemText = pMenu->GetItemText(nItemId);
+                Menu* pPopupSubmenu = pMenu->GetPopupMenu(nItemId);
+
+                if (!pMenu->IsItemEnabled(nItemId))
+                    continue;
+
+                if (!aItemText.isEmpty())
+                    aItemTree.put("text", std::string(aItemText.toUtf8().getStr()));
+
+                if (pPopupSubmenu)
+                {
+                    boost::property_tree::ptree aSubmenu = fillPopupMenu(pPopupSubmenu);
+                    if (!aSubmenu.empty())
+                    {
+                        aItemTree.put("type", "menu");
+                        aItemTree.push_back(std::make_pair("menu", aSubmenu));
+                    }
+                    else
+                        aItemTree.clear();
+                }
+                else
+                {
+                    if (!aCommandURL.isEmpty())
+                    {
+                        aItemTree.put("type", "command");
+                        aItemTree.put("command", std::string(aCommandURL.toUtf8().getStr()));
+                    }
+                }
+
+                MenuItemBits aItemBits = pMenu->GetItemBits(nItemId);
+                bool bHasChecks = false;
+                if (aItemBits & MenuItemBits::CHECKABLE)
+                {
+                    aItemTree.put("checktype", "checkmark");
+                    bHasChecks = true;
+                }
+                else if (aItemBits & MenuItemBits::RADIOCHECK)
+                {
+                    aItemTree.put("checktype", "radio");
+                    bHasChecks = true;
+                }
+                else if (aItemBits & MenuItemBits::AUTOCHECK)
+                {
+                    aItemTree.put("checktype", "auto");
+                    bHasChecks = true;
+                }
+
+                if (bHasChecks)
+                {
+                    if (pMenu->IsItemChecked(nItemId))
+                        aItemTree.put("checked", "true");
+                    else
+                        aItemTree.put("checked", "false");
+                }
+            }
+
+            if (!aItemTree.empty())
+            {
+                aTree.push_back(std::make_pair("", aItemTree));
+                if (aItemType != MenuItemType::SEPARATOR)
+                    bIsLastItemText = true;
+            }
+        }
+
+        return aTree;
+    }
+
+} // end anonymous namespace
 
 void SfxPopupMenuManager::ExecutePopup( const ResId& rResId, SfxViewFrame* pFrame, const Point& rPoint, vcl::Window* pWindow )
 {
@@ -372,9 +476,23 @@ void SfxPopupMenuManager::ExecutePopup( const ResId& rResId, SfxViewFrame* pFram
             pSVMenu = static_cast<PopupMenu*>( pMenu );
         }
 
-        SfxPopupMenuManager aPop( pSVMenu, pFrame->GetBindings() );
-        aPop.RemoveDisabledEntries();
-        aPop.Execute( rPoint, pWindow );
+        if (comphelper::LibreOfficeKit::isActive())
+        {
+            boost::property_tree::ptree aMenu = fillPopupMenu(pSVMenu);
+            boost::property_tree::ptree aRoot;
+            aRoot.add_child("menu", aMenu);
+
+            std::stringstream aStream;
+            boost::property_tree::write_json(aStream, aRoot, true);
+            const SfxObjectShell* objSh = pFrame->GetObjectShell();
+            objSh->libreOfficeKitCallback(LOK_CALLBACK_CONTEXT_MENU, aStream.str().c_str());
+        }
+        else
+        {
+            SfxPopupMenuManager aPop( pSVMenu, pFrame->GetBindings() );
+            aPop.RemoveDisabledEntries();
+            aPop.Execute( rPoint, pWindow );
+        }
 
         // #i112646 avoid crash when context menu is closed.
         // the (manually inserted) sub-menu needs to be destroyed before
diff --git a/sw/source/uibase/inc/edtwin.hxx b/sw/source/uibase/inc/edtwin.hxx
index ed65f1e..52ad95b 100644
--- a/sw/source/uibase/inc/edtwin.hxx
+++ b/sw/source/uibase/inc/edtwin.hxx
@@ -197,8 +197,6 @@ protected:
     virtual void    MouseButtonUp(const MouseEvent& rMEvt) SAL_OVERRIDE;
     virtual void    RequestHelp(const HelpEvent& rEvt) SAL_OVERRIDE;
 
-    virtual void    Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
-
                                 // Drag & Drop Interface
     virtual sal_Int8    AcceptDrop( const AcceptDropEvent& rEvt ) SAL_OVERRIDE;
     virtual sal_Int8    ExecuteDrop( const ExecuteDropEvent& rEvt ) SAL_OVERRIDE;
@@ -297,6 +295,8 @@ public:
     virtual ~SwEditWin();
     virtual void dispose() SAL_OVERRIDE;
 
+    virtual void    Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
+
     /// @see OutputDevice::LogicInvalidate().
     void LogicInvalidate(const Rectangle* pRectangle) SAL_OVERRIDE;
     /// Same as MouseButtonDown(), but coordinates are in logic unit.
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 1f7fbf9..9a78c37 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3344,12 +3344,19 @@ void SwXTextDocument::postMouseEvent(int nType, int nX, int nY, int nCount, int
     SolarMutexGuard aGuard;
 
     SwEditWin& rEditWin = pDocShell->GetView()->GetEditWin();
-    MouseEvent aEvent(Point(nX, nY), nCount, MouseEventModifiers::SIMPLECLICK, nButtons, nModifier);
+    Point aPos(nX , nY);
+    MouseEvent aEvent(aPos, nCount, MouseEventModifiers::SIMPLECLICK, nButtons, nModifier);
 
     switch (nType)
     {
     case LOK_MOUSEEVENT_MOUSEBUTTONDOWN:
         rEditWin.LogicMouseButtonDown(aEvent);
+
+        if (nButtons & MOUSE_RIGHT)
+        {
+            const CommandEvent aCEvt(aPos, CommandEventId::ContextMenu, true, nullptr);
+            rEditWin.Command(aCEvt);
+        }
         break;
     case LOK_MOUSEEVENT_MOUSEBUTTONUP:
         rEditWin.LogicMouseButtonUp(aEvent);
commit 9820da23375d89c26d6feb9d8ee3969916dc0d76
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Feb 22 20:57:52 2016 +0000

    gtk3: some changes towards enabling native gtk3 popup menus
    
    these menubar things can be menu things and can then do
    away with the casting, no logic changes intended
    
    Change-Id: Ibb1b5354d5e1483327f172d6890e134f1e4b9ee4

diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx
index 479849f..6636c8f 100644
--- a/include/vcl/menu.hxx
+++ b/include/vcl/menu.hxx
@@ -411,8 +411,11 @@ public:
 
     void HighlightItem( sal_uInt16 nItemPos );
     void DeHighlight() { HighlightItem( 0xFFFF ); } // MENUITEMPOS_INVALID
-};
 
+    bool HandleMenuCommandEvent(Menu *pMenu, sal_uInt16 nEventId) const;
+    bool HandleMenuActivateEvent(Menu *pMenu) const;
+    bool HandleMenuDeActivateEvent(Menu *pMenu) const;
+};
 
 namespace vcl { namespace MenuInvalidator {
 
@@ -473,10 +476,7 @@ public:
     void ShowButtons( bool bClose, bool bFloat, bool bHide );
 
     virtual void SelectItem(sal_uInt16 nId) SAL_OVERRIDE;
-    bool HandleMenuActivateEvent(Menu *pMenu) const;
-    bool HandleMenuDeActivateEvent(Menu *pMenu) const;
     bool HandleMenuHighlightEvent(Menu *pMenu, sal_uInt16 nEventId) const;
-    bool HandleMenuCommandEvent(Menu *pMenu, sal_uInt16 nEventId) const;
     bool HandleMenuButtonEvent(Menu *pMenu, sal_uInt16 nEventId);
 
     void SetCloseButtonClickHdl( const Link<>& rLink ) { maCloseHdl = rLink; }
diff --git a/vcl/inc/unx/gtk/gtksalmenu.hxx b/vcl/inc/unx/gtk/gtksalmenu.hxx
index e74de22..cefac23 100644
--- a/vcl/inc/unx/gtk/gtksalmenu.hxx
+++ b/vcl/inc/unx/gtk/gtksalmenu.hxx
@@ -40,7 +40,7 @@ class GtkSalMenu : public SalMenu
 private:
     std::vector< GtkSalMenuItem* >  maItems;
 
-    bool                        mbMenuBar;
+    bool                            mbMenuBar;
     Menu*                           mpVCLMenu;
     GtkSalMenu*                     mpParentSalMenu;
     const GtkSalFrame*              mpFrame;
@@ -51,7 +51,7 @@ private:
 
     GtkSalMenu*                 GetMenuForItemCommand( gchar* aCommand, gboolean bGetSubmenu );
     void                        ImplUpdate( gboolean bRecurse );
-    void                        ActivateAllSubmenus(MenuBar* pMenuBar);
+    void                        ActivateAllSubmenus(Menu* pMenuBar);
 
 public:
     GtkSalMenu( bool bMenuBar );
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 629b419..e5af009 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2663,14 +2663,13 @@ void MenuBar::SelectItem(sal_uInt16 nId)
 }
 
 // handler for native menu selection and command events
-
-bool MenuBar::HandleMenuActivateEvent( Menu *pMenu ) const
+bool Menu::HandleMenuActivateEvent( Menu *pMenu ) const
 {
     if( pMenu )
     {
         ImplMenuDelData aDelData( this );
 
-        pMenu->pStartedFrom = const_cast<MenuBar*>(this);
+        pMenu->pStartedFrom = const_cast<Menu*>(this);
         pMenu->bInCallback = true;
         pMenu->Activate();
 
@@ -2680,13 +2679,13 @@ bool MenuBar::HandleMenuActivateEvent( Menu *pMenu ) const
     return true;
 }
 
-bool MenuBar::HandleMenuDeActivateEvent( Menu *pMenu ) const
+bool Menu::HandleMenuDeActivateEvent( Menu *pMenu ) const
 {
     if( pMenu )
     {
         ImplMenuDelData aDelData( this );
 
-        pMenu->pStartedFrom = const_cast<MenuBar*>(this);
+        pMenu->pStartedFrom = const_cast<Menu*>(this);
         pMenu->bInCallback = true;
         pMenu->Deactivate();
         if( !aDelData.isDeleted() )
@@ -2719,14 +2718,14 @@ bool MenuBar::HandleMenuHighlightEvent( Menu *pMenu, sal_uInt16 nHighlightEventI
         return false;
 }
 
-bool MenuBar::HandleMenuCommandEvent( Menu *pMenu, sal_uInt16 nCommandEventId ) const
+bool Menu::HandleMenuCommandEvent( Menu *pMenu, sal_uInt16 nCommandEventId ) const
 {
     if( !pMenu )
-        pMenu = const_cast<MenuBar*>(this)->ImplFindMenu(nCommandEventId);
+        pMenu = const_cast<Menu*>(this)->ImplFindMenu(nCommandEventId);
     if( pMenu )
     {
         pMenu->nSelectedId = nCommandEventId;
-        pMenu->pStartedFrom = const_cast<MenuBar*>(this);
+        pMenu->pStartedFrom = const_cast<Menu*>(this);
         pMenu->ImplSelect();
         return true;
     }
diff --git a/vcl/unx/gtk/window/gtksalmenu.cxx b/vcl/unx/gtk/window/gtksalmenu.cxx
index 4a18999..47e97f8 100644
--- a/vcl/unx/gtk/window/gtksalmenu.cxx
+++ b/vcl/unx/gtk/window/gtksalmenu.cxx
@@ -664,11 +664,10 @@ void GtkSalMenu::DispatchCommand( gint itemId, const gchar *aCommand )
     GtkSalMenu* pSalSubMenu = GetMenuForItemCommand( const_cast<gchar*>(aCommand), FALSE );
     Menu* pSubMenu = ( pSalSubMenu != NULL ) ? pSalSubMenu->GetMenu() : NULL;
 
-    MenuBar* pMenuBar = static_cast< MenuBar* >( mpVCLMenu );
-    pMenuBar->HandleMenuCommandEvent( pSubMenu, itemId );
+    mpVCLMenu->HandleMenuCommandEvent( pSubMenu, itemId );
 }
 
-void GtkSalMenu::ActivateAllSubmenus(MenuBar* pMenuBar)
+void GtkSalMenu::ActivateAllSubmenus(Menu* pMenuBar)
 {
     pMenuBar->HandleMenuActivateEvent(mpVCLMenu);
     for ( sal_uInt16 nPos = 0; nPos < maItems.size(); nPos++ )
@@ -686,7 +685,7 @@ void GtkSalMenu::Activate()
 {
     if ( !mbMenuBar )
         return;
-    ActivateAllSubmenus(static_cast<MenuBar*>(mpVCLMenu));
+    ActivateAllSubmenus(mpVCLMenu);
 }
 
 void GtkSalMenu::Deactivate( const gchar* aMenuCommand )
@@ -697,8 +696,7 @@ void GtkSalMenu::Deactivate( const gchar* aMenuCommand )
     GtkSalMenu* pSalSubMenu = GetMenuForItemCommand( const_cast<gchar*>(aMenuCommand), TRUE );
 
     if ( pSalSubMenu != NULL ) {
-        MenuBar* pMenuBar = static_cast< MenuBar* >( mpVCLMenu );
-        pMenuBar->HandleMenuDeActivateEvent( pSalSubMenu->mpVCLMenu );
+        mpVCLMenu->HandleMenuDeActivateEvent( pSalSubMenu->mpVCLMenu );
     }
 }
 


More information about the Libreoffice-commits mailing list