LibreOffice Module sw (master) 1
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
sw::UndoManager Class Referencefinal

Stores the undo/redo information, implementing the IDocumentUndoRedo interface. More...

#include <UndoManager.hxx>

Inheritance diagram for sw::UndoManager:
[legend]
Collaboration diagram for sw::UndoManager:
[legend]

Public Member Functions

 UndoManager (std::shared_ptr< SwNodes > pUndoNodes, IDocumentDrawModelAccess &rDrawModelAccess, IDocumentRedlineAccess &rRedlineAccess, IDocumentState &rState)
 
virtual void DoUndo (bool const bDoUndo) override
 IDocumentUndoRedo. More...
 
virtual bool DoesUndo () const override
 
virtual void DoGroupUndo (bool const bDoUndo) override
 
virtual bool DoesGroupUndo () const override
 
virtual void DoDrawUndo (bool const bDoUndo) override
 
virtual bool DoesDrawUndo () const override
 
void DoRepair (bool bRepair) override
 
bool DoesRepair () const override
 
virtual void SetUndoNoModifiedPosition () override
 
virtual void LockUndoNoModifiedPosition () override
 
virtual void UnLockUndoNoModifiedPosition () override
 
virtual void SetUndoNoResetModified () override
 
virtual bool IsUndoNoResetModified () const override
 
virtual SwUndoId StartUndo (SwUndoId const eUndoId, SwRewriter const *const pRewriter) override
 
virtual SwUndoId EndUndo (SwUndoId const eUndoId, SwRewriter const *const pRewriter) override
 
virtual void DelAllUndoObj () override
 
virtual bool GetLastUndoInfo (OUString *const o_pStr, SwUndoId *const o_pId, const SwView *pView=nullptr) const override
 
virtual SwUndoComments_t GetUndoComments () const override
 
virtual bool GetFirstRedoInfo (OUString *const o_pStr, SwUndoId *const o_pId, const SwView *pView=nullptr) const override
 
virtual SwUndoComments_t GetRedoComments () const override
 
virtual bool Repeat (::sw::RepeatContext &rContext, sal_uInt16 const nRepeatCnt) override
 N.B. More...
 
virtual SwUndoId GetRepeatInfo (OUString *const o_pStr) const override
 
virtual void AppendUndo (std::unique_ptr< SwUndo > pUndo) override
 
virtual void ClearRedo () override
 
virtual bool IsUndoNodes (SwNodes const &rNodes) const override
 
virtual size_t GetUndoActionCount (const bool bCurrentLevel=true) const override
 
size_t GetRedoActionCount (const bool bCurrentLevel=true) const override
 
void SetView (SwView *pView) override
 
bool UndoWithOffset (size_t nUndoOffset) override
 
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
 
SwUndoRemoveLastUndo ()
 
SwUndoGetLastUndo ()
 
SwNodes const & GetUndoNodes () const
 
SwNodesGetUndoNodes ()
 
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...
 
- Public Member Functions inherited from SdrUndoManager
 SdrUndoManager ()
 
virtual ~SdrUndoManager () override
 
virtual bool Undo () override
 
virtual bool Redo () 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 class  UndoOrRedoType {
  Undo ,
  Redo
}
 

Private Member Functions

virtual void EmptyActionsChanged () override
 
bool impl_DoUndoRedo (UndoOrRedoType undoOrRedo, size_t nUndoOffset)
 

Private Attributes

IDocumentDrawModelAccessm_rDrawModelAccess
 
IDocumentRedlineAccessm_rRedlineAccess
 
IDocumentStatem_rState
 
std::shared_ptr< SwNodesm_xUndoNodes
 Undo nodes array: content not currently in document, but required for undo/redo. 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...
 
SwDocShellm_pDocShell
 
SwViewm_pView
 

Additional Inherited Members

- Protected Member Functions inherited from SdrUndoManager
bool isTextEditActive () const
 
virtual void EmptyActionsChanged () override
 

Detailed Description

Stores the undo/redo information, implementing the IDocumentUndoRedo interface.

