]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | //======================================================================== |
2 | // | |
3 | // Catalog.h | |
4 | // | |
5 | // Copyright 1996-2003 Glyph & Cog, LLC | |
6 | // | |
7 | //======================================================================== | |
8 | ||
9 | #ifndef CATALOG_H | |
10 | #define CATALOG_H | |
11 | ||
12 | #include <config.h> | |
13 | ||
14 | #ifdef USE_GCC_PRAGMAS | |
15 | #pragma interface | |
16 | #endif | |
17 | ||
18 | class XRef; | |
19 | class Object; | |
20 | class Page; | |
21 | class PageAttrs; | |
22 | struct Ref; | |
23 | class LinkDest; | |
24 | ||
25 | //------------------------------------------------------------------------ | |
26 | // Catalog | |
27 | //------------------------------------------------------------------------ | |
28 | ||
29 | class Catalog { | |
30 | public: | |
31 | ||
32 | // Constructor. | |
33 | Catalog(XRef *xrefA); | |
34 | ||
35 | // Destructor. | |
36 | ~Catalog(); | |
37 | ||
38 | // Is catalog valid? | |
39 | GBool isOk() { return ok; } | |
40 | ||
41 | // Get number of pages. | |
42 | int getNumPages() { return numPages; } | |
43 | ||
44 | // Get a page. | |
45 | Page *getPage(int i) { return pages[i-1]; } | |
46 | ||
47 | // Get the reference for a page object. | |
48 | Ref *getPageRef(int i) { return &pageRefs[i-1]; } | |
49 | ||
50 | // Return base URI, or NULL if none. | |
51 | GString *getBaseURI() { return baseURI; } | |
52 | ||
53 | // Return the contents of the metadata stream, or NULL if there is | |
54 | // no metadata. | |
55 | GString *readMetadata(); | |
56 | ||
57 | // Return the structure tree root object. | |
58 | Object *getStructTreeRoot() { return &structTreeRoot; } | |
59 | ||
60 | // Find a page, given its object ID. Returns page number, or 0 if | |
61 | // not found. | |
62 | int findPage(int num, int gen); | |
63 | ||
64 | // Find a named destination. Returns the link destination, or | |
65 | // NULL if <name> is not a destination. | |
66 | LinkDest *findDest(GString *name); | |
67 | ||
68 | Object *getOutline() { return &outline; } | |
69 | ||
70 | Object *getAcroForm() { return &acroForm; } | |
71 | ||
72 | private: | |
73 | ||
74 | XRef *xref; // the xref table for this PDF file | |
75 | Page **pages; // array of pages | |
76 | Ref *pageRefs; // object ID for each page | |
77 | int numPages; // number of pages | |
78 | int pagesSize; // size of pages array | |
79 | Object dests; // named destination dictionary | |
80 | Object nameTree; // name tree | |
81 | GString *baseURI; // base URI for URI-type links | |
82 | Object metadata; // metadata stream | |
83 | Object structTreeRoot; // structure tree root dictionary | |
84 | Object outline; // outline dictionary | |
85 | Object acroForm; // AcroForm dictionary | |
86 | GBool ok; // true if catalog is valid | |
87 | ||
88 | int readPageTree(Dict *pages, PageAttrs *attrs, int start); | |
89 | Object *findDestInTree(Object *tree, GString *name, Object *obj); | |
90 | }; | |
91 | ||
92 | #endif |