1/* poppler-structure-element.h: glib interface to poppler
2 *
3 * Copyright (C) 2013 Igalia S.L.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20#ifndef __POPPLER_STRUCTURE_ELEMENT_H__
21#define __POPPLER_STRUCTURE_ELEMENT_H__
22
23#include <glib-object.h>
24#include "poppler.h"
25
26G_BEGIN_DECLS
27
28#define POPPLER_TYPE_STRUCTURE_ELEMENT (poppler_structure_element_get_type())
29#define POPPLER_STRUCTURE_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), POPPLER_TYPE_STRUCTURE_ELEMENT, PopplerStructureElement))
30#define POPPLER_IS_STRUCTURE_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), POPPLER_TYPE_STRUCTURE_ELEMENT))
31
32/**
33 * PopplerStructureElementKind:
34 */
35typedef enum
36{
37 POPPLER_STRUCTURE_ELEMENT_CONTENT,
38 POPPLER_STRUCTURE_ELEMENT_OBJECT_REFERENCE,
39 POPPLER_STRUCTURE_ELEMENT_DOCUMENT,
40 POPPLER_STRUCTURE_ELEMENT_PART,
41 POPPLER_STRUCTURE_ELEMENT_ARTICLE,
42 POPPLER_STRUCTURE_ELEMENT_SECTION,
43 POPPLER_STRUCTURE_ELEMENT_DIV,
44 POPPLER_STRUCTURE_ELEMENT_SPAN,
45 POPPLER_STRUCTURE_ELEMENT_QUOTE,
46 POPPLER_STRUCTURE_ELEMENT_NOTE,
47 POPPLER_STRUCTURE_ELEMENT_REFERENCE,
48 POPPLER_STRUCTURE_ELEMENT_BIBENTRY,
49 POPPLER_STRUCTURE_ELEMENT_CODE,
50 POPPLER_STRUCTURE_ELEMENT_LINK,
51 POPPLER_STRUCTURE_ELEMENT_ANNOT,
52 POPPLER_STRUCTURE_ELEMENT_BLOCKQUOTE,
53 POPPLER_STRUCTURE_ELEMENT_CAPTION,
54 POPPLER_STRUCTURE_ELEMENT_NONSTRUCT,
55 POPPLER_STRUCTURE_ELEMENT_TOC,
56 POPPLER_STRUCTURE_ELEMENT_TOC_ITEM,
57 POPPLER_STRUCTURE_ELEMENT_INDEX,
58 POPPLER_STRUCTURE_ELEMENT_PRIVATE,
59 POPPLER_STRUCTURE_ELEMENT_PARAGRAPH,
60 POPPLER_STRUCTURE_ELEMENT_HEADING,
61 POPPLER_STRUCTURE_ELEMENT_HEADING_1,
62 POPPLER_STRUCTURE_ELEMENT_HEADING_2,
63 POPPLER_STRUCTURE_ELEMENT_HEADING_3,
64 POPPLER_STRUCTURE_ELEMENT_HEADING_4,
65 POPPLER_STRUCTURE_ELEMENT_HEADING_5,
66 POPPLER_STRUCTURE_ELEMENT_HEADING_6,
67 POPPLER_STRUCTURE_ELEMENT_LIST,
68 POPPLER_STRUCTURE_ELEMENT_LIST_ITEM,
69 POPPLER_STRUCTURE_ELEMENT_LIST_LABEL,
70 POPPLER_STRUCTURE_ELEMENT_LIST_BODY,
71 POPPLER_STRUCTURE_ELEMENT_TABLE,
72 POPPLER_STRUCTURE_ELEMENT_TABLE_ROW,
73 POPPLER_STRUCTURE_ELEMENT_TABLE_HEADING,
74 POPPLER_STRUCTURE_ELEMENT_TABLE_DATA,
75 POPPLER_STRUCTURE_ELEMENT_TABLE_HEADER,
76 POPPLER_STRUCTURE_ELEMENT_TABLE_FOOTER,
77 POPPLER_STRUCTURE_ELEMENT_TABLE_BODY,
78 POPPLER_STRUCTURE_ELEMENT_RUBY,
79 POPPLER_STRUCTURE_ELEMENT_RUBY_BASE_TEXT,
80 POPPLER_STRUCTURE_ELEMENT_RUBY_ANNOT_TEXT,
81 POPPLER_STRUCTURE_ELEMENT_RUBY_PUNCTUATION,
82 POPPLER_STRUCTURE_ELEMENT_WARICHU,
83 POPPLER_STRUCTURE_ELEMENT_WARICHU_TEXT,
84 POPPLER_STRUCTURE_ELEMENT_WARICHU_PUNCTUATION,
85 POPPLER_STRUCTURE_ELEMENT_FIGURE,
86 POPPLER_STRUCTURE_ELEMENT_FORMULA,
87 POPPLER_STRUCTURE_ELEMENT_FORM,
88} PopplerStructureElementKind;
89
90/**
91 * PopplerStructureGetTextFlags:
92 * @POPPLER_STRUCTURE_GET_TEXT_NONE: No flags.
93 * @POPPLER_STRUCTURE_GET_TEXT_RECURSIVE: For non-leaf, non-content
94 * elements, recursively obtain the text from all the elements
95 * enclosed in the subtree.
96 */
97typedef enum
98{
99 POPPLER_STRUCTURE_GET_TEXT_NONE = 0,
100 POPPLER_STRUCTURE_GET_TEXT_RECURSIVE = (1 << 0),
101} PopplerStructureGetTextFlags;
102
103/**
104 * PopplerStructurePlacement:
105 */
106typedef enum
107{
108 POPPLER_STRUCTURE_PLACEMENT_BLOCK,
109 POPPLER_STRUCTURE_PLACEMENT_INLINE,
110 POPPLER_STRUCTURE_PLACEMENT_BEFORE,
111 POPPLER_STRUCTURE_PLACEMENT_START,
112 POPPLER_STRUCTURE_PLACEMENT_END,
113} PopplerStructurePlacement;
114
115/**
116 * PopplerStructureWritingMode:
117 */
118typedef enum
119{
120 POPPLER_STRUCTURE_WRITING_MODE_LR_TB,
121 POPPLER_STRUCTURE_WRITING_MODE_RL_TB,
122 POPPLER_STRUCTURE_WRITING_MODE_TB_RL,
123} PopplerStructureWritingMode;
124
125/**
126 * PopplerStructureBorderStyle:
127 */
128typedef enum
129{
130 POPPLER_STRUCTURE_BORDER_STYLE_NONE,
131 POPPLER_STRUCTURE_BORDER_STYLE_HIDDEN,
132 POPPLER_STRUCTURE_BORDER_STYLE_DOTTED,
133 POPPLER_STRUCTURE_BORDER_STYLE_DASHED,
134 POPPLER_STRUCTURE_BORDER_STYLE_SOLID,
135 POPPLER_STRUCTURE_BORDER_STYLE_DOUBLE,
136 POPPLER_STRUCTURE_BORDER_STYLE_GROOVE,
137 POPPLER_STRUCTURE_BORDER_STYLE_INSET,
138 POPPLER_STRUCTURE_BORDER_STYLE_OUTSET,
139} PopplerStructureBorderStyle;
140
141/**
142 * PopplerStructureTextAlign:
143 */
144typedef enum
145{
146 POPPLER_STRUCTURE_TEXT_ALIGN_START,
147 POPPLER_STRUCTURE_TEXT_ALIGN_CENTER,
148 POPPLER_STRUCTURE_TEXT_ALIGN_END,
149 POPPLER_STRUCTURE_TEXT_ALIGN_JUSTIFY,
150} PopplerStructureTextAlign;
151
152/**
153 * PopplerStructureBlockAlign:
154 */
155typedef enum
156{
157 POPPLER_STRUCTURE_BLOCK_ALIGN_BEFORE,
158 POPPLER_STRUCTURE_BLOCK_ALIGN_MIDDLE,
159 POPPLER_STRUCTURE_BLOCK_ALIGN_AFTER,
160 POPPLER_STRUCTURE_BLOCK_ALIGN_JUSTIFY,
161} PopplerStructureBlockAlign;
162
163/**
164 * PopplerStructureInlineAlign:
165 */
166typedef enum
167{
168 POPPLER_STRUCTURE_INLINE_ALIGN_START,
169 POPPLER_STRUCTURE_INLINE_ALIGN_CENTER,
170 POPPLER_STRUCTURE_INLINE_ALIGN_END,
171} PopplerStructureInlineAlign;
172
173/**
174 * PopplerStructureTextDecoration:
175 */
176typedef enum
177{
178 POPPLER_STRUCTURE_TEXT_DECORATION_NONE,
179 POPPLER_STRUCTURE_TEXT_DECORATION_UNDERLINE,
180 POPPLER_STRUCTURE_TEXT_DECORATION_OVERLINE,
181 POPPLER_STRUCTURE_TEXT_DECORATION_LINETHROUGH,
182} PopplerStructureTextDecoration;
183
184/**
185 * PopplerStructureRubyAlign:
186 */
187typedef enum
188{
189 POPPLER_STRUCTURE_RUBY_ALIGN_START,
190 POPPLER_STRUCTURE_RUBY_ALIGN_CENTER,
191 POPPLER_STRUCTURE_RUBY_ALIGN_END,
192 POPPLER_STRUCTURE_RUBY_ALIGN_JUSTIFY,
193 POPPLER_STRUCTURE_RUBY_ALIGN_DISTRIBUTE,
194} PopplerStructureRubyAlign;
195
196/**
197 * PopplerStructureRubyPosition:
198 */
199typedef enum
200{
201 POPPLER_STRUCTURE_RUBY_POSITION_BEFORE,
202 POPPLER_STRUCTURE_RUBY_POSITION_AFTER,
203 POPPLER_STRUCTURE_RUBY_POSITION_WARICHU,
204 POPPLER_STRUCTURE_RUBY_POSITION_INLINE,
205} PopplerStructureRubyPosition;
206
207/**
208 * PopplerStructureGlyphOrientation:
209 */
210typedef enum
211{
212 POPPLER_STRUCTURE_GLYPH_ORIENTATION_AUTO,
213 POPPLER_STRUCTURE_GLYPH_ORIENTATION_0 = POPPLER_STRUCTURE_GLYPH_ORIENTATION_AUTO,
214 POPPLER_STRUCTURE_GLYPH_ORIENTATION_90,
215 POPPLER_STRUCTURE_GLYPH_ORIENTATION_180,
216 POPPLER_STRUCTURE_GLYPH_ORIENTATION_270,
217} PopplerStructureGlyphOrientation;
218
219/**
220 * PopplerStructureListNumbering:
221 */
222typedef enum
223{
224 POPPLER_STRUCTURE_LIST_NUMBERING_NONE,
225 POPPLER_STRUCTURE_LIST_NUMBERING_DISC,
226 POPPLER_STRUCTURE_LIST_NUMBERING_CIRCLE,
227 POPPLER_STRUCTURE_LIST_NUMBERING_SQUARE,
228 POPPLER_STRUCTURE_LIST_NUMBERING_DECIMAL,
229 POPPLER_STRUCTURE_LIST_NUMBERING_UPPER_ROMAN,
230 POPPLER_STRUCTURE_LIST_NUMBERING_LOWER_ROMAN,
231 POPPLER_STRUCTURE_LIST_NUMBERING_UPPER_ALPHA,
232 POPPLER_STRUCTURE_LIST_NUMBERING_LOWER_ALPHA,
233} PopplerStructureListNumbering;
234
235/**
236 * PopplerStructureFormRole:
237 */
238typedef enum
239{
240 POPPLER_STRUCTURE_FORM_ROLE_UNDEFINED,
241 POPPLER_STRUCTURE_FORM_ROLE_RADIO_BUTTON,
242 POPPLER_STRUCTURE_FORM_ROLE_PUSH_BUTTON,
243 POPPLER_STRUCTURE_FORM_ROLE_TEXT_VALUE,
244 POPPLER_STRUCTURE_FORM_ROLE_CHECKBOX,
245} PopplerStructureFormRole;
246
247/**
248 * PopplerStructureFormState:
249 */
250typedef enum
251{
252 POPPLER_STRUCTURE_FORM_STATE_ON,
253 POPPLER_STRUCTURE_FORM_STATE_OFF,
254 POPPLER_STRUCTURE_FORM_STATE_NEUTRAL,
255} PopplerStructureFormState;
256
257/**
258 * PopplerStructureTableScope:
259 */
260typedef enum
261{
262 POPPLER_STRUCTURE_TABLE_SCOPE_ROW,
263 POPPLER_STRUCTURE_TABLE_SCOPE_COLUMN,
264 POPPLER_STRUCTURE_TABLE_SCOPE_BOTH,
265} PopplerStructureTableScope;
266
267POPPLER_PUBLIC
268GType poppler_structure_element_get_type(void) G_GNUC_CONST;
269POPPLER_PUBLIC
270PopplerStructureElementKind poppler_structure_element_get_kind(PopplerStructureElement *poppler_structure_element);
271POPPLER_PUBLIC
272gint poppler_structure_element_get_page(PopplerStructureElement *poppler_structure_element);
273POPPLER_PUBLIC
274gboolean poppler_structure_element_is_content(PopplerStructureElement *poppler_structure_element);
275POPPLER_PUBLIC
276gboolean poppler_structure_element_is_inline(PopplerStructureElement *poppler_structure_element);
277POPPLER_PUBLIC
278gboolean poppler_structure_element_is_block(PopplerStructureElement *poppler_structure_element);
279POPPLER_PUBLIC
280gboolean poppler_structure_element_is_grouping(PopplerStructureElement *poppler_structure_element);
281POPPLER_PUBLIC
282gchar *poppler_structure_element_get_id(PopplerStructureElement *poppler_structure_element);
283POPPLER_PUBLIC
284gchar *poppler_structure_element_get_title(PopplerStructureElement *poppler_structure_element);
285POPPLER_PUBLIC
286gchar *poppler_structure_element_get_abbreviation(PopplerStructureElement *poppler_structure_element);
287POPPLER_PUBLIC
288gchar *poppler_structure_element_get_language(PopplerStructureElement *poppler_structure_element);
289POPPLER_PUBLIC
290gchar *poppler_structure_element_get_text(PopplerStructureElement *poppler_structure_element, PopplerStructureGetTextFlags flags);
291POPPLER_PUBLIC
292gchar *poppler_structure_element_get_alt_text(PopplerStructureElement *poppler_structure_element);
293POPPLER_PUBLIC
294gchar *poppler_structure_element_get_actual_text(PopplerStructureElement *poppler_structure_element);
295POPPLER_PUBLIC
296PopplerTextSpan **poppler_structure_element_get_text_spans(PopplerStructureElement *poppler_structure_element, guint *n_text_spans);
297
298POPPLER_PUBLIC
299PopplerStructurePlacement poppler_structure_element_get_placement(PopplerStructureElement *poppler_structure_element);
300POPPLER_PUBLIC
301PopplerStructureWritingMode poppler_structure_element_get_writing_mode(PopplerStructureElement *poppler_structure_element);
302POPPLER_PUBLIC
303gboolean poppler_structure_element_get_background_color(PopplerStructureElement *poppler_structure_element, PopplerColor *color);
304POPPLER_PUBLIC
305gboolean poppler_structure_element_get_border_color(PopplerStructureElement *poppler_structure_element, PopplerColor *colors);
306POPPLER_PUBLIC
307void poppler_structure_element_get_border_style(PopplerStructureElement *poppler_structure_element, PopplerStructureBorderStyle *border_styles);
308POPPLER_PUBLIC
309gboolean poppler_structure_element_get_border_thickness(PopplerStructureElement *poppler_structure_element, gdouble *border_thicknesses);
310POPPLER_PUBLIC
311void poppler_structure_element_get_padding(PopplerStructureElement *poppler_structure_element, gdouble *paddings);
312POPPLER_PUBLIC
313gboolean poppler_structure_element_get_color(PopplerStructureElement *poppler_structure_element, PopplerColor *color);
314
315POPPLER_PUBLIC
316gdouble poppler_structure_element_get_space_before(PopplerStructureElement *poppler_structure_element);
317POPPLER_PUBLIC
318gdouble poppler_structure_element_get_space_after(PopplerStructureElement *poppler_structure_element);
319POPPLER_PUBLIC
320gdouble poppler_structure_element_get_start_indent(PopplerStructureElement *poppler_structure_element);
321POPPLER_PUBLIC
322gdouble poppler_structure_element_get_end_indent(PopplerStructureElement *poppler_structure_element);
323POPPLER_PUBLIC
324gdouble poppler_structure_element_get_text_indent(PopplerStructureElement *poppler_structure_element);
325POPPLER_PUBLIC
326PopplerStructureTextAlign poppler_structure_element_get_text_align(PopplerStructureElement *poppler_structure_element);
327POPPLER_PUBLIC
328gboolean poppler_structure_element_get_bounding_box(PopplerStructureElement *poppler_structure_element, PopplerRectangle *bounding_box);
329POPPLER_PUBLIC
330gdouble poppler_structure_element_get_width(PopplerStructureElement *poppler_structure_element);
331POPPLER_PUBLIC
332gdouble poppler_structure_element_get_height(PopplerStructureElement *poppler_structure_element);
333POPPLER_PUBLIC
334PopplerStructureBlockAlign poppler_structure_element_get_block_align(PopplerStructureElement *poppler_structure_element);
335POPPLER_PUBLIC
336PopplerStructureInlineAlign poppler_structure_element_get_inline_align(PopplerStructureElement *poppler_structure_element);
337POPPLER_PUBLIC
338void poppler_structure_element_get_table_border_style(PopplerStructureElement *poppler_structure_element, PopplerStructureBorderStyle *border_styles);
339POPPLER_PUBLIC
340void poppler_structure_element_get_table_padding(PopplerStructureElement *poppler_structure_element, gdouble *paddings);
341
342POPPLER_PUBLIC
343gdouble poppler_structure_element_get_baseline_shift(PopplerStructureElement *poppler_structure_element);
344POPPLER_PUBLIC
345gdouble poppler_structure_element_get_line_height(PopplerStructureElement *poppler_structure_element);
346POPPLER_PUBLIC
347gboolean poppler_structure_element_get_text_decoration_color(PopplerStructureElement *poppler_structure_element, PopplerColor *color);
348POPPLER_PUBLIC
349gdouble poppler_structure_element_get_text_decoration_thickness(PopplerStructureElement *poppler_structure_element);
350POPPLER_PUBLIC
351PopplerStructureTextDecoration poppler_structure_element_get_text_decoration_type(PopplerStructureElement *poppler_structure_element);
352POPPLER_PUBLIC
353PopplerStructureRubyAlign poppler_structure_element_get_ruby_align(PopplerStructureElement *poppler_structure_element);
354POPPLER_PUBLIC
355PopplerStructureRubyPosition poppler_structure_element_get_ruby_position(PopplerStructureElement *poppler_structure_element);
356POPPLER_PUBLIC
357PopplerStructureGlyphOrientation poppler_structure_element_get_glyph_orientation(PopplerStructureElement *poppler_structure_element);
358
359POPPLER_PUBLIC
360guint poppler_structure_element_get_column_count(PopplerStructureElement *poppler_structure_element);
361POPPLER_PUBLIC
362gdouble *poppler_structure_element_get_column_gaps(PopplerStructureElement *poppler_structure_element, guint *n_values);
363POPPLER_PUBLIC
364gdouble *poppler_structure_element_get_column_widths(PopplerStructureElement *poppler_structure_element, guint *n_values);
365
366POPPLER_PUBLIC
367PopplerStructureListNumbering poppler_structure_element_get_list_numbering(PopplerStructureElement *poppler_structure_element);
368
369POPPLER_PUBLIC
370PopplerStructureFormRole poppler_structure_element_get_form_role(PopplerStructureElement *poppler_structure_element);
371POPPLER_PUBLIC
372PopplerStructureFormState poppler_structure_element_get_form_state(PopplerStructureElement *poppler_structure_element);
373POPPLER_PUBLIC
374gchar *poppler_structure_element_get_form_description(PopplerStructureElement *poppler_structure_element);
375
376POPPLER_PUBLIC
377guint poppler_structure_element_get_table_row_span(PopplerStructureElement *poppler_structure_element);
378POPPLER_PUBLIC
379guint poppler_structure_element_get_table_column_span(PopplerStructureElement *poppler_structure_element);
380POPPLER_PUBLIC
381gchar **poppler_structure_element_get_table_headers(PopplerStructureElement *poppler_structure_element);
382POPPLER_PUBLIC
383PopplerStructureTableScope poppler_structure_element_get_table_scope(PopplerStructureElement *poppler_structure_element);
384POPPLER_PUBLIC
385gchar *poppler_structure_element_get_table_summary(PopplerStructureElement *poppler_structure_element);
386
387#define POPPLER_TYPE_STRUCTURE_ELEMENT_ITER (poppler_structure_element_iter_get_type())
388POPPLER_PUBLIC
389GType poppler_structure_element_iter_get_type(void) G_GNUC_CONST;
390POPPLER_PUBLIC
391PopplerStructureElementIter *poppler_structure_element_iter_new(PopplerDocument *poppler_document);
392POPPLER_PUBLIC
393PopplerStructureElementIter *poppler_structure_element_iter_get_child(PopplerStructureElementIter *parent);
394POPPLER_PUBLIC
395PopplerStructureElementIter *poppler_structure_element_iter_copy(PopplerStructureElementIter *iter);
396POPPLER_PUBLIC
397PopplerStructureElement *poppler_structure_element_iter_get_element(PopplerStructureElementIter *iter);
398POPPLER_PUBLIC
399gboolean poppler_structure_element_iter_next(PopplerStructureElementIter *iter);
400POPPLER_PUBLIC
401void poppler_structure_element_iter_free(PopplerStructureElementIter *iter);
402
403#define POPPLER_TYPE_TEXT_SPAN (poppler_text_span_get_type())
404POPPLER_PUBLIC
405GType poppler_text_span_get_type(void) G_GNUC_CONST;
406POPPLER_PUBLIC
407PopplerTextSpan *poppler_text_span_copy(PopplerTextSpan *poppler_text_span);
408POPPLER_PUBLIC
409void poppler_text_span_free(PopplerTextSpan *poppler_text_span);
410POPPLER_PUBLIC
411gboolean poppler_text_span_is_fixed_width_font(PopplerTextSpan *poppler_text_span);
412POPPLER_PUBLIC
413gboolean poppler_text_span_is_serif_font(PopplerTextSpan *poppler_text_span);
414POPPLER_PUBLIC
415gboolean poppler_text_span_is_bold_font(PopplerTextSpan *poppler_text_span);
416POPPLER_PUBLIC
417void poppler_text_span_get_color(PopplerTextSpan *poppler_text_span, PopplerColor *color);
418POPPLER_PUBLIC
419const gchar *poppler_text_span_get_text(PopplerTextSpan *poppler_text_span);
420POPPLER_PUBLIC
421const gchar *poppler_text_span_get_font_name(PopplerTextSpan *poppler_text_span);
422
423G_END_DECLS
424
425#endif /* !__POPPLER_STRUCTURE_ELEMENT_H__ */
426

source code of poppler/glib/poppler-structure-element.h