Kate
kateundo.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef kate_undo_h
00022 #define kate_undo_h
00023
00024 #include <QtCore/QList>
00025
00026 #include "ktexteditor/range.h"
00027
00028
00029 class KateDocument;
00030 class KateUndo;
00031
00035 class KateUndoGroup
00036 {
00037 public:
00042 explicit KateUndoGroup (KateDocument *doc);
00043
00047 ~KateUndoGroup ();
00048
00049 public:
00053 void undo ();
00054
00058 void redo ();
00059
00060 public:
00064 enum UndoType
00065 {
00066 editInsertText,
00067 editRemoveText,
00068 editWrapLine,
00069 editUnWrapLine,
00070 editInsertLine,
00071 editRemoveLine,
00072 editMarkLineAutoWrapped,
00073 editInvalid
00074 };
00075
00084 void addItem (KateUndoGroup::UndoType type, uint line, uint col, uint len, const QString &text);
00085
00090 void setSelection (const KTextEditor::Range &selection);
00091
00096 void setCursorPosition (const KTextEditor::Cursor &cursor);
00097
00104 bool merge(KateUndoGroup* newGroup,bool complex);
00105
00109 void safePoint (bool safePoint=true);
00110
00114 bool isEmpty () const { return m_items.isEmpty(); }
00115
00116 private:
00121 KateUndoGroup::UndoType singleType() const;
00122
00128 bool isOnlyType(KateUndoGroup::UndoType type) const;
00129
00134 void addItem (KateUndo *u);
00135
00136 private:
00140 KateDocument *m_doc;
00141
00145 QList<KateUndo*> m_items;
00146
00150 bool m_safePoint;
00151
00155 KTextEditor::Range m_selection;
00156
00160 KTextEditor::Cursor m_cursor;
00161 };
00162
00163 #endif
00164
00165