LCOV - code coverage report
Current view: top level - drawinglayer/source/attribute - sdrlinestartendattribute.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/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        1494 :         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         468 :             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         468 :                 mbEndCentered(bEndCentered)
      62             :             {
      63         468 :             }
      64             : 
      65          96 :             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          96 :                 mbEndCentered(false)
      74             :             {
      75          96 :             }
      76             : 
      77             :             // data read access
      78        1026 :             const basegfx::B2DPolyPolygon& getStartPolyPolygon() const { return maStartPolyPolygon; }
      79        1026 :             const basegfx::B2DPolyPolygon& getEndPolyPolygon() const { return maEndPolyPolygon; }
      80        1026 :             double getStartWidth() const { return mfStartWidth; }
      81        1026 :             double getEndWidth() const { return mfEndWidth; }
      82         240 :             bool isStartActive() const { return mbStartActive; }
      83         240 :             bool isEndActive() const { return mbEndActive; }
      84        1026 :             bool isStartCentered() const { return mbStartCentered; }
      85        1026 :             bool isEndCentered() const { return mbEndCentered; }
      86             : 
      87         118 :             bool operator==(const ImpSdrLineStartEndAttribute& rCandidate) const
      88             :             {
      89         118 :                 return (getStartPolyPolygon() == rCandidate.getStartPolyPolygon()
      90         118 :                     && getEndPolyPolygon() == rCandidate.getEndPolyPolygon()
      91         118 :                     && getStartWidth() == rCandidate.getStartWidth()
      92         118 :                     && getEndWidth() == rCandidate.getEndWidth()
      93         118 :                     && isStartActive() == rCandidate.isStartActive()
      94         118 :                     && isEndActive() == rCandidate.isEndActive()
      95         118 :                     && isStartCentered() == rCandidate.isStartCentered()
      96         236 :                     && isEndCentered() == rCandidate.isEndCentered());
      97             :             }
      98             :         };
      99             : 
     100             :         namespace
     101             :         {
     102             :             struct theGlobalDefault :
     103             :                 public rtl::Static< SdrLineStartEndAttribute::ImplType, theGlobalDefault > {};
     104             :         }
     105             : 
     106         468 :         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         468 :                 rStartPolyPolygon, rEndPolyPolygon, fStartWidth, fEndWidth, bStartActive, bEndActive, bStartCentered, bEndCentered))
     117             :         {
     118         468 :         }
     119             : 
     120      100186 :         SdrLineStartEndAttribute::SdrLineStartEndAttribute()
     121      100186 :         :   mpSdrLineStartEndAttribute(theGlobalDefault::get())
     122             :         {
     123      100186 :         }
     124             : 
     125      128479 :         SdrLineStartEndAttribute::SdrLineStartEndAttribute(const SdrLineStartEndAttribute& rCandidate)
     126      128479 :         :   mpSdrLineStartEndAttribute(rCandidate.mpSdrLineStartEndAttribute)
     127             :         {
     128      128479 :         }
     129             : 
     130      228192 :         SdrLineStartEndAttribute::~SdrLineStartEndAttribute()
     131             :         {
     132      228192 :         }
     133             : 
     134       15989 :         bool SdrLineStartEndAttribute::isDefault() const
     135             :         {
     136       15989 :             return mpSdrLineStartEndAttribute.same_object(theGlobalDefault::get());
     137             :         }
     138             : 
     139       25181 :         SdrLineStartEndAttribute& SdrLineStartEndAttribute::operator=(const SdrLineStartEndAttribute& rCandidate)
     140             :         {
     141       25181 :             mpSdrLineStartEndAttribute = rCandidate.mpSdrLineStartEndAttribute;
     142       25181 :             return *this;
     143             :         }
     144             : 
     145       44861 :         bool SdrLineStartEndAttribute::operator==(const SdrLineStartEndAttribute& rCandidate) const
     146             :         {
     147       44861 :             return rCandidate.mpSdrLineStartEndAttribute == mpSdrLineStartEndAttribute;
     148             :         }
     149             : 
     150         790 :         const basegfx::B2DPolyPolygon& SdrLineStartEndAttribute::getStartPolyPolygon() const
     151             :         {
     152         790 :             return mpSdrLineStartEndAttribute->getStartPolyPolygon();
     153             :         }
     154             : 
     155         790 :         const basegfx::B2DPolyPolygon& SdrLineStartEndAttribute::getEndPolyPolygon() const
     156             :         {
     157         790 :             return mpSdrLineStartEndAttribute->getEndPolyPolygon();
     158             :         }
     159             : 
     160         790 :         double SdrLineStartEndAttribute::getStartWidth() const
     161             :         {
     162         790 :             return mpSdrLineStartEndAttribute->getStartWidth();
     163             :         }
     164             : 
     165         790 :         double SdrLineStartEndAttribute::getEndWidth() const
     166             :         {
     167         790 :             return mpSdrLineStartEndAttribute->getEndWidth();
     168             :         }
     169             : 
     170           4 :         bool SdrLineStartEndAttribute::isStartActive() const
     171             :         {
     172           4 :             return mpSdrLineStartEndAttribute->isStartActive();
     173             :         }
     174             : 
     175           4 :         bool SdrLineStartEndAttribute::isEndActive() const
     176             :         {
     177           4 :             return mpSdrLineStartEndAttribute->isEndActive();
     178             :         }
     179             : 
     180         790 :         bool SdrLineStartEndAttribute::isStartCentered() const
     181             :         {
     182         790 :             return mpSdrLineStartEndAttribute->isStartCentered();
     183             :         }
     184             : 
     185         790 :         bool SdrLineStartEndAttribute::isEndCentered() const
     186             :         {
     187         790 :             return mpSdrLineStartEndAttribute->isEndCentered();
     188             :         }
     189             :     } // end of namespace attribute
     190             : } // end of namespace drawinglayer
     191             : 
     192             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10