Kate
kateundomanager.h
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2009-2010 Bernhard Beschow <bbeschow@cs.tu-berlin.de> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License version 2 as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00016 Boston, MA 02110-1301, USA. 00017 */ 00018 00019 #ifndef KATEUNDOMANAGER_H 00020 #define KATEUNDOMANAGER_H 00021 00022 #include <QtCore/QObject> 00023 00024 #include "katepartprivate_export.h" 00025 00026 #include <QtCore/QList> 00027 00028 class KateDocument; 00029 class KateUndo; 00030 class KateUndoGroup; 00031 00032 namespace KTextEditor { 00033 class Document; 00034 class View; 00035 } 00036 00044 class KATEPART_TESTS_EXPORT KateUndoManager : public QObject 00045 { 00046 Q_OBJECT 00047 00048 public: 00054 KateUndoManager (KateDocument *doc); 00055 00056 ~KateUndoManager(); 00057 00058 KTextEditor::Document *document(); 00059 00065 uint undoCount () const; 00066 00072 uint redoCount () const; 00073 00077 void undoSafePoint(); 00078 00087 void setAllowComplexMerge(bool allow); 00088 00089 bool isActive() const { return m_isActive; } 00090 00091 void setModified( bool m ); 00092 void updateConfig (); 00093 00094 public Q_SLOTS: 00100 void undo (); 00101 00107 void redo (); 00108 00109 void clearUndo (); 00110 void clearRedo (); 00111 00115 void editStart(); 00116 00120 void editEnd(); 00121 00122 void startUndo(); 00123 void endUndo(); 00124 00125 void inputMethodStart(); 00126 void inputMethodEnd(); 00127 00131 void slotTextInserted(int line, int col, const QString &s); 00132 00136 void slotTextRemoved(int line, int col, const QString &s); 00137 00141 void slotMarkLineAutoWrapped(int line, bool autowrapped); 00142 00146 void slotLineWrapped(int line, int col, int pos, bool newLine); 00147 00151 void slotLineUnWrapped(int line, int col, int length, bool lineRemoved); 00152 00156 void slotLineInserted(int line, const QString &s); 00157 00161 void slotLineRemoved(int line, const QString &s); 00162 00163 Q_SIGNALS: 00164 void undoChanged (); 00165 void undoStart (KTextEditor::Document*); 00166 void undoEnd (KTextEditor::Document*); 00167 void redoStart (KTextEditor::Document*); 00168 void redoEnd (KTextEditor::Document*); 00169 void isActiveChanged(bool enabled); 00170 00171 private Q_SLOTS: 00177 void addUndoItem(KateUndo *undo); 00178 00179 void setActive(bool active); 00180 00181 void updateModified(); 00182 00183 void undoCancel(); 00184 void viewCreated (KTextEditor::Document *, KTextEditor::View *newView); 00185 00186 private: 00187 KTextEditor::View *activeView(); 00188 00189 private: 00190 KateDocument *m_document; 00191 bool m_undoComplexMerge; 00192 bool m_isActive; 00193 KateUndoGroup* m_editCurrentUndo; 00194 QList<KateUndoGroup*> undoItems; 00195 QList<KateUndoGroup*> redoItems; 00196 // these two variables are for resetting the document to 00197 // non-modified if all changes have been undone... 00198 KateUndoGroup* lastUndoGroupWhenSaved; 00199 KateUndoGroup* lastRedoGroupWhenSaved; 00200 bool docWasSavedWhenUndoWasEmpty; 00201 bool docWasSavedWhenRedoWasEmpty; 00202 }; 00203 00204 #endif 00205 00206 // kate: space-indent on; indent-width 2; replace-tabs on;
KDE 4.6 API Reference