LibreOffice Module framework (master) 1
|
helper class for implementing an XUndoManager More...
#include <undomanagerhelper.hxx>
Public Member Functions | |
UndoManagerHelper (IUndoManagerImplementation &i_undoManagerImpl) | |
~UndoManagerHelper () | |
void | disposing () |
void | enterUndoContext (const OUString &i_title, IMutexGuard &i_instanceLock) |
void | enterHiddenUndoContext (IMutexGuard &i_instanceLock) |
void | leaveUndoContext (IMutexGuard &i_instanceLock) |
void | addUndoAction (const css::uno::Reference< css::document::XUndoAction > &i_action, IMutexGuard &i_instanceLock) |
void | undo (IMutexGuard &i_instanceLock) |
void | redo (IMutexGuard &i_instanceLock) |
bool | isUndoPossible () const |
bool | isRedoPossible () const |
OUString | getCurrentUndoActionTitle () const |
OUString | getCurrentRedoActionTitle () const |
css::uno::Sequence< OUString > | getAllUndoActionTitles () const |
css::uno::Sequence< OUString > | getAllRedoActionTitles () const |
void | clear (IMutexGuard &i_instanceLock) |
void | clearRedo (IMutexGuard &i_instanceLock) |
void | reset (IMutexGuard &i_instanceLock) |
void | addUndoManagerListener (const css::uno::Reference< css::document::XUndoManagerListener > &i_listener) |
void | removeUndoManagerListener (const css::uno::Reference< css::document::XUndoManagerListener > &i_listener) |
void | lock () |
void | unlock () |
bool | isLocked () |
void | addModifyListener (const css::uno::Reference< css::util::XModifyListener > &i_listener) |
void | removeModifyListener (const css::uno::Reference< css::util::XModifyListener > &i_listener) |
Private Attributes | |
std::unique_ptr< UndoManagerHelper_Impl > | m_xImpl |
helper class for implementing an XUndoManager
Several of the methods of the class take an IMutexGuard instance. It is assumed that this guard has a lock on its mutex at the moment the method is entered. The lock will be released before any notifications to the registered XUndoManagerListeners happen.
The following locking strategy is used for this mutex:
Any notifications to the registered XUndoManagerListeners are after the guard has been cleared. i.e. without the mutex being locked.
SfxUndoManager
implementation is made without the mutex being locked. Note that this implies that the SfxUndoManager
implementation must be thread-safe in itself (which is true for the default implementation, SfxUndoManager). The reason for the exception for SfxUndoManager::Undo and SfxUndoManager::Redo is that those are expected to modify the actual document which the UndoManager works for. And as long as our documents are not thread-safe, and as long as we do not re-fit all existing SfxUndoImplementations to not expect the dreaded SolarMutex being locked when they're called, the above behavior is a compromise between "how it should be" and "how it can realistically be".
Definition at line 113 of file undomanagerhelper.hxx.
framework::UndoManagerHelper::UndoManagerHelper | ( | IUndoManagerImplementation & | i_undoManagerImpl | ) |
Definition at line 884 of file undomanagerhelper.cxx.
framework::UndoManagerHelper::~UndoManagerHelper | ( | ) |
Definition at line 889 of file undomanagerhelper.cxx.
void framework::UndoManagerHelper::addModifyListener | ( | const css::uno::Reference< css::util::XModifyListener > & | i_listener | ) |
Definition at line 1080 of file undomanagerhelper.cxx.
References m_xImpl.
void framework::UndoManagerHelper::addUndoAction | ( | const css::uno::Reference< css::document::XUndoAction > & | i_action, |
IMutexGuard & | i_instanceLock | ||
) |
Definition at line 929 of file undomanagerhelper.cxx.
References m_xImpl.
void framework::UndoManagerHelper::addUndoManagerListener | ( | const css::uno::Reference< css::document::XUndoManagerListener > & | i_listener | ) |
Definition at line 1068 of file undomanagerhelper.cxx.
References m_xImpl.
void framework::UndoManagerHelper::clear | ( | IMutexGuard & | i_instanceLock | ) |
Definition at line 1033 of file undomanagerhelper.cxx.
References m_xImpl.
void framework::UndoManagerHelper::clearRedo | ( | IMutexGuard & | i_instanceLock | ) |
Definition at line 1038 of file undomanagerhelper.cxx.
References m_xImpl.
void framework::UndoManagerHelper::disposing | ( | ) |
Definition at line 893 of file undomanagerhelper.cxx.
References m_xImpl.
void framework::UndoManagerHelper::enterHiddenUndoContext | ( | IMutexGuard & | i_instanceLock | ) |
Definition at line 903 of file undomanagerhelper.cxx.
References m_xImpl.
void framework::UndoManagerHelper::enterUndoContext | ( | const OUString & | i_title, |
IMutexGuard & | i_instanceLock | ||
) |
Definition at line 898 of file undomanagerhelper.cxx.
References m_xImpl.
Sequence< OUString > framework::UndoManagerHelper::getAllRedoActionTitles | ( | ) | const |
Definition at line 1028 of file undomanagerhelper.cxx.
References m_xImpl.
Sequence< OUString > framework::UndoManagerHelper::getAllUndoActionTitles | ( | ) | const |
Definition at line 1023 of file undomanagerhelper.cxx.
References m_xImpl.
OUString framework::UndoManagerHelper::getCurrentRedoActionTitle | ( | ) | const |
Definition at line 1018 of file undomanagerhelper.cxx.
References m_xImpl.
OUString framework::UndoManagerHelper::getCurrentUndoActionTitle | ( | ) | const |
Definition at line 1013 of file undomanagerhelper.cxx.
References m_xImpl.
bool framework::UndoManagerHelper::isLocked | ( | ) |
Definition at line 1058 of file undomanagerhelper.cxx.
References SfxUndoManager::IsUndoEnabled(), and m_xImpl.
bool framework::UndoManagerHelper::isRedoPossible | ( | ) | const |
Definition at line 955 of file undomanagerhelper.cxx.
References SfxUndoManager::GetRedoActionCount(), SfxUndoManager::IsInListAction(), m_xImpl, and SfxUndoManager::TopLevel.
bool framework::UndoManagerHelper::isUndoPossible | ( | ) | const |
Definition at line 944 of file undomanagerhelper.cxx.
References SfxUndoManager::GetUndoActionCount(), SfxUndoManager::IsInListAction(), m_xImpl, and SfxUndoManager::TopLevel.
void framework::UndoManagerHelper::leaveUndoContext | ( | IMutexGuard & | i_instanceLock | ) |
Definition at line 908 of file undomanagerhelper.cxx.
References m_xImpl.
void framework::UndoManagerHelper::lock | ( | ) |
Definition at line 1048 of file undomanagerhelper.cxx.
References m_xImpl.
void framework::UndoManagerHelper::redo | ( | IMutexGuard & | i_instanceLock | ) |
Definition at line 939 of file undomanagerhelper.cxx.
References m_xImpl.
void framework::UndoManagerHelper::removeModifyListener | ( | const css::uno::Reference< css::util::XModifyListener > & | i_listener | ) |
Definition at line 1086 of file undomanagerhelper.cxx.
References m_xImpl.
void framework::UndoManagerHelper::removeUndoManagerListener | ( | const css::uno::Reference< css::document::XUndoManagerListener > & | i_listener | ) |
Definition at line 1074 of file undomanagerhelper.cxx.
References m_xImpl.
void framework::UndoManagerHelper::reset | ( | IMutexGuard & | i_instanceLock | ) |
Definition at line 1043 of file undomanagerhelper.cxx.
References m_xImpl.
void framework::UndoManagerHelper::undo | ( | IMutexGuard & | i_instanceLock | ) |
Definition at line 934 of file undomanagerhelper.cxx.
References m_xImpl.
void framework::UndoManagerHelper::unlock | ( | ) |
Definition at line 1053 of file undomanagerhelper.cxx.
References m_xImpl.
|
private |
Definition at line 153 of file undomanagerhelper.hxx.
Referenced by addModifyListener(), addUndoAction(), addUndoManagerListener(), clear(), clearRedo(), disposing(), enterHiddenUndoContext(), enterUndoContext(), getAllRedoActionTitles(), getAllUndoActionTitles(), getCurrentRedoActionTitle(), getCurrentUndoActionTitle(), isLocked(), isRedoPossible(), isUndoPossible(), leaveUndoContext(), lock(), redo(), removeModifyListener(), removeUndoManagerListener(), reset(), undo(), and unlock().