1*f8e07b45SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*f8e07b45SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*f8e07b45SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*f8e07b45SAndrew Rist  * distributed with this work for additional information
6*f8e07b45SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*f8e07b45SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*f8e07b45SAndrew Rist  * "License"); you may not use this file except in compliance
9*f8e07b45SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*f8e07b45SAndrew Rist  *
11*f8e07b45SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*f8e07b45SAndrew Rist  *
13*f8e07b45SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*f8e07b45SAndrew Rist  * software distributed under the License is distributed on an
15*f8e07b45SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f8e07b45SAndrew Rist  * KIND, either express or implied.  See the License for the
17*f8e07b45SAndrew Rist  * specific language governing permissions and limitations
18*f8e07b45SAndrew Rist  * under the License.
19*f8e07b45SAndrew Rist  *
20*f8e07b45SAndrew Rist  *************************************************************/
21*f8e07b45SAndrew Rist 
22*f8e07b45SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef __FRAMEWORK_DISPATCH_SERVICEHANDLER_HXX_
25cdf0e10cSrcweir #define __FRAMEWORK_DISPATCH_SERVICEHANDLER_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir //_________________________________________________________________________________________________________________
28cdf0e10cSrcweir //	my own includes
29cdf0e10cSrcweir //_________________________________________________________________________________________________________________
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include <macros/generic.hxx>
32cdf0e10cSrcweir #include <macros/xinterface.hxx>
33cdf0e10cSrcweir #include <macros/xtypeprovider.hxx>
34cdf0e10cSrcweir #include <macros/xserviceinfo.hxx>
35cdf0e10cSrcweir #include <macros/debug.hxx>
36cdf0e10cSrcweir #include <threadhelp/threadhelpbase.hxx>
37cdf0e10cSrcweir #include <general.h>
38cdf0e10cSrcweir #include <stdtypes.h>
39cdf0e10cSrcweir 
40cdf0e10cSrcweir //_________________________________________________________________________________________________________________
41cdf0e10cSrcweir //	interface includes
42cdf0e10cSrcweir //_________________________________________________________________________________________________________________
43cdf0e10cSrcweir #include <com/sun/star/lang/XTypeProvider.hpp>
44cdf0e10cSrcweir #include <com/sun/star/frame/XNotifyingDispatch.hpp>
45cdf0e10cSrcweir #include <com/sun/star/frame/XDispatch.hpp>
46cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchProvider.hpp>
47cdf0e10cSrcweir #include <com/sun/star/util/URL.hpp>
48cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp>
49cdf0e10cSrcweir #include <com/sun/star/frame/XStatusListener.hpp>
50cdf0e10cSrcweir 
51cdf0e10cSrcweir //_________________________________________________________________________________________________________________
52cdf0e10cSrcweir //	other includes
53cdf0e10cSrcweir //_________________________________________________________________________________________________________________
54cdf0e10cSrcweir #include <cppuhelper/weak.hxx>
55cdf0e10cSrcweir 
56cdf0e10cSrcweir //_________________________________________________________________________________________________________________
57cdf0e10cSrcweir //	namespace
58cdf0e10cSrcweir //_________________________________________________________________________________________________________________
59cdf0e10cSrcweir 
60cdf0e10cSrcweir namespace framework{
61cdf0e10cSrcweir 
62cdf0e10cSrcweir //_________________________________________________________________________________________________________________
63cdf0e10cSrcweir //	exported const
64cdf0e10cSrcweir //_________________________________________________________________________________________________________________
65cdf0e10cSrcweir 
66cdf0e10cSrcweir //_________________________________________________________________________________________________________________
67cdf0e10cSrcweir //	exported definitions
68cdf0e10cSrcweir //_________________________________________________________________________________________________________________
69cdf0e10cSrcweir 
70cdf0e10cSrcweir /**
71cdf0e10cSrcweir     @short          protocol handler for "service:*" URLs
72cdf0e10cSrcweir     @descr          It's a special dispatch/provider object which is registered for such URL pattern and will
73cdf0e10cSrcweir                     be automaticly used by the framework dispatch mechanism if such URL occured.
74cdf0e10cSrcweir                     His job is to create any registered uno components which must be coded inside
75cdf0e10cSrcweir                     dispatched URL (may with some optional given parameters). After that such created
76cdf0e10cSrcweir                     service must be hold his self alive. Such mechanism can be usefull for UI components
77cdf0e10cSrcweir                     (e.g. Dialogs, Wizards) only.
78cdf0e10cSrcweir 
79cdf0e10cSrcweir     @base           ThreadHelpBase
80cdf0e10cSrcweir                         exports a lock member to guarantee right initialize value of it
81cdf0e10cSrcweir     @base           OWeakObject
82cdf0e10cSrcweir                         provides XWeak and ref count mechanism
83cdf0e10cSrcweir 
84cdf0e10cSrcweir 	@devstatus		ready to use
85cdf0e10cSrcweir 
86cdf0e10cSrcweir     @modified       02.05.2002 08:13, as96863
87cdf0e10cSrcweir */
88cdf0e10cSrcweir class ServiceHandler : // interfaces
89cdf0e10cSrcweir                        public  css::lang::XTypeProvider      ,
90cdf0e10cSrcweir                        public  css::lang::XServiceInfo       ,
91cdf0e10cSrcweir                        public  css::frame::XDispatchProvider ,
92cdf0e10cSrcweir                        public  css::frame::XNotifyingDispatch, // => XDispatch
93cdf0e10cSrcweir                        // baseclasses
94cdf0e10cSrcweir                        // Order is neccessary for right initialization!
95cdf0e10cSrcweir                        private ThreadHelpBase                ,
96cdf0e10cSrcweir                        public  cppu::OWeakObject
97cdf0e10cSrcweir {
98cdf0e10cSrcweir     /* member */
99cdf0e10cSrcweir     private:
100cdf0e10cSrcweir 
101cdf0e10cSrcweir         /// reference to global uno service manager which had created us
102cdf0e10cSrcweir         css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory;
103cdf0e10cSrcweir 
104cdf0e10cSrcweir     /* interface */
105cdf0e10cSrcweir 	public:
106cdf0e10cSrcweir 
107cdf0e10cSrcweir         // ctor/dtor
108cdf0e10cSrcweir                  ServiceHandler( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory );
109cdf0e10cSrcweir         virtual ~ServiceHandler(                                                                        );
110cdf0e10cSrcweir 
111cdf0e10cSrcweir         // XInterface, XTypeProvider, XServiceInfo
112cdf0e10cSrcweir         FWK_DECLARE_XINTERFACE
113cdf0e10cSrcweir         FWK_DECLARE_XTYPEPROVIDER
114cdf0e10cSrcweir         DECLARE_XSERVICEINFO
115cdf0e10cSrcweir 
116cdf0e10cSrcweir         // XDispatchProvider
117cdf0e10cSrcweir         virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL                       queryDispatch  ( const css::util::URL&                                       aURL        ,
118cdf0e10cSrcweir                                                                                                              const ::rtl::OUString&                                      sTarget     ,
119cdf0e10cSrcweir                                                                                                                    sal_Int32                                             nFlags      ) throw( css::uno::RuntimeException );
120cdf0e10cSrcweir         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 );
121cdf0e10cSrcweir 
122cdf0e10cSrcweir         // XNotifyingDispatch
123cdf0e10cSrcweir         virtual void SAL_CALL dispatchWithNotification( const css::util::URL&                                             aURL      ,
124cdf0e10cSrcweir                                                         const css::uno::Sequence< css::beans::PropertyValue >&            lArguments,
125cdf0e10cSrcweir                                                         const css::uno::Reference< css::frame::XDispatchResultListener >& xListener ) throw( css::uno::RuntimeException );
126cdf0e10cSrcweir 
127cdf0e10cSrcweir         // XDispatch
128cdf0e10cSrcweir         virtual void SAL_CALL dispatch            ( const css::util::URL&                                     aURL       ,
129cdf0e10cSrcweir                                                     const css::uno::Sequence< css::beans::PropertyValue >&    lArguments ) throw( css::uno::RuntimeException );
130cdf0e10cSrcweir         virtual void SAL_CALL addStatusListener   ( const css::uno::Reference< css::frame::XStatusListener >& xListener  ,
131cdf0e10cSrcweir                                                     const css::util::URL&                                     aURL       ) throw( css::uno::RuntimeException );
132cdf0e10cSrcweir         virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xListener  ,
133cdf0e10cSrcweir                                                     const css::util::URL&                                     aURL       ) throw( css::uno::RuntimeException );
134cdf0e10cSrcweir 
135cdf0e10cSrcweir     /* internal */
136cdf0e10cSrcweir     private:
137cdf0e10cSrcweir 
138cdf0e10cSrcweir         css::uno::Reference< css::uno::XInterface > implts_dispatch( const css::util::URL&                                  aURL       ,
139cdf0e10cSrcweir                                                                      const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) throw( css::uno::RuntimeException );
140cdf0e10cSrcweir 
141cdf0e10cSrcweir };      //  class ServiceHandler
142cdf0e10cSrcweir 
143cdf0e10cSrcweir }		//	namespace framework
144cdf0e10cSrcweir 
145cdf0e10cSrcweir #endif  //  #ifndef __FRAMEWORK_DISPATCH_SERVICEHANDLER_HXX_
146