LCOV - code coverage report
Current view: top level - drawinglayer/source/attribute - fillhatchattribute.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 48 50 96.0 %
Date: 2014-11-03 Functions: 23 24 95.8 %
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/fillhatchattribute.hxx>
      21             : #include <basegfx/color/bcolor.hxx>
      22             : #include <rtl/instance.hxx>
      23             : 
      24             : 
      25             : 
      26             : namespace drawinglayer
      27             : {
      28             :     namespace attribute
      29             :     {
      30        3163 :         class ImpFillHatchAttribute
      31             :         {
      32             :         public:
      33             :             // data definitions
      34             :             HatchStyle                              meStyle;
      35             :             double                                  mfDistance;
      36             :             double                                  mfAngle;
      37             :             basegfx::BColor                         maColor;
      38             :             sal_uInt32                              mnMinimalDiscreteDistance;
      39             : 
      40             :             // bitfield
      41             :             bool                                    mbFillBackground : 1;
      42             : 
      43        1024 :             ImpFillHatchAttribute(
      44             :                 HatchStyle eStyle,
      45             :                 double fDistance,
      46             :                 double fAngle,
      47             :                 const basegfx::BColor& rColor,
      48             :                 sal_uInt32 nMinimalDiscreteDistance,
      49             :                 bool bFillBackground)
      50             :             :   meStyle(eStyle),
      51             :                 mfDistance(fDistance),
      52             :                 mfAngle(fAngle),
      53             :                 maColor(rColor),
      54             :                 mnMinimalDiscreteDistance(nMinimalDiscreteDistance),
      55        1024 :                 mbFillBackground(bFillBackground)
      56             :             {
      57        1024 :             }
      58             : 
      59         128 :             ImpFillHatchAttribute()
      60             :             :   meStyle(HATCHSTYLE_SINGLE),
      61             :                 mfDistance(0.0),
      62             :                 mfAngle(0.0),
      63             :                 maColor(basegfx::BColor()),
      64             :                 mnMinimalDiscreteDistance(3), // same as VCL
      65         128 :                 mbFillBackground(false)
      66             :             {
      67         128 :             }
      68             : 
      69             :             // data read access
      70        1140 :             HatchStyle getStyle() const { return meStyle; }
      71        1134 :             double getDistance() const { return mfDistance; }
      72        1138 :             double getAngle() const { return mfAngle; }
      73        1132 :             const basegfx::BColor& getColor() const { return maColor; }
      74         952 :             sal_uInt32 getMinimalDiscreteDistance() const { return mnMinimalDiscreteDistance; }
      75        1146 :             bool isFillBackground() const { return mbFillBackground; }
      76             : 
      77         476 :             bool operator==(const ImpFillHatchAttribute& rCandidate) const
      78             :             {
      79         476 :                 return (getStyle() == rCandidate.getStyle()
      80         476 :                     && getDistance() == rCandidate.getDistance()
      81         476 :                     && getAngle() == rCandidate.getAngle()
      82         476 :                     && getColor() == rCandidate.getColor()
      83         476 :                     && getMinimalDiscreteDistance() == rCandidate.getMinimalDiscreteDistance()
      84         952 :                     && isFillBackground() == rCandidate.isFillBackground());
      85             :             }
      86             :         };
      87             : 
      88             :         namespace
      89             :         {
      90             :             struct theGlobalDefault :
      91             :                 public rtl::Static< FillHatchAttribute::ImplType, theGlobalDefault > {};
      92             :         }
      93             : 
      94        1024 :         FillHatchAttribute::FillHatchAttribute(
      95             :             HatchStyle eStyle,
      96             :             double fDistance,
      97             :             double fAngle,
      98             :             const basegfx::BColor& rColor,
      99             :             sal_uInt32 nMinimalDiscreteDistance,
     100             :             bool bFillBackground)
     101             :         :   mpFillHatchAttribute(ImpFillHatchAttribute(
     102             :                 eStyle, fDistance, fAngle, rColor,
     103        1024 :                 nMinimalDiscreteDistance, bFillBackground))
     104             :         {
     105        1024 :         }
     106             : 
     107       37488 :         FillHatchAttribute::FillHatchAttribute()
     108       37488 :         :   mpFillHatchAttribute(theGlobalDefault::get())
     109             :         {
     110       37488 :         }
     111             : 
     112       75810 :         FillHatchAttribute::FillHatchAttribute(const FillHatchAttribute& rCandidate)
     113       75810 :         :   mpFillHatchAttribute(rCandidate.mpFillHatchAttribute)
     114             :         {
     115       75810 :         }
     116             : 
     117      113768 :         FillHatchAttribute::~FillHatchAttribute()
     118             :         {
     119      113768 :         }
     120             : 
     121       17518 :         bool FillHatchAttribute::isDefault() const
     122             :         {
     123       17518 :             return mpFillHatchAttribute.same_object(theGlobalDefault::get());
     124             :         }
     125             : 
     126        1024 :         FillHatchAttribute& FillHatchAttribute::operator=(const FillHatchAttribute& rCandidate)
     127             :         {
     128        1024 :             mpFillHatchAttribute = rCandidate.mpFillHatchAttribute;
     129        1024 :             return *this;
     130             :         }
     131             : 
     132       13816 :         bool FillHatchAttribute::operator==(const FillHatchAttribute& rCandidate) const
     133             :         {
     134       13816 :             return rCandidate.mpFillHatchAttribute == mpFillHatchAttribute;
     135             :         }
     136             : 
     137             :         // data read access
     138         188 :         HatchStyle FillHatchAttribute::getStyle() const
     139             :         {
     140         188 :             return mpFillHatchAttribute->getStyle();
     141             :         }
     142             : 
     143         182 :         double FillHatchAttribute::getDistance() const
     144             :         {
     145         182 :             return mpFillHatchAttribute->getDistance();
     146             :         }
     147             : 
     148         186 :         double FillHatchAttribute::getAngle() const
     149             :         {
     150         186 :             return mpFillHatchAttribute->getAngle();
     151             :         }
     152             : 
     153         180 :         const basegfx::BColor& FillHatchAttribute::getColor() const
     154             :         {
     155         180 :             return mpFillHatchAttribute->getColor();
     156             :         }
     157             : 
     158           0 :         sal_uInt32 FillHatchAttribute::getMinimalDiscreteDistance() const
     159             :         {
     160           0 :             return mpFillHatchAttribute->getMinimalDiscreteDistance();
     161             :         }
     162             : 
     163         194 :         bool FillHatchAttribute::isFillBackground() const
     164             :         {
     165         194 :             return mpFillHatchAttribute->isFillBackground();
     166             :         }
     167             : 
     168             :     } // end of namespace attribute
     169             : } // end of namespace drawinglayer
     170             : 
     171             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10