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