Back to index

tetex-bin  3.0
Public Member Functions | Private Member Functions | Private Attributes
LinkDest Class Reference

#include <Link.h>

List of all members.

Public Member Functions

 LinkDest (Array *a)
LinkDestcopy ()
GBool isOk ()
LinkDestKind getKind ()
GBool isPageRef ()
int getPageNum ()
Ref getPageRef ()
double getLeft ()
double getBottom ()
double getRight ()
double getTop ()
double getZoom ()
GBool getChangeLeft ()
GBool getChangeTop ()
GBool getChangeZoom ()

Private Member Functions

 LinkDest (LinkDest *dest)

Private Attributes

LinkDestKind kind
GBool pageIsRef
union {
Ref pageRef
int pageNum
}; 
double left
double bottom
double right
double top
double zoom
GBool changeLeft
GBool changeTop
GBool changeZoom
GBool ok

Detailed Description

Definition at line 76 of file Link.h.


Constructor & Destructor Documentation

Definition at line 142 of file Link.cc.

                           {
  Object obj1, obj2;

  // initialize fields
  left = bottom = right = top = zoom = 0;
  ok = gFalse;

  // get page
  if (a->getLength() < 2) {
    error(-1, "Annotation destination array is too short");
    return;
  }
  a->getNF(0, &obj1);
  if (obj1.isInt()) {
    pageNum = obj1.getInt() + 1;
    pageIsRef = gFalse;
  } else if (obj1.isRef()) {
    pageRef.num = obj1.getRefNum();
    pageRef.gen = obj1.getRefGen();
    pageIsRef = gTrue;
  } else {
    error(-1, "Bad annotation destination");
    goto err2;
  }
  obj1.free();

  // get destination type
  a->get(1, &obj1);

  // XYZ link
  if (obj1.isName("XYZ")) {
    kind = destXYZ;
    if (a->getLength() < 3) {
      changeLeft = gFalse;
    } else {
      a->get(2, &obj2);
      if (obj2.isNull()) {
       changeLeft = gFalse;
      } else if (obj2.isNum()) {
       changeLeft = gTrue;
       left = obj2.getNum();
      } else {
       error(-1, "Bad annotation destination position");
       goto err1;
      }
      obj2.free();
    }
    if (a->getLength() < 4) {
      changeTop = gFalse;
    } else {
      a->get(3, &obj2);
      if (obj2.isNull()) {
       changeTop = gFalse;
      } else if (obj2.isNum()) {
       changeTop = gTrue;
       top = obj2.getNum();
      } else {
       error(-1, "Bad annotation destination position");
       goto err1;
      }
      obj2.free();
    }
    if (a->getLength() < 5) {
      changeZoom = gFalse;
    } else {
      a->get(4, &obj2);
      if (obj2.isNull()) {
       changeZoom = gFalse;
      } else if (obj2.isNum()) {
       changeZoom = gTrue;
       zoom = obj2.getNum();
      } else {
       error(-1, "Bad annotation destination position");
       goto err1;
      }
      obj2.free();
    }

  // Fit link
  } else if (obj1.isName("Fit")) {
    if (a->getLength() < 2) {
      error(-1, "Annotation destination array is too short");
      goto err2;
    }
    kind = destFit;

  // FitH link
  } else if (obj1.isName("FitH")) {
    if (a->getLength() < 3) {
      error(-1, "Annotation destination array is too short");
      goto err2;
    }
    kind = destFitH;
    if (!a->get(2, &obj2)->isNum()) {
      error(-1, "Bad annotation destination position");
      goto err1;
    }
    top = obj2.getNum();
    obj2.free();

  // FitV link
  } else if (obj1.isName("FitV")) {
    if (a->getLength() < 3) {
      error(-1, "Annotation destination array is too short");
      goto err2;
    }
    kind = destFitV;
    if (!a->get(2, &obj2)->isNum()) {
      error(-1, "Bad annotation destination position");
      goto err1;
    }
    left = obj2.getNum();
    obj2.free();

  // FitR link
  } else if (obj1.isName("FitR")) {
    if (a->getLength() < 6) {
      error(-1, "Annotation destination array is too short");
      goto err2;
    }
    kind = destFitR;
    if (!a->get(2, &obj2)->isNum()) {
      error(-1, "Bad annotation destination position");
      goto err1;
    }
    left = obj2.getNum();
    obj2.free();
    if (!a->get(3, &obj2)->isNum()) {
      error(-1, "Bad annotation destination position");
      goto err1;
    }
    bottom = obj2.getNum();
    obj2.free();
    if (!a->get(4, &obj2)->isNum()) {
      error(-1, "Bad annotation destination position");
      goto err1;
    }
    right = obj2.getNum();
    obj2.free();
    if (!a->get(5, &obj2)->isNum()) {
      error(-1, "Bad annotation destination position");
      goto err1;
    }
    top = obj2.getNum();
    obj2.free();

  // FitB link
  } else if (obj1.isName("FitB")) {
    if (a->getLength() < 2) {
      error(-1, "Annotation destination array is too short");
      goto err2;
    }
    kind = destFitB;

  // FitBH link
  } else if (obj1.isName("FitBH")) {
    if (a->getLength() < 3) {
      error(-1, "Annotation destination array is too short");
      goto err2;
    }
    kind = destFitBH;
    if (!a->get(2, &obj2)->isNum()) {
      error(-1, "Bad annotation destination position");
      goto err1;
    }
    top = obj2.getNum();
    obj2.free();

  // FitBV link
  } else if (obj1.isName("FitBV")) {
    if (a->getLength() < 3) {
      error(-1, "Annotation destination array is too short");
      goto err2;
    }
    kind = destFitBV;
    if (!a->get(2, &obj2)->isNum()) {
      error(-1, "Bad annotation destination position");
      goto err1;
    }
    left = obj2.getNum();
    obj2.free();

  // unknown link kind
  } else {
    error(-1, "Unknown annotation destination type");
    goto err2;
  }

  obj1.free();
  ok = gTrue;
  return;

 err1:
  obj2.free();
 err2:
  obj1.free();
}