It contains a stack of SwUndo actions, each of which represents one user-visible undo / redo step.

Definition at line 41 of file UndoManager.hxx.

Member Enumeration Documentation

◆ UndoOrRedoType

enum class sw::UndoManager::UndoOrRedoType
strongprivate
Enumerator
Undo 
Redo 

Definition at line 132 of file UndoManager.hxx.

Constructor & Destructor Documentation

◆ UndoManager()

sw::UndoManager::UndoManager ( std::shared_ptr< SwNodes pUndoNodes,
IDocumentDrawModelAccess rDrawModelAccess,
IDocumentRedlineAccess rRedlineAccess,
IDocumentState rState 
)

Definition at line 56 of file docundo.cxx.

References m_xUndoNodes, and MARK_INVALID.

Member Function Documentation

◆ AddUndoAction()

void sw::UndoManager::AddUndoAction ( std::unique_ptr< SfxUndoAction pAction,
bool  bTryMerg = false 
)
overridevirtual

◆ AppendUndo()

void sw::UndoManager::AppendUndo ( std::unique_ptr< SwUndo pUndo)
overridevirtual

Definition at line 250 of file docundo.cxx.

References AddUndoAction().

◆ ClearRedo()

void sw::UndoManager::ClearRedo ( )
overridevirtual

Definition at line 255 of file docundo.cxx.

◆ DelAllUndoObj()

void sw::UndoManager::DelAllUndoObj ( )
overridevirtual

Definition at line 260 of file docundo.cxx.

References m_UndoSaveMark, and MARK_INVALID.

◆ DoDrawUndo()

void sw::UndoManager::DoDrawUndo ( bool const  bDoUndo)
overridevirtual

Definition at line 188 of file docundo.cxx.

References m_bDrawUndo.

◆ DoesDrawUndo()

bool sw::UndoManager::DoesDrawUndo ( ) const
overridevirtual

Definition at line 193 of file docundo.cxx.

References m_bDrawUndo.

◆ DoesGroupUndo()

bool sw::UndoManager::DoesGroupUndo ( ) const
overridevirtual

Definition at line 183 of file docundo.cxx.

References m_bGroupUndo.

◆ DoesRepair()

bool sw::UndoManager::DoesRepair ( ) const
override

Definition at line 203 of file docundo.cxx.

References m_bRepair.

◆ DoesUndo()

bool sw::UndoManager::DoesUndo ( ) const
overridevirtual

Definition at line 166 of file docundo.cxx.

References SdrUndoManager::isTextEditActive().

Referenced by Repeat().

◆ DoGroupUndo()

void sw::UndoManager::DoGroupUndo ( bool const  bDoUndo)
overridevirtual

Definition at line 178 of file docundo.cxx.

References m_bGroupUndo.

◆ DoRepair()

void sw::UndoManager::DoRepair ( bool  bRepair)
override

Definition at line 198 of file docundo.cxx.

References m_bRepair.

◆ DoUndo()

void sw::UndoManager::DoUndo ( bool const  bDoUndo)
overridevirtual

◆ dumpAsXml()

void sw::UndoManager::dumpAsXml ( xmlTextWriterPtr  pWriter) const

Definition at line 751 of file docundo.cxx.

References m_xUndoNodes.

◆ EmptyActionsChanged()

void sw::UndoManager::EmptyActionsChanged ( )
overrideprivatevirtual

Reimplemented from SdrUndoManager.

Definition at line 763 of file docundo.cxx.

References m_pDocShell.

◆ EndUndo()

SwUndoId sw::UndoManager::EndUndo ( SwUndoId const  eUndoId,
SwRewriter const *const  pRewriter 
)
overridevirtual

◆ GetFirstRedoInfo()

bool sw::UndoManager::GetFirstRedoInfo ( OUString *const  o_pStr,
SwUndoId *const  o_pId,
const SwView pView = nullptr 
) const
overridevirtual

◆ GetLastUndo()

SwUndo * sw::UndoManager::GetLastUndo ( )

◆ GetLastUndoInfo()

