xref: /aoo4110/main/svx/inc/dragmt3d.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _E3D_DRAGMT3D_HXX
25 #define _E3D_DRAGMT3D_HXX
26 
27 #include <svx/svddrgmt.hxx>
28 #include <svx/view3d.hxx>
29 #include <basegfx/polygon/b3dpolypolygon.hxx>
30 #include <vcl/timer.hxx>
31 #include <basegfx/matrix/b3dhommatrix.hxx>
32 
33 class E3dScene;
34 
35 /*************************************************************************
36 |*
37 |* Parameter fuer Interaktion eines 3D-Objektes
38 |*
39 \************************************************************************/
40 class E3dDragMethodUnit
41 {
42 public:
43 	E3dObject*						mp3DObj;
44 	basegfx::B3DPolyPolygon			maWireframePoly;
45 	basegfx::B3DHomMatrix			maDisplayTransform;
46 	basegfx::B3DHomMatrix			maInvDisplayTransform;
47 	basegfx::B3DHomMatrix           maInitTransform;
48 	basegfx::B3DHomMatrix			maTransform;
49 	sal_Int32						mnStartAngle;
50 	sal_Int32						mnLastAngle;
51 
E3dDragMethodUnit()52 	E3dDragMethodUnit()
53 	:	mp3DObj(0),
54 		maWireframePoly(),
55 		maDisplayTransform(),
56 		maInvDisplayTransform(),
57 		maInitTransform(),
58 		maTransform(),
59 		mnStartAngle(0),
60 		mnLastAngle(0)
61 	{}
62 };
63 
64 /*************************************************************************
65 |*
66 |* Ableitung von SdrDragMethod fuer 3D-Objekte
67 |*
68 \************************************************************************/
69 
70 class E3dDragMethod : public SdrDragMethod
71 {
72 protected:
73 	::std::vector< E3dDragMethodUnit >	maGrp;
74 	E3dDragConstraint					meConstraint;
75 	Point								maLastPos;
76 	Rectangle							maFullBound;
77 	bool								mbMoveFull;
78 	bool								mbMovedAtAll;
79 
80 public:
81 	TYPEINFO();
82 	E3dDragMethod(
83 		SdrDragView &rView,
84 		const SdrMarkList& rMark,
85 		E3dDragConstraint eConstr = E3DDRAG_CONSTR_XYZ,
86 		sal_Bool bFull = sal_False);
87 
88 	virtual void TakeSdrDragComment(String& rStr) const;
89 	virtual bool BeginSdrDrag();
90 	virtual void MoveSdrDrag(const Point& rPnt);
91 	virtual void CancelSdrDrag();
92 	virtual bool EndSdrDrag(bool bCopy);
93 
Get3DView()94 	E3dView& Get3DView()  { return (E3dView&)getSdrDragView();  }
95 
96 	// for migration from XOR to overlay
97 	virtual void CreateOverlayGeometry(::sdr::overlay::OverlayManager& rOverlayManager);
98 };
99 
100 
101 /*************************************************************************
102 |*
103 |* Ableitung von SdrDragMethod zum Drehen von 3D-Objekten
104 |*
105 \************************************************************************/
106 
107 class E3dDragRotate : public E3dDragMethod
108 {
109 	basegfx::B3DPoint					maGlobalCenter;
110 
111 public:
112 	TYPEINFO();
113 	E3dDragRotate(
114 		SdrDragView &rView,
115 		const SdrMarkList& rMark,
116 		E3dDragConstraint eConstr = E3DDRAG_CONSTR_XYZ,
117 		sal_Bool bFull = sal_False);
118 
119 	virtual void MoveSdrDrag(const Point& rPnt);
120 	virtual Pointer GetSdrDragPointer() const;
121 };
122 
123 
124 /*************************************************************************
125 |*
126 |* Ableitung von SdrDragMethod zum Verschieben von 3D-Subobjekten
127 |*
128 \************************************************************************/
129 
130 class E3dDragMove : public E3dDragMethod
131 {
132 	SdrHdlKind				meWhatDragHdl;
133 	Point					maScaleFixPos;
134 
135 public:
136 	TYPEINFO();
137 	E3dDragMove(
138 		SdrDragView &rView,
139 		const SdrMarkList& rMark,
140 		SdrHdlKind eDrgHdl = HDL_MOVE,
141 		E3dDragConstraint eConstr = E3DDRAG_CONSTR_XYZ,
142 		sal_Bool bFull = sal_False);
143 
144 	virtual void MoveSdrDrag(const Point& rPnt);
145 	virtual Pointer GetSdrDragPointer() const;
146 };
147 
148 
149 #endif			// _E3D_DRAGMT3D_HXX
150