1/* poppler-annot.h: glib interface to poppler
2 *
3 * Copyright (C) 2007 Inigo Martinez <inigomartinez@gmail.com>
4 * Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20
21#ifndef __POPPLER_ANNOT_H__
22#define __POPPLER_ANNOT_H__
23
24#include <glib-object.h>
25#include "poppler.h"
26
27G_BEGIN_DECLS
28
29#define POPPLER_TYPE_ANNOT (poppler_annot_get_type())
30#define POPPLER_ANNOT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), POPPLER_TYPE_ANNOT, PopplerAnnot))
31#define POPPLER_IS_ANNOT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), POPPLER_TYPE_ANNOT))
32
33#define POPPLER_TYPE_ANNOT_MARKUP (poppler_annot_markup_get_type())
34#define POPPLER_ANNOT_MARKUP(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), POPPLER_TYPE_ANNOT_MARKUP, PopplerAnnotMarkup))
35#define POPPLER_IS_ANNOT_MARKUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), POPPLER_TYPE_ANNOT_MARKUP))
36
37#define POPPLER_TYPE_ANNOT_TEXT (poppler_annot_text_get_type())
38#define POPPLER_ANNOT_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), POPPLER_TYPE_ANNOT_TEXT, PopplerAnnotText))
39#define POPPLER_IS_ANNOT_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), POPPLER_TYPE_ANNOT_TEXT))
40
41#define POPPLER_TYPE_ANNOT_TEXT_MARKUP (poppler_annot_text_markup_get_type())
42#define POPPLER_ANNOT_TEXT_MARKUP(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), POPPLER_TYPE_ANNOT_TEXT_MARKUP, PopplerAnnotTextMarkup))
43#define POPPLER_IS_ANNOT_TEXT_MARKUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), POPPLER_TYPE_ANNOT_TEXT_MARKUP))
44
45#define POPPLER_TYPE_ANNOT_FREE_TEXT (poppler_annot_free_text_get_type())
46#define POPPLER_ANNOT_FREE_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), POPPLER_TYPE_ANNOT_FREE_TEXT, PopplerAnnotFreeText))
47#define POPPLER_IS_ANNOT_FREE_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), POPPLER_TYPE_ANNOT_FREE_TEXT))
48
49#define POPPLER_TYPE_ANNOT_FILE_ATTACHMENT (poppler_annot_file_attachment_get_type())
50#define POPPLER_ANNOT_FILE_ATTACHMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), POPPLER_TYPE_ANNOT_MARKUP, PopplerAnnotFileAttachment))
51#define POPPLER_IS_ANNOT_FILE_ATTACHMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), POPPLER_TYPE_ANNOT_FILE_ATTACHMENT))
52
53#define POPPLER_TYPE_ANNOT_MOVIE (poppler_annot_movie_get_type())
54#define POPPLER_ANNOT_MOVIE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), POPPLER_TYPE_ANNOT_MOVIE, PopplerAnnotMovie))
55#define POPPLER_IS_ANNOT_MOVIE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), POPPLER_TYPE_ANNOT_MOVIE))
56
57#define POPPLER_TYPE_ANNOT_SCREEN (poppler_annot_screen_get_type())
58#define POPPLER_ANNOT_SCREEN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), POPPLER_TYPE_ANNOT_SCREEN, PopplerAnnotScreen))
59#define POPPLER_IS_ANNOT_SCREEN(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), POPPLER_TYPE_ANNOT_SCREEN))
60
61#define POPPLER_TYPE_ANNOT_LINE (poppler_annot_line_get_type())
62#define POPPLER_ANNOT_LINE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), POPPLER_TYPE_ANNOT_LINE, PopplerAnnotLine))
63#define POPPLER_IS_ANNOT_LINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), POPPLER_TYPE_ANNOT_LINE))
64
65#define POPPLER_TYPE_ANNOT_CALLOUT_LINE (poppler_annot_callout_line_get_type())
66
67#define POPPLER_TYPE_ANNOT_CIRCLE (poppler_annot_circle_get_type())
68#define POPPLER_ANNOT_CIRCLE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), POPPLER_TYPE_ANNOT_CIRCLE, PopplerAnnotCircle))
69#define POPPLER_IS_ANNOT_CIRCLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), POPPLER_TYPE_ANNOT_CIRCLE))
70
71#define POPPLER_TYPE_ANNOT_SQUARE (poppler_annot_square_get_type())
72#define POPPLER_ANNOT_SQUARE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), POPPLER_TYPE_ANNOT_SQUARE, PopplerAnnotSquare))
73#define POPPLER_IS_ANNOT_SQUARE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), POPPLER_TYPE_ANNOT_SQUARE))
74
75#define POPPLER_TYPE_ANNOT_STAMP (poppler_annot_stamp_get_type())
76#define POPPLER_ANNOT_STAMP(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), POPPLER_TYPE_ANNOT_STAMP, PopplerAnnotStamp))
77#define POPPLER_IS_ANNOT_STAMP(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), POPPLER_TYPE_ANNOT_STAMP))
78
79typedef enum
80{
81 POPPLER_ANNOT_UNKNOWN,
82 POPPLER_ANNOT_TEXT,
83 POPPLER_ANNOT_LINK,
84 POPPLER_ANNOT_FREE_TEXT,
85 POPPLER_ANNOT_LINE,
86 POPPLER_ANNOT_SQUARE,
87 POPPLER_ANNOT_CIRCLE,
88 POPPLER_ANNOT_POLYGON,
89 POPPLER_ANNOT_POLY_LINE,
90 POPPLER_ANNOT_HIGHLIGHT,
91 POPPLER_ANNOT_UNDERLINE,
92 POPPLER_ANNOT_SQUIGGLY,
93 POPPLER_ANNOT_STRIKE_OUT,
94 POPPLER_ANNOT_STAMP,
95 POPPLER_ANNOT_CARET,
96 POPPLER_ANNOT_INK,
97 POPPLER_ANNOT_POPUP,
98 POPPLER_ANNOT_FILE_ATTACHMENT,
99 POPPLER_ANNOT_SOUND,
100 POPPLER_ANNOT_MOVIE,
101 POPPLER_ANNOT_WIDGET,
102 POPPLER_ANNOT_SCREEN,
103 POPPLER_ANNOT_PRINTER_MARK,
104 POPPLER_ANNOT_TRAP_NET,
105 POPPLER_ANNOT_WATERMARK,
106 POPPLER_ANNOT_3D
107} PopplerAnnotType;
108
109typedef enum /*< flags >*/
110{
111 POPPLER_ANNOT_FLAG_UNKNOWN = 0,
112 POPPLER_ANNOT_FLAG_INVISIBLE = 1 << 0,
113 POPPLER_ANNOT_FLAG_HIDDEN = 1 << 1,
114 POPPLER_ANNOT_FLAG_PRINT = 1 << 2,
115 POPPLER_ANNOT_FLAG_NO_ZOOM = 1 << 3,
116 POPPLER_ANNOT_FLAG_NO_ROTATE = 1 << 4,
117 POPPLER_ANNOT_FLAG_NO_VIEW = 1 << 5,
118 POPPLER_ANNOT_FLAG_READ_ONLY = 1 << 6,
119 POPPLER_ANNOT_FLAG_LOCKED = 1 << 7,
120 POPPLER_ANNOT_FLAG_TOGGLE_NO_VIEW = 1 << 8,
121 POPPLER_ANNOT_FLAG_LOCKED_CONTENTS = 1 << 9
122} PopplerAnnotFlag;
123
124typedef enum
125{
126 POPPLER_ANNOT_MARKUP_REPLY_TYPE_R,
127 POPPLER_ANNOT_MARKUP_REPLY_TYPE_GROUP
128} PopplerAnnotMarkupReplyType;
129
130typedef enum
131{
132 POPPLER_ANNOT_EXTERNAL_DATA_MARKUP_3D,
133 POPPLER_ANNOT_EXTERNAL_DATA_MARKUP_UNKNOWN
134} PopplerAnnotExternalDataType;
135
136#define POPPLER_ANNOT_TEXT_ICON_NOTE "Note"
137#define POPPLER_ANNOT_TEXT_ICON_COMMENT "Comment"
138#define POPPLER_ANNOT_TEXT_ICON_KEY "Key"
139#define POPPLER_ANNOT_TEXT_ICON_HELP "Help"
140#define POPPLER_ANNOT_TEXT_ICON_NEW_PARAGRAPH "NewParagraph"
141#define POPPLER_ANNOT_TEXT_ICON_PARAGRAPH "Paragraph"
142#define POPPLER_ANNOT_TEXT_ICON_INSERT "Insert"
143#define POPPLER_ANNOT_TEXT_ICON_CROSS "Cross"
144#define POPPLER_ANNOT_TEXT_ICON_CIRCLE "Circle"
145
146typedef enum
147{
148 POPPLER_ANNOT_TEXT_STATE_MARKED,
149 POPPLER_ANNOT_TEXT_STATE_UNMARKED,
150 POPPLER_ANNOT_TEXT_STATE_ACCEPTED,
151 POPPLER_ANNOT_TEXT_STATE_REJECTED,
152 POPPLER_ANNOT_TEXT_STATE_CANCELLED,
153 POPPLER_ANNOT_TEXT_STATE_COMPLETED,
154 POPPLER_ANNOT_TEXT_STATE_NONE,
155 POPPLER_ANNOT_TEXT_STATE_UNKNOWN
156} PopplerAnnotTextState;
157
158typedef enum
159{
160 POPPLER_ANNOT_FREE_TEXT_QUADDING_LEFT_JUSTIFIED,
161 POPPLER_ANNOT_FREE_TEXT_QUADDING_CENTERED,
162 POPPLER_ANNOT_FREE_TEXT_QUADDING_RIGHT_JUSTIFIED
163} PopplerAnnotFreeTextQuadding;
164
165struct _PopplerAnnotCalloutLine
166{
167 gboolean multiline;
168 gdouble x1;
169 gdouble y1;
170 gdouble x2;
171 gdouble y2;
172 gdouble x3;
173 gdouble y3;
174};
175
176typedef enum
177{
178 POPPLER_ANNOT_STAMP_ICON_UNKNOWN = 0,
179 POPPLER_ANNOT_STAMP_ICON_APPROVED,
180 POPPLER_ANNOT_STAMP_ICON_AS_IS,
181 POPPLER_ANNOT_STAMP_ICON_CONFIDENTIAL,
182 POPPLER_ANNOT_STAMP_ICON_FINAL,
183 POPPLER_ANNOT_STAMP_ICON_EXPERIMENTAL,
184 POPPLER_ANNOT_STAMP_ICON_EXPIRED,
185 POPPLER_ANNOT_STAMP_ICON_NOT_APPROVED,
186 POPPLER_ANNOT_STAMP_ICON_NOT_FOR_PUBLIC_RELEASE,
187 POPPLER_ANNOT_STAMP_ICON_SOLD,
188 POPPLER_ANNOT_STAMP_ICON_DEPARTMENTAL,
189 POPPLER_ANNOT_STAMP_ICON_FOR_COMMENT,
190 POPPLER_ANNOT_STAMP_ICON_FOR_PUBLIC_RELEASE,
191 POPPLER_ANNOT_STAMP_ICON_TOP_SECRET,
192 POPPLER_ANNOT_STAMP_ICON_NONE
193} PopplerAnnotStampIcon;
194
195POPPLER_PUBLIC
196GType poppler_annot_get_type(void) G_GNUC_CONST;
197POPPLER_PUBLIC
198PopplerAnnotType poppler_annot_get_annot_type(PopplerAnnot *poppler_annot);
199POPPLER_PUBLIC
200gchar *poppler_annot_get_contents(PopplerAnnot *poppler_annot);
201POPPLER_PUBLIC
202void poppler_annot_set_contents(PopplerAnnot *poppler_annot, const gchar *contents);
203POPPLER_PUBLIC
204gchar *poppler_annot_get_name(PopplerAnnot *poppler_annot);
205POPPLER_PUBLIC
206gchar *poppler_annot_get_modified(PopplerAnnot *poppler_annot);
207POPPLER_PUBLIC
208PopplerAnnotFlag poppler_annot_get_flags(PopplerAnnot *poppler_annot);
209POPPLER_PUBLIC
210void poppler_annot_set_flags(PopplerAnnot *poppler_annot, PopplerAnnotFlag flags);
211POPPLER_PUBLIC
212PopplerColor *poppler_annot_get_color(PopplerAnnot *poppler_annot);
213POPPLER_PUBLIC
214void poppler_annot_set_color(PopplerAnnot *poppler_annot, PopplerColor *poppler_color);
215POPPLER_PUBLIC
216gint poppler_annot_get_page_index(PopplerAnnot *poppler_annot);
217POPPLER_PUBLIC
218void poppler_annot_get_rectangle(PopplerAnnot *poppler_annot, PopplerRectangle *poppler_rect);
219POPPLER_PUBLIC
220void poppler_annot_set_rectangle(PopplerAnnot *poppler_annot, PopplerRectangle *poppler_rect);
221
222/* PopplerAnnotMarkup */
223POPPLER_PUBLIC
224GType poppler_annot_markup_get_type(void) G_GNUC_CONST;
225POPPLER_PUBLIC
226gchar *poppler_annot_markup_get_label(PopplerAnnotMarkup *poppler_annot);
227POPPLER_PUBLIC
228void poppler_annot_markup_set_label(PopplerAnnotMarkup *poppler_annot, const gchar *label);
229POPPLER_PUBLIC
230gboolean poppler_annot_markup_has_popup(PopplerAnnotMarkup *poppler_annot);
231POPPLER_PUBLIC
232void poppler_annot_markup_set_popup(PopplerAnnotMarkup *poppler_annot, PopplerRectangle *popup_rect);
233POPPLER_PUBLIC
234gboolean poppler_annot_markup_get_popup_is_open(PopplerAnnotMarkup *poppler_annot);
235POPPLER_PUBLIC
236void poppler_annot_markup_set_popup_is_open(PopplerAnnotMarkup *poppler_annot, gboolean is_open);
237POPPLER_PUBLIC
238gboolean poppler_annot_markup_get_popup_rectangle(PopplerAnnotMarkup *poppler_annot, PopplerRectangle *poppler_rect);
239POPPLER_PUBLIC
240void poppler_annot_markup_set_popup_rectangle(PopplerAnnotMarkup *poppler_annot, PopplerRectangle *poppler_rect);
241POPPLER_PUBLIC
242gdouble poppler_annot_markup_get_opacity(PopplerAnnotMarkup *poppler_annot);
243POPPLER_PUBLIC
244void poppler_annot_markup_set_opacity(PopplerAnnotMarkup *poppler_annot, gdouble opacity);
245POPPLER_PUBLIC
246GDate *poppler_annot_markup_get_date(PopplerAnnotMarkup *poppler_annot);
247POPPLER_PUBLIC
248gchar *poppler_annot_markup_get_subject(PopplerAnnotMarkup *poppler_annot);
249POPPLER_PUBLIC
250PopplerAnnotMarkupReplyType poppler_annot_markup_get_reply_to(PopplerAnnotMarkup *poppler_annot);
251POPPLER_PUBLIC
252PopplerAnnotExternalDataType poppler_annot_markup_get_external_data(PopplerAnnotMarkup *poppler_annot);
253
254/* PopplerAnnotText */
255POPPLER_PUBLIC
256GType poppler_annot_text_get_type(void) G_GNUC_CONST;
257POPPLER_PUBLIC
258PopplerAnnot *poppler_annot_text_new(PopplerDocument *doc, PopplerRectangle *rect);
259POPPLER_PUBLIC
260gboolean poppler_annot_text_get_is_open(PopplerAnnotText *poppler_annot);
261POPPLER_PUBLIC
262void poppler_annot_text_set_is_open(PopplerAnnotText *poppler_annot, gboolean is_open);
263POPPLER_PUBLIC
264gchar *poppler_annot_text_get_icon(PopplerAnnotText *poppler_annot);
265POPPLER_PUBLIC
266void poppler_annot_text_set_icon(PopplerAnnotText *poppler_annot, const gchar *icon);
267POPPLER_PUBLIC
268PopplerAnnotTextState poppler_annot_text_get_state(PopplerAnnotText *poppler_annot);
269
270/* PopplerAnnotTextMarkup */
271POPPLER_PUBLIC
272GType poppler_annot_text_markup_get_type(void) G_GNUC_CONST;
273POPPLER_PUBLIC
274PopplerAnnot *poppler_annot_text_markup_new_highlight(PopplerDocument *doc, PopplerRectangle *rect, GArray *quadrilaterals);
275POPPLER_PUBLIC
276PopplerAnnot *poppler_annot_text_markup_new_squiggly(PopplerDocument *doc, PopplerRectangle *rect, GArray *quadrilaterals);
277POPPLER_PUBLIC
278PopplerAnnot *poppler_annot_text_markup_new_strikeout(PopplerDocument *doc, PopplerRectangle *rect, GArray *quadrilaterals);
279POPPLER_PUBLIC
280PopplerAnnot *poppler_annot_text_markup_new_underline(PopplerDocument *doc, PopplerRectangle *rect, GArray *quadrilaterals);
281POPPLER_PUBLIC
282void poppler_annot_text_markup_set_quadrilaterals(PopplerAnnotTextMarkup *poppler_annot, GArray *quadrilaterals);
283POPPLER_PUBLIC
284GArray *poppler_annot_text_markup_get_quadrilaterals(PopplerAnnotTextMarkup *poppler_annot);
285
286/* PopplerAnnotFreeText */
287POPPLER_PUBLIC
288GType poppler_annot_free_text_get_type(void) G_GNUC_CONST;
289POPPLER_PUBLIC
290PopplerAnnotFreeTextQuadding poppler_annot_free_text_get_quadding(PopplerAnnotFreeText *poppler_annot);
291POPPLER_PUBLIC
292PopplerAnnotCalloutLine *poppler_annot_free_text_get_callout_line(PopplerAnnotFreeText *poppler_annot);
293
294/* PopplerAnnotFileAttachment */
295POPPLER_PUBLIC
296GType poppler_annot_file_attachment_get_type(void) G_GNUC_CONST;
297POPPLER_PUBLIC
298PopplerAttachment *poppler_annot_file_attachment_get_attachment(PopplerAnnotFileAttachment *poppler_annot);
299POPPLER_PUBLIC
300gchar *poppler_annot_file_attachment_get_name(PopplerAnnotFileAttachment *poppler_annot);
301
302/* PopplerAnnotMovie */
303POPPLER_PUBLIC
304GType poppler_annot_movie_get_type(void) G_GNUC_CONST;
305POPPLER_PUBLIC
306gchar *poppler_annot_movie_get_title(PopplerAnnotMovie *poppler_annot);
307POPPLER_PUBLIC
308PopplerMovie *poppler_annot_movie_get_movie(PopplerAnnotMovie *poppler_annot);
309
310/* PopplerAnnotScreen */
311POPPLER_PUBLIC
312GType poppler_annot_screen_get_type(void) G_GNUC_CONST;
313POPPLER_PUBLIC
314PopplerAction *poppler_annot_screen_get_action(PopplerAnnotScreen *poppler_annot);
315
316/* PopplerAnnotLine */
317POPPLER_PUBLIC
318GType poppler_annot_line_get_type(void) G_GNUC_CONST;
319POPPLER_PUBLIC
320PopplerAnnot *poppler_annot_line_new(PopplerDocument *doc, PopplerRectangle *rect, PopplerPoint *start, PopplerPoint *end);
321POPPLER_PUBLIC
322void poppler_annot_line_set_vertices(PopplerAnnotLine *poppler_annot, PopplerPoint *start, PopplerPoint *end);
323
324/* PopplerAnnotCalloutLine */
325POPPLER_PUBLIC
326GType poppler_annot_callout_line_get_type(void) G_GNUC_CONST;
327POPPLER_PUBLIC
328PopplerAnnotCalloutLine *poppler_annot_callout_line_new(void);
329POPPLER_PUBLIC
330PopplerAnnotCalloutLine *poppler_annot_callout_line_copy(PopplerAnnotCalloutLine *callout);
331POPPLER_PUBLIC
332void poppler_annot_callout_line_free(PopplerAnnotCalloutLine *callout);
333
334/* PopplerAnnotCircle */
335POPPLER_PUBLIC
336GType poppler_annot_circle_get_type(void) G_GNUC_CONST;
337POPPLER_PUBLIC
338PopplerAnnot *poppler_annot_circle_new(PopplerDocument *doc, PopplerRectangle *rect);
339POPPLER_PUBLIC
340void poppler_annot_circle_set_interior_color(PopplerAnnotCircle *poppler_annot, PopplerColor *poppler_color);
341POPPLER_PUBLIC
342PopplerColor *poppler_annot_circle_get_interior_color(PopplerAnnotCircle *poppler_annot);
343
344/* PopplerAnnotGeometry */
345POPPLER_PUBLIC
346GType poppler_annot_square_get_type(void) G_GNUC_CONST;
347POPPLER_PUBLIC
348PopplerAnnot *poppler_annot_square_new(PopplerDocument *doc, PopplerRectangle *rect);
349POPPLER_PUBLIC
350void poppler_annot_square_set_interior_color(PopplerAnnotSquare *poppler_annot, PopplerColor *poppler_color);
351POPPLER_PUBLIC
352PopplerColor *poppler_annot_square_get_interior_color(PopplerAnnotSquare *poppler_annot);
353
354/* PopplerAnnotStamp */
355POPPLER_PUBLIC
356GType poppler_annot_stamp_get_type(void) G_GNUC_CONST;
357POPPLER_PUBLIC
358PopplerAnnot *poppler_annot_stamp_new(PopplerDocument *doc, PopplerRectangle *rect);
359POPPLER_PUBLIC
360PopplerAnnotStampIcon poppler_annot_stamp_get_icon(PopplerAnnotStamp *poppler_annot);
361POPPLER_PUBLIC
362void poppler_annot_stamp_set_icon(PopplerAnnotStamp *poppler_annot, PopplerAnnotStampIcon icon);
363POPPLER_PUBLIC
364gboolean poppler_annot_stamp_set_custom_image(PopplerAnnotStamp *poppler_annot, cairo_surface_t *image, GError **error);
365
366G_END_DECLS
367
368#endif /* __POPPLER_ANNOT_H__ */
369

source code of poppler/glib/poppler-annot.h