View | Details | Raw Unified | Return to issue 86528
Collapse All | Expand All

(-)framework/inc/framework/addonmenu.hxx (-6 / +9 lines)
Lines 30-35 Link Here
30
#include <com/sun/star/frame/XFrame.hpp>
30
#include <com/sun/star/frame/XFrame.hpp>
31
#include <com/sun/star/beans/PropertyValue.hpp>
31
#include <com/sun/star/beans/PropertyValue.hpp>
32
#include <com/sun/star/uno/Sequence.hxx>
32
#include <com/sun/star/uno/Sequence.hxx>
33
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
33
34
34
//_________________________________________________________________________________________________________________
35
//_________________________________________________________________________________________________________________
35
//	includes of other projects
36
//	includes of other projects
Lines 92-114 Link Here
92
        static sal_Bool   IsAddonMenuId( sal_uInt16 nId ) { return (( nId >= ADDONMENU_ITEMID_START ) && ( nId < ADDONMENU_ITEMID_END )); }
93
        static sal_Bool   IsAddonMenuId( sal_uInt16 nId ) { return (( nId >= ADDONMENU_ITEMID_START ) && ( nId < ADDONMENU_ITEMID_END )); }
93
94
94
        // Check if the context string matches the provided xModel context
95
        // Check if the context string matches the provided xModel context
95
        static sal_Bool	  IsCorrectContext( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rModel, const rtl::OUString& aContext );
96
        static sal_Bool	  IsCorrectContext( const ::rtl::OUString& rModuleIdentifier, const rtl::OUString& aContext );
96
97
97
        // Factory method to create different Add-On menu types
98
        // Factory method to create different Add-On menu types
98
        static PopupMenu* CreatePopupMenuType( MenuType eMenuType, const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame );
99
        static PopupMenu* CreatePopupMenuType( MenuType eMenuType, const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame );
99
100
100
        // Create the Add-Ons menu
101
        // Create the Add-Ons menu
101
        static AddonMenu* CreateAddonMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
102
        static AddonMenu* CreateAddonMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, 
103
                                           const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager );
102
104
103
		// Merge the Add-Ons help menu items into the given menu bar at a defined pos
105
		// Merge the Add-Ons help menu items into the given menu bar at a defined pos
104
		static void		  MergeAddonHelpMenu( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame,
106
		static void		  MergeAddonHelpMenu( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame,
105
											  MenuBar* pMergeMenuBar );
107
											  MenuBar* pMergeMenuBar, 
108
                                              const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager );
106
109
107
		// Merge the addon popup menus into the given menu bar at the provided pos.
110
		// Merge the addon popup menus into the given menu bar at the provided pos.
108
		static void       MergeAddonPopupMenus( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame,
111
		static void       MergeAddonPopupMenus( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame,
109
											    const com::sun::star::uno::Reference< com::sun::star::frame::XModel >& rModel,
110
												sal_uInt16	 nMergeAtPos,
112
												sal_uInt16	 nMergeAtPos,
111
											    MenuBar* pMergeMenuBar );
113
											    MenuBar* pMergeMenuBar, 
114
                                                const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager );
112
115
113
        // Returns the next position to insert a menu item/sub menu
116
        // Returns the next position to insert a menu item/sub menu
114
        static sal_uInt16     GetNextPos( sal_uInt16 nPos );
117
        static sal_uInt16     GetNextPos( sal_uInt16 nPos );
Lines 120-126 Link Here
120
                                     sal_uInt16&     nUniqueMenuId,
123
                                     sal_uInt16&     nUniqueMenuId,
121
                                     com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > > aAddonMenuDefinition, 
124
                                     com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > > aAddonMenuDefinition, 
122
                                     const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame,
125
                                     const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame,
123
                                     const com::sun::star::uno::Reference< com::sun::star::frame::XModel >& rModel );
126
                                     const ::rtl::OUString& rModuleIdentifier );
124
127
125
        // Retrieve the menu entry property values from a sequence
128
        // Retrieve the menu entry property values from a sequence
