lib Library API Documentation

kocommand.h

00001 /* This file is part of the KDE project 00002 Copyright (C) 2001 David Faure <faure@kde.org> 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 as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00017 Boston, MA 02111-1307, USA. 00018 */ 00019 00020 #ifndef kocommand_h 00021 #define kocommand_h 00022 00023 #include <kcommand.h> 00024 #include <korichtext.h> 00025 class KoTextObject; 00026 class KoTextDocument; 00027 class KoVariable; 00028 #include <koparaglayout.h> 00029 #include <kotextdocument.h> 00030 00038 class KoTextCommand : public KNamedCommand 00039 { 00040 public: 00041 KoTextCommand( KoTextObject * textobj, const QString & name ) : 00042 KNamedCommand( name ), m_textobj(textobj) {} 00043 ~KoTextCommand() {} 00044 00045 virtual void execute(); 00046 virtual void unexecute(); 00047 00048 protected: 00049 KoTextObject * m_textobj; 00050 }; 00051 00055 class KoTextDeleteCommand : public KoTextDocDeleteCommand 00056 { 00057 public: 00058 KoTextDeleteCommand( KoTextDocument *d, int i, int idx, const QMemArray<KoTextStringChar> &str, 00059 const CustomItemsMap & customItemsMap, 00060 const QValueList<KoParagLayout> & oldParagLayouts ); 00061 KoTextCursor *execute( KoTextCursor *c ); 00062 KoTextCursor *unexecute( KoTextCursor *c ); 00063 protected: 00064 QValueList<KoParagLayout> m_oldParagLayouts; 00065 CustomItemsMap m_customItemsMap; 00066 }; 00067 00071 class KoTextInsertCommand : public KoTextDeleteCommand 00072 { 00073 public: 00074 KoTextInsertCommand( KoTextDocument *d, int i, int idx, const QMemArray<KoTextStringChar> &str, 00075 const CustomItemsMap & customItemsMap, 00076 const QValueList<KoParagLayout> &oldParagLayouts ) 00077 : KoTextDeleteCommand( d, i, idx, str, customItemsMap, oldParagLayouts ) {} 00078 Commands type() const { return Insert; }; 00079 KoTextCursor *execute( KoTextCursor *c ) { return KoTextDeleteCommand::unexecute( c ); } 00080 KoTextCursor *unexecute( KoTextCursor *c ) { return KoTextDeleteCommand::execute( c ); } 00081 }; 00082 00086 class KoTextParagCommand : public KoTextDocCommand 00087 { 00088 public: 00089 KoTextParagCommand( KoTextDocument *d, int fParag, int lParag, 00090 const QValueList<KoParagLayout> &oldParagLayouts, 00091 KoParagLayout newParagLayout, 00092 int /*KoParagLayout::Flags*/ flags, 00093 QStyleSheetItem::Margin margin = (QStyleSheetItem::Margin)-1, bool borderOutline=false ); 00094 // margin is only meaningful if flags==Margins only. -1 means all. 00095 KoTextCursor *execute( KoTextCursor *c ); 00096 KoTextCursor *unexecute( KoTextCursor *c ); 00097 protected: 00098 int firstParag, lastParag; 00099 QValueList<KoParagLayout> m_oldParagLayouts; 00100 KoParagLayout m_newParagLayout; 00101 int m_flags; 00102 int m_margin; 00103 bool m_borderOutline; 00104 }; 00105 00111 class KoParagFormatCommand : public KoTextDocCommand 00112 { 00113 public: 00114 KoParagFormatCommand( KoTextDocument *d, int fParag, int lParag, 00115 const QValueList<KoTextFormat *> &oldFormats, 00116 KoTextFormat * newFormat ); 00117 ~KoParagFormatCommand(); 00118 KoTextCursor *execute( KoTextCursor *c ); 00119 KoTextCursor *unexecute( KoTextCursor *c ); 00120 protected: 00121 int firstParag, lastParag; 00122 QValueList<KoTextFormat *> m_oldFormats; 00123 KoTextFormat * m_newFormat; 00124 }; 00125 00129 class KoTextFormatCommand : public KoTextDocFormatCommand 00130 { 00131 public: 00132 KoTextFormatCommand( KoTextDocument *d, int sid, int sidx, int eid, int eidx, const QMemArray<KoTextStringChar> &old, const KoTextFormat *f, int fl ); 00133 virtual ~KoTextFormatCommand(); 00134 00135 KoTextCursor *execute( KoTextCursor *c ); 00136 KoTextCursor *unexecute( KoTextCursor *c ); 00137 void resizeCustomItems(); 00138 }; 00139 00144 class KoChangeVariableSubType : public KCommand 00145 { 00146 public: 00147 KoChangeVariableSubType( short int _oldValue, short int _newValue, KoVariable *var ); 00148 void execute(); 00149 void unexecute(); 00150 virtual QString name() const; 00151 private: 00152 short int m_newValue; 00153 short int m_oldValue; 00154 KoVariable *m_var; 00155 }; 00156 00161 class KoChangeVariableFormatProperties : public KCommand 00162 { 00163 public: 00164 KoChangeVariableFormatProperties( const QString &_oldValue, const QString &_newValue, KoVariable *var); 00165 virtual QString name() const; 00166 void execute(); 00167 void unexecute(); 00168 private: 00169 QString m_newValue; 00170 QString m_oldValue; 00171 KoVariable *m_var; 00172 }; 00173 00174 #endif
KDE Logo
This file is part of the documentation for lib Library Version 1.3.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Sep 24 18:22:23 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003