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
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef __FRAMEWORK_DISPATCH_SYSTEMEXEC_HXX_
25 #define __FRAMEWORK_DISPATCH_SYSTEMEXEC_HXX_
26 
27 //_________________________________________________________________________________________________________________
28 //	my own includes
29 //_________________________________________________________________________________________________________________
30 
31 #include <macros/generic.hxx>
32 #include <macros/xinterface.hxx>
33 #include <macros/xtypeprovider.hxx>
34 #include <macros/xserviceinfo.hxx>
35 #include <macros/debug.hxx>
36 #include <threadhelp/threadhelpbase.hxx>
37 #include <general.h>
38 #include <stdtypes.h>
39 
40 //_________________________________________________________________________________________________________________
41 //	interface includes
42 //_________________________________________________________________________________________________________________
43 #include <com/sun/star/lang/XTypeProvider.hpp>
44 #include <com/sun/star/frame/XNotifyingDispatch.hpp>
45 #include <com/sun/star/frame/XDispatch.hpp>
46 #include <com/sun/star/frame/XDispatchProvider.hpp>
47 #include <com/sun/star/util/URL.hpp>
48 #include <com/sun/star/beans/PropertyValue.hpp>
49 #include <com/sun/star/frame/XStatusListener.hpp>
50 
51 //_________________________________________________________________________________________________________________
52 //	other includes
53 //_________________________________________________________________________________________________________________
54 #include <cppuhelper/weak.hxx>
55 
56 //_________________________________________________________________________________________________________________
57 //	namespace
58 //_________________________________________________________________________________________________________________
59 
60 namespace framework{
61 
62 //_________________________________________________________________________________________________________________
63 //	exported const
64 //_________________________________________________________________________________________________________________
65 
66 //_________________________________________________________________________________________________________________
67 //	exported definitions
68 //_________________________________________________________________________________________________________________
69 
70 /**
71     @short          protocol handler for "systemexec:*" URLs
72     @descr          It's a special dispatch/provider object which is registered for such URL pattern and will
73                     be automaticly used by the framework dispatch mechanism if such URL occured.
74                     It forwards all URL's to the underlying operating system.
75                     So it would e.g. be possible to open HTML files outside the office within a web browser.
76 
77     @base           ThreadHelpBase
78                         exports a lock member to guarantee right initialize value of it
79     @base           OWeakObject
80                         provides XWeak and ref count mechanism
81 
82 	@devstatus		ready to use
83 */
84 class SystemExec : // interfaces
85                        public  css::lang::XTypeProvider      ,
86                        public  css::lang::XServiceInfo       ,
87                        public  css::frame::XDispatchProvider ,
88                        public  css::frame::XNotifyingDispatch, // => XDispatch
89                        // baseclasses
90                        // Order is neccessary for right initialization!
91                        private ThreadHelpBase                ,
92                        public  cppu::OWeakObject
93 {
94     /* member */
95     private:
96         css::uno::Reference< css::uno::XComponentContext > m_xContext;
97 
98     /* interface */
99 	public:
100 
101         // ctor/dtor
102                  SystemExec( const css::uno::Reference< css::uno::XComponentContext >& xContext );
103         virtual ~SystemExec(                                                                        );
104 
105         // XInterface, XTypeProvider, XServiceInfo
106         FWK_DECLARE_XINTERFACE
107 		FWK_DECLARE_XTYPEPROVIDER
108         DECLARE_XSERVICEINFO
109 
110         // XDispatchProvider
111         virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL                       queryDispatch  ( const css::util::URL&                                       aURL        ,
112                                                                                                              const ::rtl::OUString&                                      sTarget     ,
113                                                                                                                    sal_Int32                                             nFlags      ) throw( css::uno::RuntimeException );
114         virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& lDescriptor ) throw( css::uno::RuntimeException );
115 
116         // XNotifyingDispatch
117         virtual void SAL_CALL dispatchWithNotification( const css::util::URL&                                             aURL      ,
118                                                         const css::uno::Sequence< css::beans::PropertyValue >&            lArguments,
119                                                         const css::uno::Reference< css::frame::XDispatchResultListener >& xListener ) throw( css::uno::RuntimeException );
120 
121         // XDispatch
122         virtual void SAL_CALL dispatch            ( const css::util::URL&                                     aURL       ,
123                                                     const css::uno::Sequence< css::beans::PropertyValue >&    lArguments ) throw( css::uno::RuntimeException );
124         virtual void SAL_CALL addStatusListener   ( const css::uno::Reference< css::frame::XStatusListener >& xListener  ,
125                                                     const css::util::URL&                                     aURL       ) throw( css::uno::RuntimeException );
126         virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xListener  ,
127                                                     const css::util::URL&                                     aURL       ) throw( css::uno::RuntimeException );
128 
129     /* internal */
130     private:
131 
132         void impl_notifyResultListener(const css::uno::Reference< css::frame::XDispatchResultListener >& xListener,
133                                        const sal_Int16                                                   nState   );
134 
135 };      //  class SystemExec
136 
137 }		//	namespace framework
138 
139 #endif  //  #ifndef __FRAMEWORK_DISPATCH_SYSTEMEXEC_HXX_
140