summaryrefslogtreecommitdiff
path: root/glib/poppler-private.h
blob: daa633d19e767159c214ff6efc05fc1b9e6ef36f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
#ifndef __POPPLER_PRIVATE_H__
#define __POPPLER_PRIVATE_H__

#include <config.h>

#ifndef __GI_SCANNER__
#include <PDFDoc.h>
#include <PSOutputDev.h>
#include <Link.h>
#include <Movie.h>
#include <Rendition.h>
#include <Form.h>
#include <Gfx.h>
#include <FontInfo.h>
#include <TextOutputDev.h>
#include <Catalog.h>
#include <OptionalContent.h>
#include <CairoOutputDev.h>
#include <FileSpec.h>
#include <StructElement.h>
#endif

struct _PopplerDocument
{
  /*< private >*/
  GObject parent_instance;
  std::unique_ptr<GlobalParamsIniter> initer;
  PDFDoc *doc;

  GList *layers;
  GList *layers_rbgroups;
  CairoOutputDev *output_dev;
};

struct _PopplerPSFile
{
  /*< private >*/
  GObject parent_instance;

  PopplerDocument *document;
  PSOutputDev *out;
  char *filename;
  int first_page;
  int last_page;
  double paper_width;
  double paper_height;
  gboolean duplex;
};

struct _PopplerFontInfo
{
  /*< private >*/
  GObject parent_instance;
  PopplerDocument *document;
  FontInfoScanner *scanner;
};

struct _PopplerPage
{
  /*< private >*/
  GObject parent_instance;
  PopplerDocument *document;
  Page *page;
  int index;
  TextPage *text;
};

struct _PopplerFormField
{
  /*< private >*/
  GObject parent_instance;
  PopplerDocument *document;
  FormWidget *widget;
  PopplerAction *action;
  PopplerAction *field_modified_action;
  PopplerAction *format_field_action;
  PopplerAction *validate_field_action;
  PopplerAction *calculate_field_action;
};

struct _PopplerAnnot
{
  GObject  parent_instance;
  Annot   *annot;
};

typedef struct _Layer {
  /*< private >*/
  GList *kids;
  gchar *label;
  OptionalContentGroup *oc;
} Layer;

struct _PopplerLayer
{
  /*< private >*/
  GObject parent_instance;
  PopplerDocument *document;
  Layer *layer;
  GList *rbgroup;
  gchar *title;
};


struct _PopplerStructureElement
{
  /*< private >*/
  GObject parent_instance;
  PopplerDocument *document;
  const StructElement *elem;
};

GList         *_poppler_document_get_layers (PopplerDocument *document);
GList         *_poppler_document_get_layer_rbgroup (PopplerDocument *document,
						    Layer           *layer);
PopplerPage   *_poppler_page_new   (PopplerDocument *document,
				    Page            *page,
				    int              index);
PopplerAction *_poppler_action_new (PopplerDocument *document,
				    const LinkAction      *link,
				    const gchar     *title);
PopplerLayer  *_poppler_layer_new (PopplerDocument  *document,
				   Layer            *layer,
				   GList            *rbgroup);
PopplerDest   *_poppler_dest_new_goto (PopplerDocument *document,
				       LinkDest        *link_dest);
PopplerFormField *_poppler_form_field_new (PopplerDocument *document,
					   FormWidget      *field);
PopplerAttachment *_poppler_attachment_new (FileSpec *file);
PopplerMovie      *_poppler_movie_new (const Movie *movie);
PopplerMedia      *_poppler_media_new (const MediaRendition *media);
PopplerAnnot      *_poppler_annot_new           (Annot *annot);
PopplerAnnot      *_poppler_annot_text_new      (Annot *annot);
PopplerAnnot      *_poppler_annot_free_text_new (Annot *annot);
PopplerAnnot      *_poppler_annot_text_markup_new     (Annot *annot);
PopplerAnnot      *_poppler_annot_file_attachment_new (Annot *annot);
PopplerAnnot      *_poppler_annot_movie_new (Annot *annot);
PopplerAnnot      *_poppler_annot_screen_new (PopplerDocument *doc, Annot *annot);
PopplerAnnot      *_poppler_annot_line_new (Annot *annot);
PopplerAnnot      *_poppler_annot_circle_new (Annot *annot);
PopplerAnnot      *_poppler_annot_square_new (Annot *annot);

const PDFRectangle *_poppler_annot_get_cropbox (PopplerAnnot *poppler_annot);

char *_poppler_goo_string_to_utf8(const GooString *s);
gboolean _poppler_convert_pdf_date_to_gtime (const GooString *date,
					     time_t    *gdate);

/*
 * A convenience macro for boxed type implementations, which defines a
 * type_name_get_type() function registering the boxed type.
 */
#define POPPLER_DEFINE_BOXED_TYPE(TypeName, type_name, copy_func, free_func)          \
GType                                                                                 \
type_name##_get_type (void)                                                           \
{                                                                                     \
        static volatile gsize g_define_type_id__volatile = 0;                         \
	if (g_once_init_enter (&g_define_type_id__volatile)) {                        \
	        GType g_define_type_id =                                              \
		    g_boxed_type_register_static (g_intern_static_string (#TypeName), \
		                                  (GBoxedCopyFunc) copy_func,         \
						  (GBoxedFreeFunc) free_func);        \
		g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);    \
	}                                                                             \
	return g_define_type_id__volatile;                                            \
}

void _poppler_error_cb (ErrorCategory category, Goffset pos, const char *message);

#endif