kateundo.h
00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2002 John Firebaugh <jfirebaugh@kde.org> 00003 Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org> 00004 Copyright (C) 2001 Joseph Wenninger <jowenn@kde.org> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License version 2 as published by the Free Software Foundation. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef kate_undo_h 00022 #define kate_undo_h 00023 00024 #include <qptrlist.h> 00025 #include <qstring.h> 00026 00027 class KateDocument; 00028 class KateUndo; 00029 00033 class KateUndoGroup 00034 { 00035 public: 00040 KateUndoGroup (KateDocument *doc); 00041 00045 ~KateUndoGroup (); 00046 00047 public: 00051 void undo (); 00052 00056 void redo (); 00057 00058 public: 00062 enum UndoType 00063 { 00064 editInsertText, 00065 editRemoveText, 00066 editWrapLine, 00067 editUnWrapLine, 00068 editInsertLine, 00069 editRemoveLine, 00070 editMarkLineAutoWrapped, 00071 editInvalid 00072 }; 00073 00082 void addItem (KateUndoGroup::UndoType type, uint line, uint col, uint len, const QString &text); 00083 00090 bool merge(KateUndoGroup* newGroup,bool complex); 00091 00095 void safePoint (bool safePoint=true); 00096 00100 bool isEmpty () const { return m_items.isEmpty(); } 00101 00102 private: 00107 KateUndoGroup::UndoType singleType(); 00108 00114 bool isOnlyType(KateUndoGroup::UndoType type); 00115 00120 void addItem (KateUndo *u); 00121 00122 private: 00126 KateDocument *m_doc; 00127 00131 QPtrList<KateUndo> m_items; 00132 00136 bool m_safePoint; 00137 }; 00138 00139 #endif 00140 00141 // kate: space-indent on; indent-width 2; replace-tabs on;