19#ifndef INCLUDED_SVL_UNDO_HXX
20#define INCLUDED_SVL_UNDO_HXX
23#include <rtl/ustring.hxx>
24#include <tools/datetime.hxx>
38 virtual ~SfxRepeatTarget() = 0;
65 virtual void Repeat(SfxRepeatTarget&);
66 virtual bool CanRepeat(SfxRepeatTarget&)
const;
70 virtual OUString GetComment()
const;
71 virtual OUString GetRepeatComment(SfxRepeatTarget&)
const;
88#define MARK_INVALID ::std::numeric_limits< UndoStackMark >::max()
93 ::std::vector< UndoStackMark >
aMarks;
108 nMaxUndoActions(nMax), nCurUndoAction(0), pFatherUndoArray(nullptr) {}
115 std::unique_ptr<SfxUndoAction>
Remove(
int idx);
116 void Remove(
size_t i_pos,
size_t i_count );
117 void Insert( std::unique_ptr<SfxUndoAction> i_action,
size_t i_pos );
139 const OUString &rComment,
const OUString& rRepeatComment, sal_uInt16 nId,
ViewShellId nViewShellId,
SfxUndoArray *pFather );
142 virtual void Undo()
override;
143 virtual void UndoWithContext(
SfxUndoContext& i_context )
override;
144 virtual void Redo()
override;
145 virtual void RedoWithContext(
SfxUndoContext& i_context )
override;
146 virtual void Repeat(SfxRepeatTarget&)
override;
147 virtual bool CanRepeat(SfxRepeatTarget&)
const override;
151 virtual OUString GetComment()
const override;
154 virtual OUString GetRepeatComment(SfxRepeatTarget&)
const override;
155 sal_uInt16
GetId()
const;
157 void SetComment(
const OUString& rComment);
184 class UndoManagerGuard;
191 std::unique_ptr< SfxUndoManager_Data >
194 static bool const CurrentLevel =
true;
195 static bool const TopLevel =
false;
200 void SetMaxUndoActionCount(
size_t nMaxUndoActionCount );
201 size_t GetMaxUndoActionCount()
const;
202 virtual void AddUndoAction( std::unique_ptr<SfxUndoAction> pAction,
bool bTryMerg=
false );
203 virtual size_t GetUndoActionCount(
bool const i_currentLevel = CurrentLevel )
const;
204 OUString GetUndoActionComment(
size_t nNo=0,
bool const i_currentLevel = CurrentLevel )
const;
207 OUString GetUndoActionsInfo()
const;
208 virtual size_t GetRedoActionCount(
bool const i_currentLevel = CurrentLevel )
const;
209 OUString GetRedoActionComment(
size_t nNo=0,
bool const i_currentLevel = CurrentLevel )
const;
212 OUString GetRedoActionsInfo()
const;
218 virtual void Clear();
222 virtual void ClearRedo();
233 bool IsDoing()
const;
234 size_t GetRepeatActionCount()
const;
235 OUString GetRepeatActionComment( SfxRepeatTarget &rTarget)
const;
236 bool Repeat( SfxRepeatTarget &rTarget );
237 bool CanRepeat( SfxRepeatTarget &rTarget )
const;
238 virtual void EnterListAction(
const OUString &rComment,
const OUString& rRepeatComment, sal_uInt16 nId,
ViewShellId nViewShellId);
243 size_t LeaveListAction();
260 size_t LeaveAndMergeListAction();
262 bool IsInListAction()
const;
264 size_t GetListActionDepth()
const;
266 void RemoveLastUndoAction();
275 void EnableUndo(
bool bEnable );
279 bool IsUndoEnabled()
const;
283 bool IsEmptyActions()
const;
301 void RemoveOldestUndoAction();
309 void ImplClearRedo_NoLock(
bool const i_currentLevel );
320 void ClearAllLevels();
321 virtual void EmptyActionsChanged();
329 size_t ImplGetRedoActionCount_Lock(
bool const i_currentLevel = CurrentLevel )
const;
330 bool ImplIsUndoEnabled_Lock()
const;
331 bool ImplIsInListAction_Lock()
const;
332 void ImplEnableUndo_Lock(
bool const i_enable );
336 void ImplCheckEmptyActions();
337 inline bool ImplIsEmptyActions()
const;
339 friend class ::svl::undo::impl::LockGuard;
do not make use of these implementation details, unless you really really have to!
std::unique_ptr< Impl > mpImpl
SfxUndoAction(const SfxUndoAction &)=delete
SfxUndoAction & operator=(const SfxUndoAction &)=delete
virtual size_t GetUndoOffset()
Don't undo the top undo action, but an earlier one.
is a callback interface for notifications about state changes of an SfxUndoManager
virtual void listActionEntered(const OUString &i_comment)=0
virtual void actionUndone(const OUString &i_actionComment)=0
virtual void actionRedone(const OUString &i_actionComment)=0
virtual void listActionLeft(const OUString &i_comment)=0
virtual void clearedRedo()=0
virtual void resetAll()=0
virtual void listActionCancelled()=0
virtual void undoActionAdded(const OUString &i_actionComment)=0
std::unique_ptr< SfxUndoManager_Data > m_xData
virtual void Insert(SotClipboardFormatId nFormat, const OUString &rFormatName) override
virtual sal_uInt32 GetId() const override
struct _xmlTextWriter * xmlTextWriterPtr
void Clear(EHistoryType eHistory)
DateTime GetDateTime(const css::util::DateTime &_rDT)
::std::vector< UndoStackMark > aMarks
MarkedUndoAction(std::unique_ptr< SfxUndoAction > p)
std::unique_ptr< SfxUndoAction > pAction
do not make use of these implementation details, unless you really really have to!
std::vector< MarkedUndoAction > maUndoActions
SfxUndoArray & operator=(SfxUndoArray const &)=delete
SfxUndoArray(SfxUndoArray const &)=delete
SfxUndoAction * GetUndoAction(size_t idx)
SfxUndoArray(size_t nMax=0)
SfxUndoArray * pFatherUndoArray
o3tl::strong_int< sal_Int32, struct ViewShellIdTag > ViewShellId
struct _xmlTextWriter * xmlTextWriterPtr
sal_Int32 UndoStackMark
is a mark on the Undo stack
o3tl::strong_int< int, struct ViewShellDocIdTag > ViewShellDocId
class SVL_DLLPUBLIC SAL_LOPLUGIN_ANNOTATE("crosscast") SfxRepeatTarget