]> www.fi.muni.cz Git - evince.git/blob - pdf/xpdf/Page.h
Upgraded to Bonobo-0.7 -miguel
[evince.git] / pdf / xpdf / Page.h
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 limitToCropBox ? cropX1 : x1; }
39   double getY1() { return limitToCropBox ? cropY1 : y1; }
40   double getX2() { return limitToCropBox ? cropX2 : x2; }
41   double getY2() { return limitToCropBox ? cropY2 : 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   GBool limitToCropBox;
56   int rotate;
57   Object resources;
58 };
59
60 //------------------------------------------------------------------------
61 // Page
62 //------------------------------------------------------------------------
63
64 class Page {
65 public:
66
67   // Constructor.
68   Page(int num1, Dict *pageDict, PageAttrs *attrs1);
69
70   // Destructor.
71   ~Page();
72
73   // Is page valid?
74   GBool isOk() { return ok; }
75
76   // Get page parameters.
77   double getX1() { return attrs->getX1(); }
78   double getY1() { return attrs->getY1(); }
79   double getX2() { return attrs->getX2(); }
80   double getY2() { return attrs->getY2(); }
81   GBool isCropped() { return attrs->isCropped(); }
82   double getCropX1() { return attrs->getCropX1(); }
83   double getCropY1() { return attrs->getCropY1(); }
84   double getCropX2() { return attrs->getCropX2(); }
85   double getCropY2() { return attrs->getCropY2(); }
86   double getWidth() { return attrs->getX2() - attrs->getX1(); }
87   double getHeight() { return attrs->getY2() - attrs->getY1(); }
88   int getRotate() { return attrs->getRotate(); }
89
90   // Get resource
91   Dict *getResourceDict() { return attrs->getResourceDict(); }
92
93   // Get annotations array.
94   Object *getAnnots(Object *obj) { return annots.fetch(obj); }
95
96   // Get contents.
97   Object *getContents(Object *obj) { return contents.fetch(obj); }
98
99   // Display a page.
100   void display(OutputDev *out, int dpi, int rotate);
101
102 private:
103
104   int num;                      // page number
105   PageAttrs *attrs;             // page attributes
106   Object annots;                // annotations array
107   Object contents;              // page contents
108   GBool ok;                     // true if page is valid
109 };
110
111 #endif