home *** CD-ROM | disk | FTP | other *** search
/ PSION CD 2 / PsionCDVol2.iso / Programs / 720 / PDF090B4-SorceCode / pdf / PDFDoc.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-30  |  3.3 KB  |  140 lines

  1. //========================================================================
  2. //
  3. // PDFDoc.h
  4. //
  5. // Copyright 1996 Derek B. Noonburg
  6. //
  7. //========================================================================
  8. //
  9. // Ported to EPOC by Sander van der Wal
  10. //
  11. // $Id: PDFDoc.h 1.2 2000-09-17 13:38:15+02 svdwal Exp svdwal $
  12.  
  13. #ifndef PDFDOC_H
  14. #define PDFDOC_H
  15.  
  16. #ifdef __GNUC__
  17. #pragma interface
  18. #endif
  19.  
  20. #ifdef __SYMBIAN32__
  21.  
  22. #  ifndef __E32BASE_H__
  23. #  include <e32base.h>
  24. #  endif
  25.  
  26. #  ifndef __F32FILE_H__
  27. #  include <f32file.h>
  28. #  endif
  29.  
  30. #endif
  31.  
  32. // --o C library
  33. #ifndef __SYMBIAN32__
  34. #  include <stdio.h>
  35. #endif
  36.  
  37. // --o GooLib
  38. #include "gtypes.h"
  39.  
  40. // --o PdfLib
  41. class OutputDev;
  42. #include "Link.h"
  43. #include "Object.h"
  44. #include "Catalog.h"
  45. #include "Page.h"
  46. #include "XRef.h"
  47.  
  48.  
  49. //------------------------------------------------------------------------
  50. // PDFDoc
  51. //------------------------------------------------------------------------
  52.  
  53. class PDFDoc: public CBase {
  54. public:
  55.  
  56.   PDFDoc() {}
  57.   void ConstructL(RFs& aFsSession, const TFileName& aFileName);
  58.   ~PDFDoc();
  59.  
  60.   // Was PDF document successfully opened?
  61.   GBool isOk() { return ok; }
  62.  
  63.   // Get file name.
  64.   TFileName *getFileName() { return &fileName; }
  65.  
  66.   // Get catalog.
  67.   Catalog *getCatalog() { return catalog; }
  68.  
  69.   // Get page parameters.
  70.   double getPageWidth(int page)
  71.     { return catalog->getPage(page)->getWidth(); }
  72.   double getPageHeight(int page)
  73.     { return catalog->getPage(page)->getHeight(); }
  74.   int getPageRotate(int page)
  75.     { return catalog->getPage(page)->getRotate(); }
  76.  
  77.   // Get number of pages.
  78.   int getNumPages() { return catalog->getNumPages(); }
  79.  
  80.   // Display a page.
  81.   void displayPageL(OutputDev *out, int page, int zoom, int rotate,
  82.            GBool doLinks);
  83.  
  84.   void DisplayLinks(OutputDev *out, int page);
  85.  
  86.   // Display a range of pages.
  87.   void displayPagesL(OutputDev *out, int firstPage, int lastPage,
  88.             int zoom, int rotate);
  89.  
  90.   // Find a page, given its object ID.  Returns page number, or 0 if
  91.   // not found.
  92.   int findPage(int num, int gen) { return catalog->findPage(num, gen); }
  93.  
  94.   // If point <x>,<y> is in a link, return the associated action;
  95.   // else return NULL.
  96.   LinkAction *findLink(double x, double y) { return links->find(x, y); }
  97.  
  98.   // Return true if <x>,<y> is in a link.
  99.   GBool onLink(double x, double y) { return links->onLink(x, y); }
  100.  
  101.   // Find a named destination.  Returns the link destination, or
  102.   // NULL if <name> is not a destination.
  103.   LinkDest *findDestL(GString *name)
  104.     { return catalog->findDestL(name); }
  105.  
  106.   // Is the file encrypted?
  107.   GBool isEncrypted() { return xref->isEncrypted(); }
  108.  
  109.   // Are printing and copying allowed?  If not, print an error message.
  110.   GBool okToPrint() { return xref->okToPrint(); }
  111.   GBool okToCopy() { return xref->okToCopy(); }
  112.   GBool okToChange() { return xref->okToChange(); }
  113.   GBool okToAddNotes() { return xref->okToAddNotes(); }
  114.   
  115.   // Return the document's Info dictionary (if any).
  116.   Object *getDocInfoL(Object *obj) { return xref->getDocInfoL(obj); }
  117.  
  118.   // Save this file with another name.
  119.   GBool saveAs(GString *name);
  120.  
  121.   void getLinksL(int page);
  122.  
  123. private:
  124.  
  125.   
  126.   TFileName fileName;
  127. #ifdef __SYMBIAN32__
  128.   RFile file;
  129. #else
  130.   FILE *file;
  131. #endif
  132.   XRef *xref;
  133.   Catalog *catalog;
  134.   Links *links;
  135.  
  136.   GBool ok;
  137. };
  138.  
  139. #endif
  140.