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