00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef kprcommand_h
00023 #define kprcommand_h
00024
00025 #include <kcommand.h>
00026 #include <qptrlist.h>
00027 #include <qpoint.h>
00028 #include <qcolor.h>
00029 #include <qsize.h>
00030 #include "global.h"
00031 #include <KoPictureCollection.h>
00032 #include <qvaluelist.h>
00033 #include <qpen.h>
00034 #include <qbrush.h>
00035 #include <KoPageLayoutDia.h>
00036 #include <KoParagLayout.h>
00037 #include <KoTextCommand.h>
00038 #include <KoPoint.h>
00039 #include <KoSize.h>
00040 #include <qvariant.h>
00041 #include <qvaluevector.h>
00042 #include "KPrBackground.h"
00043 #include "KPrVariableCollection.h"
00044 #include <KoPen.h>
00045
00046 class KPrDocument;
00047 class KPrTextObject;
00048 class KPrObject;
00049 class KPr2DObject;
00050 class KPrPixmapObject;
00051 class KPrGroupObject;
00052 class KPrView;
00053 class KoParagLayout;
00054 class KPrPage;
00055 class KoCustomVariable;
00056 class KoLinkVariable;
00057 class KPrPolylineObject;
00058 class KPrFieldVariable;
00059 class KPrTimeVariable;
00060 class KPrDateVariable;
00061 class KPrPgNumVariable;
00062
00063 class KPrShadowCmd : public KNamedCommand
00064 {
00065 public:
00066 struct ShadowValues
00067 {
00068 int shadowDistance;
00069 ShadowDirection shadowDirection;
00070 QColor shadowColor;
00071 };
00072
00073 KPrShadowCmd( const QString &_name, QPtrList<ShadowValues> &_oldShadow, ShadowValues _newShadow,
00074 QPtrList<KPrObject> &_objects, KPrDocument *_doc );
00075 ~KPrShadowCmd();
00076
00077 virtual void execute();
00078 virtual void unexecute();
00079
00080 protected:
00081 KPrDocument *doc;
00082 QPtrList<ShadowValues> oldShadow;
00083 QPtrList<KPrObject> objects;
00084 ShadowValues newShadow;
00085 KPrPage *m_page;
00086 };
00087
00088 class KPrSetOptionsCmd : public KNamedCommand
00089 {
00090 public:
00091 KPrSetOptionsCmd( const QString &_name, QValueList<KoPoint> &_diffs, QPtrList<KPrObject> &_objects,
00092 double _rastX, double _rastY, double _orastX, double _orastY,
00093 const QColor &_txtBackCol, const QColor &_otxtBackCol, KPrDocument *_doc );
00094 ~KPrSetOptionsCmd();
00095
00096 virtual void execute();
00097 virtual void unexecute();
00098
00099 protected:
00100
00101 QValueList<KoPoint> diffs;
00102 QPtrList<KPrObject> objects;
00103 double gridX;
00104 double gridY;
00105 double oldGridX;
00106 double oldGridY;
00107 KPrDocument *doc;
00108 QColor txtBackCol;
00109 QColor otxtBackCol;
00110 };
00111
00112 class KPrSetBackCmd : public KNamedCommand
00113 {
00114 public:
00115 KPrSetBackCmd( const QString &name, const KPrBackGround::Settings &settings,
00116 const KPrBackGround::Settings &oldSettings,
00117 bool useMasterBackground,
00118 bool takeGlobal, KPrDocument *doc, KPrPage *page );
00119
00120 virtual void execute();
00121 virtual void unexecute();
00122
00123 protected:
00124
00125 KPrBackGround::Settings m_settings;
00126 KPrBackGround::Settings m_oldSettings;
00127 bool m_useMasterBackground;
00128 bool m_oldUseMasterBackground;
00129 bool m_takeGlobal;
00130 KPrDocument *m_doc;
00131 KPrPage *m_page;
00132 };
00133
00134 class KPrRotateCmd : public KNamedCommand
00135 {
00136 public:
00137 struct RotateValues
00138 {
00139 float angle;
00140 };
00141
00142 KPrRotateCmd( const QString &_name, float newAngle, QPtrList<KPrObject> &objects,
00143 KPrDocument *doc, bool addAngle = false );
00144 ~KPrRotateCmd();
00145
00146 virtual void execute();
00147 virtual void unexecute();
00148
00149 protected:
00150 KPrDocument *m_doc;
00151 QPtrList<RotateValues> m_oldAngles;
00152 QPtrList<KPrObject> m_objects;
00153 float m_newAngle;
00154
00155 bool m_addAngle;
00156 KPrPage *m_page;
00157 };
00158
00159 class KPrResizeCmd : public KNamedCommand
00160 {
00161 public:
00162 KPrResizeCmd( const QString &_name, const KoPoint &_m_diff, const KoSize &_r_diff,
00163 KPrObject *_object, KPrDocument *_doc );
00164 ~KPrResizeCmd();
00165
00166 virtual void execute();
00167 virtual void unexecute();
00168
00169 protected:
00170
00171 KoPoint m_diff;
00172 KoSize r_diff;
00173 KPrObject *object;
00174 KPrDocument *doc;
00175 KPrPage *m_page;
00176 };
00177
00178 class KPrChgPixCmd : public KNamedCommand
00179 {
00180 public:
00181 KPrChgPixCmd( const QString &_name, KPrPixmapObject *_oldObject, KPrPixmapObject *_newObject,
00182 KPrDocument *_doc, KPrPage *_page );
00183 ~KPrChgPixCmd();
00184
00185 virtual void execute();
00186 virtual void unexecute();
00187
00188 protected:
00189
00190 KPrPixmapObject *oldObject, *newObject;
00191 KPrDocument *doc;
00192 KPrPage *m_page;
00193 };
00194
00195 class KPrDeleteCmd : public KNamedCommand
00196 {
00197 public:
00198 KPrDeleteCmd( const QString &_name, QPtrList<KPrObject> &_objects, KPrDocument *_doc,
00199 KPrPage *_page);
00200 ~KPrDeleteCmd();
00201
00202 virtual void execute();
00203 virtual void unexecute();
00204
00205 protected:
00206 QPtrList<KPrObject> m_oldObjectList;
00207 QPtrList<KPrObject> m_objectsToDelete;
00208 KPrDocument *m_doc;
00209 KPrPage *m_page;
00210 };
00211
00212 class KPrEffectCmd : public KNamedCommand
00213 {
00214 public:
00215 struct EffectStruct {
00216 int appearStep, disappearStep;
00217 Effect effect;
00218 Effect2 effect2;
00219 Effect3 effect3;
00220 EffectSpeed m_appearSpeed;
00221 EffectSpeed m_disappearSpeed;
00222 bool disappear;
00223 int appearTimer, disappearTimer;
00224 bool appearSoundEffect, disappearSoundEffect;
00225 QString a_fileName, d_fileName;
00226 };
00227
00228 KPrEffectCmd( const QString &_name, const QPtrList<KPrObject> &_objs,
00229 const QValueList<EffectStruct> &_oldEffects, EffectStruct _newEffect );
00230 ~KPrEffectCmd();
00231
00232 virtual void execute();
00233 virtual void unexecute();
00234
00235 protected:
00236
00237 QValueList<EffectStruct> oldEffects;
00238 EffectStruct newEffect;
00239 QPtrList<KPrObject> objs;
00240 };
00241
00242 class KPrGroupObjCmd : public KNamedCommand
00243 {
00244 public:
00245 KPrGroupObjCmd( const QString &_name,
00246 const QPtrList<KPrObject> &_objects,
00247 KPrDocument *_doc, KPrPage *_page );
00248 ~KPrGroupObjCmd();
00249
00250 virtual void execute();
00251 virtual void unexecute();
00252
00253 protected:
00254
00255 QPtrList<KPrObject> m_objectsToGroup;
00256 QPtrList<KPrObject> m_oldObjectList;
00257 KPrDocument *m_doc;
00258 KPrGroupObject *m_groupObject;
00259 KPrPage *m_page;
00260
00261 };
00262
00263 class UnGroupObjCmd : public KNamedCommand
00264 {
00265 public:
00266 UnGroupObjCmd( const QString &_name,
00267 KPrGroupObject *grpObj_,
00268 KPrDocument *_doc, KPrPage *_page );
00269 ~UnGroupObjCmd();
00270
00271 virtual void execute();
00272 virtual void unexecute();
00273
00274 protected:
00275
00276 QPtrList<KPrObject> m_groupedObjects;
00277 KPrGroupObject *m_groupObject;
00278 KPrDocument *m_doc;
00279 KPrPage *m_page;
00280 };
00281
00282
00283 class KPrInsertCmd : public KNamedCommand
00284 {
00285 public:
00286 KPrInsertCmd( const QString &name, const QValueList<KPrObject *> objects, KPrDocument *doc, KPrPage *page );
00287 KPrInsertCmd( const QString &name, KPrObject *object, KPrDocument *doc, KPrPage *page );
00288 ~KPrInsertCmd();
00289
00290 virtual void execute();
00291 virtual void unexecute();
00292
00293 protected:
00294 QValueList<KPrObject *> m_objects;
00295 KPrObject *m_object;
00296 KPrDocument *m_doc;
00297 KPrPage *m_page;
00298 };
00299
00300
00301 class KPrLowerRaiseCmd : public KNamedCommand
00302 {
00303 public:
00304 KPrLowerRaiseCmd( const QString &_name, const QPtrList<KPrObject>& _oldList,
00305 const QPtrList<KPrObject>& _newList,
00306 KPrDocument *_doc, KPrPage *_page );
00307 ~KPrLowerRaiseCmd();
00308
00309 virtual void execute();
00310 virtual void unexecute();
00311
00312 protected:
00313
00314 QPtrList<KPrObject> oldList, newList;
00315 KPrDocument *doc;
00316 KPrPage *m_page;
00317 };
00318
00319 class KPrMoveByCmd : public KNamedCommand
00320 {
00321 public:
00322 KPrMoveByCmd( const QString &_name, const KoPoint &_diff, QPtrList<KPrObject> &_objects,
00323 KPrDocument *_doc, KPrPage *_page );
00324 ~KPrMoveByCmd();
00325
00326 virtual void execute();
00327 virtual void unexecute();
00328
00329 protected:
00330
00331 KoPoint diff;
00332 QPtrList<KPrObject> objects;
00333 KPrDocument *doc;
00334 KPrPage *m_page;
00335 };
00336
00340 class KPrAlignCmd : public KNamedCommand
00341 {
00342 public:
00343 KPrAlignCmd( const QString &_name, QPtrList<KPrObject> &_objects, AlignType _at, KPrDocument *_doc );
00344 ~KPrAlignCmd();
00345
00346 virtual void execute();
00347 virtual void unexecute();
00348
00349 protected:
00350 QPtrList<KoPoint> diffs;
00351 QPtrList<KPrObject> objects;
00352 KPrDocument *doc;
00353 KPrPage *m_page;
00354 };
00355
00356 class KoPenCmd : public KNamedCommand
00357 {
00358 public:
00359 struct Pen {
00360 Pen( KoPen p, LineEnd lb, LineEnd le )
00361 : pen( p )
00362 , lineBegin( lb )
00363 , lineEnd( le )
00364 {}
00365
00366 KoPen pen;
00367 LineEnd lineBegin, lineEnd;
00368
00369 Pen &operator=( const Pen &_pen ) {
00370 pen = _pen.pen;
00371 lineBegin = _pen.lineBegin;
00372 lineEnd = _pen.lineEnd;
00373 return *this;
00374 }
00375 };
00376
00377
00378 enum PenConfigChange {
00379 LineBegin = 1,
00380 LineEnd = 2,
00381 Color = 4,
00382 Width = 8,
00383 Style = 16,
00384 All = LineBegin | LineEnd | Color | Width | Style
00385 };
00386
00387 KoPenCmd( const QString &_name, QPtrList<KPrObject> &_objects, Pen _newPen,
00388 KPrDocument *_doc, KPrPage *_page, int _flags = All);
00389 ~KoPenCmd();
00390
00391 virtual void execute();
00392 virtual void unexecute();
00393
00394 protected:
00395 void addObjects( const QPtrList<KPrObject> &_objects );
00396 void applyPen( KPrObject *object, Pen *tmpPen );
00397
00398 KPrDocument *doc;
00399 KPrPage *m_page;
00400 QPtrList<Pen> oldPen;
00401 QPtrList<KPrObject> objects;
00402 Pen newPen;
00403 int flags;
00404 };
00405
00406 class KPrBrushCmd : public KNamedCommand
00407 {
00408 public:
00409 struct Brush {
00410 Brush() {}
00411 Brush( QBrush _brush, QColor _gColor1, QColor _gColor2,
00412 BCType _gType, FillType _fillType, bool _unbalanced,
00413 int _xfactor, int _yfactor )
00414 : brush( _brush )
00415 , gColor1( _gColor1 )
00416 , gColor2( _gColor2 )
00417 , gType( _gType )
00418 , fillType( _fillType )
00419 , unbalanced( _unbalanced )
00420 , xfactor( _xfactor )
00421 , yfactor( _yfactor )
00422 {}
00423
00424 QBrush brush;
00425 QColor gColor1;
00426 QColor gColor2;
00427 BCType gType;
00428 FillType fillType;
00429 bool unbalanced;
00430 int xfactor, yfactor;
00431
00432 Brush &operator=( const Brush &_brush ) {
00433 brush = _brush.brush;
00434 gColor1 = _brush.gColor1;
00435 gColor2 = _brush.gColor2;
00436 gType = _brush.gType;
00437 fillType = _brush.fillType;
00438 unbalanced = _brush.unbalanced;
00439 xfactor = _brush.xfactor;
00440 yfactor = _brush.yfactor;
00441 return *this;
00442 }
00443 };
00444
00445
00446 enum BrushConfigChange {
00447 BrushColor = 1,
00448 BrushStyle = 2,
00449 BrushGradientSelect = 4,
00450 GradientColor1 = 8,
00451 GradientColor2 = 16,
00452 GradientType = 32,
00453 GradientBalanced = 64,
00454 GradientXFactor = 128,
00455 GradientYFactor = 256,
00456 All = BrushColor | BrushStyle | BrushGradientSelect | GradientColor1 | GradientColor2 | GradientType | GradientBalanced | GradientXFactor | GradientYFactor
00457 };
00458
00459 KPrBrushCmd( const QString &_name, QPtrList<KPrObject> &_objects, Brush _newBrush,
00460 KPrDocument *_doc, KPrPage *_page, int _flags = All );
00461 ~KPrBrushCmd();
00462
00463 virtual void execute();
00464 virtual void unexecute();
00465
00466 protected:
00467 void addObjects( const QPtrList<KPrObject> &_objects );
00468 void applyBrush( KPr2DObject *object, Brush *tmpBrush );
00469
00470 KPrDocument *doc;
00471 QPtrList<Brush> oldBrush;
00472 QPtrList<KPr2DObject> objects;
00473 Brush newBrush;
00474 KPrPage *m_page;
00475 int flags;
00476 };
00477
00478 class KPrPgConfCmd : public KNamedCommand
00479 {
00480 public:
00481 KPrPgConfCmd( const QString &_name, bool _manualSwitch, bool _infiniteLoop,
00482 bool _showPresentationDuration, QPen _pen,
00483 QValueList<bool> _selectedSlides, const QString & _presentationName,
00484 bool _oldManualSwitch, bool _oldInfiniteLoop,
00485 bool _oldShowPresentationDuration, QPen _oldPen,
00486 QValueList<bool> _oldSelectedSlides, const QString & _oldPresentationName,
00487 KPrDocument *_doc );
00488
00489 virtual void execute();
00490 virtual void unexecute();
00491
00492 protected:
00493 bool manualSwitch, oldManualSwitch;
00494 bool infiniteLoop, oldInfiniteLoop;
00495 bool showPresentationDuration, oldShowPresentationDuration;
00496 QPen pen, oldPen;
00497 QValueList<bool> selectedSlides, oldSelectedSlides;
00498 QString oldPresentationName, presentationName;
00499
00500 KPrDocument *doc;
00501 };
00502
00503 class KPrTransEffectCmd : public KCommand
00504 {
00505 public:
00506 struct PageEffectSettings {
00507 PageEffect pageEffect;
00508 EffectSpeed effectSpeed;
00509 bool soundEffect;
00510 QString soundFileName;
00511 bool autoAdvance;
00512 int slideTime;
00513 void applyTo( KPrPage * );
00514 };
00515
00516 KPrTransEffectCmd( QValueVector<PageEffectSettings> oldSettings,
00517 PageEffectSettings newSettings,
00518 KPrPage* page, KPrDocument* doc );
00519
00520 virtual void execute();
00521 virtual void unexecute();
00522 virtual QString name() const;
00523
00524 private:
00525 void exec( KPrPage* page );
00526 void unexec( KPrPage* page );
00527
00528 QValueVector<PageEffectSettings> m_oldSettings;
00529 PageEffectSettings m_newSettings;
00530 KPrPage *m_page;
00531 KPrDocument *m_doc;
00532 };
00533
00534 class KPrPgLayoutCmd : public KNamedCommand
00535 {
00536 public:
00537 KPrPgLayoutCmd( const QString &_name, KoPageLayout _layout, KoPageLayout _oldLayout,
00538 KoUnit::Unit _oldUnit, KoUnit::Unit _unit,KPrDocument *_doc );
00539
00540 virtual void execute();
00541 virtual void unexecute();
00542
00543 protected:
00544 KPrDocument *m_doc;
00545 KoPageLayout layout, oldLayout;
00546 KoUnit::Unit unit, oldUnit;
00547 };
00548
00549 class KPrPieValueCmd : public KNamedCommand
00550 {
00551 public:
00552 struct PieValues
00553 {
00554 PieType pieType;
00555 int pieAngle, pieLength;
00556 };
00557
00558
00559 enum PieConfigChange {
00560 Type = 1,
00561 Angle = 2,
00562 Length = 4,
00563 All = Type | Angle | Length
00564 };
00565
00566 KPrPieValueCmd( const QString &name, PieValues newValues,
00567 QPtrList<KPrObject> &objects, KPrDocument *doc,
00568 KPrPage *page, int flags = All );
00569 KPrPieValueCmd( const QString &_name, QPtrList<PieValues> &_oldValues, PieValues _newValues,
00570 QPtrList<KPrObject> &_objects, KPrDocument *_doc, KPrPage *_page, int _flags = All );
00571 ~KPrPieValueCmd();
00572
00573 virtual void execute();
00574 virtual void unexecute();
00575
00576 protected:
00577 void addObjects( const QPtrList<KPrObject> &objects );
00578
00579 KPrDocument *m_doc;
00580 KPrPage *m_page;
00581 QPtrList<PieValues> m_oldValues;
00582 QPtrList<KPrObject> m_objects;
00583 PieValues m_newValues;
00584 int m_flags;
00585 };
00586
00587 class KPrPolygonSettingCmd : public KNamedCommand
00588 {
00589 public:
00590 struct PolygonSettings
00591 {
00592 bool checkConcavePolygon;
00593 int cornersValue;
00594 int sharpnessValue;
00595 };
00596
00597
00598 enum PolygonConfigChange {
00599 ConcaveConvex = 1,
00600 Corners = 2,
00601 Sharpness = 4,
00602 All = ConcaveConvex | Corners | Sharpness
00603 };
00604
00605 KPrPolygonSettingCmd( const QString &name, PolygonSettings newSettings,
00606 QPtrList<KPrObject> &objects, KPrDocument *doc,
00607 KPrPage *page, int flags = All );
00608 ~KPrPolygonSettingCmd();
00609
00610 virtual void execute();
00611 virtual void unexecute();
00612
00613 protected:
00614 void addObjects( const QPtrList<KPrObject> &objects );
00615
00616 KPrDocument *m_doc;
00617 KPrPage *m_page;
00618 QPtrList<PolygonSettings> m_oldSettings;
00619 QPtrList<KPrObject> m_objects;
00620 PolygonSettings m_newSettings;
00621 int m_flags;
00622 };
00623
00624 class KPrPictureSettingCmd : public KNamedCommand
00625 {
00626 public:
00627 struct PictureSettings
00628 {
00629 PictureMirrorType mirrorType;
00630 int depth;
00631 bool swapRGB;
00632 bool grayscal;
00633 int bright;
00634 };
00635
00636 enum PictureConfigChange {
00637 MirrorType = 1,
00638 Depth = 2,
00639 SwapRGB = 4,
00640 Grayscal = 8,
00641 Bright = 16,
00642 All = MirrorType | Depth | SwapRGB | Grayscal | Bright
00643 };
00644
00645 KPrPictureSettingCmd( const QString &name, PictureSettings newSettings,
00646 QPtrList<KPrObject> &objects, KPrDocument *doc,
00647 KPrPage *page, int flags = All );
00648 KPrPictureSettingCmd( const QString &_name, QPtrList<PictureSettings> &_oldSettings,
00649 PictureSettings _newSettings, QPtrList<KPrObject> &_objects,
00650 KPrDocument *_doc, int flags = All );
00651 ~KPrPictureSettingCmd();
00652
00653 virtual void execute();
00654 virtual void unexecute();
00655
00656 protected:
00657 void addObjects( const QPtrList<KPrObject> &_objects );
00658
00659 KPrDocument *m_doc;
00660 QPtrList<PictureSettings> m_oldValues;
00661 QPtrList<KPrObject> m_objects;
00662 PictureSettings m_newSettings;
00663 KPrPage *m_page;
00664 int m_flags;
00665 };
00666
00667 class KPrImageEffectCmd : public KNamedCommand
00668 {
00669 public:
00670 struct ImageEffectSettings
00671 {
00672 ImageEffect effect;
00673 QVariant param1;
00674 QVariant param2;
00675 QVariant param3;
00676 };
00677
00678 KPrImageEffectCmd(const QString &_name, QPtrList<ImageEffectSettings> &_oldSettings,
00679 ImageEffectSettings _newSettings, QPtrList<KPrObject> &_objects,
00680 KPrDocument *_doc );
00681 ~KPrImageEffectCmd();
00682
00683 virtual void execute();
00684 virtual void unexecute();
00685
00686 protected:
00687 KPrDocument *doc;
00688 QPtrList<ImageEffectSettings> oldSettings;
00689 QPtrList<KPrObject> objects;
00690 ImageEffectSettings newSettings;
00691 KPrPage *m_page;
00692
00693 };
00694
00695 class KPrRectValueCmd : public KNamedCommand
00696 {
00697 public:
00698 struct RectValues
00699 {
00700 int xRnd, yRnd;
00701 };
00702
00703
00704 enum RectangleConfigChange {
00705 XRnd = 1,
00706 YRnd = 2,
00707 All = XRnd | YRnd
00708 };
00709
00710 KPrRectValueCmd( const QString &_name, QPtrList<RectValues> &_oldValues, RectValues _newValues,
00711 QPtrList<KPrObject> &_objects, KPrDocument *_doc, KPrPage *_page, int _flags = All );
00712 KPrRectValueCmd( const QString &_name, QPtrList<KPrObject> &_objects, RectValues _newValues,
00713 KPrDocument *_doc, KPrPage *_page, int _flags = All );
00714 ~KPrRectValueCmd();
00715
00716 virtual void execute();
00717 virtual void unexecute();
00718
00719 protected:
00720 void addObjects( const QPtrList<KPrObject> &_objects );
00721
00722 KPrDocument *m_doc;
00723 KPrPage *m_page;
00724 QPtrList<RectValues> m_oldValues;
00725 QPtrList<KPrObject> m_objects;
00726 RectValues m_newValues;
00727 int m_flags;
00728 };
00729
00730 class KPrDeletePageCmd : public KNamedCommand
00731 {
00732 public:
00733 KPrDeletePageCmd( const QString &name, int pageNum, KPrDocument *doc );
00734 ~KPrDeletePageCmd();
00735
00736 virtual void execute();
00737 virtual void unexecute();
00738
00739 protected:
00740 KPrDocument *m_doc;
00741 KPrPage *m_page;
00742 int m_pageNum;
00743 };
00744
00745 class KPrInsertPageCmd : public KNamedCommand
00746 {
00747 public:
00748 KPrInsertPageCmd( const QString &name, int currentPageNum, InsertPos pos,
00749 KPrPage *page, KPrDocument *doc );
00750 ~KPrInsertPageCmd();
00751
00752 virtual void execute();
00753 virtual void unexecute();
00754 protected:
00755 KPrDocument *m_doc;
00756 KPrPage *m_page;
00757 int m_currentPageNum;
00758 int m_insertPageNum;
00759 };
00760
00761 class KPrMovePageCmd : public KNamedCommand
00762 {
00763 public:
00764 KPrMovePageCmd( const QString &_name, int from,int to, KPrDocument *_doc );
00765 ~KPrMovePageCmd();
00766
00767 virtual void execute();
00768 virtual void unexecute();
00769 protected:
00770 KPrDocument *m_doc;
00771 int m_oldPosition;
00772 int m_newPosition;
00773 };
00774
00778 class KPrOasisPasteTextCommand : public KoTextDocCommand
00779 {
00780 public:
00781 KPrOasisPasteTextCommand( KoTextDocument *d, int parag, int idx,
00782 const QByteArray &data );
00783 KoTextCursor *execute( KoTextCursor *c );
00784 KoTextCursor *unexecute( KoTextCursor *c );
00785 protected:
00786 int m_parag;
00787 int m_idx;
00788 QByteArray m_data;
00789
00790 int m_lastParag;
00791 int m_lastIndex;
00792 KoParagLayout* m_oldParagLayout;
00793 };
00794
00798 class KPrChangeStartingPageCommand : public KNamedCommand
00799 {
00800 public:
00801 KPrChangeStartingPageCommand( const QString &name, KPrDocument *_doc,
00802 int _oldStartingPage, int _newStartingPage);
00803 ~KPrChangeStartingPageCommand(){}
00804
00805 void execute();
00806 void unexecute();
00807 protected:
00808 KPrDocument *m_doc;
00809 int oldStartingPage;
00810 int newStartingPage;
00811 };
00812
00816 class KPrChangeVariableSettingsCommand : public KNamedCommand
00817 {
00818 public:
00819 enum VariableProperties { VS_DISPLAYLINK, VS_UNDERLINELINK, VS_DISPLAYCOMMENT, VS_DISPLAYFIELDCODE};
00820 KPrChangeVariableSettingsCommand( const QString &name, KPrDocument *_doc, bool _oldValue,
00821 bool _newValue, VariableProperties _type);
00822 ~KPrChangeVariableSettingsCommand(){}
00823
00824 void execute();
00825 void unexecute();
00826 protected:
00827 void changeValue( bool b );
00828 KPrDocument *m_doc;
00829 VariableProperties type;
00830 bool m_bOldValue;
00831 bool m_bNewValue;
00832 };
00833
00837 class KPrChangeTitlePageNameCommand : public KNamedCommand
00838 {
00839 public:
00840 KPrChangeTitlePageNameCommand( const QString &name, KPrDocument *_doc, const QString &_oldPageName,
00841 const QString &_newPageName, KPrPage *_page);
00842 ~KPrChangeTitlePageNameCommand(){}
00843
00844 void execute();
00845 void unexecute();
00846 protected:
00847 KPrDocument *m_doc;
00848 QString oldPageName;
00849 QString newPageName;
00850 KPrPage *m_page;
00851 };
00852
00853 class KPrChangeCustomVariableValue : public KNamedCommand
00854 {
00855 public:
00856 KPrChangeCustomVariableValue( const QString &name, KPrDocument *_doc,const QString & _oldValue,
00857 const QString & _newValue, KoCustomVariable *var);
00858
00859 void execute();
00860 void unexecute();
00861 protected:
00862 KPrDocument *m_doc;
00863 QString newValue;
00864 QString oldValue;
00865 KoCustomVariable *m_var;
00866 };
00867
00868 class KPrChangeLinkVariable : public KNamedCommand
00869 {
00870 public:
00871 KPrChangeLinkVariable( const QString &name, KPrDocument *_doc,const QString & _oldHref,
00872 const QString & _newHref, const QString & _oldLink,const QString &_newLink, KoLinkVariable *var);
00873 ~KPrChangeLinkVariable(){};
00874 void execute();
00875 void unexecute();
00876 protected:
00877 KPrDocument *m_doc;
00878 QString oldHref;
00879 QString newHref;
00880 QString oldLink;
00881 QString newLink;
00882 KoLinkVariable *m_var;
00883 };
00884
00885
00886 class KPrNameObjectCommand : public KNamedCommand
00887 {
00888 public:
00889 KPrNameObjectCommand( const QString &_name, const QString &_objectName, KPrObject *_obj, KPrDocument *_doc );
00890 ~KPrNameObjectCommand();
00891 void execute();
00892 void unexecute();
00893 protected:
00894 QString oldObjectName, newObjectName;
00895 KPrObject *object;
00896 KPrDocument *doc;
00897 KPrPage *m_page;
00898 };
00899
00900 class KPrDisplayObjectFromMasterPage : public KNamedCommand
00901 {
00902 public:
00903 KPrDisplayObjectFromMasterPage( const QString &name, KPrDocument *_doc, KPrPage *_page, bool _newValue);
00904 ~KPrDisplayObjectFromMasterPage(){};
00905 void execute();
00906 void unexecute();
00907 protected:
00908 KPrDocument *m_doc;
00909 KPrPage *m_page;
00910 bool newValue;
00911 };
00912
00913 class KPrDisplayBackgroundPage : public KNamedCommand
00914 {
00915 public:
00916 KPrDisplayBackgroundPage( const QString &name, KPrDocument *_doc, KPrPage *_page, bool _newValue);
00917 ~KPrDisplayBackgroundPage(){};
00918 void execute();
00919 void unexecute();
00920 protected:
00921 KPrDocument *m_doc;
00922 KPrPage *m_page;
00923 bool newValue;
00924 };
00925
00926 class KPrHideShowHeaderFooter : public KNamedCommand
00927 {
00928 public:
00929 KPrHideShowHeaderFooter( const QString &name, KPrDocument *_doc, KPrPage *_page, bool _newValue,KPrTextObject *_textObject);
00930 ~KPrHideShowHeaderFooter(){};
00931 void execute();
00932 void unexecute();
00933 protected:
00934 KPrDocument *m_doc;
00935 KPrPage *m_page;
00936 KPrTextObject *m_textObject;
00937 bool newValue;
00938 };
00939
00940 class KPrFlipObjectCommand : public KNamedCommand
00941 {
00942 public:
00943 KPrFlipObjectCommand( const QString &name, KPrDocument *_doc, bool _horizontal ,
00944 QPtrList<KPrObject> &_objects );
00945 ~KPrFlipObjectCommand();
00946 void execute();
00947 void unexecute();
00948 protected:
00949 void flipObjects();
00950 KPrDocument *m_doc;
00951 QPtrList<KPrObject> objects;
00952 bool horizontal;
00953 KPrPage *m_page;
00954 };
00955
00956 class KPrGeometryPropertiesCommand : public KNamedCommand
00957 {
00958 public:
00959 enum KgpType { ProtectSize, KeepRatio};
00960 KPrGeometryPropertiesCommand( const QString &name, QPtrList<KPrObject> &objects,
00961 bool newValue, KgpType type, KPrDocument *_doc );
00962 KPrGeometryPropertiesCommand( const QString &name, QValueList<bool> &lst, QPtrList<KPrObject> &objects,
00963 bool newValue, KgpType type, KPrDocument *_doc );
00964 ~KPrGeometryPropertiesCommand();
00965
00966 virtual void execute();
00967 virtual void unexecute();
00968
00969 protected:
00970 QValueList<bool> m_oldValue;
00971 QPtrList<KPrObject> m_objects;
00972 bool m_newValue;
00973 KgpType m_type;
00974 KPrDocument *m_doc;
00975 };
00976
00977 class KPrProtectContentCommand : public KNamedCommand
00978 {
00979 public:
00980 KPrProtectContentCommand( const QString &name, QPtrList<KPrObject> &objects,
00981 bool protectContent, KPrDocument *doc );
00982 KPrProtectContentCommand( const QString &name, bool protectContent,
00983 KPrTextObject *obj, KPrDocument *doc );
00984
00985 ~KPrProtectContentCommand();
00986 virtual void execute();
00987 virtual void unexecute();
00988
00989 protected:
00990 void addObjects( const QPtrList<KPrObject> &objects );
00991
00992 QPtrList<KPrTextObject> m_objects;
00993 bool m_protectContent;
00994 QValueList<bool> m_oldValues;
00995 KPrDocument *m_doc;
00996 };
00997
00998 class KPrCloseObjectCommand : public KNamedCommand
00999 {
01000 public:
01001 KPrCloseObjectCommand( const QString &name, QPtrList<KPrObject> objects, KPrDocument *doc );
01002
01003 ~KPrCloseObjectCommand();
01004 virtual void execute();
01005 virtual void unexecute();
01006
01007 protected:
01008 void closeObject(bool close);
01009
01010 QPtrList<KPrObject> m_openObjects;
01011 QPtrList<KPrObject> m_closedObjects;
01012 KPrDocument * m_doc;
01013 KPrPage *m_page;
01014 };
01015
01016 struct MarginsStruct {
01017 MarginsStruct() {}
01018 MarginsStruct( KPrTextObject *obj );
01019 MarginsStruct( double _left, double top, double right, double bottom );
01020 double topMargin;
01021 double bottomMargin;
01022 double leftMargin;
01023 double rightMargin;
01024 };
01025
01026 class KPrChangeMarginCommand : public KNamedCommand
01027 {
01028 public:
01029 KPrChangeMarginCommand( const QString &name, QPtrList<KPrObject> &objects, MarginsStruct newMargins,
01030 KPrDocument *doc, KPrPage *page );
01031 ~KPrChangeMarginCommand();
01032
01033 virtual void execute();
01034 virtual void unexecute();
01035 protected:
01036 void addObjects( const QPtrList<KPrObject> &objects );
01037 QPtrList<MarginsStruct> m_oldMargins;
01038 QPtrList<KPrTextObject> m_objects;
01039 MarginsStruct m_newMargins;
01040 KPrPage *m_page;
01041 KPrDocument *m_doc;
01042 };
01043
01044
01045 class KPrChangeVerticalAlignmentCommand : public KNamedCommand
01046 {
01047 public:
01048 KPrChangeVerticalAlignmentCommand( const QString &name, KPrTextObject *_obj, VerticalAlignmentType _oldAlign,
01049 VerticalAlignmentType _newAlign, KPrDocument *_doc);
01050 ~KPrChangeVerticalAlignmentCommand() {}
01051
01052 virtual void execute();
01053 virtual void unexecute();
01054 protected:
01055 KPrTextObject *m_obj;
01056 VerticalAlignmentType m_oldAlign;
01057 VerticalAlignmentType m_newAlign;
01058 KPrPage *m_page;
01059 KPrDocument *m_doc;
01060 };
01061
01062
01063 class KPrChangeTabStopValueCommand : public KNamedCommand
01064 {
01065 public:
01066 KPrChangeTabStopValueCommand( const QString &name, double _oldValue, double _newValue, KPrDocument *_doc);
01067
01068 ~KPrChangeTabStopValueCommand() {}
01069
01070 virtual void execute();
01071 virtual void unexecute();
01072 protected:
01073 KPrDocument *m_doc;
01074 double m_oldValue;
01075 double m_newValue;
01076 };
01077
01078 class KPrChangeVariableNoteText : public KNamedCommand
01079 {
01080 public:
01081 KPrChangeVariableNoteText( const QString &name, KPrDocument *_doc, const QString &_oldValue,const QString &_newValue, KoNoteVariable *var);
01082 ~KPrChangeVariableNoteText();
01083 void execute();
01084 void unexecute();
01085 protected:
01086 KPrDocument *m_doc;
01087 QString newValue;
01088 QString oldValue;
01089 KoNoteVariable *m_var;
01090 };
01091
01092
01093 #endif