kpresenter

KPrCommand.h

00001 // -*- Mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4; -*-
00002 /* This file is part of the KDE project
00003    Copyright (C) 2001 Laurent Montel <lmontel@mandrakesoft.com>
00004    Copyright (C) 2005 Thorsten Zachmann <zachmann@kde.org>
00005 
00006    This library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Library General Public
00008    License as published by the Free Software Foundation; either
00009    version 2 of the License, or (at your option) any later version.
00010 
00011    This library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Library General Public License for more details.
00015 
00016    You should have received a copy of the GNU Library General Public License
00017    along with this library; see the file COPYING.LIB.  If not, write to
00018    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019  * Boston, MA 02110-1301, USA.
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     //necessary for duplicate object, we can duplicated and add angle.
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     // the flags indicate what has changed
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     // the flags indicate what has changed
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 _showEndOfPresentationSlide, bool _showPresentationDuration, QPen _pen,
00483                QValueList<bool> _selectedSlides, const QString & _presentationName,
00484                bool _oldManualSwitch, bool _oldInfiniteLoop,
00485                bool _oldShowEndOfPresentationSlide, 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 showEndOfPresentationSlide, oldShowEndOfPresentationSlide;
00496     bool showPresentationDuration, oldShowPresentationDuration;
00497     QPen pen, oldPen;
00498     QValueList<bool> selectedSlides, oldSelectedSlides;
00499     QString oldPresentationName, presentationName;
00500 
00501     KPrDocument *doc;
00502 };
00503 
00504 class KPrTransEffectCmd : public KCommand
00505 {
00506 public:
00507     struct PageEffectSettings {
00508         PageEffect pageEffect;
00509         EffectSpeed effectSpeed;
00510         bool soundEffect;
00511         QString soundFileName;
00512         bool autoAdvance;
00513         int slideTime;
00514         void applyTo( KPrPage * );
00515     };
00516     // TODO also pass a flag to know which settings need to be applied (especially for "all pages")
00517     KPrTransEffectCmd( QValueVector<PageEffectSettings> oldSettings,
00518                     PageEffectSettings newSettings,
00519                     KPrPage* page, KPrDocument* doc );
00520 
00521     virtual void execute();
00522     virtual void unexecute();
00523     virtual QString name() const;
00524 
00525 private:
00526     void exec( KPrPage* page );
00527     void unexec( KPrPage* page );
00528 
00529     QValueVector<PageEffectSettings> m_oldSettings;
00530     PageEffectSettings m_newSettings;
00531     KPrPage *m_page;
00532     KPrDocument *m_doc;
00533 };
00534 
00535 class KPrPgLayoutCmd : public KNamedCommand
00536 {
00537 public:
00538     KPrPgLayoutCmd( const QString &_name, KoPageLayout _layout, KoPageLayout _oldLayout,
00539                  KoUnit::Unit _oldUnit, KoUnit::Unit _unit,KPrDocument *_doc );
00540 
00541     virtual void execute();
00542     virtual void unexecute();
00543 
00544 protected:
00545     KPrDocument *m_doc;
00546     KoPageLayout layout, oldLayout;
00547     KoUnit::Unit unit, oldUnit;
00548 };
00549 
00550 class KPrPieValueCmd : public KNamedCommand
00551 {
00552 public:
00553     struct PieValues
00554     {
00555         PieType pieType;
00556         int pieAngle, pieLength;
00557     };
00558 
00559     // the flags indicate what has changed
00560     enum PieConfigChange {
00561         Type = 1,
00562         Angle = 2,
00563         Length = 4,
00564         All = Type | Angle | Length
00565     };
00566 
00567     KPrPieValueCmd( const QString &name, PieValues newValues,
00568                  QPtrList<KPrObject> &objects, KPrDocument *doc,
00569                  KPrPage *page, int flags = All );
00570     KPrPieValueCmd( const QString &_name, QPtrList<PieValues> &_oldValues, PieValues _newValues,
00571                  QPtrList<KPrObject> &_objects, KPrDocument *_doc, KPrPage *_page, int _flags = All );
00572     ~KPrPieValueCmd();
00573 
00574     virtual void execute();
00575     virtual void unexecute();
00576 
00577 protected:
00578     void addObjects( const QPtrList<KPrObject> &objects );
00579 
00580     KPrDocument *m_doc;
00581     KPrPage *m_page;
00582     QPtrList<PieValues> m_oldValues;
00583     QPtrList<KPrObject> m_objects;
00584     PieValues m_newValues;
00585     int m_flags;
00586 };
00587 
00588 class KPrPolygonSettingCmd : public KNamedCommand
00589 {
00590 public:
00591     struct PolygonSettings
00592     {
00593         bool checkConcavePolygon;
00594         int cornersValue;
00595         int sharpnessValue;
00596     };
00597 
00598     // the flags indicate what has changed
00599     enum PolygonConfigChange {
00600         ConcaveConvex = 1,
00601         Corners = 2,
00602         Sharpness = 4,
00603         All = ConcaveConvex | Corners | Sharpness
00604     };
00605 
00606     KPrPolygonSettingCmd( const QString &name, PolygonSettings newSettings,
00607                           QPtrList<KPrObject> &objects, KPrDocument *doc,
00608                           KPrPage *page, int flags = All );
00609     ~KPrPolygonSettingCmd();
00610 
00611     virtual void execute();
00612     virtual void unexecute();
00613 
00614 protected:
00615     void addObjects( const QPtrList<KPrObject> &objects );
00616 
00617     KPrDocument *m_doc;
00618     KPrPage *m_page;
00619     QPtrList<PolygonSettings> m_oldSettings;
00620     QPtrList<KPrObject> m_objects;
00621     PolygonSettings m_newSettings;
00622     int m_flags;
00623 };
00624 
00625 class KPrPictureSettingCmd : public KNamedCommand
00626 {
00627 public:
00628     struct PictureSettings
00629     {
00630         PictureMirrorType mirrorType;
00631         int depth;
00632         bool swapRGB;
00633         bool grayscal;
00634         int bright;
00635     };
00636 
00637     enum PictureConfigChange {
00638         MirrorType = 1,
00639         Depth = 2,
00640         SwapRGB = 4,
00641         Grayscal = 8,
00642         Bright = 16,
00643         All = MirrorType | Depth | SwapRGB | Grayscal | Bright
00644     };
00645 
00646     KPrPictureSettingCmd( const QString &name, PictureSettings newSettings,
00647                        QPtrList<KPrObject> &objects, KPrDocument *doc,
00648                        KPrPage *page, int flags = All );
00649     KPrPictureSettingCmd( const QString &_name, QPtrList<PictureSettings> &_oldSettings,
00650                        PictureSettings _newSettings, QPtrList<KPrObject> &_objects,
00651                        KPrDocument *_doc, int flags = All );
00652     ~KPrPictureSettingCmd();
00653 
00654     virtual void execute();
00655     virtual void unexecute();
00656 
00657 protected:
00658     void addObjects( const QPtrList<KPrObject> &_objects );
00659 
00660     KPrDocument *m_doc;
00661     QPtrList<PictureSettings> m_oldValues;
00662     QPtrList<KPrObject> m_objects;
00663     PictureSettings m_newSettings;
00664     KPrPage *m_page;
00665     int m_flags;
00666 };
00667 
00668 class KPrImageEffectCmd : public KNamedCommand
00669 {
00670 public:
00671     struct ImageEffectSettings
00672     {
00673         ImageEffect effect;
00674         QVariant param1;
00675         QVariant param2;
00676         QVariant param3;
00677     };
00678 
00679     KPrImageEffectCmd(const QString &_name, QPtrList<ImageEffectSettings> &_oldSettings,
00680                    ImageEffectSettings _newSettings, QPtrList<KPrObject> &_objects,
00681                    KPrDocument *_doc );
00682     ~KPrImageEffectCmd();
00683 
00684     virtual void execute();
00685     virtual void unexecute();
00686 
00687 protected:
00688     KPrDocument *doc;
00689     QPtrList<ImageEffectSettings> oldSettings;
00690     QPtrList<KPrObject> objects;
00691     ImageEffectSettings newSettings;
00692     KPrPage *m_page;
00693 
00694 };
00695 
00696 class KPrRectValueCmd : public KNamedCommand
00697 {
00698 public:
00699     struct RectValues
00700     {
00701         int xRnd, yRnd;
00702     };
00703 
00704     // the flags indicate what has changed
00705     enum RectangleConfigChange {
00706         XRnd = 1,
00707         YRnd = 2,
00708         All = XRnd | YRnd
00709     };
00710 
00711     KPrRectValueCmd( const QString &_name, QPtrList<RectValues> &_oldValues, RectValues _newValues,
00712                   QPtrList<KPrObject> &_objects, KPrDocument *_doc, KPrPage *_page, int _flags = All );
00713     KPrRectValueCmd( const QString &_name, QPtrList<KPrObject> &_objects, RectValues _newValues,
00714                   KPrDocument *_doc, KPrPage *_page, int _flags = All );
00715     ~KPrRectValueCmd();
00716 
00717     virtual void execute();
00718     virtual void unexecute();
00719 
00720 protected:
00721     void addObjects( const QPtrList<KPrObject> &_objects );
00722 
00723     KPrDocument *m_doc;
00724     KPrPage *m_page;
00725     QPtrList<RectValues> m_oldValues;
00726     QPtrList<KPrObject> m_objects;
00727     RectValues m_newValues;
00728     int m_flags;
00729 };
00730 
00731 class KPrDeletePageCmd : public KNamedCommand
00732 {
00733 public:
00734     KPrDeletePageCmd( const QString &name, int pageNum, KPrDocument *doc );
00735     ~KPrDeletePageCmd();
00736 
00737     virtual void execute();
00738     virtual void unexecute();
00739 
00740 protected:
00741     KPrDocument *m_doc;
00742     KPrPage *m_page;
00743     int m_pageNum;
00744 };
00745 
00746 class KPrInsertPageCmd : public KNamedCommand
00747 {
00748 public:
00749     KPrInsertPageCmd( const QString &name, int currentPageNum, InsertPos pos,
00750                       KPrPage *page, KPrDocument *doc );
00751     ~KPrInsertPageCmd();
00752 
00753     virtual void execute();
00754     virtual void unexecute();
00755 protected:
00756     KPrDocument *m_doc;
00757     KPrPage *m_page;
00758     int m_currentPageNum;
00759     int m_insertPageNum;
00760 };
00761 
00762 class KPrMovePageCmd : public KNamedCommand
00763 {
00764 public:
00765     KPrMovePageCmd( const QString &_name, int from,int to, KPrDocument *_doc );
00766     ~KPrMovePageCmd();
00767 
00768     virtual void execute();
00769     virtual void unexecute();
00770 protected:
00771     KPrDocument *m_doc;
00772     int m_oldPosition;
00773     int m_newPosition;
00774 };
00775 
00779 class KPrOasisPasteTextCommand : public KoTextDocCommand
00780 {
00781 public:
00782     KPrOasisPasteTextCommand( KoTextDocument *d, int parag, int idx,
00783                              const QByteArray &data );
00784     KoTextCursor *execute( KoTextCursor *c );
00785     KoTextCursor *unexecute( KoTextCursor *c );
00786 protected:
00787     int m_parag;
00788     int m_idx;
00789     QByteArray m_data;
00790     // filled in by execute(), for unexecute()
00791     int m_lastParag;
00792     int m_lastIndex;
00793     KoParagLayout* m_oldParagLayout;
00794 };
00795 
00799 class KPrChangeStartingPageCommand : public KNamedCommand
00800 {
00801 public:
00802     KPrChangeStartingPageCommand( const QString &name, KPrDocument *_doc,
00803                                   int _oldStartingPage, int _newStartingPage);
00804     ~KPrChangeStartingPageCommand(){}
00805 
00806     void execute();
00807     void unexecute();
00808 protected:
00809     KPrDocument *m_doc;
00810     int oldStartingPage;
00811     int newStartingPage;
00812 };
00813 
00817 class KPrChangeVariableSettingsCommand : public KNamedCommand
00818 {
00819 public:
00820     enum VariableProperties { VS_DISPLAYLINK, VS_UNDERLINELINK, VS_DISPLAYCOMMENT, VS_DISPLAYFIELDCODE};
00821     KPrChangeVariableSettingsCommand( const QString &name, KPrDocument *_doc, bool _oldValue,
00822                                       bool _newValue, VariableProperties _type);
00823     ~KPrChangeVariableSettingsCommand(){}
00824 
00825     void execute();
00826     void unexecute();
00827 protected:
00828     void changeValue( bool b );
00829     KPrDocument *m_doc;
00830     VariableProperties type;
00831     bool m_bOldValue;
00832     bool m_bNewValue;
00833 };
00834 
00838 class KPrChangeTitlePageNameCommand : public KNamedCommand
00839 {
00840 public:
00841     KPrChangeTitlePageNameCommand( const QString &name, KPrDocument *_doc, const QString &_oldPageName,
00842                                    const QString &_newPageName, KPrPage *_page);
00843     ~KPrChangeTitlePageNameCommand(){}
00844 
00845     void execute();
00846     void unexecute();
00847 protected:
00848     KPrDocument *m_doc;
00849     QString oldPageName;
00850     QString newPageName;
00851     KPrPage *m_page;
00852 };
00853 
00854 class KPrChangeCustomVariableValue : public KNamedCommand
00855 {
00856 public:
00857     KPrChangeCustomVariableValue( const QString &name, KPrDocument *_doc,const QString & _oldValue,
00858                                   const QString & _newValue, KoCustomVariable *var);
00859 
00860     void execute();
00861     void unexecute();
00862 protected:
00863     KPrDocument *m_doc;
00864     QString newValue;
00865     QString oldValue;
00866     KoCustomVariable *m_var;
00867 };
00868 
00869 class KPrChangeLinkVariable : public KNamedCommand
00870 {
00871 public:
00872     KPrChangeLinkVariable( const QString &name, KPrDocument *_doc,const QString & _oldHref,
00873                            const QString & _newHref, const QString & _oldLink,const QString &_newLink, KoLinkVariable *var);
00874     ~KPrChangeLinkVariable(){};
00875     void execute();
00876     void unexecute();
00877 protected:
00878     KPrDocument *m_doc;
00879     QString oldHref;
00880     QString newHref;
00881     QString oldLink;
00882     QString newLink;
00883     KoLinkVariable *m_var;
00884 };
00885 
00886 
00887 class KPrNameObjectCommand : public KNamedCommand
00888 {
00889 public:
00890     KPrNameObjectCommand( const QString &_name, const QString &_objectName, KPrObject *_obj, KPrDocument *_doc );
00891     ~KPrNameObjectCommand();
00892     void execute();
00893     void unexecute();
00894 protected:
00895     QString oldObjectName, newObjectName;
00896     KPrObject *object;
00897     KPrDocument *doc;
00898     KPrPage *m_page;
00899 };
00900 
00901 class KPrDisplayObjectFromMasterPage : public KNamedCommand
00902 {
00903 public:
00904     KPrDisplayObjectFromMasterPage( const QString &name, KPrDocument *_doc, KPrPage *_page, bool _newValue);
00905     ~KPrDisplayObjectFromMasterPage(){};
00906     void execute();
00907     void unexecute();
00908 protected:
00909     KPrDocument *m_doc;
00910     KPrPage *m_page;
00911     bool newValue;
00912 };
00913 
00914 class KPrDisplayBackgroundPage : public KNamedCommand
00915 {
00916 public:
00917     KPrDisplayBackgroundPage( const QString &name, KPrDocument *_doc, KPrPage *_page, bool _newValue);
00918     ~KPrDisplayBackgroundPage(){};
00919     void execute();
00920     void unexecute();
00921 protected:
00922     KPrDocument *m_doc;
00923     KPrPage *m_page;
00924     bool newValue;
00925 };
00926 
00927 class KPrHideShowHeaderFooter : public KNamedCommand
00928 {
00929 public:
00930     KPrHideShowHeaderFooter( const QString &name, KPrDocument *_doc, KPrPage *_page, bool _newValue,KPrTextObject *_textObject);
00931     ~KPrHideShowHeaderFooter(){};
00932     void execute();
00933     void unexecute();
00934 protected:
00935     KPrDocument *m_doc;
00936     KPrPage *m_page;
00937     KPrTextObject *m_textObject;
00938     bool newValue;
00939 };
00940 
00941 class KPrFlipObjectCommand : public KNamedCommand
00942 {
00943 public:
00944     KPrFlipObjectCommand( const QString &name, KPrDocument *_doc, bool _horizontal ,
00945                           QPtrList<KPrObject> &_objects );
00946     ~KPrFlipObjectCommand();
00947     void execute();
00948     void unexecute();
00949 protected:
00950     void flipObjects();
00951     KPrDocument *m_doc;
00952     QPtrList<KPrObject> objects;
00953     bool horizontal;
00954     KPrPage *m_page;
00955 };
00956 
00957 class KPrGeometryPropertiesCommand : public KNamedCommand
00958 {
00959 public:
00960     enum KgpType { ProtectSize, KeepRatio};
00961     KPrGeometryPropertiesCommand( const QString &name, QPtrList<KPrObject> &objects,
00962                                   bool newValue, KgpType type, KPrDocument *_doc );
00963     KPrGeometryPropertiesCommand( const QString &name, QValueList<bool> &lst, QPtrList<KPrObject> &objects,
00964                                   bool newValue, KgpType type, KPrDocument *_doc );
00965     ~KPrGeometryPropertiesCommand();
00966 
00967     virtual void execute();
00968     virtual void unexecute();
00969 
00970 protected:
00971     QValueList<bool> m_oldValue;
00972     QPtrList<KPrObject> m_objects;
00973     bool m_newValue;
00974     KgpType m_type;
00975     KPrDocument *m_doc;
00976 };
00977 
00978 class KPrProtectContentCommand : public KNamedCommand
00979 {
00980 public:
00981     KPrProtectContentCommand( const QString &name, QPtrList<KPrObject> &objects,
00982                               bool protectContent, KPrDocument *doc );
00983     KPrProtectContentCommand( const QString &name, bool protectContent,
00984                               KPrTextObject *obj, KPrDocument *doc );
00985 
00986     ~KPrProtectContentCommand();
00987     virtual void execute();
00988     virtual void unexecute();
00989 
00990 protected:
00991     void addObjects( const QPtrList<KPrObject> &objects );
00992 
00993     QPtrList<KPrTextObject> m_objects;
00994     bool m_protectContent;
00995     QValueList<bool> m_oldValues;
00996     KPrDocument *m_doc;
00997 };
00998 
00999 class KPrCloseObjectCommand : public KNamedCommand
01000 {
01001 public:
01002     KPrCloseObjectCommand( const QString &name, QPtrList<KPrObject> objects, KPrDocument *doc );
01003 
01004     ~KPrCloseObjectCommand();
01005     virtual void execute();
01006     virtual void unexecute();
01007 
01008 protected:
01009     void closeObject(bool close);
01010 
01011     QPtrList<KPrObject> m_openObjects;
01012     QPtrList<KPrObject> m_closedObjects;
01013     KPrDocument * m_doc;
01014     KPrPage *m_page;
01015 };
01016 
01017 struct MarginsStruct {
01018     MarginsStruct() {}
01019     MarginsStruct( KPrTextObject *obj );
01020     MarginsStruct( double _left, double top, double right, double bottom );
01021     double topMargin;
01022     double bottomMargin;
01023     double leftMargin;
01024     double rightMargin;
01025 };
01026 
01027 class KPrChangeMarginCommand : public KNamedCommand
01028 {
01029 public:
01030     KPrChangeMarginCommand( const QString &name, QPtrList<KPrObject> &objects, MarginsStruct newMargins,
01031                             KPrDocument *doc, KPrPage *page );
01032     ~KPrChangeMarginCommand();
01033 
01034     virtual void execute();
01035     virtual void unexecute();
01036 protected:
01037     void addObjects( const QPtrList<KPrObject> &objects );
01038     QPtrList<MarginsStruct> m_oldMargins;
01039     QPtrList<KPrTextObject> m_objects;
01040     MarginsStruct m_newMargins;
01041     KPrPage *m_page;
01042     KPrDocument *m_doc;
01043 };
01044 
01045 
01046 class KPrChangeVerticalAlignmentCommand : public KNamedCommand
01047 {
01048 public:
01049     KPrChangeVerticalAlignmentCommand( const QString &name, KPrTextObject *_obj, VerticalAlignmentType _oldAlign,
01050                                        VerticalAlignmentType _newAlign, KPrDocument *_doc);
01051     ~KPrChangeVerticalAlignmentCommand() {}
01052 
01053     virtual void execute();
01054     virtual void unexecute();
01055 protected:
01056     KPrTextObject *m_obj;
01057     VerticalAlignmentType m_oldAlign;
01058     VerticalAlignmentType m_newAlign;
01059     KPrPage *m_page;
01060     KPrDocument *m_doc;
01061 };
01062 
01063 
01064 class KPrChangeTabStopValueCommand : public KNamedCommand
01065 {
01066 public:
01067     KPrChangeTabStopValueCommand( const QString &name, double _oldValue, double _newValue, KPrDocument *_doc);
01068 
01069     ~KPrChangeTabStopValueCommand() {}
01070 
01071     virtual void execute();
01072     virtual void unexecute();
01073 protected:
01074     KPrDocument *m_doc;
01075     double m_oldValue;
01076     double m_newValue;
01077 };
01078 
01079 class KPrChangeVariableNoteText : public KNamedCommand
01080 {
01081  public:
01082     KPrChangeVariableNoteText( const QString &name, KPrDocument *_doc, const QString &_oldValue,const QString &_newValue, KoNoteVariable *var);
01083     ~KPrChangeVariableNoteText();
01084     void execute();
01085     void unexecute();
01086  protected:
01087     KPrDocument *m_doc;
01088     QString newValue;
01089     QString oldValue;
01090     KoNoteVariable *m_var;
01091 };
01092 
01093 
01094 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys