X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;ds=inline;f=pdf%2Fxpdf%2FXRef.h;h=3f5a598e9bc058d57d888adb161747793ff879e7;hb=884f739665dc56e66f51e104350f2affd33f2dd8;hp=e2260d0c33cf9ded044ac83ee41d9f18ab74172b;hpb=7aac8dc8533347e21311b15186e0af82f1b22fd6;p=evince.git diff --git a/pdf/xpdf/XRef.h b/pdf/xpdf/XRef.h index e2260d0c..3f5a598e 100644 --- a/pdf/xpdf/XRef.h +++ b/pdf/xpdf/XRef.h @@ -2,14 +2,16 @@ // // XRef.h // -// Copyright 1996 Derek B. Noonburg +// Copyright 1996-2003 Glyph & Cog, LLC // //======================================================================== #ifndef XREF_H #define XREF_H -#ifdef __GNUC__ +#include + +#ifdef USE_GCC_PRAGMAS #pragma interface #endif @@ -24,7 +26,7 @@ class Stream; //------------------------------------------------------------------------ struct XRefEntry { - int offset; + Guint offset; int gen; GBool used; }; @@ -33,7 +35,7 @@ class XRef { public: // Constructor. Read xref table from stream. - XRef(BaseStream *str, GString *userPassword); + XRef(BaseStream *strA, GString *ownerPassword, GString *userPassword); // Destructor. ~XRef(); @@ -41,6 +43,9 @@ public: // Is xref table valid? GBool isOk() { return ok; } + // Get the error code (if isOk() returns false). + int getErrorCode() { return errCode; } + // Is the file encrypted? #ifndef NO_DECRYPTION GBool isEncrypted() { return encrypted; } @@ -49,10 +54,10 @@ public: #endif // Check various permissions. - GBool okToPrint(); - GBool okToChange(); - GBool okToCopy(); - GBool okToAddNotes(); + GBool okToPrint(GBool ignoreOwnerPW = gFalse); + GBool okToChange(GBool ignoreOwnerPW = gFalse); + GBool okToCopy(GBool ignoreOwnerPW = gFalse); + GBool okToAddNotes(GBool ignoreOwnerPW = gFalse); // Get catalog object. Object *getCatalog(Object *obj) { return fetch(rootNum, rootGen, obj); } @@ -62,51 +67,57 @@ public: // Return the document's Info dictionary (if any). Object *getDocInfo(Object *obj); + Object *getDocInfoNF(Object *obj); // Return the number of objects in the xref table. int getNumObjects() { return size; } // Return the offset of the last xref table. - int getLastXRefPos() { return lastXRefPos; } + Guint getLastXRefPos() { return lastXRefPos; } // Return the catalog object reference. int getRootNum() { return rootNum; } int getRootGen() { return rootGen; } // Get end position for a stream in a damaged file. - // Returns -1 if unknown or file is not damaged. - int getStreamEnd(int start); + // Returns false if unknown or file is not damaged. + GBool getStreamEnd(Guint streamStart, Guint *streamEnd); + + // Direct access. + int getSize() { return size; } + XRefEntry *getEntry(int i) { return &entries[i]; } + Object *getTrailerDict() { return &trailerDict; } private: BaseStream *str; // input stream - int start; // offset in file (to allow for garbage + Guint start; // offset in file (to allow for garbage // at beginning of file) XRefEntry *entries; // xref entries int size; // size of array int rootNum, rootGen; // catalog dict GBool ok; // true if xref table is valid + int errCode; // error code (if is false) Object trailerDict; // trailer dictionary - int lastXRefPos; // offset of last xref table - int *streamEnds; // 'endstream' positions - only used in + Guint lastXRefPos; // offset of last xref table + Guint *streamEnds; // 'endstream' positions - only used in // damaged files int streamEndsLen; // number of valid entries in streamEnds #ifndef NO_DECRYPTION GBool encrypted; // true if file is encrypted + int encVersion; // encryption algorithm + int encRevision; // security handler revision + int keyLength; // length of key, in bytes int permFlags; // permission bits Guchar fileKey[16]; // file decryption key + GBool ownerPasswordOk; // true if owner password is correct #endif - int readTrailer(); - GBool readXRef(int *pos); + Guint readTrailer(); + GBool readXRef(Guint *pos); GBool constructXRef(); - GBool checkEncrypted(GString *userPassword); + GBool checkEncrypted(GString *ownerPassword, GString *userPassword); + Guint strToUnsigned(char *s); }; -//------------------------------------------------------------------------ -// The global xref table -//------------------------------------------------------------------------ - -extern XRef *xref; - #endif