-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathAcroForm.h
141 lines (111 loc) · 3.96 KB
/
AcroForm.h
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
//========================================================================
//
// AcroForm.h
//
// Copyright 2012 Glyph & Cog, LLC
//
//========================================================================
#ifndef ACROFORM_H
#define ACROFORM_H
#include <aconf.h>
#ifdef USE_GCC_PRAGMAS
#pragma interface
#endif
#include "Form.h"
class TextString;
class GfxFont;
class GfxFontDict;
//------------------------------------------------------------------------
class AcroForm: public Form {
public:
static AcroForm *load(PDFDoc *docA, Catalog *catalog, Object *acroFormObjA);
virtual ~AcroForm();
virtual const char *getType() { return "AcroForm"; }
virtual void draw(int pageNum, Gfx *gfx, GBool printing);
virtual int getNumFields();
virtual FormField *getField(int idx);
private:
AcroForm(PDFDoc *docA, Object *acroFormObjA);
void buildAnnotPageList(Catalog *catalog);
int lookupAnnotPage(Object *annotRef);
void scanField(Object *fieldRef);
Object acroFormObj;
GBool needAppearances;
GList *annotPages; // [AcroFormAnnotPage]
GList *fields; // [AcroFormField]
friend class AcroFormField;
};
//------------------------------------------------------------------------
enum AcroFormFieldType {
acroFormFieldPushbutton,
acroFormFieldRadioButton,
acroFormFieldCheckbox,
acroFormFieldFileSelect,
acroFormFieldMultilineText,
acroFormFieldText,
acroFormFieldComboBox,
acroFormFieldListBox,
acroFormFieldSignature
};
class AcroFormField: public FormField {
public:
static AcroFormField *load(AcroForm *acroFormA, Object *fieldRefA);
virtual ~AcroFormField();
virtual const char *getType();
virtual Unicode *getName(int *length);
virtual TextString *getNameTS();
virtual TextString *getValueTS();
virtual TextString *getAltTextTS();
virtual GBool getRect(int pageNum, int *xMin, int *yMin, int *xMax, int *yMax);
//virtual GString *getAltText(int pageNum);
//virtual GString *getNameGString();
//virtual GString *getValueGString();
virtual Object *getResources(Object *res);
private:
AcroFormField(AcroForm *acroFormA, Object *fieldRefA, Object *fieldObjA,
AcroFormFieldType typeA, TextString *nameA, TextString *valueA, TextString *textA,
Guint flagsA);
void draw(int pageNum, Gfx *gfx, GBool printing);
void drawAnnot(int pageNum, Gfx *gfx, GBool printing,
Object *annotRef, Object *annotObj);
GBool getRectangle(int pageNum, Object *annotRef, Object *annotObj,
int *xmin, int *ymin, int *xmax, int *ymax);
//GString *getAlternativeText(int pageNum, Object *annotRef, Object *annotObj);
void drawExistingAppearance(Gfx *gfx, Dict *annot,
double xMin, double yMin,
double xMax, double yMax);
void drawNewAppearance(Gfx *gfx, Dict *annot,
double xMin, double yMin,
double xMax, double yMax);
void setColor(Array *a, GBool fill, int adjust);
void drawText(GString *text, GString *da, GfxFontDict *fontDict,
GBool multiline, int comb, int quadding,
GBool txField, GBool forceZapfDingbats, int rot,
double xMin, double yMin, double xMax, double yMax,
double border);
void drawListBox(GString **text, GBool *selection,
int nOptions, int topIdx,
GString *da, GfxFontDict *fontDict,
GBool quadding, double xMin, double yMin,
double xMax, double yMax, double border);
void getNextLine(GString *text, int start,
GfxFont *font, double fontSize, double wMax,
int *end, double *width, int *next);
void drawCircle(double cx, double cy, double r, const char *cmd);
void drawCircleTopLeft(double cx, double cy, double r);
void drawCircleBottomRight(double cx, double cy, double r);
Object *getAnnotResources(Dict *annot, Object *res);
Object *fieldLookup(const char *key, Object *obj);
Object *fieldLookup(Dict *dict, const char *key, Object *obj);
AcroForm *acroForm;
Object fieldRef;
Object fieldObj;
AcroFormFieldType type;
TextString *name;
TextString *value;
TextString *alttext;
Guint flags;
GString *appearBuf;
friend class AcroForm;
};
#endif