karbon

vtransformcmd.h

00001 /* This file is part of the KDE project          é
00002    Copyright (C) 2001, The Karbon Developers
00003    Copyright (C) 2002, The Karbon Developers
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef __VTRANSFORMCMD_H__
00022 #define __VTRANSFORMCMD_H__
00023 
00024 #include <qvaluevector.h>
00025 #include "vcommand.h"
00026 #include "vgroup.h"
00027 #include <koffice_export.h>
00028 // Transform object(s) with a specified matrix and allow undo.
00029 
00030 
00031 class QWMatrix;
00032 class VPath;
00033 class VSubpath;
00034 class VSegment;
00035 class VSelection;
00036 
00037 
00038 class KARBONCOMMAND_EXPORT VTransformCmd : public VCommand
00039 {
00040 public:
00041     VTransformCmd( VDocument *doc, const QWMatrix& mat, bool duplicate = false );
00042     virtual ~VTransformCmd();
00043 
00044     virtual void execute();
00045     virtual void unexecute();
00046 
00047     virtual void visitVPath( VPath& composite );
00048     virtual void visitVSubpath( VSubpath& path );
00049     virtual void visitVText( VText& text );
00050     virtual void visitVImage( VImage& img );
00051     virtual void visitVObject( VObject& object );
00052 
00053     void setMatrix( const QWMatrix& m )
00054     {
00055         m_mat = m;
00056     }
00057 
00058 protected:
00059     VTransformCmd( VDocument *doc, const QString& name, const QString& icon, bool duplicate = false );
00060 
00061     VSelection* m_selection;
00062     VObjectList m_duplicates;
00063 
00064     QWMatrix m_mat;
00065 
00066     bool m_duplicate;
00067 };
00068 
00069 
00070 class KARBONCOMMAND_EXPORT VTranslateCmd : public VTransformCmd
00071 {
00072 public:
00073     VTranslateCmd( VDocument *doc, double d1, double d2, bool duplicate = false );
00074 };
00075 
00076 
00077 class KARBONCOMMAND_EXPORT VScaleCmd : public VTransformCmd
00078 {
00079 public:
00080     VScaleCmd( VDocument *doc, const KoPoint& p, double s1, double s2, bool duplicate = false );
00081 };
00082 
00083 
00084 class KARBONCOMMAND_EXPORT VShearCmd : public VTransformCmd
00085 {
00086 public:
00087     VShearCmd( VDocument *doc, const KoPoint& p, double s1, double s2, bool duplicate = false );
00088 };
00089 
00090 
00091 class KARBONCOMMAND_EXPORT VRotateCmd : public VTransformCmd
00092 {
00093 public:
00094     VRotateCmd( VDocument *doc, const KoPoint& p, double angle, bool duplicate = false );
00095 };
00096 
00097 class KARBONCOMMAND_EXPORT VTranslateBezierCmd : public VCommand
00098 {
00099 public:
00100     VTranslateBezierCmd( VDocument *doc, VSegment *segment, double d1, double d2, bool firstControl );
00101     virtual ~VTranslateBezierCmd();
00102 
00103     virtual void execute();
00104     virtual void unexecute();
00105 
00106     virtual void visitVSubpath( VSubpath& path );
00107 
00108 protected:
00109     QWMatrix m_mat;
00110     VSegment *m_segment;
00111     VSegment *m_segmenttwo;
00112     bool      m_firstControl;
00113     VSubpath *m_subpath;
00114 };
00115 
00116 class KARBONCOMMAND_EXPORT VTranslatePointCmd : public VCommand
00117 {
00118 public:
00119     VTranslatePointCmd( VDocument *doc, double d1, double d2 );
00120     virtual ~VTranslatePointCmd();
00121 
00122     virtual void execute();
00123     virtual void unexecute();
00124 
00125     virtual void visitVSubpath( VSubpath& path );
00126 
00127 protected:
00128     void translatePoints();
00129 
00130     QWMatrix m_mat;
00131     QMap<VSegment*, QValueVector<int> > m_segPnts;
00132     VObjectList m_subpaths;
00133 };
00134 
00135 #endif
00136 
KDE Home | KDE Accessibility Home | Description of Access Keys