LCOV - code coverage report
Current view: top level - drawinglayer/source/attribute - sdrsceneattribute3d.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 43 43 100.0 %
Date: 2014-11-03 Functions: 19 19 100.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 <drawinglayer/attribute/sdrsceneattribute3d.hxx>
      21             : #include <rtl/instance.hxx>
      22             : 
      23             : 
      24             : 
      25             : namespace drawinglayer
      26             : {
      27             :     namespace attribute
      28             :     {
      29             :         class ImpSdrSceneAttribute
      30             :         {
      31             :         public:
      32             :             // 3D scene attribute definitions
      33             :             double                                      mfDistance;
      34             :             double                                      mfShadowSlant;
      35             :             ::com::sun::star::drawing::ProjectionMode   maProjectionMode;
      36             :             ::com::sun::star::drawing::ShadeMode        maShadeMode;
      37             : 
      38             :             // bitfield
      39             :             bool                                        mbTwoSidedLighting : 1;
      40             : 
      41             :         public:
      42         400 :             ImpSdrSceneAttribute(
      43             :                 double fDistance,
      44             :                 double fShadowSlant,
      45             :                 ::com::sun::star::drawing::ProjectionMode aProjectionMode,
      46             :                 ::com::sun::star::drawing::ShadeMode aShadeMode,
      47             :                 bool bTwoSidedLighting)
      48             :             :   mfDistance(fDistance),
      49             :                 mfShadowSlant(fShadowSlant),
      50             :                 maProjectionMode(aProjectionMode),
      51             :                 maShadeMode(aShadeMode),
      52         400 :                 mbTwoSidedLighting(bTwoSidedLighting)
      53             :             {
      54         400 :             }
      55             : 
      56           6 :             ImpSdrSceneAttribute()
      57             :             :   mfDistance(0.0),
      58             :                 mfShadowSlant(0.0),
      59             :                 maProjectionMode(::com::sun::star::drawing::ProjectionMode_PARALLEL),
      60             :                 maShadeMode(::com::sun::star::drawing::ShadeMode_FLAT),
      61           6 :                 mbTwoSidedLighting(false)
      62             :             {
      63           6 :             }
      64             : 
      65             :             // data read access
      66          16 :             double getDistance() const { return mfDistance; }
      67          39 :             double getShadowSlant() const { return mfShadowSlant; }
      68         816 :             ::com::sun::star::drawing::ProjectionMode getProjectionMode() const { return maProjectionMode; }
      69       74256 :             ::com::sun::star::drawing::ShadeMode getShadeMode() const { return maShadeMode; }
      70       37463 :             bool getTwoSidedLighting() const { return mbTwoSidedLighting; }
      71             : 
      72           8 :             bool operator==(const ImpSdrSceneAttribute& rCandidate) const
      73             :             {
      74           8 :                 return (getDistance() == rCandidate.getDistance()
      75           8 :                     && getShadowSlant() == rCandidate.getShadowSlant()
      76           8 :                     && getProjectionMode() == rCandidate.getProjectionMode()
      77           8 :                     && getShadeMode() == rCandidate.getShadeMode()
      78          16 :                     && getTwoSidedLighting() == rCandidate.getTwoSidedLighting());
      79             :             }
      80             :         };
      81             : 
      82             :         namespace
      83             :         {
      84             :             struct theGlobalDefault :
      85             :                 public rtl::Static< SdrSceneAttribute::ImplType, theGlobalDefault > {};
      86             :         }
      87             : 
      88         400 :         SdrSceneAttribute::SdrSceneAttribute(
      89             :             double fDistance,
      90             :             double fShadowSlant,
      91             :             ::com::sun::star::drawing::ProjectionMode aProjectionMode,
      92             :             ::com::sun::star::drawing::ShadeMode aShadeMode,
      93             :             bool bTwoSidedLighting)
      94             :         :   mpSdrSceneAttribute(ImpSdrSceneAttribute(
      95         400 :                 fDistance, fShadowSlant, aProjectionMode, aShadeMode, bTwoSidedLighting))
      96             :         {
      97         400 :         }
      98             : 
      99        7872 :         SdrSceneAttribute::SdrSceneAttribute()
     100        7872 :         :   mpSdrSceneAttribute(theGlobalDefault::get())
     101             :         {
     102        7872 :         }
     103             : 
     104          36 :         SdrSceneAttribute::SdrSceneAttribute(const SdrSceneAttribute& rCandidate)
     105          36 :         :   mpSdrSceneAttribute(rCandidate.mpSdrSceneAttribute)
     106             :         {
     107          36 :         }
     108             : 
     109        8308 :         SdrSceneAttribute::~SdrSceneAttribute()
     110             :         {
     111        8308 :         }
     112             : 
     113         436 :         bool SdrSceneAttribute::isDefault() const
     114             :         {
     115         436 :             return mpSdrSceneAttribute.same_object(theGlobalDefault::get());
     116             :         }
     117             : 
     118        6866 :         SdrSceneAttribute& SdrSceneAttribute::operator=(const SdrSceneAttribute& rCandidate)
     119             :         {
     120        6866 :             mpSdrSceneAttribute = rCandidate.mpSdrSceneAttribute;
     121        6866 :             return *this;
     122             :         }
     123             : 
     124          60 :         bool SdrSceneAttribute::operator==(const SdrSceneAttribute& rCandidate) const
     125             :         {
     126          60 :             return rCandidate.mpSdrSceneAttribute == mpSdrSceneAttribute;
     127             :         }
     128             : 
     129          23 :         double SdrSceneAttribute::getShadowSlant() const
     130             :         {
     131          23 :             return mpSdrSceneAttribute->getShadowSlant();
     132             :         }
     133             : 
     134         800 :         ::com::sun::star::drawing::ProjectionMode SdrSceneAttribute::getProjectionMode() const
     135             :         {
     136         800 :             return mpSdrSceneAttribute->getProjectionMode();
     137             :         }
     138             : 
     139       74240 :         ::com::sun::star::drawing::ShadeMode SdrSceneAttribute::getShadeMode() const
     140             :         {
     141       74240 :             return mpSdrSceneAttribute->getShadeMode();
     142             :         }
     143             : 
     144       37447 :         bool SdrSceneAttribute::getTwoSidedLighting() const
     145             :         {
     146       37447 :             return mpSdrSceneAttribute->getTwoSidedLighting();
     147             :         }
     148             : 
     149             :     } // end of namespace attribute
     150             : } // end of namespace drawinglayer
     151             : 
     152             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10