From db401862de80bb4caa90db55dec5abc9cf7f3f7f Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Mon, 15 Oct 2007 16:37:14 +0000 Subject: INTEGRATION: CWS c05v005_SRC680 (1.12.78); FILE MERGED 2007/09/13 07:01:58 cd 1.12.78.1: #150543# Use 'Registration' and 'About' as reference points for add-on help menu merging --- framework/source/classes/addonmenu.cxx | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'framework/source/classes/addonmenu.cxx') diff --git a/framework/source/classes/addonmenu.cxx b/framework/source/classes/addonmenu.cxx index 9f1db8beec18..3051bb2418f9 100644 --- a/framework/source/classes/addonmenu.cxx +++ b/framework/source/classes/addonmenu.cxx @@ -4,9 +4,9 @@ * * $RCSfile: addonmenu.cxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: ihi $ $Date: 2007-04-16 16:34:34 $ + * last change: $Author: ihi $ $Date: 2007-10-15 17:37:14 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -263,7 +263,11 @@ void AddonMenuManager::MergeAddonHelpMenu( const Reference< XFrame >& rFrame, Me if ( pHelpMenu ) { + static const char REFERENCECOMMAND_AFTER[] = ".uno:OnlineRegistrationDlg"; + static const char REFERENCECOMMAND_BEFORE[] = ".uno:About"; + // Add-Ons help menu items should be inserted after the "registration" menu item + bool bAddAfter = true; USHORT nItemCount = pHelpMenu->GetItemCount(); USHORT nRegPos = pHelpMenu->GetItemPos( SID_ONLINE_REGISTRATION ); USHORT nInsPos = nRegPos; @@ -274,15 +278,25 @@ void AddonMenuManager::MergeAddonHelpMenu( const Reference< XFrame >& rFrame, Me if ( nRegPos == USHRT_MAX ) { // try to detect the online registration dialog menu item with the command URL - USHORT nId = FindMenuId( pHelpMenu, String::CreateFromAscii( ".uno:OnlineRegistrationDlg" )); - nRegPos = pHelpMenu->GetItemPos( nId ); - nInsPos = nRegPos; + USHORT nId = FindMenuId( pHelpMenu, String::CreateFromAscii( REFERENCECOMMAND_AFTER )); + nRegPos = pHelpMenu->GetItemPos( nId ); + nInsPos = nRegPos; + } + + if ( nRegPos == USHRT_MAX ) + { + // second try: + // try to detect the about menu item with the command URL + USHORT nId = FindMenuId( pHelpMenu, String::CreateFromAscii( REFERENCECOMMAND_BEFORE )); + nRegPos = pHelpMenu->GetItemPos( nId ); + nInsPos = nRegPos; + bAddAfter = false; } Sequence< Sequence< PropertyValue > > aAddonSubMenu; const Sequence< Sequence< PropertyValue > >& rAddonHelpMenuEntries = aOptions.GetAddonsHelpMenu(); - nInsPos = AddonMenuManager::GetNextPos( nInsPos ); + nInsPos = bAddAfter ? AddonMenuManager::GetNextPos( nInsPos ) : nInsPos; if ( nInsPos < nItemCount && pHelpMenu->GetItemType( nInsPos ) != MENUITEM_SEPARATOR ) nInsSepAfterPos = nInsPos; -- cgit