1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
22 #include <drawinglayer/drawinglayerdllapi.h>
24 #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
25 #include <drawinglayer/primitive2d/primitivetools2d.hxx>
26 #include <basegfx/polygon/b2dpolypolygon.hxx>
27 #include <basegfx/color/bcolor.hxx>
29 namespace drawinglayer::primitive2d
31 /** PolyPolygonSelectionPrimitive2D class
33 This primitive defines a tools::PolyPolygon which gets filled with a defined color
34 and a defined transparence, but also gets extended ('grown') by the given
35 discrete size (thus being a view-dependent primitive)
37 class DRAWINGLAYER_DLLPUBLIC PolyPolygonSelectionPrimitive2D final
38 : public DiscreteMetricDependentPrimitive2D
41 /// the tools::PolyPolygon geometry
42 basegfx::B2DPolyPolygon maPolyPolygon
;
45 basegfx::BColor maColor
;
47 /// the transparence [0.0 .. 1.0]
48 double mfTransparence
;
50 /// the discrete grow size ('pixels'), only positive values allowed
51 double mfDiscreteGrow
;
53 /// draw polygons filled when fill is set
56 /// local decomposition.
58 create2DDecomposition(Primitive2DContainer
& rContainer
,
59 const geometry::ViewInformation2D
& rViewInformation
) const override
;
63 PolyPolygonSelectionPrimitive2D(basegfx::B2DPolyPolygon aPolyPolygon
,
64 const basegfx::BColor
& rColor
, double fTransparence
,
65 double fDiscreteGrow
, bool bFill
);
68 const basegfx::B2DPolyPolygon
& getB2DPolyPolygon() const { return maPolyPolygon
; }
69 const basegfx::BColor
& getColor() const { return maColor
; }
70 double getTransparence() const { return mfTransparence
; }
71 double getDiscreteGrow() const { return mfDiscreteGrow
; }
72 bool getFill() const { return mbFill
; }
75 virtual bool operator==(const BasePrimitive2D
& rPrimitive
) const override
;
78 virtual basegfx::B2DRange
79 getB2DRange(const geometry::ViewInformation2D
& rViewInformation
) const override
;
82 virtual sal_uInt32
getPrimitive2DID() const override
;
84 } // end of namespace primitive2d::drawinglayer
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */