summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-07-19 16:07:46 +0100
committerCaolán McNamara <caolanm@redhat.com>2013-07-19 16:11:20 +0100
commitb163772e77e64261b62a9e8196799a499e4ef77d (patch)
tree7818b1264adb4aec093dd034fa830460c2a02060 /vcl
parent1bf191e88ead2a0e998045eae10326dd9cb0f9ef (diff)
Resolves: fdo#48835 complete application menu
a) reorder entries to the original design idea and add missing New b) forget about stripping the appmenu entries from the normal menus Change-Id: I70ae9d377e4ea9285940eaef5c687fb1ab50193d
Diffstat (limited to 'vcl')
-rw-r--r--vcl/unx/gtk/window/gtksalframe.cxx44
1 files changed, 36 insertions, 8 deletions
diff --git a/vcl/unx/gtk/window/gtksalframe.cxx b/vcl/unx/gtk/window/gtksalframe.cxx
index 3bedd85bdfe8..ea1ad0cfc14a 100644
--- a/vcl/unx/gtk/window/gtksalframe.cxx
+++ b/vcl/unx/gtk/window/gtksalframe.cxx
@@ -67,12 +67,14 @@
#endif
#include <comphelper/processfactory.hxx>
+#include <comphelper/sequenceashashmap.hxx>
#include <com/sun/star/accessibility/XAccessibleContext.hpp>
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/XAccessibleStateSet.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/accessibility/XAccessibleEditableText.hpp>
#include <com/sun/star/frame/Desktop.hpp>
+#include <com/sun/star/frame/ModuleManager.hpp>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/util/URLTransformer.hpp>
@@ -561,6 +563,24 @@ static void activate_uno(GSimpleAction *action, GVariant*, gpointer)
if (!strval)
return;
+ if (strcmp(strval, "New") == 0)
+ {
+ uno::Reference<frame::XModuleManager2> xModuleManager(frame::ModuleManager::create(xContext));
+ OUString aModuleId(xModuleManager->identify(xFrame));
+ if (aModuleId.isEmpty())
+ return;
+
+ comphelper::SequenceAsHashMap lModuleDescription(xModuleManager->getByName(aModuleId));
+ OUString sFactoryService;
+ lModuleDescription[OUString("ooSetupFactoryEmptyDocumentURL")] >>= sFactoryService;
+ if (sFactoryService.isEmpty())
+ return;
+
+ uno::Sequence < css::beans::PropertyValue > args(0);
+ xDesktop->loadComponentFromURL(sFactoryService, OUString("_blank"), 0, args);
+ return;
+ }
+
OUString sCommand(".uno:");
sCommand += OUString(strval, strlen(strval), RTL_TEXTENCODING_UTF8);
g_free(strval);
@@ -582,7 +602,8 @@ static GActionEntry app_entries[] = {
{ "OptionsTreeDialog", activate_uno, NULL, NULL, NULL, {0} },
{ "About", activate_uno, NULL, NULL, NULL, {0} },
{ "HelpIndex", activate_uno, NULL, NULL, NULL, {0} },
- { "Quit", activate_uno, NULL, NULL, NULL, {0} }
+ { "Quit", activate_uno, NULL, NULL, NULL, {0} },
+ { "New", activate_uno, NULL, NULL, NULL, {0} }
};
gboolean ensure_dbus_setup( gpointer data )
@@ -634,29 +655,36 @@ gboolean ensure_dbus_setup( gpointer data )
GMenu *firstsubmenu = g_menu_new ();
- OString sPreferences(OUStringToOString(ResId(SV_STDTEXT_PREFERENCES, *pMgr).toString(),
+ OString sNew(OUStringToOString(ResId(SV_BUTTONTEXT_NEW, *pMgr).toString(),
RTL_TEXTENCODING_UTF8).replaceFirst("~", "_"));
- item = g_menu_item_new(sPreferences.getStr(), "app.OptionsTreeDialog");
+ item = g_menu_item_new(sNew.getStr(), "app.New");
g_menu_append_item( firstsubmenu, item );
+
g_menu_append_section( menu, NULL, G_MENU_MODEL(firstsubmenu));
GMenu *secondsubmenu = g_menu_new ();
- OString sAbout(OUStringToOString(ResId(SV_STDTEXT_ABOUT, *pMgr).toString(),
+ OString sPreferences(OUStringToOString(ResId(SV_STDTEXT_PREFERENCES, *pMgr).toString(),
RTL_TEXTENCODING_UTF8).replaceFirst("~", "_"));
- item = g_menu_item_new(sAbout.getStr(), "app.About");
+ item = g_menu_item_new(sPreferences.getStr(), "app.OptionsTreeDialog");
g_menu_append_item( secondsubmenu, item );
+ g_menu_append_section( menu, NULL, G_MENU_MODEL(secondsubmenu));
+ GMenu *thirdsubmenu = g_menu_new ();
+
OString sHelp(OUStringToOString(ResId(SV_BUTTONTEXT_HELP, *pMgr).toString(),
RTL_TEXTENCODING_UTF8).replaceFirst("~", "_"));
item = g_menu_item_new(sHelp.getStr(), "app.HelpIndex");
- g_menu_append_item( secondsubmenu, item );
- g_menu_append_section( menu, NULL, G_MENU_MODEL(secondsubmenu));
+ g_menu_append_item( thirdsubmenu, item );
- GMenu *thirdsubmenu = g_menu_new ();
+ OString sAbout(OUStringToOString(ResId(SV_STDTEXT_ABOUT, *pMgr).toString(),
+ RTL_TEXTENCODING_UTF8).replaceFirst("~", "_"));
+
+ item = g_menu_item_new(sAbout.getStr(), "app.About");
+ g_menu_append_item( thirdsubmenu, item );
OString sQuit(OUStringToOString(ResId(SV_MENU_MAC_QUITAPP, *pMgr).toString(),
RTL_TEXTENCODING_UTF8).replaceFirst("~", "_"));