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