~ubuntu-branches/ubuntu/lucid/xpdf/lucid-updates

« back to all changes in this revision

Viewing changes to xpdf/Annot.h

  • Committer: Bazaar Package Importer
  • Author(s): Andy Price
  • Date: 2007-05-17 22:04:33 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070517220433-gzcx2lrvllkbl7mr
Tags: 3.02-1ubuntu1
* Merge from Debian unstable (LP: #113365), remaining changes:
  - Added back 09_xpdfrc_manpage.dpatch (LP #71753)
  - Set Ubuntu maintainer

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
class XRef;
19
19
class Catalog;
20
20
class Gfx;
 
21
class GfxFontDict;
 
22
 
 
23
//------------------------------------------------------------------------
 
24
// AnnotBorderStyle
 
25
//------------------------------------------------------------------------
 
26
 
 
27
enum AnnotBorderType {
 
28
  annotBorderSolid,
 
29
  annotBorderDashed,
 
30
  annotBorderBeveled,
 
31
  annotBorderInset,
 
32
  annotBorderUnderlined
 
33
};
 
34
 
 
35
class AnnotBorderStyle {
 
36
public:
 
37
 
 
38
  AnnotBorderStyle(AnnotBorderType typeA, double widthA,
 
39
                   double *dashA, int dashLengthA,
 
40
                   double rA, double gA, double bA);
 
41
  ~AnnotBorderStyle();
 
42
 
 
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; }
 
49
 
 
50
private:
 
51
 
 
52
  AnnotBorderType type;
 
53
  double width;
 
54
  double *dash;
 
55
  int dashLength;
 
56
  double r, g, b;
 
57
};
21
58
 
22
59
//------------------------------------------------------------------------
23
60
// Annot
26
63
class Annot {
27
64
public:
28
65
 
29
 
  Annot(XRef *xrefA, Dict *acroForm, Dict *dict);
 
66
  Annot(XRef *xrefA, Dict *acroForm, Dict *dict, Ref *refA);
30
67
  ~Annot();
31
68
  GBool isOk() { return ok; }
32
69
 
33
 
  void draw(Gfx *gfx);
 
70
  void draw(Gfx *gfx, GBool printing);
34
71
 
35
72
  // Get appearance object.
36
73
  Object *getAppearance(Object *obj) { return appearance.fetch(xref, obj); }
37
74
 
 
75
  AnnotBorderStyle *getBorderStyle() { return borderStyle; }
 
76
 
 
77
  GBool match(Ref *refA)
 
78
    { return ref.num == refA->num && ref.gen == refA->gen; }
 
79
 
 
80
  void generateFieldAppearance(Dict *field, Dict *annot, Dict *acroForm);
 
81
 
38
82
private:
39
83
 
40
 
  void generateAppearance(Dict *acroForm, Dict *dict);
 
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
  Object *fieldLookup(Dict *field, char *key, Object *obj);
41
98
 
42
99
  XRef *xref;                   // the xref table for this PDF file
 
100
  Ref ref;                      // object ref identifying this annotation
 
101
  GString *type;                // annotation type
43
102
  Object appearance;            // a reference to the Form XObject stream
44
103
                                //   for the normal appearance
45
104
  GString *appearBuf;
46
105
  double xMin, yMin,            // annotation rectangle
47
106
         xMax, yMax;
 
107
  Guint flags;
 
108
  AnnotBorderStyle *borderStyle;
48
109
  GBool ok;
49
110
};
50
111
 
55
116
class Annots {
56
117
public:
57
118
 
58
 
  // Extract non-link annotations from array of annotations.
 
119
  // Build a list of Annot objects.
59
120
  Annots(XRef *xref, Catalog *catalog, Object *annotsObj);
60
121
 
61
122
  ~Annots();
64
125
  int getNumAnnots() { return nAnnots; }
65
126
  Annot *getAnnot(int i) { return annots[i]; }
66
127
 
 
128
  // (Re)generate the appearance streams for all annotations belonging
 
129
  // to a form field.
 
130
  void generateAppearances(Dict *acroForm);
 
131
 
67
132
private:
68
133
 
 
134
  void scanFieldAppearances(Dict *node, Ref *ref, Dict *parent,
 
135
                            Dict *acroForm);
 
136
  Annot *findAnnot(Ref *ref);
 
137
 
69
138
  Annot **annots;
70
139
  int nAnnots;
71
140
};