xref: /AOO41X/main/embeddedobj/source/general/intercept.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_embeddedobj.hxx"
30*cdf0e10cSrcweir #include <com/sun/star/embed/EmbedStates.hpp>
31*cdf0e10cSrcweir #include <cppuhelper/weak.hxx>
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir #include "intercept.hxx"
34*cdf0e10cSrcweir #include "docholder.hxx"
35*cdf0e10cSrcweir #include "commonembobj.hxx"
36*cdf0e10cSrcweir 
37*cdf0e10cSrcweir using namespace ::com::sun::star;
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir #define IUL 6
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > Interceptor::m_aInterceptedURL(IUL);
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir struct equalOUString
46*cdf0e10cSrcweir {
47*cdf0e10cSrcweir 	bool operator()(
48*cdf0e10cSrcweir 		const rtl::OUString& rKey1,
49*cdf0e10cSrcweir 		const rtl::OUString& rKey2 ) const
50*cdf0e10cSrcweir 	{
51*cdf0e10cSrcweir 		return !!( rKey1 == rKey2 );
52*cdf0e10cSrcweir 	}
53*cdf0e10cSrcweir };
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir struct hashOUString
57*cdf0e10cSrcweir {
58*cdf0e10cSrcweir 	size_t operator()( const rtl::OUString& rName ) const
59*cdf0e10cSrcweir 	{
60*cdf0e10cSrcweir 		return rName.hashCode();
61*cdf0e10cSrcweir 	}
62*cdf0e10cSrcweir };
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir class StatusChangeListenerContainer
67*cdf0e10cSrcweir 	: public ::cppu::OMultiTypeInterfaceContainerHelperVar<
68*cdf0e10cSrcweir rtl::OUString,hashOUString,equalOUString>
69*cdf0e10cSrcweir {
70*cdf0e10cSrcweir public:
71*cdf0e10cSrcweir 	StatusChangeListenerContainer( ::osl::Mutex& aMutex )
72*cdf0e10cSrcweir 		:  cppu::OMultiTypeInterfaceContainerHelperVar<
73*cdf0e10cSrcweir 	rtl::OUString,hashOUString,equalOUString>(aMutex)
74*cdf0e10cSrcweir 	{
75*cdf0e10cSrcweir 	}
76*cdf0e10cSrcweir };
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir void Interceptor::DisconnectDocHolder()
80*cdf0e10cSrcweir {
81*cdf0e10cSrcweir 	osl::MutexGuard aGuard( m_aMutex );
82*cdf0e10cSrcweir 	m_pDocHolder = NULL;
83*cdf0e10cSrcweir }
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir void SAL_CALL
86*cdf0e10cSrcweir Interceptor::addEventListener(
87*cdf0e10cSrcweir 	const uno::Reference<lang::XEventListener >& Listener )
88*cdf0e10cSrcweir 	throw( uno::RuntimeException )
89*cdf0e10cSrcweir {
90*cdf0e10cSrcweir 	osl::MutexGuard aGuard( m_aMutex );
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir 	if ( ! m_pDisposeEventListeners )
93*cdf0e10cSrcweir 		m_pDisposeEventListeners =
94*cdf0e10cSrcweir 			new cppu::OInterfaceContainerHelper( m_aMutex );
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir 	m_pDisposeEventListeners->addInterface( Listener );
97*cdf0e10cSrcweir }
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir void SAL_CALL
101*cdf0e10cSrcweir Interceptor::removeEventListener(
102*cdf0e10cSrcweir 	const uno::Reference< lang::XEventListener >& Listener )
103*cdf0e10cSrcweir 	throw( uno::RuntimeException )
104*cdf0e10cSrcweir {
105*cdf0e10cSrcweir 	osl::MutexGuard aGuard( m_aMutex );
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir 	if ( m_pDisposeEventListeners )
108*cdf0e10cSrcweir 		m_pDisposeEventListeners->removeInterface( Listener );
109*cdf0e10cSrcweir }
110*cdf0e10cSrcweir 
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir Interceptor::Interceptor( DocumentHolder* pDocHolder )
113*cdf0e10cSrcweir 	: m_pDocHolder( pDocHolder ),
114*cdf0e10cSrcweir 	  m_pDisposeEventListeners(0),
115*cdf0e10cSrcweir 	  m_pStatCL(0)
116*cdf0e10cSrcweir {
117*cdf0e10cSrcweir 	m_aInterceptedURL[0] = rtl::OUString(
118*cdf0e10cSrcweir 		RTL_CONSTASCII_USTRINGPARAM(".uno:Save"));
119*cdf0e10cSrcweir 	m_aInterceptedURL[1] = rtl::OUString(
120*cdf0e10cSrcweir 		RTL_CONSTASCII_USTRINGPARAM(".uno:SaveAll"));
121*cdf0e10cSrcweir 	m_aInterceptedURL[2] = rtl::OUString(
122*cdf0e10cSrcweir 		RTL_CONSTASCII_USTRINGPARAM(".uno:CloseDoc"));
123*cdf0e10cSrcweir 	m_aInterceptedURL[3] = rtl::OUString(
124*cdf0e10cSrcweir 		RTL_CONSTASCII_USTRINGPARAM(".uno:CloseWin"));
125*cdf0e10cSrcweir 	m_aInterceptedURL[4] = rtl::OUString(
126*cdf0e10cSrcweir 		RTL_CONSTASCII_USTRINGPARAM(".uno:CloseFrame"));
127*cdf0e10cSrcweir 	m_aInterceptedURL[5] = rtl::OUString(
128*cdf0e10cSrcweir 		RTL_CONSTASCII_USTRINGPARAM(".uno:SaveAs"));
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir }
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir 
133*cdf0e10cSrcweir Interceptor::~Interceptor()
134*cdf0e10cSrcweir {
135*cdf0e10cSrcweir 	if( m_pDisposeEventListeners )
136*cdf0e10cSrcweir 		delete m_pDisposeEventListeners;
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir 	if(m_pStatCL)
139*cdf0e10cSrcweir 		delete m_pStatCL;
140*cdf0e10cSrcweir }
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir 
144*cdf0e10cSrcweir //XDispatch
145*cdf0e10cSrcweir void SAL_CALL
146*cdf0e10cSrcweir Interceptor::dispatch(
147*cdf0e10cSrcweir 	const util::URL& URL,
148*cdf0e10cSrcweir 	const uno::Sequence<
149*cdf0e10cSrcweir 	beans::PropertyValue >& Arguments )
150*cdf0e10cSrcweir 	throw (uno::RuntimeException)
151*cdf0e10cSrcweir {
152*cdf0e10cSrcweir 	osl::MutexGuard aGuard(m_aMutex);
153*cdf0e10cSrcweir 	if( m_pDocHolder )
154*cdf0e10cSrcweir 	{
155*cdf0e10cSrcweir 		if(URL.Complete == m_aInterceptedURL[0])
156*cdf0e10cSrcweir 			m_pDocHolder->GetEmbedObject()->SaveObject_Impl();
157*cdf0e10cSrcweir 		else if(URL.Complete == m_aInterceptedURL[2] ||
158*cdf0e10cSrcweir 				URL.Complete == m_aInterceptedURL[3] ||
159*cdf0e10cSrcweir 				URL.Complete == m_aInterceptedURL[4])
160*cdf0e10cSrcweir 		{
161*cdf0e10cSrcweir 			try {
162*cdf0e10cSrcweir 				m_pDocHolder->GetEmbedObject()->changeState( embed::EmbedStates::RUNNING );
163*cdf0e10cSrcweir 			}
164*cdf0e10cSrcweir 			catch( uno::Exception& )
165*cdf0e10cSrcweir 			{
166*cdf0e10cSrcweir 			}
167*cdf0e10cSrcweir 		}
168*cdf0e10cSrcweir 		else if ( URL.Complete == m_aInterceptedURL[5] )
169*cdf0e10cSrcweir 		{
170*cdf0e10cSrcweir 			uno::Sequence< beans::PropertyValue > aNewArgs = Arguments;
171*cdf0e10cSrcweir 			sal_Int32 nInd = 0;
172*cdf0e10cSrcweir 
173*cdf0e10cSrcweir 			while( nInd < aNewArgs.getLength() )
174*cdf0e10cSrcweir 			{
175*cdf0e10cSrcweir 				if ( aNewArgs[nInd].Name.equalsAscii( "SaveTo" ) )
176*cdf0e10cSrcweir 				{
177*cdf0e10cSrcweir 					aNewArgs[nInd].Value <<= sal_True;
178*cdf0e10cSrcweir 					break;
179*cdf0e10cSrcweir 				}
180*cdf0e10cSrcweir 				nInd++;
181*cdf0e10cSrcweir 			}
182*cdf0e10cSrcweir 
183*cdf0e10cSrcweir 			if ( nInd == aNewArgs.getLength() )
184*cdf0e10cSrcweir 			{
185*cdf0e10cSrcweir 				aNewArgs.realloc( nInd + 1 );
186*cdf0e10cSrcweir 				aNewArgs[nInd].Name = ::rtl::OUString::createFromAscii( "SaveTo" );
187*cdf0e10cSrcweir 				aNewArgs[nInd].Value <<= sal_True;
188*cdf0e10cSrcweir 			}
189*cdf0e10cSrcweir 
190*cdf0e10cSrcweir 			uno::Reference< frame::XDispatch > xDispatch = m_xSlaveDispatchProvider->queryDispatch(
191*cdf0e10cSrcweir 				URL, ::rtl::OUString::createFromAscii( "_self" ), 0 );
192*cdf0e10cSrcweir 			if ( xDispatch.is() )
193*cdf0e10cSrcweir 				xDispatch->dispatch( URL, aNewArgs );
194*cdf0e10cSrcweir 		}
195*cdf0e10cSrcweir 	}
196*cdf0e10cSrcweir }
197*cdf0e10cSrcweir 
198*cdf0e10cSrcweir void SAL_CALL
199*cdf0e10cSrcweir Interceptor::addStatusListener(
200*cdf0e10cSrcweir 	const uno::Reference<
201*cdf0e10cSrcweir 	frame::XStatusListener >& Control,
202*cdf0e10cSrcweir 	const util::URL& URL )
203*cdf0e10cSrcweir 	throw (
204*cdf0e10cSrcweir 		uno::RuntimeException
205*cdf0e10cSrcweir 	)
206*cdf0e10cSrcweir {
207*cdf0e10cSrcweir 	if(!Control.is())
208*cdf0e10cSrcweir 		return;
209*cdf0e10cSrcweir 
210*cdf0e10cSrcweir 	if(URL.Complete == m_aInterceptedURL[0])
211*cdf0e10cSrcweir 	{   // Save
212*cdf0e10cSrcweir 		frame::FeatureStateEvent aStateEvent;
213*cdf0e10cSrcweir 		aStateEvent.FeatureURL.Complete = m_aInterceptedURL[0];
214*cdf0e10cSrcweir 		aStateEvent.FeatureDescriptor = rtl::OUString(
215*cdf0e10cSrcweir 			RTL_CONSTASCII_USTRINGPARAM("Update"));
216*cdf0e10cSrcweir 		aStateEvent.IsEnabled = sal_True;
217*cdf0e10cSrcweir 		aStateEvent.Requery = sal_False;
218*cdf0e10cSrcweir 		aStateEvent.State <<= (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("($1) ")) + m_pDocHolder->GetTitle() );
219*cdf0e10cSrcweir 		Control->statusChanged(aStateEvent);
220*cdf0e10cSrcweir 
221*cdf0e10cSrcweir 		{
222*cdf0e10cSrcweir 			osl::MutexGuard aGuard(m_aMutex);
223*cdf0e10cSrcweir 			if(!m_pStatCL)
224*cdf0e10cSrcweir 				m_pStatCL =
225*cdf0e10cSrcweir 					new StatusChangeListenerContainer(m_aMutex);
226*cdf0e10cSrcweir 		}
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir 		m_pStatCL->addInterface(URL.Complete,Control);
229*cdf0e10cSrcweir 		return;
230*cdf0e10cSrcweir 	}
231*cdf0e10cSrcweir 
232*cdf0e10cSrcweir 	sal_Int32 i = 2;
233*cdf0e10cSrcweir 	if(URL.Complete == m_aInterceptedURL[i] ||
234*cdf0e10cSrcweir 	   URL.Complete == m_aInterceptedURL[++i] ||
235*cdf0e10cSrcweir 	   URL.Complete == m_aInterceptedURL[++i] )
236*cdf0e10cSrcweir 	{   // Close and return
237*cdf0e10cSrcweir 		frame::FeatureStateEvent aStateEvent;
238*cdf0e10cSrcweir 		aStateEvent.FeatureURL.Complete = m_aInterceptedURL[i];
239*cdf0e10cSrcweir 		aStateEvent.FeatureDescriptor = rtl::OUString(
240*cdf0e10cSrcweir 			RTL_CONSTASCII_USTRINGPARAM("Close and Return"));
241*cdf0e10cSrcweir 		aStateEvent.IsEnabled = sal_True;
242*cdf0e10cSrcweir 		aStateEvent.Requery = sal_False;
243*cdf0e10cSrcweir 		aStateEvent.State <<= (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("($2) ")) + m_pDocHolder->GetTitle() );
244*cdf0e10cSrcweir 		Control->statusChanged(aStateEvent);
245*cdf0e10cSrcweir 
246*cdf0e10cSrcweir 
247*cdf0e10cSrcweir 		{
248*cdf0e10cSrcweir 			osl::MutexGuard aGuard(m_aMutex);
249*cdf0e10cSrcweir 			if(!m_pStatCL)
250*cdf0e10cSrcweir 				m_pStatCL =
251*cdf0e10cSrcweir 					new StatusChangeListenerContainer(m_aMutex);
252*cdf0e10cSrcweir 		}
253*cdf0e10cSrcweir 
254*cdf0e10cSrcweir 		m_pStatCL->addInterface(URL.Complete,Control);
255*cdf0e10cSrcweir 		return;
256*cdf0e10cSrcweir 	}
257*cdf0e10cSrcweir 
258*cdf0e10cSrcweir 	if(URL.Complete == m_aInterceptedURL[5])
259*cdf0e10cSrcweir 	{   // SaveAs
260*cdf0e10cSrcweir 		frame::FeatureStateEvent aStateEvent;
261*cdf0e10cSrcweir 		aStateEvent.FeatureURL.Complete = m_aInterceptedURL[5];
262*cdf0e10cSrcweir 		aStateEvent.FeatureDescriptor = rtl::OUString(
263*cdf0e10cSrcweir 			RTL_CONSTASCII_USTRINGPARAM("SaveCopyTo"));
264*cdf0e10cSrcweir 		aStateEvent.IsEnabled = sal_True;
265*cdf0e10cSrcweir 		aStateEvent.Requery = sal_False;
266*cdf0e10cSrcweir 		aStateEvent.State <<= (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("($3)")));
267*cdf0e10cSrcweir 		Control->statusChanged(aStateEvent);
268*cdf0e10cSrcweir 
269*cdf0e10cSrcweir 		{
270*cdf0e10cSrcweir 			osl::MutexGuard aGuard(m_aMutex);
271*cdf0e10cSrcweir 			if(!m_pStatCL)
272*cdf0e10cSrcweir 				m_pStatCL =
273*cdf0e10cSrcweir 					new StatusChangeListenerContainer(m_aMutex);
274*cdf0e10cSrcweir 		}
275*cdf0e10cSrcweir 
276*cdf0e10cSrcweir 		m_pStatCL->addInterface(URL.Complete,Control);
277*cdf0e10cSrcweir 		return;
278*cdf0e10cSrcweir 	}
279*cdf0e10cSrcweir 
280*cdf0e10cSrcweir }
281*cdf0e10cSrcweir 
282*cdf0e10cSrcweir 
283*cdf0e10cSrcweir void SAL_CALL
284*cdf0e10cSrcweir Interceptor::removeStatusListener(
285*cdf0e10cSrcweir 	const uno::Reference<
286*cdf0e10cSrcweir 	frame::XStatusListener >& Control,
287*cdf0e10cSrcweir 	const util::URL& URL )
288*cdf0e10cSrcweir 	throw (
289*cdf0e10cSrcweir 		uno::RuntimeException
290*cdf0e10cSrcweir 	)
291*cdf0e10cSrcweir {
292*cdf0e10cSrcweir 	if(!(Control.is() && m_pStatCL))
293*cdf0e10cSrcweir 		return;
294*cdf0e10cSrcweir 	else {
295*cdf0e10cSrcweir 		m_pStatCL->removeInterface(URL.Complete,Control);
296*cdf0e10cSrcweir 		return;
297*cdf0e10cSrcweir 	}
298*cdf0e10cSrcweir }
299*cdf0e10cSrcweir 
300*cdf0e10cSrcweir 
301*cdf0e10cSrcweir //XInterceptorInfo
302*cdf0e10cSrcweir uno::Sequence< ::rtl::OUString >
303*cdf0e10cSrcweir SAL_CALL
304*cdf0e10cSrcweir Interceptor::getInterceptedURLs(  )
305*cdf0e10cSrcweir 	throw (
306*cdf0e10cSrcweir 		uno::RuntimeException
307*cdf0e10cSrcweir 	)
308*cdf0e10cSrcweir {
309*cdf0e10cSrcweir 	// now implemented as update
310*cdf0e10cSrcweir 
311*cdf0e10cSrcweir 	return m_aInterceptedURL;
312*cdf0e10cSrcweir }
313*cdf0e10cSrcweir 
314*cdf0e10cSrcweir 
315*cdf0e10cSrcweir // XDispatchProvider
316*cdf0e10cSrcweir 
317*cdf0e10cSrcweir uno::Reference< frame::XDispatch > SAL_CALL
318*cdf0e10cSrcweir Interceptor::queryDispatch(
319*cdf0e10cSrcweir 	const util::URL& URL,
320*cdf0e10cSrcweir 	const ::rtl::OUString& TargetFrameName,
321*cdf0e10cSrcweir 	sal_Int32 SearchFlags )
322*cdf0e10cSrcweir 	throw (
323*cdf0e10cSrcweir 		uno::RuntimeException
324*cdf0e10cSrcweir 	)
325*cdf0e10cSrcweir {
326*cdf0e10cSrcweir 	osl::MutexGuard aGuard(m_aMutex);
327*cdf0e10cSrcweir 	if(URL.Complete == m_aInterceptedURL[0])
328*cdf0e10cSrcweir 		return (frame::XDispatch*)this;
329*cdf0e10cSrcweir 	else if(URL.Complete == m_aInterceptedURL[1])
330*cdf0e10cSrcweir 		return (frame::XDispatch*)0   ;
331*cdf0e10cSrcweir 	else if(URL.Complete == m_aInterceptedURL[2])
332*cdf0e10cSrcweir 		return (frame::XDispatch*)this;
333*cdf0e10cSrcweir 	else if(URL.Complete == m_aInterceptedURL[3])
334*cdf0e10cSrcweir 		return (frame::XDispatch*)this;
335*cdf0e10cSrcweir 	else if(URL.Complete == m_aInterceptedURL[4])
336*cdf0e10cSrcweir 		return (frame::XDispatch*)this;
337*cdf0e10cSrcweir 	else if(URL.Complete == m_aInterceptedURL[5])
338*cdf0e10cSrcweir 		return (frame::XDispatch*)this;
339*cdf0e10cSrcweir 	else {
340*cdf0e10cSrcweir 		if(m_xSlaveDispatchProvider.is())
341*cdf0e10cSrcweir 			return m_xSlaveDispatchProvider->queryDispatch(
342*cdf0e10cSrcweir 				URL,TargetFrameName,SearchFlags);
343*cdf0e10cSrcweir 		else
344*cdf0e10cSrcweir 			return uno::Reference<frame::XDispatch>(0);
345*cdf0e10cSrcweir 	}
346*cdf0e10cSrcweir }
347*cdf0e10cSrcweir 
348*cdf0e10cSrcweir uno::Sequence< uno::Reference< frame::XDispatch > > SAL_CALL
349*cdf0e10cSrcweir Interceptor::queryDispatches(
350*cdf0e10cSrcweir 	const uno::Sequence<frame::DispatchDescriptor >& Requests )
351*cdf0e10cSrcweir 	throw (
352*cdf0e10cSrcweir 		uno::RuntimeException
353*cdf0e10cSrcweir 	)
354*cdf0e10cSrcweir {
355*cdf0e10cSrcweir 	uno::Sequence< uno::Reference< frame::XDispatch > > aRet;
356*cdf0e10cSrcweir 	osl::MutexGuard aGuard(m_aMutex);
357*cdf0e10cSrcweir 	if(m_xSlaveDispatchProvider.is())
358*cdf0e10cSrcweir 		aRet = m_xSlaveDispatchProvider->queryDispatches(Requests);
359*cdf0e10cSrcweir 	else
360*cdf0e10cSrcweir 		aRet.realloc(Requests.getLength());
361*cdf0e10cSrcweir 
362*cdf0e10cSrcweir 	for(sal_Int32 i = 0; i < Requests.getLength(); ++i)
363*cdf0e10cSrcweir 		if(m_aInterceptedURL[0] == Requests[i].FeatureURL.Complete)
364*cdf0e10cSrcweir 			aRet[i] = (frame::XDispatch*) this;
365*cdf0e10cSrcweir 		else if(m_aInterceptedURL[1] == Requests[i].FeatureURL.Complete)
366*cdf0e10cSrcweir 			aRet[i] = (frame::XDispatch*) 0;
367*cdf0e10cSrcweir 		else if(m_aInterceptedURL[2] == Requests[i].FeatureURL.Complete)
368*cdf0e10cSrcweir 			aRet[i] = (frame::XDispatch*) this;
369*cdf0e10cSrcweir 		else if(m_aInterceptedURL[3] == Requests[i].FeatureURL.Complete)
370*cdf0e10cSrcweir 			aRet[i] = (frame::XDispatch*) this;
371*cdf0e10cSrcweir 		else if(m_aInterceptedURL[4] == Requests[i].FeatureURL.Complete)
372*cdf0e10cSrcweir 			aRet[i] = (frame::XDispatch*) this;
373*cdf0e10cSrcweir 		else if(m_aInterceptedURL[5] == Requests[i].FeatureURL.Complete)
374*cdf0e10cSrcweir 			aRet[i] = (frame::XDispatch*) this;
375*cdf0e10cSrcweir 
376*cdf0e10cSrcweir 	return aRet;
377*cdf0e10cSrcweir }
378*cdf0e10cSrcweir 
379*cdf0e10cSrcweir 
380*cdf0e10cSrcweir 
381*cdf0e10cSrcweir //XDispatchProviderInterceptor
382*cdf0e10cSrcweir 
383*cdf0e10cSrcweir uno::Reference< frame::XDispatchProvider > SAL_CALL
384*cdf0e10cSrcweir Interceptor::getSlaveDispatchProvider(  )
385*cdf0e10cSrcweir 	throw (
386*cdf0e10cSrcweir 		uno::RuntimeException
387*cdf0e10cSrcweir 	)
388*cdf0e10cSrcweir {
389*cdf0e10cSrcweir 	osl::MutexGuard aGuard(m_aMutex);
390*cdf0e10cSrcweir 	return m_xSlaveDispatchProvider;
391*cdf0e10cSrcweir }
392*cdf0e10cSrcweir 
393*cdf0e10cSrcweir void SAL_CALL
394*cdf0e10cSrcweir Interceptor::setSlaveDispatchProvider(
395*cdf0e10cSrcweir 	const uno::Reference< frame::XDispatchProvider >& NewDispatchProvider )
396*cdf0e10cSrcweir 	throw (
397*cdf0e10cSrcweir 		uno::RuntimeException
398*cdf0e10cSrcweir 	)
399*cdf0e10cSrcweir {
400*cdf0e10cSrcweir 	osl::MutexGuard aGuard(m_aMutex);
401*cdf0e10cSrcweir 	m_xSlaveDispatchProvider = NewDispatchProvider;
402*cdf0e10cSrcweir }
403*cdf0e10cSrcweir 
404*cdf0e10cSrcweir 
405*cdf0e10cSrcweir uno::Reference< frame::XDispatchProvider > SAL_CALL
406*cdf0e10cSrcweir Interceptor::getMasterDispatchProvider(  )
407*cdf0e10cSrcweir 	throw (
408*cdf0e10cSrcweir 		uno::RuntimeException
409*cdf0e10cSrcweir 	)
410*cdf0e10cSrcweir {
411*cdf0e10cSrcweir 	osl::MutexGuard aGuard(m_aMutex);
412*cdf0e10cSrcweir 	return m_xMasterDispatchProvider;
413*cdf0e10cSrcweir }
414*cdf0e10cSrcweir 
415*cdf0e10cSrcweir 
416*cdf0e10cSrcweir void SAL_CALL
417*cdf0e10cSrcweir Interceptor::setMasterDispatchProvider(
418*cdf0e10cSrcweir 	const uno::Reference< frame::XDispatchProvider >& NewSupplier )
419*cdf0e10cSrcweir 	throw (
420*cdf0e10cSrcweir 		uno::RuntimeException
421*cdf0e10cSrcweir 	)
422*cdf0e10cSrcweir {
423*cdf0e10cSrcweir 	osl::MutexGuard aGuard(m_aMutex);
424*cdf0e10cSrcweir 	m_xMasterDispatchProvider = NewSupplier;
425*cdf0e10cSrcweir }
426*cdf0e10cSrcweir 
427