LCOV - code coverage report
Current view: top level - include/drawinglayer/primitive2d - polypolygonprimitive2d.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 23 34 67.6 %
Date: 2015-06-13 12:38:46 Functions: 29 42 69.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_POLYPOLYGONPRIMITIVE2D_HXX
      21             : #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYPOLYGONPRIMITIVE2D_HXX
      22             : 
      23             : #include <drawinglayer/drawinglayerdllapi.h>
      24             : 
      25             : #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
      26             : #include <drawinglayer/attribute/fillgraphicattribute.hxx>
      27             : #include <basegfx/polygon/b2dpolypolygon.hxx>
      28             : #include <drawinglayer/attribute/lineattribute.hxx>
      29             : #include <drawinglayer/attribute/strokeattribute.hxx>
      30             : #include <drawinglayer/attribute/linestartendattribute.hxx>
      31             : #include <drawinglayer/attribute/fillgradientattribute.hxx>
      32             : #include <drawinglayer/attribute/fillhatchattribute.hxx>
      33             : #include <drawinglayer/primitive2d/primitivetools2d.hxx>
      34             : #include <basegfx/color/bcolor.hxx>
      35             : 
      36             : 
      37             : // PolyPolygonHairlinePrimitive2D class
      38             : 
      39             : namespace drawinglayer
      40             : {
      41             :     namespace primitive2d
      42             :     {
      43             :         /** PolyPolygonHairlinePrimitive2D class
      44             : 
      45             :             This primitive defines a multi-PolygonHairlinePrimitive2D and is
      46             :             just for convenience. The definition is not different from the single
      47             :                 defined PolygonHairlinePrimitive2Ds.
      48             :          */
      49       86148 :         class DRAWINGLAYER_DLLPUBLIC PolyPolygonHairlinePrimitive2D : public BufferedDecompositionPrimitive2D
      50             :         {
      51             :         private:
      52             :             /// the hairline geometry
      53             :             basegfx::B2DPolyPolygon                 maPolyPolygon;
      54             : 
      55             :             /// the hairline color
      56             :             basegfx::BColor                         maBColor;
      57             : 
      58             :         protected:
      59             :             /// local decomposition.
      60             :             virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
      61             : 
      62             :         public:
      63             :             /// constructor
      64             :             PolyPolygonHairlinePrimitive2D(const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::BColor& rBColor);
      65             : 
      66             :             /// data read access
      67      189931 :             const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
      68       42157 :             const basegfx::BColor& getBColor() const { return maBColor; }
      69             : 
      70             :             /// compare operator
      71             :             virtual bool operator==(const BasePrimitive2D& rPrimitive) const SAL_OVERRIDE;
      72             : 
      73             :             /// get range
      74             :             virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
      75             : 
      76             :             /// provide unique ID
      77             :             DeclPrimitive2DIDBlock()
      78             :         };
      79             :     } // end of namespace primitive2d
      80             : } // end of namespace drawinglayer
      81             : 
      82             : 
      83             : // PolyPolygonMarkerPrimitive2D class
      84             : 
      85             : namespace drawinglayer
      86             : {
      87             :     namespace primitive2d
      88             :     {
      89             :         /** PolyPolygonMarkerPrimitive2D class
      90             : 
      91             :             This primitive defines a multi-PolygonMarkerPrimitive2D and is
      92             :             just for convenience. The definition is not different from the single
      93             :             defined PolygonMarkerPrimitive2Ds.
      94             :          */
      95           0 :         class DRAWINGLAYER_DLLPUBLIC PolyPolygonMarkerPrimitive2D : public BufferedDecompositionPrimitive2D
      96             :         {
      97             :         private:
      98             :             /// the marker hairline geometry
      99             :             basegfx::B2DPolyPolygon                 maPolyPolygon;
     100             : 
     101             :             /// the two colors
     102             :             basegfx::BColor                         maRGBColorA;
     103             :             basegfx::BColor                         maRGBColorB;
     104             : 
     105             :             /// the dash distance in 'pixels'
     106             :             double                                  mfDiscreteDashLength;
     107             : 
     108             :         protected:
     109             :             /// local decomposition.
     110             :             virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
     111             : 
     112             :         public:
     113             :             /// constructor
     114             :             PolyPolygonMarkerPrimitive2D(
     115             :                 const basegfx::B2DPolyPolygon& rPolyPolygon,
     116             :                 const basegfx::BColor& rRGBColorA,
     117             :                 const basegfx::BColor& rRGBColorB,
     118             :                 double fDiscreteDashLength);
     119             : 
     120             :             // data read access
     121           0 :             const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
     122           0 :             const basegfx::BColor& getRGBColorA() const { return maRGBColorA; }
     123           0 :             const basegfx::BColor& getRGBColorB() const { return maRGBColorB; }
     124           0 :             double getDiscreteDashLength() const { return mfDiscreteDashLength; }
     125             : 
     126             :             /// compare operator
     127             :             virtual bool operator==(const BasePrimitive2D& rPrimitive) const SAL_OVERRIDE;
     128             : 
     129             :             /// get range
     130             :             virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
     131             : 
     132             :             /// provide unique ID
     133             :             DeclPrimitive2DIDBlock()
     134             :         };
     135             :     } // end of namespace primitive2d
     136             : } // end of namespace drawinglayer
     137             : 
     138             : 
     139             : // PolyPolygonStrokePrimitive2D class
     140             : 
     141             : namespace drawinglayer
     142             : {
     143             :     namespace primitive2d
     144             :     {
     145             :         /** PolyPolygonStrokePrimitive2D class
     146             : 
     147             :             This primitive defines a multi-PolygonStrokePrimitive2D and is
     148             :             just for convenience. The definition is not different from the single
     149             :             defined PolygonStrokePrimitive2Ds.
     150             :          */
     151         682 :         class DRAWINGLAYER_DLLPUBLIC PolyPolygonStrokePrimitive2D : public BufferedDecompositionPrimitive2D
     152             :         {
     153             :         private:
     154             :             /// the line geometry
     155             :             basegfx::B2DPolyPolygon                 maPolyPolygon;
     156             : 
     157             :             /// the line attributes like width, join and color
     158             :             attribute::LineAttribute                maLineAttribute;
     159             : 
     160             :             /// the line stroking (if used)
     161             :             attribute::StrokeAttribute              maStrokeAttribute;
     162             : 
     163             :         protected:
     164             :             /// local decomposition.
     165             :             virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
     166             : 
     167             :         public:
     168             :             /// constructor
     169             :             PolyPolygonStrokePrimitive2D(
     170             :                 const basegfx::B2DPolyPolygon& rPolyPolygon,
     171             :                 const attribute::LineAttribute& rLineAttribute,
     172             :                 const attribute::StrokeAttribute& rStrokeAttribute);
     173             : 
     174             :             PolyPolygonStrokePrimitive2D(
     175             :                 const basegfx::B2DPolyPolygon& rPolyPolygon,
     176             :                 const attribute::LineAttribute& rLineAttribute);
     177             : 
     178             :             /// data read access
     179         760 :             const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
     180        1217 :             const attribute::LineAttribute& getLineAttribute() const { return maLineAttribute; }
     181         387 :             const attribute::StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; }
     182             : 
     183             :             /// compare operator
     184             :             virtual bool operator==(const BasePrimitive2D& rPrimitive) const SAL_OVERRIDE;
     185             : 
     186             :             /// get range
     187             :             virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
     188             : 
     189             :             /// provide unique ID
     190             :             DeclPrimitive2DIDBlock()
     191             :         };
     192             :     } // end of namespace primitive2d
     193             : } // end of namespace drawinglayer
     194             : 
     195             : 
     196             : // PolyPolygonColorPrimitive2D class
     197             : 
     198             : namespace drawinglayer
     199             : {
     200             :     namespace primitive2d
     201             :     {
     202             :         /** PolyPolygonColorPrimitive2D class
     203             : 
     204             :             This primitive defines a tools::PolyPolygon filled with a single color.
     205             :             This is one of the non-decomposable primitives, so a renderer
     206             :             should process it.
     207             :          */
     208      623004 :         class DRAWINGLAYER_DLLPUBLIC PolyPolygonColorPrimitive2D : public BasePrimitive2D
     209             :         {
     210             :         private:
     211             :             /// the tools::PolyPolygon geometry
     212             :             basegfx::B2DPolyPolygon                 maPolyPolygon;
     213             : 
     214             :             /// the polygon fill color
     215             :             basegfx::BColor                         maBColor;
     216             : 
     217             :         public:
     218             :             /// constructor
     219             :             PolyPolygonColorPrimitive2D(
     220             :                 const basegfx::B2DPolyPolygon& rPolyPolygon,
     221             :                 const basegfx::BColor& rBColor);
     222             : 
     223             :             /// data read access
     224      547027 :             const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
     225      295047 :             const basegfx::BColor& getBColor() const { return maBColor; }
     226             : 
     227             :             /// compare operator
     228             :             virtual bool operator==(const BasePrimitive2D& rPrimitive) const SAL_OVERRIDE;
     229             : 
     230             :             /// get range
     231             :             virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
     232             : 
     233             :             /// provide unique ID
     234             :             DeclPrimitive2DIDBlock()
     235             :         };
     236             :     } // end of namespace primitive2d
     237             : } // end of namespace drawinglayer
     238             : 
     239             : 
     240             : // PolyPolygonGradientPrimitive2D class
     241             : 
     242             : namespace drawinglayer
     243             : {
     244             :     namespace primitive2d
     245             :     {
     246             :         /** PolyPolygonColorPrimitive2D class
     247             : 
     248             :             This primitive defines a tools::PolyPolygon filled with a gradient. The
     249             :             decomosition will create a MaskPrimitive2D containing a
     250             :             FillGradientPrimitive2D.
     251             :          */
     252        1344 :         class DRAWINGLAYER_DLLPUBLIC PolyPolygonGradientPrimitive2D : public BufferedDecompositionPrimitive2D
     253             :         {
     254             :         private:
     255             :             /// the tools::PolyPolygon geometry
     256             :             basegfx::B2DPolyPolygon                     maPolyPolygon;
     257             : 
     258             :             /// the definition range
     259             :             basegfx::B2DRange                           maDefinitionRange;
     260             : 
     261             :             /// the gradient definition
     262             :             attribute::FillGradientAttribute            maFillGradient;
     263             : 
     264             :         protected:
     265             :             /// local decomposition.
     266             :             virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
     267             : 
     268             :         public:
     269             :             /// constructors. The one without definition range will use output range as definition range
     270             :             PolyPolygonGradientPrimitive2D(
     271             :                 const basegfx::B2DPolyPolygon& rPolyPolygon,
     272             :                 const attribute::FillGradientAttribute& rFillGradient);
     273             :             PolyPolygonGradientPrimitive2D(
     274             :                 const basegfx::B2DPolyPolygon& rPolyPolygon,
     275             :                 const basegfx::B2DRange& rDefinitionRange,
     276             :                 const attribute::FillGradientAttribute& rFillGradient);
     277             : 
     278             :             /// data read access
     279        1662 :             const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
     280         683 :             const basegfx::B2DRange& getDefinitionRange() const { return maDefinitionRange; }
     281        1657 :             const attribute::FillGradientAttribute& getFillGradient() const { return maFillGradient; }
     282             : 
     283             :             /// compare operator
     284             :             virtual bool operator==(const BasePrimitive2D& rPrimitive) const SAL_OVERRIDE;
     285             : 
     286             :             /// provide unique ID
     287             :             DeclPrimitive2DIDBlock()
     288             :         };
     289             :     } // end of namespace primitive2d
     290             : } // end of namespace drawinglayer
     291             : 
     292             : 
     293             : // PolyPolygonHatchPrimitive2D class
     294             : 
     295             : namespace drawinglayer
     296             : {
     297             :     namespace primitive2d
     298             :     {
     299             :         /** PolyPolygonHatchPrimitive2D class
     300             : 
     301             :             This primitive defines a tools::PolyPolygon filled with a hatch. The
     302             :             decomosition will create a MaskPrimitive2D containing a
     303             :             FillHatchPrimitive2D.
     304             :          */
     305        2966 :         class DRAWINGLAYER_DLLPUBLIC PolyPolygonHatchPrimitive2D : public BufferedDecompositionPrimitive2D
     306             :         {
     307             :         private:
     308             :             /// the tools::PolyPolygon geometry
     309             :             basegfx::B2DPolyPolygon                     maPolyPolygon;
     310             : 
     311             :             /// the definition range
     312             :             basegfx::B2DRange                           maDefinitionRange;
     313             : 
     314             :             /// the hatch background color (if used)
     315             :             basegfx::BColor                             maBackgroundColor;
     316             : 
     317             :             /// the hatch definition
     318             :             attribute::FillHatchAttribute               maFillHatch;
     319             : 
     320             :         protected:
     321             :             /// local decomposition.
     322             :             virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
     323             : 
     324             :         public:
     325             :             /// constructors. The one without definition range will use output range as definition range
     326             :             PolyPolygonHatchPrimitive2D(
     327             :                 const basegfx::B2DPolyPolygon& rPolyPolygon,
     328             :                 const basegfx::BColor& rBackgroundColor,
     329             :                 const attribute::FillHatchAttribute& rFillHatch);
     330             :             PolyPolygonHatchPrimitive2D(
     331             :                 const basegfx::B2DPolyPolygon& rPolyPolygon,
     332             :                 const basegfx::B2DRange& rDefinitionRange,
     333             :                 const basegfx::BColor& rBackgroundColor,
     334             :                 const attribute::FillHatchAttribute& rFillHatch);
     335             : 
     336             :             /// data read access
     337        3001 :             const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
     338        1504 :             const basegfx::B2DRange& getDefinitionRange() const { return maDefinitionRange; }
     339        1497 :             const basegfx::BColor& getBackgroundColor() const { return maBackgroundColor; }
     340        3001 :             const attribute::FillHatchAttribute& getFillHatch() const { return maFillHatch; }
     341             : 
     342             :             /// compare operator
     343             :             virtual bool operator==(const BasePrimitive2D& rPrimitive) const SAL_OVERRIDE;
     344             : 
     345             :             /// provide unique ID
     346             :             DeclPrimitive2DIDBlock()
     347             :         };
     348             :     } // end of namespace primitive2d
     349             : } // end of namespace drawinglayer
     350             : 
     351             : 
     352             : // PolyPolygonGraphicPrimitive2D class
     353             : 
     354             : namespace drawinglayer
     355             : {
     356             :     namespace primitive2d
     357             :     {
     358             :         /** PolyPolygonGraphicPrimitive2D class
     359             : 
     360             :             This primitive defines a tools::PolyPolygon filled with bitmap data
     361             :             (including transparence). The decomosition will create a MaskPrimitive2D
     362             :             containing a FillGraphicPrimitive2D.
     363             :          */
     364         814 :         class DRAWINGLAYER_DLLPUBLIC PolyPolygonGraphicPrimitive2D : public BufferedDecompositionPrimitive2D
     365             :         {
     366             :         private:
     367             :             /// the tools::PolyPolygon geometry
     368             :             basegfx::B2DPolyPolygon                     maPolyPolygon;
     369             : 
     370             :             /// the definition range
     371             :             basegfx::B2DRange                           maDefinitionRange;
     372             : 
     373             :             /// the bitmap fill definition (may include tiling)
     374             :             attribute::FillGraphicAttribute             maFillGraphic;
     375             : 
     376             :         protected:
     377             :             /// local decomposition.
     378             :             virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
     379             : 
     380             :         public:
     381             :             /// constructors. The one without definition range will use output range as definition range
     382             :             PolyPolygonGraphicPrimitive2D(
     383             :                 const basegfx::B2DPolyPolygon& rPolyPolygon,
     384             :                 const attribute::FillGraphicAttribute& rFillGraphic);
     385             :             PolyPolygonGraphicPrimitive2D(
     386             :                 const basegfx::B2DPolyPolygon& rPolyPolygon,
     387             :                 const basegfx::B2DRange& rDefinitionRange,
     388             :                 const attribute::FillGraphicAttribute& rFillGraphic);
     389             : 
     390             :             /// data read access
     391        1158 :             const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
     392         416 :             const basegfx::B2DRange& getDefinitionRange() const { return maDefinitionRange; }
     393        1580 :             const attribute::FillGraphicAttribute& getFillGraphic() const { return maFillGraphic; }
     394             : 
     395             :             /// compare operator
     396             :             virtual bool operator==(const BasePrimitive2D& rPrimitive) const SAL_OVERRIDE;
     397             : 
     398             :             /// provide unique ID
     399             :             DeclPrimitive2DIDBlock()
     400             :         };
     401             :     } // end of namespace primitive2d
     402             : } // end of namespace drawinglayer
     403             : 
     404             : 
     405             : // PolyPolygonSelectionPrimitive2D class
     406             : 
     407             : namespace drawinglayer
     408             : {
     409             :     namespace primitive2d
     410             :     {
     411             :         /** PolyPolygonSelectionPrimitive2D class
     412             : 
     413             :             This primitive defines a tools::PolyPolygon which gets filled with a defined color
     414             :             and a defined transparence, but also gets extended ('grown') by the given
     415             :             discrete size (thus being a view-dependent primitive)
     416             :          */
     417           0 :         class DRAWINGLAYER_DLLPUBLIC PolyPolygonSelectionPrimitive2D : public DiscreteMetricDependentPrimitive2D
     418             :         {
     419             :         private:
     420             :             /// the tools::PolyPolygon geometry
     421             :             basegfx::B2DPolyPolygon                 maPolyPolygon;
     422             : 
     423             :             /// the color
     424             :             basegfx::BColor                         maColor;
     425             : 
     426             :             /// the transparence [0.0 .. 1.0]
     427             :             double                                  mfTransparence;
     428             : 
     429             :             /// the discrete grow size ('pixels'), only posivive values allowed
     430             :             double                                  mfDiscreteGrow;
     431             : 
     432             :             /// bitfield
     433             :             /// draw polygons filled when fill is set
     434             :             bool                                    mbFill : 1;
     435             : 
     436             :         protected:
     437             :             /// local decomposition.
     438             :             virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
     439             : 
     440             :         public:
     441             :             /// constructor
     442             :             PolyPolygonSelectionPrimitive2D(
     443             :                 const basegfx::B2DPolyPolygon& rPolyPolygon,
     444             :                 const basegfx::BColor& rColor,
     445             :                 double fTransparence,
     446             :                 double fDiscreteGrow,
     447             :                 bool bFill);
     448             : 
     449             :             /// data read access
     450           0 :             const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
     451           0 :             const basegfx::BColor& getColor() const { return maColor; }
     452           0 :             double getTransparence() const { return mfTransparence; }
     453           0 :             double getDiscreteGrow() const { return mfDiscreteGrow; }
     454           0 :             bool getFill() const { return mbFill; }
     455             : 
     456             :             /// compare operator
     457             :             virtual bool operator==(const BasePrimitive2D& rPrimitive) const SAL_OVERRIDE;
     458             : 
     459             :             /// get range
     460             :             virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
     461             : 
     462             :             /// provide unique ID
     463             :             DeclPrimitive2DIDBlock()
     464             :         };
     465             :     } // end of namespace primitive2d
     466             : } // end of namespace drawinglayer
     467             : 
     468             : 
     469             : 
     470             : #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYPOLYGONPRIMITIVE2D_HXX
     471             : 
     472             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11