kpresenter

KPrCommand.h
1/* This file is part of the KDE project
2 Copyright (C) 2001 Laurent Montel <lmontel@mandrakesoft.com>
3 Copyright (C) 2005 Thorsten Zachmann <zachmann@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19*/
20
21#ifndef kprcommand_h
22#define kprcommand_h
23
24#include <kcommand.h>
25#include <tqptrlist.h>
26#include <tqpoint.h>
27#include <tqcolor.h>
28#include <tqsize.h>
29#include "global.h"
30#include <KoPictureCollection.h>
31#include <tqvaluelist.h>
32#include <tqpen.h>
33#include <tqbrush.h>
34#include <KoPageLayoutDia.h>
35#include <KoParagLayout.h>
36#include <KoTextCommand.h>
37#include <KoPoint.h>
38#include <KoSize.h>
39#include <tqvariant.h>
40#include <tqvaluevector.h>
41#include "KPrBackground.h"
42#include "KPrVariableCollection.h"
43#include <KoPen.h>
44
45class KPrDocument;
46class KPrTextObject;
47class KPrObject;
48class KPr2DObject;
49class KPrPixmapObject;
50class KPrGroupObject;
51class KPrView;
52class KoParagLayout;
53class KPrPage;
54class KoCustomVariable;
55class KoLinkVariable;
56class KPrPolylineObject;
57class KPrFieldVariable;
58class KPrTimeVariable;
59class KPrDateVariable;
61
62class KPrShadowCmd : public KNamedCommand
63{
64public:
65 struct ShadowValues
66 {
67 int shadowDistance;
68 ShadowDirection shadowDirection;
69 TQColor shadowColor;
70 };
71
72 KPrShadowCmd( const TQString &_name, TQPtrList<ShadowValues> &_oldShadow, ShadowValues _newShadow,
73 TQPtrList<KPrObject> &_objects, KPrDocument *_doc );
74 ~KPrShadowCmd();
75
76 virtual void execute();
77 virtual void unexecute();
78
79protected:
80 KPrDocument *doc;
81 TQPtrList<ShadowValues> oldShadow;
82 TQPtrList<KPrObject> objects;
83 ShadowValues newShadow;
84 KPrPage *m_page;
85};
86
87class KPrSetOptionsCmd : public KNamedCommand
88{
89public:
90 KPrSetOptionsCmd( const TQString &_name, TQValueList<KoPoint> &_diffs, TQPtrList<KPrObject> &_objects,
91 double _rastX, double _rastY, double _orastX, double _orastY,
92 const TQColor &_txtBackCol, const TQColor &_otxtBackCol, KPrDocument *_doc );
93 ~KPrSetOptionsCmd();
94
95 virtual void execute();
96 virtual void unexecute();
97
98protected:
99
100 TQValueList<KoPoint> diffs;
101 TQPtrList<KPrObject> objects;
102 double gridX;
103 double gridY;
104 double oldGridX;
105 double oldGridY;
106 KPrDocument *doc;
107 TQColor txtBackCol;
108 TQColor otxtBackCol;
109};
110
111class KPrSetBackCmd : public KNamedCommand
112{
113public:
114 KPrSetBackCmd( const TQString &name, const KPrBackGround::Settings &settings,
115 const KPrBackGround::Settings &oldSettings,
116 bool useMasterBackground,
117 bool takeGlobal, KPrDocument *doc, KPrPage *page );
118
119 virtual void execute();
120 virtual void unexecute();
121
122protected:
123
124 KPrBackGround::Settings m_settings;
125 KPrBackGround::Settings m_oldSettings;
126 bool m_useMasterBackground;
127 bool m_oldUseMasterBackground;
128 bool m_takeGlobal;
129 KPrDocument *m_doc;
130 KPrPage *m_page;
131};
132
133class KPrRotateCmd : public KNamedCommand
134{
135public:
136 struct RotateValues
137 {
138 float angle;
139 };
140
141 KPrRotateCmd( const TQString &_name, float newAngle, TQPtrList<KPrObject> &objects,
142 KPrDocument *doc, bool addAngle = false );
143 ~KPrRotateCmd();
144
145 virtual void execute();
146 virtual void unexecute();
147
148protected:
149 KPrDocument *m_doc;
150 TQPtrList<RotateValues> m_oldAngles;
151 TQPtrList<KPrObject> m_objects;
152 float m_newAngle;
153 //necessary for duplicate object, we can duplicated and add angle.
154 bool m_addAngle;
155 KPrPage *m_page;
156};
157
158class KPrResizeCmd : public KNamedCommand
159{
160public:
161 KPrResizeCmd( const TQString &_name, const KoPoint &_m_diff, const KoSize &_r_diff,
162 KPrObject *_object, KPrDocument *_doc );
163 ~KPrResizeCmd();
164
165 virtual void execute();
166 virtual void unexecute();
167
168protected:
169
170 KoPoint m_diff;
171 KoSize r_diff;
172 KPrObject *object;
173 KPrDocument *doc;
174 KPrPage *m_page;
175};
176
177class KPrChgPixCmd : public KNamedCommand
178{
179public:
180 KPrChgPixCmd( const TQString &_name, KPrPixmapObject *_oldObject, KPrPixmapObject *_newObject,
181 KPrDocument *_doc, KPrPage *_page );
182 ~KPrChgPixCmd();
183
184 virtual void execute();
185 virtual void unexecute();
186
187protected:
188
189 KPrPixmapObject *oldObject, *newObject;
190 KPrDocument *doc;
191 KPrPage *m_page;
192};
193
194class KPrDeleteCmd : public KNamedCommand
195{
196public:
197 KPrDeleteCmd( const TQString &_name, TQPtrList<KPrObject> &_objects, KPrDocument *_doc,
198 KPrPage *_page);
199 ~KPrDeleteCmd();
200
201 virtual void execute();
202 virtual void unexecute();
203
204protected:
205 TQPtrList<KPrObject> m_oldObjectList;
206 TQPtrList<KPrObject> m_objectsToDelete;
207 KPrDocument *m_doc;
208 KPrPage *m_page;
209};
210
211class KPrEffectCmd : public KNamedCommand
212{
213public:
214 struct EffectStruct {
215 int appearStep, disappearStep;
216 Effect effect;
217 Effect2 effect2;
218 Effect3 effect3;
219 EffectSpeed m_appearSpeed;
220 EffectSpeed m_disappearSpeed;
221 bool disappear;
222 int appearTimer, disappearTimer;
223 bool appearSoundEffect, disappearSoundEffect;
224 TQString a_fileName, d_fileName;
225 };
226
227 KPrEffectCmd( const TQString &_name, const TQPtrList<KPrObject> &_objs,
228 const TQValueList<EffectStruct> &_oldEffects, EffectStruct _newEffect );
229 ~KPrEffectCmd();
230
231 virtual void execute();
232 virtual void unexecute();
233
234protected:
235
236 TQValueList<EffectStruct> oldEffects;
237 EffectStruct newEffect;
238 TQPtrList<KPrObject> objs;
239};
240
241class KPrGroupObjCmd : public KNamedCommand
242{
243public:
244 KPrGroupObjCmd( const TQString &_name,
245 const TQPtrList<KPrObject> &_objects,
246 KPrDocument *_doc, KPrPage *_page );
247 ~KPrGroupObjCmd();
248
249 virtual void execute();
250 virtual void unexecute();
251
252protected:
253
254 TQPtrList<KPrObject> m_objectsToGroup;
255 TQPtrList<KPrObject> m_oldObjectList;
256 KPrDocument *m_doc;
257 KPrGroupObject *m_groupObject;
258 KPrPage *m_page;
259
260};
261
262class UnGroupObjCmd : public KNamedCommand
263{
264public:
265 UnGroupObjCmd( const TQString &_name,
266 KPrGroupObject *grpObj_,
267 KPrDocument *_doc, KPrPage *_page );
268 ~UnGroupObjCmd();
269
270 virtual void execute();
271 virtual void unexecute();
272
273protected:
274
275 TQPtrList<KPrObject> m_groupedObjects;
276 KPrGroupObject *m_groupObject;
277 KPrDocument *m_doc;
278 KPrPage *m_page;
279};
280
281
282class KPrInsertCmd : public KNamedCommand
283{
284public:
285 KPrInsertCmd( const TQString &name, const TQValueList<KPrObject *> objects, KPrDocument *doc, KPrPage *page );
286 KPrInsertCmd( const TQString &name, KPrObject *object, KPrDocument *doc, KPrPage *page );
287 ~KPrInsertCmd();
288
289 virtual void execute();
290 virtual void unexecute();
291
292protected:
293 TQValueList<KPrObject *> m_objects;
294 KPrObject *m_object;
295 KPrDocument *m_doc;
296 KPrPage *m_page;
297};
298
299
300class KPrLowerRaiseCmd : public KNamedCommand
301{
302public:
303 KPrLowerRaiseCmd( const TQString &_name, const TQPtrList<KPrObject>& _oldList,
304 const TQPtrList<KPrObject>& _newList,
305 KPrDocument *_doc, KPrPage *_page );
306 ~KPrLowerRaiseCmd();
307
308 virtual void execute();
309 virtual void unexecute();
310
311protected:
312
313 TQPtrList<KPrObject> oldList, newList;
314 KPrDocument *doc;
315 KPrPage *m_page;
316};
317
318class KPrMoveByCmd : public KNamedCommand
319{
320public:
321 KPrMoveByCmd( const TQString &_name, const KoPoint &_diff, TQPtrList<KPrObject> &_objects,
322 KPrDocument *_doc, KPrPage *_page );
323 ~KPrMoveByCmd();
324
325 virtual void execute();
326 virtual void unexecute();
327
328protected:
329
330 KoPoint diff;
331 TQPtrList<KPrObject> objects;
332 KPrDocument *doc;
333 KPrPage *m_page;
334};
335
339class KPrAlignCmd : public KNamedCommand
340{
341public:
342 KPrAlignCmd( const TQString &_name, TQPtrList<KPrObject> &_objects, AlignType _at, KPrDocument *_doc );
343 ~KPrAlignCmd();
344
345 virtual void execute();
346 virtual void unexecute();
347
348protected:
349 TQPtrList<KoPoint> diffs;
350 TQPtrList<KPrObject> objects;
351 KPrDocument *doc;
352 KPrPage *m_page;
353};
354
355class KoPenCmd : public KNamedCommand
356{
357public:
358 struct Pen {
359 Pen( KoPen p, LineEnd lb, LineEnd le )
360 : pen( p )
361 , lineBegin( lb )
362 , lineEnd( le )
363 {}
364
365 KoPen pen;
366 LineEnd lineBegin, lineEnd;
367
368 Pen &operator=( const Pen &_pen ) {
369 pen = _pen.pen;
370 lineBegin = _pen.lineBegin;
371 lineEnd = _pen.lineEnd;
372 return *this;
373 }
374 };
375
376 // the flags indicate what has changed
377 enum PenConfigChange {
378 BeginLine = 1,
379 EndLine = 2,
380 Color = 4,
381 Width = 8,
382 Style = 16,
383 All = BeginLine | EndLine | Color | Width | Style
384 };
385
386 KoPenCmd( const TQString &_name, TQPtrList<KPrObject> &_objects, Pen _newPen,
387 KPrDocument *_doc, KPrPage *_page, int _flags = All);
388 ~KoPenCmd();
389
390 virtual void execute();
391 virtual void unexecute();
392
393protected:
394 void addObjects( const TQPtrList<KPrObject> &_objects );
395 void applyPen( KPrObject *object, Pen *tmpPen );
396
397 KPrDocument *doc;
398 KPrPage *m_page;
399 TQPtrList<Pen> oldPen;
400 TQPtrList<KPrObject> objects;
401 Pen newPen;
402 int flags;
403};
404
405class KPrBrushCmd : public KNamedCommand
406{
407public:
408 struct Brush {
409 Brush() {}
410 Brush( TQBrush _brush, TQColor _gColor1, TQColor _gColor2,
411 BCType _gType, FillType _fillType, bool _unbalanced,
412 int _xfactor, int _yfactor )
413 : brush( _brush )
414 , gColor1( _gColor1 )
415 , gColor2( _gColor2 )
416 , gType( _gType )
417 , fillType( _fillType )
418 , unbalanced( _unbalanced )
419 , xfactor( _xfactor )
420 , yfactor( _yfactor )
421 {}
422
423 TQBrush brush;
424 TQColor gColor1;
425 TQColor gColor2;
426 BCType gType;
427 FillType fillType;
428 bool unbalanced;
429 int xfactor, yfactor;
430
431 Brush &operator=( const Brush &_brush ) {
432 brush = _brush.brush;
433 gColor1 = _brush.gColor1;
434 gColor2 = _brush.gColor2;
435 gType = _brush.gType;
436 fillType = _brush.fillType;
437 unbalanced = _brush.unbalanced;
438 xfactor = _brush.xfactor;
439 yfactor = _brush.yfactor;
440 return *this;
441 }
442 };
443
444 // the flags indicate what has changed
445 enum BrushConfigChange {
446 BrushColor = 1,
447 BrushStyle = 2,
448 BrushGradientSelect = 4,
449 GradientColor1 = 8,
450 GradientColor2 = 16,
451 GradientType = 32,
452 GradientBalanced = 64,
453 GradientXFactor = 128,
454 GradientYFactor = 256,
455 All = BrushColor | BrushStyle | BrushGradientSelect | GradientColor1 | GradientColor2 | GradientType | GradientBalanced | GradientXFactor | GradientYFactor
456 };
457
458 KPrBrushCmd( const TQString &_name, TQPtrList<KPrObject> &_objects, Brush _newBrush,
459 KPrDocument *_doc, KPrPage *_page, int _flags = All );
460 ~KPrBrushCmd();
461
462 virtual void execute();
463 virtual void unexecute();
464
465protected:
466 void addObjects( const TQPtrList<KPrObject> &_objects );
467 void applyBrush( KPr2DObject *object, Brush *tmpBrush );
468
469 KPrDocument *doc;
470 TQPtrList<Brush> oldBrush;
471 TQPtrList<KPr2DObject> objects;
472 Brush newBrush;
473 KPrPage *m_page;
474 int flags;
475};
476
477class KPrPgConfCmd : public KNamedCommand
478{
479public:
480 KPrPgConfCmd( const TQString &_name, bool _manualSwitch, bool _infiniteLoop,
481 bool _showEndOfPresentationSlide, bool _showPresentationDuration, TQPen _pen,
482 TQValueList<bool> _selectedSlides, const TQString & _presentationName,
483 bool _oldManualSwitch, bool _oldInfiniteLoop,
484 bool _oldShowEndOfPresentationSlide, bool _oldShowPresentationDuration, TQPen _oldPen,
485 TQValueList<bool> _oldSelectedSlides, const TQString & _oldPresentationName,
486 KPrDocument *_doc );
487
488 virtual void execute();
489 virtual void unexecute();
490
491protected:
492 bool manualSwitch, oldManualSwitch;
493 bool infiniteLoop, oldInfiniteLoop;
494 bool showEndOfPresentationSlide, oldShowEndOfPresentationSlide;
495 bool showPresentationDuration, oldShowPresentationDuration;
496 TQPen pen, oldPen;
497 TQValueList<bool> selectedSlides, oldSelectedSlides;
498 TQString oldPresentationName, presentationName;
499
500 KPrDocument *doc;
501};
502
503class KPrTransEffectCmd : public KCommand
504{
505public:
506 struct PageEffectSettings {
507 PageEffect pageEffect;
508 EffectSpeed effectSpeed;
509 bool soundEffect;
510 TQString soundFileName;
511 bool autoAdvance;
512 int slideTime;
513 void applyTo( KPrPage * );
514 };
515 // TODO also pass a flag to know which settings need to be applied (especially for "all pages")
516 KPrTransEffectCmd( TQValueVector<PageEffectSettings> oldSettings,
517 PageEffectSettings newSettings,
518 KPrPage* page, KPrDocument* doc );
519
520 virtual void execute();
521 virtual void unexecute();
522 virtual TQString name() const;
523
524private:
525 void exec( KPrPage* page );
526 void unexec( KPrPage* page );
527
528 TQValueVector<PageEffectSettings> m_oldSettings;
529 PageEffectSettings m_newSettings;
530 KPrPage *m_page;
531 KPrDocument *m_doc;
532};
533
534class KPrPgLayoutCmd : public KNamedCommand
535{
536public:
537 KPrPgLayoutCmd( const TQString &_name, KoPageLayout _layout, KoPageLayout _oldLayout,
538 KoUnit::Unit _oldUnit, KoUnit::Unit _unit,KPrDocument *_doc );
539
540 virtual void execute();
541 virtual void unexecute();
542
543protected:
544 KPrDocument *m_doc;
545 KoPageLayout layout, oldLayout;
546 KoUnit::Unit unit, oldUnit;
547};
548
549class KPrPieValueCmd : public KNamedCommand
550{
551public:
552 struct PieValues
553 {
554 PieType pieType;
555 int pieAngle, pieLength;
556 };
557
558 // the flags indicate what has changed
559 enum PieConfigChange {
560 Type = 1,
561 Angle = 2,
562 Length = 4,
563 All = Type | Angle | Length
564 };
565
566 KPrPieValueCmd( const TQString &name, PieValues newValues,
567 TQPtrList<KPrObject> &objects, KPrDocument *doc,
568 KPrPage *page, int flags = All );
569 KPrPieValueCmd( const TQString &_name, TQPtrList<PieValues> &_oldValues, PieValues _newValues,
570 TQPtrList<KPrObject> &_objects, KPrDocument *_doc, KPrPage *_page, int _flags = All );
571 ~KPrPieValueCmd();
572
573 virtual void execute();
574 virtual void unexecute();
575
576protected:
577 void addObjects( const TQPtrList<KPrObject> &objects );
578
579 KPrDocument *m_doc;
580 KPrPage *m_page;
581 TQPtrList<PieValues> m_oldValues;
582 TQPtrList<KPrObject> m_objects;
583 PieValues m_newValues;
584 int m_flags;
585};
586
587class KPrPolygonSettingCmd : public KNamedCommand
588{
589public:
590 struct PolygonSettings
591 {
592 bool checkConcavePolygon;
593 int cornersValue;
594 int sharpnessValue;
595 };
596
597 // the flags indicate what has changed
598 enum PolygonConfigChange {
599 ConcaveConvex = 1,
600 Corners = 2,
601 Sharpness = 4,
602 All = ConcaveConvex | Corners | Sharpness
603 };
604
605 KPrPolygonSettingCmd( const TQString &name, PolygonSettings newSettings,
606 TQPtrList<KPrObject> &objects, KPrDocument *doc,
607 KPrPage *page, int flags = All );
608 ~KPrPolygonSettingCmd();
609
610 virtual void execute();
611 virtual void unexecute();
612
613protected:
614 void addObjects( const TQPtrList<KPrObject> &objects );
615
616 KPrDocument *m_doc;
617 KPrPage *m_page;
618 TQPtrList<PolygonSettings> m_oldSettings;
619 TQPtrList<KPrObject> m_objects;
620 PolygonSettings m_newSettings;
621 int m_flags;
622};
623
624class KPrPictureSettingCmd : public KNamedCommand
625{
626public:
627 struct PictureSettings
628 {
629 PictureMirrorType mirrorType;
630 int depth;
631 bool swapRGB;
632 bool grayscal;
633 int bright;
634 };
635
636 enum PictureConfigChange {
637 MirrorType = 1,
638 Depth = 2,
639 SwapRGB = 4,
640 Grayscal = 8,
641 Bright = 16,
642 All = MirrorType | Depth | SwapRGB | Grayscal | Bright
643 };
644
645 KPrPictureSettingCmd( const TQString &name, PictureSettings newSettings,
646 TQPtrList<KPrObject> &objects, KPrDocument *doc,
647 KPrPage *page, int flags = All );
648 KPrPictureSettingCmd( const TQString &_name, TQPtrList<PictureSettings> &_oldSettings,
649 PictureSettings _newSettings, TQPtrList<KPrObject> &_objects,
650 KPrDocument *_doc, int flags = All );
651 ~KPrPictureSettingCmd();
652
653 virtual void execute();
654 virtual void unexecute();
655
656protected:
657 void addObjects( const TQPtrList<KPrObject> &_objects );
658
659 KPrDocument *m_doc;
660 TQPtrList<PictureSettings> m_oldValues;
661 TQPtrList<KPrObject> m_objects;
662 PictureSettings m_newSettings;
663 KPrPage *m_page;
664 int m_flags;
665};
666
667class KPrImageEffectCmd : public KNamedCommand
668{
669public:
670 struct ImageEffectSettings
671 {
672 ImageEffect effect;
673 TQVariant param1;
674 TQVariant param2;
675 TQVariant param3;
676 };
677
678 KPrImageEffectCmd(const TQString &_name, TQPtrList<ImageEffectSettings> &_oldSettings,
679 ImageEffectSettings _newSettings, TQPtrList<KPrObject> &_objects,
680 KPrDocument *_doc );
681 ~KPrImageEffectCmd();
682
683 virtual void execute();
684 virtual void unexecute();
685
686protected:
687 KPrDocument *doc;
688 TQPtrList<ImageEffectSettings> oldSettings;
689 TQPtrList<KPrObject> objects;
690 ImageEffectSettings newSettings;
691 KPrPage *m_page;
692
693};
694
695class KPrRectValueCmd : public KNamedCommand
696{
697public:
698 struct RectValues
699 {
700 int xRnd, yRnd;
701 };
702
703 // the flags indicate what has changed
704 enum RectangleConfigChange {
705 XRnd = 1,
706 YRnd = 2,
707 All = XRnd | YRnd
708 };
709
710 KPrRectValueCmd( const TQString &_name, TQPtrList<RectValues> &_oldValues, RectValues _newValues,
711 TQPtrList<KPrObject> &_objects, KPrDocument *_doc, KPrPage *_page, int _flags = All );
712 KPrRectValueCmd( const TQString &_name, TQPtrList<KPrObject> &_objects, RectValues _newValues,
713 KPrDocument *_doc, KPrPage *_page, int _flags = All );
714 ~KPrRectValueCmd();
715
716 virtual void execute();
717 virtual void unexecute();
718
719protected:
720 void addObjects( const TQPtrList<KPrObject> &_objects );
721
722 KPrDocument *m_doc;
723 KPrPage *m_page;
724 TQPtrList<RectValues> m_oldValues;
725 TQPtrList<KPrObject> m_objects;
726 RectValues m_newValues;
727 int m_flags;
728};
729
730class KPrDeletePageCmd : public KNamedCommand
731{
732public:
733 KPrDeletePageCmd( const TQString &name, int pageNum, KPrDocument *doc );
734 ~KPrDeletePageCmd();
735
736 virtual void execute();
737 virtual void unexecute();
738
739protected:
740 KPrDocument *m_doc;
741 KPrPage *m_page;
742 int m_pageNum;
743};
744
745class KPrInsertPageCmd : public KNamedCommand
746{
747public:
748 KPrInsertPageCmd( const TQString &name, int currentPageNum, InsertPos pos,
749 KPrPage *page, KPrDocument *doc );
750 ~KPrInsertPageCmd();
751
752 virtual void execute();
753 virtual void unexecute();
754protected:
755 KPrDocument *m_doc;
756 KPrPage *m_page;
757 int m_currentPageNum;
758 int m_insertPageNum;
759};
760
761class KPrMovePageCmd : public KNamedCommand
762{
763public:
764 KPrMovePageCmd( const TQString &_name, int from,int to, KPrDocument *_doc );
765 ~KPrMovePageCmd();
766
767 virtual void execute();
768 virtual void unexecute();
769protected:
770 KPrDocument *m_doc;
771 int m_oldPosition;
772 int m_newPosition;
773};
774
778class KPrOasisPasteTextCommand : public KoTextDocCommand
779{
780public:
781 KPrOasisPasteTextCommand( KoTextDocument *d, int parag, int idx,
782 const TQByteArray &data );
783 KoTextCursor *execute( KoTextCursor *c );
784 KoTextCursor *unexecute( KoTextCursor *c );
785protected:
786 int m_parag;
787 int m_idx;
788 TQByteArray m_data;
789 // filled in by execute(), for unexecute()
790 int m_lastParag;
791 int m_lastIndex;
792 KoParagLayout* m_oldParagLayout;
793};
794
798class KPrChangeStartingPageCommand : public KNamedCommand
799{
800public:
801 KPrChangeStartingPageCommand( const TQString &name, KPrDocument *_doc,
802 int _oldStartingPage, int _newStartingPage);
803 ~KPrChangeStartingPageCommand(){}
804
805 void execute();
806 void unexecute();
807protected:
808 KPrDocument *m_doc;
809 int oldStartingPage;
810 int newStartingPage;
811};
812
816class KPrChangeVariableSettingsCommand : public KNamedCommand
817{
818public:
819 enum VariableProperties { VS_DISPLAYLINK, VS_UNDERLINELINK, VS_DISPLAYCOMMENT, VS_DISPLAYFIELDCODE};
820 KPrChangeVariableSettingsCommand( const TQString &name, KPrDocument *_doc, bool _oldValue,
821 bool _newValue, VariableProperties _type);
822 ~KPrChangeVariableSettingsCommand(){}
823
824 void execute();
825 void unexecute();
826protected:
827 void changeValue( bool b );
828 KPrDocument *m_doc;
829 VariableProperties type;
830 bool m_bOldValue;
831 bool m_bNewValue;
832};
833
837class KPrChangeTitlePageNameCommand : public KNamedCommand
838{
839public:
840 KPrChangeTitlePageNameCommand( const TQString &name, KPrDocument *_doc, const TQString &_oldPageName,
841 const TQString &_newPageName, KPrPage *_page);
842 ~KPrChangeTitlePageNameCommand(){}
843
844 void execute();
845 void unexecute();
846protected:
847 KPrDocument *m_doc;
848 TQString oldPageName;
849 TQString newPageName;
850 KPrPage *m_page;
851};
852
853class KPrChangeCustomVariableValue : public KNamedCommand
854{
855public:
856 KPrChangeCustomVariableValue( const TQString &name, KPrDocument *_doc,const TQString & _oldValue,
857 const TQString & _newValue, KoCustomVariable *var);
858
859 void execute();
860 void unexecute();
861protected:
862 KPrDocument *m_doc;
863 TQString newValue;
864 TQString oldValue;
865 KoCustomVariable *m_var;
866};
867
868class KPrChangeLinkVariable : public KNamedCommand
869{
870public:
871 KPrChangeLinkVariable( const TQString &name, KPrDocument *_doc,const TQString & _oldHref,
872 const TQString & _newHref, const TQString & _oldLink,const TQString &_newLink, KoLinkVariable *var);
873 ~KPrChangeLinkVariable(){};
874 void execute();
875 void unexecute();
876protected:
877 KPrDocument *m_doc;
878 TQString oldHref;
879 TQString newHref;
880 TQString oldLink;
881 TQString newLink;
882 KoLinkVariable *m_var;
883};
884
885
886class KPrNameObjectCommand : public KNamedCommand
887{
888public:
889 KPrNameObjectCommand( const TQString &_name, const TQString &_objectName, KPrObject *_obj, KPrDocument *_doc );
890 ~KPrNameObjectCommand();
891 void execute();
892 void unexecute();
893protected:
894 TQString oldObjectName, newObjectName;
895 KPrObject *object;
896 KPrDocument *doc;
897 KPrPage *m_page;
898};
899
900class KPrDisplayObjectFromMasterPage : public KNamedCommand
901{
902public:
903 KPrDisplayObjectFromMasterPage( const TQString &name, KPrDocument *_doc, KPrPage *_page, bool _newValue);
904 ~KPrDisplayObjectFromMasterPage(){};
905 void execute();
906 void unexecute();
907protected:
908 KPrDocument *m_doc;
909 KPrPage *m_page;
910 bool newValue;
911};
912
913class KPrDisplayBackgroundPage : public KNamedCommand
914{
915public:
916 KPrDisplayBackgroundPage( const TQString &name, KPrDocument *_doc, KPrPage *_page, bool _newValue);
917 ~KPrDisplayBackgroundPage(){};
918 void execute();
919 void unexecute();
920protected:
921 KPrDocument *m_doc;
922 KPrPage *m_page;
923 bool newValue;
924};
925
926class KPrHideShowHeaderFooter : public KNamedCommand
927{
928public:
929 KPrHideShowHeaderFooter( const TQString &name, KPrDocument *_doc, KPrPage *_page, bool _newValue,KPrTextObject *_textObject);
930 ~KPrHideShowHeaderFooter(){};
931 void execute();
932 void unexecute();
933protected:
934 KPrDocument *m_doc;
935 KPrPage *m_page;
936 KPrTextObject *m_textObject;
937 bool newValue;
938};
939
940class KPrFlipObjectCommand : public KNamedCommand
941{
942public:
943 KPrFlipObjectCommand( const TQString &name, KPrDocument *_doc, bool _horizontal ,
944 TQPtrList<KPrObject> &_objects );
945 ~KPrFlipObjectCommand();
946 void execute();
947 void unexecute();
948protected:
949 void flipObjects();
950 KPrDocument *m_doc;
951 TQPtrList<KPrObject> objects;
952 bool horizontal;
953 KPrPage *m_page;
954};
955
956class KPrGeometryPropertiesCommand : public KNamedCommand
957{
958public:
959 enum KgpType { ProtectSize, KeepRatio};
960 KPrGeometryPropertiesCommand( const TQString &name, TQPtrList<KPrObject> &objects,
961 bool newValue, KgpType type, KPrDocument *_doc );
962 KPrGeometryPropertiesCommand( const TQString &name, TQValueList<bool> &lst, TQPtrList<KPrObject> &objects,
963 bool newValue, KgpType type, KPrDocument *_doc );
964 ~KPrGeometryPropertiesCommand();
965
966 virtual void execute();
967 virtual void unexecute();
968
969protected:
970 TQValueList<bool> m_oldValue;
971 TQPtrList<KPrObject> m_objects;
972 bool m_newValue;
973 KgpType m_type;
974 KPrDocument *m_doc;
975};
976
977class KPrProtectContentCommand : public KNamedCommand
978{
979public:
980 KPrProtectContentCommand( const TQString &name, TQPtrList<KPrObject> &objects,
981 bool protectContent, KPrDocument *doc );
982 KPrProtectContentCommand( const TQString &name, bool protectContent,
983 KPrTextObject *obj, KPrDocument *doc );
984
985 ~KPrProtectContentCommand();
986 virtual void execute();
987 virtual void unexecute();
988
989protected:
990 void addObjects( const TQPtrList<KPrObject> &objects );
991
992 TQPtrList<KPrTextObject> m_objects;
993 bool m_protectContent;
994 TQValueList<bool> m_oldValues;
995 KPrDocument *m_doc;
996};
997
998class KPrCloseObjectCommand : public KNamedCommand
999{
1000public:
1001 KPrCloseObjectCommand( const TQString &name, TQPtrList<KPrObject> objects, KPrDocument *doc );
1002
1003 ~KPrCloseObjectCommand();
1004 virtual void execute();
1005 virtual void unexecute();
1006
1007protected:
1008 void closeObject(bool close);
1009
1010 TQPtrList<KPrObject> m_openObjects;
1011 TQPtrList<KPrObject> m_closedObjects;
1012 KPrDocument * m_doc;
1013 KPrPage *m_page;
1014};
1015
1016struct MarginsStruct {
1017 MarginsStruct() {}
1018 MarginsStruct( KPrTextObject *obj );
1019 MarginsStruct( double _left, double top, double right, double bottom );
1020 double topMargin;
1021 double bottomMargin;
1022 double leftMargin;
1023 double rightMargin;
1024};
1025
1026class KPrChangeMarginCommand : public KNamedCommand
1027{
1028public:
1029 KPrChangeMarginCommand( const TQString &name, TQPtrList<KPrObject> &objects, MarginsStruct newMargins,
1030 KPrDocument *doc, KPrPage *page );
1031 ~KPrChangeMarginCommand();
1032
1033 virtual void execute();
1034 virtual void unexecute();
1035protected:
1036 void addObjects( const TQPtrList<KPrObject> &objects );
1037 TQPtrList<MarginsStruct> m_oldMargins;
1038 TQPtrList<KPrTextObject> m_objects;
1039 MarginsStruct m_newMargins;
1040 KPrPage *m_page;
1041 KPrDocument *m_doc;
1042};
1043
1044
1045class KPrChangeVerticalAlignmentCommand : public KNamedCommand
1046{
1047public:
1048 KPrChangeVerticalAlignmentCommand( const TQString &name, KPrTextObject *_obj, VerticalAlignmentType _oldAlign,
1049 VerticalAlignmentType _newAlign, KPrDocument *_doc);
1050 ~KPrChangeVerticalAlignmentCommand() {}
1051
1052 virtual void execute();
1053 virtual void unexecute();
1054protected:
1055 KPrTextObject *m_obj;
1056 VerticalAlignmentType m_oldAlign;
1057 VerticalAlignmentType m_newAlign;
1058 KPrPage *m_page;
1059 KPrDocument *m_doc;
1060};
1061
1062
1063class KPrChangeTabStopValueCommand : public KNamedCommand
1064{
1065public:
1066 KPrChangeTabStopValueCommand( const TQString &name, double _oldValue, double _newValue, KPrDocument *_doc);
1067
1068 ~KPrChangeTabStopValueCommand() {}
1069
1070 virtual void execute();
1071 virtual void unexecute();
1072protected:
1073 KPrDocument *m_doc;
1074 double m_oldValue;
1075 double m_newValue;
1076};
1077
1078class KPrChangeVariableNoteText : public KNamedCommand
1079{
1080 public:
1081 KPrChangeVariableNoteText( const TQString &name, KPrDocument *_doc, const TQString &_oldValue,const TQString &_newValue, KoNoteVariable *var);
1082 ~KPrChangeVariableNoteText();
1083 void execute();
1084 void unexecute();
1085 protected:
1086 KPrDocument *m_doc;
1087 TQString newValue;
1088 TQString oldValue;
1089 KoNoteVariable *m_var;
1090};
1091
1092
1093#endif
"current page number" and "number of pages" variables