xref: /aoo42x/main/svx/source/engine3d/dragmt3d.cxx (revision f6e50924)
1*f6e50924SAndrew Rist /**************************************************************
2*f6e50924SAndrew Rist  *
3*f6e50924SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*f6e50924SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*f6e50924SAndrew Rist  * distributed with this work for additional information
6*f6e50924SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*f6e50924SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*f6e50924SAndrew Rist  * "License"); you may not use this file except in compliance
9*f6e50924SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*f6e50924SAndrew Rist  *
11*f6e50924SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*f6e50924SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*f6e50924SAndrew Rist  * software distributed under the License is distributed on an
15*f6e50924SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f6e50924SAndrew Rist  * KIND, either express or implied.  See the License for the
17*f6e50924SAndrew Rist  * specific language governing permissions and limitations
18*f6e50924SAndrew Rist  * under the License.
19*f6e50924SAndrew Rist  *
20*f6e50924SAndrew Rist  *************************************************************/
21*f6e50924SAndrew Rist 
22*f6e50924SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svx.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <dragmt3d.hxx>
28cdf0e10cSrcweir #include <tools/shl.hxx>
29cdf0e10cSrcweir #include <svx/svdpagv.hxx>
30cdf0e10cSrcweir #include <svx/dialmgr.hxx>
31cdf0e10cSrcweir #include <svx/svddrgmt.hxx>
32cdf0e10cSrcweir #include <svx/svdtrans.hxx>
33cdf0e10cSrcweir #include <svx/obj3d.hxx>
34cdf0e10cSrcweir #include <svx/polysc3d.hxx>
35cdf0e10cSrcweir #include <svx/e3dundo.hxx>
36cdf0e10cSrcweir #include <svx/dialogs.hrc>
37cdf0e10cSrcweir #include <svx/sdr/overlay/overlaypolypolygon.hxx>
38cdf0e10cSrcweir #include <svx/sdr/overlay/overlaymanager.hxx>
39cdf0e10cSrcweir #include <basegfx/polygon/b2dpolypolygontools.hxx>
40cdf0e10cSrcweir #include <svx/sdr/contact/viewcontactofe3dscene.hxx>
41cdf0e10cSrcweir #include <drawinglayer/geometry/viewinformation3d.hxx>
42cdf0e10cSrcweir #include <svx/e3dsceneupdater.hxx>
43cdf0e10cSrcweir 
44cdf0e10cSrcweir TYPEINIT1(E3dDragMethod, SdrDragMethod);
45cdf0e10cSrcweir 
46cdf0e10cSrcweir /*************************************************************************
47cdf0e10cSrcweir |*
48cdf0e10cSrcweir |* Konstruktor aller 3D-DragMethoden
49cdf0e10cSrcweir |*
50cdf0e10cSrcweir \************************************************************************/
51cdf0e10cSrcweir 
52cdf0e10cSrcweir E3dDragMethod::E3dDragMethod (
53cdf0e10cSrcweir 	SdrDragView &_rView,
54cdf0e10cSrcweir 	const SdrMarkList& rMark,
55cdf0e10cSrcweir 	E3dDragConstraint eConstr,
56cdf0e10cSrcweir 	sal_Bool bFull)
57cdf0e10cSrcweir :	SdrDragMethod(_rView),
58cdf0e10cSrcweir 	meConstraint(eConstr),
59cdf0e10cSrcweir 	mbMoveFull(bFull),
60cdf0e10cSrcweir 	mbMovedAtAll(sal_False)
61cdf0e10cSrcweir {
62cdf0e10cSrcweir 	// Fuer alle in der selektion befindlichen 3D-Objekte
63cdf0e10cSrcweir 	// eine Unit anlegen
64cdf0e10cSrcweir 	const long nCnt(rMark.GetMarkCount());
65cdf0e10cSrcweir 	static bool bDoInvalidate(false);
66cdf0e10cSrcweir 	long nObjs(0);
67cdf0e10cSrcweir 
68cdf0e10cSrcweir 	if(mbMoveFull)
69cdf0e10cSrcweir 	{
70cdf0e10cSrcweir 		// for non-visible 3D objects fallback to wireframe interaction
71cdf0e10cSrcweir 		bool bInvisibleObjects(false);
72cdf0e10cSrcweir 
73cdf0e10cSrcweir 		for(nObjs = 0;!bInvisibleObjects && nObjs < nCnt;nObjs++)
74cdf0e10cSrcweir 		{
75cdf0e10cSrcweir 			E3dObject* pE3dObj = dynamic_cast< E3dObject* >(rMark.GetMark(nObjs)->GetMarkedSdrObj());
76cdf0e10cSrcweir 
77cdf0e10cSrcweir 			if(pE3dObj)
78cdf0e10cSrcweir 			{
79cdf0e10cSrcweir 				if(!pE3dObj->HasFillStyle() && !pE3dObj->HasLineStyle())
80cdf0e10cSrcweir 				{
81cdf0e10cSrcweir 					bInvisibleObjects = true;
82cdf0e10cSrcweir 				}
83cdf0e10cSrcweir 			}
84cdf0e10cSrcweir 		}
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 		if(bInvisibleObjects)
87cdf0e10cSrcweir 		{
88cdf0e10cSrcweir 			mbMoveFull = false;
89cdf0e10cSrcweir 		}
90cdf0e10cSrcweir 	}
91cdf0e10cSrcweir 
92cdf0e10cSrcweir 	for(nObjs = 0;nObjs < nCnt;nObjs++)
93cdf0e10cSrcweir 	{
94cdf0e10cSrcweir 		E3dObject* pE3dObj = dynamic_cast< E3dObject* >(rMark.GetMark(nObjs)->GetMarkedSdrObj());
95cdf0e10cSrcweir 
96cdf0e10cSrcweir 		if(pE3dObj)
97cdf0e10cSrcweir 		{
98cdf0e10cSrcweir 			// fill new interaction unit
99cdf0e10cSrcweir 			E3dDragMethodUnit aNewUnit;
100cdf0e10cSrcweir 			aNewUnit.mp3DObj = pE3dObj;
101cdf0e10cSrcweir 
102cdf0e10cSrcweir 			// get transformations
103cdf0e10cSrcweir 			aNewUnit.maInitTransform = aNewUnit.maTransform = pE3dObj->GetTransform();
104cdf0e10cSrcweir 
105cdf0e10cSrcweir 			if(pE3dObj->GetParentObj())
106cdf0e10cSrcweir 			{
107cdf0e10cSrcweir 				// get transform between object and world, normally scene transform
108cdf0e10cSrcweir 				aNewUnit.maInvDisplayTransform = aNewUnit.maDisplayTransform = pE3dObj->GetParentObj()->GetFullTransform();
109cdf0e10cSrcweir 				aNewUnit.maInvDisplayTransform.invert();
110cdf0e10cSrcweir 			}
111cdf0e10cSrcweir 
112cdf0e10cSrcweir 			// SnapRects der beteiligten Objekte invalidieren, um eine
113cdf0e10cSrcweir 			// Neuberechnung beim Setzen der Marker zu erzwingen
114cdf0e10cSrcweir 			if(bDoInvalidate)
115cdf0e10cSrcweir 			{
116cdf0e10cSrcweir 				pE3dObj->SetRectsDirty();
117cdf0e10cSrcweir 			}
118cdf0e10cSrcweir 
119cdf0e10cSrcweir 			if(!mbMoveFull)
120cdf0e10cSrcweir 			{
121cdf0e10cSrcweir 				// create wireframe visualisation for parent coordinate system
122cdf0e10cSrcweir 				aNewUnit.maWireframePoly.clear();
123cdf0e10cSrcweir 				aNewUnit.maWireframePoly = pE3dObj->CreateWireframe();
124cdf0e10cSrcweir 				aNewUnit.maWireframePoly.transform(aNewUnit.maTransform);
125cdf0e10cSrcweir 			}
126cdf0e10cSrcweir 
127cdf0e10cSrcweir 			// FullBound ermitteln
128cdf0e10cSrcweir 			maFullBound.Union(pE3dObj->GetSnapRect());
129cdf0e10cSrcweir 
130cdf0e10cSrcweir 			// Unit einfuegen
131cdf0e10cSrcweir 			maGrp.push_back(aNewUnit);
132cdf0e10cSrcweir 		}
133cdf0e10cSrcweir 	}
134cdf0e10cSrcweir }
135cdf0e10cSrcweir 
136cdf0e10cSrcweir /*************************************************************************
137cdf0e10cSrcweir |*
138cdf0e10cSrcweir \************************************************************************/
139cdf0e10cSrcweir 
140cdf0e10cSrcweir void E3dDragMethod::TakeSdrDragComment(XubString& /*rStr*/) const
141cdf0e10cSrcweir {
142cdf0e10cSrcweir }
143cdf0e10cSrcweir 
144cdf0e10cSrcweir /*************************************************************************
145cdf0e10cSrcweir |*
146cdf0e10cSrcweir |* Erstelle das Drahtgittermodel fuer alle Aktionen
147cdf0e10cSrcweir |*
148cdf0e10cSrcweir \************************************************************************/
149cdf0e10cSrcweir 
150cdf0e10cSrcweir bool E3dDragMethod::BeginSdrDrag()
151cdf0e10cSrcweir {
152cdf0e10cSrcweir 	if(E3DDRAG_CONSTR_Z == meConstraint)
153cdf0e10cSrcweir 	{
154cdf0e10cSrcweir 		const sal_uInt32 nCnt(maGrp.size());
155cdf0e10cSrcweir 		DragStat().Ref1() = maFullBound.Center();
156cdf0e10cSrcweir 
157cdf0e10cSrcweir 		for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
158cdf0e10cSrcweir 		{
159cdf0e10cSrcweir 			E3dDragMethodUnit& rCandidate = maGrp[nOb];
160cdf0e10cSrcweir 			rCandidate.mnStartAngle = GetAngle(DragStat().GetStart() - DragStat().GetRef1());
161cdf0e10cSrcweir 			rCandidate.mnLastAngle = 0;
162cdf0e10cSrcweir 		}
163cdf0e10cSrcweir 	}
164cdf0e10cSrcweir 	else
165cdf0e10cSrcweir 	{
166cdf0e10cSrcweir 		maLastPos = DragStat().GetStart();
167cdf0e10cSrcweir 	}
168cdf0e10cSrcweir 
169cdf0e10cSrcweir 	if(!mbMoveFull)
170cdf0e10cSrcweir 	{
171cdf0e10cSrcweir 		Show();
172cdf0e10cSrcweir 	}
173cdf0e10cSrcweir 
174cdf0e10cSrcweir 	return sal_True;
175cdf0e10cSrcweir }
176cdf0e10cSrcweir 
177cdf0e10cSrcweir /*************************************************************************
178cdf0e10cSrcweir |*
179cdf0e10cSrcweir |* Schluss
180cdf0e10cSrcweir |*
181cdf0e10cSrcweir \************************************************************************/
182cdf0e10cSrcweir 
183cdf0e10cSrcweir bool E3dDragMethod::EndSdrDrag(bool /*bCopy*/)
184cdf0e10cSrcweir {
185cdf0e10cSrcweir 	const sal_uInt32 nCnt(maGrp.size());
186cdf0e10cSrcweir 
187cdf0e10cSrcweir 	if(!mbMoveFull)
188cdf0e10cSrcweir 	{
189cdf0e10cSrcweir 		// WireFrame ausblenden
190cdf0e10cSrcweir 		Hide();
191cdf0e10cSrcweir 	}
192cdf0e10cSrcweir 
193cdf0e10cSrcweir 	// Alle Transformationen anwenden und UnDo's anlegen
194cdf0e10cSrcweir 	if(mbMovedAtAll)
195cdf0e10cSrcweir 	{
196cdf0e10cSrcweir 		const bool bUndo = getSdrDragView().IsUndoEnabled();
197cdf0e10cSrcweir 		if( bUndo )
198cdf0e10cSrcweir 			getSdrDragView().BegUndo(SVX_RESSTR(RID_SVX_3D_UNDO_ROTATE));
199cdf0e10cSrcweir 		sal_uInt32 nOb(0);
200cdf0e10cSrcweir 
201cdf0e10cSrcweir 		for(nOb=0;nOb<nCnt;nOb++)
202cdf0e10cSrcweir 		{
203cdf0e10cSrcweir 			E3dDragMethodUnit& rCandidate = maGrp[nOb];
204cdf0e10cSrcweir 			E3DModifySceneSnapRectUpdater aUpdater(rCandidate.mp3DObj);
205cdf0e10cSrcweir 			rCandidate.mp3DObj->SetTransform(rCandidate.maTransform);
206cdf0e10cSrcweir 			if( bUndo )
207cdf0e10cSrcweir 			{
208cdf0e10cSrcweir 				getSdrDragView().AddUndo(new E3dRotateUndoAction(rCandidate.mp3DObj->GetModel(),
209cdf0e10cSrcweir 					rCandidate.mp3DObj, rCandidate.maInitTransform,
210cdf0e10cSrcweir 					rCandidate.maTransform));
211cdf0e10cSrcweir 			}
212cdf0e10cSrcweir 		}
213cdf0e10cSrcweir 		if( bUndo )
214cdf0e10cSrcweir 			getSdrDragView().EndUndo();
215cdf0e10cSrcweir 	}
216cdf0e10cSrcweir 
217cdf0e10cSrcweir 	return sal_True;
218cdf0e10cSrcweir }
219cdf0e10cSrcweir 
220cdf0e10cSrcweir /*************************************************************************
221cdf0e10cSrcweir |*
222cdf0e10cSrcweir |* Abbruch
223cdf0e10cSrcweir |*
224cdf0e10cSrcweir \************************************************************************/
225cdf0e10cSrcweir 
226cdf0e10cSrcweir void E3dDragMethod::CancelSdrDrag()
227cdf0e10cSrcweir {
228cdf0e10cSrcweir 	if(mbMoveFull)
229cdf0e10cSrcweir 	{
230cdf0e10cSrcweir 		if(mbMovedAtAll)
231cdf0e10cSrcweir 		{
232cdf0e10cSrcweir 			const sal_uInt32 nCnt(maGrp.size());
233cdf0e10cSrcweir 
234cdf0e10cSrcweir 			for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
235cdf0e10cSrcweir 			{
236cdf0e10cSrcweir 				// Transformation restaurieren
237cdf0e10cSrcweir 				E3dDragMethodUnit& rCandidate = maGrp[nOb];
238cdf0e10cSrcweir     			E3DModifySceneSnapRectUpdater aUpdater(rCandidate.mp3DObj);
239cdf0e10cSrcweir 				rCandidate.mp3DObj->SetTransform(rCandidate.maInitTransform);
240cdf0e10cSrcweir 			}
241cdf0e10cSrcweir 		}
242cdf0e10cSrcweir 	}
243cdf0e10cSrcweir 	else
244cdf0e10cSrcweir 	{
245cdf0e10cSrcweir 		// WireFrame ausblenden
246cdf0e10cSrcweir 		Hide();
247cdf0e10cSrcweir 	}
248cdf0e10cSrcweir }
249cdf0e10cSrcweir 
250cdf0e10cSrcweir /*************************************************************************
251cdf0e10cSrcweir |*
252cdf0e10cSrcweir |* Gemeinsames MoveSdrDrag()
253cdf0e10cSrcweir |*
254cdf0e10cSrcweir \************************************************************************/
255cdf0e10cSrcweir 
256cdf0e10cSrcweir void E3dDragMethod::MoveSdrDrag(const Point& /*rPnt*/)
257cdf0e10cSrcweir {
258cdf0e10cSrcweir 	mbMovedAtAll = true;
259cdf0e10cSrcweir }
260cdf0e10cSrcweir 
261cdf0e10cSrcweir /*************************************************************************
262cdf0e10cSrcweir |*
263cdf0e10cSrcweir |* Zeichne das Drahtgittermodel
264cdf0e10cSrcweir |*
265cdf0e10cSrcweir \************************************************************************/
266cdf0e10cSrcweir 
267cdf0e10cSrcweir // for migration from XOR to overlay
268cdf0e10cSrcweir void E3dDragMethod::CreateOverlayGeometry(::sdr::overlay::OverlayManager& rOverlayManager)
269cdf0e10cSrcweir {
270cdf0e10cSrcweir 	const sal_uInt32 nCnt(maGrp.size());
271cdf0e10cSrcweir 	basegfx::B2DPolyPolygon aResult;
272cdf0e10cSrcweir 
273cdf0e10cSrcweir 	for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
274cdf0e10cSrcweir 	{
275cdf0e10cSrcweir 		E3dDragMethodUnit& rCandidate = maGrp[nOb];
276cdf0e10cSrcweir 		SdrPageView* pPV = getSdrDragView().GetSdrPageView();
277cdf0e10cSrcweir 
278cdf0e10cSrcweir 		if(pPV && pPV->HasMarkedObjPageView())
279cdf0e10cSrcweir 		{
280cdf0e10cSrcweir 			const basegfx::B3DPolyPolygon aCandidate(rCandidate.maWireframePoly);
281cdf0e10cSrcweir 			const sal_uInt32 nPlyCnt(aCandidate.count());
282cdf0e10cSrcweir 
283cdf0e10cSrcweir 			if(nPlyCnt)
284cdf0e10cSrcweir 			{
285cdf0e10cSrcweir 				const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mp3DObj->GetScene()->GetViewContact());
286cdf0e10cSrcweir 				const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
287cdf0e10cSrcweir 				const basegfx::B3DHomMatrix aWorldToView(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection() * aViewInfo3D.getOrientation());
288cdf0e10cSrcweir 				const basegfx::B3DHomMatrix aTransform(aWorldToView * rCandidate.maDisplayTransform);
289cdf0e10cSrcweir 
290cdf0e10cSrcweir 				// transform to relative scene coordinates
291cdf0e10cSrcweir 				basegfx::B2DPolyPolygon aPolyPolygon(basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(aCandidate, aTransform));
292cdf0e10cSrcweir 
293cdf0e10cSrcweir 				// transform to 2D view coordinates
294cdf0e10cSrcweir 				aPolyPolygon.transform(rVCScene.getObjectTransformation());
295cdf0e10cSrcweir 
296cdf0e10cSrcweir 				aResult.append(aPolyPolygon);
297cdf0e10cSrcweir 			}
298cdf0e10cSrcweir 		}
299cdf0e10cSrcweir 	}
300cdf0e10cSrcweir 
301cdf0e10cSrcweir 	if(aResult.count())
302cdf0e10cSrcweir 	{
303cdf0e10cSrcweir 		::sdr::overlay::OverlayPolyPolygonStriped* pNew = new ::sdr::overlay::OverlayPolyPolygonStriped(aResult);
304cdf0e10cSrcweir 		rOverlayManager.add(*pNew);
305cdf0e10cSrcweir 		addToOverlayObjectList(*pNew);
306cdf0e10cSrcweir 	}
307cdf0e10cSrcweir }
308cdf0e10cSrcweir 
309cdf0e10cSrcweir /*************************************************************************
310cdf0e10cSrcweir 
311cdf0e10cSrcweir 								E3dDragRotate
312cdf0e10cSrcweir 
313cdf0e10cSrcweir *************************************************************************/
314cdf0e10cSrcweir 
315cdf0e10cSrcweir TYPEINIT1(E3dDragRotate, E3dDragMethod);
316cdf0e10cSrcweir 
317cdf0e10cSrcweir E3dDragRotate::E3dDragRotate(SdrDragView &_rView,
318cdf0e10cSrcweir 	const SdrMarkList& rMark,
319cdf0e10cSrcweir 	E3dDragConstraint eConstr,
320cdf0e10cSrcweir 	sal_Bool bFull)
321cdf0e10cSrcweir :	E3dDragMethod(_rView, rMark, eConstr, bFull)
322cdf0e10cSrcweir {
323cdf0e10cSrcweir 	// Zentrum aller selektierten Objekte in Augkoordinaten holen
324cdf0e10cSrcweir 	const sal_uInt32 nCnt(maGrp.size());
325cdf0e10cSrcweir 
326cdf0e10cSrcweir 	if(nCnt)
327cdf0e10cSrcweir 	{
328cdf0e10cSrcweir 		const E3dScene *pScene = maGrp[0].mp3DObj->GetScene();
329cdf0e10cSrcweir 
330cdf0e10cSrcweir 		if(pScene)
331cdf0e10cSrcweir 		{
332cdf0e10cSrcweir 			const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact());
333cdf0e10cSrcweir 			const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
334cdf0e10cSrcweir 
335cdf0e10cSrcweir 			for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
336cdf0e10cSrcweir 			{
337cdf0e10cSrcweir 				E3dDragMethodUnit& rCandidate = maGrp[nOb];
338cdf0e10cSrcweir 				basegfx::B3DPoint aObjCenter = rCandidate.mp3DObj->GetBoundVolume().getCenter();
339cdf0e10cSrcweir 				const basegfx::B3DHomMatrix aTransform(aViewInfo3D.getOrientation() * rCandidate.maDisplayTransform * rCandidate.maInitTransform);
340cdf0e10cSrcweir 
341cdf0e10cSrcweir 				aObjCenter = aTransform * aObjCenter;
342cdf0e10cSrcweir 				maGlobalCenter += aObjCenter;
343cdf0e10cSrcweir 			}
344cdf0e10cSrcweir 
345cdf0e10cSrcweir 			// Teilen durch Anzahl
346cdf0e10cSrcweir 			if(nCnt > 1)
347cdf0e10cSrcweir 			{
348cdf0e10cSrcweir 				maGlobalCenter /= (double)nCnt;
349cdf0e10cSrcweir 			}
350cdf0e10cSrcweir 
351cdf0e10cSrcweir 			// get rotate center and transform to 3D eye coordinates
352cdf0e10cSrcweir 			basegfx::B2DPoint aRotCenter2D(Ref1().X(), Ref1().Y());
353cdf0e10cSrcweir 
354cdf0e10cSrcweir 			// from world to relative scene using inverse getObjectTransformation()
355cdf0e10cSrcweir 			basegfx::B2DHomMatrix aInverseObjectTransform(rVCScene.getObjectTransformation());
356cdf0e10cSrcweir 			aInverseObjectTransform.invert();
357cdf0e10cSrcweir 			aRotCenter2D = aInverseObjectTransform * aRotCenter2D;
358cdf0e10cSrcweir 
359cdf0e10cSrcweir 			// from 3D view to 3D eye
360cdf0e10cSrcweir 			basegfx::B3DPoint aRotCenter3D(aRotCenter2D.getX(), aRotCenter2D.getY(), 0.0);
361cdf0e10cSrcweir 			basegfx::B3DHomMatrix aInverseViewToEye(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection());
362cdf0e10cSrcweir 			aInverseViewToEye.invert();
363cdf0e10cSrcweir 			aRotCenter3D = aInverseViewToEye * aRotCenter3D;
364cdf0e10cSrcweir 
365cdf0e10cSrcweir 		// X,Y des RotCenter und Tiefe der gemeinsamen Objektmitte aus
366cdf0e10cSrcweir 		// Rotationspunkt im Raum benutzen
367cdf0e10cSrcweir 			maGlobalCenter.setX(aRotCenter3D.getX());
368cdf0e10cSrcweir 			maGlobalCenter.setY(aRotCenter3D.getY());
369cdf0e10cSrcweir 		}
370cdf0e10cSrcweir 	}
371cdf0e10cSrcweir }
372cdf0e10cSrcweir 
373cdf0e10cSrcweir /*************************************************************************
374cdf0e10cSrcweir |*
375cdf0e10cSrcweir |* Das Objekt wird bewegt, bestimme die Winkel
376cdf0e10cSrcweir |*
377cdf0e10cSrcweir \************************************************************************/
378cdf0e10cSrcweir 
379cdf0e10cSrcweir void E3dDragRotate::MoveSdrDrag(const Point& rPnt)
380cdf0e10cSrcweir {
381cdf0e10cSrcweir 	// call parent
382cdf0e10cSrcweir 	E3dDragMethod::MoveSdrDrag(rPnt);
383cdf0e10cSrcweir 
384cdf0e10cSrcweir 	if(DragStat().CheckMinMoved(rPnt))
385cdf0e10cSrcweir 	{
386cdf0e10cSrcweir 		// Modifier holen
387cdf0e10cSrcweir 		sal_uInt16 nModifier = 0;
388cdf0e10cSrcweir 		if(getSdrDragView().ISA(E3dView))
389cdf0e10cSrcweir 		{
390cdf0e10cSrcweir 			const MouseEvent& rLastMouse = ((E3dView&)getSdrDragView()).GetMouseEvent();
391cdf0e10cSrcweir 			nModifier = rLastMouse.GetModifier();
392cdf0e10cSrcweir 		}
393cdf0e10cSrcweir 
394cdf0e10cSrcweir 		// Alle Objekte rotieren
395cdf0e10cSrcweir 		const sal_uInt32 nCnt(maGrp.size());
396cdf0e10cSrcweir 
397cdf0e10cSrcweir 		for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
398cdf0e10cSrcweir 		{
399cdf0e10cSrcweir 			// Rotationswinkel bestimmen
400cdf0e10cSrcweir 			double fWAngle, fHAngle;
401cdf0e10cSrcweir 			E3dDragMethodUnit& rCandidate = maGrp[nOb];
402cdf0e10cSrcweir 
403cdf0e10cSrcweir 			if(E3DDRAG_CONSTR_Z == meConstraint)
404cdf0e10cSrcweir 			{
405cdf0e10cSrcweir 				fWAngle = NormAngle360(GetAngle(rPnt - DragStat().GetRef1()) -
406cdf0e10cSrcweir 					rCandidate.mnStartAngle) - rCandidate.mnLastAngle;
407cdf0e10cSrcweir 				rCandidate.mnLastAngle = (long)fWAngle + rCandidate.mnLastAngle;
408cdf0e10cSrcweir 				fWAngle /= 100.0;
409cdf0e10cSrcweir 				fHAngle = 0.0;
410cdf0e10cSrcweir 			}
411cdf0e10cSrcweir 			else
412cdf0e10cSrcweir 			{
413cdf0e10cSrcweir 				fWAngle = 90.0 * (double)(rPnt.X() - maLastPos.X())
414cdf0e10cSrcweir 					/ (double)maFullBound.GetWidth();
415cdf0e10cSrcweir 				fHAngle = 90.0 * (double)(rPnt.Y() - maLastPos.Y())
416cdf0e10cSrcweir 					/ (double)maFullBound.GetHeight();
417cdf0e10cSrcweir 			}
418cdf0e10cSrcweir 			long nSnap = 0;
419cdf0e10cSrcweir 
420cdf0e10cSrcweir 			if(!getSdrDragView().IsRotateAllowed(sal_False))
421cdf0e10cSrcweir 				nSnap = 90;
422cdf0e10cSrcweir 
423cdf0e10cSrcweir 			if(nSnap != 0)
424cdf0e10cSrcweir 			{
425cdf0e10cSrcweir 				fWAngle = (double)(((long) fWAngle + nSnap/2) / nSnap * nSnap);
426cdf0e10cSrcweir 				fHAngle = (double)(((long) fHAngle + nSnap/2) / nSnap * nSnap);
427cdf0e10cSrcweir 			}
428cdf0e10cSrcweir 
429cdf0e10cSrcweir 			// nach radiant
430cdf0e10cSrcweir 			fWAngle *= F_PI180;
431cdf0e10cSrcweir 			fHAngle *= F_PI180;
432cdf0e10cSrcweir 
433cdf0e10cSrcweir 			// Transformation bestimmen
434cdf0e10cSrcweir 			basegfx::B3DHomMatrix aRotMat;
435cdf0e10cSrcweir 			if(E3DDRAG_CONSTR_Y & meConstraint)
436cdf0e10cSrcweir 			{
437cdf0e10cSrcweir 				if(nModifier & KEY_MOD2)
438cdf0e10cSrcweir 					aRotMat.rotate(0.0, 0.0, fWAngle);
439cdf0e10cSrcweir 				else
440cdf0e10cSrcweir 					aRotMat.rotate(0.0, fWAngle, 0.0);
441cdf0e10cSrcweir 			}
442cdf0e10cSrcweir 			else if(E3DDRAG_CONSTR_Z & meConstraint)
443cdf0e10cSrcweir 			{
444cdf0e10cSrcweir 				if(nModifier & KEY_MOD2)
445cdf0e10cSrcweir 					aRotMat.rotate(0.0, fWAngle, 0.0);
446cdf0e10cSrcweir 				else
447cdf0e10cSrcweir 					aRotMat.rotate(0.0, 0.0, fWAngle);
448cdf0e10cSrcweir 			}
449cdf0e10cSrcweir 			if(E3DDRAG_CONSTR_X & meConstraint)
450cdf0e10cSrcweir 			{
451cdf0e10cSrcweir 				aRotMat.rotate(fHAngle, 0.0, 0.0);
452cdf0e10cSrcweir 			}
453cdf0e10cSrcweir 
454cdf0e10cSrcweir 			// Transformation in Eye-Koordinaten, dort rotieren
455cdf0e10cSrcweir 			// und zurueck
456cdf0e10cSrcweir 			const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mp3DObj->GetScene()->GetViewContact());
457cdf0e10cSrcweir 			const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
458cdf0e10cSrcweir 			basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation());
459cdf0e10cSrcweir 			aInverseOrientation.invert();
460cdf0e10cSrcweir 
461cdf0e10cSrcweir 			basegfx::B3DHomMatrix aTransMat(rCandidate.maDisplayTransform);
462cdf0e10cSrcweir 			aTransMat *= aViewInfo3D.getOrientation();
463cdf0e10cSrcweir 			aTransMat.translate(-maGlobalCenter.getX(), -maGlobalCenter.getY(), -maGlobalCenter.getZ());
464cdf0e10cSrcweir 			aTransMat *= aRotMat;
465cdf0e10cSrcweir 			aTransMat.translate(maGlobalCenter.getX(), maGlobalCenter.getY(), maGlobalCenter.getZ());
466cdf0e10cSrcweir 			aTransMat *= aInverseOrientation;
467cdf0e10cSrcweir 			aTransMat *= rCandidate.maInvDisplayTransform;
468cdf0e10cSrcweir 
469cdf0e10cSrcweir 			// ...und anwenden
470cdf0e10cSrcweir 			rCandidate.maTransform *= aTransMat;
471cdf0e10cSrcweir 
472cdf0e10cSrcweir 			if(mbMoveFull)
473cdf0e10cSrcweir 			{
474cdf0e10cSrcweir         		E3DModifySceneSnapRectUpdater aUpdater(rCandidate.mp3DObj);
475cdf0e10cSrcweir 				rCandidate.mp3DObj->SetTransform(rCandidate.maTransform);
476cdf0e10cSrcweir 			}
477cdf0e10cSrcweir 			else
478cdf0e10cSrcweir 			{
479cdf0e10cSrcweir 				Hide();
480cdf0e10cSrcweir 				rCandidate.maWireframePoly.transform(aTransMat);
481cdf0e10cSrcweir 				Show();
482cdf0e10cSrcweir 			}
483cdf0e10cSrcweir 		}
484cdf0e10cSrcweir 		maLastPos = rPnt;
485cdf0e10cSrcweir 		DragStat().NextMove(rPnt);
486cdf0e10cSrcweir 	}
487cdf0e10cSrcweir }
488cdf0e10cSrcweir 
489cdf0e10cSrcweir /*************************************************************************
490cdf0e10cSrcweir |*
491cdf0e10cSrcweir \************************************************************************/
492cdf0e10cSrcweir 
493cdf0e10cSrcweir Pointer E3dDragRotate::GetSdrDragPointer() const
494cdf0e10cSrcweir {
495cdf0e10cSrcweir 	return Pointer(POINTER_ROTATE);
496cdf0e10cSrcweir }
497cdf0e10cSrcweir 
498cdf0e10cSrcweir /*************************************************************************
499cdf0e10cSrcweir |*
500cdf0e10cSrcweir |* E3dDragMove
501cdf0e10cSrcweir |* Diese DragMethod wird nur bei Translationen innerhalb von 3D-Scenen
502cdf0e10cSrcweir |* benoetigt. Wird eine 3D-Scene selbst verschoben, so wird diese DragMethod
503cdf0e10cSrcweir |* nicht verwendet.
504cdf0e10cSrcweir |*
505cdf0e10cSrcweir \************************************************************************/
506cdf0e10cSrcweir 
507cdf0e10cSrcweir TYPEINIT1(E3dDragMove, E3dDragMethod);
508cdf0e10cSrcweir 
509cdf0e10cSrcweir E3dDragMove::E3dDragMove(SdrDragView &_rView,
510cdf0e10cSrcweir 	const SdrMarkList& rMark,
511cdf0e10cSrcweir 	SdrHdlKind eDrgHdl,
512cdf0e10cSrcweir 	E3dDragConstraint eConstr,
513cdf0e10cSrcweir 	sal_Bool bFull)
514cdf0e10cSrcweir :	E3dDragMethod(_rView, rMark, eConstr, bFull),
515cdf0e10cSrcweir 	meWhatDragHdl(eDrgHdl)
516cdf0e10cSrcweir {
517cdf0e10cSrcweir 	switch(meWhatDragHdl)
518cdf0e10cSrcweir 	{
519cdf0e10cSrcweir 		case HDL_LEFT:
520cdf0e10cSrcweir 			maScaleFixPos = maFullBound.RightCenter();
521cdf0e10cSrcweir 			break;
522cdf0e10cSrcweir 		case HDL_RIGHT:
523cdf0e10cSrcweir 			maScaleFixPos = maFullBound.LeftCenter();
524cdf0e10cSrcweir 			break;
525cdf0e10cSrcweir 		case HDL_UPPER:
526cdf0e10cSrcweir 			maScaleFixPos = maFullBound.BottomCenter();
527cdf0e10cSrcweir 			break;
528cdf0e10cSrcweir 		case HDL_LOWER:
529cdf0e10cSrcweir 			maScaleFixPos = maFullBound.TopCenter();
530cdf0e10cSrcweir 			break;
531cdf0e10cSrcweir 		case HDL_UPLFT:
532cdf0e10cSrcweir 			maScaleFixPos = maFullBound.BottomRight();
533cdf0e10cSrcweir 			break;
534cdf0e10cSrcweir 		case HDL_UPRGT:
535cdf0e10cSrcweir 			maScaleFixPos = maFullBound.BottomLeft();
536cdf0e10cSrcweir 			break;
537cdf0e10cSrcweir 		case HDL_LWLFT:
538cdf0e10cSrcweir 			maScaleFixPos = maFullBound.TopRight();
539cdf0e10cSrcweir 			break;
540cdf0e10cSrcweir 		case HDL_LWRGT:
541cdf0e10cSrcweir 			maScaleFixPos = maFullBound.TopLeft();
542cdf0e10cSrcweir 			break;
543cdf0e10cSrcweir 		default:
544cdf0e10cSrcweir 			// Bewegen des Objektes, HDL_MOVE
545cdf0e10cSrcweir 			break;
546cdf0e10cSrcweir 	}
547cdf0e10cSrcweir 
548cdf0e10cSrcweir 	// Override wenn IsResizeAtCenter()
549cdf0e10cSrcweir 	if(getSdrDragView().IsResizeAtCenter())
550cdf0e10cSrcweir 	{
551cdf0e10cSrcweir 		meWhatDragHdl = HDL_USER;
552cdf0e10cSrcweir 		maScaleFixPos = maFullBound.Center();
553cdf0e10cSrcweir 	}
554cdf0e10cSrcweir }
555cdf0e10cSrcweir 
556cdf0e10cSrcweir /*************************************************************************
557cdf0e10cSrcweir |*
558cdf0e10cSrcweir |* Das Objekt wird bewegt, bestimme die Translation
559cdf0e10cSrcweir |*
560cdf0e10cSrcweir \************************************************************************/
561cdf0e10cSrcweir 
562cdf0e10cSrcweir void E3dDragMove::MoveSdrDrag(const Point& rPnt)
563cdf0e10cSrcweir {
564cdf0e10cSrcweir 	// call parent
565cdf0e10cSrcweir 	E3dDragMethod::MoveSdrDrag(rPnt);
566cdf0e10cSrcweir 
567cdf0e10cSrcweir 	if(DragStat().CheckMinMoved(rPnt))
568cdf0e10cSrcweir 	{
569cdf0e10cSrcweir 		if(HDL_MOVE == meWhatDragHdl)
570cdf0e10cSrcweir 		{
571cdf0e10cSrcweir 			// Translation
572cdf0e10cSrcweir 			// Bewegungsvektor bestimmen
573cdf0e10cSrcweir 			basegfx::B3DPoint aGlobalMoveHead((double)(rPnt.X() - maLastPos.X()), (double)(rPnt.Y() - maLastPos.Y()), 32768.0);
574cdf0e10cSrcweir 			basegfx::B3DPoint aGlobalMoveTail(0.0, 0.0, 32768.0);
575cdf0e10cSrcweir 			const sal_uInt32 nCnt(maGrp.size());
576cdf0e10cSrcweir 
577cdf0e10cSrcweir 			// Modifier holen
578cdf0e10cSrcweir 			sal_uInt16 nModifier(0);
579cdf0e10cSrcweir 
580cdf0e10cSrcweir 			if(getSdrDragView().ISA(E3dView))
581cdf0e10cSrcweir 			{
582cdf0e10cSrcweir 				const MouseEvent& rLastMouse = ((E3dView&)getSdrDragView()).GetMouseEvent();
583cdf0e10cSrcweir 				nModifier = rLastMouse.GetModifier();
584cdf0e10cSrcweir 			}
585cdf0e10cSrcweir 
586cdf0e10cSrcweir 			for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
587cdf0e10cSrcweir 			{
588cdf0e10cSrcweir 				E3dDragMethodUnit& rCandidate = maGrp[nOb];
589cdf0e10cSrcweir 				const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mp3DObj->GetScene()->GetViewContact());
590cdf0e10cSrcweir 				const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
591cdf0e10cSrcweir 
592cdf0e10cSrcweir 				// move coor from 2d world to 3d Eye
593cdf0e10cSrcweir 				basegfx::B2DPoint aGlobalMoveHead2D((double)(rPnt.X() - maLastPos.X()), (double)(rPnt.Y() - maLastPos.Y()));
594cdf0e10cSrcweir 				basegfx::B2DPoint aGlobalMoveTail2D(0.0, 0.0);
595cdf0e10cSrcweir 				basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation());
596cdf0e10cSrcweir 
597cdf0e10cSrcweir 				aInverseSceneTransform.invert();
598cdf0e10cSrcweir 				aGlobalMoveHead2D = aInverseSceneTransform * aGlobalMoveHead2D;
599cdf0e10cSrcweir 				aGlobalMoveTail2D = aInverseSceneTransform * aGlobalMoveTail2D;
600cdf0e10cSrcweir 
601cdf0e10cSrcweir 				basegfx::B3DPoint aMoveHead3D(aGlobalMoveHead2D.getX(), aGlobalMoveHead2D.getY(), 0.5);
602cdf0e10cSrcweir 				basegfx::B3DPoint aMoveTail3D(aGlobalMoveTail2D.getX(), aGlobalMoveTail2D.getY(), 0.5);
603cdf0e10cSrcweir 				basegfx::B3DHomMatrix aInverseViewToEye(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection());
604cdf0e10cSrcweir 				aInverseViewToEye.invert();
605cdf0e10cSrcweir 
606cdf0e10cSrcweir 				aMoveHead3D = aInverseViewToEye * aMoveHead3D;
607cdf0e10cSrcweir 				aMoveTail3D = aInverseViewToEye * aMoveTail3D;
608cdf0e10cSrcweir 
609cdf0e10cSrcweir 				// eventually switch movement from XY to XZ plane
610cdf0e10cSrcweir 				if(nModifier & KEY_MOD2)
611cdf0e10cSrcweir 				{
612cdf0e10cSrcweir 					double fZwi = aMoveHead3D.getY();
613cdf0e10cSrcweir 					aMoveHead3D.setY(aMoveHead3D.getZ());
614cdf0e10cSrcweir 					aMoveHead3D.setZ(fZwi);
615cdf0e10cSrcweir 
616cdf0e10cSrcweir 					fZwi = aMoveTail3D.getY();
617cdf0e10cSrcweir 					aMoveTail3D.setY(aMoveTail3D.getZ());
618cdf0e10cSrcweir 					aMoveTail3D.setZ(fZwi);
619cdf0e10cSrcweir 				}
620cdf0e10cSrcweir 
621cdf0e10cSrcweir 				// Bewegungsvektor von Aug-Koordinaten nach Parent-Koordinaten
622cdf0e10cSrcweir 				basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation());
623cdf0e10cSrcweir 				aInverseOrientation.invert();
624cdf0e10cSrcweir 				basegfx::B3DHomMatrix aCompleteTrans(rCandidate.maInvDisplayTransform * aInverseOrientation);
625cdf0e10cSrcweir 
626cdf0e10cSrcweir 				aMoveHead3D = aCompleteTrans * aMoveHead3D;
627cdf0e10cSrcweir 				aMoveTail3D = aCompleteTrans* aMoveTail3D;
628cdf0e10cSrcweir 
629cdf0e10cSrcweir 				// build transformation
630cdf0e10cSrcweir 				basegfx::B3DHomMatrix aTransMat;
631cdf0e10cSrcweir 				basegfx::B3DPoint aTranslate(aMoveHead3D - aMoveTail3D);
632cdf0e10cSrcweir 				aTransMat.translate(aTranslate.getX(), aTranslate.getY(), aTranslate.getZ());
633cdf0e10cSrcweir 
634cdf0e10cSrcweir 				// ...and apply
635cdf0e10cSrcweir 				rCandidate.maTransform *= aTransMat;
636cdf0e10cSrcweir 
637cdf0e10cSrcweir 				if(mbMoveFull)
638cdf0e10cSrcweir 				{
639cdf0e10cSrcweir         			E3DModifySceneSnapRectUpdater aUpdater(rCandidate.mp3DObj);
640cdf0e10cSrcweir 					rCandidate.mp3DObj->SetTransform(rCandidate.maTransform);
641cdf0e10cSrcweir 				}
642cdf0e10cSrcweir 				else
643cdf0e10cSrcweir 				{
644cdf0e10cSrcweir 					Hide();
645cdf0e10cSrcweir 					rCandidate.maWireframePoly.transform(aTransMat);
646cdf0e10cSrcweir 					Show();
647cdf0e10cSrcweir 				}
648cdf0e10cSrcweir 			}
649cdf0e10cSrcweir 		}
650cdf0e10cSrcweir 		else
651cdf0e10cSrcweir 		{
652cdf0e10cSrcweir 			// Skalierung
653cdf0e10cSrcweir 			// Skalierungsvektor bestimmen
654cdf0e10cSrcweir 			Point aStartPos = DragStat().GetStart();
655cdf0e10cSrcweir 			const sal_uInt32 nCnt(maGrp.size());
656cdf0e10cSrcweir 
657cdf0e10cSrcweir 			for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
658cdf0e10cSrcweir 			{
659cdf0e10cSrcweir 				E3dDragMethodUnit& rCandidate = maGrp[nOb];
660cdf0e10cSrcweir 				const basegfx::B3DPoint aObjectCenter(rCandidate.mp3DObj->GetBoundVolume().getCenter());
661cdf0e10cSrcweir 
662cdf0e10cSrcweir 				// transform from 2D world view to 3D eye
663cdf0e10cSrcweir 				const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mp3DObj->GetScene()->GetViewContact());
664cdf0e10cSrcweir 				const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
665cdf0e10cSrcweir 
666cdf0e10cSrcweir 				basegfx::B2DPoint aGlobalScaleStart2D((double)(aStartPos.X()), (double)(aStartPos.Y()));
667cdf0e10cSrcweir 				basegfx::B2DPoint aGlobalScaleNext2D((double)(rPnt.X()), (double)(rPnt.Y()));
668cdf0e10cSrcweir 				basegfx::B2DPoint aGlobalScaleFixPos2D((double)(maScaleFixPos.X()), (double)(maScaleFixPos.Y()));
669cdf0e10cSrcweir 				basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation());
670cdf0e10cSrcweir 
671cdf0e10cSrcweir 				aInverseSceneTransform.invert();
672cdf0e10cSrcweir 				aGlobalScaleStart2D = aInverseSceneTransform * aGlobalScaleStart2D;
673cdf0e10cSrcweir 				aGlobalScaleNext2D = aInverseSceneTransform * aGlobalScaleNext2D;
674cdf0e10cSrcweir 				aGlobalScaleFixPos2D = aInverseSceneTransform * aGlobalScaleFixPos2D;
675cdf0e10cSrcweir 
676cdf0e10cSrcweir 				basegfx::B3DPoint aGlobalScaleStart3D(aGlobalScaleStart2D.getX(), aGlobalScaleStart2D.getY(), aObjectCenter.getZ());
677cdf0e10cSrcweir 				basegfx::B3DPoint aGlobalScaleNext3D(aGlobalScaleNext2D.getX(), aGlobalScaleNext2D.getY(), aObjectCenter.getZ());
678cdf0e10cSrcweir 				basegfx::B3DPoint aGlobalScaleFixPos3D(aGlobalScaleFixPos2D.getX(), aGlobalScaleFixPos2D.getY(), aObjectCenter.getZ());
679cdf0e10cSrcweir 				basegfx::B3DHomMatrix aInverseViewToEye(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection());
680cdf0e10cSrcweir 
681cdf0e10cSrcweir 				aInverseViewToEye.invert();
682cdf0e10cSrcweir 				basegfx::B3DPoint aScStart(aInverseViewToEye * aGlobalScaleStart3D);
683cdf0e10cSrcweir 				basegfx::B3DPoint aScNext(aInverseViewToEye * aGlobalScaleNext3D);
684cdf0e10cSrcweir 				basegfx::B3DPoint aScFixPos(aInverseViewToEye * aGlobalScaleFixPos3D);
685cdf0e10cSrcweir 
686cdf0e10cSrcweir 				// constraints?
687cdf0e10cSrcweir 				switch(meWhatDragHdl)
688cdf0e10cSrcweir 				{
689cdf0e10cSrcweir 					case HDL_LEFT:
690cdf0e10cSrcweir 					case HDL_RIGHT:
691cdf0e10cSrcweir 						// constrain to auf X -> Y equal
692cdf0e10cSrcweir 						aScNext.setY(aScFixPos.getY());
693cdf0e10cSrcweir 						break;
694cdf0e10cSrcweir 					case HDL_UPPER:
695cdf0e10cSrcweir 					case HDL_LOWER:
696cdf0e10cSrcweir 						// constrain to auf Y -> X equal
697cdf0e10cSrcweir 						aScNext.setX(aScFixPos.getX());
698cdf0e10cSrcweir 						break;
699cdf0e10cSrcweir 					default:
700cdf0e10cSrcweir 						break;
701cdf0e10cSrcweir 				}
702cdf0e10cSrcweir 
703cdf0e10cSrcweir 				// get scale vector in eye coordinates
704cdf0e10cSrcweir 				basegfx::B3DPoint aScaleVec(aScStart - aScFixPos);
705cdf0e10cSrcweir 				aScaleVec.setZ(1.0);
706cdf0e10cSrcweir 
707cdf0e10cSrcweir 				if(aScaleVec.getX() != 0.0)
708cdf0e10cSrcweir 				{
709cdf0e10cSrcweir 					aScaleVec.setX((aScNext.getX() - aScFixPos.getX()) / aScaleVec.getX());
710cdf0e10cSrcweir 				}
711cdf0e10cSrcweir 				else
712cdf0e10cSrcweir 				{
713cdf0e10cSrcweir 					aScaleVec.setX(1.0);
714cdf0e10cSrcweir 				}
715cdf0e10cSrcweir 
716cdf0e10cSrcweir 				if(aScaleVec.getY() != 0.0)
717cdf0e10cSrcweir 				{
718cdf0e10cSrcweir 					aScaleVec.setY((aScNext.getY() - aScFixPos.getY()) / aScaleVec.getY());
719cdf0e10cSrcweir 				}
720cdf0e10cSrcweir 				else
721cdf0e10cSrcweir 				{
722cdf0e10cSrcweir 					aScaleVec.setY(1.0);
723cdf0e10cSrcweir 				}
724cdf0e10cSrcweir 
725cdf0e10cSrcweir 				// SHIFT-key used?
726cdf0e10cSrcweir 				if(getSdrDragView().IsOrtho())
727cdf0e10cSrcweir 				{
728cdf0e10cSrcweir 					if(fabs(aScaleVec.getX()) > fabs(aScaleVec.getY()))
729cdf0e10cSrcweir 					{
730cdf0e10cSrcweir 						// X is biggest
731cdf0e10cSrcweir 						aScaleVec.setY(aScaleVec.getX());
732cdf0e10cSrcweir 					}
733cdf0e10cSrcweir 					else
734cdf0e10cSrcweir 					{
735cdf0e10cSrcweir 						// Y is biggest
736cdf0e10cSrcweir 						aScaleVec.setX(aScaleVec.getY());
737cdf0e10cSrcweir 					}
738cdf0e10cSrcweir 				}
739cdf0e10cSrcweir 
740cdf0e10cSrcweir 				// build transformation
741cdf0e10cSrcweir 				basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation());
742cdf0e10cSrcweir 				aInverseOrientation.invert();
743cdf0e10cSrcweir 
744cdf0e10cSrcweir 				basegfx::B3DHomMatrix aNewTrans = rCandidate.maInitTransform;
745cdf0e10cSrcweir 				aNewTrans *= rCandidate.maDisplayTransform;
746cdf0e10cSrcweir 				aNewTrans *= aViewInfo3D.getOrientation();
747cdf0e10cSrcweir 				aNewTrans.translate(-aScFixPos.getX(), -aScFixPos.getY(), -aScFixPos.getZ());
748cdf0e10cSrcweir 				aNewTrans.scale(aScaleVec.getX(), aScaleVec.getY(), aScaleVec.getZ());
749cdf0e10cSrcweir 				aNewTrans.translate(aScFixPos.getX(), aScFixPos.getY(), aScFixPos.getZ());
750cdf0e10cSrcweir 				aNewTrans *= aInverseOrientation;
751cdf0e10cSrcweir 				aNewTrans *= rCandidate.maInvDisplayTransform;
752cdf0e10cSrcweir 
753cdf0e10cSrcweir 				// ...und anwenden
754cdf0e10cSrcweir 				rCandidate.maTransform = aNewTrans;
755cdf0e10cSrcweir 
756cdf0e10cSrcweir 				if(mbMoveFull)
757cdf0e10cSrcweir 				{
758cdf0e10cSrcweir         			E3DModifySceneSnapRectUpdater aUpdater(rCandidate.mp3DObj);
759cdf0e10cSrcweir 					rCandidate.mp3DObj->SetTransform(rCandidate.maTransform);
760cdf0e10cSrcweir 				}
761cdf0e10cSrcweir 				else
762cdf0e10cSrcweir 				{
763cdf0e10cSrcweir 					Hide();
764cdf0e10cSrcweir 					rCandidate.maWireframePoly.clear();
765cdf0e10cSrcweir 					rCandidate.maWireframePoly = rCandidate.mp3DObj->CreateWireframe();
766cdf0e10cSrcweir 					rCandidate.maWireframePoly.transform(rCandidate.maTransform);
767cdf0e10cSrcweir 					Show();
768cdf0e10cSrcweir 				}
769cdf0e10cSrcweir 			}
770cdf0e10cSrcweir 		}
771cdf0e10cSrcweir 		maLastPos = rPnt;
772cdf0e10cSrcweir 		DragStat().NextMove(rPnt);
773cdf0e10cSrcweir 	}
774cdf0e10cSrcweir }
775cdf0e10cSrcweir 
776cdf0e10cSrcweir /*************************************************************************
777cdf0e10cSrcweir |*
778cdf0e10cSrcweir \************************************************************************/
779cdf0e10cSrcweir 
780cdf0e10cSrcweir Pointer E3dDragMove::GetSdrDragPointer() const
781cdf0e10cSrcweir {
782cdf0e10cSrcweir 	return Pointer(POINTER_MOVE);
783cdf0e10cSrcweir }
784cdf0e10cSrcweir 
785cdf0e10cSrcweir // eof
786