1 //========================================================================
5 // Copyright 2000-2003 Glyph & Cog, LLC
7 //========================================================================
11 #ifdef USE_GCC_PRAGMAS
12 #pragma implementation
20 //------------------------------------------------------------------------
22 //------------------------------------------------------------------------
24 Annot::Annot(XRef *xrefA, Dict *dictA) {
25 Object apObj, asObj, obj1, obj2;
33 dictA->lookup("Subtype", &subtype);
34 if (dictA->lookup("AP", &apObj)->isDict()) {
35 if (dictA->lookup("AS", &asObj)->isName()) {
36 if (apObj.dictLookup("N", &obj1)->isDict()) {
37 if (obj1.dictLookupNF(asObj.getName(), &obj2)->isRef()) {
38 obj2.copy(&appearance);
45 if (apObj.dictLookupNF("N", &obj1)->isRef()) {
46 obj1.copy(&appearance);
55 if (dictA->lookup("Rect", &obj1)->isArray() &&
56 obj1.arrayGetLength() == 4) {
57 //~ should check object types here
58 obj1.arrayGet(0, &obj2);
61 obj1.arrayGet(1, &obj2);
64 obj1.arrayGet(2, &obj2);
67 obj1.arrayGet(3, &obj2);
71 t = xMin; xMin = xMax; xMax = t;
74 t = yMin; yMin = yMax; yMax = t;
77 //~ this should return an error
88 void Annot::draw(Gfx *gfx) {
91 if (appearance.fetch(xref, &obj)->isStream()) {
92 gfx->doAnnot(&obj, xMin, yMin, xMax, yMax);
97 //------------------------------------------------------------------------
99 //------------------------------------------------------------------------
101 Annots::Annots(XRef *xref, Object *annotsObj) {
111 if (annotsObj->isArray()) {
112 for (i = 0; i < annotsObj->arrayGetLength(); ++i) {
113 if (annotsObj->arrayGet(i, &obj1)->isDict()) {
114 annot = new Annot(xref, obj1.getDict());
116 if (nAnnots >= size) {
118 annots = (Annot **)grealloc(annots, size * sizeof(Annot *));
120 annots[nAnnots++] = annot;
133 for (i = 0; i < nAnnots; ++i) {