126
        static void       GetMenuEntry( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rAddonMenuEntry,
129
        static void       GetMenuEntry( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rAddonMenuEntry,
(-)framework/source/fwe/classes/addonmenu.cxx (-44 / +44 lines)
Lines 33-38 Link Here
33
#include <macros/debug/assertion.hxx>
33
#include <macros/debug/assertion.hxx>
34
#include <framework/imageproducer.hxx>
34
#include <framework/imageproducer.hxx>
35
#include <framework/menuconfiguration.hxx>
35
#include <framework/menuconfiguration.hxx>
36
#include <services.h>
36
37
37
//_________________________________________________________________________________________________________________
38
//_________________________________________________________________________________________________________________
38
//	interface includes
39
//	interface includes
Lines 40-46 Link Here
40
#include <com/sun/star/uno/Reference.hxx>
41
#include <com/sun/star/uno/Reference.hxx>
41
#include <com/sun/star/util/URL.hpp>
42
#include <com/sun/star/util/URL.hpp>
42
#include <com/sun/star/util/XURLTransformer.hpp>
43
#include <com/sun/star/util/XURLTransformer.hpp>
43
#include <com/sun/star/lang/XServiceInfo.hpp>
44
#include <com/sun/star/frame/XModuleManager.hpp>
44
45
45
//_________________________________________________________________________________________________________________
46
//_________________________________________________________________________________________________________________
46
//	includes of other projects
47
//	includes of other projects
Lines 108-125 Link Here
108
109
109
// ------------------------------------------------------------------------
110
// ------------------------------------------------------------------------
110
111
111
static Reference< XModel > GetModelFromFrame( const Reference< XFrame >& rFrame )
112
static ::rtl::OUString GetModuleIdentifier( const Reference< XMultiServiceFactory >& rServiceManager, 
113
                                            const Reference< XFrame >& rFrame )
112
{
114
{
113
    // Query for the model to get check the context information
115
    Reference< XModuleManager > xModuleManager( rServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY );
114
    Reference< XModel > xModel;
116
    if ( xModuleManager.is() )
115
	if ( rFrame.is() )
117
    {
116
	{
118
        try
117
	    Reference< XController > xController( rFrame->getController(), UNO_QUERY );
119
        {
118
	    if ( xController.is() )
120
            return xModuleManager->identify( rFrame );
119
	        xModel = xController->getModel();
121
        }
120
	}
122
        catch ( Exception& )
121
123
        {
122
    return xModel;
124
        }
125
    }
126
    return ::rtl::OUString();
123
}
127
}
124
128
125
// ------------------------------------------------------------------------
129
// ------------------------------------------------------------------------
Lines 146-152 Link Here
146
}
150
}
147
151
148
// Create the Add-Ons menu
152
// Create the Add-Ons menu
149
AddonMenu* AddonMenuManager::CreateAddonMenu( const Reference< XFrame >& rFrame )
153
AddonMenu* AddonMenuManager::CreateAddonMenu( const Reference< XFrame >& rFrame, 
154
                                              const Reference< XMultiServiceFactory >& rServiceManager )
