F:/KPlato/koffice/libs/flake/KoCommand.h

Aller à la documentation de ce fichier.
00001 /* This file is part of the KDE project
00002  * Copyright (C) 2006 Thomas Zander <zander@kde.org>
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Library General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Library General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Library General Public License
00015  * along with this library; see the file COPYING.LIB.  If not, write to
00016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018  */
00019 
00020 #ifndef KOCommand_h
00021 #define KOCommand_h
00022 
00023 #include <kcommand.h>
00024 #include <koffice_export.h>
00025 
00026 #include <KoSelection.h>
00027 
00028 #include <QList>
00029 #include <QPointF>
00030 
00031 class KoShape;
00032 class KoShapeGroup;
00033 class KoShapeContainer;
00034 class KoShapeControllerBase;
00035 class QString;
00036 
00038 class FLAKE_EXPORT KoShapeMoveCommand : public KCommand {
00039 public:
00048     KoShapeMoveCommand(const KoSelectionSet &shapes, QList<QPointF> &previousPositions, QList<QPointF> &newPositions);
00057     KoShapeMoveCommand(const QList<KoShape*> &shapes, QList<QPointF> &previousPositions, QList<QPointF> &newPositions);
00059     void execute ();
00061     void unexecute ();
00063     QString name () const;
00064 
00066     void setNewPositions(QList<QPointF> newPositions) { m_newPositions = newPositions; }
00067 
00068 private:
00069     QList<KoShape*> m_shapes;
00070     QList<QPointF> m_previousPositions, m_newPositions;
00071 };
00072 
00074 class FLAKE_EXPORT KoShapeRotateCommand : public KCommand {
00075 public:
00084     KoShapeRotateCommand(const KoSelectionSet &shapes, QList<double> &previousAngles, QList<double> &newAngles);
00093     KoShapeRotateCommand(const QList<KoShape*> &shapes, QList<double> &previousAngles, QList<double> &newAngles);
00095     void execute ();
00097     void unexecute ();
00099     QString name () const;
00100 private:
00101     QList<KoShape*> m_shapes;
00102     QList<double> m_previousAngles, m_newAngles;
00103 };
00104 
00106 class FLAKE_EXPORT KoShapeShearCommand : public KCommand {
00107 public:
00119     KoShapeShearCommand(const KoSelectionSet &shapes, QList<double> &previousShearXs, QList<double> &previousShearYs, QList<double> &newShearXs, QList<double> &newShearYs);
00121     void execute ();
00123     void unexecute ();
00125     QString name () const;
00126 private:
00127     QList<KoShape*> m_shapes;
00128     QList<double> m_previousShearXs, m_previousShearYs, m_newShearXs, m_newShearYs;
00129 };
00130 
00132 class FLAKE_EXPORT KoShapeSizeCommand : public KCommand {
00133 public:
00140     KoShapeSizeCommand(const KoSelectionSet &shapes, QList<QSizeF> &previousSizes, QList<QSizeF> &newSizes);
00147     KoShapeSizeCommand(const QList<KoShape*> &shapes, QList<QSizeF> &previousSizes, QList<QSizeF> &newSizes);
00149     void execute ();
00151     void unexecute ();
00153     QString name () const;
00154 private:
00155     QList<KoShape*> m_shapes;
00156     QList<QSizeF> m_previousSizes, m_newSizes;
00157 };
00158 
00160 class FLAKE_EXPORT KoGroupShapesCommand : public KCommand {
00161 public:
00169     KoGroupShapesCommand(KoShapeContainer *container, QList<KoShape *> shapes, QList<bool> clipped);
00176     KoGroupShapesCommand(KoShapeGroup *container, QList<KoShape *> shapes);
00177     virtual ~KoGroupShapesCommand() { };
00179     virtual void execute ();
00181     virtual void unexecute ();
00183     virtual QString name () const;
00184 
00185 protected:
00186     KoGroupShapesCommand(); 
00187     QList<KoShape*> m_shapes; 
00188     QList<bool> m_clipped; 
00189     KoShapeContainer *m_container; 
00190     QList<KoShapeContainer*> m_oldParents; 
00191 };
00192 
00194 class FLAKE_EXPORT KoUngroupShapesCommand : public KoGroupShapesCommand {
00195 public:
00201     KoUngroupShapesCommand(KoShapeContainer *container, QList<KoShape *> shapes);
00203     void execute ();
00205     void unexecute ();
00207     QString name () const;
00208 };
00209 
00211 class FLAKE_EXPORT KoShapeCreateCommand : public KCommand {
00212 public:
00218     KoShapeCreateCommand( KoShapeControllerBase *controller, KoShape *shape );
00219     virtual ~KoShapeCreateCommand();
00221     void execute ();
00223     void unexecute ();
00225     virtual QString name () const;
00226 private:
00227     KoShapeControllerBase *m_controller;
00228     KoShape *m_shape;
00229     bool m_deleteShape;
00230 };
00231 
00233 class FLAKE_EXPORT KoShapeDeleteCommand : public KCommand {
00234 public:
00240     KoShapeDeleteCommand( KoShapeControllerBase *controller, KoShape *shape );
00246     KoShapeDeleteCommand( KoShapeControllerBase *controller, const KoSelectionSet &shapes );
00247     virtual ~KoShapeDeleteCommand();
00249     void execute ();
00251     void unexecute ();
00253     virtual QString name () const;
00254 private:
00255     KoShapeControllerBase *m_controller;
00256     QList<KoShape*> m_shapes;
00257     bool m_deleteShapes;
00258 };
00259 
00261 class FLAKE_EXPORT KoShapeBackgroundCommand : public KCommand {
00262 public:
00268     KoShapeBackgroundCommand( const KoSelectionSet &shapes, const QBrush &brush );
00269     virtual ~KoShapeBackgroundCommand();
00271     void execute ();
00273     void unexecute ();
00275     virtual QString name () const;
00276 private:
00277     QList<KoShape*> m_shapes;    
00278     QList<QBrush> m_oldBrushes; 
00279     QBrush m_newBrush;           
00280 };
00281 
00283 class KoShapeAlignCommand : public KCommand {
00284 public:
00286     enum Align
00287     {
00288         HorizontalLeftAlignment,    
00289         HorizontalCenterAlignment,  
00290         HorizontalRightAlignment,   
00291         VerticalBottomAlignment,    
00292         VerticalCenterAlignment,    
00293         VerticalTopAlignment        
00294     };
00301     KoShapeAlignCommand( const KoSelectionSet &shapes, Align align, QRectF boundingRect );
00302     virtual ~KoShapeAlignCommand();
00304     virtual void execute();
00306     virtual void unexecute();
00308     virtual QString name () const;
00309 private:
00310     KoShapeMoveCommand *m_command;
00311 };
00312 
00314 class KoShapeDistributeCommand : public KCommand
00315 {
00316 public:
00318     enum Distribute
00319     {
00320         HorizontalCenterDistribution,   
00321         HorizontalGapsDistribution,     
00322         HorizontalLeftDistribution,     
00323         HorizontalRightDistribution,    
00324         VerticalCenterDistribution,     
00325         VerticalGapsDistribution,       
00326         VerticalBottomDistribution,     
00327         VerticalTopDistribution         
00328     };
00335     KoShapeDistributeCommand( const KoSelectionSet &shapes, Distribute distribute, QRectF boundingRect );
00336     virtual ~KoShapeDistributeCommand();
00338     virtual void execute();
00340     virtual void unexecute();
00342     virtual QString name () const;
00343 private:
00344     double getAvailableSpace( KoShape *first, KoShape *last, double extent, QRectF boundingRect );
00345     Distribute m_distribute;
00346     KoShapeMoveCommand *m_command;
00347 };
00348 
00349 class KoShapeLockCommand : public KCommand
00350 {
00351 public:
00358     KoShapeLockCommand(const KoSelectionSet &shapes, const QList<bool> &oldLock, const QList<bool> &newLock);
00365     KoShapeLockCommand(const QList<KoShape*> &shapes, const QList<bool> &oldLock, const QList<bool> &newLock);
00366     ~KoShapeLockCommand();
00367 
00369     virtual void execute();
00371     virtual void unexecute();
00373     virtual QString name () const;
00374 
00375 private:
00376     QList<KoShape*> m_shapes;    
00377     QList<bool> m_oldLock;       
00378     QList<bool> m_newLock;       
00379 };
00380 
00381 #endif

Généré le Wed Nov 22 23:40:59 2006 pour KPlato par  doxygen 1.5.1-p1