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

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

30#include <dispatch/mailtodispatcher.hxx>
31#include <threadhelp/readguard.hxx>
32#include <general.h>
33#include <services.h>
34
35//_________________________________________________________________________________________________________________
36// interface includes
37//_________________________________________________________________________________________________________________
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

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

30#include <dispatch/mailtodispatcher.hxx>
31#include <threadhelp/readguard.hxx>
32#include <general.h>
33#include <services.h>
34
35//_________________________________________________________________________________________________________________
36// interface includes
37//_________________________________________________________________________________________________________________
38#include <com/sun/star/system/XSystemShellExecute.hpp>
38#include <com/sun/star/system/SystemShellExecute.hpp>
39#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
40#include <com/sun/star/frame/DispatchResultState.hpp>
41
42//_________________________________________________________________________________________________________________
43// includes of other projects
44//_________________________________________________________________________________________________________________
45
46#include <vcl/svapp.hxx>

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

79
80DEFINE_XTYPEPROVIDER_5(MailToDispatcher ,
81 css::lang::XTypeProvider ,
82 css::lang::XServiceInfo ,
83 css::frame::XDispatchProvider ,
84 css::frame::XNotifyingDispatch,
85 css::frame::XDispatch )
86
39#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
40#include <com/sun/star/frame/DispatchResultState.hpp>
41
42//_________________________________________________________________________________________________________________
43// includes of other projects
44//_________________________________________________________________________________________________________________
45
46#include <vcl/svapp.hxx>

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

