1f6e50924SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3f6e50924SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4f6e50924SAndrew Rist * or more contributor license agreements. See the NOTICE file 5f6e50924SAndrew Rist * distributed with this work for additional information 6f6e50924SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7f6e50924SAndrew Rist * to you under the Apache License, Version 2.0 (the 8f6e50924SAndrew Rist * "License"); you may not use this file except in compliance 9f6e50924SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11f6e50924SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13f6e50924SAndrew Rist * Unless required by applicable law or agreed to in writing, 14f6e50924SAndrew Rist * software distributed under the License is distributed on an 15f6e50924SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16f6e50924SAndrew Rist * KIND, either express or implied. See the License for the 17f6e50924SAndrew Rist * specific language governing permissions and limitations 18f6e50924SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20f6e50924SAndrew Rist *************************************************************/ 21f6e50924SAndrew Rist 22f6e50924SAndrew 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 { 303*1cd65da9SArmin Le Grand ::sdr::overlay::OverlayPolyPolygonStripedAndFilled* pNew = new ::sdr::overlay::OverlayPolyPolygonStripedAndFilled( 304*1cd65da9SArmin Le Grand aResult); 305cdf0e10cSrcweir rOverlayManager.add(*pNew); 306cdf0e10cSrcweir addToOverlayObjectList(*pNew); 307cdf0e10cSrcweir } 308cdf0e10cSrcweir } 309cdf0e10cSrcweir 310cdf0e10cSrcweir /************************************************************************* 311cdf0e10cSrcweir 312cdf0e10cSrcweir E3dDragRotate 313cdf0e10cSrcweir 314cdf0e10cSrcweir *************************************************************************/ 315cdf0e10cSrcweir 316cdf0e10cSrcweir TYPEINIT1(E3dDragRotate, E3dDragMethod); 317cdf0e10cSrcweir 318cdf0e10cSrcweir E3dDragRotate::E3dDragRotate(SdrDragView &_rView, 319cdf0e10cSrcweir const SdrMarkList& rMark, 320cdf0e10cSrcweir E3dDragConstraint eConstr, 321cdf0e10cSrcweir sal_Bool bFull) 322cdf0e10cSrcweir : E3dDragMethod(_rView, rMark, eConstr, bFull) 323cdf0e10cSrcweir { 324cdf0e10cSrcweir // Zentrum aller selektierten Objekte in Augkoordinaten holen 325cdf0e10cSrcweir const sal_uInt32 nCnt(maGrp.size()); 326cdf0e10cSrcweir 327cdf0e10cSrcweir if(nCnt) 328cdf0e10cSrcweir { 329cdf0e10cSrcweir const E3dScene *pScene = maGrp[0].mp3DObj->GetScene(); 330cdf0e10cSrcweir 331cdf0e10cSrcweir if(pScene) 332cdf0e10cSrcweir { 333cdf0e10cSrcweir const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact()); 334cdf0e10cSrcweir const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D()); 335cdf0e10cSrcweir 336cdf0e10cSrcweir for(sal_uInt32 nOb(0); nOb < nCnt; nOb++) 337cdf0e10cSrcweir { 338cdf0e10cSrcweir E3dDragMethodUnit& rCandidate = maGrp[nOb]; 339cdf0e10cSrcweir basegfx::B3DPoint aObjCenter = rCandidate.mp3DObj->GetBoundVolume().getCenter(); 340cdf0e10cSrcweir const basegfx::B3DHomMatrix aTransform(aViewInfo3D.getOrientation() * rCandidate.maDisplayTransform * rCandidate.maInitTransform); 341cdf0e10cSrcweir 342cdf0e10cSrcweir aObjCenter = aTransform * aObjCenter; 343cdf0e10cSrcweir maGlobalCenter += aObjCenter; 344cdf0e10cSrcweir } 345cdf0e10cSrcweir 346cdf0e10cSrcweir // Teilen durch Anzahl 347cdf0e10cSrcweir if(nCnt > 1) 348cdf0e10cSrcweir { 349cdf0e10cSrcweir maGlobalCenter /= (double)nCnt; 350cdf0e10cSrcweir } 351cdf0e10cSrcweir 352cdf0e10cSrcweir // get rotate center and transform to 3D eye coordinates 353cdf0e10cSrcweir basegfx::B2DPoint aRotCenter2D(Ref1().X(), Ref1().Y()); 354cdf0e10cSrcweir 355cdf0e10cSrcweir // from world to relative scene using inverse getObjectTransformation() 356cdf0e10cSrcweir basegfx::B2DHomMatrix aInverseObjectTransform(rVCScene.getObjectTransformation()); 357cdf0e10cSrcweir aInverseObjectTransform.invert(); 358cdf0e10cSrcweir aRotCenter2D = aInverseObjectTransform * aRotCenter2D; 359cdf0e10cSrcweir 360cdf0e10cSrcweir // from 3D view to 3D eye 361cdf0e10cSrcweir basegfx::B3DPoint aRotCenter3D(aRotCenter2D.getX(), aRotCenter2D.getY(), 0.0); 362cdf0e10cSrcweir basegfx::B3DHomMatrix aInverseViewToEye(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection()); 363cdf0e10cSrcweir aInverseViewToEye.invert(); 364cdf0e10cSrcweir aRotCenter3D = aInverseViewToEye * aRotCenter3D; 365cdf0e10cSrcweir 366cdf0e10cSrcweir // X,Y des RotCenter und Tiefe der gemeinsamen Objektmitte aus 367cdf0e10cSrcweir // Rotationspunkt im Raum benutzen 368cdf0e10cSrcweir maGlobalCenter.setX(aRotCenter3D.getX()); 369cdf0e10cSrcweir maGlobalCenter.setY(aRotCenter3D.getY()); 370cdf0e10cSrcweir } 371cdf0e10cSrcweir } 372cdf0e10cSrcweir } 373cdf0e10cSrcweir 374cdf0e10cSrcweir /************************************************************************* 375cdf0e10cSrcweir |* 376cdf0e10cSrcweir |* Das Objekt wird bewegt, bestimme die Winkel 377cdf0e10cSrcweir |* 378cdf0e10cSrcweir \************************************************************************/ 379cdf0e10cSrcweir 380cdf0e10cSrcweir void E3dDragRotate::MoveSdrDrag(const Point& rPnt) 381cdf0e10cSrcweir { 382cdf0e10cSrcweir // call parent 383cdf0e10cSrcweir E3dDragMethod::MoveSdrDrag(rPnt); 384cdf0e10cSrcweir 385cdf0e10cSrcweir if(DragStat().CheckMinMoved(rPnt)) 386cdf0e10cSrcweir { 387cdf0e10cSrcweir // Modifier holen 388cdf0e10cSrcweir sal_uInt16 nModifier = 0; 389cdf0e10cSrcweir if(getSdrDragView().ISA(E3dView)) 390cdf0e10cSrcweir { 391cdf0e10cSrcweir const MouseEvent& rLastMouse = ((E3dView&)getSdrDragView()).GetMouseEvent(); 392cdf0e10cSrcweir nModifier = rLastMouse.GetModifier(); 393cdf0e10cSrcweir } 394cdf0e10cSrcweir 395cdf0e10cSrcweir // Alle Objekte rotieren 396cdf0e10cSrcweir const sal_uInt32 nCnt(maGrp.size()); 397cdf0e10cSrcweir 398cdf0e10cSrcweir for(sal_uInt32 nOb(0); nOb < nCnt; nOb++) 399cdf0e10cSrcweir { 400cdf0e10cSrcweir // Rotationswinkel bestimmen 401cdf0e10cSrcweir double fWAngle, fHAngle; 402cdf0e10cSrcweir E3dDragMethodUnit& rCandidate = maGrp[nOb]; 403cdf0e10cSrcweir 404cdf0e10cSrcweir if(E3DDRAG_CONSTR_Z == meConstraint) 405cdf0e10cSrcweir { 406cdf0e10cSrcweir fWAngle = NormAngle360(GetAngle(rPnt - DragStat().GetRef1()) - 407cdf0e10cSrcweir rCandidate.mnStartAngle) - rCandidate.mnLastAngle; 408cdf0e10cSrcweir rCandidate.mnLastAngle = (long)fWAngle + rCandidate.mnLastAngle; 409cdf0e10cSrcweir fWAngle /= 100.0; 410cdf0e10cSrcweir fHAngle = 0.0; 411cdf0e10cSrcweir } 412cdf0e10cSrcweir else 413cdf0e10cSrcweir { 414cdf0e10cSrcweir fWAngle = 90.0 * (double)(rPnt.X() - maLastPos.X()) 415cdf0e10cSrcweir / (double)maFullBound.GetWidth(); 416cdf0e10cSrcweir fHAngle = 90.0 * (double)(rPnt.Y() - maLastPos.Y()) 417cdf0e10cSrcweir / (double)maFullBound.GetHeight(); 418cdf0e10cSrcweir } 419cdf0e10cSrcweir long nSnap = 0; 420cdf0e10cSrcweir 421cdf0e10cSrcweir if(!getSdrDragView().IsRotateAllowed(sal_False)) 422cdf0e10cSrcweir nSnap = 90; 423cdf0e10cSrcweir 424cdf0e10cSrcweir if(nSnap != 0) 425cdf0e10cSrcweir { 426cdf0e10cSrcweir fWAngle = (double)(((long) fWAngle + nSnap/2) / nSnap * nSnap); 427cdf0e10cSrcweir fHAngle = (double)(((long) fHAngle + nSnap/2) / nSnap * nSnap); 428cdf0e10cSrcweir } 429cdf0e10cSrcweir 430cdf0e10cSrcweir // nach radiant 431cdf0e10cSrcweir fWAngle *= F_PI180; 432cdf0e10cSrcweir fHAngle *= F_PI180; 433cdf0e10cSrcweir 434cdf0e10cSrcweir // Transformation bestimmen 435cdf0e10cSrcweir basegfx::B3DHomMatrix aRotMat; 436cdf0e10cSrcweir if(E3DDRAG_CONSTR_Y & meConstraint) 437cdf0e10cSrcweir { 438cdf0e10cSrcweir if(nModifier & KEY_MOD2) 439cdf0e10cSrcweir aRotMat.rotate(0.0, 0.0, fWAngle); 440cdf0e10cSrcweir else 441cdf0e10cSrcweir aRotMat.rotate(0.0, fWAngle, 0.0); 442cdf0e10cSrcweir } 443cdf0e10cSrcweir else if(E3DDRAG_CONSTR_Z & meConstraint) 444cdf0e10cSrcweir { 445cdf0e10cSrcweir if(nModifier & KEY_MOD2) 446cdf0e10cSrcweir aRotMat.rotate(0.0, fWAngle, 0.0); 447cdf0e10cSrcweir else 448cdf0e10cSrcweir aRotMat.rotate(0.0, 0.0, fWAngle); 449cdf0e10cSrcweir } 450cdf0e10cSrcweir if(E3DDRAG_CONSTR_X & meConstraint) 451cdf0e10cSrcweir { 452cdf0e10cSrcweir aRotMat.rotate(fHAngle, 0.0, 0.0); 453cdf0e10cSrcweir } 454cdf0e10cSrcweir 455cdf0e10cSrcweir // Transformation in Eye-Koordinaten, dort rotieren 456cdf0e10cSrcweir // und zurueck 457cdf0e10cSrcweir const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mp3DObj->GetScene()->GetViewContact()); 458cdf0e10cSrcweir const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D()); 459cdf0e10cSrcweir basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation()); 460cdf0e10cSrcweir aInverseOrientation.invert(); 461cdf0e10cSrcweir 462cdf0e10cSrcweir basegfx::B3DHomMatrix aTransMat(rCandidate.maDisplayTransform); 463cdf0e10cSrcweir aTransMat *= aViewInfo3D.getOrientation(); 464cdf0e10cSrcweir aTransMat.translate(-maGlobalCenter.getX(), -maGlobalCenter.getY(), -maGlobalCenter.getZ()); 465cdf0e10cSrcweir aTransMat *= aRotMat; 466cdf0e10cSrcweir aTransMat.translate(maGlobalCenter.getX(), maGlobalCenter.getY(), maGlobalCenter.getZ()); 467cdf0e10cSrcweir aTransMat *= aInverseOrientation; 468cdf0e10cSrcweir aTransMat *= rCandidate.maInvDisplayTransform; 469cdf0e10cSrcweir 470cdf0e10cSrcweir // ...und anwenden 471cdf0e10cSrcweir rCandidate.maTransform *= aTransMat; 472cdf0e10cSrcweir 473cdf0e10cSrcweir if(mbMoveFull) 474cdf0e10cSrcweir { 475cdf0e10cSrcweir E3DModifySceneSnapRectUpdater aUpdater(rCandidate.mp3DObj); 476cdf0e10cSrcweir rCandidate.mp3DObj->SetTransform(rCandidate.maTransform); 477cdf0e10cSrcweir } 478cdf0e10cSrcweir else 479cdf0e10cSrcweir { 480cdf0e10cSrcweir Hide(); 481cdf0e10cSrcweir rCandidate.maWireframePoly.transform(aTransMat); 482cdf0e10cSrcweir Show(); 483cdf0e10cSrcweir } 484cdf0e10cSrcweir } 485cdf0e10cSrcweir maLastPos = rPnt; 486cdf0e10cSrcweir DragStat().NextMove(rPnt); 487cdf0e10cSrcweir } 488cdf0e10cSrcweir } 489cdf0e10cSrcweir 490cdf0e10cSrcweir /************************************************************************* 491cdf0e10cSrcweir |* 492cdf0e10cSrcweir \************************************************************************/ 493cdf0e10cSrcweir 494cdf0e10cSrcweir Pointer E3dDragRotate::GetSdrDragPointer() const 495cdf0e10cSrcweir { 496cdf0e10cSrcweir return Pointer(POINTER_ROTATE); 497cdf0e10cSrcweir } 498cdf0e10cSrcweir 499cdf0e10cSrcweir /************************************************************************* 500cdf0e10cSrcweir |* 501cdf0e10cSrcweir |* E3dDragMove 502cdf0e10cSrcweir |* Diese DragMethod wird nur bei Translationen innerhalb von 3D-Scenen 503cdf0e10cSrcweir |* benoetigt. Wird eine 3D-Scene selbst verschoben, so wird diese DragMethod 504cdf0e10cSrcweir |* nicht verwendet. 505cdf0e10cSrcweir |* 506cdf0e10cSrcweir \************************************************************************/ 507cdf0e10cSrcweir 508cdf0e10cSrcweir TYPEINIT1(E3dDragMove, E3dDragMethod); 509cdf0e10cSrcweir 510cdf0e10cSrcweir E3dDragMove::E3dDragMove(SdrDragView &_rView, 511cdf0e10cSrcweir const SdrMarkList& rMark, 512cdf0e10cSrcweir SdrHdlKind eDrgHdl, 513cdf0e10cSrcweir E3dDragConstraint eConstr, 514cdf0e10cSrcweir sal_Bool bFull) 515cdf0e10cSrcweir : E3dDragMethod(_rView, rMark, eConstr, bFull), 516cdf0e10cSrcweir meWhatDragHdl(eDrgHdl) 517cdf0e10cSrcweir { 518cdf0e10cSrcweir switch(meWhatDragHdl) 519cdf0e10cSrcweir { 520cdf0e10cSrcweir case HDL_LEFT: 521cdf0e10cSrcweir maScaleFixPos = maFullBound.RightCenter(); 522cdf0e10cSrcweir break; 523cdf0e10cSrcweir case HDL_RIGHT: 524cdf0e10cSrcweir maScaleFixPos = maFullBound.LeftCenter(); 525cdf0e10cSrcweir break; 526cdf0e10cSrcweir case HDL_UPPER: 527cdf0e10cSrcweir maScaleFixPos = maFullBound.BottomCenter(); 528cdf0e10cSrcweir break; 529cdf0e10cSrcweir case HDL_LOWER: 530cdf0e10cSrcweir maScaleFixPos = maFullBound.TopCenter(); 531cdf0e10cSrcweir break; 532cdf0e10cSrcweir case HDL_UPLFT: 533cdf0e10cSrcweir maScaleFixPos = maFullBound.BottomRight(); 534cdf0e10cSrcweir break; 535cdf0e10cSrcweir case HDL_UPRGT: 536cdf0e10cSrcweir maScaleFixPos = maFullBound.BottomLeft(); 537cdf0e10cSrcweir break; 538cdf0e10cSrcweir case HDL_LWLFT: 539cdf0e10cSrcweir maScaleFixPos = maFullBound.TopRight(); 540cdf0e10cSrcweir break; 541cdf0e10cSrcweir case HDL_LWRGT: 542cdf0e10cSrcweir maScaleFixPos = maFullBound.TopLeft(); 543cdf0e10cSrcweir break; 544cdf0e10cSrcweir default: 545cdf0e10cSrcweir // Bewegen des Objektes, HDL_MOVE 546cdf0e10cSrcweir break; 547cdf0e10cSrcweir } 548cdf0e10cSrcweir 549cdf0e10cSrcweir // Override wenn IsResizeAtCenter() 550cdf0e10cSrcweir if(getSdrDragView().IsResizeAtCenter()) 551cdf0e10cSrcweir { 552cdf0e10cSrcweir meWhatDragHdl = HDL_USER; 553cdf0e10cSrcweir maScaleFixPos = maFullBound.Center(); 554cdf0e10cSrcweir } 555cdf0e10cSrcweir } 556cdf0e10cSrcweir 557cdf0e10cSrcweir /************************************************************************* 558cdf0e10cSrcweir |* 559cdf0e10cSrcweir |* Das Objekt wird bewegt, bestimme die Translation 560cdf0e10cSrcweir |* 561cdf0e10cSrcweir \************************************************************************/ 562cdf0e10cSrcweir 563cdf0e10cSrcweir void E3dDragMove::MoveSdrDrag(const Point& rPnt) 564cdf0e10cSrcweir { 565cdf0e10cSrcweir // call parent 566cdf0e10cSrcweir E3dDragMethod::MoveSdrDrag(rPnt); 567cdf0e10cSrcweir 568cdf0e10cSrcweir if(DragStat().CheckMinMoved(rPnt)) 569cdf0e10cSrcweir { 570cdf0e10cSrcweir if(HDL_MOVE == meWhatDragHdl) 571cdf0e10cSrcweir { 572cdf0e10cSrcweir // Translation 573cdf0e10cSrcweir // Bewegungsvektor bestimmen 574cdf0e10cSrcweir basegfx::B3DPoint aGlobalMoveHead((double)(rPnt.X() - maLastPos.X()), (double)(rPnt.Y() - maLastPos.Y()), 32768.0); 575cdf0e10cSrcweir basegfx::B3DPoint aGlobalMoveTail(0.0, 0.0, 32768.0); 576cdf0e10cSrcweir const sal_uInt32 nCnt(maGrp.size()); 577cdf0e10cSrcweir 578cdf0e10cSrcweir // Modifier holen 579cdf0e10cSrcweir sal_uInt16 nModifier(0); 580cdf0e10cSrcweir 581cdf0e10cSrcweir if(getSdrDragView().ISA(E3dView)) 582cdf0e10cSrcweir { 583cdf0e10cSrcweir const MouseEvent& rLastMouse = ((E3dView&)getSdrDragView()).GetMouseEvent(); 584cdf0e10cSrcweir nModifier = rLastMouse.GetModifier(); 585cdf0e10cSrcweir } 586cdf0e10cSrcweir 587cdf0e10cSrcweir for(sal_uInt32 nOb(0); nOb < nCnt; nOb++) 588cdf0e10cSrcweir { 589cdf0e10cSrcweir E3dDragMethodUnit& rCandidate = maGrp[nOb]; 590cdf0e10cSrcweir const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mp3DObj->GetScene()->GetViewContact()); 591cdf0e10cSrcweir const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D()); 592cdf0e10cSrcweir 593cdf0e10cSrcweir // move coor from 2d world to 3d Eye 594cdf0e10cSrcweir basegfx::B2DPoint aGlobalMoveHead2D((double)(rPnt.X() - maLastPos.X()), (double)(rPnt.Y() - maLastPos.Y())); 595cdf0e10cSrcweir basegfx::B2DPoint aGlobalMoveTail2D(0.0, 0.0); 596cdf0e10cSrcweir basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation()); 597cdf0e10cSrcweir 598cdf0e10cSrcweir aInverseSceneTransform.invert(); 599cdf0e10cSrcweir aGlobalMoveHead2D = aInverseSceneTransform * aGlobalMoveHead2D; 600cdf0e10cSrcweir aGlobalMoveTail2D = aInverseSceneTransform * aGlobalMoveTail2D; 601cdf0e10cSrcweir 602cdf0e10cSrcweir basegfx::B3DPoint aMoveHead3D(aGlobalMoveHead2D.getX(), aGlobalMoveHead2D.getY(), 0.5); 603cdf0e10cSrcweir basegfx::B3DPoint aMoveTail3D(aGlobalMoveTail2D.getX(), aGlobalMoveTail2D.getY(), 0.5); 604cdf0e10cSrcweir basegfx::B3DHomMatrix aInverseViewToEye(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection()); 605cdf0e10cSrcweir aInverseViewToEye.invert(); 606cdf0e10cSrcweir 607cdf0e10cSrcweir aMoveHead3D = aInverseViewToEye * aMoveHead3D; 608cdf0e10cSrcweir aMoveTail3D = aInverseViewToEye * aMoveTail3D; 609cdf0e10cSrcweir 610cdf0e10cSrcweir // eventually switch movement from XY to XZ plane 611cdf0e10cSrcweir if(nModifier & KEY_MOD2) 612cdf0e10cSrcweir { 613cdf0e10cSrcweir double fZwi = aMoveHead3D.getY(); 614cdf0e10cSrcweir aMoveHead3D.setY(aMoveHead3D.getZ()); 615cdf0e10cSrcweir aMoveHead3D.setZ(fZwi); 616cdf0e10cSrcweir 617cdf0e10cSrcweir fZwi = aMoveTail3D.getY(); 618cdf0e10cSrcweir aMoveTail3D.setY(aMoveTail3D.getZ()); 619cdf0e10cSrcweir aMoveTail3D.setZ(fZwi); 620cdf0e10cSrcweir } 621cdf0e10cSrcweir 622cdf0e10cSrcweir // Bewegungsvektor von Aug-Koordinaten nach Parent-Koordinaten 623cdf0e10cSrcweir basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation()); 624cdf0e10cSrcweir aInverseOrientation.invert(); 625cdf0e10cSrcweir basegfx::B3DHomMatrix aCompleteTrans(rCandidate.maInvDisplayTransform * aInverseOrientation); 626cdf0e10cSrcweir 627cdf0e10cSrcweir aMoveHead3D = aCompleteTrans * aMoveHead3D; 628cdf0e10cSrcweir aMoveTail3D = aCompleteTrans* aMoveTail3D; 629cdf0e10cSrcweir 630cdf0e10cSrcweir // build transformation 631cdf0e10cSrcweir basegfx::B3DHomMatrix aTransMat; 632cdf0e10cSrcweir basegfx::B3DPoint aTranslate(aMoveHead3D - aMoveTail3D); 633cdf0e10cSrcweir aTransMat.translate(aTranslate.getX(), aTranslate.getY(), aTranslate.getZ()); 634cdf0e10cSrcweir 635cdf0e10cSrcweir // ...and apply 636cdf0e10cSrcweir rCandidate.maTransform *= aTransMat; 637cdf0e10cSrcweir 638cdf0e10cSrcweir if(mbMoveFull) 639cdf0e10cSrcweir { 640cdf0e10cSrcweir E3DModifySceneSnapRectUpdater aUpdater(rCandidate.mp3DObj); 641cdf0e10cSrcweir rCandidate.mp3DObj->SetTransform(rCandidate.maTransform); 642cdf0e10cSrcweir } 643cdf0e10cSrcweir else 644cdf0e10cSrcweir { 645cdf0e10cSrcweir Hide(); 646cdf0e10cSrcweir rCandidate.maWireframePoly.transform(aTransMat); 647cdf0e10cSrcweir Show(); 648cdf0e10cSrcweir } 649cdf0e10cSrcweir } 650cdf0e10cSrcweir } 651cdf0e10cSrcweir else 652cdf0e10cSrcweir { 653cdf0e10cSrcweir // Skalierung 654cdf0e10cSrcweir // Skalierungsvektor bestimmen 655cdf0e10cSrcweir Point aStartPos = DragStat().GetStart(); 656cdf0e10cSrcweir const sal_uInt32 nCnt(maGrp.size()); 657cdf0e10cSrcweir 658cdf0e10cSrcweir for(sal_uInt32 nOb(0); nOb < nCnt; nOb++) 659cdf0e10cSrcweir { 660cdf0e10cSrcweir E3dDragMethodUnit& rCandidate = maGrp[nOb]; 661cdf0e10cSrcweir const basegfx::B3DPoint aObjectCenter(rCandidate.mp3DObj->GetBoundVolume().getCenter()); 662cdf0e10cSrcweir 663cdf0e10cSrcweir // transform from 2D world view to 3D eye 664cdf0e10cSrcweir const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mp3DObj->GetScene()->GetViewContact()); 665cdf0e10cSrcweir const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D()); 666cdf0e10cSrcweir 667cdf0e10cSrcweir basegfx::B2DPoint aGlobalScaleStart2D((double)(aStartPos.X()), (double)(aStartPos.Y())); 668cdf0e10cSrcweir basegfx::B2DPoint aGlobalScaleNext2D((double)(rPnt.X()), (double)(rPnt.Y())); 669cdf0e10cSrcweir basegfx::B2DPoint aGlobalScaleFixPos2D((double)(maScaleFixPos.X()), (double)(maScaleFixPos.Y())); 670cdf0e10cSrcweir basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation()); 671cdf0e10cSrcweir 672cdf0e10cSrcweir aInverseSceneTransform.invert(); 673cdf0e10cSrcweir aGlobalScaleStart2D = aInverseSceneTransform * aGlobalScaleStart2D; 674cdf0e10cSrcweir aGlobalScaleNext2D = aInverseSceneTransform * aGlobalScaleNext2D; 675cdf0e10cSrcweir aGlobalScaleFixPos2D = aInverseSceneTransform * aGlobalScaleFixPos2D; 676cdf0e10cSrcweir 677cdf0e10cSrcweir basegfx::B3DPoint aGlobalScaleStart3D(aGlobalScaleStart2D.getX(), aGlobalScaleStart2D.getY(), aObjectCenter.getZ()); 678cdf0e10cSrcweir basegfx::B3DPoint aGlobalScaleNext3D(aGlobalScaleNext2D.getX(), aGlobalScaleNext2D.getY(), aObjectCenter.getZ()); 679cdf0e10cSrcweir basegfx::B3DPoint aGlobalScaleFixPos3D(aGlobalScaleFixPos2D.getX(), aGlobalScaleFixPos2D.getY(), aObjectCenter.getZ()); 680cdf0e10cSrcweir basegfx::B3DHomMatrix aInverseViewToEye(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection()); 681cdf0e10cSrcweir 682cdf0e10cSrcweir aInverseViewToEye.invert(); 683cdf0e10cSrcweir basegfx::B3DPoint aScStart(aInverseViewToEye * aGlobalScaleStart3D); 684cdf0e10cSrcweir basegfx::B3DPoint aScNext(aInverseViewToEye * aGlobalScaleNext3D); 685cdf0e10cSrcweir basegfx::B3DPoint aScFixPos(aInverseViewToEye * aGlobalScaleFixPos3D); 686cdf0e10cSrcweir 687cdf0e10cSrcweir // constraints? 688cdf0e10cSrcweir switch(meWhatDragHdl) 689cdf0e10cSrcweir { 690cdf0e10cSrcweir case HDL_LEFT: 691cdf0e10cSrcweir case HDL_RIGHT: 692cdf0e10cSrcweir // constrain to auf X -> Y equal 693cdf0e10cSrcweir aScNext.setY(aScFixPos.getY()); 694cdf0e10cSrcweir break; 695cdf0e10cSrcweir case HDL_UPPER: 696cdf0e10cSrcweir case HDL_LOWER: 697cdf0e10cSrcweir // constrain to auf Y -> X equal 698cdf0e10cSrcweir aScNext.setX(aScFixPos.getX()); 699cdf0e10cSrcweir break; 700cdf0e10cSrcweir default: 701cdf0e10cSrcweir break; 702cdf0e10cSrcweir } 703cdf0e10cSrcweir 704cdf0e10cSrcweir // get scale vector in eye coordinates 705cdf0e10cSrcweir basegfx::B3DPoint aScaleVec(aScStart - aScFixPos); 706cdf0e10cSrcweir aScaleVec.setZ(1.0); 707cdf0e10cSrcweir 708cdf0e10cSrcweir if(aScaleVec.getX() != 0.0) 709cdf0e10cSrcweir { 710cdf0e10cSrcweir aScaleVec.setX((aScNext.getX() - aScFixPos.getX()) / aScaleVec.getX()); 711cdf0e10cSrcweir } 712cdf0e10cSrcweir else 713cdf0e10cSrcweir { 714cdf0e10cSrcweir aScaleVec.setX(1.0); 715cdf0e10cSrcweir } 716cdf0e10cSrcweir 717cdf0e10cSrcweir if(aScaleVec.getY() != 0.0) 718cdf0e10cSrcweir { 719cdf0e10cSrcweir aScaleVec.setY((aScNext.getY() - aScFixPos.getY()) / aScaleVec.getY()); 720cdf0e10cSrcweir } 721cdf0e10cSrcweir else 722cdf0e10cSrcweir { 723cdf0e10cSrcweir aScaleVec.setY(1.0); 724cdf0e10cSrcweir } 725cdf0e10cSrcweir 726cdf0e10cSrcweir // SHIFT-key used? 727cdf0e10cSrcweir if(getSdrDragView().IsOrtho()) 728cdf0e10cSrcweir { 729cdf0e10cSrcweir if(fabs(aScaleVec.getX()) > fabs(aScaleVec.getY())) 730cdf0e10cSrcweir { 731cdf0e10cSrcweir // X is biggest 732cdf0e10cSrcweir aScaleVec.setY(aScaleVec.getX()); 733cdf0e10cSrcweir } 734cdf0e10cSrcweir else 735cdf0e10cSrcweir { 736cdf0e10cSrcweir // Y is biggest 737cdf0e10cSrcweir aScaleVec.setX(aScaleVec.getY()); 738cdf0e10cSrcweir } 739cdf0e10cSrcweir } 740cdf0e10cSrcweir 741cdf0e10cSrcweir // build transformation 742cdf0e10cSrcweir basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation()); 743cdf0e10cSrcweir aInverseOrientation.invert(); 744cdf0e10cSrcweir 745cdf0e10cSrcweir basegfx::B3DHomMatrix aNewTrans = rCandidate.maInitTransform; 746cdf0e10cSrcweir aNewTrans *= rCandidate.maDisplayTransform; 747cdf0e10cSrcweir aNewTrans *= aViewInfo3D.getOrientation(); 748cdf0e10cSrcweir aNewTrans.translate(-aScFixPos.getX(), -aScFixPos.getY(), -aScFixPos.getZ()); 749cdf0e10cSrcweir aNewTrans.scale(aScaleVec.getX(), aScaleVec.getY(), aScaleVec.getZ()); 750cdf0e10cSrcweir aNewTrans.translate(aScFixPos.getX(), aScFixPos.getY(), aScFixPos.getZ()); 751cdf0e10cSrcweir aNewTrans *= aInverseOrientation; 752cdf0e10cSrcweir aNewTrans *= rCandidate.maInvDisplayTransform; 753cdf0e10cSrcweir 754cdf0e10cSrcweir // ...und anwenden 755cdf0e10cSrcweir rCandidate.maTransform = aNewTrans; 756cdf0e10cSrcweir 757cdf0e10cSrcweir if(mbMoveFull) 758cdf0e10cSrcweir { 759cdf0e10cSrcweir E3DModifySceneSnapRectUpdater aUpdater(rCandidate.mp3DObj); 760cdf0e10cSrcweir rCandidate.mp3DObj->SetTransform(rCandidate.maTransform); 761cdf0e10cSrcweir } 762cdf0e10cSrcweir else 763cdf0e10cSrcweir { 764cdf0e10cSrcweir Hide(); 765cdf0e10cSrcweir rCandidate.maWireframePoly.clear(); 766cdf0e10cSrcweir rCandidate.maWireframePoly = rCandidate.mp3DObj->CreateWireframe(); 767cdf0e10cSrcweir rCandidate.maWireframePoly.transform(rCandidate.maTransform); 768cdf0e10cSrcweir Show(); 769cdf0e10cSrcweir } 770cdf0e10cSrcweir } 771cdf0e10cSrcweir } 772cdf0e10cSrcweir maLastPos = rPnt; 773cdf0e10cSrcweir DragStat().NextMove(rPnt); 774cdf0e10cSrcweir } 775cdf0e10cSrcweir } 776cdf0e10cSrcweir 777cdf0e10cSrcweir /************************************************************************* 778cdf0e10cSrcweir |* 779cdf0e10cSrcweir \************************************************************************/ 780cdf0e10cSrcweir 781cdf0e10cSrcweir Pointer E3dDragMove::GetSdrDragPointer() const 782cdf0e10cSrcweir { 783cdf0e10cSrcweir return Pointer(POINTER_MOVE); 784cdf0e10cSrcweir } 785cdf0e10cSrcweir 786cdf0e10cSrcweir // eof 787