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 :
29 : // predeclarations
30 :
31 : class SdrDragView;
32 :
33 0 : class SdrDragMovHdl : public SdrDragMethod
34 : {
35 : protected:
36 : // define nothing, overload to do so
37 : virtual void createSdrDragEntries() SAL_OVERRIDE;
38 :
39 : public:
40 : TYPEINFO_OVERRIDE();
41 : SdrDragMovHdl(SdrDragView& rNewView);
42 :
43 : virtual void TakeSdrDragComment(OUString& rStr) const SAL_OVERRIDE;
44 : virtual bool BeginSdrDrag() SAL_OVERRIDE;
45 : virtual void MoveSdrDrag(const Point& rPnt) SAL_OVERRIDE;
46 : virtual bool EndSdrDrag(bool bCopy) SAL_OVERRIDE;
47 : virtual void CancelSdrDrag() SAL_OVERRIDE;
48 : virtual Pointer GetSdrDragPointer() const SAL_OVERRIDE;
49 : };
50 :
51 0 : class SdrDragRotate : public SdrDragMethod
52 : {
53 : private:
54 : double nSin;
55 : double nCos;
56 : long nWink0;
57 : long nWink;
58 : bool bRight;
59 :
60 : public:
61 : TYPEINFO_OVERRIDE();
62 : SdrDragRotate(SdrDragView& rNewView);
63 :
64 : virtual void TakeSdrDragComment(OUString& rStr) const SAL_OVERRIDE;
65 : virtual bool BeginSdrDrag() SAL_OVERRIDE;
66 : virtual void MoveSdrDrag(const Point& rPnt) SAL_OVERRIDE;
67 : virtual bool EndSdrDrag(bool bCopy) SAL_OVERRIDE;
68 : virtual Pointer GetSdrDragPointer() const SAL_OVERRIDE;
69 :
70 : virtual basegfx::B2DHomMatrix getCurrentTransformation() SAL_OVERRIDE;
71 : virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget) SAL_OVERRIDE;
72 : };
73 :
74 0 : class SdrDragShear : public SdrDragMethod
75 : {
76 : private:
77 : Fraction aFact;
78 : long nWink0;
79 : long nWink;
80 : double nTan;
81 : bool bVertical; // contort vertically
82 : bool bResize; // shear and resize
83 : bool bUpSideDown; // mirror and shear/slant
84 : bool bSlant;
85 :
86 : public:
87 : TYPEINFO_OVERRIDE();
88 : SdrDragShear(SdrDragView& rNewView,bool bSlant1);
89 :
90 : virtual void TakeSdrDragComment(OUString& rStr) const SAL_OVERRIDE;
91 : virtual bool BeginSdrDrag() SAL_OVERRIDE;
92 : virtual void MoveSdrDrag(const Point& rPnt) SAL_OVERRIDE;
93 : virtual bool EndSdrDrag(bool bCopy) SAL_OVERRIDE;
94 : virtual Pointer GetSdrDragPointer() const SAL_OVERRIDE;
95 :
96 : virtual basegfx::B2DHomMatrix getCurrentTransformation() SAL_OVERRIDE;
97 : virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget) SAL_OVERRIDE;
98 : };
99 :
100 0 : class SdrDragMirror : public SdrDragMethod
101 : {
102 : private:
103 : Point aDif;
104 : long nWink;
105 : bool bMirrored;
106 : bool bSide0;
107 :
108 : bool ImpCheckSide(const Point& rPnt) const;
109 :
110 : public:
111 : TYPEINFO_OVERRIDE();
112 : SdrDragMirror(SdrDragView& rNewView);
113 :
114 : virtual void TakeSdrDragComment(OUString& rStr) const SAL_OVERRIDE;
115 : virtual bool BeginSdrDrag() SAL_OVERRIDE;
116 : virtual void MoveSdrDrag(const Point& rPnt) SAL_OVERRIDE;
117 : virtual bool EndSdrDrag(bool bCopy) SAL_OVERRIDE;
118 : virtual Pointer GetSdrDragPointer() const SAL_OVERRIDE;
119 :
120 : virtual basegfx::B2DHomMatrix getCurrentTransformation() SAL_OVERRIDE;
121 : virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget) SAL_OVERRIDE;
122 : };
123 :
124 0 : class SdrDragGradient : public SdrDragMethod
125 : {
126 : private:
127 : // Handles to work on
128 : SdrHdlGradient* pIAOHandle;
129 :
130 : // is this for gradient (or for transparency)?
131 : bool bIsGradient : 1;
132 :
133 : public:
134 : TYPEINFO_OVERRIDE();
135 : SdrDragGradient(SdrDragView& rNewView, bool bGrad = true);
136 :
137 0 : bool IsGradient() const { return bIsGradient; }
138 :
139 : virtual void TakeSdrDragComment(OUString& rStr) const SAL_OVERRIDE;
140 : virtual bool BeginSdrDrag() SAL_OVERRIDE;
141 : virtual void MoveSdrDrag(const Point& rPnt) SAL_OVERRIDE;
142 : virtual bool EndSdrDrag(bool bCopy) SAL_OVERRIDE;
143 : virtual Pointer GetSdrDragPointer() const SAL_OVERRIDE;
144 : virtual void CancelSdrDrag() SAL_OVERRIDE;
145 : };
146 :
147 0 : class SdrDragCrook : public SdrDragMethod
148 : {
149 : private:
150 : Rectangle aMarkRect;
151 : Point aMarkCenter;
152 : Point aCenter;
153 : Point aStart;
154 : Fraction aFact;
155 : Point aRad;
156 : bool bContortionAllowed;
157 : bool bNoContortionAllowed;
158 : bool bContortion;
159 : bool bResizeAllowed;
160 : bool bResize;
161 : bool bRotateAllowed;
162 : bool bRotate;
163 : bool bVertical;
164 : bool bValid;
165 : bool bLft;
166 : bool bRgt;
167 : bool bUpr;
168 : bool bLwr;
169 : bool bAtCenter;
170 : long nWink;
171 : long nMarkSize;
172 : SdrCrookMode eMode;
173 :
174 : // helpers for applyCurrentTransformationToPolyPolygon
175 : void _MovAllPoints(basegfx::B2DPolyPolygon& rTarget);
176 : void _MovCrookPoint(Point& rPnt, Point* pC1, Point* pC2);
177 :
178 : protected:
179 : // needs to add drag geometry to the default
180 : virtual void createSdrDragEntries() SAL_OVERRIDE;
181 :
182 : public:
183 : TYPEINFO_OVERRIDE();
184 : SdrDragCrook(SdrDragView& rNewView);
185 :
186 : virtual void TakeSdrDragComment(OUString& rStr) const SAL_OVERRIDE;
187 : virtual bool BeginSdrDrag() SAL_OVERRIDE;
188 : virtual void MoveSdrDrag(const Point& rPnt) SAL_OVERRIDE;
189 : virtual bool EndSdrDrag(bool bCopy) SAL_OVERRIDE;
190 : virtual Pointer GetSdrDragPointer() const SAL_OVERRIDE;
191 :
192 : virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget) SAL_OVERRIDE;
193 : virtual void applyCurrentTransformationToPolyPolygon(basegfx::B2DPolyPolygon& rTarget) SAL_OVERRIDE;
194 : };
195 :
196 0 : class SdrDragDistort : public SdrDragMethod
197 : {
198 : private:
199 : Rectangle aMarkRect;
200 : XPolygon aDistortedRect;
201 : sal_uInt16 nPolyPt;
202 : bool bContortionAllowed;
203 : bool bNoContortionAllowed;
204 : bool bContortion;
205 :
206 : // helper for applyCurrentTransformationToPolyPolygon
207 : void _MovAllPoints(basegfx::B2DPolyPolygon& rTarget);
208 :
209 : protected:
210 : // needs to add drag geometry to the default
211 : virtual void createSdrDragEntries() SAL_OVERRIDE;
212 :
213 : public:
214 : TYPEINFO_OVERRIDE();
215 : SdrDragDistort(SdrDragView& rNewView);
216 :
217 : virtual void TakeSdrDragComment(OUString& rStr) const SAL_OVERRIDE;
218 : virtual bool BeginSdrDrag() SAL_OVERRIDE;
219 : virtual void MoveSdrDrag(const Point& rPnt) SAL_OVERRIDE;
220 : virtual bool EndSdrDrag(bool bCopy) SAL_OVERRIDE;
221 : virtual Pointer GetSdrDragPointer() const SAL_OVERRIDE;
222 :
223 : virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget) SAL_OVERRIDE;
224 : virtual void applyCurrentTransformationToPolyPolygon(basegfx::B2DPolyPolygon& rTarget) SAL_OVERRIDE;
225 : };
226 :
227 : // derive from SdrDragObjOwn to have handles aligned to object when it
228 : // is sheared or rotated
229 0 : class SdrDragCrop : public SdrDragObjOwn
230 : {
231 : public:
232 : TYPEINFO_OVERRIDE();
233 : SdrDragCrop(SdrDragView& rNewView);
234 :
235 : virtual void TakeSdrDragComment(OUString& rStr) const SAL_OVERRIDE;
236 : virtual bool BeginSdrDrag() SAL_OVERRIDE;
237 : virtual bool EndSdrDrag(bool bCopy) SAL_OVERRIDE;
238 : virtual Pointer GetSdrDragPointer() const SAL_OVERRIDE;
239 : };
240 :
241 :
242 : #endif // INCLUDED_SVX_SOURCE_SVDRAW_SVDDRGM1_HXX
243 :
244 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|