LCOV - code coverage report
Current view: top level - include/drawinglayer/primitive2d - borderlineprimitive2d.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 22 22 100.0 %
Date: 2014-11-03 Functions: 20 20 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             : #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BORDERLINEPRIMITIVE2D_HXX
      21             : #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BORDERLINEPRIMITIVE2D_HXX
      22             : 
      23             : #include <drawinglayer/drawinglayerdllapi.h>
      24             : 
      25             : #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
      26             : #include <basegfx/color/bcolor.hxx>
      27             : #include <basegfx/matrix/b2dhommatrix.hxx>
      28             : #include <basegfx/polygon/b2dpolypolygon.hxx>
      29             : 
      30             : #include <com/sun/star/table/BorderLineStyle.hpp>
      31             : 
      32             : 
      33             : 
      34             : namespace drawinglayer
      35             : {
      36             :     namespace primitive2d
      37             :     {
      38             :         /** BorderLinePrimitive2D class
      39             : 
      40             :             This is the basic primitive to build frames around objects, e.g. tables.
      41             :             It defines a single or double line from Start to End using the LeftWidth,
      42             :             Distance and RightWidth definitions.
      43             :             The LineStart/End overlap is defined by the Extend(Left|Right)(Start|End)
      44             :             definitions.
      45             :          */
      46       36062 :         class DRAWINGLAYER_DLLPUBLIC BorderLinePrimitive2D : public BufferedDecompositionPrimitive2D
      47             :         {
      48             :         private:
      49             :             /// the line definition
      50             :             basegfx::B2DPoint                               maStart;
      51             :             basegfx::B2DPoint                               maEnd;
      52             : 
      53             :             /// the widths of single/double line
      54             :             double                                          mfLeftWidth;
      55             :             double                                          mfDistance;
      56             :             double                                          mfRightWidth;
      57             : 
      58             :             /// edge overlap sizes
      59             :             double                                          mfExtendLeftStart;
      60             :             double                                          mfExtendLeftEnd;
      61             :             double                                          mfExtendRightStart;
      62             :             double                                          mfExtendRightEnd;
      63             : 
      64             :             /// the line colors
      65             :             basegfx::BColor                                 maRGBColorRight;
      66             :             basegfx::BColor                                 maRGBColorLeft;
      67             :             basegfx::BColor                                 maRGBColorGap;
      68             :             bool                                            mbHasGapColor;
      69             : 
      70             :             short                                           mnStyle;
      71             : 
      72             :             double                                          mfPatternScale;
      73             : 
      74             :             /// local helpers
      75             :             double getWidth(
      76             :                     const geometry::ViewInformation2D& rViewInformation) const;
      77             : 
      78          84 :             bool isSolidLine() const
      79             :             {
      80          84 :                 return mnStyle == com::sun::star::table::BorderLineStyle::SOLID;
      81             :             }
      82             : 
      83         284 :             bool isInsideUsed() const
      84             :             {
      85         284 :                 return !basegfx::fTools::equalZero(mfLeftWidth);
      86             :             }
      87             : 
      88         184 :             bool isOutsideUsed() const
      89             :             {
      90         184 :                 return !basegfx::fTools::equalZero(mfRightWidth);
      91             :             }
      92             : 
      93             :         protected:
      94             :             virtual basegfx::B2DPolyPolygon getClipPolygon(
      95             :                     const geometry::ViewInformation2D& rViewInformation) const;
      96             : 
      97             :             /// create local decomposition
      98             :             virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
      99             : 
     100             :         public:
     101             :             /// constructor
     102             :             BorderLinePrimitive2D(
     103             :                 const basegfx::B2DPoint& rStart,
     104             :                 const basegfx::B2DPoint& rEnd,
     105             :                 double fLeftWidth,
     106             :                 double fDistance,
     107             :                 double fRightWidth,
     108             :                 double fExtendLeftStart,
     109             :                 double fExtendLeftEnd,
     110             :                 double fExtendRightStart,
     111             :                 double fExtendRightEnd,
     112             :                 const basegfx::BColor& rRGBColorRight,
     113             :                 const basegfx::BColor& rRGBColorLeft,
     114             :                 const basegfx::BColor& rRGBColorGap,
     115             :                 bool bHasGapColor,
     116             :                 const short nStyle,
     117             :                 double fPatternScale = 1.0 );
     118             : 
     119             :             /// data read access
     120       34579 :             const basegfx::B2DPoint& getStart() const { return maStart; }
     121       32919 :             const basegfx::B2DPoint& getEnd() const { return maEnd; }
     122       20413 :             double getLeftWidth() const { return mfLeftWidth; }
     123        1886 :             double getDistance() const { return mfDistance; }
     124        1826 :             double getRightWidth() const { return mfRightWidth; }
     125         234 :             double getExtendLeftStart() const { return mfExtendLeftStart; }
     126         234 :             double getExtendLeftEnd() const { return mfExtendLeftEnd; }
     127         234 :             double getExtendRightStart() const { return mfExtendRightStart; }
     128         234 :             double getExtendRightEnd() const { return mfExtendRightEnd; }
     129        1810 :             const basegfx::BColor& getRGBColorRight () const { return maRGBColorRight; }
     130       19641 :             const basegfx::BColor& getRGBColorLeft () const { return maRGBColorLeft; }
     131          50 :             const basegfx::BColor& getRGBColorGap () const { return maRGBColorGap; }
     132        2540 :             bool hasGapColor( ) const { return mbHasGapColor; }
     133       37390 :             short getStyle () const { return mnStyle; }
     134         158 :             double getPatternScale() const { return mfPatternScale; }
     135             : 
     136             :             /// compare operator
     137             :             virtual bool operator==(const BasePrimitive2D& rPrimitive) const SAL_OVERRIDE;
     138             : 
     139             :             /// provide unique ID
     140             :             DeclPrimitive2DIDBlock()
     141             :         };
     142             :     } // end of namespace primitive2d
     143             : } // end of namespace drawinglayer
     144             : 
     145             : 
     146             : 
     147             : #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BORDERLINEPRIMITIVE2D_HXX
     148             : 
     149             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10