summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-10-17 13:54:31 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-10-24 17:59:29 +0200
commitd26f3acf2874f64fd89c8197163651443d4b1733 (patch)
treec8207bc122afeffced45e8b530610c19278cafe9 /framework
parente0c4e1f8b7258a3a6e38e4115c03e4315541a8de (diff)
fdo#46808, use service constructor for system::SystemShellExecute
Diffstat (limited to 'framework')
-rw-r--r--framework/inc/dispatch/mailtodispatcher.hxx6
-rw-r--r--framework/inc/dispatch/systemexec.hxx4
-rw-r--r--framework/inc/services.h1
-rw-r--r--framework/source/dispatch/mailtodispatcher.cxx46
-rw-r--r--framework/source/dispatch/systemexec.cxx17
5 files changed, 34 insertions, 40 deletions
diff --git a/framework/inc/dispatch/mailtodispatcher.hxx b/framework/inc/dispatch/mailtodispatcher.hxx
index 91acd5b837de..72ad6396795e 100644
--- a/framework/inc/dispatch/mailtodispatcher.hxx
+++ b/framework/inc/dispatch/mailtodispatcher.hxx
@@ -76,14 +76,14 @@ class MailToDispatcher : // interfaces
private:
/// reference to global uno service manager which had created us
- css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory;
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
/* interface */
public:
// ctor/dtor
- MailToDispatcher( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory );
- virtual ~MailToDispatcher( );
+ MailToDispatcher( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+ virtual ~MailToDispatcher( );
// XInterface, XTypeProvider, XServiceInfo
FWK_DECLARE_XINTERFACE
diff --git a/framework/inc/dispatch/systemexec.hxx b/framework/inc/dispatch/systemexec.hxx
index 3469e42a6b76..c0e2b641c7dc 100644
--- a/framework/inc/dispatch/systemexec.hxx
+++ b/framework/inc/dispatch/systemexec.hxx
@@ -78,13 +78,13 @@ class SystemExec : // interfaces
private:
/// reference to global uno service manager which had created us
- css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory;
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
/* interface */
public:
// ctor/dtor
- SystemExec( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory );
+ SystemExec( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
virtual ~SystemExec( );
// XInterface, XTypeProvider, XServiceInfo
diff --git a/framework/inc/services.h b/framework/inc/services.h
index 6af3d9a06d64..179633660509 100644
--- a/framework/inc/services.h
+++ b/framework/inc/services.h
@@ -55,7 +55,6 @@ namespace framework{
#define SERVICENAME_JOB DECLARE_ASCII("com.sun.star.task.Job" )
#define SERVICENAME_DISPATCHRECORDERSUPPLIER DECLARE_ASCII("com.sun.star.frame.DispatchRecorderSupplier" )
#define SERVICENAME_DISPATCHRECORDER DECLARE_ASCII("com.sun.star.frame.DispatchRecorder" )
-#define SERVICENAME_SYSTEMSHELLEXECUTE DECLARE_ASCII("com.sun.star.system.SystemShellExecute" )
#define SERVICENAME_PROTOCOLHANDLER DECLARE_ASCII("com.sun.star.frame.ProtocolHandler" )
#define SERVICENAME_SUBSTITUTEPATHVARIABLES DECLARE_ASCII("com.sun.star.util.PathSubstitution" )
#define SERVICENAME_PATHSETTINGS DECLARE_ASCII("com.sun.star.util.PathSettings" )
diff --git a/framework/source/dispatch/mailtodispatcher.cxx b/framework/source/dispatch/mailtodispatcher.cxx
index 903e33ce695c..6555f3a885d5 100644
--- a/framework/source/dispatch/mailtodispatcher.cxx
+++ b/framework/source/dispatch/mailtodispatcher.cxx
@@ -31,7 +31,7 @@
#include <general.h>
#include <services.h>
-#include <com/sun/star/system/XSystemShellExecute.hpp>
+#include <com/sun/star/system/SystemShellExecute.hpp>
#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
#include <com/sun/star/frame/DispatchResultState.hpp>
@@ -60,7 +60,7 @@ DEFINE_XTYPEPROVIDER_5(MailToDispatcher ,
css::frame::XNotifyingDispatch,
css::frame::XDispatch )
-DEFINE_XSERVICEINFO_MULTISERVICE(MailToDispatcher ,
+DEFINE_XSERVICEINFO_MULTISERVICE_2(MailToDispatcher ,
::cppu::OWeakObject ,
SERVICENAME_PROTOCOLHANDLER ,
IMPLEMENTATIONNAME_MAILTODISPATCHER)
@@ -81,15 +81,15 @@ DEFINE_INIT_SERVICE(MailToDispatcher,
@short standard ctor
@descr These initialize a new instance of ths class with needed informations for work.
- @param xFactory
+ @param rxContext
reference to uno servicemanager for creation of new services
*/
-MailToDispatcher::MailToDispatcher( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory )
+MailToDispatcher::MailToDispatcher( const css::uno::Reference< css::uno::XComponentContext >& rxContext )
// Init baseclasses first
: ThreadHelpBase( &Application::GetSolarMutex() )
, OWeakObject ( )
// Init member
- , m_xFactory ( xFactory )
+ , m_xContext ( rxContext )
{
}
@@ -101,7 +101,7 @@ MailToDispatcher::MailToDispatcher( const css::uno::Reference< css::lang::XMulti
*/
MailToDispatcher::~MailToDispatcher()
{
- m_xFactory = NULL;
+ m_xContext = NULL;
}
//_________________________________________________________________________________________________________________
@@ -228,29 +228,27 @@ sal_Bool MailToDispatcher::implts_dispatch( const css::util::URL&
{
sal_Bool bSuccess = sal_False;
- css::uno::Reference< css::lang::XMultiServiceFactory > xFactory;
+ css::uno::Reference< css::uno::XComponentContext > xContext;
/* SAFE */{
ReadGuard aReadLock( m_aLock );
- xFactory = m_xFactory;
+ xContext = m_xContext;
/* SAFE */}
- css::uno::Reference< css::system::XSystemShellExecute > xSystemShellExecute( xFactory->createInstance(SERVICENAME_SYSTEMSHELLEXECUTE), css::uno::UNO_QUERY );
- if (xSystemShellExecute.is())
+ css::uno::Reference< css::system::XSystemShellExecute > xSystemShellExecute = css::system::SystemShellExecute::create( xContext );
+
+ try
+ {
+ // start mail client
+ // Because there is no notofocation about success - we use case of
+ // no detected exception as SUCCESS - FAILED otherwhise.
+ xSystemShellExecute->execute( aURL.Complete, ::rtl::OUString(), css::system::SystemShellExecuteFlags::URIS_ONLY );
+ bSuccess = sal_True;
+ }
+ catch (const css::lang::IllegalArgumentException&)
+ {
+ }
+ catch (const css::system::SystemShellExecuteException&)
{
- try
- {
- // start mail client
- // Because there is no notofocation about success - we use case of
- // no detected exception as SUCCESS - FAILED otherwhise.
- xSystemShellExecute->execute( aURL.Complete, ::rtl::OUString(), css::system::SystemShellExecuteFlags::URIS_ONLY );
- bSuccess = sal_True;
- }
- catch (const css::lang::IllegalArgumentException&)
- {
- }
- catch (const css::system::SystemShellExecuteException&)
- {
- }
}
return bSuccess;
diff --git a/framework/source/dispatch/systemexec.cxx b/framework/source/dispatch/systemexec.cxx
index 4d67609b1406..1934552af98e 100644
--- a/framework/source/dispatch/systemexec.cxx
+++ b/framework/source/dispatch/systemexec.cxx
@@ -31,7 +31,7 @@
#include <general.h>
#include <services.h>
-#include <com/sun/star/system/XSystemShellExecute.hpp>
+#include <com/sun/star/system/SystemShellExecute.hpp>
#include <com/sun/star/util/PathSubstitution.hpp>
#include <com/sun/star/util/XStringSubstitution.hpp>
#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
@@ -63,7 +63,7 @@ DEFINE_XTYPEPROVIDER_5(SystemExec ,
css::frame::XNotifyingDispatch,
css::frame::XDispatch )
-DEFINE_XSERVICEINFO_MULTISERVICE(SystemExec ,
+DEFINE_XSERVICEINFO_MULTISERVICE_2(SystemExec ,
::cppu::OWeakObject ,
SERVICENAME_PROTOCOLHANDLER ,
IMPLEMENTATIONNAME_SYSTEMEXEC)
@@ -80,12 +80,12 @@ DEFINE_INIT_SERVICE(SystemExec,
//_________________________________________________________________________________________________________________
-SystemExec::SystemExec( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory )
+SystemExec::SystemExec( const css::uno::Reference< css::uno::XComponentContext >& rxContext )
// Init baseclasses first
: ThreadHelpBase( &Application::GetSolarMutex() )
, OWeakObject ( )
// Init member
- , m_xFactory ( xFactory )
+ , m_xContext ( rxContext )
{
}
@@ -93,7 +93,7 @@ SystemExec::SystemExec( const css::uno::Reference< css::lang::XMultiServiceFacto
SystemExec::~SystemExec()
{
- m_xFactory = NULL;
+ m_xContext = NULL;
}
//_________________________________________________________________________________________________________________
@@ -149,7 +149,7 @@ void SAL_CALL SystemExec::dispatchWithNotification( const css::util::URL&
// 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
@@ -157,14 +157,11 @@ void SAL_CALL SystemExec::dispatchWithNotification( const css::util::URL&
try
{
- css::uno::Reference< css::uno::XComponentContext > xContext( comphelper::getComponentContext(xFactory) );
css::uno::Reference< css::util::XStringSubstitution > xPathSubst( css::util::PathSubstitution::create(xContext) );
::rtl::OUString sSystemURL = xPathSubst->substituteVariables(sSystemURLWithVariables, sal_True); // sal_True force an exception if unknown variables exists !
- css::uno::Reference< css::system::XSystemShellExecute > xShell(
- xFactory->createInstance(SERVICENAME_SYSTEMSHELLEXECUTE),
- css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::system::XSystemShellExecute > xShell = css::system::SystemShellExecute::create( xContext );
xShell->execute(sSystemURL, ::rtl::OUString(), css::system::SystemShellExecuteFlags::URIS_ONLY);
impl_notifyResultListener(xListener, css::frame::DispatchResultState::SUCCESS);