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 27 G_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 typedef enum 76 { 77 POPPLER_ANNOT_UNKNOWN, 78 POPPLER_ANNOT_TEXT, 79 POPPLER_ANNOT_LINK, 80 POPPLER_ANNOT_FREE_TEXT, 81 POPPLER_ANNOT_LINE, 82 POPPLER_ANNOT_SQUARE, 83 POPPLER_ANNOT_CIRCLE, 84 POPPLER_ANNOT_POLYGON, 85 POPPLER_ANNOT_POLY_LINE, 86 POPPLER_ANNOT_HIGHLIGHT, 87 POPPLER_ANNOT_UNDERLINE, 88 POPPLER_ANNOT_SQUIGGLY, 89 POPPLER_ANNOT_STRIKE_OUT, 90 POPPLER_ANNOT_STAMP, 91 POPPLER_ANNOT_CARET, 92 POPPLER_ANNOT_INK, 93 POPPLER_ANNOT_POPUP, 94 POPPLER_ANNOT_FILE_ATTACHMENT, 95 POPPLER_ANNOT_SOUND, 96 POPPLER_ANNOT_MOVIE, 97 POPPLER_ANNOT_WIDGET, 98 POPPLER_ANNOT_SCREEN, 99 POPPLER_ANNOT_PRINTER_MARK, 100 POPPLER_ANNOT_TRAP_NET, 101 POPPLER_ANNOT_WATERMARK, 102 POPPLER_ANNOT_3D 103 } PopplerAnnotType; 104 105 typedef enum /*< flags >*/ 106 { 107 POPPLER_ANNOT_FLAG_UNKNOWN = 0, 108 POPPLER_ANNOT_FLAG_INVISIBLE = 1 << 0, 109 POPPLER_ANNOT_FLAG_HIDDEN = 1 << 1, 110 POPPLER_ANNOT_FLAG_PRINT = 1 << 2, 111 POPPLER_ANNOT_FLAG_NO_ZOOM = 1 << 3, 112 POPPLER_ANNOT_FLAG_NO_ROTATE = 1 << 4, 113 POPPLER_ANNOT_FLAG_NO_VIEW = 1 << 5, 114 POPPLER_ANNOT_FLAG_READ_ONLY = 1 << 6, 115 POPPLER_ANNOT_FLAG_LOCKED = 1 << 7, 116 POPPLER_ANNOT_FLAG_TOGGLE_NO_VIEW = 1 << 8, 117 POPPLER_ANNOT_FLAG_LOCKED_CONTENTS = 1 << 9 118 } PopplerAnnotFlag; 119 120 typedef enum 121 { 122 POPPLER_ANNOT_MARKUP_REPLY_TYPE_R, 123 POPPLER_ANNOT_MARKUP_REPLY_TYPE_GROUP 124 } PopplerAnnotMarkupReplyType; 125 126 typedef enum 127 { 128 POPPLER_ANNOT_EXTERNAL_DATA_MARKUP_3D, 129 POPPLER_ANNOT_EXTERNAL_DATA_MARKUP_UNKNOWN 130 } PopplerAnnotExternalDataType; 131 132 #define POPPLER_ANNOT_TEXT_ICON_NOTE "Note" 133 #define POPPLER_ANNOT_TEXT_ICON_COMMENT "Comment" 134 #define POPPLER_ANNOT_TEXT_ICON_KEY "Key" 135 #define POPPLER_ANNOT_TEXT_ICON_HELP "Help" 136 #define POPPLER_ANNOT_TEXT_ICON_NEW_PARAGRAPH "NewParagraph" 137 #define POPPLER_ANNOT_TEXT_ICON_PARAGRAPH "Paragraph" 138 #define POPPLER_ANNOT_TEXT_ICON_INSERT "Insert" 139 #define POPPLER_ANNOT_TEXT_ICON_CROSS "Cross" 140 #define POPPLER_ANNOT_TEXT_ICON_CIRCLE "Circle" 141 142 typedef enum 143 { 144 POPPLER_ANNOT_TEXT_STATE_MARKED, 145 POPPLER_ANNOT_TEXT_STATE_UNMARKED, 146 POPPLER_ANNOT_TEXT_STATE_ACCEPTED, 147 POPPLER_ANNOT_TEXT_STATE_REJECTED, 148 POPPLER_ANNOT_TEXT_STATE_CANCELLED, 149 POPPLER_ANNOT_TEXT_STATE_COMPLETED, 150 POPPLER_ANNOT_TEXT_STATE_NONE, 151 POPPLER_ANNOT_TEXT_STATE_UNKNOWN 152 } PopplerAnnotTextState; 153 154 typedef enum 155 { 156 POPPLER_ANNOT_FREE_TEXT_QUADDING_LEFT_JUSTIFIED, 157 POPPLER_ANNOT_FREE_TEXT_QUADDING_CENTERED, 158 POPPLER_ANNOT_FREE_TEXT_QUADDING_RIGHT_JUSTIFIED 159 } PopplerAnnotFreeTextQuadding; 160 161 struct _PopplerAnnotCalloutLine 162 { 163 gboolean multiline; 164 gdouble x1; 165 gdouble y1; 166 gdouble x2; 167 gdouble y2; 168 gdouble x3; 169 gdouble y3; 170 }; 171 172 POPPLER_PUBLIC 173 GType poppler_annot_get_type(void) G_GNUC_CONST; 174 POPPLER_PUBLIC 175 PopplerAnnotType poppler_annot_get_annot_type(PopplerAnnot *poppler_annot); 176 POPPLER_PUBLIC 177 gchar *poppler_annot_get_contents(PopplerAnnot *poppler_annot); 178 POPPLER_PUBLIC 179 void poppler_annot_set_contents(PopplerAnnot *poppler_annot, const gchar *contents); 180 POPPLER_PUBLIC 181 gchar *poppler_annot_get_name(PopplerAnnot *poppler_annot); 182 POPPLER_PUBLIC 183 gchar *poppler_annot_get_modified(PopplerAnnot *poppler_annot); 184 POPPLER_PUBLIC 185 PopplerAnnotFlag poppler_annot_get_flags(PopplerAnnot *poppler_annot); 186 POPPLER_PUBLIC 187 void poppler_annot_set_flags(PopplerAnnot *poppler_annot, PopplerAnnotFlag flags); 188 POPPLER_PUBLIC 189 PopplerColor *poppler_annot_get_color(PopplerAnnot *poppler_annot); 190 POPPLER_PUBLIC 191 void poppler_annot_set_color(PopplerAnnot *poppler_annot, PopplerColor *poppler_color); 192 POPPLER_PUBLIC 193 gint poppler_annot_get_page_index(PopplerAnnot *poppler_annot); 194 POPPLER_PUBLIC 195 void poppler_annot_get_rectangle(PopplerAnnot *poppler_annot, PopplerRectangle *poppler_rect); 196 POPPLER_PUBLIC 197 void poppler_annot_set_rectangle(PopplerAnnot *poppler_annot, PopplerRectangle *poppler_rect); 198 199 /* PopplerAnnotMarkup */ 200 POPPLER_PUBLIC 201 GType poppler_annot_markup_get_type(void) G_GNUC_CONST; 202 POPPLER_PUBLIC 203 gchar *poppler_annot_markup_get_label(PopplerAnnotMarkup *poppler_annot); 204 POPPLER_PUBLIC 205 void poppler_annot_markup_set_label(PopplerAnnotMarkup *poppler_annot, const gchar *label); 206 POPPLER_PUBLIC 207 gboolean poppler_annot_markup_has_popup(PopplerAnnotMarkup *poppler_annot); 208 POPPLER_PUBLIC 209 void poppler_annot_markup_set_popup(PopplerAnnotMarkup *poppler_annot, PopplerRectangle *popup_rect); 210 POPPLER_PUBLIC 211 gboolean poppler_annot_markup_get_popup_is_open(PopplerAnnotMarkup *poppler_annot); 212 POPPLER_PUBLIC 213 void poppler_annot_markup_set_popup_is_open(PopplerAnnotMarkup *poppler_annot, gboolean is_open); 214 POPPLER_PUBLIC 215 gboolean poppler_annot_markup_get_popup_rectangle(PopplerAnnotMarkup *poppler_annot, PopplerRectangle *poppler_rect); 216 POPPLER_PUBLIC 217 void poppler_annot_markup_set_popup_rectangle(PopplerAnnotMarkup *poppler_annot, PopplerRectangle *poppler_rect); 218 POPPLER_PUBLIC 219 gdouble poppler_annot_markup_get_opacity(PopplerAnnotMarkup *poppler_annot); 220 POPPLER_PUBLIC 221 void poppler_annot_markup_set_opacity(PopplerAnnotMarkup *poppler_annot, gdouble opacity); 222 POPPLER_PUBLIC 223 GDate *poppler_annot_markup_get_date(PopplerAnnotMarkup *poppler_annot); 224 POPPLER_PUBLIC 225 gchar *poppler_annot_markup_get_subject(PopplerAnnotMarkup *poppler_annot); 226 POPPLER_PUBLIC 227 PopplerAnnotMarkupReplyType poppler_annot_markup_get_reply_to(PopplerAnnotMarkup *poppler_annot); 228 POPPLER_PUBLIC 229 PopplerAnnotExternalDataType poppler_annot_markup_get_external_data(PopplerAnnotMarkup *poppler_annot); 230 231 /* PopplerAnnotText */ 232 POPPLER_PUBLIC 233 GType poppler_annot_text_get_type(void) G_GNUC_CONST; 234 POPPLER_PUBLIC 235 PopplerAnnot *poppler_annot_text_new(PopplerDocument *doc, PopplerRectangle *rect); 236 POPPLER_PUBLIC 237 gboolean poppler_annot_text_get_is_open(PopplerAnnotText *poppler_annot); 238 POPPLER_PUBLIC 239 void poppler_annot_text_set_is_open(PopplerAnnotText *poppler_annot, gboolean is_open); 240 POPPLER_PUBLIC 241 gchar *poppler_annot_text_get_icon(PopplerAnnotText *poppler_annot); 242 POPPLER_PUBLIC 243 void poppler_annot_text_set_icon(PopplerAnnotText *poppler_annot, const gchar *icon); 244 POPPLER_PUBLIC 245 PopplerAnnotTextState poppler_annot_text_get_state(PopplerAnnotText *poppler_annot); 246 247 /* PopplerAnnotTextMarkup */ 248 POPPLER_PUBLIC 249 GType poppler_annot_text_markup_get_type(void) G_GNUC_CONST; 250 POPPLER_PUBLIC 251 PopplerAnnot *poppler_annot_text_markup_new_highlight(PopplerDocument *doc, PopplerRectangle *rect, GArray *quadrilaterals); 252 POPPLER_PUBLIC 253 PopplerAnnot *poppler_annot_text_markup_new_squiggly(PopplerDocument *doc, PopplerRectangle *rect, GArray *quadrilaterals); 254 POPPLER_PUBLIC 255 PopplerAnnot *poppler_annot_text_markup_new_strikeout(PopplerDocument *doc, PopplerRectangle *rect, GArray *quadrilaterals); 256 POPPLER_PUBLIC 257 PopplerAnnot *poppler_annot_text_markup_new_underline(PopplerDocument *doc, PopplerRectangle *rect, GArray *quadrilaterals); 258 POPPLER_PUBLIC 259 void poppler_annot_text_markup_set_quadrilaterals(PopplerAnnotTextMarkup *poppler_annot, GArray *quadrilaterals); 260 POPPLER_PUBLIC 261 GArray *poppler_annot_text_markup_get_quadrilaterals(PopplerAnnotTextMarkup *poppler_annot); 262 263 /* PopplerAnnotFreeText */ 264 POPPLER_PUBLIC 265 GType poppler_annot_free_text_get_type(void) G_GNUC_CONST; 266 POPPLER_PUBLIC 267 PopplerAnnotFreeTextQuadding poppler_annot_free_text_get_quadding(PopplerAnnotFreeText *poppler_annot); 268 POPPLER_PUBLIC 269 PopplerAnnotCalloutLine *poppler_annot_free_text_get_callout_line(PopplerAnnotFreeText *poppler_annot); 270 271 /* PopplerAnnotFileAttachment */ 272 POPPLER_PUBLIC 273 GType poppler_annot_file_attachment_get_type(void) G_GNUC_CONST; 274 POPPLER_PUBLIC 275 PopplerAttachment *poppler_annot_file_attachment_get_attachment(PopplerAnnotFileAttachment *poppler_annot); 276 POPPLER_PUBLIC 277 gchar *poppler_annot_file_attachment_get_name(PopplerAnnotFileAttachment *poppler_annot); 278 279 /* PopplerAnnotMovie */ 280 POPPLER_PUBLIC 281 GType poppler_annot_movie_get_type(void) G_GNUC_CONST; 282 POPPLER_PUBLIC 283 gchar *poppler_annot_movie_get_title(PopplerAnnotMovie *poppler_annot); 284 POPPLER_PUBLIC 285 PopplerMovie *poppler_annot_movie_get_movie(PopplerAnnotMovie *poppler_annot); 286 287 /* PopplerAnnotScreen */ 288 POPPLER_PUBLIC 289 GType poppler_annot_screen_get_type(void) G_GNUC_CONST; 290 POPPLER_PUBLIC 291 PopplerAction *poppler_annot_screen_get_action(PopplerAnnotScreen *poppler_annot); 292 293 /* PopplerAnnotLine */ 294 POPPLER_PUBLIC 295 GType poppler_annot_line_get_type(void) G_GNUC_CONST; 296 POPPLER_PUBLIC 297 PopplerAnnot *poppler_annot_line_new(PopplerDocument *doc, PopplerRectangle *rect, PopplerPoint *start, PopplerPoint *end); 298 POPPLER_PUBLIC 299 void poppler_annot_line_set_vertices(PopplerAnnotLine *poppler_annot, PopplerPoint *start, PopplerPoint *end); 300 301 /* PopplerAnnotCalloutLine */ 302 POPPLER_PUBLIC 303 GType poppler_annot_callout_line_get_type(void) G_GNUC_CONST; 304 POPPLER_PUBLIC 305 PopplerAnnotCalloutLine *poppler_annot_callout_line_new(void); 306 POPPLER_PUBLIC 307 PopplerAnnotCalloutLine *poppler_annot_callout_line_copy(PopplerAnnotCalloutLine *callout); 308 POPPLER_PUBLIC 309 void poppler_annot_callout_line_free(PopplerAnnotCalloutLine *callout); 310 311 /* PopplerAnnotCircle */ 312 POPPLER_PUBLIC 313 GType poppler_annot_circle_get_type(void) G_GNUC_CONST; 314 POPPLER_PUBLIC 315 PopplerAnnot *poppler_annot_circle_new(PopplerDocument *doc, PopplerRectangle *rect); 316 POPPLER_PUBLIC 317 void poppler_annot_circle_set_interior_color(PopplerAnnotCircle *poppler_annot, PopplerColor *poppler_color); 318 POPPLER_PUBLIC 319 PopplerColor *poppler_annot_circle_get_interior_color(PopplerAnnotCircle *poppler_annot); 320 321 /* PopplerAnnotGeometry */ 322 POPPLER_PUBLIC 323 GType poppler_annot_square_get_type(void) G_GNUC_CONST; 324 POPPLER_PUBLIC 325 PopplerAnnot *poppler_annot_square_new(PopplerDocument *doc, PopplerRectangle *rect); 326 POPPLER_PUBLIC 327 void poppler_annot_square_set_interior_color(PopplerAnnotSquare *poppler_annot, PopplerColor *poppler_color); 328 POPPLER_PUBLIC 329 PopplerColor *poppler_annot_square_get_interior_color(PopplerAnnotSquare *poppler_annot); 330 331 G_END_DECLS 332 333 #endif /* __POPPLER_ANNOT_H__ */ 334