LCOV - code coverage report
Current view: top level - drawinglayer/source/attribute - sdrlineattribute.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 53 53 100.0 %
Date: 2014-04-11 Functions: 26 26 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/sdrlineattribute.hxx>
      21             : #include <basegfx/color/bcolor.hxx>
      22             : #include <rtl/instance.hxx>
      23             : 
      24             : 
      25             : 
      26             : namespace drawinglayer
      27             : {
      28             :     namespace attribute
      29             :     {
      30       38160 :         class ImpSdrLineAttribute
      31             :         {
      32             :         public:
      33             :             // line definitions
      34             :             basegfx::B2DLineJoin                    meJoin;             // B2DLINEJOIN_* defines
      35             :             double                                  mfWidth;            // 1/100th mm, 0.0==hair
      36             :             double                                  mfTransparence;     // [0.0 .. 1.0], 0.0==no transp.
      37             :             basegfx::BColor                         maColor;            // color of line
      38             :             com::sun::star::drawing::LineCap        meCap;              // BUTT, ROUND, or SQUARE
      39             :             ::std::vector< double >                 maDotDashArray;     // array of double which defines the dot-dash pattern
      40             :             double                                  mfFullDotDashLen;   // sum of maDotDashArray (for convenience)
      41             : 
      42       13034 :             ImpSdrLineAttribute(
      43             :                 basegfx::B2DLineJoin eJoin,
      44             :                 double fWidth,
      45             :                 double fTransparence,
      46             :                 const basegfx::BColor& rColor,
      47             :                 com::sun::star::drawing::LineCap eCap,
      48             :                 const ::std::vector< double >& rDotDashArray,
      49             :                 double fFullDotDashLen)
      50             :             :   meJoin(eJoin),
      51             :                 mfWidth(fWidth),
      52             :                 mfTransparence(fTransparence),
      53             :                 maColor(rColor),
      54             :                 meCap(eCap),
      55             :                 maDotDashArray(rDotDashArray),
      56       13034 :                 mfFullDotDashLen(fFullDotDashLen)
      57             :             {
      58       13034 :             }
      59             : 
      60          37 :             ImpSdrLineAttribute()
      61             :             :   meJoin(basegfx::B2DLINEJOIN_ROUND),
      62             :                 mfWidth(0.0),
      63             :                 mfTransparence(0.0),
      64             :                 maColor(basegfx::BColor()),
      65             :                 meCap(com::sun::star::drawing::LineCap_BUTT),
      66             :                 maDotDashArray(std::vector< double >()),
      67          37 :                 mfFullDotDashLen(0.0)
      68             :             {
      69          37 :             }
      70             : 
      71             :             // data read access
      72       32164 :             basegfx::B2DLineJoin getJoin() const { return meJoin; }
      73       47582 :             double getWidth() const { return mfWidth; }
      74       32539 :             double getTransparence() const { return mfTransparence; }
      75       32136 :             const basegfx::BColor& getColor() const { return maColor; }
      76       32132 :             com::sun::star::drawing::LineCap getCap() const { return meCap; }
      77       32132 :             const ::std::vector< double >& getDotDashArray() const { return maDotDashArray; }
      78       20810 :             double getFullDotDashLen() const { return mfFullDotDashLen; }
      79             : 
      80        5677 :             bool operator==(const ImpSdrLineAttribute& rCandidate) const
      81             :             {
      82        5677 :                 return (getJoin() == rCandidate.getJoin()
      83        5677 :                     && getWidth() == rCandidate.getWidth()
      84        5665 :                     && getTransparence() == rCandidate.getTransparence()
      85        5663 :                     && getColor() == rCandidate.getColor()
      86        5661 :                     && getCap() == rCandidate.getCap()
      87       11338 :                     && getDotDashArray() == rCandidate.getDotDashArray());
      88             :             }
      89             :         };
      90             : 
      91             :         namespace
      92             :         {
      93             :             struct theGlobalDefault :
      94             :                 public rtl::Static< SdrLineAttribute::ImplType, theGlobalDefault > {};
      95             :         }
      96             : 
      97       13034 :         SdrLineAttribute::SdrLineAttribute(
      98             :             basegfx::B2DLineJoin eJoin,
      99             :             double fWidth,
     100             :             double fTransparence,
     101             :             const basegfx::BColor& rColor,
     102             :             com::sun::star::drawing::LineCap eCap,
     103             :             const ::std::vector< double >& rDotDashArray,
     104             :             double fFullDotDashLen)
     105             :         :   mpSdrLineAttribute(
     106             :                 ImpSdrLineAttribute(
     107             :                     eJoin,
     108             :                     fWidth,
     109             :                     fTransparence,
     110             :                     rColor,
     111             :                     eCap,
     112             :                     rDotDashArray,
     113       13034 :                     fFullDotDashLen))
     114             : 
     115             :         {
     116       13034 :         }
     117             : 
     118       87254 :         SdrLineAttribute::SdrLineAttribute()
     119       87254 :         :   mpSdrLineAttribute(theGlobalDefault::get())
     120             :         {
     121       87254 :         }
     122             : 
     123       91441 :         SdrLineAttribute::SdrLineAttribute(const SdrLineAttribute& rCandidate)
     124       91441 :         :   mpSdrLineAttribute(rCandidate.mpSdrLineAttribute)
     125             :         {
     126       91441 :         }
     127             : 
     128      186689 :         SdrLineAttribute::~SdrLineAttribute()
     129             :         {
     130      186689 :         }
     131             : 
     132      127277 :         bool SdrLineAttribute::isDefault() const
     133             :         {
     134      127277 :             return mpSdrLineAttribute.same_object(theGlobalDefault::get());
     135             :         }
     136             : 
     137       46099 :         SdrLineAttribute& SdrLineAttribute::operator=(const SdrLineAttribute& rCandidate)
     138             :         {
     139       46099 :             mpSdrLineAttribute = rCandidate.mpSdrLineAttribute;
     140       46099 :             return *this;
     141             :         }
     142             : 
     143       32812 :         bool SdrLineAttribute::operator==(const SdrLineAttribute& rCandidate) const
     144             :         {
     145       32812 :             return rCandidate.mpSdrLineAttribute == mpSdrLineAttribute;
     146             :         }
     147             : 
     148       20810 :         basegfx::B2DLineJoin SdrLineAttribute::getJoin() const
     149             :         {
     150       20810 :             return mpSdrLineAttribute->getJoin();
     151             :         }
     152             : 
     153       36228 :         double SdrLineAttribute::getWidth() const
     154             :         {
     155       36228 :             return mpSdrLineAttribute->getWidth();
     156             :         }
     157             : 
     158       21209 :         double SdrLineAttribute::getTransparence() const
     159             :         {
     160       21209 :             return mpSdrLineAttribute->getTransparence();
     161             :         }
     162             : 
     163       20810 :         const basegfx::BColor& SdrLineAttribute::getColor() const
     164             :         {
     165       20810 :             return mpSdrLineAttribute->getColor();
     166             :         }
     167             : 
     168       20810 :         const ::std::vector< double >& SdrLineAttribute::getDotDashArray() const
     169             :         {
     170       20810 :             return mpSdrLineAttribute->getDotDashArray();
     171             :         }
     172             : 
     173       20810 :         double SdrLineAttribute::getFullDotDashLen() const
     174             :         {
     175       20810 :             return mpSdrLineAttribute->getFullDotDashLen();
     176             :         }
     177             : 
     178       20810 :         com::sun::star::drawing::LineCap SdrLineAttribute::getCap() const
     179             :         {
     180       20810 :             return mpSdrLineAttribute->getCap();
     181             :         }
     182             : 
     183             :     } // end of namespace attribute
     184             : } // end of namespace drawinglayer
     185             : 
     186             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10