home *** CD-ROM | disk | FTP | other *** search
- //========================================================================
- //
- // PDFDoc.h
- //
- // Copyright 1996 Derek B. Noonburg
- //
- //========================================================================
- //
- // Ported to EPOC by Sander van der Wal
- //
- // $Id: PDFDoc.h 1.2 2000-09-17 13:38:15+02 svdwal Exp svdwal $
-
- #ifndef PDFDOC_H
- #define PDFDOC_H
-
- #ifdef __GNUC__
- #pragma interface
- #endif
-
- #ifdef __SYMBIAN32__
-
- # ifndef __E32BASE_H__
- # include <e32base.h>
- # endif
-
- # ifndef __F32FILE_H__
- # include <f32file.h>
- # endif
-
- #endif
-
- // --o C library
- #ifndef __SYMBIAN32__
- # include <stdio.h>
- #endif
-
- // --o GooLib
- #include "gtypes.h"
-
- // --o PdfLib
- class OutputDev;
- #include "Link.h"
- #include "Object.h"
- #include "Catalog.h"
- #include "Page.h"
- #include "XRef.h"
-
-
- //------------------------------------------------------------------------
- // PDFDoc
- //------------------------------------------------------------------------
-
- class PDFDoc: public CBase {
- public:
-
- PDFDoc() {}
- void ConstructL(RFs& aFsSession, const TFileName& aFileName);
- ~PDFDoc();
-
- // Was PDF document successfully opened?
- GBool isOk() { return ok; }
-
- // Get file name.
- TFileName *getFileName() { return &fileName; }
-
- // Get catalog.
- Catalog *getCatalog() { return catalog; }
-
- // Get page parameters.
- double getPageWidth(int page)
- { return catalog->getPage(page)->getWidth(); }
- double getPageHeight(int page)
- { return catalog->getPage(page)->getHeight(); }
- int getPageRotate(int page)
- { return catalog->getPage(page)->getRotate(); }
-
- // Get number of pages.
- int getNumPages() { return catalog->getNumPages(); }
-
- // Display a page.
- void displayPageL(OutputDev *out, int page, int zoom, int rotate,
- GBool doLinks);
-
- void DisplayLinks(OutputDev *out, int page);
-
- // Display a range of pages.
- void displayPagesL(OutputDev *out, int firstPage, int lastPage,
- int zoom, int rotate);
-
- // Find a page, given its object ID. Returns page number, or 0 if
- // not found.
- int findPage(int num, int gen) { return catalog->findPage(num, gen); }
-
- // If point <x>,<y> is in a link, return the associated action;
- // else return NULL.
- LinkAction *findLink(double x, double y) { return links->find(x, y); }
-
- // Return true if <x>,<y> is in a link.
- GBool onLink(double x, double y) { return links->onLink(x, y); }
-
- // Find a named destination. Returns the link destination, or
- // NULL if <name> is not a destination.
- LinkDest *findDestL(GString *name)
- { return catalog->findDestL(name); }
-
- // Is the file encrypted?
- GBool isEncrypted() { return xref->isEncrypted(); }
-
- // Are printing and copying allowed? If not, print an error message.
- GBool okToPrint() { return xref->okToPrint(); }
- GBool okToCopy() { return xref->okToCopy(); }
- GBool okToChange() { return xref->okToChange(); }
- GBool okToAddNotes() { return xref->okToAddNotes(); }
-
- // Return the document's Info dictionary (if any).
- Object *getDocInfoL(Object *obj) { return xref->getDocInfoL(obj); }
-
- // Save this file with another name.
- GBool saveAs(GString *name);
-
- void getLinksL(int page);
-
- private:
-
-
- TFileName fileName;
- #ifdef __SYMBIAN32__
- RFile file;
- #else
- FILE *file;
- #endif
- XRef *xref;
- Catalog *catalog;
- Links *links;
-
- GBool ok;
- };
-
- #endif
-