X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=pdf2swf%2Fxpdf%2FPDFDoc.h;h=a1f42c08d94e53797233aac4608946e25ec68c47;hb=0e6deb35dd62be9cb5b56af78c08fa3842030040;hp=c12531e9387c76bf7c89c9a8e146cb1e9e5500e8;hpb=50dd339d3d6262763616efe8d7ee415ab19befb9;p=swftools.git diff --git a/pdf2swf/xpdf/PDFDoc.h b/pdf2swf/xpdf/PDFDoc.h index c12531e..a1f42c0 100644 --- a/pdf2swf/xpdf/PDFDoc.h +++ b/pdf2swf/xpdf/PDFDoc.h @@ -2,20 +2,21 @@ // // PDFDoc.h // -// Copyright 1996-2002 Glyph & Cog, LLC +// 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" @@ -25,6 +26,7 @@ class OutputDev; class Links; class LinkAction; class LinkDest; +class Outline; //------------------------------------------------------------------------ // PDFDoc @@ -34,9 +36,13 @@ class PDFDoc { public: PDFDoc(GString *fileNameA, GString *ownerPassword = NULL, - GString *userPassword = NULL, GBool printCommandsA = gFalse); + GString *userPassword = NULL, void *guiDataA = NULL); +#ifdef WIN32 + PDFDoc(wchar_t *fileNameA, int fileNameLen, GString *ownerPassword = NULL, + GString *userPassword = NULL, void *guiDataA = NULL); +#endif PDFDoc(BaseStream *strA, GString *ownerPassword = NULL, - GString *userPassword = NULL, GBool printCommandsA = gFalse); + GString *userPassword = NULL, void *guiDataA = NULL); ~PDFDoc(); // Was PDF document successfully opened? @@ -58,10 +64,14 @@ public: BaseStream *getBaseStream() { return str; } // Get page parameters. - double getPageWidth(int page) - { return catalog->getPage(page)->getWidth(); } - double getPageHeight(int page) - { return catalog->getPage(page)->getHeight(); } + double getPageMediaWidth(int page) + { return catalog->getPage(page)->getMediaWidth(); } + double getPageMediaHeight(int page) + { return catalog->getPage(page)->getMediaHeight(); } + double getPageCropWidth(int page) + { return catalog->getPage(page)->getCropWidth(); } + double getPageCropHeight(int page) + { return catalog->getPage(page)->getCropHeight(); } int getPageRotate(int page) { return catalog->getPage(page)->getRotate(); } @@ -76,29 +86,45 @@ public: Object *getStructTreeRoot() { return catalog->getStructTreeRoot(); } // Display a page. - void displayPage(OutputDev *out, int page, double zoom, - int rotate, GBool doLinks); + void displayPage(OutputDev *out, int page, double hDPI, double vDPI, + int rotate, GBool useMediaBox, GBool crop, + GBool doLinks, + GBool (*abortCheckCbk)(void *data) = NULL, + void *abortCheckCbkData = NULL); // Display a range of pages. void displayPages(OutputDev *out, int firstPage, int lastPage, - int zoom, int rotate, GBool doLinks); + double hDPI, double vDPI, int rotate, + GBool useMediaBox, GBool crop, GBool doLinks, + GBool (*abortCheckCbk)(void *data) = NULL, + void *abortCheckCbkData = NULL); + + // Display part of a page. + void displayPageSlice(OutputDev *out, int page, + double hDPI, double vDPI, int rotate, + GBool useMediaBox, GBool crop, GBool doLinks, + int sliceX, int sliceY, int sliceW, int sliceH, + GBool (*abortCheckCbk)(void *data) = NULL, + void *abortCheckCbkData = NULL); // Find a page, given its object ID. Returns page number, or 0 if // not found. int findPage(int num, int gen) { return catalog->findPage(num, gen); } - // If point , is in a link, return the associated action; - // else return NULL. - LinkAction *findLink(double x, double y) { return links->find(x, y); } - - // Return true if , is in a link. - GBool onLink(double x, double y) { return links->onLink(x, y); } + // Returns the links for the current page, transferring ownership to + // the caller. + Links *takeLinks(); // Find a named destination. Returns the link destination, or // NULL if is not a destination. 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(); } @@ -117,6 +143,7 @@ public: // 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; } @@ -124,20 +151,29 @@ public: // Save this file with another name. GBool saveAs(GString *name); + // Return a pointer to the GUI (XPDFCore or WinPDFCore object). + void *getGUIData() { return guiData; } + + private: GBool setup(GString *ownerPassword, GString *userPassword); void checkHeader(); + GBool checkEncryption(GString *ownerPassword, GString *userPassword); void getLinks(Page *page); GString *fileName; FILE *file; BaseStream *str; + void *guiData; double pdfVersion; XRef *xref; Catalog *catalog; Links *links; - GBool printCommands; +#ifndef DISABLE_OUTLINE + Outline *outline; +#endif + GBool ok; int errCode;