diff options
author | Noel Grandin <noel@peralex.com> | 2013-02-25 15:17:03 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-03-04 14:22:33 +0200 |
commit | 244c7cdede13980c29850b7b68e9da16cdc61879 (patch) | |
tree | d06ef7ef2a9239302aedf5ba126e3e3e2fc4c146 /framework | |
parent | c4c736c2a4c9852f8ef8257c36d7b5481aa9e83a (diff) |
fdo#46808, convert task::StatusIndicatorFactory to new style
the service already existed, it just needed an IDL file.
Change-Id: I84c8e48e176ec3a38ac48a7abcec7463390523b9
Diffstat (limited to 'framework')
-rw-r--r-- | framework/inc/classes/menumanager.hxx | 10 | ||||
-rw-r--r-- | framework/inc/dispatch/menudispatcher.hxx | 37 | ||||
-rw-r--r-- | framework/inc/framework/menuconfiguration.hxx | 5 | ||||
-rw-r--r-- | framework/inc/properties.h | 13 | ||||
-rw-r--r-- | framework/inc/services.h | 2 | ||||
-rw-r--r-- | framework/inc/uiconfiguration/uiconfigurationmanager.hxx | 4 | ||||
-rw-r--r-- | framework/source/classes/menumanager.cxx | 23 | ||||
-rw-r--r-- | framework/source/dispatch/dispatchprovider.cxx | 2 | ||||
-rw-r--r-- | framework/source/fwe/xml/menuconfiguration.cxx | 8 | ||||
-rw-r--r-- | framework/source/helper/statusindicatorfactory.cxx | 45 | ||||
-rw-r--r-- | framework/source/services/frame.cxx | 14 | ||||
-rw-r--r-- | framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx | 4 | ||||
-rw-r--r-- | framework/source/uiconfiguration/uiconfigurationmanager.cxx | 24 | ||||
-rw-r--r-- | framework/source/uielement/newmenucontroller.cxx | 2 |
14 files changed, 78 insertions, 115 deletions
diff --git a/framework/inc/classes/menumanager.hxx b/framework/inc/classes/menumanager.hxx index 8e2ac6f076e8..a6112a1f801c 100644 --- a/framework/inc/classes/menumanager.hxx +++ b/framework/inc/classes/menumanager.hxx @@ -38,8 +38,6 @@ #include <threadhelp/threadhelpbase.hxx> #include <macros/debug.hxx> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> - #define REFERENCE ::com::sun::star::uno::Reference #define XFRAME ::com::sun::star::frame::XFrame #define XDISPATCH ::com::sun::star::frame::XDispatch @@ -61,7 +59,7 @@ class MenuManager : public ThreadHelpBase , { public: MenuManager( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, REFERENCE< XFRAME >& rFrame, Menu* pMenu, sal_Bool bDelete, @@ -81,7 +79,7 @@ class MenuManager : public ThreadHelpBase , void RemoveListener(); - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& getServiceFactory(); + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& getContext(); static void UpdateSpecialWindowMenu( Menu* pMenu ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,IMutex& _rMutex); static void FillMenuImages( @@ -136,8 +134,8 @@ class MenuManager : public ThreadHelpBase , REFERENCE< XFRAME > m_xFrame; ::std::vector< MenuItemHandler* > m_aMenuItemHandlerVector; - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& mxServiceFactory; - ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer; }; } // namespace diff --git a/framework/inc/dispatch/menudispatcher.hxx b/framework/inc/dispatch/menudispatcher.hxx index eb0a8e7711dc..a41318fd3705 100644 --- a/framework/inc/dispatch/menudispatcher.hxx +++ b/framework/inc/dispatch/menudispatcher.hxx @@ -99,14 +99,14 @@ class MenuDispatcher : // interfaces @seealso using at owner - @param "xFactory" , css::uno::Reference to servicemanager for creation of new services + @param "rxContext" , css::uno::Reference to servicemanager for creation of new services @param "xOwner" , css::uno::Reference to our owner, the Desktop!!! @return - @onerror - *//*-*****************************************************************************************************/ - MenuDispatcher( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory , + MenuDispatcher( const css::uno::Reference< css::uno::XComponentContext >& rxContext , const css::uno::Reference< css::frame::XFrame >& xOwner ); //--------------------------------------------------------------------------------------------------------- @@ -252,37 +252,6 @@ class MenuDispatcher : // interfaces void impl_setAccelerators( Menu* pMenu, const Accelerator& aAccel ); //------------------------------------------------------------------------------------------------------------- - // debug methods - // (should be private everyway!) - //------------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short debug-method to check incoming parameter of some other mehods of this class - @descr The following methods are used to check parameters for other methods - of this class. The return value is used directly for an ASSERT(...). - - @seealso ASSERTs in implementation! - - @param css::uno::References to checking variables - @return sal_False on invalid parameter<BR> - sal_True otherway - - @onerror - - *//*-*****************************************************************************************************/ - - #ifdef ENABLE_ASSERTIONS - - private: - - static sal_Bool impldbg_checkParameter_MenuDispatcher ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory , - const css::uno::Reference< css::frame::XFrame >& xOwner ); - static sal_Bool impldbg_checkParameter_addStatusListener ( const css::uno::Reference< css::frame::XStatusListener >& xControl , - const css::util::URL& aURL ); - static sal_Bool impldbg_checkParameter_removeStatusListener ( const css::uno::Reference< css::frame::XStatusListener >& xControl , - const css::util::URL& aURL ); - #endif // #ifdef ENABLE_ASSERTIONS - - //------------------------------------------------------------------------------------------------------------- // variables // (should be private everyway!) //------------------------------------------------------------------------------------------------------------- @@ -290,7 +259,7 @@ class MenuDispatcher : // interfaces private: css::uno::WeakReference< css::frame::XFrame > m_xOwnerWeak ; /// css::uno::WeakReference to owner (Don't use a hard css::uno::Reference. Owner can't delete us then!) - css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory ; /// factory shared with our owner to create new services! + css::uno::Reference< css::uno::XComponentContext > m_xContext ; /// factory shared with our owner to create new services! IMPL_ListenerHashContainer m_aListenerContainer; /// hash table for listener at specified URLs sal_Bool m_bAlreadyDisposed ; /// Protection against multiple disposing calls. sal_Bool m_bActivateListener ; /// dispatcher is listener for frame activation diff --git a/framework/inc/framework/menuconfiguration.hxx b/framework/inc/framework/menuconfiguration.hxx index d122e4043e59..9b6eb7439016 100644 --- a/framework/inc/framework/menuconfiguration.hxx +++ b/framework/inc/framework/menuconfiguration.hxx @@ -71,7 +71,7 @@ class FWE_DLLPUBLIC MenuConfiguration MenuConfiguration( // use const when giving a uno reference by reference - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager ); + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ); virtual ~MenuConfiguration(); @@ -97,8 +97,7 @@ class FWE_DLLPUBLIC MenuConfiguration throw ( ::com::sun::star::lang::WrappedTargetException ); private: - // do not hold the uno reference by reference - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& m_rxServiceManager; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> m_xContext; }; } diff --git a/framework/inc/properties.h b/framework/inc/properties.h index 1071b0ebd844..31052a24820e 100644 --- a/framework/inc/properties.h +++ b/framework/inc/properties.h @@ -27,19 +27,6 @@ namespace framework{ //_______________________________________________ -/** properties for "StatusIndicatorFactory" class */ - -#define STATUSINDICATORFACTORY_PROPNAME_ASCII_FRAME "Frame" -#define STATUSINDICATORFACTORY_PROPNAME_ASCII_WINDOW "Window" -#define STATUSINDICATORFACTORY_PROPNAME_ASCII_ALLOWPARENTSHOW "AllowParentShow" -#define STATUSINDICATORFACTORY_PROPNAME_ASCII_DISABLERESCHEDULE "DisableReschedule" - -#define STATUSINDICATORFACTORY_PROPNAME_FRAME DECLARE_ASCII(STATUSINDICATORFACTORY_PROPNAME_ASCII_FRAME ) -#define STATUSINDICATORFACTORY_PROPNAME_WINDOW DECLARE_ASCII(STATUSINDICATORFACTORY_PROPNAME_ASCII_WINDOW ) -#define STATUSINDICATORFACTORY_PROPNAME_ALLOWPARENTSHOW DECLARE_ASCII(STATUSINDICATORFACTORY_PROPNAME_ASCII_ALLOWPARENTSHOW ) -#define STATUSINDICATORFACTORY_PROPNAME_DISABLERESCHEDULE DECLARE_ASCII(STATUSINDICATORFACTORY_PROPNAME_ASCII_DISABLERESCHEDULE) - -//_______________________________________________ /** properties for "Frame" class */ #define FRAME_PROPNAME_ASCII_DISPATCHRECORDERSUPPLIER "DispatchRecorderSupplier" diff --git a/framework/inc/services.h b/framework/inc/services.h index abc275b58ae5..28f8b6d70bad 100644 --- a/framework/inc/services.h +++ b/framework/inc/services.h @@ -36,7 +36,6 @@ namespace framework{ #define SERVICENAME_CFGREADACCESS DECLARE_ASCII("com.sun.star.configuration.ConfigurationAccess" ) // provides readonly access to the configuration #define SERVICENAME_CONTENTHANDLER DECLARE_ASCII("com.sun.star.frame.ContentHandler" ) #define SERVICENAME_CONTENTHANDLERFACTORY DECLARE_ASCII("com.sun.star.frame.ContentHandlerFactory" ) -#define SERVICENAME_STATUSINDICATORFACTORY DECLARE_ASCII("com.sun.star.task.StatusIndicatorFactory" ) #define SERVICENAME_JOB DECLARE_ASCII("com.sun.star.task.Job" ) #define SERVICENAME_PROTOCOLHANDLER DECLARE_ASCII("com.sun.star.frame.ProtocolHandler" ) #define SERVICENAME_PATHSETTINGS DECLARE_ASCII("com.sun.star.util.PathSettings" ) @@ -111,7 +110,6 @@ namespace framework{ #define IMPLEMENTATIONNAME_TOOLBARCONTROLLERFACTORY DECLARE_ASCII("com.sun.star.comp.framework.ToolBarControllerFactory" ) #define IMPLEMENTATIONNAME_LICENSE DECLARE_ASCII("com.sun.star.comp.framework.License" ) #define IMPLEMENTATIONNAME_AUTORECOVERY DECLARE_ASCII("com.sun.star.comp.framework.AutoRecovery" ) -#define IMPLEMENTATIONNAME_STATUSINDICATORFACTORY DECLARE_ASCII("com.sun.star.comp.framework.StatusIndicatorFactory" ) #define IMPLEMENTATIONNAME_RECENTFILESMENUCONTROLLER DECLARE_ASCII("com.sun.star.comp.framework.RecentFilesMenuController" ) #define IMPLEMENTATIONNAME_STATUSBARFACTORY DECLARE_ASCII("com.sun.star.comp.framework.StatusBarFactory" ) #define IMPLEMENTATIONNAME_STATUSBARCONTROLLERFACTORY DECLARE_ASCII("com.sun.star.comp.framework.StatusBarControllerFactory" ) diff --git a/framework/inc/uiconfiguration/uiconfigurationmanager.hxx b/framework/inc/uiconfiguration/uiconfigurationmanager.hxx index 17e7f41986be..6d93a74430a2 100644 --- a/framework/inc/uiconfiguration/uiconfigurationmanager.hxx +++ b/framework/inc/uiconfiguration/uiconfigurationmanager.hxx @@ -71,7 +71,7 @@ namespace framework FWK_DECLARE_XTYPEPROVIDER DECLARE_XSERVICEINFO - UIConfigurationManager( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xServiceManager ); + UIConfigurationManager( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > & rxContext ); virtual ~UIConfigurationManager(); // XComponent @@ -180,7 +180,7 @@ namespace framework rtl::OUString m_aPropUIName; rtl::OUString m_aPropResourceURL; rtl::OUString m_aModuleIdentifier; - com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext; ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xImageManager; com::sun::star::uno::Reference< com::sun::star::uno::XInterface > m_xAccConfig; diff --git a/framework/source/classes/menumanager.cxx b/framework/source/classes/menumanager.cxx index 54e4dc34ffd1..c53ac70c03ef 100644 --- a/framework/source/classes/menumanager.cxx +++ b/framework/source/classes/menumanager.cxx @@ -32,7 +32,6 @@ #include <com/sun/star/frame/XDispatch.hpp> #include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> #include <com/sun/star/frame/Desktop.hpp> @@ -110,11 +109,11 @@ namespace framework const char UNO_COMMAND[] = ".uno:"; MenuManager::MenuManager( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, REFERENCE< XFRAME >& rFrame, Menu* pMenu, sal_Bool bDelete, sal_Bool bDeleteChildren ) : ThreadHelpBase( &Application::GetSolarMutex() ), - mxServiceFactory(xServiceFactory) + m_xContext(rxContext) { m_bActive = sal_False; m_bDeleteMenu = bDelete; @@ -193,7 +192,7 @@ MenuManager::MenuManager( { if ( nItemId == SID_NEWDOCDIRECT || aItemCommand == aSlotNewDocDirect ) { - MenuConfiguration aMenuCfg( getServiceFactory() ); + MenuConfiguration aMenuCfg( m_xContext ); BmkMenu* pSubMenu = (BmkMenu*)aMenuCfg.CreateBookmarkMenu( rFrame, BOOKMARK_NEWMENU ); pMenu->SetPopupMenu( nItemId, pSubMenu ); @@ -207,7 +206,7 @@ MenuManager::MenuManager( } else if ( nItemId == SID_AUTOPILOTMENU || aItemCommand == aSlotAutoPilot ) { - MenuConfiguration aMenuCfg( getServiceFactory() ); + MenuConfiguration aMenuCfg( m_xContext ); BmkMenu* pSubMenu = (BmkMenu*)aMenuCfg.CreateBookmarkMenu( rFrame, BOOKMARK_WIZARDMENU ); pMenu->SetPopupMenu( nItemId, pSubMenu ); @@ -278,8 +277,8 @@ void MenuManager::SetHdl() m_pVCLMenu->SetDeactivateHdl( LINK( this, MenuManager, Deactivate )); m_pVCLMenu->SetSelectHdl( LINK( this, MenuManager, Select )); - if ( mxServiceFactory.is() ) - m_xURLTransformer.set( URLTransformer::create(::comphelper::getComponentContext(mxServiceFactory)) ); + if ( m_xContext.is() ) + m_xURLTransformer.set( URLTransformer::create( m_xContext ) ); } MenuManager::~MenuManager() @@ -763,7 +762,7 @@ IMPL_LINK( MenuManager, Activate, Menu *, pMenu ) if ( m_aMenuItemCommand == aSpecialFileMenu || m_aMenuItemCommand == aSlotSpecialFileMenu || aCommand == aSpecialFileCommand ) UpdateSpecialFileMenu( pMenu ); else if ( m_aMenuItemCommand == aSpecialWindowMenu || m_aMenuItemCommand == aSlotSpecialWindowMenu || aCommand == aSpecialWindowCommand ) - UpdateSpecialWindowMenu( pMenu, comphelper::getComponentContext(getServiceFactory()), m_aLock ); + UpdateSpecialWindowMenu( pMenu, m_xContext, m_aLock ); // Check if some modes have changed so we have to update our menu images if ( bShowMenuImages != m_bShowMenuImages ) @@ -862,7 +861,7 @@ IMPL_LINK( MenuManager, Select, Menu *, pMenu ) { // window list menu item selected - Reference< XDesktop2 > xDesktop = Desktop::create( comphelper::getComponentContext(getServiceFactory()) ); + Reference< XDesktop2 > xDesktop = Desktop::create( m_xContext ); sal_uInt16 nTaskId = START_ITEMID_WINDOWLIST; Reference< XIndexAccess > xList( xDesktop->getFrames(), UNO_QUERY ); @@ -923,14 +922,14 @@ IMPL_LINK_NOARG(MenuManager, Highlight) return 0; } -const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& MenuManager::getServiceFactory() +const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& MenuManager::getContext() { - return mxServiceFactory; + return m_xContext; } void MenuManager::AddMenu(PopupMenu* _pPopupMenu,const ::rtl::OUString& _sItemCommand,sal_uInt16 _nItemId,sal_Bool _bDelete,sal_Bool _bDeleteChildren) { - MenuManager* pSubMenuManager = new MenuManager( getServiceFactory(), m_xFrame, _pPopupMenu, _bDelete, _bDeleteChildren ); + MenuManager* pSubMenuManager = new MenuManager( m_xContext, m_xFrame, _pPopupMenu, _bDelete, _bDeleteChildren ); // store menu item command as we later have to know which menu is active (see Activate handler) pSubMenuManager->m_aMenuItemCommand = _sItemCommand; diff --git a/framework/source/dispatch/dispatchprovider.cxx b/framework/source/dispatch/dispatchprovider.cxx index 56053cc8c1bd..90f39948d327 100644 --- a/framework/source/dispatch/dispatchprovider.cxx +++ b/framework/source/dispatch/dispatchprovider.cxx @@ -597,7 +597,7 @@ css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_getOrCreat WriteGuard aWriteLock( m_aLock ); if ( ! m_xMenuDispatcher.is() ) { - MenuDispatcher* pDispatcher = new MenuDispatcher( xFactory, xOwner ); + MenuDispatcher* pDispatcher = new MenuDispatcher( comphelper::getComponentContext(xFactory), xOwner ); m_xMenuDispatcher = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY ); } xDispatchHelper = m_xMenuDispatcher; diff --git a/framework/source/fwe/xml/menuconfiguration.cxx b/framework/source/fwe/xml/menuconfiguration.cxx index 61fd1302a15f..0402a9546a90 100644 --- a/framework/source/fwe/xml/menuconfiguration.cxx +++ b/framework/source/fwe/xml/menuconfiguration.cxx @@ -44,8 +44,8 @@ namespace framework { MenuConfiguration::MenuConfiguration( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager ) -: m_rxServiceManager( rServiceManager ) + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ) +: m_xContext( rxContext ) { } @@ -59,7 +59,7 @@ Reference< XIndexAccess > MenuConfiguration::CreateMenuBarConfigurationFromXML( Reference< XInputStream >& rInputStream ) throw ( WrappedTargetException ) { - Reference< XParser > xParser = Parser::create( comphelper::getComponentContext(m_rxServiceManager) ); + Reference< XParser > xParser = Parser::create( m_xContext ); // connect stream to input stream to the parser InputSource aInputSource; @@ -121,7 +121,7 @@ void MenuConfiguration::StoreMenuBarConfigurationToXML( Reference< XOutputStream >& rOutputStream ) throw ( WrappedTargetException ) { - Reference< XWriter > xWriter = Writer::create(comphelper::getComponentContext(m_rxServiceManager)); + Reference< XWriter > xWriter = Writer::create(m_xContext); xWriter->setOutputStream( rOutputStream ); try diff --git a/framework/source/helper/statusindicatorfactory.cxx b/framework/source/helper/statusindicatorfactory.cxx index 3f6b34dfb9ed..19347ee43177 100644 --- a/framework/source/helper/statusindicatorfactory.cxx +++ b/framework/source/helper/statusindicatorfactory.cxx @@ -71,8 +71,8 @@ DEFINE_XTYPEPROVIDER_5(StatusIndicatorFactory , DEFINE_XSERVICEINFO_MULTISERVICE(StatusIndicatorFactory , ::cppu::OWeakObject , - SERVICENAME_STATUSINDICATORFACTORY , - IMPLEMENTATIONNAME_STATUSINDICATORFACTORY) + OUString("com.sun.star.task.StatusIndicatorFactory"), + OUString("com.sun.star.comp.framework.StatusIndicatorFactory")) DEFINE_INIT_SERVICE(StatusIndicatorFactory, { @@ -107,18 +107,37 @@ void SAL_CALL StatusIndicatorFactory::initialize(const css::uno::Sequence< css:: throw(css::uno::Exception , css::uno::RuntimeException) { - ::comphelper::SequenceAsHashMap lArgs(lArguments); - - // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); - - m_xFrame = lArgs.getUnpackedValueOrDefault(STATUSINDICATORFACTORY_PROPNAME_FRAME , css::uno::Reference< css::frame::XFrame >()); - m_xPluggWindow = lArgs.getUnpackedValueOrDefault(STATUSINDICATORFACTORY_PROPNAME_WINDOW , css::uno::Reference< css::awt::XWindow >() ); - m_bAllowParentShow = lArgs.getUnpackedValueOrDefault(STATUSINDICATORFACTORY_PROPNAME_ALLOWPARENTSHOW , (sal_Bool)sal_False ); - m_bDisableReschedule = lArgs.getUnpackedValueOrDefault(STATUSINDICATORFACTORY_PROPNAME_DISABLERESCHEDULE, (sal_Bool)sal_False ); + if (lArguments.getLength() > 0) { + // SAFE -> ---------------------------------- + WriteGuard aWriteLock(m_aLock); - aWriteLock.unlock(); - // <- SAFE ---------------------------------- + css::uno::Reference< css::frame::XFrame > xTmpFrame; + css::uno::Reference< css::awt::XWindow > xTmpWindow; + bool b1 = lArguments[0] >>= xTmpFrame; + bool b2 = lArguments[0] >>= xTmpWindow; + if (lArguments.getLength() == 3 && b1) { + // it's the first service constructor "createWithFrame" + m_xFrame = xTmpFrame; + lArguments[1] >>= m_bDisableReschedule; + lArguments[2] >>= m_bAllowParentShow; + } else if (lArguments.getLength() == 3 && b2) { + // it's the second service constructor "createWithWindow" + m_xPluggWindow = xTmpWindow; + lArguments[1] >>= m_bDisableReschedule; + lArguments[2] >>= m_bAllowParentShow; + } else { + // it's an old-style initialisation using properties + ::comphelper::SequenceAsHashMap lArgs(lArguments); + + m_xFrame = lArgs.getUnpackedValueOrDefault("Frame" , css::uno::Reference< css::frame::XFrame >()); + m_xPluggWindow = lArgs.getUnpackedValueOrDefault("Window" , css::uno::Reference< css::awt::XWindow >() ); + m_bAllowParentShow = lArgs.getUnpackedValueOrDefault("AllowParentShow" , (sal_Bool)sal_False ); + m_bDisableReschedule = lArgs.getUnpackedValueOrDefault("DisableReschedule", (sal_Bool)sal_False ); + + aWriteLock.unlock(); + // <- SAFE ---------------------------------- + } + } impl_createProgress(); } diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index ba54b20608f5..4cf109d76a17 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -40,6 +40,7 @@ #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/lang/DisposedException.hpp> +#include <com/sun/star/task/StatusIndicatorFactory.hpp> #include <com/sun/star/task/JobExecutor.hpp> #include <com/sun/star/task/XJobExecutor.hpp> #include <com/sun/star/util/URLTransformer.hpp> @@ -564,17 +565,8 @@ void SAL_CALL Frame::initialize( const css::uno::Reference< css::awt::XWindow >& // create progress helper css::uno::Reference< css::frame::XFrame > xThis (static_cast< css::frame::XFrame* >(this) , css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::task::XStatusIndicatorFactory > xIndicatorFactory(xSMGR->createInstance(IMPLEMENTATIONNAME_STATUSINDICATORFACTORY), css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::lang::XInitialization > xIndicatorInit (xIndicatorFactory , css::uno::UNO_QUERY_THROW); - css::uno::Sequence< css::uno::Any > lArgs(2); - css::beans::NamedValue aArg; - aArg.Name = STATUSINDICATORFACTORY_PROPNAME_FRAME; - aArg.Value <<= xThis; - lArgs[0] <<= aArg; - aArg.Name = STATUSINDICATORFACTORY_PROPNAME_ALLOWPARENTSHOW; - aArg.Value <<= sal_True; - lArgs[1] <<= aArg; - xIndicatorInit->initialize(lArgs); + css::uno::Reference< css::task::XStatusIndicatorFactory > xIndicatorFactory = + css::task::StatusIndicatorFactory::createWithFrame(comphelper::getComponentContext(xSMGR), xThis, sal_False/*DisableReschedule*/, sal_True/*AllowParentShow*/ ); // SAFE -> ---------------------------------- aWriteLock.lock(); diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx index f101ef1cbee9..35e14bc20120 100644 --- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx @@ -305,7 +305,7 @@ void ModuleUIConfigurationManager::impl_requestUIElementData( sal_Int16 nElement { try { - MenuConfiguration aMenuCfg( m_xServiceManager ); + MenuConfiguration aMenuCfg( comphelper::getComponentContext(m_xServiceManager) ); Reference< XIndexAccess > xContainer( aMenuCfg.CreateMenuBarConfigurationFromXML( xInputStream )); RootItemContainer* pRootItemContainer = RootItemContainer::GetImplementation( xContainer ); if ( pRootItemContainer ) @@ -446,7 +446,7 @@ void ModuleUIConfigurationManager::impl_storeElementTypeData( Reference< XStorag { try { - MenuConfiguration aMenuCfg( m_xServiceManager ); + MenuConfiguration aMenuCfg( comphelper::getComponentContext(m_xServiceManager) ); aMenuCfg.StoreMenuBarConfigurationToXML( rElement.xSettings, xOutputStream ); } catch ( const ::com::sun::star::lang::WrappedTargetException& ) diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx b/framework/source/uiconfiguration/uiconfigurationmanager.cxx index 7c2c3c6732da..8f3224f65f63 100644 --- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx @@ -81,7 +81,7 @@ DEFINE_XTYPEPROVIDER_7 ( UIConfigurationManager ::com::sun::star::ui::XUIConfigurationStorage ) -DEFINE_XSERVICEINFO_MULTISERVICE ( UIConfigurationManager , +DEFINE_XSERVICEINFO_MULTISERVICE_2 ( UIConfigurationManager , ::cppu::OWeakObject , SERVICENAME_UICONFIGURATIONMANAGER , IMPLEMENTATIONNAME_UICONFIGURATIONMANAGER @@ -243,7 +243,7 @@ void UIConfigurationManager::impl_requestUIElementData( sal_Int16 nElementType, { try { - MenuConfiguration aMenuCfg( m_xServiceManager ); + MenuConfiguration aMenuCfg( m_xContext ); Reference< XIndexAccess > xContainer( aMenuCfg.CreateMenuBarConfigurationFromXML( xInputStream )); RootItemContainer* pRootItemContainer = RootItemContainer::GetImplementation( xContainer ); if ( pRootItemContainer ) @@ -268,7 +268,7 @@ void UIConfigurationManager::impl_requestUIElementData( sal_Int16 nElementType, try { Reference< XIndexContainer > xIndexContainer( static_cast< OWeakObject * >( new RootItemContainer() ), UNO_QUERY ); - ToolBoxConfiguration::LoadToolBox( comphelper::getComponentContext(m_xServiceManager), xInputStream, xIndexContainer ); + ToolBoxConfiguration::LoadToolBox( m_xContext, xInputStream, xIndexContainer ); RootItemContainer* pRootItemContainer = RootItemContainer::GetImplementation( xIndexContainer ); aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( pRootItemContainer, sal_True ) ), UNO_QUERY ); return; @@ -285,7 +285,7 @@ void UIConfigurationManager::impl_requestUIElementData( sal_Int16 nElementType, try { Reference< XIndexContainer > xIndexContainer( static_cast< OWeakObject * >( new RootItemContainer() ), UNO_QUERY ); - StatusBarConfiguration::LoadStatusBar( comphelper::getComponentContext(m_xServiceManager), xInputStream, xIndexContainer ); + StatusBarConfiguration::LoadStatusBar( m_xContext, xInputStream, xIndexContainer ); RootItemContainer* pRootItemContainer = RootItemContainer::GetImplementation( xIndexContainer ); aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( pRootItemContainer, sal_True ) ), UNO_QUERY ); return; @@ -375,7 +375,7 @@ void UIConfigurationManager::impl_storeElementTypeData( Reference< XStorage >& x { try { - MenuConfiguration aMenuCfg( m_xServiceManager ); + MenuConfiguration aMenuCfg( m_xContext ); aMenuCfg.StoreMenuBarConfigurationToXML( rElement.xSettings, xOutputStream ); } catch ( const ::com::sun::star::lang::WrappedTargetException& ) @@ -388,7 +388,7 @@ void UIConfigurationManager::impl_storeElementTypeData( Reference< XStorage >& x { try { - ToolBoxConfiguration::StoreToolBox( comphelper::getComponentContext(m_xServiceManager), xOutputStream, rElement.xSettings ); + ToolBoxConfiguration::StoreToolBox( m_xContext, xOutputStream, rElement.xSettings ); } catch ( const ::com::sun::star::lang::WrappedTargetException& ) { @@ -400,7 +400,7 @@ void UIConfigurationManager::impl_storeElementTypeData( Reference< XStorage >& x { try { - StatusBarConfiguration::StoreStatusBar( comphelper::getComponentContext(m_xServiceManager), xOutputStream, rElement.xSettings ); + StatusBarConfiguration::StoreStatusBar( m_xContext, xOutputStream, rElement.xSettings ); } catch ( const ::com::sun::star::lang::WrappedTargetException& ) { @@ -578,7 +578,7 @@ void UIConfigurationManager::impl_Initialize() } } -UIConfigurationManager::UIConfigurationManager( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xServiceManager ) : +UIConfigurationManager::UIConfigurationManager( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > & rxContext ) : ThreadHelpBase( &Application::GetSolarMutex() ) , m_xDocConfigStorage( 0 ) , m_bReadOnly( true ) @@ -588,7 +588,7 @@ UIConfigurationManager::UIConfigurationManager( com::sun::star::uno::Reference< , m_aXMLPostfix( ".xml" ) , m_aPropUIName( "UIName" ) , m_aPropResourceURL( "ResourceURL" ) - , m_xServiceManager( xServiceManager ) + , m_xContext( rxContext ) , m_aListenerContainer( m_aLock.getShareableOslMutex() ) { // Make sure we have a default initialized entry for every layer and user interface element type! @@ -1050,7 +1050,9 @@ Reference< XInterface > SAL_CALL UIConfigurationManager::getImageManager() throw if ( !m_xImageManager.is() ) { - m_xImageManager = Reference< XComponent >( static_cast< cppu::OWeakObject *>( new ImageManager( m_xServiceManager )), + Reference<XMultiServiceFactory> xMSF(m_xContext->getServiceManager(), UNO_QUERY_THROW); + + m_xImageManager = Reference< XComponent >( static_cast< cppu::OWeakObject *>( new ImageManager( xMSF )), UNO_QUERY ); Reference< XInitialization > xInit( m_xImageManager, UNO_QUERY ); @@ -1077,7 +1079,7 @@ Reference< XInterface > SAL_CALL UIConfigurationManager::getShortCutManager() th if (m_xAccConfig.is()) return m_xAccConfig; - Reference< XMultiServiceFactory > xSMGR = m_xServiceManager; + Reference<XMultiServiceFactory> xSMGR(m_xContext->getServiceManager(), UNO_QUERY_THROW); Reference< XStorage > xDocumentRoot = m_xDocConfigStorage; aGuard.unlock(); diff --git a/framework/source/uielement/newmenucontroller.cxx b/framework/source/uielement/newmenucontroller.cxx index 867a890a5e29..bddc886594b0 100644 --- a/framework/source/uielement/newmenucontroller.cxx +++ b/framework/source/uielement/newmenucontroller.cxx @@ -326,7 +326,7 @@ void NewMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& rPopup if ( pVCLPopupMenu ) { - MenuConfiguration aMenuCfg( m_xServiceManager ); + MenuConfiguration aMenuCfg( comphelper::getComponentContext(m_xServiceManager) ); BmkMenu* pSubMenu( 0 ); if ( m_bNewMenu ) |