xref: /AOO41X/main/dbaccess/source/core/dataaccess/intercept.hxx (revision 2e2212a7c22e96cf6f6fab0dd042c34a45a64bd6)
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 DBA_INTERCEPT_HXX
25 #define DBA_INTERCEPT_HXX
26 
27 #ifndef _OSL_MUTEX_HXX_
28 #include <osl/mutex.hxx>
29 #endif
30 #ifndef _CPPUHELPER_IMPLBASE4_HXX_
31 #include <cppuhelper/implbase4.hxx>
32 #endif
33 #ifndef _CPPUHELPER_INTERFACECONTAINER_HXX_
34 #include <cppuhelper/interfacecontainer.hxx>
35 #endif
36 #ifndef  _COM_SUN_STAR_FRAME_XDISPATCHPROVIDERINTERCEPTOR_HPP_
37 #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
38 #endif
39 #ifndef _COM_SUN_STAR_FRAME_XINTERCEPTORINFO_HPP_
40 #include <com/sun/star/frame/XInterceptorInfo.hpp>
41 #endif
42 #ifndef _COM_SUN_STAR_DOCUMENT_XEVENTLISTENER_HPP_
43 #include <com/sun/star/document/XEventListener.hpp>
44 #endif
45 #ifndef _COM_SUN_STAR_FRAME_XDISPATCH_HPP_
46 #include <com/sun/star/frame/XDispatch.hpp>
47 #endif
48 #ifndef _DBA_COREDATAACCESS_DOCUMENTDEFINITION_HXX_
49 #include "documentdefinition.hxx"
50 #endif
51 #include <vcl/svapp.hxx>
52 
53 namespace dbaccess
54 {
55 
56 
57 class OInterceptor : public ::cppu::WeakImplHelper4< ::com::sun::star::frame::XDispatchProviderInterceptor,
58                                                     ::com::sun::star::frame::XInterceptorInfo,
59                                                     ::com::sun::star::frame::XDispatch,
60                                                     ::com::sun::star::document::XEventListener>
61 {
62     DECL_LINK( OnDispatch, void* _aURL  );
63 protected:
64     virtual ~OInterceptor();
65 public:
66 
67     OInterceptor( ODocumentDefinition* _pContentHolder,sal_Bool _bAllowEditDoc );
68 
69     void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
70 
71     //XDispatch
72     virtual void SAL_CALL
73     dispatch(
74         const ::com::sun::star::util::URL& URL,
75         const ::com::sun::star::uno::Sequence<
76         ::com::sun::star::beans::PropertyValue >& Arguments )
77         throw (::com::sun::star::uno::RuntimeException);
78 
79     virtual void SAL_CALL
80     addStatusListener(
81         const ::com::sun::star::uno::Reference<
82         ::com::sun::star::frame::XStatusListener >& Control,
83         const ::com::sun::star::util::URL& URL )
84         throw (
85             ::com::sun::star::uno::RuntimeException
86         );
87 
88     virtual void SAL_CALL
89     removeStatusListener(
90         const ::com::sun::star::uno::Reference<
91         ::com::sun::star::frame::XStatusListener >& Control,
92         const ::com::sun::star::util::URL& URL )
93         throw (
94             ::com::sun::star::uno::RuntimeException
95         );
96 
97     //XInterceptorInfo
98     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString >
99     SAL_CALL getInterceptedURLs(  )
100         throw (
101             ::com::sun::star::uno::RuntimeException
102         );
103 
104     //XDispatchProvider ( inherited by XDispatchProviderInterceptor )
105     virtual ::com::sun::star::uno::Reference<
106     ::com::sun::star::frame::XDispatch > SAL_CALL
107     queryDispatch(
108         const ::com::sun::star::util::URL& URL,
109         const ::rtl::OUString& TargetFrameName,
110         sal_Int32 SearchFlags )
111         throw (
112             ::com::sun::star::uno::RuntimeException
113         );
114 
115     virtual ::com::sun::star::uno::Sequence<
116     ::com::sun::star::uno::Reference<
117     ::com::sun::star::frame::XDispatch > > SAL_CALL
118     queryDispatches(
119         const ::com::sun::star::uno::Sequence<
120         ::com::sun::star::frame::DispatchDescriptor >& Requests )
121         throw (
122             ::com::sun::star::uno::RuntimeException
123         );
124 
125 
126     //XDispatchProviderInterceptor
127     virtual ::com::sun::star::uno::Reference<
128     ::com::sun::star::frame::XDispatchProvider > SAL_CALL
129     getSlaveDispatchProvider(  )
130         throw (
131             ::com::sun::star::uno::RuntimeException
132         );
133 
134     virtual void SAL_CALL
135     setSlaveDispatchProvider(
136         const ::com::sun::star::uno::Reference<
137         ::com::sun::star::frame::XDispatchProvider >& NewDispatchProvider )
138         throw (
139             ::com::sun::star::uno::RuntimeException
140         );
141 
142     virtual ::com::sun::star::uno::Reference<
143     ::com::sun::star::frame::XDispatchProvider > SAL_CALL
144     getMasterDispatchProvider(  )
145         throw (
146             ::com::sun::star::uno::RuntimeException
147         );
148 
149     virtual void SAL_CALL
150     setMasterDispatchProvider(
151         const ::com::sun::star::uno::Reference<
152         ::com::sun::star::frame::XDispatchProvider >& NewSupplier )
153         throw (
154             ::com::sun::star::uno::RuntimeException
155         );
156 
157     // XEventListener
158     virtual void SAL_CALL notifyEvent( const ::com::sun::star::document::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException);
159     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
160 
161 
162 private:
163 
164     osl::Mutex   m_aMutex;
165 
166     ODocumentDefinition*   m_pContentHolder;
167 
168     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xSlaveDispatchProvider;
169     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xMasterDispatchProvider;
170 
171     ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aInterceptedURL;
172 
173     cppu::OInterfaceContainerHelper*    m_pDisposeEventListeners;
174     PropertyChangeListenerContainer*    m_pStatCL;
175     sal_Bool                            m_bAllowEditDoc;
176 };
177 
178 
179 //........................................................................
180 }   // namespace dbaccess
181 //........................................................................
182 
183 
184 #endif //DBA_INTERCEPT_HXX
185 
186 
187