1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3*cdf0e10cSrcweir  *
4*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
5*cdf0e10cSrcweir  *
6*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
7*cdf0e10cSrcweir  *
8*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
9*cdf0e10cSrcweir  *
10*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
11*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
12*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
13*cdf0e10cSrcweir  *
14*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
15*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
18*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
19*cdf0e10cSrcweir  *
20*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
21*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
22*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
23*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
24*cdf0e10cSrcweir  *
25*cdf0e10cSrcweir  ************************************************************************/
26*cdf0e10cSrcweir 
27*cdf0e10cSrcweir #include "precompiled_dbaccess.hxx"
28*cdf0e10cSrcweir 
29*cdf0e10cSrcweir #include "dbaundomanager.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir /** === begin UNO includes === **/
32*cdf0e10cSrcweir #include <com/sun/star/lang/DisposedException.hpp>
33*cdf0e10cSrcweir /** === end UNO includes === **/
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir #include <svl/undo.hxx>
36*cdf0e10cSrcweir #include <vcl/svapp.hxx>
37*cdf0e10cSrcweir #include <vos/mutex.hxx>
38*cdf0e10cSrcweir #include <framework/undomanagerhelper.hxx>
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir //......................................................................................................................
41*cdf0e10cSrcweir namespace dbaui
42*cdf0e10cSrcweir {
43*cdf0e10cSrcweir //......................................................................................................................
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir 	/** === begin UNO using === **/
46*cdf0e10cSrcweir 	using ::com::sun::star::uno::Reference;
47*cdf0e10cSrcweir 	using ::com::sun::star::uno::XInterface;
48*cdf0e10cSrcweir 	using ::com::sun::star::uno::UNO_QUERY;
49*cdf0e10cSrcweir 	using ::com::sun::star::uno::UNO_QUERY_THROW;
50*cdf0e10cSrcweir 	using ::com::sun::star::uno::UNO_SET_THROW;
51*cdf0e10cSrcweir 	using ::com::sun::star::uno::Exception;
52*cdf0e10cSrcweir 	using ::com::sun::star::uno::RuntimeException;
53*cdf0e10cSrcweir 	using ::com::sun::star::uno::Any;
54*cdf0e10cSrcweir 	using ::com::sun::star::uno::makeAny;
55*cdf0e10cSrcweir 	using ::com::sun::star::uno::Sequence;
56*cdf0e10cSrcweir 	using ::com::sun::star::uno::Type;
57*cdf0e10cSrcweir     using ::com::sun::star::document::XUndoManager;
58*cdf0e10cSrcweir     using ::com::sun::star::lang::DisposedException;
59*cdf0e10cSrcweir     using ::com::sun::star::document::UndoContextNotClosedException;
60*cdf0e10cSrcweir     using ::com::sun::star::document::UndoFailedException;
61*cdf0e10cSrcweir     using ::com::sun::star::document::EmptyUndoStackException;
62*cdf0e10cSrcweir     using ::com::sun::star::util::InvalidStateException;
63*cdf0e10cSrcweir     using ::com::sun::star::document::XUndoAction;
64*cdf0e10cSrcweir     using ::com::sun::star::lang::IllegalArgumentException;
65*cdf0e10cSrcweir     using ::com::sun::star::document::XUndoManagerListener;
66*cdf0e10cSrcweir     using ::com::sun::star::util::NotLockedException;
67*cdf0e10cSrcweir     using ::com::sun::star::lang::NoSupportException;
68*cdf0e10cSrcweir 	/** === end UNO using === **/
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir 	//==================================================================================================================
71*cdf0e10cSrcweir 	//= UndoManager_Impl
72*cdf0e10cSrcweir 	//==================================================================================================================
73*cdf0e10cSrcweir     struct UndoManager_Impl : public ::framework::IUndoManagerImplementation
74*cdf0e10cSrcweir     {
75*cdf0e10cSrcweir         UndoManager_Impl( UndoManager& i_antiImpl, ::cppu::OWeakObject& i_parent, ::osl::Mutex& i_mutex )
76*cdf0e10cSrcweir             :rAntiImpl( i_antiImpl )
77*cdf0e10cSrcweir             ,rParent( i_parent )
78*cdf0e10cSrcweir             ,rMutex( i_mutex )
79*cdf0e10cSrcweir             ,bDisposed( false )
80*cdf0e10cSrcweir             ,aUndoManager()
81*cdf0e10cSrcweir             ,aUndoHelper( *this )
82*cdf0e10cSrcweir         {
83*cdf0e10cSrcweir         }
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir         virtual ~UndoManager_Impl()
86*cdf0e10cSrcweir         {
87*cdf0e10cSrcweir         }
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir         UndoManager&                    rAntiImpl;
90*cdf0e10cSrcweir         ::cppu::OWeakObject&            rParent;
91*cdf0e10cSrcweir         ::osl::Mutex&                   rMutex;
92*cdf0e10cSrcweir         bool                            bDisposed;
93*cdf0e10cSrcweir         SfxUndoManager                  aUndoManager;
94*cdf0e10cSrcweir         ::framework::UndoManagerHelper  aUndoHelper;
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir         // IUndoManagerImplementation
97*cdf0e10cSrcweir         virtual ::svl::IUndoManager&        getImplUndoManager();
98*cdf0e10cSrcweir         virtual Reference< XUndoManager >   getThis();
99*cdf0e10cSrcweir     };
100*cdf0e10cSrcweir 
101*cdf0e10cSrcweir 	//------------------------------------------------------------------------------------------------------------------
102*cdf0e10cSrcweir     ::svl::IUndoManager& UndoManager_Impl::getImplUndoManager()
103*cdf0e10cSrcweir     {
104*cdf0e10cSrcweir         return aUndoManager;
105*cdf0e10cSrcweir     }
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir 	//------------------------------------------------------------------------------------------------------------------
108*cdf0e10cSrcweir     Reference< XUndoManager > UndoManager_Impl::getThis()
109*cdf0e10cSrcweir     {
110*cdf0e10cSrcweir         return static_cast< XUndoManager* >( &rAntiImpl );
111*cdf0e10cSrcweir     }
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir     //==============================================================================================================
114*cdf0e10cSrcweir     //= OslMutexFacade
115*cdf0e10cSrcweir     //==============================================================================================================
116*cdf0e10cSrcweir     class OslMutexFacade : public ::framework::IMutex
117*cdf0e10cSrcweir     {
118*cdf0e10cSrcweir     public:
119*cdf0e10cSrcweir         OslMutexFacade( ::osl::Mutex& i_mutex )
120*cdf0e10cSrcweir             :m_rMutex( i_mutex )
121*cdf0e10cSrcweir         {
122*cdf0e10cSrcweir         }
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir         virtual void acquire();
125*cdf0e10cSrcweir         virtual void release();
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir     private:
128*cdf0e10cSrcweir         ::osl::Mutex&   m_rMutex;
129*cdf0e10cSrcweir     };
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir     //--------------------------------------------------------------------------------------------------------------
132*cdf0e10cSrcweir     void OslMutexFacade::acquire()
133*cdf0e10cSrcweir     {
134*cdf0e10cSrcweir         m_rMutex.acquire();
135*cdf0e10cSrcweir     }
136*cdf0e10cSrcweir 
137*cdf0e10cSrcweir     //--------------------------------------------------------------------------------------------------------------
138*cdf0e10cSrcweir     void OslMutexFacade::release()
139*cdf0e10cSrcweir     {
140*cdf0e10cSrcweir         m_rMutex.release();
141*cdf0e10cSrcweir     }
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir     //==============================================================================================================
144*cdf0e10cSrcweir     //= UndoManagerMethodGuard
145*cdf0e10cSrcweir     //==============================================================================================================
146*cdf0e10cSrcweir     /** guard for public UNO methods of the UndoManager
147*cdf0e10cSrcweir     */
148*cdf0e10cSrcweir     class UndoManagerMethodGuard : public ::framework::IMutexGuard
149*cdf0e10cSrcweir     {
150*cdf0e10cSrcweir     public:
151*cdf0e10cSrcweir         UndoManagerMethodGuard( UndoManager_Impl& i_impl )
152*cdf0e10cSrcweir             :m_aGuard( i_impl.rMutex )
153*cdf0e10cSrcweir             ,m_aMutexFacade( i_impl.rMutex )
154*cdf0e10cSrcweir         {
155*cdf0e10cSrcweir             // throw if the instance is already disposed
156*cdf0e10cSrcweir             if ( i_impl.bDisposed )
157*cdf0e10cSrcweir                 throw DisposedException( ::rtl::OUString(), i_impl.getThis() );
158*cdf0e10cSrcweir         }
159*cdf0e10cSrcweir         virtual ~UndoManagerMethodGuard()
160*cdf0e10cSrcweir         {
161*cdf0e10cSrcweir         }
162*cdf0e10cSrcweir 
163*cdf0e10cSrcweir         // IMutexGuard
164*cdf0e10cSrcweir         virtual ::framework::IMutex& getGuardedMutex();
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir         // IGuard
167*cdf0e10cSrcweir         virtual void clear();
168*cdf0e10cSrcweir         virtual void reset();
169*cdf0e10cSrcweir 
170*cdf0e10cSrcweir     private:
171*cdf0e10cSrcweir         ::osl::ResettableMutexGuard m_aGuard;
172*cdf0e10cSrcweir         OslMutexFacade              m_aMutexFacade;
173*cdf0e10cSrcweir     };
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir     //--------------------------------------------------------------------------------------------------------------
176*cdf0e10cSrcweir     ::framework::IMutex& UndoManagerMethodGuard::getGuardedMutex()
177*cdf0e10cSrcweir     {
178*cdf0e10cSrcweir         return m_aMutexFacade;
179*cdf0e10cSrcweir     }
180*cdf0e10cSrcweir 
181*cdf0e10cSrcweir     //--------------------------------------------------------------------------------------------------------------
182*cdf0e10cSrcweir     void UndoManagerMethodGuard::clear()
183*cdf0e10cSrcweir     {
184*cdf0e10cSrcweir         m_aGuard.clear();
185*cdf0e10cSrcweir     }
186*cdf0e10cSrcweir 
187*cdf0e10cSrcweir     //--------------------------------------------------------------------------------------------------------------
188*cdf0e10cSrcweir     void UndoManagerMethodGuard::reset()
189*cdf0e10cSrcweir     {
190*cdf0e10cSrcweir         m_aGuard.reset();
191*cdf0e10cSrcweir     }
192*cdf0e10cSrcweir 
193*cdf0e10cSrcweir 	//==================================================================================================================
194*cdf0e10cSrcweir 	//= UndoManager
195*cdf0e10cSrcweir 	//==================================================================================================================
196*cdf0e10cSrcweir 	//------------------------------------------------------------------------------------------------------------------
197*cdf0e10cSrcweir     UndoManager::UndoManager( ::cppu::OWeakObject& i_parent, ::osl::Mutex& i_mutex )
198*cdf0e10cSrcweir         :m_pImpl( new UndoManager_Impl( *this, i_parent, i_mutex ) )
199*cdf0e10cSrcweir     {
200*cdf0e10cSrcweir     }
201*cdf0e10cSrcweir 
202*cdf0e10cSrcweir 	//------------------------------------------------------------------------------------------------------------------
203*cdf0e10cSrcweir     UndoManager::~UndoManager()
204*cdf0e10cSrcweir     {
205*cdf0e10cSrcweir     }
206*cdf0e10cSrcweir 
207*cdf0e10cSrcweir 	//------------------------------------------------------------------------------------------------------------------
208*cdf0e10cSrcweir     SfxUndoManager& UndoManager::GetSfxUndoManager() const
209*cdf0e10cSrcweir     {
210*cdf0e10cSrcweir         return m_pImpl->aUndoManager;
211*cdf0e10cSrcweir     }
212*cdf0e10cSrcweir 
213*cdf0e10cSrcweir     //------------------------------------------------------------------------------------------------------------------
214*cdf0e10cSrcweir     void SAL_CALL UndoManager::acquire(  ) throw ()
215*cdf0e10cSrcweir     {
216*cdf0e10cSrcweir         m_pImpl->rParent.acquire();
217*cdf0e10cSrcweir     }
218*cdf0e10cSrcweir 
219*cdf0e10cSrcweir     //------------------------------------------------------------------------------------------------------------------
220*cdf0e10cSrcweir     void SAL_CALL UndoManager::release(  ) throw ()
221*cdf0e10cSrcweir     {
222*cdf0e10cSrcweir         m_pImpl->rParent.release();
223*cdf0e10cSrcweir     }
224*cdf0e10cSrcweir 
225*cdf0e10cSrcweir     //------------------------------------------------------------------------------------------------------------------
226*cdf0e10cSrcweir     void UndoManager::disposing()
227*cdf0e10cSrcweir     {
228*cdf0e10cSrcweir         {
229*cdf0e10cSrcweir             ::osl::MutexGuard aGuard( m_pImpl->rMutex );
230*cdf0e10cSrcweir             m_pImpl->bDisposed = true;
231*cdf0e10cSrcweir         }
232*cdf0e10cSrcweir         m_pImpl->aUndoHelper.disposing();
233*cdf0e10cSrcweir     }
234*cdf0e10cSrcweir 
235*cdf0e10cSrcweir     //------------------------------------------------------------------------------------------------------------------
236*cdf0e10cSrcweir     void SAL_CALL UndoManager::enterUndoContext( const ::rtl::OUString& i_title ) throw (RuntimeException)
237*cdf0e10cSrcweir     {
238*cdf0e10cSrcweir         UndoManagerMethodGuard aGuard( *m_pImpl );
239*cdf0e10cSrcweir         m_pImpl->aUndoHelper.enterUndoContext( i_title, aGuard );
240*cdf0e10cSrcweir     }
241*cdf0e10cSrcweir 
242*cdf0e10cSrcweir     //------------------------------------------------------------------------------------------------------------------
243*cdf0e10cSrcweir     void SAL_CALL UndoManager::enterHiddenUndoContext(  ) throw (EmptyUndoStackException, RuntimeException)
244*cdf0e10cSrcweir     {
245*cdf0e10cSrcweir         UndoManagerMethodGuard aGuard( *m_pImpl );
246*cdf0e10cSrcweir         m_pImpl->aUndoHelper.enterHiddenUndoContext( aGuard );
247*cdf0e10cSrcweir     }
248*cdf0e10cSrcweir 
249*cdf0e10cSrcweir     //------------------------------------------------------------------------------------------------------------------
250*cdf0e10cSrcweir     void SAL_CALL UndoManager::leaveUndoContext(  ) throw (InvalidStateException, RuntimeException)
251*cdf0e10cSrcweir     {
252*cdf0e10cSrcweir         UndoManagerMethodGuard aGuard( *m_pImpl );
253*cdf0e10cSrcweir         m_pImpl->aUndoHelper.leaveUndoContext( aGuard );
254*cdf0e10cSrcweir     }
255*cdf0e10cSrcweir 
256*cdf0e10cSrcweir     //------------------------------------------------------------------------------------------------------------------
257*cdf0e10cSrcweir     void SAL_CALL UndoManager::addUndoAction( const Reference< XUndoAction >& i_action ) throw (IllegalArgumentException, RuntimeException)
258*cdf0e10cSrcweir     {
259*cdf0e10cSrcweir         UndoManagerMethodGuard aGuard( *m_pImpl );
260*cdf0e10cSrcweir         m_pImpl->aUndoHelper.addUndoAction( i_action, aGuard );
261*cdf0e10cSrcweir     }
262*cdf0e10cSrcweir 
263*cdf0e10cSrcweir     //------------------------------------------------------------------------------------------------------------------
264*cdf0e10cSrcweir     void SAL_CALL UndoManager::undo(  ) throw (EmptyUndoStackException, UndoContextNotClosedException, UndoFailedException, RuntimeException)
265*cdf0e10cSrcweir     {
266*cdf0e10cSrcweir         ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
267*cdf0e10cSrcweir             // (all our UndoActions work directly on VCL code, usually, so ...)
268*cdf0e10cSrcweir         UndoManagerMethodGuard aGuard( *m_pImpl );
269*cdf0e10cSrcweir         m_pImpl->aUndoHelper.undo( aGuard );
270*cdf0e10cSrcweir     }
271*cdf0e10cSrcweir 
272*cdf0e10cSrcweir     //------------------------------------------------------------------------------------------------------------------
273*cdf0e10cSrcweir     void SAL_CALL UndoManager::redo(  ) throw (EmptyUndoStackException, UndoContextNotClosedException, UndoFailedException, RuntimeException)
274*cdf0e10cSrcweir     {
275*cdf0e10cSrcweir         ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
276*cdf0e10cSrcweir             // (all our UndoActions work directly on VCL code, usually, so ...)
277*cdf0e10cSrcweir         UndoManagerMethodGuard aGuard( *m_pImpl );
278*cdf0e10cSrcweir         m_pImpl->aUndoHelper.redo( aGuard );
279*cdf0e10cSrcweir     }
280*cdf0e10cSrcweir 
281*cdf0e10cSrcweir     //------------------------------------------------------------------------------------------------------------------
282*cdf0e10cSrcweir     ::sal_Bool SAL_CALL UndoManager::isUndoPossible(  ) throw (RuntimeException)
283*cdf0e10cSrcweir     {
284*cdf0e10cSrcweir         UndoManagerMethodGuard aGuard( *m_pImpl );
285*cdf0e10cSrcweir         return m_pImpl->aUndoHelper.isUndoPossible();
286*cdf0e10cSrcweir     }
287*cdf0e10cSrcweir 
288*cdf0e10cSrcweir     //------------------------------------------------------------------------------------------------------------------
289*cdf0e10cSrcweir     ::sal_Bool SAL_CALL UndoManager::isRedoPossible(  ) throw (RuntimeException)
290*cdf0e10cSrcweir     {
291*cdf0e10cSrcweir         UndoManagerMethodGuard aGuard( *m_pImpl );
292*cdf0e10cSrcweir         return m_pImpl->aUndoHelper.isRedoPossible();
293*cdf0e10cSrcweir     }
294*cdf0e10cSrcweir 
295*cdf0e10cSrcweir     //------------------------------------------------------------------------------------------------------------------
296*cdf0e10cSrcweir     ::rtl::OUString SAL_CALL UndoManager::getCurrentUndoActionTitle(  ) throw (EmptyUndoStackException, RuntimeException)
297*cdf0e10cSrcweir     {
298*cdf0e10cSrcweir         UndoManagerMethodGuard aGuard( *m_pImpl );
299*cdf0e10cSrcweir         return m_pImpl->aUndoHelper.getCurrentUndoActionTitle();
300*cdf0e10cSrcweir     }
301*cdf0e10cSrcweir 
302*cdf0e10cSrcweir     //------------------------------------------------------------------------------------------------------------------
303*cdf0e10cSrcweir     ::rtl::OUString SAL_CALL UndoManager::getCurrentRedoActionTitle(  ) throw (EmptyUndoStackException, RuntimeException)
304*cdf0e10cSrcweir     {
305*cdf0e10cSrcweir         UndoManagerMethodGuard aGuard( *m_pImpl );
306*cdf0e10cSrcweir         return m_pImpl->aUndoHelper.getCurrentRedoActionTitle();
307*cdf0e10cSrcweir     }
308*cdf0e10cSrcweir 
309*cdf0e10cSrcweir     //------------------------------------------------------------------------------------------------------------------
310*cdf0e10cSrcweir     Sequence< ::rtl::OUString > SAL_CALL UndoManager::getAllUndoActionTitles(  ) throw (RuntimeException)
311*cdf0e10cSrcweir     {
312*cdf0e10cSrcweir         UndoManagerMethodGuard aGuard( *m_pImpl );
313*cdf0e10cSrcweir         return m_pImpl->aUndoHelper.getAllUndoActionTitles();
314*cdf0e10cSrcweir     }
315*cdf0e10cSrcweir 
316*cdf0e10cSrcweir     //------------------------------------------------------------------------------------------------------------------
317*cdf0e10cSrcweir     Sequence< ::rtl::OUString > SAL_CALL UndoManager::getAllRedoActionTitles(  ) throw (RuntimeException)
318*cdf0e10cSrcweir     {
319*cdf0e10cSrcweir         UndoManagerMethodGuard aGuard( *m_pImpl );
320*cdf0e10cSrcweir         return m_pImpl->aUndoHelper.getAllRedoActionTitles();
321*cdf0e10cSrcweir     }
322*cdf0e10cSrcweir 
323*cdf0e10cSrcweir     //------------------------------------------------------------------------------------------------------------------
324*cdf0e10cSrcweir     void SAL_CALL UndoManager::clear(  ) throw (UndoContextNotClosedException, RuntimeException)
325*cdf0e10cSrcweir     {
326*cdf0e10cSrcweir         UndoManagerMethodGuard aGuard( *m_pImpl );
327*cdf0e10cSrcweir         m_pImpl->aUndoHelper.clear( aGuard );
328*cdf0e10cSrcweir     }
329*cdf0e10cSrcweir 
330*cdf0e10cSrcweir     //------------------------------------------------------------------------------------------------------------------
331*cdf0e10cSrcweir     void SAL_CALL UndoManager::clearRedo(  ) throw (UndoContextNotClosedException, RuntimeException)
332*cdf0e10cSrcweir     {
333*cdf0e10cSrcweir         UndoManagerMethodGuard aGuard( *m_pImpl );
334*cdf0e10cSrcweir         m_pImpl->aUndoHelper.clearRedo( aGuard );
335*cdf0e10cSrcweir     }
336*cdf0e10cSrcweir 
337*cdf0e10cSrcweir     //------------------------------------------------------------------------------------------------------------------
338*cdf0e10cSrcweir     void SAL_CALL UndoManager::reset(  ) throw (RuntimeException)
339*cdf0e10cSrcweir     {
340*cdf0e10cSrcweir         UndoManagerMethodGuard aGuard( *m_pImpl );
341*cdf0e10cSrcweir         m_pImpl->aUndoHelper.reset( aGuard );
342*cdf0e10cSrcweir     }
343*cdf0e10cSrcweir 
344*cdf0e10cSrcweir     //------------------------------------------------------------------------------------------------------------------
345*cdf0e10cSrcweir     void SAL_CALL UndoManager::addUndoManagerListener( const Reference< XUndoManagerListener >& i_listener ) throw (RuntimeException)
346*cdf0e10cSrcweir     {
347*cdf0e10cSrcweir         UndoManagerMethodGuard aGuard( *m_pImpl );
348*cdf0e10cSrcweir         m_pImpl->aUndoHelper.addUndoManagerListener( i_listener );
349*cdf0e10cSrcweir     }
350*cdf0e10cSrcweir 
351*cdf0e10cSrcweir     //------------------------------------------------------------------------------------------------------------------
352*cdf0e10cSrcweir     void SAL_CALL UndoManager::removeUndoManagerListener( const Reference< XUndoManagerListener >& i_listener ) throw (RuntimeException)
353*cdf0e10cSrcweir     {
354*cdf0e10cSrcweir         UndoManagerMethodGuard aGuard( *m_pImpl );
355*cdf0e10cSrcweir         m_pImpl->aUndoHelper.removeUndoManagerListener( i_listener );
356*cdf0e10cSrcweir     }
357*cdf0e10cSrcweir 
358*cdf0e10cSrcweir     //------------------------------------------------------------------------------------------------------------------
359*cdf0e10cSrcweir     void SAL_CALL UndoManager::lock(  ) throw (RuntimeException)
360*cdf0e10cSrcweir     {
361*cdf0e10cSrcweir         UndoManagerMethodGuard aGuard( *m_pImpl );
362*cdf0e10cSrcweir         m_pImpl->aUndoHelper.lock();
363*cdf0e10cSrcweir     }
364*cdf0e10cSrcweir 
365*cdf0e10cSrcweir     //------------------------------------------------------------------------------------------------------------------
366*cdf0e10cSrcweir     void SAL_CALL UndoManager::unlock(  ) throw (NotLockedException, RuntimeException)
367*cdf0e10cSrcweir     {
368*cdf0e10cSrcweir         UndoManagerMethodGuard aGuard( *m_pImpl );
369*cdf0e10cSrcweir         m_pImpl->aUndoHelper.unlock();
370*cdf0e10cSrcweir     }
371*cdf0e10cSrcweir 
372*cdf0e10cSrcweir     //------------------------------------------------------------------------------------------------------------------
373*cdf0e10cSrcweir     ::sal_Bool SAL_CALL UndoManager::isLocked(  ) throw (RuntimeException)
374*cdf0e10cSrcweir     {
375*cdf0e10cSrcweir         UndoManagerMethodGuard aGuard( *m_pImpl );
376*cdf0e10cSrcweir         return m_pImpl->aUndoHelper.isLocked();
377*cdf0e10cSrcweir     }
378*cdf0e10cSrcweir 
379*cdf0e10cSrcweir     //------------------------------------------------------------------------------------------------------------------
380*cdf0e10cSrcweir     Reference< XInterface > SAL_CALL UndoManager::getParent(  ) throw (RuntimeException)
381*cdf0e10cSrcweir     {
382*cdf0e10cSrcweir         UndoManagerMethodGuard aGuard( *m_pImpl );
383*cdf0e10cSrcweir         return *&m_pImpl->rParent;
384*cdf0e10cSrcweir     }
385*cdf0e10cSrcweir 
386*cdf0e10cSrcweir     //------------------------------------------------------------------------------------------------------------------
387*cdf0e10cSrcweir     void SAL_CALL UndoManager::setParent( const Reference< XInterface >& i_parent ) throw (NoSupportException, RuntimeException)
388*cdf0e10cSrcweir     {
389*cdf0e10cSrcweir         (void)i_parent;
390*cdf0e10cSrcweir         throw NoSupportException( ::rtl::OUString(), m_pImpl->getThis() );
391*cdf0e10cSrcweir     }
392*cdf0e10cSrcweir 
393*cdf0e10cSrcweir //......................................................................................................................
394*cdf0e10cSrcweir } // namespace dbaui
395*cdf0e10cSrcweir //......................................................................................................................
396