Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Catalog.h

Go to the documentation of this file.
00001 //========================================================================
00002 //
00003 // Catalog.h
00004 //
00005 // Copyright 1996-2003 Glyph & Cog, LLC
00006 //
00007 //========================================================================
00008 
00009 #ifndef CATALOG_H
00010 #define CATALOG_H
00011 
00012 #include <aconf.h>
00013 
00014 #ifdef USE_GCC_PRAGMAS
00015 #pragma interface
00016 #endif
00017 
00018 class XRef;
00019 class Object;
00020 class Page;
00021 class PageAttrs;
00022 struct Ref;
00023 class LinkDest;
00024 
00025 //------------------------------------------------------------------------
00026 // Catalog
00027 //------------------------------------------------------------------------
00028 
00029 class Catalog {
00030 public:
00031 
00032   // Constructor.
00033   Catalog(XRef *xrefA);
00034 
00035   // Destructor.
00036   ~Catalog();
00037 
00038   // Is catalog valid?
00039   GBool isOk() { return ok; }
00040 
00041   // Get number of pages.
00042   int getNumPages() { return numPages; }
00043 
00044   // Get a page.
00045   Page *getPage(int i) { return pages[i-1]; }
00046 
00047   // Get the reference for a page object.
00048   Ref *getPageRef(int i) { return &pageRefs[i-1]; }
00049 
00050   // Return base URI, or NULL if none.
00051   GString *getBaseURI() { return baseURI; }
00052 
00053   // Return the contents of the metadata stream, or NULL if there is
00054   // no metadata.
00055   GString *readMetadata();
00056 
00057   // Return the structure tree root object.
00058   Object *getStructTreeRoot() { return &structTreeRoot; }
00059 
00060   // Find a page, given its object ID.  Returns page number, or 0 if
00061   // not found.
00062   int findPage(int num, int gen);
00063 
00064   // Find a named destination.  Returns the link destination, or
00065   // NULL if <name> is not a destination.
00066   LinkDest *findDest(GString *name);
00067 
00068   Object *getOutline() { return &outline; }
00069 
00070 private:
00071 
00072   XRef *xref;                   // the xref table for this PDF file
00073   Page **pages;                 // array of pages
00074   Ref *pageRefs;                // object ID for each page
00075   int numPages;                 // number of pages
00076   int pagesSize;                // size of pages array
00077   Object dests;                 // named destination dictionary
00078   Object nameTree;              // name tree
00079   GString *baseURI;             // base URI for URI-type links
00080   Object metadata;              // metadata stream
00081   Object structTreeRoot;        // structure tree root dictionary
00082   Object outline;               // outline dictionary
00083   GBool ok;                     // true if catalog is valid
00084 
00085   int readPageTree(Dict *pages, PageAttrs *attrs, int start);
00086   Object *findDestInTree(Object *tree, GString *name, Object *obj);
00087 };
00088 
00089 #endif

Generated on Wed Nov 3 12:58:52 2004 for Lemur Toolkit by doxygen1.2.18