summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2017-02-09 00:31:24 +0200
committerMaxim Monastirsky <momonasmon@gmail.com>2017-02-09 22:49:51 +0000
commit54d5b1828ec73d0475e0ddb6e31394a7e1904a1b (patch)
tree95ea5cb85d31f4cd9d79d0fedb600c5a556ba361
parent8dc38dd9b132805191e0d20d00fb7559121fda15 (diff)
tdf#105672 framework managed menu button
This adds a menu button that can use a popup menu controller to manage its menu. It supports 2 cases: - Use any controller that is registered in Controller.xcu, by specifing its .uno command. - Manage an arbitrary popup menu with MenuBarManager (assuming its items have proper .uno commands in their MenuItemData::aCommandStr). It means that a menu that was defined in a .ui file, can be used inside that .ui file without any additional code. This commit uses the new control to fix some currently non-working buttons in Calc's Notebookbar (but there are more that can be fixed the same way). It's not clear how long we will continue to use buttons (instead of toolboxes) for the Notebookbar, but hopefully this control will be useful in other places too. Change-Id: Ie00cde7cd7e39948948960ca2eff76e9db837109 Reviewed-on: https://gerrit.libreoffice.org/34103 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
-rw-r--r--extras/source/glade/libreoffice-catalog.xml.in3
-rw-r--r--include/toolkit/awt/vclxmenu.hxx1
-rw-r--r--include/vcl/button.hxx1
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu4
-rw-r--r--sc/uiconfig/scalc/ui/notebookbar.ui2
-rw-r--r--sc/uiconfig/scalc/ui/notebookbar_groups.ui120
-rw-r--r--svtools/Library_svt.mk1
-rw-r--r--svtools/source/control/managedmenubutton.cxx122
-rw-r--r--toolkit/source/awt/vclxmenu.cxx7
-rw-r--r--vcl/source/window/builder.cxx13
10 files changed, 170 insertions, 104 deletions
diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in
index 82f9ab484240..b842df22279d 100644
--- a/extras/source/glade/libreoffice-catalog.xml.in
+++ b/extras/source/glade/libreoffice-catalog.xml.in
@@ -850,5 +850,8 @@
<glade-widget-class title="Vertical box hiding childs depending on context" name="sfxlo-ContextVBox"
generic-name="ContextVBox" parent="GtkBox"
icon-name="widget-gtk-box"/>
+ <glade-widget-class title="Managed Menu Button" name="svtlo-ManagedMenuButton"
+ generic-name="ManagedMenuButton" parent="GtkButton"
+ icon-name="widget-gtk-button"/>
</glade-widget-classes>
</glade-catalog>
diff --git a/include/toolkit/awt/vclxmenu.hxx b/include/toolkit/awt/vclxmenu.hxx
index afdd52b94333..e678d8b5d945 100644
--- a/include/toolkit/awt/vclxmenu.hxx
+++ b/include/toolkit/awt/vclxmenu.hxx
@@ -71,6 +71,7 @@ protected:
DECL_LINK( MenuEventListener, VclMenuEvent&, void );
void ImplCreateMenu( bool bPopup );
+ void ImplAddListener();
public:
VCLXMenu();
diff --git a/include/vcl/button.hxx b/include/vcl/button.hxx
index d8588dca30f5..b511db38f67c 100644
--- a/include/vcl/button.hxx
+++ b/include/vcl/button.hxx
@@ -76,6 +76,7 @@ public:
/// Setup handler for UNO commands so that commands like .uno:Something are handled automagically by this button.
void SetCommandHandler(const OUString& aCommand);
+ const OUString GetCommand() const { return maCommand; }
static OUString GetStandardText( StandardButtonType eButton );
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
index 3621837a8f27..5ac0c6cbc821 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
@@ -2189,7 +2189,7 @@
</node>
<node oor:name=".uno:ColumnOperations" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
- <value xml:lang="en-US">Column Operations</value>
+ <value xml:lang="en-US">Column</value>
</prop>
<prop oor:name="Properties" oor:type="xs:int">
<value>1</value>
@@ -2197,7 +2197,7 @@
</node>
<node oor:name=".uno:RowOperations" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
- <value xml:lang="en-US">Row Operations</value>
+ <value xml:lang="en-US">Row</value>
</prop>
<prop oor:name="Properties" oor:type="xs:int">
<value>1</value>
diff --git a/sc/uiconfig/scalc/ui/notebookbar.ui b/sc/uiconfig/scalc/ui/notebookbar.ui
index 8772510c20aa..f922d4ba7a2a 100644
--- a/sc/uiconfig/scalc/ui/notebookbar.ui
+++ b/sc/uiconfig/scalc/ui/notebookbar.ui
@@ -1381,7 +1381,7 @@
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
- <object class="GtkButton" id="ConditionalFormatMenu">
+ <object class="svtlo-ManagedMenuButton" id="ConditionalFormatMenu">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
diff --git a/sc/uiconfig/scalc/ui/notebookbar_groups.ui b/sc/uiconfig/scalc/ui/notebookbar_groups.ui
index 5011d96a80c0..a23f08d47ad7 100644
--- a/sc/uiconfig/scalc/ui/notebookbar_groups.ui
+++ b/sc/uiconfig/scalc/ui/notebookbar_groups.ui
@@ -148,6 +148,7 @@
<object class="GtkMenuItem" id="stylemenudefault">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="action_name">.uno:StyleApply?Style:string=Default&amp;FamilyName:string=CellStyles</property>
<property name="label" translatable="yes">Default</property>
<property name="use_underline">True</property>
</object>
@@ -162,6 +163,7 @@
<object class="GtkMenuItem" id="stylemenuacc1">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="action_name">.uno:StyleApply?Style:string=Accent%201&amp;FamilyName:string=CellStyles</property>
<property name="label" translatable="yes">Accent 1</property>
<property name="use_underline">True</property>
</object>
@@ -170,6 +172,7 @@
<object class="GtkMenuItem" id="stylemenuacc2">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="action_name">.uno:StyleApply?Style:string=Accent%202&amp;FamilyName:string=CellStyles</property>
<property name="label" translatable="yes">Accent 2</property>
<property name="use_underline">True</property>
</object>
@@ -178,6 +181,7 @@
<object class="GtkMenuItem" id="stylemenuacc3">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="action_name">.uno:StyleApply?Style:string=Accent%203&amp;FamilyName:string=CellStyles</property>
<property name="label" translatable="yes">Accent 3</property>
<property name="use_underline">True</property>
</object>
@@ -192,6 +196,7 @@
<object class="GtkMenuItem" id="stylemenuhed1">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="action_name">.uno:StyleApply?Style:string=Heading%201&amp;FamilyName:string=CellStyles</property>
<property name="label" translatable="yes">Heading 1</property>
<property name="use_underline">True</property>
</object>
@@ -200,6 +205,7 @@
<object class="GtkMenuItem" id="stylemenuhed2">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="action_name">.uno:StyleApply?Style:string=Heading%202&amp;FamilyName:string=CellStyles</property>
<property name="label" translatable="yes">Heading 2</property>
<property name="use_underline">True</property>
</object>
@@ -214,6 +220,7 @@
<object class="GtkMenuItem" id="stylemenustatg">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="action_name">.uno:StyleApply?Style:string=Good&amp;FamilyName:string=CellStyles</property>
<property name="label" translatable="yes">Good</property>
<property name="use_underline">True</property>
</object>
@@ -222,6 +229,7 @@
<object class="GtkMenuItem" id="stylemenustatn">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="action_name">.uno:StyleApply?Style:string=Neutral&amp;FamilyName:string=CellStyles</property>
<property name="label" translatable="yes">Neutral</property>
<property name="use_underline">True</property>
</object>
@@ -230,6 +238,7 @@
<object class="GtkMenuItem" id="stylemenustatb">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="action_name">.uno:StyleApply?Style:string=Bad&amp;FamilyName:string=CellStyles</property>
<property name="label" translatable="yes">Bad</property>
<property name="use_underline">True</property>
</object>
@@ -238,6 +247,7 @@
<object class="GtkMenuItem" id="stylemenustatw">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="action_name">.uno:StyleApply?Style:string=Warning&amp;FamilyName:string=CellStyles</property>
<property name="label" translatable="yes">Warning</property>
<property name="use_underline">True</property>
</object>
@@ -246,6 +256,7 @@
<object class="GtkMenuItem" id="stylemenustate">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="action_name">.uno:StyleApply?Style:string=Error&amp;FamilyName:string=CellStyles</property>
<property name="label" translatable="yes">Error</property>
<property name="use_underline">True</property>
</object>
@@ -260,6 +271,7 @@
<object class="GtkMenuItem" id="stylemenutxtn">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="action_name">.uno:StyleApply?Style:string=Note&amp;FamilyName:string=CellStyles</property>
<property name="label" translatable="yes">Note</property>
<property name="use_underline">True</property>
</object>
@@ -268,16 +280,12 @@
<object class="GtkMenuItem" id="stylemenutxtf">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="action_name">.uno:StyleApply?Style:string=Footnote&amp;FamilyName:string=CellStyles</property>
<property name="label" translatable="yes">Footnote</property>
<property name="use_underline">True</property>
</object>
</child>
</object>
- <object class="GtkImage" id="tablecolumnsi">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="pixbuf">cmd/lc_entirecolumn.png</property>
- </object>
<object class="GtkMenu" id="tablemenu">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -330,94 +338,6 @@
</object>
</child>
</object>
- <object class="GtkImage" id="tablerowsi">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="pixbuf">cmd/lc_entirerow.png</property>
- </object>
- <object class="GtkMenu" id="tcolumnmenu">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- <object class="GtkMenu" id="trowmenu">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkMenuItem" id="rowmenuaddup">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="action_name">.uno:InsertRowsBefore</property>
- <property name="label" translatable="yes">Insert Rows Above</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="rowmenuadddown">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="action_name">.uno:InsertRowsAfter</property>
- <property name="label" translatable="yes">Insert Rows Below</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- <child>
- <object class="GtkSeparatorMenuItem" id="rowmenusep1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="rowmenudel">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="action_name">.uno:DeleteRows</property>
- <property name="label" translatable="yes">Delete Rows</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="rowmenuselect">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="action_name">.uno:EntireRow</property>
- <property name="label" translatable="yes">Select Rows</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- <child>
- <object class="GtkSeparatorMenuItem" id="rowmenusep2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="rowmenuheight">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="action_name">.uno:SetRowHeight</property>
- <property name="label" translatable="yes">Row Height...</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="rowmenuoptimalrow">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="action_name">.uno:SetOptimalRowHeight</property>
- <property name="label" translatable="yes">Optimal Row Height</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="rowmenudistribute">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="action_name">.uno:DistributeRows</property>
- <property name="label" translatable="yes">Distribute Rows Evenly</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- </object>
<object class="GtkImage" id="undoi">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -805,7 +725,7 @@
<property name="can_focus">False</property>
<property name="spacing">3</property>
<child>
- <object class="GtkButton" id="paragraphstyleb:stylemenu">
+ <object class="svtlo-ManagedMenuButton" id="paragraphstyleb:stylemenu">
<property name="label" translatable="yes">Style</property>
<property name="width_request">70</property>
<property name="visible">True</property>
@@ -1406,14 +1326,13 @@
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
- <object class="GtkButton" id="tablerowsb:trowmenu">
- <property name="label" translatable="yes">Row</property>
+ <object class="svtlo-ManagedMenuButton" id="tablerowsb">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="valign">center</property>
<property name="vexpand">True</property>
- <property name="image">tablerowsi</property>
+ <property name="action_name">.uno:RowOperations</property>
<property name="relief">none</property>
<property name="xalign">0</property>
</object>
@@ -1424,14 +1343,13 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="tablecolumnsb:tcolumnmenu">
- <property name="label" translatable="yes">Column</property>
+ <object class="svtlo-ManagedMenuButton" id="tablecolumnsb">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="valign">center</property>
<property name="vexpand">True</property>
- <property name="image">tablecolumnsi</property>
+ <property name="action_name">.uno:ColumnOperations</property>
<property name="relief">none</property>
<property name="xalign">0</property>
</object>
@@ -1535,7 +1453,7 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="conditionalb">
+ <object class="svtlo-ManagedMenuButton" id="conditionalb">
<property name="label" translatable="yes">Conditional</property>
<property name="height_request">24</property>
<property name="visible">True</property>
diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk
index f778453846ee..2f3ca6a97a3a 100644
--- a/svtools/Library_svt.mk
+++ b/svtools/Library_svt.mk
@@ -122,6 +122,7 @@ $(eval $(call gb_Library_add_exception_objects,svt,\
svtools/source/control/hyperlabel \
svtools/source/control/indexentryres \
svtools/source/control/inettbc \
+ svtools/source/control/managedmenubutton \
svtools/source/control/roadmap \
svtools/source/control/ruler \
svtools/source/control/scriptedtext \
diff --git a/svtools/source/control/managedmenubutton.cxx b/svtools/source/control/managedmenubutton.cxx
new file mode 100644
index 000000000000..45e9d98ca1a8
--- /dev/null
+++ b/svtools/source/control/managedmenubutton.cxx
@@ -0,0 +1,122 @@
+/* -*- 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/.
+ */
+
+#include <comphelper/processfactory.hxx>
+#include <comphelper/propertyvalue.hxx>
+#include <toolkit/awt/vclxmenu.hxx>
+#include <vcl/builderfactory.hxx>
+#include <vcl/menu.hxx>
+#include <vcl/menubtn.hxx>
+
+#include <com/sun/star/frame/theDesktop.hpp>
+#include <com/sun/star/frame/ModuleManager.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:
+ rtl::Reference<VCLXPopupMenu> m_xPopupMenu;
+ css::uno::Reference<css::frame::XPopupMenuController> m_xPopupController;
+};
+
+ManagedMenuButton::ManagedMenuButton(vcl::Window* pParent, WinBits nStyle)
+ : MenuButton(pParent, nStyle)
+{
+ SetImageAlign(ImageAlign::Left);
+}
+
+ManagedMenuButton::~ManagedMenuButton()
+{
+ disposeOnce();
+}
+
+void ManagedMenuButton::dispose()
+{
+ css::uno::Reference<css::lang::XComponent> xComponent(m_xPopupController, css::uno::UNO_QUERY);
+ if (xComponent.is())
+ xComponent->dispose();
+
+ m_xPopupMenu.clear();
+ m_xPopupController.clear();
+ MenuButton::dispose();
+}
+
+void ManagedMenuButton::Activate()
+{
+ if (!GetPopupMenu())
+ SetPopupMenu(VclPtr<PopupMenu>::Create());
+
+ MenuButton::Activate();
+
+ if (m_xPopupController.is())
+ {
+ m_xPopupController->updatePopupMenu();
+ return;
+ }
+
+ if (!m_xPopupMenu.is())
+ m_xPopupMenu.set(new VCLXPopupMenu(GetPopupMenu()));
+
+ // FIXME: get the frame from the parent VclBuilder.
+ css::uno::Reference<css::uno::XComponentContext> xContext(comphelper::getProcessComponentContext());
+ css::uno::Reference<css::frame::XDesktop2> xDesktop(css::frame::theDesktop::get(xContext));
+ css::uno::Reference<css::frame::XFrame> xFrame(xDesktop->getActiveFrame());
+ if (!xFrame.is())
+ return;
+
+ OUString aModuleName;
+ try
+ {
+ css::uno::Reference<css::frame::XModuleManager> xModuleManager(css::frame::ModuleManager::create(xContext));
+ aModuleName = xModuleManager->identify(xFrame);
+ }
+ catch( const css::uno::Exception& )
+ {}
+
+ css::uno::Sequence<css::uno::Any> aArgs {
+ css::uno::makeAny(comphelper::makePropertyValue("ModuleIdentifier", aModuleName)),
+ css::uno::makeAny(comphelper::makePropertyValue("Frame", css::uno::makeAny(xFrame))),
+ css::uno::makeAny(comphelper::makePropertyValue("InToolbar", css::uno::makeAny(true)))
+ };
+
+ const OUString aCommand(GetCommand());
+ if (!aCommand.isEmpty() && GetPopupMenu()->GetItemCount() == 0)
+ {
+ css::uno::Reference<css::frame::XUIControllerFactory> xPopupMenuControllerFactory =
+ css::frame::thePopupMenuControllerFactory::get(xContext);
+
+ if (xPopupMenuControllerFactory->hasController(aCommand, aModuleName))
+ m_xPopupController.set(xPopupMenuControllerFactory->createInstanceWithArgumentsAndContext(
+ aCommand, aArgs, xContext), css::uno::UNO_QUERY);
+ }
+
+ // No registered controller found, use one the can handle arbitrary menus (e.g. defined in .ui file).
+ if (!m_xPopupController.is())
+ m_xPopupController.set(xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
+ "com.sun.star.comp.framework.ResourceMenuController", aArgs, xContext), css::uno::UNO_QUERY);
+
+ if (m_xPopupController.is())
+ m_xPopupController->setPopupMenu(m_xPopupMenu.get());
+}
+
+}
+
+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/toolkit/source/awt/vclxmenu.cxx b/toolkit/source/awt/vclxmenu.cxx
index bcf081c89ee1..2650fa802cbd 100644
--- a/toolkit/source/awt/vclxmenu.cxx
+++ b/toolkit/source/awt/vclxmenu.cxx
@@ -79,6 +79,12 @@ void VCLXMenu::ImplCreateMenu( bool bPopup )
mpMenu->AddEventListener( LINK( this, VCLXMenu, MenuEventListener ) );
}
+void VCLXMenu::ImplAddListener()
+{
+ assert(mpMenu);
+ mpMenu->AddEventListener( LINK( this, VCLXMenu, MenuEventListener ) );
+}
+
IMPL_LINK( VCLXMenu, MenuEventListener, VclMenuEvent&, rMenuEvent, void )
{
DBG_ASSERT( rMenuEvent.GetMenu() && mpMenu, "Menu???" );
@@ -858,6 +864,7 @@ VCLXPopupMenu::VCLXPopupMenu()
VCLXPopupMenu::VCLXPopupMenu( PopupMenu* pPopMenu ) : VCLXMenu( static_cast<Menu *>(pPopMenu) )
{
+ ImplAddListener();
}
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index d6225023c4fc..c627cf1a9726 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -1790,6 +1790,13 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
pFunction(xWindow, xParent, rMap);
if (xWindow->GetType() == WINDOW_PUSHBUTTON)
setupFromActionName(static_cast<Button*>(xWindow.get()), rMap, m_xFrame);
+ else if (xWindow->GetType() == WINDOW_MENUBUTTON)
+ {
+ OString sMenu = extractCustomProperty(rMap);
+ if (!sMenu.isEmpty())
+ m_pParserState->m_aButtonMenuMaps.push_back(ButtonMenuMap(id, sMenu));
+ setupFromActionName(static_cast<Button*>(xWindow.get()), rMap, m_xFrame);
+ }
}
}
}
@@ -2721,17 +2728,23 @@ void VclBuilder::insertMenuObject(PopupMenu *pParent, const OString &rClass, con
if (rClass == "GtkMenuItem")
{
OUString sLabel(OStringToOUString(convertMnemonicMarkup(extractLabel(rProps)), RTL_TEXTENCODING_UTF8));
+ OUString aCommand(OStringToOUString(extractActionName(rProps), RTL_TEXTENCODING_UTF8));
pParent->InsertItem(nNewId, sLabel, MenuItemBits::TEXT, rID);
+ pParent->SetItemCommand(nNewId, aCommand);
}
else if (rClass == "GtkCheckMenuItem")
{
OUString sLabel(OStringToOUString(convertMnemonicMarkup(extractLabel(rProps)), RTL_TEXTENCODING_UTF8));
+ OUString aCommand(OStringToOUString(extractActionName(rProps), RTL_TEXTENCODING_UTF8));
pParent->InsertItem(nNewId, sLabel, MenuItemBits::CHECKABLE, rID);
+ pParent->SetItemCommand(nNewId, aCommand);
}
else if (rClass == "GtkRadioMenuItem")
{
OUString sLabel(OStringToOUString(convertMnemonicMarkup(extractLabel(rProps)), RTL_TEXTENCODING_UTF8));
+ OUString aCommand(OStringToOUString(extractActionName(rProps), RTL_TEXTENCODING_UTF8));
pParent->InsertItem(nNewId, sLabel, MenuItemBits::CHECKABLE | MenuItemBits::RADIOCHECK, rID);
+ pParent->SetItemCommand(nNewId, aCommand);
}
else if (rClass == "GtkSeparatorMenuItem")