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"
30 /// This is used to combine consecutive undo recordings of the same kind.
33 * Insert something - these will combine to one big chunk
34 * when many inserts come after each other.
38 * Delete something - these will combine to one big chunk
39 * when many deletes come after each other.
42 /// Atomic - each of these will have its own entry in the stack
48 * Record undo information - call with the current cursor and the 'other
49 * end' of the range of changed paragraphs. So we give an inclusive range.
50 * This is called before you make the changes to the paragraph, and it
51 * will record the original information of the paragraphs in the undo stack.
53 * FIXME: We need something to record undo in partial grids for mathed.
54 * Right now we use recordUndoInset if more than one cell is changed,
55 * but that puts the cursor in front of the inset after undo. We would need
57 * recordUndoGrid(DocIterator & cur, UndoKind kind, idx_type from, idx_type to);
58 * and store the cell information in class Undo.
68 /// this will undo the last action - returns false if no undo possible
69 bool textUndo(DocIterator &);
71 /// this will redo the last undo - returns false if no redo possible
72 bool textRedo(DocIterator &);
74 /// makes sure the next operation will be stored
78 bool hasUndoStack() const;
80 bool hasRedoStack() const;
82 /// The general case: prepare undo for an arbitrary range.
83 void recordUndo(DocIterator & cur, UndoKind kind,
84 pit_type from, pit_type to);
86 /// Convenience: prepare undo for the range between 'from' and cursor.
87 void recordUndo(DocIterator & cur, UndoKind kind, pit_type from);
89 /// Convenience: prepare undo for the single paragraph or cell
90 /// containing the cursor
91 void recordUndo(DocIterator & cur, UndoKind kind = ATOMIC_UNDO);
92 /// Convenience: prepare undo for the inset containing the cursor
93 void recordUndoInset(DocIterator & cur, UndoKind kind = ATOMIC_UNDO);
95 /// Convenience: prepare undo for the whole buffer
96 void recordUndoFullDocument(DocIterator & cur);