Adjust includes
[LibreOffice.git] / svx / source / svdraw / svddrgm1.hxx
blob94de57531ff0731bb42cc0de3f89a9241cb67f9a
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>
28 class SdrDragView;
30 class SdrDragMovHdl : public SdrDragMethod
32 protected:
33 // define nothing, override to do so
34 virtual void createSdrDragEntries() override;
36 public:
37 explicit SdrDragMovHdl(SdrDragView& rNewView);
39 virtual void TakeSdrDragComment(OUString& rStr) const override;
40 virtual bool BeginSdrDrag() override;
41 virtual void MoveSdrDrag(const Point& rPnt) override;
42 virtual bool EndSdrDrag(bool bCopy) override;
43 virtual void CancelSdrDrag() override;
44 virtual Pointer GetSdrDragPointer() const override;
47 class SdrDragRotate : public SdrDragMethod
49 private:
50 double nSin;
51 double nCos;
52 long nAngle0;
53 long nAngle;
54 bool bRight;
56 public:
57 explicit SdrDragRotate(SdrDragView& rNewView);
59 virtual void TakeSdrDragComment(OUString& rStr) const override;
60 virtual bool BeginSdrDrag() override;
61 virtual void MoveSdrDrag(const Point& rPnt) override;
62 virtual bool EndSdrDrag(bool bCopy) override;
63 virtual Pointer GetSdrDragPointer() const override;
65 virtual basegfx::B2DHomMatrix getCurrentTransformation() override;
66 virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget) override;
69 class SdrDragShear : public SdrDragMethod
71 private:
72 Fraction aFact;
73 long nAngle0;
74 long nAngle;
75 double nTan;
76 bool bVertical; // contort vertically
77 bool bResize; // shear and resize
78 bool bUpSideDown; // mirror and shear/slant
79 bool bSlant;
81 public:
82 SdrDragShear(SdrDragView& rNewView,bool bSlant1);
84 virtual void TakeSdrDragComment(OUString& rStr) const override;
85 virtual bool BeginSdrDrag() override;
86 virtual void MoveSdrDrag(const Point& rPnt) override;
87 virtual bool EndSdrDrag(bool bCopy) override;
88 virtual Pointer GetSdrDragPointer() const override;
90 virtual basegfx::B2DHomMatrix getCurrentTransformation() override;
91 virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget) override;
94 class SdrDragMirror : public SdrDragMethod
96 private:
97 Point aDif;
98 long nAngle;
99 bool bMirrored;
100 bool bSide0;
102 bool ImpCheckSide(const Point& rPnt) const;
104 public:
105 explicit SdrDragMirror(SdrDragView& rNewView);
107 virtual void TakeSdrDragComment(OUString& rStr) const override;
108 virtual bool BeginSdrDrag() override;
109 virtual void MoveSdrDrag(const Point& rPnt) override;
110 virtual bool EndSdrDrag(bool bCopy) override;
111 virtual Pointer GetSdrDragPointer() const override;
113 virtual basegfx::B2DHomMatrix getCurrentTransformation() override;
114 virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget) override;
117 class SdrDragGradient : public SdrDragMethod
119 private:
120 // Handles to work on
121 SdrHdlGradient* pIAOHandle;
123 // is this for gradient (or for transparency)?
124 bool bIsGradient : 1;
126 public:
127 SdrDragGradient(SdrDragView& rNewView, bool bGrad = true);
129 bool IsGradient() const { return bIsGradient; }
131 virtual void TakeSdrDragComment(OUString& rStr) const override;
132 virtual bool BeginSdrDrag() override;
133 virtual void MoveSdrDrag(const Point& rPnt) override;
134 virtual bool EndSdrDrag(bool bCopy) override;
135 virtual Pointer GetSdrDragPointer() const override;
136 virtual void CancelSdrDrag() override;
139 class SdrDragCrook : public SdrDragMethod
141 private:
142 tools::Rectangle aMarkRect;
143 Point aMarkCenter;
144 Point aCenter;
145 Point aStart;
146 Fraction aFact;
147 Point aRad;
148 bool bContortionAllowed;
149 bool bNoContortionAllowed;
150 bool bContortion;
151 bool bResizeAllowed;
152 bool bResize;
153 bool bRotateAllowed;
154 bool bRotate;
155 bool bVertical;
156 bool bValid;
157 bool bLft;
158 bool bRgt;
159 bool bUpr;
160 bool bLwr;
161 bool bAtCenter;
162 long nAngle;
163 long nMarkSize;
164 SdrCrookMode eMode;
166 // helpers for applyCurrentTransformationToPolyPolygon
167 void MovAllPoints(basegfx::B2DPolyPolygon& rTarget);
168 void MovCrookPoint(Point& rPnt, Point* pC1, Point* pC2);
170 protected:
171 // needs to add drag geometry to the default
172 virtual void createSdrDragEntries() override;
174 public:
175 explicit SdrDragCrook(SdrDragView& rNewView);
177 virtual void TakeSdrDragComment(OUString& rStr) const override;
178 virtual bool BeginSdrDrag() override;
179 virtual void MoveSdrDrag(const Point& rPnt) override;
180 virtual bool EndSdrDrag(bool bCopy) override;
181 virtual Pointer GetSdrDragPointer() const override;
183 virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget) override;
184 virtual void applyCurrentTransformationToPolyPolygon(basegfx::B2DPolyPolygon& rTarget) override;
187 class SdrDragDistort : public SdrDragMethod
189 private:
190 tools::Rectangle aMarkRect;
191 XPolygon aDistortedRect;
192 sal_uInt16 nPolyPt;
193 bool bContortionAllowed;
194 bool bNoContortionAllowed;
195 bool bContortion;
197 // helper for applyCurrentTransformationToPolyPolygon
198 void MovAllPoints(basegfx::B2DPolyPolygon& rTarget);
200 protected:
201 // needs to add drag geometry to the default
202 virtual void createSdrDragEntries() override;
204 public:
205 explicit SdrDragDistort(SdrDragView& rNewView);
207 virtual void TakeSdrDragComment(OUString& rStr) const override;
208 virtual bool BeginSdrDrag() override;
209 virtual void MoveSdrDrag(const Point& rPnt) override;
210 virtual bool EndSdrDrag(bool bCopy) override;
211 virtual Pointer GetSdrDragPointer() const override;
213 virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget) override;
214 virtual void applyCurrentTransformationToPolyPolygon(basegfx::B2DPolyPolygon& rTarget) override;
217 // derive from SdrDragObjOwn to have handles aligned to object when it
218 // is sheared or rotated
219 class SdrDragCrop : public SdrDragObjOwn
221 public:
222 explicit SdrDragCrop(SdrDragView& rNewView);
224 virtual void TakeSdrDragComment(OUString& rStr) const override;
225 virtual bool BeginSdrDrag() override;
226 virtual bool EndSdrDrag(bool bCopy) override;
227 virtual Pointer GetSdrDragPointer() const override;
230 #endif // INCLUDED_SVX_SOURCE_SVDRAW_SVDDRGM1_HXX
232 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */