00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef kiviocommand_h
00021 #define kiviocommand_h
00022
00023 #include <kcommand.h>
00024 #include <qfont.h>
00025 #include <qcolor.h>
00026 #include <qvaluelist.h>
00027 #include <KoRect.h>
00028 #include <KoPageLayout.h>
00029 #include <koffice_export.h>
00030 class KivioPage;
00031 class KivioLayer;
00032 class KivioStencil;
00033 class KivioGroupStencil;
00034 struct KoPageLayout;
00035
00036 class KivioChangePageNameCommand : public KNamedCommand
00037 {
00038 public:
00039 KivioChangePageNameCommand( const QString &_name, const QString & _oldPageName, const QString & _newPageName, KivioPage *_page );
00040 ~KivioChangePageNameCommand();
00041
00042 virtual void execute();
00043 virtual void unexecute();
00044
00045 protected:
00046 QString oldPageName;
00047 QString newPageName;
00048 KivioPage * m_page;
00049 };
00050
00051 class KivioHidePageCommand : public KNamedCommand
00052 {
00053 public:
00054 KivioHidePageCommand( const QString &_name, KivioPage *_page );
00055 ~KivioHidePageCommand();
00056
00057 virtual void execute();
00058 virtual void unexecute();
00059
00060 protected:
00061 KivioPage * m_page;
00062 };
00063
00064 class KivioShowPageCommand : public KivioHidePageCommand
00065 {
00066 public:
00067 KivioShowPageCommand( const QString &_name, KivioPage *_page );
00068 ~KivioShowPageCommand() {}
00069
00070 void execute() { KivioHidePageCommand::unexecute(); }
00071 void unexecute() { KivioHidePageCommand::execute(); }
00072 };
00073
00074 class KivioAddPageCommand : public KNamedCommand
00075 {
00076 public:
00077 KivioAddPageCommand( const QString &_name, KivioPage *_page );
00078 ~KivioAddPageCommand();
00079
00080 virtual void execute();
00081 virtual void unexecute();
00082
00083 protected:
00084 KivioPage * m_page;
00085 };
00086
00087 class KivioRemovePageCommand : public KNamedCommand
00088 {
00089 public:
00090 KivioRemovePageCommand( const QString &_name, KivioPage *_page );
00091 ~KivioRemovePageCommand();
00092
00093 virtual void execute();
00094 virtual void unexecute();
00095
00096 protected:
00097 KivioPage * m_page;
00098 };
00099
00100 class KivioAddStencilCommand : public KNamedCommand
00101 {
00102 public:
00103 KivioAddStencilCommand( const QString &_name, KivioPage *_page, KivioLayer * _layer, KivioStencil *_stencil );
00104 ~KivioAddStencilCommand();
00105
00106 virtual void execute();
00107 virtual void unexecute();
00108
00109 protected:
00110 KivioPage * m_page;
00111 KivioLayer * m_layer;
00112 KivioStencil *m_stencil;
00113 };
00114
00115
00116 class KivioRemoveStencilCommand : public KivioAddStencilCommand
00117 {
00118 public:
00119 KivioRemoveStencilCommand(const QString &_name, KivioPage *_page, KivioLayer * _layer, KivioStencil *_stencil );
00120 ~KivioRemoveStencilCommand() {}
00121
00122 void execute() { KivioAddStencilCommand::unexecute(); }
00123 void unexecute() { KivioAddStencilCommand::execute(); }
00124 };
00125
00126 class KIVIO_EXPORT KivioChangeStencilTextCommand : public KNamedCommand
00127 {
00128 public:
00129 KivioChangeStencilTextCommand( const QString &_name, KivioStencil *_stencil, const QString & _oldText, const QString & _newText, KivioPage *_page, const QString& textBoxName = QString::null);
00130 ~KivioChangeStencilTextCommand();
00131 virtual void execute();
00132 virtual void unexecute();
00133 protected:
00134 KivioStencil *m_stencil;
00135 QString oldText;
00136 QString newText;
00137 KivioPage *m_page;
00138 QString m_textBoxName;
00139 };
00140
00141 class KivioAddLayerCommand : public KNamedCommand
00142 {
00143 public:
00144 KivioAddLayerCommand( const QString &_name, KivioPage *_page, KivioLayer * _layer,int _pos );
00145 ~KivioAddLayerCommand();
00146
00147 virtual void execute();
00148 virtual void unexecute();
00149
00150 protected:
00151 KivioPage * m_page;
00152 KivioLayer *m_layer;
00153 int layerPos;
00154 };
00155
00156 class KivioRemoveLayerCommand : public KivioAddLayerCommand
00157 {
00158 public:
00159 KivioRemoveLayerCommand( const QString &_name, KivioPage *_page, KivioLayer * _layer, int _pos );
00160 ~KivioRemoveLayerCommand() {}
00161
00162 void execute() { KivioAddLayerCommand::unexecute(); }
00163 void unexecute() { KivioAddLayerCommand::execute(); }
00164 };
00165
00166 class KivioRenameLayerCommand : public KNamedCommand
00167 {
00168 public:
00169 KivioRenameLayerCommand( const QString &_name, KivioLayer * _layer, const QString & _oldName, const QString & _newName);
00170 ~KivioRenameLayerCommand();
00171 virtual void execute();
00172 virtual void unexecute();
00173
00174 protected:
00175 KivioLayer *m_layer;
00176 QString oldName;
00177 QString newName;
00178
00179 };
00180
00181 class KIVIO_EXPORT KivioResizeStencilCommand : public KNamedCommand
00182 {
00183 public:
00184 KivioResizeStencilCommand(const QString &_name, KivioStencil *_stencil, KoRect _initSize, KoRect _endSize, KivioPage *_page );
00185 ~KivioResizeStencilCommand();
00186
00187 virtual void execute();
00188 virtual void unexecute();
00189
00190 protected:
00191 KivioStencil *m_stencil;
00192 KoRect initSize;
00193 KoRect endSize;
00194 KivioPage *m_page;
00195 };
00196
00197 class KIVIO_EXPORT KivioMoveStencilCommand : public KNamedCommand
00198 {
00199 public:
00200 KivioMoveStencilCommand(const QString &_name, KivioStencil *_stencil, KoRect _initSize, KoRect _endSize, KivioPage *_page );
00201 ~KivioMoveStencilCommand();
00202
00203 virtual void execute();
00204 virtual void unexecute();
00205
00206 protected:
00207 KivioStencil *m_stencil;
00208 KoRect initSize;
00209 KoRect endSize;
00210 KivioPage *m_page;
00211 };
00212
00213 class KivioChangeLayoutCommand : public KNamedCommand
00214 {
00215 public:
00216 KivioChangeLayoutCommand(const QString &_name, KivioPage *_page, KoPageLayout _oldLayout, KoPageLayout _newLayout);
00217 ~KivioChangeLayoutCommand();
00218
00219 virtual void execute();
00220 virtual void unexecute();
00221
00222 protected:
00223 KivioPage *m_page;
00224 KoPageLayout oldLayout;
00225 KoPageLayout newLayout;
00226 };
00227
00228
00229 class KivioChangeStencilHAlignmentCommand : public KNamedCommand
00230 {
00231 public:
00232 KivioChangeStencilHAlignmentCommand(const QString& _name, KivioPage* _page, KivioStencil* _stencil,
00233 int _oldAlign, int _newAlign, const QString& textBoxName = QString::null);
00234 ~KivioChangeStencilHAlignmentCommand();
00235
00236 virtual void execute();
00237 virtual void unexecute();
00238
00239 protected:
00240 KivioPage *m_page;
00241 KivioStencil *m_stencil;
00242 int oldAlign;
00243 int newAlign;
00244 QString m_textBoxName;
00245 };
00246
00247 class KivioChangeStencilVAlignmentCommand : public KNamedCommand
00248 {
00249 public:
00250 KivioChangeStencilVAlignmentCommand(const QString& _name, KivioPage* _page, KivioStencil* _stencil,
00251 int _oldAlign, int _newAlign, const QString& textBoxName = QString::null);
00252 ~KivioChangeStencilVAlignmentCommand();
00253
00254 virtual void execute();
00255 virtual void unexecute();
00256
00257 protected:
00258 KivioPage *m_page;
00259 KivioStencil *m_stencil;
00260 int oldAlign;
00261 int newAlign;
00262 QString m_textBoxName;
00263 };
00264
00265
00266 class KivioChangeStencilFontCommand : public KNamedCommand
00267 {
00268 public:
00269 KivioChangeStencilFontCommand(const QString& _name, KivioPage* _page, KivioStencil* _stencil,
00270 const QFont& _oldFont, const QFont& _newFont,
00271 const QString& textBoxName = QString::null);
00272 ~KivioChangeStencilFontCommand();
00273
00274 virtual void execute();
00275 virtual void unexecute();
00276
00277 protected:
00278 KivioPage *m_page;
00279 KivioStencil *m_stencil;
00280 QFont oldFont;
00281 QFont newFont;
00282 QString m_textBoxName;
00283 };
00284
00285 class KivioChangeStencilColorCommand : public KNamedCommand
00286 {
00287 public:
00288 enum ColorType { CT_TEXTCOLOR, CT_FGCOLOR, CT_BGCOLOR };
00289 KivioChangeStencilColorCommand(const QString& _name, KivioPage* _page, KivioStencil* _stencil,
00290 const QColor& _oldColor, const QColor& _newColor, ColorType _type,
00291 const QString& textBoxName = QString::null);
00292 ~KivioChangeStencilColorCommand();
00293
00294 virtual void execute();
00295 virtual void unexecute();
00296
00297 protected:
00298 KivioPage *m_page;
00299 KivioStencil *m_stencil;
00300 QColor oldColor;
00301 QColor newColor;
00302 ColorType type;
00303 QString m_textBoxName;
00304 };
00305
00306 class KivioChangeRotationCommand : public KNamedCommand
00307 {
00308 public:
00309 KivioChangeRotationCommand( const QString &_name, KivioPage *_page, KivioStencil * _stencil, int _oldValue, int _newValue);
00310 ~KivioChangeRotationCommand();
00311
00312 virtual void execute();
00313 virtual void unexecute();
00314
00315 protected:
00316 KivioPage *m_page;
00317 KivioStencil *m_stencil;
00318 int oldValue;
00319 int newValue;
00320 };
00321
00322 class KivioChangeLineStyleCommand : public KNamedCommand
00323 {
00324 public:
00325 KivioChangeLineStyleCommand( const QString &_name, KivioPage *_page, KivioStencil * _stencil, int _oldValue, int _newValue);
00326 ~KivioChangeLineStyleCommand();
00327
00328 virtual void execute();
00329 virtual void unexecute();
00330
00331 protected:
00332 KivioPage *m_page;
00333 KivioStencil *m_stencil;
00334 int oldValue;
00335 int newValue;
00336 };
00337
00338
00339 class KivioChangeLineWidthCommand : public KNamedCommand
00340 {
00341 public:
00342 KivioChangeLineWidthCommand( const QString &_name, KivioPage *_page, KivioStencil * _stencil, double _oldValue, double _newValue);
00343 ~KivioChangeLineWidthCommand();
00344
00345 virtual void execute();
00346 virtual void unexecute();
00347
00348 protected:
00349 KivioPage *m_page;
00350 KivioStencil *m_stencil;
00351 double oldValue;
00352 double newValue;
00353 };
00354
00355 class KivioChangeBeginEndArrowCommand : public KNamedCommand
00356 {
00357 public:
00358 KivioChangeBeginEndArrowCommand( const QString &_name, KivioPage *_page, KivioStencil * _stencil, int _oldArrow, int _newArrow, bool _beginArrow);
00359
00360 ~KivioChangeBeginEndArrowCommand();
00361
00362 virtual void execute();
00363 virtual void unexecute();
00364
00365 protected:
00366 KivioPage *m_page;
00367 KivioStencil *m_stencil;
00368 int oldArrow;
00369 int newArrow;
00370 bool beginArrow;
00371 };
00372
00373 class KivioChangeBeginEndSizeArrowCommand : public KNamedCommand
00374 {
00375 public:
00376 KivioChangeBeginEndSizeArrowCommand( const QString &_name, KivioPage *_page, KivioStencil * _stencil, float _oldH,float _oldW, float _newH,float _newW, bool _beginArrow);
00377
00378 ~KivioChangeBeginEndSizeArrowCommand();
00379
00380 virtual void execute();
00381 virtual void unexecute();
00382
00383 protected:
00384 KivioPage *m_page;
00385 KivioStencil *m_stencil;
00386 float oldWidth;
00387 float oldLength;
00388 float newWidth;
00389 float newLength;
00390
00391 bool beginArrow;
00392 };
00393
00394 class KivioChangeStencilProtectCommand : public KNamedCommand
00395 {
00396 public:
00397 enum KVP_TYPE {KV_POSX, KV_POSY,KV_WIDTH, KV_HEIGHT, KV_ASPECT, KV_DELETE};
00398 KivioChangeStencilProtectCommand( const QString &_name, KivioPage *_page, KivioStencil * _stencil, bool _state, KVP_TYPE _type);
00399
00400 ~KivioChangeStencilProtectCommand(){};
00401
00402 virtual void execute();
00403 virtual void unexecute();
00404
00405 protected:
00406 void changeValue( bool b );
00407 KivioPage *m_page;
00408 KivioStencil *m_stencil;
00409 KVP_TYPE type;
00410 bool m_bValue;
00411 };
00412
00413 class KivioAddConnectorTargetCommand : public KNamedCommand
00414 {
00415 public:
00416 KivioAddConnectorTargetCommand(const QString& name, KivioPage* page,
00417 KivioStencil* stencil, const KoPoint& targetPoint);
00418
00419 virtual void execute();
00420 virtual void unexecute();
00421
00422 protected:
00423 KivioPage* m_page;
00424 KivioStencil* m_stencil;
00425 KoPoint m_targetPoint;
00426 };
00427
00428 class KivioCustomDragCommand : public KNamedCommand
00429 {
00430 public:
00431 KivioCustomDragCommand(const QString& name, KivioPage* page, KivioStencil* stencil,
00432 int customID, const KoPoint& originalPoint, const KoPoint& newPoint);
00433
00434 virtual void execute();
00435 virtual void unexecute();
00436
00437 protected:
00438 KivioPage* m_page;
00439 KivioStencil* m_stencil;
00440
00441 int m_customID;
00442 KoPoint m_originalPoint;
00443 KoPoint m_newPoint;
00444 };
00445
00446 class KivioGroupCommand : public KNamedCommand
00447 {
00448 public:
00449 KivioGroupCommand(const QString& name, KivioPage* page, KivioLayer* layer, KivioGroupStencil* group);
00450
00451 virtual void execute();
00452 virtual void unexecute();
00453
00454 protected:
00455 KivioPage* m_page;
00456 KivioLayer* m_layer;
00457
00458 KivioGroupStencil* m_groupStencil;
00459 };
00460
00461 class KivioUnGroupCommand : public KivioGroupCommand
00462 {
00463 public:
00464 KivioUnGroupCommand(const QString& name, KivioPage* page, KivioLayer* layer, KivioGroupStencil* group)
00465 : KivioGroupCommand(name, page, layer, group)
00466 {}
00467
00468 virtual void execute() { KivioGroupCommand::unexecute(); }
00469 virtual void unexecute() { KivioGroupCommand::execute(); }
00470 };
00471
00472 #endif
00473