[Libreoffice-commits] .: 4 commits - framework/Library_lomenubar.mk framework/Module_framework.mk framework/source
Bjoern Michaelsen
bmichaelsen at kemper.freedesktop.org
Thu Mar 31 12:06:41 PDT 2011
framework/Library_lomenubar.mk | 63 +
framework/Module_framework.mk | 6
framework/source/lomenubar/AwtKeyToDbusmenuString.cxx | 145 +++
framework/source/lomenubar/AwtKeyToDbusmenuString.hxx | 33
framework/source/lomenubar/DesktopJob.cxx | 157 +++
framework/source/lomenubar/DesktopJob.hxx | 90 +
framework/source/lomenubar/FrameHelper.cxx | 829 ++++++++++++++++++
framework/source/lomenubar/FrameHelper.hxx | 142 +++
framework/source/lomenubar/FrameJob.cxx | 393 ++++++++
framework/source/lomenubar/FrameJob.hxx | 101 ++
framework/source/lomenubar/MenuItemInfo.cxx | 103 ++
framework/source/lomenubar/MenuItemInfo.hxx | 54 +
framework/source/lomenubar/MenuItemStatusListener.cxx | 82 +
framework/source/lomenubar/MenuItemStatusListener.hxx | 35
framework/source/lomenubar/exports.cxx | 119 ++
15 files changed, 2352 insertions(+)
New commits:
commit cfdb06ed920fbc4435131a62395a5b404e614def
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Thu Mar 31 20:49:27 2011 +0200
getting rid of warnings as far as possible
diff --git a/framework/source/lomenubar/DesktopJob.cxx b/framework/source/lomenubar/DesktopJob.cxx
index 425deb5..2913215 100644
--- a/framework/source/lomenubar/DesktopJob.cxx
+++ b/framework/source/lomenubar/DesktopJob.cxx
@@ -70,23 +70,23 @@ using com::sun::star::uno::XInterface;
//-------------------------- D-Bus Callbacks ----------------------------------
static void
-on_bus (GDBusConnection * connection,
- const gchar * name,
- gpointer user_data)
+on_bus (GDBusConnection * /*connection*/,
+ const gchar * /*name*/,
+ gpointer /*user_data*/)
{
//TODO: Should we actually do something here?
return;
}
static void
-name_lost (GDBusConnection * connection, const gchar * name, gpointer user_data)
+name_lost (GDBusConnection * /*connection*/, const gchar * name, gpointer /*user_data*/)
{
g_error ("Unable to get name '%s' on DBus", name);
return;
}
// --------------------------- DesktopJob ----------------------------------
-Any SAL_CALL DesktopJob::execute( const Sequence< NamedValue >& aArguments )
+Any SAL_CALL DesktopJob::execute( const Sequence< NamedValue >& /*aArguments*/ )
throw ( IllegalArgumentException, Exception, RuntimeException )
{
g_type_init ();
diff --git a/framework/source/lomenubar/FrameHelper.cxx b/framework/source/lomenubar/FrameHelper.cxx
index b45cf0f..f9998de 100644
--- a/framework/source/lomenubar/FrameHelper.cxx
+++ b/framework/source/lomenubar/FrameHelper.cxx
@@ -62,7 +62,10 @@
#include <rtl/process.h>
#include <gio/gio.h>
+//#pragma GCC diagnostic push
+//#pragma GCC diagnostic ignored "-Wignored-qualifiers"
#include <libdbusmenu-glib/client.h>
+//#pragma GCC diagnostic pop
#include <libdbusmenu-gtk/menuitem.h>
using rtl::OUString;
@@ -112,7 +115,7 @@ using com::sun::star::util::XURLTransformer;
// ------------------------ Item callbacks ---------------------------
// Item activated. It distpatches the command associated to a given menu item.
void
-item_activated (DbusmenuMenuitem *item, guint timestamp, gpointer user_data)
+item_activated (DbusmenuMenuitem *item, guint /*timestamp*/, gpointer user_data)
{
FrameHelper *helper = (FrameHelper*)user_data;
OUString command = OUString::createFromAscii(dbusmenu_menuitem_property_get (item, "CommandURL"));
@@ -195,114 +198,114 @@ FrameHelper::FrameHelper(const Reference< XMultiServiceFactory >& rServiceManag
const Reference< XFrame >& xFrame,
DbusmenuServer* server)
{
- xMSF = rServiceManager;
- this->xFrame = xFrame;
- this->server = server;
+ m_xMSF = rServiceManager;
+ this->m_xFrame = xFrame;
+ this->m_server = server;
//Get xUICommands database (to retrieve labels, see FrameJob::getLabelFromCommandURL ())
- Reference < XNameAccess > xNameAccess (xMSF->createInstance(OUString::createFromAscii("com.sun.star.frame.UICommandDescription")),
+ Reference < XNameAccess > xNameAccess (m_xMSF->createInstance(OUString::createFromAscii("com.sun.star.frame.UICommandDescription")),
UNO_QUERY);
- xMM = Reference < XModuleManager> (xMSF->createInstance(OUString::createFromAscii("com.sun.star.frame.ModuleManager")),
+ m_xMM = Reference < XModuleManager> (m_xMSF->createInstance(OUString::createFromAscii("com.sun.star.frame.ModuleManager")),
UNO_QUERY);
- xNameAccess->getByName(xMM->identify(xFrame)) >>= xUICommands;
+ xNameAccess->getByName(m_xMM->identify(xFrame)) >>= m_xUICommands;
- xdp = Reference < XDispatchProvider > (xFrame, UNO_QUERY);
- xTrans = Reference < XURLTransformer > (xMSF->createInstance( rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )), UNO_QUERY);
+ m_xdp = Reference < XDispatchProvider > (xFrame, UNO_QUERY);
+ m_xTrans = Reference < XURLTransformer > (m_xMSF->createInstance( rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )), UNO_QUERY);
- xSL = (XStatusListener*)new MenuItemStatusListener (this);
+ m_xSL = (XStatusListener*)new MenuItemStatusListener (this);
// This initializes the shortcut database
- getAcceleratorConfigurations (xFrame->getController()->getModel (), xMM);
+ getAcceleratorConfigurations (xFrame->getController()->getModel (), m_xMM);
// This information is needed for the dynamic submenus
- xPCF = Reference < XMultiComponentFactory > (xMSF->createInstance(OUString::createFromAscii("com.sun.star.frame.PopupMenuControllerFactory")),
+ m_xPCF = Reference < XMultiComponentFactory > (m_xMSF->createInstance(OUString::createFromAscii("com.sun.star.frame.PopupMenuControllerFactory")),
UNO_QUERY);
// This is a hash table that maps Command URLs to MenuItemInfo classes
// to cache command information
- commandsInfo = g_hash_table_new_full (g_str_hash,
+ m_commandsInfo = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
destroy_menu_item_info);
// These are the arguments needed for the XPopupMenuController
- args = Sequence < Any > (2);
+ m_args = Sequence < Any > (2);
PropertyValue item;
item.Name = OUString::createFromAscii("ModuleName");
- item.Value <<= xMM->identify (xFrame);
- args[0] <<= item;
+ item.Value <<= m_xMM->identify (xFrame);
+ m_args[0] <<= item;
item.Name = OUString::createFromAscii("Frame");
item.Value <<= xFrame;
- args[1] <<= item;
+ m_args[1] <<= item;
- root = NULL;
- watcher_set = FALSE;
+ m_root = NULL;
+ m_watcher_set = FALSE;
//This variable prevents the helper from being disconnected from the frame
//for special cases of component dettaching like print preview
- blockDetach = FALSE;
+ m_blockDetach = FALSE;
}
void SAL_CALL
-FrameHelper::disposing (const EventObject& aEvent) throw (RuntimeException)
+FrameHelper::disposing (const EventObject& /*aEvent*/ ) throw (RuntimeException)
{}
FrameHelper::~FrameHelper()
{
- if (server)
- g_object_unref (server);
+ if (m_server)
+ g_object_unref (m_server);
- if (watcher_set)
- g_bus_unwatch_name (watcher);
+ if (m_watcher_set)
+ g_bus_unwatch_name (m_watcher);
- g_hash_table_destroy (commandsInfo);
+ g_hash_table_destroy (m_commandsInfo);
}
void
FrameHelper::setRootItem (DbusmenuMenuitem *root)
{
- this->root = root;
+ this->m_root = root;
}
void
FrameHelper::setRegistrarWatcher (guint watcher)
{
- watcher_set = TRUE;
- this->watcher = watcher;
+ m_watcher_set = TRUE;
+ this->m_watcher = watcher;
}
void
FrameHelper::setServer (DbusmenuServer *server)
{
- this->server = server;
+ this->m_server = server;
}
//Getters
Reference < XFrame >
FrameHelper::getFrame ()
{
- return xFrame;
+ return m_xFrame;
}
XStatusListener*
FrameHelper::getStatusListener ()
{
- return xSL;
+ return m_xSL;
}
GHashTable*
FrameHelper::getCommandsInfo ()
{
- return commandsInfo;
+ return m_commandsInfo;
}
unsigned long
FrameHelper::getXID ()
{
- Reference< XSystemDependentWindowPeer > xWin( xFrame->getContainerWindow(), UNO_QUERY );
+ Reference< XSystemDependentWindowPeer > xWin( m_xFrame->getContainerWindow(), UNO_QUERY );
if (!xWin.is())
return 0;
@@ -326,9 +329,9 @@ FrameHelper::frameAction(const FrameActionEvent& action) throw (RuntimeException
//This is a special case, .uno:printPreview detaches the component but we are
//not actually switching to another document.
- if (blockDetach)
+ if (m_blockDetach)
{
- blockDetach = TRUE;
+ m_blockDetach = TRUE;
return;
}
@@ -337,8 +340,8 @@ FrameHelper::frameAction(const FrameActionEvent& action) throw (RuntimeException
GError *error = NULL;
- xFrame->removeFrameActionListener (this);
- Reference< XPropertySet > frameProps (xFrame, UNO_QUERY);
+ m_xFrame->removeFrameActionListener (this);
+ Reference< XPropertySet > frameProps (m_xFrame, UNO_QUERY);
Reference < XLayoutManager > xLayoutManager(frameProps->getPropertyValue(OUString::createFromAscii("LayoutManager")),
UNO_QUERY);
xLayoutManager->showElement (OUString::createFromAscii("private:resource/menubar/menubar"));
@@ -375,17 +378,17 @@ FrameHelper::frameAction(const FrameActionEvent& action) throw (RuntimeException
g_error_free (error);
}
- if (server)
+ if (m_server)
{
- g_object_unref (server);
- server = NULL;
- root = NULL;
+ g_object_unref (m_server);
+ m_server = NULL;
+ m_root = NULL;
}
- if (watcher_set)
+ if (m_watcher_set)
{
- g_bus_unwatch_name (watcher);
- watcher_set = FALSE;
+ g_bus_unwatch_name (m_watcher);
+ m_watcher_set = FALSE;
}
return;
@@ -492,11 +495,11 @@ FrameHelper::rebuildMenu (Reference < XMenu > xMenu,
// Lookup for a MenuItemInfo object for this menuitem, create one if it doesn't exist
// this object caches the values that change on status updates.
- MenuItemInfo* commInfo = (MenuItemInfo*)g_hash_table_lookup (commandsInfo, (gconstpointer)command.getStr());
+ MenuItemInfo* commInfo = (MenuItemInfo*)g_hash_table_lookup (m_commandsInfo, (gconstpointer)command.getStr());
if (!commInfo)
{
commInfo = new MenuItemInfo ();
- g_hash_table_insert (commandsInfo, g_strdup (command.getStr()), commInfo);
+ g_hash_table_insert (m_commandsInfo, g_strdup (command.getStr()), commInfo);
OUString oULabel = getLabelFromCommandURL(oUCommand);
if (oULabel.getLength() == 0)
@@ -534,11 +537,11 @@ FrameHelper::rebuildMenu (Reference < XMenu > xMenu,
// Adding status listener
URL commandURL;
commandURL.Complete = oUCommand;
- xTrans->parseStrict (commandURL);
+ m_xTrans->parseStrict (commandURL);
- Reference < XDispatch > xDispatch = xdp->queryDispatch (commandURL, OUString(), 0);
+ Reference < XDispatch > xDispatch = m_xdp->queryDispatch (commandURL, OUString(), 0);
if (xDispatch.is())
- xDispatch->addStatusListener (xSL, commandURL);
+ xDispatch->addStatusListener (m_xSL, commandURL);
Reference < XPopupMenu > subPopMenu (xMenu->getPopupMenu (id), UNO_QUERY);
@@ -546,16 +549,16 @@ FrameHelper::rebuildMenu (Reference < XMenu > xMenu,
//we need to access that info through a special XPopupMenuController
if (isSpecialSubmenu (oUCommand))
{
- Reference < XPropertySet > xMSFProps (xMSF, UNO_QUERY);
+ Reference < XPropertySet > xMSFProps (m_xMSF, UNO_QUERY);
Reference <XComponentContext> xContext (xMSFProps->getPropertyValue (OUString::createFromAscii ("DefaultContext")),
UNO_QUERY);
- Reference < XPopupMenuController > xRFC (xPCF->createInstanceWithArgumentsAndContext(oUCommand,
- args,
+ Reference < XPopupMenuController > xRFC (m_xPCF->createInstanceWithArgumentsAndContext(oUCommand,
+ m_args,
xContext),
UNO_QUERY);
- Reference < XPopupMenu > xPO (xMSF->createInstance(OUString::createFromAscii ("stardiv.Toolkit.VCLXPopupMenu")),
+ Reference < XPopupMenu > xPO (m_xMSF->createInstance(OUString::createFromAscii ("stardiv.Toolkit.VCLXPopupMenu")),
UNO_QUERY);
if (xRFC.is () && xPO.is ())
@@ -601,12 +604,12 @@ FrameHelper::getLabelFromCommandURL (OUString commandURL)
if (commandURL.getLength () < 1)
return label;
- if (!xUICommands.is())
+ if (!m_xUICommands.is())
return label;
try
{
- xUICommands->getByName (commandURL) >>= commandProps;
+ m_xUICommands->getByName (commandURL) >>= commandProps;
}
catch (com::sun::star::container::NoSuchElementException e)
{
@@ -646,7 +649,7 @@ FrameHelper::rebuildMenuFromRoot ()
if (!xMenu.is ())
return;
- rebuildMenu (xMenu, root);
+ rebuildMenu (xMenu, m_root);
}
//Some menus are special, this is the list of them
@@ -677,7 +680,7 @@ void
FrameHelper::dispatchCommand (OUString command)
{
OUString target = OUString::createFromAscii ("");
- Reference < XDispatchHelper > xdh (xMSF->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.DispatchHelper"))),
+ Reference < XDispatchHelper > xdh (m_xMSF->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.DispatchHelper"))),
UNO_QUERY);
//g_debug ("%s", OUStringToOString (command, RTL_TEXTENCODING_ASCII_US).getStr());
@@ -686,24 +689,24 @@ FrameHelper::dispatchCommand (OUString command)
// when PrintPreview dettaches. See the frameAction method.
if (command.equals (OUString::createFromAscii (".uno:PrintPreview")))
{
- blockDetach = TRUE;
+ m_blockDetach = TRUE;
}
- // This is a special case for the recentfilelist
+ // This is a special case for the recentfilelist
if (command.matchAsciiL ("vnd.sun.star.popup:RecentFileList", 33, 0))
{
target = OUString::createFromAscii ("_default");
- Reference < XPropertySet > xMSFProps (xMSF, UNO_QUERY);
+ Reference < XPropertySet > xMSFProps (m_xMSF, UNO_QUERY);
Reference <XComponentContext> xContext (xMSFProps->getPropertyValue (OUString::createFromAscii ("DefaultContext")),
UNO_QUERY);
- Reference < XPopupMenuController > xRFC (xPCF->createInstanceWithArgumentsAndContext(OUString::createFromAscii (".uno:RecentFileList"),
- args,
+ Reference < XPopupMenuController > xRFC (m_xPCF->createInstanceWithArgumentsAndContext(OUString::createFromAscii (".uno:RecentFileList"),
+ m_args,
xContext),
UNO_QUERY);
Reference < XMenuListener > xML (xRFC, UNO_QUERY);
- Reference < XPopupMenu > xPO (xMSF->createInstance(OUString::createFromAscii ("stardiv.Toolkit.VCLXPopupMenu")),
+ Reference < XPopupMenu > xPO (m_xMSF->createInstance(OUString::createFromAscii ("stardiv.Toolkit.VCLXPopupMenu")),
UNO_QUERY);
if (xRFC.is () && xPO.is ())
@@ -734,7 +737,7 @@ FrameHelper::dispatchCommand (OUString command)
if (command.matchAsciiL ("private:factory/", 16, 0))
target = OUString::createFromAscii ("_blank");
- xdh->executeDispatch (Reference < XDispatchProvider > (xFrame, UNO_QUERY),
+ xdh->executeDispatch (Reference < XDispatchProvider > (m_xFrame, UNO_QUERY),
command,
target,
0,
@@ -750,19 +753,19 @@ FrameHelper::getAcceleratorConfigurations (Reference < XModel > xModel,
Reference< XUIConfigurationManagerSupplier > docUISupplier(xModel, UNO_QUERY);
Reference< XUIConfigurationManager > docUIManager = docUISupplier->getUIConfigurationManager();
Reference< XAcceleratorConfiguration > docAccelConf(docUIManager->getShortCutManager(), UNO_QUERY);
- this->docAccelConf = docAccelConf;
+ this->m_docAccelConf = docAccelConf;
//Get module shurtcut database
- Reference< XModuleUIConfigurationManagerSupplier > modUISupplier(xMSF->createInstance(OUString::createFromAscii("com.sun.star.ui.ModuleUIConfigurationManagerSupplier")),
+ Reference< XModuleUIConfigurationManagerSupplier > modUISupplier(m_xMSF->createInstance(OUString::createFromAscii("com.sun.star.ui.ModuleUIConfigurationManagerSupplier")),
UNO_QUERY);
- Reference< XUIConfigurationManager > modUIManager = modUISupplier->getUIConfigurationManager(xModuleManager->identify(xFrame));
+ Reference< XUIConfigurationManager > modUIManager = modUISupplier->getUIConfigurationManager(xModuleManager->identify(m_xFrame));
Reference< XAcceleratorConfiguration > modAccelConf(modUIManager->getShortCutManager(), UNO_QUERY);
- this->modAccelConf = modAccelConf;
+ this->m_modAccelConf = modAccelConf;
//Get global shortcut database
- Reference< XAcceleratorConfiguration > globAccelConf(xMSF->createInstance(OUString::createFromAscii("com.sun.star.ui.GlobalAcceleratorConfiguration")),
+ Reference< XAcceleratorConfiguration > globAccelConf(m_xMSF->createInstance(OUString::createFromAscii("com.sun.star.ui.GlobalAcceleratorConfiguration")),
UNO_QUERY);
- this->globAccelConf = globAccelConf;
+ this->m_globAccelConf = globAccelConf;
}
@@ -778,7 +781,7 @@ FrameHelper::findShortcutForCommand (OUString command)
try
{
- Sequence < Any > evs = docAccelConf->getPreferredKeyEventsForCommandList (commands);
+ Sequence < Any > evs = m_docAccelConf->getPreferredKeyEventsForCommandList (commands);
for (int j = 0; j < evs.getLength (); j++)
{
@@ -791,7 +794,7 @@ FrameHelper::findShortcutForCommand (OUString command)
{}
try
{
- Sequence < Any > evs = modAccelConf->getPreferredKeyEventsForCommandList (commands);
+ Sequence < Any > evs = m_modAccelConf->getPreferredKeyEventsForCommandList (commands);
for (int j = 0; j < evs.getLength (); j++)
{
@@ -804,7 +807,7 @@ FrameHelper::findShortcutForCommand (OUString command)
{}
try
{
- Sequence < Any > evs = globAccelConf->getPreferredKeyEventsForCommandList (commands);
+ Sequence < Any > evs = m_globAccelConf->getPreferredKeyEventsForCommandList (commands);
for (int j = 0; j < evs.getLength (); j++)
{
diff --git a/framework/source/lomenubar/FrameHelper.hxx b/framework/source/lomenubar/FrameHelper.hxx
index a36a7de..d34220f 100644
--- a/framework/source/lomenubar/FrameHelper.hxx
+++ b/framework/source/lomenubar/FrameHelper.hxx
@@ -43,7 +43,10 @@
#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/ui/XAcceleratorConfiguration.hpp>
+//#pragma GCC diagnostic push
+//#pragma GCC diagnostic ignored "-Wignored-qualifiers"
#include <libdbusmenu-glib/server.h>
+//#pragma GCC diagnostic pop
#include <libdbusmenu-glib/menuitem.h>
using com::sun::star::awt::KeyEvent;
@@ -76,30 +79,30 @@ using rtl::OUString;
class FrameHelper : public cppu::WeakImplHelper1 < XFrameActionListener >
{
private:
- Reference < XFrame > xFrame;
- Reference < XMultiServiceFactory > xMSF;
- Reference < XNameAccess > xUICommands;
- DbusmenuServer *server;
- DbusmenuMenuitem *root;
- gboolean watcher_set;
- guint watcher;
- XStatusListener *xSL;
- Reference < XURLTransformer > xTrans;
- Reference < XDispatchProvider > xdp;
- GHashTable *commandsInfo;
- gboolean blockDetach;
+ Reference < XFrame > m_xFrame;
+ Reference < XMultiServiceFactory > m_xMSF;
+ Reference < XNameAccess > m_xUICommands;
+ DbusmenuServer *m_server;
+ DbusmenuMenuitem *m_root;
+ gboolean m_watcher_set;
+ guint m_watcher;
+ XStatusListener *m_xSL;
+ Reference < XURLTransformer > m_xTrans;
+ Reference < XDispatchProvider > m_xdp;
+ GHashTable *m_commandsInfo;
+ gboolean m_blockDetach;
//These object/methods are used to recreate dynamic popupmenus
- Reference < XMultiComponentFactory > xPCF;
- Reference < XModuleManager> xMM;
- Sequence < Any > args;
+ Reference < XMultiComponentFactory > m_xPCF;
+ Reference < XModuleManager> m_xMM;
+ Sequence < Any > m_args;
gboolean isSpecialSubmenu (OUString command);
//This is to build the shortcut database
- Reference< XAcceleratorConfiguration > docAccelConf;
- Reference< XAcceleratorConfiguration > modAccelConf;
- Reference< XAcceleratorConfiguration > globAccelConf;
+ Reference< XAcceleratorConfiguration > m_docAccelConf;
+ Reference< XAcceleratorConfiguration > m_modAccelConf;
+ Reference< XAcceleratorConfiguration > m_globAccelConf;
void getAcceleratorConfigurations (Reference < XModel >,
Reference < XModuleManager>);
diff --git a/framework/source/lomenubar/FrameJob.cxx b/framework/source/lomenubar/FrameJob.cxx
index f5de3cd..bbf53ce 100644
--- a/framework/source/lomenubar/FrameJob.cxx
+++ b/framework/source/lomenubar/FrameJob.cxx
@@ -140,9 +140,9 @@ xid_to_object_path (unsigned long xid)
//-------------------------- GObject callbacks -------------------------------//
//This is called when a registrar becomes available. It registers the hides the menubar.
static void
-on_registrar_available (GDBusConnection *connection,
- const gchar *name,
- const gchar *name_owner,
+on_registrar_available (GDBusConnection * /*connection*/,
+ const gchar * /*name*/,
+ const gchar * /*name_owner*/,
gpointer user_data)
{
GError *error = NULL;
@@ -195,8 +195,8 @@ on_registrar_available (GDBusConnection *connection,
//This is called when the registrar becomes unavailable. It shows the menubar.
static void
-on_registrar_unavailable (GDBusConnection *connection,
- const gchar *name,
+on_registrar_unavailable (GDBusConnection * /*connection*/,
+ const gchar * /*name*/,
gpointer user_data)
{
//TODO: Unregister window?
@@ -245,11 +245,11 @@ Any SAL_CALL FrameJob::execute( const Sequence< NamedValue >& aArguments )
if (!xController.is())
return Any();
- xFrame = Reference< XFrame > ( xController->getFrame(), UNO_QUERY);
- if (!xFrame.is ())
+ m_xFrame = Reference< XFrame > ( xController->getFrame(), UNO_QUERY);
+ if (!m_xFrame.is ())
return Any();
- exportMenus (xFrame);
+ exportMenus (m_xFrame);
return Any();
}
@@ -259,7 +259,7 @@ FrameJob::exportMenus (Reference < XFrame > xFrame)
{
//Set the xFrame for this object
- this->xFrame = xFrame;
+ this->m_xFrame = xFrame;
//Create dbusmenu server object path string
DbusmenuServer *server = dbusmenu_server_new (xid_to_object_path(getXID (xFrame)).getStr());
@@ -294,7 +294,7 @@ FrameJob::exportMenus (Reference < XFrame > xFrame)
}
//Create a new frame helper to close the server when needed
- FrameHelper *helper = new FrameHelper (mxMSF, xFrame, server);
+ FrameHelper *helper = new FrameHelper (m_xMSF, xFrame, server);
xFrame->addFrameActionListener (Reference < XFrameActionListener > (helper));
//Populate dbusmenu items and start the server
diff --git a/framework/source/lomenubar/FrameJob.hxx b/framework/source/lomenubar/FrameJob.hxx
index d209a09..ae5369f 100644
--- a/framework/source/lomenubar/FrameJob.hxx
+++ b/framework/source/lomenubar/FrameJob.hxx
@@ -49,9 +49,9 @@ using css::uno::Reference;
class FrameJob : public cppu::WeakImplHelper2 < css::task::XJob, css::lang::XServiceInfo >
{
private:
- Reference < css::lang::XMultiServiceFactory > mxMSF;
- Reference < css::container::XNameAccess > xUICommands;
- Reference < css::frame::XFrame > xFrame;
+ Reference < css::lang::XMultiServiceFactory > m_xMSF;
+ Reference < css::container::XNameAccess > m_xUICommands;
+ Reference < css::frame::XFrame > m_xFrame;
unsigned long xid;
@@ -62,7 +62,7 @@ class FrameJob : public cppu::WeakImplHelper2 < css::task::XJob, css::lang::XSer
public:
FrameJob( const css::uno::Reference< css::lang::XMultiServiceFactory > &rxMSF)
- : mxMSF( rxMSF ) {};
+ : m_xMSF( rxMSF ) {};
void exportMenus (Reference < css::frame::XFrame > xFrame);
diff --git a/framework/source/lomenubar/MenuItemInfo.cxx b/framework/source/lomenubar/MenuItemInfo.cxx
index 4fe6636..c5b22f6 100644
--- a/framework/source/lomenubar/MenuItemInfo.cxx
+++ b/framework/source/lomenubar/MenuItemInfo.cxx
@@ -26,78 +26,78 @@
MenuItemInfo::MenuItemInfo ()
{
- label = NULL;
- check_state = DBUSMENU_MENUITEM_TOGGLE_STATE_UNKNOWN;
- check_type = (gchar*)DBUSMENU_MENUITEM_TOGGLE_CHECK;
+ m_label = NULL;
+ m_check_state = DBUSMENU_MENUITEM_TOGGLE_STATE_UNKNOWN;
+ m_check_type = (gchar*)DBUSMENU_MENUITEM_TOGGLE_CHECK;
- is_visible = TRUE;
- is_enabled = TRUE;
+ m_is_visible = TRUE;
+ m_is_enabled = TRUE;
}
MenuItemInfo::~MenuItemInfo ()
{
- if (label)
- g_free(label);
+ if (m_label)
+ g_free(m_label);
}
//Setters
void
MenuItemInfo::setLabel (gchar* label)
{
- this->label = g_strdup (label);
+ this->m_label = g_strdup (label);
}
void
MenuItemInfo::setEnabled (gboolean is_enabled)
{
- this->is_enabled = is_enabled;
+ this->m_is_enabled = is_enabled;
}
void
MenuItemInfo::setCheckState (gint check_state)
{
- this->check_state = check_state;
+ this->m_check_state = check_state;
}
void
MenuItemInfo::setCheckType (const gchar* check_type)
{
- this->check_type = (gchar*)check_type;
+ this->m_check_type = (gchar*)check_type;
}
void
MenuItemInfo::setVisible (gboolean is_visible)
{
- this->is_visible = is_visible;
+ this->m_is_visible = is_visible;
}
//Getters
gchar*
MenuItemInfo::getLabel ()
{
- return label;
+ return m_label;
}
gboolean
MenuItemInfo::getEnabled ()
{
- return is_enabled;
+ return m_is_enabled;
}
gint
MenuItemInfo::getCheckState ()
{
- return check_state;
+ return m_check_state;
}
const gchar*
MenuItemInfo::getCheckType ()
{
- return check_type;
+ return m_check_type;
}
gboolean
MenuItemInfo::getVisible ()
{
- return is_visible;
+ return m_is_visible;
}
diff --git a/framework/source/lomenubar/MenuItemInfo.hxx b/framework/source/lomenubar/MenuItemInfo.hxx
index 1180688..b04b8fc 100644
--- a/framework/source/lomenubar/MenuItemInfo.hxx
+++ b/framework/source/lomenubar/MenuItemInfo.hxx
@@ -27,11 +27,11 @@
// This is used in a hash table with commandurls as keys
class MenuItemInfo {
- gchar* label; //Label text in UTF-8 with tildes subst by underscores
- gint check_state;
- gchar* check_type;
- gboolean is_enabled;
- gboolean is_visible;
+ gchar* m_label; //Label text in UTF-8 with tildes subst by underscores
+ gint m_check_state;
+ gchar* m_check_type;
+ gboolean m_is_enabled;
+ gboolean m_is_visible;
public:
MenuItemInfo ();
diff --git a/framework/source/lomenubar/MenuItemStatusListener.cxx b/framework/source/lomenubar/MenuItemStatusListener.cxx
index d51a7c5..7989c9b 100644
--- a/framework/source/lomenubar/MenuItemStatusListener.cxx
+++ b/framework/source/lomenubar/MenuItemStatusListener.cxx
@@ -8,7 +8,7 @@ using com::sun::star::frame::status::Visibility;
MenuItemStatusListener::MenuItemStatusListener (FrameHelper *helper)
{
if (!helper) throw ("FrameHelper cannot be NULL");
- this->helper = helper;
+ this->m_helper = helper;
}
void SAL_CALL
@@ -24,7 +24,7 @@ MenuItemStatusListener::statusChanged(const FeatureStateEvent& Event)
url.getLength(),
NULL, NULL, NULL);
- GHashTable *commandsInfo = helper->getCommandsInfo ();
+ GHashTable *commandsInfo = m_helper->getCommandsInfo ();
MenuItemInfo *info = (MenuItemInfo*)g_hash_table_lookup (commandsInfo, (gpointer)c_url);
if (!info)
{
@@ -32,7 +32,7 @@ MenuItemStatusListener::statusChanged(const FeatureStateEvent& Event)
g_hash_table_insert (commandsInfo, c_url, info);
//Set the default label
- oULabel = helper->getLabelFromCommandURL(url);
+ oULabel = m_helper->getLabelFromCommandURL(url);
// Replace tilde with underscore for Dbusmenu Alt accelerators
oULabel = oULabel.replace ((sal_Unicode)0x007e, (sal_Unicode)0x005f);
diff --git a/framework/source/lomenubar/MenuItemStatusListener.hxx b/framework/source/lomenubar/MenuItemStatusListener.hxx
index 33997e9..df03537 100644
--- a/framework/source/lomenubar/MenuItemStatusListener.hxx
+++ b/framework/source/lomenubar/MenuItemStatusListener.hxx
@@ -18,8 +18,8 @@ using com::sun::star::lang::EventObject;
class MenuItemStatusListener : public cppu::WeakImplHelper1 < XStatusListener >
{
private:
- guint16 id;
- FrameHelper *helper;
+ guint16 m_id;
+ FrameHelper *m_helper;
public:
MenuItemStatusListener (FrameHelper *helper);
@@ -29,7 +29,7 @@ class MenuItemStatusListener : public cppu::WeakImplHelper1 < XStatusListener >
statusChanged(const FeatureStateEvent& Event)
throw (RuntimeException);
- virtual void SAL_CALL disposing(const EventObject& aEvent)
+ virtual void SAL_CALL disposing(const EventObject& /*aEvent*/)
throw (RuntimeException) {}
};
#endif
diff --git a/framework/source/lomenubar/exports.cxx b/framework/source/lomenubar/exports.cxx
index f6f0892..6782167 100644
--- a/framework/source/lomenubar/exports.cxx
+++ b/framework/source/lomenubar/exports.cxx
@@ -55,14 +55,14 @@ extern "C"
{
//==================================================================================================
SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(const sal_Char** ppEnvTypeName,
- uno_Environment** ppEnv )
+ uno_Environment** /*ppEnv*/ )
{
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
//==================================================================================================
-SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo(void* pServiceManager,
+SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo(void* /*pServiceManager*/,
void* pRegistryKey )
{
if (!pRegistryKey)
@@ -86,7 +86,7 @@ SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo(void* pServiceManager
//==================================================================================================
SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(const sal_Char* pImplName ,
void* pServiceManager,
- void* pRegistryKey )
+ void* /*pRegistryKey*/ )
{
if ( !pServiceManager || !pImplName )
return 0;
commit 385746a99cc9ad861d38d2bd1d77cc050ca2e0ba
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Thu Mar 31 19:53:30 2011 +0200
add lomenubar to the build (disabled)
diff --git a/framework/Library_lomenubar.mk b/framework/Library_lomenubar.mk
new file mode 100755
index 0000000..f4d82e8
--- /dev/null
+++ b/framework/Library_lomenubar.mk
@@ -0,0 +1,63 @@
+# Version: MPL 1.1 / GPLv3+ / LGPLv3+
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License or as specified alternatively below. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Initial Developer of the Original Code is
+# Bjoern Michaelsen, Canonical Ltd. <bjoern.michaelsen at canonical.com>
+# Portions created by the Initial Developer are Copyright (C) 2010 the
+# Initial Developer. All Rights Reserved.
+#
+# Major Contributor(s):
+#
+# For minor contributions see the git repository.
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+# instead of those above.
+
+$(eval $(call gb_Library_Library,lomenubar))
+
+#$(eval $(call gb_Library_set_componentfile,lomenubar,MODULE/COMPONENT_FILE))
+
+# FIXME pkg-config call belong in ./configure obviously
+
+$(eval $(call gb_Library_set_include,lomenubar,\
+ $$(INCLUDE) \
+ -I$(OUTDIR)/inc/offuh \
+ $(shell pkg-config --cflags-only-I dbusmenu-gtk-0.4) \
+))
+
+$(eval $(call gb_Library_set_ldflags,lomenubar,\
+ $$(LDFLAGS) \
+ $(shell pkg-config --libs dbusmenu-gtk-0.4) \
+ $(GTK_LIBS) \
+))
+
+$(eval $(call gb_Library_add_linked_libs,lomenubar,\
+ sal \
+ cppu \
+ cppuhelper \
+ X11 \
+))
+
+$(eval $(call gb_Library_add_exception_objects,lomenubar,\
+ framework/source/lomenubar/MenuItemInfo \
+ framework/source/lomenubar/AwtKeyToDbusmenuString \
+ framework/source/lomenubar/DesktopJob \
+ framework/source/lomenubar/FrameJob \
+ framework/source/lomenubar/FrameHelper \
+ framework/source/lomenubar/MenuItemStatusListener \
+ framework/source/lomenubar/exports \
+))
+
+# vim: set noet sw=4:
diff --git a/framework/Module_framework.mk b/framework/Module_framework.mk
index 82e5a34..aaccaab 100755
--- a/framework/Module_framework.mk
+++ b/framework/Module_framework.mk
@@ -40,6 +40,12 @@ $(eval $(call gb_Module_add_targets,framework,\
Package_unotypes \
))
+ifeq ($(ENABLE_LOMENUBAR),TRUE)
+$(eval $(call gb_Module_add_targets,framework,\
+ Library_lomenubar \
+))
+endif
+
$(eval $(call gb_Module_add_subsequentcheck_targets,framework,\
JunitTest_framework_complex \
JunitTest_framework_unoapi \
commit 761ed48f20ec5dc8d597d8e8c41b234bbee70eae
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Thu Mar 31 17:39:38 2011 +0200
renaming to LO code conventions
diff --git a/framework/source/lomenubar/AwtKeyToDbusmenuString.h b/framework/source/lomenubar/AwtKeyToDbusmenuString.h
deleted file mode 100644
index acedc90..0000000
--- a/framework/source/lomenubar/AwtKeyToDbusmenuString.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * A LibreOffice extension to send the menubar structure through DBusMenu
- *
- * Copyright 2011 Canonical, Ltd.
- * Authors:
- * Alberto Ruiz <alberto.ruiz at codethink.co.uk>
- *
- * This program is free software: you can redistribute it and/or modify it under
- * the the GNU Lesser General Public License version 3, as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
- * SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR PURPOSE. See the applicable
- * version of the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
-
-#ifndef __AWT_KEY_TO_DBUSMENU_STRING_H__
-#define __AWT_KEY_TO_DBUSMENU_STRING_H__
-#include <X11/X.h>
-#include <glib.h>
-
-gchar*
-AwtKeyToDbusmenuString (guint16 aKeyCode);
-
-
-#endif //__AWT_KEY_TO_DBUSMENU_STRING_H__
diff --git a/framework/source/lomenubar/AwtKeyToDbusmenuString.hxx b/framework/source/lomenubar/AwtKeyToDbusmenuString.hxx
new file mode 100644
index 0000000..faa61b6
--- /dev/null
+++ b/framework/source/lomenubar/AwtKeyToDbusmenuString.hxx
@@ -0,0 +1,33 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * A LibreOffice extension to send the menubar structure through DBusMenu
+ *
+ * Copyright 2011 Canonical, Ltd.
+ * Authors:
+ * Alberto Ruiz <alberto.ruiz at codethink.co.uk>
+ *
+ * This program is free software: you can redistribute it and/or modify it under
+ * the the GNU Lesser General Public License version 3, as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
+ * SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR PURPOSE. See the applicable
+ * version of the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#ifndef __AWT_KEY_TO_DBUSMENU_STRING_HXX__
+#define __AWT_KEY_TO_DBUSMENU_STRING_HXX__
+#include <X11/X.h>
+#include <glib.h>
+
+gchar*
+AwtKeyToDbusmenuString (guint16 aKeyCode);
+
+
+#endif //__AWT_KEY_TO_DBUSMENU_STRING_HXX__
diff --git a/framework/source/lomenubar/DesktopJob.cxx b/framework/source/lomenubar/DesktopJob.cxx
index 1ac56c2..425deb5 100644
--- a/framework/source/lomenubar/DesktopJob.cxx
+++ b/framework/source/lomenubar/DesktopJob.cxx
@@ -21,8 +21,8 @@
*
*/
-#include "DesktopJob.h"
-#include "FrameJob.h"
+#include "DesktopJob.hxx"
+#include "FrameJob.hxx"
#include <gio/gio.h>
#include <libdbusmenu-glib/server.h>
diff --git a/framework/source/lomenubar/DesktopJob.h b/framework/source/lomenubar/DesktopJob.h
deleted file mode 100644
index 9dd3024..0000000
--- a/framework/source/lomenubar/DesktopJob.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * A LibreOffice extension to send the menubar structure through DBusMenu
- *
- * Copyright 2011 Canonical, Ltd.
- * Authors:
- * Alberto Ruiz <alberto.ruiz at codethink.co.uk>
- *
- * This program is free software: you can redistribute it and/or modify it under
- * the the GNU Lesser General Public License version 3, as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
- * SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR PURPOSE. See the applicable
- * version of the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
-
-#ifndef __DESKTOP_JOB_H__
-#define __DESKTOP_JOB_H__
-
-#include <glib.h>
-#include <libdbusmenu-glib/menuitem.h>
-
-#include <com/sun/star/task/XJob.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <cppuhelper/implbase2.hxx>
-
-#define LIBREOFFICE_BUSNAME "org.libreoffice.dbusmenu"
-#define DESKTOPJOB_IMPLEMENTATION_NAME "org.libreoffice.desktop.AppMenuJob"
-#define DESKTOPJOB_SERVICE_NAME "org.libreoffice.desktop.AppMenuJob"
-
-namespace css = ::com::sun::star;
-using css::uno::Reference;
-using css::uno::Sequence;
-using css::uno::Any;
-using css::uno::Exception;
-using css::uno::RuntimeException;
-using css::lang::IllegalArgumentException;
-
-class DesktopJob : public cppu::WeakImplHelper2 < css::task::XJob, css::lang::XServiceInfo >
-{
- private:
- Reference< css::lang::XMultiServiceFactory > mxMSF;
-
- public:
- DesktopJob( const Reference< css::lang::XMultiServiceFactory > &rxMSF)
- : mxMSF( rxMSF ) {}
-
- virtual ~DesktopJob() {}
-
- // XJob
- virtual Any SAL_CALL execute(const css::uno::Sequence< css::beans::NamedValue >& Arguments)
- throw (IllegalArgumentException, Exception, RuntimeException);
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName()
- throw (RuntimeException);
-
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
- throw (RuntimeException);
-
- virtual Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
- throw (RuntimeException);
-};
-
-
-::rtl::OUString
-DesktopJob_getImplementationName()
- throw ( RuntimeException );
-
-sal_Bool SAL_CALL
-DesktopJob_supportsService( const ::rtl::OUString& ServiceName )
- throw ( RuntimeException );
-
-Sequence< ::rtl::OUString > SAL_CALL
-DesktopJob_getSupportedServiceNames()
- throw ( RuntimeException );
-
-Reference< css::uno::XInterface >
-SAL_CALL DesktopJob_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr)
- throw ( Exception );
-
-#endif //__DESKTOP_JOB_H__
-
diff --git a/framework/source/lomenubar/DesktopJob.hxx b/framework/source/lomenubar/DesktopJob.hxx
new file mode 100644
index 0000000..e19e1da
--- /dev/null
+++ b/framework/source/lomenubar/DesktopJob.hxx
@@ -0,0 +1,90 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * A LibreOffice extension to send the menubar structure through DBusMenu
+ *
+ * Copyright 2011 Canonical, Ltd.
+ * Authors:
+ * Alberto Ruiz <alberto.ruiz at codethink.co.uk>
+ *
+ * This program is free software: you can redistribute it and/or modify it under
+ * the the GNU Lesser General Public License version 3, as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
+ * SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR PURPOSE. See the applicable
+ * version of the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#ifndef __DESKTOP_JOB_HXX__
+#define __DESKTOP_JOB_HXX__
+
+#include <glib.h>
+#include <libdbusmenu-glib/menuitem.h>
+
+#include <com/sun/star/task/XJob.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/implbase2.hxx>
+
+#define LIBREOFFICE_BUSNAME "org.libreoffice.dbusmenu"
+#define DESKTOPJOB_IMPLEMENTATION_NAME "org.libreoffice.desktop.AppMenuJob"
+#define DESKTOPJOB_SERVICE_NAME "org.libreoffice.desktop.AppMenuJob"
+
+namespace css = ::com::sun::star;
+using css::uno::Reference;
+using css::uno::Sequence;
+using css::uno::Any;
+using css::uno::Exception;
+using css::uno::RuntimeException;
+using css::lang::IllegalArgumentException;
+
+class DesktopJob : public cppu::WeakImplHelper2 < css::task::XJob, css::lang::XServiceInfo >
+{
+ private:
+ Reference< css::lang::XMultiServiceFactory > mxMSF;
+
+ public:
+ DesktopJob( const Reference< css::lang::XMultiServiceFactory > &rxMSF)
+ : mxMSF( rxMSF ) {}
+
+ virtual ~DesktopJob() {}
+
+ // XJob
+ virtual Any SAL_CALL execute(const css::uno::Sequence< css::beans::NamedValue >& Arguments)
+ throw (IllegalArgumentException, Exception, RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw (RuntimeException);
+
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
+ throw (RuntimeException);
+
+ virtual Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
+ throw (RuntimeException);
+};
+
+
+::rtl::OUString
+DesktopJob_getImplementationName()
+ throw ( RuntimeException );
+
+sal_Bool SAL_CALL
+DesktopJob_supportsService( const ::rtl::OUString& ServiceName )
+ throw ( RuntimeException );
+
+Sequence< ::rtl::OUString > SAL_CALL
+DesktopJob_getSupportedServiceNames()
+ throw ( RuntimeException );
+
+Reference< css::uno::XInterface >
+SAL_CALL DesktopJob_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr)
+ throw ( Exception );
+
+#endif //__DESKTOP_JOB_HXX__
+
diff --git a/framework/source/lomenubar/FrameHelper.cxx b/framework/source/lomenubar/FrameHelper.cxx
index 4c4550e..b45cf0f 100644
--- a/framework/source/lomenubar/FrameHelper.cxx
+++ b/framework/source/lomenubar/FrameHelper.cxx
@@ -21,10 +21,10 @@
*
*/
-#include "FrameHelper.h"
-#include "AwtKeyToDbusmenuString.h"
-#include "MenuItemInfo.h"
-#include "MenuItemStatusListener.h"
+#include "FrameHelper.hxx"
+#include "AwtKeyToDbusmenuString.hxx"
+#include "MenuItemInfo.hxx"
+#include "MenuItemStatusListener.hxx"
#include <com/sun/star/awt/KeyEvent.hpp>
#include <com/sun/star/awt/SystemDependentXWindow.hpp>
diff --git a/framework/source/lomenubar/FrameHelper.h b/framework/source/lomenubar/FrameHelper.h
deleted file mode 100644
index d3e00c6..0000000
--- a/framework/source/lomenubar/FrameHelper.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * A LibreOffice extension to send the menubar structure through DBusMenu
- *
- * Copyright 2011 Canonical, Ltd.
- * Authors:
- * Alberto Ruiz <alberto.ruiz at codethink.co.uk>
- *
- * This program is free software: you can redistribute it and/or modify it under
- * the the GNU Lesser General Public License version 3, as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
- * SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR PURPOSE. See the applicable
- * version of the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
-
-#ifndef __FRAME_HELPER_H__
-#define __FRAME_HELPER_H__
-
-#include <com/sun/star/awt/KeyEvent.hpp>
-#include <com/sun/star/awt/XMenu.hpp>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/frame/XFrame.hpp>
-#include <com/sun/star/frame/XFramesSupplier.hpp>
-#include <com/sun/star/frame/FrameSearchFlag.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/frame/XFrameActionListener.hpp>
-#include <com/sun/star/frame/XStatusListener.hpp>
-#include <com/sun/star/frame/FrameAction.hpp>
-#include <com/sun/star/frame/XDispatchProvider.hpp>
-#include <com/sun/star/frame/XModuleManager.hpp>
-#include <com/sun/star/frame/XModel.hpp>
-#include <cppuhelper/implbase1.hxx>
-#include <com/sun/star/lang/EventObject.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/util/XURLTransformer.hpp>
-#include <com/sun/star/ui/XAcceleratorConfiguration.hpp>
-
-#include <libdbusmenu-glib/server.h>
-#include <libdbusmenu-glib/menuitem.h>
-
-using com::sun::star::awt::KeyEvent;
-using com::sun::star::awt::XMenu;
-using com::sun::star::beans::PropertyValue;
-using com::sun::star::container::XNameAccess;
-using com::sun::star::frame::FrameActionEvent;
-using com::sun::star::frame::XFrame;
-using com::sun::star::frame::XFramesSupplier;
-using com::sun::star::frame::XFrameActionListener;
-using com::sun::star::frame::XStatusListener;
-using com::sun::star::frame::XDispatchProvider;
-using com::sun::star::frame::XModuleManager;
-using com::sun::star::frame::XModel;
-using com::sun::star::lang::EventObject;
-using com::sun::star::lang::XMultiServiceFactory;
-using com::sun::star::lang::XMultiComponentFactory;
-using com::sun::star::uno::Any;
-using com::sun::star::uno::Reference;
-using com::sun::star::uno::Sequence;
-using com::sun::star::uno::RuntimeException;
-using com::sun::star::util::XURLTransformer;
-using com::sun::star::ui::XAcceleratorConfiguration;
-using rtl::OUString;
-
-/* This class is a helper in charge of closing the dbusmenu server when a frame is closed,
- * and also allows the menuitem callbacks to dispatch commands.
- */
-
-class FrameHelper : public cppu::WeakImplHelper1 < XFrameActionListener >
-{
- private:
- Reference < XFrame > xFrame;
- Reference < XMultiServiceFactory > xMSF;
- Reference < XNameAccess > xUICommands;
- DbusmenuServer *server;
- DbusmenuMenuitem *root;
- gboolean watcher_set;
- guint watcher;
- XStatusListener *xSL;
- Reference < XURLTransformer > xTrans;
- Reference < XDispatchProvider > xdp;
- GHashTable *commandsInfo;
- gboolean blockDetach;
-
- //These object/methods are used to recreate dynamic popupmenus
- Reference < XMultiComponentFactory > xPCF;
- Reference < XModuleManager> xMM;
- Sequence < Any > args;
-
- gboolean isSpecialSubmenu (OUString command);
-
- //This is to build the shortcut database
- Reference< XAcceleratorConfiguration > docAccelConf;
- Reference< XAcceleratorConfiguration > modAccelConf;
- Reference< XAcceleratorConfiguration > globAccelConf;
-
- void getAcceleratorConfigurations (Reference < XModel >,
- Reference < XModuleManager>);
-
- KeyEvent findShortcutForCommand (OUString);
-
- public:
- FrameHelper(const Reference< XMultiServiceFactory >&,
- const Reference< XFrame >&,
- DbusmenuServer*);
-
- virtual ~FrameHelper();
- virtual void SAL_CALL frameAction(const FrameActionEvent& action)
- throw (RuntimeException);
-
- virtual void SAL_CALL disposing(const EventObject& aEvent)
- throw (RuntimeException);
-
- //Setters
- void setRootItem (DbusmenuMenuitem *);
- void setRegistrarWatcher (guint watcher);
- void setServer (DbusmenuServer *);
-
- //Getters
- Reference < XFrame > getFrame ();
- unsigned long getXID ();
- GHashTable* getCommandsInfo ();
- XStatusListener* getStatusListener ();
- ::rtl::OUString getLabelFromCommandURL (::rtl::OUString);
-
- //Menu Related actions
- void dispatchCommand (OUString);
- void rebuildMenu (Reference < XMenu >, DbusmenuMenuitem*);
- void rebuildMenuFromRoot ();
- void populateWindowList (DbusmenuMenuitem *);
-};
-#endif // __FRAME_HELPER_H__
diff --git a/framework/source/lomenubar/FrameHelper.hxx b/framework/source/lomenubar/FrameHelper.hxx
new file mode 100644
index 0000000..a36a7de
--- /dev/null
+++ b/framework/source/lomenubar/FrameHelper.hxx
@@ -0,0 +1,139 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * A LibreOffice extension to send the menubar structure through DBusMenu
+ *
+ * Copyright 2011 Canonical, Ltd.
+ * Authors:
+ * Alberto Ruiz <alberto.ruiz at codethink.co.uk>
+ *
+ * This program is free software: you can redistribute it and/or modify it under
+ * the the GNU Lesser General Public License version 3, as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
+ * SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR PURPOSE. See the applicable
+ * version of the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#ifndef __FRAME_HELPER_HXX__
+#define __FRAME_HELPER_HXX__
+
+#include <com/sun/star/awt/KeyEvent.hpp>
+#include <com/sun/star/awt/XMenu.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XFramesSupplier.hpp>
+#include <com/sun/star/frame/FrameSearchFlag.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/frame/XFrameActionListener.hpp>
+#include <com/sun/star/frame/XStatusListener.hpp>
+#include <com/sun/star/frame/FrameAction.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/XModuleManager.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/lang/EventObject.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+#include <com/sun/star/ui/XAcceleratorConfiguration.hpp>
+
+#include <libdbusmenu-glib/server.h>
+#include <libdbusmenu-glib/menuitem.h>
+
+using com::sun::star::awt::KeyEvent;
+using com::sun::star::awt::XMenu;
+using com::sun::star::beans::PropertyValue;
+using com::sun::star::container::XNameAccess;
+using com::sun::star::frame::FrameActionEvent;
+using com::sun::star::frame::XFrame;
+using com::sun::star::frame::XFramesSupplier;
+using com::sun::star::frame::XFrameActionListener;
+using com::sun::star::frame::XStatusListener;
+using com::sun::star::frame::XDispatchProvider;
+using com::sun::star::frame::XModuleManager;
+using com::sun::star::frame::XModel;
+using com::sun::star::lang::EventObject;
+using com::sun::star::lang::XMultiServiceFactory;
+using com::sun::star::lang::XMultiComponentFactory;
+using com::sun::star::uno::Any;
+using com::sun::star::uno::Reference;
+using com::sun::star::uno::Sequence;
+using com::sun::star::uno::RuntimeException;
+using com::sun::star::util::XURLTransformer;
+using com::sun::star::ui::XAcceleratorConfiguration;
+using rtl::OUString;
+
+/* This class is a helper in charge of closing the dbusmenu server when a frame is closed,
+ * and also allows the menuitem callbacks to dispatch commands.
+ */
+
+class FrameHelper : public cppu::WeakImplHelper1 < XFrameActionListener >
+{
+ private:
+ Reference < XFrame > xFrame;
+ Reference < XMultiServiceFactory > xMSF;
+ Reference < XNameAccess > xUICommands;
+ DbusmenuServer *server;
+ DbusmenuMenuitem *root;
+ gboolean watcher_set;
+ guint watcher;
+ XStatusListener *xSL;
+ Reference < XURLTransformer > xTrans;
+ Reference < XDispatchProvider > xdp;
+ GHashTable *commandsInfo;
+ gboolean blockDetach;
+
+ //These object/methods are used to recreate dynamic popupmenus
+ Reference < XMultiComponentFactory > xPCF;
+ Reference < XModuleManager> xMM;
+ Sequence < Any > args;
+
+ gboolean isSpecialSubmenu (OUString command);
+
+ //This is to build the shortcut database
+ Reference< XAcceleratorConfiguration > docAccelConf;
+ Reference< XAcceleratorConfiguration > modAccelConf;
+ Reference< XAcceleratorConfiguration > globAccelConf;
+
+ void getAcceleratorConfigurations (Reference < XModel >,
+ Reference < XModuleManager>);
+
+ KeyEvent findShortcutForCommand (OUString);
+
+ public:
+ FrameHelper(const Reference< XMultiServiceFactory >&,
+ const Reference< XFrame >&,
+ DbusmenuServer*);
+
+ virtual ~FrameHelper();
+ virtual void SAL_CALL frameAction(const FrameActionEvent& action)
+ throw (RuntimeException);
+
+ virtual void SAL_CALL disposing(const EventObject& aEvent)
+ throw (RuntimeException);
+
+ //Setters
+ void setRootItem (DbusmenuMenuitem *);
+ void setRegistrarWatcher (guint watcher);
+ void setServer (DbusmenuServer *);
+
+ //Getters
+ Reference < XFrame > getFrame ();
+ unsigned long getXID ();
+ GHashTable* getCommandsInfo ();
+ XStatusListener* getStatusListener ();
+ ::rtl::OUString getLabelFromCommandURL (::rtl::OUString);
+
+ //Menu Related actions
+ void dispatchCommand (OUString);
+ void rebuildMenu (Reference < XMenu >, DbusmenuMenuitem*);
+ void rebuildMenuFromRoot ();
+ void populateWindowList (DbusmenuMenuitem *);
+};
+#endif // __FRAME_HELPER_HXX__
diff --git a/framework/source/lomenubar/FrameJob.cxx b/framework/source/lomenubar/FrameJob.cxx
index 7e84d6c..f5de3cd 100644
--- a/framework/source/lomenubar/FrameJob.cxx
+++ b/framework/source/lomenubar/FrameJob.cxx
@@ -21,9 +21,9 @@
*
*/
-#include "FrameJob.h"
-#include "DesktopJob.h"
-#include "FrameHelper.h"
+#include "FrameJob.hxx"
+#include "DesktopJob.hxx"
+#include "FrameHelper.hxx"
#define OBJ_PATH_PREFIX "/com/canonical/menu/"
diff --git a/framework/source/lomenubar/FrameJob.h b/framework/source/lomenubar/FrameJob.h
deleted file mode 100644
index d209a09..0000000
--- a/framework/source/lomenubar/FrameJob.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * A LibreOffice extension to send the menubar structure through DBusMenu
- *
- * Copyright 2011 Canonical, Ltd.
- * Authors:
- * Alberto Ruiz <alberto.ruiz at codethink.co.uk>
- *
- * This program is free software: you can redistribute it and/or modify it under
- * the the GNU Lesser General Public License version 3, as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
- * SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR PURPOSE. See the applicable
- * version of the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
-
-#ifndef __FRAME_JOB_HXX__
-#define __MRAME_JOB_HXX__
-
-#include <com/sun/star/task/XJob.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <cppuhelper/implbase2.hxx>
-#include <com/sun/star/frame/XFrame.hpp>
-#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/frame/XModuleManager.hpp>
-#include <com/sun/star/beans/NamedValue.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/container/XIndexContainer.hpp>
-#include <com/sun/star/ui/XAcceleratorConfiguration.hpp>
-#include <com/sun/star/awt/XMenu.hpp>
-#include <com/sun/star/awt/KeyEvent.hpp>
-
-#include <glib.h>
-#include <libdbusmenu-glib/menuitem.h>
-
-#define FRAMEJOB_IMPLEMENTATION_NAME "com.sun.star.comp.Office.MyJob"
-#define FRAMEJOB_SERVICE_NAME "com.sun.star.task.Job"
-
-namespace css = ::com::sun::star;
-using css::uno::Reference;
-
-class FrameJob : public cppu::WeakImplHelper2 < css::task::XJob, css::lang::XServiceInfo >
-{
- private:
- Reference < css::lang::XMultiServiceFactory > mxMSF;
- Reference < css::container::XNameAccess > xUICommands;
- Reference < css::frame::XFrame > xFrame;
-
- unsigned long xid;
-
- //Private methods
- unsigned long getXID (Reference < css::frame::XFrame >);
- DbusmenuMenuitem* getRootMenuitem (Reference < css::awt::XMenu >,
- gpointer);
-
- public:
- FrameJob( const css::uno::Reference< css::lang::XMultiServiceFactory > &rxMSF)
- : mxMSF( rxMSF ) {};
-
- void exportMenus (Reference < css::frame::XFrame > xFrame);
-
- virtual ~FrameJob() {}
-
- // XJob
- virtual css::uno::Any SAL_CALL execute(const css::uno::Sequence< css::beans::NamedValue >& Arguments)
- throw (css::lang::IllegalArgumentException, css::uno::Exception, css::uno::RuntimeException);
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName()
- throw (css::uno::RuntimeException);
-
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
- throw (css::uno::RuntimeException);
-
- virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
- throw (css::uno::RuntimeException);
-};
-
-
-::rtl::OUString FrameJob_getImplementationName()
- throw ( css::uno::RuntimeException );
-
-sal_Bool SAL_CALL FrameJob_supportsService( const ::rtl::OUString& ServiceName )
- throw ( css::uno::RuntimeException );
-
-css::uno::Sequence< ::rtl::OUString > SAL_CALL FrameJob_getSupportedServiceNames()
- throw ( css::uno::RuntimeException );
-
-css::uno::Reference< css::uno::XInterface >
-SAL_CALL FrameJob_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr)
- throw ( css::uno::Exception );
-
-#endif
-
diff --git a/framework/source/lomenubar/FrameJob.hxx b/framework/source/lomenubar/FrameJob.hxx
new file mode 100644
index 0000000..d209a09
--- /dev/null
+++ b/framework/source/lomenubar/FrameJob.hxx
@@ -0,0 +1,101 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * A LibreOffice extension to send the menubar structure through DBusMenu
+ *
+ * Copyright 2011 Canonical, Ltd.
+ * Authors:
+ * Alberto Ruiz <alberto.ruiz at codethink.co.uk>
+ *
+ * This program is free software: you can redistribute it and/or modify it under
+ * the the GNU Lesser General Public License version 3, as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
+ * SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR PURPOSE. See the applicable
+ * version of the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#ifndef __FRAME_JOB_HXX__
+#define __MRAME_JOB_HXX__
+
+#include <com/sun/star/task/XJob.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/implbase2.hxx>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/frame/XModuleManager.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/ui/XAcceleratorConfiguration.hpp>
+#include <com/sun/star/awt/XMenu.hpp>
+#include <com/sun/star/awt/KeyEvent.hpp>
+
+#include <glib.h>
+#include <libdbusmenu-glib/menuitem.h>
+
+#define FRAMEJOB_IMPLEMENTATION_NAME "com.sun.star.comp.Office.MyJob"
+#define FRAMEJOB_SERVICE_NAME "com.sun.star.task.Job"
+
+namespace css = ::com::sun::star;
+using css::uno::Reference;
+
+class FrameJob : public cppu::WeakImplHelper2 < css::task::XJob, css::lang::XServiceInfo >
+{
+ private:
+ Reference < css::lang::XMultiServiceFactory > mxMSF;
+ Reference < css::container::XNameAccess > xUICommands;
+ Reference < css::frame::XFrame > xFrame;
+
+ unsigned long xid;
+
+ //Private methods
+ unsigned long getXID (Reference < css::frame::XFrame >);
+ DbusmenuMenuitem* getRootMenuitem (Reference < css::awt::XMenu >,
+ gpointer);
+
+ public:
+ FrameJob( const css::uno::Reference< css::lang::XMultiServiceFactory > &rxMSF)
+ : mxMSF( rxMSF ) {};
+
+ void exportMenus (Reference < css::frame::XFrame > xFrame);
+
+ virtual ~FrameJob() {}
+
+ // XJob
+ virtual css::uno::Any SAL_CALL execute(const css::uno::Sequence< css::beans::NamedValue >& Arguments)
+ throw (css::lang::IllegalArgumentException, css::uno::Exception, css::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw (css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
+ throw (css::uno::RuntimeException);
+
+ virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
+ throw (css::uno::RuntimeException);
+};
+
+
+::rtl::OUString FrameJob_getImplementationName()
+ throw ( css::uno::RuntimeException );
+
+sal_Bool SAL_CALL FrameJob_supportsService( const ::rtl::OUString& ServiceName )
+ throw ( css::uno::RuntimeException );
+
+css::uno::Sequence< ::rtl::OUString > SAL_CALL FrameJob_getSupportedServiceNames()
+ throw ( css::uno::RuntimeException );
+
+css::uno::Reference< css::uno::XInterface >
+SAL_CALL FrameJob_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr)
+ throw ( css::uno::Exception );
+
+#endif
+
diff --git a/framework/source/lomenubar/MenuItemInfo.cxx b/framework/source/lomenubar/MenuItemInfo.cxx
index eab5c5b..4fe6636 100644
--- a/framework/source/lomenubar/MenuItemInfo.cxx
+++ b/framework/source/lomenubar/MenuItemInfo.cxx
@@ -21,7 +21,7 @@
*
*/
-#include "MenuItemInfo.h"
+#include "MenuItemInfo.hxx"
#include <libdbusmenu-gtk/menuitem.h>
MenuItemInfo::MenuItemInfo ()
diff --git a/framework/source/lomenubar/MenuItemInfo.h b/framework/source/lomenubar/MenuItemInfo.h
deleted file mode 100644
index 9239625..0000000
--- a/framework/source/lomenubar/MenuItemInfo.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * A LibreOffice extension to send the menubar structure through DBusMenu
- *
- * Copyright 2011 Canonical, Ltd.
- * Authors:
- * Alberto Ruiz <alberto.ruiz at codethink.co.uk>
- *
- * This program is free software: you can redistribute it and/or modify it under
- * the the GNU Lesser General Public License version 3, as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
- * SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR PURPOSE. See the applicable
- * version of the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
-
-#ifndef __MENU_ITEM_INFO_H__
-#define __MENU_ITEM_INFO_H__
-#include <glib.h>
-
-// This is used in a hash table with commandurls as keys
-class MenuItemInfo {
- gchar* label; //Label text in UTF-8 with tildes subst by underscores
- gint check_state;
- gchar* check_type;
- gboolean is_enabled;
- gboolean is_visible;
-
- public:
- MenuItemInfo ();
- ~MenuItemInfo ();
-
- //Setters
- void setLabel (gchar* label);
- void setEnabled (gboolean is_enabled);
- void setCheckState (gint check_state);
- void setCheckType (const gchar* check_type);
- void setVisible (gboolean is_visible);
-
- //Getters
- gchar* getLabel ();
- gboolean getEnabled ();
- gint getCheckState ();
- const gchar* getCheckType ();
- gboolean getVisible ();
-};
-#endif // __MENU_ITEM_INFO_H__
diff --git a/framework/source/lomenubar/MenuItemInfo.hxx b/framework/source/lomenubar/MenuItemInfo.hxx
new file mode 100644
index 0000000..1180688
--- /dev/null
+++ b/framework/source/lomenubar/MenuItemInfo.hxx
@@ -0,0 +1,54 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * A LibreOffice extension to send the menubar structure through DBusMenu
+ *
+ * Copyright 2011 Canonical, Ltd.
+ * Authors:
+ * Alberto Ruiz <alberto.ruiz at codethink.co.uk>
+ *
+ * This program is free software: you can redistribute it and/or modify it under
+ * the the GNU Lesser General Public License version 3, as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
+ * SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR PURPOSE. See the applicable
+ * version of the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#ifndef __MENU_ITEM_INFO_HXX__
+#define __MENU_ITEM_INFO_HXX__
+#include <glib.h>
+
+// This is used in a hash table with commandurls as keys
+class MenuItemInfo {
+ gchar* label; //Label text in UTF-8 with tildes subst by underscores
+ gint check_state;
+ gchar* check_type;
+ gboolean is_enabled;
+ gboolean is_visible;
+
+ public:
+ MenuItemInfo ();
+ ~MenuItemInfo ();
+
+ //Setters
+ void setLabel (gchar* label);
+ void setEnabled (gboolean is_enabled);
+ void setCheckState (gint check_state);
+ void setCheckType (const gchar* check_type);
+ void setVisible (gboolean is_visible);
+
+ //Getters
+ gchar* getLabel ();
+ gboolean getEnabled ();
+ gint getCheckState ();
+ const gchar* getCheckType ();
+ gboolean getVisible ();
+};
+#endif // __MENU_ITEM_INFO_HXX__
diff --git a/framework/source/lomenubar/MenuItemStatusListener.cxx b/framework/source/lomenubar/MenuItemStatusListener.cxx
index 68ca3de..d51a7c5 100644
--- a/framework/source/lomenubar/MenuItemStatusListener.cxx
+++ b/framework/source/lomenubar/MenuItemStatusListener.cxx
@@ -1,5 +1,5 @@
-#include "MenuItemStatusListener.h"
-#include "MenuItemInfo.h"
+#include "MenuItemStatusListener.hxx"
+#include "MenuItemInfo.hxx"
#include <com/sun/star/frame/status/Visibility.hpp>
diff --git a/framework/source/lomenubar/MenuItemStatusListener.h b/framework/source/lomenubar/MenuItemStatusListener.h
deleted file mode 100644
index 56cf5e8..0000000
--- a/framework/source/lomenubar/MenuItemStatusListener.h
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef __MENU_ITEM_STATUS_LISTENER_H__
-#define __MENU_ITEM_STATUS_LISTENER_H__
-
-#include "FrameHelper.h"
-
-#include <glib.h>
-
-#include <com/sun/star/frame/XStatusListener.hpp>
-#include <cppuhelper/implbase1.hxx>
-
-#include <rtl/process.h>
-
-using com::sun::star::frame::FeatureStateEvent;
-using com::sun::star::frame::XStatusListener;
-using com::sun::star::lang::EventObject;
-
-// This class listens for changes in each menuitem and notifies FrameHelper about it
-class MenuItemStatusListener : public cppu::WeakImplHelper1 < XStatusListener >
-{
- private:
- guint16 id;
- FrameHelper *helper;
-
- public:
- MenuItemStatusListener (FrameHelper *helper);
- ~MenuItemStatusListener () {}
-
- virtual void SAL_CALL
- statusChanged(const FeatureStateEvent& Event)
- throw (RuntimeException);
-
- virtual void SAL_CALL disposing(const EventObject& aEvent)
- throw (RuntimeException) {}
-};
-#endif
diff --git a/framework/source/lomenubar/MenuItemStatusListener.hxx b/framework/source/lomenubar/MenuItemStatusListener.hxx
new file mode 100644
index 0000000..33997e9
--- /dev/null
+++ b/framework/source/lomenubar/MenuItemStatusListener.hxx
@@ -0,0 +1,35 @@
+#ifndef __MENU_ITEM_STATUS_LISTENER_HXX__
+#define __MENU_ITEM_STATUS_LISTENER_HXX__
+
+#include "FrameHelper.hxx"
+
+#include <glib.h>
+
+#include <com/sun/star/frame/XStatusListener.hpp>
+#include <cppuhelper/implbase1.hxx>
+
+#include <rtl/process.h>
+
+using com::sun::star::frame::FeatureStateEvent;
+using com::sun::star::frame::XStatusListener;
+using com::sun::star::lang::EventObject;
+
+// This class listens for changes in each menuitem and notifies FrameHelper about it
+class MenuItemStatusListener : public cppu::WeakImplHelper1 < XStatusListener >
+{
+ private:
+ guint16 id;
+ FrameHelper *helper;
+
+ public:
+ MenuItemStatusListener (FrameHelper *helper);
+ ~MenuItemStatusListener () {}
+
+ virtual void SAL_CALL
+ statusChanged(const FeatureStateEvent& Event)
+ throw (RuntimeException);
+
+ virtual void SAL_CALL disposing(const EventObject& aEvent)
+ throw (RuntimeException) {}
+};
+#endif
diff --git a/framework/source/lomenubar/exports.cxx b/framework/source/lomenubar/exports.cxx
index e581a2c..f6f0892 100644
--- a/framework/source/lomenubar/exports.cxx
+++ b/framework/source/lomenubar/exports.cxx
@@ -34,8 +34,8 @@
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#endif
-#include "DesktopJob.h"
-#include "FrameJob.h"
+#include "DesktopJob.hxx"
+#include "FrameJob.hxx"
namespace css = ::com::sun::star;
commit ec176090c881c6d6b85606c6711ed621c5af7531
Author: Alberto Ruiz <alberto.ruiz at codethink.co.uk>
Date: Thu Mar 31 19:49:02 2011 +0200
initial import of lomenubar
* from http://bazaar.launchpad.net/~lo-menubar-team/lo-menubar/trunk/changes
* fixed indent to keep git hooks happy, otherwise a vanilla copy
diff --git a/framework/source/lomenubar/AwtKeyToDbusmenuString.cxx b/framework/source/lomenubar/AwtKeyToDbusmenuString.cxx
new file mode 100644
index 0000000..4fd377d
--- /dev/null
+++ b/framework/source/lomenubar/AwtKeyToDbusmenuString.cxx
@@ -0,0 +1,145 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * A LibreOffice extension to send the menubar structure through DBusMenu
+ *
+ * Copyright 2011 Canonical, Ltd.
+ * Authors:
+ * Alberto Ruiz <alberto.ruiz at codethink.co.uk>
+ *
+ * This program is free software: you can redistribute it and/or modify it under
+ * the the GNU Lesser General Public License version 3, as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
+ * SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR PURPOSE. See the applicable
+ * version of the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#define XK_MISCELLANY
+#define XK_LATIN1
+#define XK_PUBLISHING
+
+#include <X11/Xlib.h>
+#include <X11/keysymdef.h>
+
+#include <glib.h>
+
+#include <com/sun/star/awt/Key.hpp>
+
+using namespace ::com::sun::star;
+
+KeySym MapAwtToXKey (guint16 aKeyCode);
+
+gchar*
+AwtKeyToDbusmenuString (guint16 aKeyCode)
+{
+ KeySym code = (KeySym)0;
+
+ if (!aKeyCode)
+ return NULL;
+
+ //We try the consecutive ranges first, if the code is not there
+ //we use MapAwtToXKey(), se below
+ if (aKeyCode >= awt::Key::A && aKeyCode <= awt::Key::Z)
+ code = (KeySym)aKeyCode - (KeySym)awt::Key::A + XK_A;
+ else if (aKeyCode >= awt::Key::F1 && aKeyCode <= awt::Key::F26)
+ code = (KeySym)aKeyCode - (KeySym)awt::Key::F1 + XK_F1;
+ else if (aKeyCode >= awt::Key::NUM0 && aKeyCode <= awt::Key::NUM9)
+ code = (KeySym)aKeyCode - (KeySym)awt::Key::NUM0 + XK_0;
+ else
+ code = MapAwtToXKey (aKeyCode);
+
+ if (code == 0)
+ return NULL;
+
+ return XKeysymToString (code);;
+}
+
+
+//This is a 1-1 mapper between com::sun::star::awt:Key values and X11 KeySyms
+//note that some symbols are missing
+KeySym
+MapAwtToXKey (guint16 aKeyCode)
+{
+ switch (aKeyCode)
+ {
+ case awt::Key::UP:
+ return XK_Up;
+ case awt::Key::DOWN:
+ return XK_Down;
+ case awt::Key::LEFT:
+ return XK_Left;
+ case awt::Key::RIGHT:
+ return XK_Right;
+ case awt::Key::HOME:
+ return XK_Home;
+ case awt::Key::END:
+ return XK_End;
+ case awt::Key::PAGEUP:
+ return XK_Page_Up;
+ case awt::Key::PAGEDOWN:
+ return XK_Page_Down;
+ case awt::Key::RETURN:
+ return XK_Return;
+ case awt::Key::ESCAPE:
+ return XK_Escape;
+ case awt::Key::TAB:
+ return XK_Tab;
+ case awt::Key::BACKSPACE:
+ return XK_BackSpace;
+ case awt::Key::SPACE:
+ return XK_space;
+ case awt::Key::INSERT:
+ return XK_Insert;
+ case awt::Key::DELETE:
+ return XK_Delete;
+ case awt::Key::ADD:
+ return XK_plus;
+ case awt::Key::SUBTRACT:
+ return XK_minus;
+ case awt::Key::MULTIPLY:
+ return XK_asterisk;
+ case awt::Key::DIVIDE:
+ return XK_slash;
+ case awt::Key::POINT:
+ return XK_period;
+ case awt::Key::COMMA:
+ return XK_comma;
+ case awt::Key::LESS:
+ return XK_less;
+ case awt::Key::GREATER:
+ return XK_greater;
+ case awt::Key::EQUAL:
+ return XK_equal;
+ case awt::Key::UNDO:
+ return XK_Undo;
+ case awt::Key::REPEAT:
+ return XK_Redo;
+ case awt::Key::FIND:
+ return XK_Find;
+ case awt::Key::DECIMAL:
+ return XK_decimalpoint;
+ case awt::Key::TILDE:
+ return XK_asciitilde;
+ case awt::Key::QUOTELEFT:
+ return XK_leftsinglequotemark;
+ //Sun keys and other unsupported symbols
+ case awt::Key::OPEN:
+ case awt::Key::CUT:
+ case awt::Key::COPY:
+ case awt::Key::PASTE:
+ case awt::Key::PROPERTIES:
+ case awt::Key::FRONT:
+ case awt::Key::CONTEXTMENU:
+ case awt::Key::HELP:
+ case awt::Key::MENU:
+ default:
+ return 0;
+ }
+}
diff --git a/framework/source/lomenubar/AwtKeyToDbusmenuString.h b/framework/source/lomenubar/AwtKeyToDbusmenuString.h
new file mode 100644
index 0000000..acedc90
--- /dev/null
+++ b/framework/source/lomenubar/AwtKeyToDbusmenuString.h
@@ -0,0 +1,33 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * A LibreOffice extension to send the menubar structure through DBusMenu
+ *
+ * Copyright 2011 Canonical, Ltd.
+ * Authors:
+ * Alberto Ruiz <alberto.ruiz at codethink.co.uk>
+ *
+ * This program is free software: you can redistribute it and/or modify it under
+ * the the GNU Lesser General Public License version 3, as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
+ * SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR PURPOSE. See the applicable
+ * version of the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#ifndef __AWT_KEY_TO_DBUSMENU_STRING_H__
+#define __AWT_KEY_TO_DBUSMENU_STRING_H__
+#include <X11/X.h>
+#include <glib.h>
+
+gchar*
+AwtKeyToDbusmenuString (guint16 aKeyCode);
+
+
+#endif //__AWT_KEY_TO_DBUSMENU_STRING_H__
diff --git a/framework/source/lomenubar/DesktopJob.cxx b/framework/source/lomenubar/DesktopJob.cxx
new file mode 100644
index 0000000..1ac56c2
--- /dev/null
+++ b/framework/source/lomenubar/DesktopJob.cxx
@@ -0,0 +1,157 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * A LibreOffice extension to send the menubar structure through DBusMenu
+ *
+ * Copyright 2011 Canonical, Ltd.
+ * Authors:
+ * Alberto Ruiz <alberto.ruiz at codethink.co.uk>
+ *
+ * This program is free software: you can redistribute it and/or modify it under
+ * the the GNU Lesser General Public License version 3, as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
+ * SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR PURPOSE. See the applicable
+ * version of the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#include "DesktopJob.h"
+#include "FrameJob.h"
+
+#include <gio/gio.h>
+#include <libdbusmenu-glib/server.h>
+
+#include <rtl/process.h>
+#include <osl/diagnose.h>
+#include <cppuhelper/implbase1.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/document/XEventBroadcaster.hpp>
+#include <com/sun/star/document/XEventListener.hpp>
+#include <com/sun/star/document/EventObject.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/EventObject.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/FrameSearchFlag.hpp>
+#include <com/sun/star/frame/XFramesSupplier.hpp>
+#include <com/sun/star/frame/XFrameActionListener.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/frame/XLayoutManager.hpp>
+
+using rtl::OUString;
+using com::sun::star::beans::XPropertySet;
+using com::sun::star::beans::NamedValue;
+using com::sun::star::document::XEventListener;
+using com::sun::star::document::XEventBroadcaster;
+using com::sun::star::frame::XFrame;
+using com::sun::star::frame::XFramesSupplier;
+using com::sun::star::frame::XFrameActionListener;
+using com::sun::star::frame::XModel;
+using com::sun::star::frame::XLayoutManager;
+using com::sun::star::frame::FrameActionEvent;
+using com::sun::star::frame::XFrameActionListener;
+using com::sun::star::lang::IllegalArgumentException;
+using com::sun::star::lang::XMultiServiceFactory;
+using com::sun::star::lang::EventObject;
+using com::sun::star::uno::Any;
+using com::sun::star::uno::Exception;
+using com::sun::star::uno::Reference;
+using com::sun::star::uno::RuntimeException;
+using com::sun::star::uno::Sequence;
+using com::sun::star::uno::UNO_QUERY;
+using com::sun::star::uno::UNO_QUERY_THROW;
+using com::sun::star::uno::XInterface;
+
+//-------------------------- D-Bus Callbacks ----------------------------------
+static void
+on_bus (GDBusConnection * connection,
+ const gchar * name,
+ gpointer user_data)
+{
+ //TODO: Should we actually do something here?
+ return;
+}
+
+static void
+name_lost (GDBusConnection * connection, const gchar * name, gpointer user_data)
+{
+ g_error ("Unable to get name '%s' on DBus", name);
+ return;
+}
+
+// --------------------------- DesktopJob ----------------------------------
+Any SAL_CALL DesktopJob::execute( const Sequence< NamedValue >& aArguments )
+ throw ( IllegalArgumentException, Exception, RuntimeException )
+{
+ g_type_init ();
+
+ g_bus_own_name(G_BUS_TYPE_SESSION,
+ LIBREOFFICE_BUSNAME,
+ G_BUS_NAME_OWNER_FLAGS_NONE,
+ on_bus,
+ NULL,
+ name_lost,
+ NULL,
+ NULL);
+
+ return Any ();
+}
+
+OUString
+DesktopJob_getImplementationName ()
+ throw (RuntimeException)
+{
+ return OUString ( RTL_CONSTASCII_USTRINGPARAM ( DESKTOPJOB_IMPLEMENTATION_NAME ) );
+}
+
+sal_Bool SAL_CALL
+DesktopJob_supportsService( const OUString& ServiceName )
+ throw (RuntimeException)
+{
+ return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( DESKTOPJOB_SERVICE_NAME ) );
+}
+
+Sequence< OUString > SAL_CALL
+DesktopJob_getSupportedServiceNames( )
+ throw (RuntimeException)
+{
+ Sequence < OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( DESKTOPJOB_SERVICE_NAME ) );
+ return aRet;
+}
+
+Reference< XInterface > SAL_CALL
+DesktopJob_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
+ throw( Exception )
+{
+ return (cppu::OWeakObject*) new DesktopJob(rSMgr);
+}
+
+// XServiceInfo
+OUString SAL_CALL
+DesktopJob::getImplementationName()
+ throw (RuntimeException)
+{
+ return DesktopJob_getImplementationName();
+}
+
+sal_Bool SAL_CALL
+DesktopJob::supportsService( const OUString& rServiceName )
+ throw (RuntimeException)
+{
+ return DesktopJob_supportsService( rServiceName );
+}
+
+Sequence< OUString > SAL_CALL
+DesktopJob::getSupportedServiceNames()
+ throw (RuntimeException)
+{
+ return DesktopJob_getSupportedServiceNames();
+}
diff --git a/framework/source/lomenubar/DesktopJob.h b/framework/source/lomenubar/DesktopJob.h
new file mode 100644
index 0000000..9dd3024
--- /dev/null
+++ b/framework/source/lomenubar/DesktopJob.h
@@ -0,0 +1,90 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * A LibreOffice extension to send the menubar structure through DBusMenu
+ *
+ * Copyright 2011 Canonical, Ltd.
+ * Authors:
+ * Alberto Ruiz <alberto.ruiz at codethink.co.uk>
+ *
+ * This program is free software: you can redistribute it and/or modify it under
+ * the the GNU Lesser General Public License version 3, as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
+ * SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR PURPOSE. See the applicable
+ * version of the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#ifndef __DESKTOP_JOB_H__
+#define __DESKTOP_JOB_H__
+
+#include <glib.h>
+#include <libdbusmenu-glib/menuitem.h>
+
+#include <com/sun/star/task/XJob.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/implbase2.hxx>
+
+#define LIBREOFFICE_BUSNAME "org.libreoffice.dbusmenu"
+#define DESKTOPJOB_IMPLEMENTATION_NAME "org.libreoffice.desktop.AppMenuJob"
+#define DESKTOPJOB_SERVICE_NAME "org.libreoffice.desktop.AppMenuJob"
+
+namespace css = ::com::sun::star;
+using css::uno::Reference;
+using css::uno::Sequence;
+using css::uno::Any;
+using css::uno::Exception;
+using css::uno::RuntimeException;
+using css::lang::IllegalArgumentException;
+
+class DesktopJob : public cppu::WeakImplHelper2 < css::task::XJob, css::lang::XServiceInfo >
+{
+ private:
+ Reference< css::lang::XMultiServiceFactory > mxMSF;
+
+ public:
+ DesktopJob( const Reference< css::lang::XMultiServiceFactory > &rxMSF)
+ : mxMSF( rxMSF ) {}
+
+ virtual ~DesktopJob() {}
+
+ // XJob
+ virtual Any SAL_CALL execute(const css::uno::Sequence< css::beans::NamedValue >& Arguments)
+ throw (IllegalArgumentException, Exception, RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw (RuntimeException);
+
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
+ throw (RuntimeException);
+
+ virtual Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
+ throw (RuntimeException);
+};
+
+
+::rtl::OUString
+DesktopJob_getImplementationName()
+ throw ( RuntimeException );
+
+sal_Bool SAL_CALL
+DesktopJob_supportsService( const ::rtl::OUString& ServiceName )
+ throw ( RuntimeException );
+
+Sequence< ::rtl::OUString > SAL_CALL
+DesktopJob_getSupportedServiceNames()
+ throw ( RuntimeException );
+
+Reference< css::uno::XInterface >
+SAL_CALL DesktopJob_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr)
+ throw ( Exception );
+
+#endif //__DESKTOP_JOB_H__
+
diff --git a/framework/source/lomenubar/FrameHelper.cxx b/framework/source/lomenubar/FrameHelper.cxx
new file mode 100644
index 0000000..4c4550e
--- /dev/null
+++ b/framework/source/lomenubar/FrameHelper.cxx
@@ -0,0 +1,826 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * A LibreOffice extension to send the menubar structure through DBusMenu
+ *
+ * Copyright 2011 Canonical, Ltd.
+ * Authors:
+ * Alberto Ruiz <alberto.ruiz at codethink.co.uk>
+ *
+ * This program is free software: you can redistribute it and/or modify it under
+ * the the GNU Lesser General Public License version 3, as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
+ * SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR PURPOSE. See the applicable
+ * version of the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#include "FrameHelper.h"
+#include "AwtKeyToDbusmenuString.h"
+#include "MenuItemInfo.h"
+#include "MenuItemStatusListener.h"
+
+#include <com/sun/star/awt/KeyEvent.hpp>
+#include <com/sun/star/awt/SystemDependentXWindow.hpp>
+#include <com/sun/star/awt/XSystemDependentWindowPeer.hpp>
+#include <com/sun/star/awt/XWindow2.hpp>
+#include <com/sun/star/awt/Key.hpp>
+#include <com/sun/star/awt/KeyModifier.hpp>
+#include <com/sun/star/awt/MenuEvent.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/awt/XPopupMenu.hpp>
+#include <com/sun/star/awt/XMenuExtended.hpp>
+#include <com/sun/star/awt/XMenuListener.hpp>
+#include <com/sun/star/awt/XPopupMenuExtended.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/frame/XComponentLoader.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/XDispatchHelper.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/XLayoutManager.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/frame/XModuleManager.hpp>
+#include <com/sun/star/frame/XPopupMenuController.hpp>
+#include <com/sun/star/frame/FrameAction.hpp>
+#include <com/sun/star/frame/FrameActionEvent.hpp>
+#include <com/sun/star/lang/SystemDependent.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/util/URL.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+#include <com/sun/star/ui/XUIElement.hpp>
+#include <com/sun/star/ui/XUIConfigurationManager.hpp>
+#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
+#include <com/sun/star/ui/XAcceleratorConfiguration.hpp>
+#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
+#include <rtl/process.h>
+
+#include <gio/gio.h>
+#include <libdbusmenu-glib/client.h>
+#include <libdbusmenu-gtk/menuitem.h>
+
+using rtl::OUString;
+using rtl::OString;
+using rtl::OUStringToOString;
+
+using namespace ::com::sun::star;
+
+using com::sun::star::awt::KeyEvent;
+using com::sun::star::awt::MenuEvent;
+using com::sun::star::awt::SystemDependentXWindow;
+using com::sun::star::awt::XMenuListener;
+using com::sun::star::awt::XMenuExtended;
+using com::sun::star::awt::XMenuListener;
+using com::sun::star::awt::MenuEvent;
+using com::sun::star::awt::XPopupMenu;
+using com::sun::star::awt::XPopupMenuExtended;
+using com::sun::star::awt::XSystemDependentWindowPeer;
+using com::sun::star::awt::XWindow2;
+using com::sun::star::beans::XPropertySet;
+using com::sun::star::beans::PropertyValue;
+using com::sun::star::container::XNameAccess;
+using com::sun::star::container::NoSuchElementException;
+using com::sun::star::frame::XController;
+using com::sun::star::frame::XComponentLoader;
+using com::sun::star::frame::XDispatch;
+using com::sun::star::frame::XDispatchProvider;
+using com::sun::star::frame::XDispatchHelper;
+using com::sun::star::frame::XModel;
+using com::sun::star::frame::XModuleManager;
+using com::sun::star::frame::XLayoutManager;
+using com::sun::star::frame::XPopupMenuController;
+using com::sun::star::lang::SystemDependent::SYSTEM_XWINDOW;
+using com::sun::star::uno::UNO_QUERY;
+using com::sun::star::uno::UNO_QUERY_THROW;
+using com::sun::star::uno::Sequence;
+using com::sun::star::uno::XComponentContext;
+using com::sun::star::uno::XInterface;
+using com::sun::star::ui::XUIElement;
+using com::sun::star::ui::XUIConfigurationManager;
+using com::sun::star::ui::XUIConfigurationManagerSupplier;
+using com::sun::star::ui::XAcceleratorConfiguration;
+using com::sun::star::ui::XModuleUIConfigurationManagerSupplier;
+using com::sun::star::util::URL;
+using com::sun::star::util::XURLTransformer;
+
+// ------------------------ Item callbacks ---------------------------
+// Item activated. It distpatches the command associated to a given menu item.
+void
+item_activated (DbusmenuMenuitem *item, guint timestamp, gpointer user_data)
+{
+ FrameHelper *helper = (FrameHelper*)user_data;
+ OUString command = OUString::createFromAscii(dbusmenu_menuitem_property_get (item, "CommandURL"));
+ helper->dispatchCommand (command);
+}
+
+// Rebuilds the submenu
+gboolean
+item_about_to_show (DbusmenuMenuitem *item, gpointer user_data)
+{
+ //Get the XMenu interface for the MenuBar UIElement
+ FrameHelper *helper = (FrameHelper*)user_data;
+ Reference < XFrame > xFrame = helper->getFrame ();
+ Reference< XPropertySet > frameProps (xFrame, UNO_QUERY);
+ Reference < XLayoutManager > xLayoutManager(frameProps->getPropertyValue(OUString::createFromAscii("LayoutManager")),
+ UNO_QUERY);
+ Reference < XUIElement > menuBar(xLayoutManager->getElement (OUString::createFromAscii("private:resource/menubar/menubar")),
+ UNO_QUERY);
+ Reference < XPropertySet > menuPropSet (menuBar, UNO_QUERY);
+
+ if (!menuPropSet.is ())
+ {
+ return FALSE;
+ }
+
+ Reference < XMenu > xMenu(menuPropSet->getPropertyValue(OUString::createFromAscii("XMenuBar")),
+ UNO_QUERY);
+ if (!xMenu.is())
+ {
+ return FALSE;
+ }
+
+ //Find xMenu for the first level item
+ Reference < XMenu > xSubMenu;
+ Reference < XMenuExtended > xMenuEx (xMenu, UNO_QUERY);
+ guint16 root_count = xMenu->getItemCount();
+ for (guint16 i = 0; i<root_count ;i++)
+ {
+
+ guint16 id = xMenu->getItemId (i);
+ if (id == 0)
+ continue;
+
+ OUString command = xMenuEx->getCommand (id);
+
+ //We must find the element with the same command URL
+ if (! OUString::createFromAscii (dbusmenu_menuitem_property_get (item, "CommandURL")).equals (command))
+ continue;
+
+ Reference <XPopupMenu> subPopup (xMenu->getPopupMenu (id), UNO_QUERY);
+ xSubMenu = Reference <XMenu> (subPopup, UNO_QUERY);
+ break;
+ }
+
+ //We only do this for toplevel items
+ if (xSubMenu.is ())
+ {
+ helper->rebuildMenu (xSubMenu, item);
+ return FALSE;
+ }
+
+ //If it is not a toplevel item we stop trying to rebuild
+ return TRUE;
+}
+
+void
+destroy_menuitem (gpointer data)
+{
+ g_object_unref (G_OBJECT (data));
+}
+
+void
+destroy_menu_item_info (gpointer data)
+{
+ delete (MenuItemInfo*)data;
+}
+
+// ------------------------ FrameHelper Class -------------------------------
+FrameHelper::FrameHelper(const Reference< XMultiServiceFactory >& rServiceManager,
+ const Reference< XFrame >& xFrame,
+ DbusmenuServer* server)
+{
+ xMSF = rServiceManager;
+ this->xFrame = xFrame;
+ this->server = server;
+
+ //Get xUICommands database (to retrieve labels, see FrameJob::getLabelFromCommandURL ())
+ Reference < XNameAccess > xNameAccess (xMSF->createInstance(OUString::createFromAscii("com.sun.star.frame.UICommandDescription")),
+ UNO_QUERY);
+ xMM = Reference < XModuleManager> (xMSF->createInstance(OUString::createFromAscii("com.sun.star.frame.ModuleManager")),
+ UNO_QUERY);
+ xNameAccess->getByName(xMM->identify(xFrame)) >>= xUICommands;
+
+ xdp = Reference < XDispatchProvider > (xFrame, UNO_QUERY);
+ xTrans = Reference < XURLTransformer > (xMSF->createInstance( rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )), UNO_QUERY);
+
+ xSL = (XStatusListener*)new MenuItemStatusListener (this);
+
+ // This initializes the shortcut database
+ getAcceleratorConfigurations (xFrame->getController()->getModel (), xMM);
+
+ // This information is needed for the dynamic submenus
+ xPCF = Reference < XMultiComponentFactory > (xMSF->createInstance(OUString::createFromAscii("com.sun.star.frame.PopupMenuControllerFactory")),
+ UNO_QUERY);
+
+
+ // This is a hash table that maps Command URLs to MenuItemInfo classes
+ // to cache command information
+ commandsInfo = g_hash_table_new_full (g_str_hash,
+ g_str_equal,
+ g_free,
+ destroy_menu_item_info);
+
+ // These are the arguments needed for the XPopupMenuController
+ args = Sequence < Any > (2);
+ PropertyValue item;
+
+ item.Name = OUString::createFromAscii("ModuleName");
+ item.Value <<= xMM->identify (xFrame);
+ args[0] <<= item;
+
+ item.Name = OUString::createFromAscii("Frame");
+ item.Value <<= xFrame;
+ args[1] <<= item;
+
+ root = NULL;
+ watcher_set = FALSE;
+
+ //This variable prevents the helper from being disconnected from the frame
+ //for special cases of component dettaching like print preview
+ blockDetach = FALSE;
+}
+
+void SAL_CALL
+FrameHelper::disposing (const EventObject& aEvent) throw (RuntimeException)
+{}
+
+FrameHelper::~FrameHelper()
+{
+ if (server)
+ g_object_unref (server);
+
+ if (watcher_set)
+ g_bus_unwatch_name (watcher);
+
+ g_hash_table_destroy (commandsInfo);
+}
+
+void
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list