diff options
author | Martin Kretzschmar <mkretzschmar@src.gnome.org> | 2002-09-18 20:32:18 (GMT) |
---|---|---|
committer | Martin Kretzschmar <mkretzschmar@src.gnome.org> | 2002-09-18 20:32:18 (GMT) |
commit | 7aac8dc8533347e21311b15186e0af82f1b22fd6 (patch) | |
tree | 02650bb02c8a1d8468c22f50ff151885d233016b /pdf/xpdf/XRef.h | |
parent | d99fb4f4acd14fcdbda968abd907547dcc7af40c (diff) |
Synched with Xpdf 0.92
this adds "decryption" support
testing this code after six weeks immediately gives me segfaults (image drawing) :-O
must have fixed that later without knowing :-O
Diffstat (limited to 'pdf/xpdf/XRef.h')
-rw-r--r-- | pdf/xpdf/XRef.h | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/pdf/xpdf/XRef.h b/pdf/xpdf/XRef.h index 8e947e4..e2260d0 100644 --- a/pdf/xpdf/XRef.h +++ b/pdf/xpdf/XRef.h @@ -33,7 +33,7 @@ class XRef { public: // Constructor. Read xref table from stream. - XRef(BaseStream *str); + XRef(BaseStream *str, GString *userPassword); // Destructor. ~XRef(); @@ -42,11 +42,17 @@ public: GBool isOk() { return ok; } // Is the file encrypted? +#ifndef NO_DECRYPTION + GBool isEncrypted() { return encrypted; } +#else GBool isEncrypted() { return gFalse; } +#endif - // Are printing and copying allowed? If not, print an error message. + // Check various permissions. GBool okToPrint(); + GBool okToChange(); GBool okToCopy(); + GBool okToAddNotes(); // Get catalog object. Object *getCatalog(Object *obj) { return fetch(rootNum, rootGen, obj); } @@ -57,6 +63,20 @@ public: // Return the document's Info dictionary (if any). Object *getDocInfo(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; } + + // 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); + private: BaseStream *str; // input stream @@ -67,11 +87,20 @@ private: int rootNum, rootGen; // catalog dict GBool ok; // true if xref table is valid Object trailerDict; // trailer dictionary + int lastXRefPos; // offset of last xref table + int *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 permFlags; // permission bits + Guchar fileKey[16]; // file decryption key +#endif int readTrailer(); GBool readXRef(int *pos); GBool constructXRef(); - GBool checkEncrypted(); + GBool checkEncrypted(GString *userPassword); }; //------------------------------------------------------------------------ |