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/groupprimitive2d.hxx>
25 #include <rtl/ustring.hxx>
28 namespace drawinglayer::primitive2d
30 /** TextHierarchyLinePrimitive2D class
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.
37 This primitive encapsulates text lines.
39 class DRAWINGLAYER_DLLPUBLIC TextHierarchyLinePrimitive2D final
: public GroupPrimitive2D
44 explicit TextHierarchyLinePrimitive2D(const Primitive2DContainer
& rChildren
);
47 virtual sal_uInt32
getPrimitive2DID() const override
;
50 /** TextHierarchyBulletPrimitive2D class
52 This primitive encapsulates text bullets.
54 class DRAWINGLAYER_DLLPUBLIC TextHierarchyBulletPrimitive2D final
: public GroupPrimitive2D
59 explicit TextHierarchyBulletPrimitive2D(const Primitive2DContainer
& rChildren
);
62 virtual sal_uInt32
getPrimitive2DID() const override
;
65 /** TextHierarchyParagraphPrimitive2D class
67 This primitive encapsulates text paragraphs.
69 class DRAWINGLAYER_DLLPUBLIC TextHierarchyParagraphPrimitive2D final
: public GroupPrimitive2D
72 // outline level of the encapsulated paragraph data.
73 // -1 means no level, >= 0 is the level
74 sal_Int16 mnOutlineLevel
;
78 explicit TextHierarchyParagraphPrimitive2D(
79 const Primitive2DContainer
& rChildren
,
80 sal_Int16 nOutlineLevel
= -1);
83 sal_Int16
getOutlineLevel() const { return mnOutlineLevel
; }
86 virtual bool operator==(const BasePrimitive2D
& rPrimitive
) const override
;
89 virtual sal_uInt32
getPrimitive2DID() const override
;
92 /** TextHierarchyBlockPrimitive2D class
94 This primitive encapsulates text blocks.
96 class DRAWINGLAYER_DLLPUBLIC TextHierarchyBlockPrimitive2D final
: public GroupPrimitive2D
101 explicit TextHierarchyBlockPrimitive2D(const Primitive2DContainer
& rChildren
);
103 /// provide unique ID
104 virtual sal_uInt32
getPrimitive2DID() const override
;
107 /** FieldType definition */
110 /** unspecified. If more info is needed for a FieldType,
111 create a new type and its handling
115 /** uses "FIELD_SEQ_BEGIN;PageField" -> special handling */
118 /** uses URL as string -> special handling */
122 /** TextHierarchyFieldPrimitive2D class
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.
129 class DRAWINGLAYER_DLLPUBLIC TextHierarchyFieldPrimitive2D final
: public GroupPrimitive2D
132 /// field type definition
135 /// field data as name/value pairs (dependent of field type definition)
136 std::vector
< std::pair
< OUString
, OUString
>> meNameValue
;
140 TextHierarchyFieldPrimitive2D(
141 const Primitive2DContainer
& rChildren
,
142 const FieldType
& rFieldType
,
143 const std::vector
< std::pair
< OUString
, OUString
>>* pNameValue
= nullptr);
146 FieldType
getType() const { return meType
; }
147 OUString
getValue(const OUString
& rName
) const;
150 virtual bool operator==(const BasePrimitive2D
& rPrimitive
) const override
;
152 /// provide unique ID
153 virtual sal_uInt32
getPrimitive2DID() const override
;
156 /** TextHierarchyEditPrimitive2D class
159 Primitive to encapsulate text from an active text edit; some
160 renderers need to suppress this output due to painting the
161 edited text in e.g. an OutlinerEditView. It's derived from
162 GroupPrimitive2D, so the implicit decomposition will use the
163 content. To suppress, this primitive needs to be parsed by
164 the renderer without taking any action.
166 class DRAWINGLAYER_DLLPUBLIC TextHierarchyEditPrimitive2D final
: public GroupPrimitive2D
171 explicit TextHierarchyEditPrimitive2D(const Primitive2DContainer
& rChildren
);
173 /// provide unique ID
174 virtual sal_uInt32
getPrimitive2DID() const override
;
176 } // end of namespace drawinglayer::primitive2d
179 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */