addonstoolbarmanager.cxx (6d739b60) addonstoolbarmanager.cxx (dccf82be)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 248 unchanged lines hidden (view full) ---

257 Reference< XModuleManager > xModuleManager(
258 m_xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY_THROW );
259 aModuleIdentifier = xModuleManager->identify( m_xFrame );
260 }
261 catch ( Exception& )
262 {
263 }
264
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 248 unchanged lines hidden (view full) ---

257 Reference< XModuleManager > xModuleManager(
258 m_xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY_THROW );
259 aModuleIdentifier = xModuleManager->identify( m_xFrame );
260 }
261 catch ( Exception& )
262 {
263 }
264
265 Reference< XMultiComponentFactory > xToolbarControllerFactory( m_xToolbarControllerRegistration, UNO_QUERY );
266 Reference< XComponentContext > xComponentContext;
267 Reference< XPropertySet > xProps( m_xServiceManager, UNO_QUERY );
268
269 if ( xProps.is() )
270 xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xComponentContext;
271
272 sal_uInt32 nElements( 0 );
273 sal_Bool bAppendSeparator( sal_False );

--- 48 unchanged lines hidden (view full) ---

322 m_pToolBar->SetItemData( nId, pRuntimeItemData );
323 m_pToolBar->SetItemCommand( nId, aURL );
324
325 Reference< XStatusListener > xController;
326
327 sal_Bool bMustBeInit( sal_True );
328
329 // Support external toolbar controller for add-ons!
265 Reference< XComponentContext > xComponentContext;
266 Reference< XPropertySet > xProps( m_xServiceManager, UNO_QUERY );
267
268 if ( xProps.is() )
269 xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xComponentContext;
270
271 sal_uInt32 nElements( 0 );
272 sal_Bool bAppendSeparator( sal_False );

--- 48 unchanged lines hidden (view full) ---

321 m_pToolBar->SetItemData( nId, pRuntimeItemData );
322 m_pToolBar->SetItemCommand( nId, aURL );
323
324 Reference< XStatusListener > xController;
325
326 sal_Bool bMustBeInit( sal_True );
327
328 // Support external toolbar controller for add-ons!
330 if ( m_xToolbarControllerRegistration.is() &&
331 m_xToolbarControllerRegistration->hasController( aURL, m_aModuleIdentifier ))
329 if ( m_xToolbarControllerFactory.is() &&
330 m_xToolbarControllerFactory->hasController( aURL, m_aModuleIdentifier ))
332 {
331 {
333 if ( xToolbarControllerFactory.is() )
334 {
335 Sequence< Any > aArgs(5);
336 PropertyValue aPropValue;
332 Sequence< Any > aArgs(5);
333 PropertyValue aPropValue;
337
334
338 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleName" ));
339 aPropValue.Value <<= m_aModuleIdentifier;
340 aArgs[0] <<= aPropValue;
341 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" ));
342 aPropValue.Value <<= m_xFrame;
343 aArgs[1] <<= aPropValue;
344 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ServiceManager" ));
345 aPropValue.Value <<= m_xServiceManager;
346 aArgs[2] <<= aPropValue;
347 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" ));
348 aPropValue.Value <<= xToolbarWindow;
349 aArgs[3] <<= aPropValue;
350 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ItemId" ));
351 aPropValue.Value = makeAny( sal_Int32( nId ));
352 aArgs[4] <<= aPropValue;
335 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleIdentifier" ));
336 aPropValue.Value <<= m_aModuleIdentifier;
337 aArgs[0] <<= aPropValue;
338 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" ));
339 aPropValue.Value <<= m_xFrame;
340 aArgs[1] <<= aPropValue;
341 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ServiceManager" ));
342 aPropValue.Value <<= m_xServiceManager;
343 aArgs[2] <<= aPropValue;
344 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" ));
345 aPropValue.Value <<= xToolbarWindow;
346 aArgs[3] <<= aPropValue;
347 aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ItemId" ));
348 aPropValue.Value = makeAny( sal_Int32( nId ));
349 aArgs[4] <<= aPropValue;
353
350
354 try
355 {
356 xController = Reference< XStatusListener >( xToolbarControllerFactory->createInstanceWithArgumentsAndContext(
357 aURL, aArgs, xComponentContext ),
358 UNO_QUERY );
359 }
360 catch ( uno::Exception& )
361 {
362 }
363 bMustBeInit = sal_False; // factory called init already!
351 try
352 {
353 xController = Reference< XStatusListener >( m_xToolbarControllerFactory->createInstanceWithArgumentsAndContext(
354 aURL, aArgs, xComponentContext ),
355 UNO_QUERY );
364 }
356 }
357 catch ( uno::Exception& )
358 {
359 }
360 bMustBeInit = sal_False; // factory called init already!
365 }
366 else
367 {
368 ::cppu::OWeakObject* pController = 0;
369
370 pController = ToolBarMerger::CreateController( m_xServiceManager, m_xFrame, m_pToolBar, aURL, nId, nWidth, aControlType );
371 xController = Reference< XStatusListener >( pController, UNO_QUERY );
372 }

--- 183 unchanged lines hidden ---
361 }
362 else
363 {
364 ::cppu::OWeakObject* pController = 0;
365
366 pController = ToolBarMerger::CreateController( m_xServiceManager, m_xFrame, m_pToolBar, aURL, nId, nWidth, aControlType );
367 xController = Reference< XStatusListener >( pController, UNO_QUERY );
368 }

--- 183 unchanged lines hidden ---