summaryrefslogtreecommitdiff
path: root/framework/source/jobs
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-05-27 15:15:03 +0200
committerNoel Grandin <noel@peralex.com>2013-05-28 08:10:24 +0200
commit052de9c16bc4018d2ae3edc6282267e04d3956ac (patch)
treec3613a6381e0b07aaac11d4340404b6275930719 /framework/source/jobs
parent8f3cec9d7a50f33c7be5191656720e463712dd83 (diff)
fdo#46808, Convert some XMultiServiceFactory to XComponentContext
Change-Id: I7223d8e2c962ca90eda08119ed73a034d334329d
Diffstat (limited to 'framework/source/jobs')
-rw-r--r--framework/source/jobs/job.cxx20
-rw-r--r--framework/source/jobs/jobdispatch.cxx36
-rw-r--r--framework/source/jobs/jobexecutor.cxx36
3 files changed, 46 insertions, 46 deletions
diff --git a/framework/source/jobs/job.cxx b/framework/source/jobs/job.cxx
index 22d286cdad3d..0629df3553b9 100644
--- a/framework/source/jobs/job.cxx
+++ b/framework/source/jobs/job.cxx
@@ -58,19 +58,19 @@ DEFINE_XTYPEPROVIDER_4( Job ,
Specialized information (e.g. the alias or service name ofthis job) will be set
later using the method setJobData().
- @param xSMGR
+ @param xContext
reference to the uno service manager
@param xFrame
reference to the frame, in which environment we run
(May be null!)
*/
-Job::Job( /*IN*/ const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ,
+Job::Job( /*IN*/ const css::uno::Reference< css::uno::XComponentContext >& xContext ,
/*IN*/ const css::uno::Reference< css::frame::XFrame >& xFrame )
: ThreadHelpBase (&Application::GetSolarMutex())
, ::cppu::OWeakObject ( )
- , m_aJobCfg (comphelper::getComponentContext(xSMGR))
- , m_xSMGR (xSMGR )
+ , m_aJobCfg (xContext )
+ , m_xContext (xContext )
, m_xFrame (xFrame )
, m_bListenOnDesktop (sal_False )
, m_bListenOnFrame (sal_False )
@@ -88,19 +88,19 @@ Job::Job( /*IN*/ const css::uno::Reference< css::lang::XMultiServiceFactory >& x
Specialized information (e.g. the alias or service name ofthis job) will be set
later using the method setJobData().
- @param xSMGR
+ @param xContext
reference to the uno service manager
@param xModel
reference to the model, in which environment we run
(May be null!)
*/
-Job::Job( /*IN*/ const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ,
+Job::Job( /*IN*/ const css::uno::Reference< css::uno::XComponentContext >& xContext ,
/*IN*/ const css::uno::Reference< css::frame::XModel >& xModel )
: ThreadHelpBase (&Application::GetSolarMutex())
, ::cppu::OWeakObject ( )
- , m_aJobCfg (comphelper::getComponentContext(xSMGR))
- , m_xSMGR (xSMGR )
+ , m_aJobCfg (xContext )
+ , m_xContext (xContext )
, m_xModel (xModel )
, m_bListenOnDesktop (sal_False )
, m_bListenOnFrame (sal_False )
@@ -212,7 +212,7 @@ void Job::execute( /*IN*/ const css::uno::Sequence< css::beans::NamedValue >& lD
// create the job
// We must check for the supported interface on demand!
// But we preferr the synchronous one ...
- m_xJob = m_xSMGR->createInstance(m_aJobCfg.getService());
+ m_xJob = m_xContext->getServiceManager()->createInstanceWithContext(m_aJobCfg.getService(), m_xContext);
xSJob = css::uno::Reference< css::task::XJob >(m_xJob, css::uno::UNO_QUERY);
if (!xSJob.is())
xAJob = css::uno::Reference< css::task::XAsyncJob >(m_xJob, css::uno::UNO_QUERY);
@@ -542,7 +542,7 @@ void Job::impl_startListening()
{
try
{
- m_xDesktop = css::frame::Desktop::create( comphelper::getComponentContext(m_xSMGR) );
+ m_xDesktop = css::frame::Desktop::create( m_xContext );
css::uno::Reference< css::frame::XTerminateListener > xThis(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY);
m_xDesktop->addTerminateListener(xThis);
m_bListenOnDesktop = sal_True;
diff --git a/framework/source/jobs/jobdispatch.cxx b/framework/source/jobs/jobdispatch.cxx
index d66feca76179..adc4690fb97e 100644
--- a/framework/source/jobs/jobdispatch.cxx
+++ b/framework/source/jobs/jobdispatch.cxx
@@ -55,11 +55,11 @@ DEFINE_XTYPEPROVIDER_6( JobDispatch ,
css::frame::XDispatch
)
-DEFINE_XSERVICEINFO_MULTISERVICE( JobDispatch ,
- ::cppu::OWeakObject ,
- SERVICENAME_PROTOCOLHANDLER ,
- IMPLEMENTATIONNAME_JOBDISPATCH
- )
+DEFINE_XSERVICEINFO_MULTISERVICE_2( JobDispatch ,
+ ::cppu::OWeakObject ,
+ SERVICENAME_PROTOCOLHANDLER ,
+ IMPLEMENTATIONNAME_JOBDISPATCH
+ )
DEFINE_INIT_SERVICE( JobDispatch,
{
@@ -76,13 +76,13 @@ DEFINE_INIT_SERVICE( JobDispatch,
@short standard ctor
@descr It initialize this new instance.
- @param xSMGR
+ @param xContext
reference to the uno service manager
*/
-JobDispatch::JobDispatch( /*IN*/ const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR )
+JobDispatch::JobDispatch( /*IN*/ const css::uno::Reference< css::uno::XComponentContext >& xContext )
: ThreadHelpBase(&Application::GetSolarMutex())
, OWeakObject ( )
- , m_xSMGR (xSMGR )
+ , m_xContext (xContext )
{
}
@@ -94,8 +94,8 @@ JobDispatch::JobDispatch( /*IN*/ const css::uno::Reference< css::lang::XMultiSer
JobDispatch::~JobDispatch()
{
// release all used resources
- m_xSMGR = css::uno::Reference< css::lang::XMultiServiceFactory >();
- m_xFrame = css::uno::Reference< css::frame::XFrame >();
+ m_xContext.clear();
+ m_xFrame.clear();
}
//________________________________
@@ -121,7 +121,7 @@ void SAL_CALL JobDispatch::initialize( const css::uno::Sequence< css::uno::Any >
lArguments[a] >>= m_xFrame;
css::uno::Reference< css::frame::XModuleManager2 > xModuleManager =
- css::frame::ModuleManager::create(comphelper::getComponentContext(m_xSMGR));
+ css::frame::ModuleManager::create(m_xContext);
try
{
m_sModuleIdentifier = xModuleManager->identify( m_xFrame );
@@ -262,7 +262,7 @@ void JobDispatch::impl_dispatchEvent( /*IN*/ const OUString&
// filter disabled jobs using it's time stamp values.
/* SAFE { */
ReadGuard aReadLock(m_aLock);
- css::uno::Sequence< OUString > lJobs = JobData::getEnabledJobsForEvent(comphelper::getComponentContext(m_xSMGR), sEvent);
+ css::uno::Sequence< OUString > lJobs = JobData::getEnabledJobsForEvent(m_xContext, sEvent);
aReadLock.unlock();
/* } SAFE */
@@ -279,7 +279,7 @@ void JobDispatch::impl_dispatchEvent( /*IN*/ const OUString&
/* SAFE { */
aReadLock.lock();
- JobData aCfg(comphelper::getComponentContext(m_xSMGR));
+ JobData aCfg(m_xContext);
aCfg.setEvent(sEvent, lJobs[j]);
aCfg.setEnvironment(JobData::E_DISPATCH);
const bool bIsEnabled=aCfg.hasCorrectContext(m_sModuleIdentifier);
@@ -289,7 +289,7 @@ void JobDispatch::impl_dispatchEvent( /*IN*/ const OUString&
And freeing of such uno object is done by uno itself.
So we have to use dynamic memory everytimes.
*/
- Job* pJob = new Job(m_xSMGR, m_xFrame);
+ Job* pJob = new Job(m_xContext, m_xFrame);
css::uno::Reference< css::uno::XInterface > xJob(static_cast< ::cppu::OWeakObject* >(pJob), css::uno::UNO_QUERY);
pJob->setJobData(aCfg);
@@ -343,7 +343,7 @@ void JobDispatch::impl_dispatchService( /*IN*/ const OUString&
/* SAFE { */
ReadGuard aReadLock(m_aLock);
- JobData aCfg(comphelper::getComponentContext(m_xSMGR));
+ JobData aCfg(m_xContext);
aCfg.setService(sService);
aCfg.setEnvironment(JobData::E_DISPATCH);
@@ -352,7 +352,7 @@ void JobDispatch::impl_dispatchService( /*IN*/ const OUString&
And freeing of such uno object is done by uno itself.
So we have to use dynamic memory everytimes.
*/
- Job* pJob = new Job(m_xSMGR, m_xFrame);
+ Job* pJob = new Job(m_xContext, m_xFrame);
css::uno::Reference< css::uno::XInterface > xJob(static_cast< ::cppu::OWeakObject* >(pJob), css::uno::UNO_QUERY);
pJob->setJobData(aCfg);
@@ -394,7 +394,7 @@ void JobDispatch::impl_dispatchAlias( /*IN*/ const OUString&
/* SAFE { */
ReadGuard aReadLock(m_aLock);
- JobData aCfg(comphelper::getComponentContext(m_xSMGR));
+ JobData aCfg(m_xContext);
aCfg.setAlias(sAlias);
aCfg.setEnvironment(JobData::E_DISPATCH);
@@ -403,7 +403,7 @@ void JobDispatch::impl_dispatchAlias( /*IN*/ const OUString&
And freeing of such uno object is done by uno itself.
So we have to use dynamic memory everytimes.
*/
- Job* pJob = new Job(m_xSMGR, m_xFrame);
+ Job* pJob = new Job(m_xContext, m_xFrame);
css::uno::Reference< css::uno::XInterface > xJob(static_cast< ::cppu::OWeakObject* >(pJob), css::uno::UNO_QUERY);
pJob->setJobData(aCfg);
diff --git a/framework/source/jobs/jobexecutor.cxx b/framework/source/jobs/jobexecutor.cxx
index 54fe8469ae08..6d6de63c989c 100644
--- a/framework/source/jobs/jobexecutor.cxx
+++ b/framework/source/jobs/jobexecutor.cxx
@@ -62,15 +62,15 @@ DEFINE_XTYPEPROVIDER_6( JobExecutor ,
css::lang::XEventListener
)
-DEFINE_XSERVICEINFO_ONEINSTANCESERVICE( JobExecutor ,
- ::cppu::OWeakObject ,
- "com.sun.star.task.JobExecutor",
- IMPLEMENTATIONNAME_JOBEXECUTOR
- )
+DEFINE_XSERVICEINFO_ONEINSTANCESERVICE_2( JobExecutor ,
+ ::cppu::OWeakObject ,
+ "com.sun.star.task.JobExecutor",
+ IMPLEMENTATIONNAME_JOBEXECUTOR
+ )
DEFINE_INIT_SERVICE( JobExecutor,
{
- m_xModuleManager = css::frame::ModuleManager::create( comphelper::getComponentContext(m_xSMGR) );
+ m_xModuleManager = css::frame::ModuleManager::create( m_xContext );
/*Attention
I think we don't need any mutex or lock here ... because we are called by our own static method impl_createInstance()
@@ -109,15 +109,15 @@ DEFINE_INIT_SERVICE( JobExecutor,
@short standard ctor
@descr It initialize this new instance.
- @param xSMGR
+ @param xContext
reference to the uno service manager
*/
-JobExecutor::JobExecutor( /*IN*/ const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR )
+JobExecutor::JobExecutor( /*IN*/ const css::uno::Reference< css::uno::XComponentContext >& xContext )
: ThreadHelpBase (&Application::GetSolarMutex() )
, ::cppu::OWeakObject ( )
- , m_xSMGR (xSMGR )
+ , m_xContext (xContext )
, m_xModuleManager ( )
- , m_aConfig (comphelper::getComponentContext(xSMGR), OUString::createFromAscii(JobData::EVENTCFG_ROOT) )
+ , m_aConfig (xContext, OUString::createFromAscii(JobData::EVENTCFG_ROOT) )
{
// Don't do any reference related code here! Do it inside special
// impl_ method() ... see DEFINE_INIT_SERVICE() macro for further information.
@@ -157,7 +157,7 @@ void SAL_CALL JobExecutor::trigger( const OUString& sEvent ) throw(css::uno::Run
// get list of all enabled jobs
// The called static helper methods read it from the configuration and
// filter disabled jobs using it's time stamp values.
- css::uno::Sequence< OUString > lJobs = JobData::getEnabledJobsForEvent(comphelper::getComponentContext(m_xSMGR), sEvent);
+ css::uno::Sequence< OUString > lJobs = JobData::getEnabledJobsForEvent(m_xContext, sEvent);
aReadLock.unlock();
/* } SAFE */
@@ -169,7 +169,7 @@ void SAL_CALL JobExecutor::trigger( const OUString& sEvent ) throw(css::uno::Run
/* SAFE { */
aReadLock.lock();
- JobData aCfg(comphelper::getComponentContext(m_xSMGR));
+ JobData aCfg(m_xContext);
aCfg.setEvent(sEvent, lJobs[j]);
aCfg.setEnvironment(JobData::E_EXECUTION);
@@ -178,7 +178,7 @@ void SAL_CALL JobExecutor::trigger( const OUString& sEvent ) throw(css::uno::Run
And freeing of such uno object is done by uno itself.
So we have to use dynamic memory everytimes.
*/
- Job* pJob = new Job(m_xSMGR, css::uno::Reference< css::frame::XFrame >());
+ Job* pJob = new Job(m_xContext, css::uno::Reference< css::frame::XFrame >());
css::uno::Reference< css::uno::XInterface > xJob(static_cast< ::cppu::OWeakObject* >(pJob), css::uno::UNO_QUERY);
pJob->setJobData(aCfg);
@@ -226,7 +226,7 @@ void SAL_CALL JobExecutor::notifyEvent( const css::document::EventObject& aEvent
)
{
if (m_lEvents.find(EVENT_ON_DOCUMENT_OPENED) != m_lEvents.end())
- JobData::appendEnabledJobsForEvent(comphelper::getComponentContext(m_xSMGR), EVENT_ON_DOCUMENT_OPENED, lJobs);
+ JobData::appendEnabledJobsForEvent(m_xContext, EVENT_ON_DOCUMENT_OPENED, lJobs);
}
// Special feature: If the events "OnCreate" or "OnLoadFinished" occures - we generate our own event "onDocumentAdded".
@@ -236,12 +236,12 @@ void SAL_CALL JobExecutor::notifyEvent( const css::document::EventObject& aEvent
)
{
if (m_lEvents.find(EVENT_ON_DOCUMENT_ADDED) != m_lEvents.end())
- JobData::appendEnabledJobsForEvent(comphelper::getComponentContext(m_xSMGR), EVENT_ON_DOCUMENT_ADDED, lJobs);
+ JobData::appendEnabledJobsForEvent(m_xContext, EVENT_ON_DOCUMENT_ADDED, lJobs);
}
// Add all jobs for "real" notified event too .-)
if (m_lEvents.find(aEvent.EventName) != m_lEvents.end())
- JobData::appendEnabledJobsForEvent(comphelper::getComponentContext(m_xSMGR), aEvent.EventName, lJobs);
+ JobData::appendEnabledJobsForEvent(m_xContext, aEvent.EventName, lJobs);
aReadLock.unlock();
/* } SAFE */
@@ -257,7 +257,7 @@ void SAL_CALL JobExecutor::notifyEvent( const css::document::EventObject& aEvent
const JobData::TJob2DocEventBinding& rBinding = *pIt;
- JobData aCfg(comphelper::getComponentContext(m_xSMGR));
+ JobData aCfg(m_xContext);
aCfg.setEvent(rBinding.m_sDocEvent, rBinding.m_sJobName);
aCfg.setEnvironment(JobData::E_DOCUMENTEVENT);
@@ -270,7 +270,7 @@ void SAL_CALL JobExecutor::notifyEvent( const css::document::EventObject& aEvent
So we have to use dynamic memory everytimes.
*/
css::uno::Reference< css::frame::XModel > xModel(aEvent.Source, css::uno::UNO_QUERY);
- Job* pJob = new Job(m_xSMGR, xModel);
+ Job* pJob = new Job(m_xContext, xModel);
css::uno::Reference< css::uno::XInterface > xJob(static_cast< ::cppu::OWeakObject* >(pJob), css::uno::UNO_QUERY);
pJob->setJobData(aCfg);