1 //========================================================================
5 // Copyright 2000-2002 Glyph & Cog, LLC
7 //========================================================================
10 #pragma implementation
19 //------------------------------------------------------------------------
21 //------------------------------------------------------------------------
23 Annot::Annot(XRef *xrefA, Dict *dict) {
24 Object apObj, asObj, obj1, obj2;
30 if (dict->lookup("AP", &apObj)->isDict()) {
31 if (dict->lookup("AS", &asObj)->isName()) {
32 if (apObj.dictLookup("N", &obj1)->isDict()) {
33 if (obj1.dictLookupNF(asObj.getName(), &obj2)->isRef()) {
34 obj2.copy(&appearance);
41 if (apObj.dictLookupNF("N", &obj1)->isRef()) {
42 obj1.copy(&appearance);
51 if (dict->lookup("Rect", &obj1)->isArray() &&
52 obj1.arrayGetLength() == 4) {
53 //~ should check object types here
54 obj1.arrayGet(0, &obj2);
57 obj1.arrayGet(1, &obj2);
60 obj1.arrayGet(2, &obj2);
63 obj1.arrayGet(3, &obj2);
67 t = xMin; xMin = xMax; xMax = t;
70 t = yMin; yMin = yMax; yMax = t;
73 //~ this should return an error
84 void Annot::draw(Gfx *gfx) {
87 if (appearance.fetch(xref, &obj)->isStream()) {
88 gfx->doAnnot(&obj, xMin, yMin, xMax, yMax);
93 //------------------------------------------------------------------------
95 //------------------------------------------------------------------------
97 Annots::Annots(XRef *xref, Object *annotsObj) {
107 if (annotsObj->isArray()) {
108 for (i = 0; i < annotsObj->arrayGetLength(); ++i) {
109 if (annotsObj->arrayGet(i, &obj1)->isDict()) {
110 obj1.dictLookup("Subtype", &obj2);
111 if (obj2.isName("Widget") ||
112 obj2.isName("Stamp")) {
113 annot = new Annot(xref, obj1.getDict());
115 if (nAnnots >= size) {
117 annots = (Annot **)grealloc(annots, size * sizeof(Annot *));
119 annots[nAnnots++] = annot;
134 for (i = 0; i < nAnnots; ++i) {