From 814ae4799fdfe82e5c83476285611789927d2c66 Mon Sep 17 00:00:00 2001 From: Kurt Zenker Date: Wed, 25 Feb 2004 16:43:47 +0000 Subject: INTEGRATION: CWS layoutmanager (1.4.60); FILE MERGED 2004/01/29 19:13:48 cd 1.4.60.2: RESYNC: (1.4-1.5); FILE MERGED 2004/01/28 16:25:46 cd 1.4.60.1: #111899# Adapt code for new index container implementation --- framework/source/classes/addonmenu.cxx | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'framework/source/classes/addonmenu.cxx') diff --git a/framework/source/classes/addonmenu.cxx b/framework/source/classes/addonmenu.cxx index 33a10f02330b..9f4fa2f86a74 100644 --- a/framework/source/classes/addonmenu.cxx +++ b/framework/source/classes/addonmenu.cxx @@ -2,9 +2,9 @@ * * $RCSfile: addonmenu.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: vg $ $Date: 2004-01-06 16:58:51 $ + * last change: $Author: kz $ $Date: 2004-02-25 17:43:47 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -254,12 +254,36 @@ USHORT AddonMenuManager::GetNextPos( USHORT nPos ) return ( nPos == MENU_APPEND ) ? MENU_APPEND : ( nPos+1 ); } + +static USHORT FindMenuId( Menu* pMenu, const String aCommand ) +{ + USHORT nPos = 0; + String aCmd; + for ( nPos = 0; nPos < pMenu->GetItemCount(); nPos++ ) + { + USHORT nId = pMenu->GetItemId( nPos ); + aCmd = pMenu->GetItemCommand( nId ); + if ( aCmd == aCommand ) + return nId; + } + + return USHRT_MAX; +} + + // Merge the Add-Ons help menu items into the given menu bar at a defined pos void AddonMenuManager::MergeAddonHelpMenu( Reference< XFrame >& rFrame, MenuBar* pMergeMenuBar ) { if ( pMergeMenuBar ) { PopupMenu* pHelpMenu = pMergeMenuBar->GetPopupMenu( SID_HELPMENU ); + if ( !pHelpMenu ) + { + USHORT nId = FindMenuId( pMergeMenuBar, String::CreateFromAscii( ".uno:HelpMenu" )); + if ( nId != USHRT_MAX ) + pHelpMenu = pMergeMenuBar->GetPopupMenu( nId ); + } + if ( pHelpMenu ) { // Add-Ons help menu items should be inserted after the "registration" menu item @@ -270,6 +294,9 @@ void AddonMenuManager::MergeAddonHelpMenu( Reference< XFrame >& rFrame, MenuBar* USHORT nUniqueMenuId = ADDONMENU_ITEMID_START; AddonsOptions aOptions; + if ( nRegPos == USHRT_MAX ) + nRegPos = FindMenuId( pHelpMenu, String::CreateFromAscii( ".uno:OnlineRegistrationDlg" )); + Sequence< Sequence< PropertyValue > > aAddonSubMenu; const Sequence< Sequence< PropertyValue > >& rAddonHelpMenuEntries = aOptions.GetAddonsHelpMenu(); -- cgit