1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: scene3d.cxx,v $
10 * $Revision: 1.34.18.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
35 #include "svdglob.hxx"
36 #include "svditer.hxx"
38 #if defined( UNX ) || defined( ICC )
41 #include "globl3d.hxx"
42 #include <svx/svdpage.hxx>
43 #include <svtools/style.hxx>
44 #include <svx/scene3d.hxx>
45 #include <svx/e3dundo.hxx>
46 #include <svx/svdtrans.hxx>
47 #include <svx/svxids.hrc>
48 #include <svx/colritem.hxx>
49 #include <svx/e3ditem.hxx>
50 #include <svx/xlntrit.hxx>
51 #include <svx/xfltrit.hxx>
52 #include <svx/svx3ditems.hxx>
53 #include <svtools/whiter.hxx>
54 #include <svx/xflftrit.hxx>
55 #include <svx/sdr/properties/e3dsceneproperties.hxx>
56 #include <svx/sdr/contact/viewcontactofe3dscene.hxx>
57 #include <svx/svddrag.hxx>
58 #include <helperminimaldepth3d.hxx>
60 #include <drawinglayer/geometry/viewinformation3d.hxx>
61 #include <basegfx/polygon/b2dpolypolygontools.hxx>
62 #include <svx/e3dsceneupdater.hxx>
64 #define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue()
66 //////////////////////////////////////////////////////////////////////////////
72 double mfMinimalDepth
;
75 unsigned mbIsScene
: 1;
78 ImpRemap3DDepth(sal_uInt32 nOrdNum
, double fMinimalDepth
);
79 ImpRemap3DDepth(sal_uInt32 nOrdNum
);
83 bool operator<(const ImpRemap3DDepth
& rComp
) const;
85 sal_uInt32
GetOrdNum() const { return mnOrdNum
; }
86 sal_Bool
IsScene() const { return mbIsScene
; }
89 ImpRemap3DDepth::ImpRemap3DDepth(sal_uInt32 nOrdNum
, double fMinimalDepth
)
91 mfMinimalDepth(fMinimalDepth
),
96 ImpRemap3DDepth::ImpRemap3DDepth(sal_uInt32 nOrdNum
)
102 ImpRemap3DDepth::~ImpRemap3DDepth()
106 bool ImpRemap3DDepth::operator<(const ImpRemap3DDepth
& rComp
) const
120 return mfMinimalDepth
< rComp
.mfMinimalDepth
;
125 // typedefs for a vector of ImpRemap3DDepths
126 typedef ::std::vector
< ImpRemap3DDepth
> ImpRemap3DDepthVector
;
128 //////////////////////////////////////////////////////////////////////////////
131 class Imp3DDepthRemapper
133 ImpRemap3DDepthVector maVector
;
136 Imp3DDepthRemapper(E3dScene
& rScene
);
137 ~Imp3DDepthRemapper();
139 sal_uInt32
RemapOrdNum(sal_uInt32 nOrdNum
) const;
142 Imp3DDepthRemapper::Imp3DDepthRemapper(E3dScene
& rScene
)
144 // only called when rScene.GetSubList() and nObjCount > 1L
145 SdrObjList
* pList
= rScene
.GetSubList();
146 const sal_uInt32
nObjCount(pList
->GetObjCount());
148 for(sal_uInt32
a(0L); a
< nObjCount
; a
++)
150 SdrObject
* pCandidate
= pList
->GetObj(a
);
154 if(pCandidate
->ISA(E3dCompoundObject
))
156 // single 3d object, calc depth
157 const double fMinimalDepth(getMinimalDepthInViewCoordinates(static_cast< const E3dCompoundObject
& >(*pCandidate
)));
158 ImpRemap3DDepth
aEntry(a
, fMinimalDepth
);
159 maVector
.push_back(aEntry
);
163 // scene, use standard entry for scene
164 ImpRemap3DDepth
aEntry(a
);
165 maVector
.push_back(aEntry
);
170 // now, we need to sort the maVector by it's members minimal depth. The
171 // smaller, the nearer to the viewer.
172 ::std::sort(maVector
.begin(), maVector
.end());
175 Imp3DDepthRemapper::~Imp3DDepthRemapper()
179 sal_uInt32
Imp3DDepthRemapper::RemapOrdNum(sal_uInt32 nOrdNum
) const
181 if(nOrdNum
< maVector
.size())
183 nOrdNum
= maVector
[(maVector
.size() - 1) - nOrdNum
].GetOrdNum();
189 //////////////////////////////////////////////////////////////////////////////
190 // BaseProperties section
192 sdr::properties::BaseProperties
* E3dScene::CreateObjectSpecificProperties()
194 return new sdr::properties::E3dSceneProperties(*this);
197 //////////////////////////////////////////////////////////////////////////////
198 // #110094# DrawContact section
200 sdr::contact::ViewContact
* E3dScene::CreateObjectSpecificViewContact()
202 return new sdr::contact::ViewContactOfE3dScene(*this);
205 ////////////////////////////////////////////////////////////////////////////////////////////////////
207 TYPEINIT1(E3dScene
, E3dObject
);
209 /*************************************************************************
211 |* E3dScene-Konstruktor
213 \************************************************************************/
217 aCamera(basegfx::B3DPoint(0.0, 0.0, 4.0), basegfx::B3DPoint()),
218 mp3DDepthRemapper(0L),
219 bDrawOnlySelected(false)
222 E3dDefaultAttributes aDefault
;
223 SetDefaultAttributes(aDefault
);
226 E3dScene::E3dScene(E3dDefaultAttributes
& rDefault
)
228 aCamera(basegfx::B3DPoint(0.0, 0.0, 4.0), basegfx::B3DPoint()),
229 mp3DDepthRemapper(0L),
230 bDrawOnlySelected(false)
233 SetDefaultAttributes(rDefault
);
236 void E3dScene::SetDefaultAttributes(E3dDefaultAttributes
& /*rDefault*/)
238 // Fuer OS/2 die FP-Exceptions abschalten
240 #define SC_FPEXCEPTIONS_ON() _control87( MCW_EM, 0 )
241 #define SC_FPEXCEPTIONS_OFF() _control87( MCW_EM, MCW_EM )
242 SC_FPEXCEPTIONS_OFF();
245 // Fuer WIN95/NT die FP-Exceptions abschalten
246 #if defined(WNT) || defined(WIN)
247 #define SC_FPEXCEPTIONS_ON() _control87( _MCW_EM, 0 )
248 #define SC_FPEXCEPTIONS_OFF() _control87( _MCW_EM, _MCW_EM )
249 SC_FPEXCEPTIONS_OFF();
253 aCamera
.SetViewWindow(-2, -2, 4, 4);
254 aCameraSet
.SetDeviceRectangle(-2, 2, -2, 2);
255 aCamera
.SetDeviceWindow(Rectangle(0, 0, 10, 10));
256 Rectangle
aRect(0, 0, 10, 10);
257 aCameraSet
.SetViewportRectangle(aRect
);
259 // set defaults for Camera from ItemPool
260 aCamera
.SetProjection(GetPerspective());
261 basegfx::B3DPoint
aActualPosition(aCamera
.GetPosition());
262 double fNew
= GetDistance();
264 if(fabs(fNew
- aActualPosition
.getZ()) > 1.0)
266 aCamera
.SetPosition( basegfx::B3DPoint( aActualPosition
.getX(), aActualPosition
.getY(), fNew
) );
269 fNew
= GetFocalLength() / 100.0;
270 aCamera
.SetFocalLength(fNew
);
273 /*************************************************************************
277 \************************************************************************/
279 E3dScene::~E3dScene()
282 ImpCleanup3DDepthMapper();
285 basegfx::B2DPolyPolygon
E3dScene::TakeXorPoly() const
287 const sdr::contact::ViewContactOfE3dScene
& rVCScene
= static_cast< sdr::contact::ViewContactOfE3dScene
& >(GetViewContact());
288 const drawinglayer::geometry::ViewInformation3D
aViewInfo3D(rVCScene
.getViewInformation3D());
289 const basegfx::B3DPolyPolygon
aCubePolyPolygon(CreateWireframe());
291 basegfx::B2DPolyPolygon
aRetval(basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(aCubePolyPolygon
,
292 aViewInfo3D
.getObjectToView()));
293 aRetval
.transform(rVCScene
.getObjectTransformation());
299 void E3dScene::ImpCleanup3DDepthMapper()
301 if(mp3DDepthRemapper
)
303 delete mp3DDepthRemapper
;
304 mp3DDepthRemapper
= 0L;
309 sal_uInt32
E3dScene::RemapOrdNum(sal_uInt32 nNewOrdNum
) const
311 if(!mp3DDepthRemapper
)
313 const sal_uInt32
nObjCount(GetSubList() ? GetSubList()->GetObjCount() : 0L);
317 ((E3dScene
*)this)->mp3DDepthRemapper
= new Imp3DDepthRemapper((E3dScene
&)(*this));
321 if(mp3DDepthRemapper
)
323 return mp3DDepthRemapper
->RemapOrdNum(nNewOrdNum
);
329 /*************************************************************************
331 |* Identifier zurueckgeben
333 \************************************************************************/
335 UINT16
E3dScene::GetObjIdentifier() const
340 /*************************************************************************
344 \************************************************************************/
346 void E3dScene::NbcSetSnapRect(const Rectangle
& rRect
)
349 E3dObject::NbcSetSnapRect(rRect
);
350 aCamera
.SetDeviceWindow(rRect
);
351 aCameraSet
.SetViewportRectangle((Rectangle
&)rRect
);
354 ImpCleanup3DDepthMapper();
357 /*************************************************************************
359 |* Objekt verschieben
361 \************************************************************************/
363 void E3dScene::NbcMove(const Size
& rSize
)
365 Rectangle aNewSnapRect
= GetSnapRect();
366 MoveRect(aNewSnapRect
, rSize
);
367 NbcSetSnapRect(aNewSnapRect
);
370 /*************************************************************************
374 \************************************************************************/
376 void E3dScene::NbcResize(const Point
& rRef
, const Fraction
& rXFact
,
377 const Fraction
& rYFact
)
379 Rectangle aNewSnapRect
= GetSnapRect();
380 ResizeRect(aNewSnapRect
, rRef
, rXFact
, rYFact
);
381 NbcSetSnapRect(aNewSnapRect
);
384 /*************************************************************************
386 |* Neue Kamera setzen, und dabei die Szene und ggf. das BoundVolume
387 |* als geaendert markieren
389 \************************************************************************/
391 void E3dScene::SetCamera(const Camera3D
& rNewCamera
)
393 // Alte Kamera setzen
394 aCamera
= rNewCamera
;
395 ((sdr::properties::E3dSceneProperties
&)GetProperties()).SetSceneItemsFromCamera();
399 // Neue Kamera aus alter fuellen
400 Camera3D
& rCam
= (Camera3D
&)GetCamera();
403 if(rCam
.GetAspectMapping() == AS_NO_MAPPING
)
404 GetCameraSet().SetRatio(0.0);
406 // Abbildungsgeometrie setzen
407 basegfx::B3DPoint
aVRP(rCam
.GetViewPoint());
408 basegfx::B3DVector
aVPN(aVRP
- rCam
.GetVRP());
409 basegfx::B3DVector
aVUV(rCam
.GetVUV());
411 // #91047# use SetViewportValues() to set VRP, VPN and VUV as vectors, too.
412 // Else these values would not be exported/imported correctly.
413 GetCameraSet().SetViewportValues(aVRP
, aVPN
, aVUV
);
415 // Perspektive setzen
416 GetCameraSet().SetPerspective(rCam
.GetProjection() == PR_PERSPECTIVE
);
417 GetCameraSet().SetViewportRectangle((Rectangle
&)rCam
.GetDeviceWindow());
420 ImpCleanup3DDepthMapper();
423 /*************************************************************************
425 |* 3D-Objekt einfuegen
427 \************************************************************************/
429 void E3dScene::NewObjectInserted(const E3dObject
* p3DObj
)
431 E3dObject::NewObjectInserted(p3DObj
);
433 if ( p3DObj
== this )
437 ImpCleanup3DDepthMapper();
440 /*************************************************************************
442 |* Parent ueber Aenderung eines Childs informieren
444 \************************************************************************/
446 void E3dScene::StructureChanged()
448 E3dObject::StructureChanged();
452 ImpCleanup3DDepthMapper();
455 /*************************************************************************
457 |* Uebergeordnetes Szenenobjekt bestimmen
459 \************************************************************************/
461 E3dScene
* E3dScene::GetScene() const
464 return GetParentObj()->GetScene();
466 return (E3dScene
*)this;
469 void E3dScene::removeAllNonSelectedObjects()
471 E3DModifySceneSnapRectUpdater
aUpdater(this);
473 for(sal_uInt32
a(0); a
< maSubList
.GetObjCount(); a
++)
475 SdrObject
* pObj
= maSubList
.GetObj(a
);
479 bool bRemoveObject(false);
481 if(pObj
->ISA(E3dScene
))
483 E3dScene
* pScene
= (E3dScene
*)pObj
;
485 // iterate over this sub-scene
486 pScene
->removeAllNonSelectedObjects();
488 // check object count. Empty scenes can be deleted
489 const sal_uInt32
nObjCount(pScene
->GetSubList() ? pScene
->GetSubList()->GetObjCount() : 0);
493 // all objects removed, scene can be removed, too
494 bRemoveObject
= true;
497 else if(pObj
->ISA(E3dCompoundObject
))
499 E3dCompoundObject
* pCompound
= (E3dCompoundObject
*)pObj
;
501 if(!pCompound
->GetSelected())
503 bRemoveObject
= true;
509 maSubList
.NbcRemoveObject(pObj
->GetOrdNum());
511 SdrObject::Free(pObj
);
517 /*************************************************************************
519 |* Zuweisungsoperator
521 \************************************************************************/
523 void E3dScene::operator=(const SdrObject
& rObj
)
525 E3dObject::operator=(rObj
);
527 const E3dScene
& r3DObj
= (const E3dScene
&) rObj
;
528 aCamera
= r3DObj
.aCamera
;
531 aCameraSet
= r3DObj
.aCameraSet
;
532 ((sdr::properties::E3dSceneProperties
&)GetProperties()).SetSceneItemsFromCamera();
534 // SetSnapRect(r3DObj.GetSnapRect());
535 InvalidateBoundVolume();
540 ImpCleanup3DDepthMapper();
543 // After a Scene as model object is cloned, the used
544 // ViewContactOfE3dScene is created and partially used
545 // to calculate Bound/SnapRects, but - since quite some
546 // values are buffered at the VC - not really well
547 // initialized. It would be possible to always watch for
548 // preconditions of buffered data, but this would be expensive
549 // and would create a lot of short living data structures.
550 // It is currently better to flush that data, e.g. by using
551 // ActionChanged at the VC which will for this class
552 // flush that cached data and initalize it's valid reconstruction
553 GetViewContact().ActionChanged();
556 /*************************************************************************
558 |* Licht- und Labelobjektlisten neu aufbauen (nach Laden, Zuweisung)
560 \************************************************************************/
562 void E3dScene::RebuildLists()
565 SdrLayerID nCurrLayerID
= GetLayer();
567 SdrObjListIter
a3DIterator(maSubList
, IM_FLAT
);
569 // dann alle Objekte in der Szene pruefen
570 while ( a3DIterator
.IsMore() )
572 E3dObject
* p3DObj
= (E3dObject
*) a3DIterator
.Next();
573 p3DObj
->NbcSetLayer(nCurrLayerID
);
574 NewObjectInserted(p3DObj
);
578 /*************************************************************************
580 |* erstelle neues GeoData-Objekt
582 \************************************************************************/
584 SdrObjGeoData
*E3dScene::NewGeoData() const
586 return new E3DSceneGeoData
;
589 /*************************************************************************
591 |* uebergebe aktuelle werte an das GeoData-Objekt
593 \************************************************************************/
595 void E3dScene::SaveGeoData(SdrObjGeoData
& rGeo
) const
597 E3dObject::SaveGeoData (rGeo
);
599 ((E3DSceneGeoData
&) rGeo
).aCamera
= aCamera
;
602 /*************************************************************************
604 |* uebernehme werte aus dem GeoData-Objekt
606 \************************************************************************/
608 void E3dScene::RestGeoData(const SdrObjGeoData
& rGeo
)
610 // #i94832# removed E3DModifySceneSnapRectUpdater here.
611 // It should not be needed, is already part of E3dObject::RestGeoData
612 E3dObject::RestGeoData (rGeo
);
613 SetCamera (((E3DSceneGeoData
&) rGeo
).aCamera
);
616 /*************************************************************************
618 |* Am StyleSheet wurde etwas geaendert, also Scene aendern
620 \************************************************************************/
622 void E3dScene::Notify(SfxBroadcaster
&rBC
, const SfxHint
&rHint
)
625 E3dObject::Notify(rBC
, rHint
);
628 /*************************************************************************
630 \************************************************************************/
632 void E3dScene::RotateScene (const Point
& rRef
, long /*nWink*/, double sn
, double cs
)
634 Point UpperLeft
, LowerRight
, Center
, NewCenter
;
636 UpperLeft
= aOutRect
.TopLeft();
637 LowerRight
= aOutRect
.BottomRight();
639 long dxOutRectHalf
= labs(UpperLeft
.X() - LowerRight
.X());
641 long dyOutRectHalf
= labs(UpperLeft
.Y() - LowerRight
.Y());
644 Rectangle
RectQuelle(aOutRect
), RectZiel(aOutRect
);
646 // Nur der Mittelpunkt wird bewegt. Die Ecken werden von NbcMove bewegt.
647 // Fuer das Drehen wird von mir ein kartesisches Koordinatensystem verwendet in dem der Drehpunkt
648 // der Nullpunkt ist und die Y- Achse nach oben ansteigt, die X-Achse nach rechts.
649 // Dies muss bei den Y-Werten beachtet werden. (Auf dem Blatt zeigt die Y-Achse nach unten
650 Center
.X() = (UpperLeft
.X() + dxOutRectHalf
) - rRef
.X();
651 Center
.Y() = -((UpperLeft
.Y() + dyOutRectHalf
) - rRef
.Y());
652 // Ein paar Spezialfaelle zuerst abhandeln (n*90 Grad n ganzzahlig)
653 if (sn
==1.0 && cs
==0.0) { // 90deg
654 NewCenter
.X() = -Center
.Y();
655 NewCenter
.Y() = -Center
.X();
656 } else if (sn
==0.0 && cs
==-1.0) { // 180deg
657 NewCenter
.X() = -Center
.X();
658 NewCenter
.Y() = -Center
.Y();
659 } else if (sn
==-1.0 && cs
==0.0) { // 270deg
660 NewCenter
.X() = Center
.Y();
661 NewCenter
.Y() = -Center
.X();
663 else // Hier wird um einen beliebigen Winkel in mathematisch positiver Richtung gedreht!
664 { // xneu = x * cos(alpha) - y * sin(alpha)
665 // yneu = x * sin(alpha) + y * cos(alpha)
666 // Unten Rechts wird nicht gedreht: die Seiten von RectQuelle muessen parallel
667 // zu den Koordinatenachsen bleiben.
668 NewCenter
.X() = (long) (Center
.X() * cs
- Center
.Y() * sn
);
669 NewCenter
.Y() = (long) (Center
.X() * sn
+ Center
.Y() * cs
);
673 Point DiffPoint
= (NewCenter
- Center
);
674 Differenz
.Width() = DiffPoint
.X();
675 Differenz
.Height() = -DiffPoint
.Y(); // Man beachte dass die Y-Achse nach unten positiv gezaehlt wird.
676 NbcMove (Differenz
); // fuehrt die eigentliche Koordinatentransformation durch.
679 /*************************************************************************
681 |* Get the name of the object (singular)
683 \************************************************************************/
685 void E3dScene::TakeObjNameSingul(XubString
& rName
) const
687 rName
=ImpGetResStr(STR_ObjNameSingulScene3d
);
689 String
aName( GetName() );
692 rName
+= sal_Unicode(' ');
693 rName
+= sal_Unicode('\'');
695 rName
+= sal_Unicode('\'');
699 /*************************************************************************
701 |* Get the name of the object (plural)
703 \************************************************************************/
705 void E3dScene::TakeObjNamePlural(XubString
& rName
) const
707 rName
=ImpGetResStr(STR_ObjNamePluralScene3d
);
710 /*************************************************************************
712 |* Die NbcRotate-Routine ueberlaedt die des SdrObject. Die Idee ist die Scene
713 |* drehen zu koennen und relativ zur Lage der Scene dann auch die Objekte
716 \************************************************************************/
718 void E3dScene::NbcSetTransform(const basegfx::B3DHomMatrix
& rMatrix
)
720 if(maTransformation
!= rMatrix
)
723 E3dObject::NbcSetTransform(rMatrix
);
727 void E3dScene::SetTransform(const basegfx::B3DHomMatrix
& rMatrix
)
729 if(rMatrix
!= maTransformation
)
732 E3dObject::SetTransform(rMatrix
);
736 void E3dScene::NbcRotate(const Point
& rRef
, long nWink
, double sn
, double cs
)
738 // Also derzeit sind die Klebepunkte relativ zum aOutRect der Szene definiert. Vor dem Drehen
739 // werden die Klebepunkte relativ zur Seite definiert. Sie nehmen an der Drehung der Szene noch nicht Teil
740 // dafuer gibt es den
741 SetGlueReallyAbsolute(TRUE
);
743 // So dass war die Szene, ab jetzt kommen die Objekte in der Szene
744 // 3D-Objekte gibt es nur ein einziges das kann zwar mehrere Flaechen haben aber die Flaechen
745 // muessen ja nicht zusammenhaengend sein
746 // es ermoeglicht den Zugriff auf Kindobjekte
747 // Ich gehe also die gesamte Liste durch und rotiere um die Z-Achse die durch den
748 // Mittelpunkt von aOutRect geht (Satz von Steiner), also RotateZ
750 RotateScene (rRef
, nWink
, sn
, cs
); // Rotiert die Szene
751 double fWinkelInRad
= nWink
/100 * F_PI180
;
753 basegfx::B3DHomMatrix aRotation
;
754 aRotation
.rotate(0.0, 0.0, fWinkelInRad
);
755 NbcSetTransform(aRotation
* GetTransform());
757 SetRectsDirty(); // Veranlasst eine Neuberechnung aller BoundRects
758 NbcRotateGluePoints(rRef
,nWink
,sn
,cs
); // Rotiert die Klebepunkte (die haben noch Koordinaten relativ
759 // zum Urpsung des Blattes
760 SetGlueReallyAbsolute(FALSE
); // ab jetzt sind sie wieder relativ zum BoundRect (also dem aOutRect definiert)
764 /*************************************************************************
766 |* SnapRect berechnen
768 \************************************************************************/
770 void E3dScene::RecalcSnapRect()
772 E3dScene
* pScene
= GetScene();
776 // Szene wird als 2D-Objekt benutzt, nimm SnapRect aus der
777 // 2D Bildschrimdarstellung
778 Camera3D
& rCam
= (Camera3D
&)pScene
->GetCamera();
779 maSnapRect
= rCam
.GetDeviceWindow();
783 // Szene ist selbst Mitglied einer anderen Szene, hole das
784 // SnapRect als zusammengesetztes Objekt
785 E3dObject::RecalcSnapRect();
789 /*************************************************************************
793 \************************************************************************/
795 BOOL
E3dScene::IsBreakObjPossible()
797 // Szene ist aufzubrechen, wenn alle Mitglieder aufzubrechen sind
798 SdrObjListIter
a3DIterator(maSubList
, IM_DEEPWITHGROUPS
);
800 while ( a3DIterator
.IsMore() )
802 E3dObject
* pObj
= (E3dObject
*) a3DIterator
.Next();
803 DBG_ASSERT(pObj
->ISA(E3dObject
), "AW: In Szenen sind nur 3D-Objekte erlaubt!");
804 if(!pObj
->IsBreakObjPossible())
811 basegfx::B3DVector
E3dScene::GetShadowPlaneDirection() const
813 double fWink
= (double)GetShadowSlant() * F_PI180
;
814 basegfx::B3DVector
aShadowPlaneDir(0.0, sin(fWink
), cos(fWink
));
815 aShadowPlaneDir
.normalize();
816 return aShadowPlaneDir
;
819 void E3dScene::SetShadowPlaneDirection(const basegfx::B3DVector
& rVec
)
821 UINT16 nSceneShadowSlant
= (UINT16
)((atan2(rVec
.getY(), rVec
.getZ()) / F_PI180
) + 0.5);
822 GetProperties().SetObjectItemDirect(Svx3DShadowSlantItem(nSceneShadowSlant
));
825 basegfx::B2DPolyPolygon
E3dScene::TakeCreatePoly(const SdrDragStat
& /*rDrag*/) const
827 return TakeXorPoly();
830 FASTBOOL
E3dScene::BegCreate(SdrDragStat
& rStat
)
832 rStat
.SetOrtho4Possible();
833 Rectangle
aRect1(rStat
.GetStart(), rStat
.GetNow());
835 rStat
.SetActionRect(aRect1
);
836 NbcSetSnapRect(aRect1
);
840 FASTBOOL
E3dScene::MovCreate(SdrDragStat
& rStat
)
843 rStat
.TakeCreateRect(aRect1
);
845 rStat
.SetActionRect(aRect1
);
846 NbcSetSnapRect(aRect1
);
852 FASTBOOL
E3dScene::EndCreate(SdrDragStat
& rStat
, SdrCreateCmd eCmd
)
855 rStat
.TakeCreateRect(aRect1
);
857 NbcSetSnapRect(aRect1
);
859 return (eCmd
==SDRCREATE_FORCEEND
|| rStat
.GetPointAnz()>=2);
862 FASTBOOL
E3dScene::BckCreate(SdrDragStat
& /*rStat*/)
867 void E3dScene::BrkCreate(SdrDragStat
& /*rStat*/)