Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / svx / source / svdraw / svddrgm1.hxx
blob621589c1f046db03d5017c9749e5acc47a06cb18
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SVX_SOURCE_SVDRAW_SVDDRGM1_HXX
21 #define INCLUDED_SVX_SOURCE_SVDRAW_SVDDRGM1_HXX
23 #include <svx/xpoly.hxx>
24 #include <svx/svdhdl.hxx>
25 #include <svx/svddrgv.hxx>
26 #include <svx/svddrgmt.hxx>
29 // predeclarations
31 class SdrDragView;
34 // SdrDragMovHdl
36 class SdrDragMovHdl : public SdrDragMethod
38 protected:
39 // define nothing, overload to do so
40 virtual void createSdrDragEntries() SAL_OVERRIDE;
42 public:
43 TYPEINFO_OVERRIDE();
44 SdrDragMovHdl(SdrDragView& rNewView);
46 virtual void TakeSdrDragComment(OUString& rStr) const SAL_OVERRIDE;
47 virtual bool BeginSdrDrag() SAL_OVERRIDE;
48 virtual void MoveSdrDrag(const Point& rPnt) SAL_OVERRIDE;
49 virtual bool EndSdrDrag(bool bCopy) SAL_OVERRIDE;
50 virtual void CancelSdrDrag() SAL_OVERRIDE;
51 virtual Pointer GetSdrDragPointer() const SAL_OVERRIDE;
55 // SdrDragRotate
57 class SdrDragRotate : public SdrDragMethod
59 private:
60 double nSin;
61 double nCos;
62 long nWink0;
63 long nWink;
64 bool bRight;
66 public:
67 TYPEINFO_OVERRIDE();
68 SdrDragRotate(SdrDragView& rNewView);
70 virtual void TakeSdrDragComment(OUString& rStr) const SAL_OVERRIDE;
71 virtual bool BeginSdrDrag() SAL_OVERRIDE;
72 virtual void MoveSdrDrag(const Point& rPnt) SAL_OVERRIDE;
73 virtual bool EndSdrDrag(bool bCopy) SAL_OVERRIDE;
74 virtual Pointer GetSdrDragPointer() const SAL_OVERRIDE;
76 virtual basegfx::B2DHomMatrix getCurrentTransformation() SAL_OVERRIDE;
77 virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget) SAL_OVERRIDE;
81 // SdrDragShear
83 class SdrDragShear : public SdrDragMethod
85 private:
86 Fraction aFact;
87 long nWink0;
88 long nWink;
89 double nTan;
90 bool bVertical; // contort vertically
91 bool bResize; // shear and resize
92 bool bUpSideDown; // mirror and shear/slant
93 bool bSlant;
95 public:
96 TYPEINFO_OVERRIDE();
97 SdrDragShear(SdrDragView& rNewView,bool bSlant1);
99 virtual void TakeSdrDragComment(OUString& rStr) const SAL_OVERRIDE;
100 virtual bool BeginSdrDrag() SAL_OVERRIDE;
101 virtual void MoveSdrDrag(const Point& rPnt) SAL_OVERRIDE;
102 virtual bool EndSdrDrag(bool bCopy) SAL_OVERRIDE;
103 virtual Pointer GetSdrDragPointer() const SAL_OVERRIDE;
105 virtual basegfx::B2DHomMatrix getCurrentTransformation() SAL_OVERRIDE;
106 virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget) SAL_OVERRIDE;
110 // SdrDragMirror
112 class SdrDragMirror : public SdrDragMethod
114 private:
115 Point aDif;
116 long nWink;
117 bool bMirrored;
118 bool bSide0;
120 bool ImpCheckSide(const Point& rPnt) const;
122 public:
123 TYPEINFO_OVERRIDE();
124 SdrDragMirror(SdrDragView& rNewView);
126 virtual void TakeSdrDragComment(OUString& rStr) const SAL_OVERRIDE;
127 virtual bool BeginSdrDrag() SAL_OVERRIDE;
128 virtual void MoveSdrDrag(const Point& rPnt) SAL_OVERRIDE;
129 virtual bool EndSdrDrag(bool bCopy) SAL_OVERRIDE;
130 virtual Pointer GetSdrDragPointer() const SAL_OVERRIDE;
132 virtual basegfx::B2DHomMatrix getCurrentTransformation() SAL_OVERRIDE;
133 virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget) SAL_OVERRIDE;
137 // SdrDragGradient
139 class SdrDragGradient : public SdrDragMethod
141 private:
142 // Handles to work on
143 SdrHdlGradient* pIAOHandle;
145 // is this for gradient (or for transparency)?
146 bool bIsGradient : 1;
148 public:
149 TYPEINFO_OVERRIDE();
150 SdrDragGradient(SdrDragView& rNewView, bool bGrad = true);
152 bool IsGradient() const { return bIsGradient; }
154 virtual void TakeSdrDragComment(OUString& rStr) const SAL_OVERRIDE;
155 virtual bool BeginSdrDrag() SAL_OVERRIDE;
156 virtual void MoveSdrDrag(const Point& rPnt) SAL_OVERRIDE;
157 virtual bool EndSdrDrag(bool bCopy) SAL_OVERRIDE;
158 virtual Pointer GetSdrDragPointer() const SAL_OVERRIDE;
159 virtual void CancelSdrDrag() SAL_OVERRIDE;
163 // SdrDragCrook
165 class SdrDragCrook : public SdrDragMethod
167 private:
168 Rectangle aMarkRect;
169 Point aMarkCenter;
170 Point aCenter;
171 Point aStart;
172 Fraction aFact;
173 Point aRad;
174 bool bContortionAllowed;
175 bool bNoContortionAllowed;
176 bool bContortion;
177 bool bResizeAllowed;
178 bool bResize;
179 bool bRotateAllowed;
180 bool bRotate;
181 bool bVertical;
182 bool bValid;
183 bool bLft;
184 bool bRgt;
185 bool bUpr;
186 bool bLwr;
187 bool bAtCenter;
188 long nWink;
189 long nMarkSize;
190 SdrCrookMode eMode;
192 // helpers for applyCurrentTransformationToPolyPolygon
193 void _MovAllPoints(basegfx::B2DPolyPolygon& rTarget);
194 void _MovCrookPoint(Point& rPnt, Point* pC1, Point* pC2);
196 protected:
197 // needs to add drag geometry to the default
198 virtual void createSdrDragEntries() SAL_OVERRIDE;
200 public:
201 TYPEINFO_OVERRIDE();
202 SdrDragCrook(SdrDragView& rNewView);
204 virtual void TakeSdrDragComment(OUString& rStr) const SAL_OVERRIDE;
205 virtual bool BeginSdrDrag() SAL_OVERRIDE;
206 virtual void MoveSdrDrag(const Point& rPnt) SAL_OVERRIDE;
207 virtual bool EndSdrDrag(bool bCopy) SAL_OVERRIDE;
208 virtual Pointer GetSdrDragPointer() const SAL_OVERRIDE;
210 virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget) SAL_OVERRIDE;
211 virtual void applyCurrentTransformationToPolyPolygon(basegfx::B2DPolyPolygon& rTarget) SAL_OVERRIDE;
215 // SdrDragDistort
217 class SdrDragDistort : public SdrDragMethod
219 private:
220 Rectangle aMarkRect;
221 XPolygon aDistortedRect;
222 sal_uInt16 nPolyPt;
223 bool bContortionAllowed;
224 bool bNoContortionAllowed;
225 bool bContortion;
227 // helper for applyCurrentTransformationToPolyPolygon
228 void _MovAllPoints(basegfx::B2DPolyPolygon& rTarget);
230 protected:
231 // needs to add drag geometry to the default
232 virtual void createSdrDragEntries() SAL_OVERRIDE;
234 public:
235 TYPEINFO_OVERRIDE();
236 SdrDragDistort(SdrDragView& rNewView);
238 virtual void TakeSdrDragComment(OUString& rStr) const SAL_OVERRIDE;
239 virtual bool BeginSdrDrag() SAL_OVERRIDE;
240 virtual void MoveSdrDrag(const Point& rPnt) SAL_OVERRIDE;
241 virtual bool EndSdrDrag(bool bCopy) SAL_OVERRIDE;
242 virtual Pointer GetSdrDragPointer() const SAL_OVERRIDE;
244 virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget) SAL_OVERRIDE;
245 virtual void applyCurrentTransformationToPolyPolygon(basegfx::B2DPolyPolygon& rTarget) SAL_OVERRIDE;
249 // SdrDragCrop
251 // derive from SdrDragObjOwn to have handles aligned to object when it
252 // is sheared or rotated
253 class SdrDragCrop : public SdrDragObjOwn
255 public:
256 TYPEINFO_OVERRIDE();
257 SdrDragCrop(SdrDragView& rNewView);
259 virtual void TakeSdrDragComment(OUString& rStr) const SAL_OVERRIDE;
260 virtual bool BeginSdrDrag() SAL_OVERRIDE;
261 virtual bool EndSdrDrag(bool bCopy) SAL_OVERRIDE;
262 virtual Pointer GetSdrDragPointer() const SAL_OVERRIDE;
266 #endif // INCLUDED_SVX_SOURCE_SVDRAW_SVDDRGM1_HXX
268 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */