Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_SVX_SOURCE_SVDRAW_SVDDRGM1_HXX
21 : #define INCLUDED_SVX_SOURCE_SVDRAW_SVDDRGM1_HXX
22 :
23 : #include <svx/xpoly.hxx>
24 : #include <svx/svdhdl.hxx>
25 : #include <svx/svddrgv.hxx>
26 : #include <svx/svddrgmt.hxx>
27 :
28 : class SdrDragView;
29 :
30 0 : class SdrDragMovHdl : public SdrDragMethod
31 : {
32 : protected:
33 : // define nothing, override to do so
34 : virtual void createSdrDragEntries() SAL_OVERRIDE;
35 :
36 : public:
37 : TYPEINFO_OVERRIDE();
38 : explicit SdrDragMovHdl(SdrDragView& rNewView);
39 :
40 : virtual void TakeSdrDragComment(OUString& rStr) const SAL_OVERRIDE;
41 : virtual bool BeginSdrDrag() SAL_OVERRIDE;
42 : virtual void MoveSdrDrag(const Point& rPnt) SAL_OVERRIDE;
43 : virtual bool EndSdrDrag(bool bCopy) SAL_OVERRIDE;
44 : virtual void CancelSdrDrag() SAL_OVERRIDE;
45 : virtual Pointer GetSdrDragPointer() const SAL_OVERRIDE;
46 : };
47 :
48 0 : class SdrDragRotate : public SdrDragMethod
49 : {
50 : private:
51 : double nSin;
52 : double nCos;
53 : long nAngle0;
54 : long nAngle;
55 : bool bRight;
56 :
57 : public:
58 : TYPEINFO_OVERRIDE();
59 : explicit SdrDragRotate(SdrDragView& rNewView);
60 :
61 : virtual void TakeSdrDragComment(OUString& rStr) const SAL_OVERRIDE;
62 : virtual bool BeginSdrDrag() SAL_OVERRIDE;
63 : virtual void MoveSdrDrag(const Point& rPnt) SAL_OVERRIDE;
64 : virtual bool EndSdrDrag(bool bCopy) SAL_OVERRIDE;
65 : virtual Pointer GetSdrDragPointer() const SAL_OVERRIDE;
66 :
67 : virtual basegfx::B2DHomMatrix getCurrentTransformation() SAL_OVERRIDE;
68 : virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget) SAL_OVERRIDE;
69 : };
70 :
71 0 : class SdrDragShear : public SdrDragMethod
72 : {
73 : private:
74 : Fraction aFact;
75 : long nAngle0;
76 : long nAngle;
77 : double nTan;
78 : bool bVertical; // contort vertically
79 : bool bResize; // shear and resize
80 : bool bUpSideDown; // mirror and shear/slant
81 : bool bSlant;
82 :
83 : public:
84 : TYPEINFO_OVERRIDE();
85 : SdrDragShear(SdrDragView& rNewView,bool bSlant1);
86 :
87 : virtual void TakeSdrDragComment(OUString& rStr) const SAL_OVERRIDE;
88 : virtual bool BeginSdrDrag() SAL_OVERRIDE;
89 : virtual void MoveSdrDrag(const Point& rPnt) SAL_OVERRIDE;
90 : virtual bool EndSdrDrag(bool bCopy) SAL_OVERRIDE;
91 : virtual Pointer GetSdrDragPointer() const SAL_OVERRIDE;
92 :
93 : virtual basegfx::B2DHomMatrix getCurrentTransformation() SAL_OVERRIDE;
94 : virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget) SAL_OVERRIDE;
95 : };
96 :
97 0 : class SdrDragMirror : public SdrDragMethod
98 : {
99 : private:
100 : Point aDif;
101 : long nAngle;
102 : bool bMirrored;
103 : bool bSide0;
104 :
105 : bool ImpCheckSide(const Point& rPnt) const;
106 :
107 : public:
108 : TYPEINFO_OVERRIDE();
109 : explicit SdrDragMirror(SdrDragView& rNewView);
110 :
111 : virtual void TakeSdrDragComment(OUString& rStr) const SAL_OVERRIDE;
112 : virtual bool BeginSdrDrag() SAL_OVERRIDE;
113 : virtual void MoveSdrDrag(const Point& rPnt) SAL_OVERRIDE;
114 : virtual bool EndSdrDrag(bool bCopy) SAL_OVERRIDE;
115 : virtual Pointer GetSdrDragPointer() const SAL_OVERRIDE;
116 :
117 : virtual basegfx::B2DHomMatrix getCurrentTransformation() SAL_OVERRIDE;
118 : virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget) SAL_OVERRIDE;
119 : };
120 :
121 0 : class SdrDragGradient : public SdrDragMethod
122 : {
123 : private:
124 : // Handles to work on
125 : SdrHdlGradient* pIAOHandle;
126 :
127 : // is this for gradient (or for transparency)?
128 : bool bIsGradient : 1;
129 :
130 : public:
131 : TYPEINFO_OVERRIDE();
132 : SdrDragGradient(SdrDragView& rNewView, bool bGrad = true);
133 :
134 0 : bool IsGradient() const { return bIsGradient; }
135 :
136 : virtual void TakeSdrDragComment(OUString& rStr) const SAL_OVERRIDE;
137 : virtual bool BeginSdrDrag() SAL_OVERRIDE;
138 : virtual void MoveSdrDrag(const Point& rPnt) SAL_OVERRIDE;
139 : virtual bool EndSdrDrag(bool bCopy) SAL_OVERRIDE;
140 : virtual Pointer GetSdrDragPointer() const SAL_OVERRIDE;
141 : virtual void CancelSdrDrag() SAL_OVERRIDE;
142 : };
143 :
144 0 : class SdrDragCrook : public SdrDragMethod
145 : {
146 : private:
147 : Rectangle aMarkRect;
148 : Point aMarkCenter;
149 : Point aCenter;
150 : Point aStart;
151 : Fraction aFact;
152 : Point aRad;
153 : bool bContortionAllowed;
154 : bool bNoContortionAllowed;
155 : bool bContortion;
156 : bool bResizeAllowed;
157 : bool bResize;
158 : bool bRotateAllowed;
159 : bool bRotate;
160 : bool bVertical;
161 : bool bValid;
162 : bool bLft;
163 : bool bRgt;
164 : bool bUpr;
165 : bool bLwr;
166 : bool bAtCenter;
167 : long nAngle;
168 : long nMarkSize;
169 : SdrCrookMode eMode;
170 :
171 : // helpers for applyCurrentTransformationToPolyPolygon
172 : void _MovAllPoints(basegfx::B2DPolyPolygon& rTarget);
173 : void _MovCrookPoint(Point& rPnt, Point* pC1, Point* pC2);
174 :
175 : protected:
176 : // needs to add drag geometry to the default
177 : virtual void createSdrDragEntries() SAL_OVERRIDE;
178 :
179 : public:
180 : TYPEINFO_OVERRIDE();
181 : explicit SdrDragCrook(SdrDragView& rNewView);
182 :
183 : virtual void TakeSdrDragComment(OUString& rStr) const SAL_OVERRIDE;
184 : virtual bool BeginSdrDrag() SAL_OVERRIDE;
185 : virtual void MoveSdrDrag(const Point& rPnt) SAL_OVERRIDE;
186 : virtual bool EndSdrDrag(bool bCopy) SAL_OVERRIDE;
187 : virtual Pointer GetSdrDragPointer() const SAL_OVERRIDE;
188 :
189 : virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget) SAL_OVERRIDE;
190 : virtual void applyCurrentTransformationToPolyPolygon(basegfx::B2DPolyPolygon& rTarget) SAL_OVERRIDE;
191 : };
192 :
193 0 : class SdrDragDistort : public SdrDragMethod
194 : {
195 : private:
196 : Rectangle aMarkRect;
197 : XPolygon aDistortedRect;
198 : sal_uInt16 nPolyPt;
199 : bool bContortionAllowed;
200 : bool bNoContortionAllowed;
201 : bool bContortion;
202 :
203 : // helper for applyCurrentTransformationToPolyPolygon
204 : void _MovAllPoints(basegfx::B2DPolyPolygon& rTarget);
205 :
206 : protected:
207 : // needs to add drag geometry to the default
208 : virtual void createSdrDragEntries() SAL_OVERRIDE;
209 :
210 : public:
211 : TYPEINFO_OVERRIDE();
212 : explicit SdrDragDistort(SdrDragView& rNewView);
213 :
214 : virtual void TakeSdrDragComment(OUString& rStr) const SAL_OVERRIDE;
215 : virtual bool BeginSdrDrag() SAL_OVERRIDE;
216 : virtual void MoveSdrDrag(const Point& rPnt) SAL_OVERRIDE;
217 : virtual bool EndSdrDrag(bool bCopy) SAL_OVERRIDE;
218 : virtual Pointer GetSdrDragPointer() const SAL_OVERRIDE;
219 :
220 : virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget) SAL_OVERRIDE;
221 : virtual void applyCurrentTransformationToPolyPolygon(basegfx::B2DPolyPolygon& rTarget) SAL_OVERRIDE;
222 : };
223 :
224 : // derive from SdrDragObjOwn to have handles aligned to object when it
225 : // is sheared or rotated
226 0 : class SdrDragCrop : public SdrDragObjOwn
227 : {
228 : public:
229 : TYPEINFO_OVERRIDE();
230 : explicit SdrDragCrop(SdrDragView& rNewView);
231 :
232 : virtual void TakeSdrDragComment(OUString& rStr) const SAL_OVERRIDE;
233 : virtual bool BeginSdrDrag() SAL_OVERRIDE;
234 : virtual bool EndSdrDrag(bool bCopy) SAL_OVERRIDE;
235 : virtual Pointer GetSdrDragPointer() const SAL_OVERRIDE;
236 : };
237 :
238 : #endif // INCLUDED_SVX_SOURCE_SVDRAW_SVDDRGM1_HXX
239 :
240 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|