00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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 flags,
00093 QStyleSheetItem::Margin margin = (QStyleSheetItem::Margin)-1,
bool borderOutline=
false );
00094
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