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