1 //========================================================================
5 // Copyright 2000-2003 Glyph & Cog, LLC
7 //========================================================================
14 #ifdef USE_GCC_PRAGMAS
23 //------------------------------------------------------------------------
25 //------------------------------------------------------------------------
27 enum AnnotBorderType
{
35 class AnnotBorderStyle
{
38 AnnotBorderStyle(AnnotBorderType typeA
, double widthA
,
39 double *dashA
, int dashLengthA
,
40 double rA
, double gA
, double bA
);
43 AnnotBorderType
getType() { return type
; }
44 double getWidth() { return width
; }
45 void getDash(double **dashA
, int *dashLengthA
)
46 { *dashA
= dash
; *dashLengthA
= dashLength
; }
47 void getColor(double *rA
, double *gA
, double *bA
)
48 { *rA
= r
; *gA
= g
; *bA
= b
; }
59 //------------------------------------------------------------------------
61 //------------------------------------------------------------------------
66 Annot(XRef
*xrefA
, Dict
*acroForm
, Dict
*dict
, Ref
*refA
);
68 GBool
isOk() { return ok
; }
70 void draw(Gfx
*gfx
, GBool printing
);
72 // Get appearance xObject.
73 xObject
*getAppearance(xObject
*obj
) { return appearance
.fetch(xref
, obj
); }
75 AnnotBorderStyle
*getBorderStyle() { return borderStyle
; }
77 GBool
match(Ref
*refA
)
78 { return ref
.num
== refA
->num
&& ref
.gen
== refA
->gen
; }
80 void generateFieldAppearance(Dict
*field
, Dict
*annot
, Dict
*acroForm
);
84 void setColor(Array
*a
, GBool fill
, int adjust
);
85 void drawText(GString
*text
, GString
*da
, GfxFontDict
*fontDict
,
86 GBool multiline
, int comb
, int quadding
,
87 GBool txField
, GBool forceZapfDingbats
);
88 void drawListBox(GString
**text
, GBool
*selection
,
89 int nOptions
, int topIdx
,
90 GString
*da
, GfxFontDict
*fontDict
, GBool quadding
);
91 void getNextLine(GString
*text
, int start
,
92 GfxFont
*font
, double fontSize
, double wMax
,
93 int *end
, double *width
, int *next
);
94 void drawCircle(double cx
, double cy
, double r
, GBool fill
);
95 void drawCircleTopLeft(double cx
, double cy
, double r
);
96 void drawCircleBottomRight(double cx
, double cy
, double r
);
97 xObject
*fieldLookup(Dict
*field
, char *key
, xObject
*obj
);
99 XRef
*xref
; // the xref table for this PDF file
100 Ref ref
; // xObject ref identifying this annotation
101 GString
*type
; // annotation type
102 xObject appearance
; // a reference to the Form XObject stream
103 // for the normal appearance
105 double xMin
, yMin
, // annotation rectangle
108 AnnotBorderStyle
*borderStyle
;
112 //------------------------------------------------------------------------
114 //------------------------------------------------------------------------
119 // Build a list of Annot xObjects.
120 Annots(XRef
*xref
, Catalog
*catalog
, xObject
*annotsObj
);
124 // Iterate through list of annotations.
125 int getNumAnnots() { return nAnnots
; }
126 Annot
*getAnnot(int i
) { return annots
[i
]; }
128 // (Re)generate the appearance streams for all annotations belonging
130 void generateAppearances(Dict
*acroForm
);
134 void scanFieldAppearances(Dict
*node
, Ref
*ref
, Dict
*parent
,
136 Annot
*findAnnot(Ref
*ref
);