LibreOffice Module svx (master)  1
dragmt3d.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 
21 #include <dragmt3d.hxx>
22 #include <o3tl/numeric.hxx>
23 #include <svx/svdpagv.hxx>
24 #include <svx/dialmgr.hxx>
25 #include <svx/svddrgmt.hxx>
26 #include <svx/svdtrans.hxx>
27 #include <svx/obj3d.hxx>
28 #include <svx/e3dundo.hxx>
29 #include <svx/strings.hrc>
35 #include <svx/e3dsceneupdater.hxx>
36 #include <vcl/ptrstyle.hxx>
37 
38 
40  SdrDragView &_rView,
41  const SdrMarkList& rMark,
42  E3dDragConstraint eConstr,
43  bool bFull)
44 : SdrDragMethod(_rView),
45  meConstraint(eConstr),
46  mbMoveFull(bFull),
47  mbMovedAtAll(false)
48 {
49  // Create a unit for all the 3D objects present in the selection
50  const size_t nCnt(rMark.GetMarkCount());
51 
52  if(mbMoveFull)
53  {
54  // for non-visible 3D objects fallback to wireframe interaction
55  for(size_t nObjs = 0; nObjs < nCnt; ++nObjs)
56  {
57  E3dObject* pE3dObj = dynamic_cast< E3dObject* >(rMark.GetMark(nObjs)->GetMarkedSdrObj());
58 
59  if(pE3dObj)
60  {
61  if(!pE3dObj->HasFillStyle() && !pE3dObj->HasLineStyle())
62  {
63  mbMoveFull = false;
64  break;
65  }
66  }
67  }
68  }
69 
70  for(size_t nObjs = 0; nObjs < nCnt; ++nObjs)
71  {
72  E3dObject* pE3dObj = dynamic_cast< E3dObject* >(rMark.GetMark(nObjs)->GetMarkedSdrObj());
73 
74  if(pE3dObj)
75  {
76  // fill new interaction unit
77  E3dDragMethodUnit aNewUnit(*pE3dObj);
78 
79  // get transformations
80  aNewUnit.maInitTransform = aNewUnit.maTransform = pE3dObj->GetTransform();
81 
82  if(nullptr != pE3dObj->getParentE3dSceneFromE3dObject())
83  {
84  // get transform between object and world, normally scene transform
86  aNewUnit.maInvDisplayTransform.invert();
87  }
88 
89  if(!mbMoveFull)
90  {
91  // create wireframe visualisation for parent coordinate system
92  aNewUnit.maWireframePoly.clear();
93  aNewUnit.maWireframePoly = pE3dObj->CreateWireframe();
94  aNewUnit.maWireframePoly.transform(aNewUnit.maTransform);
95  }
96 
97  // Determine FullBound
98  maFullBound.Union(pE3dObj->GetSnapRect());
99 
100  // Insert Unit
101  maGrp.push_back(aNewUnit);
102  }
103  }
104 }
105 
107 {
108  return OUString();
109 }
110 
111 // Create the wireframe model for all actions
112 
114 {
116  {
117  const sal_uInt32 nCnt(maGrp.size());
119 
120  for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
121  {
122  E3dDragMethodUnit& rCandidate = maGrp[nOb];
123  rCandidate.mnStartAngle = GetAngle(DragStat().GetStart() - DragStat().GetRef1());
124  rCandidate.mnLastAngle = 0;
125  }
126  }
127  else
128  {
130  }
131 
132  if(!mbMoveFull)
133  {
134  Show();
135  }
136 
137  return true;
138 }
139 
140 bool E3dDragMethod::EndSdrDrag(bool /*bCopy*/)
141 {
142  const sal_uInt32 nCnt(maGrp.size());
143 
144  if(!mbMoveFull)
145  {
146  // Hide wireframe
147  Hide();
148  }
149 
150  // Apply all transformations and create undo's
151  if(mbMovedAtAll)
152  {
153  const bool bUndo = getSdrDragView().IsUndoEnabled();
154  if( bUndo )
155  getSdrDragView().BegUndo(SvxResId(RID_SVX_3D_UNDO_ROTATE));
156  sal_uInt32 nOb(0);
157 
158  for(nOb=0;nOb<nCnt;nOb++)
159  {
160  E3dDragMethodUnit& rCandidate = maGrp[nOb];
161  E3DModifySceneSnapRectUpdater aUpdater(&rCandidate.mr3DObj);
162  rCandidate.mr3DObj.SetTransform(rCandidate.maTransform);
163  if( bUndo )
164  {
166  std::make_unique<E3dRotateUndoAction>(
167  rCandidate.mr3DObj,
168  rCandidate.maInitTransform,
169  rCandidate.maTransform));
170  }
171  }
172  if( bUndo )
174  }
175 
176  return true;
177 }
178 
180 {
181  if(mbMoveFull)
182  {
183  if(mbMovedAtAll)
184  {
185  const sal_uInt32 nCnt(maGrp.size());
186 
187  for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
188  {
189  // Restore transformation
190  E3dDragMethodUnit& rCandidate = maGrp[nOb];
191  E3DModifySceneSnapRectUpdater aUpdater(&rCandidate.mr3DObj);
192  rCandidate.mr3DObj.SetTransform(rCandidate.maInitTransform);
193  }
194  }
195  }
196  else
197  {
198  // Hide WireFrame
199  Hide();
200  }
201 }
202 
203 // Common MoveSdrDrag()
204 
205 void E3dDragMethod::MoveSdrDrag(const Point& /*rPnt*/)
206 {
207  mbMovedAtAll = true;
208 }
209 
210 // Draw the wire frame model
211 
212 // for migration from XOR to overlay
214  sdr::overlay::OverlayManager& rOverlayManager,
215  const sdr::contact::ObjectContact& rObjectContact)
216 {
217  const sal_uInt32 nCnt(maGrp.size());
218  basegfx::B2DPolyPolygon aResult;
219 
220  for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
221  {
222  E3dDragMethodUnit& rCandidate = maGrp[nOb];
224 
225  if(pPV && pPV->HasMarkedObjPageView())
226  {
227  const basegfx::B3DPolyPolygon aCandidate(rCandidate.maWireframePoly);
228  const sal_uInt32 nPlyCnt(aCandidate.count());
229 
230  if(nPlyCnt)
231  {
232  const E3dScene* pScene(rCandidate.mr3DObj.getRootE3dSceneFromE3dObject());
233 
234  if(nullptr != pScene)
235  {
236  const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact());
238  const basegfx::B3DHomMatrix aWorldToView(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection() * aViewInfo3D.getOrientation());
239  const basegfx::B3DHomMatrix aTransform(aWorldToView * rCandidate.maDisplayTransform);
240 
241  // transform to relative scene coordinates
243 
244  // transform to 2D view coordinates
245  aPolyPolygon.transform(rVCScene.getObjectTransformation());
246 
247  aResult.append(aPolyPolygon);
248  }
249  }
250  }
251  }
252 
253  if(aResult.count())
254  {
255  std::unique_ptr<sdr::overlay::OverlayPolyPolygonStripedAndFilled> pNew(
257  aResult));
258 
260  std::move(pNew),
261  rObjectContact,
262  rOverlayManager);
263  }
264 }
265 
266 
268  const SdrMarkList& rMark,
269  E3dDragConstraint eConstr,
270  bool bFull)
271 : E3dDragMethod(_rView, rMark, eConstr, bFull)
272 {
273  // Get center of all selected objects in eye coordinates
274  const sal_uInt32 nCnt(maGrp.size());
275 
276  if(nCnt)
277  {
278  const E3dScene* pScene(maGrp[0].mr3DObj.getRootE3dSceneFromE3dObject());
279 
280  if(nullptr != pScene)
281  {
282  const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact());
284 
285  for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
286  {
287  E3dDragMethodUnit& rCandidate = maGrp[nOb];
288  basegfx::B3DPoint aObjCenter = rCandidate.mr3DObj.GetBoundVolume().getCenter();
289  const basegfx::B3DHomMatrix aTransform(aViewInfo3D.getOrientation() * rCandidate.maDisplayTransform * rCandidate.maInitTransform);
290 
291  aObjCenter = aTransform * aObjCenter;
292  maGlobalCenter += aObjCenter;
293  }
294 
295  // Divide by the number
296  if(nCnt > 1)
297  {
298  maGlobalCenter /= static_cast<double>(nCnt);
299  }
300 
301  // get rotate center and transform to 3D eye coordinates
302  basegfx::B2DPoint aRotCenter2D(Ref1().X(), Ref1().Y());
303 
304  // from world to relative scene using inverse getObjectTransformation()
305  basegfx::B2DHomMatrix aInverseObjectTransform(rVCScene.getObjectTransformation());
306  aInverseObjectTransform.invert();
307  aRotCenter2D = aInverseObjectTransform * aRotCenter2D;
308 
309  // from 3D view to 3D eye
310  basegfx::B3DPoint aRotCenter3D(aRotCenter2D.getX(), aRotCenter2D.getY(), 0.0);
311  basegfx::B3DHomMatrix aInverseViewToEye(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection());
312  aInverseViewToEye.invert();
313  aRotCenter3D = aInverseViewToEye * aRotCenter3D;
314 
315  // Use X,Y of the RotCenter and depth of the common object centre
316  // as rotation point in the space
317  maGlobalCenter.setX(aRotCenter3D.getX());
318  maGlobalCenter.setY(aRotCenter3D.getY());
319  }
320  }
321 }
322 
323 
324 //The object is moved, determine the angle
325 
327 {
328  // call parent
330 
331  if(DragStat().CheckMinMoved(rPnt))
332  {
333  // Get modifier
334  sal_uInt16 nModifier = 0;
335  if(dynamic_cast<const E3dView*>(&getSdrDragView()))
336  {
337  const MouseEvent& rLastMouse = static_cast<E3dView&>(getSdrDragView()).GetMouseEvent();
338  nModifier = rLastMouse.GetModifier();
339  }
340 
341  // Rotate all objects
342  const sal_uInt32 nCnt(maGrp.size());
343 
344  for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
345  {
346  // Determine rotation angle
347  double fWAngle, fHAngle;
348  E3dDragMethodUnit& rCandidate = maGrp[nOb];
349 
351  {
352  fWAngle = NormAngle36000(GetAngle(rPnt - DragStat().GetRef1()) -
353  rCandidate.mnStartAngle) - rCandidate.mnLastAngle;
354  rCandidate.mnLastAngle = static_cast<long>(fWAngle) + rCandidate.mnLastAngle;
355  fWAngle /= 100.0;
356  fHAngle = 0.0;
357  }
358  else
359  {
360  if ((maFullBound.GetWidth() == 0) || (maFullBound.GetHeight() == 0))
361  throw o3tl::divide_by_zero();
362  fWAngle = 90.0 * static_cast<double>(rPnt.X() - maLastPos.X())
363  / static_cast<double>(maFullBound.GetWidth());
364  fHAngle = 90.0 * static_cast<double>(rPnt.Y() - maLastPos.Y())
365  / static_cast<double>(maFullBound.GetHeight());
366  }
367  long nSnap = 0;
368 
370  nSnap = 90;
371 
372  if(nSnap != 0)
373  {
374  fWAngle = static_cast<double>((static_cast<long>(fWAngle) + nSnap/2) / nSnap * nSnap);
375  fHAngle = static_cast<double>((static_cast<long>(fHAngle) + nSnap/2) / nSnap * nSnap);
376  }
377 
378  // to radians
379  fWAngle = basegfx::deg2rad(fWAngle);
380  fHAngle = basegfx::deg2rad(fHAngle);
381 
382  // Determine transformation
383  basegfx::B3DHomMatrix aRotMat;
385  {
386  if(nModifier & KEY_MOD2)
387  aRotMat.rotate(0.0, 0.0, fWAngle);
388  else
389  aRotMat.rotate(0.0, fWAngle, 0.0);
390  }
391  else if(E3dDragConstraint::Z & meConstraint)
392  {
393  if(nModifier & KEY_MOD2)
394  aRotMat.rotate(0.0, fWAngle, 0.0);
395  else
396  aRotMat.rotate(0.0, 0.0, fWAngle);
397  }
398  if(E3dDragConstraint::X & meConstraint)
399  {
400  aRotMat.rotate(fHAngle, 0.0, 0.0);
401  }
402 
403  const E3dScene* pScene(rCandidate.mr3DObj.getRootE3dSceneFromE3dObject());
404 
405  if(nullptr != pScene)
406  {
407  // Transformation in eye coordinates, there rotate then and back
408  const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact());
410  basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation());
411  aInverseOrientation.invert();
412 
413  basegfx::B3DHomMatrix aTransMat(rCandidate.maDisplayTransform);
414  aTransMat *= aViewInfo3D.getOrientation();
416  aTransMat *= aRotMat;
418  aTransMat *= aInverseOrientation;
419  aTransMat *= rCandidate.maInvDisplayTransform;
420 
421  // ...and apply
422  rCandidate.maTransform *= aTransMat;
423 
424  if(mbMoveFull)
425  {
426  E3DModifySceneSnapRectUpdater aUpdater(&rCandidate.mr3DObj);
427  rCandidate.mr3DObj.SetTransform(rCandidate.maTransform);
428  }
429  else
430  {
431  Hide();
432  rCandidate.maWireframePoly.transform(aTransMat);
433  Show();
434  }
435  }
436  }
437  maLastPos = rPnt;
438  DragStat().NextMove(rPnt);
439  }
440 }
441 
443 {
444  return PointerStyle::Rotate;
445 }
446 
447 // E3dDragMove. This drag method is only required for translations inside
448 // 3D scenes. If a 3D-scene itself moved, then this drag method will drag
449 // not be used.
450 
451 
453  const SdrMarkList& rMark,
454  SdrHdlKind eDrgHdl,
455  E3dDragConstraint eConstr,
456  bool bFull)
457 : E3dDragMethod(_rView, rMark, eConstr, bFull),
458  meWhatDragHdl(eDrgHdl)
459 {
460  switch(meWhatDragHdl)
461  {
462  case SdrHdlKind::Left:
464  break;
465  case SdrHdlKind::Right:
467  break;
468  case SdrHdlKind::Upper:
470  break;
471  case SdrHdlKind::Lower:
473  break;
476  break;
479  break;
482  break;
485  break;
486  default:
487  // Moving the object, SdrHdlKind::Move
488  break;
489  }
490 
491  // Override when IsResizeAtCenter()
492  if(getSdrDragView().IsResizeAtCenter())
493  {
496  }
497 }
498 
499 // The object is moved, determine the translations
500 
502 {
503  // call parent
505 
506  if(DragStat().CheckMinMoved(rPnt))
507  {
509  {
510  // Translation
511  // Determine the motion vector
512  const sal_uInt32 nCnt(maGrp.size());
513 
514  // Get modifier
515  sal_uInt16 nModifier(0);
516 
517  if(dynamic_cast<const E3dView*>(&getSdrDragView()))
518  {
519  const MouseEvent& rLastMouse = static_cast<E3dView&>(getSdrDragView()).GetMouseEvent();
520  nModifier = rLastMouse.GetModifier();
521  }
522 
523  for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
524  {
525  E3dDragMethodUnit& rCandidate = maGrp[nOb];
526  const E3dScene* pScene(rCandidate.mr3DObj.getRootE3dSceneFromE3dObject());
527 
528  if(nullptr != pScene)
529  {
530  const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact());
532 
533  // move coor from 2d world to 3d Eye
534  basegfx::B2DPoint aGlobalMoveHead2D(static_cast<double>(rPnt.X() - maLastPos.X()), static_cast<double>(rPnt.Y() - maLastPos.Y()));
535  basegfx::B2DPoint aGlobalMoveTail2D(0.0, 0.0);
536  basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation());
537 
538  aInverseSceneTransform.invert();
539  aGlobalMoveHead2D = aInverseSceneTransform * aGlobalMoveHead2D;
540  aGlobalMoveTail2D = aInverseSceneTransform * aGlobalMoveTail2D;
541 
542  basegfx::B3DPoint aMoveHead3D(aGlobalMoveHead2D.getX(), aGlobalMoveHead2D.getY(), 0.5);
543  basegfx::B3DPoint aMoveTail3D(aGlobalMoveTail2D.getX(), aGlobalMoveTail2D.getY(), 0.5);
544  basegfx::B3DHomMatrix aInverseViewToEye(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection());
545  aInverseViewToEye.invert();
546 
547  aMoveHead3D = aInverseViewToEye * aMoveHead3D;
548  aMoveTail3D = aInverseViewToEye * aMoveTail3D;
549 
550  // eventually switch movement from XY to XZ plane
551  if(nModifier & KEY_MOD2)
552  {
553  double fZwi = aMoveHead3D.getY();
554  aMoveHead3D.setY(aMoveHead3D.getZ());
555  aMoveHead3D.setZ(fZwi);
556 
557  fZwi = aMoveTail3D.getY();
558  aMoveTail3D.setY(aMoveTail3D.getZ());
559  aMoveTail3D.setZ(fZwi);
560  }
561 
562  // Motion vector from eye coordinates to parent coordinates
563  basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation());
564  aInverseOrientation.invert();
565  basegfx::B3DHomMatrix aCompleteTrans(rCandidate.maInvDisplayTransform * aInverseOrientation);
566 
567  aMoveHead3D = aCompleteTrans * aMoveHead3D;
568  aMoveTail3D = aCompleteTrans* aMoveTail3D;
569 
570  // build transformation
571  basegfx::B3DHomMatrix aTransMat;
572  basegfx::B3DPoint aTranslate(aMoveHead3D - aMoveTail3D);
573  aTransMat.translate(aTranslate.getX(), aTranslate.getY(), aTranslate.getZ());
574 
575  // ...and apply
576  rCandidate.maTransform *= aTransMat;
577 
578  if(mbMoveFull)
579  {
580  E3DModifySceneSnapRectUpdater aUpdater(&rCandidate.mr3DObj);
581  rCandidate.mr3DObj.SetTransform(rCandidate.maTransform);
582  }
583  else
584  {
585  Hide();
586  rCandidate.maWireframePoly.transform(aTransMat);
587  Show();
588  }
589  }
590  }
591  }
592  else
593  {
594  // Scaling
595  // Determine scaling vector
596  Point aStartPos = DragStat().GetStart();
597  const sal_uInt32 nCnt(maGrp.size());
598 
599  for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
600  {
601  E3dDragMethodUnit& rCandidate = maGrp[nOb];
602  const basegfx::B3DPoint aObjectCenter(rCandidate.mr3DObj.GetBoundVolume().getCenter());
603  const E3dScene* pScene(rCandidate.mr3DObj.getRootE3dSceneFromE3dObject());
604 
605  if(nullptr != pScene)
606  {
607  // transform from 2D world view to 3D eye
608  const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact());
610 
611  basegfx::B2DPoint aGlobalScaleStart2D(static_cast<double>(aStartPos.X()), static_cast<double>(aStartPos.Y()));
612  basegfx::B2DPoint aGlobalScaleNext2D(static_cast<double>(rPnt.X()), static_cast<double>(rPnt.Y()));
613  basegfx::B2DPoint aGlobalScaleFixPos2D(static_cast<double>(maScaleFixPos.X()), static_cast<double>(maScaleFixPos.Y()));
614  basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation());
615 
616  aInverseSceneTransform.invert();
617  aGlobalScaleStart2D = aInverseSceneTransform * aGlobalScaleStart2D;
618  aGlobalScaleNext2D = aInverseSceneTransform * aGlobalScaleNext2D;
619  aGlobalScaleFixPos2D = aInverseSceneTransform * aGlobalScaleFixPos2D;
620 
621  basegfx::B3DPoint aGlobalScaleStart3D(aGlobalScaleStart2D.getX(), aGlobalScaleStart2D.getY(), aObjectCenter.getZ());
622  basegfx::B3DPoint aGlobalScaleNext3D(aGlobalScaleNext2D.getX(), aGlobalScaleNext2D.getY(), aObjectCenter.getZ());
623  basegfx::B3DPoint aGlobalScaleFixPos3D(aGlobalScaleFixPos2D.getX(), aGlobalScaleFixPos2D.getY(), aObjectCenter.getZ());
624  basegfx::B3DHomMatrix aInverseViewToEye(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection());
625 
626  aInverseViewToEye.invert();
627  basegfx::B3DPoint aScStart(aInverseViewToEye * aGlobalScaleStart3D);
628  basegfx::B3DPoint aScNext(aInverseViewToEye * aGlobalScaleNext3D);
629  basegfx::B3DPoint aScFixPos(aInverseViewToEye * aGlobalScaleFixPos3D);
630 
631  // constraints?
632  switch(meWhatDragHdl)
633  {
634  case SdrHdlKind::Left:
635  case SdrHdlKind::Right:
636  // to constrain on X -> Y equal
637  aScNext.setY(aScFixPos.getY());
638  break;
639  case SdrHdlKind::Upper:
640  case SdrHdlKind::Lower:
641  // constrain to Y -> X equal
642  aScNext.setX(aScFixPos.getX());
643  break;
644  default:
645  break;
646  }
647 
648  // get scale vector in eye coordinates
649  basegfx::B3DPoint aScaleVec(aScStart - aScFixPos);
650  aScaleVec.setZ(1.0);
651 
652  if(aScaleVec.getX() != 0.0)
653  {
654  aScaleVec.setX((aScNext.getX() - aScFixPos.getX()) / aScaleVec.getX());
655  }
656  else
657  {
658  aScaleVec.setX(1.0);
659  }
660 
661  if(aScaleVec.getY() != 0.0)
662  {
663  aScaleVec.setY((aScNext.getY() - aScFixPos.getY()) / aScaleVec.getY());
664  }
665  else
666  {
667  aScaleVec.setY(1.0);
668  }
669 
670  // SHIFT-key used?
671  if(getSdrDragView().IsOrtho())
672  {
673  if(fabs(aScaleVec.getX()) > fabs(aScaleVec.getY()))
674  {
675  // X is biggest
676  aScaleVec.setY(aScaleVec.getX());
677  }
678  else
679  {
680  // Y is biggest
681  aScaleVec.setX(aScaleVec.getY());
682  }
683  }
684 
685  // build transformation
686  basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation());
687  aInverseOrientation.invert();
688 
689  basegfx::B3DHomMatrix aNewTrans = rCandidate.maInitTransform;
690  aNewTrans *= rCandidate.maDisplayTransform;
691  aNewTrans *= aViewInfo3D.getOrientation();
692  aNewTrans.translate(-aScFixPos.getX(), -aScFixPos.getY(), -aScFixPos.getZ());
693  aNewTrans.scale(aScaleVec.getX(), aScaleVec.getY(), aScaleVec.getZ());
694  aNewTrans.translate(aScFixPos.getX(), aScFixPos.getY(), aScFixPos.getZ());
695  aNewTrans *= aInverseOrientation;
696  aNewTrans *= rCandidate.maInvDisplayTransform;
697 
698  // ...and apply
699  rCandidate.maTransform = aNewTrans;
700 
701  if(mbMoveFull)
702  {
703  E3DModifySceneSnapRectUpdater aUpdater(&rCandidate.mr3DObj);
704  rCandidate.mr3DObj.SetTransform(rCandidate.maTransform);
705  }
706  else
707  {
708  Hide();
709  rCandidate.maWireframePoly.clear();
710  rCandidate.maWireframePoly = rCandidate.mr3DObj.CreateWireframe();
711  rCandidate.maWireframePoly.transform(rCandidate.maTransform);
712  Show();
713  }
714  }
715  }
716  }
717  maLastPos = rPnt;
718  DragStat().NextMove(rPnt);
719  }
720 }
721 
723 {
724  return PointerStyle::Move;
725 }
726 
727 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Point TopLeft() const
::std::vector< E3dDragMethodUnit > maGrp
Definition: dragmt3d.hxx:60
void setY(double fY)
void setX(double fX)
long GetWidth() const
sal_Int32 mnStartAngle
Definition: dragmt3d.hxx:40
size_t GetMarkCount() const
Definition: svdmark.hxx:179
long GetHeight() const
void transform(const basegfx::B3DHomMatrix &rMatrix)
SdrHdlKind meWhatDragHdl
Definition: dragmt3d.hxx:105
basegfx::B3DPoint maGlobalCenter
Definition: dragmt3d.hxx:89
const Point & GetStart() const
Definition: svddrag.hxx:92
Point BottomLeft() const
SdrHdlKind
Definition: svdhdl.hxx:52
bool IsUndoEnabled() const
Definition: svdedtv.cxx:1031
bool HasFillStyle() const
Definition: svdobj.cxx:2976
basegfx::B3DHomMatrix maDisplayTransform
Definition: dragmt3d.hxx:36
E3dDragRotate(SdrDragView &rView, const SdrMarkList &rMark, E3dDragConstraint eConstr, bool bFull)
Definition: dragmt3d.cxx:267
Point maLastPos
Definition: dragmt3d.hxx:62
void BegUndo()
Definition: svdedtv.hxx:179
double getZ() const
const drawinglayer::geometry::ViewInformation3D & getViewInformation3D(const ::basegfx::B3DRange &rContentRange) const
SdrMark * GetMark(size_t nNum) const
Definition: svdmark.cxx:234
B2DPolyPolygon createB2DPolyPolygonFromB3DPolyPolygon(const B3DPolyPolygon &rCandidate, const B3DHomMatrix &rMat)
const basegfx::B3DHomMatrix & GetTransform() const
Definition: obj3d.hxx:111
virtual const tools::Rectangle & GetSnapRect() const override
Definition: svdoattr.cxx:91
void scale(double fX, double fY, double fZ)
long NormAngle36000(long a)
Normalize angle to -180.00..179.99.
Definition: svdtrans.cxx:407
SdrDragStat & DragStat()
Definition: svddrgmt.hxx:163
Point RightCenter() const
double getX() const
sal_Int32 mnLastAngle
Definition: dragmt3d.hxx:41
B3DPoint getCenter() const
OUString SvxResId(const char *pId)
Definition: dialmgr.cxx:28
#define KEY_MOD2
#define X
Point BottomCenter() const
sal_uInt32 count() const
E3dDragMethod(SdrDragView &rView, const SdrMarkList &rMark, E3dDragConstraint eConstr, bool bFull)
Definition: dragmt3d.cxx:39
bool IsRotateAllowed(bool b90Deg=false) const
Definition: svdedtv.cxx:374
Point LeftCenter() const
Point & Ref1() const
Definition: svddrgmt.hxx:165
void EndUndo()
Definition: svdedtv.cxx:278
SdrObject * GetMarkedSdrObj() const
Definition: svdmark.hxx:67
Point BottomRight() const
SdrDragView & getSdrDragView()
Definition: svddrgmt.hxx:146
void AddUndo(std::unique_ptr< SdrUndoAction > pUndo)
Definition: svdedtv.hxx:183
E3dScene * getParentE3dSceneFromE3dObject() const
Definition: obj3d.cxx:281
virtual PointerStyle GetSdrDragPointer() const override
Definition: dragmt3d.cxx:442
void SetRef1(const Point &pt)
Definition: svddrag.hxx:98
bool HasMarkedObjPageView() const
Definition: svdpagv.hxx:184
E3dDragMove(SdrDragView &rView, const SdrMarkList &rMark, SdrHdlKind eDrgHdl, E3dDragConstraint eConstr, bool bFull)
Definition: dragmt3d.cxx:452
basegfx::B3DHomMatrix maInitTransform
Definition: dragmt3d.hxx:38
basegfx::B3DPolyPolygon maWireframePoly
Definition: dragmt3d.hxx:35
E3dDragConstraint const meConstraint
Definition: dragmt3d.hxx:61
virtual bool EndSdrDrag(bool bCopy) override
Definition: dragmt3d.cxx:140
void transform(const basegfx::B2DHomMatrix &rMatrix)
virtual bool BeginSdrDrag() override
Definition: dragmt3d.cxx:113
void NextMove(const Point &rPnt)
Definition: svddrag.cxx:66
constexpr double deg2rad(double v)
const basegfx::B3DRange & GetBoundVolume() const
Definition: obj3d.cxx:323
const basegfx::B3DHomMatrix & GetFullTransform() const
Definition: obj3d.cxx:347
sal_uInt16 GetModifier() const
basegfx::B3DHomMatrix maInvDisplayTransform
Definition: dragmt3d.hxx:37
long X() const
#define Y
bool HasLineStyle() const
Definition: svdobj.cxx:2981
void translate(double fX, double fY, double fZ)
virtual void MoveSdrDrag(const Point &rPnt) override
Definition: dragmt3d.cxx:501
bool mbMovedAtAll
Definition: dragmt3d.hxx:65
virtual void SetTransform(const basegfx::B3DHomMatrix &rMatrix)
Definition: obj3d.cxx:377
Derived class of SdrView to edit 3D objects.
Definition: view3d.hxx:41
const basegfx::B2DHomMatrix & getObjectTransformation() const
tools::Rectangle & Union(const tools::Rectangle &rRect)
virtual void CreateOverlayGeometry(sdr::overlay::OverlayManager &rOverlayManager, const sdr::contact::ObjectContact &rObjectContact) override
Definition: dragmt3d.cxx:213
E3dDragConstraint
Definition: def3d.hxx:32
virtual void MoveSdrDrag(const Point &rPnt) override
Definition: dragmt3d.cxx:326
virtual PointerStyle GetSdrDragPointer() const override
Definition: dragmt3d.cxx:722
long GetAngle(const Point &rPnt)
The Y axis points down! The function negates the Y axis, when calculating the angle, such that GetAngle(Point(0,-1))=90 deg.
Definition: svdtrans.cxx:385
PointerStyle
SdrPageView * GetSdrPageView() const
Definition: svdpntv.hxx:310
Helper for 3d object changes affecting 2d geometry.
void rotate(double fAngleX, double fAngleY, double fAngleZ)
double getY() const
E3dObject & mr3DObj
Definition: dragmt3d.hxx:34
virtual void MoveSdrDrag(const Point &rPnt) override
Definition: dragmt3d.cxx:205
basegfx::B3DHomMatrix maTransform
Definition: dragmt3d.hxx:39
virtual E3dScene * getRootE3dSceneFromE3dObject() const
Definition: obj3d.cxx:287
virtual void CancelSdrDrag() override
Definition: dragmt3d.cxx:179
Point maScaleFixPos
Definition: dragmt3d.hxx:106
basegfx::B3DPolyPolygon CreateWireframe() const
Definition: obj3d.cxx:388
Point TopRight() const
void setZ(double fZ)
virtual OUString GetSdrDragComment() const override
Definition: dragmt3d.cxx:106
bool mbMoveFull
Definition: dragmt3d.hxx:64
void insertNewlyCreatedOverlayObjectForSdrDragMethod(std::unique_ptr< sdr::overlay::OverlayObject > pOverlayObject, const sdr::contact::ObjectContact &rObjectContact, sdr::overlay::OverlayManager &rOverlayManager)
Definition: svddrgmt.cxx:336
Point Center() const
long Y() const
Point TopCenter() const
tools::Rectangle maFullBound
Definition: dragmt3d.hxx:63