1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
|
/* This file is part of the KDE project
Copyright (C) 2002 Laurent Montel <lmontel@mandrakesoft.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef kiviocommand_h
#define kiviocommand_h
#include <kcommand.h>
#include <tqfont.h>
#include <tqcolor.h>
#include <tqvaluelist.h>
#include <KoRect.h>
#include <KoPageLayout.h>
#include <koffice_export.h>
class KivioPage;
class KivioLayer;
class KivioStencil;
class KivioGroupStencil;
struct KoPageLayout;
class KivioChangePageNameCommand : public KNamedCommand
{
public:
KivioChangePageNameCommand( const TQString &_name, const TQString & _oldPageName, const TQString & _newPageName, KivioPage *_page );
~KivioChangePageNameCommand();
virtual void execute();
virtual void unexecute();
protected:
TQString oldPageName;
TQString newPageName;
KivioPage * m_page;
};
class KivioHidePageCommand : public KNamedCommand
{
public:
KivioHidePageCommand( const TQString &_name, KivioPage *_page );
~KivioHidePageCommand();
virtual void execute();
virtual void unexecute();
protected:
KivioPage * m_page;
};
class KivioShowPageCommand : public KivioHidePageCommand
{
public:
KivioShowPageCommand( const TQString &_name, KivioPage *_page );
~KivioShowPageCommand() {}
void execute() { KivioHidePageCommand::unexecute(); }
void unexecute() { KivioHidePageCommand::execute(); }
};
class KivioAddPageCommand : public KNamedCommand
{
public:
KivioAddPageCommand( const TQString &_name, KivioPage *_page );
~KivioAddPageCommand();
virtual void execute();
virtual void unexecute();
protected:
KivioPage * m_page;
};
class KivioRemovePageCommand : public KNamedCommand
{
public:
KivioRemovePageCommand( const TQString &_name, KivioPage *_page );
~KivioRemovePageCommand();
virtual void execute();
virtual void unexecute();
protected:
KivioPage * m_page;
};
class KivioAddStencilCommand : public KNamedCommand
{
public:
KivioAddStencilCommand( const TQString &_name, KivioPage *_page, KivioLayer * _layer, KivioStencil *_stencil );
~KivioAddStencilCommand();
virtual void execute();
virtual void unexecute();
protected:
KivioPage * m_page;
KivioLayer * m_layer;
KivioStencil *m_stencil;
};
class KivioRemoveStencilCommand : public KivioAddStencilCommand
{
public:
KivioRemoveStencilCommand(const TQString &_name, KivioPage *_page, KivioLayer * _layer, KivioStencil *_stencil );
~KivioRemoveStencilCommand() {}
void execute() { KivioAddStencilCommand::unexecute(); }
void unexecute() { KivioAddStencilCommand::execute(); }
};
class KIVIO_EXPORT KivioChangeStencilTextCommand : public KNamedCommand
{
public:
KivioChangeStencilTextCommand( const TQString &_name, KivioStencil *_stencil, const TQString & _oldText, const TQString & _newText, KivioPage *_page, const TQString& textBoxName = TQString());
~KivioChangeStencilTextCommand();
virtual void execute();
virtual void unexecute();
protected:
KivioStencil *m_stencil;
TQString oldText;
TQString newText;
KivioPage *m_page;
TQString m_textBoxName;
};
class KivioAddLayerCommand : public KNamedCommand
{
public:
KivioAddLayerCommand( const TQString &_name, KivioPage *_page, KivioLayer * _layer,int _pos );
~KivioAddLayerCommand();
virtual void execute();
virtual void unexecute();
protected:
KivioPage * m_page;
KivioLayer *m_layer;
int layerPos;
};
class KivioRemoveLayerCommand : public KivioAddLayerCommand
{
public:
KivioRemoveLayerCommand( const TQString &_name, KivioPage *_page, KivioLayer * _layer, int _pos );
~KivioRemoveLayerCommand() {}
void execute() { KivioAddLayerCommand::unexecute(); }
void unexecute() { KivioAddLayerCommand::execute(); }
};
class KivioRenameLayerCommand : public KNamedCommand
{
public:
KivioRenameLayerCommand( const TQString &_name, KivioLayer * _layer, const TQString & _oldName, const TQString & _newName);
~KivioRenameLayerCommand();
virtual void execute();
virtual void unexecute();
protected:
KivioLayer *m_layer;
TQString oldName;
TQString newName;
};
class KIVIO_EXPORT KivioResizeStencilCommand : public KNamedCommand
{
public:
KivioResizeStencilCommand(const TQString &_name, KivioStencil *_stencil, KoRect _initSize, KoRect _endSize, KivioPage *_page );
~KivioResizeStencilCommand();
virtual void execute();
virtual void unexecute();
protected:
KivioStencil *m_stencil;
KoRect initSize;
KoRect endSize;
KivioPage *m_page;
};
class KIVIO_EXPORT KivioMoveStencilCommand : public KNamedCommand
{
public:
KivioMoveStencilCommand(const TQString &_name, KivioStencil *_stencil, KoRect _initSize, KoRect _endSize, KivioPage *_page );
~KivioMoveStencilCommand();
virtual void execute();
virtual void unexecute();
protected:
KivioStencil *m_stencil;
KoRect initSize;
KoRect endSize;
KivioPage *m_page;
};
class KivioChangeLayoutCommand : public KNamedCommand
{
public:
KivioChangeLayoutCommand(const TQString &_name, KivioPage *_page, KoPageLayout _oldLayout, KoPageLayout _newLayout);
~KivioChangeLayoutCommand();
virtual void execute();
virtual void unexecute();
protected:
KivioPage *m_page;
KoPageLayout oldLayout;
KoPageLayout newLayout;
};
class KivioChangeStencilHAlignmentCommand : public KNamedCommand
{
public:
KivioChangeStencilHAlignmentCommand(const TQString& _name, KivioPage* _page, KivioStencil* _stencil,
int _oldAlign, int _newAlign, const TQString& textBoxName = TQString());
~KivioChangeStencilHAlignmentCommand();
virtual void execute();
virtual void unexecute();
protected:
KivioPage *m_page;
KivioStencil *m_stencil;
int oldAlign;
int newAlign;
TQString m_textBoxName;
};
class KivioChangeStencilVAlignmentCommand : public KNamedCommand
{
public:
KivioChangeStencilVAlignmentCommand(const TQString& _name, KivioPage* _page, KivioStencil* _stencil,
int _oldAlign, int _newAlign, const TQString& textBoxName = TQString());
~KivioChangeStencilVAlignmentCommand();
virtual void execute();
virtual void unexecute();
protected:
KivioPage *m_page;
KivioStencil *m_stencil;
int oldAlign;
int newAlign;
TQString m_textBoxName;
};
class KivioChangeStencilFontCommand : public KNamedCommand
{
public:
KivioChangeStencilFontCommand(const TQString& _name, KivioPage* _page, KivioStencil* _stencil,
const TQFont& _oldFont, const TQFont& _newFont,
const TQString& textBoxName = TQString());
~KivioChangeStencilFontCommand();
virtual void execute();
virtual void unexecute();
protected:
KivioPage *m_page;
KivioStencil *m_stencil;
TQFont oldFont;
TQFont newFont;
TQString m_textBoxName;
};
class KivioChangeStencilColorCommand : public KNamedCommand
{
public:
enum ColorType { CT_TEXTCOLOR, CT_FGCOLOR, CT_BGCOLOR };
KivioChangeStencilColorCommand(const TQString& _name, KivioPage* _page, KivioStencil* _stencil,
const TQColor& _oldColor, const TQColor& _newColor, ColorType _type,
const TQString& textBoxName = TQString());
~KivioChangeStencilColorCommand();
virtual void execute();
virtual void unexecute();
protected:
KivioPage *m_page;
KivioStencil *m_stencil;
TQColor oldColor;
TQColor newColor;
ColorType type;
TQString m_textBoxName;
};
class KivioChangeRotationCommand : public KNamedCommand
{
public:
KivioChangeRotationCommand( const TQString &_name, KivioPage *_page, KivioStencil * _stencil, int _oldValue, int _newValue);
~KivioChangeRotationCommand();
virtual void execute();
virtual void unexecute();
protected:
KivioPage *m_page;
KivioStencil *m_stencil;
int oldValue;
int newValue;
};
class KivioChangeLineStyleCommand : public KNamedCommand
{
public:
KivioChangeLineStyleCommand( const TQString &_name, KivioPage *_page, KivioStencil * _stencil, int _oldValue, int _newValue);
~KivioChangeLineStyleCommand();
virtual void execute();
virtual void unexecute();
protected:
KivioPage *m_page;
KivioStencil *m_stencil;
int oldValue;
int newValue;
};
class KivioChangeLineWidthCommand : public KNamedCommand
{
public:
KivioChangeLineWidthCommand( const TQString &_name, KivioPage *_page, KivioStencil * _stencil, double _oldValue, double _newValue);
~KivioChangeLineWidthCommand();
virtual void execute();
virtual void unexecute();
protected:
KivioPage *m_page;
KivioStencil *m_stencil;
double oldValue;
double newValue;
};
class KivioChangeBeginEndArrowCommand : public KNamedCommand
{
public:
KivioChangeBeginEndArrowCommand( const TQString &_name, KivioPage *_page, KivioStencil * _stencil, int _oldArrow, int _newArrow, bool _beginArrow);
~KivioChangeBeginEndArrowCommand();
virtual void execute();
virtual void unexecute();
protected:
KivioPage *m_page;
KivioStencil *m_stencil;
int oldArrow;
int newArrow;
bool beginArrow;
};
class KivioChangeBeginEndSizeArrowCommand : public KNamedCommand
{
public:
KivioChangeBeginEndSizeArrowCommand( const TQString &_name, KivioPage *_page, KivioStencil * _stencil, float _oldH,float _oldW, float _newH,float _newW, bool _beginArrow);
~KivioChangeBeginEndSizeArrowCommand();
virtual void execute();
virtual void unexecute();
protected:
KivioPage *m_page;
KivioStencil *m_stencil;
float oldWidth;
float oldLength;
float newWidth;
float newLength;
bool beginArrow;
};
class KivioChangeStencilProtectCommand : public KNamedCommand
{
public:
enum KVP_TYPE {KV_POSX, KV_POSY,KV_WIDTH, KV_HEIGHT, KV_ASPECT, KV_DELETE};
KivioChangeStencilProtectCommand( const TQString &_name, KivioPage *_page, KivioStencil * _stencil, bool _state, KVP_TYPE _type);
~KivioChangeStencilProtectCommand(){};
virtual void execute();
virtual void unexecute();
protected:
void changeValue( bool b );
KivioPage *m_page;
KivioStencil *m_stencil;
KVP_TYPE type;
bool m_bValue;
};
class KivioAddConnectorTargetCommand : public KNamedCommand
{
public:
KivioAddConnectorTargetCommand(const TQString& name, KivioPage* page,
KivioStencil* stencil, const KoPoint& targetPoint);
virtual void execute();
virtual void unexecute();
protected:
KivioPage* m_page;
KivioStencil* m_stencil;
KoPoint m_targetPoint;
};
class KivioCustomDragCommand : public KNamedCommand
{
public:
KivioCustomDragCommand(const TQString& name, KivioPage* page, KivioStencil* stencil,
int customID, const KoPoint& originalPoint, const KoPoint& newPoint);
virtual void execute();
virtual void unexecute();
protected:
KivioPage* m_page;
KivioStencil* m_stencil;
int m_customID;
KoPoint m_originalPoint;
KoPoint m_newPoint;
};
class KivioGroupCommand : public KNamedCommand
{
public:
KivioGroupCommand(const TQString& name, KivioPage* page, KivioLayer* layer, KivioGroupStencil* group);
virtual void execute();
virtual void unexecute();
protected:
KivioPage* m_page;
KivioLayer* m_layer;
KivioGroupStencil* m_groupStencil;
};
class KivioUnGroupCommand : public KivioGroupCommand
{
public:
KivioUnGroupCommand(const TQString& name, KivioPage* page, KivioLayer* layer, KivioGroupStencil* group)
: KivioGroupCommand(name, page, layer, group)
{}
virtual void execute() { KivioGroupCommand::unexecute(); }
virtual void unexecute() { KivioGroupCommand::execute(); }
};
#endif
|