LCOV - code coverage report
Current view: top level - drawinglayer/source/attribute - fillgradientattribute.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 58 58 100.0 %
Date: 2014-11-03 Functions: 28 28 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/fillgradientattribute.hxx>
      21             : #include <basegfx/color/bcolor.hxx>
      22             : #include <rtl/instance.hxx>
      23             : 
      24             : 
      25             : 
      26             : namespace drawinglayer
      27             : {
      28             :     namespace attribute
      29             :     {
      30        9948 :         class ImpFillGradientAttribute
      31             :         {
      32             :         public:
      33             :             // data definitions
      34             :             GradientStyle                           meStyle;
      35             :             double                                  mfBorder;
      36             :             double                                  mfOffsetX;
      37             :             double                                  mfOffsetY;
      38             :             double                                  mfAngle;
      39             :             basegfx::BColor                         maStartColor;
      40             :             basegfx::BColor                         maEndColor;
      41             :             sal_uInt16                              mnSteps;
      42             : 
      43        3297 :             ImpFillGradientAttribute(
      44             :                 GradientStyle eStyle,
      45             :                 double fBorder,
      46             :                 double fOffsetX,
      47             :                 double fOffsetY,
      48             :                 double fAngle,
      49             :                 const basegfx::BColor& rStartColor,
      50             :                 const basegfx::BColor& rEndColor,
      51             :                 sal_uInt16 nSteps)
      52             :             :   meStyle(eStyle),
      53             :                 mfBorder(fBorder),
      54             :                 mfOffsetX(fOffsetX),
      55             :                 mfOffsetY(fOffsetY),
      56             :                 mfAngle(fAngle),
      57             :                 maStartColor(rStartColor),
      58             :                 maEndColor(rEndColor),
      59        3297 :                 mnSteps(nSteps)
      60             :             {
      61        3297 :             }
      62             : 
      63         128 :             ImpFillGradientAttribute()
      64             :             :   meStyle(GRADIENTSTYLE_LINEAR),
      65             :                 mfBorder(0.0),
      66             :                 mfOffsetX(0.0),
      67             :                 mfOffsetY(0.0),
      68             :                 mfAngle(0.0),
      69             :                 maStartColor(basegfx::BColor()),
      70             :                 maEndColor(basegfx::BColor()),
      71         128 :                 mnSteps(0)
      72             :             {
      73         128 :             }
      74             : 
      75             :             // data read access
      76        2836 :             GradientStyle getStyle() const { return meStyle; }
      77        2371 :             double getBorder() const { return mfBorder; }
      78        1898 :             double getOffsetX() const { return mfOffsetX; }
      79        1898 :             double getOffsetY() const { return mfOffsetY; }
      80        2371 :             double getAngle() const { return mfAngle; }
      81        2425 :             const basegfx::BColor& getStartColor() const { return maStartColor; }
      82        2425 :             const basegfx::BColor& getEndColor() const { return maEndColor; }
      83        2371 :             sal_uInt16 getSteps() const { return mnSteps; }
      84             : 
      85         943 :             bool operator==(const ImpFillGradientAttribute& rCandidate) const
      86             :             {
      87         943 :                 return (getStyle() == rCandidate.getStyle()
      88         943 :                     && getBorder() == rCandidate.getBorder()
      89         943 :                     && getOffsetX() == rCandidate.getOffsetX()
      90         943 :                     && getOffsetY() == rCandidate.getOffsetY()
      91         943 :                     && getAngle() == rCandidate.getAngle()
      92         943 :                     && getStartColor() == rCandidate.getStartColor()
      93         943 :                     && getEndColor() == rCandidate.getEndColor()
      94        1886 :                     && getSteps() == rCandidate.getSteps());
      95             :             }
      96             :         };
      97             : 
      98             :         namespace
      99             :         {
     100             :             struct theGlobalDefault :
     101             :                 public rtl::Static< FillGradientAttribute::ImplType, theGlobalDefault > {};
     102             :         }
     103             : 
     104        3297 :         FillGradientAttribute::FillGradientAttribute(
     105             :             GradientStyle eStyle,
     106             :             double fBorder,
     107             :             double fOffsetX,
     108             :             double fOffsetY,
     109             :             double fAngle,
     110             :             const basegfx::BColor& rStartColor,
     111             :             const basegfx::BColor& rEndColor,
     112             :             sal_uInt16 nSteps)
     113             :         :   mpFillGradientAttribute(ImpFillGradientAttribute(
     114        3297 :                 eStyle, fBorder, fOffsetX, fOffsetY, fAngle, rStartColor, rEndColor, nSteps))
     115             :         {
     116        3297 :         }
     117             : 
     118      215221 :         FillGradientAttribute::FillGradientAttribute()
     119      215221 :         :   mpFillGradientAttribute(theGlobalDefault::get())
     120             :         {
     121      215221 :         }
     122             : 
     123      206163 :         FillGradientAttribute::FillGradientAttribute(const FillGradientAttribute& rCandidate)
     124      206163 :         :   mpFillGradientAttribute(rCandidate.mpFillGradientAttribute)
     125             :         {
     126      206163 :         }
     127             : 
     128      423166 :         FillGradientAttribute::~FillGradientAttribute()
     129             :         {
     130      423166 :         }
     131             : 
     132       36527 :         bool FillGradientAttribute::isDefault() const
     133             :         {
     134       36527 :             return mpFillGradientAttribute.same_object(theGlobalDefault::get());
     135             :         }
     136             : 
     137       36448 :         FillGradientAttribute& FillGradientAttribute::operator=(const FillGradientAttribute& rCandidate)
     138             :         {
     139       36448 :             mpFillGradientAttribute = rCandidate.mpFillGradientAttribute;
     140       36448 :             return *this;
     141             :         }
     142             : 
     143       58617 :         bool FillGradientAttribute::operator==(const FillGradientAttribute& rCandidate) const
     144             :         {
     145       58617 :             return rCandidate.mpFillGradientAttribute == mpFillGradientAttribute;
     146             :         }
     147             : 
     148         539 :         const basegfx::BColor& FillGradientAttribute::getStartColor() const
     149             :         {
     150         539 :             return mpFillGradientAttribute->getStartColor();
     151             :         }
     152             : 
     153         539 :         const basegfx::BColor& FillGradientAttribute::getEndColor() const
     154             :         {
     155         539 :             return mpFillGradientAttribute->getEndColor();
     156             :         }
     157             : 
     158         485 :         double FillGradientAttribute::getBorder() const
     159             :         {
     160         485 :             return mpFillGradientAttribute->getBorder();
     161             :         }
     162             : 
     163          12 :         double FillGradientAttribute::getOffsetX() const
     164             :         {
     165          12 :             return mpFillGradientAttribute->getOffsetX();
     166             :         }
     167             : 
     168          12 :         double FillGradientAttribute::getOffsetY() const
     169             :         {
     170          12 :             return mpFillGradientAttribute->getOffsetY();
     171             :         }
     172             : 
     173         485 :         double FillGradientAttribute::getAngle() const
     174             :         {
     175         485 :             return mpFillGradientAttribute->getAngle();
     176             :         }
     177             : 
     178         950 :         GradientStyle FillGradientAttribute::getStyle() const
     179             :         {
     180         950 :             return mpFillGradientAttribute->getStyle();
     181             :         }
     182             : 
     183         485 :         sal_uInt16 FillGradientAttribute::getSteps() const
     184             :         {
     185         485 :             return mpFillGradientAttribute->getSteps();
     186             :         }
     187             : 
     188             :     } // end of namespace attribute
     189             : } // end of namespace drawinglayer
     190             : 
     191             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10