summaryrefslogtreecommitdiff
path: root/vcl/unx/gtk/window
diff options
context:
space:
mode:
authorAntonio Fernandez <antonio.fernandez@aentos.es>2012-10-15 16:03:26 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2012-11-14 13:52:56 +0100
commitb561590534afc4152282db44c24cb4788bd03730 (patch)
treefdc006b2960da5a725869a6b2ce8ae70cd31cb56 /vcl/unx/gtk/window
parent097e8668a416362ed5f80c0d33888678da416f5d (diff)
Added a hack to make "Slide Show" menu item on "Slide Show" menu work.
Change-Id: I6c3865227702325e7f1545be893eb05b19c2e09f
Diffstat (limited to 'vcl/unx/gtk/window')
-rw-r--r--vcl/unx/gtk/window/gtksalmenu.cxx37
1 files changed, 26 insertions, 11 deletions
diff --git a/vcl/unx/gtk/window/gtksalmenu.cxx b/vcl/unx/gtk/window/gtksalmenu.cxx
index 13afb2bf912a..2dfed291eed8 100644
--- a/vcl/unx/gtk/window/gtksalmenu.cxx
+++ b/vcl/unx/gtk/window/gtksalmenu.cxx
@@ -39,17 +39,29 @@
static sal_Bool bMenuVisibility = sal_False;
+/*
+ * This function generates an alternative command name to avoid name collisions
+ * or to give a valid command name to certain menu items.
+ */
static gchar* GetCommandForSpecialItem( GtkSalMenuItem* pSalMenuItem )
{
gchar* aCommand = NULL;
sal_uInt16 nId = pSalMenuItem->mnId;
+ Menu* pMenu = pSalMenuItem->mpVCLMenu;
// If item belongs to window list, generate a command with "window-(id)" format.
if ( ( nId >= START_ITEMID_WINDOWLIST ) && ( nId <= END_ITEMID_WINDOWLIST ) )
- {
aCommand = g_strdup_printf( "window-%d", nId );
- }
+ else
+ if ( pMenu )
+ {
+ rtl::OUString aMenuCommand = pMenu->GetItemCommand( nId );
+ MenuItemBits nBits = pMenu->GetItemBits( nId );
+
+ if ( aMenuCommand.equalsAscii(".uno:Presentation") && nBits == 0 )
+ aCommand = g_strdup(".uno:Presentation2");
+ }
return aCommand;
}
@@ -303,7 +315,8 @@ void GtkSalMenu::UpdateNativeMenu()
// Convert internal values to native values.
gboolean bChecked = ( itemChecked == sal_True ) ? TRUE : FALSE;
gboolean bEnabled = ( itemEnabled == sal_True ) ? TRUE : FALSE;
- gchar* aNativeCommand = g_strdup( rtl::OUStringToOString( aCommand, RTL_TEXTENCODING_UTF8 ).getStr() );
+// gchar* aNativeCommand = g_strdup( rtl::OUStringToOString( aCommand, RTL_TEXTENCODING_UTF8 ).getStr() );
+ gchar* aNativeCommand = GetCommandForSpecialItem( pSalMenuItem );
// Store current item command in command list.
gchar *aCurrentCommand = g_lo_menu_get_command_from_item_in_section( pLOMenu, nSection, nItemPos );
@@ -316,15 +329,17 @@ void GtkSalMenu::UpdateNativeMenu()
NativeSetAccelerator( nSection, nItemPos, nAccelKey, nAccelKey.GetName( GetFrame()->GetWindow() ) );
// Some items are special, so they have different commands.
- if ( g_strcmp0( aNativeCommand, "" ) == 0 )
+// if ( g_strcmp0( aNativeCommand, "" ) == 0 )
+ if ( !aNativeCommand )
{
- gchar *aSpecialItemCmd = GetCommandForSpecialItem( pSalMenuItem );
-
- if ( aSpecialItemCmd != NULL )
- {
- g_free( aNativeCommand );
- aNativeCommand = aSpecialItemCmd;
- }
+// gchar *aSpecialItemCmd = GetCommandForSpecialItem( pSalMenuItem );
+ aNativeCommand = g_strdup( rtl::OUStringToOString( aCommand, RTL_TEXTENCODING_UTF8 ).getStr() );
+
+// if ( aSpecialItemCmd != NULL )
+// {
+// g_free( aNativeCommand );
+// aNativeCommand = aSpecialItemCmd;
+// }
}
if ( g_strcmp0( aNativeCommand, "" ) != 0 && pSalMenuItem->mpSubMenu == NULL )