]> www.fi.muni.cz Git - evince.git/blob - pdf/xpdf/PDFDoc.h
Initial revision
[evince.git] / pdf / xpdf / PDFDoc.h
1 //========================================================================
2 //
3 // PDFDoc.h
4 //
5 // Copyright 1996 Derek B. Noonburg
6 //
7 //========================================================================
8
9 #ifndef PDFDOC_H
10 #define PDFDOC_H
11
12 #ifdef __GNUC__
13 #pragma interface
14 #endif
15
16 #include <stdio.h>
17 #include "Link.h"
18
19 class GString;
20 class XRef;
21 class Catalog;
22 class OutputDev;
23 class Links;
24 class LinkAction;
25 class LinkDest;
26
27 //------------------------------------------------------------------------
28 // PDFDoc
29 //------------------------------------------------------------------------
30
31 class PDFDoc {
32 public:
33
34   PDFDoc(GString *fileName1);
35   ~PDFDoc();
36
37   // Was PDF document successfully opened?
38   GBool isOk() { return ok; }
39
40   // Get file name.
41   GString *getFileName() { return fileName; }
42
43   // Get catalog.
44   Catalog *getCatalog() { return catalog; }
45
46   // Get page parameters.
47   double getPageWidth(int page)
48     { return catalog->getPage(page)->getWidth(); }
49   double getPageHeight(int page)
50     { return catalog->getPage(page)->getHeight(); }
51   int getPageRotate(int page)
52     { return catalog->getPage(page)->getRotate(); }
53
54   // Get number of pages.
55   int getNumPages() { return catalog->getNumPages(); }
56
57   // Display a page.
58   void displayPage(OutputDev *out, int page, int zoom, int rotate,
59                    GBool doLinks);
60
61   // Display a range of pages.
62   void displayPages(OutputDev *out, int firstPage, int lastPage,
63                     int zoom, int rotate);
64
65   // Find a page, given its object ID.  Returns page number, or 0 if
66   // not found.
67   int findPage(int num, int gen) { return catalog->findPage(num, gen); }
68
69   // If point <x>,<y> is in a link, return the associated action;
70   // else return NULL.
71   LinkAction *findLink(double x, double y) { return links->find(x, y); }
72
73   // Return true if <x>,<y> is in a link.
74   GBool onLink(double x, double y) { return links->onLink(x, y); }
75
76   // Find a named destination.  Returns the link destination, or
77   // NULL if <name> is not a destination.
78   LinkDest *findDest(GString *name)
79     { return catalog->findDest(name); }
80
81   // Is the file encrypted?
82   GBool isEncrypted() { return xref->isEncrypted(); }
83
84   // Are printing and copying allowed?  If not, print an error message.
85   GBool okToPrint() { return xref->okToPrint(); }
86   GBool okToCopy() { return xref->okToCopy(); }
87
88   // Return the document's Info dictionary (if any).
89   Object *getDocInfo(Object *obj) { return xref->getDocInfo(obj); }
90
91   // Save this file with another name.
92   GBool saveAs(GString *name);
93
94 private:
95
96   void getLinks(int page);
97
98   GString *fileName;
99   FILE *file;
100   XRef *xref;
101   Catalog *catalog;
102   Links *links;
103
104   GBool ok;
105 };
106
107 #endif