4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Asger Alstrup
8 * \author Lars Gullik Bjønnes
10 * \author André Pönitz
11 * \author Jürgen Vigna
12 * \author Abdelrazak Younes
14 * Full author contact details are available in file CREDITS.
20 #include "support/types.h"
31 /// This is used to combine consecutive undo recordings of the same kind.
34 * Insert something - these will combine to one big chunk
35 * when many inserts come after each other.
39 * Delete something - these will combine to one big chunk
40 * when many deletes come after each other.
43 /// Atomic - each of these will have its own entry in the stack
56 /// this will undo the last action - returns false if no undo possible
57 bool textUndo(DocIterator &);
59 /// this will redo the last undo - returns false if no redo possible
60 bool textRedo(DocIterator &);
62 /// End a sequence of INSERT_UNDO or DELETE_UNDO type of undo
63 /// operations (grouping of consecutive characters insertion/deletion).
67 bool hasUndoStack() const;
69 bool hasRedoStack() const;
71 /// Mark all the elements of the undo and redo stacks as dirty
74 /// open a new group of undo operations.
76 * Groups can be nested. Such a nested group e.g. { {} {} } is undone in
77 * a single step. This means you can add a group whenever you are not sure.
79 void beginUndoGroup();
81 /// end the current undo group.
84 /// The general case: record undo information for an arbitrary range.
86 * Record undo information - call with the current cursor and
87 * the 'other end' of the range of changed paragraphs. So we
88 * give an inclusive range. This is called before you make the
89 * changes to the paragraph, and it will record the original
90 * information of the paragraphs in the undo stack.
92 void recordUndo(DocIterator const & cur, UndoKind kind,
93 pit_type from, pit_type to);
95 /// Convenience: record undo information for the range between
96 /// 'from' and cursor.
97 void recordUndo(DocIterator const & cur, UndoKind kind, pit_type from);
99 /// Convenience: record undo information for the single
100 /// paragraph or cell containing the cursor.
101 void recordUndo(DocIterator const & cur, UndoKind kind = ATOMIC_UNDO);
103 /// Convenience: record undo information for the inset
104 /// containing the cursor.
105 void recordUndoInset(DocIterator const & cur,
106 UndoKind kind = ATOMIC_UNDO,
107 Inset const * inset = 0);
109 /// Convenience: prepare undo for the whole buffer
110 void recordUndoFullDocument(DocIterator const & cur);