include/vcl/menu.hxx       |   13 ++++++--
 vcl/source/window/menu.cxx |   71 +++++++++++++++++++++++----------------------
 2 files changed, 48 insertions(+), 36 deletions(-)

New commits:
commit 5ac2c503c04282b3b456ccb8bf39d886e568d1fa
Author: Jan Holesovsky <ke...@collabora.com>
Date:   Mon Sep 15 10:30:18 2014 +0200

    vcl menu: Make DeactivateMenuBar() virtual to eliminate IsMenuBar() call.
    
    Change-Id: I33ba324a13e2addb678fb801222bd25a21c3ef1b

diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx
index 8045963..db133e6 100644
--- a/include/vcl/menu.hxx
+++ b/include/vcl/menu.hxx
@@ -190,7 +190,7 @@ protected:
     virtual void CloseStartedFrom() = 0;
 
     /// Deactivate the MenuBarWindow.
-    SAL_DLLPRIVATE sal_uLong DeactivateMenuBar(sal_uLong nFocusId);
+    virtual sal_uLong DeactivateMenuBar(sal_uLong nFocusId);
 
     /// Forward the KeyInput call to the MenuBar.
     SAL_DLLPRIVATE void MenuBarKeyInput(const KeyEvent& rEvent);
@@ -423,6 +423,9 @@ public:
     /// Close the 'pStartedFrom' menu window.
     virtual void CloseStartedFrom() SAL_OVERRIDE;
 
+    /// Deactivate the MenuBarWindow.
+    virtual sal_uLong DeactivateMenuBar(sal_uLong nFocusId) SAL_OVERRIDE;
+
     void                ShowCloseButton( bool bShow = true );
     bool                HasCloseButton() const { return mbCloseBtnVisible; }
     bool            HasFloatButton() const { return mbFloatBtnVisible; }
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 0a58c2d..60e2425 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2265,16 +2265,6 @@ bool Menu::HasValidEntries( bool bCheckPopups )
 
 sal_uLong Menu::DeactivateMenuBar(sal_uLong nFocusId)
 {
-    if (!IsMenuBar())
-        return nFocusId;
-
-    nFocusId = 
((MenuBarWindow*)(dynamic_cast<MenuBar*>(this))->ImplGetWindow())->GetFocusId();
-    if (nFocusId)
-    {
-        
((MenuBarWindow*)(dynamic_cast<MenuBar*>(this))->ImplGetWindow())->SetFocusId(0);
-        ImplGetSVData()->maWinData.mbNoDeactivate = false;
-    }
-
     return nFocusId;
 }
 
@@ -2479,6 +2469,18 @@ void MenuBar::CloseStartedFrom()
         p->PopupClosed(this);
 }
 
