LCOV - code coverage report
Current view: top level - xmloff/source/draw - ximp3dscene.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 7 223 3.1 %
Date: 2012-08-25 Functions: 2 19 10.5 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 1 438 0.2 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include <sax/tools/converter.hxx>
      31                 :            : 
      32                 :            : #include "ximp3dscene.hxx"
      33                 :            : #include <xmloff/xmluconv.hxx>
      34                 :            : #include "xexptran.hxx"
      35                 :            : #include <xmloff/xmltoken.hxx>
      36                 :            : #include "xmloff/xmlnmspe.hxx"
      37                 :            : #include <com/sun/star/drawing/Direction3D.hpp>
      38                 :            : #include <com/sun/star/drawing/CameraGeometry.hpp>
      39                 :            : #include "eventimp.hxx"
      40                 :            : #include "descriptionimp.hxx"
      41                 :            : 
      42                 :            : using ::rtl::OUString;
      43                 :            : using ::rtl::OUStringBuffer;
      44                 :            : 
      45                 :            : using namespace ::com::sun::star;
      46                 :            : using namespace ::xmloff::token;
      47                 :            : 
      48                 :            : //////////////////////////////////////////////////////////////////////////////
      49                 :            : // dr3d:3dlight context
      50                 :            : 
      51                 :          0 : SdXML3DLightContext::SdXML3DLightContext(
      52                 :            :     SvXMLImport& rImport,
      53                 :            :     sal_uInt16 nPrfx,
      54                 :            :     const rtl::OUString& rLName,
      55                 :            :     const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList)
      56                 :            : :   SvXMLImportContext( rImport, nPrfx, rLName),
      57                 :            :     maDiffuseColor(0x00000000),
      58                 :            :     maDirection(0.0, 0.0, 1.0),
      59                 :            :     mbEnabled(false),
      60                 :          0 :     mbSpecular(false)
      61                 :            : {
      62                 :            :     // read attributes for the 3DScene
      63 [ #  # ][ #  # ]:          0 :     sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
                 [ #  # ]
      64         [ #  # ]:          0 :     for(sal_Int16 i=0; i < nAttrCount; i++)
      65                 :            :     {
      66 [ #  # ][ #  # ]:          0 :         OUString sAttrName = xAttrList->getNameByIndex( i );
      67                 :          0 :         OUString aLocalName;
      68         [ #  # ]:          0 :         sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
      69 [ #  # ][ #  # ]:          0 :         OUString sValue = xAttrList->getValueByIndex( i );
      70 [ #  # ][ #  # ]:          0 :         const SvXMLTokenMap& rAttrTokenMap = GetImport().GetShapeImport()->Get3DLightAttrTokenMap();
         [ #  # ][ #  # ]
      71                 :            : 
      72 [ #  # ][ #  #  :          0 :         switch(rAttrTokenMap.Get(nPrefix, aLocalName))
                #  #  # ]
      73                 :            :         {
      74                 :            :             case XML_TOK_3DLIGHT_DIFFUSE_COLOR:
      75                 :            :             {
      76         [ #  # ]:          0 :                 ::sax::Converter::convertColor(maDiffuseColor, sValue);
      77                 :          0 :                 break;
      78                 :            :             }
      79                 :            :             case XML_TOK_3DLIGHT_DIRECTION:
      80                 :            :             {
      81         [ #  # ]:          0 :                 GetImport().GetMM100UnitConverter().convertB3DVector(maDirection, sValue);
      82                 :          0 :                 break;
      83                 :            :             }
      84                 :            :             case XML_TOK_3DLIGHT_ENABLED:
      85                 :            :             {
      86         [ #  # ]:          0 :                 ::sax::Converter::convertBool(mbEnabled, sValue);
      87                 :          0 :                 break;
      88                 :            :             }
      89                 :            :             case XML_TOK_3DLIGHT_SPECULAR:
      90                 :            :             {
      91         [ #  # ]:          0 :                 ::sax::Converter::convertBool(mbSpecular, sValue);
      92                 :          0 :                 break;
      93                 :            :             }
      94                 :            :         }
      95                 :          0 :     }
      96                 :          0 : }
      97                 :            : 
      98                 :          0 : SdXML3DLightContext::~SdXML3DLightContext()
      99                 :            : {
     100         [ #  # ]:          0 : }
     101                 :            : 
     102                 :            : //////////////////////////////////////////////////////////////////////////////
     103                 :            : 
     104 [ #  # ][ #  # ]:          0 : TYPEINIT1( SdXML3DSceneShapeContext, SdXMLShapeContext );
     105                 :            : 
     106                 :          0 : SdXML3DSceneShapeContext::SdXML3DSceneShapeContext(
     107                 :            :     SvXMLImport& rImport,
     108                 :            :     sal_uInt16 nPrfx,
     109                 :            :     const OUString& rLocalName,
     110                 :            :     const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
     111                 :            :     uno::Reference< drawing::XShapes >& rShapes,
     112                 :            :     sal_Bool bTemporaryShapes)
     113         [ #  # ]:          0 : :   SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShapes ), SdXML3DSceneAttributesHelper( rImport )
     114                 :            : {
     115                 :          0 : }
     116                 :            : 
     117                 :            : //////////////////////////////////////////////////////////////////////////////
     118                 :            : 
     119         [ #  # ]:          0 : SdXML3DSceneShapeContext::~SdXML3DSceneShapeContext()
     120                 :            : {
     121         [ #  # ]:          0 : }
     122                 :            : 
     123                 :            : //////////////////////////////////////////////////////////////////////////////
     124                 :            : 
     125                 :          0 : void SdXML3DSceneShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
     126                 :            : {
     127                 :            :     // create new 3DScene shape and add it to rShapes, use it
     128                 :            :     // as base for the new 3DScene import
     129                 :          0 :     AddShape( "com.sun.star.drawing.Shape3DSceneObject" );
     130         [ #  # ]:          0 :     if( mxShape.is() )
     131                 :            :     {
     132                 :          0 :         SetStyle();
     133                 :            : 
     134         [ #  # ]:          0 :         mxChildren = uno::Reference< drawing::XShapes >::query( mxShape );
     135         [ #  # ]:          0 :         if( mxChildren.is() )
     136 [ #  # ][ #  # ]:          0 :             GetImport().GetShapeImport()->pushGroupForSorting( mxChildren );
     137                 :            : 
     138                 :          0 :         SetLayer();
     139                 :            : 
     140                 :            :         // set pos, size, shear and rotate
     141                 :          0 :         SetTransformation();
     142                 :            :     }
     143                 :            : 
     144                 :            :     // read attributes for the 3DScene
     145         [ #  # ]:          0 :     sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
     146         [ #  # ]:          0 :     for(sal_Int16 i=0; i < nAttrCount; i++)
     147                 :            :     {
     148 [ #  # ][ #  # ]:          0 :         OUString sAttrName = xAttrList->getNameByIndex( i );
     149                 :          0 :         OUString aLocalName;
     150         [ #  # ]:          0 :         sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
     151 [ #  # ][ #  # ]:          0 :         OUString sValue = xAttrList->getValueByIndex( i );
     152         [ #  # ]:          0 :         processSceneAttribute( nPrefix, aLocalName, sValue );
     153                 :          0 :     }
     154                 :            : 
     155                 :            :     // #91047# call parent function is missing here, added it
     156         [ #  # ]:          0 :     if(mxShape.is())
     157                 :            :     {
     158                 :            :         // call parent
     159                 :          0 :         SdXMLShapeContext::StartElement(xAttrList);
     160                 :            :     }
     161                 :          0 : }
     162                 :            : 
     163                 :            : //////////////////////////////////////////////////////////////////////////////
     164                 :            : 
     165                 :          0 : void SdXML3DSceneShapeContext::EndElement()
     166                 :            : {
     167         [ #  # ]:          0 :     if(mxShape.is())
     168                 :            :     {
     169         [ #  # ]:          0 :         uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
     170         [ #  # ]:          0 :         if(xPropSet.is())
     171                 :            :         {
     172         [ #  # ]:          0 :             setSceneAttributes( xPropSet );
     173                 :            :         }
     174                 :            : 
     175         [ #  # ]:          0 :         if( mxChildren.is() )
     176 [ #  # ][ #  # ]:          0 :             GetImport().GetShapeImport()->popGroupAndSort();
         [ #  # ][ #  # ]
     177                 :            : 
     178                 :            :         // call parent
     179         [ #  # ]:          0 :         SdXMLShapeContext::EndElement();
     180                 :            :     }
     181                 :          0 : }
     182                 :            : 
     183                 :            : //////////////////////////////////////////////////////////////////////////////
     184                 :            : 
     185                 :          0 : SvXMLImportContext* SdXML3DSceneShapeContext::CreateChildContext( sal_uInt16 nPrefix,
     186                 :            :     const OUString& rLocalName,
     187                 :            :     const uno::Reference< xml::sax::XAttributeList>& xAttrList )
     188                 :            : {
     189                 :          0 :     SvXMLImportContext* pContext = 0L;
     190                 :            : 
     191                 :            :     // #i68101#
     192   [ #  #  #  #  :          0 :     if( nPrefix == XML_NAMESPACE_SVG &&
           #  # ][ #  # ]
     193                 :          0 :         (IsXMLToken( rLocalName, XML_TITLE ) || IsXMLToken( rLocalName, XML_DESC ) ) )
     194                 :            :     {
     195         [ #  # ]:          0 :         pContext = new SdXMLDescriptionContext( GetImport(), nPrefix, rLocalName, xAttrList, mxShape );
     196                 :            :     }
     197 [ #  # ][ #  # ]:          0 :     else if( nPrefix == XML_NAMESPACE_OFFICE && IsXMLToken( rLocalName, XML_EVENT_LISTENERS ) )
                 [ #  # ]
     198                 :            :     {
     199         [ #  # ]:          0 :         pContext = new SdXMLEventsContext( GetImport(), nPrefix, rLocalName, xAttrList, mxShape );
     200                 :            :     }
     201                 :            :     // look for local light context first
     202 [ #  # ][ #  # ]:          0 :     else if(nPrefix == XML_NAMESPACE_DR3D && IsXMLToken( rLocalName, XML_LIGHT ) )
                 [ #  # ]
     203                 :            :     {
     204                 :            :         // dr3d:light inside dr3d:scene context
     205                 :          0 :         pContext = create3DLightContext( nPrefix, rLocalName, xAttrList );
     206                 :            :     }
     207                 :            : 
     208                 :            :     // call GroupChildContext function at common ShapeImport
     209         [ #  # ]:          0 :     if(!pContext)
     210                 :            :     {
     211                 :          0 :         pContext = GetImport().GetShapeImport()->Create3DSceneChildContext(
     212 [ #  # ][ #  # ]:          0 :             GetImport(), nPrefix, rLocalName, xAttrList, mxChildren);
     213                 :            :         }
     214                 :            : 
     215                 :            :     // call parent when no own context was created
     216         [ #  # ]:          0 :     if(!pContext)
     217                 :            :     {
     218                 :            :         pContext = SvXMLImportContext::CreateChildContext(
     219                 :          0 :         nPrefix, rLocalName, xAttrList);
     220                 :            :     }
     221                 :            : 
     222                 :          0 :     return pContext;
     223                 :            : }
     224                 :            : 
     225                 :            : //////////////////////////////////////////////////////////////////////////////
     226                 :            : 
     227                 :          6 : SdXML3DSceneAttributesHelper::SdXML3DSceneAttributesHelper( SvXMLImport& rImporter )
     228                 :            : :   mrImport( rImporter ),
     229                 :            :     mbSetTransform( sal_False ),
     230                 :            :     mxPrjMode(drawing::ProjectionMode_PERSPECTIVE),
     231                 :            :     mnDistance(1000),
     232                 :            :     mnFocalLength(1000),
     233                 :            :     mnShadowSlant(0),
     234                 :            :     mxShadeMode(drawing::ShadeMode_SMOOTH),
     235                 :            :     maAmbientColor(0x00666666),
     236                 :            :     mbLightingMode(false),
     237                 :            :     maVRP(0.0, 0.0, 1.0),
     238                 :            :     maVPN(0.0, 0.0, 1.0),
     239                 :            :     maVUP(0.0, 1.0, 0.0),
     240                 :            :     mbVRPUsed(sal_False),
     241                 :            :     mbVPNUsed(sal_False),
     242                 :          6 :     mbVUPUsed(sal_False)
     243                 :            : {
     244                 :          6 : }
     245                 :            : 
     246                 :          6 : SdXML3DSceneAttributesHelper::~SdXML3DSceneAttributesHelper()
     247                 :            : {
     248                 :            :     // release remembered light contexts, they are no longer needed
     249         [ -  + ]:          6 :     for ( size_t i = maList.size(); i > 0; )
     250         [ #  # ]:          0 :         maList[ --i ]->ReleaseRef();
     251                 :          6 :     maList.clear();
     252                 :          6 : }
     253                 :            : 
     254                 :            : /** creates a 3d ligth context and adds it to the internal list for later processing */
     255                 :          0 : SvXMLImportContext * SdXML3DSceneAttributesHelper::create3DLightContext( sal_uInt16 nPrfx, const rtl::OUString& rLName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList)
     256                 :            : {
     257         [ #  # ]:          0 :     SvXMLImportContext* pContext = new SdXML3DLightContext(mrImport, nPrfx, rLName, xAttrList);
     258                 :            : 
     259                 :            :     // remember SdXML3DLightContext for later evaluation
     260         [ #  # ]:          0 :     if(pContext)
     261                 :            :     {
     262                 :          0 :         pContext->AddRef();
     263         [ #  # ]:          0 :         maList.push_back( (SdXML3DLightContext*)pContext );
     264                 :            :     }
     265                 :            : 
     266                 :          0 :     return pContext;
     267                 :            : }
     268                 :            : 
     269                 :            : /** this should be called for each scene attribute */
     270                 :          0 : void SdXML3DSceneAttributesHelper::processSceneAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
     271                 :            : {
     272         [ #  # ]:          0 :     if( XML_NAMESPACE_DR3D == nPrefix )
     273                 :            :     {
     274         [ #  # ]:          0 :         if( IsXMLToken( rLocalName, XML_TRANSFORM ) )
     275                 :            :         {
     276         [ #  # ]:          0 :             SdXMLImExTransform3D aTransform(rValue, mrImport.GetMM100UnitConverter());
     277         [ #  # ]:          0 :             if(aTransform.NeedsAction())
     278         [ #  # ]:          0 :                 mbSetTransform = aTransform.GetFullHomogenTransform(mxHomMat);
     279         [ #  # ]:          0 :             return;
     280                 :            :         }
     281         [ #  # ]:          0 :         else if( IsXMLToken( rLocalName, XML_VRP ) )
     282                 :            :         {
     283                 :          0 :             ::basegfx::B3DVector aNewVec;
     284         [ #  # ]:          0 :             mrImport.GetMM100UnitConverter().convertB3DVector(aNewVec, rValue);
     285                 :            : 
     286         [ #  # ]:          0 :             if(aNewVec != maVRP)
     287                 :            :             {
     288         [ #  # ]:          0 :                 maVRP = aNewVec;
     289                 :          0 :                 mbVRPUsed = sal_True;
     290                 :            :             }
     291                 :          0 :             return;
     292                 :            :         }
     293         [ #  # ]:          0 :         else if( IsXMLToken( rLocalName, XML_VPN ) )
     294                 :            :         {
     295                 :          0 :             ::basegfx::B3DVector aNewVec;
     296         [ #  # ]:          0 :             mrImport.GetMM100UnitConverter().convertB3DVector(aNewVec, rValue);
     297                 :            : 
     298         [ #  # ]:          0 :             if(aNewVec != maVPN)
     299                 :            :             {
     300         [ #  # ]:          0 :                 maVPN = aNewVec;
     301                 :          0 :                 mbVPNUsed = sal_True;
     302                 :            :             }
     303                 :          0 :             return;
     304                 :            :         }
     305         [ #  # ]:          0 :         else if( IsXMLToken( rLocalName, XML_VUP ) )
     306                 :            :         {
     307                 :          0 :             ::basegfx::B3DVector aNewVec;
     308         [ #  # ]:          0 :             mrImport.GetMM100UnitConverter().convertB3DVector(aNewVec, rValue);
     309                 :            : 
     310         [ #  # ]:          0 :             if(aNewVec != maVUP)
     311                 :            :             {
     312         [ #  # ]:          0 :                 maVUP = aNewVec;
     313                 :          0 :                 mbVUPUsed = sal_True;
     314                 :            :             }
     315                 :          0 :             return;
     316                 :            :         }
     317         [ #  # ]:          0 :         else if( IsXMLToken( rLocalName, XML_PROJECTION ) )
     318                 :            :         {
     319         [ #  # ]:          0 :             if( IsXMLToken( rValue, XML_PARALLEL ) )
     320                 :          0 :                 mxPrjMode = drawing::ProjectionMode_PARALLEL;
     321                 :            :             else
     322                 :          0 :                 mxPrjMode = drawing::ProjectionMode_PERSPECTIVE;
     323                 :          0 :             return;
     324                 :            :         }
     325         [ #  # ]:          0 :         else if( IsXMLToken( rLocalName, XML_DISTANCE ) )
     326                 :            :         {
     327                 :          0 :             mrImport.GetMM100UnitConverter().convertMeasureToCore(mnDistance,
     328                 :          0 :                     rValue);
     329                 :          0 :             return;
     330                 :            :         }
     331         [ #  # ]:          0 :         else if( IsXMLToken( rLocalName, XML_FOCAL_LENGTH ) )
     332                 :            :         {
     333                 :          0 :             mrImport.GetMM100UnitConverter().convertMeasureToCore(mnFocalLength,
     334                 :          0 :                     rValue);
     335                 :          0 :             return;
     336                 :            :         }
     337         [ #  # ]:          0 :         else if( IsXMLToken( rLocalName, XML_SHADOW_SLANT ) )
     338                 :            :         {
     339                 :          0 :             ::sax::Converter::convertNumber(mnShadowSlant, rValue);
     340                 :          0 :             return;
     341                 :            :         }
     342         [ #  # ]:          0 :         else if( IsXMLToken( rLocalName, XML_SHADE_MODE ) )
     343                 :            :         {
     344         [ #  # ]:          0 :             if( IsXMLToken( rValue, XML_FLAT ) )
     345                 :          0 :                 mxShadeMode = drawing::ShadeMode_FLAT;
     346         [ #  # ]:          0 :             else if( IsXMLToken( rValue, XML_PHONG ) )
     347                 :          0 :                 mxShadeMode = drawing::ShadeMode_PHONG;
     348         [ #  # ]:          0 :             else if( IsXMLToken( rValue, XML_GOURAUD ) )
     349                 :          0 :                 mxShadeMode = drawing::ShadeMode_SMOOTH;
     350                 :            :             else
     351                 :          0 :                 mxShadeMode = drawing::ShadeMode_DRAFT;
     352                 :          0 :             return;
     353                 :            :         }
     354         [ #  # ]:          0 :         else if( IsXMLToken( rLocalName, XML_AMBIENT_COLOR ) )
     355                 :            :         {
     356                 :          0 :             ::sax::Converter::convertColor(maAmbientColor, rValue);
     357                 :          0 :             return;
     358                 :            :         }
     359         [ #  # ]:          0 :         else if( IsXMLToken( rLocalName, XML_LIGHTING_MODE ) )
     360                 :            :         {
     361                 :          0 :             ::sax::Converter::convertBool(mbLightingMode, rValue);
     362                 :          0 :             return;
     363                 :            :         }
     364                 :            :     }
     365                 :            : }
     366                 :            : 
     367                 :            : /** this sets the scene attributes at this propertyset */
     368                 :          0 : void SdXML3DSceneAttributesHelper::setSceneAttributes( const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xPropSet )
     369                 :            : {
     370                 :          0 :     uno::Any aAny;
     371                 :            : 
     372                 :            :     // world transformation
     373         [ #  # ]:          0 :     if(mbSetTransform)
     374                 :            :     {
     375         [ #  # ]:          0 :         aAny <<= mxHomMat;
     376 [ #  # ][ #  # ]:          0 :         xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DTransformMatrix")), aAny);
                 [ #  # ]
     377                 :            :     }
     378                 :            : 
     379                 :            :     // distance
     380         [ #  # ]:          0 :     aAny <<= mnDistance;
     381 [ #  # ][ #  # ]:          0 :     xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneDistance")), aAny);
                 [ #  # ]
     382                 :            : 
     383                 :            :     // focalLength
     384         [ #  # ]:          0 :     aAny <<= mnFocalLength;
     385 [ #  # ][ #  # ]:          0 :     xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneFocalLength")), aAny);
                 [ #  # ]
     386                 :            : 
     387                 :            :     // shadowSlant
     388         [ #  # ]:          0 :     aAny <<= (sal_Int16)mnShadowSlant;
     389 [ #  # ][ #  # ]:          0 :     xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneShadowSlant")), aAny);
                 [ #  # ]
     390                 :            : 
     391                 :            :     // shadeMode
     392         [ #  # ]:          0 :     aAny <<= mxShadeMode;
     393 [ #  # ][ #  # ]:          0 :     xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneShadeMode")), aAny);
                 [ #  # ]
     394                 :            : 
     395                 :            :     // ambientColor
     396         [ #  # ]:          0 :     aAny <<= maAmbientColor;
     397 [ #  # ][ #  # ]:          0 :     xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneAmbientColor")), aAny);
                 [ #  # ]
     398                 :            : 
     399                 :            :     // lightingMode
     400         [ #  # ]:          0 :     aAny <<= mbLightingMode;
     401 [ #  # ][ #  # ]:          0 :     xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneTwoSidedLighting")), aAny);
                 [ #  # ]
     402                 :            : 
     403         [ #  # ]:          0 :     if( !maList.empty() )
     404                 :            :     {
     405                 :          0 :         uno::Any aAny2;
     406                 :          0 :         uno::Any aAny3;
     407                 :            : 
     408                 :            :         // set lights
     409         [ #  # ]:          0 :         for( size_t a = 0; a < maList.size(); a++)
     410                 :            :         {
     411                 :          0 :             SdXML3DLightContext* pCtx = (SdXML3DLightContext*)maList[ a ];
     412                 :            : 
     413                 :            :             // set anys
     414         [ #  # ]:          0 :             aAny <<= pCtx->GetDiffuseColor();
     415                 :          0 :             drawing::Direction3D xLightDir;
     416                 :          0 :             xLightDir.DirectionX = pCtx->GetDirection().getX();
     417                 :          0 :             xLightDir.DirectionY = pCtx->GetDirection().getY();
     418                 :          0 :             xLightDir.DirectionZ = pCtx->GetDirection().getZ();
     419         [ #  # ]:          0 :             aAny2 <<= xLightDir;
     420         [ #  # ]:          0 :             aAny3 <<= pCtx->GetEnabled();
     421                 :            : 
     422   [ #  #  #  #  :          0 :             switch(a)
             #  #  #  #  
                      # ]
     423                 :            :             {
     424                 :            :                 case 0:
     425                 :            :                 {
     426 [ #  # ][ #  # ]:          0 :                     xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor1")), aAny);
                 [ #  # ]
     427 [ #  # ][ #  # ]:          0 :                     xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection1")), aAny2);
                 [ #  # ]
     428 [ #  # ][ #  # ]:          0 :                     xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn1")), aAny3);
                 [ #  # ]
     429                 :          0 :                     break;
     430                 :            :                 }
     431                 :            :                 case 1:
     432                 :            :                 {
     433 [ #  # ][ #  # ]:          0 :                     xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor2")), aAny);
                 [ #  # ]
     434 [ #  # ][ #  # ]:          0 :                     xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection2")), aAny2);
                 [ #  # ]
     435 [ #  # ][ #  # ]:          0 :                     xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn2")), aAny3);
                 [ #  # ]
     436                 :          0 :                     break;
     437                 :            :                 }
     438                 :            :                 case 2:
     439                 :            :                 {
     440 [ #  # ][ #  # ]:          0 :                     xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor3")), aAny);
                 [ #  # ]
     441 [ #  # ][ #  # ]:          0 :                     xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection3")), aAny2);
                 [ #  # ]
     442 [ #  # ][ #  # ]:          0 :                     xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn3")), aAny3);
                 [ #  # ]
     443                 :          0 :                     break;
     444                 :            :                 }
     445                 :            :                 case 3:
     446                 :            :                 {
     447 [ #  # ][ #  # ]:          0 :                     xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor4")), aAny);
                 [ #  # ]
     448 [ #  # ][ #  # ]:          0 :                     xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection4")), aAny2);
                 [ #  # ]
     449 [ #  # ][ #  # ]:          0 :                     xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn4")), aAny3);
                 [ #  # ]
     450                 :          0 :                     break;
     451                 :            :                 }
     452                 :            :                 case 4:
     453                 :            :                 {
     454 [ #  # ][ #  # ]:          0 :                     xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor5")), aAny);
                 [ #  # ]
     455 [ #  # ][ #  # ]:          0 :                     xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection5")), aAny2);
                 [ #  # ]
     456 [ #  # ][ #  # ]:          0 :                     xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn5")), aAny3);
                 [ #  # ]
     457                 :          0 :                     break;
     458                 :            :                 }
     459                 :            :                 case 5:
     460                 :            :                 {
     461 [ #  # ][ #  # ]:          0 :                     xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor6")), aAny);
                 [ #  # ]
     462 [ #  # ][ #  # ]:          0 :                     xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection6")), aAny2);
                 [ #  # ]
     463 [ #  # ][ #  # ]:          0 :                     xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn6")), aAny3);
                 [ #  # ]
     464                 :          0 :                     break;
     465                 :            :                 }
     466                 :            :                 case 6:
     467                 :            :                 {
     468 [ #  # ][ #  # ]:          0 :                     xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor7")), aAny);
                 [ #  # ]
     469 [ #  # ][ #  # ]:          0 :                     xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection7")), aAny2);
                 [ #  # ]
     470 [ #  # ][ #  # ]:          0 :                     xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn7")), aAny3);
                 [ #  # ]
     471                 :          0 :                     break;
     472                 :            :                 }
     473                 :            :                 case 7:
     474                 :            :                 {
     475 [ #  # ][ #  # ]:          0 :                     xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor8")), aAny);
                 [ #  # ]
     476 [ #  # ][ #  # ]:          0 :                     xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection8")), aAny2);
                 [ #  # ]
     477 [ #  # ][ #  # ]:          0 :                     xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn8")), aAny3);
                 [ #  # ]
     478                 :          0 :                     break;
     479                 :            :                 }
     480                 :            :             }
     481                 :          0 :         }
     482                 :            :     }
     483                 :            : 
     484                 :            :     // CameraGeometry and camera settings
     485                 :          0 :     drawing::CameraGeometry aCamGeo;
     486                 :          0 :     aCamGeo.vrp.PositionX = maVRP.getX();
     487                 :          0 :     aCamGeo.vrp.PositionY = maVRP.getY();
     488                 :          0 :     aCamGeo.vrp.PositionZ = maVRP.getZ();
     489                 :          0 :     aCamGeo.vpn.DirectionX = maVPN.getX();
     490                 :          0 :     aCamGeo.vpn.DirectionY = maVPN.getY();
     491                 :          0 :     aCamGeo.vpn.DirectionZ = maVPN.getZ();
     492                 :          0 :     aCamGeo.vup.DirectionX = maVUP.getX();
     493                 :          0 :     aCamGeo.vup.DirectionY = maVUP.getY();
     494                 :          0 :     aCamGeo.vup.DirectionZ = maVUP.getZ();
     495         [ #  # ]:          0 :     aAny <<= aCamGeo;
     496 [ #  # ][ #  # ]:          0 :     xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DCameraGeometry")), aAny);
                 [ #  # ]
     497                 :            : 
     498                 :            :     // #91047# set drawing::ProjectionMode AFTER camera geometry is set
     499                 :            :     // projection "D3DScenePerspective" drawing::ProjectionMode
     500         [ #  # ]:          0 :     aAny <<= mxPrjMode;
     501 [ #  # ][ #  # ]:          0 :     xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DScenePerspective")), aAny);
                 [ #  # ]
     502                 :          0 : }
     503                 :            : 
     504                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10