LCOV - code coverage report
Current view: top level - drawinglayer/source/attribute - linestartendattribute.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 42 0.0 %
Date: 2014-04-14 Functions: 0 19 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/linestartendattribute.hxx>
      21             : #include <basegfx/polygon/b2dpolygon.hxx>
      22             : #include <basegfx/polygon/b2dpolypolygon.hxx>
      23             : #include <rtl/instance.hxx>
      24             : 
      25             : 
      26             : 
      27             : namespace drawinglayer
      28             : {
      29             :     namespace attribute
      30             :     {
      31           0 :         class ImpLineStartEndAttribute
      32             :         {
      33             :         public:
      34             :             // data definitions
      35             :             double                                  mfWidth;                // absolute line StartEndGeometry base width
      36             :             basegfx::B2DPolyPolygon                 maPolyPolygon;          // the StartEndGeometry PolyPolygon
      37             : 
      38             :             // bitfield
      39             :             bool                                    mbCentered : 1;         // use centered to ineStart/End point?
      40             : 
      41           0 :             ImpLineStartEndAttribute(
      42             :                 double fWidth,
      43             :                 const basegfx::B2DPolyPolygon& rPolyPolygon,
      44             :                 bool bCentered)
      45             :             :   mfWidth(fWidth),
      46             :                 maPolyPolygon(rPolyPolygon),
      47           0 :                 mbCentered(bCentered)
      48             :             {
      49           0 :             }
      50             : 
      51           0 :             ImpLineStartEndAttribute()
      52             :             :   mfWidth(0.0),
      53             :                 maPolyPolygon(basegfx::B2DPolyPolygon()),
      54           0 :                 mbCentered(false)
      55             :             {
      56           0 :             }
      57             : 
      58             :             // data read access
      59           0 :             double getWidth() const { return mfWidth; }
      60           0 :             const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
      61           0 :             bool isCentered() const { return mbCentered; }
      62             : 
      63           0 :             bool operator==(const ImpLineStartEndAttribute& rCandidate) const
      64             :             {
      65           0 :                 return (basegfx::fTools::equal(getWidth(), rCandidate.getWidth())
      66           0 :                     && getB2DPolyPolygon() == rCandidate.getB2DPolyPolygon()
      67           0 :                     && isCentered() == rCandidate.isCentered());
      68             :             }
      69             :         };
      70             : 
      71             :         namespace
      72             :         {
      73             :             struct theGlobalDefault :
      74             :                 public rtl::Static< LineStartEndAttribute::ImplType, theGlobalDefault > {};
      75             :         }
      76             : 
      77           0 :         LineStartEndAttribute::LineStartEndAttribute(
      78             :             double fWidth,
      79             :             const basegfx::B2DPolyPolygon& rPolyPolygon,
      80             :             bool bCentered)
      81             :         :   mpLineStartEndAttribute(ImpLineStartEndAttribute(
      82           0 :                 fWidth, rPolyPolygon, bCentered))
      83             :         {
      84           0 :         }
      85             : 
      86           0 :         LineStartEndAttribute::LineStartEndAttribute()
      87           0 :         :   mpLineStartEndAttribute(theGlobalDefault::get())
      88             :         {
      89           0 :         }
      90             : 
      91           0 :         LineStartEndAttribute::LineStartEndAttribute(const LineStartEndAttribute& rCandidate)
      92           0 :         :   mpLineStartEndAttribute(rCandidate.mpLineStartEndAttribute)
      93             :         {
      94           0 :         }
      95             : 
      96           0 :         LineStartEndAttribute::~LineStartEndAttribute()
      97             :         {
      98           0 :         }
      99             : 
     100           0 :         bool LineStartEndAttribute::isDefault() const
     101             :         {
     102           0 :             return mpLineStartEndAttribute.same_object(theGlobalDefault::get());
     103             :         }
     104             : 
     105           0 :         LineStartEndAttribute& LineStartEndAttribute::operator=(const LineStartEndAttribute& rCandidate)
     106             :         {
     107           0 :             mpLineStartEndAttribute = rCandidate.mpLineStartEndAttribute;
     108           0 :             return *this;
     109             :         }
     110             : 
     111           0 :         bool LineStartEndAttribute::operator==(const LineStartEndAttribute& rCandidate) const
     112             :         {
     113           0 :             return rCandidate.mpLineStartEndAttribute == mpLineStartEndAttribute;
     114             :         }
     115             : 
     116           0 :         double LineStartEndAttribute::getWidth() const
     117             :         {
     118           0 :             return mpLineStartEndAttribute->getWidth();
     119             :         }
     120             : 
     121           0 :         const basegfx::B2DPolyPolygon& LineStartEndAttribute::getB2DPolyPolygon() const
     122             :         {
     123           0 :             return mpLineStartEndAttribute->getB2DPolyPolygon();
     124             :         }
     125             : 
     126           0 :         bool LineStartEndAttribute::isCentered() const
     127             :         {
     128           0 :             return mpLineStartEndAttribute->isCentered();
     129             :         }
     130             : 
     131           0 :         bool LineStartEndAttribute::isActive() const
     132             :         {
     133           0 :             return (0.0 != getWidth()
     134           0 :                 && 0 != getB2DPolyPolygon().count()
     135           0 :                 && 0 != getB2DPolyPolygon().getB2DPolygon(0).count());
     136             :         }
     137             :     } // end of namespace attribute
     138             : } // end of namespace drawinglayer
     139             : 
     140             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10