X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=pdf%2Fxpdf%2FPDFDoc.h;h=57e37a2afb7d4847904fb0e22ecd07415b5d52d5;hb=5932479cc8c371a385616b5909df558a091b7111;hp=5e28962eda9db8e57b013acd9d8a6e70e17da953;hpb=d9f9a6449f377b4c933b75d57541b19c6d088994;p=evince.git diff --git a/pdf/xpdf/PDFDoc.h b/pdf/xpdf/PDFDoc.h index 5e28962e..57e37a2a 100644 --- a/pdf/xpdf/PDFDoc.h +++ b/pdf/xpdf/PDFDoc.h @@ -2,27 +2,33 @@ // // PDFDoc.h // -// Copyright 1996 Derek B. Noonburg +// Copyright 1996-2003 Glyph & Cog, LLC // //======================================================================== #ifndef PDFDOC_H #define PDFDOC_H -#ifdef __GNUC__ +#include + +#ifdef USE_GCC_PRAGMAS #pragma interface #endif #include +#include "XRef.h" #include "Link.h" +#include "Catalog.h" +#include "Page.h" +#include "Annot.h" class GString; -class XRef; -class Catalog; +class BaseStream; class OutputDev; class Links; class LinkAction; class LinkDest; +class Outline; //------------------------------------------------------------------------ // PDFDoc @@ -31,18 +37,30 @@ class LinkDest; class PDFDoc { public: - PDFDoc(GString *fileName1); + PDFDoc(GString *fileNameA, GString *ownerPassword = NULL, + GString *userPassword = NULL); + PDFDoc(BaseStream *strA, GString *ownerPassword = NULL, + GString *userPassword = NULL); ~PDFDoc(); // Was PDF document successfully opened? GBool isOk() { return ok; } + // Get the error code (if isOk() returns false). + int getErrorCode() { return errCode; } + // Get file name. GString *getFileName() { return fileName; } + // Get the xref table. + XRef *getXRef() { return xref; } + // Get catalog. Catalog *getCatalog() { return catalog; } + // Get base stream. + BaseStream *getBaseStream() { return str; } + // Get page parameters. double getPageWidth(int page) { return catalog->getPage(page)->getWidth(); } @@ -54,13 +72,39 @@ public: // Get number of pages. int getNumPages() { return catalog->getNumPages(); } + // Return the contents of the metadata stream, or NULL if there is + // no metadata. + GString *readMetadata() { return catalog->readMetadata(); } + + // Return the structure tree root object. + Object *getStructTreeRoot() { return catalog->getStructTreeRoot(); } + // Display a page. - void displayPage(OutputDev *out, int page, int zoom, int rotate, - GBool doLinks); + void displayPage(OutputDev *out, int page, double hDPI, double vDPI, + int rotate, GBool crop, GBool doLinks, + GBool (*abortCheckCbk)(void *data) = NULL, + void *abortCheckCbkData = NULL, + GBool (*annotDisplayDecideCbk)(Annot *annot, void *user_data) = NULL, + void *annotDisplayDecideCbkData = NULL); // Display a range of pages. void displayPages(OutputDev *out, int firstPage, int lastPage, - int zoom, int rotate); + double hDPI, double vDPI, int rotate, + GBool crop, GBool doLinks, + GBool (*abortCheckCbk)(void *data) = NULL, + void *abortCheckCbkData = NULL, + GBool (*annotDisplayDecideCbk)(Annot *annot, void *user_data) = NULL, + void *annotDisplayDecideCbkData = NULL); + + // Display part of a page. + void displayPageSlice(OutputDev *out, int page, + double hDPI, double vDPI, + int rotate, GBool crop, + int sliceX, int sliceY, int sliceW, int sliceH, + GBool (*abortCheckCbk)(void *data) = NULL, + void *abortCheckCbkData = NULL, + GBool (*annotDisplayDecideCbk)(Annot *annot, void *user_data) = NULL, + void *annotDisplayDecideCbkData = NULL); // Find a page, given its object ID. Returns page number, or 0 if // not found. @@ -68,7 +112,8 @@ public: // If point , is in a link, return the associated action; // else return NULL. - LinkAction *findLink(double x, double y) { return links->find(x, y); } + LinkAction *findLink(double x, double y) + { return links ? links->find(x, y) : (LinkAction *)NULL; } // Return true if , is in a link. GBool onLink(double x, double y) { return links->onLink(x, y); } @@ -78,30 +123,56 @@ public: LinkDest *findDest(GString *name) { return catalog->findDest(name); } +#ifndef DISABLE_OUTLINE + // Return the outline object. + Outline *getOutline() { return outline; } +#endif + // Is the file encrypted? GBool isEncrypted() { return xref->isEncrypted(); } - // Are printing and copying allowed? If not, print an error message. - GBool okToPrint() { return xref->okToPrint(); } - GBool okToCopy() { return xref->okToCopy(); } + // Check various permissions. + GBool okToPrint(GBool ignoreOwnerPW = gFalse) + { return xref->okToPrint(ignoreOwnerPW); } + GBool okToChange(GBool ignoreOwnerPW = gFalse) + { return xref->okToChange(ignoreOwnerPW); } + GBool okToCopy(GBool ignoreOwnerPW = gFalse) + { return xref->okToCopy(ignoreOwnerPW); } + GBool okToAddNotes(GBool ignoreOwnerPW = gFalse) + { return xref->okToAddNotes(ignoreOwnerPW); } + + // Is this document linearized? + GBool isLinearized(); // Return the document's Info dictionary (if any). Object *getDocInfo(Object *obj) { return xref->getDocInfo(obj); } + Object *getDocInfoNF(Object *obj) { return xref->getDocInfoNF(obj); } + + // Return the PDF version specified by the file. + double getPDFVersion() { return pdfVersion; } // Save this file with another name. GBool saveAs(GString *name); private: - void getLinks(int page); + GBool setup(GString *ownerPassword, GString *userPassword); + void checkHeader(); + void getLinks(Page *page); GString *fileName; FILE *file; + BaseStream *str; + double pdfVersion; XRef *xref; Catalog *catalog; Links *links; +#ifndef DISABLE_OUTLINE + Outline *outline; +#endif GBool ok; + int errCode; }; #endif