[Libreoffice-commits] core.git: dbaccess/source include/vcl vcl/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Feb 24 09:08:25 UTC 2021


 dbaccess/source/ui/app/AppControllerGen.cxx |   11 ++---------
 include/vcl/syswin.hxx                      |    2 ++
 vcl/source/window/syswin.cxx                |   11 +++++++++++
 3 files changed, 15 insertions(+), 9 deletions(-)

New commits:
commit 00c1d85fabe426efdf6833b8034b041f1263d702
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Feb 23 19:36:37 2021 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Feb 24 10:07:39 2021 +0100

    hide MenuBar details
    
    Change-Id: I409a4df7703300e920511c28263634a00c7c6da7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111432
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/dbaccess/source/ui/app/AppControllerGen.cxx b/dbaccess/source/ui/app/AppControllerGen.cxx
index 28b4c4053da3..632523e76977 100644
--- a/dbaccess/source/ui/app/AppControllerGen.cxx
+++ b/dbaccess/source/ui/app/AppControllerGen.cxx
@@ -52,7 +52,6 @@
 #include <toolkit/helper/vclunohelper.hxx>
 #include <tools/diagnose_ex.h>
 #include <osl/diagnose.h>
-#include <vcl/menu.hxx>
 #include <vcl/mnemonic.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/syswin.hxx>
@@ -648,14 +647,8 @@ void OApplicationController::onLoadedMenu(const Reference< css::frame::XLayoutMa
         // we need to share the "mnemonic space":
         MnemonicGenerator aMnemonicGenerator;
         // - the menu already has mnemonics
-        SystemWindow* pSystemWindow = getContainer()->GetSystemWindow();
-        MenuBar* pMenu = pSystemWindow ? pSystemWindow->GetMenuBar() : nullptr;
-        if ( pMenu )
-        {
-            sal_uInt16 nMenuItems = pMenu->GetItemCount();
-            for ( sal_uInt16 i = 0; i < nMenuItems; ++i )
-                aMnemonicGenerator.RegisterMnemonic( pMenu->GetItemText( pMenu->GetItemId( i ) ) );
-        }
+        if (SystemWindow* pSystemWindow = getContainer()->GetSystemWindow())
+            pSystemWindow->CollectMenuBarMnemonics(aMnemonicGenerator);
         // - the icons should use automatic ones
         getContainer()->createIconAutoMnemonics( aMnemonicGenerator );
         // - as well as the entries in the task pane
diff --git a/include/vcl/syswin.hxx b/include/vcl/syswin.hxx
index fee6afe96917..8b728a1af912 100644
--- a/include/vcl/syswin.hxx
+++ b/include/vcl/syswin.hxx
@@ -31,6 +31,7 @@
 class SalInstanceBuilder;
 class ScreenshotTest;
 class MenuBar;
+class MnemonicGenerator;
 class NotebookBar;
 class TaskPaneList;
 class VclBuilder;
@@ -193,6 +194,7 @@ public:
     void            SetMenuBar(MenuBar* pMenuBar);
     MenuBar*        GetMenuBar() const { return mpMenuBar; }
     void            SetMenuBarMode( MenuBarMode nMode );
+    void            CollectMenuBarMnemonics(MnemonicGenerator& rMnemonicGenerator) const;
 
     void SetNotebookBar(const OUString& rUIXMLDescription,
                         const css::uno::Reference<css::frame::XFrame>& rFrame,
diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index 8e396207df92..b204135036bd 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -25,6 +25,7 @@
 
 #include <vcl/accel.hxx>
 #include <vcl/layout.hxx>
+#include <vcl/mnemonic.hxx>
 #include <vcl/settings.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/menu.hxx>
@@ -1200,4 +1201,14 @@ void SystemWindow::ensureRepaint()
     }
 }
 
+void SystemWindow::CollectMenuBarMnemonics(MnemonicGenerator& rMnemonicGenerator) const
+{
+    if (MenuBar* pMenu = GetMenuBar())
+    {
+        sal_uInt16 nMenuItems = pMenu->GetItemCount();
+        for ( sal_uInt16 i = 0; i < nMenuItems; ++i )
+            rMnemonicGenerator.RegisterMnemonic( pMenu->GetItemText( pMenu->GetItemId( i ) ) );
+    }
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list