00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef PAGE_H
00010 #define PAGE_H
00011
00012 #ifdef __GNUC__
00013 #pragma interface
00014 #endif
00015
00016 #include "Object.h"
00017
00018 class Dict;
00019 class XRef;
00020 class OutputDev;
00021 class Links;
00022 class Catalog;
00023
00024
00025
00026 struct PDFRectangle {
00027 fouble x1, y1, x2, y2;
00028 };
00029
00030
00031
00032
00033
00034 class PageAttrs {
00035 public:
00036
00037
00038
00039
00040 PageAttrs(PageAttrs *attrs, Dict *dict);
00041
00042
00043 ~PageAttrs();
00044
00045
00046 PDFRectangle *getBox() { return limitToCropBox ? &cropBox : &mediaBox; }
00047 PDFRectangle *getMediaBox() { return &mediaBox; }
00048 PDFRectangle *getCropBox() { return &cropBox; }
00049 GBool isCropped() { return haveCropBox; }
00050 PDFRectangle *getBleedBox() { return &bleedBox; }
00051 PDFRectangle *getTrimBox() { return &trimBox; }
00052 PDFRectangle *getArtBox() { return &artBox; }
00053 int getRotate() { return rotate; }
00054 GString *getLastModified()
00055 { return lastModified.isString()
00056 ? lastModified.getString() : (GString *)NULL; }
00057 Dict *getBoxColorInfo()
00058 { return boxColorInfo.isDict() ? boxColorInfo.getDict() : (Dict *)NULL; }
00059 Dict *getGroup()
00060 { return group.isDict() ? group.getDict() : (Dict *)NULL; }
00061 Stream *getMetadata()
00062 { return metadata.isStream() ? metadata.getStream() : (Stream *)NULL; }
00063 Dict *getPieceInfo()
00064 { return pieceInfo.isDict() ? pieceInfo.getDict() : (Dict *)NULL; }
00065 Dict *getSeparationInfo()
00066 { return separationInfo.isDict()
00067 ? separationInfo.getDict() : (Dict *)NULL; }
00068 Dict *getResourceDict()
00069 { return resources.isDict() ? resources.getDict() : (Dict *)NULL; }
00070
00071 private:
00072
00073 GBool readBox(Dict *dict, char *key, PDFRectangle *box);
00074
00075 PDFRectangle mediaBox;
00076 PDFRectangle cropBox;
00077 GBool haveCropBox;
00078 GBool limitToCropBox;
00079 PDFRectangle bleedBox;
00080 PDFRectangle trimBox;
00081 PDFRectangle artBox;
00082 int rotate;
00083 Object lastModified;
00084 Object boxColorInfo;
00085 Object group;
00086 Object metadata;
00087 Object pieceInfo;
00088 Object separationInfo;
00089 Object resources;
00090 };
00091
00092
00093
00094
00095
00096 class Page {
00097 public:
00098
00099
00100 Page(XRef *xrefA, int numA, Dict *pageDict, PageAttrs *attrsA,
00101 GBool printCommandsA);
00102
00103
00104 ~Page();
00105
00106
00107 GBool isOk() { return ok; }
00108
00109
00110 PDFRectangle *getBox() { return attrs->getBox(); }
00111 PDFRectangle *getMediaBox() { return attrs->getMediaBox(); }
00112 PDFRectangle *getCropBox() { return attrs->getCropBox(); }
00113 GBool isCropped() { return attrs->isCropped(); }
00114 fouble getWidth() { return attrs->getBox()->x2 - attrs->getBox()->x1; }
00115 fouble getHeight() { return attrs->getBox()->y2 - attrs->getBox()->y1; }
00116 PDFRectangle *getBleedBox() { return attrs->getBleedBox(); }
00117 PDFRectangle *getTrimBox() { return attrs->getTrimBox(); }
00118 PDFRectangle *getArtBox() { return attrs->getArtBox(); }
00119 int getRotate() { return attrs->getRotate(); }
00120 GString *getLastModified() { return attrs->getLastModified(); }
00121 Dict *getBoxColorInfo() { return attrs->getBoxColorInfo(); }
00122 Dict *getGroup() { return attrs->getGroup(); }
00123 Stream *getMetadata() { return attrs->getMetadata(); }
00124 Dict *getPieceInfo() { return attrs->getPieceInfo(); }
00125 Dict *getSeparationInfo() { return attrs->getSeparationInfo(); }
00126
00127
00128 Dict *getResourceDict() { return attrs->getResourceDict(); }
00129
00130
00131 Object *getAnnots(Object *obj) { return annots.fetch(xref, obj); }
00132
00133
00134 Object *getContents(Object *obj) { return contents.fetch(xref, obj); }
00135
00136
00137 void display(OutputDev *out, fouble dpi, int rotate,
00138 Links *links, Catalog *catalog);
00139
00140 private:
00141
00142 XRef *xref;
00143 int num;
00144 PageAttrs *attrs;
00145 Object annots;
00146 Object contents;
00147 GBool printCommands;
00148 GBool ok;
00149 };
00150
00151 #endif