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  OUStringBuffer sName(SvxResId(STR_ObjNameSingulScene3d));
578 
579  OUString aName(GetName());
580  if (!aName.isEmpty())
581  {
582  sName.append(' ');
583  sName.append('\'');
584  sName.append(aName);
585  sName.append('\'');
586  }
587  return sName.makeStringAndClear();
588 }
589 
591 {
592  return SvxResId(STR_ObjNamePluralScene3d);
593 }
594 
595 // The NbcRotate routine overrides the one of the SdrObject. The idea is
596 // to be able to rotate the scene relative to the position of the scene
597 // and then the objects in the scene
598 
600 {
601  if(maTransformation != rMatrix)
602  {
603  // call parent
605  }
606 }
607 
609 {
610  if(rMatrix != maTransformation)
611  {
612  // call parent
613  E3dObject::SetTransform(rMatrix);
614  }
615 }
616 
617 void E3dScene::NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs)
618 {
619  // So currently the glue points are defined relative to the scene aOutRect.
620  // Before turning the glue points are defined relative to the page. They
621  // take no part in the rotation of the scene. To ensure this, there is the
622  // SetGlueReallyAbsolute(sal_True);
623 
624  // So that was the scene, now the objects used in the scene
625  // 3D objects, if there is only one it can still have multiple surfaces but
626  // the surfaces do not have to be connected. This allows you to access child
627  // objects. So going through the entire list and rotate around the Z axis
628  // through the enter of aOutRect's (Steiner's theorem), so RotateZ
629 
630  RotateScene (rRef, sn, cs); // Rotates the scene
631  double fAngleInRad = toRadians(nAngle);
632 
633  basegfx::B3DHomMatrix aRotation;
634  aRotation.rotate(0.0, 0.0, fAngleInRad);
635  NbcSetTransform(aRotation * GetTransform());
636 
637  SetRectsDirty(); // This forces a recalculation of all BoundRects
638  NbcRotateGluePoints(rRef,nAngle,sn,cs); // Rotate the glue points (who still
639  // have coordinates relative to the
640  // original page)
641  SetGlueReallyAbsolute(false); // from now they are again relative to BoundRect (that is defined as aOutRect)
642  SetRectsDirty();
643 }
644 
646 {
648 
649  if(pScene == this)
650  {
651  // The Scene is used as a 2D-Object, take the SnapRect from the
652  // 2D Display settings
653  maSnapRect = pScene->aCamera.GetDeviceWindow();
654  }
655  else
656  {
657  // The Scene itself is a member of another scene, get the SnapRect
658  // as a composite object
659  // call parent
661 
662  for(size_t a = 0; a < GetObjCount(); ++a)
663  {
664  E3dObject* pCandidate(dynamic_cast< E3dObject* >(GetObj(a)));
665 
666  if(pCandidate)
667  {
668  maSnapRect.Union(pCandidate->GetSnapRect());
669  }
670  }
671  }
672 }
673 
675 {
676  // Break scene, if all members are able to break
678 
679  while ( a3DIterator.IsMore() )
680  {
681  E3dObject* pObj = static_cast<E3dObject*>(a3DIterator.Next());
682  if(!pObj->IsBreakObjPossible())
683  return false;
684  }
685 
686  return true;
687 }
688 
690 {
691  return TakeXorPoly();
692 }
693 
695 {
696  rStat.SetOrtho4Possible();
697  tools::Rectangle aRect1(rStat.GetStart(), rStat.GetNow());
698  aRect1.Justify();
699  rStat.SetActionRect(aRect1);
700  NbcSetSnapRect(aRect1);
701  return true;
702 }
703 
705 {
706  tools::Rectangle aRect1;
707  rStat.TakeCreateRect(aRect1);
708  aRect1.Justify();
709  rStat.SetActionRect(aRect1);
710  NbcSetSnapRect(aRect1);
712  m_bSnapRectDirty=true;
713  return true;
714 }
715 
717 {
718  tools::Rectangle aRect1;
719  rStat.TakeCreateRect(aRect1);
720  aRect1.Justify();
721  NbcSetSnapRect(aRect1);
722  SetRectsDirty();
723  return (eCmd==SdrCreateCmd::ForceEnd || rStat.GetPointCount()>=2);
724 }
725 
727 {
728  return false;
729 }
730 
732 {
733 }
734 
735 void E3dScene::SetSelected(bool bNew)
736 {
737  // call parent
739 
740  for(size_t a(0); a < GetObjCount(); a++)
741  {
742  E3dObject* pCandidate(dynamic_cast< E3dObject* >(GetObj(a)));
743 
744  if(pCandidate)
745  {
746  pCandidate->SetSelected(bNew);
747  }
748  }
749 }
750 
751 void E3dScene::NbcInsertObject(SdrObject* pObj, size_t nPos)
752 {
753  // Is it even a 3D object?
754  if(nullptr != dynamic_cast< const E3dObject* >(pObj))
755  {
756  // Normal 3D object, insert means call parent
757  SdrObjList::NbcInsertObject(pObj, nPos);
758 
759  // local needed stuff
762  }
763  else
764  {
765  // No 3D object, inserted a page in place in a scene ...
767  }
768 }
769 
770 void E3dScene::InsertObject(SdrObject* pObj, size_t nPos)
771 {
772  // Is it even a 3D object?
773  if(nullptr != dynamic_cast< const E3dObject* >(pObj))
774  {
775  // call parent
776  SdrObjList::InsertObject(pObj, nPos);
777 
778  // local needed stuff
781  }
782  else
783  {
784  // No 3D object, inserted a page in place in a scene ...
786  }
787 }
788 
790 {
791  // call parent
792  SdrObject* pRetval = SdrObjList::NbcRemoveObject(nObjNum);
793 
796 
797  return pRetval;
798 }
799 
801 {
802  // call parent
803  SdrObject* pRetval(SdrObjList::RemoveObject(nObjNum));
804 
807 
808  return pRetval;
809 }
810 
811 void E3dScene::SetRectsDirty(bool bNotMyself, bool bRecursive)
812 {
813  // call parent
814  E3dObject::SetRectsDirty(bNotMyself, bRecursive);
815 
816  for(size_t a = 0; a < GetObjCount(); ++a)
817  {
818  E3dObject* pCandidate = dynamic_cast< E3dObject* >(GetObj(a));
819 
820  if(pCandidate)
821  {
822  pCandidate->SetRectsDirty(bNotMyself, false);
823  }
824  }
825 }
826 
828 {
829  // call parent
830  E3dObject::NbcSetLayer(nLayer);
831 
832  for(size_t a = 0; a < GetObjCount(); ++a)
833  {
834  E3dObject* pCandidate = dynamic_cast< E3dObject* >(GetObj(a));
835 
836  if(pCandidate)
837  {
838  pCandidate->NbcSetLayer(nLayer);
839  }
840  }
841 }
842 
843 void E3dScene::handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage)
844 {
845  if(pOldPage == pNewPage)
846  return;
847 
848  // call parent
849  E3dObject::handlePageChange(pOldPage, pNewPage);
850 
851  for(size_t a(0); a < GetObjCount(); a++)
852  {
853  E3dObject* pCandidate = dynamic_cast< E3dObject* >(GetObj(a));
854 
855  if(pCandidate)
856  {
857  pCandidate->handlePageChange(pOldPage, pNewPage);
858  }
859  else
860  {
861  OSL_ENSURE(false, "E3dScene::handlePageChange invalid object list (!)");
862  }
863  }
864 }
865 
867 {
868  return const_cast< E3dScene* >(this);
869 }
870 
872 {
873  basegfx::B3DRange aRetval;
874  const size_t nObjCnt(GetObjCount());
875 
876  for(size_t a = 0; a < nObjCnt; ++a)
877  {
878  const E3dObject* p3DObject = dynamic_cast< const E3dObject* >(GetObj(a));
879 
880  if(p3DObject)
881  {
882  basegfx::B3DRange aLocalRange(p3DObject->GetBoundVolume());
883  aLocalRange.transform(p3DObject->GetTransform());
884  aRetval.expand(aLocalRange);
885  }
886  }
887 
888  return aRetval;
889 }
890 
892 {
893  // call parent
895 
896  for(size_t a = 0; a < GetObjCount(); ++a)
897  {
898  E3dObject* pCandidate = dynamic_cast< E3dObject* >(GetObj(a));
899 
900  if(pCandidate)
901  {
902  pCandidate->SetTransformChanged();
903  }
904  }
905 }
906 
907 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Point TopLeft() const
virtual OUString TakeObjNameSingul() const override
Definition: scene3d.cxx:575
virtual SdrObject * RemoveObject(size_t nObjNum) override
Definition: scene3d.cxx:800
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:827
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:523
const Point & GetStart() const
Definition: svddrag.hxx:92
virtual void SetTransformChanged() override
Definition: scene3d.cxx:891
virtual void RestoreGeoData(const SdrObjGeoData &rGeo) override
Definition: obj3d.cxx:428
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:65
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:590
virtual void SaveGeoData(SdrObjGeoData &rGeo) const override
Definition: obj3d.cxx:420
SdrObject * GetObj(size_t nNum) const
Definition: svdpage.cxx:770
size_t GetObjCount() const
Definition: svdpage.cxx:764
virtual void SetBoundRectDirty()
Definition: svdobj.cxx:313
B3dCamera aCameraSet
Definition: scene3d.hxx:64
void SetGlueReallyAbsolute(bool bOn)
Definition: svdobj.cxx:2283
bool mbSkipSettingDirty
Definition: scene3d.hxx:72
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:674
const basegfx::B3DHomMatrix & GetTransform() const
Definition: obj3d.hxx:112
static void Free(SdrObject *&_rpObject)
Definition: svdobj.cxx:470
virtual SdrObjList * GetSubList() const override
Definition: scene3d.cxx:866
virtual sdr::properties::BaseProperties & GetProperties() const
Definition: svdobj.cxx:207
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:726
SdrObjKind
Definition: svdobjkind.hxx:24
double GetDistance() const
Definition: scene3d.hxx:108
sdr::contact::ViewContact & GetViewContact() const
Definition: svdobj.cxx:248
void SetAllSceneRectsDirty()
Definition: scene3d.cxx:472
ProjectionType GetPerspective() const
Definition: scene3d.hxx:104
basegfx::B3DHomMatrix maTransformation
Definition: obj3d.hxx:72
virtual SdrObject * getSdrObjectFromSdrObjList() const override
Definition: scene3d.cxx:250
std::unique_ptr< Imp3DDepthRemapper > mp3DDepthRemapper
Definition: scene3d.hxx:67
bool IsMore() const
Definition: svditer.hxx:62
SdrPage * getSdrPageFromSdrObject() const
Definition: svdobj.cxx:266
OUString SvxResId(const char *pId)
Definition: dialmgr.cxx:25
virtual void StructureChanged()
Definition: obj3d.cxx:261
virtual void NbcSetTransform(const basegfx::B3DHomMatrix &rMatrix) override
Definition: scene3d.cxx:599
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:112
void SetOrtho4Possible(bool bOn=true)
Definition: svddrag.hxx:126
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:735
tools::Rectangle maSnapRect
Definition: svdoattr.hxx:42
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:716
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
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: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:873
virtual void handlePageChange(SdrPage *pOldPage, SdrPage *pNewPage) override
Definition: scene3d.cxx:843
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:871
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:775
virtual void SetRectsDirty(bool bNotMyself=false, bool bRecursive=true) override
Definition: scene3d.cxx:811
BASEGFX_DLLPUBLIC void transform(const B3DHomMatrix &rMatrix)
virtual SdrLayerID GetLayer() const
Definition: svdobj.cxx:651
virtual SdrObject * NbcRemoveObject(size_t nObjNum) override
remove from list without delete
Definition: scene3d.cxx:789
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:608
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:694
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:1650
virtual void InsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE) override
Definition: scene3d.cxx:770
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:645
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:617
void SetProjection(ProjectionType ePrj)
Definition: viewpt3d.hxx:80
OUString aName
virtual bool MovCreate(SdrDragStat &rStat) override
Definition: scene3d.cxx:704
const Point & GetNow() const
Definition: svddrag.hxx:95
virtual void SetRectsDirty(bool bNotMyself=false, bool bRecursive=true)
Definition: svdobj.cxx:509
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:731
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:751
double mfMinimalDepth
SdrCreateCmd
Definition: svdtypes.hxx:27
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:148
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:689
void NbcRotateGluePoints(const Point &rRef, Degree100 nAngle, double sn, double cs)
Definition: svdobj.cxx:2293
virtual void NbcSetLayer(SdrLayerID nLayer)
Definition: svdobj.cxx:668