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