bool sw::UndoManager::GetLastUndoInfo ( OUString *const  o_pStr,
SwUndoId *const  o_pId,
const SwView pView = nullptr 
) const
overridevirtual

◆ GetRedoActionCount()

size_t sw::UndoManager::GetRedoActionCount ( const bool  bCurrentLevel = true) const
override

◆ GetRedoComments()

SwUndoComments_t sw::UndoManager::GetRedoComments ( ) const
overridevirtual

Definition at line 551 of file docundo.cxx.

References n.

◆ GetRepeatInfo()

SwUndoId sw::UndoManager::GetRepeatInfo ( OUString *const  o_pStr) const
overridevirtual

Definition at line 568 of file docundo.cxx.

References EMPTY, and GetLastUndoInfo().

◆ GetUndoActionCount()

size_t sw::UndoManager::GetUndoActionCount ( const bool  bCurrentLevel = true) const
overridevirtual

◆ GetUndoComments()

SwUndoComments_t sw::UndoManager::GetUndoComments ( ) const
overridevirtual

Definition at line 488 of file docundo.cxx.

References n.

◆ GetUndoNodes() [1/2]

SwNodes & sw::UndoManager::GetUndoNodes ( )

Definition at line 84 of file docundo.cxx.

References m_xUndoNodes.

◆ GetUndoNodes() [2/2]

SwNodes const & sw::UndoManager::GetUndoNodes ( ) const

◆ impl_DoUndoRedo()

bool sw::UndoManager::impl_DoUndoRedo ( UndoOrRedoType  undoOrRedo,
size_t  nUndoOffset 
)
private

◆ IsUndoNodes()

bool sw::UndoManager::IsUndoNodes ( SwNodes const &  rNodes) const
overridevirtual

Definition at line 89 of file docundo.cxx.

References m_xUndoNodes.

◆ IsUndoNoResetModified()

bool sw::UndoManager::IsUndoNoResetModified ( ) const
overridevirtual

Definition at line 208 of file docundo.cxx.

References m_UndoSaveMark, and MARK_INVALID.

◆ IsViewUndoActionIndependent()

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 364 of file docundo.cxx.

References GetRedoActionCount(), GetUndoActionCount(), SfxUndoAction::GetViewShellId(), SfxViewShell::GetViewShellId(), i, and TYPING.

Referenced by SwBaseShell::ExecUndo(), and GetLastUndoInfo().

◆ LockUndoNoModifiedPosition()

void sw::UndoManager::LockUndoNoModifiedPosition ( )
overridevirtual

Definition at line 230 of file docundo.cxx.

References m_bLockUndoNoModifiedPosition.

◆ Redo()

bool sw::UndoManager::Redo ( )
overridevirtual

Reimplemented from SdrUndoManager.

Definition at line 739 of file docundo.cxx.

References impl_DoUndoRedo(), SdrUndoManager::isTextEditActive(), SdrUndoManager::Redo(), and Redo.

◆ RemoveLastUndo()

SwUndo * sw::UndoManager::RemoveLastUndo ( )

Definition at line 583 of file docundo.cxx.

Referenced by SwDoc::MergeTable().

◆ Repeat()

bool sw::UndoManager::Repeat ( ::sw::RepeatContext rContext,
sal_uInt16 const  nRepeatCount 
)
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!

Definition at line 776 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().

◆ SetDocShell()

void sw::UndoManager::SetDocShell ( SwDocShell pDocShell)

Definition at line 94 of file docundo.cxx.

References m_pDocShell.

Referenced by SwDoc::SetDocShell().

◆ SetUndoNoModifiedPosition()

void sw::UndoManager::SetUndoNoModifiedPosition ( )
overridevirtual

Definition at line 222 of file docundo.cxx.

References m_bLockUndoNoModifiedPosition, and m_UndoSaveMark.

◆ SetUndoNoResetModified()

void sw::UndoManager::SetUndoNoResetModified ( )
overridevirtual

Definition at line 213 of file docundo.cxx.