Here is the call graph for this function:

Here is the caller graph for this function:

LinkDest::LinkDest ( LinkDest dest) [private]

Definition at line 340 of file Link.cc.

                                 {
  kind = dest->kind;
  pageIsRef = dest->pageIsRef;
  if (pageIsRef)
    pageRef = dest->pageRef;
  else
    pageNum = dest->pageNum;
  left = dest->left;
  bottom = dest->bottom;
  right = dest->right;
  top = dest->top;
  zoom = dest->zoom;
  changeLeft = dest->changeLeft;
  changeTop = dest->changeTop;
  changeZoom = dest->changeZoom;
  ok = gTrue;
}

Member Function Documentation

LinkDest* LinkDest::copy ( ) [inline]

Definition at line 83 of file Link.h.

{ return new LinkDest(this); }

Here is the call graph for this function:

double LinkDest::getBottom ( ) [inline]

Definition at line 94 of file Link.h.

{ return bottom; }

Definition at line 98 of file Link.h.

{ return changeLeft; }

Definition at line 99 of file Link.h.

{ return changeTop; }

Definition at line 100 of file Link.h.

{ return changeZoom; }

Definition at line 89 of file Link.h.

{ return kind; }
double LinkDest::getLeft ( ) [inline]

Definition at line 93 of file Link.h.

{ return left; }
int LinkDest::getPageNum ( ) [inline]

Definition at line 91 of file Link.h.

{ return pageNum; }
Ref LinkDest::getPageRef ( ) [inline]

Definition at line 92 of file Link.h.

{ return pageRef; }

Here is the caller graph for this function:

double LinkDest::getRight ( ) [inline]

Definition at line 95 of file Link.h.

{ return right; }
double LinkDest::getTop ( ) [inline]

Definition at line 96 of file Link.h.

{ return top; }
double LinkDest::getZoom ( ) [inline]

Definition at line 97 of file Link.h.

{ return zoom; }
GBool LinkDest::isOk ( ) [inline]

Definition at line 86 of file Link.h.

{ return ok; }

Here is the caller graph for this function:

GBool LinkDest::isPageRef ( ) [inline]

Definition at line 90 of file Link.h.

{ return pageIsRef; }

Member Data Documentation

union { ... } [private]
double LinkDest::bottom [private]

Definition at line 110 of file Link.h.

Definition at line 113 of file Link.h.

Definition at line 113 of file Link.h.

Definition at line 114 of file Link.h.

Definition at line 104 of file Link.h.

double LinkDest::left [private]

Definition at line 110 of file Link.h.

GBool LinkDest::ok [private]

Definition at line 115 of file Link.h.

Definition at line 105 of file Link.h.

double LinkDest::right [private]

Definition at line 111 of file Link.h.

double LinkDest::top [private]

Definition at line 111 of file Link.h.

double LinkDest::zoom [private]

Definition at line 112 of file Link.h.


The documentation for this class was generated from the following files: