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