LCOV - code coverage report
Current view: top level - drawinglayer/source/attribute - sdrobjectattribute3d.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 57 62 91.9 %
Date: 2014-11-03 Functions: 29 31 93.5 %
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 <drawinglayer/attribute/sdrobjectattribute3d.hxx>
      21             : #include <drawinglayer/attribute/materialattribute3d.hxx>
      22             : #include <rtl/instance.hxx>
      23             : 
      24             : 
      25             : 
      26             : namespace drawinglayer
      27             : {
      28             :     namespace attribute
      29             :     {
      30       22428 :         class ImpSdr3DObjectAttribute
      31             :         {
      32             :         public:
      33             :             // 3D object attribute definitions
      34             :             ::com::sun::star::drawing::NormalsKind              maNormalsKind;              // normals type (0..2)
      35             :             ::com::sun::star::drawing::TextureProjectionMode    maTextureProjectionX;       // texture projection type X (0..2)
      36             :             ::com::sun::star::drawing::TextureProjectionMode    maTextureProjectionY;       // texture projection type Y (0..2)
      37             :             ::com::sun::star::drawing::TextureKind2             maTextureKind;              // texture kind (see uno API)
      38             :             ::com::sun::star::drawing::TextureMode              maTextureMode;              // texture kind (see uno API)
      39             :             MaterialAttribute3D                                 maMaterial;                 // object, specular and emissive colors, SpecularIntensity
      40             : 
      41             :             // bitfield
      42             :             bool                                                mbNormalsInvert : 1;        // invert normals
      43             :             bool                                                mbDoubleSided : 1;          // surfaces are double sided
      44             :             bool                                                mbShadow3D : 1;             // display shadow in 3D (if on), params for that are at scene
      45             :             bool                                                mbTextureFilter : 1;        // filter texture to make more smooth
      46             :             bool                                                mbReducedLineGeometry : 1;  // use reduced line geometry (object specific)
      47             : 
      48        7476 :             ImpSdr3DObjectAttribute(
      49             :                 ::com::sun::star::drawing::NormalsKind  aNormalsKind,
      50             :                 ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionX,
      51             :                 ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionY,
      52             :                 ::com::sun::star::drawing::TextureKind2 aTextureKind,
      53             :                 ::com::sun::star::drawing::TextureMode aTextureMode,
      54             :                 const MaterialAttribute3D& rMaterial,
      55             :                 bool bNormalsInvert,
      56             :                 bool bDoubleSided,
      57             :                 bool bShadow3D,
      58             :                 bool bTextureFilter,
      59             :                 bool bReducedLineGeometry)
      60             :             :   maNormalsKind(aNormalsKind),
      61             :                 maTextureProjectionX(aTextureProjectionX),
      62             :                 maTextureProjectionY(aTextureProjectionY),
      63             :                 maTextureKind(aTextureKind),
      64             :                 maTextureMode(aTextureMode),
      65             :                 maMaterial(rMaterial),
      66             :                 mbNormalsInvert(bNormalsInvert),
      67             :                 mbDoubleSided(bDoubleSided),
      68             :                 mbShadow3D(bShadow3D),
      69             :                 mbTextureFilter(bTextureFilter),
      70        7476 :                 mbReducedLineGeometry(bReducedLineGeometry)
      71             :             {
      72        7476 :             }
      73             : 
      74             :             // data read access
      75        8020 :             ::com::sun::star::drawing::NormalsKind getNormalsKind() const { return maNormalsKind; }
      76        8039 :             ::com::sun::star::drawing::TextureProjectionMode getTextureProjectionX() const { return maTextureProjectionX; }
      77        8039 :             ::com::sun::star::drawing::TextureProjectionMode getTextureProjectionY() const { return maTextureProjectionY; }
      78        7276 :             ::com::sun::star::drawing::TextureKind2 getTextureKind() const { return maTextureKind; }
      79        7276 :             ::com::sun::star::drawing::TextureMode getTextureMode() const { return maTextureMode; }
      80       23597 :             const MaterialAttribute3D& getMaterial() const { return maMaterial; }
      81        7777 :             bool getNormalsInvert() const { return mbNormalsInvert; }
      82       23597 :             bool getDoubleSided() const { return mbDoubleSided; }
      83        7272 :             bool getShadow3D() const { return mbShadow3D; }
      84        7276 :             bool getTextureFilter() const { return mbTextureFilter; }
      85        7666 :             bool getReducedLineGeometry() const { return mbReducedLineGeometry; }
      86             : 
      87        3636 :             bool operator==(const ImpSdr3DObjectAttribute& rCandidate) const
      88             :             {
      89        3636 :                 return (getNormalsKind() == rCandidate.getNormalsKind()
      90        3636 :                     && getTextureProjectionX() == rCandidate.getTextureProjectionX()
      91        3636 :                     && getTextureProjectionY() == rCandidate.getTextureProjectionY()
      92        3636 :                     && getTextureKind() == rCandidate.getTextureKind()
      93        3636 :                     && getTextureMode() == rCandidate.getTextureMode()
      94        3636 :                     && getMaterial() == rCandidate.getMaterial()
      95        3636 :                     && getNormalsInvert() == rCandidate.getNormalsInvert()
      96        3636 :                     && getDoubleSided() == rCandidate.getDoubleSided()
      97        3636 :                     && getShadow3D() == rCandidate.getShadow3D()
      98        3636 :                     && getTextureFilter() == rCandidate.getTextureFilter()
      99        7272 :                     && getReducedLineGeometry() == rCandidate.getReducedLineGeometry());
     100             :             }
     101             :         };
     102             : 
     103             :         namespace
     104             :         {
     105             :             struct theGlobalDefault :
     106             :                 public rtl::Static< Sdr3DObjectAttribute::ImplType, theGlobalDefault > {};
     107             :         }
     108             : 
     109        7476 :         Sdr3DObjectAttribute::Sdr3DObjectAttribute(
     110             :             ::com::sun::star::drawing::NormalsKind  aNormalsKind,
     111             :             ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionX,
     112             :             ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionY,
     113             :             ::com::sun::star::drawing::TextureKind2 aTextureKind,
     114             :             ::com::sun::star::drawing::TextureMode aTextureMode,
     115             :             const MaterialAttribute3D& rMaterial,
     116             :             bool bNormalsInvert,
     117             :             bool bDoubleSided,
     118             :             bool bShadow3D,
     119             :             bool bTextureFilter,
     120             :             bool bReducedLineGeometry)
     121             :         :   mpSdr3DObjectAttribute(ImpSdr3DObjectAttribute(
     122             :                 aNormalsKind, aTextureProjectionX, aTextureProjectionY, aTextureKind, aTextureMode,
     123        7476 :                 rMaterial, bNormalsInvert, bDoubleSided, bShadow3D, bTextureFilter, bReducedLineGeometry))
     124             :         {
     125        7476 :         }
     126             : 
     127       22504 :         Sdr3DObjectAttribute::Sdr3DObjectAttribute(const Sdr3DObjectAttribute& rCandidate)
     128       22504 :         :   mpSdr3DObjectAttribute(rCandidate.mpSdr3DObjectAttribute)
     129             :         {
     130       22504 :         }
     131             : 
     132       29980 :         Sdr3DObjectAttribute::~Sdr3DObjectAttribute()
     133             :         {
     134       29980 :         }
     135             : 
     136           0 :         Sdr3DObjectAttribute& Sdr3DObjectAttribute::operator=(const Sdr3DObjectAttribute& rCandidate)
     137             :         {
     138           0 :             mpSdr3DObjectAttribute = rCandidate.mpSdr3DObjectAttribute;
     139           0 :             return *this;
     140             :         }
     141             : 
     142        5640 :         bool Sdr3DObjectAttribute::operator==(const Sdr3DObjectAttribute& rCandidate) const
     143             :         {
     144        5640 :             return rCandidate.mpSdr3DObjectAttribute == mpSdr3DObjectAttribute;
     145             :         }
     146             : 
     147         748 :         ::com::sun::star::drawing::NormalsKind Sdr3DObjectAttribute::getNormalsKind() const
     148             :         {
     149         748 :             return mpSdr3DObjectAttribute->getNormalsKind();
     150             :         }
     151             : 
     152         767 :         ::com::sun::star::drawing::TextureProjectionMode Sdr3DObjectAttribute::getTextureProjectionX() const
     153             :         {
     154         767 :             return mpSdr3DObjectAttribute->getTextureProjectionX();
     155             :         }
     156             : 
     157         767 :         ::com::sun::star::drawing::TextureProjectionMode Sdr3DObjectAttribute::getTextureProjectionY() const
     158             :         {
     159         767 :             return mpSdr3DObjectAttribute->getTextureProjectionY();
     160             :         }
     161             : 
     162           4 :         ::com::sun::star::drawing::TextureKind2 Sdr3DObjectAttribute::getTextureKind() const
     163             :         {
     164           4 :             return mpSdr3DObjectAttribute->getTextureKind();
     165             :         }
     166             : 
     167           4 :         ::com::sun::star::drawing::TextureMode Sdr3DObjectAttribute::getTextureMode() const
     168             :         {
     169           4 :             return mpSdr3DObjectAttribute->getTextureMode();
     170             :         }
     171             : 
     172       16325 :         const MaterialAttribute3D& Sdr3DObjectAttribute::getMaterial() const
     173             :         {
     174       16325 :             return mpSdr3DObjectAttribute->getMaterial();
     175             :         }
     176             : 
     177         505 :         bool Sdr3DObjectAttribute::getNormalsInvert() const
     178             :         {
     179         505 :             return mpSdr3DObjectAttribute->getNormalsInvert();
     180             :         }
     181             : 
     182       16325 :         bool Sdr3DObjectAttribute::getDoubleSided() const
     183             :         {
     184       16325 :             return mpSdr3DObjectAttribute->getDoubleSided();
     185             :         }
     186             : 
     187           0 :         bool Sdr3DObjectAttribute::getShadow3D() const
     188             :         {
     189           0 :             return mpSdr3DObjectAttribute->getShadow3D();
     190             :         }
     191             : 
     192           4 :         bool Sdr3DObjectAttribute::getTextureFilter() const
     193             :         {
     194           4 :             return mpSdr3DObjectAttribute->getTextureFilter();
     195             :         }
     196             : 
     197         394 :         bool Sdr3DObjectAttribute::getReducedLineGeometry() const
     198             :         {
     199         394 :             return mpSdr3DObjectAttribute->getReducedLineGeometry();
     200             :         }
     201             : 
     202             :     } // end of namespace attribute
     203             : } // end of namespace drawinglayer
     204             : 
     205             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10