79
80DEFINE_XTYPEPROVIDER_5(MailToDispatcher ,
81 css::lang::XTypeProvider ,
82 css::lang::XServiceInfo ,
83 css::frame::XDispatchProvider ,
84 css::frame::XNotifyingDispatch,
85 css::frame::XDispatch )
86
87DEFINE_XSERVICEINFO_MULTISERVICE(MailToDispatcher ,
88 ::cppu::OWeakObject ,
89 SERVICENAME_PROTOCOLHANDLER ,
90 IMPLEMENTATIONNAME_MAILTODISPATCHER)
87DEFINE_XSERVICEINFO_MULTISERVICE_2(MailToDispatcher ,
88 ::cppu::OWeakObject ,
89 SERVICENAME_PROTOCOLHANDLER ,
90 IMPLEMENTATIONNAME_MAILTODISPATCHER)
91
92DEFINE_INIT_SERVICE(MailToDispatcher,
93 {
94 /*Attention
95 I think we don't need any mutex or lock here ... because we are called by our own static method impl_createInstance()
96 to create a new instance of this class by our own supported service factory.
97 see macro DEFINE_XSERVICEINFO_MULTISERVICE and "impl_initService()" for further informations!
98 */
99 }
100 )
101
102//_________________________________________________________________________________________________________________
103
104/**
105 @short standard ctor
106 @descr These initialize a new instance of ths class with needed informations for work.
107
91
92DEFINE_INIT_SERVICE(MailToDispatcher,
93 {
94 /*Attention
95 I think we don't need any mutex or lock here ... because we are called by our own static method impl_createInstance()
96 to create a new instance of this class by our own supported service factory.
97 see macro DEFINE_XSERVICEINFO_MULTISERVICE and "impl_initService()" for further informations!
98 */
99 }
100 )
101
102//_________________________________________________________________________________________________________________
103
104/**
105 @short standard ctor
106 @descr These initialize a new instance of ths class with needed informations for work.
107
108 @param xFactory
109 reference to uno servicemanager for creation of new services
108 @param xContext
109 reference to uno component context
110
111 @modified 30.04.2002 14:10, as96863
112*/
110
111 @modified 30.04.2002 14:10, as96863
112*/
113MailToDispatcher::MailToDispatcher( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory )
113MailToDispatcher::MailToDispatcher( const css::uno::Reference< css::uno::XComponentContext >& xContext )
114 // Init baseclasses first
115 : ThreadHelpBase( &Application::GetSolarMutex() )
116 , OWeakObject ( )
117 // Init member
114 // Init baseclasses first
115 : ThreadHelpBase( &Application::GetSolarMutex() )
116 , OWeakObject ( )
117 // Init member
118 , m_xFactory ( xFactory )
118 , m_xContext ( xContext )
119{
120}
121
122//_________________________________________________________________________________________________________________
123
124/**
125 @short standard dtor
126 @descr -
127
128 @modified 30.04.2002 14:10, as96863
129*/
130MailToDispatcher::~MailToDispatcher()
131{
119{
120}
121
122//_________________________________________________________________________________________________________________
123
124/**
125 @short standard dtor
126 @descr -
127
128 @modified 30.04.2002 14:10, as96863
129*/
130MailToDispatcher::~MailToDispatcher()
131{
132 m_xFactory = NULL;
132 m_xContext = NULL;
133}
134
135//_________________________________________________________________________________________________________________
136
137/**
138 @short decide if this dispatch implementation can be used for requested URL or not
139 @descr A protocol handler is registerd for an URL pattern inside configuration and will
140 be asked by the generic dispatch mechanism inside framework, if he can handle this

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

261
262 @modified 30.04.2002 14:49, as96863
263*/
264sal_Bool MailToDispatcher::implts_dispatch( const css::util::URL& aURL ,
265 const css::uno::Sequence< css::beans::PropertyValue >& /*lArguments*/ ) throw( css::uno::RuntimeException )
266{
267 sal_Bool bSuccess = sal_False;
268
133}
134
135//_________________________________________________________________________________________________________________
136
137/**
138 @short decide if this dispatch implementation can be used for requested URL or not
139 @descr A protocol handler is registerd for an URL pattern inside configuration and will
140 be asked by the generic dispatch mechanism inside framework, if he can handle this

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

261
262 @modified 30.04.2002 14:49, as96863
263*/
264sal_Bool MailToDispatcher::implts_dispatch( const css::util::URL& aURL ,
265 const css::uno::Sequence< css::beans::PropertyValue >& /*lArguments*/ ) throw( css::uno::RuntimeException )
266{
267 sal_Bool bSuccess = sal_False;
268
269 css::uno::Reference< css::lang::XMultiServiceFactory > xFactory;
269 css::uno::Reference< css::uno::XComponentContext > xContext;
270 /* SAFE */{
271 ReadGuard aReadLock( m_aLock );
270 /* SAFE */{
271 ReadGuard aReadLock( m_aLock );
272 xFactory = m_xFactory;
272 xContext = m_xContext;
273 /* SAFE */}
274
273 /* SAFE */}
274
275 css::uno::Reference< css::system::XSystemShellExecute > xSystemShellExecute( xFactory->createInstance(SERVICENAME_SYSTEMSHELLEXECUTE), css::uno::UNO_QUERY );
275 css::uno::Reference< css::system::XSystemShellExecute > xSystemShellExecute(
276 css::system::SystemShellExecute::create( xContext ) );
276 if (xSystemShellExecute.is())
277 {
278 try
279 {
280 // start mail client
281 // Because there is no notofocation about success - we use case of
282 // no detected exception as SUCCESS - FAILED otherwhise.
283 xSystemShellExecute->execute( aURL.Complete, ::rtl::OUString(), css::system::SystemShellExecuteFlags::DEFAULTS );

--- 43 unchanged lines hidden ---
277 if (xSystemShellExecute.is())
278 {
279 try
280 {
281 // start mail client
282 // Because there is no notofocation about success - we use case of
283 // no detected exception as SUCCESS - FAILED otherwhise.
284 xSystemShellExecute->execute( aURL.Complete, ::rtl::OUString(), css::system::SystemShellExecuteFlags::DEFAULTS );

--- 43 unchanged lines hidden ---