1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <sal/config.h>
24 #include <svx/strings.hrc>
25 #include <svx/dialmgr.hxx>
26 #include <svx/svditer.hxx>
28 #include <svx/svdobjkind.hxx>
29 #include <svx/svdpage.hxx>
30 #include <svx/scene3d.hxx>
31 #include <svx/svdtrans.hxx>
32 #include <sdr/properties/e3dsceneproperties.hxx>
33 #include <svx/sdr/contact/viewcontactofe3dscene.hxx>
34 #include <svx/svddrag.hxx>
35 #include "helperminimaldepth3d.hxx"
37 #include <drawinglayer/geometry/viewinformation3d.hxx>
38 #include <basegfx/polygon/b2dpolypolygontools.hxx>
39 #include <svx/e3dsceneupdater.hxx>
40 #include <svx/svdmodel.hxx>
47 double mfMinimalDepth
;
53 ImpRemap3DDepth(sal_uInt32 nOrdNum
, double fMinimalDepth
);
54 explicit ImpRemap3DDepth(sal_uInt32 nOrdNum
);
57 bool operator<(const ImpRemap3DDepth
& rComp
) const;
59 sal_uInt32
GetOrdNum() const { return mnOrdNum
; }
60 bool IsScene() const { return mbIsScene
; }
65 ImpRemap3DDepth::ImpRemap3DDepth(sal_uInt32 nOrdNum
, double fMinimalDepth
)
67 mfMinimalDepth(fMinimalDepth
),
72 ImpRemap3DDepth::ImpRemap3DDepth(sal_uInt32 nOrdNum
)
79 bool ImpRemap3DDepth::operator<(const ImpRemap3DDepth
& rComp
) const
93 return mfMinimalDepth
< rComp
.mfMinimalDepth
;
98 class Imp3DDepthRemapper
100 std::vector
< ImpRemap3DDepth
> maVector
;
103 explicit Imp3DDepthRemapper(E3dScene
const & rScene
);
105 sal_uInt32
RemapOrdNum(sal_uInt32 nOrdNum
) const;
108 Imp3DDepthRemapper::Imp3DDepthRemapper(E3dScene
const & rScene
)
110 // only called when rScene.GetSubList() and nObjCount > 1
111 SdrObjList
* pList
= rScene
.GetSubList();
112 const size_t nObjCount(pList
->GetObjCount());
114 for(size_t a
= 0; a
< nObjCount
; ++a
)
116 SdrObject
* pCandidate
= pList
->GetObj(a
);
120 if(auto pCompoundObj
= dynamic_cast< const E3dCompoundObject
*>(pCandidate
))
122 // single 3d object, calc depth
123 const double fMinimalDepth(getMinimalDepthInViewCoordinates(*pCompoundObj
));
124 ImpRemap3DDepth
aEntry(a
, fMinimalDepth
);
125 maVector
.push_back(aEntry
);
129 // scene, use standard entry for scene
130 ImpRemap3DDepth
aEntry(a
);
131 maVector
.push_back(aEntry
);
136 // now, we need to sort the maVector by its members minimal depth. The
137 // smaller, the nearer to the viewer.
138 ::std::sort(maVector
.begin(), maVector
.end());
141 sal_uInt32
Imp3DDepthRemapper::RemapOrdNum(sal_uInt32 nOrdNum
) const
143 if(nOrdNum
< maVector
.size())
145 nOrdNum
= maVector
[(maVector
.size() - 1) - nOrdNum
].GetOrdNum();
152 // BaseProperties section
154 std::unique_ptr
<sdr::properties::BaseProperties
> E3dScene::CreateObjectSpecificProperties()
156 return std::make_unique
<sdr::properties::E3dSceneProperties
>(*this);
160 // DrawContact section
162 std::unique_ptr
<sdr::contact::ViewContact
> E3dScene::CreateObjectSpecificViewContact()
164 return std::make_unique
<sdr::contact::ViewContactOfE3dScene
>(*this);
168 E3dScene::E3dScene(SdrModel
& rSdrModel
)
169 : E3dObject(rSdrModel
),
170 aCamera(basegfx::B3DPoint(0.0, 0.0, 4.0), basegfx::B3DPoint()),
171 bDrawOnlySelected(false),
172 mbSkipSettingDirty(false)
175 SetDefaultAttributes();
178 E3dScene::E3dScene(SdrModel
& rSdrModel
, E3dScene
const & rSource
)
179 : E3dObject(rSdrModel
, rSource
),
180 aCamera(basegfx::B3DPoint(0.0, 0.0, 4.0), basegfx::B3DPoint()),
181 bDrawOnlySelected(false),
182 mbSkipSettingDirty(false)
185 SetDefaultAttributes();
187 // copy child SdrObjects
188 if (rSource
.GetSubList())
190 CopyObjects(*rSource
.GetSubList());
192 // tdf#116979: needed here, we need bSnapRectDirty to be true
193 // which it is after using SdrObject::operator= (see above),
194 // but set to false again using CopyObjects
195 SetBoundAndSnapRectsDirty();
199 aCamera
= rSource
.aCamera
;
200 aCameraSet
= rSource
.aCameraSet
;
201 static_cast<sdr::properties::E3dSceneProperties
&>(GetProperties()).SetSceneItemsFromCamera();
202 InvalidateBoundVolume();
204 ImpCleanup3DDepthMapper();
205 GetViewContact().ActionChanged();
208 void E3dScene::SetDefaultAttributes()
210 // For WIN95/NT turn off the FP-Exceptions
212 _control87( _MCW_EM
, _MCW_EM
);
216 aCamera
.SetViewWindow(-2, -2, 4, 4);
217 aCameraSet
.SetDeviceRectangle(-2, 2, -2, 2);
218 aCamera
.SetDeviceWindow(tools::Rectangle(0, 0, 10, 10));
219 tools::Rectangle
aRect(0, 0, 10, 10);
220 aCameraSet
.SetViewportRectangle(aRect
);
222 // set defaults for Camera from ItemPool
223 aCamera
.SetProjection(GetPerspective());
224 basegfx::B3DPoint
aActualPosition(aCamera
.GetPosition());
225 double fNew
= GetDistance();
227 if(fabs(fNew
- aActualPosition
.getZ()) > 1.0)
229 aCamera
.SetPosition( basegfx::B3DPoint( aActualPosition
.getX(), aActualPosition
.getY(), fNew
) );
232 fNew
= GetFocalLength() / 100.0;
233 aCamera
.SetFocalLength(fNew
);
236 E3dScene::~E3dScene()
238 ImpCleanup3DDepthMapper();
241 SdrPage
* E3dScene::getSdrPageFromSdrObjList() const
243 return getSdrPageFromSdrObject();
246 SdrObject
* E3dScene::getSdrObjectFromSdrObjList() const
248 return const_cast< E3dScene
* >(this);
251 SdrObjList
* E3dScene::getChildrenOfSdrObject() const
253 return const_cast< E3dScene
* >(this);
256 basegfx::B2DPolyPolygon
E3dScene::TakeXorPoly() const
258 const sdr::contact::ViewContactOfE3dScene
& rVCScene
= static_cast< sdr::contact::ViewContactOfE3dScene
& >(GetViewContact());
259 const drawinglayer::geometry::ViewInformation3D
& aViewInfo3D(rVCScene
.getViewInformation3D());
260 const basegfx::B3DPolyPolygon
aCubePolyPolygon(CreateWireframe());
262 basegfx::B2DPolyPolygon
aRetval(basegfx::utils::createB2DPolyPolygonFromB3DPolyPolygon(aCubePolyPolygon
,
263 aViewInfo3D
.getObjectToView()));
264 aRetval
.transform(rVCScene
.getObjectTransformation());
269 void E3dScene::ImpCleanup3DDepthMapper()
271 mp3DDepthRemapper
.reset();
274 sal_uInt32
E3dScene::RemapOrdNum(sal_uInt32 nNewOrdNum
) const
276 if(!mp3DDepthRemapper
)
278 const size_t nObjCount(GetSubList() ? GetSubList()->GetObjCount() : 0);
282 mp3DDepthRemapper
.reset(new Imp3DDepthRemapper(*this));
286 if(mp3DDepthRemapper
)
288 return mp3DDepthRemapper
->RemapOrdNum(nNewOrdNum
);
294 SdrObjKind
E3dScene::GetObjIdentifier() const
296 return SdrObjKind::E3D_Scene
;
299 void E3dScene::SetBoundRectDirty()
301 E3dScene
* pScene(getRootE3dSceneFromE3dObject());
305 // avoid resetting aOutRect which in case of a 3D scene used as 2d object
306 // is model data,not re-creatable view data
310 // if not the outmost scene it is used as group in 3d, call parent
311 E3dObject::SetBoundRectDirty();
315 void E3dScene::NbcSetSnapRect(const tools::Rectangle
& rRect
)
317 SetBoundAndSnapRectsDirty();
318 E3dObject::NbcSetSnapRect(rRect
);
319 aCamera
.SetDeviceWindow(rRect
);
320 aCameraSet
.SetViewportRectangle(rRect
);
322 ImpCleanup3DDepthMapper();
325 void E3dScene::NbcMove(const Size
& rSize
)
327 tools::Rectangle aNewSnapRect
= GetSnapRect();
328 aNewSnapRect
.Move(rSize
);
329 NbcSetSnapRect(aNewSnapRect
);
332 void E3dScene::NbcResize(const Point
& rRef
, const Fraction
& rXFact
,
333 const Fraction
& rYFact
)
335 tools::Rectangle aNewSnapRect
= GetSnapRect();
336 ResizeRect(aNewSnapRect
, rRef
, rXFact
, rYFact
);
337 NbcSetSnapRect(aNewSnapRect
);
340 // Set new camera, and thus mark the scene and if possible the bound volume
343 void E3dScene::SetCamera(const Camera3D
& rNewCamera
)
345 aCamera
= rNewCamera
;
346 static_cast<sdr::properties::E3dSceneProperties
&>(GetProperties()).SetSceneItemsFromCamera();
348 SetBoundAndSnapRectsDirty();
351 GetCameraSet().SetRatio(0.0);
353 // Set Imaging geometry
354 basegfx::B3DPoint
aVRP(aCamera
.GetViewPoint());
355 basegfx::B3DVector
aVPN(aVRP
- aCamera
.GetVRP());
356 basegfx::B3DVector
aVUV(aCamera
.GetVUV());
358 // use SetViewportValues() to set VRP, VPN and VUV as vectors, too.
359 // Else these values would not be exported/imported correctly.
360 GetCameraSet().SetViewportValues(aVRP
, aVPN
, aVUV
);
363 GetCameraSet().SetPerspective(aCamera
.GetProjection() == ProjectionType::Perspective
);
364 GetCameraSet().SetViewportRectangle(aCamera
.GetDeviceWindow());
366 ImpCleanup3DDepthMapper();
369 // Inform parent of changes of a child
371 void E3dScene::StructureChanged()
373 E3dObject::StructureChanged();
375 E3dScene
* pScene(getRootE3dSceneFromE3dObject());
377 if(nullptr != pScene
&& !pScene
->mbSkipSettingDirty
)
379 SetBoundAndSnapRectsDirty();
382 ImpCleanup3DDepthMapper();
385 // Determine the overall scene object
387 E3dScene
* E3dScene::getRootE3dSceneFromE3dObject() const
389 E3dScene
* pParent(getParentE3dSceneFromE3dObject());
391 if(nullptr != pParent
)
393 return pParent
->getRootE3dSceneFromE3dObject();
396 return const_cast< E3dScene
* >(this);
399 void E3dScene::removeAllNonSelectedObjects()
401 E3DModifySceneSnapRectUpdater
aUpdater(this);
403 for(size_t a
= 0; a
< GetObjCount(); ++a
)
405 SdrObject
* pObj
= GetObj(a
);
409 bool bRemoveObject(false);
411 if(E3dScene
* pScene
= DynCastE3dScene(pObj
))
413 // iterate over this sub-scene
414 pScene
->removeAllNonSelectedObjects();
416 // check object count. Empty scenes can be deleted
417 const size_t nObjCount(pScene
->GetSubList() ? pScene
->GetSubList()->GetObjCount() : 0);
421 // all objects removed, scene can be removed, too
422 bRemoveObject
= true;
425 else if(auto pCompound
= dynamic_cast<E3dCompoundObject
*>(pObj
))
427 if(!pCompound
->GetSelected())
429 bRemoveObject
= true;
435 NbcRemoveObject(pObj
->GetOrdNum());
442 rtl::Reference
<SdrObject
> E3dScene::CloneSdrObject(SdrModel
& rTargetModel
) const
444 return new E3dScene(rTargetModel
, *this);
447 void E3dScene::SuspendReportingDirtyRects()
449 E3dScene
* pScene(getRootE3dSceneFromE3dObject());
451 if(nullptr != pScene
)
453 pScene
->mbSkipSettingDirty
= true;
457 void E3dScene::ResumeReportingDirtyRects()
459 E3dScene
* pScene(getRootE3dSceneFromE3dObject());
461 if(nullptr != pScene
)
463 pScene
->mbSkipSettingDirty
= false;
467 void E3dScene::SetAllSceneRectsDirty()
469 E3dScene
* pScene(getRootE3dSceneFromE3dObject());
471 if(nullptr != pScene
)
473 pScene
->SetBoundAndSnapRectsDirty();
477 // Rebuild Light- and label- object lists rebuild (after loading, allocation)
479 void E3dScene::RebuildLists()
482 const SdrLayerID
nCurrLayerID(GetLayer());
483 SdrObjListIter
a3DIterator(GetSubList(), SdrIterMode::Flat
);
485 // then examine all the objects in the scene
486 while(a3DIterator
.IsMore())
488 E3dObject
* p3DObj(static_cast< E3dObject
* >(a3DIterator
.Next()));
489 p3DObj
->NbcSetLayer(nCurrLayerID
);
492 ImpCleanup3DDepthMapper();
495 std::unique_ptr
<SdrObjGeoData
> E3dScene::NewGeoData() const
497 return std::make_unique
<E3DSceneGeoData
>();
500 void E3dScene::SaveGeoData(SdrObjGeoData
& rGeo
) const
502 E3dObject::SaveGeoData (rGeo
);
504 static_cast<E3DSceneGeoData
&>(rGeo
).aCamera
= aCamera
;
507 void E3dScene::RestoreGeoData(const SdrObjGeoData
& rGeo
)
509 // #i94832# removed E3DModifySceneSnapRectUpdater here.
510 // It should not be needed, is already part of E3dObject::RestoreGeoData
511 E3dObject::RestoreGeoData (rGeo
);
512 SetCamera (static_cast<const E3DSceneGeoData
&>(rGeo
).aCamera
);
515 // Something was changed in the style sheet, so change scene
517 void E3dScene::Notify(SfxBroadcaster
&rBC
, const SfxHint
&rHint
)
519 SetBoundAndSnapRectsDirty();
520 E3dObject::Notify(rBC
, rHint
);
523 void E3dScene::RotateScene (const Point
& rRef
, double sn
, double cs
)
527 auto const& rRectangle
= getOutRectangle();
528 Point Center
= rRectangle
.Center();
530 // Only the center is moved. The corners are moved by NbcMove. For the
531 // rotation a cartesian coordinate system is used in which the pivot
532 // point is the origin, and the y-axis increases upward, the X-axis to
533 // the right. This must be especially noted for the Y-values.
534 // (When considering a flat piece of paper the Y-axis pointing downwards
535 Center
.setX(Center
.X() - rRef
.X());
536 Center
.setY(rRef
.Y() - Center
.Y());
537 // A few special cases has to be dealt with first (n * 90 degrees n integer)
538 if (sn
==1.0 && cs
==0.0) { // 90deg
539 NewCenter
.setX( -Center
.Y() );
540 NewCenter
.setY( -Center
.X() );
541 } else if (sn
==0.0 && cs
==-1.0) { // 180deg
542 NewCenter
.setX( -Center
.X() );
543 NewCenter
.setY( -Center
.Y() );
544 } else if (sn
==-1.0 && cs
==0.0) { // 270deg
545 NewCenter
.setX( Center
.Y() );
546 NewCenter
.setY( -Center
.X() );
548 else // Here it is rotated to any angle in the mathematically
549 // positive direction!
550 { // xnew = x * cos(alpha) - y * sin(alpha)
551 // ynew = x * sin(alpha) + y * cos(alpha)
552 // Bottom Right is not rotated: the pages of aOutRect must
553 // remain parallel to the coordinate axes.
554 NewCenter
.setX( static_cast<tools::Long
>(Center
.X() * cs
- Center
.Y() * sn
) );
555 NewCenter
.setY( static_cast<tools::Long
>(Center
.X() * sn
+ Center
.Y() * cs
) );
559 Point DiffPoint
= NewCenter
- Center
;
560 Differenz
.setWidth( DiffPoint
.X() );
561 Differenz
.setHeight( -DiffPoint
.Y() ); // Note that the Y-axis is counted ad positive downward.
562 NbcMove (Differenz
); // Actually executes the coordinate transformation.
565 OUString
E3dScene::TakeObjNameSingul() const
567 OUString
sName(SvxResId(STR_ObjNameSingulScene3d
));
569 OUString
aName(GetName());
570 if (!aName
.isEmpty())
571 sName
+= " '" + aName
+ "'";
575 OUString
E3dScene::TakeObjNamePlural() const
577 return SvxResId(STR_ObjNamePluralScene3d
);
580 // The NbcRotate routine overrides the one of the SdrObject. The idea is
581 // to be able to rotate the scene relative to the position of the scene
582 // and then the objects in the scene
584 void E3dScene::NbcSetTransform(const basegfx::B3DHomMatrix
& rMatrix
)
586 if(maTransformation
!= rMatrix
)
589 E3dObject::NbcSetTransform(rMatrix
);
593 void E3dScene::SetTransform(const basegfx::B3DHomMatrix
& rMatrix
)
595 if(rMatrix
!= maTransformation
)
598 E3dObject::SetTransform(rMatrix
);
602 void E3dScene::NbcRotate(const Point
& rRef
, Degree100 nAngle
, double sn
, double cs
)
604 // So currently the gluepoints are defined relative to the scene aOutRect.
605 // Before turning the gluepoints are defined relative to the page. They
606 // take no part in the rotation of the scene. To ensure this, there is the
607 // SetGlueReallyAbsolute(sal_True);
609 // So that was the scene, now the objects used in the scene
610 // 3D objects, if there is only one it can still have multiple surfaces but
611 // the surfaces do not have to be connected. This allows you to access child
612 // objects. So going through the entire list and rotate around the Z axis
613 // through the enter of aOutRect's (Steiner's theorem), so RotateZ
615 RotateScene (rRef
, sn
, cs
); // Rotates the scene
616 double fAngleInRad
= toRadians(nAngle
);
618 basegfx::B3DHomMatrix aRotation
;
619 aRotation
.rotate(0.0, 0.0, fAngleInRad
);
620 NbcSetTransform(aRotation
* GetTransform());
622 SetBoundAndSnapRectsDirty(); // This forces a recalculation of all BoundRects
623 NbcRotateGluePoints(rRef
,nAngle
,sn
,cs
); // Rotate the gluepoints (who still
624 // have coordinates relative to the
626 SetGlueReallyAbsolute(false); // from now they are again relative to BoundRect (that is defined as aOutRect)
627 SetBoundAndSnapRectsDirty();
630 void E3dScene::RecalcSnapRect()
632 E3dScene
* pScene(getRootE3dSceneFromE3dObject());
636 // The Scene is used as a 2D-Object, take the SnapRect from the
637 // 2D Display settings
638 maSnapRect
= pScene
->aCamera
.GetDeviceWindow();
642 // The Scene itself is a member of another scene, get the SnapRect
643 // as a composite object
645 E3dObject::RecalcSnapRect();
647 for(size_t a
= 0; a
< GetObjCount(); ++a
)
649 E3dObject
* pCandidate(DynCastE3dObject(GetObj(a
)));
653 maSnapRect
.Union(pCandidate
->GetSnapRect());
659 bool E3dScene::IsBreakObjPossible()
661 // Break scene, if all members are able to break
662 SdrObjListIter
a3DIterator(GetSubList(), SdrIterMode::DeepWithGroups
);
664 while ( a3DIterator
.IsMore() )
666 E3dObject
* pObj
= static_cast<E3dObject
*>(a3DIterator
.Next());
667 if(!pObj
->IsBreakObjPossible())
674 basegfx::B2DPolyPolygon
E3dScene::TakeCreatePoly(const SdrDragStat
& /*rDrag*/) const
676 return TakeXorPoly();
679 bool E3dScene::BegCreate(SdrDragStat
& rStat
)
681 rStat
.SetOrtho4Possible();
682 tools::Rectangle
aRect1(rStat
.GetStart(), rStat
.GetNow());
684 rStat
.SetActionRect(aRect1
);
685 NbcSetSnapRect(aRect1
);
689 bool E3dScene::MovCreate(SdrDragStat
& rStat
)
691 tools::Rectangle aRect1
;
692 rStat
.TakeCreateRect(aRect1
);
694 rStat
.SetActionRect(aRect1
);
695 NbcSetSnapRect(aRect1
);
697 m_bSnapRectDirty
=true;
701 bool E3dScene::EndCreate(SdrDragStat
& rStat
, SdrCreateCmd eCmd
)
703 tools::Rectangle aRect1
;
704 rStat
.TakeCreateRect(aRect1
);
706 NbcSetSnapRect(aRect1
);
707 SetBoundAndSnapRectsDirty();
708 return (eCmd
==SdrCreateCmd::ForceEnd
|| rStat
.GetPointCount()>=2);
711 bool E3dScene::BckCreate(SdrDragStat
& /*rStat*/)
716 void E3dScene::BrkCreate(SdrDragStat
& /*rStat*/)
720 void E3dScene::SetSelected(bool bNew
)
723 E3dObject::SetSelected(bNew
);
725 for(size_t a(0); a
< GetObjCount(); a
++)
727 E3dObject
* pCandidate(DynCastE3dObject(GetObj(a
)));
731 pCandidate
->SetSelected(bNew
);
736 void E3dScene::NbcInsertObject(SdrObject
* pObj
, size_t nPos
)
738 // Is it even a 3D object?
739 if(DynCastE3dObject(pObj
))
741 // Normal 3D object, insert means call parent
742 SdrObjList::NbcInsertObject(pObj
, nPos
);
744 // local needed stuff
745 InvalidateBoundVolume();
750 // No 3D object, inserted a page in place in a scene ...
751 getSdrObjectFromSdrObjList()->getSdrPageFromSdrObject()->InsertObject(pObj
, nPos
);
755 void E3dScene::InsertObject(SdrObject
* pObj
, size_t nPos
)
757 // Is it even a 3D object?
758 if(DynCastE3dObject(pObj
))
761 SdrObjList::InsertObject(pObj
, nPos
);
763 // local needed stuff
764 InvalidateBoundVolume();
769 // No 3D object, inserted a page in place in a scene ...
770 getSdrObjectFromSdrObjList()->getSdrPageFromSdrObject()->InsertObject(pObj
, nPos
);
774 rtl::Reference
<SdrObject
> E3dScene::NbcRemoveObject(size_t nObjNum
)
777 rtl::Reference
<SdrObject
> pRetval
= SdrObjList::NbcRemoveObject(nObjNum
);
779 InvalidateBoundVolume();
785 rtl::Reference
<SdrObject
> E3dScene::RemoveObject(size_t nObjNum
)
788 rtl::Reference
<SdrObject
> pRetval(SdrObjList::RemoveObject(nObjNum
));
790 InvalidateBoundVolume();
796 void E3dScene::SetBoundAndSnapRectsDirty(bool bNotMyself
, bool bRecursive
)
799 E3dObject::SetBoundAndSnapRectsDirty(bNotMyself
, bRecursive
);
801 for(size_t a
= 0; a
< GetObjCount(); ++a
)
803 E3dObject
* pCandidate
= DynCastE3dObject(GetObj(a
));
807 pCandidate
->SetBoundAndSnapRectsDirty(bNotMyself
, false);
812 void E3dScene::NbcSetLayer(SdrLayerID nLayer
)
815 E3dObject::NbcSetLayer(nLayer
);
817 for(size_t a
= 0; a
< GetObjCount(); ++a
)
819 E3dObject
* pCandidate
= DynCastE3dObject(GetObj(a
));
823 pCandidate
->NbcSetLayer(nLayer
);
828 void E3dScene::handlePageChange(SdrPage
* pOldPage
, SdrPage
* pNewPage
)
830 if(pOldPage
== pNewPage
)
834 E3dObject::handlePageChange(pOldPage
, pNewPage
);
836 for(size_t a(0); a
< GetObjCount(); a
++)
838 E3dObject
* pCandidate
= DynCastE3dObject(GetObj(a
));
842 pCandidate
->handlePageChange(pOldPage
, pNewPage
);
846 OSL_ENSURE(false, "E3dScene::handlePageChange invalid object list (!)");
851 SdrObjList
* E3dScene::GetSubList() const
853 return const_cast< E3dScene
* >(this);
856 basegfx::B3DRange
E3dScene::RecalcBoundVolume() const
858 basegfx::B3DRange aRetval
;
859 const size_t nObjCnt(GetObjCount());
861 for(size_t a
= 0; a
< nObjCnt
; ++a
)
863 const E3dObject
* p3DObject
= DynCastE3dObject(GetObj(a
));
867 basegfx::B3DRange
aLocalRange(p3DObject
->GetBoundVolume());
868 aLocalRange
.transform(p3DObject
->GetTransform());
869 aRetval
.expand(aLocalRange
);
876 void E3dScene::SetTransformChanged()
879 E3dObject::SetTransformChanged();
881 for(size_t a
= 0; a
< GetObjCount(); ++a
)
883 E3dObject
* pCandidate
= DynCastE3dObject(GetObj(a
));
887 pCandidate
->SetTransformChanged();
892 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */