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_RECORDING_DISPATCHRECORDERSUPPLIER_HXX_
25 #define __FRAMEWORK_RECORDING_DISPATCHRECORDERSUPPLIER_HXX_
26 
27 //_________________________________________________________________________________________________________________
28 // include own things
29 
30 #include <threadhelp/threadhelpbase.hxx>
31 #include <macros/xinterface.hxx>
32 #include <macros/xtypeprovider.hxx>
33 #include <macros/xserviceinfo.hxx>
34 #include <macros/debug.hxx>
35 #include <macros/generic.hxx>
36 #include <general.h>
37 #include <stdtypes.h>
38 
39 //_________________________________________________________________________________________________________________
40 // include interfaces
41 #include <com/sun/star/lang/XTypeProvider.hpp>
42 #include <com/sun/star/frame/XDispatchRecorderSupplier.hpp>
43 
44 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
45 #include <com/sun/star/util/URL.hpp>
46 #include <com/sun/star/beans/PropertyValue.hpp>
47 
48 //_________________________________________________________________________________________________________________
49 // include other projects
50 #include <cppuhelper/weak.hxx>
51 
52 //_________________________________________________________________________________________________________________
53 //	namespace
54 
55 namespace framework{
56 
57 //_________________________________________________________________________________________________________________
58 //	exported const
59 
60 //_________________________________________________________________________________________________________________
61 //	exported definitions
62 
63 //_______________________________________________
64 
65 /** @short          implement a supplier for dispatch recorder
66     @descr          This supplier can be set on property "DispatchRecorderSupplier" on a frame.
67                     By using of this supplier and his internal XDispatchRecorder it's possible to
68                     record XDispatch::dispatch() requests.
69 
70     @threadsafe     yes
71  */
72 class DispatchRecorderSupplier  :   // interfaces
73                                     public  css::lang::XTypeProvider                ,
74                                     public  css::lang::XServiceInfo                 ,
75                                     public  css::frame::XDispatchRecorderSupplier   ,
76                                     // baseclasses
77                                     // Order is necessary for right initialization!
78                                     private ThreadHelpBase                          ,
79                                     public  ::cppu::OWeakObject
80 {
81     //___________________________________________
82     // member
83 
84 	private:
85 
86         //_______________________________________
87         /** provided dispatch recorder of this supplier instance
88 
89             @life   Is controlled from outside. Because this variable is set
90                     from there and not created internally. But we release our
91                     reference to it if we die.
92          */
93         css::uno::Reference< css::frame::XDispatchRecorder > m_xDispatchRecorder;
94 
95         //_______________________________________
96         /** reference to the global uno service manager
97          */
98         css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory;
99 
100     //___________________________________________
101     // uno interface
102 
103     public:
104 
105         //_______________________________________
106         // XInterface, XTypeProvider, XServiceInfo
107 
108         FWK_DECLARE_XINTERFACE
109         FWK_DECLARE_XTYPEPROVIDER
110         DECLARE_XSERVICEINFO
111 
112         //_______________________________________
113         // XDispatchRecorderSupplier
114 
115         virtual void                                                 SAL_CALL setDispatchRecorder( const css::uno::Reference< css::frame::XDispatchRecorder >& xRecorder   ) throw (css::uno::RuntimeException);
116         virtual css::uno::Reference< css::frame::XDispatchRecorder > SAL_CALL getDispatchRecorder(                                                                         ) throw (css::uno::RuntimeException);
117         virtual void                                                 SAL_CALL dispatchAndRecord  ( const css::util::URL&                                       aURL        ,
118                                                                                                    const css::uno::Sequence< css::beans::PropertyValue >&      lArguments  ,
119                                                                                                    const css::uno::Reference< css::frame::XDispatch >&         xDispatcher ) throw (css::uno::RuntimeException);
120 
121     //___________________________________________
122     // native interface
123 
124     public:
125 
126          DispatchRecorderSupplier( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory );
127         ~DispatchRecorderSupplier();
128 
129 };      //  class DispatchRecorderSupplier
130 
131 }		//	namespace framework
132 
133 #endif  //  #ifndef __FRAMEWORK_RECORDING_DISPATCHRECORDERSUPPLIER_HXX_
134