22#include <com/sun/star/lang/DisposedException.hpp>
23#include <com/sun/star/lang/NoSupportException.hpp>
33 using ::com::sun::star::uno::Reference;
34 using ::com::sun::star::uno::XInterface;
35 using ::com::sun::star::uno::Sequence;
36 using ::com::sun::star::document::XUndoManager;
37 using ::com::sun::star::lang::DisposedException;
38 using ::com::sun::star::document::XUndoAction;
39 using ::com::sun::star::document::XUndoManagerListener;
40 using ::com::sun::star::lang::NoSupportException;
77 return static_cast< XUndoManager*
>( &
rAntiImpl );
86 explicit OslMutexFacade( ::osl::Mutex& i_mutex )
91 virtual ~OslMutexFacade() {}
93 virtual void acquire()
override;
94 virtual void release()
override;
102 void OslMutexFacade::acquire()
107 void OslMutexFacade::release()
120 explicit UndoManagerMethodGuard( UndoManager_Impl& i_impl )
125 if ( i_impl.bDisposed )
126 throw DisposedException( OUString(), i_impl.getThis() );
128 virtual ~UndoManagerMethodGuard()
133 virtual void clear()
override;
134 virtual ::framework::IMutex& getGuardedMutex()
override;
148 void UndoManagerMethodGuard::clear()
181 ::osl::MutexGuard aGuard(
m_xImpl->rMutex );
184 m_xImpl->aUndoHelper.disposing();
189 UndoManagerMethodGuard aGuard( *
m_xImpl );
190 m_xImpl->aUndoHelper.enterUndoContext( i_title, aGuard );
195 UndoManagerMethodGuard aGuard( *
m_xImpl );
196 m_xImpl->aUndoHelper.enterHiddenUndoContext( aGuard );
201 UndoManagerMethodGuard aGuard( *
m_xImpl );
202 m_xImpl->aUndoHelper.leaveUndoContext( aGuard );
207 UndoManagerMethodGuard aGuard( *
m_xImpl );
208 m_xImpl->aUndoHelper.addUndoAction( i_action, aGuard );
215 UndoManagerMethodGuard aGuard( *
m_xImpl );
216 m_xImpl->aUndoHelper.undo( aGuard );
223 UndoManagerMethodGuard aGuard( *
m_xImpl );
224 m_xImpl->aUndoHelper.redo( aGuard );
229 UndoManagerMethodGuard aGuard( *
m_xImpl );
230 return m_xImpl->aUndoHelper.isUndoPossible();
235 UndoManagerMethodGuard aGuard( *
m_xImpl );
236 return m_xImpl->aUndoHelper.isRedoPossible();
241 UndoManagerMethodGuard aGuard( *
m_xImpl );
242 return m_xImpl->aUndoHelper.getCurrentUndoActionTitle();
247 UndoManagerMethodGuard aGuard( *
m_xImpl );
248 return m_xImpl->aUndoHelper.getCurrentRedoActionTitle();
253 UndoManagerMethodGuard aGuard( *
m_xImpl );
254 return m_xImpl->aUndoHelper.getAllUndoActionTitles();
259 UndoManagerMethodGuard aGuard( *
m_xImpl );
260 return m_xImpl->aUndoHelper.getAllRedoActionTitles();
265 UndoManagerMethodGuard aGuard( *
m_xImpl );
266 m_xImpl->aUndoHelper.clear( aGuard );
271 UndoManagerMethodGuard aGuard( *
m_xImpl );
272 m_xImpl->aUndoHelper.clearRedo( aGuard );
277 UndoManagerMethodGuard aGuard( *
m_xImpl );
278 m_xImpl->aUndoHelper.reset( aGuard );
283 UndoManagerMethodGuard aGuard( *
m_xImpl );
284 m_xImpl->aUndoHelper.addUndoManagerListener( i_listener );
289 UndoManagerMethodGuard aGuard( *
m_xImpl );
290 m_xImpl->aUndoHelper.removeUndoManagerListener( i_listener );
295 UndoManagerMethodGuard aGuard( *
m_xImpl );
301 UndoManagerMethodGuard aGuard( *
m_xImpl );
307 UndoManagerMethodGuard aGuard( *
m_xImpl );
308 return m_xImpl->aUndoHelper.isLocked();
313 UndoManagerMethodGuard aGuard( *
m_xImpl );
319 throw NoSupportException( OUString(),
m_xImpl->getThis() );
virtual void SAL_CALL addUndoManagerListener(const css::uno::Reference< css::document::XUndoManagerListener > &i_listener) override
virtual void SAL_CALL redo() override
virtual void SAL_CALL enterUndoContext(const OUString &i_title) override
virtual void SAL_CALL setParent(const css::uno::Reference< css::uno::XInterface > &Parent) override
virtual css::uno::Sequence< OUString > SAL_CALL getAllUndoActionTitles() override
SfxUndoManager & GetSfxUndoManager() const
virtual void SAL_CALL addUndoAction(const css::uno::Reference< css::document::XUndoAction > &i_action) override
virtual void SAL_CALL clear() override
virtual void SAL_CALL removeUndoManagerListener(const css::uno::Reference< css::document::XUndoManagerListener > &i_listener) override
virtual void SAL_CALL lock() override
virtual void SAL_CALL leaveUndoContext() override
virtual sal_Bool SAL_CALL isRedoPossible() override
virtual css::uno::Sequence< OUString > SAL_CALL getAllRedoActionTitles() override
virtual OUString SAL_CALL getCurrentUndoActionTitle() override
virtual void SAL_CALL reset() override
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent() override
virtual void SAL_CALL enterHiddenUndoContext() override
UndoManager(::cppu::OWeakObject &i_parent, ::osl::Mutex &i_mutex)
virtual void SAL_CALL acquire() noexcept override
virtual void SAL_CALL undo() override
virtual sal_Bool SAL_CALL isLocked() override
virtual sal_Bool SAL_CALL isUndoPossible() override
virtual void SAL_CALL clearRedo() override
virtual void SAL_CALL release() noexcept override
virtual void SAL_CALL unlock() override
virtual OUString SAL_CALL getCurrentRedoActionTitle() override
std::unique_ptr< UndoManager_Impl > m_xImpl
OslMutexFacade m_aMutexFacade
osl::ClearableMutexGuard m_aGuard
::framework::UndoManagerHelper aUndoHelper
SfxUndoManager aUndoManager
::cppu::OWeakObject & rParent
virtual Reference< XUndoManager > getThis() override
virtual ~UndoManager_Impl()
UndoManager_Impl(UndoManager &i_antiImpl, ::cppu::OWeakObject &i_parent, ::osl::Mutex &i_mutex)
virtual SfxUndoManager & getImplUndoManager() override