References m_UndoSaveMark, and MARK_INVALID.

◆ SetView()

void sw::UndoManager::SetView ( SwView pView)
override

Definition at line 99 of file docundo.cxx.

References m_pView.

◆ StartUndo()

SwUndoId sw::UndoManager::StartUndo ( SwUndoId const  eUndoId,
SwRewriter const *const  pRewriter 
)
overridevirtual

◆ Undo()

bool sw::UndoManager::Undo ( )
overridevirtual

Reimplemented from SdrUndoManager.

Definition at line 725 of file docundo.cxx.

References UndoWithOffset().

◆ UndoWithOffset()

bool sw::UndoManager::UndoWithOffset ( size_t  nUndoOffset)
override

Definition at line 727 of file docundo.cxx.

References impl_DoUndoRedo(), SdrUndoManager::isTextEditActive(), SdrUndoManager::Undo(), and Undo.

Referenced by Undo().

◆ UnLockUndoNoModifiedPosition()

void sw::UndoManager::UnLockUndoNoModifiedPosition ( )
overridevirtual

Definition at line 235 of file docundo.cxx.

References m_bLockUndoNoModifiedPosition.

Member Data Documentation

◆ m_bDrawUndo

bool sw::UndoManager::m_bDrawUndo
private

Definition at line 121 of file UndoManager.hxx.

Referenced by DoDrawUndo(), and DoesDrawUndo().

◆ m_bGroupUndo

bool sw::UndoManager::m_bGroupUndo
private

Definition at line 120 of file UndoManager.hxx.

Referenced by DoesGroupUndo(), and DoGroupUndo().

◆ m_bLockUndoNoModifiedPosition

bool sw::UndoManager::m_bLockUndoNoModifiedPosition
private

◆ m_bRepair

bool sw::UndoManager::m_bRepair
private

If true, then repair mode is enabled.

Definition at line 123 of file UndoManager.hxx.

Referenced by DoesRepair(), DoRepair(), GetFirstRedoInfo(), GetLastUndoInfo(), GetRedoActionCount(), and GetUndoActionCount().

◆ m_isAddWithIgnoreRepeat

bool sw::UndoManager::m_isAddWithIgnoreRepeat
private

set the IgnoreRepeat flag on every added action

Definition at line 126 of file UndoManager.hxx.

Referenced by AddUndoAction(), and Repeat().

◆ m_pDocShell

SwDocShell* sw::UndoManager::m_pDocShell
private

◆ m_pView

SwView* sw::UndoManager::m_pView
private

Definition at line 130 of file UndoManager.hxx.

Referenced by GetRedoActionCount(), GetUndoActionCount(), and SetView().

◆ m_rDrawModelAccess

IDocumentDrawModelAccess& sw::UndoManager::m_rDrawModelAccess
private

Definition at line 113 of file UndoManager.hxx.

Referenced by DoUndo().

◆ m_rRedlineAccess

IDocumentRedlineAccess& sw::UndoManager::m_rRedlineAccess
private

Definition at line 114 of file UndoManager.hxx.

Referenced by AddUndoAction().

◆ m_rState

IDocumentState& sw::UndoManager::m_rState
private

Definition at line 115 of file UndoManager.hxx.

Referenced by impl_DoUndoRedo().

◆ m_UndoSaveMark

UndoStackMark sw::UndoManager::m_UndoSaveMark
private

position in Undo-Array at which Doc was saved (and is not modified)

Definition at line 128 of file UndoManager.hxx.

Referenced by DelAllUndoObj(), impl_DoUndoRedo(), IsUndoNoResetModified(), SetUndoNoModifiedPosition(), and SetUndoNoResetModified().

◆ m_xUndoNodes

std::shared_ptr<SwNodes> sw::UndoManager::m_xUndoNodes
private

Undo nodes array: content not currently in document, but required for undo/redo.

Definition at line 118 of file UndoManager.hxx.

Referenced by dumpAsXml(), GetUndoNodes(), IsUndoNodes(), and UndoManager().


The documentation for this class was generated from the following files: