Coverage Report

Created: 2026-03-31 11:00

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/drawinglayer/primitive2d/PolyPolygonSelectionPrimitive2D.hxx
Line
Count
Source
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
#pragma once
21
22
#include <drawinglayer/drawinglayerdllapi.h>
23
24
#include <drawinglayer/primitive2d/primitivetools2d.hxx>
25
#include <basegfx/polygon/b2dpolypolygon.hxx>
26
#include <basegfx/color/bcolor.hxx>
27
28
namespace drawinglayer::primitive2d
29
{
30
/** PolyPolygonSelectionPrimitive2D class
31
32
    This primitive defines a tools::PolyPolygon which gets filled with a defined color
33
    and a defined transparence, but also gets extended ('grown') by the given
34
    discrete size (thus being a view-dependent primitive)
35
 */
36
class DRAWINGLAYER_DLLPUBLIC PolyPolygonSelectionPrimitive2D final
37
    : public DiscreteMetricDependentPrimitive2D
38
{
39
private:
40
    /// the tools::PolyPolygon geometry
41
    basegfx::B2DPolyPolygon maPolyPolygon;
42
43
    /// the color
44
    basegfx::BColor maColor;
45
46
    /// the transparence [0.0 .. 1.0]
47
    double mfTransparence;
48
49
    /// the discrete grow size ('pixels'), only positive values allowed
50
    double mfDiscreteGrow;
51
52
    /// draw polygons filled when fill is set
53
    bool mbFill : 1;
54
55
    /// local decomposition.
56
    virtual Primitive2DReference
57
    create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const override;
58
59
public:
60
    /// constructor
61
    PolyPolygonSelectionPrimitive2D(basegfx::B2DPolyPolygon aPolyPolygon,
62
                                    const basegfx::BColor& rColor, double fTransparence,
63
                                    double fDiscreteGrow, bool bFill);
64
65
    /// data read access
66
0
    const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
67
0
    const basegfx::BColor& getColor() const { return maColor; }
68
0
    double getTransparence() const { return mfTransparence; }
69
0
    double getDiscreteGrow() const { return mfDiscreteGrow; }
70
0
    bool getFill() const { return mbFill; }
71
72
    /// compare operator
73
    virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
74
75
    /// get range
76
    virtual basegfx::B2DRange
77
    getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
78
79
    /// provide unique ID
80
    virtual sal_uInt32 getPrimitive2DID() const override;
81
};
82
} // end of namespace primitive2d::drawinglayer
83
84
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */