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_framework.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir //_______________________________________________
32*cdf0e10cSrcweir //	my own includes
33*cdf0e10cSrcweir 
34*cdf0e10cSrcweir #ifndef __FRAMEWORK_DISPATCH_INTERCEPTIONHELPER_HXX_
35*cdf0e10cSrcweir #include <dispatch/interceptionhelper.hxx>
36*cdf0e10cSrcweir #endif
37*cdf0e10cSrcweir 
38*cdf0e10cSrcweir //_______________________________________________
39*cdf0e10cSrcweir //	interface includes
40*cdf0e10cSrcweir #include <com/sun/star/frame/XInterceptorInfo.hpp>
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir //_______________________________________________
43*cdf0e10cSrcweir //	includes of other projects
44*cdf0e10cSrcweir #include <vcl/svapp.hxx>
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir //_______________________________________________
47*cdf0e10cSrcweir //	namespace
48*cdf0e10cSrcweir 
49*cdf0e10cSrcweir namespace framework{
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir //_______________________________________________
52*cdf0e10cSrcweir //	non exported const
53*cdf0e10cSrcweir 
54*cdf0e10cSrcweir sal_Bool InterceptionHelper::m_bPreferrFirstInterceptor = sal_True;
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir //_______________________________________________
57*cdf0e10cSrcweir //	non exported definitions
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir //_______________________________________________
60*cdf0e10cSrcweir //	declarations
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir /*-----------------------------------------------------------------------------
63*cdf0e10cSrcweir     31.03.2003 09:02
64*cdf0e10cSrcweir -----------------------------------------------------------------------------*/
65*cdf0e10cSrcweir DEFINE_XINTERFACE_3(InterceptionHelper                                         ,
66*cdf0e10cSrcweir                     OWeakObject                                                ,
67*cdf0e10cSrcweir                     DIRECT_INTERFACE(css::frame::XDispatchProvider            ),
68*cdf0e10cSrcweir                     DIRECT_INTERFACE(css::frame::XDispatchProviderInterception),
69*cdf0e10cSrcweir                     DIRECT_INTERFACE(css::lang::XEventListener                ))
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir /*-----------------------------------------------------------------------------
72*cdf0e10cSrcweir     31.03.2003 09:02
73*cdf0e10cSrcweir -----------------------------------------------------------------------------*/
74*cdf0e10cSrcweir InterceptionHelper::InterceptionHelper(const css::uno::Reference< css::frame::XFrame >&            xOwner,
75*cdf0e10cSrcweir                                        const css::uno::Reference< css::frame::XDispatchProvider >& xSlave)
76*cdf0e10cSrcweir     //  Init baseclasses first
77*cdf0e10cSrcweir     : ThreadHelpBase(&Application::GetSolarMutex())
78*cdf0e10cSrcweir     , OWeakObject   (                             )
79*cdf0e10cSrcweir     // Init member
80*cdf0e10cSrcweir     , m_xOwnerWeak  (xOwner                       )
81*cdf0e10cSrcweir     , m_xSlave      (xSlave                       )
82*cdf0e10cSrcweir {
83*cdf0e10cSrcweir }
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir /*-----------------------------------------------------------------------------
86*cdf0e10cSrcweir     31.03.2003 09:02
87*cdf0e10cSrcweir -----------------------------------------------------------------------------*/
88*cdf0e10cSrcweir InterceptionHelper::~InterceptionHelper()
89*cdf0e10cSrcweir {
90*cdf0e10cSrcweir }
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir /*-----------------------------------------------------------------------------
93*cdf0e10cSrcweir     31.03.2003 09:09
94*cdf0e10cSrcweir -----------------------------------------------------------------------------*/
95*cdf0e10cSrcweir css::uno::Reference< css::frame::XDispatch > SAL_CALL InterceptionHelper::queryDispatch(const css::util::URL&  aURL            ,
96*cdf0e10cSrcweir                                                                                         const ::rtl::OUString& sTargetFrameName,
97*cdf0e10cSrcweir                                                                                               sal_Int32        nSearchFlags    )
98*cdf0e10cSrcweir     throw(css::uno::RuntimeException)
99*cdf0e10cSrcweir {
100*cdf0e10cSrcweir     // SAFE {
101*cdf0e10cSrcweir     ReadGuard aReadLock(m_aLock);
102*cdf0e10cSrcweir 
103*cdf0e10cSrcweir     // a) first search an interceptor, which match to this URL by it's URL pattern registration
104*cdf0e10cSrcweir     //    Note: if it return NULL - it does not mean an empty interceptor list automaticly!
105*cdf0e10cSrcweir     css::uno::Reference< css::frame::XDispatchProvider > xInterceptor;
106*cdf0e10cSrcweir     InterceptorList::const_iterator pIt = m_lInterceptionRegs.findByPattern(aURL.Complete);
107*cdf0e10cSrcweir     if (pIt != m_lInterceptionRegs.end())
108*cdf0e10cSrcweir         xInterceptor = pIt->xInterceptor;
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir     // b) No match by registration - but a valid interceptor list.
111*cdf0e10cSrcweir     //    Use first interceptor everytimes.
112*cdf0e10cSrcweir     //    Note: it doesn't matter, which direction this helper implementation use to ask interceptor objects.
113*cdf0e10cSrcweir     //    Using of member m_aInterceptorList will starts at the beginning everytimes.
114*cdf0e10cSrcweir     //    It depends from the filling operation, in which direction it works realy!
115*cdf0e10cSrcweir     if (!xInterceptor.is() && m_lInterceptionRegs.size()>0)
116*cdf0e10cSrcweir     {
117*cdf0e10cSrcweir         pIt          = m_lInterceptionRegs.begin();
118*cdf0e10cSrcweir         xInterceptor = pIt->xInterceptor;
119*cdf0e10cSrcweir     }
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir     // c) No registered interceptor => use our direct slave.
122*cdf0e10cSrcweir     //    This helper exist by design and must be valid everytimes ...
123*cdf0e10cSrcweir     //    But to be more feature proof - we should check that .-)
124*cdf0e10cSrcweir     if (!xInterceptor.is() && m_xSlave.is())
125*cdf0e10cSrcweir         xInterceptor = m_xSlave;
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir     aReadLock.unlock();
128*cdf0e10cSrcweir     // } SAFE
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir     css::uno::Reference< css::frame::XDispatch > xReturn;
131*cdf0e10cSrcweir     if (xInterceptor.is())
132*cdf0e10cSrcweir         xReturn = xInterceptor->queryDispatch(aURL, sTargetFrameName, nSearchFlags);
133*cdf0e10cSrcweir 	return xReturn;
134*cdf0e10cSrcweir }
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir /*-----------------------------------------------------------------------------
137*cdf0e10cSrcweir     31.03.2003 07:58
138*cdf0e10cSrcweir -----------------------------------------------------------------------------*/
139*cdf0e10cSrcweir css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL InterceptionHelper::queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& lDescriptor )
140*cdf0e10cSrcweir     throw(css::uno::RuntimeException)
141*cdf0e10cSrcweir {
142*cdf0e10cSrcweir           sal_Int32                                                          c           = lDescriptor.getLength();
143*cdf0e10cSrcweir           css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > lDispatches (c);
144*cdf0e10cSrcweir           css::uno::Reference< css::frame::XDispatch >*                      pDispatches = lDispatches.getArray();
145*cdf0e10cSrcweir     const css::frame::DispatchDescriptor*                                    pDescriptor = lDescriptor.getConstArray();
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir     for (sal_Int32 i=0; i<c; ++i)
148*cdf0e10cSrcweir         pDispatches[i] = queryDispatch(pDescriptor[i].FeatureURL, pDescriptor[i].FrameName, pDescriptor[i].SearchFlags);
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir     return lDispatches;
151*cdf0e10cSrcweir }
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir /*-----------------------------------------------------------------------------
154*cdf0e10cSrcweir     31.03.2003 10:20
155*cdf0e10cSrcweir -----------------------------------------------------------------------------*/
156*cdf0e10cSrcweir void SAL_CALL InterceptionHelper::registerDispatchProviderInterceptor(const css::uno::Reference< css::frame::XDispatchProviderInterceptor >& xInterceptor)
157*cdf0e10cSrcweir     throw(css::uno::RuntimeException)
158*cdf0e10cSrcweir {
159*cdf0e10cSrcweir     // reject wrong calling of this interface method
160*cdf0e10cSrcweir     css::uno::Reference< css::frame::XDispatchProvider > xThis(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY);
161*cdf0e10cSrcweir     if (!xInterceptor.is())
162*cdf0e10cSrcweir         throw css::uno::RuntimeException(DECLARE_ASCII("NULL references not allowed as in parameter"), xThis);
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir 	// Fill a new info structure for new interceptor.
165*cdf0e10cSrcweir 	// Save his reference and try to get an additional URL/pattern list from him.
166*cdf0e10cSrcweir 	// If no list exist register these interceptor for all dispatch events with "*"!
167*cdf0e10cSrcweir     InterceptorInfo aInfo;
168*cdf0e10cSrcweir 
169*cdf0e10cSrcweir     aInfo.xInterceptor = css::uno::Reference< css::frame::XDispatchProvider >(xInterceptor, css::uno::UNO_QUERY);
170*cdf0e10cSrcweir     css::uno::Reference< css::frame::XInterceptorInfo > xInfo(xInterceptor, css::uno::UNO_QUERY);
171*cdf0e10cSrcweir     if (xInfo.is())
172*cdf0e10cSrcweir         aInfo.lURLPattern = xInfo->getInterceptedURLs();
173*cdf0e10cSrcweir 	else
174*cdf0e10cSrcweir 	{
175*cdf0e10cSrcweir         aInfo.lURLPattern.realloc(1);
176*cdf0e10cSrcweir         aInfo.lURLPattern[0] = ::rtl::OUString::createFromAscii("*");
177*cdf0e10cSrcweir 	}
178*cdf0e10cSrcweir 
179*cdf0e10cSrcweir     // SAFE {
180*cdf0e10cSrcweir     WriteGuard aWriteLock(m_aLock);
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir     // a) no interceptor at all - set this instance as master for given interceptor
183*cdf0e10cSrcweir     //    and set our slave as it's slave - and put this interceptor to the list.
184*cdf0e10cSrcweir     //    It's place there doesn matter. Because this list is currently empty.
185*cdf0e10cSrcweir     if (m_lInterceptionRegs.empty())
186*cdf0e10cSrcweir     {
187*cdf0e10cSrcweir         xInterceptor->setMasterDispatchProvider(xThis   );
188*cdf0e10cSrcweir         xInterceptor->setSlaveDispatchProvider (m_xSlave);
189*cdf0e10cSrcweir         m_lInterceptionRegs.push_back(aInfo);
190*cdf0e10cSrcweir     }
191*cdf0e10cSrcweir 
192*cdf0e10cSrcweir     // b) OK - there is at least one interceptor already registered.
193*cdf0e10cSrcweir     //    It's slave and it's master must be valid references ...
194*cdf0e10cSrcweir     //    because we created it. But we have to look for the static bool which
195*cdf0e10cSrcweir     //    regulate direction of using of interceptor objects!
196*cdf0e10cSrcweir 
197*cdf0e10cSrcweir     // b1) If "m_bPreferrFirstInterceptor" is set to true, we have to
198*cdf0e10cSrcweir     //     insert it behind any other existing interceptor - means at the end of our list.
199*cdf0e10cSrcweir     else if (m_bPreferrFirstInterceptor)
200*cdf0e10cSrcweir 	{
201*cdf0e10cSrcweir         css::uno::Reference< css::frame::XDispatchProvider >            xMasterD = m_lInterceptionRegs.rbegin()->xInterceptor;
202*cdf0e10cSrcweir         css::uno::Reference< css::frame::XDispatchProviderInterceptor > xMasterI (xMasterD, css::uno::UNO_QUERY);
203*cdf0e10cSrcweir 
204*cdf0e10cSrcweir         xInterceptor->setMasterDispatchProvider(xMasterD          );
205*cdf0e10cSrcweir         xInterceptor->setSlaveDispatchProvider (m_xSlave          );
206*cdf0e10cSrcweir         xMasterI->setSlaveDispatchProvider     (aInfo.xInterceptor);
207*cdf0e10cSrcweir 
208*cdf0e10cSrcweir         m_lInterceptionRegs.push_back(aInfo);
209*cdf0e10cSrcweir 	}
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir     // b2) If "m_bPreferrFirstInterceptor" is set to false, we have to
212*cdf0e10cSrcweir     //     insert it before any other existing interceptor - means at the beginning of our list.
213*cdf0e10cSrcweir     else
214*cdf0e10cSrcweir     {
215*cdf0e10cSrcweir         css::uno::Reference< css::frame::XDispatchProvider >            xSlaveD = m_lInterceptionRegs.begin()->xInterceptor;
216*cdf0e10cSrcweir         css::uno::Reference< css::frame::XDispatchProviderInterceptor > xSlaveI (xSlaveD , css::uno::UNO_QUERY);
217*cdf0e10cSrcweir 
218*cdf0e10cSrcweir         xInterceptor->setMasterDispatchProvider(xThis             );
219*cdf0e10cSrcweir         xInterceptor->setSlaveDispatchProvider (xSlaveD           );
220*cdf0e10cSrcweir         xSlaveI->setMasterDispatchProvider     (aInfo.xInterceptor);
221*cdf0e10cSrcweir 
222*cdf0e10cSrcweir         m_lInterceptionRegs.push_front(aInfo);
223*cdf0e10cSrcweir     }
224*cdf0e10cSrcweir 
225*cdf0e10cSrcweir     css::uno::Reference< css::frame::XFrame > xOwner(m_xOwnerWeak.get(), css::uno::UNO_QUERY);
226*cdf0e10cSrcweir 
227*cdf0e10cSrcweir     aWriteLock.unlock();
228*cdf0e10cSrcweir     // } SAFE
229*cdf0e10cSrcweir 
230*cdf0e10cSrcweir     // Don't forget to send a frame action event "context changed".
231*cdf0e10cSrcweir     // Any cached dispatch objects must be validated now!
232*cdf0e10cSrcweir     if (xOwner.is())
233*cdf0e10cSrcweir 		xOwner->contextChanged();
234*cdf0e10cSrcweir }
235*cdf0e10cSrcweir 
236*cdf0e10cSrcweir /*-----------------------------------------------------------------------------
237*cdf0e10cSrcweir     31.03.2003 10:27
238*cdf0e10cSrcweir -----------------------------------------------------------------------------*/
239*cdf0e10cSrcweir void SAL_CALL InterceptionHelper::releaseDispatchProviderInterceptor(const css::uno::Reference< css::frame::XDispatchProviderInterceptor >& xInterceptor)
240*cdf0e10cSrcweir     throw(css::uno::RuntimeException)
241*cdf0e10cSrcweir {
242*cdf0e10cSrcweir     // reject wrong calling of this interface method
243*cdf0e10cSrcweir     css::uno::Reference< css::frame::XDispatchProvider > xThis(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY);
244*cdf0e10cSrcweir     if (!xInterceptor.is())
245*cdf0e10cSrcweir         throw css::uno::RuntimeException(DECLARE_ASCII("NULL references not allowed as in parameter"), xThis);
246*cdf0e10cSrcweir 
247*cdf0e10cSrcweir     // SAFE {
248*cdf0e10cSrcweir     WriteGuard aWriteLock(m_aLock);
249*cdf0e10cSrcweir 
250*cdf0e10cSrcweir     // search this interceptor ...
251*cdf0e10cSrcweir     // If it could be located inside cache -
252*cdf0e10cSrcweir     // use it's slave/master relations to update the interception list;
253*cdf0e10cSrcweir     // set empty references for it as new master and slave;
254*cdf0e10cSrcweir     // and relase it from out cache.
255*cdf0e10cSrcweir     InterceptorList::iterator pIt = m_lInterceptionRegs.findByReference(xInterceptor);
256*cdf0e10cSrcweir     if (pIt != m_lInterceptionRegs.end())
257*cdf0e10cSrcweir     {
258*cdf0e10cSrcweir         css::uno::Reference< css::frame::XDispatchProvider >            xSlaveD  (xInterceptor->getSlaveDispatchProvider() , css::uno::UNO_QUERY);
259*cdf0e10cSrcweir         css::uno::Reference< css::frame::XDispatchProvider >            xMasterD (xInterceptor->getMasterDispatchProvider(), css::uno::UNO_QUERY);
260*cdf0e10cSrcweir         css::uno::Reference< css::frame::XDispatchProviderInterceptor > xSlaveI  (xSlaveD                                  , css::uno::UNO_QUERY);
261*cdf0e10cSrcweir         css::uno::Reference< css::frame::XDispatchProviderInterceptor > xMasterI (xMasterD                                 , css::uno::UNO_QUERY);
262*cdf0e10cSrcweir 
263*cdf0e10cSrcweir         if (xMasterI.is())
264*cdf0e10cSrcweir             xMasterI->setSlaveDispatchProvider(xSlaveD);
265*cdf0e10cSrcweir 
266*cdf0e10cSrcweir         if (xSlaveI.is())
267*cdf0e10cSrcweir             xSlaveI->setMasterDispatchProvider(xMasterD);
268*cdf0e10cSrcweir 
269*cdf0e10cSrcweir         xInterceptor->setSlaveDispatchProvider (css::uno::Reference< css::frame::XDispatchProvider >());
270*cdf0e10cSrcweir         xInterceptor->setMasterDispatchProvider(css::uno::Reference< css::frame::XDispatchProvider >());
271*cdf0e10cSrcweir 
272*cdf0e10cSrcweir         m_lInterceptionRegs.erase(pIt);
273*cdf0e10cSrcweir     }
274*cdf0e10cSrcweir 
275*cdf0e10cSrcweir     css::uno::Reference< css::frame::XFrame > xOwner(m_xOwnerWeak.get(), css::uno::UNO_QUERY);
276*cdf0e10cSrcweir 
277*cdf0e10cSrcweir     aWriteLock.unlock();
278*cdf0e10cSrcweir     // } SAFE
279*cdf0e10cSrcweir 
280*cdf0e10cSrcweir     // Don't forget to send a frame action event "context changed".
281*cdf0e10cSrcweir     // Any cached dispatch objects must be validated now!
282*cdf0e10cSrcweir     if (xOwner.is())
283*cdf0e10cSrcweir 		xOwner->contextChanged();
284*cdf0e10cSrcweir }
285*cdf0e10cSrcweir 
286*cdf0e10cSrcweir /*-----------------------------------------------------------------------------
287*cdf0e10cSrcweir     31.03.2003 10:31
288*cdf0e10cSrcweir -----------------------------------------------------------------------------*/
289*cdf0e10cSrcweir #define FORCE_DESTRUCTION_OF_INTERCEPTION_CHAIN
290*cdf0e10cSrcweir void SAL_CALL InterceptionHelper::disposing(const css::lang::EventObject& aEvent)
291*cdf0e10cSrcweir     throw(css::uno::RuntimeException)
292*cdf0e10cSrcweir {
293*cdf0e10cSrcweir     #ifdef FORCE_DESTRUCTION_OF_INTERCEPTION_CHAIN
294*cdf0e10cSrcweir     // SAFE ->
295*cdf0e10cSrcweir     ReadGuard aReadLock(m_aLock);
296*cdf0e10cSrcweir 
297*cdf0e10cSrcweir     // check calli ... we accept such disposing call's only from our onwer frame.
298*cdf0e10cSrcweir     css::uno::Reference< css::frame::XFrame > xOwner(m_xOwnerWeak.get(), css::uno::UNO_QUERY);
299*cdf0e10cSrcweir     if (aEvent.Source != xOwner)
300*cdf0e10cSrcweir         return;
301*cdf0e10cSrcweir 
302*cdf0e10cSrcweir     // Because every interceptor hold at least one reference to us ... and we destruct this list
303*cdf0e10cSrcweir     // of interception objects ... we should hold ourself alive .-)
304*cdf0e10cSrcweir     css::uno::Reference< css::frame::XDispatchProvider > xThis(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY_THROW);
305*cdf0e10cSrcweir 
306*cdf0e10cSrcweir     // We need a full copy of all currently registered interceptor objects.
307*cdf0e10cSrcweir     // Otherwhise we cant iterate over this vector without the risk, that our iterator will be invalid.
308*cdf0e10cSrcweir     // Because this vetor will be influenced by every deregistered interceptor.
309*cdf0e10cSrcweir     InterceptionHelper::InterceptorList aCopy = m_lInterceptionRegs;
310*cdf0e10cSrcweir 
311*cdf0e10cSrcweir     aReadLock.unlock();
312*cdf0e10cSrcweir     // <- SAFE
313*cdf0e10cSrcweir 
314*cdf0e10cSrcweir     InterceptionHelper::InterceptorList::iterator pIt;
315*cdf0e10cSrcweir     for (  pIt  = aCopy.begin();
316*cdf0e10cSrcweir            pIt != aCopy.end()  ;
317*cdf0e10cSrcweir          ++pIt                 )
318*cdf0e10cSrcweir     {
319*cdf0e10cSrcweir         InterceptionHelper::InterceptorInfo& rInfo = *pIt;
320*cdf0e10cSrcweir         if (rInfo.xInterceptor.is())
321*cdf0e10cSrcweir         {
322*cdf0e10cSrcweir             css::uno::Reference< css::frame::XDispatchProviderInterceptor > xInterceptor(rInfo.xInterceptor, css::uno::UNO_QUERY_THROW);
323*cdf0e10cSrcweir             releaseDispatchProviderInterceptor(xInterceptor);
324*cdf0e10cSrcweir             rInfo.xInterceptor.clear();
325*cdf0e10cSrcweir         }
326*cdf0e10cSrcweir     }
327*cdf0e10cSrcweir 
328*cdf0e10cSrcweir     aCopy.clear();
329*cdf0e10cSrcweir 
330*cdf0e10cSrcweir     #if OSL_DEBUG_LEVEL > 0
331*cdf0e10cSrcweir     // SAFE ->
332*cdf0e10cSrcweir     aReadLock.lock();
333*cdf0e10cSrcweir     if (!m_lInterceptionRegs.empty() )
334*cdf0e10cSrcweir         OSL_ENSURE(sal_False, "There are some pending interceptor objects, which seams to be registered during (!) the destruction of a frame.");
335*cdf0e10cSrcweir     aReadLock.unlock();
336*cdf0e10cSrcweir     // <- SAFE
337*cdf0e10cSrcweir     #endif // ODL_DEBUG_LEVEL>0
338*cdf0e10cSrcweir 
339*cdf0e10cSrcweir     #endif // FORCE_DESTRUCTION_OF_INTERCEPTION_CHAIN
340*cdf0e10cSrcweir }
341*cdf0e10cSrcweir 
342*cdf0e10cSrcweir } // namespace framework
343