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
13 * Full author contact details are available in file CREDITS.
19 #include "ParagraphList_fwd.h"
20 #include "support/types.h"
27 * These are the elements put on the undo stack. Each object
28 * contains complete paragraphs and sufficient information
29 * to restore the state.
33 /// This is used to combine consecutive undo recordings of the same kind.
36 * Insert something - these will combine to one big chunk
37 * when many inserts come after each other.
41 * Delete something - these will combine to one big chunk
42 * when many deletes come after each other.
45 /// Atomic - each of these will have its own entry in the stack
50 Undo(undo_kind kind, int text, int index,
51 int first_par, int end_par, int cursor_par, int cursor_pos);
54 /// which kind of operation are we recording for?
56 /// hosting LyXText counted from buffer begin
58 /// cell in a tabular or similar
60 /// offset to the first paragraph in the paragraph list
62 /// offset to the last paragraph from the end of paragraph list
64 /// offset to the first paragraph in the paragraph list
66 /// the position of the cursor in the hosting paragraph
68 /// the contents of the paragraphs saved
73 /// this will undo the last action - returns false if no undo possible
74 bool textUndo(BufferView &);
76 /// this will redo the last undo - returns false if no redo possible
77 bool textRedo(BufferView &);
79 /// makes sure the next operation will be stored
82 /// whilst undo is frozen, all actions do not get added to the undo stack
90 * Record undo information - call with the current cursor and the 'other
91 * end' of the range of changed paragraphs. So we give an inclusive range.
92 * This is called before you make the changes to the paragraph, and it
93 * will record the original information of the paragraphs in the undo stack.
96 /// the common case: prepare undo for an arbitrary range
97 void recordUndo(LCursor & cur, Undo::undo_kind kind,
98 lyx::paroffset_type from, lyx::paroffset_type to);
100 /// convienience: prepare undo for the range between 'from' and cursor.
101 void recordUndo(LCursor & cur, Undo::undo_kind kind, lyx::paroffset_type from);
103 /// convienience: prepare undo for the single paragraph containing the cursor
104 void recordUndo(LCursor & cur, Undo::undo_kind kind);
106 /// convienience: prepare undo for the single paragraph containing the cursor
107 void recordUndoFullDocument(LCursor & cur);
109 /// are we avoiding tracking undos currently?
110 extern bool undo_frozen;
112 #endif // UNDO_FUNCS_H