LCOV - code coverage report
Current view: top level - drawinglayer/source/attribute - fillgraphicattribute.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 44 0.0 %
Date: 2014-04-14 Functions: 0 21 0.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/fillgraphicattribute.hxx>
      21             : #include <vcl/graph.hxx>
      22             : 
      23             : namespace drawinglayer
      24             : {
      25             :     namespace attribute
      26             :     {
      27           0 :         class ImpFillGraphicAttribute
      28             :         {
      29             :         public:
      30             :             // data definitions
      31             :             Graphic                                 maGraphic;
      32             :             basegfx::B2DRange                       maGraphicRange;
      33             : 
      34             :             // bitfield
      35             :             bool                                    mbTiling : 1;
      36             : 
      37             :             // tiling definitions, offsets in X/Y in percent for each 2nd row.
      38             :             // If both are set, Y is ignored (X has precedence)
      39             :             double                                  mfOffsetX;
      40             :             double                                  mfOffsetY;
      41             : 
      42           0 :             ImpFillGraphicAttribute(
      43             :                 const Graphic& rGraphic,
      44             :                 const basegfx::B2DRange& rGraphicRange,
      45             :                 bool bTiling,
      46             :                 double fOffsetX,
      47             :                 double fOffsetY)
      48             :             :   maGraphic(rGraphic),
      49             :                 maGraphicRange(rGraphicRange),
      50             :                 mbTiling(bTiling),
      51             :                 mfOffsetX(fOffsetX),
      52           0 :                 mfOffsetY(fOffsetY)
      53             :             {
      54           0 :             }
      55             : 
      56           0 :             ImpFillGraphicAttribute()
      57             :             :   maGraphic(Graphic()),
      58             :                 maGraphicRange(basegfx::B2DRange()),
      59             :                 mbTiling(false),
      60             :                 mfOffsetX(0.0),
      61           0 :                 mfOffsetY(0.0)
      62             :             {
      63           0 :             }
      64             : 
      65             :             // data read access
      66           0 :             const Graphic& getGraphic() const { return maGraphic; }
      67           0 :             const basegfx::B2DRange& getGraphicRange() const { return maGraphicRange; }
      68           0 :             bool getTiling() const { return mbTiling; }
      69           0 :             double getOffsetX() const { return mfOffsetX; }
      70           0 :             double getOffsetY() const { return mfOffsetY; }
      71             : 
      72           0 :             bool operator==(const ImpFillGraphicAttribute& rCandidate) const
      73             :             {
      74           0 :                 return (getGraphic() == rCandidate.getGraphic()
      75           0 :                     && getGraphicRange() == rCandidate.getGraphicRange()
      76           0 :                     && getTiling() == rCandidate.getTiling()
      77           0 :                     && getOffsetX() == rCandidate.getOffsetX()
      78           0 :                     && getOffsetY() == rCandidate.getOffsetY());
      79             :             }
      80             :         };
      81             : 
      82             :         namespace
      83             :         {
      84             :             struct theGlobalDefault :
      85             :                 public rtl::Static< FillGraphicAttribute::ImplType, theGlobalDefault > {};
      86             :         }
      87             : 
      88           0 :         FillGraphicAttribute::FillGraphicAttribute(
      89             :             const Graphic& rGraphic,
      90             :             const basegfx::B2DRange& rGraphicRange,
      91             :             bool bTiling,
      92             :             double fOffsetX,
      93             :             double fOffsetY)
      94             :         :   mpFillGraphicAttribute(ImpFillGraphicAttribute(
      95             :                 rGraphic, rGraphicRange, bTiling,
      96           0 :                     basegfx::clamp(fOffsetX, 0.0, 1.0),
      97           0 :                     basegfx::clamp(fOffsetY, 0.0, 1.0)))
      98             :         {
      99           0 :         }
     100             : 
     101           0 :         FillGraphicAttribute::FillGraphicAttribute(const FillGraphicAttribute& rCandidate)
     102           0 :         :   mpFillGraphicAttribute(rCandidate.mpFillGraphicAttribute)
     103             :         {
     104           0 :         }
     105             : 
     106           0 :         FillGraphicAttribute::~FillGraphicAttribute()
     107             :         {
     108           0 :         }
     109             : 
     110           0 :         bool FillGraphicAttribute::isDefault() const
     111             :         {
     112           0 :             return mpFillGraphicAttribute.same_object(theGlobalDefault::get());
     113             :         }
     114             : 
     115           0 :         FillGraphicAttribute& FillGraphicAttribute::operator=(const FillGraphicAttribute& rCandidate)
     116             :         {
     117           0 :             mpFillGraphicAttribute = rCandidate.mpFillGraphicAttribute;
     118           0 :             return *this;
     119             :         }
     120             : 
     121           0 :         bool FillGraphicAttribute::operator==(const FillGraphicAttribute& rCandidate) const
     122             :         {
     123           0 :             return rCandidate.mpFillGraphicAttribute == mpFillGraphicAttribute;
     124             :         }
     125             : 
     126           0 :         const Graphic& FillGraphicAttribute::getGraphic() const
     127             :         {
     128           0 :             return mpFillGraphicAttribute->getGraphic();
     129             :         }
     130             : 
     131           0 :         const basegfx::B2DRange& FillGraphicAttribute::getGraphicRange() const
     132             :         {
     133           0 :             return mpFillGraphicAttribute->getGraphicRange();
     134             :         }
     135             : 
     136           0 :         bool FillGraphicAttribute::getTiling() const
     137             :         {
     138           0 :             return mpFillGraphicAttribute->getTiling();
     139             :         }
     140             : 
     141           0 :         double FillGraphicAttribute::getOffsetX() const
     142             :         {
     143           0 :             return mpFillGraphicAttribute->getOffsetX();
     144             :         }
     145             : 
     146           0 :         double FillGraphicAttribute::getOffsetY() const
     147             :         {
     148           0 :             return mpFillGraphicAttribute->getOffsetY();
     149             :         }
     150             : 
     151             :     } // end of namespace attribute
     152             : } // end of namespace drawinglayer
     153             : 
     154             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10