diff options
-rw-r--r-- | svx/source/engine3d/deflt3d.cxx | 44 | ||||
-rw-r--r-- | svx/source/engine3d/extrud3d.cxx | 215 | ||||
-rw-r--r-- | svx/source/engine3d/float3d.cxx | 45 | ||||
-rw-r--r-- | svx/source/engine3d/lathe3d.cxx | 476 | ||||
-rw-r--r-- | svx/source/engine3d/obj3d.cxx | 1020 | ||||
-rw-r--r-- | svx/source/engine3d/polysc3d.cxx | 19 | ||||
-rw-r--r-- | svx/source/engine3d/scene3d.cxx | 657 | ||||
-rw-r--r-- | svx/source/engine3d/sphere3d.cxx | 322 | ||||
-rw-r--r-- | svx/source/engine3d/view3d.cxx | 8 | ||||
-rw-r--r-- | svx/source/msfilter/msdffimp.cxx | 8 | ||||
-rw-r--r-- | svx/source/svdraw/svdmodel.cxx | 48 | ||||
-rw-r--r-- | svx/source/svdraw/svdoattr.cxx | 9 | ||||
-rw-r--r-- | svx/source/svdraw/svdocirc.cxx | 10 | ||||
-rw-r--r-- | svx/source/svdraw/svdogrp.cxx | 28 | ||||
-rw-r--r-- | svx/source/svdraw/svdotext.cxx | 10 | ||||
-rw-r--r-- | svx/source/svdraw/svdovirt.cxx | 15 |
16 files changed, 1846 insertions, 1088 deletions
diff --git a/svx/source/engine3d/deflt3d.cxx b/svx/source/engine3d/deflt3d.cxx index d40318de6c42..ceb0a9db3941 100644 --- a/svx/source/engine3d/deflt3d.cxx +++ b/svx/source/engine3d/deflt3d.cxx @@ -2,9 +2,9 @@ * * $RCSfile: deflt3d.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2000-10-30 10:55:03 $ + * last change: $Author: aw $ $Date: 2000-11-07 12:52:01 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -98,20 +98,20 @@ void E3dDefaultAttributes::Reset() // Compound-Objekt // aDefaultFrontMaterial; // aDefaultBackMaterial; - eDefaultTextureKind = Base3DTextureColor; - eDefaultTextureMode = Base3DTextureModulate; - bDefaultDoubleSided = FALSE; +//-/ eDefaultTextureKind = Base3DTextureColor; +//-/ eDefaultTextureMode = Base3DTextureModulate; +//-/ bDefaultDoubleSided = FALSE; bDefaultCreateNormals = TRUE; bDefaultCreateTexture = TRUE; - bDefaultUseStdNormals = FALSE; - bDefaultUseStdNormalsUseSphere = FALSE; - bDefaultInvertNormals = FALSE; - bDefaultUseStdTextureX = FALSE; - bDefaultUseStdTextureXUseSphere = FALSE; - bDefaultUseStdTextureY = FALSE; - bDefaultUseStdTextureYUseSphere = FALSE; - bDefaultShadow3D = FALSE; - bDefaultFilterTexture = FALSE; +//-/ bDefaultUseStdNormals = FALSE; +//-/ bDefaultUseStdNormalsUseSphere = FALSE; +//-/ bDefaultInvertNormals = FALSE; +//-/ bDefaultUseStdTextureX = FALSE; +//-/ bDefaultUseStdTextureXUseSphere = FALSE; +//-/ bDefaultUseStdTextureY = FALSE; +//-/ bDefaultUseStdTextureYUseSphere = FALSE; +//-/ bDefaultShadow3D = FALSE; +//-/ bDefaultFilterTexture = FALSE; bDefaultUseDifferentBackMaterial = FALSE; // Cube-Objekt @@ -121,16 +121,16 @@ void E3dDefaultAttributes::Reset() bDefaultCubePosIsCenter = FALSE; // Sphere-Objekt - nDefaultHSegments = 24; - nDefaultVSegments = 24; +//-/ nDefaultHSegments = 24; +//-/ nDefaultVSegments = 24; aDefaultSphereCenter = Vector3D(0.0, 0.0, 0.0); aDefaultSphereSize = Vector3D(1000.0, 1000.0, 1000.0); // Lathe-Objekt nDefaultLatheEndAngle = 3600; fDefaultLatheScale = 1.0; - fDefaultBackScale = 1.0; - fDefaultPercentDiag = 0.05; +//-/ fDefaultBackScale = 1.0; +//-/ fDefaultPercentDiag = 0.05; bDefaultLatheSmoothed = TRUE; bDefaultLatheSmoothFrontBack = FALSE; bDefaultLatheCharacterMode = FALSE; @@ -139,7 +139,7 @@ void E3dDefaultAttributes::Reset() // Extrude-Objekt fDefaultExtrudeScale = 1.0; - fDefaultExtrudeDepth = 1000.0; +//-/ fDefaultExtrudeDepth = 1000.0; bDefaultExtrudeSmoothed = TRUE; bDefaultExtrudeSmoothFrontBack = FALSE; bDefaultExtrudeCharacterMode = FALSE; @@ -148,10 +148,10 @@ void E3dDefaultAttributes::Reset() // Scene-Objekt // aDefaultLightGroup; - aDefaultShadowPlaneDirection = Vector3D(0.0, 0.0, 1.0); - eDefaultShadeModel = Base3DSmooth; +//-/ aDefaultShadowPlaneDirection = Vector3D(0.0, 0.0, 1.0); +//-/ eDefaultShadeModel = Base3DSmooth; bDefaultDither = TRUE; - bDefaultForceDraftShadeModel = FALSE; +//-/ bDefaultForceDraftShadeModel = FALSE; } /************************************************************************* diff --git a/svx/source/engine3d/extrud3d.cxx b/svx/source/engine3d/extrud3d.cxx index 25bb37c7261c..6ff9a0e8b4a6 100644 --- a/svx/source/engine3d/extrud3d.cxx +++ b/svx/source/engine3d/extrud3d.cxx @@ -2,9 +2,9 @@ * * $RCSfile: extrud3d.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2000-10-30 10:55:03 $ + * last change: $Author: aw $ $Date: 2000-11-07 12:52:01 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -121,12 +121,15 @@ TYPEINIT1(E3dExtrudeObj, E3dCompoundObject); E3dExtrudeObj::E3dExtrudeObj(E3dDefaultAttributes& rDefault, const PolyPolygon& rPP, double fDepth) : E3dCompoundObject(rDefault), - aExtrudePolygon(rPP, rDefault.GetDefaultExtrudeScale()), - fExtrudeDepth(fDepth) + aExtrudePolygon(rPP, rDefault.GetDefaultExtrudeScale()) +//-/ fExtrudeDepth(fDepth) { // Defaults setzen SetDefaultAttributes(rDefault); + // set extrude depth + mpObjectItemSet->Put(Svx3DDepthItem((sal_uInt32)(fDepth + 0.5))); + // Geometrie erzeugen CreateGeometry(); } @@ -141,12 +144,15 @@ E3dExtrudeObj::E3dExtrudeObj(E3dDefaultAttributes& rDefault, const PolyPolygon& E3dExtrudeObj::E3dExtrudeObj(E3dDefaultAttributes& rDefault, const XPolyPolygon& rXPP, double fDepth) : E3dCompoundObject(rDefault), - aExtrudePolygon(rXPP, rDefault.GetDefaultExtrudeScale()), - fExtrudeDepth(fDepth) + aExtrudePolygon(rXPP, rDefault.GetDefaultExtrudeScale()) +//-/ fExtrudeDepth(fDepth) { // Defaults setzen SetDefaultAttributes(rDefault); + // set extrude depth + mpObjectItemSet->Put(Svx3DDepthItem((sal_uInt32)(fDepth + 0.5))); + // Geometrie erzeugen CreateGeometry(); } @@ -156,16 +162,18 @@ E3dExtrudeObj::E3dExtrudeObj() { // Defaults setzen E3dDefaultAttributes aDefault; - fExtrudeDepth = aDefault.GetDefaultExtrudeDepth(); +//-/ fExtrudeDepth = aDefault.GetDefaultExtrudeDepth(); SetDefaultAttributes(aDefault); } void E3dExtrudeObj::SetDefaultAttributes(E3dDefaultAttributes& rDefault) { // Defaults setzen + ImpForceItemSet(); + fExtrudeScale = rDefault.GetDefaultExtrudeScale(); - fExtrudeBackScale = rDefault.GetDefaultBackScale(); - fExtrudePercentDiag = rDefault.GetDefaultPercentDiag(); +//-/ fExtrudeBackScale = rDefault.GetDefaultBackScale(); +//-/ fExtrudePercentDiag = rDefault.GetDefaultPercentDiag(); bExtrudeSmoothed = rDefault.GetDefaultExtrudeSmoothed(); bExtrudeSmoothFrontBack = rDefault.GetDefaultExtrudeSmoothFrontBack(); bExtrudeCharacterMode = rDefault.GetDefaultExtrudeCharacterMode(); @@ -173,8 +181,11 @@ void E3dExtrudeObj::SetDefaultAttributes(E3dDefaultAttributes& rDefault) bExtrudeCloseBack = rDefault.GetDefaultExtrudeCloseBack(); // Bei extrudes defaultmaessig StdTexture in X und Y - bUseStdTextureX = TRUE; - bUseStdTextureY = TRUE; +//-/ bUseStdTextureX = TRUE; + mpObjectItemSet->Put(Svx3DTextureProjectionXItem(1)); + +//-/ bUseStdTextureY = TRUE; + mpObjectItemSet->Put(Svx3DTextureProjectionYItem(1)); } /************************************************************************* @@ -194,7 +205,7 @@ PolyPolygon3D E3dExtrudeObj::GetFrontSide() // Normale holen Vector3D aNormal = aPolyPoly3D.GetNormal(); - if((aNormal.Z() > 0.0) != (fExtrudeDepth > 0.0)) + if((aNormal.Z() > 0.0) != (GetExtrudeDepth() != 0)) aPolyPoly3D.FlipDirections(); // Orientierung evtl. vorhandener Loecher in einen definierten @@ -208,17 +219,19 @@ PolyPolygon3D E3dExtrudeObj::GetBackSide(const PolyPolygon3D& rFrontSide) { PolyPolygon3D aBackSide(rFrontSide); - if(fExtrudeDepth != 0.0) + if(GetExtrudeDepth() != 0) { // Extrudevektor bilden Vector3D aNormal = aBackSide.GetNormal(); if(aNormal.Z() < 0.0) aNormal.Z() = -aNormal.Z(); - Vector3D aOffset = aNormal * fExtrudeDepth; + Vector3D aOffset = aNormal * (double)GetExtrudeDepth(); // eventuell Skalieren - if(fExtrudeBackScale != 1.0) - ScalePoly(aBackSide, fExtrudeBackScale); +//-/ if(fExtrudeBackScale != 1.0) + if(GetPercentBackScale() != 100) +//-/ ScalePoly(aBackSide, fExtrudeBackScale); + ScalePoly(aBackSide, (double)GetPercentBackScale() / 100.0); // Verschieben Matrix4D aTrans; @@ -237,14 +250,15 @@ void E3dExtrudeObj::CreateGeometry() // Polygon als Grundlage holen PolyPolygon3D aFrontSide = GetFrontSide(); - if(fExtrudeDepth != 0.0) + if(GetExtrudeDepth() != 0) { // Hinteres Polygon erzeugen PolyPolygon3D aBackSide = GetBackSide(aFrontSide); // Was muss erzeugt werden? if(!aFrontSide.IsClosed()) - bDoubleSided = TRUE; +//-/ bDoubleSided = TRUE; + mpObjectItemSet->Put(Svx3DDoubleSidedItem(TRUE)); double fTextureDepth=1.0; double fTextureStart=0.0; @@ -271,7 +285,8 @@ void E3dExtrudeObj::CreateGeometry() 0L, bExtrudeCloseFront, bExtrudeCloseBack, - fExtrudePercentDiag, +//-/ fExtrudePercentDiag, + (double)GetPercentDiagonal() / 200.0, GetExtrudeSmoothed(), GetExtrudeSmoothed(), GetExtrudeSmoothFrontBack(), @@ -286,14 +301,15 @@ void E3dExtrudeObj::CreateGeometry() else { // nur ein Polygon erzeugen - bDoubleSided = TRUE; +//-/ bDoubleSided = TRUE; + mpObjectItemSet->Put(Svx3DDoubleSidedItem(TRUE)); // Fuer evtl. selbst erzeugte Normalen PolyPolygon3D aNormalsFront; // Extrudevektor bilden Vector3D aNormal = aFrontSide.GetNormal(); - Vector3D aOffset = aNormal * fExtrudeDepth; + Vector3D aOffset = aNormal * (double)GetExtrudeDepth(); // Normalen und Vorderseite selbst erzeugen AddFrontNormals(aFrontSide, aNormalsFront, aOffset); @@ -372,9 +388,14 @@ void E3dExtrudeObj::WriteData(SvStream& rOut) const E3dIOCompat aCompat(rOut, STREAM_WRITE, 1); rOut << aExtrudePolygon; rOut << fExtrudeScale; - rOut << fExtrudeDepth; - rOut << fExtrudeBackScale; - rOut << fExtrudePercentDiag; + +//-/ rOut << fExtrudeDepth; + rOut << (double)GetExtrudeDepth(); + +//-/ rOut << fExtrudeBackScale; + rOut << (double)GetPercentBackScale() / 100.0; + + rOut << (double)GetPercentDiagonal() / 200.0; rOut << (BOOL)bExtrudeSmoothed; rOut << (BOOL)bExtrudeSmoothFrontBack; @@ -412,12 +433,22 @@ void E3dExtrudeObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn) if(aIoCompat.GetVersion() >= 1) { BOOL bTmp; + double fTmp; rIn >> aExtrudePolygon; rIn >> fExtrudeScale; - rIn >> fExtrudeDepth; - rIn >> fExtrudeBackScale; - rIn >> fExtrudePercentDiag; + +//-/ rIn >> fExtrudeDepth; + rIn >> fTmp; + mpObjectItemSet->Put(Svx3DDepthItem(sal_uInt32(fTmp + 0.5))); + +//-/ rIn >> fExtrudeBackScale; + rIn >> fTmp; + mpObjectItemSet->Put(Svx3DBackscaleItem(sal_uInt16(fTmp * 100.0))); + +//-/ rIn >> fExtrudePercentDiag; + rIn >> fTmp; + mpObjectItemSet->Put(Svx3DPercentDiagonalItem(sal_uInt16(fTmp * 200.0))); rIn >> bTmp; bExtrudeSmoothed = bTmp; rIn >> bTmp; bExtrudeSmoothFrontBack = bTmp; @@ -490,11 +521,14 @@ void E3dExtrudeObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn) const PolyPolygon3D& rOtherPoly = pOther->GetPolyPolygon3D(); // Hintereinanderliegende Paare in der alten Version waren // 0,1 und 3,2 (0,3 vorne) - fExtrudeDepth = (rOtherPoly[0][1] - rOtherPoly[0][0]).GetLength(); +//-/ fExtrudeDepth = (rOtherPoly[0][1] - rOtherPoly[0][0]).GetLength(); + double fVal = (rOtherPoly[0][1] - rOtherPoly[0][0]).GetLength(); + mpObjectItemSet->Put(Svx3DDepthItem(sal_uInt32(fVal + 0.5))); } else // Einen Default vorsehen, kann aber eigentlich nie geschehen - fExtrudeDepth = 100.0; +//-/ fExtrudeDepth = 100.0; + mpObjectItemSet->Put(Svx3DDepthItem(100)); // Polygon fuer Vorderseite holen if(pFront) @@ -509,7 +543,7 @@ void E3dExtrudeObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn) // verschieben aExtrudePolygon = pBack->GetPolyPolygon3D(); Matrix4D aMat; - aMat.Translate(Vector3D(0.0, 0.0, -fExtrudeDepth)); + aMat.Translate(Vector3D(0.0, 0.0, -(double)GetExtrudeDepth())); aExtrudePolygon.Transform(aMat); } else @@ -558,8 +592,12 @@ void E3dExtrudeObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn) // Setze die weiteren Parameter auf die defaults fExtrudeScale = 1.0; - fExtrudeBackScale = 1.0; - fExtrudePercentDiag = 0.05; + +//-/ fExtrudeBackScale = 1.0; + mpObjectItemSet->Put(Svx3DBackscaleItem(100)); + +//-/ fExtrudePercentDiag = 0.05; + mpObjectItemSet->Put(Svx3DPercentDiagonalItem(10)); bExtrudeSmoothed = TRUE; bExtrudeSmoothFrontBack = FALSE; @@ -587,9 +625,9 @@ void E3dExtrudeObj::operator=(const SdrObject& rObj) aExtrudePolygon = r3DObj.aExtrudePolygon; fExtrudeScale = r3DObj.fExtrudeScale; - fExtrudeDepth = r3DObj.fExtrudeDepth; - fExtrudeBackScale = r3DObj.fExtrudeBackScale; - fExtrudePercentDiag = r3DObj.fExtrudePercentDiag; +//-/ fExtrudeDepth = r3DObj.fExtrudeDepth; +//-/ fExtrudeBackScale = r3DObj.fExtrudeBackScale; +//-/ fExtrudePercentDiag = r3DObj.fExtrudePercentDiag; bExtrudeSmoothed = r3DObj.bExtrudeSmoothed; bExtrudeSmoothFrontBack = r3DObj.bExtrudeSmoothFrontBack; @@ -679,20 +717,23 @@ void E3dExtrudeObj::ImpLocalItemValueChange(const SfxPoolItem& rNew) { case SDRATTR_3DOBJ_PERCENT_DIAGONAL: { - UINT16 nNew = ((const Svx3DPercentDiagonalItem&)rNew).GetValue(); - ImpSetExtrudePercentDiag((double)nNew / 200.0); + bGeometryValid = FALSE; +//-/ UINT16 nNew = ((const Svx3DPercentDiagonalItem&)rNew).GetValue(); +//-/ ImpSetExtrudePercentDiag((double)nNew / 200.0); break; } case SDRATTR_3DOBJ_BACKSCALE: { - UINT16 nNew = ((const Svx3DBackscaleItem&)rNew).GetValue(); - ImpSetExtrudeBackScale((double)nNew / 100.0); + bGeometryValid = FALSE; +//-/ UINT16 nNew = ((const Svx3DBackscaleItem&)rNew).GetValue(); +//-/ ImpSetExtrudeBackScale((double)nNew / 100.0); break; } case SDRATTR_3DOBJ_DEPTH: { - UINT32 nNew = ((const Svx3DDepthItem&)rNew).GetValue(); - ImpSetExtrudeDepth((double)nNew); + bGeometryValid = FALSE; +//-/ UINT32 nNew = ((const Svx3DDepthItem&)rNew).GetValue(); +//-/ ImpSetExtrudeDepth((double)nNew); break; } } @@ -728,7 +769,8 @@ void E3dExtrudeObj::SetItemSet( const SfxItemSet& rSet ) // handle value change for(sal_uInt16 nWhich(SDRATTR_3DOBJ_PERCENT_DIAGONAL); nWhich <= SDRATTR_3DOBJ_DEPTH; nWhich++) - ImpLocalItemValueChange(rSet.Get(nWhich)); + if(SFX_ITEM_SET == rSet.GetItemState(nWhich, FALSE)) + ImpLocalItemValueChange(rSet.Get(nWhich)); } @@ -789,25 +831,28 @@ void E3dExtrudeObj::SetItemSet( const SfxItemSet& rSet ) |* \************************************************************************/ -void E3dExtrudeObj::Collect3DAttributes(SfxItemSet& rAttr) const -{ - // call parent - E3dCompoundObject::Collect3DAttributes(rAttr); - - // special Attr for E3dExtrudeObj - UINT16 nObjPercentDiagonal = (UINT16)((fExtrudePercentDiag * 200.0) + 0.5); - UINT16 nObjBackScale = (UINT16)((fExtrudeBackScale * 100.0) + 0.5); - UINT32 nObjDeepth = (UINT32)(fExtrudeDepth + 0.5); - - // PercentDiagonal - rAttr.Put(SfxUInt16Item(SDRATTR_3DOBJ_PERCENT_DIAGONAL, nObjPercentDiagonal)); - - // BackScale - rAttr.Put(SfxUInt16Item(SDRATTR_3DOBJ_BACKSCALE, nObjBackScale)); - - // ExtrudeDepth - rAttr.Put(SfxUInt32Item(SDRATTR_3DOBJ_DEPTH, nObjDeepth)); -} +//-/void E3dExtrudeObj::Collect3DAttributes(SfxItemSet& rAttr) const +//-/{ +//-/ // call parent +//-/ E3dCompoundObject::Collect3DAttributes(rAttr); +//-/ +//-/ // special Attr for E3dExtrudeObj +//-///-/ UINT16 nObjPercentDiagonal = (UINT16)((fExtrudePercentDiag * 200.0) + 0.5); +//-/ UINT16 nObjPercentDiagonal = GetPercentDiagonal(); +//-///-/ UINT16 nObjBackScale = (UINT16)((fExtrudeBackScale * 100.0) + 0.5); +//-/ UINT16 nObjBackScale = GetPercentBackScale(); +//-///-/ UINT32 nObjDeepth = (UINT32)(fExtrudeDepth + 0.5); +//-/ UINT32 nObjDeepth = GetExtrudeDepth(); +//-/ +//-/ // PercentDiagonal +//-/ rAttr.Put(Svx3DPercentDiagonalItem(nObjPercentDiagonal)); +//-/ +//-/ // BackScale +//-/ rAttr.Put(Svx3DBackscaleItem(nObjBackScale)); +//-/ +//-/ // ExtrudeDepth +//-/ rAttr.Put(Svx3DDepthItem(nObjDeepth)); +//-/} //-/void E3dExtrudeObj::TakeAttributes(SfxItemSet& rAttr, FASTBOOL bMerge, FASTBOOL bOnlyHardAttr) const //-/{ @@ -952,32 +997,32 @@ SdrAttrObj* E3dExtrudeObj::GetBreakObj() return pPathObj; } -void E3dExtrudeObj::ImpSetExtrudePercentDiag(double fNew) -{ - if(fExtrudePercentDiag != fNew) - { - fExtrudePercentDiag = fNew; - bGeometryValid = FALSE; - } -} +//-/void E3dExtrudeObj::ImpSetExtrudePercentDiag(double fNew) +//-/{ +//-/ if(fExtrudePercentDiag != fNew) +//-/ { +//-/ fExtrudePercentDiag = fNew; +//-/ bGeometryValid = FALSE; +//-/ } +//-/} -void E3dExtrudeObj::ImpSetExtrudeBackScale(double fNew) -{ - if(fExtrudeBackScale != fNew) - { - fExtrudeBackScale = fNew; - bGeometryValid = FALSE; - } -} +//-/void E3dExtrudeObj::ImpSetExtrudeBackScale(double fNew) +//-/{ +//-/ if(fExtrudeBackScale != fNew) +//-/ { +//-/ fExtrudeBackScale = fNew; +//-/ bGeometryValid = FALSE; +//-/ } +//-/} -void E3dExtrudeObj::ImpSetExtrudeDepth(double fNew) -{ - if(fExtrudeDepth != fNew) - { - fExtrudeDepth = fNew; - bGeometryValid = FALSE; - } -} +//-/void E3dExtrudeObj::ImpSetExtrudeDepth(double fNew) +//-/{ +//-/ if(fExtrudeDepth != fNew) +//-/ { +//-/ fExtrudeDepth = fNew; +//-/ bGeometryValid = FALSE; +//-/ } +//-/} // EOF diff --git a/svx/source/engine3d/float3d.cxx b/svx/source/engine3d/float3d.cxx index 0c31db0c1d1b..90dc4429698c 100644 --- a/svx/source/engine3d/float3d.cxx +++ b/svx/source/engine3d/float3d.cxx @@ -2,9 +2,9 @@ * * $RCSfile: float3d.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: aw $ $Date: 2000-10-30 10:55:03 $ + * last change: $Author: aw $ $Date: 2000-11-07 12:52:01 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1530,11 +1530,11 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) { UINT16 nValue = ((const SfxUInt16Item&)rAttrs.Get(SDRATTR_3DOBJ_TEXTURE_KIND)).GetValue(); - if( ( !aBtnTexLuminance.IsChecked() && nValue == 0 ) || - ( !aBtnTexColor.IsChecked() && nValue == 1 ) ) + if( ( !aBtnTexLuminance.IsChecked() && nValue == 1 ) || + ( !aBtnTexColor.IsChecked() && nValue == 3 ) ) { - aBtnTexLuminance.Check( nValue == 0 ); - aBtnTexColor.Check( nValue == 1 ); + aBtnTexLuminance.Check( nValue == 1 ); + aBtnTexColor.Check( nValue == 3 ); bUpdate = TRUE; } } @@ -1555,11 +1555,11 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) { UINT16 nValue = ((const SfxUInt16Item&)rAttrs.Get(SDRATTR_3DOBJ_TEXTURE_MODE)).GetValue(); - if( ( !aBtnTexReplace.IsChecked() && nValue == 0 ) || - ( !aBtnTexModulate.IsChecked() && nValue == 1 ) ) + if( ( !aBtnTexReplace.IsChecked() && nValue == 1 ) || + ( !aBtnTexModulate.IsChecked() && nValue == 2 ) ) { - aBtnTexReplace.Check( nValue == 0 ); - aBtnTexModulate.Check( nValue == 1 ); + aBtnTexReplace.Check( nValue == 1 ); + aBtnTexModulate.Check( nValue == 2 ); //aBtnTexBlend.Check( nValue == 2 ); bUpdate = TRUE; } @@ -1663,10 +1663,12 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) //aLbMatFavorites.SelectEntryPos( 0 ); // Objektfarbe - eState = rAttrs.GetItemState(SDRATTR_3DOBJ_MAT_COLOR); +//-/ eState = rAttrs.GetItemState(SDRATTR_3DOBJ_MAT_COLOR); + eState = rAttrs.GetItemState(XATTR_FILLCOLOR); if( eState != SFX_ITEM_DONTCARE ) { - aColor = ((const SvxColorItem&)rAttrs.Get(SDRATTR_3DOBJ_MAT_COLOR)).GetValue(); +//-/ aColor = ((const SvxColorItem&)rAttrs.Get(SDRATTR_3DOBJ_MAT_COLOR)).GetValue(); + aColor = ((const XFillColorItem&)rAttrs.Get(XATTR_FILLCOLOR)).GetValue(); aCtlLightPreview.GetPreviewControl().SetMaterial( aColor, Base3DMaterialDiffuse ); ColorLB* pLb = &aLbMatColor; if( aColor != pLb->GetSelectEntryColor() ) @@ -2216,13 +2218,13 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) // Texturen // Art - nValue = 99; + nValue = 3; if( aBtnTexLuminance.IsChecked() ) - nValue = 0; - else if( aBtnTexColor.IsChecked() ) nValue = 1; + else if( aBtnTexColor.IsChecked() ) + nValue = 3; - if( nValue <= 1 ) + if( nValue == 1 || nValue == 3 ) rAttrs.Put( SfxUInt16Item( SDRATTR_3DOBJ_TEXTURE_KIND, nValue ) ); else rAttrs.InvalidateItem( SDRATTR_3DOBJ_TEXTURE_KIND ); @@ -2231,13 +2233,13 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) // Modus nValue = 99; if( aBtnTexReplace.IsChecked() ) - nValue = 0; - else if( aBtnTexModulate.IsChecked() ) nValue = 1; + else if( aBtnTexModulate.IsChecked() ) + nValue = 2; //else if( aBtnTexBlend.IsChecked() ) // nValue = 2; - if( nValue <= 2 ) + if( nValue == 1 || nValue == 2 ) rAttrs.Put( SfxUInt16Item( SDRATTR_3DOBJ_TEXTURE_MODE, nValue ) ); else rAttrs.InvalidateItem( SDRATTR_3DOBJ_TEXTURE_MODE ); @@ -2287,11 +2289,12 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) if( aLbMatColor.GetSelectEntryCount() ) { aColor = aLbMatColor.GetSelectEntryColor(); - rAttrs.Put( SvxColorItem( aColor, SDRATTR_3DOBJ_MAT_COLOR ) ); +//-/ rAttrs.Put( SvxColorItem( aColor, SDRATTR_3DOBJ_MAT_COLOR ) ); + rAttrs.Put( XFillColorItem( String(), aColor) ); } else { - rAttrs.InvalidateItem( SDRATTR_3DOBJ_MAT_COLOR ); +//-/ rAttrs.InvalidateItem( SDRATTR_3DOBJ_MAT_COLOR ); rAttrs.InvalidateItem( XATTR_FILLCOLOR ); } diff --git a/svx/source/engine3d/lathe3d.cxx b/svx/source/engine3d/lathe3d.cxx index 0e021083c4c6..5cf7d7273364 100644 --- a/svx/source/engine3d/lathe3d.cxx +++ b/svx/source/engine3d/lathe3d.cxx @@ -2,9 +2,9 @@ * * $RCSfile: lathe3d.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2000-10-30 10:55:03 $ + * last change: $Author: aw $ $Date: 2000-11-07 12:52:01 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -133,7 +133,9 @@ E3dLatheObj::E3dLatheObj(E3dDefaultAttributes& rDefault, const PolyPolygon& rPol // Ueberfluessige Punkte entfernen, insbesondere doppelte // Start- und Endpunkte verhindern aPolyPoly3D.RemoveDoublePoints(); - nVSegments = aPolyPoly3D[0].GetPointCount(); + +//-/ nVSegments = aPolyPoly3D[0].GetPointCount(); + mpObjectItemSet->Put(Svx3DVerticalSegmentsItem(aPolyPoly3D[0].GetPointCount())); // Geometrie erzeugen CreateGeometry(); @@ -157,7 +159,8 @@ E3dLatheObj::E3dLatheObj(E3dDefaultAttributes& rDefault, const XPolyPolygon& rXP // Ueberfluessige Punkte entfernen, insbesondere doppelte // Start- und Endpunkte verhindern aPolyPoly3D.RemoveDoublePoints(); - nVSegments = aPolyPoly3D[0].GetPointCount(); +//-/ nVSegments = aPolyPoly3D[0].GetPointCount(); + mpObjectItemSet->Put(Svx3DVerticalSegmentsItem(aPolyPoly3D[0].GetPointCount())); // Geometrie erzeugen CreateGeometry(); @@ -177,7 +180,8 @@ E3dLatheObj::E3dLatheObj(E3dDefaultAttributes& rDefault, const XPolygon& rXPoly) // Ueberfluessige Punkte entfernen, insbesondere doppelte // Start- und Endpunkte verhindern aPolyPoly3D.RemoveDoublePoints(); - nVSegments = aPolyPoly3D[0].GetPointCount(); +//-/ nVSegments = aPolyPoly3D[0].GetPointCount(); + mpObjectItemSet->Put(Svx3DVerticalSegmentsItem(aPolyPoly3D[0].GetPointCount())); // Geometrie erzeugen CreateGeometry(); @@ -200,7 +204,8 @@ E3dLatheObj::E3dLatheObj (E3dDefaultAttributes& rDefault, const PolyPolygon3D rP // Ueberfluessige Punkte entfernen, insbesondere doppelte // Start- und Endpunkte verhindern aPolyPoly3D.RemoveDoublePoints(); - nVSegments = aPolyPoly3D[0].GetPointCount(); +//-/ nVSegments = aPolyPoly3D[0].GetPointCount(); + mpObjectItemSet->Put(Svx3DVerticalSegmentsItem(aPolyPoly3D[0].GetPointCount())); // Geometrie erzeugen CreateGeometry(); @@ -223,12 +228,14 @@ E3dLatheObj::E3dLatheObj() void E3dLatheObj::SetDefaultAttributes(E3dDefaultAttributes& rDefault) { // Defaults setzen - nHSegments = rDefault.GetDefaultHSegments(); - nVSegments = rDefault.GetDefaultVSegments(); - nEndAngle = rDefault.GetDefaultLatheEndAngle(); + ImpForceItemSet(); + +//-/ nHSegments = rDefault.GetDefaultHSegments(); +//-/ nVSegments = rDefault.GetDefaultVSegments(); +//-/ nEndAngle = rDefault.GetDefaultLatheEndAngle(); fLatheScale = rDefault.GetDefaultLatheScale(); - fLatheBackScale = rDefault.GetDefaultBackScale(); - fLathePercentDiag = rDefault.GetDefaultPercentDiag(); +//-/ fLatheBackScale = rDefault.GetDefaultBackScale(); +//-/ fLathePercentDiag = rDefault.GetDefaultPercentDiag(); bLatheSmoothed = rDefault.GetDefaultLatheSmoothed(); bLatheSmoothFrontBack = rDefault.GetDefaultLatheSmoothFrontBack(); bLatheCharacterMode = rDefault.GetDefaultLatheCharacterMode(); @@ -259,7 +266,7 @@ void E3dLatheObj::CreateGeometry() PolyPolygon3D aLathePoly3D(aPolyPoly3D); // Eventuelle Anpassung der Segmentanzahlen - aLathePoly3D = CreateLathePolyPoly(aPolyPoly3D, nVSegments); + aLathePoly3D = CreateLathePolyPoly(aPolyPoly3D, GetVerticalSegments()); // Normale holen Vector3D aNormal = aLathePoly3D.GetNormal(); @@ -274,11 +281,12 @@ void E3dLatheObj::CreateGeometry() aLathePoly3D.SetDirections(); // Spezialfall Einzelnes Polygon erzeugen - FASTBOOL bSinglePoly = (nEndAngle == 0 || nHSegments == 0); + BOOL bSinglePoly = (GetEndAngle() == 0 || GetHorizontalSegments() == 0); if(bSinglePoly) { // nur ein Polygon erzeugen - bDoubleSided = TRUE; +//-/ bDoubleSided = TRUE; + mpObjectItemSet->Put(Svx3DDoubleSidedItem(TRUE)); // Fuer evtl. selbst erzeugte Normalen PolyPolygon3D aNormalsFront; @@ -291,22 +299,27 @@ void E3dLatheObj::CreateGeometry() { // Eventuell doppelseitig erzeugen? if(!aLathePoly3D.IsClosed()) - bDoubleSided = TRUE; +//-/ bDoubleSided = TRUE; + mpObjectItemSet->Put(Svx3DDoubleSidedItem(TRUE)); // Seiten genenrieren? - BOOL bCreateSides = ((nEndAngle < 3600 && !bDoubleSided) || (fLatheBackScale != 1.0)); +//-/ BOOL bCreateSides = ((GetEndAngle() < 3600 && !GetDoubleSided()) || (fLatheBackScale != 1.0)); + BOOL bCreateSides = ((GetEndAngle() < 3600 && !GetDoubleSided()) + || (GetBackScale() != 100)); // Polygone vorbereiten PolyPolygon3D aPrev, aFront, aBack, aNext; // Rotation vorbereiten - double fAng = DEG2RAD(double(nEndAngle) / 10); + double fAng = DEG2RAD(double(GetEndAngle()) / 10); Matrix4D aRotMat; // Skalierung vorbereiten double fScalePerStep; - if(fLatheBackScale != 1.0) - fScalePerStep = (fLatheBackScale - 1.0) / (double)nHSegments; +//-/ if(fLatheBackScale != 1.0) + if(GetBackScale() != 100) +//-/ fScalePerStep = (fLatheBackScale - 1.0) / (double)GetHorizontalSegments(); + fScalePerStep = (((double)GetBackScale() - 100.0) / 100.0) / (double)GetHorizontalSegments(); // Texturen erzeugen? double fTextureDepth=1.0; @@ -315,42 +328,46 @@ void E3dLatheObj::CreateGeometry() fTextureStart = fTextureDepth = 0.0; // aPrev bis aBack ausfuellen als Startvorbereitung - aRotMat.RotateY(-(fAng / (double)nHSegments)); + aRotMat.RotateY(-(fAng / (double)GetHorizontalSegments())); aPrev = aLathePoly3D; RotatePoly(aPrev, aRotMat); - if(fLatheBackScale != 1.0) +//-/ if(fLatheBackScale != 1.0) + if(GetBackScale() != 100) { ScalePoly(aPrev, 1.0 - fScalePerStep); } aRotMat.Identity(); - aRotMat.RotateY(fAng / (double)nHSegments); + aRotMat.RotateY(fAng / (double)GetHorizontalSegments()); aFront = aLathePoly3D; aBack = aLathePoly3D; RotatePoly(aBack, aRotMat); - if(fLatheBackScale != 1.0) +//-/ if(fLatheBackScale != 1.0) + if(GetBackScale() != 100) { ScalePoly(aBack, 1.0 + fScalePerStep); } // Werte fuer Textur-Zwischensegmenterzeugung berechnen double fTmpStart = 0.0; - double fTmpLength = fTextureDepth / (double)nHSegments; + double fTmpLength = fTextureDepth / (double)GetHorizontalSegments(); + sal_uInt16 nUpperBound = (sal_uInt16)GetHorizontalSegments(); - for(UINT16 a=0;a<nHSegments;a++) + for(UINT16 a=0;a<nUpperBound;a++) { // Naechstes Polygon vorbereiten aNext = aLathePoly3D; // Rotieren - if(!(a+2 == nHSegments && nEndAngle == 3600)) + if(!(a+2 == nUpperBound && GetEndAngle() == 3600)) { aRotMat.Identity(); - aRotMat.RotateY((fAng * (double)(a+2))/ (double)nHSegments); + aRotMat.RotateY((fAng * (double)(a+2))/ (double)nUpperBound); RotatePoly(aNext, aRotMat); } // Skalieren - if(fLatheBackScale != 1.0) +//-/ if(fLatheBackScale != 1.0) + if(GetBackScale() != 100) { ScalePoly(aNext, 1.0 + (fScalePerStep * (double)(a+2))); } @@ -362,8 +379,10 @@ void E3dLatheObj::CreateGeometry() &aPrev, &aNext, (a == 0) && bCreateSides && bLatheCloseFront, - (a == nHSegments-1) && bCreateSides && bLatheCloseBack, - fLathePercentDiag * (double(nHSegments) / 6.0), + (a == nUpperBound-1) && bCreateSides && bLatheCloseBack, +//-/ fLathePercentDiag + ((double)GetPercentDiagonal() / 200.0) + * (double(nUpperBound) / 6.0), GetLatheSmoothed(), GetLatheSmoothed(), GetLatheSmoothFrontBack(), @@ -397,7 +416,8 @@ PolyPolygon3D E3dLatheObj::CreateLathePolyPoly(PolyPolygon3D& rPolyPoly3D, long { // Erstes Polygon anpassen aLathePolyPolygon3D[0] = CreateLathePoly(aLathePolyPolygon3D[0], nVSegs); - nVSegments = aLathePolyPolygon3D[0].GetPointCount(); +//-/ nVSegments = aLathePolyPolygon3D[0].GetPointCount(); + mpObjectItemSet->Put(Svx3DVerticalSegmentsItem(aLathePolyPolygon3D[0].GetPointCount())); // andere Polygone im richtigen Verhaeltnis anpassen, // aber nur, wenn Wert fuer erstes angepasst werden musste @@ -484,14 +504,14 @@ void E3dLatheObj::operator=(const SdrObject& rObj) const E3dLatheObj& r3DObj = (const E3dLatheObj&)rObj; aPolyPoly3D = r3DObj.aPolyPoly3D; - nHSegments = r3DObj.nHSegments; - nVSegments = r3DObj.nVSegments; - nEndAngle = r3DObj.nEndAngle; +//-/ nHSegments = r3DObj.nHSegments; +//-/ nVSegments = r3DObj.nVSegments; +//-/ nEndAngle = r3DObj.nEndAngle; fLatheScale = r3DObj.fLatheScale; // Ab Version 374 (15.12.97) - fLatheBackScale = r3DObj.fLatheBackScale; - fLathePercentDiag = r3DObj.fLathePercentDiag; +//-/ fLatheBackScale = r3DObj.fLatheBackScale; +//-/ fLathePercentDiag = r3DObj.fLathePercentDiag; bLatheSmoothed = r3DObj.bLatheSmoothed; bLatheSmoothFrontBack = r3DObj.bLatheSmoothFrontBack; bLatheCharacterMode = r3DObj.bLatheCharacterMode; @@ -543,18 +563,28 @@ void E3dLatheObj::WriteData(SvStream& rOut) const // rOut << aPolyPoly3D; rOut << aPolyPoly3D[0]; - rOut << nHSegments; - rOut << nEndAngle; - rOut << ((E3dLatheObj*)this)->bDoubleSided; +//-/ rOut << nHSegments; + rOut << GetHorizontalSegments(); + +//-/ rOut << nEndAngle; + rOut << GetEndAngle(); + + rOut << ((E3dLatheObj*)this)->GetDoubleSided(); rOut << fLatheScale; // Ab Version 364f (19.06.97) - rOut << nVSegments; +//-/ rOut << nVSegments; + rOut << GetVerticalSegments(); // Ab Version 374 (15.12.97) rOut << aPolyPoly3D; - rOut << fLatheBackScale; - rOut << fLathePercentDiag; + +//-/ rOut << fLatheBackScale; + rOut << ((double)GetBackScale() / 100.0); + +//-/ rOut << fLathePercentDiag; + rOut << ((double)GetPercentDiagonal() / 200.0); + rOut << (BOOL)bLatheSmoothed; rOut << (BOOL)bLatheSmoothFrontBack; rOut << (BOOL)bLatheCharacterMode; @@ -565,21 +595,49 @@ void E3dLatheObj::WriteData(SvStream& rOut) const // bisher NOCH NIE gespeichert (Grrr). Diese Stelle muss nun natuerlich // auch IMMER MITGEPFLEGT werden, wenn sich Parameter in // E3dCompoundObject oder E3dObject aendern. - rOut << BOOL(bDoubleSided); + rOut << GetDoubleSided(); + rOut << BOOL(bCreateNormals); rOut << BOOL(bCreateTexture); - rOut << BOOL(bUseStdNormals); - rOut << BOOL(bUseStdNormalsUseSphere); - rOut << BOOL(bUseStdTextureX); - rOut << BOOL(bUseStdTextureXUseSphere); - rOut << BOOL(bUseStdTextureY); - rOut << BOOL(bUseStdTextureYUseSphere); - rOut << BOOL(bShadow3D); - aFrontMaterial.WriteData(rOut); + +//-/ rOut << BOOL(bUseStdNormals); +//-/ rOut << BOOL(bUseStdNormalsUseSphere); + sal_uInt16 nVal = GetNormalsKind(); + rOut << BOOL(nVal > 0); + rOut << BOOL(nVal > 1); + +//-/ rOut << BOOL(bUseStdTextureX); +//-/ rOut << BOOL(bUseStdTextureXUseSphere); + nVal = GetTextureProjectionX(); + rOut << BOOL(nVal > 0); + rOut << BOOL(nVal > 1); + +//-/ rOut << BOOL(bUseStdTextureY); +//-/ rOut << BOOL(bUseStdTextureYUseSphere); + nVal = GetTextureProjectionY(); + rOut << BOOL(nVal > 0); + rOut << BOOL(nVal > 1); + +//-/ rOut << BOOL(bShadow3D); + rOut << BOOL(GetShadow3D()); + +//-/ aFrontMaterial.WriteData(rOut); + rOut << GetMaterialAmbientColor(); + rOut << GetMaterialColor(); + rOut << GetMaterialSpecular(); + rOut << GetMaterialEmission(); + rOut << GetMaterialSpecularIntensity(); + aBackMaterial.WriteData(rOut); - rOut << (UINT16)eTextureKind; - rOut << (UINT16)eTextureMode; - rOut << BOOL(bInvertNormals); + +//-/ rOut << (UINT16)eTextureKind; + rOut << (UINT16)GetTextureKind(); + +//-/ rOut << (UINT16)eTextureMode; + rOut << (UINT16)GetTextureMode(); + +//-/ rOut << BOOL(bInvertNormals); + rOut << BOOL(GetNormalsInvert()); // Ab Version 513a (5.2.99): Parameter fuer das // Erzeugen der Vorder/Rueckwand @@ -587,7 +645,8 @@ void E3dLatheObj::WriteData(SvStream& rOut) const rOut << BOOL(bLatheCloseBack); // neu ab 534: (hat noch gefehlt) - rOut << BOOL(bFilterTexture); +//-/ rOut << BOOL(bFilterTexture); + rOut << BOOL(GetTextureFilter()); if(nVersion < 3800) { @@ -638,22 +697,35 @@ void E3dLatheObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn) { // neue Member BOOL bTmp; + sal_Int32 nTmp; // alte Version holt sich nur ein Polygon3D, wird hier durch // Eintragen als erstes Teilpolygon geladen // rIn >> aPolyPoly3D; rIn >> aPolyPoly3D[0]; - rIn >> nHSegments; - rIn >> nEndAngle; - rIn >> bTmp; bDoubleSided = bTmp; +//-/ rIn >> nHSegments; + rIn >> nTmp; + mpObjectItemSet->Put(Svx3DHorizontalSegmentsItem(nTmp)); + +//-/ rIn >> nEndAngle; + rIn >> nTmp; + mpObjectItemSet->Put(Svx3DEndAngleItem(nTmp)); + +//-/ rIn >> bTmp; bDoubleSided = bTmp; + rIn >> bTmp; + mpObjectItemSet->Put(Svx3DDoubleSidedItem(bTmp)); + rIn >> fLatheScale; } if (aCompat.GetBytesLeft()) { // Ab Version 364f (19.06.97) - rIn >> nVSegments; +//-/ rIn >> nVSegments; + sal_Int32 nTmp; + rIn >> nTmp; + mpObjectItemSet->Put(Svx3DVerticalSegmentsItem(nTmp)); } if (aCompat.GetBytesLeft()) @@ -661,11 +733,18 @@ void E3dLatheObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn) // Ab Version 374 (15.12.97) // Gesamtes PolyPolygon laden BOOL bTmp; + double fTmp; aPolyPoly3D.Clear(); rIn >> aPolyPoly3D; - rIn >> fLatheBackScale; - rIn >> fLathePercentDiag; + +//-/ rIn >> fLatheBackScale; + rIn >> fTmp; + mpObjectItemSet->Put(Svx3DBackscaleItem((sal_uInt16)(fTmp * 100.0))); + +//-/ rIn >> fLathePercentDiag; + rIn >> fTmp; + mpObjectItemSet->Put(Svx3DPercentDiagonalItem(sal_uInt16(fTmp * 200.0))); rIn >> bTmp; bLatheSmoothed = bTmp; rIn >> bTmp; bLatheSmoothFrontBack = bTmp; @@ -674,8 +753,11 @@ void E3dLatheObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn) else { // Geometrie aus erzeugten PolyObj's rekonstruieren - fLatheBackScale = 1.0; - fLathePercentDiag = 0.05; +//-/ fLatheBackScale = 1.0; + mpObjectItemSet->Put(Svx3DBackscaleItem(100)); + +//-/ fLathePercentDiag = 0.05; + mpObjectItemSet->Put(Svx3DPercentDiagonalItem(10)); bLatheSmoothed = TRUE; bLatheSmoothFrontBack = FALSE; @@ -690,23 +772,89 @@ void E3dLatheObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn) // bisher NOCH NIE gespeichert (Grrr). Diese Stelle muss nun natuerlich // auch IMMER MITGEPFLEGT werden, wenn sich Parameter in // E3dCompoundObject oder E3dObject aendern. - BOOL bTmp; + BOOL bTmp, bTmp2; + sal_uInt16 nTmp; + +//-/ rIn >> bTmp; bDoubleSided = bTmp; + rIn >> bTmp; + mpObjectItemSet->Put(Svx3DDoubleSidedItem(bTmp)); - rIn >> bTmp; bDoubleSided = bTmp; rIn >> bTmp; bCreateNormals = bTmp; rIn >> bTmp; bCreateTexture = bTmp; - rIn >> bTmp; bUseStdNormals = bTmp; - rIn >> bTmp; bUseStdNormalsUseSphere = bTmp; - rIn >> bTmp; bUseStdTextureX = bTmp; - rIn >> bTmp; bUseStdTextureXUseSphere = bTmp; - rIn >> bTmp; bUseStdTextureY = bTmp; - rIn >> bTmp; bUseStdTextureYUseSphere = bTmp; - rIn >> bTmp; bShadow3D = bTmp; - aFrontMaterial.ReadData(rIn); + +//-/ rIn >> bTmp; bUseStdNormals = bTmp; +//-/ rIn >> bTmp; bUseStdNormalsUseSphere = bTmp; + rIn >> bTmp; + rIn >> bTmp2; + if(bTmp == FALSE && bTmp2 == FALSE) + nTmp = 0; + else if(bTmp == TRUE && bTmp2 == FALSE) + nTmp = 1; + else + nTmp = 2; + mpObjectItemSet->Put(Svx3DNormalsKindItem(nTmp)); + +//-/ rIn >> bTmp; bUseStdTextureX = bTmp; +//-/ rIn >> bTmp; bUseStdTextureXUseSphere = bTmp; + rIn >> bTmp; + rIn >> bTmp2; + if(bTmp == FALSE && bTmp2 == FALSE) + nTmp = 0; + else if(bTmp == TRUE && bTmp2 == FALSE) + nTmp = 1; + else + nTmp = 2; + mpObjectItemSet->Put(Svx3DTextureProjectionXItem(nTmp)); + +//-/ rIn >> bTmp; bUseStdTextureY = bTmp; +//-/ rIn >> bTmp; bUseStdTextureYUseSphere = bTmp; + rIn >> bTmp; + rIn >> bTmp2; + if(bTmp == FALSE && bTmp2 == FALSE) + nTmp = 0; + else if(bTmp == TRUE && bTmp2 == FALSE) + nTmp = 1; + else + nTmp = 2; + mpObjectItemSet->Put(Svx3DTextureProjectionYItem(nTmp)); + +//-/ rIn >> bTmp; bShadow3D = bTmp; + rIn >> bTmp; + mpObjectItemSet->Put(Svx3DShadow3DItem(bTmp)); + +//-/ aFrontMaterial.ReadData(rIn); + Color aCol; + + rIn >> aCol; + SetMaterialAmbientColor(aCol); + + rIn >> aCol; +//-/ SetItem(Svx3DMaterialColorItem(aCol)); + // do NOT use, this is the old 3D-Color(!) + // SetItem(XFillColorItem(String(), aCol)); + + rIn >> aCol; + mpObjectItemSet->Put(Svx3DMaterialSpecularItem(aCol)); + + rIn >> aCol; + mpObjectItemSet->Put(Svx3DMaterialEmissionItem(aCol)); + + rIn >> nTmp; + mpObjectItemSet->Put(Svx3DMaterialSpecularIntensityItem(nTmp)); + aBackMaterial.ReadData(rIn); - rIn >> nTmp16; eTextureKind = Base3DTextureKind(nTmp16); - rIn >> nTmp16; eTextureMode = Base3DTextureMode(nTmp16); - rIn >> bTmp; bInvertNormals = bTmp; + +//-/ rIn >> nTmp16; eTextureKind = Base3DTextureKind(nTmp16); + rIn >> nTmp; + mpObjectItemSet->Put(Svx3DTextureKindItem(nTmp)); + +//-/ rIn >> nTmp16; eTextureMode = Base3DTextureMode(nTmp16); + rIn >> nTmp; + mpObjectItemSet->Put(Svx3DTextureModeItem(nTmp)); + +//-/ rIn >> bTmp; bInvertNormals = bTmp; + rIn >> bTmp; + mpObjectItemSet->Put(Svx3DNormalsInvertItem(bTmp)); } if (aCompat.GetBytesLeft()) @@ -728,7 +876,9 @@ void E3dLatheObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn) if (aCompat.GetBytesLeft () >= sizeof (BOOL)) { BOOL bTmp; - rIn >> bTmp; bFilterTexture = bTmp; +//-/ rIn >> bTmp; bFilterTexture = bTmp; + rIn >> bTmp; + mpObjectItemSet->Put(Svx3DTextureFilterItem(bTmp)); } } @@ -755,11 +905,14 @@ SdrObject *E3dLatheObj::DoConvertToPolyObj(BOOL bBezier) const void E3dLatheObj::ReSegment(long nHSegs, long nVSegs) { - if ((nHSegs != nHSegments || nVSegs != nVSegments) && + if ((nHSegs != GetHorizontalSegments() || nVSegs != GetVerticalSegments()) && (nHSegs != 0 || nVSegs != 0)) { - nHSegments = nHSegs; - nVSegments = nVSegs; +//-/ nHSegments = nHSegs; + mpObjectItemSet->Put(Svx3DHorizontalSegmentsItem(nHSegs)); + +//-/ nVSegments = nVSegs; + mpObjectItemSet->Put(Svx3DVerticalSegmentsItem(nVSegs)); bGeometryValid = FALSE; } @@ -881,32 +1034,37 @@ void E3dLatheObj::ImpLocalItemValueChange(const SfxPoolItem& rNew) { case SDRATTR_3DOBJ_HORZ_SEGS: { - UINT32 nNew = ((const Svx3DHorizontalSegmentsItem&)rNew).GetValue(); - ImpSetHSegments(nNew); + bGeometryValid = FALSE; +//-/ UINT32 nNew = ((const Svx3DHorizontalSegmentsItem&)rNew).GetValue(); +//-/ ImpSetHSegments(nNew); break; } case SDRATTR_3DOBJ_VERT_SEGS: { - UINT32 nNew = ((const Svx3DVerticalSegmentsItem&)rNew).GetValue(); - ImpSetVSegments(nNew); + bGeometryValid = FALSE; +//-/ UINT32 nNew = ((const Svx3DVerticalSegmentsItem&)rNew).GetValue(); +//-/ ImpSetVSegments(nNew); break; } case SDRATTR_3DOBJ_PERCENT_DIAGONAL: { - UINT16 nNew = ((const Svx3DPercentDiagonalItem&)rNew).GetValue(); - ImpSetLathePercentDiag((double)nNew / 200.0); + bGeometryValid = FALSE; +//-/ UINT16 nNew = ((const Svx3DPercentDiagonalItem&)rNew).GetValue(); +//-/ ImpSetLathePercentDiag((double)nNew / 200.0); break; } case SDRATTR_3DOBJ_BACKSCALE: { - UINT16 nNew = ((const Svx3DBackscaleItem&)rNew).GetValue(); - ImpSetLatheBackScale((double)nNew / 100.0); + bGeometryValid = FALSE; +//-/ UINT16 nNew = ((const Svx3DBackscaleItem&)rNew).GetValue(); +//-/ ImpSetLatheBackScale((double)nNew / 100.0); break; } case SDRATTR_3DOBJ_END_ANGLE: { - UINT16 nNew = ((const Svx3DEndAngleItem&)rNew).GetValue(); - ImpSetEndAngle((long)nNew); + bGeometryValid = FALSE; +//-/ UINT16 nNew = ((const Svx3DEndAngleItem&)rNew).GetValue(); +//-/ ImpSetEndAngle((long)nNew); break; } } @@ -942,7 +1100,8 @@ void E3dLatheObj::SetItemSet( const SfxItemSet& rSet ) // handle value change for(sal_uInt16 nWhich(SDRATTR_3DOBJ_PERCENT_DIAGONAL); nWhich <= SDRATTR_3DOBJ_END_ANGLE; nWhich++) - ImpLocalItemValueChange(rSet.Get(nWhich)); + if(SFX_ITEM_SET == rSet.GetItemState(nWhich, FALSE)) + ImpLocalItemValueChange(rSet.Get(nWhich)); } //-/void E3dLatheObj::NbcSetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll) @@ -986,33 +1145,33 @@ void E3dLatheObj::SetItemSet( const SfxItemSet& rSet ) |* \************************************************************************/ -void E3dLatheObj::Collect3DAttributes(SfxItemSet& rAttr) const -{ - // call parent - E3dCompoundObject::Collect3DAttributes(rAttr); - - // special Attr for E3dLatheObj - long nObjHorzSegs = nHSegments; - long nObjVertSegs = nVSegments; - UINT16 nObjPercentDiagonal = (UINT16)((fLathePercentDiag * 200.0) + 0.5); - UINT16 nObjBackScale = (UINT16)((fLatheBackScale * 100.0) + 0.5); - UINT16 nObjEndAngle = (UINT16)(nEndAngle + 0.5); - - // HorizSegs - rAttr.Put(SfxUInt32Item(SDRATTR_3DOBJ_HORZ_SEGS, nObjHorzSegs)); - - // VertSegs - rAttr.Put(SfxUInt32Item(SDRATTR_3DOBJ_VERT_SEGS, nObjVertSegs)); - - // PercentDiagonal - rAttr.Put(SfxUInt16Item(SDRATTR_3DOBJ_PERCENT_DIAGONAL, nObjPercentDiagonal)); - - // BackScale - rAttr.Put(SfxUInt16Item(SDRATTR_3DOBJ_BACKSCALE, nObjBackScale)); - - // EndAngle - rAttr.Put(SfxUInt16Item(SDRATTR_3DOBJ_END_ANGLE, nObjEndAngle)); -} +//-/void E3dLatheObj::Collect3DAttributes(SfxItemSet& rAttr) const +//-/{ +//-/ // call parent +//-/ E3dCompoundObject::Collect3DAttributes(rAttr); +//-/ +//-/ // special Attr for E3dLatheObj +//-/ long nObjHorzSegs = nHSegments; +//-/ long nObjVertSegs = nVSegments; +//-/ UINT16 nObjPercentDiagonal = (UINT16)((fLathePercentDiag * 200.0) + 0.5); +//-/ UINT16 nObjBackScale = (UINT16)((fLatheBackScale * 100.0) + 0.5); +//-/ UINT16 nObjEndAngle = (UINT16)(nEndAngle + 0.5); +//-/ +//-/ // HorizSegs +//-/ rAttr.Put(Svx3DHorizontalSegmentsItem(nObjHorzSegs)); +//-/ +//-/ // VertSegs +//-/ rAttr.Put(Svx3DVerticalSegmentsItem(nObjVertSegs)); +//-/ +//-/ // PercentDiagonal +//-/ rAttr.Put(Svx3DPercentDiagonalItem(nObjPercentDiagonal)); +//-/ +//-/ // BackScale +//-/ rAttr.Put(Svx3DBackscaleItem(nObjBackScale)); +//-/ +//-/ // EndAngle +//-/ rAttr.Put(Svx3DEndAngleItem(nObjEndAngle)); +//-/} //-/void E3dLatheObj::TakeAttributes(SfxItemSet& rAttr, FASTBOOL bMerge, FASTBOOL bOnlyHardAttr) const //-/{ @@ -1200,50 +1359,49 @@ SdrAttrObj* E3dLatheObj::GetBreakObj() return pPathObj; } -void E3dLatheObj::ImpSetHSegments(long nNew) -{ - if(nHSegments != nNew) - { - nHSegments = nNew; - bGeometryValid = FALSE; - } -} - -void E3dLatheObj::ImpSetVSegments(long nNew) -{ - if(nVSegments != nNew) - { - nVSegments = nNew; - bGeometryValid = FALSE; - } -} +//-/void E3dLatheObj::ImpSetHSegments(long nNew) +//-/{ +//-/ if(nHSegments != nNew) +//-/ { +//-/ nHSegments = nNew; +//-/ bGeometryValid = FALSE; +//-/ } +//-/} -void E3dLatheObj::ImpSetLathePercentDiag(double fNew) -{ - if(fLathePercentDiag != fNew) - { - fLathePercentDiag = fNew; - bGeometryValid = FALSE; - } -} +//-/void E3dLatheObj::ImpSetVSegments(long nNew) +//-/{ +//-/ if(nVSegments != nNew) +//-/ { +//-/ nVSegments = nNew; +//-/ bGeometryValid = FALSE; +//-/ } +//-/} -void E3dLatheObj::ImpSetLatheBackScale(double fNew) -{ - if(fLatheBackScale != fNew) - { - fLatheBackScale = fNew; - bGeometryValid = FALSE; - } -} +//-/void E3dLatheObj::ImpSetLathePercentDiag(double fNew) +//-/{ +//-/ if(fLathePercentDiag != fNew) +//-/ { +//-/ fLathePercentDiag = fNew; +//-/ bGeometryValid = FALSE; +//-/ } +//-/} -void E3dLatheObj::ImpSetEndAngle(long nNew) -{ - if(nEndAngle != nNew) - { - nEndAngle = nNew; - bGeometryValid = FALSE; - } -} +//-/void E3dLatheObj::ImpSetLatheBackScale(double fNew) +//-/{ +//-/ if(fLatheBackScale != fNew) +//-/ { +//-/ fLatheBackScale = fNew; +//-/ bGeometryValid = FALSE; +//-/ } +//-/} +//-/void E3dLatheObj::ImpSetEndAngle(long nNew) +//-/{ +//-/ if(nEndAngle != nNew) +//-/ { +//-/ nEndAngle = nNew; +//-/ bGeometryValid = FALSE; +//-/ } +//-/} // EOF diff --git a/svx/source/engine3d/obj3d.cxx b/svx/source/engine3d/obj3d.cxx index e744ee7b4338..2b60435f5dbe 100644 --- a/svx/source/engine3d/obj3d.cxx +++ b/svx/source/engine3d/obj3d.cxx @@ -2,9 +2,9 @@ * * $RCSfile: obj3d.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: aw $ $Date: 2000-10-31 12:43:34 $ + * last change: $Author: aw $ $Date: 2000-11-07 12:52:01 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -2068,12 +2068,12 @@ void E3dObject::AfterRead() pSub->AfterRead(); // put loaded items to ItemSet - Collect3DAttributes((SfxItemSet&)GetItemSet()); +//-/ Collect3DAttributes((SfxItemSet&)GetItemSet()); } -void E3dObject::Collect3DAttributes(SfxItemSet& rAttr) const -{ -} +//-/void E3dObject::Collect3DAttributes(SfxItemSet& rAttr) const +//-/{ +//-/} /************************************************************************* |* @@ -2232,22 +2232,24 @@ E3dCompoundObject::E3dCompoundObject(E3dDefaultAttributes& rDefault) : E3dObject void E3dCompoundObject::SetDefaultAttributes(E3dDefaultAttributes& rDefault) { // Defaults setzen - aFrontMaterial = rDefault.GetDefaultFrontMaterial(); +//-/ SetFrontMaterial(rDefault.GetDefaultFrontMaterial()); + aMaterialAmbientColor = rDefault.GetDefaultAmbientColor(); + aBackMaterial = rDefault.GetDefaultBackMaterial(); - eTextureKind = rDefault.GetDefaultTextureKind(); - eTextureMode = rDefault.GetDefaultTextureMode(); - bDoubleSided = rDefault.GetDefaultDoubleSided(); +//-/ eTextureKind = rDefault.GetDefaultTextureKind(); +//-/ eTextureMode = rDefault.GetDefaultTextureMode(); +//-/ bDoubleSided = rDefault.GetDefaultDoubleSided(); bCreateNormals = rDefault.GetDefaultCreateNormals(); bCreateTexture = rDefault.GetDefaultCreateTexture(); - bUseStdNormals = rDefault.GetDefaultUseStdNormals(); - bUseStdNormalsUseSphere = rDefault.GetDefaultUseStdNormalsUseSphere(); - bInvertNormals = rDefault.GetDefaultInvertNormals(); - bUseStdTextureX = rDefault.GetDefaultUseStdTextureX(); - bUseStdTextureXUseSphere = rDefault.GetDefaultUseStdTextureXUseSphere(); - bUseStdTextureY = rDefault.GetDefaultUseStdTextureY(); - bUseStdTextureYUseSphere = rDefault.GetDefaultUseStdTextureYUseSphere(); - bShadow3D = rDefault.GetDefaultShadow3D(); - bFilterTexture = rDefault.GetDefaultFilterTexture(); +//-/ bUseStdNormals = rDefault.GetDefaultUseStdNormals(); +//-/ bUseStdNormalsUseSphere = rDefault.GetDefaultUseStdNormalsUseSphere(); +//-/ bInvertNormals = rDefault.GetDefaultInvertNormals(); +//-/ bUseStdTextureX = rDefault.GetDefaultUseStdTextureX(); +//-/ bUseStdTextureXUseSphere = rDefault.GetDefaultUseStdTextureXUseSphere(); +//-/ bUseStdTextureY = rDefault.GetDefaultUseStdTextureY(); +//-/ bUseStdTextureYUseSphere = rDefault.GetDefaultUseStdTextureYUseSphere(); +//-/ bShadow3D = rDefault.GetDefaultShadow3D(); +//-/ bFilterTexture = rDefault.GetDefaultFilterTexture(); bUseDifferentBackMaterial = rDefault.GetDefaultUseDifferentBackMaterial(); } @@ -2430,31 +2432,58 @@ void E3dCompoundObject::WriteData(SvStream& rOut) const #ifdef DBG_UTIL aCompat.SetID("E3dCompoundObject"); #endif - rOut << BOOL(bDoubleSided); +//-/ rOut << BOOL(bDoubleSided); + rOut << BOOL(GetDoubleSided()); #endif // neue Parameter zur Geometrieerzeugung rOut << BOOL(bCreateNormals); rOut << BOOL(bCreateTexture); - rOut << BOOL(bUseStdNormals); - rOut << BOOL(bUseStdNormalsUseSphere); - rOut << BOOL(bUseStdTextureX); - rOut << BOOL(bUseStdTextureXUseSphere); - rOut << BOOL(bUseStdTextureY); - rOut << BOOL(bUseStdTextureYUseSphere); - rOut << BOOL(bShadow3D); + +//-/ rOut << BOOL(bUseStdNormals); +//-/ rOut << BOOL(bUseStdNormalsUseSphere); + sal_uInt16 nVal = GetNormalsKind(); + rOut << BOOL(nVal > 0); + rOut << BOOL(nVal > 1); + +//-/ rOut << BOOL(bUseStdTextureX); +//-/ rOut << BOOL(bUseStdTextureXUseSphere); + nVal = GetTextureProjectionX(); + rOut << BOOL(nVal > 0); + rOut << BOOL(nVal > 1); + +//-/ rOut << BOOL(bUseStdTextureY); +//-/ rOut << BOOL(bUseStdTextureYUseSphere); + nVal = GetTextureProjectionY(); + rOut << BOOL(nVal > 0); + rOut << BOOL(nVal > 1); + +//-/ rOut << BOOL(bShadow3D); + rOut << BOOL(GetShadow3D()); // neu al 384: - aFrontMaterial.WriteData(rOut); +//-/ aFrontMaterial.WriteData(rOut); + rOut << GetMaterialAmbientColor(); + rOut << GetMaterialColor(); + rOut << GetMaterialSpecular(); + rOut << GetMaterialEmission(); + rOut << GetMaterialSpecularIntensity(); + aBackMaterial.WriteData(rOut); - rOut << (UINT16)eTextureKind; - rOut << (UINT16)eTextureMode; - rOut << BOOL(bInvertNormals); + +//-/ rOut << (UINT16)eTextureKind; + rOut << (UINT16)GetTextureKind(); + +//-/ rOut << (UINT16)eTextureMode; + rOut << (UINT16)GetTextureMode(); + +//-/ rOut << BOOL(bInvertNormals); + rOut << BOOL(GetNormalsInvert()); // neu ab 534: (hat noch gefehlt) - rOut << BOOL(bFilterTexture); +//-/ rOut << BOOL(bFilterTexture); + rOut << BOOL(GetTextureFilter()); } - } /************************************************************************* @@ -2485,21 +2514,68 @@ void E3dCompoundObject::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn) bBytesLeft = FALSE; if (aCompat.GetBytesLeft () >= sizeof (BOOL)) { - BOOL bTmp; - rIn >> bTmp; bDoubleSided = bTmp; + BOOL bTmp, bTmp2; + sal_uInt16 nTmp; + + rIn >> bTmp; + mpObjectItemSet->Put(Svx3DDoubleSidedItem(bTmp)); +//-/ bDoubleSided = bTmp; // neue Parameter zur Geometrieerzeugung if (aCompat.GetBytesLeft () >= sizeof (BOOL)) { - rIn >> bTmp; bCreateNormals = bTmp; - rIn >> bTmp; bCreateTexture = bTmp; - rIn >> bTmp; bUseStdNormals = bTmp; - rIn >> bTmp; bUseStdNormalsUseSphere = bTmp; - rIn >> bTmp; bUseStdTextureX = bTmp; - rIn >> bTmp; bUseStdTextureXUseSphere = bTmp; - rIn >> bTmp; bUseStdTextureY = bTmp; - rIn >> bTmp; bUseStdTextureYUseSphere = bTmp; - rIn >> bTmp; bShadow3D = bTmp; + rIn >> bTmp; + bCreateNormals = bTmp; + + rIn >> bTmp; + bCreateTexture = bTmp; + +//-/ rIn >> bTmp; +//-/ bUseStdNormals = bTmp; +//-/ rIn >> bTmp; +//-/ bUseStdNormalsUseSphere = bTmp; + rIn >> bTmp; + rIn >> bTmp2; + if(bTmp == FALSE && bTmp2 == FALSE) + nTmp = 0; + else if(bTmp == TRUE && bTmp2 == FALSE) + nTmp = 1; + else + nTmp = 2; + mpObjectItemSet->Put(Svx3DNormalsKindItem(nTmp)); + +//-/ rIn >> bTmp; +//-/ bUseStdTextureX = bTmp; +//-/ rIn >> bTmp; +//-/ bUseStdTextureXUseSphere = bTmp; + rIn >> bTmp; + rIn >> bTmp2; + if(bTmp == FALSE && bTmp2 == FALSE) + nTmp = 0; + else if(bTmp == TRUE && bTmp2 == FALSE) + nTmp = 1; + else + nTmp = 2; + mpObjectItemSet->Put(Svx3DTextureProjectionXItem(nTmp)); + +//-/ rIn >> bTmp; +//-/ bUseStdTextureY = bTmp; +//-/ rIn >> bTmp; +//-/ bUseStdTextureYUseSphere = bTmp; + rIn >> bTmp; + rIn >> bTmp2; + if(bTmp == FALSE && bTmp2 == FALSE) + nTmp = 0; + else if(bTmp == TRUE && bTmp2 == FALSE) + nTmp = 1; + else + nTmp = 2; + mpObjectItemSet->Put(Svx3DTextureProjectionYItem(nTmp)); + + rIn >> bTmp; +//-/ bShadow3D = bTmp; + mpObjectItemSet->Put(Svx3DShadow3DItem(bTmp)); + // Setze ein Flag fuer den Aufrufer, dass neues Format // zu lesen ist bBytesLeft = TRUE; @@ -2509,17 +2585,48 @@ void E3dCompoundObject::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn) if (aCompat.GetBytesLeft () >= sizeof (B3dMaterial)) { UINT16 nTmp; - aFrontMaterial.ReadData(rIn); + +//-/ aFrontMaterial.ReadData(rIn); + Color aCol; + + rIn >> aCol; + SetMaterialAmbientColor(aCol); + + rIn >> aCol; +//-/ SetItem(Svx3DMaterialColorItem(aCol)); + // do NOT use, this is the old 3D-Color(!) + // SetItem(XFillColorItem(String(), aCol)); + + rIn >> aCol; + mpObjectItemSet->Put(Svx3DMaterialSpecularItem(aCol)); + + rIn >> aCol; + mpObjectItemSet->Put(Svx3DMaterialEmissionItem(aCol)); + + rIn >> nTmp; + mpObjectItemSet->Put(Svx3DMaterialSpecularIntensityItem(nTmp)); + aBackMaterial.ReadData(rIn); - rIn >> nTmp; eTextureKind = (Base3DTextureKind)nTmp; - rIn >> nTmp; eTextureMode = (Base3DTextureMode)nTmp; - rIn >> bTmp; bInvertNormals = bTmp; + + rIn >> nTmp; +//-/ eTextureKind = (Base3DTextureKind)nTmp; + mpObjectItemSet->Put(Svx3DTextureKindItem(nTmp)); + + rIn >> nTmp; +//-/ eTextureMode = (Base3DTextureMode)nTmp; + mpObjectItemSet->Put(Svx3DTextureModeItem(nTmp)); + + rIn >> bTmp; +//-/ bInvertNormals = bTmp; + mpObjectItemSet->Put(Svx3DNormalsInvertItem(bTmp)); } // neu ab 534: (hat noch gefehlt) if (aCompat.GetBytesLeft () >= sizeof (BOOL)) { - rIn >> bTmp; bFilterTexture = bTmp; + rIn >> bTmp; +//-/ bFilterTexture = bTmp; + mpObjectItemSet->Put(Svx3DTextureFilterItem(bTmp)); } } } @@ -2722,18 +2829,23 @@ void E3dCompoundObject::CreateGeometry() // und Default -Normalen oder -Texturkoordinaten erzeugen if(bCreateNormals) { - if(bUseStdNormals && bUseStdNormalsUseSphere) +//-/ if(bUseStdNormals && bUseStdNormalsUseSphere) + if(GetNormalsKind() > 1) GetDisplayGeometry().CreateDefaultNormalsSphere(); - if(bInvertNormals) + if(GetNormalsInvert()) GetDisplayGeometry().InvertNormals(); } if(bCreateTexture) { +//-/ GetDisplayGeometry().CreateDefaultTexture( +//-/ ((bUseStdTextureX) ? B3D_CREATE_DEFAULT_X : FALSE) +//-/ |((bUseStdTextureY) ? B3D_CREATE_DEFAULT_Y : FALSE), +//-/ bUseStdTextureXUseSphere); GetDisplayGeometry().CreateDefaultTexture( - ((bUseStdTextureX) ? B3D_CREATE_DEFAULT_X : FALSE) - |((bUseStdTextureY) ? B3D_CREATE_DEFAULT_Y : FALSE), - bUseStdTextureXUseSphere); + ((GetTextureProjectionX() > 0) ? B3D_CREATE_DEFAULT_X : FALSE) + |((GetTextureProjectionY() > 0) ? B3D_CREATE_DEFAULT_Y : FALSE), + GetTextureProjectionX() > 1); } // Am Ende der Geometrieerzeugung das model an den erzeugten @@ -2773,7 +2885,7 @@ void E3dCompoundObject::AddGeometry(const PolyPolygon3D& rPolyPolygon3D, if(bCreateE3dPolyObj) { E3dPolyObj* pObj = new E3dPolyObj( - rPolyPolygon3D, bDoubleSided, TRUE); + rPolyPolygon3D, GetDoubleSided(), TRUE); pObj->SetPartOfParent(); Insert3DObj(pObj); } @@ -2808,7 +2920,7 @@ void E3dCompoundObject::AddGeometry( if(bCreateE3dPolyObj) { E3dPolyObj* pObj = new E3dPolyObj( - rPolyPolygon3D, rPolyNormal3D, bDoubleSided, TRUE); + rPolyPolygon3D, rPolyNormal3D, GetDoubleSided(), TRUE); pObj->SetPartOfParent(); Insert3DObj(pObj); } @@ -2846,7 +2958,7 @@ void E3dCompoundObject::AddGeometry( { E3dPolyObj* pObj = new E3dPolyObj( rPolyPolygon3D, rPolyNormal3D, - rPolyTexture3D, bDoubleSided, TRUE); + rPolyTexture3D, GetDoubleSided(), TRUE); pObj->SetPartOfParent(); Insert3DObj(pObj); } @@ -3331,27 +3443,29 @@ void E3dCompoundObject::operator=(const SdrObject& rObj) const E3dCompoundObject& r3DObj = (const E3dCompoundObject&) rObj; aDisplayGeometry = r3DObj.aDisplayGeometry; - bDoubleSided = r3DObj.bDoubleSided; +//-/ bDoubleSided = r3DObj.bDoubleSided; bCreateNormals = r3DObj.bCreateNormals; bCreateTexture = r3DObj.bCreateTexture; - bUseStdNormals = r3DObj.bUseStdNormals; - bUseStdNormalsUseSphere = r3DObj.bUseStdNormalsUseSphere; - bUseStdTextureX = r3DObj.bUseStdTextureX; - bUseStdTextureXUseSphere = r3DObj.bUseStdTextureXUseSphere; - bUseStdTextureY = r3DObj.bUseStdTextureY; - bUseStdTextureYUseSphere = r3DObj.bUseStdTextureYUseSphere; +//-/ bUseStdNormals = r3DObj.bUseStdNormals; +//-/ bUseStdNormalsUseSphere = r3DObj.bUseStdNormalsUseSphere; +//-/ bUseStdTextureX = r3DObj.bUseStdTextureX; +//-/ bUseStdTextureXUseSphere = r3DObj.bUseStdTextureXUseSphere; +//-/ bUseStdTextureY = r3DObj.bUseStdTextureY; +//-/ bUseStdTextureYUseSphere = r3DObj.bUseStdTextureYUseSphere; bGeometryValid = r3DObj.bGeometryValid; - bShadow3D = r3DObj.bShadow3D; +//-/ bShadow3D = r3DObj.bShadow3D; bBytesLeft = r3DObj.bBytesLeft; bCreateE3dPolyObj = r3DObj.bCreateE3dPolyObj; // neu ab 383: - aFrontMaterial = r3DObj.aFrontMaterial; +//-/ aFrontMaterial = r3DObj.aFrontMaterial; + aMaterialAmbientColor = r3DObj.aMaterialAmbientColor; + aBackMaterial = r3DObj.aBackMaterial; - eTextureKind = r3DObj.eTextureKind; - eTextureMode = r3DObj.eTextureMode; - bInvertNormals = r3DObj.bInvertNormals; - bFilterTexture = r3DObj.bFilterTexture; +//-/ eTextureKind = r3DObj.eTextureKind; +//-/ eTextureMode = r3DObj.eTextureMode; +//-/ bInvertNormals = r3DObj.bInvertNormals; +//-/ bFilterTexture = r3DObj.bFilterTexture; bUseDifferentBackMaterial = r3DObj.bUseDifferentBackMaterial; } @@ -3400,9 +3514,15 @@ void E3dCompoundObject::SetBase3DParams(ExtOutputDevice& rOut, Base3D* pBase3D, // Material setzen pBase3D->SetMaterial(aColorWhite, Base3DMaterialAmbient); pBase3D->SetMaterial(aColorWhiteWithTransparency, Base3DMaterialDiffuse); - pBase3D->SetMaterial(aFrontMaterial.GetMaterial(Base3DMaterialSpecular), Base3DMaterialSpecular); - pBase3D->SetMaterial(aFrontMaterial.GetMaterial(Base3DMaterialEmission), Base3DMaterialEmission); - pBase3D->SetShininess(aFrontMaterial.GetShininess()); + +//-/ pBase3D->SetMaterial(aFrontMaterial.GetMaterial(Base3DMaterialSpecular), Base3DMaterialSpecular); + pBase3D->SetMaterial(GetMaterialSpecular(), Base3DMaterialSpecular); + +//-/ pBase3D->SetMaterial(aFrontMaterial.GetMaterial(Base3DMaterialEmission), Base3DMaterialEmission); + pBase3D->SetMaterial(GetMaterialEmission(), Base3DMaterialEmission); + +//-/ pBase3D->SetShininess(aFrontMaterial.GetShininess()); + pBase3D->SetShininess(GetMaterialSpecularIntensity()); if(GetUseDifferentBackMaterial()) { @@ -3675,9 +3795,15 @@ void E3dCompoundObject::SetBase3DParams(ExtOutputDevice& rOut, Base3D* pBase3D, if(pTexture) { // Einige Modi einstellen - pTexture->SetTextureKind(eTextureKind); - pTexture->SetTextureMode(eTextureMode); - pTexture->SetTextureFilter(bFilterTexture ? Base3DTextureLinear : Base3DTextureNearest); +//-/ pTexture->SetTextureKind(eTextureKind); + pTexture->SetTextureKind(GetTextureKind()); + +//-/ pTexture->SetTextureMode(eTextureMode); + pTexture->SetTextureMode(GetTextureMode()); + +//-/ pTexture->SetTextureFilter(bFilterTexture ? Base3DTextureLinear : Base3DTextureNearest); + pTexture->SetTextureFilter(GetTextureFilter() ? + Base3DTextureLinear : Base3DTextureNearest); pTexture->SetTextureWrapS(eWrapX); pTexture->SetTextureWrapT(eWrapY); @@ -3914,9 +4040,9 @@ void E3dCompoundObject::CenterObject(const Vector3D& rCenter) Color E3dCompoundObject::GetShadowColor() { - const SdrShadowColorItem& rShadColItem = ((SdrShadowColorItem&)(GetItem(SDRATTR_SHADOWCOLOR))); - Color aShadCol = rShadColItem.GetValue(); - return aShadCol; + return ((SdrShadowColorItem&)(GetItem(SDRATTR_SHADOWCOLOR))).GetValue(); +//-/ Color aShadCol = rShadColItem.GetValue(); +//-/ return aShadCol; //-/ Color aShadCol; //-/ //-/ if (pShadAttr!=NULL) @@ -4441,11 +4567,19 @@ B3dGeometry& E3dCompoundObject::GetDisplayGeometry() |* \************************************************************************/ -void E3dCompoundObject::SetFrontMaterial(const B3dMaterial& rNew) +//-/void E3dCompoundObject::SetFrontMaterial(const B3dMaterial& rNew) +//-/{ +//-/ if(aFrontMaterial != rNew) +//-/ { +//-/ aFrontMaterial = rNew; +//-/ } +//-/} + +void E3dCompoundObject::SetMaterialAmbientColor(const Color& rColor) { - if(aFrontMaterial != rNew) + if(aMaterialAmbientColor != rColor) { - aFrontMaterial = rNew; + aMaterialAmbientColor = rColor; } } @@ -4495,10 +4629,11 @@ void E3dCompoundObject::Paint3D(ExtOutputDevice& rOut, Base3D* pBase3D, bIsLineDraft, bIsFillDraft); // Culling? - pBase3D->SetCullMode(bDoubleSided ? Base3DCullNone : Base3DCullBack); + pBase3D->SetCullMode(GetDoubleSided() ? Base3DCullNone : Base3DCullBack); // Objekt flat darstellen? - BOOL bForceFlat = (bUseStdNormals && !bUseStdNormalsUseSphere); +//-/ BOOL bForceFlat = (bUseStdNormals && !bUseStdNormalsUseSphere); + BOOL bForceFlat = ((GetNormalsKind() > 0) && !(GetNormalsKind() > 1)); pBase3D->SetForceFlat(bForceFlat); // Geometrie ausgeben @@ -4645,7 +4780,8 @@ void E3dCompoundObject::GetShadowPolygon(PolyPolygon& rPoly) B3dEntityBucket& rEntityBucket = GetDisplayGeometry().GetEntityBucket(); GeometryIndexValueBucket& rIndexBucket = GetDisplayGeometry().GetIndexBucket(); - if(bShadow3D) +//-/ if(bShadow3D) + if(GetShadow3D()) { // 3D Schatten. Nimm Lichtquelle und Ebene. Projiziere // die Punkte und jage sie durch die 3D Darstellung. @@ -5139,150 +5275,183 @@ void E3dCompoundObject::ImpLocalItemValueChange(const SfxPoolItem& rNew) { case SDRATTR_3DOBJ_DOUBLE_SIDED: { - BOOL bNew = ((const Svx3DDoubleSidedItem&)rNew).GetValue(); - ImpSetDoubleSided(bNew); +//-/ BOOL bNew = ((const Svx3DDoubleSidedItem&)rNew).GetValue(); +//-/ if(GetDoubleSided() != bNew) + bGeometryValid = FALSE; break; } case SDRATTR_3DOBJ_NORMALS_KIND: { - UINT16 nNew = ((const Svx3DNormalsKindItem&)rNew).GetValue(); - if(nNew == 0) - { - ImpSetUseStdNormals(FALSE); - ImpSetUseStdNormalsUseSphere(FALSE); - } - else if(nNew == 1) - { - ImpSetUseStdNormals(TRUE); - ImpSetUseStdNormalsUseSphere(FALSE); - } - else - { - ImpSetUseStdNormals(TRUE); - ImpSetUseStdNormalsUseSphere(TRUE); - } +//-/ UINT16 nNew = ((const Svx3DNormalsKindItem&)rNew).GetValue(); +//-/ if(GetNormalsKind() != nNew) + bGeometryValid = FALSE; +//-/ if(nNew == 0) +//-/ { +//-/ ImpSetUseStdNormals(FALSE); +//-/ ImpSetUseStdNormalsUseSphere(FALSE); +//-/ } +//-/ else if(nNew == 1) +//-/ { +//-/ ImpSetUseStdNormals(TRUE); +//-/ ImpSetUseStdNormalsUseSphere(FALSE); +//-/ } +//-/ else +//-/ { +//-/ ImpSetUseStdNormals(TRUE); +//-/ ImpSetUseStdNormalsUseSphere(TRUE); +//-/ } break; } case SDRATTR_3DOBJ_NORMALS_INVERT: { - BOOL bNew = ((const Svx3DNormalsInvertItem&)rNew).GetValue(); - ImpSetInvertNormals(bNew); +//-/ BOOL bNew = ((const Svx3DNormalsInvertItem&)rNew).GetValue(); +//-/ if(GetNormalsInvert() != bNew) +//-/ GetDisplayGeometry().InvertNormals(); + bGeometryValid = FALSE; +//-/ ImpSetInvertNormals(bNew); break; } case SDRATTR_3DOBJ_TEXTURE_PROJ_X: { - UINT16 nNew = ((const Svx3DTextureProjectionXItem&)rNew).GetValue(); - if(nNew == 0) - { - ImpSetUseStdTextureX(FALSE); - ImpSetUseStdTextureXUseSphere(FALSE); - } - else if(nNew == 1) - { - ImpSetUseStdTextureX(TRUE); - ImpSetUseStdTextureXUseSphere(FALSE); - } - else - { - ImpSetUseStdTextureX(TRUE); - ImpSetUseStdTextureXUseSphere(TRUE); - } +//-/ UINT16 nNew = ((const Svx3DTextureProjectionXItem&)rNew).GetValue(); +//-/ if(GetTextureProjectionX() != nNew) + bGeometryValid = FALSE; +//-/ if(nNew == 0) +//-/ { +//-/ ImpSetUseStdTextureX(FALSE); +//-/ ImpSetUseStdTextureXUseSphere(FALSE); +//-/ } +//-/ else if(nNew == 1) +//-/ { +//-/ ImpSetUseStdTextureX(TRUE); +//-/ ImpSetUseStdTextureXUseSphere(FALSE); +//-/ } +//-/ else +//-/ { +//-/ ImpSetUseStdTextureX(TRUE); +//-/ ImpSetUseStdTextureXUseSphere(TRUE); +//-/ } break; } case SDRATTR_3DOBJ_TEXTURE_PROJ_Y: { - UINT16 nNew = ((const Svx3DTextureProjectionYItem&)rNew).GetValue(); - if(nNew == 0) - { - ImpSetUseStdTextureY(FALSE); - ImpSetUseStdTextureYUseSphere(FALSE); - } - else if(nNew == 1) - { - ImpSetUseStdTextureY(TRUE); - ImpSetUseStdTextureYUseSphere(FALSE); - } - else - { - ImpSetUseStdTextureY(TRUE); - ImpSetUseStdTextureYUseSphere(TRUE); - } - break; - } - case SDRATTR_3DOBJ_SHADOW_3D: - { - BOOL bNew = ((const Svx3DShadow3DItem&)rNew).GetValue(); - ImpSetDrawShadow3D(bNew); - break; - } - case SDRATTR_3DOBJ_MAT_COLOR: - { - B3dMaterial aNewMat = GetFrontMaterial(); - Color aNew = ((const Svx3DMaterialColorItem&)rNew).GetValue(); - aNewMat.SetMaterial(aNew, Base3DMaterialDiffuse); - SetFrontMaterial(aNewMat); - break; - } - case SDRATTR_3DOBJ_MAT_EMISSION: - { - B3dMaterial aNewMat = GetFrontMaterial(); - Color aNew = ((const Svx3DMaterialEmissionItem&)rNew).GetValue(); - aNewMat.SetMaterial(aNew, Base3DMaterialEmission); - SetFrontMaterial(aNewMat); - break; - } - case SDRATTR_3DOBJ_MAT_SPECULAR: - { - B3dMaterial aNewMat = GetFrontMaterial(); - Color aNew = ((const Svx3DMaterialSpecularItem&)rNew).GetValue(); - aNewMat.SetMaterial(aNew, Base3DMaterialSpecular); - SetFrontMaterial(aNewMat); - break; - } - case SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY: - { - B3dMaterial aNewMat = GetFrontMaterial(); - UINT16 nNew = ((const Svx3DMaterialSpecularIntensityItem&)rNew).GetValue(); - aNewMat.SetShininess(nNew); - SetFrontMaterial(aNewMat); - break; - } - case SDRATTR_3DOBJ_TEXTURE_KIND: - { - UINT16 nNew = ((const Svx3DTextureKindItem&)rNew).GetValue(); - if(nNew == 0) - { - ImpSetTextureKind(Base3DTextureLuminance); - } - else - { - ImpSetTextureKind(Base3DTextureColor); - } - break; - } - case SDRATTR_3DOBJ_TEXTURE_MODE: - { - UINT16 nNew = ((const Svx3DTextureModeItem&)rNew).GetValue(); - if(nNew == 0) - { - ImpSetTextureMode(Base3DTextureReplace); - } - else if(nNew == 1) - { - ImpSetTextureMode(Base3DTextureModulate); - } - else - { - ImpSetTextureMode(Base3DTextureBlend); - } - break; - } - case SDRATTR_3DOBJ_TEXTURE_FILTER: - { - BOOL bNew = ((const Svx3DTextureFilterItem&)rNew).GetValue(); - ImpSetFilterTexture(bNew); +//-/ UINT16 nNew = ((const Svx3DTextureProjectionYItem&)rNew).GetValue(); +//-/ if(GetTextureProjectionY() != nNew) + bGeometryValid = FALSE; +//-/ if(nNew == 0) +//-/ { +//-/ ImpSetUseStdTextureY(FALSE); +//-/ ImpSetUseStdTextureYUseSphere(FALSE); +//-/ } +//-/ else if(nNew == 1) +//-/ { +//-/ ImpSetUseStdTextureY(TRUE); +//-/ ImpSetUseStdTextureYUseSphere(FALSE); +//-/ } +//-/ else +//-/ { +//-/ ImpSetUseStdTextureY(TRUE); +//-/ ImpSetUseStdTextureYUseSphere(TRUE); +//-/ } break; } +//-/ case SDRATTR_3DOBJ_SHADOW_3D: +//-/ { +//-/ BOOL bNew = ((const Svx3DShadow3DItem&)rNew).GetValue(); +//-/ if(GetShadow3D() != bNew) +//-/ ; +//-///-/ ImpSetDrawShadow3D(bNew); +//-/ break; +//-/ } +//-/ case SDRATTR_3DOBJ_MAT_COLOR: +//-/ { +//-/ // set 3d object color as fill color +//-/ Color aNew = ((const Svx3DMaterialColorItem&)rNew).GetValue(); +//-/ ImpForceItemSet(); +//-/ mpObjectItemSet->Put(XFillColorItem(String(), aNew)); +//-///-/ if(GetMaterialColor() != aNew) +//-///-/ { +//-///-/ B3dMaterial aNewMat = GetFrontMaterial(); +//-///-/ aNewMat.SetMaterial(aNew, Base3DMaterialDiffuse); +//-///-/ SetFrontMaterial(aNewMat); +//-///-/ } +//-/ break; +//-/ } +//-/ case SDRATTR_3DOBJ_MAT_EMISSION: +//-/ { +//-/ Color aNew = ((const Svx3DMaterialEmissionItem&)rNew).GetValue(); +//-/ if(GetMaterialEmission() != aNew) +//-/ { +//-/ B3dMaterial aNewMat = GetFrontMaterial(); +//-/ aNewMat.SetMaterial(aNew, Base3DMaterialEmission); +//-/ SetFrontMaterial(aNewMat); +//-/ } +//-/ break; +//-/ } +//-/ case SDRATTR_3DOBJ_MAT_SPECULAR: +//-/ { +//-/ Color aNew = ((const Svx3DMaterialSpecularItem&)rNew).GetValue(); +//-/ if(GetMaterialSpecular() != aNew) +//-/ { +//-/ B3dMaterial aNewMat = GetFrontMaterial(); +//-/ aNewMat.SetMaterial(aNew, Base3DMaterialSpecular); +//-/ SetFrontMaterial(aNewMat); +//-/ } +//-/ break; +//-/ } +//-/ case SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY: +//-/ { +//-/ UINT16 nNew = ((const Svx3DMaterialSpecularIntensityItem&)rNew).GetValue(); +//-/ if(GetMaterialSpecularIntensity() != nNew) +//-/ { +//-/ B3dMaterial aNewMat = GetFrontMaterial(); +//-/ aNewMat.SetShininess(nNew); +//-/ SetFrontMaterial(aNewMat); +//-/ } +//-/ break; +//-/ } +//-/ case SDRATTR_3DOBJ_TEXTURE_KIND: +//-/ { +//-/ Base3DTextureKind eNew = ((const Svx3DTextureKindItem&)rNew).GetValue(); +//-/ if(GetTextureKind() != eNew) +//-/ ; +//-/ if(nNew == 0) +//-/ { +//-/ ImpSetTextureKind(Base3DTextureLuminance); +//-/ } +//-/ else +//-/ { +//-/ ImpSetTextureKind(Base3DTextureColor); +//-/ } +//-/ break; +//-/ } +//-/ case SDRATTR_3DOBJ_TEXTURE_MODE: +//-/ { +//-/ Base3DTextureMode eNew = ((const Svx3DTextureModeItem&)rNew).GetValue(); +//-/ if(GetTextureMode() != eNew) +//-/ ; +//-/ if(nNew == 0) +//-/ { +//-/ ImpSetTextureMode(Base3DTextureReplace); +//-/ } +//-/ else if(nNew == 1) +//-/ { +//-/ ImpSetTextureMode(Base3DTextureModulate); +//-/ } +//-/ else +//-/ { +//-/ ImpSetTextureMode(Base3DTextureBlend); +//-/ } +//-/ break; +//-/ } +//-/ case SDRATTR_3DOBJ_TEXTURE_FILTER: +//-/ { +//-/ BOOL bNew = ((const Svx3DTextureFilterItem&)rNew).GetValue(); +//-/ if(GetTextureFilter() != bNew) +//-/ ; +//-/ ImpSetFilterTexture(bNew); +//-/ break; +//-/ } } } @@ -5294,6 +5463,13 @@ void E3dCompoundObject::SetItem( const SfxPoolItem& rItem ) // handle value change if(rItem.Which() >= SDRATTR_3DOBJ_FIRST && rItem.Which() <= SDRATTR_3DOBJ_LAST) ImpLocalItemValueChange(rItem); + +//-/ // set fill color as 3d object color +//-/ if(rItem.Which() == XATTR_FILLCOLOR) +//-/ { +//-/ Color aNew = ((const XFillColorItem&)rItem).GetValue(); +//-/ mpObjectItemSet->Put(Svx3DMaterialColorItem(aNew)); +//-/ } } void E3dCompoundObject::ClearItem( USHORT nWhich ) @@ -5306,6 +5482,10 @@ void E3dCompoundObject::ClearItem( USHORT nWhich ) // handle value change if(nWhich >= SDRATTR_3DOBJ_FIRST && nWhich <= SDRATTR_3DOBJ_LAST) ImpLocalItemValueChange(mpObjectItemSet->Get(nWhich)); + +//-/ // clear fill color when 3d object color is cleared +//-/ if(nWhich == XATTR_FILLCOLOR) +//-/ mpObjectItemSet->ClearItem(SDRATTR_3DOBJ_MAT_COLOR); } } @@ -5316,7 +5496,15 @@ void E3dCompoundObject::SetItemSet( const SfxItemSet& rSet ) // handle value change for(sal_uInt16 nWhich(SDRATTR_3DOBJ_FIRST); nWhich <= SDRATTR_3DOBJ_TEXTURE_FILTER; nWhich++) - ImpLocalItemValueChange(rSet.Get(nWhich)); + if(SFX_ITEM_SET == rSet.GetItemState(nWhich, FALSE)) + ImpLocalItemValueChange(rSet.Get(nWhich)); + +//-/ // set fill color as 3d object color +//-/ if(SFX_ITEM_SET == rSet.GetItemState(XATTR_FILLCOLOR, FALSE)) +//-/ { +//-/ Color aNew = ((const XFillColorItem&)rSet.Get(XATTR_FILLCOLOR)).GetValue(); +//-/ mpObjectItemSet->Put(Svx3DMaterialColorItem(aNew)); +//-/ } } //-/void E3dCompoundObject::NbcSetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll) @@ -5476,125 +5664,125 @@ void E3dCompoundObject::SetItemSet( const SfxItemSet& rSet ) |* \************************************************************************/ -void E3dCompoundObject::Collect3DAttributes(SfxItemSet& rAttr) const -{ - // call parent - E3dObject::Collect3DAttributes(rAttr); - - // special Attr for E3dCompoundObject - BOOL bObjDoubleSided = bDoubleSided; - UINT16 nObjNormalsKind; - if(!bUseStdNormals) - { - nObjNormalsKind = 0; - } - else - { - if(bUseStdNormalsUseSphere) - { - nObjNormalsKind = 2; - } - else - { - nObjNormalsKind = 1; - } - } - BOOL bObjNormalsInvert = bInvertNormals; - UINT16 nObjTextureProjX; - if(!bUseStdTextureX) - { - nObjTextureProjX = 0; - } - else - { - if(bUseStdTextureXUseSphere) - { - nObjTextureProjX = 2; - } - else - { - nObjTextureProjX = 1; - } - } - UINT16 nObjTextureProjY; - if(!bUseStdTextureY) - { - nObjTextureProjY = 0; - } - else - { - if(bUseStdTextureYUseSphere) - { - nObjTextureProjY = 2; - } - else - { - nObjTextureProjY = 1; - } - } - BOOL bObjShadow3D = bShadow3D; - const B3dMaterial& rMat = GetFrontMaterial(); - Color aObjMaterialColor = ((const XFillColorItem&)(GetItem(XATTR_FILLCOLOR))).GetValue(); - Color aObjMaterialEmission = rMat.GetMaterial(Base3DMaterialEmission); - Color aObjMaterialSpecular = rMat.GetMaterial(Base3DMaterialSpecular); - UINT16 nObjMaterialIntensity = rMat.GetShininess(); - UINT16 nObjTextureKind; - if(eTextureKind == Base3DTextureColor) - { - nObjTextureKind = 1; - } - else - { - nObjTextureKind = 0; - } - UINT16 nObjTextureMode; - if(eTextureMode == Base3DTextureReplace) - { - nObjTextureMode = 0; - } - else if(eTextureMode == Base3DTextureModulate) - { - nObjTextureMode = 1; - } - else - { - nObjTextureMode = 2; - } - BOOL bObjTextureFilter = bFilterTexture; - - // DoubleSided - rAttr.Put(SfxBoolItem(SDRATTR_3DOBJ_DOUBLE_SIDED, bObjDoubleSided)); - - // NormalsKind - rAttr.Put(SfxUInt16Item(SDRATTR_3DOBJ_NORMALS_KIND, nObjNormalsKind)); - - // NormalsInvert - rAttr.Put(SfxBoolItem(SDRATTR_3DOBJ_NORMALS_INVERT, bObjNormalsInvert)); - - // TextureProjectionX - rAttr.Put(SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_PROJ_X, nObjTextureProjX)); - - // TextureProjectionY - rAttr.Put(SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_PROJ_Y, nObjTextureProjY)); - - // Shadow3D - rAttr.Put(SfxBoolItem(SDRATTR_3DOBJ_SHADOW_3D, bObjShadow3D)); - - // Material - rAttr.Put(SvxColorItem(aObjMaterialColor, SDRATTR_3DOBJ_MAT_COLOR)); - rAttr.Put(SvxColorItem(aObjMaterialEmission, SDRATTR_3DOBJ_MAT_EMISSION)); - rAttr.Put(SvxColorItem(aObjMaterialSpecular, SDRATTR_3DOBJ_MAT_SPECULAR)); - rAttr.Put(SfxUInt16Item(SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY, nObjMaterialIntensity)); - - // TextureKind - rAttr.Put(SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_KIND, nObjTextureKind)); - - // TextureMode - rAttr.Put(SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_MODE, nObjTextureMode)); - - // TextureFilter - rAttr.Put(SfxBoolItem(SDRATTR_3DOBJ_TEXTURE_FILTER, bObjTextureFilter)); -} +//-/void E3dCompoundObject::Collect3DAttributes(SfxItemSet& rAttr) const +//-/{ +//-/ // call parent +//-/ E3dObject::Collect3DAttributes(rAttr); +//-/ +//-/ // special Attr for E3dCompoundObject +//-/ BOOL bObjDoubleSided = bDoubleSided; +//-/ UINT16 nObjNormalsKind; +//-/ if(!bUseStdNormals) +//-/ { +//-/ nObjNormalsKind = 0; +//-/ } +//-/ else +//-/ { +//-/ if(bUseStdNormalsUseSphere) +//-/ { +//-/ nObjNormalsKind = 2; +//-/ } +//-/ else +//-/ { +//-/ nObjNormalsKind = 1; +//-/ } +//-/ } +//-/ BOOL bObjNormalsInvert = bInvertNormals; +//-/ UINT16 nObjTextureProjX; +//-/ if(!bUseStdTextureX) +//-/ { +//-/ nObjTextureProjX = 0; +//-/ } +//-/ else +//-/ { +//-/ if(bUseStdTextureXUseSphere) +//-/ { +//-/ nObjTextureProjX = 2; +//-/ } +//-/ else +//-/ { +//-/ nObjTextureProjX = 1; +//-/ } +//-/ } +//-/ UINT16 nObjTextureProjY; +//-/ if(!bUseStdTextureY) +//-/ { +//-/ nObjTextureProjY = 0; +//-/ } +//-/ else +//-/ { +//-/ if(bUseStdTextureYUseSphere) +//-/ { +//-/ nObjTextureProjY = 2; +//-/ } +//-/ else +//-/ { +//-/ nObjTextureProjY = 1; +//-/ } +//-/ } +//-/ BOOL bObjShadow3D = bShadow3D; +//-/ const B3dMaterial& rMat = GetFrontMaterial(); +//-/ Color aObjMaterialColor = ((const XFillColorItem&)(GetItem(XATTR_FILLCOLOR))).GetValue(); +//-/ Color aObjMaterialEmission = rMat.GetMaterial(Base3DMaterialEmission); +//-/ Color aObjMaterialSpecular = rMat.GetMaterial(Base3DMaterialSpecular); +//-/ UINT16 nObjMaterialIntensity = rMat.GetShininess(); +//-/ UINT16 nObjTextureKind; +//-/ if(eTextureKind == Base3DTextureColor) +//-/ { +//-/ nObjTextureKind = 1; +//-/ } +//-/ else +//-/ { +//-/ nObjTextureKind = 0; +//-/ } +//-/ UINT16 nObjTextureMode; +//-/ if(eTextureMode == Base3DTextureReplace) +//-/ { +//-/ nObjTextureMode = 0; +//-/ } +//-/ else if(eTextureMode == Base3DTextureModulate) +//-/ { +//-/ nObjTextureMode = 1; +//-/ } +//-/ else +//-/ { +//-/ nObjTextureMode = 2; +//-/ } +//-/ BOOL bObjTextureFilter = bFilterTexture; +//-/ +//-/ // DoubleSided +//-/ rAttr.Put(SfxBoolItem(SDRATTR_3DOBJ_DOUBLE_SIDED, bObjDoubleSided)); +//-/ +//-/ // NormalsKind +//-/ rAttr.Put(SfxUInt16Item(SDRATTR_3DOBJ_NORMALS_KIND, nObjNormalsKind)); +//-/ +//-/ // NormalsInvert +//-/ rAttr.Put(SfxBoolItem(SDRATTR_3DOBJ_NORMALS_INVERT, bObjNormalsInvert)); +//-/ +//-/ // TextureProjectionX +//-/ rAttr.Put(SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_PROJ_X, nObjTextureProjX)); +//-/ +//-/ // TextureProjectionY +//-/ rAttr.Put(SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_PROJ_Y, nObjTextureProjY)); +//-/ +//-/ // Shadow3D +//-/ rAttr.Put(SfxBoolItem(SDRATTR_3DOBJ_SHADOW_3D, bObjShadow3D)); +//-/ +//-/ // Material +//-/ rAttr.Put(SvxColorItem(aObjMaterialColor, SDRATTR_3DOBJ_MAT_COLOR)); +//-/ rAttr.Put(SvxColorItem(aObjMaterialEmission, SDRATTR_3DOBJ_MAT_EMISSION)); +//-/ rAttr.Put(SvxColorItem(aObjMaterialSpecular, SDRATTR_3DOBJ_MAT_SPECULAR)); +//-/ rAttr.Put(SfxUInt16Item(SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY, nObjMaterialIntensity)); +//-/ +//-/ // TextureKind +//-/ rAttr.Put(SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_KIND, nObjTextureKind)); +//-/ +//-/ // TextureMode +//-/ rAttr.Put(SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_MODE, nObjTextureMode)); +//-/ +//-/ // TextureFilter +//-/ rAttr.Put(SfxBoolItem(SDRATTR_3DOBJ_TEXTURE_FILTER, bObjTextureFilter)); +//-/} //-/void E3dCompoundObject::TakeAttributes(SfxItemSet& rAttr, FASTBOOL bMerge, FASTBOOL bOnlyHardAttr) const //-/{ @@ -5959,100 +6147,100 @@ void E3dCompoundObject::Collect3DAttributes(SfxItemSet& rAttr) const //-/ } //-/} -void E3dCompoundObject::ImpSetDoubleSided(BOOL bNew) -{ - if(bDoubleSided != bNew) - { - bDoubleSided = bNew; - bGeometryValid = FALSE; - } -} +//-/void E3dCompoundObject::ImpSetDoubleSided(BOOL bNew) +//-/{ +//-/ if(bDoubleSided != bNew) +//-/ { +//-/ bDoubleSided = bNew; +//-/ bGeometryValid = FALSE; +//-/ } +//-/} -void E3dCompoundObject::ImpSetUseStdNormals(BOOL bNew) -{ - if(bUseStdNormals != bNew) - { - bUseStdNormals = bNew; - bGeometryValid = FALSE; - } -} +//-/void E3dCompoundObject::ImpSetUseStdNormals(BOOL bNew) +//-/{ +//-/ if(bUseStdNormals != bNew) +//-/ { +//-/ bUseStdNormals = bNew; +//-/ bGeometryValid = FALSE; +//-/ } +//-/} -void E3dCompoundObject::ImpSetUseStdNormalsUseSphere(BOOL bNew) -{ - if(bUseStdNormalsUseSphere != bNew) - { - bUseStdNormalsUseSphere = bNew; - bGeometryValid = FALSE; - } -} +//-/void E3dCompoundObject::ImpSetUseStdNormalsUseSphere(BOOL bNew) +//-/{ +//-/ if(bUseStdNormalsUseSphere != bNew) +//-/ { +//-/ bUseStdNormalsUseSphere = bNew; +//-/ bGeometryValid = FALSE; +//-/ } +//-/} -void E3dCompoundObject::ImpSetInvertNormals(BOOL bNew) -{ - if(bInvertNormals != bNew) - { - bInvertNormals = bNew; - GetDisplayGeometry().InvertNormals(); - } -} +//-/void E3dCompoundObject::ImpSetInvertNormals(BOOL bNew) +//-/{ +//-/ if(bInvertNormals != bNew) +//-/ { +//-/ bInvertNormals = bNew; +//-/ GetDisplayGeometry().InvertNormals(); +//-/ } +//-/} -void E3dCompoundObject::ImpSetUseStdTextureX(BOOL bNew) -{ - if(bUseStdTextureX != bNew) - { - bUseStdTextureX = bNew; - bGeometryValid = FALSE; - } -} +//-/void E3dCompoundObject::ImpSetUseStdTextureX(BOOL bNew) +//-/{ +//-/ if(bUseStdTextureX != bNew) +//-/ { +//-/ bUseStdTextureX = bNew; +//-/ bGeometryValid = FALSE; +//-/ } +//-/} -void E3dCompoundObject::ImpSetUseStdTextureXUseSphere(BOOL bNew) -{ - if(bUseStdTextureXUseSphere != bNew) - { - bUseStdTextureXUseSphere = bNew; - bGeometryValid = FALSE; - } -} +//-/void E3dCompoundObject::ImpSetUseStdTextureXUseSphere(BOOL bNew) +//-/{ +//-/ if(bUseStdTextureXUseSphere != bNew) +//-/ { +//-/ bUseStdTextureXUseSphere = bNew; +//-/ bGeometryValid = FALSE; +//-/ } +//-/} -void E3dCompoundObject::ImpSetUseStdTextureY(BOOL bNew) -{ - if(bUseStdTextureY != bNew) - { - bUseStdTextureY = bNew; - bGeometryValid = FALSE; - } -} +//-/void E3dCompoundObject::ImpSetUseStdTextureY(BOOL bNew) +//-/{ +//-/ if(bUseStdTextureY != bNew) +//-/ { +//-/ bUseStdTextureY = bNew; +//-/ bGeometryValid = FALSE; +//-/ } +//-/} -void E3dCompoundObject::ImpSetUseStdTextureYUseSphere(BOOL bNew) -{ - if(bUseStdTextureYUseSphere != bNew) - { - bUseStdTextureYUseSphere = bNew; - bGeometryValid = FALSE; - } -} +//-/void E3dCompoundObject::ImpSetUseStdTextureYUseSphere(BOOL bNew) +//-/{ +//-/ if(bUseStdTextureYUseSphere != bNew) +//-/ { +//-/ bUseStdTextureYUseSphere = bNew; +//-/ bGeometryValid = FALSE; +//-/ } +//-/} -void E3dCompoundObject::ImpSetTextureKind(Base3DTextureKind eNew) -{ - if(eTextureKind != eNew) - { - eTextureKind = eNew; - } -} +//-/void E3dCompoundObject::ImpSetTextureKind(Base3DTextureKind eNew) +//-/{ +//-/ if(eTextureKind != eNew) +//-/ { +//-/ eTextureKind = eNew; +//-/ } +//-/} -void E3dCompoundObject::ImpSetTextureMode(Base3DTextureMode eNew) -{ - if(eTextureMode != eNew) - { - eTextureMode = eNew; - } -} +//-/void E3dCompoundObject::ImpSetTextureMode(Base3DTextureMode eNew) +//-/{ +//-/ if(eTextureMode != eNew) +//-/ { +//-/ eTextureMode = eNew; +//-/ } +//-/} -void E3dCompoundObject::ImpSetFilterTexture(BOOL bNew) -{ - if(bFilterTexture != bNew) - { - bFilterTexture = bNew; - } -} +//-/void E3dCompoundObject::ImpSetFilterTexture(BOOL bNew) +//-/{ +//-/ if(bFilterTexture != bNew) +//-/ { +//-/ bFilterTexture = bNew; +//-/ } +//-/} // EOF diff --git a/svx/source/engine3d/polysc3d.cxx b/svx/source/engine3d/polysc3d.cxx index 55cdd041adaf..4ad1c155d7da 100644 --- a/svx/source/engine3d/polysc3d.cxx +++ b/svx/source/engine3d/polysc3d.cxx @@ -2,9 +2,9 @@ * * $RCSfile: polysc3d.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2000-10-30 10:55:03 $ + * last change: $Author: aw $ $Date: 2000-11-07 12:52:02 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -236,10 +236,21 @@ BOOL E3dPolyScene::LocalPaint3D(ExtOutputDevice& rOut, Time aStartTime; Rectangle aBound(GetSnapRect()); OutputDevice* pOut = rOut.GetOutDev(); - Base3D *pBase3D = Base3D::Create(pOut, bForceDraftShadeModel); + +//-/ Base3D *pBase3D = Base3D::Create(pOut, bForceDraftShadeModel); + sal_uInt16 nShadeMode = GetShadeMode(); + Base3D *pBase3D = Base3D::Create(pOut, nShadeMode > 2); + DBG_ASSERT(pBase3D, "Habe keinen Base3D Kontext bekommen!!"); pBase3D->SetDisplayQuality(GetDisplayQuality()); - pBase3D->SetShadeModel(eShadeModel); + +//-/ pBase3D->SetShadeModel(eShadeModel); + if(nShadeMode == 0) + pBase3D->SetShadeModel(Base3DFlat); + else if(nShadeMode == 1) + pBase3D->SetShadeModel(Base3DPhong); + else + pBase3D->SetShadeModel(Base3DSmooth); Rectangle aVisible(Point(0,0), pOut->GetOutputSizePixel()); aVisible = pOut->PixelToLogic(aVisible); diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx index 0b4183fac2e0..0596cee9f58e 100644 --- a/svx/source/engine3d/scene3d.cxx +++ b/svx/source/engine3d/scene3d.cxx @@ -2,9 +2,9 @@ * * $RCSfile: scene3d.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2000-10-30 10:55:03 $ + * last change: $Author: aw $ $Date: 2000-11-07 12:52:02 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -200,11 +200,40 @@ void E3dScene::SetDefaultAttributes(E3dDefaultAttributes& rDefault) #endif // Defaults setzen - aLightGroup = rDefault.GetDefaultLightGroup(); - aShadowPlaneDirection = rDefault.GetDefaultShadowPlaneDirection(); - eShadeModel = rDefault.GetDefaultShadeModel(); +//-/ aLightGroup = rDefault.GetDefaultLightGroup(); + + // set defaults for LightGroup from ItemPool + aLightGroup.SetModelTwoSide(GetTwoSidedLighting()); + aLightGroup.SetIntensity( GetLightColor1(), Base3DMaterialDiffuse, Base3DLight0); + aLightGroup.SetIntensity( GetLightColor2(), Base3DMaterialDiffuse, Base3DLight1); + aLightGroup.SetIntensity( GetLightColor3(), Base3DMaterialDiffuse, Base3DLight2); + aLightGroup.SetIntensity( GetLightColor4(), Base3DMaterialDiffuse, Base3DLight3); + aLightGroup.SetIntensity( GetLightColor5(), Base3DMaterialDiffuse, Base3DLight4); + aLightGroup.SetIntensity( GetLightColor6(), Base3DMaterialDiffuse, Base3DLight5); + aLightGroup.SetIntensity( GetLightColor7(), Base3DMaterialDiffuse, Base3DLight6); + aLightGroup.SetIntensity( GetLightColor8(), Base3DMaterialDiffuse, Base3DLight7); + aLightGroup.SetGlobalAmbientLight(GetGlobalAmbientColor()); + aLightGroup.Enable( GetLightOnOff1(), Base3DLight0); + aLightGroup.Enable( GetLightOnOff2(), Base3DLight1); + aLightGroup.Enable( GetLightOnOff3(), Base3DLight2); + aLightGroup.Enable( GetLightOnOff4(), Base3DLight3); + aLightGroup.Enable( GetLightOnOff5(), Base3DLight4); + aLightGroup.Enable( GetLightOnOff6(), Base3DLight5); + aLightGroup.Enable( GetLightOnOff7(), Base3DLight6); + aLightGroup.Enable( GetLightOnOff8(), Base3DLight7); + aLightGroup.SetDirection( GetLightDirection1(), Base3DLight0); + aLightGroup.SetDirection( GetLightDirection2(), Base3DLight1); + aLightGroup.SetDirection( GetLightDirection3(), Base3DLight2); + aLightGroup.SetDirection( GetLightDirection4(), Base3DLight3); + aLightGroup.SetDirection( GetLightDirection5(), Base3DLight4); + aLightGroup.SetDirection( GetLightDirection6(), Base3DLight5); + aLightGroup.SetDirection( GetLightDirection7(), Base3DLight6); + aLightGroup.SetDirection( GetLightDirection8(), Base3DLight7); + +//-/ aShadowPlaneDirection = rDefault.GetDefaultShadowPlaneDirection(); +//-/ eShadeModel = rDefault.GetDefaultShadeModel(); bDither = rDefault.GetDefaultDither(); - bForceDraftShadeModel = rDefault.GetDefaultForceDraftShadeModel(); +//-/ bForceDraftShadeModel = rDefault.GetDefaultForceDraftShadeModel(); // Alte Werte initialisieren aCamera.SetViewWindow(-2, -2, 4, 4); @@ -214,8 +243,17 @@ void E3dScene::SetDefaultAttributes(E3dDefaultAttributes& rDefault) aCameraSet.SetViewportRectangle(aRect); nSortingMode = E3D_SORT_FAST_SORTING | E3D_SORT_IN_PARENTS | E3D_SORT_TEST_LENGTH; + // set defaults for Camera from ItemPool + aCamera.SetProjection(GetPerspective()); + Vector3D aActualPosition = aCamera.GetPosition(); + double fNew = GetDistance(); + if(fabs(fNew - aActualPosition.Z()) > 1.0) + aCamera.SetPosition( Vector3D( aActualPosition.X(), aActualPosition.Y(), fNew) ); + fNew = GetFocalLength() / 100.0; + aCamera.SetFocalLength(fNew); + // Schattenebene normalisieren - aShadowPlaneDirection.Normalize(); +//-/ aShadowPlaneDirection.Normalize(); } /************************************************************************* @@ -364,6 +402,7 @@ void E3dScene::SetCamera(const Camera3D& rNewCamera) { // Alte Kamera setzen aCamera = rNewCamera; + ImpSetSceneItemsFromCamera(); SetRectsDirty(); // Neue Kamera aus alter fuellen @@ -712,14 +751,24 @@ void E3dScene::WriteData(SvStream& rOut) const rOut << nSortingMode; // neu ab 377: - rOut << aShadowPlaneDirection; +//-/ rOut << aShadowPlaneDirection; + Vector3D aPlaneDirection = GetShadowPlaneDirection(); + rOut << aPlaneDirection; // neu ab 383: rOut << (BOOL)bDither; // neu ab 384: - rOut << (UINT16)eShadeModel; - rOut << (BOOL)bForceDraftShadeModel; +//-/ rOut << (UINT16)eShadeModel; +//-/ rOut << (BOOL)bForceDraftShadeModel; + sal_uInt16 nShadeMode = GetShadeMode(); + if(nShadeMode == 0) + rOut << (sal_uInt16)Base3DFlat; + else if(nShadeMode == 1) + rOut << (sal_uInt16)Base3DPhong; + else + rOut << (sal_uInt16)Base3DSmooth; + rOut << (BOOL)(nShadeMode > 2); #endif } @@ -803,7 +852,10 @@ void E3dScene::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn) // neu ab 377: if (aCompat.GetBytesLeft() >= sizeof(Vector3D)) { - rIn >> aShadowPlaneDirection; +//-/ rIn >> aShadowPlaneDirection; + Vector3D aShadowVec; + rIn >> aShadowVec; + SetShadowPlaneDirection(aShadowVec); } // neu ab 383: @@ -816,11 +868,21 @@ void E3dScene::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn) if (aCompat.GetBytesLeft() >= sizeof(UINT16)) { UINT16 nTmp; - rIn >> nTmp; eShadeModel = (Base3DShadeModel)nTmp; + rIn >> nTmp; +//-/ eShadeModel = (Base3DShadeModel)nTmp; + if(nTmp == (Base3DShadeModel)Base3DFlat) + mpObjectItemSet->Put(Svx3DShadeModeItem(0)); + else if(nTmp == (Base3DShadeModel)Base3DPhong) + mpObjectItemSet->Put(Svx3DShadeModeItem(1)); + else + mpObjectItemSet->Put(Svx3DShadeModeItem(2)); } if (aCompat.GetBytesLeft() >= sizeof(BOOL)) { - rIn >> bTmp; bForceDraftShadeModel = bTmp; + rIn >> bTmp; +//-/ bForceDraftShadeModel = bTmp; + if(bTmp) + mpObjectItemSet->Put(Svx3DShadeModeItem(3)); } // SnapRects der Objekte ungueltig @@ -831,6 +893,10 @@ void E3dScene::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn) InitTransformationSet(); RebuildLists(); + + // set items from combined read objects like lightgroup and camera + ImpSetLightItemsFromLightGroup(); + ImpSetSceneItemsFromCamera(); } } @@ -915,14 +981,16 @@ void E3dScene::operator=(const SdrObject& rObj) nSortingMode = r3DObj.nSortingMode; // neu ab 377: - aShadowPlaneDirection = r3DObj.aShadowPlaneDirection; +//-/ aShadowPlaneDirection = r3DObj.aShadowPlaneDirection; aCameraSet = r3DObj.aCameraSet; + ImpSetSceneItemsFromCamera(); // neu ab 383: aLightGroup = r3DObj.aLightGroup; - eShadeModel = r3DObj.eShadeModel; + ImpSetLightItemsFromLightGroup(); +//-/ eShadeModel = r3DObj.eShadeModel; bDither = r3DObj.bDither; - bForceDraftShadeModel = r3DObj.bForceDraftShadeModel; +//-/ bForceDraftShadeModel = r3DObj.bForceDraftShadeModel; bBoundVolValid = FALSE; RebuildLists(); @@ -1204,18 +1272,17 @@ void E3dScene::RemoveLightObjects() void E3dScene::CreateLightObjectsFromLightGroup() { - if(GetLightGroup().IsLightingEnabled()) + if(aLightGroup.IsLightingEnabled()) { // Global Ambient Light - const Color& rAmbient = GetLightGroup().GetGlobalAmbientLight(); + const Color& rAmbient = aLightGroup.GetGlobalAmbientLight(); if(rAmbient != Color(COL_BLACK)) Insert3DObj(new E3dLight(Vector3D(), rAmbient, 1.0)); // Andere Lichter for(UINT16 a=0;a<BASE3D_MAX_NUMBER_LIGHTS;a++) { - B3dLight& rLight = GetLightGroup(). - GetLightObject((Base3DLightNumber)(Base3DLight0 + a)); + B3dLight& rLight = aLightGroup.GetLightObject((Base3DLightNumber)(Base3DLight0 + a)); if(rLight.IsEnabled()) { if(rLight.IsDirectionalSource()) @@ -1253,7 +1320,7 @@ void E3dScene::FillLightGroup() Base3DLightNumber eLight = Base3DLight0; // AmbientLight aus - GetLightGroup().SetGlobalAmbientLight(Color(COL_BLACK)); + aLightGroup.SetGlobalAmbientLight(Color(COL_BLACK)); while ( a3DIterator.IsMore() ) { @@ -1273,13 +1340,13 @@ void E3dScene::FillLightGroup() // Position, keine Richtung B3dColor aCol(pLight->GetColor().GetColor()); aCol *= pLight->GetIntensity(); - GetLightGroup().SetIntensity(aCol, Base3DMaterialDiffuse, eLight); - GetLightGroup().SetIntensity(Color(COL_WHITE), Base3DMaterialSpecular, eLight); + aLightGroup.SetIntensity(aCol, Base3DMaterialDiffuse, eLight); + aLightGroup.SetIntensity(Color(COL_WHITE), Base3DMaterialSpecular, eLight); Vector3D aPos = pLight->GetPosition(); - GetLightGroup().SetPosition(aPos, eLight); + aLightGroup.SetPosition(aPos, eLight); // Lichtquelle einschalten - GetLightGroup().Enable(TRUE, eLight); + aLightGroup.Enable(TRUE, eLight); // Naechstes Licht in Base3D eLight = (Base3DLightNumber)(eLight + 1); @@ -1290,13 +1357,13 @@ void E3dScene::FillLightGroup() // Richtung, keine Position B3dColor aCol(pLight->GetColor().GetColor()); aCol *= pLight->GetIntensity(); - GetLightGroup().SetIntensity(aCol, Base3DMaterialDiffuse, eLight); - GetLightGroup().SetIntensity(Color(COL_WHITE), Base3DMaterialSpecular, eLight); + aLightGroup.SetIntensity(aCol, Base3DMaterialDiffuse, eLight); + aLightGroup.SetIntensity(Color(COL_WHITE), Base3DMaterialSpecular, eLight); Vector3D aDir = ((E3dDistantLight *)pLight)->GetDirection(); - GetLightGroup().SetDirection(aDir, eLight); + aLightGroup.SetDirection(aDir, eLight); // Lichtquelle einschalten - GetLightGroup().Enable(TRUE, eLight); + aLightGroup.Enable(TRUE, eLight); // Naechstes Licht in Base3D eLight = (Base3DLightNumber)(eLight + 1); @@ -1307,8 +1374,8 @@ void E3dScene::FillLightGroup() // ambientes licht, auf globales aufaddieren B3dColor aCol(pLight->GetColor().GetColor()); aCol *= pLight->GetIntensity(); - aCol += (B3dColor &)GetLightGroup().GetGlobalAmbientLight(); - GetLightGroup().SetGlobalAmbientLight(aCol); + aCol += (B3dColor &)aLightGroup.GetGlobalAmbientLight(); + aLightGroup.SetGlobalAmbientLight(aCol); } } } @@ -1317,13 +1384,13 @@ void E3dScene::FillLightGroup() // Alle anderen Lichter ausschalten while(eLight <= Base3DLight7) { - GetLightGroup().Enable(FALSE, eLight); + aLightGroup.Enable(FALSE, eLight); eLight = (Base3DLightNumber)(eLight + 1); } } // Beleuchtung einschalten, falls Lampen vorhanden - GetLightGroup().EnableLighting(bLampFound); + aLightGroup.EnableLighting(bLampFound); } /************************************************************************* @@ -1850,119 +1917,175 @@ void E3dScene::RecalcSnapRect() |* \************************************************************************/ -void E3dScene::Collect3DAttributes(SfxItemSet& rAttr) const +void E3dScene::ImpSetLightItemsFromLightGroup() { - // call parent - E3dObject::Collect3DAttributes(rAttr); - - // special Attr for E3dCompoundObject - B3dLightGroup& rLightGroup = ((E3dScene*)this)->GetLightGroup(); - Camera3D aSceneCam (GetCamera()); - double fSceneCamPosZ = aSceneCam.GetPosition().Z(); - double fSceneFocal = aSceneCam.GetFocalLength() * 100.0; - BOOL bSceneTwoSidedLighting = rLightGroup.GetModelTwoSide(); - Color aSceneLightColor1 = rLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight0); - Color aSceneLightColor2 = rLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight1); - Color aSceneLightColor3 = rLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight2); - Color aSceneLightColor4 = rLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight3); - Color aSceneLightColor5 = rLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight4); - Color aSceneLightColor6 = rLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight5); - Color aSceneLightColor7 = rLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight6); - Color aSceneLightColor8 = rLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight7); - Color aSceneAmbientColor = rLightGroup.GetGlobalAmbientLight(); - BOOL bSceneLightOn1 = rLightGroup.IsEnabled(Base3DLight0); - BOOL bSceneLightOn2 = rLightGroup.IsEnabled(Base3DLight1); - BOOL bSceneLightOn3 = rLightGroup.IsEnabled(Base3DLight2); - BOOL bSceneLightOn4 = rLightGroup.IsEnabled(Base3DLight3); - BOOL bSceneLightOn5 = rLightGroup.IsEnabled(Base3DLight4); - BOOL bSceneLightOn6 = rLightGroup.IsEnabled(Base3DLight5); - BOOL bSceneLightOn7 = rLightGroup.IsEnabled(Base3DLight6); - BOOL bSceneLightOn8 = rLightGroup.IsEnabled(Base3DLight7); - Vector3D aSceneLightDirection1 = rLightGroup.GetDirection( Base3DLight0 ); - Vector3D aSceneLightDirection2 = rLightGroup.GetDirection( Base3DLight1 ); - Vector3D aSceneLightDirection3 = rLightGroup.GetDirection( Base3DLight2 ); - Vector3D aSceneLightDirection4 = rLightGroup.GetDirection( Base3DLight3 ); - Vector3D aSceneLightDirection5 = rLightGroup.GetDirection( Base3DLight4 ); - Vector3D aSceneLightDirection6 = rLightGroup.GetDirection( Base3DLight5 ); - Vector3D aSceneLightDirection7 = rLightGroup.GetDirection( Base3DLight6 ); - Vector3D aSceneLightDirection8 = rLightGroup.GetDirection( Base3DLight7 ); - ProjectionType eScenePT = aSceneCam.GetProjection(); - UINT16 nSceneShadeMode; - const Vector3D& rShadowVec = ((E3dScene*)this)->GetShadowPlaneDirection(); - UINT16 nSceneShadowSlant = (UINT16)((atan2(rShadowVec.Y(), rShadowVec.Z()) / F_PI180) + 0.5); - - if(bForceDraftShadeModel) - { - nSceneShadeMode = 3; // Draft-Modus - } - else - { - if(eShadeModel == Base3DSmooth) - { - nSceneShadeMode = 2; // Gouraud - } - else if(eShadeModel == Base3DFlat) - { - nSceneShadeMode = 0; // Flat - } - else // Base3DPhong - { - nSceneShadeMode = 1; // Phong - } - } - - // ProjectionType - rAttr.Put(SfxUInt16Item(SDRATTR_3DSCENE_PERSPECTIVE, (UINT16)eScenePT)); - - // CamPos - rAttr.Put(SfxUInt32Item(SDRATTR_3DSCENE_DISTANCE, (UINT32)(fSceneCamPosZ + 0.5))); - - // FocalLength - rAttr.Put(SfxUInt32Item(SDRATTR_3DSCENE_FOCAL_LENGTH, (UINT32)(fSceneFocal + 0.5))); + ImpForceItemSet(); // TwoSidedLighting - rAttr.Put(SfxBoolItem(SDRATTR_3DSCENE_TWO_SIDED_LIGHTING, bSceneTwoSidedLighting)); + mpObjectItemSet->Put(Svx3DTwoSidedLightingItem(aLightGroup.GetModelTwoSide())); // LightColors - rAttr.Put(SvxColorItem(aSceneLightColor1, SDRATTR_3DSCENE_LIGHTCOLOR_1)); - rAttr.Put(SvxColorItem(aSceneLightColor2, SDRATTR_3DSCENE_LIGHTCOLOR_2)); - rAttr.Put(SvxColorItem(aSceneLightColor3, SDRATTR_3DSCENE_LIGHTCOLOR_3)); - rAttr.Put(SvxColorItem(aSceneLightColor4, SDRATTR_3DSCENE_LIGHTCOLOR_4)); - rAttr.Put(SvxColorItem(aSceneLightColor5, SDRATTR_3DSCENE_LIGHTCOLOR_5)); - rAttr.Put(SvxColorItem(aSceneLightColor6, SDRATTR_3DSCENE_LIGHTCOLOR_6)); - rAttr.Put(SvxColorItem(aSceneLightColor7, SDRATTR_3DSCENE_LIGHTCOLOR_7)); - rAttr.Put(SvxColorItem(aSceneLightColor8, SDRATTR_3DSCENE_LIGHTCOLOR_8)); + mpObjectItemSet->Put(Svx3DLightcolor1Item(aLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight0))); + mpObjectItemSet->Put(Svx3DLightcolor2Item(aLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight1))); + mpObjectItemSet->Put(Svx3DLightcolor3Item(aLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight2))); + mpObjectItemSet->Put(Svx3DLightcolor4Item(aLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight3))); + mpObjectItemSet->Put(Svx3DLightcolor5Item(aLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight4))); + mpObjectItemSet->Put(Svx3DLightcolor6Item(aLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight5))); + mpObjectItemSet->Put(Svx3DLightcolor7Item(aLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight6))); + mpObjectItemSet->Put(Svx3DLightcolor8Item(aLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight7))); // AmbientColor - rAttr.Put(SvxColorItem(aSceneAmbientColor, SDRATTR_3DSCENE_AMBIENTCOLOR)); + mpObjectItemSet->Put(Svx3DAmbientcolorItem(aLightGroup.GetGlobalAmbientLight())); // LightOn - rAttr.Put(SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_1, bSceneLightOn1)); - rAttr.Put(SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_2, bSceneLightOn2)); - rAttr.Put(SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_3, bSceneLightOn3)); - rAttr.Put(SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_4, bSceneLightOn4)); - rAttr.Put(SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_5, bSceneLightOn5)); - rAttr.Put(SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_6, bSceneLightOn6)); - rAttr.Put(SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_7, bSceneLightOn7)); - rAttr.Put(SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_8, bSceneLightOn8)); + mpObjectItemSet->Put(Svx3DLightOnOff1Item(aLightGroup.IsEnabled(Base3DLight0))); + mpObjectItemSet->Put(Svx3DLightOnOff2Item(aLightGroup.IsEnabled(Base3DLight1))); + mpObjectItemSet->Put(Svx3DLightOnOff3Item(aLightGroup.IsEnabled(Base3DLight2))); + mpObjectItemSet->Put(Svx3DLightOnOff4Item(aLightGroup.IsEnabled(Base3DLight3))); + mpObjectItemSet->Put(Svx3DLightOnOff5Item(aLightGroup.IsEnabled(Base3DLight4))); + mpObjectItemSet->Put(Svx3DLightOnOff6Item(aLightGroup.IsEnabled(Base3DLight5))); + mpObjectItemSet->Put(Svx3DLightOnOff7Item(aLightGroup.IsEnabled(Base3DLight6))); + mpObjectItemSet->Put(Svx3DLightOnOff8Item(aLightGroup.IsEnabled(Base3DLight7))); // LightDirection - rAttr.Put(SvxVector3DItem(SDRATTR_3DSCENE_LIGHTDIRECTION_1, aSceneLightDirection1)); - rAttr.Put(SvxVector3DItem(SDRATTR_3DSCENE_LIGHTDIRECTION_2, aSceneLightDirection2)); - rAttr.Put(SvxVector3DItem(SDRATTR_3DSCENE_LIGHTDIRECTION_3, aSceneLightDirection3)); - rAttr.Put(SvxVector3DItem(SDRATTR_3DSCENE_LIGHTDIRECTION_4, aSceneLightDirection4)); - rAttr.Put(SvxVector3DItem(SDRATTR_3DSCENE_LIGHTDIRECTION_5, aSceneLightDirection5)); - rAttr.Put(SvxVector3DItem(SDRATTR_3DSCENE_LIGHTDIRECTION_6, aSceneLightDirection6)); - rAttr.Put(SvxVector3DItem(SDRATTR_3DSCENE_LIGHTDIRECTION_7, aSceneLightDirection7)); - rAttr.Put(SvxVector3DItem(SDRATTR_3DSCENE_LIGHTDIRECTION_8, aSceneLightDirection8)); - - // ShadowSlant - rAttr.Put(SfxUInt16Item(SDRATTR_3DSCENE_SHADOW_SLANT, nSceneShadowSlant)); - - // ShadeMode - rAttr.Put(SfxUInt16Item(SDRATTR_3DSCENE_SHADE_MODE, nSceneShadeMode)); + mpObjectItemSet->Put(Svx3DLightDirection1Item(aLightGroup.GetDirection( Base3DLight0 ))); + mpObjectItemSet->Put(Svx3DLightDirection2Item(aLightGroup.GetDirection( Base3DLight1 ))); + mpObjectItemSet->Put(Svx3DLightDirection3Item(aLightGroup.GetDirection( Base3DLight2 ))); + mpObjectItemSet->Put(Svx3DLightDirection4Item(aLightGroup.GetDirection( Base3DLight3 ))); + mpObjectItemSet->Put(Svx3DLightDirection5Item(aLightGroup.GetDirection( Base3DLight4 ))); + mpObjectItemSet->Put(Svx3DLightDirection6Item(aLightGroup.GetDirection( Base3DLight5 ))); + mpObjectItemSet->Put(Svx3DLightDirection7Item(aLightGroup.GetDirection( Base3DLight6 ))); + mpObjectItemSet->Put(Svx3DLightDirection8Item(aLightGroup.GetDirection( Base3DLight7 ))); +} + +void E3dScene::ImpSetSceneItemsFromCamera() +{ + ImpForceItemSet(); + Camera3D aSceneCam (GetCamera()); + + // ProjectionType + mpObjectItemSet->Put(Svx3DPerspectiveItem((UINT16)aSceneCam.GetProjection())); + + // CamPos + mpObjectItemSet->Put(Svx3DDistanceItem((UINT32)(aSceneCam.GetPosition().Z() + 0.5))); + + // FocalLength + mpObjectItemSet->Put(Svx3DFocalLengthItem((UINT32)((aSceneCam.GetFocalLength() * 100.0) + 0.5))); } +//-/void E3dScene::Collect3DAttributes(SfxItemSet& rAttr) const +//-/{ +//-/ // call parent +//-/ E3dObject::Collect3DAttributes(rAttr); +//-/ +//-/ // special Attr for E3dCompoundObject +//-///-/ B3dLightGroup& rLightGroup = ((E3dScene*)this)->GetLightGroup(); +//-/ Camera3D aSceneCam (GetCamera()); +//-/ double fSceneCamPosZ = aSceneCam.GetPosition().Z(); +//-/ double fSceneFocal = aSceneCam.GetFocalLength() * 100.0; +//-/ BOOL bSceneTwoSidedLighting = aLightGroup.GetModelTwoSide(); +//-/ Color aSceneLightColor1 = aLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight0); +//-/ Color aSceneLightColor2 = aLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight1); +//-/ Color aSceneLightColor3 = aLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight2); +//-/ Color aSceneLightColor4 = aLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight3); +//-/ Color aSceneLightColor5 = aLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight4); +//-/ Color aSceneLightColor6 = aLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight5); +//-/ Color aSceneLightColor7 = aLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight6); +//-/ Color aSceneLightColor8 = aLightGroup.GetIntensity(Base3DMaterialDiffuse, Base3DLight7); +//-/ Color aSceneAmbientColor = aLightGroup.GetGlobalAmbientLight(); +//-/ BOOL bSceneLightOn1 = aLightGroup.IsEnabled(Base3DLight0); +//-/ BOOL bSceneLightOn2 = aLightGroup.IsEnabled(Base3DLight1); +//-/ BOOL bSceneLightOn3 = aLightGroup.IsEnabled(Base3DLight2); +//-/ BOOL bSceneLightOn4 = aLightGroup.IsEnabled(Base3DLight3); +//-/ BOOL bSceneLightOn5 = aLightGroup.IsEnabled(Base3DLight4); +//-/ BOOL bSceneLightOn6 = aLightGroup.IsEnabled(Base3DLight5); +//-/ BOOL bSceneLightOn7 = aLightGroup.IsEnabled(Base3DLight6); +//-/ BOOL bSceneLightOn8 = aLightGroup.IsEnabled(Base3DLight7); +//-/ Vector3D aSceneLightDirection1 = aLightGroup.GetDirection( Base3DLight0 ); +//-/ Vector3D aSceneLightDirection2 = aLightGroup.GetDirection( Base3DLight1 ); +//-/ Vector3D aSceneLightDirection3 = aLightGroup.GetDirection( Base3DLight2 ); +//-/ Vector3D aSceneLightDirection4 = aLightGroup.GetDirection( Base3DLight3 ); +//-/ Vector3D aSceneLightDirection5 = aLightGroup.GetDirection( Base3DLight4 ); +//-/ Vector3D aSceneLightDirection6 = aLightGroup.GetDirection( Base3DLight5 ); +//-/ Vector3D aSceneLightDirection7 = aLightGroup.GetDirection( Base3DLight6 ); +//-/ Vector3D aSceneLightDirection8 = aLightGroup.GetDirection( Base3DLight7 ); +//-/ ProjectionType eScenePT = aSceneCam.GetProjection(); +//-///-/ UINT16 nSceneShadeMode; +//-///-/ const Vector3D& rShadowVec = ((E3dScene*)this)->GetShadowPlaneDirection(); +//-///-/ UINT16 nSceneShadowSlant = (UINT16)((atan2(rShadowVec.Y(), rShadowVec.Z()) / F_PI180) + 0.5); +//-/ +//-///-/ if(bForceDraftShadeModel) +//-///-/ { +//-///-/ nSceneShadeMode = 3; // Draft-Modus +//-///-/ } +//-///-/ else +//-///-/ { +//-///-/ if(eShadeModel == Base3DSmooth) +//-///-/ { +//-///-/ nSceneShadeMode = 2; // Gouraud +//-///-/ } +//-///-/ else if(eShadeModel == Base3DFlat) +//-///-/ { +//-///-/ nSceneShadeMode = 0; // Flat +//-///-/ } +//-///-/ else // Base3DPhong +//-///-/ { +//-///-/ nSceneShadeMode = 1; // Phong +//-///-/ } +//-///-/ } +//-/ +//-/ // ProjectionType +//-/ rAttr.Put(Svx3DPerspectiveItem((UINT16)eScenePT)); +//-/ +//-/ // CamPos +//-/ rAttr.Put(Svx3DDistanceItem((UINT32)(fSceneCamPosZ + 0.5))); +//-/ +//-/ // FocalLength +//-/ rAttr.Put(Svx3DFocalLengthItem((UINT32)(fSceneFocal + 0.5))); +//-/ +//-/ // TwoSidedLighting +//-/ rAttr.Put(Svx3DTwoSidedLightingItem(bSceneTwoSidedLighting)); +//-/ +//-/ // LightColors +//-/ rAttr.Put(Svx3DLightcolor1Item(aSceneLightColor1)); +//-/ rAttr.Put(Svx3DLightcolor2Item(aSceneLightColor2)); +//-/ rAttr.Put(Svx3DLightcolor3Item(aSceneLightColor3)); +//-/ rAttr.Put(Svx3DLightcolor4Item(aSceneLightColor4)); +//-/ rAttr.Put(Svx3DLightcolor5Item(aSceneLightColor5)); +//-/ rAttr.Put(Svx3DLightcolor6Item(aSceneLightColor6)); +//-/ rAttr.Put(Svx3DLightcolor7Item(aSceneLightColor7)); +//-/ rAttr.Put(Svx3DLightcolor8Item(aSceneLightColor8)); +//-/ +//-/ // AmbientColor +//-/ rAttr.Put(Svx3DAmbientcolorItem(aSceneAmbientColor)); +//-/ +//-/ // LightOn +//-/ rAttr.Put(Svx3DLightOnOff1Item(bSceneLightOn1)); +//-/ rAttr.Put(Svx3DLightOnOff2Item(bSceneLightOn2)); +//-/ rAttr.Put(Svx3DLightOnOff3Item(bSceneLightOn3)); +//-/ rAttr.Put(Svx3DLightOnOff4Item(bSceneLightOn4)); +//-/ rAttr.Put(Svx3DLightOnOff5Item(bSceneLightOn5)); +//-/ rAttr.Put(Svx3DLightOnOff6Item(bSceneLightOn6)); +//-/ rAttr.Put(Svx3DLightOnOff7Item(bSceneLightOn7)); +//-/ rAttr.Put(Svx3DLightOnOff8Item(bSceneLightOn8)); +//-/ +//-/ // LightDirection +//-/ rAttr.Put(Svx3DLightDirection1Item(aSceneLightDirection1)); +//-/ rAttr.Put(Svx3DLightDirection2Item(aSceneLightDirection2)); +//-/ rAttr.Put(Svx3DLightDirection3Item(aSceneLightDirection3)); +//-/ rAttr.Put(Svx3DLightDirection4Item(aSceneLightDirection4)); +//-/ rAttr.Put(Svx3DLightDirection5Item(aSceneLightDirection5)); +//-/ rAttr.Put(Svx3DLightDirection6Item(aSceneLightDirection6)); +//-/ rAttr.Put(Svx3DLightDirection7Item(aSceneLightDirection7)); +//-/ rAttr.Put(Svx3DLightDirection8Item(aSceneLightDirection8)); +//-/ +//-///-/ // ShadowSlant +//-///-/ rAttr.Put(Svx3DShadowSlantItem(nSceneShadowSlant)); +//-/ +//-///-/ // ShadeMode +//-///-/ rAttr.Put(Svx3DShadeModeItem(nSceneShadeMode)); +//-/} + // ItemSet access const sal_uInt16 E3dScene::mnSceneRangeData[4] = { SDRATTR_3DSCENE_FIRST, SDRATTR_3DSCENE_LAST, 0, 0 }; const sal_uInt16 E3dScene::mnAllRangeData[4] = { SDRATTR_START, SDRATTR_END, 0, 0 }; @@ -2059,8 +2182,7 @@ void E3dScene::ImpLocalItemValueChange(const SfxPoolItem& rNew) case SDRATTR_3DSCENE_PERSPECTIVE : { Camera3D aSceneCam(GetCamera()); - ProjectionType eNew = (ProjectionType)((const Svx3DPerspectiveItem&)rNew).GetValue(); - aSceneCam.SetProjection( eNew ); + aSceneCam.SetProjection(GetPerspective()); SetCamera( aSceneCam ); break; } @@ -2068,7 +2190,7 @@ void E3dScene::ImpLocalItemValueChange(const SfxPoolItem& rNew) { Camera3D aSceneCam(GetCamera()); Vector3D aActualPosition = aSceneCam.GetPosition(); - double fNew = (double)((const Svx3DDistanceItem&)rNew).GetValue(); + double fNew = GetDistance(); if(fabs(fNew - aActualPosition.Z()) > 1.0) { aSceneCam.SetPosition( Vector3D( aActualPosition.X(), aActualPosition.Y(), fNew) ); @@ -2079,204 +2201,214 @@ void E3dScene::ImpLocalItemValueChange(const SfxPoolItem& rNew) case SDRATTR_3DSCENE_FOCAL_LENGTH : { Camera3D aSceneCam(GetCamera()); - double fNew = (double)((const Svx3DFocalLengthItem&)rNew).GetValue() / 100.0; - aSceneCam.SetFocalLength( fNew); + double fNew = GetFocalLength() / 100.0; + aSceneCam.SetFocalLength(fNew); SetCamera( aSceneCam ); break; } case SDRATTR_3DSCENE_TWO_SIDED_LIGHTING : { - BOOL bNew = ((const Svx3DTwoSidedLightingItem&)rNew).GetValue(); - GetLightGroup().SetModelTwoSide( bNew ); +//-/ BOOL bNew = ((const Svx3DTwoSidedLightingItem&)rNew).GetValue(); + aLightGroup.SetModelTwoSide(GetTwoSidedLighting()); break; } case SDRATTR_3DSCENE_LIGHTCOLOR_1 : { - Color aNew = ((const Svx3DLightcolor1Item&)rNew).GetValue(); - GetLightGroup().SetIntensity( aNew, Base3DMaterialDiffuse, Base3DLight0); +//-/ Color aNew = ((const Svx3DLightcolor1Item&)rNew).GetValue(); + aLightGroup.SetIntensity( GetLightColor1(), Base3DMaterialDiffuse, Base3DLight0); break; } case SDRATTR_3DSCENE_LIGHTCOLOR_2 : { - Color aNew = ((const Svx3DLightcolor2Item&)rNew).GetValue(); - GetLightGroup().SetIntensity( aNew, Base3DMaterialDiffuse, Base3DLight1); +//-/ Color aNew = ((const Svx3DLightcolor2Item&)rNew).GetValue(); + aLightGroup.SetIntensity( GetLightColor2(), Base3DMaterialDiffuse, Base3DLight1); break; } case SDRATTR_3DSCENE_LIGHTCOLOR_3 : { - Color aNew = ((const Svx3DLightcolor3Item&)rNew).GetValue(); - GetLightGroup().SetIntensity( aNew, Base3DMaterialDiffuse, Base3DLight2); +//-/ Color aNew = ((const Svx3DLightcolor3Item&)rNew).GetValue(); + aLightGroup.SetIntensity( GetLightColor3(), Base3DMaterialDiffuse, Base3DLight2); break; } case SDRATTR_3DSCENE_LIGHTCOLOR_4 : { - Color aNew = ((const Svx3DLightcolor4Item&)rNew).GetValue(); - GetLightGroup().SetIntensity( aNew, Base3DMaterialDiffuse, Base3DLight3); +//-/ Color aNew = ((const Svx3DLightcolor4Item&)rNew).GetValue(); + aLightGroup.SetIntensity( GetLightColor4(), Base3DMaterialDiffuse, Base3DLight3); break; } case SDRATTR_3DSCENE_LIGHTCOLOR_5 : { - Color aNew = ((const Svx3DLightcolor5Item&)rNew).GetValue(); - GetLightGroup().SetIntensity( aNew, Base3DMaterialDiffuse, Base3DLight4); +//-/ Color aNew = ((const Svx3DLightcolor5Item&)rNew).GetValue(); + aLightGroup.SetIntensity( GetLightColor5(), Base3DMaterialDiffuse, Base3DLight4); break; } case SDRATTR_3DSCENE_LIGHTCOLOR_6 : { - Color aNew = ((const Svx3DLightcolor6Item&)rNew).GetValue(); - GetLightGroup().SetIntensity( aNew, Base3DMaterialDiffuse, Base3DLight5); +//-/ Color aNew = ((const Svx3DLightcolor6Item&)rNew).GetValue(); + aLightGroup.SetIntensity( GetLightColor6(), Base3DMaterialDiffuse, Base3DLight5); break; } case SDRATTR_3DSCENE_LIGHTCOLOR_7 : { - Color aNew = ((const Svx3DLightcolor7Item&)rNew).GetValue(); - GetLightGroup().SetIntensity( aNew, Base3DMaterialDiffuse, Base3DLight6); +//-/ Color aNew = ((const Svx3DLightcolor7Item&)rNew).GetValue(); + aLightGroup.SetIntensity( GetLightColor7(), Base3DMaterialDiffuse, Base3DLight6); break; } case SDRATTR_3DSCENE_LIGHTCOLOR_8 : { - Color aNew = ((const Svx3DLightcolor8Item&)rNew).GetValue(); - GetLightGroup().SetIntensity( aNew, Base3DMaterialDiffuse, Base3DLight7); +//-/ Color aNew = ((const Svx3DLightcolor8Item&)rNew).GetValue(); + aLightGroup.SetIntensity( GetLightColor8(), Base3DMaterialDiffuse, Base3DLight7); break; } case SDRATTR_3DSCENE_AMBIENTCOLOR : { - Color aNew = ((const Svx3DAmbientcolorItem&)rNew).GetValue(); - GetLightGroup().SetGlobalAmbientLight( aNew ); +//-/ Color aNew = ((const Svx3DAmbientcolorItem&)rNew).GetValue(); + aLightGroup.SetGlobalAmbientLight(GetGlobalAmbientColor()); break; } case SDRATTR_3DSCENE_LIGHTON_1 : { - BOOL bNew = ((const Svx3DLightOnOff1Item&)rNew).GetValue(); - GetLightGroup().Enable( bNew, Base3DLight0); +//-/ BOOL bNew = ((const Svx3DLightOnOff1Item&)rNew).GetValue(); + aLightGroup.Enable( GetLightOnOff1(), Base3DLight0); break; } case SDRATTR_3DSCENE_LIGHTON_2 : { - BOOL bNew = ((const Svx3DLightOnOff2Item&)rNew).GetValue(); - GetLightGroup().Enable( bNew, Base3DLight1); +//-/ BOOL bNew = ((const Svx3DLightOnOff2Item&)rNew).GetValue(); + aLightGroup.Enable( GetLightOnOff2(), Base3DLight1); break; } case SDRATTR_3DSCENE_LIGHTON_3 : { - BOOL bNew = ((const Svx3DLightOnOff3Item&)rNew).GetValue(); - GetLightGroup().Enable( bNew, Base3DLight2); +//-/ BOOL bNew = ((const Svx3DLightOnOff3Item&)rNew).GetValue(); + aLightGroup.Enable( GetLightOnOff3(), Base3DLight2); break; } case SDRATTR_3DSCENE_LIGHTON_4 : { - BOOL bNew = ((const Svx3DLightOnOff4Item&)rNew).GetValue(); - GetLightGroup().Enable( bNew, Base3DLight3); +//-/ BOOL bNew = ((const Svx3DLightOnOff4Item&)rNew).GetValue(); + aLightGroup.Enable( GetLightOnOff4(), Base3DLight3); break; } case SDRATTR_3DSCENE_LIGHTON_5 : { - BOOL bNew = ((const Svx3DLightOnOff5Item&)rNew).GetValue(); - GetLightGroup().Enable( bNew, Base3DLight4); +//-/ BOOL bNew = ((const Svx3DLightOnOff5Item&)rNew).GetValue(); + aLightGroup.Enable( GetLightOnOff5(), Base3DLight4); break; } case SDRATTR_3DSCENE_LIGHTON_6 : { - BOOL bNew = ((const Svx3DLightOnOff6Item&)rNew).GetValue(); - GetLightGroup().Enable( bNew, Base3DLight5); +//-/ BOOL bNew = ((const Svx3DLightOnOff6Item&)rNew).GetValue(); + aLightGroup.Enable( GetLightOnOff6(), Base3DLight5); break; } case SDRATTR_3DSCENE_LIGHTON_7 : { - BOOL bNew = ((const Svx3DLightOnOff7Item&)rNew).GetValue(); - GetLightGroup().Enable( bNew, Base3DLight6); +//-/ BOOL bNew = ((const Svx3DLightOnOff7Item&)rNew).GetValue(); + aLightGroup.Enable( GetLightOnOff7(), Base3DLight6); break; } case SDRATTR_3DSCENE_LIGHTON_8 : { - BOOL bNew = ((const Svx3DLightOnOff8Item&)rNew).GetValue(); - GetLightGroup().Enable( bNew, Base3DLight7); +//-/ BOOL bNew = ((const Svx3DLightOnOff8Item&)rNew).GetValue(); + aLightGroup.Enable( GetLightOnOff8(), Base3DLight7); break; } case SDRATTR_3DSCENE_LIGHTDIRECTION_1 : { - Vector3D aNew = ((const Svx3DLightDirection1Item&)rNew).GetValue(); - GetLightGroup().SetDirection( aNew, Base3DLight0); +//-/ Vector3D aNew = ((const Svx3DLightDirection1Item&)rNew).GetValue(); + aLightGroup.SetDirection( GetLightDirection1(), Base3DLight0); break; } case SDRATTR_3DSCENE_LIGHTDIRECTION_2 : { - Vector3D aNew = ((const Svx3DLightDirection2Item&)rNew).GetValue(); - GetLightGroup().SetDirection( aNew, Base3DLight1); +//-/ Vector3D aNew = ((const Svx3DLightDirection2Item&)rNew).GetValue(); + aLightGroup.SetDirection( GetLightDirection2(), Base3DLight1); break; } case SDRATTR_3DSCENE_LIGHTDIRECTION_3 : { - Vector3D aNew = ((const Svx3DLightDirection3Item&)rNew).GetValue(); - GetLightGroup().SetDirection( aNew, Base3DLight2); +//-/ Vector3D aNew = ((const Svx3DLightDirection3Item&)rNew).GetValue(); + aLightGroup.SetDirection( GetLightDirection3(), Base3DLight2); break; } case SDRATTR_3DSCENE_LIGHTDIRECTION_4 : { - Vector3D aNew = ((const Svx3DLightDirection4Item&)rNew).GetValue(); - GetLightGroup().SetDirection( aNew, Base3DLight3); +//-/ Vector3D aNew = ((const Svx3DLightDirection4Item&)rNew).GetValue(); + aLightGroup.SetDirection( GetLightDirection4(), Base3DLight3); break; } case SDRATTR_3DSCENE_LIGHTDIRECTION_5 : { - Vector3D aNew = ((const Svx3DLightDirection5Item&)rNew).GetValue(); - GetLightGroup().SetDirection( aNew, Base3DLight4); +//-/ Vector3D aNew = ((const Svx3DLightDirection5Item&)rNew).GetValue(); + aLightGroup.SetDirection( GetLightDirection5(), Base3DLight4); break; } case SDRATTR_3DSCENE_LIGHTDIRECTION_6 : { - Vector3D aNew = ((const Svx3DLightDirection6Item&)rNew).GetValue(); - GetLightGroup().SetDirection( aNew, Base3DLight5); +//-/ Vector3D aNew = ((const Svx3DLightDirection6Item&)rNew).GetValue(); + aLightGroup.SetDirection( GetLightDirection6(), Base3DLight5); break; } case SDRATTR_3DSCENE_LIGHTDIRECTION_7 : { - Vector3D aNew = ((const Svx3DLightDirection7Item&)rNew).GetValue(); - GetLightGroup().SetDirection( aNew, Base3DLight6); +//-/ Vector3D aNew = ((const Svx3DLightDirection7Item&)rNew).GetValue(); + aLightGroup.SetDirection( GetLightDirection7(), Base3DLight6); break; } case SDRATTR_3DSCENE_LIGHTDIRECTION_8 : { - Vector3D aNew = ((const Svx3DLightDirection8Item&)rNew).GetValue(); - GetLightGroup().SetDirection( aNew, Base3DLight7); - break; - } - case SDRATTR_3DSCENE_SHADOW_SLANT : - { - UINT16 nNew = ((const Svx3DShadowSlantItem&)rNew).GetValue(); - double fWink = (double)nNew * F_PI180; - Vector3D aVec(0.0, sin(fWink), cos(fWink)); - aVec.Normalize(); - ImpSetShadowPlaneDirection(aVec); - break; - } - case SDRATTR_3DSCENE_SHADE_MODE : - { - UINT16 nNew = ((const Svx3DShadeModeItem&)rNew).GetValue(); - if(nNew == 3) - { - ImpSetForceDraftShadeModel(TRUE); - ImpSetShadeModel(Base3DSmooth); - } - else - { - ImpSetForceDraftShadeModel(FALSE); - - if(nNew == 0) - { - ImpSetShadeModel(Base3DFlat); - } - else if(nNew == 1) - { - ImpSetShadeModel(Base3DPhong); - } - else - { - // Gouraud - ImpSetShadeModel(Base3DSmooth); - } - } +//-/ Vector3D aNew = ((const Svx3DLightDirection8Item&)rNew).GetValue(); + aLightGroup.SetDirection( GetLightDirection8(), Base3DLight7); break; } +//-/ case SDRATTR_3DSCENE_SHADOW_SLANT : +//-/ { +//-///-/ UINT16 nNew = ((const Svx3DShadowSlantItem&)rNew).GetValue(); +//-/ UINT16 nNew = GetShadowSlant(); +//-/ double fWink = (double)nNew * F_PI180; +//-/ Vector3D aVec(0.0, sin(fWink), cos(fWink)); +//-/ aVec.Normalize(); +//-///-/ ImpSetShadowPlaneDirection(aVec); +//-/ aShadowPlaneDirection = aVec; +//-///-/ aShadowPlaneDirection.Normalize(); +//-/ break; +//-/ } +//-/ case SDRATTR_3DSCENE_SHADE_MODE : +//-/ { +//-///-/ UINT16 nNew = ((const Svx3DShadeModeItem&)rNew).GetValue(); +//-/ sal_uInt16 nNew = GetShadeMode(); +//-/ if(nNew == 3) +//-/ { +//-/ bForceDraftShadeModel = TRUE; +//-///-/ ImpSetShadeModel(Base3DSmooth); +//-/ eShadeModel = Base3DSmooth; +//-/ SetRectsDirty(); +//-/ } +//-/ else +//-/ { +//-/ bForceDraftShadeModel = FALSE; +//-/ SetRectsDirty(); +//-/ +//-/ if(nNew == 0) +//-/ { +//-///-/ ImpSetShadeModel(Base3DFlat); +//-/ eShadeModel = Base3DFlat; +//-/ } +//-/ else if(nNew == 1) +//-/ { +//-///-/ ImpSetShadeModel(Base3DPhong); +//-/ eShadeModel = Base3DPhong; +//-/ } +//-/ else +//-/ { +//-/ // Gouraud +//-///-/ ImpSetShadeModel(Base3DSmooth); +//-/ eShadeModel = Base3DSmooth; +//-/ } +//-/ } +//-/ break; +//-/ } } } @@ -2356,7 +2488,8 @@ void E3dScene::SetItemSet( const SfxItemSet& rSet ) // handle value change for(sal_uInt16 nWhich(SDRATTR_3DSCENE_FIRST); nWhich <= SDRATTR_3DSCENE_LAST; nWhich++) - ImpLocalItemValueChange(rSet.Get(nWhich)); + if(SFX_ITEM_SET == rSet.GetItemState(nWhich, FALSE)) + ImpLocalItemValueChange(rSet.Get(nWhich)); // set at all contained objects sal_uInt32 nCount(pSub->GetObjCount()); @@ -2383,6 +2516,25 @@ void E3dScene::SetItemSet( const SfxItemSet& rSet ) //-/ } } +//////////////////////////////////////////////////////////////////////////////////////////////////// +// pre- and postprocessing for objects for saving + +void E3dScene::PreSave() +{ + // set at all contained objects + sal_uInt32 nCount(pSub->GetObjCount()); + for(sal_uInt32 a(0); a < nCount; a++) + pSub->GetObj(a)->PreSave(); +} + +void E3dScene::PostSave() +{ + // set at all contained objects + sal_uInt32 nCount(pSub->GetObjCount()); + for(sal_uInt32 a(0); a < nCount; a++) + pSub->GetObj(a)->PostSave(); +} + //-/void E3dScene::TakeAttributes(SfxItemSet& rAttr, FASTBOOL bMerge, FASTBOOL bOnlyHardAttr) const //-/{ //-/ // call parent @@ -3079,28 +3231,43 @@ void E3dScene::MigrateItemPool(SfxItemPool* pSrcPool, SfxItemPool* pDestPool) } } -void E3dScene::ImpSetShadowPlaneDirection(const Vector3D& rNew) -{ - aShadowPlaneDirection = rNew; - aShadowPlaneDirection.Normalize(); -} +//-/void E3dScene::ImpSetShadowPlaneDirection(const Vector3D& rNew) +//-/{ +//-/ aShadowPlaneDirection = rNew; +//-/ aShadowPlaneDirection.Normalize(); +//-/} -void E3dScene::ImpSetShadeModel(Base3DShadeModel eNew) +//-/void E3dScene::ImpSetShadeModel(Base3DShadeModel eNew) +//-/{ +//-/ if(eShadeModel != eNew) +//-/ { +//-/ eShadeModel = eNew; +//-/ SetRectsDirty(); +//-/ } +//-/} + +//-/void E3dScene::ImpSetForceDraftShadeModel(BOOL bNew) +//-/{ +//-/ if(bNew != bForceDraftShadeModel) +//-/ { +//-/ bForceDraftShadeModel = bNew; +//-/ SetRectsDirty(); +//-/ } +//-/} + +Vector3D E3dScene::GetShadowPlaneDirection() const { - if(eShadeModel != eNew) - { - eShadeModel = eNew; - SetRectsDirty(); - } + double fWink = (double)GetShadowSlant() * F_PI180; + Vector3D aShadowPlaneDir(0.0, sin(fWink), cos(fWink)); + aShadowPlaneDir.Normalize(); + return aShadowPlaneDir; } -void E3dScene::ImpSetForceDraftShadeModel(BOOL bNew) +void E3dScene::SetShadowPlaneDirection(const Vector3D& rVec) { - if(bNew != bForceDraftShadeModel) - { - bForceDraftShadeModel = bNew; - SetRectsDirty(); - } + UINT16 nSceneShadowSlant = (UINT16)((atan2(rVec.Y(), rVec.Z()) / F_PI180) + 0.5); + ImpForceItemSet(); + mpObjectItemSet->Put(Svx3DShadowSlantItem(nSceneShadowSlant)); } // EOF diff --git a/svx/source/engine3d/sphere3d.cxx b/svx/source/engine3d/sphere3d.cxx index e70b0ba265b2..365d8df4beaa 100644 --- a/svx/source/engine3d/sphere3d.cxx +++ b/svx/source/engine3d/sphere3d.cxx @@ -2,9 +2,9 @@ * * $RCSfile: sphere3d.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2000-10-30 10:55:03 $ + * last change: $Author: aw $ $Date: 2000-11-07 12:52:02 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -152,8 +152,8 @@ E3dSphereObj::E3dSphereObj(int dummy) // den Parameter braucht es um unterscheid void E3dSphereObj::SetDefaultAttributes(E3dDefaultAttributes& rDefault) { // Defaults setzen - nHSegments = rDefault.GetDefaultHSegments(); - nVSegments = rDefault.GetDefaultVSegments(); +//-/ nHSegments = rDefault.GetDefaultHSegments(); +//-/ nVSegments = rDefault.GetDefaultVSegments(); aCenter = rDefault.GetDefaultSphereCenter(); aSize = rDefault.GetDefaultSphereSize(); } @@ -170,24 +170,32 @@ void E3dSphereObj::CreateGeometry() Polygon3D aNormal3D(4); Polygon3D aTexture3D(4); + if ( GetHorizontalSegments() < 3 ) + mpObjectItemSet->Put(Svx3DHorizontalSegmentsItem(3)); + + if ( GetHorizontalSegments() > 100 ) + mpObjectItemSet->Put(Svx3DHorizontalSegmentsItem(100)); + + if ( GetVerticalSegments() < 2 ) + mpObjectItemSet->Put(Svx3DVerticalSegmentsItem(2)); + + if ( GetVerticalSegments() > 100 ) + mpObjectItemSet->Put(Svx3DVerticalSegmentsItem(100)); + // Start der Geometrieerzeugung ankuendigen StartCreateGeometry(); - if ( nHSegments < 3 ) nHSegments = 3; - if ( nHSegments > 100 ) nHSegments = 100; - if ( nVSegments < 2 ) nVSegments = 2; - if ( nVSegments > 100 ) nVSegments = 100; - Vector3D aRadius = aSize / 2; double fHSin1, fHSin2, fHCos1, fHCos2; double fHAng = 0; - double fHInc = DEG2RAD(360) / nHSegments; - double fVInc = DEG2RAD(180) / nVSegments; + double fHInc = DEG2RAD(360) / GetHorizontalSegments(); + double fVInc = DEG2RAD(180) / GetVerticalSegments(); fHSin2 = 0.0; // sin(0) fHCos2 = 1.0; // cos(0) + sal_uInt16 nUpperBound = (sal_uInt16)GetHorizontalSegments(); - for (USHORT nH = 0; nH < nHSegments; nH++) + for (USHORT nH = 0; nH < nUpperBound; nH++) { fHAng += fHInc; fHSin1 = fHSin2; @@ -200,8 +208,9 @@ void E3dSphereObj::CreateGeometry() double fVSin1, fVSin2, fVCos1, fVCos2; fVSin2 = 1.0; // sin(90) fVCos2 = 0.0; // cos(90) + sal_uInt16 nUpperVert = (sal_uInt16)GetVerticalSegments(); - for (USHORT nV = 0; nV < nVSegments; nV++) + for (USHORT nV = 0; nV < nUpperVert; nV++) { Vector3D aPos; @@ -238,17 +247,17 @@ void E3dSphereObj::CreateGeometry() if(GetCreateTexture()) { aTexture3D[1].X() = - (double)(nHSegments - (nH + 1)) / (double)nHSegments; + (double)(nUpperBound - (nH + 1)) / (double)nUpperBound; aTexture3D[1].Y() = - (double)nV / (double)nVSegments; + (double)nV / (double)nUpperVert; aTexture3D[2].X() = - (double)((nHSegments - (nH + 1)) - 1) / (double)nHSegments; + (double)((nUpperBound - (nH + 1)) - 1) / (double)nUpperBound; aTexture3D[2].Y() = aTexture3D[1].Y(); aTexture3D[3].X() = aTexture3D[2].X(); aTexture3D[3].Y() = - (double)(nV+1) / (double)nVSegments; + (double)(nV+1) / (double)nUpperVert; aTexture3D[0].X() = aTexture3D[1].X(); aTexture3D[0].Y() = aTexture3D[3].Y(); @@ -329,11 +338,11 @@ SdrObject *E3dSphereObj::DoConvertToPolyObj(BOOL bBezier) const void E3dSphereObj::ReSegment(long nHSegs, long nVSegs) { - if ((nHSegs != nHSegments || nVSegs != nVSegments) && + if((nHSegs != GetHorizontalSegments() || nVSegs != GetVerticalSegments()) && (nHSegs != 0 || nVSegs != 0)) { - nHSegments = nHSegs; - nVSegments = nVSegs; + mpObjectItemSet->Put(Svx3DHorizontalSegmentsItem(nHSegs)); + mpObjectItemSet->Put(Svx3DVerticalSegmentsItem(nVSegs)); bGeometryValid = FALSE; } @@ -405,13 +414,18 @@ void E3dSphereObj::WriteData(SvStream& rOut) const E3dObject::WriteOnlyOwnMembers(rOut); } // Das gehrt zu E3dSphere - rOut << nHSegments; - rOut << nVSegments; +//-/ rOut << nHSegments; + rOut << GetHorizontalSegments(); + +//-/ rOut << nVSegments; + rOut << GetVerticalSegments(); + rOut << aCenter; rOut << aSize; // Das hier ist ein Merkmal eines Compound-Objektes - rOut << bDoubleSided; +//-/ rOut << bDoubleSided; + rOut << GetDoubleSided(); // Ab Version 395 (8.6.98): Parameter aus dem Objekt // E3dCompoundObject. Da irgendwann mal jemand die Ableitungs- @@ -419,24 +433,54 @@ void E3dSphereObj::WriteData(SvStream& rOut) const // bisher NOCH NIE gespeichert (Grrr). Diese Stelle muss nun natuerlich // auch IMMER MITGEPFLEGT werden, wenn sich Parameter in // E3dCompoundObject oder E3dObject aendern. - rOut << BOOL(bDoubleSided); +//-/ rOut << BOOL(bDoubleSided); + rOut << GetDoubleSided(); + rOut << BOOL(bCreateNormals); rOut << BOOL(bCreateTexture); - rOut << BOOL(bUseStdNormals); - rOut << BOOL(bUseStdNormalsUseSphere); - rOut << BOOL(bUseStdTextureX); - rOut << BOOL(bUseStdTextureXUseSphere); - rOut << BOOL(bUseStdTextureY); - rOut << BOOL(bUseStdTextureYUseSphere); - rOut << BOOL(bShadow3D); - aFrontMaterial.WriteData(rOut); + +//-/ rOut << BOOL(bUseStdNormals); +//-/ rOut << BOOL(bUseStdNormalsUseSphere); + sal_uInt16 nVal = GetNormalsKind(); + rOut << BOOL(nVal > 0); + rOut << BOOL(nVal > 1); + +//-/ rOut << BOOL(bUseStdTextureX); +//-/ rOut << BOOL(bUseStdTextureXUseSphere); + nVal = GetTextureProjectionX(); + rOut << BOOL(nVal > 0); + rOut << BOOL(nVal > 1); + +//-/ rOut << BOOL(bUseStdTextureY); +//-/ rOut << BOOL(bUseStdTextureYUseSphere); + nVal = GetTextureProjectionY(); + rOut << BOOL(nVal > 0); + rOut << BOOL(nVal > 1); + +//-/ rOut << BOOL(bShadow3D); + rOut << BOOL(GetShadow3D()); + +//-/ aFrontMaterial.WriteData(rOut); + rOut << GetMaterialAmbientColor(); + rOut << GetMaterialColor(); + rOut << GetMaterialSpecular(); + rOut << GetMaterialEmission(); + rOut << GetMaterialSpecularIntensity(); + aBackMaterial.WriteData(rOut); - rOut << (UINT16)eTextureKind; - rOut << (UINT16)eTextureMode; - rOut << BOOL(bInvertNormals); + +//-/ rOut << (UINT16)eTextureKind; + rOut << (UINT16)GetTextureKind(); + +//-/ rOut << (UINT16)eTextureMode; + rOut << (UINT16)GetTextureMode(); + +//-/ rOut << BOOL(bInvertNormals); + rOut << BOOL(GetNormalsInvert()); // neu ab 534: (hat noch gefehlt) - rOut << BOOL(bFilterTexture); +//-/ rOut << BOOL(bFilterTexture); + rOut << BOOL(GetTextureFilter()); if(nVersion < 3800) { @@ -459,6 +503,8 @@ void E3dSphereObj::ReadData31(const SdrObjIOHeader& rHead, SvStream& rIn) #endif // dann die Member UINT16 nTmp16; + sal_Int32 nTmp32; + pSub->Load(rIn, *pPage); // FG: Die Daten des 3D-Objektes rIn >> aLocalBoundVol; @@ -472,8 +518,15 @@ void E3dSphereObj::ReadData31(const SdrObjIOHeader& rHead, SvStream& rIn) rIn >> nPartOfParent; rIn >> nTmp16; eDragDetail = E3dDragDetail(nTmp16); // FG: Die Daten der Kugel - rIn >> nHSegments; - rIn >> nVSegments; + +//-/ rIn >> nHSegments; + rIn >> nTmp32; + mpObjectItemSet->Put(Svx3DHorizontalSegmentsItem(nTmp32)); + +//-/ rIn >> nVSegments; + rIn >> nTmp32; + mpObjectItemSet->Put(Svx3DVerticalSegmentsItem(nTmp32)); + rIn >> aCenter; rIn >> aSize; @@ -530,15 +583,23 @@ void E3dSphereObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn) if (aCompat.GetBytesLeft ()) { // neue Member - rIn >> nHSegments; - rIn >> nVSegments; +//-/ rIn >> nHSegments; + sal_Int32 nTmp32; + + rIn >> nTmp32; + mpObjectItemSet->Put(Svx3DHorizontalSegmentsItem(nTmp32)); + + rIn >> nTmp32; + mpObjectItemSet->Put(Svx3DVerticalSegmentsItem(nTmp32)); + rIn >> aCenter; rIn >> aSize; if (aCompat.GetBytesLeft ()) { rIn >> bMyDoubleSided; - bDoubleSided = bMyDoubleSided; // FG: Member des E3dCompounds wird dort eigentlich - } // sowieso nochmal gemacht, ist aber sicherer so. +//-/ bDoubleSided = bMyDoubleSided; + mpObjectItemSet->Put(Svx3DDoubleSidedItem(bMyDoubleSided)); + } if (aCompat.GetBytesLeft()) { @@ -548,31 +609,99 @@ void E3dSphereObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn) // bisher NOCH NIE gespeichert (Grrr). Diese Stelle muss nun natuerlich // auch IMMER MITGEPFLEGT werden, wenn sich Parameter in // E3dCompoundObject oder E3dObject aendern. - BOOL bTmp; - UINT16 nTmp16; + BOOL bTmp, bTmp2; + sal_uInt16 nTmp; + +//-/ rIn >> bTmp; bDoubleSided = bTmp; + rIn >> bTmp; + mpObjectItemSet->Put(Svx3DDoubleSidedItem(bTmp)); - rIn >> bTmp; bDoubleSided = bTmp; rIn >> bTmp; bCreateNormals = bTmp; rIn >> bTmp; bCreateTexture = bTmp; - rIn >> bTmp; bUseStdNormals = bTmp; - rIn >> bTmp; bUseStdNormalsUseSphere = bTmp; - rIn >> bTmp; bUseStdTextureX = bTmp; - rIn >> bTmp; bUseStdTextureXUseSphere = bTmp; - rIn >> bTmp; bUseStdTextureY = bTmp; - rIn >> bTmp; bUseStdTextureYUseSphere = bTmp; - rIn >> bTmp; bShadow3D = bTmp; - aFrontMaterial.ReadData(rIn); + +//-/ rIn >> bTmp; bUseStdNormals = bTmp; +//-/ rIn >> bTmp; bUseStdNormalsUseSphere = bTmp; + rIn >> bTmp; + rIn >> bTmp2; + if(bTmp == FALSE && bTmp2 == FALSE) + nTmp = 0; + else if(bTmp == TRUE && bTmp2 == FALSE) + nTmp = 1; + else + nTmp = 2; + mpObjectItemSet->Put(Svx3DNormalsKindItem(nTmp)); + +//-/ rIn >> bTmp; bUseStdTextureX = bTmp; +//-/ rIn >> bTmp; bUseStdTextureXUseSphere = bTmp; + rIn >> bTmp; + rIn >> bTmp2; + if(bTmp == FALSE && bTmp2 == FALSE) + nTmp = 0; + else if(bTmp == TRUE && bTmp2 == FALSE) + nTmp = 1; + else + nTmp = 2; + mpObjectItemSet->Put(Svx3DTextureProjectionXItem(nTmp)); + +//-/ rIn >> bTmp; bUseStdTextureY = bTmp; +//-/ rIn >> bTmp; bUseStdTextureYUseSphere = bTmp; + rIn >> bTmp; + rIn >> bTmp2; + if(bTmp == FALSE && bTmp2 == FALSE) + nTmp = 0; + else if(bTmp == TRUE && bTmp2 == FALSE) + nTmp = 1; + else + nTmp = 2; + mpObjectItemSet->Put(Svx3DTextureProjectionYItem(nTmp)); + +//-/ rIn >> bTmp; bShadow3D = bTmp; + rIn >> bTmp; + mpObjectItemSet->Put(Svx3DShadow3DItem(bTmp)); + +//-/ aFrontMaterial.ReadData(rIn); + Color aCol; + + rIn >> aCol; + SetMaterialAmbientColor(aCol); + + rIn >> aCol; +//-/ SetItem(Svx3DMaterialColorItem(aCol)); + // do NOT use, this is the old 3D-Color(!) + // SetItem(XFillColorItem(String(), aCol)); + + rIn >> aCol; + mpObjectItemSet->Put(Svx3DMaterialSpecularItem(aCol)); + + rIn >> aCol; + mpObjectItemSet->Put(Svx3DMaterialEmissionItem(aCol)); + + rIn >> nTmp; + mpObjectItemSet->Put(Svx3DMaterialSpecularIntensityItem(nTmp)); + aBackMaterial.ReadData(rIn); - rIn >> nTmp16; eTextureKind = Base3DTextureKind(nTmp16); - rIn >> nTmp16; eTextureMode = Base3DTextureMode(nTmp16); - rIn >> bTmp; bInvertNormals = bTmp; + +//-/ rIn >> nTmp16; eTextureKind = Base3DTextureKind(nTmp16); + rIn >> nTmp; + mpObjectItemSet->Put(Svx3DTextureKindItem(nTmp)); + +//-/ rIn >> nTmp16; eTextureMode = Base3DTextureMode(nTmp16); + rIn >> nTmp; + mpObjectItemSet->Put(Svx3DTextureModeItem(nTmp)); + +//-/ rIn >> bTmp; bInvertNormals = bTmp; + rIn >> bTmp; + mpObjectItemSet->Put(Svx3DNormalsInvertItem(bTmp)); + } // neu ab 534: (hat noch gefehlt) if (aCompat.GetBytesLeft () >= sizeof (BOOL)) { BOOL bTmp; - rIn >> bTmp; bFilterTexture = bTmp; +//-/ rIn >> bTmp; bFilterTexture = bTmp; + rIn >> bTmp; + mpObjectItemSet->Put(Svx3DTextureFilterItem(bTmp)); } } else @@ -601,8 +730,8 @@ void E3dSphereObj::operator=(const SdrObject& rObj) // weitere Parameter kopieren const E3dSphereObj& r3DObj = (const E3dSphereObj&) rObj; - nHSegments = r3DObj.nHSegments; - nVSegments = r3DObj.nVSegments; +//-/ nHSegments = r3DObj.nHSegments; +//-/ nVSegments = r3DObj.nVSegments; aCenter = r3DObj.aCenter; aSize = r3DObj.aSize; } @@ -681,14 +810,16 @@ void E3dSphereObj::ImpLocalItemValueChange(const SfxPoolItem& rNew) { case SDRATTR_3DOBJ_HORZ_SEGS: { - UINT32 nNew = ((const Svx3DHorizontalSegmentsItem&)rNew).GetValue(); - ImpSetHSegments(nNew); + bGeometryValid = FALSE; +//-/ UINT32 nNew = ((const Svx3DHorizontalSegmentsItem&)rNew).GetValue(); +//-/ ImpSetHSegments(nNew); break; } case SDRATTR_3DOBJ_VERT_SEGS: { - UINT32 nNew = ((const Svx3DVerticalSegmentsItem&)rNew).GetValue(); - ImpSetVSegments(nNew); + bGeometryValid = FALSE; +//-/ UINT32 nNew = ((const Svx3DVerticalSegmentsItem&)rNew).GetValue(); +//-/ ImpSetVSegments(nNew); break; } } @@ -724,7 +855,8 @@ void E3dSphereObj::SetItemSet( const SfxItemSet& rSet ) // handle value change for(sal_uInt16 nWhich(SDRATTR_3DOBJ_HORZ_SEGS); nWhich <= SDRATTR_3DOBJ_VERT_SEGS; nWhich++) - ImpLocalItemValueChange(rSet.Get(nWhich)); + if(SFX_ITEM_SET == rSet.GetItemState(nWhich, FALSE)) + ImpLocalItemValueChange(rSet.Get(nWhich)); } //-/void E3dSphereObj::NbcSetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll) @@ -753,21 +885,21 @@ void E3dSphereObj::SetItemSet( const SfxItemSet& rSet ) |* \************************************************************************/ -void E3dSphereObj::Collect3DAttributes(SfxItemSet& rAttr) const -{ - // call parent - E3dCompoundObject::Collect3DAttributes(rAttr); - - // special Attr for E3dSphereObj - long nObjHorzSegs = nHSegments; - long nObjVertSegs = nVSegments; - - // HorizSegs - rAttr.Put(SfxUInt32Item(SDRATTR_3DOBJ_HORZ_SEGS, nObjHorzSegs)); - - // VertSegs - rAttr.Put(SfxUInt32Item(SDRATTR_3DOBJ_VERT_SEGS, nObjVertSegs)); -} +//-/void E3dSphereObj::Collect3DAttributes(SfxItemSet& rAttr) const +//-/{ +//-/ // call parent +//-/ E3dCompoundObject::Collect3DAttributes(rAttr); +//-/ +//-/ // special Attr for E3dSphereObj +//-/ long nObjHorzSegs = nHSegments; +//-/ long nObjVertSegs = nVSegments; +//-/ +//-/ // HorizSegs +//-/ rAttr.Put(Svx3DHorizontalSegmentsItem(nObjHorzSegs)); +//-/ +//-/ // VertSegs +//-/ rAttr.Put(Svx3DVerticalSegmentsItem(nObjVertSegs)); +//-/} //-/void E3dSphereObj::TakeAttributes(SfxItemSet& rAttr, FASTBOOL bMerge, FASTBOOL bOnlyHardAttr) const //-/{ @@ -844,22 +976,22 @@ void E3dSphereObj::TakeObjNamePlural(XubString& rName) const rName=ImpGetResStr(STR_ObjNamePluralSphere3d); } -void E3dSphereObj::ImpSetHSegments(long nNew) -{ - if(nHSegments != nNew) - { - nHSegments = nNew; - bGeometryValid = FALSE; - } -} +//-/void E3dSphereObj::ImpSetHSegments(long nNew) +//-/{ +//-/ if(nHSegments != nNew) +//-/ { +//-/ nHSegments = nNew; +//-/ bGeometryValid = FALSE; +//-/ } +//-/} -void E3dSphereObj::ImpSetVSegments(long nNew) -{ - if(nVSegments != nNew) - { - nVSegments = nNew; - bGeometryValid = FALSE; - } -} +//-/void E3dSphereObj::ImpSetVSegments(long nNew) +//-/{ +//-/ if(nVSegments != nNew) +//-/ { +//-/ nVSegments = nNew; +//-/ bGeometryValid = FALSE; +//-/ } +//-/} // EOF diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx index 27a1a8b4902e..45fb934085ef 100644 --- a/svx/source/engine3d/view3d.cxx +++ b/svx/source/engine3d/view3d.cxx @@ -2,9 +2,9 @@ * * $RCSfile: view3d.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2000-10-30 10:55:03 $ + * last change: $Author: aw $ $Date: 2000-11-07 12:52:02 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -872,7 +872,9 @@ void E3dView::ImpCreateSingle3DObjectFlat(E3dScene* pScene, SdrObject* pObj, BOO // eine beidseitige Darstellung notwendig. aDefault.SetDefaultExtrudeCloseFront(FALSE); aDefault.SetDefaultExtrudeCloseBack(FALSE); - aDefault.SetDefaultDoubleSided(TRUE); + +//-/ aDefault.SetDefaultDoubleSided(TRUE); + aSet.Put(Svx3DDoubleSidedItem(TRUE)); // Fuellattribut setzen aSet.Put(XFillStyleItem(XFILL_SOLID)); diff --git a/svx/source/msfilter/msdffimp.cxx b/svx/source/msfilter/msdffimp.cxx index 54e6dcc69520..53922be3f6dc 100644 --- a/svx/source/msfilter/msdffimp.cxx +++ b/svx/source/msfilter/msdffimp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: msdffimp.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: sj $ $Date: 2000-11-06 17:09:15 $ + * last change: $Author: aw $ $Date: 2000-11-07 12:55:54 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -2463,7 +2463,7 @@ SdrObject* SvxMSDffManager::Import3DObject( SdrObject* pRet, SfxItemSet& aSet, R { E3dExtrudeObj* pSingleExtrude = (E3dExtrudeObj*)pSingleObj; //-/ if ( nVal != (long)pSingleExtrude->GetExtrudeDepth() ) - sal_uInt32 nSingleExtrudeDepth = (sal_uInt32)((Svx3DDepthItem&)(pSingleExtrude->GetItem(SDRATTR_3DOBJ_DEPTH))).GetValue(); + sal_Int32 nSingleExtrudeDepth = pSingleExtrude->GetExtrudeDepth(); if( nVal != (sal_Int32)nSingleExtrudeDepth) { if ( nVal == 338667 ) @@ -2560,7 +2560,7 @@ SdrObject* SvxMSDffManager::Import3DObject( SdrObject* pRet, SfxItemSet& aSet, R E3dExtrudeObj* pSingleExtrude = (E3dExtrudeObj*)pSingleObj; //-/ double fFrontPlaneDepth = pSingleExtrude->GetExtrudeDepth(); - double fFrontPlaneDepth = (double)((Svx3DDepthItem&)(pSingleExtrude->GetItem(SDRATTR_3DOBJ_DEPTH))).GetValue(); + double fFrontPlaneDepth = (double)pSingleExtrude->GetExtrudeDepth(); if ( bUseBackSide ) fFrontPlaneDepth = 0.0; diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index 4f8b8bc170b2..26c915bd8a00 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -2,9 +2,9 @@ * * $RCSfile: svdmodel.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: cl $ $Date: 2000-11-02 16:12:23 $ + * last change: $Author: aw $ $Date: 2000-11-07 12:58:27 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -2429,21 +2429,27 @@ void SdrModel::PreSave() { sal_uInt16 nCnt(GetMasterPageCount()); - for(sal_uInt16 i(0); i < nCnt; i++) + for(sal_uInt16 a(0); a < nCnt; a++) { // MasterPages - SdrObjListIter aIter(*GetMasterPage(i)); - while(aIter.IsMore()) - aIter.Next()->PreSave(); + const SdrObjList& rObjList = *GetMasterPage(a); + for(sal_uInt32 b(0); b < rObjList.GetObjCount(); b++) + rObjList.GetObj(b)->PreSave(); +//-/ SdrObjListIter aIter(*GetMasterPage(i), IM_FLAT); +//-/ while(aIter.IsMore()) +//-/ aIter.Next()->PreSave(); } nCnt = GetPageCount(); - for(i = 0; i < nCnt; i++) + for(a = 0; a < nCnt; a++) { // Pages - SdrObjListIter aIter(*GetPage(i)); - while(aIter.IsMore()) - aIter.Next()->PreSave(); + const SdrObjList& rObjList = *GetPage(a); + for(sal_uInt32 b(0); b < rObjList.GetObjCount(); b++) + rObjList.GetObj(b)->PreSave(); +//-/ SdrObjListIter aIter(*GetPage(i), IM_FLAT); +//-/ while(aIter.IsMore()) +//-/ aIter.Next()->PreSave(); } } @@ -2451,21 +2457,27 @@ void SdrModel::PostSave() { sal_uInt16 nCnt(GetMasterPageCount()); - for(sal_uInt16 i(0); i < nCnt; i++) + for(sal_uInt16 a(0); a < nCnt; a++) { // MasterPages - SdrObjListIter aIter(*GetMasterPage(i)); - while(aIter.IsMore()) - aIter.Next()->PostSave(); + const SdrObjList& rObjList = *GetMasterPage(a); + for(sal_uInt32 b(0); b < rObjList.GetObjCount(); b++) + rObjList.GetObj(b)->PostSave(); +//-/ SdrObjListIter aIter(*GetMasterPage(i), IM_FLAT); +//-/ while(aIter.IsMore()) +//-/ aIter.Next()->PreSave(); } nCnt = GetPageCount(); - for(i = 0; i < nCnt; i++) + for(a = 0; a < nCnt; a++) { // Pages - SdrObjListIter aIter(*GetPage(i)); - while(aIter.IsMore()) - aIter.Next()->PostSave(); + const SdrObjList& rObjList = *GetPage(a); + for(sal_uInt32 b(0); b < rObjList.GetObjCount(); b++) + rObjList.GetObj(b)->PostSave(); +//-/ SdrObjListIter aIter(*GetPage(i), IM_FLAT); +//-/ while(aIter.IsMore()) +//-/ aIter.Next()->PreSave(); } } diff --git a/svx/source/svdraw/svdoattr.cxx b/svx/source/svdraw/svdoattr.cxx index 2b7b6011d449..bf16a3a82b3a 100644 --- a/svx/source/svdraw/svdoattr.cxx +++ b/svx/source/svdraw/svdoattr.cxx @@ -2,9 +2,9 @@ * * $RCSfile: svdoattr.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2000-10-30 11:11:37 $ + * last change: $Author: aw $ $Date: 2000-11-07 12:58:27 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1186,6 +1186,11 @@ void SdrAttrObj::ForceDefaultAttr() //////////////////////////////////////////////////////////////////////////////////////////////////// // ItemSet access +const SfxItemSet& SdrAttrObj::GetUnmergedItemSet() const +{ + return SdrAttrObj::GetItemSet(); +} + const SfxItemSet& SdrAttrObj::GetItemSet() const { ((SdrAttrObj*)this)->ImpForceItemSet(); diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx index f131c4d22fe6..6b252ed75ced 100644 --- a/svx/source/svdraw/svdocirc.cxx +++ b/svx/source/svdraw/svdocirc.cxx @@ -2,9 +2,9 @@ * * $RCSfile: svdocirc.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: aw $ $Date: 2000-10-30 11:11:37 $ + * last change: $Author: aw $ $Date: 2000-11-07 12:58:28 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1637,13 +1637,13 @@ void SdrCircObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn) if(eKindA != SDRCIRC_FULL) { - SetItem(SdrCircKindItem(eKindA)); + mpObjectItemSet->Put(SdrCircKindItem(eKindA)); if(nStartWink) - SetItem(SdrCircStartAngleItem(nStartWink)); + mpObjectItemSet->Put(SdrCircStartAngleItem(nStartWink)); if(nEndWink != 36000) - SetItem(SdrCircEndAngleItem(nEndWink)); + mpObjectItemSet->Put(SdrCircEndAngleItem(nEndWink)); } } } diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx index 388f9c7fcfeb..78f4d28fdf50 100644 --- a/svx/source/svdraw/svdogrp.cxx +++ b/svx/source/svdraw/svdogrp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: svdogrp.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2000-10-30 11:11:37 $ + * last change: $Author: aw $ $Date: 2000-11-07 12:58:28 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1480,6 +1480,30 @@ SfxItemSet* SdrObjGroup::CreateNewItemSet(SfxItemPool& rPool) return new SfxItemSet(rPool, SDRATTR_START, SDRATTR_END); } + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// pre- and postprocessing for objects for saving + +void SdrObjGroup::PreSave() +{ + if(!IsLinkedGroup()) + { + sal_uInt32 nCount(pSub->GetObjCount()); + for(sal_uInt32 a(0); a < nCount; a++) + pSub->GetObj(a)->PreSave(); + } +} + +void SdrObjGroup::PostSave() +{ + if(!IsLinkedGroup()) + { + sal_uInt32 nCount(pSub->GetObjCount()); + for(sal_uInt32 a(0); a < nCount; a++) + pSub->GetObj(a)->PostSave(); + } +} + //-/void SdrObjGroup::BroadcastItemChange(const SdrBroadcastItemChange& rChange) //-/{ //-/ if(!IsLinkedGroup()) diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx index 1f3b7e03b8f2..43e2991edba3 100644 --- a/svx/source/svdraw/svdotext.cxx +++ b/svx/source/svdraw/svdotext.cxx @@ -2,9 +2,9 @@ * * $RCSfile: svdotext.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: aw $ $Date: 2000-10-30 11:11:37 $ + * last change: $Author: aw $ $Date: 2000-11-07 12:58:28 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1893,11 +1893,11 @@ void SdrTextObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn) if(rHead.GetVersion() < 12 && !bTextFrame) { - SetItem(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_CENTER)); - SetItem(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_CENTER)); + mpObjectItemSet->Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_CENTER)); + mpObjectItemSet->Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_CENTER)); //-/ SdrOutlinerSetItem aOutl(*pOutlAttr); //-/ aOutl.GetItemSet().Put(SvxAdjustItem(SVX_ADJUST_CENTER)); - SetItem(SvxAdjustItem(SVX_ADJUST_CENTER)); + mpObjectItemSet->Put(SvxAdjustItem(SVX_ADJUST_CENTER)); } if (bTextFrame && pOutlinerParaObject!=NULL) diff --git a/svx/source/svdraw/svdovirt.cxx b/svx/source/svdraw/svdovirt.cxx index 4d29285c37b1..a6aa6e08cee9 100644 --- a/svx/source/svdraw/svdovirt.cxx +++ b/svx/source/svdraw/svdovirt.cxx @@ -2,9 +2,9 @@ * * $RCSfile: svdovirt.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: aw $ $Date: 2000-11-01 13:27:31 $ + * last change: $Author: aw $ $Date: 2000-11-07 12:58:28 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -613,6 +613,17 @@ SfxItemSet* SdrVirtObj::CreateNewItemSet(SfxItemPool& rPool) } //////////////////////////////////////////////////////////////////////////////////////////////////// +// pre- and postprocessing for objects for saving + +void SdrVirtObj::PreSave() +{ +} + +void SdrVirtObj::PostSave() +{ +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// SfxStyleSheet* SdrVirtObj::GetStyleSheet() const { |