summaryrefslogtreecommitdiff
path: root/noncore/unsupported/qpdf/xpdf/Page.h
Unidiff
Diffstat (limited to 'noncore/unsupported/qpdf/xpdf/Page.h') (more/less context) (show whitespace changes)
-rw-r--r--noncore/unsupported/qpdf/xpdf/Page.h125
1 files changed, 125 insertions, 0 deletions
diff --git a/noncore/unsupported/qpdf/xpdf/Page.h b/noncore/unsupported/qpdf/xpdf/Page.h
new file mode 100644
index 0000000..203878f
--- a/dev/null
+++ b/noncore/unsupported/qpdf/xpdf/Page.h
@@ -0,0 +1,125 @@
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
18class Dict;
19class XRef;
20class OutputDev;
21class Links;
22class Catalog;
23
24//------------------------------------------------------------------------
25
26struct PDFRectangle {
27 fouble x1, y1, x2, y2;
28};
29
30//------------------------------------------------------------------------
31// PageAttrs
32//------------------------------------------------------------------------
33
34class PageAttrs {
35public:
36
37 // Construct a new PageAttrs object by merging a dictionary
38 // (of type Pages or Page) into another PageAttrs object. If
39 // <attrs> is NULL, uses defaults.
40 PageAttrs(PageAttrs *attrs, Dict *dict);
41
42 // Destructor.
43 ~PageAttrs();
44
45 // Accessors.
46 PDFRectangle *getBox() { return limitToCropBox ? &cropBox : &mediaBox; }
47 PDFRectangle *getMediaBox() { return &mediaBox; }
48 PDFRectangle *getCropBox() { return &cropBox; }
49 GBool isCropped() { return haveCropBox; }
50 PDFRectangle *getBleedBox() { return &bleedBox; }
51 PDFRectangle *getTrimBox() { return &trimBox; }
52 PDFRectangle *getArtBox() { return &artBox; }
53 int getRotate() { return rotate; }
54 Dict *getResourceDict()
55 { return resources.isDict() ? resources.getDict() : (Dict *)NULL; }
56
57private:
58
59 GBool readBox(Dict *dict, char *key, PDFRectangle *box);
60
61 PDFRectangle mediaBox;
62 PDFRectangle cropBox;
63 GBool haveCropBox;
64 GBool limitToCropBox;
65 PDFRectangle bleedBox;
66 PDFRectangle trimBox;
67 PDFRectangle artBox;
68 int rotate;
69 Object resources;
70};
71
72//------------------------------------------------------------------------
73// Page
74//------------------------------------------------------------------------
75
76class Page {
77public:
78
79 // Constructor.
80 Page(XRef *xrefA, int numA, Dict *pageDict, PageAttrs *attrsA,
81 GBool printCommandsA);
82
83 // Destructor.
84 ~Page();
85
86 // Is page valid?
87 GBool isOk() { return ok; }
88
89 // Get page parameters.
90 PDFRectangle *getBox() { return attrs->getBox(); }
91 PDFRectangle *getMediaBox() { return attrs->getMediaBox(); }
92 PDFRectangle *getCropBox() { return attrs->getCropBox(); }
93 GBool isCropped() { return attrs->isCropped(); }
94 fouble getWidth() { return attrs->getBox()->x2 - attrs->getBox()->x1; }
95 fouble getHeight() { return attrs->getBox()->y2 - attrs->getBox()->y1; }
96 PDFRectangle *getBleedBox() { return attrs->getBleedBox(); }
97 PDFRectangle *getTrimBox() { return attrs->getTrimBox(); }
98 PDFRectangle *getArtBox() { return attrs->getArtBox(); }
99 int getRotate() { return attrs->getRotate(); }
100
101 // Get resource dictionary.
102 Dict *getResourceDict() { return attrs->getResourceDict(); }
103
104 // Get annotations array.
105 Object *getAnnots(Object *obj) { return annots.fetch(xref, obj); }
106
107 // Get contents.
108 Object *getContents(Object *obj) { return contents.fetch(xref, obj); }
109
110 // Display a page.
111 void display(OutputDev *out, fouble dpi, int rotate,
112 Links *links, Catalog *catalog);
113
114private:
115
116 XRef *xref; // the xref table for this PDF file
117 int num; // page number
118 PageAttrs *attrs; // page attributes
119 Object annots; // annotations array
120 Object contents; // page contents
121 GBool printCommands; // print the drawing commands (for debugging)
122 GBool ok; // true if page is valid
123};
124
125#endif