Back to index

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

#include <Link.h>

Inheritance diagram for LinkLaunch:
Inheritance graph
[legend]
Collaboration diagram for LinkLaunch:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 LinkLaunch (Object *actionObj)
virtual ~LinkLaunch ()
virtual GBool isOk ()
virtual LinkActionKind getKind ()
GStringgetFileName ()
GStringgetParams ()

Static Public Member Functions

static LinkActionparseDest (Object *obj)
static LinkActionparseAction (Object *obj, GString *baseURI=NULL)
static GStringgetFileSpecName (Object *fileSpecObj)

Private Attributes

GStringfileName
GStringparams

Detailed Description

Definition at line 185 of file Link.h.


Constructor & Destructor Documentation

LinkLaunch::LinkLaunch ( Object actionObj)

Definition at line 438 of file Link.cc.

                                        {
  Object obj1, obj2;

  fileName = NULL;
  params = NULL;

  if (actionObj->isDict()) {
    if (!actionObj->dictLookup("F", &obj1)->isNull()) {
      fileName = getFileSpecName(&obj1);
    } else {
      obj1.free();
#ifdef WIN32
      if (actionObj->dictLookup("Win", &obj1)->isDict()) {
       obj1.dictLookup("F", &obj2);
       fileName = getFileSpecName(&obj2);
       obj2.free();
       if (obj1.dictLookup("P", &obj2)->isString()) {
         params = obj2.getString()->copy();
       }
       obj2.free();
      } else {
       error(-1, "Bad launch-type link action");
      }
#else
      //~ This hasn't been defined by Adobe yet, so assume it looks
      //~ just like the Win dictionary until they say otherwise.
      if (actionObj->dictLookup("Unix", &obj1)->isDict()) {
       obj1.dictLookup("F", &obj2);
       fileName = getFileSpecName(&obj2);
       obj2.free();
       if (obj1.dictLookup("P", &obj2)->isString()) {
         params = obj2.getString()->copy();
       }
       obj2.free();
      } else {
       error(-1, "Bad launch-type link action");
      }
#endif
    }
    obj1.free();
  }
}

Here is the call graph for this function:

LinkLaunch::~LinkLaunch ( ) [virtual]

Definition at line 481 of file Link.cc.

                        {
  if (fileName)
    delete fileName;
  if (params)
    delete params;
}

Member Function Documentation

Definition at line 199 of file Link.h.

{ return fileName; }
GString * LinkAction::getFileSpecName ( Object fileSpecObj) [static, inherited]

Definition at line 108 of file Link.cc.

                                                        {
  GString *name;
  Object obj1;

  name = NULL;

  // string
  if (fileSpecObj->isString()) {
    name = fileSpecObj->getString()->copy();

  // dictionary
  } else if (fileSpecObj->isDict()) {
    if (!fileSpecObj->dictLookup("Unix", &obj1)->isString()) {
      obj1.free();
      fileSpecObj->dictLookup("F", &obj1);
    }
    if (obj1.isString())
      name = obj1.getString()->copy();
    else
      error(-1, "Illegal file spec in link");
    obj1.free();

  // error
  } else {
    error(-1, "Illegal file spec in link");
  }

  return name;
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual LinkActionKind LinkLaunch::getKind ( ) [inline, virtual]

Implements LinkAction.

Definition at line 198 of file Link.h.

{ return actionLaunch; }

Definition at line 200 of file Link.h.

{ return params; }
virtual GBool LinkLaunch::isOk ( ) [inline, virtual]

Implements LinkAction.

Definition at line 195 of file Link.h.

{ return fileName != NULL; }
LinkAction * LinkAction::parseAction ( Object obj,
GString baseURI = NULL 
) [static, inherited]

Definition at line 40 of file Link.cc.

                                                                 {
  LinkAction *action;
  Object obj2, obj3, obj4;

  if (!obj->isDict()) {
    error(-1, "Bad annotation action");
    return NULL;
  }

  obj->dictLookup("S", &obj2);

  // GoTo action
  if (obj2.isName("GoTo")) {
    obj->dictLookup("D", &obj3);
    action = new LinkGoTo(&obj3);
    obj3.free();

  // GoToR action
  } else if (obj2.isName("GoToR")) {
    obj->dictLookup("F", &obj3);
    obj->dictLookup("D", &obj4);
    action = new LinkGoToR(&obj3, &obj4);
    obj3.free();
    obj4.free();

  // Launch action
  } else if (obj2.isName("Launch")) {
    action = new LinkLaunch(obj);

  // URI action
  } else if (obj2.isName("URI")) {
    obj->dictLookup("URI", &obj3);
    action = new LinkURI(&obj3, baseURI);
    obj3.free();

  // Named action
  } else if (obj2.isName("Named")) {
    obj->dictLookup("N", &obj3);
    action = new LinkNamed(&obj3);
    obj3.free();

  // Movie action
  } else if (obj2.isName("Movie")) {
    obj->dictLookupNF("Annot", &obj3);
    obj->dictLookup("T", &obj4);
    action = new LinkMovie(&obj3, &obj4);
    obj3.free();
    obj4.free();

  // unknown action
  } else if (obj2.isName()) {
    action = new LinkUnknown(obj2.getName());

  // action is missing or wrong type
  } else {
    error(-1, "Bad annotation action");
    action = NULL;
  }

  obj2.free();

  if (action && !action->isOk()) {
    delete action;
    return NULL;
  }
  return action;
}

Here is the call graph for this function:

Here is the caller graph for this function:

LinkAction * LinkAction::parseDest ( Object obj) [static, inherited]

Definition at line 29 of file Link.cc.

                                             {
  LinkAction *action;

  action = new LinkGoTo(obj);
  if (!action->isOk()) {
    delete action;
    return NULL;
  }
  return action;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 204 of file Link.h.

Definition at line 205 of file Link.h.


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