[Libreoffice-commits] core.git: solenv/bin solenv/clang-format svtools/Library_svt.mk svtools/source vcl/inc vcl/Library_vcl.mk vcl/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Dec 4 16:49:44 UTC 2020


 solenv/bin/native-code.py                |    1 -
 solenv/clang-format/excludelist          |    2 +-
 svtools/Library_svt.mk                   |    1 -
 vcl/Library_vcl.mk                       |    1 +
 vcl/inc/managedmenubutton.hxx            |   30 ++++++++++++++++++++++++++++++
 vcl/source/control/managedmenubutton.cxx |   28 +++-------------------------
 vcl/source/window/builder.cxx            |   11 +++++++++++
 7 files changed, 46 insertions(+), 28 deletions(-)

New commits:
commit fcb7fe3a082c200f69f10c1d3951761a7e41d6e0
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Dec 4 15:39:45 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Dec 4 17:48:56 2020 +0100

    move ManagedMenuButton to vcl
    
    Change-Id: Ie2dd1635a5f5f677d286011a14b734af7435612a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107231
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index 13a7e720be08..6eefce978bb9 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -716,7 +716,6 @@ constructor_map = {
 custom_widgets = [
     'ContextVBox',
     'DropdownBox',
-    'ManagedMenuButton',
     'NotebookbarTabControl',
     'NotebookbarToolBox',
     'PriorityHBox',
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index fddf4b2955f8..b7105c4d962d 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -11421,7 +11421,6 @@ svtools/source/control/ctrlbox.cxx
 svtools/source/control/ctrltool.cxx
 svtools/source/control/indexentryres.cxx
 svtools/source/control/inettbc.cxx
-svtools/source/control/managedmenubutton.cxx
 svtools/source/control/ruler.cxx
 svtools/source/control/scriptedtext.cxx
 svtools/source/control/tabbar.cxx
@@ -14995,6 +14994,7 @@ vcl/source/control/imp_listbox.cxx
 vcl/source/control/ivctrl.cxx
 vcl/source/control/listbox.cxx
 vcl/source/control/longcurr.cxx
+vcl/source/control/managedmenubutton.cxx
 vcl/source/control/menubtn.cxx
 vcl/source/control/notebookbar.cxx
 vcl/source/control/prgsbar.cxx
diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk
index be89ea4c2b56..adaa6b1bc99d 100644
--- a/svtools/Library_svt.mk
+++ b/svtools/Library_svt.mk
@@ -96,7 +96,6 @@ $(eval $(call gb_Library_add_exception_objects,svt,\
     svtools/source/control/ctrltool \
     svtools/source/control/indexentryres \
     svtools/source/control/inettbc \
-    svtools/source/control/managedmenubutton \
     svtools/source/control/ruler \
     svtools/source/control/scriptedtext \
     svtools/source/control/tabbar \
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index bc6b8f8f9af7..8f9608d2ca2c 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -199,6 +199,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
     vcl/source/control/longcurr \
     vcl/source/control/imp_listbox \
     vcl/source/control/listbox \
+	vcl/source/control/managedmenubutton \
     vcl/source/control/menubtn \
     vcl/source/control/notebookbar \
     vcl/source/control/WeldedTabbedNotebookbar \
diff --git a/vcl/inc/managedmenubutton.hxx b/vcl/inc/managedmenubutton.hxx
new file mode 100644
index 000000000000..d80655288215
--- /dev/null
+++ b/vcl/inc/managedmenubutton.hxx
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <vcl/menubtn.hxx>
+#include <com/sun/star/awt/XPopupMenu.hpp>
+#include <com/sun/star/frame/XPopupMenuController.hpp>
+
+class ManagedMenuButton : public MenuButton
+{
+public:
+    ManagedMenuButton(vcl::Window* pParent, WinBits nStyle);
+    ~ManagedMenuButton() override;
+
+    void Activate() override;
+    void dispose() override;
+
+private:
+    css::uno::Reference<css::awt::XPopupMenu> m_xPopupMenu;
+    css::uno::Reference<css::frame::XPopupMenuController> m_xPopupController;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/svtools/source/control/managedmenubutton.cxx b/vcl/source/control/managedmenubutton.cxx
similarity index 84%
rename from svtools/source/control/managedmenubutton.cxx
rename to vcl/source/control/managedmenubutton.cxx
index 4db9d2a1858b..880730721ce2 100644
--- a/svtools/source/control/managedmenubutton.cxx
+++ b/vcl/source/control/managedmenubutton.cxx
@@ -9,31 +9,13 @@
 
 #include <comphelper/processfactory.hxx>
 #include <comphelper/propertyvalue.hxx>
-#include <vcl/builderfactory.hxx>
+
+#include <managedmenubutton.hxx>
 #include <vcl/menu.hxx>
-#include <vcl/menubtn.hxx>
 
-#include <com/sun/star/awt/XPopupMenu.hpp>
-#include <com/sun/star/frame/theDesktop.hpp>
 #include <com/sun/star/frame/ModuleManager.hpp>
+#include <com/sun/star/frame/theDesktop.hpp>
 #include <com/sun/star/frame/thePopupMenuControllerFactory.hpp>
-#include <com/sun/star/frame/XPopupMenuController.hpp>
-
-namespace {
-
-class ManagedMenuButton : public MenuButton
-{
-public:
-    ManagedMenuButton(vcl::Window* pParent, WinBits nStyle);
-    ~ManagedMenuButton() override;
-
-    void Activate() override;
-    void dispose() override;
-
-private:
-    css::uno::Reference<css::awt::XPopupMenu> m_xPopupMenu;
-    css::uno::Reference<css::frame::XPopupMenuController> m_xPopupController;
-};
 
 ManagedMenuButton::ManagedMenuButton(vcl::Window* pParent, WinBits nStyle)
     : MenuButton(pParent, nStyle)
@@ -115,8 +97,4 @@ void ManagedMenuButton::Activate()
         m_xPopupController->setPopupMenu(m_xPopupMenu);
 }
 
-}
-
-VCL_BUILDER_FACTORY_ARGS(ManagedMenuButton, WB_CLIPCHILDREN|WB_CENTER|WB_VCENTER|WB_FLATBUTTON)
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 6110f3460a9b..fa759ead51f8 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -57,6 +57,7 @@
 #include <iconview.hxx>
 #include <svdata.hxx>
 #include <bitmaps.hlst>
+#include <managedmenubutton.hxx>
 #include <messagedialog.hxx>
 #include <OptionalBox.hxx>
 #include <window.h>
@@ -1958,6 +1959,16 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
         // tdf#135495 fallback sfxlo-OptionalBox to VclOptionalBox as a stopgap
         xWindow = VclPtr<OptionalBox>::Create(pParent);
     }
+    else if (name == "svtlo-ManagedMenuButton")
+    {
+        // like tdf#135495 keep the name svtlo-ManagedMenuButton even though its a misnomer
+        // and is not dlsymed from the svt library
+        xWindow = VclPtr<ManagedMenuButton>::Create(pParent, WB_CLIPCHILDREN|WB_CENTER|WB_VCENTER|WB_FLATBUTTON);
+        OUString sMenu = BuilderUtils::extractCustomProperty(rMap);
+        if (!sMenu.isEmpty())
+            m_pParserState->m_aButtonMenuMaps.emplace_back(id, sMenu);
+        setupFromActionName(static_cast<Button*>(xWindow.get()), rMap, m_xFrame);
+    }
     else if (name == "GtkIconView")
     {
         assert(rMap.find(OString("model")) != rMap.end() && "GtkIconView must have a model");


More information about the Libreoffice-commits mailing list