1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
23 #include <svx/xpoly.hxx>
24 #include <svx/svdhdl.hxx>
25 #include <svx/svddrgv.hxx>
26 #include <svx/svddrgmt.hxx>
28 ////////////////////////////////////////////////////////////////////////////////////////////////////
33 ////////////////////////////////////////////////////////////////////////////////////////////////////
36 class SdrDragMovHdl
: public SdrDragMethod
39 // define nothing, overload to do so
40 virtual void createSdrDragEntries();
44 SdrDragMovHdl(SdrDragView
& rNewView
);
46 virtual void TakeSdrDragComment(String
& rStr
) const;
47 virtual bool BeginSdrDrag();
48 virtual void MoveSdrDrag(const Point
& rPnt
);
49 virtual bool EndSdrDrag(bool bCopy
);
50 virtual void CancelSdrDrag();
51 virtual Pointer
GetSdrDragPointer() const;
54 ////////////////////////////////////////////////////////////////////////////////////////////////////
57 class SdrDragRotate
: public SdrDragMethod
68 SdrDragRotate(SdrDragView
& rNewView
);
70 virtual void TakeSdrDragComment(String
& rStr
) const;
71 virtual bool BeginSdrDrag();
72 virtual void MoveSdrDrag(const Point
& rPnt
);
73 virtual bool EndSdrDrag(bool bCopy
);
74 virtual Pointer
GetSdrDragPointer() const;
76 virtual basegfx::B2DHomMatrix
getCurrentTransformation();
77 virtual void applyCurrentTransformationToSdrObject(SdrObject
& rTarget
);
80 ////////////////////////////////////////////////////////////////////////////////////////////////////
83 class SdrDragShear
: public SdrDragMethod
90 bool bVertical
; // contort vertically
91 bool bResize
; // shear and resize
92 bool bUpSideDown
; // mirror and shear/slant
97 SdrDragShear(SdrDragView
& rNewView
,bool bSlant1
);
99 virtual void TakeSdrDragComment(String
& rStr
) const;
100 virtual bool BeginSdrDrag();
101 virtual void MoveSdrDrag(const Point
& rPnt
);
102 virtual bool EndSdrDrag(bool bCopy
);
103 virtual Pointer
GetSdrDragPointer() const;
105 virtual basegfx::B2DHomMatrix
getCurrentTransformation();
106 virtual void applyCurrentTransformationToSdrObject(SdrObject
& rTarget
);
109 ////////////////////////////////////////////////////////////////////////////////////////////////////
112 class SdrDragMirror
: public SdrDragMethod
120 bool ImpCheckSide(const Point
& rPnt
) const;
124 SdrDragMirror(SdrDragView
& rNewView
);
126 virtual void TakeSdrDragComment(String
& rStr
) const;
127 virtual bool BeginSdrDrag();
128 virtual void MoveSdrDrag(const Point
& rPnt
);
129 virtual bool EndSdrDrag(bool bCopy
);
130 virtual Pointer
GetSdrDragPointer() const;
132 virtual basegfx::B2DHomMatrix
getCurrentTransformation();
133 virtual void applyCurrentTransformationToSdrObject(SdrObject
& rTarget
);
136 ////////////////////////////////////////////////////////////////////////////////////////////////////
139 class SdrDragGradient
: public SdrDragMethod
142 // Handles to work on
143 SdrHdlGradient
* pIAOHandle
;
145 // is this for gradient (or for transparency)?
146 unsigned bIsGradient
: 1;
150 SdrDragGradient(SdrDragView
& rNewView
, bool bGrad
= true);
152 bool IsGradient() const { return bIsGradient
; }
154 virtual void TakeSdrDragComment(String
& rStr
) const;
155 virtual bool BeginSdrDrag();
156 virtual void MoveSdrDrag(const Point
& rPnt
);
157 virtual bool EndSdrDrag(bool bCopy
);
158 virtual Pointer
GetSdrDragPointer() const;
159 virtual void CancelSdrDrag();
162 ////////////////////////////////////////////////////////////////////////////////////////////////////
165 class SdrDragCrook
: public SdrDragMethod
174 bool bContortionAllowed
;
175 bool bNoContortionAllowed
;
192 // helpers for applyCurrentTransformationToPolyPolygon
193 void _MovAllPoints(basegfx::B2DPolyPolygon
& rTarget
);
194 void _MovCrookPoint(Point
& rPnt
, Point
* pC1
, Point
* pC2
);
197 // needs to add drag geometry to the default
198 virtual void createSdrDragEntries();
202 SdrDragCrook(SdrDragView
& rNewView
);
204 virtual void TakeSdrDragComment(String
& rStr
) const;
205 virtual bool BeginSdrDrag();
206 virtual void MoveSdrDrag(const Point
& rPnt
);
207 virtual bool EndSdrDrag(bool bCopy
);
208 virtual Pointer
GetSdrDragPointer() const;
210 virtual void applyCurrentTransformationToSdrObject(SdrObject
& rTarget
);
211 virtual void applyCurrentTransformationToPolyPolygon(basegfx::B2DPolyPolygon
& rTarget
);
214 ////////////////////////////////////////////////////////////////////////////////////////////////////
217 class SdrDragDistort
: public SdrDragMethod
221 XPolygon aDistortedRect
;
223 bool bContortionAllowed
;
224 bool bNoContortionAllowed
;
227 // helper for applyCurrentTransformationToPolyPolygon
228 void _MovAllPoints(basegfx::B2DPolyPolygon
& rTarget
);
231 // needs to add drag geometry to the default
232 virtual void createSdrDragEntries();
236 SdrDragDistort(SdrDragView
& rNewView
);
238 virtual void TakeSdrDragComment(String
& rStr
) const;
239 virtual bool BeginSdrDrag();
240 virtual void MoveSdrDrag(const Point
& rPnt
);
241 virtual bool EndSdrDrag(bool bCopy
);
242 virtual Pointer
GetSdrDragPointer() const;
244 virtual void applyCurrentTransformationToSdrObject(SdrObject
& rTarget
);
245 virtual void applyCurrentTransformationToPolyPolygon(basegfx::B2DPolyPolygon
& rTarget
);
248 ////////////////////////////////////////////////////////////////////////////////////////////////////
251 class SdrDragCrop
: public SdrDragResize
255 SdrDragCrop(SdrDragView
& rNewView
);
257 virtual void TakeSdrDragComment(String
& rStr
) const;
258 virtual bool EndSdrDrag(bool bCopy
);
259 virtual Pointer
GetSdrDragPointer() const;
262 ////////////////////////////////////////////////////////////////////////////////////////////////////
263 #endif //_SVDDRGM1_HXX
265 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */