xref: /AOO41X/main/sd/source/ui/view/UpdateLockManager.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_sd.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include "UpdateLockManager.hxx"
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir #include "MutexOwner.hxx"
34*cdf0e10cSrcweir #include "ViewShellBase.hxx"
35*cdf0e10cSrcweir #include <com/sun/star/frame/XLayoutManager.hpp>
36*cdf0e10cSrcweir #include <com/sun/star/frame/XLayoutManagerEventBroadcaster.hpp>
37*cdf0e10cSrcweir #include <com/sun/star/frame/LayoutManagerEvents.hpp>
38*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
39*cdf0e10cSrcweir #include <cppuhelper/compbase1.hxx>
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir #include <vcl/timer.hxx>
42*cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
45*cdf0e10cSrcweir using namespace ::com::sun::star;
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir namespace {
48*cdf0e10cSrcweir typedef cppu::WeakComponentImplHelper1<frame::XLayoutManagerListener> InterfaceBase;
49*cdf0e10cSrcweir }
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir namespace sd {
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir 
54*cdf0e10cSrcweir /** This implementation class not only implements the Lock() and Unlock()
55*cdf0e10cSrcweir     methods but as well listens for the right combination of events to call
56*cdf0e10cSrcweir     Unlock() when all is ready after the PaneManager has switched (some of)
57*cdf0e10cSrcweir     its view shells.
58*cdf0e10cSrcweir */
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir class UpdateLockManager::Implementation
61*cdf0e10cSrcweir     : protected MutexOwner,
62*cdf0e10cSrcweir       public InterfaceBase
63*cdf0e10cSrcweir {
64*cdf0e10cSrcweir public:
65*cdf0e10cSrcweir     Implementation (ViewShellBase& rBase);
66*cdf0e10cSrcweir     virtual ~Implementation (void);
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir     void Lock (void);
69*cdf0e10cSrcweir     void Unlock (void);
70*cdf0e10cSrcweir     bool IsLocked (void) const;
71*cdf0e10cSrcweir 
72*cdf0e10cSrcweir     /** Unlock regardless of the current lock level.
73*cdf0e10cSrcweir     */
74*cdf0e10cSrcweir     void ForceUnlock (void);
75*cdf0e10cSrcweir 
76*cdf0e10cSrcweir private:
77*cdf0e10cSrcweir     ViewShellBase& mrBase;
78*cdf0e10cSrcweir     /// A lock level greater than 0 indicates that the ViewShellBase is locked.
79*cdf0e10cSrcweir     sal_Int32 mnLockDepth;
80*cdf0e10cSrcweir     /// The emergency timer to unlock the ViewShellBase when all else fails.
81*cdf0e10cSrcweir     Timer maTimer;
82*cdf0e10cSrcweir     /// Remember when to unlock after a layout event from frame::XLayoutManager
83*cdf0e10cSrcweir     bool mbUnlockOnNextLayout;
84*cdf0e10cSrcweir     /// Remember whether we are listening to the frame::XLayoutManager
85*cdf0e10cSrcweir     bool mbListenerIsRegistered;
86*cdf0e10cSrcweir     /// Remember whether the frame::XLayoutManager is locked.
87*cdf0e10cSrcweir     bool mbLayouterIsLocked;
88*cdf0e10cSrcweir     /** We hold a weak reference to the layout manager in order to have
89*cdf0e10cSrcweir         access to it even when the ViewShellBase object is not valid anymore
90*cdf0e10cSrcweir         and can not be used to obtain the layout manager.
91*cdf0e10cSrcweir     */
92*cdf0e10cSrcweir     WeakReference<frame::XLayoutManager> mxLayoutManager;
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir     //=====  frame::XLayoutEventListener  =====================================
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir     /** The event of the layouter are observed to find the best moment for
97*cdf0e10cSrcweir         unlocking.  This is the first layout after the lock level of the
98*cdf0e10cSrcweir         layouter drops to one (we hold a lock to it ourselves which we
99*cdf0e10cSrcweir         release when unlocking).
100*cdf0e10cSrcweir     */
101*cdf0e10cSrcweir     virtual void SAL_CALL layoutEvent (
102*cdf0e10cSrcweir         const lang::EventObject& xSource,
103*cdf0e10cSrcweir         sal_Int16 eLayoutEvent,
104*cdf0e10cSrcweir         const Any& rInfo)
105*cdf0e10cSrcweir         throw (uno::RuntimeException);
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir     //=====  lang::XEventListener  ============================================
108*cdf0e10cSrcweir     virtual void SAL_CALL
109*cdf0e10cSrcweir         disposing (const lang::EventObject& rEventObject)
110*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir     virtual void SAL_CALL disposing (void);
113*cdf0e10cSrcweir 
114*cdf0e10cSrcweir     /** This is only a fallback to make the office usable when for some
115*cdf0e10cSrcweir         reason the intended way of unlocking it failed.
116*cdf0e10cSrcweir     */
117*cdf0e10cSrcweir     DECL_LINK(Timeout, void*);
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir     /** Convenience method that finds the layout manager associated with the
120*cdf0e10cSrcweir         frame that shows the ViewShellBase.
121*cdf0e10cSrcweir     */
122*cdf0e10cSrcweir     Reference<frame::XLayoutManager> GetLayoutManager (void);
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir     Implementation (const Implementation&); // Not implemented.
125*cdf0e10cSrcweir     Implementation& operator= (const Implementation&); // Not implemented.
126*cdf0e10cSrcweir };
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir //===== UpdateLockManager =====================================================
132*cdf0e10cSrcweir 
133*cdf0e10cSrcweir UpdateLockManager::UpdateLockManager (ViewShellBase& rBase)
134*cdf0e10cSrcweir     : mpImpl(new Implementation(rBase))
135*cdf0e10cSrcweir {
136*cdf0e10cSrcweir     mpImpl->acquire();
137*cdf0e10cSrcweir }
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir 
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir UpdateLockManager::~UpdateLockManager (void)
142*cdf0e10cSrcweir {
143*cdf0e10cSrcweir     if (mpImpl != NULL)
144*cdf0e10cSrcweir     {
145*cdf0e10cSrcweir         mpImpl->ForceUnlock();
146*cdf0e10cSrcweir         mpImpl->release();
147*cdf0e10cSrcweir     }
148*cdf0e10cSrcweir }
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir void UpdateLockManager::Disable (void)
154*cdf0e10cSrcweir {
155*cdf0e10cSrcweir     if (mpImpl != NULL)
156*cdf0e10cSrcweir     {
157*cdf0e10cSrcweir         mpImpl->ForceUnlock();
158*cdf0e10cSrcweir         mpImpl->release();
159*cdf0e10cSrcweir         mpImpl = NULL;
160*cdf0e10cSrcweir     }
161*cdf0e10cSrcweir }
162*cdf0e10cSrcweir 
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir void UpdateLockManager::Lock (void)
167*cdf0e10cSrcweir {
168*cdf0e10cSrcweir     if (mpImpl != NULL)
169*cdf0e10cSrcweir         mpImpl->Lock();
170*cdf0e10cSrcweir }
171*cdf0e10cSrcweir 
172*cdf0e10cSrcweir 
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir void UpdateLockManager::Unlock (void)
176*cdf0e10cSrcweir {
177*cdf0e10cSrcweir     if (mpImpl != NULL)
178*cdf0e10cSrcweir         mpImpl->Unlock();
179*cdf0e10cSrcweir }
180*cdf0e10cSrcweir 
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir 
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir bool UpdateLockManager::IsLocked (void) const
185*cdf0e10cSrcweir {
186*cdf0e10cSrcweir     if (mpImpl != NULL)
187*cdf0e10cSrcweir         return mpImpl->IsLocked();
188*cdf0e10cSrcweir     else
189*cdf0e10cSrcweir         return false;
190*cdf0e10cSrcweir }
191*cdf0e10cSrcweir 
192*cdf0e10cSrcweir 
193*cdf0e10cSrcweir 
194*cdf0e10cSrcweir //===== UpdateLock::Implementation ============================================
195*cdf0e10cSrcweir 
196*cdf0e10cSrcweir UpdateLockManager::Implementation::Implementation (ViewShellBase& rBase)
197*cdf0e10cSrcweir     : InterfaceBase(maMutex),
198*cdf0e10cSrcweir       mrBase(rBase),
199*cdf0e10cSrcweir       mnLockDepth(0),
200*cdf0e10cSrcweir       maTimer(),
201*cdf0e10cSrcweir       mbUnlockOnNextLayout(false),
202*cdf0e10cSrcweir       mbListenerIsRegistered(false),
203*cdf0e10cSrcweir       mbLayouterIsLocked(false)
204*cdf0e10cSrcweir {
205*cdf0e10cSrcweir }
206*cdf0e10cSrcweir 
207*cdf0e10cSrcweir 
208*cdf0e10cSrcweir 
209*cdf0e10cSrcweir 
210*cdf0e10cSrcweir UpdateLockManager::Implementation::~Implementation (void)
211*cdf0e10cSrcweir {
212*cdf0e10cSrcweir     OSL_ASSERT(mnLockDepth==0);
213*cdf0e10cSrcweir     ForceUnlock();
214*cdf0e10cSrcweir }
215*cdf0e10cSrcweir 
216*cdf0e10cSrcweir 
217*cdf0e10cSrcweir 
218*cdf0e10cSrcweir 
219*cdf0e10cSrcweir void UpdateLockManager::Implementation::Lock (void)
220*cdf0e10cSrcweir {
221*cdf0e10cSrcweir     ++mnLockDepth;
222*cdf0e10cSrcweir     if (mnLockDepth == 1)
223*cdf0e10cSrcweir     {
224*cdf0e10cSrcweir         Reference<frame::XLayoutManager> xLayouter (GetLayoutManager());
225*cdf0e10cSrcweir         if (xLayouter.is())
226*cdf0e10cSrcweir         {
227*cdf0e10cSrcweir             // Register as event listener.
228*cdf0e10cSrcweir             Reference<frame::XLayoutManagerEventBroadcaster> xBroadcaster (
229*cdf0e10cSrcweir                 xLayouter, UNO_QUERY);
230*cdf0e10cSrcweir             if (xBroadcaster.is())
231*cdf0e10cSrcweir             {
232*cdf0e10cSrcweir                 mbListenerIsRegistered = true;
233*cdf0e10cSrcweir                 xBroadcaster->addLayoutManagerEventListener(
234*cdf0e10cSrcweir                     Reference<frame::XLayoutManagerListener> (
235*cdf0e10cSrcweir                         static_cast<XWeak*>(this), UNO_QUERY) );
236*cdf0e10cSrcweir             }
237*cdf0e10cSrcweir 
238*cdf0e10cSrcweir             // Lock the layout manager.
239*cdf0e10cSrcweir             mbLayouterIsLocked = true;
240*cdf0e10cSrcweir             xLayouter->lock();
241*cdf0e10cSrcweir         }
242*cdf0e10cSrcweir 
243*cdf0e10cSrcweir         // As a fallback, when the notification mechanism does not work (or is
244*cdf0e10cSrcweir         // incorrectly used) we use a timer that will unlock us eventually.
245*cdf0e10cSrcweir         maTimer.SetTimeout(5000 /*ms*/);
246*cdf0e10cSrcweir         maTimer.SetTimeoutHdl(LINK(this,UpdateLockManager::Implementation,Timeout));
247*cdf0e10cSrcweir         maTimer.Start();
248*cdf0e10cSrcweir     }
249*cdf0e10cSrcweir }
250*cdf0e10cSrcweir 
251*cdf0e10cSrcweir 
252*cdf0e10cSrcweir 
253*cdf0e10cSrcweir 
254*cdf0e10cSrcweir void UpdateLockManager::Implementation::Unlock (void)
255*cdf0e10cSrcweir {
256*cdf0e10cSrcweir     --mnLockDepth;
257*cdf0e10cSrcweir 
258*cdf0e10cSrcweir     if (mnLockDepth == 0)
259*cdf0e10cSrcweir     {
260*cdf0e10cSrcweir         // Stop the timer.  We don't need it anymore.
261*cdf0e10cSrcweir         maTimer.Stop();
262*cdf0e10cSrcweir 
263*cdf0e10cSrcweir         try
264*cdf0e10cSrcweir         {
265*cdf0e10cSrcweir             Reference<frame::XLayoutManager> xLayouter (GetLayoutManager());
266*cdf0e10cSrcweir             if (xLayouter.is())
267*cdf0e10cSrcweir             {
268*cdf0e10cSrcweir                 // Detach from the layouter.
269*cdf0e10cSrcweir                 if (mbListenerIsRegistered)
270*cdf0e10cSrcweir                 {
271*cdf0e10cSrcweir                     Reference<frame::XLayoutManagerEventBroadcaster> xBroadcaster (
272*cdf0e10cSrcweir                         xLayouter, UNO_QUERY);
273*cdf0e10cSrcweir                     if (xBroadcaster.is())
274*cdf0e10cSrcweir                     {
275*cdf0e10cSrcweir                         mbListenerIsRegistered = false;
276*cdf0e10cSrcweir                         xBroadcaster->removeLayoutManagerEventListener(
277*cdf0e10cSrcweir                             Reference<frame::XLayoutManagerListener> (
278*cdf0e10cSrcweir                                 static_cast<XWeak*>(this), UNO_QUERY) );
279*cdf0e10cSrcweir                     }
280*cdf0e10cSrcweir                 }
281*cdf0e10cSrcweir 
282*cdf0e10cSrcweir                 // Unlock the layouter.
283*cdf0e10cSrcweir                 if (mbLayouterIsLocked)
284*cdf0e10cSrcweir                 {
285*cdf0e10cSrcweir                     mbLayouterIsLocked = false;
286*cdf0e10cSrcweir                     xLayouter->unlock();
287*cdf0e10cSrcweir                 }
288*cdf0e10cSrcweir             }
289*cdf0e10cSrcweir         }
290*cdf0e10cSrcweir         catch (RuntimeException)
291*cdf0e10cSrcweir         { }
292*cdf0e10cSrcweir 
293*cdf0e10cSrcweir         // Force a rearrangement of the UI elements of the views.
294*cdf0e10cSrcweir         mrBase.Rearrange();
295*cdf0e10cSrcweir     }
296*cdf0e10cSrcweir }
297*cdf0e10cSrcweir 
298*cdf0e10cSrcweir 
299*cdf0e10cSrcweir 
300*cdf0e10cSrcweir 
301*cdf0e10cSrcweir bool UpdateLockManager::Implementation::IsLocked (void) const
302*cdf0e10cSrcweir {
303*cdf0e10cSrcweir     return (mnLockDepth > 0);
304*cdf0e10cSrcweir }
305*cdf0e10cSrcweir 
306*cdf0e10cSrcweir 
307*cdf0e10cSrcweir 
308*cdf0e10cSrcweir 
309*cdf0e10cSrcweir void UpdateLockManager::Implementation::ForceUnlock (void)
310*cdf0e10cSrcweir {
311*cdf0e10cSrcweir     while (IsLocked())
312*cdf0e10cSrcweir         Unlock();
313*cdf0e10cSrcweir }
314*cdf0e10cSrcweir 
315*cdf0e10cSrcweir 
316*cdf0e10cSrcweir 
317*cdf0e10cSrcweir 
318*cdf0e10cSrcweir void SAL_CALL UpdateLockManager::Implementation::layoutEvent (
319*cdf0e10cSrcweir     const lang::EventObject&,
320*cdf0e10cSrcweir     sal_Int16 eLayoutEvent,
321*cdf0e10cSrcweir     const Any& rInfo)
322*cdf0e10cSrcweir     throw (uno::RuntimeException)
323*cdf0e10cSrcweir {
324*cdf0e10cSrcweir     switch (eLayoutEvent)
325*cdf0e10cSrcweir     {
326*cdf0e10cSrcweir         case frame::LayoutManagerEvents::LOCK:
327*cdf0e10cSrcweir         {
328*cdf0e10cSrcweir             sal_Int32 nLockCount;
329*cdf0e10cSrcweir             rInfo >>= nLockCount;
330*cdf0e10cSrcweir         }
331*cdf0e10cSrcweir         break;
332*cdf0e10cSrcweir 
333*cdf0e10cSrcweir         case frame::LayoutManagerEvents::UNLOCK:
334*cdf0e10cSrcweir         {
335*cdf0e10cSrcweir             sal_Int32 nLockCount = 0;
336*cdf0e10cSrcweir             rInfo >>= nLockCount;
337*cdf0e10cSrcweir             if (nLockCount == 1)
338*cdf0e10cSrcweir             {
339*cdf0e10cSrcweir                 // The lock count dropped to one.  This means that we are
340*cdf0e10cSrcweir                 // the only one that still holds a lock to the layout
341*cdf0e10cSrcweir                 // manager.  We unlock the layout manager now and the
342*cdf0e10cSrcweir                 // ViewShellBase on the next layout of the layout manager.
343*cdf0e10cSrcweir                 mbUnlockOnNextLayout = true;
344*cdf0e10cSrcweir                 Reference<frame::XLayoutManager> xLayouter (GetLayoutManager());
345*cdf0e10cSrcweir                 if (xLayouter.is() && mbLayouterIsLocked)
346*cdf0e10cSrcweir                 {
347*cdf0e10cSrcweir                     mbLayouterIsLocked = false;
348*cdf0e10cSrcweir                     xLayouter->unlock();
349*cdf0e10cSrcweir                 }
350*cdf0e10cSrcweir             }
351*cdf0e10cSrcweir         }
352*cdf0e10cSrcweir         break;
353*cdf0e10cSrcweir 
354*cdf0e10cSrcweir         case frame::LayoutManagerEvents::LAYOUT:
355*cdf0e10cSrcweir             // Unlock when the layout manager is not still locked.
356*cdf0e10cSrcweir             if (mbUnlockOnNextLayout)
357*cdf0e10cSrcweir                 Unlock();
358*cdf0e10cSrcweir             break;
359*cdf0e10cSrcweir     }
360*cdf0e10cSrcweir }
361*cdf0e10cSrcweir 
362*cdf0e10cSrcweir 
363*cdf0e10cSrcweir 
364*cdf0e10cSrcweir 
365*cdf0e10cSrcweir void SAL_CALL UpdateLockManager::Implementation::disposing (const lang::EventObject& )
366*cdf0e10cSrcweir     throw (::com::sun::star::uno::RuntimeException)
367*cdf0e10cSrcweir {
368*cdf0e10cSrcweir }
369*cdf0e10cSrcweir 
370*cdf0e10cSrcweir 
371*cdf0e10cSrcweir 
372*cdf0e10cSrcweir 
373*cdf0e10cSrcweir void SAL_CALL UpdateLockManager::Implementation::disposing (void)
374*cdf0e10cSrcweir {
375*cdf0e10cSrcweir }
376*cdf0e10cSrcweir 
377*cdf0e10cSrcweir 
378*cdf0e10cSrcweir 
379*cdf0e10cSrcweir 
380*cdf0e10cSrcweir IMPL_LINK(UpdateLockManager::Implementation, Timeout, void*, EMPTYARG)
381*cdf0e10cSrcweir {
382*cdf0e10cSrcweir     // This method is only called when all else failed.  We unlock
383*cdf0e10cSrcweir     // regardless of how deep the lock depth.
384*cdf0e10cSrcweir     while (mnLockDepth > 0)
385*cdf0e10cSrcweir         Unlock();
386*cdf0e10cSrcweir     return 1;
387*cdf0e10cSrcweir }
388*cdf0e10cSrcweir 
389*cdf0e10cSrcweir 
390*cdf0e10cSrcweir 
391*cdf0e10cSrcweir 
392*cdf0e10cSrcweir Reference< ::com::sun::star::frame::XLayoutManager>
393*cdf0e10cSrcweir     UpdateLockManager::Implementation::GetLayoutManager (void)
394*cdf0e10cSrcweir {
395*cdf0e10cSrcweir     Reference<frame::XLayoutManager> xLayoutManager;
396*cdf0e10cSrcweir 
397*cdf0e10cSrcweir     if (mxLayoutManager.get() == NULL)
398*cdf0e10cSrcweir     {
399*cdf0e10cSrcweir         if (mrBase.GetViewFrame()!=NULL)
400*cdf0e10cSrcweir         {
401*cdf0e10cSrcweir             Reference<beans::XPropertySet> xFrameProperties (
402*cdf0e10cSrcweir                 mrBase.GetViewFrame()->GetFrame().GetFrameInterface(),
403*cdf0e10cSrcweir                 UNO_QUERY);
404*cdf0e10cSrcweir             if (xFrameProperties.is())
405*cdf0e10cSrcweir             {
406*cdf0e10cSrcweir                 try
407*cdf0e10cSrcweir                 {
408*cdf0e10cSrcweir                     Any aValue (xFrameProperties->getPropertyValue(
409*cdf0e10cSrcweir                         ::rtl::OUString::createFromAscii("LayoutManager")));
410*cdf0e10cSrcweir                     aValue >>= xLayoutManager;
411*cdf0e10cSrcweir                 }
412*cdf0e10cSrcweir                 catch (const beans::UnknownPropertyException& rException)
413*cdf0e10cSrcweir                 {
414*cdf0e10cSrcweir                     (void)rException;
415*cdf0e10cSrcweir                 }
416*cdf0e10cSrcweir             }
417*cdf0e10cSrcweir             mxLayoutManager = xLayoutManager;
418*cdf0e10cSrcweir         }
419*cdf0e10cSrcweir     }
420*cdf0e10cSrcweir     else
421*cdf0e10cSrcweir         xLayoutManager = mxLayoutManager;
422*cdf0e10cSrcweir 
423*cdf0e10cSrcweir     return xLayoutManager;
424*cdf0e10cSrcweir }
425*cdf0e10cSrcweir 
426*cdf0e10cSrcweir 
427*cdf0e10cSrcweir 
428*cdf0e10cSrcweir 
429*cdf0e10cSrcweir } // end of anonymous namespace
430