diff options
Diffstat (limited to 'framework/source')
-rw-r--r-- | framework/source/classes/droptargetlistener.cxx | 16 | ||||
-rw-r--r-- | framework/source/classes/taskcreator.cxx | 18 | ||||
-rw-r--r-- | framework/source/dispatch/closedispatcher.cxx | 26 | ||||
-rw-r--r-- | framework/source/dispatch/dispatchinformationprovider.cxx | 17 | ||||
-rw-r--r-- | framework/source/dispatch/dispatchprovider.cxx | 25 | ||||
-rw-r--r-- | framework/source/dispatch/loaddispatcher.cxx | 10 | ||||
-rw-r--r-- | framework/source/dispatch/windowcommanddispatch.cxx | 10 | ||||
-rw-r--r-- | framework/source/fwi/classes/propertysethelper.cxx | 6 | ||||
-rw-r--r-- | framework/source/helper/oframes.cxx | 11 | ||||
-rw-r--r-- | framework/source/inc/dispatch/loaddispatcher.hxx | 8 | ||||
-rw-r--r-- | framework/source/inc/dispatch/windowcommanddispatch.hxx | 6 | ||||
-rw-r--r-- | framework/source/inc/loadenv/loadenv.hxx | 8 | ||||
-rw-r--r-- | framework/source/loadenv/loadenv.cxx | 49 | ||||
-rw-r--r-- | framework/source/services/backingcomp.cxx | 2 | ||||
-rw-r--r-- | framework/source/services/desktop.cxx | 10 | ||||
-rw-r--r-- | framework/source/services/frame.cxx | 69 | ||||
-rw-r--r-- | framework/source/services/tabwindowservice.cxx | 3 |
17 files changed, 144 insertions, 150 deletions
diff --git a/framework/source/classes/droptargetlistener.cxx b/framework/source/classes/droptargetlistener.cxx index 66e272b18bef..1b00c54e7586 100644 --- a/framework/source/classes/droptargetlistener.cxx +++ b/framework/source/classes/droptargetlistener.cxx @@ -41,10 +41,10 @@ namespace framework { -DropTargetListener::DropTargetListener( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory, - const css::uno::Reference< css::frame::XFrame >& xFrame ) +DropTargetListener::DropTargetListener( const css::uno::Reference< css::uno::XComponentContext >& xContext, + const css::uno::Reference< css::frame::XFrame >& xFrame ) : ThreadHelpBase ( &Application::GetSolarMutex() ) - , m_xFactory ( xFactory ) + , m_xContext ( xContext ) , m_xTargetFrame ( xFrame ) , m_pFormats ( new DataFlavorExVector ) { @@ -54,8 +54,8 @@ DropTargetListener::DropTargetListener( const css::uno::Reference< css::lang::XM DropTargetListener::~DropTargetListener() { - m_xTargetFrame = css::uno::WeakReference< css::frame::XFrame >(); - m_xFactory = css::uno::Reference< css::lang::XMultiServiceFactory >(); + m_xTargetFrame.clear(); + m_xContext.clear(); delete m_pFormats; m_pFormats = NULL; } @@ -64,8 +64,8 @@ DropTargetListener::~DropTargetListener() void SAL_CALL DropTargetListener::disposing( const css::lang::EventObject& ) throw( css::uno::RuntimeException ) { - m_xTargetFrame = css::uno::WeakReference< css::frame::XFrame >(); - m_xFactory = css::uno::Reference< css::lang::XMultiServiceFactory >(); + m_xTargetFrame.clear(); + m_xContext.clear(); } // ----------------------------------------------------------------------------- @@ -212,7 +212,7 @@ void DropTargetListener::implts_OpenFile( const String& rFilePath ) /* SAFE { */ ReadGuard aReadLock(m_aLock); css::uno::Reference< css::frame::XFrame > xTargetFrame( m_xTargetFrame.get(), css::uno::UNO_QUERY ); - css::uno::Reference< css::util::XURLTransformer > xParser ( css::util::URLTransformer::create(::comphelper::getComponentContext(m_xFactory)) ); + css::uno::Reference< css::util::XURLTransformer > xParser ( css::util::URLTransformer::create(m_xContext) ); aReadLock.unlock(); /* } SAFE */ if (xTargetFrame.is() && xParser.is()) diff --git a/framework/source/classes/taskcreator.cxx b/framework/source/classes/taskcreator.cxx index f9fb99fdca64..69f33bb9e216 100644 --- a/framework/source/classes/taskcreator.cxx +++ b/framework/source/classes/taskcreator.cxx @@ -37,12 +37,12 @@ namespace framework{ @descr We need a valid uno service manager to create or instanciate new services. All other information to create frames or tasks come in on right interface methods. - @param xSMGR + @param xContext points to the valid uno service manager *//*-*****************************************************************************************************/ -TaskCreator::TaskCreator( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ) +TaskCreator::TaskCreator( const css::uno::Reference< css::uno::XComponentContext >& xContext ) : ThreadHelpBase( ) - , m_xSMGR ( xSMGR ) + , m_xContext ( xContext ) { } @@ -52,7 +52,7 @@ TaskCreator::TaskCreator( const css::uno::Reference< css::lang::XMultiServiceFac *//*-*****************************************************************************************************/ TaskCreator::~TaskCreator() { - m_xSMGR.clear(); + m_xContext.clear(); } /*-****************************************************************************************************//** @@ -63,7 +63,7 @@ css::uno::Reference< css::frame::XFrame > TaskCreator::createTask( const OUStrin { /* SAFE { */ ReadGuard aReadLock( m_aLock ); - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; + css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; aReadLock.unlock(); /* } SAFE */ @@ -78,7 +78,7 @@ css::uno::Reference< css::frame::XFrame > TaskCreator::createTask( const OUStrin ) { ::comphelper::ConfigurationHelper::readDirectKey( - comphelper::getComponentContext(xSMGR), + xContext, "org.openoffice.Office.TabBrowse", "TaskCreatorService", "ImplementationName", @@ -86,7 +86,7 @@ css::uno::Reference< css::frame::XFrame > TaskCreator::createTask( const OUStrin } xCreator = css::uno::Reference< css::lang::XSingleServiceFactory >( - xSMGR->createInstance(sCreator), css::uno::UNO_QUERY_THROW); + xContext->getServiceManager()->createInstanceWithContext(sCreator, xContext), css::uno::UNO_QUERY_THROW); } catch(const css::uno::Exception&) {} @@ -97,13 +97,13 @@ css::uno::Reference< css::frame::XFrame > TaskCreator::createTask( const OUStrin // library then these class here ... Why we should not be able to create it ? if ( ! xCreator.is()) xCreator = css::uno::Reference< css::lang::XSingleServiceFactory >( - xSMGR->createInstance(IMPLEMENTATIONNAME_FWK_TASKCREATOR), css::uno::UNO_QUERY_THROW); + xContext->getServiceManager()->createInstanceWithContext(IMPLEMENTATIONNAME_FWK_TASKCREATOR, xContext), css::uno::UNO_QUERY_THROW); css::uno::Sequence< css::uno::Any > lArgs(5); css::beans::NamedValue aArg ; aArg.Name = OUString(ARGUMENT_PARENTFRAME); - aArg.Value <<= css::uno::Reference< css::frame::XFrame >( css::frame::Desktop::create( comphelper::getComponentContext(xSMGR) ), css::uno::UNO_QUERY_THROW); + aArg.Value <<= css::uno::Reference< css::frame::XFrame >( css::frame::Desktop::create( xContext ), css::uno::UNO_QUERY_THROW); lArgs[0] <<= aArg; aArg.Name = OUString(ARGUMENT_CREATETOPWINDOW); diff --git a/framework/source/dispatch/closedispatcher.cxx b/framework/source/dispatch/closedispatcher.cxx index 1fa0c575eafc..2ff79161395a 100644 --- a/framework/source/dispatch/closedispatcher.cxx +++ b/framework/source/dispatch/closedispatcher.cxx @@ -72,12 +72,12 @@ DEFINE_XTYPEPROVIDER_4(CloseDispatcher , css::frame::XDispatch ) //----------------------------------------------- -CloseDispatcher::CloseDispatcher(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , - const css::uno::Reference< css::frame::XFrame >& xFrame , - const OUString& sTarget) +CloseDispatcher::CloseDispatcher(const css::uno::Reference< css::uno::XComponentContext >& rxContext , + const css::uno::Reference< css::frame::XFrame >& xFrame , + const OUString& sTarget) : ThreadHelpBase (&Application::GetSolarMutex() ) , ::cppu::OWeakObject( ) - , m_xSMGR (xSMGR ) + , m_xContext (rxContext ) , m_aAsyncCallback (LINK( this, CloseDispatcher, impl_asyncCallback)) , m_lStatusListener (m_aLock.getShareableOslMutex() ) , m_pSysWindow(NULL) @@ -282,7 +282,7 @@ IMPL_LINK_NOARG(CloseDispatcher, impl_asyncCallback) // BTW: Make some copies, which are needed later ... EOperation eOperation = m_eOperation; - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; + css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; css::uno::Reference< css::frame::XFrame > xCloseFrame (m_xCloseFrame.get(), css::uno::UNO_QUERY); css::uno::Reference< css::frame::XDispatchResultListener > xListener = m_xResultListener; @@ -301,7 +301,7 @@ IMPL_LINK_NOARG(CloseDispatcher, impl_asyncCallback) // Analyze the environment a first time. // If we found some special cases, we can // make some decisions erliar! - css::uno::Reference< css::frame::XFramesSupplier > xDesktop( css::frame::Desktop::create(comphelper::getComponentContext(xSMGR)), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::frame::XFramesSupplier > xDesktop( css::frame::Desktop::create(xContext), css::uno::UNO_QUERY_THROW); FrameListAnalyzer aCheck1(xDesktop, xCloseFrame, FrameListAnalyzer::E_HELP | FrameListAnalyzer::E_BACKINGCOMPONENT); // a) If the curent frame (where the close dispatch was requested for) does not have @@ -465,11 +465,11 @@ sal_Bool CloseDispatcher::implts_prepareFrameForClosing(const css::uno::Referenc { // SAFE -> ---------------------------------- ReadGuard aReadLock(m_aLock); - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; + css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; aReadLock.unlock(); // <- SAFE ---------------------------------- - css::uno::Reference< css::frame::XFramesSupplier > xDesktop( css::frame::Desktop::create( comphelper::getComponentContext(xSMGR) ), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::frame::XFramesSupplier > xDesktop( css::frame::Desktop::create( xContext ), css::uno::UNO_QUERY_THROW); FrameListAnalyzer aCheck(xDesktop, xFrame, FrameListAnalyzer::E_ALL); sal_Int32 c = aCheck.m_lModelFrames.getLength(); @@ -533,8 +533,8 @@ sal_Bool CloseDispatcher::implts_establishBackingMode() { // SAFE -> ---------------------------------- ReadGuard aReadLock(m_aLock); - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; - css::uno::Reference< css::frame::XFrame > xFrame (m_xCloseFrame.get(), css::uno::UNO_QUERY); + css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; + css::uno::Reference< css::frame::XFrame > xFrame (m_xCloseFrame.get(), css::uno::UNO_QUERY); aReadLock.unlock(); // <- SAFE ---------------------------------- @@ -548,7 +548,7 @@ sal_Bool CloseDispatcher::implts_establishBackingMode() css::uno::Reference< css::awt::XWindow > xContainerWindow = xFrame->getContainerWindow(); css::uno::Reference< css::frame::XController > xStartModule = css::frame::StartModule::createWithParentWindow( - comphelper::getComponentContext(xSMGR), xContainerWindow); + xContext, xContainerWindow); // Attention: You MUST(!) call setComponent() before you call attachFrame(). css::uno::Reference< css::awt::XWindow > xBackingWin(xStartModule, css::uno::UNO_QUERY); @@ -564,11 +564,11 @@ sal_Bool CloseDispatcher::implts_terminateApplication() { // SAFE -> ---------------------------------- ReadGuard aReadLock(m_aLock); - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; + css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; aReadLock.unlock(); // <- SAFE ---------------------------------- - css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( comphelper::getComponentContext(xSMGR) ); + css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( xContext ); return xDesktop->terminate(); } diff --git a/framework/source/dispatch/dispatchinformationprovider.cxx b/framework/source/dispatch/dispatchinformationprovider.cxx index 5e2435a6366e..a40c746bd784 100644 --- a/framework/source/dispatch/dispatchinformationprovider.cxx +++ b/framework/source/dispatch/dispatchinformationprovider.cxx @@ -35,10 +35,10 @@ DEFINE_XINTERFACE_1(DispatchInformationProvider , DIRECT_INTERFACE(css::frame::XDispatchInformationProvider)) //_________________________________________________________________________________________________________________ -DispatchInformationProvider::DispatchInformationProvider(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , - const css::uno::Reference< css::frame::XFrame >& xFrame) +DispatchInformationProvider::DispatchInformationProvider(const css::uno::Reference< css::uno::XComponentContext >& xContext , + const css::uno::Reference< css::frame::XFrame >& xFrame) : ThreadHelpBase(&Application::GetSolarMutex()) - , m_xSMGR (xSMGR ) + , m_xContext (xContext ) , m_xFrame (xFrame ) { } @@ -135,21 +135,22 @@ css::uno::Sequence< css::uno::Reference< css::frame::XDispatchInformationProvide { // SAFE -> ---------------------------------- ReadGuard aReadLock(m_aLock); - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; - css::uno::Reference< css::frame::XFrame > xFrame(m_xFrame.get(), css::uno::UNO_QUERY); + css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; + css::uno::Reference< css::frame::XFrame > xFrame(m_xFrame.get(), css::uno::UNO_QUERY); aReadLock.unlock(); // <- SAFE ---------------------------------- if (!xFrame.is()) return css::uno::Sequence< css::uno::Reference< css::frame::XDispatchInformationProvider > >(); - CloseDispatcher* pCloser = new CloseDispatcher(xSMGR, xFrame, OUString("_self")); // explicit "_self" ... not "" ... see implementation of close dispatcher itself! + CloseDispatcher* pCloser = new CloseDispatcher(xContext, xFrame, OUString("_self")); // explicit "_self" ... not "" ... see implementation of close dispatcher itself! css::uno::Reference< css::uno::XInterface > xCloser(static_cast< css::frame::XDispatch* >(pCloser), css::uno::UNO_QUERY); css::uno::Reference< css::frame::XDispatchInformationProvider > xCloseDispatch(xCloser , css::uno::UNO_QUERY); css::uno::Reference< css::frame::XDispatchInformationProvider > xController (xFrame->getController() , css::uno::UNO_QUERY); - css::uno::Reference< css::frame::XDispatchInformationProvider > xAppDispatcher(xSMGR->createInstance(IMPLEMENTATIONNAME_APPDISPATCHPROVIDER), css::uno::UNO_QUERY); - + css::uno::Reference< css::frame::XDispatchInformationProvider > xAppDispatcher( + css::uno::Reference<css::lang::XMultiServiceFactory>(xContext->getServiceManager(), css::uno::UNO_QUERY_THROW) + ->createInstance(IMPLEMENTATIONNAME_APPDISPATCHPROVIDER), css::uno::UNO_QUERY); css::uno::Sequence< css::uno::Reference< css::frame::XDispatchInformationProvider > > lProvider(3); lProvider[0] = xController ; lProvider[1] = xCloseDispatch; diff --git a/framework/source/dispatch/dispatchprovider.cxx b/framework/source/dispatch/dispatchprovider.cxx index 962eadb07118..73bbf0785f4c 100644 --- a/framework/source/dispatch/dispatchprovider.cxx +++ b/framework/source/dispatch/dispatchprovider.cxx @@ -72,18 +72,18 @@ DEFINE_XTYPEPROVIDER_2( DispatchProvider , @seealso using at owner - @param xFactory + @param rxContext reference to servicemanager to create new services. @param xFrame reference to our owner frame. */ -DispatchProvider::DispatchProvider( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory , +DispatchProvider::DispatchProvider( const css::uno::Reference< css::uno::XComponentContext >& rxContext , const css::uno::Reference< css::frame::XFrame >& xFrame ) // Init baseclasses first : ThreadHelpBase( &Application::GetSolarMutex() ) , OWeakObject ( ) // Init member - , m_xFactory ( xFactory ) + , m_xContext ( rxContext ) , m_xFrame ( xFrame ) { } @@ -514,7 +514,8 @@ css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_searchProt try { xHandler = css::uno::Reference< css::frame::XDispatchProvider >( - m_xFactory->createInstance(aHandler.m_sUNOName), + css::uno::Reference<css::lang::XMultiServiceFactory>(m_xContext->getServiceManager(), css::uno::UNO_QUERY_THROW) + ->createInstance(aHandler.m_sUNOName), css::uno::UNO_QUERY); } catch(const css::uno::Exception&) {} @@ -583,7 +584,7 @@ css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_getOrCreat /* SAFE { */ ReadGuard aReadLock( m_aLock ); - css::uno::Reference< css::lang::XMultiServiceFactory > xFactory = m_xFactory; + css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; aReadLock.unlock(); /* } SAFE */ @@ -597,7 +598,7 @@ css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_getOrCreat WriteGuard aWriteLock( m_aLock ); if ( ! m_xMenuDispatcher.is() ) { - MenuDispatcher* pDispatcher = new MenuDispatcher( comphelper::getComponentContext(xFactory), xOwner ); + MenuDispatcher* pDispatcher = new MenuDispatcher( xContext, xOwner ); m_xMenuDispatcher = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY ); } xDispatchHelper = m_xMenuDispatcher; @@ -608,7 +609,7 @@ css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_getOrCreat case E_CREATEDISPATCHER : { - LoadDispatcher* pDispatcher = new LoadDispatcher(xFactory, xOwner, sTarget, nSearchFlags); + LoadDispatcher* pDispatcher = new LoadDispatcher(xContext, xOwner, sTarget, nSearchFlags); xDispatchHelper = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY ); } break; @@ -618,7 +619,7 @@ css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_getOrCreat css::uno::Reference< css::frame::XFrame > xDesktop( xOwner, css::uno::UNO_QUERY ); if (xDesktop.is()) { - LoadDispatcher* pDispatcher = new LoadDispatcher(xFactory, xOwner, SPECIALTARGET_BLANK, 0); + LoadDispatcher* pDispatcher = new LoadDispatcher(xContext, xOwner, SPECIALTARGET_BLANK, 0); xDispatchHelper = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY ); } } @@ -629,7 +630,7 @@ css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_getOrCreat css::uno::Reference< css::frame::XFrame > xDesktop( xOwner, css::uno::UNO_QUERY ); if (xDesktop.is()) { - LoadDispatcher* pDispatcher = new LoadDispatcher(xFactory, xOwner, SPECIALTARGET_DEFAULT, 0); + LoadDispatcher* pDispatcher = new LoadDispatcher(xContext, xOwner, SPECIALTARGET_DEFAULT, 0); xDispatchHelper = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY ); } } @@ -637,21 +638,21 @@ css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_getOrCreat case E_SELFDISPATCHER : { - LoadDispatcher* pDispatcher = new LoadDispatcher(xFactory, xOwner, SPECIALTARGET_SELF, 0); + LoadDispatcher* pDispatcher = new LoadDispatcher(xContext, xOwner, SPECIALTARGET_SELF, 0); xDispatchHelper = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY ); } break; case E_CLOSEDISPATCHER : { - CloseDispatcher* pDispatcher = new CloseDispatcher( xFactory, xOwner, sTarget ); + CloseDispatcher* pDispatcher = new CloseDispatcher( xContext, xOwner, sTarget ); xDispatchHelper = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY ); } break; case E_STARTMODULEDISPATCHER : { - StartModuleDispatcher* pDispatcher = new StartModuleDispatcher( comphelper::getComponentContext(xFactory), xOwner, sTarget ); + StartModuleDispatcher* pDispatcher = new StartModuleDispatcher( xContext, xOwner, sTarget ); xDispatchHelper = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY ); } break; diff --git a/framework/source/dispatch/loaddispatcher.cxx b/framework/source/dispatch/loaddispatcher.cxx index d84d8221629b..6c5230160d63 100644 --- a/framework/source/dispatch/loaddispatcher.cxx +++ b/framework/source/dispatch/loaddispatcher.cxx @@ -25,22 +25,22 @@ namespace framework{ -LoadDispatcher::LoadDispatcher(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , - const css::uno::Reference< css::frame::XFrame >& xOwnerFrame , +LoadDispatcher::LoadDispatcher(const css::uno::Reference< css::uno::XComponentContext >& xContext , + const css::uno::Reference< css::frame::XFrame >& xOwnerFrame , const OUString sTargetName , sal_Int32 nSearchFlags) : ThreadHelpBase( ) - , m_xSMGR (xSMGR ) + , m_xContext (xContext ) , m_xOwnerFrame (xOwnerFrame ) , m_sTarget (sTargetName ) , m_nSearchFlags(nSearchFlags) - , m_aLoader (xSMGR ) + , m_aLoader (xContext ) { } LoadDispatcher::~LoadDispatcher() { - m_xSMGR.clear(); + m_xContext.clear(); } void SAL_CALL LoadDispatcher::dispatchWithNotification(const css::util::URL& aURL , diff --git a/framework/source/dispatch/windowcommanddispatch.cxx b/framework/source/dispatch/windowcommanddispatch.cxx index 3edef48cd889..4e260c5ac5b2 100644 --- a/framework/source/dispatch/windowcommanddispatch.cxx +++ b/framework/source/dispatch/windowcommanddispatch.cxx @@ -40,10 +40,10 @@ namespace framework{ //----------------------------------------------- -WindowCommandDispatch::WindowCommandDispatch(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , +WindowCommandDispatch::WindowCommandDispatch(const css::uno::Reference< css::uno::XComponentContext >& xContext , const css::uno::Reference< css::frame::XFrame >& xFrame) : ThreadHelpBase( ) - , m_xSMGR (xSMGR ) + , m_xContext (xContext ) , m_xFrame (xFrame ) , m_xWindow (xFrame->getContainerWindow()) { @@ -54,7 +54,7 @@ WindowCommandDispatch::WindowCommandDispatch(const css::uno::Reference< css::lan WindowCommandDispatch::~WindowCommandDispatch() { impl_stopListening(); - m_xSMGR.clear(); + m_xContext.clear(); } //----------------------------------------------- @@ -156,7 +156,7 @@ void WindowCommandDispatch::impl_dispatchCommand(const OUString& sCommand) // SYNCHRONIZED -> ReadGuard aReadLock(m_aLock); css::uno::Reference< css::frame::XDispatchProvider > xProvider(m_xFrame.get(), css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; + css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; aReadLock.unlock(); // <- SYNCHRONIZED @@ -164,7 +164,7 @@ void WindowCommandDispatch::impl_dispatchCommand(const OUString& sCommand) if ( ! xProvider.is()) return; - css::uno::Reference< css::util::XURLTransformer > xParser(css::util::URLTransformer::create(::comphelper::getComponentContext(xSMGR))); + css::uno::Reference< css::util::XURLTransformer > xParser(css::util::URLTransformer::create(xContext)); css::util::URL aCommand; aCommand.Complete = sCommand; xParser->parseStrict(aCommand); diff --git a/framework/source/fwi/classes/propertysethelper.cxx b/framework/source/fwi/classes/propertysethelper.cxx index 7c23fc2b5daa..7ef56a6490d9 100644 --- a/framework/source/fwi/classes/propertysethelper.cxx +++ b/framework/source/fwi/classes/propertysethelper.cxx @@ -27,12 +27,10 @@ namespace framework{ //----------------------------------------------------------------------------- -PropertySetHelper::PropertySetHelper(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , - LockHelper* pExternalLock , +PropertySetHelper::PropertySetHelper( LockHelper* pExternalLock , TransactionManager* pExternalTransactionManager , sal_Bool bReleaseLockOnCall ) - : m_xSMGR (xSMGR ) - , m_lSimpleChangeListener(pExternalLock->getShareableOslMutex()) + : m_lSimpleChangeListener(pExternalLock->getShareableOslMutex()) , m_lVetoChangeListener (pExternalLock->getShareableOslMutex()) , m_bReleaseLockOnCall (bReleaseLockOnCall ) , m_rLock (*pExternalLock ) diff --git a/framework/source/helper/oframes.cxx b/framework/source/helper/oframes.cxx index 9ab93b550235..64421ce7b377 100644 --- a/framework/source/helper/oframes.cxx +++ b/framework/source/helper/oframes.cxx @@ -40,20 +40,18 @@ using namespace ::std ; //***************************************************************************************************************** // constructor //***************************************************************************************************************** -OFrames::OFrames( const css::uno::Reference< XMultiServiceFactory >& xFactory , - const css::uno::Reference< XFrame >& xOwner , +OFrames::OFrames( const css::uno::Reference< XFrame >& xOwner , FrameContainer* pFrameContainer ) // Init baseclasses first : ThreadHelpBase ( &Application::GetSolarMutex() ) // Init member - , m_xFactory ( xFactory ) , m_xOwner ( xOwner ) , m_pFrameContainer ( pFrameContainer ) , m_bRecursiveSearchProtection( sal_False ) { // Safe impossible cases // Method is not defined for ALL incoming parameters! - LOG_ASSERT( impldbg_checkParameter_OFramesCtor( xFactory, xOwner, pFrameContainer ), "OFrames::OFrames()\nInvalid parameter detected!\n" ) + LOG_ASSERT( impldbg_checkParameter_OFramesCtor( xOwner, pFrameContainer ), "OFrames::OFrames()\nInvalid parameter detected!\n" ) } //***************************************************************************************************************** @@ -395,17 +393,14 @@ void OFrames::impl_appendSequence( Sequence< css::uno::Reference< XFram // An instance of this class can only work with valid initialization. // We share the mutex with ouer owner class, need a valid factory to instanciate new services and // use the access to ouer owner for some operations. -sal_Bool OFrames::impldbg_checkParameter_OFramesCtor( const css::uno::Reference< XMultiServiceFactory >& xFactory , - const css::uno::Reference< XFrame >& xOwner , +sal_Bool OFrames::impldbg_checkParameter_OFramesCtor( const css::uno::Reference< XFrame >& xOwner , FrameContainer* pFrameContainer ) { // Set default return value. sal_Bool bOK = sal_True; // Check parameter. if ( - ( &xFactory == NULL ) || ( &xOwner == NULL ) || - ( xFactory.is() == sal_False ) || ( xOwner.is() == sal_False ) || ( pFrameContainer == NULL ) ) diff --git a/framework/source/inc/dispatch/loaddispatcher.hxx b/framework/source/inc/dispatch/loaddispatcher.hxx index c4f866577ccc..51e06de59be0 100644 --- a/framework/source/inc/dispatch/loaddispatcher.hxx +++ b/framework/source/inc/dispatch/loaddispatcher.hxx @@ -45,7 +45,7 @@ class LoadDispatcher : private ThreadHelpBase private: /** @short can be used to create own needed services on demand. */ - css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + css::uno::Reference< css::uno::XComponentContext > m_xContext; /** @short TODO document me */ css::uno::WeakReference< css::frame::XFrame > m_xOwnerFrame; @@ -70,7 +70,7 @@ class LoadDispatcher : private ThreadHelpBase That means: It can be used to load any further requested content into tzhe here(!) specified target frame. - @param xSMGR + @param xContext will be used to create own needed services on demand. @param xOwnerFrame @@ -83,8 +83,8 @@ class LoadDispatcher : private ThreadHelpBase @param nSearchFlags used in case sTargetFrame isnt a special one. */ - LoadDispatcher(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , - const css::uno::Reference< css::frame::XFrame >& xOwnerFrame , + LoadDispatcher(const css::uno::Reference< css::uno::XComponentContext >& xContext, + const css::uno::Reference< css::frame::XFrame >& xOwnerFrame , const OUString sTargetName , sal_Int32 nSearchFlags); diff --git a/framework/source/inc/dispatch/windowcommanddispatch.hxx b/framework/source/inc/dispatch/windowcommanddispatch.hxx index 9624e9c99fa0..64fc5e41a1d9 100644 --- a/framework/source/inc/dispatch/windowcommanddispatch.hxx +++ b/framework/source/inc/dispatch/windowcommanddispatch.hxx @@ -48,7 +48,7 @@ class WindowCommandDispatch : private ThreadHelpBase private: /// can be used to create own needed services on demand. - css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + css::uno::Reference< css::uno::XComponentContext > m_xContext; /// knows the frame, where we dispatch our commands as weak reference css::uno::WeakReference< css::frame::XFrame > m_xFrame; @@ -69,13 +69,13 @@ class WindowCommandDispatch : private ThreadHelpBase Means: 1 MACDispatch object is bound to 1 Frame/Window pair in which context the detected commands will be executed. - @param xSMGR + @param xContext will be used to create own needed services on demand. @param xFrame used as for new detected commands. */ - WindowCommandDispatch(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , + WindowCommandDispatch(const css::uno::Reference< css::uno::XComponentContext >& xContext , const css::uno::Reference< css::frame::XFrame >& xFrame); //_______________________________________ diff --git a/framework/source/inc/loadenv/loadenv.hxx b/framework/source/inc/loadenv/loadenv.hxx index f8c78193eb7b..dc62622306bd 100644 --- a/framework/source/inc/loadenv/loadenv.hxx +++ b/framework/source/inc/loadenv/loadenv.hxx @@ -110,7 +110,7 @@ private: /** @short reference to an uno service manager, which must be used to created on needed services on demand. */ - css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + css::uno::Reference< css::uno::XComponentContext > m_xContext; /** @short points to the frame, which uses this LoadEnv object and must be used to start target search there. @@ -200,7 +200,7 @@ public: /** @short initialize a new instance of this load environment. - @param xSMGR + @param xContext reference to an uno service manager, which can be used internaly to create on needed services on demand. @@ -209,7 +209,7 @@ public: @throw A RuntimeException in case any internal process indicates, that the whole runtime cant be used any longer. */ - LoadEnv(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR) + LoadEnv(const css::uno::Reference< css::uno::XComponentContext >& xContext) throw(LoadEnvException, css::uno::RuntimeException); /** @short deinitialize an instance of this class in the right way. @@ -217,7 +217,7 @@ public: ~LoadEnv(); static css::uno::Reference< css::lang::XComponent > loadComponentFromURL(const css::uno::Reference< css::frame::XComponentLoader >& xLoader, - const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , + const css::uno::Reference< css::uno::XComponentContext >& xContext, const OUString& sURL , const OUString& sTarget, sal_Int32 nFlags , diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index 6796fd210e16..b8a584092982 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -129,10 +129,10 @@ class LoadEnvListener : private ThreadHelpBase }; -LoadEnv::LoadEnv(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR) +LoadEnv::LoadEnv(const css::uno::Reference< css::uno::XComponentContext >& xContext) throw(LoadEnvException, css::uno::RuntimeException) : ThreadHelpBase( ) - , m_xSMGR (xSMGR) + , m_xContext (xContext) , m_pQuietInteraction( 0 ) { } @@ -144,7 +144,7 @@ LoadEnv::~LoadEnv() css::uno::Reference< css::lang::XComponent > LoadEnv::loadComponentFromURL(const css::uno::Reference< css::frame::XComponentLoader >& xLoader, - const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , + const css::uno::Reference< css::uno::XComponentContext >& xContext , const OUString& sURL , const OUString& sTarget, sal_Int32 nFlags , @@ -157,7 +157,7 @@ css::uno::Reference< css::lang::XComponent > LoadEnv::loadComponentFromURL(const try { - LoadEnv aEnv(xSMGR); + LoadEnv aEnv(xContext); aEnv.initializeLoading(sURL, lArgs, @@ -268,7 +268,7 @@ void LoadEnv::initializeLoading(const OUString& // parse it - because some following code require that m_aURL.Complete = sURL; - css::uno::Reference< css::util::XURLTransformer > xParser(css::util::URLTransformer::create(::comphelper::getComponentContext(m_xSMGR))); + css::uno::Reference< css::util::XURLTransformer > xParser(css::util::URLTransformer::create(m_xContext)); xParser->parseStrict(m_aURL); // BTW: Split URL and JumpMark ... @@ -294,7 +294,7 @@ void LoadEnv::initializeLoading(const OUString& ( m_lMediaDescriptor.getUnpackedValueOrDefault( ::comphelper::MediaDescriptor::PROP_PREVIEW(), sal_False ) == sal_False ); initializeUIDefaults( - comphelper::getComponentContext(m_xSMGR), + m_xContext, m_lMediaDescriptor, bUIMode, &m_pQuietInteraction @@ -791,7 +791,7 @@ void LoadEnv::impl_detectTypeAndFilter() // we can't use as an in/out parameter here. Copy it before and dont forget to // update structure afterwards again! css::uno::Sequence< css::beans::PropertyValue > lDescriptor = m_lMediaDescriptor.getAsConstPropertyValueList(); - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; + css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; aReadLock.unlock(); // <- SAFE @@ -808,7 +808,7 @@ void LoadEnv::impl_detectTypeAndFilter() return; } - css::uno::Reference< css::document::XTypeDetection > xDetect(xSMGR->createInstance(SERVICENAME_TYPEDETECTION), css::uno::UNO_QUERY); + css::uno::Reference< css::document::XTypeDetection > xDetect( xContext->getServiceManager()->createInstanceWithContext(SERVICENAME_TYPEDETECTION, xContext), css::uno::UNO_QUERY); if (xDetect.is()) sType = xDetect->queryTypeByDescriptor(lDescriptor, sal_True); /*TODO should deep detection be able for enable/disable it from outside? */ @@ -869,7 +869,7 @@ void LoadEnv::impl_detectTypeAndFilter() sal_Bool bIsOwnTemplate = sal_False; if (!sFilter.isEmpty()) { - css::uno::Reference< css::container::XNameAccess > xFilterCont(xSMGR->createInstance(SERVICENAME_FILTERFACTORY), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::container::XNameAccess > xFilterCont(xContext->getServiceManager()->createInstanceWithContext(SERVICENAME_FILTERFACTORY, xContext), css::uno::UNO_QUERY_THROW); try { ::comphelper::SequenceAsHashMap lFilterProps(xFilterCont->getByName(sFilter)); @@ -910,7 +910,8 @@ sal_Bool LoadEnv::impl_handleContent() css::util::URL aURL = m_aURL; // get necessary container to query for a handler object - css::uno::Reference< css::lang::XMultiServiceFactory > xFactory(m_xSMGR->createInstance(SERVICENAME_CONTENTHANDLERFACTORY), css::uno::UNO_QUERY); + css::uno::Reference< css::lang::XMultiServiceFactory > xFactory(m_xContext->getServiceManager()->createInstanceWithContext(SERVICENAME_CONTENTHANDLERFACTORY, m_xContext), css::uno::UNO_QUERY); + css::uno::Reference< css::container::XContainerQuery > xQuery (xFactory , css::uno::UNO_QUERY); aReadLock.unlock(); @@ -965,7 +966,7 @@ sal_Bool LoadEnv::impl_furtherDocsAllowed() { // SAFE -> ReadGuard aReadLock(m_aLock); - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; + css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; aReadLock.unlock(); // <- SAFE @@ -974,7 +975,7 @@ sal_Bool LoadEnv::impl_furtherDocsAllowed() try { css::uno::Any aVal = ::comphelper::ConfigurationHelper::readDirectKey( - comphelper::getComponentContext(xSMGR), + xContext, OUString("org.openoffice.Office.Common/"), OUString("Misc"), OUString("MaxOpenDocuments"), @@ -990,7 +991,7 @@ sal_Bool LoadEnv::impl_furtherDocsAllowed() aVal >>= nMaxOpenDocuments; css::uno::Reference< css::frame::XFramesSupplier > xDesktop( - css::frame::Desktop::create( comphelper::getComponentContext(xSMGR)), + css::frame::Desktop::create(xContext), css::uno::UNO_QUERY_THROW); FrameListAnalyzer aAnalyzer(xDesktop, @@ -1193,7 +1194,7 @@ css::uno::Reference< css::uno::XInterface > LoadEnv::impl_searchLoader() { try { - return m_xSMGR->createInstance(IMPLEMENTATIONNAME_GENERICFRAMELOADER); + return m_xContext->getServiceManager()->createInstanceWithContext(IMPLEMENTATIONNAME_GENERICFRAMELOADER, m_xContext); } catch(const css::uno::RuntimeException&) { throw; } @@ -1210,7 +1211,7 @@ css::uno::Reference< css::uno::XInterface > LoadEnv::impl_searchLoader() throw LoadEnvException(LoadEnvException::ID_INVALID_MEDIADESCRIPTOR); // try to locate any interested frame loader - css::uno::Reference< css::lang::XMultiServiceFactory > xLoaderFactory(m_xSMGR->createInstance(SERVICENAME_FRAMELOADERFACTORY), css::uno::UNO_QUERY); + css::uno::Reference< css::lang::XMultiServiceFactory > xLoaderFactory(m_xContext->getServiceManager()->createInstanceWithContext(SERVICENAME_FRAMELOADERFACTORY, m_xContext), css::uno::UNO_QUERY); css::uno::Reference< css::container::XContainerQuery > xQuery (xLoaderFactory , css::uno::UNO_QUERY); aReadLock.unlock(); @@ -1261,14 +1262,14 @@ void LoadEnv::impl_jumpToMark(const css::uno::Reference< css::frame::XFrame >& x // SAFE -> ReadGuard aReadLock(m_aLock); - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; + css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; aReadLock.unlock(); // <- SAFE css::util::URL aCmd; aCmd.Complete = OUString(".uno:JumpToMark"); - css::uno::Reference< css::util::XURLTransformer > xParser(css::util::URLTransformer::create(::comphelper::getComponentContext(m_xSMGR))); + css::uno::Reference< css::util::XURLTransformer > xParser(css::util::URLTransformer::create(xContext)); xParser->parseStrict(aCmd); css::uno::Reference< css::frame::XDispatch > xDispatcher = xProvider->queryDispatch(aCmd, SPECIALTARGET_SELF, 0); @@ -1313,7 +1314,7 @@ css::uno::Reference< css::frame::XFrame > LoadEnv::impl_searchAlreadyLoaded() // otherwise - iterate through the tasks of the desktop container // to find out, which of them might contains the requested document - css::uno::Reference< css::frame::XDesktop2 > xSupplier = css::frame::Desktop::create( comphelper::getComponentContext(m_xSMGR) ); + css::uno::Reference< css::frame::XDesktop2 > xSupplier = css::frame::Desktop::create( m_xContext ); css::uno::Reference< css::container::XIndexAccess > xTaskList(xSupplier->getFrames() , css::uno::UNO_QUERY); if (!xTaskList.is()) @@ -1454,7 +1455,7 @@ css::uno::Reference< css::frame::XFrame > LoadEnv::impl_searchRecycleTarget() if (m_lMediaDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_HIDDEN(), sal_False) == sal_True) return css::uno::Reference< css::frame::XFrame >(); - css::uno::Reference< css::frame::XFramesSupplier > xSupplier( css::frame::Desktop::create( comphelper::getComponentContext(m_xSMGR) ), css::uno::UNO_QUERY); + css::uno::Reference< css::frame::XFramesSupplier > xSupplier( css::frame::Desktop::create( m_xContext ), css::uno::UNO_QUERY); FrameListAnalyzer aTasksAnalyzer(xSupplier, css::uno::Reference< css::frame::XFrame >(), FrameListAnalyzer::E_BACKINGCOMPONENT); if (aTasksAnalyzer.m_xBackingComponent.is()) { @@ -1696,7 +1697,7 @@ void LoadEnv::impl_makeFrameWindowVisible(const css::uno::Reference< css::awt::X { // SAFE -> ---------------------------------- ReadGuard aReadLock(m_aLock); - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR( m_xSMGR.get(), css::uno::UNO_QUERY ); + css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; aReadLock.unlock(); // <- SAFE ---------------------------------- @@ -1712,7 +1713,7 @@ void LoadEnv::impl_makeFrameWindowVisible(const css::uno::Reference< css::awt::X { css::uno::Any const a = ::comphelper::ConfigurationHelper::readDirectKey( - comphelper::getComponentContext(xSMGR), + xContext, OUString("org.openoffice.Office.Common/View"), OUString("NewDocumentHandling"), OUString("ForceFocusAndToFront"), @@ -1776,7 +1777,7 @@ void LoadEnv::impl_applyPersistentWindowState(const css::uno::Reference< css::aw if (sFilter.isEmpty()) return; - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; + css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; aReadLock.unlock(); // <- SAFE @@ -1785,14 +1786,14 @@ void LoadEnv::impl_applyPersistentWindowState(const css::uno::Reference< css::aw { // retrieve the module name from the filter configuration css::uno::Reference< css::container::XNameAccess > xFilterCfg( - xSMGR->createInstance(SERVICENAME_FILTERFACTORY), + xContext->getServiceManager()->createInstanceWithContext(SERVICENAME_FILTERFACTORY, xContext), css::uno::UNO_QUERY_THROW); ::comphelper::SequenceAsHashMap lProps (xFilterCfg->getByName(sFilter)); OUString sModule = lProps.getUnpackedValueOrDefault(FILTER_PROPNAME_DOCUMENTSERVICE, OUString()); // get access to the configuration of this office module css::uno::Reference< css::container::XNameAccess > xModuleCfg(::comphelper::ConfigurationHelper::openConfig( - comphelper::getComponentContext(xSMGR), + xContext, PACKAGE_SETUP_MODULES, ::comphelper::ConfigurationHelper::E_READONLY), css::uno::UNO_QUERY_THROW); diff --git a/framework/source/services/backingcomp.cxx b/framework/source/services/backingcomp.cxx index 88515c03f10f..b7c1c4ee3f1a 100644 --- a/framework/source/services/backingcomp.cxx +++ b/framework/source/services/backingcomp.cxx @@ -459,7 +459,7 @@ void SAL_CALL BackingComp::attachFrame( /*IN*/ const css::uno::Reference< css::f m_xFrame = xFrame; // establish drag&drop mode - ::framework::DropTargetListener* pDropListener = new ::framework::DropTargetListener(m_xSMGR, m_xFrame); + ::framework::DropTargetListener* pDropListener = new ::framework::DropTargetListener( comphelper::getComponentContext(m_xSMGR), m_xFrame); m_xDropTargetListener = css::uno::Reference< css::datatransfer::dnd::XDropTargetListener >(static_cast< ::cppu::OWeakObject* >(pDropListener), css::uno::UNO_QUERY); css::uno::Reference< css::awt::XToolkit2 > xToolkit = css::awt::Toolkit::create( comphelper::getComponentContext(m_xSMGR) ); diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx index 6e8edbea9b2c..50004f382f77 100644 --- a/framework/source/services/desktop.cxx +++ b/framework/source/services/desktop.cxx @@ -137,14 +137,14 @@ DEFINE_INIT_SERVICE ( Desktop, // We hold member as reference ... not as pointer too! // Attention: We share our frame container with this helper. Container is threadsafe himself ... So I think we can do that. // But look on dispose() for right order of deinitialization. - OFrames* pFramesHelper = new OFrames( m_xFactory, this, &m_aChildTaskContainer ); + OFrames* pFramesHelper = new OFrames( this, &m_aChildTaskContainer ); m_xFramesHelper = css::uno::Reference< css::frame::XFrames >( static_cast< ::cppu::OWeakObject* >(pFramesHelper), css::uno::UNO_QUERY ); //------------------------------------------------------------------------------------------------------------- // Initialize a new dispatchhelper-object to handle dispatches. // We use these helper as slave for our interceptor helper ... not directly! // But he is event listener on THIS instance! - DispatchProvider* pDispatchHelper = new DispatchProvider( m_xFactory, this ); + DispatchProvider* pDispatchHelper = new DispatchProvider( comphelper::getComponentContext(m_xFactory), this ); css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider( static_cast< ::cppu::OWeakObject* >(pDispatchHelper), css::uno::UNO_QUERY ); //------------------------------------------------------------------------------------------------------------- @@ -648,7 +648,7 @@ css::uno::Reference< css::lang::XComponent > SAL_CALL Desktop::loadComponentFrom aReadLock.unlock(); RTL_LOGFILE_PRODUCT_CONTEXT( aLog2, "PERFORMANCE - Desktop::loadComponentFromURL()" ); - return LoadEnv::loadComponentFromURL(xThis, xSMGR, sURL, sTargetFrameName, nSearchFlags, lArguments); + return LoadEnv::loadComponentFromURL(xThis, comphelper::getComponentContext(xSMGR), sURL, sTargetFrameName, nSearchFlags, lArguments); } /*-************************************************************************************************************//** @@ -1050,7 +1050,7 @@ css::uno::Reference< css::frame::XFrame > SAL_CALL Desktop::findFrame( const OUS //----------------------------------------------------------------------------------------------------- if ( sTargetFrameName==SPECIALTARGET_BLANK ) { - TaskCreator aCreator(xFactory); + TaskCreator aCreator( comphelper::getComponentContext(xFactory) ); xTarget = aCreator.createTask(sTargetFrameName,sal_False); } @@ -1148,7 +1148,7 @@ css::uno::Reference< css::frame::XFrame > SAL_CALL Desktop::findFrame( const OUS (nSearchFlags & css::frame::FrameSearchFlag::CREATE) ) { - TaskCreator aCreator(xFactory); + TaskCreator aCreator( comphelper::getComponentContext(xFactory) ); xTarget = aCreator.createTask(sTargetFrameName,sal_False); } } diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index 3fff17d34392..6dbdc2aad84e 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -146,7 +146,7 @@ DEFINE_XTYPEPROVIDER_21 ( Frame css::frame::XTitleChangeBroadcaster ) -DEFINE_XSERVICEINFO_MULTISERVICE ( Frame , +DEFINE_XSERVICEINFO_MULTISERVICE_2 ( Frame , ::cppu::OWeakObject , "com.sun.star.frame.Frame" , OUString("com.sun.star.comp.framework.Frame") @@ -165,11 +165,11 @@ DEFINE_INIT_SERVICE ( Frame, // Initialize a new dispatchhelper-object to handle dispatches. // We use these helper as slave for our interceptor helper ... not directly! // But he is event listener on THIS instance! - DispatchProvider* pDispatchHelper = new DispatchProvider( m_xFactory, this ); + DispatchProvider* pDispatchHelper = new DispatchProvider( m_xContext, this ); css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider( static_cast< ::cppu::OWeakObject* >(pDispatchHelper), css::uno::UNO_QUERY ); //------------------------------------------------------------------------------------------------------------- - DispatchInformationProvider* pInfoHelper = new DispatchInformationProvider(m_xFactory, this); + DispatchInformationProvider* pInfoHelper = new DispatchInformationProvider(m_xContext, this); m_xDispatchInfoHelper = css::uno::Reference< css::frame::XDispatchInformationProvider >( static_cast< ::cppu::OWeakObject* >(pInfoHelper), css::uno::UNO_QUERY ); //------------------------------------------------------------------------------------------------------------- @@ -185,13 +185,13 @@ DEFINE_INIT_SERVICE ( Frame, // We hold member as reference ... not as pointer too! // Attention: We share our frame container with this helper. Container is threadsafe himself ... So I think we can do that. // But look on dispose() for right order of deinitialization. - OFrames* pFramesHelper = new OFrames( m_xFactory, this, &m_aChildFrameContainer ); + OFrames* pFramesHelper = new OFrames( this, &m_aChildFrameContainer ); m_xFramesHelper = css::uno::Reference< css::frame::XFrames >( static_cast< ::cppu::OWeakObject* >(pFramesHelper), css::uno::UNO_QUERY ); //------------------------------------------------------------------------------------------------------------- // Initialize a the drop target listener. // We hold member as reference ... not as pointer too! - DropTargetListener* pDropListener = new DropTargetListener( m_xFactory, this ); + DropTargetListener* pDropListener = new DropTargetListener( m_xContext, this ); m_xDropTargetListener = css::uno::Reference< css::datatransfer::dnd::XDropTargetListener >( static_cast< ::cppu::OWeakObject* >(pDropListener), css::uno::UNO_QUERY ); // Safe impossible cases @@ -208,7 +208,7 @@ DEFINE_INIT_SERVICE ( Frame, //------------------------------------------------------------------------------------------------------------- // Create an initial layout manager // Create layout manager and connect it to the newly created frame - m_xLayoutManager = css::uno::Reference< css::frame::XLayoutManager >(m_xFactory->createInstance(SERVICENAME_LAYOUTMANAGER), css::uno::UNO_QUERY); + m_xLayoutManager.set(m_xContext->getServiceManager()->createInstanceWithContext(SERVICENAME_LAYOUTMANAGER, m_xContext), css::uno::UNO_QUERY); //------------------------------------------------------------------------------------------------------------- // set information about all supported properties at the base class helper PropertySetHelper @@ -231,22 +231,21 @@ DEFINE_INIT_SERVICE ( Frame, @seealso method DEFINE_INIT_SERVICE() - @param "xFactory" is the multi service manager, which create this instance. - The value must be different from NULL! + @param xContext is the multi service manager, which creates this instance. + The value must be different from NULL! @return - @onerror ASSERT in debug version or nothing in relaese version. *//*-*****************************************************************************************************/ -Frame::Frame( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ) +Frame::Frame( const css::uno::Reference< css::uno::XComponentContext >& xContext ) : ThreadHelpBase ( &Application::GetSolarMutex() ) , TransactionBase ( ) - , PropertySetHelper ( xFactory, - &m_aLock, + , PropertySetHelper ( &m_aLock, &m_aTransactionManager, sal_False) // sal_False => dont release shared mutex on calling us! , ::cppu::OWeakObject ( ) // init member - , m_xFactory ( xFactory ) + , m_xContext ( xContext ) , m_aListenerContainer ( m_aLock.getShareableOslMutex() ) , m_xParent ( ) , m_xContainerWindow ( ) @@ -264,7 +263,7 @@ Frame::Frame( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFac , m_aChildFrameContainer ( ) { // Check incoming parameter to avoid against wrong initialization. - LOG_ASSERT2( implcp_ctor( xFactory ), "Frame::Frame()", "Invalid parameter detected!" ) + LOG_ASSERT2( implcp_ctor( xContext ), "Frame::Frame()", "Invalid parameter detected!" ) /* Please have a look on "@attentions" of description before! */ } @@ -322,10 +321,10 @@ css::uno::Reference< css::lang::XComponent > SAL_CALL Frame::loadComponentFromUR ReadGuard aReadLock(m_aLock); css::uno::Reference< css::frame::XComponentLoader > xThis(static_cast< css::frame::XComponentLoader* >(this), css::uno::UNO_QUERY); - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xFactory; + css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; aReadLock.unlock(); - return LoadEnv::loadComponentFromURL(xThis, xSMGR, sURL, sTargetFrameName, nSearchFlags, lArguments); + return LoadEnv::loadComponentFromURL(xThis, xContext, sURL, sTargetFrameName, nSearchFlags, lArguments); } /*-****************************************************************************************************//** @@ -554,8 +553,8 @@ void SAL_CALL Frame::initialize( const css::uno::Reference< css::awt::XWindow >& if (pWindow && pWindow->IsVisible()) m_bIsHidden = sal_False; - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xFactory; - css::uno::Reference< css::frame::XLayoutManager > xLayoutManager = m_xLayoutManager; + css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; + css::uno::Reference< css::frame::XLayoutManager > xLayoutManager = m_xLayoutManager; // Release lock ... because we call some impl methods, which are threadsafe by himself. // If we hold this lock - we will produce our own deadlock! @@ -568,7 +567,7 @@ 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 = - css::task::StatusIndicatorFactory::createWithFrame(comphelper::getComponentContext(xSMGR), xThis, sal_False/*DisableReschedule*/, sal_True/*AllowParentShow*/ ); + css::task::StatusIndicatorFactory::createWithFrame(xContext, xThis, sal_False/*DisableReschedule*/, sal_True/*AllowParentShow*/ ); // SAFE -> ---------------------------------- aWriteLock.lock(); @@ -582,10 +581,10 @@ void SAL_CALL Frame::initialize( const css::uno::Reference< css::awt::XWindow >& impl_enablePropertySet(); - m_pWindowCommandDispatch = new WindowCommandDispatch(xSMGR, this); + m_pWindowCommandDispatch = new WindowCommandDispatch(xContext, this); // Initialize title functionality - TitleHelper* pTitleHelper = new TitleHelper( comphelper::getComponentContext(xSMGR) ); + TitleHelper* pTitleHelper = new TitleHelper( xContext ); m_xTitleHelper = css::uno::Reference< css::frame::XTitle >(static_cast< ::cppu::OWeakObject* >(pTitleHelper), css::uno::UNO_QUERY_THROW); pTitleHelper->setOwner(xThis); } @@ -769,7 +768,7 @@ css::uno::Reference< css::frame::XFrame > SAL_CALL Frame::findFrame( const OUStr /* SAFE { */ ReadGuard aReadLock( m_aLock ); css::uno::Reference< css::frame::XFrame > xParent ( m_xParent, css::uno::UNO_QUERY ); - css::uno::Reference< css::lang::XMultiServiceFactory > xFactory = m_xFactory; + css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; sal_Bool bIsTopFrame = m_bIsFrameTop; sal_Bool bIsTopWindow = WindowHelper::isTopWindow(m_xContainerWindow); aReadLock.unlock(); @@ -782,7 +781,7 @@ css::uno::Reference< css::frame::XFrame > SAL_CALL Frame::findFrame( const OUStr //----------------------------------------------------------------------------------------------------- if ( sTargetFrameName==SPECIALTARGET_BLANK ) { - TaskCreator aCreator(xFactory); + TaskCreator aCreator(xContext); xTarget = aCreator.createTask(sTargetFrameName,sal_False); } @@ -989,7 +988,7 @@ css::uno::Reference< css::frame::XFrame > SAL_CALL Frame::findFrame( const OUStr (nSearchFlags & css::frame::FrameSearchFlag::CREATE) ) { - TaskCreator aCreator(xFactory); + TaskCreator aCreator(xContext); xTarget = aCreator.createTask(sTargetFrameName,sal_False); } } @@ -1936,7 +1935,7 @@ void SAL_CALL Frame::dispose() throw( css::uno::RuntimeException ) // Release some other references. // This calls should be easy ... I hope it :-) m_xDispatchHelper.clear(); - m_xFactory.clear(); + m_xContext.clear(); m_xDropTargetListener.clear(); m_xDispatchRecorderSupplier.clear(); m_xLayoutManager.clear(); @@ -2347,13 +2346,13 @@ void SAL_CALL Frame::windowClosing( const css::lang::EventObject& ) throw( css:: /* SAFE */ ReadGuard aReadLock( m_aLock ); - css::uno::Reference< css::lang::XMultiServiceFactory > xFactory = m_xFactory; + css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; aReadLock.unlock(); /* SAFE */ css::util::URL aURL; aURL.Complete = DECLARE_ASCII(".uno:CloseFrame"); - css::uno::Reference< css::util::XURLTransformer > xParser(css::util::URLTransformer::create(::comphelper::getComponentContext(xFactory))); + css::uno::Reference< css::util::XURLTransformer > xParser(css::util::URLTransformer::create(xContext)); xParser->parseStrict(aURL); css::uno::Reference< css::frame::XDispatch > xCloser = queryDispatch(aURL, SPECIALTARGET_SELF, 0); @@ -2394,7 +2393,7 @@ void SAL_CALL Frame::windowShown( const css::lang::EventObject& ) throw(css::uno /* SAFE { */ ReadGuard aReadLock(m_aLock); css::uno::Reference< css::frame::XDesktop > xDesktopCheck( m_xParent, css::uno::UNO_QUERY ); - css::uno::Reference< css::lang::XMultiServiceFactory > xFactory = m_xFactory; + css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; m_bIsHidden = sal_False; aReadLock.unlock(); /* } SAFE */ @@ -2413,7 +2412,7 @@ void SAL_CALL Frame::windowShown( const css::lang::EventObject& ) throw(css::uno if (bMustBeTriggered) { css::uno::Reference< css::task::XJobExecutor > xExecutor - = css::task::JobExecutor::create( comphelper::getComponentContext(xFactory) ); + = css::task::JobExecutor::create( xContext ); xExecutor->trigger( DECLARE_ASCII("onFirstVisibleTask") ); } } @@ -2935,7 +2934,7 @@ void Frame::implts_startWindowListening() // Make snapshot of necessary member! ReadGuard aReadLock( m_aLock ); css::uno::Reference< css::awt::XWindow > xContainerWindow = m_xContainerWindow ; - css::uno::Reference< css::lang::XMultiServiceFactory > xFactory = m_xFactory ; + css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; css::uno::Reference< css::datatransfer::dnd::XDropTargetListener > xDragDropListener = m_xDropTargetListener; css::uno::Reference< css::awt::XWindowListener > xWindowListener ( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY ); css::uno::Reference< css::awt::XFocusListener > xFocusListener ( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY ); @@ -2953,7 +2952,7 @@ void Frame::implts_startWindowListening() { xTopWindow->addTopWindowListener( xTopWindowListener ); - css::uno::Reference< css::awt::XToolkit2 > xToolkit = css::awt::Toolkit::create( comphelper::getComponentContext(xFactory) ); + css::uno::Reference< css::awt::XToolkit2 > xToolkit = css::awt::Toolkit::create( xContext ); css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget = xToolkit->getDropTarget( xContainerWindow ); if( xDropTarget.is() == sal_True ) { @@ -2975,7 +2974,7 @@ void Frame::implts_stopWindowListening() // Make snapshot of necessary member! ReadGuard aReadLock( m_aLock ); css::uno::Reference< css::awt::XWindow > xContainerWindow = m_xContainerWindow ; - css::uno::Reference< css::lang::XMultiServiceFactory > xFactory = m_xFactory ; + css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext ; css::uno::Reference< css::datatransfer::dnd::XDropTargetListener > xDragDropListener = m_xDropTargetListener; css::uno::Reference< css::awt::XWindowListener > xWindowListener ( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY ); css::uno::Reference< css::awt::XFocusListener > xFocusListener ( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY ); @@ -2993,7 +2992,7 @@ void Frame::implts_stopWindowListening() { xTopWindow->removeTopWindowListener( xTopWindowListener ); - css::uno::Reference< css::awt::XToolkit2 > xToolkit = css::awt::Toolkit::create( comphelper::getComponentContext(xFactory) ); + css::uno::Reference< css::awt::XToolkit2 > xToolkit = css::awt::Toolkit::create( xContext ); css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget = xToolkit->getDropTarget( xContainerWindow ); if( xDropTarget.is() == sal_True ) { @@ -3178,11 +3177,11 @@ void Frame::impl_checkMenuCloser() //***************************************************************************************************************** // We don't accept null pointer or references! -sal_Bool Frame::implcp_ctor( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ) +sal_Bool Frame::implcp_ctor( const css::uno::Reference< css::uno::XComponentContext >& xContext ) { return ( - ( &xFactory == NULL ) || - ( xFactory.is() == sal_False ) + ( &xContext == NULL ) || + ( xContext.is() == sal_False ) ); } diff --git a/framework/source/services/tabwindowservice.cxx b/framework/source/services/tabwindowservice.cxx index bbfd98641522..39b5d35a110c 100644 --- a/framework/source/services/tabwindowservice.cxx +++ b/framework/source/services/tabwindowservice.cxx @@ -80,8 +80,7 @@ TabWindowService::TabWindowService( const css::uno::Reference< css::lang::XMulti // baseclasses and then members. And we need the mutex for other baseclasses !!! : ThreadHelpBase ( &Application::GetSolarMutex() ) , TransactionBase ( ) - , PropertySetHelper ( xFactory , - &m_aLock , + , PropertySetHelper ( &m_aLock , &m_aTransactionManager , sal_False ) // sal_False => dont release shared mutex on calling us! , OWeakObject ( ) |