xref: /aoo41x/main/svx/inc/dragmt3d.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _E3D_DRAGMT3D_HXX
29 #define _E3D_DRAGMT3D_HXX
30 
31 #include <svx/svddrgmt.hxx>
32 #include <svx/view3d.hxx>
33 #include <basegfx/polygon/b3dpolypolygon.hxx>
34 #include <vcl/timer.hxx>
35 #include <basegfx/matrix/b3dhommatrix.hxx>
36 
37 class E3dScene;
38 
39 /*************************************************************************
40 |*
41 |* Parameter fuer Interaktion eines 3D-Objektes
42 |*
43 \************************************************************************/
44 class E3dDragMethodUnit
45 {
46 public:
47 	E3dObject*						mp3DObj;
48 	basegfx::B3DPolyPolygon			maWireframePoly;
49 	basegfx::B3DHomMatrix			maDisplayTransform;
50 	basegfx::B3DHomMatrix			maInvDisplayTransform;
51 	basegfx::B3DHomMatrix           maInitTransform;
52 	basegfx::B3DHomMatrix			maTransform;
53 	sal_Int32						mnStartAngle;
54 	sal_Int32						mnLastAngle;
55 
56 	E3dDragMethodUnit()
57 	:	mp3DObj(0),
58 		maWireframePoly(),
59 		maDisplayTransform(),
60 		maInvDisplayTransform(),
61 		maInitTransform(),
62 		maTransform(),
63 		mnStartAngle(0),
64 		mnLastAngle(0)
65 	{}
66 };
67 
68 /*************************************************************************
69 |*
70 |* Ableitung von SdrDragMethod fuer 3D-Objekte
71 |*
72 \************************************************************************/
73 
74 class E3dDragMethod : public SdrDragMethod
75 {
76 protected:
77 	::std::vector< E3dDragMethodUnit >	maGrp;
78 	E3dDragConstraint					meConstraint;
79 	Point								maLastPos;
80 	Rectangle							maFullBound;
81 	bool								mbMoveFull;
82 	bool								mbMovedAtAll;
83 
84 public:
85 	TYPEINFO();
86 	E3dDragMethod(
87 		SdrDragView &rView,
88 		const SdrMarkList& rMark,
89 		E3dDragConstraint eConstr = E3DDRAG_CONSTR_XYZ,
90 		sal_Bool bFull = sal_False);
91 
92 	virtual void TakeSdrDragComment(String& rStr) const;
93 	virtual bool BeginSdrDrag();
94 	virtual void MoveSdrDrag(const Point& rPnt);
95 	virtual void CancelSdrDrag();
96 	virtual bool EndSdrDrag(bool bCopy);
97 
98 	E3dView& Get3DView()  { return (E3dView&)getSdrDragView();  }
99 
100 	// for migration from XOR to overlay
101 	virtual void CreateOverlayGeometry(::sdr::overlay::OverlayManager& rOverlayManager);
102 };
103 
104 
105 /*************************************************************************
106 |*
107 |* Ableitung von SdrDragMethod zum Drehen von 3D-Objekten
108 |*
109 \************************************************************************/
110 
111 class E3dDragRotate : public E3dDragMethod
112 {
113 	basegfx::B3DPoint					maGlobalCenter;
114 
115 public:
116 	TYPEINFO();
117 	E3dDragRotate(
118 		SdrDragView &rView,
119 		const SdrMarkList& rMark,
120 		E3dDragConstraint eConstr = E3DDRAG_CONSTR_XYZ,
121 		sal_Bool bFull = sal_False);
122 
123 	virtual void MoveSdrDrag(const Point& rPnt);
124 	virtual Pointer GetSdrDragPointer() const;
125 };
126 
127 
128 /*************************************************************************
129 |*
130 |* Ableitung von SdrDragMethod zum Verschieben von 3D-Subobjekten
131 |*
132 \************************************************************************/
133 
134 class E3dDragMove : public E3dDragMethod
135 {
136 	SdrHdlKind				meWhatDragHdl;
137 	Point					maScaleFixPos;
138 
139 public:
140 	TYPEINFO();
141 	E3dDragMove(
142 		SdrDragView &rView,
143 		const SdrMarkList& rMark,
144 		SdrHdlKind eDrgHdl = HDL_MOVE,
145 		E3dDragConstraint eConstr = E3DDRAG_CONSTR_XYZ,
146 		sal_Bool bFull = sal_False);
147 
148 	virtual void MoveSdrDrag(const Point& rPnt);
149 	virtual Pointer GetSdrDragPointer() const;
150 };
151 
152 
153 #endif			// _E3D_DRAGMT3D_HXX
154