Coverage Report

Created: 2025-11-16 09:57

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/drawinglayer/source/primitive2d/PolyPolygonStrokePrimitive2D.cxx
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
#include <drawinglayer/primitive2d/PolyPolygonStrokePrimitive2D.hxx>
21
22
#include <basegfx/polygon/b2dpolypolygontools.hxx>
23
#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
24
#include <drawinglayer/primitive2d/PolygonStrokePrimitive2D.hxx>
25
#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
26
#include <utility>
27
28
using namespace com::sun::star;
29
30
namespace drawinglayer::primitive2d
31
{
32
Primitive2DReference PolyPolygonStrokePrimitive2D::create2DDecomposition(
33
    const geometry::ViewInformation2D& /*rViewInformation*/) const
34
0
{
35
0
    const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon());
36
0
    const sal_uInt32 nCount(aPolyPolygon.count());
37
38
0
    Primitive2DContainer aContainer;
39
0
    for (sal_uInt32 a(0); a < nCount; a++)
40
0
    {
41
0
        aContainer.push_back(new PolygonStrokePrimitive2D(
42
0
            aPolyPolygon.getB2DPolygon(a), getLineAttribute(), getStrokeAttribute()));
43
0
    }
44
0
    return new GroupPrimitive2D(std::move(aContainer));
45
0
}
46
47
PolyPolygonStrokePrimitive2D::PolyPolygonStrokePrimitive2D(
48
    basegfx::B2DPolyPolygon aPolyPolygon, const attribute::LineAttribute& rLineAttribute,
49
    attribute::StrokeAttribute aStrokeAttribute)
50
0
    : maPolyPolygon(std::move(aPolyPolygon))
51
0
    , maLineAttribute(rLineAttribute)
52
0
    , maStrokeAttribute(std::move(aStrokeAttribute))
53
0
{
54
0
}
55
56
PolyPolygonStrokePrimitive2D::PolyPolygonStrokePrimitive2D(
57
    basegfx::B2DPolyPolygon aPolyPolygon, const attribute::LineAttribute& rLineAttribute)
58
0
    : maPolyPolygon(std::move(aPolyPolygon))
59
0
    , maLineAttribute(rLineAttribute)
60
0
{
61
0
}
62
63
bool PolyPolygonStrokePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
64
0
{
65
0
    if (BufferedDecompositionPrimitive2D::operator==(rPrimitive))
66
0
    {
67
0
        const PolyPolygonStrokePrimitive2D& rCompare
68
0
            = static_cast<const PolyPolygonStrokePrimitive2D&>(rPrimitive);
69
70
0
        return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon()
71
0
                && getLineAttribute() == rCompare.getLineAttribute()
72
0
                && getStrokeAttribute() == rCompare.getStrokeAttribute());
73
0
    }
74
75
0
    return false;
76
0
}
77
78
basegfx::B2DRange PolyPolygonStrokePrimitive2D::getB2DRange(
79
    const geometry::ViewInformation2D& /*rViewInformation*/) const
80
0
{
81
    // get range of it (subdivided)
82
0
    basegfx::B2DRange aRetval(getB2DPolyPolygon().getB2DRange());
83
84
    // if width, grow by line width
85
0
    if (getLineAttribute().getWidth())
86
0
    {
87
0
        aRetval.grow(getLineAttribute().getWidth() / 2.0);
88
0
    }
89
90
0
    return aRetval;
91
0
}
92
93
// provide unique ID
94
sal_uInt32 PolyPolygonStrokePrimitive2D::getPrimitive2DID() const
95
0
{
96
0
    return PRIMITIVE2D_ID_POLYPOLYGONSTROKEPRIMITIVE2D;
97
0
}
98
99
} // end drawinglayer::primitive2d namespace
100
101
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */