Initial revision
[swftools.git] / pdf2swf / xpdf / Catalog.h
1 //========================================================================
2 //
3 // Catalog.h
4 //
5 // Copyright 1996 Derek B. Noonburg
6 //
7 //========================================================================
8
9 #ifndef CATALOG_H
10 #define CATALOG_H
11
12 #ifdef __GNUC__
13 #pragma interface
14 #endif
15
16 class Object;
17 class Page;
18 class PageAttrs;
19 struct Ref;
20 class LinkDest;
21
22 //------------------------------------------------------------------------
23 // Catalog
24 //------------------------------------------------------------------------
25
26 class Catalog {
27 public:
28
29   // Constructor.
30   Catalog(Object *catDict);
31
32   // Destructor.
33   ~Catalog();
34
35   // Is catalog valid?
36   GBool isOk() { return ok; }
37
38   // Get number of pages.
39   int getNumPages() { return numPages; }
40
41   // Get a page.
42   Page *getPage(int i) { return pages[i-1]; }
43
44   // Get the reference for a page object.
45   Ref *getPageRef(int i) { return &pageRefs[i-1]; }
46
47   // Return base URI, or NULL if none.
48   GString *getBaseURI() { return baseURI; }
49
50   // Find a page, given its object ID.  Returns page number, or 0 if
51   // not found.
52   int findPage(int num, int gen);
53
54   // Find a named destination.  Returns the link destination, or
55   // NULL if <name> is not a destination.
56   LinkDest *findDest(GString *name);
57
58 private:
59
60   Page **pages;                 // array of pages
61   Ref *pageRefs;                // object ID for each page
62   int numPages;                 // number of pages
63   int pagesSize;                // size of pages array
64   Object dests;                 // named destination dictionary
65   Object nameTree;              // name tree
66   GString *baseURI;             // base URI for URI-type links
67   GBool ok;                     // true if catalog is valid
68
69   int readPageTree(Dict *pages, PageAttrs *attrs, int start);
70   Object *findDestInTree(Object *tree, GString *name, Object *obj);
71 };
72
73 #endif