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 *dict) {
25 Object apObj, asObj, obj1, obj2;
31 if (dict->lookup("AP", &apObj)->isDict()) {
32 if (dict->lookup("AS", &asObj)->isName()) {
33 if (apObj.dictLookup("N", &obj1)->isDict()) {
34 if (obj1.dictLookupNF(asObj.getName(), &obj2)->isRef()) {
35 obj2.copy(&appearance);
42 if (apObj.dictLookupNF("N", &obj1)->isRef()) {
43 obj1.copy(&appearance);
52 if (dict->lookup("Rect", &obj1)->isArray() &&
53 obj1.arrayGetLength() == 4) {
54 //~ should check object types here
55 obj1.arrayGet(0, &obj2);
58 obj1.arrayGet(1, &obj2);
61 obj1.arrayGet(2, &obj2);
64 obj1.arrayGet(3, &obj2);
68 t = xMin; xMin = xMax; xMax = t;
71 t = yMin; yMin = yMax; yMax = t;
74 //~ this should return an error
85 void Annot::draw(Gfx *gfx) {
88 if (appearance.fetch(xref, &obj)->isStream()) {
89 gfx->doAnnot(&obj, xMin, yMin, xMax, yMax);
94 //------------------------------------------------------------------------
96 //------------------------------------------------------------------------
98 Annots::Annots(XRef *xref, Object *annotsObj) {
108 if (annotsObj->isArray()) {
109 for (i = 0; i < annotsObj->arrayGetLength(); ++i) {
110 if (annotsObj->arrayGet(i, &obj1)->isDict()) {
111 annot = new Annot(xref, obj1.getDict());
113 if (nAnnots >= size) {
115 annots = (Annot **)grealloc(annots, size * sizeof(Annot *));
117 annots[nAnnots++] = annot;
130 for (i = 0; i < nAnnots; ++i) {