Back to index

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

#include <Outline.h>

Collaboration diagram for OutlineItem:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 OutlineItem (Dict *dict, XRef *xrefA)
 ~OutlineItem ()
void open ()
void close ()
UnicodegetTitle ()
int getTitleLength ()
LinkActiongetAction ()
GBool isOpen ()
GBool hasKids ()
GListgetKids ()

Static Public Member Functions

static GListreadItemList (Object *firstItemRef, Object *lastItemRef, XRef *xrefA)

Private Attributes

XRefxref
Unicodetitle
int titleLen
LinkActionaction
Object firstRef
Object lastRef
Object nextRef
GBool startsOpen
GListkids

Detailed Description

Definition at line 44 of file Outline.h.


Constructor & Destructor Documentation

OutlineItem::OutlineItem ( Dict dict,
XRef xrefA 
)

Definition at line 46 of file Outline.cc.

                                                {
  Object obj1;
  GString *s;
  int i;

  xref = xrefA;
  title = NULL;
  action = NULL;
  kids = NULL;

  if (dict->lookup("Title", &obj1)->isString()) {
    s = obj1.getString();
    if ((s->getChar(0) & 0xff) == 0xfe &&
       (s->getChar(1) & 0xff) == 0xff) {
      titleLen = (s->getLength() - 2) / 2;
      title = (Unicode *)gmalloc(titleLen * sizeof(Unicode));
      for (i = 0; i < titleLen; ++i) {
       title[i] = ((s->getChar(2 + 2*i) & 0xff) << 8) |
                  (s->getChar(3 + 2*i) & 0xff);
      }
    } else {
      titleLen = s->getLength();
      title = (Unicode *)gmalloc(titleLen * sizeof(Unicode));
      for (i = 0; i < titleLen; ++i) {
       title[i] = pdfDocEncoding[s->getChar(i) & 0xff];
      }
    }
  } else {
    titleLen = 0;
  }
  obj1.free();

  if (!dict->lookup("Dest", &obj1)->isNull()) {
    action = LinkAction::parseDest(&obj1);
  } else {
    obj1.free();
    if (dict->lookup("A", &obj1)) {
      action = LinkAction::parseAction(&obj1);
    }
  }
  obj1.free();

  dict->lookupNF("First", &firstRef);
  dict->lookupNF("Last", &lastRef);
  dict->lookupNF("Next", &nextRef);

  startsOpen = gFalse;
  if (dict->lookup("Count", &obj1)->isInt()) {
    if (obj1.getInt() > 0) {
      startsOpen = gTrue;
    }
  }
  obj1.free();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 101 of file Outline.cc.

                          {
  close();
  if (title) {
    gfree(title);
  }
  if (action) {
    delete action;
  }
  firstRef.free();
  lastRef.free();
  nextRef.free();
}

Here is the call graph for this function:


Member Function Documentation

Definition at line 146 of file Outline.cc.

                        {
  if (kids) {
    deleteGList(kids, OutlineItem);
    kids = NULL;
  }
}

Here is the caller graph for this function:

Definition at line 58 of file Outline.h.

{ return action; }
GList* OutlineItem::getKids ( ) [inline]

Definition at line 61 of file Outline.h.

{ return kids; }

Definition at line 56 of file Outline.h.

{ return title; }

Definition at line 57 of file Outline.h.

{ return titleLen; }

Definition at line 60 of file Outline.h.

{ return firstRef.isRef(); }

Here is the call graph for this function:

GBool OutlineItem::isOpen ( ) [inline]

Definition at line 59 of file Outline.h.

{ return startsOpen; }

Definition at line 140 of file Outline.cc.

                       {
  if (!kids) {
    kids = readItemList(&firstRef, &lastRef, xref);
  }
}

Here is the call graph for this function:

GList * OutlineItem::readItemList ( Object firstItemRef,
Object lastItemRef,
XRef xrefA 
) [static]

Definition at line 114 of file Outline.cc.

                                          {
  GList *items;
  OutlineItem *item;
  Object obj;
  Object *p;

  items = new GList();
  p = firstItemRef;
  while (p->isRef()) {
    if (!p->fetch(xrefA, &obj)->isDict()) {
      obj.free();
      break;
    }
    item = new OutlineItem(obj.getDict(), xrefA);
    obj.free();
    items->append(item);
    if (p->getRef().num == lastItemRef->getRef().num &&
       p->getRef().gen == lastItemRef->getRef().gen) {
      break;
    }
    p = &item->nextRef;
  }
  return items;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 68 of file Outline.h.

Definition at line 69 of file Outline.h.

Definition at line 73 of file Outline.h.

Definition at line 70 of file Outline.h.

Definition at line 71 of file Outline.h.

Definition at line 72 of file Outline.h.

Definition at line 66 of file Outline.h.

Definition at line 67 of file Outline.h.

XRef* OutlineItem::xref [private]

Definition at line 65 of file Outline.h.


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