Coverage Report

Created: 2025-12-31 10:39

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/drawinglayer/primitive2d/texthierarchyprimitive2d.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/groupprimitive2d.hxx>
25
#include <rtl/ustring.hxx>
26
27
28
namespace drawinglayer::primitive2d
29
{
30
        /** TextHierarchyLinePrimitive2D class
31
32
            Text format hierarchy helper class. It decomposes to its
33
            content, so all direct renderers may ignore it. If You need
34
            to know more about line hierarchies You may react on it and
35
            also need to take care that the source of data uses it.
36
37
            This primitive encapsulates text lines.
38
         */
39
        class DRAWINGLAYER_DLLPUBLIC TextHierarchyLinePrimitive2D final : public GroupPrimitive2D
40
        {
41
        private:
42
        public:
43
            /// constructor
44
            explicit TextHierarchyLinePrimitive2D(Primitive2DContainer&& aChildren);
45
46
            /// provide unique ID
47
            virtual sal_uInt32 getPrimitive2DID() const override;
48
        };
49
50
        /** TextHierarchyBulletPrimitive2D class
51
52
            This primitive encapsulates text bullets.
53
         */
54
        class DRAWINGLAYER_DLLPUBLIC TextHierarchyBulletPrimitive2D final : public GroupPrimitive2D
55
        {
56
        private:
57
        public:
58
            /// constructor
59
            explicit TextHierarchyBulletPrimitive2D(Primitive2DContainer&& aChildren);
60
61
            /// provide unique ID
62
            virtual sal_uInt32 getPrimitive2DID() const override;
63
        };
64
65
        /** TextHierarchyParagraphPrimitive2D class
66
67
            This primitive encapsulates text paragraphs.
68
         */
69
        class DRAWINGLAYER_DLLPUBLIC TextHierarchyParagraphPrimitive2D final : public GroupPrimitive2D
70
        {
71
        private:
72
            // outline level of the encapsulated paragraph data.
73
            // -1 means no level, >= 0 is the level
74
            sal_Int16           mnOutlineLevel;
75
76
        public:
77
            /// constructor
78
            explicit TextHierarchyParagraphPrimitive2D(
79
                Primitive2DContainer&& aChildren,
80
                sal_Int16 nOutlineLevel = -1);
81
82
            /// data read access
83
0
            sal_Int16 getOutlineLevel() const { return mnOutlineLevel; }
84
85
            /// compare operator
86
            virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
87
88
            /// provide unique ID
89
            virtual sal_uInt32 getPrimitive2DID() const override;
90
        };
91
92
        /** TextHierarchyBlockPrimitive2D class
93
94
            This primitive encapsulates text blocks.
95
         */
96
        class DRAWINGLAYER_DLLPUBLIC TextHierarchyBlockPrimitive2D final : public GroupPrimitive2D
97
        {
98
        private:
99
        public:
100
            /// constructor
101
            explicit TextHierarchyBlockPrimitive2D(Primitive2DContainer&& aChildren);
102
103
            /// provide unique ID
104
            virtual sal_uInt32 getPrimitive2DID() const override;
105
        };
106
107
        /** FieldType definition */
108
        enum FieldType
109
        {
110
            /** unspecified. If more info is needed for a FieldType,
111
                create a new type and its handling
112
             */
113
            FIELD_TYPE_COMMON,
114
115
            /** uses "FIELD_SEQ_BEGIN;PageField" -> special handling */
116
            FIELD_TYPE_PAGE,
117
118
            /** uses URL as string -> special handling */
119
            FIELD_TYPE_URL
120
        };
121
122
        /** TextHierarchyFieldPrimitive2D class
123
124
            This primitive encapsulates text fields.
125
            Also: This type uses a type enum to transport the encapsulated field
126
            type. Also added is a String which is type-dependent. E.g. for URL
127
            fields, it contains the URL.
128
         */
129
        class DRAWINGLAYER_DLLPUBLIC TextHierarchyFieldPrimitive2D final : public GroupPrimitive2D
130
        {
131
        private:
132
            /// field type definition
133
            FieldType                               meType;
134
135
            /// field data as name/value pairs (dependent of field type definition)
136
            std::vector< std::pair< OUString, OUString>>    meNameValue;
137
138
        public:
139
            /// constructor
140
            TextHierarchyFieldPrimitive2D(
141
                Primitive2DContainer&& aChildren,
142
                const FieldType& rFieldType,
143
                const std::vector< std::pair< OUString, OUString>>* pNameValue = nullptr);
144
145
            /// data read access
146
0
            FieldType getType() const { return meType; }
147
            OUString getValue(const OUString& rName) const;
148
149
            /// compare operator
150
            virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
151
152
            /// provide unique ID
153
            virtual sal_uInt32 getPrimitive2DID() const override;
154
        };
155
156
        /** TextHierarchyEditPrimitive2D class
157
158
            Primitive to encapsulate text from an active text edit; this is
159
            separate from other text data since some renderers need to suppress
160
            this output due to painting the edited text in e.g. an
161
            OutlinerEditView in the active text edit control.
162
            It now uses get2DDecomposition to decide if to process or not,
163
            thus it does not need to be processed in any B2DProcessor at all.
164
            This is also important e.g. for PDF export - if the object is in
165
            edit mode, we need to include the most current text from EditEngine/
166
            Outliner to that export which is contained here.
167
         */
168
        class DRAWINGLAYER_DLLPUBLIC TextHierarchyEditPrimitive2D final : public GroupPrimitive2D
169
        {
170
        public:
171
            /// constructor
172
            explicit TextHierarchyEditPrimitive2D(Primitive2DContainer&& aContent);
173
174
            /// local decomposition
175
            virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override;
176
177
            /// provide unique ID
178
            virtual sal_uInt32 getPrimitive2DID() const override;
179
        };
180
181
        class DRAWINGLAYER_DLLPUBLIC TextHierarchyEmphasisMarkPrimitive2D final : public GroupPrimitive2D
182
        {
183
        public:
184
            /// constructor
185
            explicit TextHierarchyEmphasisMarkPrimitive2D(Primitive2DContainer&& aContent);
186
187
            /// provide unique ID
188
            virtual sal_uInt32 getPrimitive2DID() const override;
189
        };
190
} // end of namespace drawinglayer::primitive2d
191
192
193
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */