karbon

vtransformcmd.h
1/* This file is part of the KDE project é
2 Copyright (C) 2001, The Karbon Developers
3 Copyright (C) 2002, The Karbon Developers
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 __VTRANSFORMCMD_H__
22#define __VTRANSFORMCMD_H__
23
24#include <tqvaluevector.h>
25#include "vcommand.h"
26#include "vgroup.h"
27#include <koffice_export.h>
28// Transform object(s) with a specified matrix and allow undo.
29
30
31class TQWMatrix;
32class VPath;
33class VSubpath;
34class VSegment;
35class VSelection;
36
37
38class KARBONCOMMAND_EXPORT VTransformCmd : public VCommand
39{
40public:
41 VTransformCmd( VDocument *doc, const TQWMatrix& mat, bool duplicate = false );
42 virtual ~VTransformCmd();
43
44 virtual void execute();
45 virtual void unexecute();
46
47 virtual void visitVPath( VPath& composite );
48 virtual void visitVSubpath( VSubpath& path );
49 virtual void visitVText( VText& text );
50 virtual void visitVImage( VImage& img );
51 virtual void visitVObject( VObject& object );
52
53 void setMatrix( const TQWMatrix& m )
54 {
55 m_mat = m;
56 }
57
58protected:
59 VTransformCmd( VDocument *doc, const TQString& name, const TQString& icon, bool duplicate = false );
60
61 VSelection* m_selection;
62 VObjectList m_duplicates;
63
64 TQWMatrix m_mat;
65
66 bool m_duplicate;
67};
68
69
70class KARBONCOMMAND_EXPORT VTranslateCmd : public VTransformCmd
71{
72public:
73 VTranslateCmd( VDocument *doc, double d1, double d2, bool duplicate = false );
74};
75
76
77class KARBONCOMMAND_EXPORT VScaleCmd : public VTransformCmd
78{
79public:
80 VScaleCmd( VDocument *doc, const KoPoint& p, double s1, double s2, bool duplicate = false );
81};
82
83
84class KARBONCOMMAND_EXPORT VShearCmd : public VTransformCmd
85{
86public:
87 VShearCmd( VDocument *doc, const KoPoint& p, double s1, double s2, bool duplicate = false );
88};
89
90
91class KARBONCOMMAND_EXPORT VRotateCmd : public VTransformCmd
92{
93public:
94 VRotateCmd( VDocument *doc, const KoPoint& p, double angle, bool duplicate = false );
95};
96
97class KARBONCOMMAND_EXPORT VTranslateBezierCmd : public VCommand
98{
99public:
100 VTranslateBezierCmd( VDocument *doc, VSegment *segment, double d1, double d2, bool firstControl );
101 virtual ~VTranslateBezierCmd();
102
103 virtual void execute();
104 virtual void unexecute();
105
106 virtual void visitVSubpath( VSubpath& path );
107
108protected:
109 TQWMatrix m_mat;
110 VSegment *m_segment;
111 VSegment *m_segmenttwo;
112 bool m_firstControl;
113 VSubpath *m_subpath;
114};
115
116class KARBONCOMMAND_EXPORT VTranslatePointCmd : public VCommand
117{
118public:
119 VTranslatePointCmd( VDocument *doc, double d1, double d2 );
120 virtual ~VTranslatePointCmd();
121
122 virtual void execute();
123 virtual void unexecute();
124
125 virtual void visitVSubpath( VSubpath& path );
126
127protected:
128 void translatePoints();
129
130 TQWMatrix m_mat;
131 TQMap<VSegment*, TQValueVector<int> > m_segPnts;
132 VObjectList m_subpaths;
133};
134
135#endif
136
The base class for all karbon commands.
Definition vcommand.h:42
virtual void unexecute()
Unexecutes the command.
Definition vcommand.h:75
virtual void execute()=0
Executes the command.
A composite path consists of one or many subpaths.
Definition vcomposite.h:48
A class representing lines and beziers.
Definition vsegment.h:43
VSelection manages a set of selected vobjects.
Definition vselection.h:62
VSubpath provides a sophisticated list of VSegment.
Definition vpath.h:43
virtual void visitVSubpath(VSubpath &path)
Visit method for a VSubpath.
Definition vvisitor.cpp:86
virtual void visitVText(VText &text)
Visit method for a VText.
Definition vvisitor.cpp:102
virtual void visitVImage(VImage &img)
Visit method for a VImage.
Definition vvisitor.cpp:107
virtual void visitVObject(VObject &object)
Visit method for a VObject.
Definition vvisitor.cpp:112
virtual void visitVPath(VPath &composite)
Visit method for a VPath.
Definition vvisitor.cpp:74