xref: /trunk/main/svx/source/svdraw/svddrgm1.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _SVDDRGM1_HXX
29 #define _SVDDRGM1_HXX
30 
31 #include <svx/xpoly.hxx>
32 #include <svx/svdhdl.hxx>
33 #include <svx/svddrgv.hxx>
34 #include <svx/svddrgmt.hxx>
35 
36 ////////////////////////////////////////////////////////////////////////////////////////////////////
37 // predeclarations
38 
39 class SdrDragView;
40 class SdrDragStat;
41 
42 ////////////////////////////////////////////////////////////////////////////////////////////////////
43 //   SdrDragMovHdl
44 
45 class SdrDragMovHdl : public SdrDragMethod
46 {
47 private:
48     bool                    bMirrObjShown;
49 
50 protected:
51     // define nothing, overload to do so
52     virtual void createSdrDragEntries();
53 
54 public:
55     TYPEINFO();
56     SdrDragMovHdl(SdrDragView& rNewView);
57 
58     virtual void TakeSdrDragComment(String& rStr) const;
59     virtual bool BeginSdrDrag();
60     virtual void MoveSdrDrag(const Point& rPnt);
61     virtual bool EndSdrDrag(bool bCopy);
62     virtual void CancelSdrDrag();
63     virtual Pointer GetSdrDragPointer() const;
64 };
65 
66 ////////////////////////////////////////////////////////////////////////////////////////////////////
67 //   SdrDragRotate
68 
69 class SdrDragRotate : public SdrDragMethod
70 {
71 private:
72     double                      nSin;
73     double                      nCos;
74     long                        nWink0;
75     long                        nWink;
76     bool                        bRight;
77 
78 public:
79     TYPEINFO();
80     SdrDragRotate(SdrDragView& rNewView);
81 
82     virtual void TakeSdrDragComment(String& rStr) const;
83     virtual bool BeginSdrDrag();
84     virtual void MoveSdrDrag(const Point& rPnt);
85     virtual bool EndSdrDrag(bool bCopy);
86     virtual Pointer GetSdrDragPointer() const;
87 
88     virtual basegfx::B2DHomMatrix getCurrentTransformation();
89     virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget);
90 };
91 
92 ////////////////////////////////////////////////////////////////////////////////////////////////////
93 //   SdrDragShear
94 
95 class SdrDragShear : public SdrDragMethod
96 {
97 private:
98     Fraction                    aFact;
99     long                        nWink0;
100     long                        nWink;
101     double                      nTan;
102     bool                        bVertical;   // Vertikales verzerren
103     bool                        bResize;     // Shear mit Resize
104     bool                        bUpSideDown; // Beim Shear/Slant gespiegelt
105     bool                        bSlant;
106 
107 public:
108     TYPEINFO();
109     SdrDragShear(SdrDragView& rNewView,bool bSlant1);
110 
111     virtual void TakeSdrDragComment(String& rStr) const;
112     virtual bool BeginSdrDrag();
113     virtual void MoveSdrDrag(const Point& rPnt);
114     virtual bool EndSdrDrag(bool bCopy);
115     virtual Pointer GetSdrDragPointer() const;
116 
117     virtual basegfx::B2DHomMatrix getCurrentTransformation();
118     virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget);
119 };
120 
121 ////////////////////////////////////////////////////////////////////////////////////////////////////
122 //   SdrDragMirror
123 
124 class SdrDragMirror : public SdrDragMethod
125 {
126 private:
127     Point                       aDif;
128     long                        nWink;
129     bool                        bMirrored;
130     bool                        bSide0;
131 
132     bool ImpCheckSide(const Point& rPnt) const;
133 
134 public:
135     TYPEINFO();
136     SdrDragMirror(SdrDragView& rNewView);
137 
138     virtual void TakeSdrDragComment(String& rStr) const;
139     virtual bool BeginSdrDrag();
140     virtual void MoveSdrDrag(const Point& rPnt);
141     virtual bool EndSdrDrag(bool bCopy);
142     virtual Pointer GetSdrDragPointer() const;
143 
144     virtual basegfx::B2DHomMatrix getCurrentTransformation();
145     virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget);
146 };
147 
148 ////////////////////////////////////////////////////////////////////////////////////////////////////
149 //   SdrDragGradient
150 
151 class SdrDragGradient : public SdrDragMethod
152 {
153 private:
154     // Handles to work on
155     SdrHdlGradient*             pIAOHandle;
156 
157     // is this for gradient (or for transparence) ?
158     unsigned                    bIsGradient : 1;
159 
160 public:
161     TYPEINFO();
162     SdrDragGradient(SdrDragView& rNewView, bool bGrad = true);
163 
164     bool IsGradient() const { return bIsGradient; }
165 
166     virtual void TakeSdrDragComment(String& rStr) const;
167     virtual bool BeginSdrDrag();
168     virtual void MoveSdrDrag(const Point& rPnt);
169     virtual bool EndSdrDrag(bool bCopy);
170     virtual Pointer GetSdrDragPointer() const;
171     virtual void CancelSdrDrag();
172 };
173 
174 ////////////////////////////////////////////////////////////////////////////////////////////////////
175 //   SdrDragCrook
176 
177 class SdrDragCrook : public SdrDragMethod
178 {
179 private:
180     Rectangle                   aMarkRect;
181     Point                       aMarkCenter;
182     Point                       aCenter;
183     Point                       aStart;
184     Fraction                    aFact;
185     Point                       aRad;
186     bool                        bContortionAllowed;
187     bool                        bNoContortionAllowed;
188     bool                        bContortion;
189     bool                        bResizeAllowed;
190     bool                        bResize;
191     bool                        bRotateAllowed;
192     bool                        bRotate;
193     bool                        bVertical;
194     bool                        bValid;
195     bool                        bLft;
196     bool                        bRgt;
197     bool                        bUpr;
198     bool                        bLwr;
199     bool                        bAtCenter;
200     long                        nWink;
201     long                        nMarkSize;
202     SdrCrookMode                eMode;
203 
204     // helpers for applyCurrentTransformationToPolyPolygon
205     void _MovAllPoints(basegfx::B2DPolyPolygon& rTarget);
206     void _MovCrookPoint(Point& rPnt, Point* pC1, Point* pC2);
207 
208 protected:
209     // needs to add drag geometry to the default
210     virtual void createSdrDragEntries();
211 
212 public:
213     TYPEINFO();
214     SdrDragCrook(SdrDragView& rNewView);
215 
216     virtual void TakeSdrDragComment(String& rStr) const;
217     virtual bool BeginSdrDrag();
218     virtual void MoveSdrDrag(const Point& rPnt);
219     virtual bool EndSdrDrag(bool bCopy);
220     virtual Pointer GetSdrDragPointer() const;
221 
222     virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget);
223     virtual void applyCurrentTransformationToPolyPolygon(basegfx::B2DPolyPolygon& rTarget);
224 };
225 
226 ////////////////////////////////////////////////////////////////////////////////////////////////////
227 //   SdrDragDistort
228 
229 class SdrDragDistort : public SdrDragMethod
230 {
231 private:
232     Rectangle                   aMarkRect;
233     XPolygon                    aDistortedRect;
234     sal_uInt16                  nPolyPt;
235     bool                        bContortionAllowed;
236     bool                        bNoContortionAllowed;
237     bool                        bContortion;
238 
239     // helper for applyCurrentTransformationToPolyPolygon
240     void _MovAllPoints(basegfx::B2DPolyPolygon& rTarget);
241 
242 protected:
243     // needs to add drag geometry to the default
244     virtual void createSdrDragEntries();
245 
246 public:
247     TYPEINFO();
248     SdrDragDistort(SdrDragView& rNewView);
249 
250     virtual void TakeSdrDragComment(String& rStr) const;
251     virtual bool BeginSdrDrag();
252     virtual void MoveSdrDrag(const Point& rPnt);
253     virtual bool EndSdrDrag(bool bCopy);
254     virtual Pointer GetSdrDragPointer() const;
255 
256     virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget);
257     virtual void applyCurrentTransformationToPolyPolygon(basegfx::B2DPolyPolygon& rTarget);
258 };
259 
260 ////////////////////////////////////////////////////////////////////////////////////////////////////
261 //   SdrDragCrop
262 
263 class SdrDragCrop : public SdrDragResize
264 {
265 public:
266     TYPEINFO();
267     SdrDragCrop(SdrDragView& rNewView);
268 
269     virtual void TakeSdrDragComment(String& rStr) const;
270     virtual bool EndSdrDrag(bool bCopy);
271     virtual Pointer GetSdrDragPointer() const;
272 };
273 
274 ////////////////////////////////////////////////////////////////////////////////////////////////////
275 #endif //_SVDDRGM1_HXX
276 
277 // eof
278