1 #ifndef __POPPLER_PRIVATE_H__
2 #define __POPPLER_PRIVATE_H__
3 
4 #include <config.h>
5 
6 #ifndef __GI_SCANNER__
7 #    include <PDFDoc.h>
8 #    include <PSOutputDev.h>
9 #    include <Link.h>
10 #    include <Movie.h>
11 #    include <Rendition.h>
12 #    include <Form.h>
13 #    include <Gfx.h>
14 #    include <FontInfo.h>
15 #    include <TextOutputDev.h>
16 #    include <Catalog.h>
17 #    include <OptionalContent.h>
18 #    include <CairoOutputDev.h>
19 #    include <FileSpec.h>
20 #    include <StructElement.h>
21 #    include <SignatureInfo.h>
22 #endif
23 
24 #define SUPPORTED_ROTATION(r) (r == 90 || r == 180 || r == 270)
25 
26 struct _PopplerDocument
27 {
28     /*< private >*/
29     GObject parent_instance;
30     std::unique_ptr<GlobalParamsIniter> initer;
31     PDFDoc *doc;
32 
33     GList *layers;
34     GList *layers_rbgroups;
35     CairoOutputDev *output_dev;
36 };
37 
38 struct _PopplerPSFile
39 {
40     /*< private >*/
41     GObject parent_instance;
42 
43     PopplerDocument *document;
44     PSOutputDev *out;
45     int fd;
46     char *filename;
47     int first_page;
48     int last_page;
49     double paper_width;
50     double paper_height;
51     gboolean duplex;
52 };
53 
54 struct _PopplerFontInfo
55 {
56     /*< private >*/
57     GObject parent_instance;
58     PopplerDocument *document;
59     FontInfoScanner *scanner;
60 };
61 
62 struct _PopplerPage
63 {
64     /*< private >*/
65     GObject parent_instance;
66     PopplerDocument *document;
67     Page *page;
68     int index;
69     TextPage *text;
70 };
71 
72 struct _PopplerFormField
73 {
74     /*< private >*/
75     GObject parent_instance;
76     PopplerDocument *document;
77     FormWidget *widget;
78     PopplerAction *action;
79     PopplerAction *field_modified_action;
80     PopplerAction *format_field_action;
81     PopplerAction *validate_field_action;
82     PopplerAction *calculate_field_action;
83 };
84 
85 struct _PopplerAnnot
86 {
87     GObject parent_instance;
88     Annot *annot;
89 };
90 
91 typedef struct _Layer
92 {
93     /*< private >*/
94     GList *kids;
95     gchar *label;
96     OptionalContentGroup *oc;
97 } Layer;
98 
99 struct _PopplerLayer
100 {
101     /*< private >*/
102     GObject parent_instance;
103     PopplerDocument *document;
104     Layer *layer;
105     GList *rbgroup;
106     gchar *title;
107 };
108 
109 struct _PopplerStructureElement
110 {
111     /*< private >*/
112     GObject parent_instance;
113     PopplerDocument *document;
114     const StructElement *elem;
115 };
116 
117 /*
118  * PopplerRectangleExtended:
119  *
120  * The real type behind the public PopplerRectangle.
121  * Must be ABI compatible to it!
122  */
123 typedef struct
124 {
125     /*< private >*/
126     double x1;
127     double y1;
128     double x2;
129     double y2;
130     bool match_continued; /* Described in poppler_rectangle_find_get_match_continued() */
131     bool ignored_hyphen; /* Described in poppler_rectangle_find_get_ignored_hyphen() */
132 } PopplerRectangleExtended;
133 
134 PopplerRectangle *poppler_rectangle_new_from_pdf_rectangle(const PDFRectangle *rect);
135 
136 GList *_poppler_document_get_layers(PopplerDocument *document);
137 GList *_poppler_document_get_layer_rbgroup(PopplerDocument *document, Layer *layer);
138 PopplerPage *_poppler_page_new(PopplerDocument *document, Page *page, int index);
139 void _unrotate_rect_for_annot_and_page(Page *page, Annot *annot, double *x1, double *y1, double *x2, double *y2);
140 AnnotQuadrilaterals *_page_new_quads_unrotated(Page *page, AnnotQuadrilaterals *quads);
141 AnnotQuadrilaterals *new_quads_from_offset_cropbox(const PDFRectangle *crop_box, AnnotQuadrilaterals *quads, gboolean add);
142 PopplerAction *_poppler_action_new(PopplerDocument *document, const LinkAction *link, const gchar *title);
143 PopplerLayer *_poppler_layer_new(PopplerDocument *document, Layer *layer, GList *rbgroup);
144 PopplerDest *_poppler_dest_new_goto(PopplerDocument *document, LinkDest *link_dest);
145 PopplerFormField *_poppler_form_field_new(PopplerDocument *document, FormWidget *field);
146 PopplerAttachment *_poppler_attachment_new(FileSpec *file);
147 PopplerMovie *_poppler_movie_new(const Movie *movie);
148 PopplerMedia *_poppler_media_new(const MediaRendition *media);
149 PopplerAnnot *_poppler_annot_new(Annot *annot);
150 PopplerAnnot *_poppler_annot_text_new(Annot *annot);
151 PopplerAnnot *_poppler_annot_free_text_new(Annot *annot);
152 PopplerAnnot *_poppler_annot_text_markup_new(Annot *annot);
153 PopplerAnnot *_poppler_annot_file_attachment_new(Annot *annot);
154 PopplerAnnot *_poppler_annot_movie_new(Annot *annot);
155 PopplerAnnot *_poppler_annot_screen_new(PopplerDocument *doc, Annot *annot);
156 PopplerAnnot *_poppler_annot_line_new(Annot *annot);
157 PopplerAnnot *_poppler_annot_circle_new(Annot *annot);
158 PopplerAnnot *_poppler_annot_square_new(Annot *annot);
159 
160 const PDFRectangle *_poppler_annot_get_cropbox(PopplerAnnot *poppler_annot);
161 
162 char *_poppler_goo_string_to_utf8(const GooString *s);
163 gboolean _poppler_convert_pdf_date_to_gtime(const GooString *date, time_t *gdate);
164 GDateTime *_poppler_convert_pdf_date_to_date_time(const GooString *date);
165 GooString *_poppler_convert_date_time_to_pdf_date(GDateTime *datetime);
166 
167 void _poppler_error_cb(ErrorCategory category, Goffset pos, const char *message);
168 
169 #endif
170