X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;ds=sidebyside;f=pdf2swf%2Fxpdf%2FXRef.h;h=f9dede3e70c33f1374688c6124e70df04af1af28;hb=f3bc04e70501213ea1d9d2aa22d5c2fa550dab3f;hp=7876fa6c5807473a69ad69e9c181fcd14d499abd;hpb=50dd339d3d6262763616efe8d7ee415ab19befb9;p=swftools.git diff --git a/pdf2swf/xpdf/XRef.h b/pdf2swf/xpdf/XRef.h index 7876fa6..f9dede3 100644 --- a/pdf2swf/xpdf/XRef.h +++ b/pdf2swf/xpdf/XRef.h @@ -2,14 +2,16 @@ // // XRef.h // -// Copyright 1996-2002 Glyph & Cog, LLC +// Copyright 1996-2003 Glyph & Cog, LLC // //======================================================================== #ifndef XREF_H #define XREF_H -#ifdef __GNUC__ +#include + +#ifdef USE_GCC_PRAGMAS #pragma interface #endif @@ -18,22 +20,30 @@ class Dict; class Stream; +class Parser; +class ObjectStream; //------------------------------------------------------------------------ // XRef //------------------------------------------------------------------------ +enum XRefEntryType { + xrefEntryFree, + xrefEntryUncompressed, + xrefEntryCompressed +}; + struct XRefEntry { Guint offset; int gen; - GBool used; + XRefEntryType type; }; class XRef { public: // Constructor. Read xref table from stream. - XRef(BaseStream *strA, GString *ownerPassword, GString *userPassword); + XRef(BaseStream *strA); // Destructor. ~XRef(); @@ -44,12 +54,12 @@ public: // Get the error code (if isOk() returns false). int getErrorCode() { return errCode; } + // Set the encryption parameters. + void setEncryption(int permFlagsA, GBool ownerPasswordOkA, + Guchar *fileKeyA, int keyLengthA, int encVersionA); + // Is the file encrypted? -#ifndef NO_DECRYPTION GBool isEncrypted() { return encrypted; } -#else - GBool isEncrypted() { return gFalse; } -#endif // Check various permissions. GBool okToPrint(GBool ignoreOwnerPW = gFalse); @@ -81,6 +91,11 @@ public: // 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 @@ -96,20 +111,20 @@ private: Guint *streamEnds; // 'endstream' positions - only used in // damaged files int streamEndsLen; // number of valid entries in streamEnds -#ifndef NO_DECRYPTION + ObjectStream *objStr; // cached object stream 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 + Guchar fileKey[16]; // file decryption key + int keyLength; // length of key, in bytes + int encVersion; // encryption algorithm - Guint readTrailer(); + Guint getStartXref(); GBool readXRef(Guint *pos); + GBool readXRefTable(Parser *parser, Guint *pos); + GBool readXRefStreamSection(Stream *xrefStr, int *w, int first, int n); + GBool readXRefStream(Stream *xrefStr, Guint *pos); GBool constructXRef(); - GBool checkEncrypted(GString *ownerPassword, GString *userPassword); Guint strToUnsigned(char *s); };