LCOV - code coverage report
Current view: top level - drawinglayer/source/attribute - sdrlinestartendattribute.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 59 60 98.3 %
Date: 2015-06-13 12:38:46 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/sdrlinestartendattribute.hxx>
      21             : #include <basegfx/polygon/b2dpolypolygon.hxx>
      22             : #include <rtl/instance.hxx>
      23             : 
      24             : 
      25             : 
      26             : namespace drawinglayer
      27             : {
      28             :     namespace attribute
      29             :     {
      30         716 :         class ImpSdrLineStartEndAttribute
      31             :         {
      32             :         public:
      33             :             // line arrow definitions
      34             :             basegfx::B2DPolyPolygon                 maStartPolyPolygon;     // start Line PolyPolygon
      35             :             basegfx::B2DPolyPolygon                 maEndPolyPolygon;       // end Line PolyPolygon
      36             :             double                                  mfStartWidth;           // 1/100th mm
      37             :             double                                  mfEndWidth;             // 1/100th mm
      38             : 
      39             :             // bitfield
      40             :             bool                                    mbStartActive : 1;     // start of Line is active
      41             :             bool                                    mbEndActive : 1;       // end of Line is active
      42             :             bool                                    mbStartCentered : 1;   // Line is centered on line start point
      43             :             bool                                    mbEndCentered : 1;     // Line is centered on line end point
      44             : 
      45         219 :             ImpSdrLineStartEndAttribute(
      46             :                 const basegfx::B2DPolyPolygon& rStartPolyPolygon,
      47             :                 const basegfx::B2DPolyPolygon& rEndPolyPolygon,
      48             :                 double fStartWidth,
      49             :                 double fEndWidth,
      50             :                 bool bStartActive,
      51             :                 bool bEndActive,
      52             :                 bool bStartCentered,
      53             :                 bool bEndCentered)
      54             :             :   maStartPolyPolygon(rStartPolyPolygon),
      55             :                 maEndPolyPolygon(rEndPolyPolygon),
      56             :                 mfStartWidth(fStartWidth),
      57             :                 mfEndWidth(fEndWidth),
      58             :                 mbStartActive(bStartActive),
      59             :                 mbEndActive(bEndActive),
      60             :                 mbStartCentered(bStartCentered),
      61         219 :                 mbEndCentered(bEndCentered)
      62             :             {
      63         219 :             }
      64             : 
      65          63 :             ImpSdrLineStartEndAttribute()
      66             :             :   maStartPolyPolygon(basegfx::B2DPolyPolygon()),
      67             :                 maEndPolyPolygon(basegfx::B2DPolyPolygon()),
      68             :                 mfStartWidth(0.0),
      69             :                 mfEndWidth(0.0),
      70             :                 mbStartActive(false),
      71             :                 mbEndActive(false),
      72             :                 mbStartCentered(false),
      73          63 :                 mbEndCentered(false)
      74             :             {
      75          63 :             }
      76             : 
      77             :             // data read access
      78         477 :             const basegfx::B2DPolyPolygon& getStartPolyPolygon() const { return maStartPolyPolygon; }
      79         477 :             const basegfx::B2DPolyPolygon& getEndPolyPolygon() const { return maEndPolyPolygon; }
      80         477 :             double getStartWidth() const { return mfStartWidth; }
      81         477 :             double getEndWidth() const { return mfEndWidth; }
      82          66 :             bool isStartActive() const { return mbStartActive; }
      83          66 :             bool isEndActive() const { return mbEndActive; }
      84         477 :             bool isStartCentered() const { return mbStartCentered; }
      85         477 :             bool isEndCentered() const { return mbEndCentered; }
      86             : 
      87          26 :             bool operator==(const ImpSdrLineStartEndAttribute& rCandidate) const
      88             :             {
      89          26 :                 return (getStartPolyPolygon() == rCandidate.getStartPolyPolygon()
      90          26 :                     && getEndPolyPolygon() == rCandidate.getEndPolyPolygon()
      91          26 :                     && getStartWidth() == rCandidate.getStartWidth()
      92          26 :                     && getEndWidth() == rCandidate.getEndWidth()
      93          26 :                     && isStartActive() == rCandidate.isStartActive()
      94          26 :                     && isEndActive() == rCandidate.isEndActive()
      95          26 :                     && isStartCentered() == rCandidate.isStartCentered()
      96          52 :                     && isEndCentered() == rCandidate.isEndCentered());
      97             :             }
      98             :         };
      99             : 
     100             :         namespace
     101             :         {
     102             :             struct theGlobalDefault :
     103             :                 public rtl::Static< SdrLineStartEndAttribute::ImplType, theGlobalDefault > {};
     104             :         }
     105             : 
     106         219 :         SdrLineStartEndAttribute::SdrLineStartEndAttribute(
     107             :             const basegfx::B2DPolyPolygon& rStartPolyPolygon,
     108             :             const basegfx::B2DPolyPolygon& rEndPolyPolygon,
     109             :             double fStartWidth,
     110             :             double fEndWidth,
     111             :             bool bStartActive,
     112             :             bool bEndActive,
     113             :             bool bStartCentered,
     114             :             bool bEndCentered)
     115             :         :   mpSdrLineStartEndAttribute(ImpSdrLineStartEndAttribute(
     116         219 :                 rStartPolyPolygon, rEndPolyPolygon, fStartWidth, fEndWidth, bStartActive, bEndActive, bStartCentered, bEndCentered))
     117             :         {
     118         219 :         }
     119             : 
     120      140024 :         SdrLineStartEndAttribute::SdrLineStartEndAttribute()
     121      140024 :         :   mpSdrLineStartEndAttribute(theGlobalDefault::get())
     122             :         {
     123      140024 :         }
     124             : 
     125      185072 :         SdrLineStartEndAttribute::SdrLineStartEndAttribute(const SdrLineStartEndAttribute& rCandidate)
     126      185072 :         :   mpSdrLineStartEndAttribute(rCandidate.mpSdrLineStartEndAttribute)
     127             :         {
     128      185072 :         }
     129             : 
     130      324714 :         SdrLineStartEndAttribute::~SdrLineStartEndAttribute()
     131             :         {
     132      324714 :         }
     133             : 
     134      133204 :         bool SdrLineStartEndAttribute::isDefault() const
     135             :         {
     136      133204 :             return mpSdrLineStartEndAttribute.same_object(theGlobalDefault::get());
     137             :         }
     138             : 
     139       28463 :         SdrLineStartEndAttribute& SdrLineStartEndAttribute::operator=(const SdrLineStartEndAttribute& rCandidate)
     140             :         {
     141       28463 :             mpSdrLineStartEndAttribute = rCandidate.mpSdrLineStartEndAttribute;
     142       28463 :             return *this;
     143             :         }
     144             : 
     145       54514 :         bool SdrLineStartEndAttribute::operator==(const SdrLineStartEndAttribute& rCandidate) const
     146             :         {
     147             :             // tdf#87509 default attr is always != non-default attr, even with same values
     148       54514 :             if(rCandidate.isDefault() != isDefault())
     149           0 :                 return false;
     150             : 
     151       54514 :             return rCandidate.mpSdrLineStartEndAttribute == mpSdrLineStartEndAttribute;
     152             :         }
     153             : 
     154         425 :         const basegfx::B2DPolyPolygon& SdrLineStartEndAttribute::getStartPolyPolygon() const
     155             :         {
     156         425 :             return mpSdrLineStartEndAttribute->getStartPolyPolygon();
     157             :         }
     158             : 
     159         425 :         const basegfx::B2DPolyPolygon& SdrLineStartEndAttribute::getEndPolyPolygon() const
     160             :         {
     161         425 :             return mpSdrLineStartEndAttribute->getEndPolyPolygon();
     162             :         }
     163             : 
     164         425 :         double SdrLineStartEndAttribute::getStartWidth() const
     165             :         {
     166         425 :             return mpSdrLineStartEndAttribute->getStartWidth();
     167             :         }
     168             : 
     169         425 :         double SdrLineStartEndAttribute::getEndWidth() const
     170             :         {
     171         425 :             return mpSdrLineStartEndAttribute->getEndWidth();
     172             :         }
     173             : 
     174          14 :         bool SdrLineStartEndAttribute::isStartActive() const
     175             :         {
     176          14 :             return mpSdrLineStartEndAttribute->isStartActive();
     177             :         }
     178             : 
     179          14 :         bool SdrLineStartEndAttribute::isEndActive() const
     180             :         {
     181          14 :             return mpSdrLineStartEndAttribute->isEndActive();
     182             :         }
     183             : 
     184         425 :         bool SdrLineStartEndAttribute::isStartCentered() const
     185             :         {
     186         425 :             return mpSdrLineStartEndAttribute->isStartCentered();
     187             :         }
     188             : 
     189         425 :         bool SdrLineStartEndAttribute::isEndCentered() const
     190             :         {
     191         425 :             return mpSdrLineStartEndAttribute->isEndCentered();
     192             :         }
     193             :     } // end of namespace attribute
     194             : } // end of namespace drawinglayer
     195             : 
     196             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11