150
{
155
{
151
    AddonsOptions aOptions;
156
    AddonsOptions aOptions;
152
    AddonMenu*  pAddonMenu      = NULL;
157
    AddonMenu*  pAddonMenu      = NULL;
Lines 156-163 Link Here
156
	if ( rAddonMenuEntries.getLength() > 0 )
161
	if ( rAddonMenuEntries.getLength() > 0 )
157
	{
162
	{
158
        pAddonMenu = (AddonMenu *)AddonMenuManager::CreatePopupMenuType( ADDON_MENU, rFrame );
163
        pAddonMenu = (AddonMenu *)AddonMenuManager::CreatePopupMenuType( ADDON_MENU, rFrame );
159
		Reference< XModel > xModel = GetModelFromFrame( rFrame );
164
        ::rtl::OUString aModuleIdentifier = GetModuleIdentifier( rServiceManager, rFrame );
160
        AddonMenuManager::BuildMenu( pAddonMenu, ADDON_MENU, MENU_APPEND, nUniqueMenuId, rAddonMenuEntries, rFrame, xModel );
165
        AddonMenuManager::BuildMenu( pAddonMenu, ADDON_MENU, MENU_APPEND, nUniqueMenuId, rAddonMenuEntries, rFrame, aModuleIdentifier );
161
166
162
        // Don't return an empty Add-On menu
167
        // Don't return an empty Add-On menu
163
        if ( pAddonMenu->GetItemCount() == 0 )
168
        if ( pAddonMenu->GetItemCount() == 0 )
Lines 194-200 Link Here
194
199
195
200
196
// Merge the Add-Ons help menu items into the given menu bar at a defined pos
201
// Merge the Add-Ons help menu items into the given menu bar at a defined pos
197
void AddonMenuManager::MergeAddonHelpMenu( const Reference< XFrame >& rFrame, MenuBar* pMergeMenuBar )
202
void AddonMenuManager::MergeAddonHelpMenu( const Reference< XFrame >& rFrame, 
203
                                           MenuBar* pMergeMenuBar, 
204
                                           const Reference< XMultiServiceFactory >& rServiceManager )
198
{
205
{
199
    if ( pMergeMenuBar )
206
    if ( pMergeMenuBar )
200
    {
207
    {
Lines 245-252 Link Here
245
	        if ( nInsPos < nItemCount && pHelpMenu->GetItemType( nInsPos ) != MENUITEM_SEPARATOR )
252
	        if ( nInsPos < nItemCount && pHelpMenu->GetItemType( nInsPos ) != MENUITEM_SEPARATOR )
246
	            nInsSepAfterPos = nInsPos;
253
	            nInsSepAfterPos = nInsPos;
247
254
248
			Reference< XModel > xModel = GetModelFromFrame( rFrame );
255
            ::rtl::OUString aModuleIdentifier = GetModuleIdentifier( rServiceManager, rFrame );
249
	        AddonMenuManager::BuildMenu( pHelpMenu, ADDON_MENU, nInsPos, nUniqueMenuId, rAddonHelpMenuEntries, rFrame, xModel );
256
	        AddonMenuManager::BuildMenu( pHelpMenu, ADDON_MENU, nInsPos, nUniqueMenuId, rAddonHelpMenuEntries, rFrame, aModuleIdentifier );
250
257
251
	        if ( pHelpMenu->GetItemCount() > nItemCount )
258
	        if ( pHelpMenu->GetItemCount() > nItemCount )
252
	        {
259
	        {
Lines 267-275 Link Here
267
274
268
// Merge the addon popup menus into the given menu bar at the provided pos.
275
// Merge the addon popup menus into the given menu bar at the provided pos.
269
void AddonMenuManager::MergeAddonPopupMenus( const Reference< XFrame >& rFrame,
276
void AddonMenuManager::MergeAddonPopupMenus( const Reference< XFrame >& rFrame,
270
											 const Reference< XModel >& rModel,
271
										     sal_uInt16	              nMergeAtPos,
277
										     sal_uInt16	              nMergeAtPos,
272
											 MenuBar*             pMergeMenuBar )
278
											 MenuBar*             pMergeMenuBar, 
279
                                             const Reference< XMultiServiceFactory >& rServiceManager )
273
{
280
{
274
	if ( pMergeMenuBar )
281
	if ( pMergeMenuBar )
275
	{
282
	{
Lines 283-288 Link Here
283
	    ::rtl::OUString                              aContext;
290
	    ::rtl::OUString                              aContext;
284
	    Sequence< Sequence< PropertyValue > > aAddonSubMenu;
291
	    Sequence< Sequence< PropertyValue > > aAddonSubMenu;
285
	    sal_uInt16                                nUniqueMenuId = ADDONMENU_ITEMID_START;
292
	    sal_uInt16                                nUniqueMenuId = ADDONMENU_ITEMID_START;
293
        ::rtl::OUString                              aModuleIdentifier = GetModuleIdentifier( rServiceManager, rFrame );
286
294
287
		const Sequence< Sequence< PropertyValue > >&	rAddonMenuEntries = aAddonsOptions.GetAddonsMenuBarPart();
295
		const Sequence< Sequence< PropertyValue > >&	rAddonMenuEntries = aAddonsOptions.GetAddonsMenuBarPart();
288
		for ( sal_Int32 i = 0; i < rAddonMenuEntries.getLength(); i++ )
296
		for ( sal_Int32 i = 0; i < rAddonMenuEntries.getLength(); i++ )
Lines 297-308 Link Here
297
            if ( aTitle.getLength() > 0 &&
305
            if ( aTitle.getLength() > 0 &&
298
                 aURL.getLength() > 0 &&
306
                 aURL.getLength() > 0 &&
299
                 aAddonSubMenu.getLength() > 0 &&
307
                 aAddonSubMenu.getLength() > 0 &&
300
                 AddonMenuManager::IsCorrectContext( rModel, aContext ))
308
                 AddonMenuManager::IsCorrectContext( aModuleIdentifier, aContext ))
301
            {
309
            {
302
                sal_uInt16          nId             = nUniqueMenuId++;
310
                sal_uInt16          nId             = nUniqueMenuId++;
303
                AddonPopupMenu* pAddonPopupMenu = (AddonPopupMenu *)AddonMenuManager::CreatePopupMenuType( ADDON_POPUPMENU, rFrame );
311
                AddonPopupMenu* pAddonPopupMenu = (AddonPopupMenu *)AddonMenuManager::CreatePopupMenuType( ADDON_POPUPMENU, rFrame );
304
312
305
                AddonMenuManager::BuildMenu( pAddonPopupMenu, ADDON_MENU, MENU_APPEND, nUniqueMenuId, aAddonSubMenu, rFrame, rModel );
313
                AddonMenuManager::BuildMenu( pAddonPopupMenu, ADDON_MENU, MENU_APPEND, nUniqueMenuId, aAddonSubMenu, rFrame, aModuleIdentifier );
306
314
307
                if ( pAddonPopupMenu->GetItemCount() > 0 )
315
                if ( pAddonPopupMenu->GetItemCount() > 0 )
308
                {
316
                {
Lines 327-333 Link Here
327
                                  sal_uInt16&                               nUniqueMenuId,
335
                                  sal_uInt16&                               nUniqueMenuId,
328
                                  Sequence< Sequence< PropertyValue > > aAddonMenuDefinition,
336
                                  Sequence< Sequence< PropertyValue > > aAddonMenuDefinition,
329
                                  const Reference< XFrame >&            rFrame,
337
                                  const Reference< XFrame >&            rFrame,
330
                                  const Reference< XModel >&            rModel )
338
                                  const ::rtl::OUString&               rModuleIdentifier )
331
{
339
{
332
	Sequence< Sequence< PropertyValue > >	aAddonSubMenu;
340
	Sequence< Sequence< PropertyValue > >	aAddonSubMenu;
333
	sal_Bool                                    bInsertSeparator    = sal_False;
341
	sal_Bool                                    bInsertSeparator    = sal_False;
Lines 346-352 Link Here
346
	{
354
	{
347
		GetMenuEntry( aAddonMenuDefinition[i], aTitle, aURL, aTarget, aImageId, aContext, aAddonSubMenu );
355
		GetMenuEntry( aAddonMenuDefinition[i], aTitle, aURL, aTarget, aImageId, aContext, aAddonSubMenu );
348
356
349
		if ( !IsCorrectContext( rModel, aContext ) || ( !aTitle.getLength() && !aURL.getLength() ))
357
		if ( !IsCorrectContext( rModuleIdentifier, aContext ) || ( !aTitle.getLength() && !aURL.getLength() ))
350
		    continue;
358
		    continue;
351
359
352
        if ( aURL == ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:separator" )))
360
        if ( aURL == ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:separator" )))
Lines 357-363 Link Here
357
			if ( aAddonSubMenu.getLength() > 0 )
365
			if ( aAddonSubMenu.getLength() > 0 )
358
			{
366
			{
359
	            pSubMenu = AddonMenuManager::CreatePopupMenuType( nSubMenuType, rFrame );
367
	            pSubMenu = AddonMenuManager::CreatePopupMenuType( nSubMenuType, rFrame );
360
				AddonMenuManager::BuildMenu( pSubMenu, nSubMenuType, MENU_APPEND, nUniqueMenuId, aAddonSubMenu, rFrame, rModel );
368
				AddonMenuManager::BuildMenu( pSubMenu, nSubMenuType, MENU_APPEND, nUniqueMenuId, aAddonSubMenu, rFrame, rModuleIdentifier );
361
369
362
                // Don't create a menu item for an empty sub menu
370
                // Don't create a menu item for an empty sub menu
363
				if ( pSubMenu->GetItemCount() == 0 )
371
				if ( pSubMenu->GetItemCount() == 0 )
Lines 426-451 Link Here
426
}
434
}
427
435
428
// Check if the context string matches the provided xModel context
436
// Check if the context string matches the provided xModel context
429
sal_Bool AddonMenuManager::IsCorrectContext( const Reference< XModel >& rModel, const ::rtl::OUString& aContext )
437
sal_Bool AddonMenuManager::IsCorrectContext( const ::rtl::OUString& rModuleIdentifier, const ::rtl::OUString& aContext )
430
{
438
{
431
	if ( rModel.is() )
439
    if ( aContext.isEmpty() )
432
	{
440
        return sal_True;
433
		Reference< com::sun::star::lang::XServiceInfo > xServiceInfo( rModel, UNO_QUERY );
441
    
434
		if ( xServiceInfo.is() )
442
    if ( !rModuleIdentifier.isEmpty() )
435
		{
443
    {
436
			sal_Int32 nIndex = 0;
444
        sal_Int32 nIndex = aContext.indexOf( rModuleIdentifier );
437
			do
445
        return ( nIndex >= 0 );
438
			{
446
    }
439
				::rtl::OUString aToken = aContext.getToken( 0, ',', nIndex );
447
    
440
448
    return sal_False;
441
				if ( xServiceInfo->supportsService( aToken ))
442
					return sal_True;
443
			}
444
			while ( nIndex >= 0 );
445
		}
446
	}
447
448
	return ( aContext.getLength() == 0 );
449
}
449
}
450
450
451
}
451
}
(-)framework/source/classes/menumanager.cxx (-1 / +1 lines)
Lines 192-198 Link Here
192
					AddonMenuManager::HasAddonMenuElements() )
192
					AddonMenuManager::HasAddonMenuElements() )
193
				{
193
				{
194
					sal_uInt16      nCount   = 0;
194
					sal_uInt16      nCount   = 0;
195
					AddonMenu*  pSubMenu = AddonMenuManager::CreateAddonMenu( rFrame );
195
					AddonMenu*  pSubMenu = AddonMenuManager::CreateAddonMenu( rFrame, xServiceFactory );
196
					if ( pSubMenu && ( pSubMenu->GetItemCount() > 0 ))
196
					if ( pSubMenu && ( pSubMenu->GetItemCount() > 0 ))
197
					{
197
					{
198
						if ( pPopupMenu->GetItemType( nCount-1 ) != MENUITEM_SEPARATOR )
198
						if ( pPopupMenu->GetItemType( nCount-1 ) != MENUITEM_SEPARATOR )
(-)framework/source/dispatch/menudispatcher.cxx (-2 / +2 lines)
Lines 344-353 Link Here
344
                        xModel = uno::Reference< XModel >( xController->getModel(), UNO_QUERY );
344
                        xModel = uno::Reference< XModel >( xController->getModel(), UNO_QUERY );
345
345
346
                    // retrieve addon popup menus and add them to our menu bar
346
                    // retrieve addon popup menus and add them to our menu bar
347
                    AddonMenuManager::MergeAddonPopupMenus( xFrame, xModel, nPos, pMenuBar );
347
                    AddonMenuManager::MergeAddonPopupMenus( xFrame, nPos, pMenuBar, m_xFactory );
348
348
349
                    // retrieve addon help menu items and add them to our help menu
349
                    // retrieve addon help menu items and add them to our help menu
350
                    AddonMenuManager::MergeAddonHelpMenu( xFrame, pMenuBar );
350
                    AddonMenuManager::MergeAddonHelpMenu( xFrame, pMenuBar, m_xFactory );
351
                }
351
                }
352
352
353
                // set new menu on our system window and create new menu manager
353
                // set new menu on our system window and create new menu manager
(-)framework/source/uielement/menubarmanager.cxx (-7 / +3 lines)
Lines 1292-1308 Link Here
1292
                 aCommand == aSpecialWindowCommand )
1292
                 aCommand == aSpecialWindowCommand )
1293
            {
1293
            {
1294
		        // Retrieve addon popup menus and add them to our menu bar
1294
		        // Retrieve addon popup menus and add them to our menu bar
1295
		        Reference< com::sun::star::frame::XModel >		xModel;
1295
		        framework::AddonMenuManager::MergeAddonPopupMenus( rFrame, nPos, (MenuBar *)pMenu, mxServiceFactory );
1296
		        Reference< com::sun::star::frame::XController >	xController( rFrame->getController(), UNO_QUERY );
1297
		        if ( xController.is() )
1298
			        xModel = Reference< com::sun::star::frame::XModel >( xController->getModel(), UNO_QUERY );
1299
		        framework::AddonMenuManager::MergeAddonPopupMenus( rFrame, xModel, nPos, (MenuBar *)pMenu );
1300
                break;
1296
                break;
1301
            }
1297
            }
1302
        }
1298
        }
1303
1299
1304
        // Merge the Add-Ons help menu items into the Office help menu
1300
        // Merge the Add-Ons help menu items into the Office help menu
1305
        framework::AddonMenuManager::MergeAddonHelpMenu( rFrame, (MenuBar *)pMenu );
1301
        framework::AddonMenuManager::MergeAddonHelpMenu( rFrame, (MenuBar *)pMenu, mxServiceFactory );
1306
    }
1302
    }
1307
1303
1308
    String      aEmpty;
1304
    String      aEmpty;
Lines 1398-1404 Link Here
1398
                {
1394
                {
1399
                    // Create addon popup menu if there exist elements and this is the tools popup menu
1395
                    // Create addon popup menu if there exist elements and this is the tools popup menu
1400
					sal_uInt16      nCount   = 0;
1396
					sal_uInt16      nCount   = 0;
1401
					AddonMenu*  pSubMenu = AddonMenuManager::CreateAddonMenu( rFrame );
1397
					AddonMenu*  pSubMenu = AddonMenuManager::CreateAddonMenu( rFrame, mxServiceFactory );
1402
					if ( pSubMenu && ( pSubMenu->GetItemCount() > 0 ))
1398
					if ( pSubMenu && ( pSubMenu->GetItemCount() > 0 ))
1403
					{
1399
					{
1404
						if ( pPopup->GetItemType( nCount-1 ) != MENUITEM_SEPARATOR )
1400
						if ( pPopup->GetItemType( nCount-1 ) != MENUITEM_SEPARATOR )
(-)sfx2/source/menu/virtmenu.cxx (-7 / +4 lines)
Lines 341-360 Link Here
341
341
342
	if ( pSVMenu->IsMenuBar() )
342
	if ( pSVMenu->IsMenuBar() )
343
	{
343
	{
344
		Reference<com::sun::star::lang::XMultiServiceFactory> aXMultiServiceFactory(::comphelper::getProcessServiceFactory());
344
		sal_uInt16 nPos = pSVMenu->GetItemPos( SID_MDIWINDOWLIST );
345
		sal_uInt16 nPos = pSVMenu->GetItemPos( SID_MDIWINDOWLIST );
345
		if ( nPos != MENU_ITEM_NOTFOUND && xFrame.is() )
346
		if ( nPos != MENU_ITEM_NOTFOUND && xFrame.is() )
346
		{
347
		{
347
			// Retrieve addon popup menus and add them to our menu bar
348
			// Retrieve addon popup menus and add them to our menu bar
348
			Reference< com::sun::star::frame::XModel >		xModel;
349
			framework::AddonMenuManager::MergeAddonPopupMenus( xFrame, nPos, (MenuBar *)pSVMenu, aXMultiServiceFactory );
349
			Reference< com::sun::star::frame::XController >	xController( xFrame->getController(), UNO_QUERY );
350
			if ( xController.is() )
351
				xModel = Reference< com::sun::star::frame::XModel >( xController->getModel(), UNO_QUERY );
352
			framework::AddonMenuManager::MergeAddonPopupMenus( xFrame, xModel, nPos, (MenuBar *)pSVMenu );
353
		}
350
		}
354
351
355
        // Merge the Add-Ons help menu items into the Office help menu
352
        // Merge the Add-Ons help menu items into the Office help menu
356
		if ( xFrame.is() )
353
		if ( xFrame.is() )
357
		    framework::AddonMenuManager::MergeAddonHelpMenu( xFrame, (MenuBar *)pSVMenu );
354
		    framework::AddonMenuManager::MergeAddonHelpMenu( xFrame, (MenuBar *)pSVMenu, aXMultiServiceFactory );
358
355
359
        // Set addon menu pointer here to avoid problems. When accessibility is enabled, the whole menu
356
        // Set addon menu pointer here to avoid problems. When accessibility is enabled, the whole menu
360
        // is created immediately!
357
        // is created immediately!
Lines 870-876 Link Here
870
	PopupMenu* pAddonMenu = NULL;
867
	PopupMenu* pAddonMenu = NULL;
871
	try
868
	try
872
	{
869
	{
873
		pAddonMenu = framework::AddonMenuManager::CreateAddonMenu( xFrame );
870
		pAddonMenu = framework::AddonMenuManager::CreateAddonMenu( xFrame, aXMultiServiceFactory );
874
	}
871
	}
875
	catch ( ::com::sun::star::lang::WrappedTargetException )
872
	catch ( ::com::sun::star::lang::WrappedTargetException )
876
	{
873
	{

Return to issue 86528