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"
26 * These are the elements put on the undo stack. Each object
27 * contains complete paragraphs and sufficient information
28 * to restore the state.
33 * The undo kinds are used to combine consecutive undo recordings
38 * Insert something - these will combine to one big chunk
39 * when many inserts come after each other.
44 * Delete something - these will combine to one big chunk
45 * when many deletes come after each other.
49 /// Atomic - each of these will have its own entry in the stack
53 Undo(undo_kind kind, int text, int index,
54 int first_par, int end_par, int cursor_par, int cursor_pos);
56 /// which kind of operation are we recording for?
59 /// hosting LyXText counted from buffer begin
62 /// cell in a tabular or similar
65 /// offset to the first paragraph in the paragraph list
68 /// offset to the last paragraph from the end of parargraph list
71 /// offset to the first paragraph in the paragraph list
74 /// the position of the cursor in the hosting paragraph
77 /// the contents of the paragraphs saved
82 /// this will undo the last action - returns false if no undo possible
83 bool textUndo(BufferView *);
85 /// this will redo the last undo - returns false if no redo possible
86 bool textRedo(BufferView *);
88 /// makes sure the next operation will be stored
91 /// whilst undo is frozen, all actions do not get added to the undo stack
98 * Record undo information - call with the first paragraph that will be changed
99 * and the last paragraph that will be changed. So we give an inclusive
101 * This is called before you make the changes to the paragraph, and it
102 * will record the original information of the paragraphs in the undo stack.
104 void recordUndo(Undo::undo_kind kind,
105 LyXText const * text, lyx::paroffset_type first, lyx::paroffset_type last);
107 /// convienience: prepare undo when change in a single paragraph
108 void recordUndo(Undo::undo_kind kind,
109 LyXText const * text, lyx::paroffset_type par);
111 /// convienience: prepare undo for the paragraph that contains the cursor
112 void recordUndo(BufferView *, Undo::undo_kind kind);
114 /// are we avoiding tracking undos currently?
115 extern bool undo_frozen;
117 #endif // UNDO_FUNCS_H