LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/xmloff/source/draw - shapeexport3.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 252 0.0 %
Date: 2013-07-09 Functions: 0 4 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <com/sun/star/drawing/HomogenMatrix.hpp>
      21             : #include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
      22             : #include <com/sun/star/drawing/ProjectionMode.hpp>
      23             : #include <com/sun/star/drawing/ShadeMode.hpp>
      24             : #include <com/sun/star/drawing/Direction3D.hpp>
      25             : #include <com/sun/star/drawing/Position3D.hpp>
      26             : #include <com/sun/star/drawing/CameraGeometry.hpp>
      27             : #include <com/sun/star/drawing/DoubleSequence.hpp>
      28             : #include <tools/helpers.hxx>
      29             : 
      30             : #include <sax/tools/converter.hxx>
      31             : 
      32             : #include <xmloff/shapeexport.hxx>
      33             : #include "sdpropls.hxx"
      34             : #include <tools/debug.hxx>
      35             : #include <rtl/ustrbuf.hxx>
      36             : #include <xmloff/xmlexp.hxx>
      37             : #include <xmloff/xmluconv.hxx>
      38             : #include "xexptran.hxx"
      39             : #include <xmloff/xmltoken.hxx>
      40             : #include <basegfx/vector/b3dvector.hxx>
      41             : 
      42             : #include "xmloff/xmlnmspe.hxx"
      43             : 
      44             : 
      45             : using namespace ::com::sun::star;
      46             : using namespace ::xmloff::token;
      47             : 
      48             : 
      49             : //////////////////////////////////////////////////////////////////////////////
      50             : 
      51           0 : void XMLShapeExport::ImpExport3DSceneShape( const uno::Reference< drawing::XShape >& xShape, XmlShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint)
      52             : {
      53           0 :     uno::Reference< drawing::XShapes > xShapes(xShape, uno::UNO_QUERY);
      54           0 :     if(xShapes.is() && xShapes->getCount())
      55             :     {
      56           0 :         uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY );
      57             :         DBG_ASSERT( xPropSet.is(), "XMLShapeExport::ImpExport3DSceneShape can't export a scene without a propertyset" );
      58           0 :         if( xPropSet.is() )
      59             :         {
      60             :             // Transformation
      61           0 :             ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
      62             : 
      63             :             // 3d attributes
      64           0 :             export3DSceneAttributes( xPropSet );
      65             : 
      66             :             // write 3DScene shape
      67           0 :             sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
      68           0 :             SvXMLElementExport aOBJ( mrExport, XML_NAMESPACE_DR3D, XML_SCENE, bCreateNewline, sal_True);
      69             : 
      70           0 :             ImpExportDescription( xShape ); // #i68101#
      71           0 :             ImpExportEvents( xShape );
      72             : 
      73             :             // write 3DSceneLights
      74           0 :             export3DLamps( xPropSet );
      75             : 
      76             :             // #89764# if export of position is supressed for group shape,
      77             :             // positions of contained objects should be written relative to
      78             :             // the upper left edge of the group.
      79           0 :             awt::Point aUpperLeft;
      80             : 
      81           0 :             if(!(nFeatures & SEF_EXPORT_POSITION))
      82             :             {
      83           0 :                 nFeatures |= SEF_EXPORT_POSITION;
      84           0 :                 aUpperLeft = xShape->getPosition();
      85           0 :                 pRefPoint = &aUpperLeft;
      86             :             }
      87             : 
      88             :             // write members
      89           0 :             exportShapes( xShapes, nFeatures, pRefPoint );
      90           0 :         }
      91           0 :     }
      92           0 : }
      93             : 
      94             : //////////////////////////////////////////////////////////////////////////////
      95             : 
      96           0 : void XMLShapeExport::ImpExport3DShape(
      97             :     const uno::Reference< drawing::XShape >& xShape,
      98             :     XmlShapeType eShapeType, sal_Int32 /* nFeatures = SEF_DEFAULT */, awt::Point* /*pRefPoint = NULL */)
      99             : {
     100           0 :     const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
     101           0 :     if(xPropSet.is())
     102             :     {
     103           0 :         OUString aStr;
     104           0 :         OUStringBuffer sStringBuffer;
     105             : 
     106             :         // transformation (UNO_NAME_3D_TRANSFORM_MATRIX == "D3DTransformMatrix")
     107           0 :         uno::Any aAny = xPropSet->getPropertyValue("D3DTransformMatrix");
     108           0 :         drawing::HomogenMatrix xHomMat;
     109           0 :         aAny >>= xHomMat;
     110           0 :         SdXMLImExTransform3D aTransform;
     111           0 :         aTransform.AddHomogenMatrix(xHomMat);
     112           0 :         if(aTransform.NeedsAction())
     113           0 :             mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_TRANSFORM, aTransform.GetExportString(mrExport.GetMM100UnitConverter()));
     114             : 
     115           0 :         switch(eShapeType)
     116             :         {
     117             :             case XmlShapeTypeDraw3DCubeObject:
     118             :             {
     119             :                 // write 3DCube shape
     120           0 :                 SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DR3D, XML_CUBE, sal_True, sal_True);
     121             : 
     122             :                 // minEdge
     123           0 :                 aAny = xPropSet->getPropertyValue("D3DPosition");
     124           0 :                 drawing::Position3D aPosition3D;
     125           0 :                 aAny >>= aPosition3D;
     126           0 :                 ::basegfx::B3DVector aPos3D(aPosition3D.PositionX, aPosition3D.PositionY, aPosition3D.PositionZ);
     127             : 
     128             :                 // maxEdge
     129           0 :                 aAny = xPropSet->getPropertyValue("D3DSize");
     130           0 :                 drawing::Direction3D aDirection3D;
     131           0 :                 aAny >>= aDirection3D;
     132           0 :                 ::basegfx::B3DVector aDir3D(aDirection3D.DirectionX, aDirection3D.DirectionY, aDirection3D.DirectionZ);
     133             : 
     134             :                 // transform maxEdge from distance to pos
     135           0 :                 aDir3D = aPos3D + aDir3D;
     136             : 
     137             :                 // write minEdge
     138           0 :                 if(aPos3D != ::basegfx::B3DVector(-2500.0, -2500.0, -2500.0)) // write only when not default
     139             :                 {
     140           0 :                     mrExport.GetMM100UnitConverter().convertB3DVector(sStringBuffer, aPos3D);
     141           0 :                     aStr = sStringBuffer.makeStringAndClear();
     142           0 :                     mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_MIN_EDGE, aStr);
     143             :                 }
     144             : 
     145             :                 // write maxEdge
     146           0 :                 if(aDir3D != ::basegfx::B3DVector(2500.0, 2500.0, 2500.0)) // write only when not default
     147             :                 {
     148           0 :                     mrExport.GetMM100UnitConverter().convertB3DVector(sStringBuffer, aDir3D);
     149           0 :                     aStr = sStringBuffer.makeStringAndClear();
     150           0 :                     mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_MAX_EDGE, aStr);
     151             :                 }
     152             : 
     153           0 :                 break;
     154             :             }
     155             :             case XmlShapeTypeDraw3DSphereObject:
     156             :             {
     157             :                 // write 3DSphere shape
     158           0 :                 SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DR3D, XML_SPHERE, sal_True, sal_True);
     159             : 
     160             :                 // Center
     161           0 :                 aAny = xPropSet->getPropertyValue("D3DPosition");
     162           0 :                 drawing::Position3D aPosition3D;
     163           0 :                 aAny >>= aPosition3D;
     164           0 :                 ::basegfx::B3DVector aPos3D(aPosition3D.PositionX, aPosition3D.PositionY, aPosition3D.PositionZ);
     165             : 
     166             :                 // Size
     167           0 :                 aAny = xPropSet->getPropertyValue("D3DSize");
     168           0 :                 drawing::Direction3D aDirection3D;
     169           0 :                 aAny >>= aDirection3D;
     170           0 :                 ::basegfx::B3DVector aDir3D(aDirection3D.DirectionX, aDirection3D.DirectionY, aDirection3D.DirectionZ);
     171             : 
     172             :                 // write Center
     173           0 :                 if(aPos3D != ::basegfx::B3DVector(0.0, 0.0, 0.0)) // write only when not default
     174             :                 {
     175           0 :                     mrExport.GetMM100UnitConverter().convertB3DVector(sStringBuffer, aPos3D);
     176           0 :                     aStr = sStringBuffer.makeStringAndClear();
     177           0 :                     mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_CENTER, aStr);
     178             :                 }
     179             : 
     180             :                 // write Size
     181           0 :                 if(aDir3D != ::basegfx::B3DVector(5000.0, 5000.0, 5000.0)) // write only when not default
     182             :                 {
     183           0 :                     mrExport.GetMM100UnitConverter().convertB3DVector(sStringBuffer, aDir3D);
     184           0 :                     aStr = sStringBuffer.makeStringAndClear();
     185           0 :                     mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_SIZE, aStr);
     186             :                 }
     187             : 
     188           0 :                 break;
     189             :             }
     190             :             case XmlShapeTypeDraw3DLatheObject:
     191             :             case XmlShapeTypeDraw3DExtrudeObject:
     192             :             {
     193             :                 // write special 3DLathe/3DExtrude attributes
     194           0 :                 aAny = xPropSet->getPropertyValue("D3DPolyPolygon3D");
     195           0 :                 drawing::PolyPolygonShape3D xPolyPolygon3D;
     196           0 :                 aAny >>= xPolyPolygon3D;
     197             : 
     198             :                 // look for maximal values
     199           0 :                 double fXMin = 0;
     200           0 :                 double fXMax = 0;
     201           0 :                 double fYMin = 0;
     202           0 :                 double fYMax = 0;
     203           0 :                 sal_Bool bInit(sal_False);
     204           0 :                 sal_Int32 nOuterSequenceCount(xPolyPolygon3D.SequenceX.getLength());
     205           0 :                 drawing::DoubleSequence* pInnerSequenceX = xPolyPolygon3D.SequenceX.getArray();
     206           0 :                 drawing::DoubleSequence* pInnerSequenceY = xPolyPolygon3D.SequenceY.getArray();
     207             : 
     208             :                 sal_Int32 a;
     209           0 :                 for (a = 0; a < nOuterSequenceCount; a++)
     210             :                 {
     211           0 :                     sal_Int32 nInnerSequenceCount(pInnerSequenceX->getLength());
     212           0 :                     double* pArrayX = pInnerSequenceX->getArray();
     213           0 :                     double* pArrayY = pInnerSequenceY->getArray();
     214             : 
     215           0 :                     for(sal_Int32 b(0L); b < nInnerSequenceCount; b++)
     216             :                     {
     217           0 :                         double fX = *pArrayX++;
     218           0 :                         double fY = *pArrayY++;
     219             : 
     220           0 :                         if(bInit)
     221             :                         {
     222           0 :                             if(fX > fXMax)
     223           0 :                                 fXMax = fX;
     224             : 
     225           0 :                             if(fX < fXMin)
     226           0 :                                 fXMin = fX;
     227             : 
     228           0 :                             if(fY > fYMax)
     229           0 :                                 fYMax = fY;
     230             : 
     231           0 :                             if(fY < fYMin)
     232           0 :                                 fYMin = fY;
     233             :                         }
     234             :                         else
     235             :                         {
     236           0 :                             fXMin = fXMax = fX;
     237           0 :                             fYMin = fYMax = fY;
     238           0 :                             bInit = sal_True;
     239             :                         }
     240             :                     }
     241             : 
     242           0 :                     pInnerSequenceX++;
     243           0 :                     pInnerSequenceY++;
     244             :                 }
     245             : 
     246             :                 // export ViewBox
     247           0 :                 awt::Point aMinPoint(FRound(fXMin), FRound(fYMin));
     248           0 :                 awt::Size aMaxSize(FRound(fXMax) - aMinPoint.X, FRound(fYMax) - aMinPoint.Y);
     249             :                 SdXMLImExViewBox aViewBox(
     250           0 :                     aMinPoint.X, aMinPoint.Y, aMaxSize.Width, aMaxSize.Height);
     251             :                 mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX,
     252           0 :                     aViewBox.GetExportString());
     253             : 
     254             :                 // prepare svx:d element export
     255           0 :                 SdXMLImExSvgDElement aSvgDElement(aViewBox, GetExport());
     256           0 :                 pInnerSequenceX = xPolyPolygon3D.SequenceX.getArray();
     257           0 :                 pInnerSequenceY = xPolyPolygon3D.SequenceY.getArray();
     258             : 
     259           0 :                 for (a = 0; a < nOuterSequenceCount; a++)
     260             :                 {
     261           0 :                     sal_Int32 nInnerSequenceCount(pInnerSequenceX->getLength());
     262           0 :                     double* pArrayX = pInnerSequenceX->getArray();
     263           0 :                     double* pArrayY = pInnerSequenceY->getArray();
     264           0 :                     drawing::PointSequence aPoly(nInnerSequenceCount);
     265           0 :                     awt::Point* pInnerSequence = aPoly.getArray();
     266             : 
     267           0 :                     for(sal_Int32 b(0L); b < nInnerSequenceCount; b++)
     268             :                     {
     269           0 :                         double fX = *pArrayX++;
     270           0 :                         double fY = *pArrayY++;
     271             : 
     272           0 :                         *pInnerSequence = awt::Point(FRound(fX), FRound(fY));
     273           0 :                         pInnerSequence++;
     274             :                     }
     275             : 
     276             :                     // calculate closed flag
     277           0 :                     awt::Point* pFirst = aPoly.getArray();
     278           0 :                     awt::Point* pLast = pFirst + (nInnerSequenceCount - 1);
     279           0 :                     sal_Bool bClosed = (pFirst->X == pLast->X && pFirst->Y == pLast->Y);
     280             : 
     281             :                     aSvgDElement.AddPolygon(&aPoly, 0L, aMinPoint,
     282           0 :                         aMaxSize, bClosed);
     283             : 
     284             :                     // #80594# corrected error in PolyPolygon3D export for 3D XML
     285           0 :                     pInnerSequenceX++;
     286           0 :                     pInnerSequenceY++;
     287           0 :                 }
     288             : 
     289             :                 // write point array
     290           0 :                 mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aSvgDElement.GetExportString());
     291             : 
     292           0 :                 if(eShapeType == XmlShapeTypeDraw3DLatheObject)
     293             :                 {
     294             :                     // write 3DLathe shape
     295           0 :                     SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DR3D, XML_ROTATE, sal_True, sal_True);
     296             :                 }
     297             :                 else
     298             :                 {
     299             :                     // write 3DExtrude shape
     300           0 :                     SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DR3D, XML_EXTRUDE, sal_True, sal_True);
     301             :                 }
     302           0 :                 break;
     303             :             }
     304             :             default:
     305           0 :                 break;
     306           0 :         }
     307           0 :     }
     308           0 : }
     309             : 
     310             : //////////////////////////////////////////////////////////////////////////////
     311             : 
     312             : /** helper for chart that adds all attributes of a 3d scene element to the export */
     313           0 : void XMLShapeExport::export3DSceneAttributes( const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xPropSet )
     314             : {
     315           0 :     OUString aStr;
     316           0 :     OUStringBuffer sStringBuffer;
     317             : 
     318             :     // world transformation (UNO_NAME_3D_TRANSFORM_MATRIX == "D3DTransformMatrix")
     319           0 :     uno::Any aAny = xPropSet->getPropertyValue("D3DTransformMatrix");
     320           0 :     drawing::HomogenMatrix xHomMat;
     321           0 :     aAny >>= xHomMat;
     322           0 :     SdXMLImExTransform3D aTransform;
     323           0 :     aTransform.AddHomogenMatrix(xHomMat);
     324           0 :     if(aTransform.NeedsAction())
     325           0 :         mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_TRANSFORM, aTransform.GetExportString(mrExport.GetMM100UnitConverter()));
     326             : 
     327             :     // VRP, VPN, VUP
     328           0 :     aAny = xPropSet->getPropertyValue("D3DCameraGeometry");
     329           0 :     drawing::CameraGeometry aCamGeo;
     330           0 :     aAny >>= aCamGeo;
     331             : 
     332           0 :     ::basegfx::B3DVector aVRP(aCamGeo.vrp.PositionX, aCamGeo.vrp.PositionY, aCamGeo.vrp.PositionZ);
     333           0 :     if(aVRP != ::basegfx::B3DVector(0.0, 0.0, 1.0)) // write only when not default
     334             :     {
     335           0 :         mrExport.GetMM100UnitConverter().convertB3DVector(sStringBuffer, aVRP);
     336           0 :         aStr = sStringBuffer.makeStringAndClear();
     337           0 :         mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_VRP, aStr);
     338             :     }
     339             : 
     340           0 :     ::basegfx::B3DVector aVPN(aCamGeo.vpn.DirectionX, aCamGeo.vpn.DirectionY, aCamGeo.vpn.DirectionZ);
     341           0 :     if(aVPN != ::basegfx::B3DVector(0.0, 0.0, 1.0)) // write only when not default
     342             :     {
     343           0 :         mrExport.GetMM100UnitConverter().convertB3DVector(sStringBuffer, aVPN);
     344           0 :         aStr = sStringBuffer.makeStringAndClear();
     345           0 :         mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_VPN, aStr);
     346             :     }
     347             : 
     348           0 :     ::basegfx::B3DVector aVUP(aCamGeo.vup.DirectionX, aCamGeo.vup.DirectionY, aCamGeo.vup.DirectionZ);
     349           0 :     if(aVUP != ::basegfx::B3DVector(0.0, 1.0, 0.0)) // write only when not default
     350             :     {
     351           0 :         mrExport.GetMM100UnitConverter().convertB3DVector(sStringBuffer, aVUP);
     352           0 :         aStr = sStringBuffer.makeStringAndClear();
     353           0 :         mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_VUP, aStr);
     354             :     }
     355             : 
     356             :     // projection "D3DScenePerspective" drawing::ProjectionMode
     357           0 :     aAny = xPropSet->getPropertyValue("D3DScenePerspective");
     358             :     drawing::ProjectionMode xPrjMode;
     359           0 :     aAny >>= xPrjMode;
     360           0 :     if(xPrjMode == drawing::ProjectionMode_PARALLEL)
     361           0 :         aStr = GetXMLToken(XML_PARALLEL);
     362             :     else
     363           0 :         aStr = GetXMLToken(XML_PERSPECTIVE);
     364           0 :     mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_PROJECTION, aStr);
     365             : 
     366             :     // distance
     367           0 :     aAny = xPropSet->getPropertyValue("D3DSceneDistance");
     368           0 :     sal_Int32 nDistance = 0;
     369           0 :     aAny >>= nDistance;
     370           0 :     mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
     371           0 :             nDistance);
     372           0 :     aStr = sStringBuffer.makeStringAndClear();
     373           0 :     mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_DISTANCE, aStr);
     374             : 
     375             :     // focalLength
     376           0 :     aAny = xPropSet->getPropertyValue("D3DSceneFocalLength");
     377           0 :     sal_Int32 nFocalLength = 0;
     378           0 :     aAny >>= nFocalLength;
     379           0 :     mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
     380           0 :             nFocalLength);
     381           0 :     aStr = sStringBuffer.makeStringAndClear();
     382           0 :     mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_FOCAL_LENGTH, aStr);
     383             : 
     384             :     // shadowSlant
     385           0 :     aAny = xPropSet->getPropertyValue("D3DSceneShadowSlant");
     386           0 :     sal_Int16 nShadowSlant = 0;
     387           0 :     aAny >>= nShadowSlant;
     388           0 :     ::sax::Converter::convertNumber(sStringBuffer, (sal_Int32)nShadowSlant);
     389           0 :     aStr = sStringBuffer.makeStringAndClear();
     390           0 :     mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_SHADOW_SLANT, aStr);
     391             : 
     392             :     // shadeMode
     393           0 :     aAny = xPropSet->getPropertyValue("D3DSceneShadeMode");
     394             :     drawing::ShadeMode xShadeMode;
     395           0 :     if(aAny >>= xShadeMode)
     396             :     {
     397           0 :         if(xShadeMode == drawing::ShadeMode_FLAT)
     398           0 :             aStr = GetXMLToken(XML_FLAT);
     399           0 :         else if(xShadeMode == drawing::ShadeMode_PHONG)
     400           0 :             aStr = GetXMLToken(XML_PHONG);
     401           0 :         else if(xShadeMode == drawing::ShadeMode_SMOOTH)
     402           0 :             aStr = GetXMLToken(XML_GOURAUD);
     403             :         else
     404           0 :             aStr = GetXMLToken(XML_DRAFT);
     405             :     }
     406             :     else
     407             :     {
     408             :         // ShadeMode enum not there, write default
     409           0 :         aStr = GetXMLToken(XML_GOURAUD);
     410             :     }
     411           0 :     mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_SHADE_MODE, aStr);
     412             : 
     413             :     // ambientColor
     414           0 :     aAny = xPropSet->getPropertyValue("D3DSceneAmbientColor");
     415           0 :     sal_Int32 nAmbientColor = 0;
     416           0 :     aAny >>= nAmbientColor;
     417           0 :     ::sax::Converter::convertColor(sStringBuffer, nAmbientColor);
     418           0 :     aStr = sStringBuffer.makeStringAndClear();
     419           0 :     mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_AMBIENT_COLOR, aStr);
     420             : 
     421             :     // lightingMode
     422           0 :     aAny = xPropSet->getPropertyValue("D3DSceneTwoSidedLighting");
     423           0 :     sal_Bool bTwoSidedLighting = false;
     424           0 :     aAny >>= bTwoSidedLighting;
     425           0 :     ::sax::Converter::convertBool(sStringBuffer, bTwoSidedLighting);
     426           0 :     aStr = sStringBuffer.makeStringAndClear();
     427           0 :     mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_LIGHTING_MODE, aStr);
     428           0 : }
     429             : 
     430             : /** helper for chart that exports all lamps from the propertyset */
     431           0 : void XMLShapeExport::export3DLamps( const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xPropSet )
     432             : {
     433             :     // write lamps 1..8 as content
     434           0 :     OUString aStr;
     435           0 :     OUStringBuffer sStringBuffer;
     436             : 
     437           0 :     const OUString aColorPropName("D3DSceneLightColor");
     438           0 :     const OUString aDirectionPropName("D3DSceneLightDirection");
     439           0 :     const OUString aLightOnPropName("D3DSceneLightOn");
     440             : 
     441           0 :     OUString aPropName;
     442           0 :     OUString aIndexStr;
     443           0 :     ::basegfx::B3DVector aLightDirection;
     444           0 :     drawing::Direction3D xLightDir;
     445           0 :     sal_Bool bLightOnOff = false;
     446           0 :     for(sal_Int32 nLamp = 1; nLamp <= 8; nLamp++)
     447             :     {
     448           0 :         aIndexStr = OUString::valueOf( nLamp );
     449             : 
     450             :         // lightcolor
     451           0 :         aPropName = aColorPropName;
     452           0 :         aPropName += aIndexStr;
     453           0 :         sal_Int32 nLightColor = 0;
     454           0 :         xPropSet->getPropertyValue( aPropName ) >>= nLightColor;
     455           0 :         ::sax::Converter::convertColor(sStringBuffer, nLightColor);
     456           0 :         aStr = sStringBuffer.makeStringAndClear();
     457           0 :         mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_DIFFUSE_COLOR, aStr);
     458             : 
     459             :         // lightdirection
     460           0 :         aPropName = aDirectionPropName;
     461           0 :         aPropName += aIndexStr;
     462           0 :         xPropSet->getPropertyValue(aPropName) >>= xLightDir;
     463           0 :         aLightDirection = ::basegfx::B3DVector(xLightDir.DirectionX, xLightDir.DirectionY, xLightDir.DirectionZ);
     464           0 :         mrExport.GetMM100UnitConverter().convertB3DVector(sStringBuffer, aLightDirection);
     465           0 :         aStr = sStringBuffer.makeStringAndClear();
     466           0 :         mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_DIRECTION, aStr);
     467             : 
     468             :         // lighton
     469           0 :         aPropName = aLightOnPropName;
     470           0 :         aPropName += aIndexStr;
     471           0 :         xPropSet->getPropertyValue(aPropName) >>= bLightOnOff;
     472           0 :         ::sax::Converter::convertBool(sStringBuffer, bLightOnOff);
     473           0 :         aStr = sStringBuffer.makeStringAndClear();
     474           0 :         mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_ENABLED, aStr);
     475             : 
     476             :         // specular
     477             :         mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_SPECULAR,
     478           0 :             nLamp == 1 ? XML_TRUE : XML_FALSE);
     479             : 
     480             :         // write light entry
     481           0 :         SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DR3D, XML_LIGHT, sal_True, sal_True);
     482           0 :     }
     483           0 : }
     484             : 
     485             : //////////////////////////////////////////////////////////////////////////////
     486             : 
     487             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10