diff options
author | Kurt Zenker <kz@openoffice.org> | 2004-02-25 16:43:47 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2004-02-25 16:43:47 +0000 |
commit | 814ae4799fdfe82e5c83476285611789927d2c66 (patch) | |
tree | 33f9710c2e5bfc9551d925f596fe9e82ee4bc420 /framework/source/classes/addonmenu.cxx | |
parent | e572c2c7bb19f197272c322112e2c07b9af16bef (diff) |
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
Diffstat (limited to 'framework/source/classes/addonmenu.cxx')
-rw-r--r-- | framework/source/classes/addonmenu.cxx | 31 |
1 files changed, 29 insertions, 2 deletions
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(); |