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