xref: /aoo42x/main/embedserv/source/inc/intercept.hxx (revision 93fe1cd1)
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 _INTERCEPT_HXX_
25 #define _INTERCEPT_HXX_
26 
27 #include <osl/mutex.hxx>
28 #include <cppuhelper/implbase3.hxx>
29 #include <cppuhelper/interfacecontainer.hxx>
30 #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
31 #include <com/sun/star/frame/XInterceptorInfo.hpp>
32 #include <com/sun/star/frame/XDispatch.hpp>
33 
34 #include <rtl/ref.hxx>
35 #include "embeddocaccess.hxx"
36 
37 
38 class StatusChangeListenerContainer;
39 class EmbedDocument_Impl;
40 class DocumentHolder;
41 
42 class Interceptor
43 	: public ::cppu::WeakImplHelper3<
44 				   ::com::sun::star::frame::XDispatchProviderInterceptor,
45 				   ::com::sun::star::frame::XInterceptorInfo,
46 				   ::com::sun::star::frame::XDispatch>
47 {
48 public:
49 
50 	Interceptor(
51 		const ::rtl::Reference< EmbeddedDocumentInstanceAccess_Impl >& xOleAccess,
52 		DocumentHolder* pDocH,
53 		sal_Bool bLink );
54 
55 	~Interceptor();
56 
57 	void DisconnectDocHolder();
58 
59 	void generateFeatureStateEvent();
60 
61 	// overwritten to release the statuslistener.
62 
63 
64 	// XComponent
65 	virtual void SAL_CALL
66 	addEventListener(
67 		const com::sun::star::uno::Reference< com::sun::star::lang::XEventListener >& xListener )
68 		throw( com::sun::star::uno::RuntimeException );
69 
70 	virtual void SAL_CALL
71 	removeEventListener( const com::sun::star::uno::Reference< com::sun::star::lang::XEventListener >& aListener )
72 		throw( com::sun::star::uno::RuntimeException );
73 
74 	void SAL_CALL
75 	dispose() throw(::com::sun::star::uno::RuntimeException);
76 
77 
78 
79 	//XDispatch
80 	virtual void SAL_CALL
81 	dispatch(
82 		const ::com::sun::star::util::URL& URL,
83 		const ::com::sun::star::uno::Sequence<
84 		::com::sun::star::beans::PropertyValue >& Arguments )
85 		throw (::com::sun::star::uno::RuntimeException);
86 
87     virtual void SAL_CALL
88 	addStatusListener(
89 		const ::com::sun::star::uno::Reference<
90 		::com::sun::star::frame::XStatusListener >& Control,
91 		const ::com::sun::star::util::URL& URL )
92 		throw (
93 			::com::sun::star::uno::RuntimeException
94 		);
95 
96     virtual void SAL_CALL
97 	removeStatusListener(
98 		const ::com::sun::star::uno::Reference<
99 		::com::sun::star::frame::XStatusListener >& Control,
100 		const ::com::sun::star::util::URL& URL )
101 		throw (
102 			::com::sun::star::uno::RuntimeException
103 		);
104 
105 	//XInterceptorInfo
106 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString >
107 	SAL_CALL getInterceptedURLs(  )
108 		throw (
109 			::com::sun::star::uno::RuntimeException
110 		);
111 
112 
113 	//XDispatchProvider ( inherited by XDispatchProviderInterceptor )
114     virtual ::com::sun::star::uno::Reference<
115 	::com::sun::star::frame::XDispatch > SAL_CALL
116 	queryDispatch(
117 		const ::com::sun::star::util::URL& URL,
118 		const ::rtl::OUString& TargetFrameName,
119 		sal_Int32 SearchFlags )
120 		throw (
121 			::com::sun::star::uno::RuntimeException
122 		);
123 
124     virtual ::com::sun::star::uno::Sequence<
125 	::com::sun::star::uno::Reference<
126 	::com::sun::star::frame::XDispatch > > SAL_CALL
127 	queryDispatches(
128 		const ::com::sun::star::uno::Sequence<
129 		::com::sun::star::frame::DispatchDescriptor >& Requests )
130 		throw (
131 			::com::sun::star::uno::RuntimeException
132 		);
133 
134 
135 	//XDispatchProviderInterceptor
136     virtual ::com::sun::star::uno::Reference<
137 	::com::sun::star::frame::XDispatchProvider > SAL_CALL
138 	getSlaveDispatchProvider(  )
139 		throw (
140 			::com::sun::star::uno::RuntimeException
141 		);
142 
143     virtual void SAL_CALL
144 	setSlaveDispatchProvider(
145 		const ::com::sun::star::uno::Reference<
146 		::com::sun::star::frame::XDispatchProvider >& NewDispatchProvider )
147 		throw (
148 			::com::sun::star::uno::RuntimeException
149 		);
150 
151     virtual ::com::sun::star::uno::Reference<
152 	::com::sun::star::frame::XDispatchProvider > SAL_CALL
153 	getMasterDispatchProvider(  )
154 		throw (
155 			::com::sun::star::uno::RuntimeException
156 		);
157 
158     virtual void SAL_CALL
159 	setMasterDispatchProvider(
160 		const ::com::sun::star::uno::Reference<
161 		::com::sun::star::frame::XDispatchProvider >& NewSupplier )
162 		throw (
163 			::com::sun::star::uno::RuntimeException
164 		);
165 
166 
167 private:
168 
169 	osl::Mutex   m_aMutex;
170 
171 	::rtl::Reference< EmbeddedDocumentInstanceAccess_Impl > m_xOleAccess;
172 
173 	::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface > m_xDocHLocker;
174 	DocumentHolder*       m_pDocH;
175 
176 	::com::sun::star::uno::Reference<
177 	::com::sun::star::frame::XDispatchProvider > m_xSlaveDispatchProvider;
178 
179 	::com::sun::star::uno::Reference<
180 	::com::sun::star::frame::XDispatchProvider > m_xMasterDispatchProvider;
181 
182 	static ::com::sun::star::uno::Sequence< ::rtl::OUString >
183 	m_aInterceptedURL;
184 
185 	cppu::OInterfaceContainerHelper*    m_pDisposeEventListeners;
186 	StatusChangeListenerContainer*    m_pStatCL;
187 
188 	sal_Bool m_bLink;
189 };
190 
191 #endif
192