LCOV - code coverage report
Current view: top level - drawinglayer/source/attribute - lineattribute.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 39 42 92.9 %
Date: 2014-11-03 Functions: 19 20 95.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/lineattribute.hxx>
      21             : #include <basegfx/color/bcolor.hxx>
      22             : #include <rtl/instance.hxx>
      23             : 
      24             : 
      25             : 
      26             : namespace drawinglayer
      27             : {
      28             :     namespace attribute
      29             :     {
      30      124184 :         class ImpLineAttribute
      31             :         {
      32             :         public:
      33             :             // data definitions
      34             :             basegfx::BColor                         maColor;                // color
      35             :             double                                  mfWidth;                // absolute line width
      36             :             basegfx::B2DLineJoin                    meLineJoin;             // type of LineJoin
      37             :             com::sun::star::drawing::LineCap        meLineCap;              // BUTT, ROUND, or SQUARE
      38             : 
      39       41653 :             ImpLineAttribute(
      40             :                 const basegfx::BColor& rColor,
      41             :                 double fWidth,
      42             :                 basegfx::B2DLineJoin aB2DLineJoin,
      43             :                 com::sun::star::drawing::LineCap aLineCap)
      44             :             :   maColor(rColor),
      45             :                 mfWidth(fWidth),
      46             :                 meLineJoin(aB2DLineJoin),
      47       41653 :                 meLineCap(aLineCap)
      48             :             {
      49       41653 :             }
      50             : 
      51         103 :             ImpLineAttribute()
      52             :             :   maColor(basegfx::BColor()),
      53             :                 mfWidth(0.0),
      54             :                 meLineJoin(basegfx::B2DLINEJOIN_ROUND),
      55         103 :                 meLineCap(com::sun::star::drawing::LineCap_BUTT)
      56             :             {
      57         103 :             }
      58             : 
      59             :             // data read access
      60      100807 :             const basegfx::BColor& getColor() const { return maColor; }
      61      289051 :             double getWidth() const { return mfWidth; }
      62      146099 :             basegfx::B2DLineJoin getLineJoin() const { return meLineJoin; }
      63      143135 :             com::sun::star::drawing::LineCap getLineCap() const { return meLineCap; }
      64             : 
      65          46 :             bool operator==(const ImpLineAttribute& rCandidate) const
      66             :             {
      67          46 :                 return (getColor() == rCandidate.getColor()
      68          46 :                     && getWidth() == rCandidate.getWidth()
      69          46 :                     && getLineJoin() == rCandidate.getLineJoin()
      70          92 :                     && getLineCap() == rCandidate.getLineCap());
      71             :             }
      72             :         };
      73             : 
      74             :         namespace
      75             :         {
      76             :             struct theGlobalDefault :
      77             :                 public rtl::Static< LineAttribute::ImplType, theGlobalDefault > {};
      78             :         }
      79             : 
      80       41653 :         LineAttribute::LineAttribute(
      81             :             const basegfx::BColor& rColor,
      82             :             double fWidth,
      83             :             basegfx::B2DLineJoin aB2DLineJoin,
      84             :             com::sun::star::drawing::LineCap aLineCap)
      85             :         :   mpLineAttribute(
      86             :                 ImpLineAttribute(
      87             :                     rColor,
      88             :                     fWidth,
      89             :                     aB2DLineJoin,
      90       41653 :                     aLineCap))
      91             :         {
      92       41653 :         }
      93             : 
      94         100 :         LineAttribute::LineAttribute()
      95         100 :         :   mpLineAttribute(theGlobalDefault::get())
      96             :         {
      97         100 :         }
      98             : 
      99       44268 :         LineAttribute::LineAttribute(const LineAttribute& rCandidate)
     100       44268 :         :   mpLineAttribute(rCandidate.mpLineAttribute)
     101             :         {
     102       44268 :         }
     103             : 
     104       85143 :         LineAttribute::~LineAttribute()
     105             :         {
     106       85143 :         }
     107             : 
     108       13258 :         bool LineAttribute::isDefault() const
     109             :         {
     110       13258 :             return mpLineAttribute.same_object(theGlobalDefault::get());
     111             :         }
     112             : 
     113           0 :         LineAttribute& LineAttribute::operator=(const LineAttribute& rCandidate)
     114             :         {
     115           0 :             mpLineAttribute = rCandidate.mpLineAttribute;
     116           0 :             return *this;
     117             :         }
     118             : 
     119          46 :         bool LineAttribute::operator==(const LineAttribute& rCandidate) const
     120             :         {
     121          46 :             return rCandidate.mpLineAttribute == mpLineAttribute;
     122             :         }
     123             : 
     124      100715 :         const basegfx::BColor& LineAttribute::getColor() const
     125             :         {
     126      100715 :             return mpLineAttribute->getColor();
     127             :         }
     128             : 
     129      288959 :         double LineAttribute::getWidth() const
     130             :         {
     131      288959 :             return mpLineAttribute->getWidth();
     132             :         }
     133             : 
     134      146007 :         basegfx::B2DLineJoin LineAttribute::getLineJoin() const
     135             :         {
     136      146007 :             return mpLineAttribute->getLineJoin();
     137             :         }
     138             : 
     139      143043 :         com::sun::star::drawing::LineCap LineAttribute::getLineCap() const
     140             :         {
     141      143043 :             return mpLineAttribute->getLineCap();
     142             :         }
     143             : 
     144             :     } // end of namespace attribute
     145             : } // end of namespace drawinglayer
     146             : 
     147             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10