LibreOffice Module sw (master)
1
|
#include <UndoManager.hxx>
Public Member Functions | |
UndoManager (std::shared_ptr< SwNodes > const &pUndoNodes, IDocumentDrawModelAccess &rDrawModelAccess, IDocumentRedlineAccess &rRedlineAccess, IDocumentState &rState) | |
virtual void | DoUndo (bool const bDoUndo) override |
IDocumentUndoRedo. More... | |
virtual bool | DoesUndo () const override |
Is Undo enabled? More... | |
virtual void | DoGroupUndo (bool const bDoUndo) override |
Enable/Disable Group Undo. More... | |
virtual bool | DoesGroupUndo () const override |
Is Group Undo enabled? More... | |
virtual void | DoDrawUndo (bool const bDoUndo) override |
Enable/Disable Undo for Drawing objects. More... | |
virtual bool | DoesDrawUndo () const override |
Is Undo for Drawing objects enabled? for Draw-Undo: writer wants to handle actions on Flys on its own. More... | |
void | DoRepair (bool bRepair) override |
Enable repair mode. More... | |
bool | DoesRepair () const override |
Is repair mode active? More... | |
virtual void | SetUndoNoModifiedPosition () override |
Set the position at which the document is in the "unmodified" state to the current position in the Undo stack. More... | |
virtual void | LockUndoNoModifiedPosition () override |
Prevent updates to the "unmodified" state position via SetUndoNoResetModified(). More... | |
virtual void | UnLockUndoNoModifiedPosition () override |
Allow updates to the "unmodified" state position via SetUndoNoResetModified(). More... | |
virtual void | SetUndoNoResetModified () override |
Disable (re)setting the document modified flag on Undo/Redo. More... | |
virtual bool | IsUndoNoResetModified () const override |
Is setting the document modified flag on Undo/Redo disabled? More... | |
virtual SwUndoId | StartUndo (SwUndoId const eUndoId, SwRewriter const *const pRewriter) override |
Opens undo block. More... | |
virtual SwUndoId | EndUndo (SwUndoId const eUndoId, SwRewriter const *const pRewriter) override |
Closes undo block. More... | |
virtual void | DelAllUndoObj () override |
Delete all Undo actions. More... | |
virtual bool | GetLastUndoInfo (OUString *const o_pStr, SwUndoId *const o_pId, const SwView *pView=nullptr) const override |
Get Id and comment of last Undo action. More... | |
virtual SwUndoComments_t | GetUndoComments () const override |
Get comments of Undo actions. More... | |
virtual bool | GetFirstRedoInfo (OUString *const o_pStr, SwUndoId *const o_pId, const SwView *pView=nullptr) const override |
Get Id and comment of first Redo action. More... | |
virtual SwUndoComments_t | GetRedoComments () const override |
Get comments of Redo actions. More... | |
virtual bool | Repeat (::sw::RepeatContext &rContext, sal_uInt16 const nRepeatCnt) override |
N.B. More... | |
virtual SwUndoId | GetRepeatInfo (OUString *const o_pStr) const override |
Get Id and comment of last Undo action, if it is Repeat capable. More... | |
virtual void | AppendUndo (std::unique_ptr< SwUndo > pUndo) override |
Add new Undo action. More... | |
virtual void | ClearRedo () override |
Delete all Redo actions. More... | |
virtual bool | IsUndoNodes (SwNodes const &rNodes) const override |
virtual size_t | GetUndoActionCount (const bool bCurrentLevel=true) const override |
Get the number of Undo actions. More... | |
size_t | GetRedoActionCount (const bool bCurrentLevel=true) const override |
void | SetView (SwView *pView) override |
Return undo/redo info for this view. More... | |
bool | UndoWithOffset (size_t nUndoOffset) override |
Zero offset means undoing the top undo action. More... | |
virtual void | AddUndoAction (std::unique_ptr< SfxUndoAction > pAction, bool bTryMerg=false) override |
virtual bool | Undo () override |
virtual bool | Redo () override |
void | dumpAsXml (xmlTextWriterPtr pWriter) const |
SwUndo * | RemoveLastUndo () |
SwUndo * | GetLastUndo () |
SwNodes const & | GetUndoNodes () const |
SwNodes & | GetUndoNodes () |
void | SetDocShell (SwDocShell *pDocShell) |
bool | IsViewUndoActionIndependent (const SwView *pView, sal_uInt16 &rOffset) const |
Checks if the topmost undo action owned by pView is independent from the topmost action undo action. More... | |
![]() | |
SdrUndoManager () | |
virtual | ~SdrUndoManager () override |
virtual void | Clear () override |
void | SetEndTextEditHdl (const Link< SdrUndoManager *, void > &rLink) |
bool | isEndTextEditTriggeredFromUndo () const |
void | SetDocShell (SfxObjectShell *pDocShell) |
size_t | GetRedoActionCountBeforeTextEdit () const |
Private Types | |
enum | UndoOrRedoType { UndoOrRedoType::Undo, UndoOrRedoType::Redo } |
Private Member Functions | |
virtual void | EmptyActionsChanged () override |
bool | impl_DoUndoRedo (UndoOrRedoType undoOrRedo, size_t nUndoOffset) |
Private Attributes | |
IDocumentDrawModelAccess & | m_rDrawModelAccess |
IDocumentRedlineAccess & | m_rRedlineAccess |
IDocumentState & | m_rState |
std::shared_ptr< SwNodes > | m_xUndoNodes |
Undo nodes array: content not currently in document. More... | |
bool | m_bGroupUndo: 1 |
bool | m_bDrawUndo: 1 |
bool | m_bRepair |
If true, then repair mode is enabled. More... | |
bool | m_bLockUndoNoModifiedPosition: 1 |
bool | m_isAddWithIgnoreRepeat |
set the IgnoreRepeat flag on every added action More... | |
UndoStackMark | m_UndoSaveMark |
position in Undo-Array at which Doc was saved (and is not modified) More... | |
SwDocShell * | m_pDocShell |
SwView * | m_pView |
Additional Inherited Members | |
![]() | |
virtual | ~IDocumentUndoRedo () |
![]() | |
bool | isTextEditActive () const |
Definition at line 36 of file UndoManager.hxx.
|
strongprivate |
Enumerator | |
---|---|
Undo | |
Redo |
Definition at line 127 of file UndoManager.hxx.
sw::UndoManager::UndoManager | ( | std::shared_ptr< SwNodes > const & | pUndoNodes, |
IDocumentDrawModelAccess & | rDrawModelAccess, | ||
IDocumentRedlineAccess & | rRedlineAccess, | ||
IDocumentState & | rState | ||
) |
Definition at line 54 of file docundo.cxx.
References false, m_xUndoNodes, and MARK_INVALID.
|
overridevirtual |
Definition at line 601 of file docundo.cxx.
References Count, SfxViewFrame::GetBindings(), SfxViewFrame::GetFirst(), SfxViewFrame::GetNext(), IDocumentRedlineAccess::GetRedlineFlags(), SwUndo::GetRedlineFlags(), GetUndoNodes(), SwUndo::IgnoreRepeat(), SfxBindings::Invalidate(), m_isAddWithIgnoreRepeat, m_pDocShell, m_rRedlineAccess, NONE, SwUndo::SetRedlineFlags(), and UNDO_ACTION_LIMIT.
Referenced by AppendUndo().
Add new Undo action.
Takes over ownership of pUndo.
Implements IDocumentUndoRedo.
Definition at line 248 of file docundo.cxx.
References AddUndoAction().
|
overridevirtual |
|
overridevirtual |
Delete all Undo actions.
Of course Undo will be disabled during deletion.
Implements IDocumentUndoRedo.
Definition at line 258 of file docundo.cxx.
References m_UndoSaveMark, and MARK_INVALID.
|
overridevirtual |
Enable/Disable Undo for Drawing objects.
Implements IDocumentUndoRedo.
Definition at line 186 of file docundo.cxx.
References m_bDrawUndo.
|
overridevirtual |
Is Undo for Drawing objects enabled? for Draw-Undo: writer wants to handle actions on Flys on its own.
Implements IDocumentUndoRedo.
Definition at line 191 of file docundo.cxx.
References m_bDrawUndo.
|
overridevirtual |
Is Group Undo enabled?
Implements IDocumentUndoRedo.
Definition at line 181 of file docundo.cxx.
References m_bGroupUndo.
|
overridevirtual |
Is repair mode active?
Implements IDocumentUndoRedo.
Definition at line 201 of file docundo.cxx.
References m_bRepair.
|
overridevirtual |
Is Undo enabled?
Implements IDocumentUndoRedo.
Definition at line 164 of file docundo.cxx.
References SdrUndoManager::isTextEditActive().
Referenced by Repeat().
|
overridevirtual |
Enable/Disable Group Undo.
This determines whether successive Insert/Delete/Overwrite actions are combined.
Implements IDocumentUndoRedo.
Definition at line 176 of file docundo.cxx.
References m_bGroupUndo.
|
overridevirtual |
Enable repair mode.
Implements IDocumentUndoRedo.
Definition at line 196 of file docundo.cxx.
References m_bRepair.
|
overridevirtual |
Implements IDocumentUndoRedo.
Definition at line 150 of file docundo.cxx.
References SdrModel::EnableUndo(), IDocumentDrawModelAccess::GetDrawModel(), SdrUndoManager::isTextEditActive(), and m_rDrawModelAccess.
void sw::UndoManager::dumpAsXml | ( | xmlTextWriterPtr | pWriter | ) | const |
Definition at line 747 of file docundo.cxx.
References m_xUndoNodes, and void().
|
overrideprivatevirtual |
Reimplemented from SdrUndoManager.
Definition at line 759 of file docundo.cxx.
References m_pDocShell.
|
overridevirtual |
Closes undo block.
nUndoId | undo ID for the list action |
pRewriter | rewriter for comments |
If the given nUndoId is not SwUndoId::EMPTY or SwUndoId::END, the comment of the resulting list action will be set via the nUndoId, applying the given pRewriter (if not 0). Otherwise the comment of the resulting list action is unchanged if it has an UndoId that is not SwUndoId::START set by StartUndo, and in case the UndoId is SwUndoId::START the comment of the list action defaults to the comment of the last action contained in the list action.
Implements IDocumentUndoRedo.
Definition at line 300 of file docundo.cxx.
References SwRewriter::Apply(), EMPTY, END, SfxUndoAction::GetComment(), GetUndoComment(), nCount, and START.
|
overridevirtual |
Get Id and comment of first Redo action.
o_pStr | if not 0, receives comment of first Redo action. |
o_pId | if not 0, receives Id of first Redo action. |
pView | if not nullptr, get the info for this view |
Implements IDocumentUndoRedo.
Definition at line 503 of file docundo.cxx.
References CONFLICT, EMPTY, SfxUndoAction::GetComment(), SwDocShell::GetView(), SfxViewShell::GetViewShellId(), SfxUndoAction::GetViewShellId(), comphelper::LibreOfficeKit::isActive(), m_bRepair, and m_pDocShell.
SwUndo * sw::UndoManager::GetLastUndo | ( | ) |
Definition at line 238 of file docundo.cxx.
Referenced by sw::DocumentContentOperationsManager::DeleteAndJoinWithRedlineImpl(), sw::DocumentContentOperationsManager::DeleteRangeImplImpl(), sw::DocumentContentOperationsManager::InsertString(), sw::DocumentContentOperationsManager::Overwrite(), and SwDoc::UpdateRsid().
|
overridevirtual |
Get Id and comment of last Undo action.
o_pStr | if not 0, receives comment of last Undo action. |
o_pId | if not 0, receives Id of last Undo action. |
pView | if not nullptr, get the info for this view |
Implements IDocumentUndoRedo.
Definition at line 441 of file docundo.cxx.
References CONFLICT, EMPTY, SfxUndoAction::GetComment(), SwDocShell::GetView(), SfxViewShell::GetViewShellId(), SfxUndoAction::GetViewShellId(), comphelper::LibreOfficeKit::isActive(), IsViewUndoActionIndependent(), m_bRepair, m_pDocShell, and o3tl::temporary().
Referenced by GetRepeatInfo().
|
override |
Definition at line 126 of file docundo.cxx.
References SfxViewShell::GetViewShellId(), SfxUndoAction::GetViewShellId(), comphelper::LibreOfficeKit::isActive(), m_bRepair, and m_pView.
Referenced by IsViewUndoActionIndependent().
|
overridevirtual |
Get comments of Redo actions.
Implements IDocumentUndoRedo.
Definition at line 549 of file docundo.cxx.
References n.
|
overridevirtual |
Get Id and comment of last Undo action, if it is Repeat capable.
o_pStr | if not 0, receives comment of last Undo action if it is Repeat capable. |
Implements IDocumentUndoRedo.
Definition at line 566 of file docundo.cxx.
References EMPTY, and GetLastUndoInfo().
|
overridevirtual |
Get the number of Undo actions.
Implements IDocumentUndoRedo.
Definition at line 102 of file docundo.cxx.
References SfxViewShell::GetViewShellId(), SfxUndoAction::GetViewShellId(), comphelper::LibreOfficeKit::isActive(), m_bRepair, and m_pView.
Referenced by IsViewUndoActionIndependent().
|
overridevirtual |
Get comments of Undo actions.
Implements IDocumentUndoRedo.
Definition at line 486 of file docundo.cxx.
References n.
SwNodes const & sw::UndoManager::GetUndoNodes | ( | ) | const |
Definition at line 77 of file docundo.cxx.
References m_xUndoNodes.
Referenced by AddUndoAction(), impl_DoUndoRedo(), SwUndoSaveContent::MoveFromUndoNds(), SwUndoSaveContent::MoveToUndoNds(), SwUndoDelete::SwUndoDelete(), and SwUndoDelete::UndoImpl().
SwNodes & sw::UndoManager::GetUndoNodes | ( | ) |
Definition at line 82 of file docundo.cxx.
References m_xUndoNodes.
|
private |
Definition at line 662 of file docundo.cxx.
References SwDoc::GetEditShell(), GetUndoNodes(), m_rState, m_UndoSaveMark, IDocumentState::ResetModified(), IDocumentState::SetModified(), sw::UndoRedoContext::SetUndoOffset(), and Undo.
Referenced by Redo(), and UndoWithOffset().
|
overridevirtual |
|
overridevirtual |
Is setting the document modified flag on Undo/Redo disabled?
Implements IDocumentUndoRedo.
Definition at line 206 of file docundo.cxx.
References m_UndoSaveMark, and MARK_INVALID.
bool sw::UndoManager::IsViewUndoActionIndependent | ( | const SwView * | pView, |
sal_uInt16 & | rOffset | ||
) | const |
Checks if the topmost undo action owned by pView is independent from the topmost action undo action.
Sets rOffset to the offset of that independent undo action on success.
Definition at line 362 of file docundo.cxx.
References GetRedoActionCount(), GetUndoActionCount(), SfxViewShell::GetViewShellId(), SfxUndoAction::GetViewShellId(), i, and TYPING.
Referenced by SwBaseShell::ExecUndo(), and GetLastUndoInfo().
|
overridevirtual |
Prevent updates to the "unmodified" state position via SetUndoNoResetModified().
Implements IDocumentUndoRedo.
Definition at line 228 of file docundo.cxx.
References m_bLockUndoNoModifiedPosition.
|
overridevirtual |
Reimplemented from SdrUndoManager.
Definition at line 735 of file docundo.cxx.
References impl_DoUndoRedo(), SdrUndoManager::isTextEditActive(), SdrUndoManager::Redo(), and Redo.
SwUndo * sw::UndoManager::RemoveLastUndo | ( | ) |
Definition at line 581 of file docundo.cxx.
Referenced by SwDoc::MergeTable().
|
overridevirtual |
N.B.
: this does not call SdrUndoManager::Repeat because it is not possible to wrap a list action around it: calling EnterListAction here will cause SdrUndoManager::Repeat to repeat the list action!
Implements IDocumentUndoRedo.
Definition at line 772 of file docundo.cxx.
References SfxUndoAction::CanRepeat(), DoesUndo(), SfxUndoAction::GetComment(), SfxUndoAction::GetRepeatComment(), sw::RepeatContext::GetRepeatPaM(), sw::Ring< value_type >::GetRingContainer(), SwDocShell::GetView(), sw::RepeatContext::m_bDeleteRepeated, m_isAddWithIgnoreRepeat, sw::RepeatContext::m_pCurrentPaM, m_pDocShell, nId, and SfxUndoAction::Repeat().
void sw::UndoManager::SetDocShell | ( | SwDocShell * | pDocShell | ) |
Definition at line 92 of file docundo.cxx.
References m_pDocShell.
Referenced by SwDoc::SetDocShell().
|
overridevirtual |
Set the position at which the document is in the "unmodified" state to the current position in the Undo stack.
Implements IDocumentUndoRedo.
Definition at line 220 of file docundo.cxx.
References m_bLockUndoNoModifiedPosition, and m_UndoSaveMark.
|
overridevirtual |
Disable (re)setting the document modified flag on Undo/Redo.
Implements IDocumentUndoRedo.
Definition at line 211 of file docundo.cxx.
References m_UndoSaveMark, and MARK_INVALID.
Return undo/redo info for this view.
Implements IDocumentUndoRedo.
Definition at line 97 of file docundo.cxx.
References m_pView.
|
overridevirtual |
Opens undo block.
nUndoId | undo ID for the list action |
pRewriter | rewriter for comments |
If the given nUndoId is equal to zero an undo object with ID SwUndoId::START will be generated.
Implements IDocumentUndoRedo.
Definition at line 268 of file docundo.cxx.
References SwRewriter::Apply(), EMPTY, END, GetUndoComment(), SwDocShell::GetView(), m_pDocShell, and START.
|
overridevirtual |
Reimplemented from SdrUndoManager.
Definition at line 721 of file docundo.cxx.
References UndoWithOffset().
|
overridevirtual |
Zero offset means undoing the top undo action.
Implements IDocumentUndoRedo.
Definition at line 723 of file docundo.cxx.
References impl_DoUndoRedo(), SdrUndoManager::isTextEditActive(), SdrUndoManager::Undo(), and Undo.
Referenced by Undo().
|
overridevirtual |
Allow updates to the "unmodified" state position via SetUndoNoResetModified().
Implements IDocumentUndoRedo.
Definition at line 233 of file docundo.cxx.
References m_bLockUndoNoModifiedPosition.
|
private |
Definition at line 116 of file UndoManager.hxx.
Referenced by DoDrawUndo(), and DoesDrawUndo().
|
private |
Definition at line 115 of file UndoManager.hxx.
Referenced by DoesGroupUndo(), and DoGroupUndo().
|
private |
Definition at line 119 of file UndoManager.hxx.
Referenced by LockUndoNoModifiedPosition(), SetUndoNoModifiedPosition(), and UnLockUndoNoModifiedPosition().
|
private |
If true, then repair mode is enabled.
Definition at line 118 of file UndoManager.hxx.
Referenced by DoesRepair(), DoRepair(), GetFirstRedoInfo(), GetLastUndoInfo(), GetRedoActionCount(), and GetUndoActionCount().
|
private |
set the IgnoreRepeat flag on every added action
Definition at line 121 of file UndoManager.hxx.
Referenced by AddUndoAction(), and Repeat().
|
private |
Definition at line 124 of file UndoManager.hxx.
Referenced by AddUndoAction(), EmptyActionsChanged(), GetFirstRedoInfo(), GetLastUndoInfo(), Repeat(), SetDocShell(), and StartUndo().
|
private |
Definition at line 125 of file UndoManager.hxx.
Referenced by GetRedoActionCount(), GetUndoActionCount(), and SetView().
|
private |
Definition at line 108 of file UndoManager.hxx.
Referenced by DoUndo().
|
private |
Definition at line 109 of file UndoManager.hxx.
Referenced by AddUndoAction().
|
private |
Definition at line 110 of file UndoManager.hxx.
Referenced by impl_DoUndoRedo().
|
private |
position in Undo-Array at which Doc was saved (and is not modified)
Definition at line 123 of file UndoManager.hxx.
Referenced by DelAllUndoObj(), impl_DoUndoRedo(), IsUndoNoResetModified(), SetUndoNoModifiedPosition(), and SetUndoNoResetModified().
|
private |
Undo nodes array: content not currently in document.
Definition at line 113 of file UndoManager.hxx.
Referenced by dumpAsXml(), GetUndoNodes(), IsUndoNodes(), and UndoManager().