home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 110 / EnigmaAmiga110CD.iso / indispensabili / utility / apdf / xpdf-0.80 / xpdf / page.h < prev    next >
C/C++ Source or Header  |  1998-11-27  |  3KB  |  111 lines

  1. //========================================================================
  2. //
  3. // Page.h
  4. //
  5. // Copyright 1996 Derek B. Noonburg
  6. //
  7. //========================================================================
  8.  
  9. #ifndef PAGE_H
  10. #define PAGE_H
  11.  
  12. #ifdef __GNUC__
  13. #pragma interface
  14. #endif
  15.  
  16. #include "Object.h"
  17.  
  18. class Dict;
  19. class XRef;
  20. class OutputDev;
  21.  
  22. //------------------------------------------------------------------------
  23. // PageAttrs
  24. //------------------------------------------------------------------------
  25.  
  26. class PageAttrs {
  27. public:
  28.  
  29.   // Construct a new PageAttrs object by merging a dictionary
  30.   // (of type Pages or Page) into another PageAttrs object.  If
  31.   // <attrs> is NULL, uses defaults.
  32.   PageAttrs(PageAttrs *attrs, Dict *dict);
  33.  
  34.   // Destructor.
  35.   ~PageAttrs();
  36.  
  37.   // Accessors.
  38.   double getX1() { return x1; }
  39.   double getY1() { return y1; }
  40.   double getX2() { return x2; }
  41.   double getY2() { return y2; }
  42.   GBool isCropped() { return cropX2 > cropX1; }
  43.   double getCropX1() { return cropX1; }
  44.   double getCropY1() { return cropY1; }
  45.   double getCropX2() { return cropX2; }
  46.   double getCropY2() { return cropY2; }
  47.   int getRotate() { return rotate; }
  48.   Dict *getResourceDict()
  49.     { return resources.isDict() ? resources.getDict() : (Dict *)NULL; }
  50.  
  51. private:
  52.  
  53.   double x1, y1, x2, y2;
  54.   double cropX1, cropY1, cropX2, cropY2;
  55.   int rotate;
  56.   Object resources;
  57. };
  58.  
  59. //------------------------------------------------------------------------
  60. // Page
  61. //------------------------------------------------------------------------
  62.  
  63. class Page {
  64. public:
  65.  
  66.   // Constructor.
  67.   Page(int num1, Dict *pageDict, PageAttrs *attrs1);
  68.  
  69.   // Destructor.
  70.   ~Page();
  71.  
  72.   // Is page valid?
  73.   GBool isOk() { return ok; }
  74.  
  75.   // Get page parameters.
  76.   double getX1() { return attrs->getX1(); }
  77.   double getY1() { return attrs->getY1(); }
  78.   double getX2() { return attrs->getX2(); }
  79.   double getY2() { return attrs->getY2(); }
  80.   GBool isCropped() { return attrs->isCropped(); }
  81.   double getCropX1() { return attrs->getCropX1(); }
  82.   double getCropY1() { return attrs->getCropY1(); }
  83.   double getCropX2() { return attrs->getCropX2(); }
  84.   double getCropY2() { return attrs->getCropY2(); }
  85.   double getWidth() { return attrs->getX2() - attrs->getX1(); }
  86.   double getHeight() { return attrs->getY2() - attrs->getY1(); }
  87.   int getRotate() { return attrs->getRotate(); }
  88.  
  89.   // Get resource
  90.   Dict *getResourceDict() { return attrs->getResourceDict(); }
  91.  
  92.   // Get annotations array.
  93.   Object *getAnnots(Object *obj) { return annots.fetch(obj); }
  94.  
  95.   // Get contents.
  96.   Object *getContents(Object *obj) { return contents.fetch(obj); }
  97.  
  98.   // Display a page.
  99.   void display(OutputDev *out, int dpi, int rotate);
  100.  
  101. private:
  102.  
  103.   int num;            // page number
  104.   PageAttrs *attrs;        // page attributes
  105.   Object annots;        // annotations array
  106.   Object contents;        // page contents
  107.   GBool ok;            // true if page is valid
  108. };
  109.  
  110. #endif
  111.