Coverage Report

Created: 2026-09-14 06:37

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/librevenge/inc/librevenge/RVNGDrawingInterface.h
Line
Count
Source
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2
/* librevenge
3
 * Version: MPL 2.0 / LGPLv2.1+
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
 * Major Contributor(s):
10
 * Copyright (C) 2006 Ariya Hidayat (ariya@kde.org)
11
 * Copyright (C) 2004 Marc Oude Kotte (marc@solcon.nl)
12
 *
13
 * For minor contributions see the git repository.
14
 *
15
 * Alternatively, the contents of this file may be used under the terms
16
 * of the GNU Lesser General Public License Version 2.1 or later
17
 * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
18
 * applicable instead of those above.
19
 */
20
21
#ifndef RVNGDRAWINGINTERFACE_H
22
#define RVNGDRAWINGINTERFACE_H
23
24
#include "RVNGPropertyList.h"
25
#include "RVNGPropertyListVector.h"
26
#include "RVNGBinaryData.h"
27
28
namespace librevenge
29
{
30
31
class RVNGDrawingInterface
32
{
33
public:
34
7.49M
  virtual ~RVNGDrawingInterface() {}
35
36
  // none of the other callback functions will be called before this function is called
37
  virtual void startDocument(const RVNGPropertyList &propList) = 0;
38
39
  // none of the other callback functions will be called after this function is called
40
  virtual void endDocument() = 0;
41
42
  /**
43
  Called when all document metadata should be set. This is always the first callback made.
44
  \param propList Property list for the metadata. May contain:
45
  \li \c dc:creator
46
  \li \c dc:language The document's keywords
47
  \li \c dc:publisher The document's publisher
48
  \li \c dc:source
49
  \li \c dc:subject The document's subject
50
  \li \c dc:type The document's type
51
  \li \c dcterms:available Date when the document was completed
52
  \li \c dcterms:issued: Date of the version of the document
53
  \li \c librevenge:abstract Abstract of the document's contents
54
  \li \c librevenge:account Account
55
  \li \c librevenge:address Address
56
  \li \c librevenge:attachments
57
  \li \c librevenge:authorization
58
  \li \c librevenge:bill-to
59
  \li \c librevenge:blind-copy
60
  \li \c librevenge:carbon-copy
61
  \li \c librevenge:checked-by
62
  \li \c librevenge:client
63
  \li \c librevenge:comments
64
  \li \c librevenge:department
65
  \li \c librevenge:descriptive-name The descriptive name for the document
66
  \li \c librevenge:descriptive-type The descriptive type for the document
67
  \li \c librevenge:destination
68
  \li \c librevenge:disposition
69
  \li \c librevenge:division
70
  \li \c librevenge:document-number
71
  \li \c librevenge:editor
72
  \li \c librevenge:forward-to
73
  \li \c librevenge:group
74
  \li \c librevenge:mail-stop
75
  \li \c librevenge:matter
76
  \li \c librevenge:office
77
  \li \c librevenge:owner
78
  \li \c librevenge:project
79
  \li \c librevenge:purpose
80
  \li \c librevenge:received-from
81
  \li \c librevenge:recorded-by
82
  \li \c librevenge:recorded-date Date when the document was recorded
83
  \li \c librevenge:reference
84
  \li \c librevenge:revision-notes
85
  \li \c librevenge:revision-number
86
  \li \c librevenge:section
87
  \li \c librevenge:security
88
  \li \c librevenge:status
89
  \li \c librevenge:telephone-number
90
  \li \c librevenge:version-notes
91
  \li \c librevenge:version-number
92
  \li \c meta:creation-date Document creation date
93
  \li \c meta:initial-creator The document's author
94
  \li \c meta:keyword The document's keywords
95
  \li \c
96
  */
97
  virtual void setDocumentMetaData(const RVNGPropertyList &propList) = 0;
98
99
  /**
100
  Called when an embedded font should be defined
101
  \param propList A set of properties that specify the font. May contain:
102
  \li \c librevenge:name The name of the font
103
  \li \c librevenge:mime-type The mimetype of the font
104
  \li \c office:binary-data The font data
105
  \li \c librevenge:replacement-objects A property list vector containing alternative formats of the font. Every element is a property list containing:
106
      -# \c librevenge:mime-type The mimetype of the replacement object
107
      -# \c office:binary-data The replacement object data
108
  */
109
  virtual void defineEmbeddedFont(const RVNGPropertyList &propList) = 0;
110
111
  virtual void startPage(const RVNGPropertyList &propList) = 0;
112
113
  virtual void endPage() = 0;
114
115
  virtual void startMasterPage(const RVNGPropertyList &propList) = 0;
116
117
  virtual void endMasterPage() = 0;
118
119
  virtual void setStyle(const RVNGPropertyList &propList) = 0;
120
121
  virtual void startLayer(const RVNGPropertyList &propList) = 0;
122
123
  virtual void endLayer() = 0;
124
125
  virtual void startEmbeddedGraphics(const RVNGPropertyList &propList) = 0;
126
127
  virtual void endEmbeddedGraphics() = 0;
128
129
  virtual void openGroup(const RVNGPropertyList &propList) = 0;
130
131
  virtual void closeGroup() = 0;
132
133
  // Different primitive shapes
134
  virtual void drawRectangle(const RVNGPropertyList &propList) = 0;
135
136
  virtual void drawEllipse(const RVNGPropertyList &propList) = 0;
137
138
  virtual void drawPolygon(const RVNGPropertyList &propList) = 0;
139
140
  virtual void drawPolyline(const RVNGPropertyList &propList) = 0;
141
142
  virtual void drawPath(const RVNGPropertyList &propList) = 0;
143
144
  /**
145
  Called when a binary/raster object should be inserted
146
  \param propList Defines a set of properties for the object. May contain:
147
  \li \c librevenge:mime-type The mimetype of the object
148
  \li \c office:binary-data The object data
149
  \li \c librevenge:replacement-objects A property list vector containing alternative representations of the content. Every element is a property list containing:
150
      -# \c librevenge:mime-type The mimetype of the replacement object
151
      -# \c office:binary-data The replacement object data
152
  \li \c librevenge:replacement-text A string containing a text representation of the content.
153
154
  \note to insert a MathMl file, set the mimetype value to "application/mathml-presentation+xml"
155
     or "application/mathml+xml".
156
  */
157
  virtual void drawGraphicObject(const RVNGPropertyList &propList) = 0;
158
159
  /** Draw a connector.
160
    The connector will be typically between two shapes, but free-standing connectors are allowed too.
161
    \param propList Defines a set of properties for the object. May contain:
162
    \li \c draw:end-shape The \c ID of the shape attached at the end. Should not be present if the connector's end is not attached to any object.
163
    \li \c draw:start-shape The \c ID of the shape attached at the beginning. Should not be present if the connector's start is not attached to any object.
164
    \li \c svg:d The connector's geometric path. This is optional; if missing, the consumer is free to render it any way it likes.
165
    \li \c svg:x1 The \c X coordinate of the start point.
166
    \li \c svg:y1 The \c Y coordinate of the start point.
167
    \li \c svg:x2 The \c X coordinate of the end point.
168
    \li \c svg:y2 The \c Y coordinate of the end point.
169
    */
170
  virtual void drawConnector(const RVNGPropertyList &propList) = 0;
171
172
  // Embedded text object
173
  virtual void startTextObject(const RVNGPropertyList &propList) = 0;
174
  virtual void endTextObject() = 0;
175
  /**
176
  Called when a table should be opened
177
  \param propList Defines a set of properties for the table. May contain:
178
  \li \c table:align The alignment (left, right, center, or margins)
179
  \li \c fo:margin-left The left indentation of the table, in inches
180
  \li \c fo:margin-right The right indentation of the table, in inches
181
  \li \c style:width Total width of the table, in inches
182
  \li \c fo:break-before Whether this table should be placed in a new column or page (the value is set to column or page if so)
183
  \li \c librevenge:table-columns Column definitions for the table. May contain
184
      -# \c style:column-width Width of a column, in inches
185
  */
186
  virtual void startTableObject(const RVNGPropertyList &propList) = 0;
187
  /**
188
  Called when a new table row is opened
189
  \param propList Defines a set of properties for the table row. May contain:
190
  \li \c style:row-height The row's height, in inches
191
  \li \c style:min-row-height The row's minimum height, in inches
192
  \li \c librevenge:is-header-row This row contains headings of columns and should repeat at every page (for tables that span several pages)
193
  */
194
  virtual void openTableRow(const RVNGPropertyList &propList) = 0;
195
  /**
196
  Called when the current table row is closed
197
  */
198
  virtual void closeTableRow() = 0;
199
  /**
200
  Called when a new table cell is opened
201
  \param propList Property list for the table cell. May contain:
202
  \li \c librevenge:column Number of the column in which the cell is positioned
203
  \li \c librevenge:row Number of the row in which the cell is positioned
204
  \li \c table:number-columns-spanned Number of columns that the cell spans
205
  \li \c table:number-rows-spanned Number of rows that the cell spans
206
  \li \c fo:border-left Properties of the left border of the cell
207
  \li \c fo:border-right Properties of the right border of the cell
208
  \li \c fo:border-top Properties of the top border of the cell
209
  \li \c fo:border-bottom Properties of the bottom border of the cell
210
  \li \c fo:background-color Color of the cell (encoded in hex: \#RRGGBB)
211
  \li \c style:vertical-align Vertical alignment of the content in the cell (top, middle, or bottom)
212
  */
213
  virtual void openTableCell(const RVNGPropertyList &propList) = 0;
214
  /**
215
  Called when the current table cell is closed
216
  */
217
  virtual void closeTableCell() = 0;
218
  /**
219
  Called when a covered (spanned by another cell in the table) table cell is opened
220
  \param propList Property list for the table cell. May contain:
221
  \li \c librevenge:column Number of the column in which the cell is positioned
222
  \li \c librevenge:row Number of the row in which the cell is positioned
223
  */
224
  virtual void insertCoveredTableCell(const RVNGPropertyList &propList) = 0;
225
  /**
226
  Called when the current table is closed
227
  */
228
  virtual void endTableObject() = 0;
229
230
  /**
231
  Called when a TAB character should be inserted
232
  */
233
  virtual void insertTab() = 0;
234
235
  /**
236
  Called when an explicit space should be inserted
237
  */
238
  virtual void insertSpace() = 0;
239
240
  /**
241
  Called when a string of text should be inserted
242
  \param text A textbuffer encoded as a UTF8 string
243
  */
244
  virtual void insertText(const RVNGString &text) = 0;
245
246
  /**
247
  Called when a line break should be inserted
248
  */
249
  virtual void insertLineBreak() = 0;
250
251
  /**
252
  Called when a field should be inserted. Field types may include:
253
  - \c librevenge:field-type field types may include:
254
     -# \c text:page-number Current page number
255
     -# \c text:page-count Total # of pages in document
256
  - \c style:num-format Type of page number (for page number)
257
  */
258
  virtual void insertField(const RVNGPropertyList &propList) = 0;
259
260
  /**
261
  Called when a new ordered list level should be opened
262
  \param propList Defines a set of properties for the list. May contain:
263
  \li \c librevenge:list-id A unique integer identifier for the list
264
  \li \c librevenge:level The level of the list in the hierarchy
265
  \li \c style:num-format Type of list
266
  \li \c style:num-prefix Text that comes before the number in the list
267
  \li \c style:num-suffix Text that comes after the number in the list
268
  \li \c text:start-value The starting number of the list
269
  \li \c text:min-label-width The distance between the list label and the actual text, stored in inches
270
  \li \c text:space-before The indentation level of the lists, stored in inches
271
  */
272
  virtual void openOrderedListLevel(const RVNGPropertyList &propList) = 0;
273
274
  /**
275
  Called when a new unordered list level should be opened
276
  \param propList Defines a set of properties for the list level. May contain:
277
  \li \c librevenge:list-id A unique integer identifier for the list
278
  \li \c librevenge:level The level of the list in the hierarchy
279
  \li \c text:bullet-char The string that should be used as a bullet
280
  \li \c text:min-label-width The distance between the bullet and the actual text, stored in inches
281
  \li \c text:space-before The indentation level of the lists, stored in inches
282
  */
283
  virtual void openUnorderedListLevel(const RVNGPropertyList &propList) = 0;
284
285
  /**
286
  Called when an unordered list level should be closed
287
  */
288
  virtual void closeOrderedListLevel() = 0;
289
290
  /**
291
  Called when an ununordered list level should be closed
292
  */
293
  virtual void closeUnorderedListLevel() = 0;
294
295
  /**
296
  Called when a list element should be opened
297
  \param propList Property list for the paragraph. May contain:
298
  \li \c fo:text-align The justification of this paragraph (left, center, end, full, or justify)
299
  \li \c fo:margin-left The left indentation of this paragraph, in inches
300
  \li \c fo:margin-right The right indentation of this paragraph, in inches
301
  \li \c fo:margin-top The amount of extra spacing to be placed before the paragraph, in inches
302
  \li \c fo:margin-bottom The amount of extra spacing to be placed after the paragraph, in inches
303
  \li \c fo:text-indent The indentation of first line, in inches (difference relative to margin-left)
304
  \li \c fo:line-height The amount of spacing between lines, in number of lines (1.0 is single spacing)
305
  \li \c fo:break-before Whether this paragraph should be placed in a new column or page (the value is set to column or page if so)
306
  \li \c librevenge:tab-stops List of tabstop definitions for the paragraph. If the list is empty, default tabstop definition should be used. Each tab stop may contain:
307
      -# \c style:type Type of tab (left, right, center, or char)
308
      -# \c style:char Alingnment character for char aligned tabs
309
      -# \c style:leader-text The leader character
310
      -# \c style:position Position of the tab
311
  */
312
  virtual void openListElement(const RVNGPropertyList &propList) = 0;
313
314
  /**
315
  Called when a list element should be closed
316
  */
317
  virtual void closeListElement() = 0;
318
319
  virtual void defineParagraphStyle(const RVNGPropertyList &propList) = 0;
320
  /**
321
  Called when a new paragraph is opened. This (or openListElement) will always be called before any text or span is placed into the document.
322
  \param propList Property list for the paragraph. May contain:
323
  \paragraphproperties
324
  \li \c librevenge:tab-stops List of tabstop definitions for the paragraph. If the list is empty, default tabstop definition should be used. Each tab stop may contain:
325
      -# \c style:type Type of tab (left, right, center, or char)
326
      -# \c style:char Alingnment character for char aligned tabs
327
      -# \c style:leader-text The leader character
328
      -# \c style:position Position of the tab
329
  */
330
  virtual void openParagraph(const RVNGPropertyList &propList) = 0;
331
332
  /**
333
  Called when a paragraph is closed.
334
  */
335
  virtual void closeParagraph() = 0;
336
337
  virtual void defineCharacterStyle(const RVNGPropertyList &propList) = 0;
338
  /**
339
  Called when a text span is opened
340
  \param propList Property list for the span. May contain:
341
  \textproperties
342
  \li \c fo:text-shadow
343
  */
344
  virtual void openSpan(const RVNGPropertyList &propList) = 0;
345
346
  /**
347
  Called when a text span is closed
348
  */
349
  virtual void closeSpan() = 0;
350
351
  /**
352
  Called when a link should be opened
353
  \param propList Defines a set of properties for the link. May contain:
354
  \li \c xlink:type .
355
  \li \c xlink:href .
356
  */
357
  virtual void openLink(const RVNGPropertyList &propList) = 0;
358
359
  /**
360
  Called when the current link is closed
361
  */
362
  virtual void closeLink() = 0;
363
};
364
365
}
366
367
#endif // __RVNGPAINTINTERFACE_H__
368
369
/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */