summaryrefslogtreecommitdiff
path: root/noncore/unsupported/qpdf/xpdf/Link.cc
authorsandman <sandman>2002-05-23 23:51:52 (UTC)
committer sandman <sandman>2002-05-23 23:51:52 (UTC)
commit2f3bb7b07f833273d966d41813e68bfe8b9d8d76 (patch) (unidiff)
tree00beb1bd9e7f4ba79e22334a0d258269b28f4564 /noncore/unsupported/qpdf/xpdf/Link.cc
parent6e82b45dd416ceeba78765717b700e853c96a137 (diff)
downloadopie-2f3bb7b07f833273d966d41813e68bfe8b9d8d76.zip
opie-2f3bb7b07f833273d966d41813e68bfe8b9d8d76.tar.gz
opie-2f3bb7b07f833273d966d41813e68bfe8b9d8d76.tar.bz2
Port to xpdf 1.01
Diffstat (limited to 'noncore/unsupported/qpdf/xpdf/Link.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/qpdf/xpdf/Link.cc34
1 files changed, 15 insertions, 19 deletions
diff --git a/noncore/unsupported/qpdf/xpdf/Link.cc b/noncore/unsupported/qpdf/xpdf/Link.cc
index 79a5f6e..c25ec43 100644
--- a/noncore/unsupported/qpdf/xpdf/Link.cc
+++ b/noncore/unsupported/qpdf/xpdf/Link.cc
@@ -2,7 +2,7 @@
2// 2//
3// Link.cc 3// Link.cc
4// 4//
5// Copyright 1996 Derek B. Noonburg 5// Copyright 1996-2002 Glyph & Cog, LLC
6// 6//
7//======================================================================== 7//========================================================================
8 8
@@ -29,31 +29,27 @@ static GString *getFileSpecName(Object *fileSpecObj);
29// LinkDest 29// LinkDest
30//------------------------------------------------------------------------ 30//------------------------------------------------------------------------
31 31
32LinkDest::LinkDest(Array *a, GBool pageIsRefA) { 32LinkDest::LinkDest(Array *a) {
33 Object obj1, obj2; 33 Object obj1, obj2;
34 34
35 // initialize fields 35 // initialize fields
36 pageIsRef = pageIsRefA;
37 left = bottom = right = top = zoom = 0; 36 left = bottom = right = top = zoom = 0;
38 ok = gFalse; 37 ok = gFalse;
39 38
40 // get page 39 // get page
41 if (pageIsRef) { 40 a->getNF(0, &obj1);
42 if (!a->getNF(0, &obj1)->isRef()) { 41 if (obj1.isInt()) {
43 error(-1, "Bad annotation destination"); 42 pageNum = obj1.getInt() + 1;
44 goto err2; 43 pageIsRef = gFalse;
45 } 44 } else if (obj1.isRef()) {
46 pageRef.num = obj1.getRefNum(); 45 pageRef.num = obj1.getRefNum();
47 pageRef.gen = obj1.getRefGen(); 46 pageRef.gen = obj1.getRefGen();
48 obj1.free(); 47 pageIsRef = gTrue;
49 } else { 48 } else {
50 if (!a->get(0, &obj1)->isInt()) { 49 error(-1, "Bad annotation destination");
51 error(-1, "Bad annotation destination"); 50 goto err2;
52 goto err2;
53 }
54 pageNum = obj1.getInt() + 1;
55 obj1.free();
56 } 51 }
52 obj1.free();
57 53
58 // get destination type 54 // get destination type
59 a->get(1, &obj1); 55 a->get(1, &obj1);
@@ -221,7 +217,7 @@ LinkGoTo::LinkGoTo(Object *destObj) {
221 217
222 // destination dictionary 218 // destination dictionary
223 } else if (destObj->isArray()) { 219 } else if (destObj->isArray()) {
224 dest = new LinkDest(destObj->getArray(), gTrue); 220 dest = new LinkDest(destObj->getArray());
225 if (!dest->isOk()) { 221 if (!dest->isOk()) {
226 delete dest; 222 delete dest;
227 dest = NULL; 223 dest = NULL;
@@ -259,7 +255,7 @@ LinkGoToR::LinkGoToR(Object *fileSpecObj, Object *destObj) {
259 255
260 // destination dictionary 256 // destination dictionary
261 } else if (destObj->isArray()) { 257 } else if (destObj->isArray()) {
262 dest = new LinkDest(destObj->getArray(), gFalse); 258 dest = new LinkDest(destObj->getArray());
263 if (!dest->isOk()) { 259 if (!dest->isOk()) {
264 delete dest; 260 delete dest;
265 dest = NULL; 261 dest = NULL;
@@ -446,7 +442,7 @@ Link::Link(Dict *dict, GString *baseURI) {
446 } 442 }
447 443
448 // get border 444 // get border
449 borderW = 0; 445 borderW = 1;
450 if (!dict->lookup("Border", &obj1)->isNull()) { 446 if (!dict->lookup("Border", &obj1)->isNull()) {
451 if (obj1.isArray() && obj1.arrayGetLength() >= 3) { 447 if (obj1.isArray() && obj1.arrayGetLength() >= 3) {
452 if (obj1.arrayGet(2, &obj2)->isNum()) { 448 if (obj1.arrayGet(2, &obj2)->isNum()) {
@@ -582,7 +578,7 @@ Links::~Links() {
582LinkAction *Links::find(fouble x, fouble y) { 578LinkAction *Links::find(fouble x, fouble y) {
583 int i; 579 int i;
584 580
585 for (i = 0; i < numLinks; ++i) { 581 for (i = numLinks - 1; i >= 0; --i) {
586 if (links[i]->inRect(x, y)) { 582 if (links[i]->inRect(x, y)) {
587 return links[i]->getAction(); 583 return links[i]->getAction();
588 } 584 }