]> www.fi.muni.cz Git - evince.git/blobdiff - pdf/xpdf/Link.h
distribute gpdf-window-ui.xml
[evince.git] / pdf / xpdf / Link.h
index 62a4c85e57dfcfc87d1ac486ef48f817778fe5c6..e5b15e327c351350be5172dd01b3fcd59a026ee9 100644 (file)
@@ -2,7 +2,7 @@
 //
 // Link.h
 //
-// Copyright 1996 Derek B. Noonburg
+// Copyright 1996-2002 Glyph & Cog, LLC
 //
 //========================================================================
 
@@ -28,6 +28,7 @@ enum LinkActionKind {
   actionGoToR,                 // go to destination in new file
   actionLaunch,                        // launch app (or open document)
   actionURI,                   // URI
+  actionNamed,                 // named action
   actionUnknown                        // anything else
 };
 
@@ -62,10 +63,8 @@ enum LinkDestKind {
 class LinkDest {
 public:
 
-  // Build a LinkDest from the array.  If <pageIsRef> is true, the
-  // page is specified by an object reference; otherwise the page is
-  // specified by a (zero-relative) page number.
-  LinkDest(Array *a, GBool pageIsRef1);
+  // Build a LinkDest from the array.
+  LinkDest(Array *a);
 
   // Copy a LinkDest.
   LinkDest *copy() { return new LinkDest(this); }
@@ -200,8 +199,8 @@ private:
 class LinkURI: public LinkAction {
 public:
 
-  // Build a LinkURI given the URI (string).
-  LinkURI(Object *uriObj);
+  // Build a LinkURI given the URI (string) and base URI.
+  LinkURI(Object *uriObj, GString *baseURI);
 
   // Destructor.
   virtual ~LinkURI();
@@ -218,6 +217,28 @@ private:
   GString *uri;                        // the URI
 };
 
+//------------------------------------------------------------------------
+// LinkNamed
+//------------------------------------------------------------------------
+
+class LinkNamed: public LinkAction {
+public:
+
+  // Build a LinkNamed given the action name.
+  LinkNamed(Object *nameObj);
+
+  virtual ~LinkNamed();
+
+  virtual GBool isOk() { return name != NULL; }
+
+  virtual LinkActionKind getKind() { return actionNamed; }
+  GString *getName() { return name; }
+
+private:
+
+  GString *name;
+};
+
 //------------------------------------------------------------------------
 // LinkUnknown
 //------------------------------------------------------------------------
@@ -226,7 +247,7 @@ class LinkUnknown: public LinkAction {
 public:
 
   // Build a LinkUnknown with the specified action type.
-  LinkUnknown(char *action1);
+  LinkUnknown(char *actionA);
 
   // Destructor.
   virtual ~LinkUnknown();
@@ -251,24 +272,24 @@ class Link {
 public:
 
   // Construct a link, given its dictionary.
-  Link(Dict *dict);
+  Link(Dict *dict, GString *baseURI);
 
   // Destructor.
   ~Link();
 
   // Was the link created successfully?
-  GBool isOk() { return ok; }
+  GBool isOk() const { return ok; }
 
   // Check if point is inside the link rectangle.
-  GBool inRect(double x, double y)
+  GBool inRect(double x, double y) const
     { return x1 <= x && x <= x2 && y1 <= y && y <= y2; }
 
   // Get action.
-  LinkAction *getAction() { return action; }
+  LinkAction *getAction() const { return action; }
 
   // Get border corners and width.
   void getBorder(double *xa1, double *ya1, double *xa2, double *ya2,
-                double *wa)
+                double *wa) const
     { *xa1 = x1; *ya1 = y1; *xa2 = x2; *ya2 = y2; *wa = borderW; }
 
 private:
@@ -288,21 +309,21 @@ class Links {
 public:
 
   // Extract links from array of annotations.
-  Links(Object *annots);
+  Links(Object *annots, GString *baseURI);
 
   // Destructor.
   ~Links();
 
   // Iterate through list of links.
-  int getNumLinks() { return numLinks; }
-  Link *getLink(int i) { return links[i]; }
+  int getNumLinks() const { return numLinks; }
+  Link *getLink(int i) const { return links[i]; }
 
   // If point <x>,<y> is in a link, return the associated action;
   // else return NULL.
-  LinkAction *find(double x, double y);
+  LinkAction *find(double x, double y) const;
 
   // Return true if <x>,<y> is in a link.
-  GBool onLink(double x, double y);
+  GBool onLink(double x, double y) const;
 
 private: