Coverage Report

Created: 2025-12-08 09:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/drawinglayer/source/primitive2d/texthierarchyprimitive2d.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/texthierarchyprimitive2d.hxx>
21
#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
22
#include <comphelper/lok.hxx>
23
24
25
using namespace com::sun::star;
26
27
28
namespace drawinglayer::primitive2d
29
{
30
        TextHierarchyLinePrimitive2D::TextHierarchyLinePrimitive2D(Primitive2DContainer&& aChildren)
31
1.38k
        :   GroupPrimitive2D(std::move(aChildren))
32
1.38k
        {
33
1.38k
        }
34
35
        // provide unique ID
36
        sal_uInt32 TextHierarchyLinePrimitive2D::getPrimitive2DID() const
37
1.38k
        {
38
1.38k
            return PRIMITIVE2D_ID_TEXTHIERARCHYLINEPRIMITIVE2D;
39
1.38k
        }
40
41
42
        TextHierarchyParagraphPrimitive2D::TextHierarchyParagraphPrimitive2D(
43
            Primitive2DContainer&& aChildren,
44
            sal_Int16 nOutlineLevel)
45
500
        :   GroupPrimitive2D(std::move(aChildren)),
46
500
            mnOutlineLevel(nOutlineLevel)
47
500
        {
48
500
        }
49
50
        bool TextHierarchyParagraphPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
51
0
        {
52
0
            if(GroupPrimitive2D::operator==(rPrimitive))
53
0
            {
54
0
                const TextHierarchyParagraphPrimitive2D& rCompare = static_cast<const TextHierarchyParagraphPrimitive2D&>(rPrimitive);
55
56
0
                return (getOutlineLevel() == rCompare.getOutlineLevel());
57
0
            }
58
59
0
            return false;
60
0
        }
61
62
        // provide unique ID
63
        sal_uInt32 TextHierarchyParagraphPrimitive2D::getPrimitive2DID() const
64
500
        {
65
500
            return PRIMITIVE2D_ID_TEXTHIERARCHYPARAGRAPHPRIMITIVE2D;
66
500
        }
67
68
69
70
        TextHierarchyBulletPrimitive2D::TextHierarchyBulletPrimitive2D(Primitive2DContainer&& aChildren)
71
0
        :   GroupPrimitive2D(std::move(aChildren))
72
0
        {
73
0
        }
74
75
        // provide unique ID
76
        sal_uInt32 TextHierarchyBulletPrimitive2D::getPrimitive2DID() const
77
0
        {
78
0
            return PRIMITIVE2D_ID_TEXTHIERARCHYBULLETPRIMITIVE2D;
79
0
        }
80
81
82
        TextHierarchyBlockPrimitive2D::TextHierarchyBlockPrimitive2D(Primitive2DContainer&& aChildren)
83
485
        :   GroupPrimitive2D(std::move(aChildren))
84
485
        {
85
485
        }
86
87
        // provide unique ID
88
        sal_uInt32 TextHierarchyBlockPrimitive2D::getPrimitive2DID() const
89
485
        {
90
485
            return PRIMITIVE2D_ID_TEXTHIERARCHYBLOCKPRIMITIVE2D;
91
485
        }
92
93
94
        TextHierarchyFieldPrimitive2D::TextHierarchyFieldPrimitive2D(
95
            Primitive2DContainer&& aChildren,
96
            const FieldType& rFieldType,
97
            const std::vector< std::pair< OUString, OUString>>* pNameValue)
98
0
        :   GroupPrimitive2D(std::move(aChildren)),
99
0
            meType(rFieldType)
100
0
        {
101
0
            if (nullptr != pNameValue)
102
0
            {
103
0
                meNameValue = *pNameValue;
104
0
            }
105
0
        }
106
107
        OUString TextHierarchyFieldPrimitive2D::getValue(const OUString& rName) const
108
0
        {
109
0
            for (const std::pair< OUString, OUString >& candidate : meNameValue)
110
0
            {
111
0
                if (candidate.first.equals(rName))
112
0
                {
113
0
                    return candidate.second;
114
0
                }
115
0
            }
116
117
0
            return OUString();
118
0
        }
119
120
        bool TextHierarchyFieldPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
121
0
        {
122
0
            if(GroupPrimitive2D::operator==(rPrimitive))
123
0
            {
124
0
                const TextHierarchyFieldPrimitive2D& rCompare = static_cast<const TextHierarchyFieldPrimitive2D&>(rPrimitive);
125
126
0
                return (getType() == rCompare.getType()
127
0
                    && meNameValue == rCompare.meNameValue);
128
0
            }
129
130
0
            return false;
131
0
        }
132
133
        // provide unique ID
134
        sal_uInt32 TextHierarchyFieldPrimitive2D::getPrimitive2DID() const
135
0
        {
136
0
            return PRIMITIVE2D_ID_TEXTHIERARCHYFIELDPRIMITIVE2D;
137
0
        }
138
139
140
        TextHierarchyEditPrimitive2D::TextHierarchyEditPrimitive2D(Primitive2DContainer&& aContent)
141
0
        :   GroupPrimitive2D(std::move(aContent))
142
0
        {
143
0
        }
144
145
        void TextHierarchyEditPrimitive2D::get2DDecomposition(
146
            Primitive2DDecompositionVisitor& rVisitor,
147
            const geometry::ViewInformation2D& rViewInformation) const
148
0
        {
149
            // check if TextEdit is active. If not, process. If yes, suppress the content
150
            // lok case: always decompose it when we're rendering a slide show
151
0
            if (!rViewInformation.getTextEditActive() || comphelper::LibreOfficeKit::isSlideshowRendering())
152
0
                GroupPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
153
0
        }
154
155
        // provide unique ID
156
        sal_uInt32 TextHierarchyEditPrimitive2D::getPrimitive2DID() const
157
0
        {
158
0
            return PRIMITIVE2D_ID_TEXTHIERARCHYEDITPRIMITIVE2D;
159
0
        }
160
161
162
        TextHierarchyEmphasisMarkPrimitive2D::TextHierarchyEmphasisMarkPrimitive2D(Primitive2DContainer&& aContent)
163
0
        :   GroupPrimitive2D(std::move(aContent))
164
0
        {
165
0
        }
166
167
        // provide unique ID
168
        sal_uInt32 TextHierarchyEmphasisMarkPrimitive2D::getPrimitive2DID() const
169
0
        {
170
0
            return PRIMITIVE2D_ID_TEXTHIERARCHYEMPHASISMARKPRIMITIVE2D;
171
0
        }
172
173
} // end of namespace
174
175
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */