LibreOffice Module svx (master)  1
scene3d.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 #include <sal/config.h>
21 
22 #include <cstdlib>
23 
24 #include <svx/strings.hrc>
25 #include <svx/dialmgr.hxx>
26 #include <svx/svditer.hxx>
27 
28 #include <stdlib.h>
29 #include <svx/svdobjkind.hxx>
30 #include <svx/svdpage.hxx>
31 #include <svx/scene3d.hxx>
32 #include <svx/svdtrans.hxx>
35 #include <svx/svddrag.hxx>
36 #include "helperminimaldepth3d.hxx"
37 #include <algorithm>
40 #include <svx/e3dsceneupdater.hxx>
41 #include <svx/svdmodel.hxx>
42 #include <rtl/ustrbuf.hxx>
43 
44 namespace {
45 
46 class ImpRemap3DDepth
47 {
48  sal_uInt32 mnOrdNum;
49  double mfMinimalDepth;
50 
51  // bit field
52  bool mbIsScene : 1;
53 
54 public:
55  ImpRemap3DDepth(sal_uInt32 nOrdNum, double fMinimalDepth);
56  explicit ImpRemap3DDepth(sal_uInt32 nOrdNum);
57 
58  // for ::std::sort
59  bool operator<(const ImpRemap3DDepth& rComp) const;
60 
61  sal_uInt32 GetOrdNum() const { return mnOrdNum; }
62  bool IsScene() const { return mbIsScene; }
63 };
64 
65 }
66 
67 ImpRemap3DDepth::ImpRemap3DDepth(sal_uInt32 nOrdNum, double fMinimalDepth)
68 : mnOrdNum(nOrdNum),
69  mfMinimalDepth(fMinimalDepth),
70  mbIsScene(false)
71 {
72 }
73 
74 ImpRemap3DDepth::ImpRemap3DDepth(sal_uInt32 nOrdNum)
75 : mnOrdNum(nOrdNum),
76  mfMinimalDepth(0.0),
77  mbIsScene(true)
78 {
79 }
80 
81 bool ImpRemap3DDepth::operator<(const ImpRemap3DDepth& rComp) const
82 {
83  if(IsScene())
84  {
85  return false;
86  }
87  else
88  {
89  if(rComp.IsScene())
90  {
91  return true;
92  }
93  else
94  {
95  return mfMinimalDepth < rComp.mfMinimalDepth;
96  }
97  }
98 }
99 
101 {
102  std::vector< ImpRemap3DDepth > maVector;
103 
104 public:
105  explicit Imp3DDepthRemapper(E3dScene const & rScene);
106 
107  sal_uInt32 RemapOrdNum(sal_uInt32 nOrdNum) const;
108 };
109 
111 {
112  // only called when rScene.GetSubList() and nObjCount > 1
113  SdrObjList* pList = rScene.GetSubList();
114  const size_t nObjCount(pList->GetObjCount());
115 
116  for(size_t a = 0; a < nObjCount; ++a)
117  {
118  SdrObject* pCandidate = pList->GetObj(a);
119 
120  if(pCandidate)
121  {
122  if(auto pCompoundObj = dynamic_cast< const E3dCompoundObject*>(pCandidate))
123  {
124  // single 3d object, calc depth
125  const double fMinimalDepth(getMinimalDepthInViewCoordinates(*pCompoundObj));
126  ImpRemap3DDepth aEntry(a, fMinimalDepth);
127  maVector.push_back(aEntry);
128  }
129  else
130  {
131  // scene, use standard entry for scene
132  ImpRemap3DDepth aEntry(a);
133  maVector.push_back(aEntry);
134  }
135  }
136  }
137 
138  // now, we need to sort the maVector by its members minimal depth. The
139  // smaller, the nearer to the viewer.
140  ::std::sort(maVector.begin(), maVector.end());
141 }
142 
143 sal_uInt32 Imp3DDepthRemapper::RemapOrdNum(sal_uInt32 nOrdNum) const
144 {
145  if(nOrdNum < maVector.size())
146  {
147  nOrdNum = maVector[(maVector.size() - 1) - nOrdNum].GetOrdNum();
148  }
149 
150  return nOrdNum;
151 }
152 
153 
154 // BaseProperties section
155 
156 std::unique_ptr<sdr::properties::BaseProperties> E3dScene::CreateObjectSpecificProperties()
157 {
158  return std::make_unique<sdr::properties::E3dSceneProperties>(*this);
159 }
160 
161 
162 // DrawContact section
163 
164 std::unique_ptr<sdr::contact::ViewContact> E3dScene::CreateObjectSpecificViewContact()
165 {
166  return std::make_unique<sdr::contact::ViewContactOfE3dScene>(*this);
167 }
168 
169 
171 : E3dObject(rSdrModel),
172  SdrObjList(),
173  aCamera(basegfx::B3DPoint(0.0, 0.0, 4.0), basegfx::B3DPoint()),
174  bDrawOnlySelected(false),
175  mbSkipSettingDirty(false)
176 {
177  // Set defaults
179 }
180 
181 E3dScene::E3dScene(SdrModel& rSdrModel, E3dScene const & rSource)
182 : E3dObject(rSdrModel, rSource),
183  SdrObjList(),
184  aCamera(basegfx::B3DPoint(0.0, 0.0, 4.0), basegfx::B3DPoint()),
185  bDrawOnlySelected(false),
186  mbSkipSettingDirty(false)
187 {
188  // Set defaults
190 
191  // copy child SdrObjects
192  if (rSource.GetSubList())
193  {
194  CopyObjects(*rSource.GetSubList());
195 
196  // tdf#116979: needed here, we need bSnapRectDirty to be true
197  // which it is after using SdrObject::operator= (see above),
198  // but set to false again using CopyObjects
199  SetRectsDirty();
200  }
201 
202  // copy local data
203  aCamera = rSource.aCamera;
204  aCameraSet = rSource.aCameraSet;
205  static_cast<sdr::properties::E3dSceneProperties&>(GetProperties()).SetSceneItemsFromCamera();
207  RebuildLists();
210 }
211 
213 {
214  // For WIN95/NT turn off the FP-Exceptions
215 #if defined(_WIN32)
216  _control87( _MCW_EM, _MCW_EM );
217 #endif
218 
219  // Set defaults
220  aCamera.SetViewWindow(-2, -2, 4, 4);
221  aCameraSet.SetDeviceRectangle(-2, 2, -2, 2);
223  tools::Rectangle aRect(0, 0, 10, 10);
224  aCameraSet.SetViewportRectangle(aRect);
225 
226  // set defaults for Camera from ItemPool
228  basegfx::B3DPoint aActualPosition(aCamera.GetPosition());
229  double fNew = GetDistance();
230 
231  if(fabs(fNew - aActualPosition.getZ()) > 1.0)
232  {
233  aCamera.SetPosition( basegfx::B3DPoint( aActualPosition.getX(), aActualPosition.getY(), fNew) );
234  }
235 
236  fNew = GetFocalLength() / 100.0;
237  aCamera.SetFocalLength(fNew);
238 }
239 
241 {
243 }
244 
246 {
247  return getSdrPageFromSdrObject();
248 }
249 
251 {
252  return const_cast< E3dScene* >(this);
253 }
254 
256 {
257  return const_cast< E3dScene* >(this);
258 }
259 
261 {
264  const basegfx::B3DPolyPolygon aCubePolyPolygon(CreateWireframe());
265 
267  aViewInfo3D.getObjectToView()));
268  aRetval.transform(rVCScene.getObjectTransformation());
269 
270  return aRetval;
271 }
272 
274 {
275  mp3DDepthRemapper.reset();
276 }
277 
278 sal_uInt32 E3dScene::RemapOrdNum(sal_uInt32 nNewOrdNum) const
279 {
280  if(!mp3DDepthRemapper)
281  {
282  const size_t nObjCount(GetSubList() ? GetSubList()->GetObjCount() : 0);
283 
284  if(nObjCount > 1)
285  {
286  mp3DDepthRemapper.reset(new Imp3DDepthRemapper(*this));
287  }
288  }
289 
291  {
292  return mp3DDepthRemapper->RemapOrdNum(nNewOrdNum);
293  }
294 
295  return nNewOrdNum;
296 }
297 
299 {
300  return E3D_SCENE_ID;
301 }
302 
304 {
306 
307  if(pScene == this)
308  {
309  // avoid resetting aOutRect which in case of a 3D scene used as 2d object
310  // is model data,not re-creatable view data
311  }
312  else
313  {
314  // if not the outmost scene it is used as group in 3d, call parent
316  }
317 }
318 
320 {
321  SetRectsDirty();
323  aCamera.SetDeviceWindow(rRect);
324  aCameraSet.SetViewportRectangle(rRect);
325 
327 }
328 
329 void E3dScene::NbcMove(const Size& rSize)
330 {
331  tools::Rectangle aNewSnapRect = GetSnapRect();
332  aNewSnapRect.Move(rSize);
333  NbcSetSnapRect(aNewSnapRect);
334 }
335 
336 void E3dScene::NbcResize(const Point& rRef, const Fraction& rXFact,
337  const Fraction& rYFact)
338 {
339  tools::Rectangle aNewSnapRect = GetSnapRect();
340  ResizeRect(aNewSnapRect, rRef, rXFact, rYFact);
341  NbcSetSnapRect(aNewSnapRect);
342 }
343 
344 // Set new camera, and thus mark the scene and if possible the bound volume
345 // as changed
346 
347 void E3dScene::SetCamera(const Camera3D& rNewCamera)
348 {
349  aCamera = rNewCamera;
350  static_cast<sdr::properties::E3dSceneProperties&>(GetProperties()).SetSceneItemsFromCamera();
351 
352  SetRectsDirty();
353 
354  // Turn off ratio
355  GetCameraSet().SetRatio(0.0);
356 
357  // Set Imaging geometry
359  basegfx::B3DVector aVPN(aVRP - aCamera.GetVRP());
361 
362  // use SetViewportValues() to set VRP, VPN and VUV as vectors, too.
363  // Else these values would not be exported/imported correctly.
364  GetCameraSet().SetViewportValues(aVRP, aVPN, aVUV);
365 
366  // Set perspective
368  GetCameraSet().SetViewportRectangle(aCamera.GetDeviceWindow());
369 
371 }
372 
373 // Inform parent of changes of a child
374 
376 {
378 
380 
381  if(nullptr != pScene && !pScene->mbSkipSettingDirty)
382  {
383  SetRectsDirty();
384  }
385 
387 }
388 
389 // Determine the overall scene object
390 
392 {
394 
395  if(nullptr != pParent)
396  {
397  return pParent->getRootE3dSceneFromE3dObject();
398  }
399 
400  return const_cast< E3dScene* >(this);
401 }
402 
404 {
405  E3DModifySceneSnapRectUpdater aUpdater(this);
406 
407  for(size_t a = 0; a < GetObjCount(); ++a)
408  {
409  SdrObject* pObj = GetObj(a);
410 
411  if(pObj)
412  {
413  bool bRemoveObject(false);
414 
415  if(auto pScene = dynamic_cast<E3dScene*>(pObj))
416  {
417  // iterate over this sub-scene
418  pScene->removeAllNonSelectedObjects();
419 
420  // check object count. Empty scenes can be deleted
421  const size_t nObjCount(pScene->GetSubList() ? pScene->GetSubList()->GetObjCount() : 0);
422 
423  if(!nObjCount)
424  {
425  // all objects removed, scene can be removed, too
426  bRemoveObject = true;
427  }
428  }
429  else if(auto pCompound = dynamic_cast<E3dCompoundObject*>(pObj))
430  {
431  if(!pCompound->GetSelected())
432  {
433  bRemoveObject = true;
434  }
435  }
436 
437  if(bRemoveObject)
438  {
439  NbcRemoveObject(pObj->GetOrdNum());
440  a--;
441  SdrObject::Free(pObj);
442  }
443  }
444  }
445 }
446 
448 {
449  return new E3dScene(rTargetModel, *this);
450 }
451 
453 {
455 
456  if(nullptr != pScene)
457  {
458  pScene->mbSkipSettingDirty = true;
459  }
460 }
461 
463 {
465 
466  if(nullptr != pScene)
467  {
468  pScene->mbSkipSettingDirty = false;
469  }
470 }
471 
473 {
475 
476  if(nullptr != pScene)
477  {
478  pScene->SetRectsDirty();
479  }
480 }
481 
482 // Rebuild Light- and label- object lists rebuild (after loading, allocation)
483 
485 {
486  // first delete
487  const SdrLayerID nCurrLayerID(GetLayer());
489 
490  // then examine all the objects in the scene
491  while(a3DIterator.IsMore())
492  {
493  E3dObject* p3DObj(static_cast< E3dObject* >(a3DIterator.Next()));
494  p3DObj->NbcSetLayer(nCurrLayerID);
495  }
496 
498 }
499 
500 std::unique_ptr<SdrObjGeoData> E3dScene::NewGeoData() const
501 {
502  return std::make_unique<E3DSceneGeoData>();
503 }
504 
506 {
507  E3dObject::SaveGeoData (rGeo);
508 
509  static_cast<E3DSceneGeoData &>(rGeo).aCamera = aCamera;
510 }
511 
513 {
514  // #i94832# removed E3DModifySceneSnapRectUpdater here.
515  // It should not be needed, is already part of E3dObject::RestoreGeoData
517  SetCamera (static_cast<const E3DSceneGeoData &>(rGeo).aCamera);
518 }
519 
520 // Something was changed in the style sheet, so change scene
521 
522 void E3dScene::Notify(SfxBroadcaster &rBC, const SfxHint &rHint)
523 {
524  SetRectsDirty();
525  E3dObject::Notify(rBC, rHint);
526 }
527 
528 void E3dScene::RotateScene (const Point& rRef, double sn, double cs)
529 {
530  Point UpperLeft, LowerRight, Center, NewCenter;
531 
532  UpperLeft = m_aOutRect.TopLeft();
533  LowerRight = m_aOutRect.BottomRight();
534 
535  tools::Long dxOutRectHalf = std::abs(UpperLeft.X() - LowerRight.X());
536  dxOutRectHalf /= 2;
537  tools::Long dyOutRectHalf = std::abs(UpperLeft.Y() - LowerRight.Y());
538  dyOutRectHalf /= 2;
539 
540  // Only the center is moved. The corners are moved by NbcMove. For the
541  // rotation a cartesian coordinate system is used in which the pivot
542  // point is the origin, and the y-axis increases upward, the X-axis to
543  // the right. This must be especially noted for the Y-values.
544  // (When considering a flat piece of paper the Y-axis pointing downwards
545  Center.setX( (UpperLeft.X() + dxOutRectHalf) - rRef.X() );
546  Center.setY( -((UpperLeft.Y() + dyOutRectHalf) - rRef.Y()) );
547  // A few special cases has to be dealt with first (n * 90 degrees n integer)
548  if (sn==1.0 && cs==0.0) { // 90deg
549  NewCenter.setX( -Center.Y() );
550  NewCenter.setY( -Center.X() );
551  } else if (sn==0.0 && cs==-1.0) { // 180deg
552  NewCenter.setX( -Center.X() );
553  NewCenter.setY( -Center.Y() );
554  } else if (sn==-1.0 && cs==0.0) { // 270deg
555  NewCenter.setX( Center.Y() );
556  NewCenter.setY( -Center.X() );
557  }
558  else // Here it is rotated to any angle in the mathematically
559  // positive direction!
560  { // xnew = x * cos(alpha) - y * sin(alpha)
561  // ynew = x * sin(alpha) + y * cos(alpha)
562  // Bottom Right is not rotated: the pages of aOutRect must
563  // remain parallel to the coordinate axes.
564  NewCenter.setX( static_cast<tools::Long>(Center.X() * cs - Center.Y() * sn) );
565  NewCenter.setY( static_cast<tools::Long>(Center.X() * sn + Center.Y() * cs) );
566  }
567 
568  Size Differenz;
569  Point DiffPoint = NewCenter - Center;
570  Differenz.setWidth( DiffPoint.X() );
571  Differenz.setHeight( -DiffPoint.Y() ); // Note that the Y-axis is counted ad positive downward.
572  NbcMove (Differenz); // Actually executes the coordinate transformation.
573 }
574 
576 {
577  OUString sName(SvxResId(STR_ObjNameSingulScene3d));
578 
579  OUString aName(GetName());
580  if (!aName.isEmpty())
581  sName += " '" + aName + "'";
582  return sName;
583 }
584 
586 {
587  return SvxResId(STR_ObjNamePluralScene3d);
588 }
589 
590 // The NbcRotate routine overrides the one of the SdrObject. The idea is
591 // to be able to rotate the scene relative to the position of the scene
592 // and then the objects in the scene
593 
595 {
596  if(maTransformation != rMatrix)
597  {
598  // call parent
600  }
601 }
602 
604 {
605  if(rMatrix != maTransformation)
606  {
607  // call parent
608  E3dObject::SetTransform(rMatrix);
609  }
610 }
611 
612 void E3dScene::NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs)
613 {
614  // So currently the glue points are defined relative to the scene aOutRect.
615  // Before turning the glue points are defined relative to the page. They
616  // take no part in the rotation of the scene. To ensure this, there is the
617  // SetGlueReallyAbsolute(sal_True);
618 
619  // So that was the scene, now the objects used in the scene
620  // 3D objects, if there is only one it can still have multiple surfaces but
621  // the surfaces do not have to be connected. This allows you to access child
622  // objects. So going through the entire list and rotate around the Z axis
623  // through the enter of aOutRect's (Steiner's theorem), so RotateZ
624 
625  RotateScene (rRef, sn, cs); // Rotates the scene
626  double fAngleInRad = toRadians(nAngle);
627 
628  basegfx::B3DHomMatrix aRotation;
629  aRotation.rotate(0.0, 0.0, fAngleInRad);
630  NbcSetTransform(aRotation * GetTransform());
631 
632  SetRectsDirty(); // This forces a recalculation of all BoundRects
633  NbcRotateGluePoints(rRef,nAngle,sn,cs); // Rotate the glue points (who still
634  // have coordinates relative to the
635  // original page)
636  SetGlueReallyAbsolute(false); // from now they are again relative to BoundRect (that is defined as aOutRect)
637  SetRectsDirty();
638 }
639 
641 {
643 
644  if(pScene == this)
645  {
646  // The Scene is used as a 2D-Object, take the SnapRect from the
647  // 2D Display settings
648  maSnapRect = pScene->aCamera.GetDeviceWindow();
649  }
650  else
651  {
652  // The Scene itself is a member of another scene, get the SnapRect
653  // as a composite object
654  // call parent
656 
657  for(size_t a = 0; a < GetObjCount(); ++a)
658  {
659  E3dObject* pCandidate(dynamic_cast< E3dObject* >(GetObj(a)));
660 
661  if(pCandidate)
662  {
663  maSnapRect.Union(pCandidate->GetSnapRect());
664  }
665  }
666  }
667 }
668 
670 {
671  // Break scene, if all members are able to break
673 
674  while ( a3DIterator.IsMore() )
675  {
676  E3dObject* pObj = static_cast<E3dObject*>(a3DIterator.Next());
677  if(!pObj->IsBreakObjPossible())
678  return false;
679  }
680 
681  return true;
682 }
683 
685 {
686  return TakeXorPoly();
687 }
688 
690 {
691  rStat.SetOrtho4Possible();
692  tools::Rectangle aRect1(rStat.GetStart(), rStat.GetNow());
693  aRect1.Justify();
694  rStat.SetActionRect(aRect1);
695  NbcSetSnapRect(aRect1);
696  return true;
697 }
698 
700 {
701  tools::Rectangle aRect1;
702  rStat.TakeCreateRect(aRect1);
703  aRect1.Justify();
704  rStat.SetActionRect(aRect1);
705  NbcSetSnapRect(aRect1);
707  m_bSnapRectDirty=true;
708  return true;
709 }
710 
712 {
713  tools::Rectangle aRect1;
714  rStat.TakeCreateRect(aRect1);
715  aRect1.Justify();
716  NbcSetSnapRect(aRect1);
717  SetRectsDirty();
718  return (eCmd==SdrCreateCmd::ForceEnd || rStat.GetPointCount()>=2);
719 }
720 
722 {
723  return false;
724 }
725 
727 {
728 }
729 
730 void E3dScene::SetSelected(bool bNew)
731 {
732  // call parent
734 
735  for(size_t a(0); a < GetObjCount(); a++)
736  {
737  E3dObject* pCandidate(dynamic_cast< E3dObject* >(GetObj(a)));
738 
739  if(pCandidate)
740  {
741  pCandidate->SetSelected(bNew);
742  }
743  }
744 }
745 
746 void E3dScene::NbcInsertObject(SdrObject* pObj, size_t nPos)
747 {
748  // Is it even a 3D object?
749  if(nullptr != dynamic_cast< const E3dObject* >(pObj))
750  {
751  // Normal 3D object, insert means call parent
752  SdrObjList::NbcInsertObject(pObj, nPos);
753 
754  // local needed stuff
757  }
758  else
759  {
760  // No 3D object, inserted a page in place in a scene ...
762  }
763 }
764 
765 void E3dScene::InsertObject(SdrObject* pObj, size_t nPos)
766 {
767  // Is it even a 3D object?
768  if(nullptr != dynamic_cast< const E3dObject* >(pObj))
769  {
770  // call parent
771  SdrObjList::InsertObject(pObj, nPos);
772 
773  // local needed stuff
776  }
777  else
778  {
779  // No 3D object, inserted a page in place in a scene ...
781  }
782 }
783 
785 {
786  // call parent
787  SdrObject* pRetval = SdrObjList::NbcRemoveObject(nObjNum);
788 
791 
792  return pRetval;
793 }
794 
796 {
797  // call parent
798  SdrObject* pRetval(SdrObjList::RemoveObject(nObjNum));
799 
802 
803  return pRetval;
804 }
805 
806 void E3dScene::SetRectsDirty(bool bNotMyself, bool bRecursive)
807 {
808  // call parent
809  E3dObject::SetRectsDirty(bNotMyself, bRecursive);
810 
811  for(size_t a = 0; a < GetObjCount(); ++a)
812  {
813  E3dObject* pCandidate = dynamic_cast< E3dObject* >(GetObj(a));
814 
815  if(pCandidate)
816  {
817  pCandidate->SetRectsDirty(bNotMyself, false);
818  }
819  }
820 }
821 
823 {
824  // call parent
825  E3dObject::NbcSetLayer(nLayer);
826 
827  for(size_t a = 0; a < GetObjCount(); ++a)
828  {
829  E3dObject* pCandidate = dynamic_cast< E3dObject* >(GetObj(a));
830 
831  if(pCandidate)
832  {
833  pCandidate->NbcSetLayer(nLayer);
834  }
835  }
836 }
837 
838 void E3dScene::handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage)
839 {
840  if(pOldPage == pNewPage)
841  return;
842 
843  // call parent
844  E3dObject::handlePageChange(pOldPage, pNewPage);
845 
846  for(size_t a(0); a < GetObjCount(); a++)
847  {
848  E3dObject* pCandidate = dynamic_cast< E3dObject* >(GetObj(a));
849 
850  if(pCandidate)
851  {
852  pCandidate->handlePageChange(pOldPage, pNewPage);
853  }
854  else
855  {
856  OSL_ENSURE(false, "E3dScene::handlePageChange invalid object list (!)");
857  }
858  }
859 }
860 
862 {
863  return const_cast< E3dScene* >(this);
864 }
865 
867 {
868  basegfx::B3DRange aRetval;
869  const size_t nObjCnt(GetObjCount());
870 
871  for(size_t a = 0; a < nObjCnt; ++a)
872  {
873  const E3dObject* p3DObject = dynamic_cast< const E3dObject* >(GetObj(a));
874 
875  if(p3DObject)
876  {
877  basegfx::B3DRange aLocalRange(p3DObject->GetBoundVolume());
878  aLocalRange.transform(p3DObject->GetTransform());
879  aRetval.expand(aLocalRange);
880  }
881  }
882 
883  return aRetval;
884 }
885 
887 {
888  // call parent
890 
891  for(size_t a = 0; a < GetObjCount(); ++a)
892  {
893  E3dObject* pCandidate = dynamic_cast< E3dObject* >(GetObj(a));
894 
895  if(pCandidate)
896  {
897  pCandidate->SetTransformChanged();
898  }
899  }
900 }
901 
902 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual OUString TakeObjNameSingul() const override
Definition: scene3d.cxx:575
virtual SdrObject * RemoveObject(size_t nObjNum) override
Definition: scene3d.cxx:795
const tools::Rectangle & GetDeviceWindow() const
Definition: viewpt3d.hxx:87
void SetDeviceWindow(const tools::Rectangle &rRect)
Definition: viewpt3d2.cxx:113
virtual void SetBoundRectDirty() override
Definition: scene3d.cxx:303
void SuspendReportingDirtyRects()
Definition: scene3d.cxx:452
ProjectionType GetProjection() const
Definition: viewpt3d.hxx:82
virtual SdrObjKind GetObjIdentifier() const override
Definition: scene3d.cxx:298
void setWidth(tools::Long nWidth)
virtual void SetTransformChanged()
Definition: obj3d.cxx:333
virtual void StructureChanged() override
Definition: scene3d.cxx:375
void SetViewWindow(double fX, double fY, double fW, double fH)
Definition: camera3d.cxx:41
virtual void NbcSetLayer(SdrLayerID nLayer) override
Definition: scene3d.cxx:822
virtual std::unique_ptr< SdrObjGeoData > NewGeoData() const override
A derived class must override these 3 methods if it has own geometric data that must be saved for Und...
Definition: scene3d.cxx:500
virtual void handlePageChange(SdrPage *pOldPage, SdrPage *pNewPage)
Definition: svdobj.cxx:526
const Point & GetStart() const
Definition: svddrag.hxx:102
virtual void SetTransformChanged() override
Definition: scene3d.cxx:886
virtual void RestoreGeoData(const SdrObjGeoData &rGeo) override
Definition: obj3d.cxx:425
double getMinimalDepthInViewCoordinates(const E3dCompoundObject &rObject)
support extracting the minimal depth of a 3d object in its scene
virtual SdrObjList * getChildrenOfSdrObject() const override
Definition: scene3d.cxx:255
Camera3D aCamera
Definition: scene3d.hxx:64
std::vector< ImpRemap3DDepth > maVector
Definition: scene3d.cxx:102
long Long
virtual void NbcInsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE)
Definition: svdpage.cxx:287
virtual OUString TakeObjNamePlural() const override
Definition: scene3d.cxx:585
virtual void SaveGeoData(SdrObjGeoData &rGeo) const override
Definition: obj3d.cxx:417
SdrObject * GetObj(size_t nNum) const
Definition: svdpage.cxx:770
size_t GetObjCount() const
Definition: svdpage.cxx:764
virtual void SetBoundRectDirty()
Definition: svdobj.cxx:316
B3dCamera aCameraSet
Definition: scene3d.hxx:63
void SetGlueReallyAbsolute(bool bOn)
Definition: svdobj.cxx:2307
bool mbSkipSettingDirty
Definition: scene3d.hxx:71
void CopyObjects(const SdrObjList &rSrcList)
Definition: svdpage.cxx:138
const drawinglayer::geometry::ViewInformation3D & getViewInformation3D(const ::basegfx::B3DRange &rContentRange) const
double toRadians(Degree10 x)
tools::Rectangle m_aOutRect
Definition: svdobj.hxx:872
B2DPolyPolygon createB2DPolyPolygonFromB3DPolyPolygon(const B3DPolyPolygon &rCandidate, const B3DHomMatrix &rMat)
virtual bool IsBreakObjPossible() override
Definition: scene3d.cxx:669
const basegfx::B3DHomMatrix & GetTransform() const
Definition: obj3d.hxx:112
static void Free(SdrObject *&_rpObject)
Definition: svdobj.cxx:473
virtual SdrObjList * GetSubList() const override
Definition: scene3d.cxx:861
virtual sdr::properties::BaseProperties & GetProperties() const
Definition: svdobj.cxx:210
virtual void InsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE)
Definition: svdpage.cxx:338
virtual const tools::Rectangle & GetSnapRect() const override
Definition: svdoattr.cxx:49
Center
All geometrical data of an arbitrary object for use in undo/redo.
Definition: svdobj.hxx:172
virtual bool BckCreate(SdrDragStat &rStat) override
Definition: scene3d.cxx:721
SdrObjKind
Definition: svdobjkind.hxx:24
double GetDistance() const
Definition: scene3d.hxx:107
sdr::contact::ViewContact & GetViewContact() const
Definition: svdobj.cxx:251
void SetAllSceneRectsDirty()
Definition: scene3d.cxx:472
ProjectionType GetPerspective() const
Definition: scene3d.hxx:103
basegfx::B3DHomMatrix maTransformation
Definition: obj3d.hxx:72
virtual SdrObject * getSdrObjectFromSdrObjList() const override
Definition: scene3d.cxx:250
std::unique_ptr< Imp3DDepthRemapper > mp3DDepthRemapper
Definition: scene3d.hxx:66
bool IsMore() const
Definition: svditer.hxx:62
SdrPage * getSdrPageFromSdrObject() const
Definition: svdobj.cxx:269
virtual void StructureChanged()
Definition: obj3d.cxx:261
virtual void NbcSetTransform(const basegfx::B3DHomMatrix &rMatrix) override
Definition: scene3d.cxx:594
virtual bool IsBreakObjPossible()
Definition: obj3d.cxx:100
void SetCamera(const Camera3D &rNewCamera)
Definition: scene3d.cxx:347
void ImpCleanup3DDepthMapper()
Definition: scene3d.cxx:273
double GetFocalLength() const
Definition: scene3d.hxx:111
void SetOrtho4Possible(bool bOn=true)
Definition: svddrag.hxx:136
void removeAllNonSelectedObjects()
Definition: scene3d.cxx:403
void SetDefaultAttributes()
Definition: scene3d.cxx:212
void TakeCreateRect(tools::Rectangle &rRect) const
Definition: svddrag.cxx:115
virtual void SetSelected(bool bNew) override
Definition: scene3d.cxx:730
tools::Rectangle maSnapRect
Definition: svdoattr.hxx:41
virtual void NbcResize(const Point &rRef, const Fraction &rXFact, const Fraction &rYFact) override
Definition: scene3d.cxx:336
virtual bool EndCreate(SdrDragStat &rStat, SdrCreateCmd eCmd) override
Definition: scene3d.cxx:711
virtual void NbcSetTransform(const basegfx::B3DHomMatrix &rMatrix)
Definition: obj3d.cxx:360
void RotateScene(const Point &rRef, double sn, double cs)
Definition: scene3d.cxx:528
const basegfx::B3DPoint & GetViewPoint()
Definition: viewpt3d2.cxx:50
Point BottomRight() const
E3dScene(SdrModel &rSdrModel)
Definition: scene3d.cxx:170
void ResizeRect(tools::Rectangle &rRect, const Point &rRef, const Fraction &rxFact, const Fraction &ryFact)
Definition: svdtrans.cxx:38
E3dScene * getParentE3dSceneFromE3dObject() const
Definition: obj3d.cxx:272
OUString SvxResId(std::string_view aId)
Definition: dialmgr.cxx:25
sal_uInt32 RemapOrdNum(sal_uInt32 nOrdNum) const
Definition: scene3d.cxx:278
virtual E3dScene * CloneSdrObject(SdrModel &rTargetModel) const override
Definition: scene3d.cxx:447
uno_Any a
OUString sName
virtual ~E3dScene() override
Definition: scene3d.cxx:240
void expand(const B3DTuple &rTuple)
sal_Int32 GetPointCount() const
Definition: svddrag.hxx:101
void SetFocalLength(double fLen)
Definition: camera3d.cxx:172
void transform(const basegfx::B2DHomMatrix &rMatrix)
sal_uInt32 GetOrdNum() const
The order number (aka ZOrder, aka z-index) determines whether a SdrObject is located above or below a...
Definition: svdobj.cxx:902
virtual void handlePageChange(SdrPage *pOldPage, SdrPage *pNewPage) override
Definition: scene3d.cxx:838
virtual void NbcMove(const Size &rSize) override
The methods Move, Resize, Rotate, Mirror, Shear, SetSnapRect and SetLogicRect call the corresponding ...
Definition: scene3d.cxx:329
const basegfx::B3DRange & GetBoundVolume() const
Definition: obj3d.cxx:317
virtual void SaveGeoData(SdrObjGeoData &rGeo) const override
Definition: scene3d.cxx:505
virtual SdrObject * NbcRemoveObject(size_t nObjNum)
remove from list without delete
Definition: svdpage.cxx:377
Abstract DrawObject.
Definition: svdobj.hxx:258
virtual void ActionChanged()
virtual basegfx::B3DRange RecalcBoundVolume() const override
Definition: scene3d.cxx:866
virtual SdrObject * RemoveObject(size_t nObjNum)
Definition: svdpage.cxx:416
virtual void RestoreGeoData(const SdrObjGeoData &rGeo) override
Definition: scene3d.cxx:512
OUString GetName() const
Definition: svdobj.cxx:804
virtual void SetRectsDirty(bool bNotMyself=false, bool bRecursive=true) override
Definition: scene3d.cxx:806
BASEGFX_DLLPUBLIC void transform(const B3DHomMatrix &rMatrix)
constexpr Point TopLeft() const
virtual SdrLayerID GetLayer() const
Definition: svdobj.cxx:680
virtual SdrObject * NbcRemoveObject(size_t nObjNum) override
remove from list without delete
Definition: scene3d.cxx:784
Imp3DDepthRemapper(E3dScene const &rScene)
Definition: scene3d.cxx:110
virtual void SetTransform(const basegfx::B3DHomMatrix &rMatrix)
Definition: obj3d.cxx:371
SdrObject * Next()
Definition: svditer.hxx:63
virtual void SetTransform(const basegfx::B3DHomMatrix &rMatrix) override
Definition: scene3d.cxx:603
void SetActionRect(const tools::Rectangle &rR)
Definition: svddrag.hxx:167
virtual bool BegCreate(SdrDragStat &rStat) override
Every object must be able to create itself interactively.
Definition: scene3d.cxx:689
const basegfx::B3DPoint & GetPosition() const
Definition: camera3d.hxx:51
const basegfx::B2DHomMatrix & getObjectTransformation() const
bool operator<(const Subset &rLHS, const Subset &rRHS)
Definition: ucsubset.hxx:50
virtual void NbcSetSnapRect(const tools::Rectangle &rRect)
Definition: svdobj.cxx:1674
virtual void InsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE) override
Definition: scene3d.cxx:765
tools::Rectangle & Union(const tools::Rectangle &rRect)
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Detects when a stylesheet is changed.
Definition: svdoattr.cxx:61
void RebuildLists()
Definition: scene3d.cxx:484
const basegfx::B3DPoint & GetVRP() const
Definition: viewpt3d.hxx:77
virtual void RecalcSnapRect() override
Snap is not done on the BoundRect but if possible on logic coordinates (i.e.
Definition: scene3d.cxx:640
virtual SdrPage * getSdrPageFromSdrObjList() const override
Definition: scene3d.cxx:245
virtual void NbcRotate(const Point &rRef, Degree100 nAngle, double sn, double cs) override
Definition: scene3d.cxx:612
void SetProjection(ProjectionType ePrj)
Definition: viewpt3d.hxx:80
OUString aName
virtual bool MovCreate(SdrDragStat &rStat) override
Definition: scene3d.cxx:699
const Point & GetNow() const
Definition: svddrag.hxx:105
virtual void SetRectsDirty(bool bNotMyself=false, bool bRecursive=true)
Definition: svdobj.cxx:512
void setHeight(tools::Long nHeight)
Helper for 3d object changes affecting 2d geometry.
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Detects when a stylesheet is changed.
Definition: scene3d.cxx:522
sal_uInt32 RemapOrdNum(sal_uInt32 nOrdNum) const
Definition: scene3d.cxx:143
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
Definition: scene3d.cxx:156
void Move(tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta)
virtual void BrkCreate(SdrDragStat &rStat) override
Definition: scene3d.cxx:726
void rotate(double fAngleX, double fAngleY, double fAngleZ)
bool m_bSnapRectDirty
Definition: svdobj.hxx:879
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Definition: svdpage.hxx:365
virtual void SetSelected(bool bNew)
Definition: obj3d.cxx:91
virtual void NbcInsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE) override
Definition: scene3d.cxx:746
double mfMinimalDepth
SdrCreateCmd
Definition: svdtypes.hxx:26
void SetPosition(const basegfx::B3DPoint &rNewPos)
Definition: camera3d.cxx:48
const basegfx::B3DVector & GetVUV() const
Definition: viewpt3d.hxx:78
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
Definition: scene3d.cxx:164
basegfx::B3DPolyPolygon CreateWireframe() const
Definition: obj3d.cxx:382
virtual E3dScene * getRootE3dSceneFromE3dObject() const override
Definition: scene3d.cxx:391
void InvalidateBoundVolume()
Definition: obj3d.cxx:327
virtual void RecalcSnapRect() override
Snap is not done on the BoundRect but if possible on logic coordinates (i.e.
Definition: obj3d.cxx:254
B3dCamera & GetCameraSet()
Definition: scene3d.hxx:147
virtual basegfx::B2DPolyPolygon TakeXorPoly() const override
The Xor-Polygon is required by the View to drag the object.
Definition: scene3d.cxx:260
virtual void NbcSetSnapRect(const tools::Rectangle &rRect) override
Definition: scene3d.cxx:319
void ResumeReportingDirtyRects()
Definition: scene3d.cxx:462
virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat &rDrag) const override
Polygon dragged by the user when creating the object.
Definition: scene3d.cxx:684
void NbcRotateGluePoints(const Point &rRef, Degree100 nAngle, double sn, double cs)
Definition: svdobj.cxx:2317
virtual void NbcSetLayer(SdrLayerID nLayer)
Definition: svdobj.cxx:697