+sal_uLong MenuBar::DeactivateMenuBar(sal_uLong nFocusId)
+{
+    nFocusId = 
((MenuBarWindow*)(dynamic_cast<MenuBar*>(this))->ImplGetWindow())->GetFocusId();
+    if (nFocusId)
+    {
+        
((MenuBarWindow*)(dynamic_cast<MenuBar*>(this))->ImplGetWindow())->SetFocusId(0);
+        ImplGetSVData()->maWinData.mbNoDeactivate = false;
+    }
+
+    return nFocusId;
+}
+
 void MenuBar::ShowCloseButton(bool bShow)
 {
     ShowButtons( bShow, mbFloatBtnVisible, mbHideBtnVisible );
commit fcc49e118c9da28309dce3389d111a546cba19cd
Author: Jan Holesovsky <ke...@collabora.com>
Date:   Mon Sep 15 10:22:49 2014 +0200

    vcl menu: Make CloseStartedFrom() virtual to eliminate IsMenuBar() call.
    
    Change-Id: Ifd89b7a9264075b166dd621fcb2c55225e25ea87

diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx
index 5eaa3c9..8045963 100644
--- a/include/vcl/menu.hxx
+++ b/include/vcl/menu.hxx
@@ -187,7 +187,7 @@ protected:
     SAL_DLLPRIVATE void                ImplRemoveDel( ImplMenuDelData &rDel );
 
     /// Close the 'pStartedFrom' menu window.
-    SAL_DLLPRIVATE void CloseStartedFrom();
+    virtual void CloseStartedFrom() = 0;
 
     /// Deactivate the MenuBarWindow.
     SAL_DLLPRIVATE sal_uLong DeactivateMenuBar(sal_uLong nFocusId);
@@ -420,6 +420,9 @@ public:
 
     virtual bool        IsMenuBar() const SAL_OVERRIDE { return true; }
 
+    /// Close the 'pStartedFrom' menu window.
+    virtual void CloseStartedFrom() SAL_OVERRIDE;
+
     void                ShowCloseButton( bool bShow = true );
     bool                HasCloseButton() const { return mbCloseBtnVisible; }
     bool            HasFloatButton() const { return mbFloatBtnVisible; }
@@ -504,6 +507,9 @@ public:
 
     virtual bool        IsMenuBar() const SAL_OVERRIDE { return false; }
 
+    /// Close the 'pStartedFrom' menu window.
+    virtual void CloseStartedFrom() SAL_OVERRIDE;
+
     void                SetText( const OUString& rTitle )  { aTitleText = 
rTitle; }
     const OUString&     GetText() const                     { return 
aTitleText; }
 
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 7923acd..0a58c2d 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2263,30 +2263,6 @@ bool Menu::HasValidEntries( bool bCheckPopups )
     return bValidEntries;
 }
 
-void Menu::CloseStartedFrom()
-{
-    // if the window was closed by TH, there is another menu
-    // which has this window as pActivePopup
-    if (!pStartedFrom)
-        return;
-
-    // pWin from parent could be 0, if the list is
-    // cleaned from the start, now clean up the endpopup-events
-    if (pStartedFrom->IsMenuBar())
-    {
-        MenuBarWindow* p = (MenuBarWindow*) pStartedFrom->ImplGetWindow();
-        if (p)
-            p->PopupClosed(this);
-    }
-    else
-    {
-        MenuFloatingWindow* p = (MenuFloatingWindow*) 
pStartedFrom->ImplGetWindow();
-        PopupMenu *pMenu = dynamic_cast<PopupMenu*>(this);
-        if (p && pMenu)
-            p->KillActivePopup(pMenu);
-    }
-}
-
 sal_uLong Menu::DeactivateMenuBar(sal_uLong nFocusId)
 {
     if (!IsMenuBar())
@@ -2491,6 +2467,18 @@ MenuBar::~MenuBar()
     ImplDestroy( this, true );
 }
 
+void MenuBar::CloseStartedFrom()
+{
+    // if the window was closed by TH, there is another menu
+    // which has this window as pActivePopup
+    if (!pStartedFrom)
+        return;
+
+    MenuBarWindow* p = (MenuBarWindow*) pStartedFrom->ImplGetWindow();
+    if (p)
+        p->PopupClosed(this);
+}
+
 void MenuBar::ShowCloseButton(bool bShow)
 {
     ShowButtons( bShow, mbFloatBtnVisible, mbHideBtnVisible );
@@ -2717,6 +2705,19 @@ PopupMenu::~PopupMenu()
         *pRefAutoSubMenu = NULL;    // #111060# avoid second delete in 
~MenuItemData
 }
 
+void PopupMenu::CloseStartedFrom()
+{
+    // if the window was closed by TH, there is another menu
+    // which has this window as pActivePopup
+    if (!pStartedFrom)
+        return;
+
+    MenuFloatingWindow* p = (MenuFloatingWindow*) 
pStartedFrom->ImplGetWindow();
+    PopupMenu *pMenu = dynamic_cast<PopupMenu*>(this);
+    if (p && pMenu)
+        p->KillActivePopup(pMenu);
+}
+
 bool PopupMenu::IsInExecute()
 {
     return GetActivePopupMenu() ? true : false;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to