diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2007-07-10 14:12:18 +0000 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2007-07-10 14:12:18 +0000 |
commit | bbcaab564931cd3b8e7ed601964d532bed635093 (patch) | |
tree | 260f8fee28286c93d8f5722da230e2a5350a5e8e /framework/source/uielement/menubarmanager.cxx | |
parent | 4c6afdec61729cd240824997025e75c79b474ad0 (diff) |
INTEGRATION: CWS fwk66 (1.46.34); FILE MERGED
2007/06/06 12:31:57 pb 1.46.34.4: fix: #i78020# linux warnings removed
2007/06/05 06:46:30 pb 1.46.34.3: RESYNC: (1.46-1.47); FILE MERGED
2007/06/04 11:22:21 cd 1.46.34.2: #i78020# Support merging to menu and toolbar for add-ons
2007/04/24 10:32:55 cd 1.46.34.1: #i76565# Fix crash with central add-ons popup menu
Diffstat (limited to 'framework/source/uielement/menubarmanager.cxx')
-rw-r--r-- | framework/source/uielement/menubarmanager.cxx | 256 |
1 files changed, 167 insertions, 89 deletions
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index d0585f75f3..9e0039a179 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -4,9 +4,9 @@ * * $RCSfile: menubarmanager.cxx,v $ * - * $Revision: 1.47 $ + * $Revision: 1.48 $ * - * last change: $Author: ihi $ $Date: 2007-04-16 16:46:23 $ + * last change: $Author: ihi $ $Date: 2007-07-10 15:12:18 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -188,10 +188,11 @@ #ifndef _RTL_LOGFILE_HXX_ #include <rtl/logfile.hxx> #endif - #ifndef INCLUDED_SVTOOLS_MISCOPT_HXX #include "svtools/miscopt.hxx" #endif +#include <classes/addonmenu.hxx> +#include <uielement/menubarmerger.hxx> //_________________________________________________________________________________________________________________ // namespace @@ -225,6 +226,8 @@ const sal_Int32 LEN_DESCRIPTOR_TYPE = 4; const sal_Int32 LEN_DESCRIPTOR_MODULEIDENTIFIER = 16; const sal_Int32 LEN_DESCRIPTOR_DISPATCHPROVIDER = 16; +const sal_uInt16 ADDONMENU_MERGE_ITEMID_START = 1500; + struct SystemMenuData { unsigned long nSize; // size in bytes of this structure @@ -313,9 +316,9 @@ MenuBarManager::MenuBarManager( // #110897# MenuBarManager::MenuBarManager( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, - const Reference< XFrame >& rFrame, - AddonMenu* pAddonMenu, - sal_Bool bDelete, + const Reference< XFrame >& rFrame, + AddonMenu* pAddonMenu, + sal_Bool bDelete, sal_Bool bDeleteChildren ) : ThreadHelpBase( &Application::GetSolarMutex() ) , OWeakObject() @@ -389,6 +392,7 @@ MenuBarManager::MenuBarManager( pMenuItemHandler->aTargetFrame = pAddonAttributes->aTargetFrame; } + pMenuItemHandler->aMenuItemURL = aItemCommand; m_aMenuItemHandlerVector.push_back( pMenuItemHandler ); } } @@ -404,9 +408,9 @@ MenuBarManager::MenuBarManager( // #110897# MenuBarManager::MenuBarManager( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, - const Reference< XFrame >& rFrame, - AddonPopupMenu* pAddonPopupMenu, - sal_Bool bDelete, + const Reference< XFrame >& rFrame, + AddonPopupMenu* pAddonPopupMenu, + sal_Bool bDelete, sal_Bool bDeleteChildren ) : ThreadHelpBase( &Application::GetSolarMutex() ) , OWeakObject() @@ -480,6 +484,7 @@ MenuBarManager::MenuBarManager( pMenuItemHandler->aTargetFrame = pAttributes->aTargetFrame; } + pMenuItemHandler->aMenuItemURL = aItemCommand; m_aMenuItemHandlerVector.push_back( pMenuItemHandler ); } } @@ -558,7 +563,7 @@ MenuBarManager::~MenuBarManager() // stop asynchronous settings timer m_xDeferedItemContainer.clear(); m_aAsyncSettingsTimer.Stop(); - + DBG_ASSERT( OWeakObject::m_refCount == 0, "Who wants to delete an object with refcount > 0!" ); } @@ -572,7 +577,8 @@ void MenuBarManager::Destroy() // release defered item container reference m_aAsyncSettingsTimer.Stop(); m_xDeferedItemContainer.clear(); - + RemoveListener(); + std::vector< MenuItemHandler* >::iterator p; for ( p = m_aMenuItemHandlerVector.begin(); p != m_aMenuItemHandlerVector.end(); p++ ) { @@ -602,7 +608,7 @@ void SAL_CALL MenuBarManager::dispose() throw( RuntimeException ) { ResetableGuard aGuard( m_aLock ); - RemoveListener(); +// RemoveListener(); Destroy(); m_bDisposed = sal_True; @@ -856,7 +862,7 @@ void MenuBarManager::RemoveListener() Reference< XMultiServiceFactory > xServiceManager = getServiceFactory(); if ( xServiceManager.is() ) { - Reference< XURLTransformer > xTrans( xServiceManager->createInstance( + Reference< XURLTransformer > xTrans( xServiceManager->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY ); std::vector< MenuItemHandler* >::iterator p; @@ -906,7 +912,7 @@ void MenuBarManager::RemoveListener() catch ( Exception& ) { } - + // Release references to controller and popup menu pItemHandler->xPopupMenuController.clear(); pItemHandler->xPopupMenu.clear(); @@ -961,7 +967,7 @@ void SAL_CALL MenuBarManager::disposing( const EventObject& Source ) throw ( Run Reference< XMultiServiceFactory > xServiceManager( getServiceFactory() ); if ( xServiceManager.is() ) { - Reference< XURLTransformer > xTrans( xServiceManager->createInstance( + Reference< XURLTransformer > xTrans( xServiceManager->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY ); xTrans->parseStrict( aTargetURL ); @@ -1495,7 +1501,7 @@ sal_Bool MenuBarManager::MustBeHidden( PopupMenu* pPopupMenu, const Reference< X sal_uInt16 nCount = pPopupMenu->GetItemCount(); sal_uInt16 nHideCount( 0 ); - + for ( sal_uInt16 i = 0; i < nCount; i++ ) { sal_uInt16 nId = pPopupMenu->GetItemId( i ); @@ -1503,7 +1509,7 @@ sal_Bool MenuBarManager::MustBeHidden( PopupMenu* pPopupMenu, const Reference< X { PopupMenu* pSubPopupMenu = pPopupMenu->GetPopupMenu( nId ); if ( pSubPopupMenu ) - { + { if ( MustBeHidden( pSubPopupMenu, rTransformer )) { pPopupMenu->HideItem( nId ); @@ -1514,7 +1520,7 @@ sal_Bool MenuBarManager::MustBeHidden( PopupMenu* pPopupMenu, const Reference< X { aTargetURL.Complete = pPopupMenu->GetItemCommand( nId ); rTransformer->parseStrict( aTargetURL ); - + if ( aCmdOptions.Lookup( SvtCommandOptions::CMDOPTION_DISABLED, aTargetURL.Path )) ++nHideCount; } @@ -1657,7 +1663,6 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF m_bRetrieveImages = sal_False; sal_Int32 nAddonsURLPrefixLength = ADDONSPOPUPMENU_URL_PREFIX.getLength(); - ::std::vector< USHORT > aQueryLabelItemIdVector; // Add root as ui configuration listener RetrieveImageManagers(); @@ -1710,7 +1715,7 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF } if (( pMenu->IsMenuBar() || bAccessibilityEnabled ) && - ( pMenu->GetItemText( nItemId ).Len() == 0 )) + ( pMenu->GetItemText( nItemId ).Len() == 0 )) { if ( aItemCommand.getLength() > 0 ) pMenu->SetItemText( nItemId, RetrieveLabelFromCommand( aItemCommand )); @@ -1756,7 +1761,7 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF ( aItemCommand.indexOf( ADDONSPOPUPMENU_URL_PREFIX ) == 0 )) { // A special addon popup menu, must be created with a different ctor - // #110897# + // #110897# MenuBarManager* pSubMenuManager = new MenuBarManager( getServiceFactory(), rFrame, (AddonPopupMenu *)pPopup, bDeleteChildren, bDeleteChildren ); Reference< XStatusListener > xSubMenuManager( static_cast< OWeakObject *>( pSubMenuManager ), UNO_QUERY ); @@ -1775,44 +1780,22 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF else { Reference< XDispatchProvider > xPopupMenuDispatchProvider( rDispatchProvider ); - + // Retrieve possible attributes struct MenuConfiguration::Attributes* pAttributes = (MenuConfiguration::Attributes *)(pMenu->GetUserValue( nItemId )); if ( pAttributes ) xPopupMenuDispatchProvider = pAttributes->xDispatchProvider; - + // Check if this is the help menu. Add menu item if needed if ( nItemId == SID_HELPMENU || aItemCommand == aSlotHelpMenu || aItemCommand == aCmdHelpMenu ) + { + // Check if this is the help menu. Add menu item if needed CheckAndAddMenuExtension( pPopup ); - - // #110897# MenuBarManager* pSubMenuManager = new MenuBarManager( rFrame, pPopupMenu, bDeleteChildren, bDeleteChildren ); - MenuBarManager* pSubMenuMgr = new MenuBarManager( getServiceFactory(), - rFrame, - xPopupMenuDispatchProvider, - aModuleIdentifier, - pPopup, - bDeleteChildren, - bDeleteChildren ); - Reference< XStatusListener > xSubMenuMgr( static_cast< OWeakObject *>( pSubMenuMgr ), UNO_QUERY ); - rFrame->addFrameActionListener( Reference< XFrameActionListener >( xSubMenuMgr, UNO_QUERY )); - - // store menu item command as we later have to know which menu is active (see Activate handler) - pSubMenuMgr->m_aMenuItemCommand = aItemCommand; - - MenuItemHandler* pMenuItemHdl = new MenuItemHandler( - nItemId, - xSubMenuMgr, - xDispatch ); - pMenuItemHdl->aMenuItemURL = aItemCommand; - m_aMenuItemHandlerVector.push_back( pMenuItemHdl ); - - if ( pMenu->GetItemText( nItemId ).Len() == 0 ) - aQueryLabelItemIdVector.push_back( nItemId ); - - // Create addon popup menu if there exist elements and this is the tools popup menu - if (( nItemId == SID_ADDONLIST || aItemCommand == aSlotSpecialToolsMenu || aItemCommand == aCmdToolsMenu ) && - AddonMenuManager::HasAddonMenuElements() ) + } + else if (( nItemId == SID_ADDONLIST || aItemCommand == aSlotSpecialToolsMenu || aItemCommand == aCmdToolsMenu ) && + AddonMenuManager::HasAddonMenuElements() ) { + // Create addon popup menu if there exist elements and this is the tools popup menu USHORT nCount = 0; AddonMenu* pSubMenu = AddonMenuManager::CreateAddonMenu( rFrame ); if ( pSubMenu && ( pSubMenu->GetItemCount() > 0 )) @@ -1826,11 +1809,21 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF pPopup->SetPopupMenu( ITEMID_ADDONLIST, pSubMenu ); // Set item command for popup menu to enable it for GetImageFromURL - aItemCommand = aSlotString; - aItemCommand += ::rtl::OUString::valueOf( (sal_Int32)ITEMID_ADDONLIST ); - pPopup->SetItemCommand( ITEMID_ADDONLIST, aItemCommand ); + ::rtl::OUString aNewItemCommand( aSlotString ); + aNewItemCommand += ::rtl::OUString::valueOf( (sal_Int32)ITEMID_ADDONLIST ); + pPopup->SetItemCommand( ITEMID_ADDONLIST, aNewItemCommand ); + } + else + delete pSubMenu; + } - // #110897# + if ( nItemId == ITEMID_ADDONLIST ) + { + // Create control structure within the "Tools" sub menu for the Add-Ons popup menu + // #110897# MenuBarManager* pSubMenuManager = new MenuBarManager( rFrame, pSubMenu, sal_True, sal_False ); + AddonMenu* pSubMenu = dynamic_cast< AddonMenu* >( pPopup ); + if ( pSubMenu ) + { MenuBarManager* pSubMenuManager = new MenuBarManager( getServiceFactory(), rFrame, pSubMenu, sal_True, sal_False ); Reference< XStatusListener > xSubMenuManager( static_cast< OWeakObject *>( pSubMenuManager ), UNO_QUERY ); @@ -1841,20 +1834,34 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF xSubMenuManager, xDispatch ); pMenuItemHandler->aMenuItemURL = aItemCommand; - if ( pMenu->GetItemText( nItemId ).Len() == 0 ) - aQueryLabelItemIdVector.push_back( nItemId ); m_aMenuItemHandlerVector.push_back( pMenuItemHandler ); // Set image for the addon popup menu item if ( m_bShowMenuImages && !pPopup->GetItemImage( ITEMID_ADDONLIST )) { - Image aImage = GetImageFromURL( m_xFrame, aItemCommand, FALSE, m_bWasHiContrast ); + Reference< XFrame > xTemp( rFrame ); + Image aImage = GetImageFromURL( xTemp, aItemCommand, FALSE, m_bWasHiContrast ); if ( !!aImage ) pPopup->SetItemImage( ITEMID_ADDONLIST, aImage ); } } - else - delete pSubMenu; + } + else + { + // #110897# MenuBarManager* pSubMenuManager = new MenuBarManager( rFrame, pPopupMenu, bDeleteChildren, bDeleteChildren ); + MenuBarManager* pSubMenuMgr = new MenuBarManager( getServiceFactory(), rFrame, rDispatchProvider, aModuleIdentifier, pPopup, bDeleteChildren, bDeleteChildren ); + Reference< XStatusListener > xSubMenuMgr( static_cast< OWeakObject *>( pSubMenuMgr ), UNO_QUERY ); + rFrame->addFrameActionListener( Reference< XFrameActionListener >( xSubMenuMgr, UNO_QUERY )); + + // store menu item command as we later have to know which menu is active (see Activate handler) + pSubMenuMgr->m_aMenuItemCommand = aItemCommand; + + MenuItemHandler* pMenuItemHdl = new MenuItemHandler( + nItemId, + xSubMenuMgr, + xDispatch ); + pMenuItemHdl->aMenuItemURL = aItemCommand; + m_aMenuItemHandlerVector.push_back( pMenuItemHdl ); } } } @@ -1916,8 +1923,6 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF } m_aMenuItemHandlerVector.push_back( pItemHandler ); - if ( pMenu->GetItemText( nItemId ).Len() == 0 ) - aQueryLabelItemIdVector.push_back( nItemId ); } } @@ -1986,7 +1991,7 @@ void MenuBarManager::RetrieveShortcuts( std::vector< MenuItemHandler* >& aMenuSh { } } - + if ( m_bModuleIdentified ) { Reference< XAcceleratorConfiguration > xDocAccelCfg( m_xDocAcceleratorManager ); @@ -2118,16 +2123,21 @@ void MenuBarManager::RetrieveImageManagers() } } -void MenuBarManager::FillMenuWithConfiguration( - USHORT& nId, - Menu* pMenu, - const ::rtl::OUString& rModuleIdentifier, +void MenuBarManager::FillMenuWithConfiguration( + USHORT& nId, + Menu* pMenu, + const ::rtl::OUString& rModuleIdentifier, const Reference< XIndexAccess >& rItemContainer, const Reference< XURLTransformer >& rTransformer ) { Reference< XDispatchProvider > xEmptyDispatchProvider; MenuBarManager::FillMenu( nId, pMenu, rModuleIdentifier, rItemContainer, xEmptyDispatchProvider ); + // Merge add-on menu entries into the menu bar + MenuBarManager::MergeAddonMenus( static_cast< Menu* >( pMenu ), + AddonsOptions().GetMergeMenuInstructions(), + rModuleIdentifier ); + sal_Bool bHasDisabledEntries = SvtCommandOptions().HasEntries( SvtCommandOptions::CMDOPTION_DISABLED ); if ( bHasDisabledEntries ) { @@ -2139,7 +2149,7 @@ void MenuBarManager::FillMenuWithConfiguration( { PopupMenu* pPopupMenu = pMenu->GetPopupMenu( nID ); if ( pPopupMenu ) - { + { if ( MustBeHidden( pPopupMenu, rTransformer )) pMenu->HideItem( nId ); } @@ -2148,10 +2158,10 @@ void MenuBarManager::FillMenuWithConfiguration( } } -void MenuBarManager::FillMenu( - USHORT& nId, - Menu* pMenu, - const rtl::OUString& rModuleIdentifier, +void MenuBarManager::FillMenu( + USHORT& nId, + Menu* pMenu, + const rtl::OUString& rModuleIdentifier, const Reference< XIndexAccess >& rItemContainer, const Reference< XDispatchProvider >& rDispatchProvider ) { @@ -2174,25 +2184,25 @@ void MenuBarManager::FillMenu( for ( int i = 0; i < aProp.getLength(); i++ ) { rtl::OUString aPropName = aProp[i].Name; - if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_COMMANDURL, + if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_COMMANDURL, LEN_DESCRIPTOR_COMMANDURL )) aProp[i].Value >>= aCommandURL; - else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_HELPURL, + else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_HELPURL, LEN_DESCRIPTOR_HELPURL )) aProp[i].Value >>= aHelpURL; - else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_CONTAINER, + else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_CONTAINER, LEN_DESCRIPTOR_CONTAINER )) aProp[i].Value >>= xIndexContainer; - else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_LABEL, + else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_LABEL, LEN_DESCRIPTOR_LABEL )) aProp[i].Value >>= aLabel; - else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_TYPE, + else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_TYPE, LEN_DESCRIPTOR_TYPE )) aProp[i].Value >>= nType; - else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_MODULEIDENTIFIER, + else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_MODULEIDENTIFIER, LEN_DESCRIPTOR_MODULEIDENTIFIER )) aProp[i].Value >>= aModuleIdentifier; - else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_DISPATCHPROVIDER, + else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_DISPATCHPROVIDER, LEN_DESCRIPTOR_DISPATCHPROVIDER )) aProp[i].Value >>= xDispatchProvider; } @@ -2243,6 +2253,60 @@ void MenuBarManager::FillMenu( } } +void MenuBarManager::MergeAddonMenus( + Menu* pMenuBar, + const MergeMenuInstructionContainer& aMergeInstructionContainer, + const ::rtl::OUString& rModuleIdentifier ) +{ + // set start value for the item ID for the new addon menu items + sal_uInt16 nItemId = ADDONMENU_MERGE_ITEMID_START; + + const sal_uInt32 nCount = aMergeInstructionContainer.size(); + for ( sal_uInt32 i = 0; i < nCount; i++ ) + { + const MergeMenuInstruction& rMergeInstruction = aMergeInstructionContainer[i]; + + if ( MenuBarMerger::IsCorrectContext( rMergeInstruction.aMergeContext, rModuleIdentifier )) + { + ::std::vector< ::rtl::OUString > aMergePath; + + // retrieve the merge path from the merge point string + MenuBarMerger::RetrieveReferencePath( rMergeInstruction.aMergePoint, aMergePath ); + + // convert the sequence/sequence property value to a more convenient vector<> + AddonMenuContainer aMergeMenuItems; + MenuBarMerger::GetSubMenu( rMergeInstruction.aMergeMenu, aMergeMenuItems ); + + // try to find the reference point for our merge operation + Menu* pMenu = pMenuBar; + ReferencePathInfo aResult = MenuBarMerger::FindReferencePath( aMergePath, pMenu ); + + if ( aResult.eResult == RP_OK ) + { + // normal merge operation + MenuBarMerger::ProcessMergeOperation( aResult.pPopupMenu, + aResult.nPos, + nItemId, + rMergeInstruction.aMergeCommand, + rMergeInstruction.aMergeCommandParameter, + rModuleIdentifier, + aMergeMenuItems ); + } + else + { + // fallback + MenuBarMerger::ProcessFallbackOperation( aResult, + nItemId, + rMergeInstruction.aMergeCommand, + rMergeInstruction.aMergeFallback, + aMergePath, + rModuleIdentifier, + aMergeMenuItems ); + } + } + } +} + void MenuBarManager::SetItemContainer( const Reference< XIndexAccess >& rItemContainer ) { RTL_LOGFILE_CONTEXT( aLog, "framework (cd100003) ::MenuBarManager::SetItemContainer" ); @@ -2251,6 +2315,21 @@ void MenuBarManager::SetItemContainer( const Reference< XIndexAccess >& rItemCon Reference< XFrame > xFrame = m_xFrame; + if ( !m_bModuleIdentified ) + { + m_bModuleIdentified = sal_True; + Reference< XModuleManager > xModuleManager; + xModuleManager = Reference< XModuleManager >( getServiceFactory()->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY_THROW ); + + try + { + m_aModuleIdentifier = xModuleManager->identify( xFrame ); + } + catch( Exception& ) + { + } + } + // Clear MenuBarManager structures { vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); @@ -2277,17 +2356,16 @@ void MenuBarManager::SetItemContainer( const Reference< XIndexAccess >& rItemCon m_pVCLMenu->Clear(); USHORT nId = 1; - rtl::OUString aModuleIdentifier; // Fill menu bar with container contents - Reference< XURLTransformer > xTrans( getServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + Reference< XURLTransformer > xTrans( getServiceFactory()->createInstance( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY ); - FillMenuWithConfiguration( nId, (Menu *)m_pVCLMenu, aModuleIdentifier, rItemContainer, xTrans ); + FillMenuWithConfiguration( nId, (Menu *)m_pVCLMenu, m_aModuleIdentifier, rItemContainer, xTrans ); // Refill menu manager again Reference< XDispatchProvider > xDispatchProvider; - FillMenuManager( m_pVCLMenu, xFrame, xDispatchProvider, aModuleIdentifier, sal_False, sal_True ); + FillMenuManager( m_pVCLMenu, xFrame, xDispatchProvider, m_aModuleIdentifier, sal_False, sal_True ); // add itself as frame action listener m_xFrame->addFrameActionListener( Reference< XFrameActionListener >( static_cast< OWeakObject* >( this ), UNO_QUERY )); @@ -2307,7 +2385,7 @@ void MenuBarManager::GetPopupController( PopupControllerCache& rPopupController if ( pItemHandler->xPopupMenuController.is() ) { Reference< XDispatchProvider > xDispatchProvider( pItemHandler->xPopupMenuController, UNO_QUERY ); - + PopupControllerEntry aPopupControllerEntry; aPopupControllerEntry.m_xDispatchProvider = xDispatchProvider; @@ -2316,9 +2394,9 @@ void MenuBarManager::GetPopupController( PopupControllerCache& rPopupController sal_Int32 nSchemePart( 0 ); rtl::OUString aMainURL( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.popup:" )); rtl::OUString aMenuURL( pItemHandler->aMenuItemURL ); - + nSchemePart = aMenuURL.indexOf( ':' ); - if (( nSchemePart > 0 ) && + if (( nSchemePart > 0 ) && ( aMenuURL.getLength() > ( nSchemePart+1 ))) { nQueryPart = aMenuURL.indexOf( '?', nSchemePart ); @@ -2326,8 +2404,8 @@ void MenuBarManager::GetPopupController( PopupControllerCache& rPopupController aMainURL += aMenuURL.copy( nSchemePart, nQueryPart-nSchemePart ); else if ( nQueryPart == -1 ) aMainURL += aMenuURL.copy( nSchemePart+1 ); - - rPopupController.insert( PopupControllerCache::value_type( + + rPopupController.insert( PopupControllerCache::value_type( aMainURL, aPopupControllerEntry )); } } |