xref: /trunk/main/svx/source/svdraw/svddrgm1.hxx (revision 414a0e15)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SVDDRGM1_HXX
25 #define _SVDDRGM1_HXX
26 
27 #include <svx/xpoly.hxx>
28 #include <svx/svdhdl.hxx>
29 #include <svx/svddrgv.hxx>
30 #include <svx/svddrgmt.hxx>
31 
32 ////////////////////////////////////////////////////////////////////////////////////////////////////
33 // predeclarations
34 
35 class SdrDragView;
36 class SdrDragStat;
37 
38 ////////////////////////////////////////////////////////////////////////////////////////////////////
39 //   SdrDragMovHdl
40 
41 class SdrDragMovHdl : public SdrDragMethod
42 {
43 private:
44 	bool					bMirrObjShown;
45 
46 protected:
47     // define nothing, overload to do so
48     virtual void createSdrDragEntries();
49 
50 public:
51 	TYPEINFO();
52 	SdrDragMovHdl(SdrDragView& rNewView);
53 
54 	virtual void TakeSdrDragComment(String& rStr) const;
55 	virtual bool BeginSdrDrag();
56 	virtual void MoveSdrDrag(const Point& rPnt);
57 	virtual bool EndSdrDrag(bool bCopy);
58 	virtual void CancelSdrDrag();
59 	virtual Pointer GetSdrDragPointer() const;
60 };
61 
62 ////////////////////////////////////////////////////////////////////////////////////////////////////
63 //   SdrDragRotate
64 
65 class SdrDragRotate : public SdrDragMethod
66 {
67 private:
68 	double						nSin;
69 	double						nCos;
70 	long						nWink0;
71 	long						nWink;
72 	bool    					bRight;
73 
74 public:
75 	TYPEINFO();
76 	SdrDragRotate(SdrDragView& rNewView);
77 
78 	virtual void TakeSdrDragComment(String& rStr) const;
79 	virtual bool BeginSdrDrag();
80 	virtual void MoveSdrDrag(const Point& rPnt);
81 	virtual bool EndSdrDrag(bool bCopy);
82 	virtual Pointer GetSdrDragPointer() const;
83 
84 	virtual basegfx::B2DHomMatrix getCurrentTransformation();
85     virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget);
86 };
87 
88 ////////////////////////////////////////////////////////////////////////////////////////////////////
89 //   SdrDragShear
90 
91 class SdrDragShear : public SdrDragMethod
92 {
93 private:
94 	Fraction					aFact;
95 	long						nWink0;
96 	long						nWink;
97 	double						nTan;
98 	bool    					bVertical;   // Vertikales verzerren
99 	bool    					bResize;     // Shear mit Resize
100 	bool    					bUpSideDown; // Beim Shear/Slant gespiegelt
101 	bool    					bSlant;
102 
103 public:
104 	TYPEINFO();
105 	SdrDragShear(SdrDragView& rNewView,bool bSlant1);
106 
107 	virtual void TakeSdrDragComment(String& rStr) const;
108 	virtual bool BeginSdrDrag();
109 	virtual void MoveSdrDrag(const Point& rPnt);
110 	virtual bool EndSdrDrag(bool bCopy);
111 	virtual Pointer GetSdrDragPointer() const;
112 
113 	virtual basegfx::B2DHomMatrix getCurrentTransformation();
114     virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget);
115 };
116 
117 ////////////////////////////////////////////////////////////////////////////////////////////////////
118 //   SdrDragMirror
119 
120 class SdrDragMirror : public SdrDragMethod
121 {
122 private:
123 	Point						aDif;
124 	long						nWink;
125 	bool    					bMirrored;
126 	bool    					bSide0;
127 
128 	bool ImpCheckSide(const Point& rPnt) const;
129 
130 public:
131 	TYPEINFO();
132 	SdrDragMirror(SdrDragView& rNewView);
133 
134 	virtual void TakeSdrDragComment(String& rStr) const;
135 	virtual bool BeginSdrDrag();
136 	virtual void MoveSdrDrag(const Point& rPnt);
137 	virtual bool EndSdrDrag(bool bCopy);
138 	virtual Pointer GetSdrDragPointer() const;
139 
140 	virtual basegfx::B2DHomMatrix getCurrentTransformation();
141     virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget);
142 };
143 
144 ////////////////////////////////////////////////////////////////////////////////////////////////////
145 //   SdrDragGradient
146 
147 class SdrDragGradient : public SdrDragMethod
148 {
149 private:
150 	// Handles to work on
151 	SdrHdlGradient*				pIAOHandle;
152 
153 	// is this for gradient (or for transparence) ?
154 	unsigned					bIsGradient : 1;
155 
156 public:
157 	TYPEINFO();
158 	SdrDragGradient(SdrDragView& rNewView, bool bGrad = true);
159 
IsGradient() const160 	bool IsGradient() const { return bIsGradient; }
161 
162 	virtual void TakeSdrDragComment(String& rStr) const;
163 	virtual bool BeginSdrDrag();
164 	virtual void MoveSdrDrag(const Point& rPnt);
165 	virtual bool EndSdrDrag(bool bCopy);
166 	virtual Pointer GetSdrDragPointer() const;
167 	virtual void CancelSdrDrag();
168 };
169 
170 ////////////////////////////////////////////////////////////////////////////////////////////////////
171 //   SdrDragCrook
172 
173 class SdrDragCrook : public SdrDragMethod
174 {
175 private:
176 	Rectangle					aMarkRect;
177 	Point						aMarkCenter;
178 	Point						aCenter;
179 	Point						aStart;
180 	Fraction					aFact;
181 	Point						aRad;
182 	bool    					bContortionAllowed;
183 	bool    					bNoContortionAllowed;
184 	bool    					bContortion;
185 	bool    					bResizeAllowed;
186 	bool    					bResize;
187 	bool    					bRotateAllowed;
188 	bool    					bRotate;
189 	bool    					bVertical;
190 	bool    					bValid;
191 	bool    					bLft;
192 	bool    					bRgt;
193 	bool    					bUpr;
194 	bool    					bLwr;
195 	bool    					bAtCenter;
196 	long						nWink;
197 	long						nMarkSize;
198 	SdrCrookMode				eMode;
199 
200 	// helpers for applyCurrentTransformationToPolyPolygon
201 	void _MovAllPoints(basegfx::B2DPolyPolygon& rTarget);
202 	void _MovCrookPoint(Point& rPnt, Point* pC1, Point* pC2);
203 
204 protected:
205     // needs to add drag geometry to the default
206     virtual void createSdrDragEntries();
207 
208 public:
209 	TYPEINFO();
210 	SdrDragCrook(SdrDragView& rNewView);
211 
212 	virtual void TakeSdrDragComment(String& rStr) const;
213 	virtual bool BeginSdrDrag();
214 	virtual void MoveSdrDrag(const Point& rPnt);
215 	virtual bool EndSdrDrag(bool bCopy);
216 	virtual Pointer GetSdrDragPointer() const;
217 
218 	virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget);
219 	virtual void applyCurrentTransformationToPolyPolygon(basegfx::B2DPolyPolygon& rTarget);
220 };
221 
222 ////////////////////////////////////////////////////////////////////////////////////////////////////
223 //   SdrDragDistort
224 
225 class SdrDragDistort : public SdrDragMethod
226 {
227 private:
228 	Rectangle					aMarkRect;
229 	XPolygon					aDistortedRect;
230 	sal_uInt16					nPolyPt;
231 	bool    					bContortionAllowed;
232 	bool    					bNoContortionAllowed;
233 	bool    					bContortion;
234 
235 	// helper for applyCurrentTransformationToPolyPolygon
236 	void _MovAllPoints(basegfx::B2DPolyPolygon& rTarget);
237 
238 protected:
239     // needs to add drag geometry to the default
240     virtual void createSdrDragEntries();
241 
242 public:
243 	TYPEINFO();
244 	SdrDragDistort(SdrDragView& rNewView);
245 
246 	virtual void TakeSdrDragComment(String& rStr) const;
247 	virtual bool BeginSdrDrag();
248 	virtual void MoveSdrDrag(const Point& rPnt);
249 	virtual bool EndSdrDrag(bool bCopy);
250 	virtual Pointer GetSdrDragPointer() const;
251 
252     virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget);
253 	virtual void applyCurrentTransformationToPolyPolygon(basegfx::B2DPolyPolygon& rTarget);
254 };
255 
256 ////////////////////////////////////////////////////////////////////////////////////////////////////
257 //   SdrDragCrop
258 
259 // derive from SdrDragObjOwn to have handles aligned to object when it
260 // is sheared or rotated
261 class SdrDragCrop : public SdrDragObjOwn
262 {
263 public:
264     TYPEINFO();
265     SdrDragCrop(SdrDragView& rNewView);
266 
267     virtual void TakeSdrDragComment(String& rStr) const;
268     virtual bool BeginSdrDrag();
269     virtual bool EndSdrDrag(bool bCopy);
270     virtual Pointer GetSdrDragPointer() const;
271 };
272 
273 ////////////////////////////////////////////////////////////////////////////////////////////////////
274 #endif //_SVDDRGM1_HXX
275 
276 // eof
277