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(Primitive2DContainer
&& aChildren
);
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(Primitive2DContainer
&& aChildren
);
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 Primitive2DContainer
&& aChildren
,
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(Primitive2DContainer
&& aChildren
);
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 Primitive2DContainer
&& aChildren
,
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
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 Deriving now from BasePrimitive2D to turn around functionality:
163 This will decompose to nothing -> suppress. In renderers that need to
164 visualize it (only VclMetafileProcessor2D for now), it needs
165 to be detected and used (see there).
166 Doing it this way around since we will potentially have many
167 pixel renderers and only one MetafileProcessor, so it will
168 be one action less to support (and to potentially forget about )
169 in these implementations.
171 class DRAWINGLAYER_DLLPUBLIC TextHierarchyEditPrimitive2D final
: public BasePrimitive2D
175 Primitive2DContainer maContent
;
179 explicit TextHierarchyEditPrimitive2D(Primitive2DContainer
&& aContent
);
182 const Primitive2DContainer
& getContent() const { return maContent
; }
184 /// provide unique ID
185 virtual sal_uInt32
getPrimitive2DID() const override
;
187 } // end of namespace drawinglayer::primitive2d
190 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */