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