LCOV - code coverage report
Current view: top level - drawinglayer/source/attribute - sdrshadowattribute.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 39 40 97.5 %
Date: 2015-06-13 12:38:46 Functions: 18 18 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/sdrshadowattribute.hxx>
      21             : #include <basegfx/vector/b2dvector.hxx>
      22             : #include <basegfx/color/bcolor.hxx>
      23             : #include <rtl/instance.hxx>
      24             : 
      25             : 
      26             : 
      27             : namespace drawinglayer
      28             : {
      29             :     namespace attribute
      30             :     {
      31        1653 :         class ImpSdrShadowAttribute
      32             :         {
      33             :         public:
      34             :             // shadow definitions
      35             :             basegfx::B2DVector                  maOffset;                   // shadow offset 1/100th mm
      36             :             double                              mfTransparence;             // [0.0 .. 1.0], 0.0==no transp.
      37             :             basegfx::BColor                     maColor;                    // color of shadow
      38             : 
      39         531 :             ImpSdrShadowAttribute(
      40             :                 const basegfx::B2DVector& rOffset,
      41             :                 double fTransparence,
      42             :                 const basegfx::BColor& rColor)
      43             :             :   maOffset(rOffset),
      44             :                 mfTransparence(fTransparence),
      45         531 :                 maColor(rColor)
      46             :             {
      47         531 :             }
      48             : 
      49          64 :             ImpSdrShadowAttribute()
      50             :             :   maOffset(basegfx::B2DVector()),
      51             :                 mfTransparence(0.0),
      52          64 :                 maColor(basegfx::BColor())
      53             :             {
      54          64 :             }
      55             : 
      56             :             // data read access
      57        1480 :             const basegfx::B2DVector& getOffset() const { return maOffset; }
      58        1267 :             double getTransparence() const { return mfTransparence; }
      59        1138 :             const basegfx::BColor& getColor() const { return maColor; }
      60             : 
      61         398 :             bool operator==(const ImpSdrShadowAttribute& rCandidate) const
      62             :             {
      63         398 :                 return (getOffset() == rCandidate.getOffset()
      64         398 :                     && getTransparence() == rCandidate.getTransparence()
      65         796 :                     && getColor() == rCandidate.getColor());
      66             :             }
      67             :         };
      68             : 
      69             :         namespace
      70             :         {
      71             :             struct theGlobalDefault :
      72             :                 public rtl::Static< SdrShadowAttribute::ImplType, theGlobalDefault > {};
      73             :         }
      74             : 
      75             : 
      76         531 :         SdrShadowAttribute::SdrShadowAttribute(
      77             :             const basegfx::B2DVector& rOffset,
      78             :             double fTransparence,
      79             :             const basegfx::BColor& rColor)
      80             :         :   mpSdrShadowAttribute(ImpSdrShadowAttribute(
      81         531 :                 rOffset, fTransparence, rColor))
      82             :         {
      83         531 :         }
      84             : 
      85      202968 :         SdrShadowAttribute::SdrShadowAttribute()
      86      202968 :         :   mpSdrShadowAttribute(theGlobalDefault::get())
      87             :         {
      88      202968 :         }
      89             : 
      90      197474 :         SdrShadowAttribute::SdrShadowAttribute(const SdrShadowAttribute& rCandidate)
      91      197474 :         :   mpSdrShadowAttribute(rCandidate.mpSdrShadowAttribute)
      92             :         {
      93      197474 :         }
      94             : 
      95      400372 :         SdrShadowAttribute::~SdrShadowAttribute()
      96             :         {
      97      400372 :         }
      98             : 
      99      174644 :         bool SdrShadowAttribute::isDefault() const
     100             :         {
     101      174644 :             return mpSdrShadowAttribute.same_object(theGlobalDefault::get());
     102             :         }
     103             : 
     104       86929 :         SdrShadowAttribute& SdrShadowAttribute::operator=(const SdrShadowAttribute& rCandidate)
     105             :         {
     106       86929 :             mpSdrShadowAttribute = rCandidate.mpSdrShadowAttribute;
     107       86929 :             return *this;
     108             :         }
     109             : 
     110       60460 :         bool SdrShadowAttribute::operator==(const SdrShadowAttribute& rCandidate) const
     111             :         {
     112             :             // tdf#87509 default attr is always != non-default attr, even with same values
     113       60460 :             if(rCandidate.isDefault() != isDefault())
     114           0 :                 return false;
     115             : 
     116       60460 :             return mpSdrShadowAttribute == rCandidate.mpSdrShadowAttribute;
     117             :         }
     118             : 
     119         684 :         const basegfx::B2DVector& SdrShadowAttribute::getOffset() const
     120             :         {
     121         684 :             return mpSdrShadowAttribute->getOffset();
     122             :         }
     123             : 
     124         471 :         double SdrShadowAttribute::getTransparence() const
     125             :         {
     126         471 :             return mpSdrShadowAttribute->getTransparence();
     127             :         }
     128             : 
     129         342 :         const basegfx::BColor& SdrShadowAttribute::getColor() const
     130             :         {
     131         342 :             return mpSdrShadowAttribute->getColor();
     132             :         }
     133             :     } // end of namespace attribute
     134             : } // end of namespace drawinglayer
     135             : 
     136             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11