F:/KPlato/koffice/libs/kotext/KoTextCommand.h

Aller à la documentation de ce fichier.
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., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef kocommand_h
00021 #define kocommand_h
00022 
00023 #include <kcommand.h>
00024 #include <KoRichText.h>
00025 //Added by qt3to4:
00026 #include <Q3ValueList>
00027 #include <Q3MemArray>
00028 class KoTextObject;
00029 class KoTextDocument;
00030 class KoVariable;
00031 #include <KoParagLayout.h>
00032 #include <KoTextDocument.h>
00033 #include <koffice_export.h>
00041 class KOTEXT_EXPORT KoTextCommand : public KNamedCommand
00042 {
00043 public:
00044     KoTextCommand( KoTextObject * textobj, const QString & name ) :
00045         KNamedCommand( name ), m_textobj(textobj) {}
00046     ~KoTextCommand() {}
00047 
00048     virtual void execute();
00049     virtual void unexecute();
00050 
00051 protected:
00052     KoTextObject * m_textobj;
00053 };
00054 
00058 class KOTEXT_EXPORT KoTextDeleteCommand : public KoTextDocDeleteCommand
00059 {
00060 public:
00061     KoTextDeleteCommand( KoTextDocument *d, int i, int idx, const Q3MemArray<KoTextStringChar> &str,
00062                          const CustomItemsMap & customItemsMap,
00063                          const Q3ValueList<KoParagLayout> & oldParagLayouts );
00064     KoTextCursor *execute( KoTextCursor *c );
00065     KoTextCursor *unexecute( KoTextCursor *c );
00066 protected:
00067     Q3ValueList<KoParagLayout> m_oldParagLayouts;
00068     CustomItemsMap m_customItemsMap;
00069 };
00070 
00074 class KoTextInsertCommand : public KoTextDeleteCommand
00075 {
00076 public:
00077     KoTextInsertCommand( KoTextDocument *d, int i, int idx, const Q3MemArray<KoTextStringChar> &str,
00078                          const CustomItemsMap & customItemsMap,
00079                          const Q3ValueList<KoParagLayout> &oldParagLayouts )
00080         : KoTextDeleteCommand( d, i, idx, str, customItemsMap, oldParagLayouts ) {}
00081     Commands type() const { return Insert; };
00082     KoTextCursor *execute( KoTextCursor *c ) { return KoTextDeleteCommand::unexecute( c ); }
00083     KoTextCursor *unexecute( KoTextCursor *c ) { return KoTextDeleteCommand::execute( c ); }
00084 };
00085 
00089 class KOTEXT_EXPORT KoTextParagCommand : public KoTextDocCommand
00090 {
00091 public:
00092     KoTextParagCommand( KoTextDocument *d, int fParag, int lParag,
00093                         const Q3ValueList<KoParagLayout> &oldParagLayouts,
00094                         KoParagLayout newParagLayout,
00095                         int /*KoParagLayout::Flags*/ flags,
00096                         Q3StyleSheetItem::Margin margin = (Q3StyleSheetItem::Margin)-1, bool borderOutline=false );
00097                         // margin is only meaningful if flags==Margins only. -1 means all.
00098     KoTextCursor *execute( KoTextCursor *c );
00099     KoTextCursor *unexecute( KoTextCursor *c );
00100 protected:
00101     int firstParag, lastParag;
00102     Q3ValueList<KoParagLayout> m_oldParagLayouts;
00103     KoParagLayout m_newParagLayout;
00104     int m_flags;
00105     int m_margin;
00106     bool m_borderOutline;
00107 };
00108 
00114 class KoParagFormatCommand : public KoTextDocCommand
00115 {
00116 public:
00117     KoParagFormatCommand( KoTextDocument *d, int fParag, int lParag,
00118                           const Q3ValueList<KoTextFormat *> &oldFormats,
00119                           KoTextFormat * newFormat );
00120     ~KoParagFormatCommand();
00121     KoTextCursor *execute( KoTextCursor *c );
00122     KoTextCursor *unexecute( KoTextCursor *c );
00123 protected:
00124     int firstParag, lastParag;
00125     Q3ValueList<KoTextFormat *> m_oldFormats;
00126     KoTextFormat * m_newFormat;
00127 };
00128 
00132 class KoTextFormatCommand : public KoTextDocFormatCommand
00133 {
00134 public:
00135     KoTextFormatCommand( KoTextDocument *d, int sid, int sidx, int eid, int eidx, const Q3MemArray<KoTextStringChar> &old, const KoTextFormat *f, int fl );
00136     virtual ~KoTextFormatCommand();
00137 
00138     KoTextCursor *execute( KoTextCursor *c );
00139     KoTextCursor *unexecute( KoTextCursor *c );
00140     void resizeCustomItems();
00141 };
00142 
00147 class KoChangeVariableSubType : public KCommand
00148 {
00149 public:
00150     KoChangeVariableSubType( short int _oldValue, short int _newValue, KoVariable *var );
00151     void execute();
00152     void unexecute();
00153     virtual QString name() const;
00154 private:
00155     short int m_newValue;
00156     short int m_oldValue;
00157     KoVariable *m_var;
00158 };
00159 
00164 class KoChangeVariableFormatProperties : public KCommand
00165 {
00166  public:
00167     KoChangeVariableFormatProperties( const QString &_oldValue, const QString &_newValue, KoVariable *var);
00168     virtual QString name() const;
00169     void execute();
00170     void unexecute();
00171 private:
00172     QString m_newValue;
00173     QString m_oldValue;
00174     KoVariable *m_var;
00175 };
00176 
00177 #endif

Généré le Wed Nov 22 23:41:09 2006 pour KPlato par  doxygen 1.5.1-p1