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