OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef CORE_INCLUDE_FPDFAPI_FPDF_SERIAL_H_ | 7 #ifndef CORE_INCLUDE_FPDFAPI_FPDF_SERIAL_H_ |
8 #define CORE_INCLUDE_FPDFAPI_FPDF_SERIAL_H_ | 8 #define CORE_INCLUDE_FPDFAPI_FPDF_SERIAL_H_ |
9 | 9 |
10 #include "fpdf_page.h" | 10 #include "fpdf_page.h" |
11 #include "fpdf_pageobj.h" | 11 #include "fpdf_pageobj.h" |
12 | 12 |
13 class CPDF_ObjectStream; | 13 class CPDF_ObjectStream; |
14 class CPDF_XRefStream; | 14 class CPDF_XRefStream; |
15 CFX_ByteTextBuf& operator << (CFX_ByteTextBuf& buf, const CPDF_Object* pObj); | 15 CFX_ByteTextBuf& operator<<(CFX_ByteTextBuf& buf, const CPDF_Object* pObj); |
16 #define FPDFCREATE_INCREMENTAL» » 1 | 16 #define FPDFCREATE_INCREMENTAL 1 |
17 #define FPDFCREATE_NO_ORIGINAL» » 2 | 17 #define FPDFCREATE_NO_ORIGINAL 2 |
18 #define FPDFCREATE_PROGRESSIVE» » 4 | 18 #define FPDFCREATE_PROGRESSIVE 4 |
19 #define FPDFCREATE_OBJECTSTREAM»» 8 | 19 #define FPDFCREATE_OBJECTSTREAM 8 |
20 class CPDF_Creator | 20 class CPDF_Creator { |
21 { | 21 public: |
22 public: | 22 CPDF_Creator(CPDF_Document* pDoc); |
23 | 23 |
24 CPDF_Creator(CPDF_Document* pDoc); | 24 ~CPDF_Creator(); |
25 | 25 |
26 ~CPDF_Creator(); | 26 void RemoveSecurity(); |
27 | 27 |
28 void» » » » RemoveSecurity(); | 28 FX_BOOL Create(const FX_WCHAR* filename, FX_DWORD flags = 0); |
29 | 29 |
30 FX_BOOL» » » » Create(const FX_WCHAR* filename, FX_DWOR
D flags = 0); | 30 FX_BOOL Create(const FX_CHAR* filename, FX_DWORD flags = 0); |
31 | 31 |
32 FX_BOOL» » » » Create(const FX_CHAR* filename, FX_DWORD
flags = 0); | 32 FX_BOOL Create(IFX_StreamWrite* pFile, FX_DWORD flags = 0); |
33 | 33 |
34 FX_BOOL» » » » Create(IFX_StreamWrite* pFile, FX_DWORD
flags = 0); | 34 int32_t Continue(IFX_Pause* pPause = NULL); |
35 | 35 |
36 int32_t» » » Continue(IFX_Pause *pPause = NULL); | 36 FX_BOOL SetFileVersion(int32_t fileVersion = 17); |
37 | 37 |
38 FX_BOOL» » » » SetFileVersion(int32_t fileVersion = 17)
; | 38 protected: |
39 protected: | 39 CPDF_Document* m_pDocument; |
40 | 40 |
41 CPDF_Document*» » m_pDocument; | 41 CPDF_Parser* m_pParser; |
42 | 42 |
43 CPDF_Parser*» » m_pParser; | 43 FX_BOOL m_bCompress; |
44 | 44 |
45 FX_BOOL» » » » m_bCompress; | 45 FX_BOOL m_bSecurityChanged; |
46 | 46 |
47 FX_BOOL» » » » m_bSecurityChanged; | 47 CPDF_Dictionary* m_pEncryptDict; |
| 48 FX_DWORD m_dwEnryptObjNum; |
| 49 FX_BOOL m_bEncryptCloned; |
48 | 50 |
49 CPDF_Dictionary*» m_pEncryptDict; | 51 FX_BOOL m_bStandardSecurity; |
50 FX_DWORD» » » m_dwEnryptObjNum; | |
51 FX_BOOL» » » » m_bEncryptCloned; | |
52 | 52 |
53 FX_BOOL» » » » m_bStandardSecurity; | 53 CPDF_CryptoHandler* m_pCryptoHandler; |
| 54 FX_BOOL m_bNewCrypto; |
54 | 55 |
55 CPDF_CryptoHandler*»m_pCryptoHandler; | 56 FX_BOOL m_bEncryptMetadata; |
56 FX_BOOL» » » » m_bNewCrypto; | |
57 | 57 |
58 FX_BOOL» » » » m_bEncryptMetadata; | 58 CPDF_Object* m_pMetadata; |
59 | 59 |
60 CPDF_Object*» » m_pMetadata; | 60 CPDF_XRefStream* m_pXRefStream; |
61 | 61 |
62 CPDF_XRefStream*» m_pXRefStream; | 62 int32_t m_ObjectStreamSize; |
63 | 63 |
64 int32_t» » » m_ObjectStreamSize; | 64 FX_DWORD m_dwLastObjNum; |
| 65 FX_BOOL Create(FX_DWORD flags); |
| 66 void ResetStandardSecurity(); |
| 67 void Clear(); |
| 68 int32_t WriteDoc_Stage1(IFX_Pause* pPause); |
| 69 int32_t WriteDoc_Stage2(IFX_Pause* pPause); |
| 70 int32_t WriteDoc_Stage3(IFX_Pause* pPause); |
| 71 int32_t WriteDoc_Stage4(IFX_Pause* pPause); |
65 | 72 |
66 FX_DWORD» » » m_dwLastObjNum; | 73 CFX_FileBufferArchive m_File; |
67 FX_BOOL» » » » Create(FX_DWORD flags); | |
68 void» » » » ResetStandardSecurity(); | |
69 void» » » » Clear(); | |
70 int32_t» » » WriteDoc_Stage1(IFX_Pause *pPause); | |
71 int32_t» » » WriteDoc_Stage2(IFX_Pause *pPause); | |
72 int32_t» » » WriteDoc_Stage3(IFX_Pause *pPause); | |
73 int32_t» » » WriteDoc_Stage4(IFX_Pause *pPause); | |
74 | 74 |
75 CFX_FileBufferArchive» m_File; | 75 FX_FILESIZE m_Offset; |
| 76 void InitOldObjNumOffsets(); |
| 77 void InitNewObjNumOffsets(); |
| 78 void AppendNewObjNum(FX_DWORD objbum); |
| 79 int32_t WriteOldIndirectObject(FX_DWORD objnum); |
| 80 int32_t WriteOldObjs(IFX_Pause* pPause); |
| 81 int32_t WriteNewObjs(FX_BOOL bIncremental, IFX_Pause* pPause); |
| 82 int32_t WriteIndirectObj(const CPDF_Object* pObj); |
| 83 int32_t WriteDirectObj(FX_DWORD objnum, |
| 84 const CPDF_Object* pObj, |
| 85 FX_BOOL bEncrypt = TRUE); |
| 86 int32_t WriteIndirectObjectToStream(const CPDF_Object* pObj); |
| 87 int32_t WriteIndirectObj(FX_DWORD objnum, const CPDF_Object* pObj); |
| 88 int32_t WriteIndirectObjectToStream(FX_DWORD objnum, |
| 89 const uint8_t* pBuffer, |
| 90 FX_DWORD dwSize); |
| 91 int32_t AppendObjectNumberToXRef(FX_DWORD objnum); |
| 92 void InitID(FX_BOOL bDefault = TRUE); |
| 93 int32_t WriteStream(const CPDF_Object* pStream, |
| 94 FX_DWORD objnum, |
| 95 CPDF_CryptoHandler* pCrypto); |
76 | 96 |
77 FX_FILESIZE»» » m_Offset; | 97 int32_t m_iStage; |
78 void» » » » InitOldObjNumOffsets(); | 98 FX_DWORD m_dwFlags; |
79 void» » » » InitNewObjNumOffsets(); | 99 FX_POSITION m_Pos; |
80 void» » » » AppendNewObjNum(FX_DWORD objbum); | 100 FX_FILESIZE m_XrefStart; |
81 int32_t» » » WriteOldIndirectObject(FX_DWORD objnum); | |
82 int32_t» » » WriteOldObjs(IFX_Pause *pPause); | |
83 int32_t» » » WriteNewObjs(FX_BOOL bIncremental, IFX_Pause *pP
ause); | |
84 int32_t» » » WriteIndirectObj(const CPDF_Object* pObj); | |
85 int32_t» » » WriteDirectObj(FX_DWORD objnum, const CPDF_Objec
t* pObj, FX_BOOL bEncrypt = TRUE); | |
86 int32_t» » » WriteIndirectObjectToStream(const CPDF_Object* p
Obj); | |
87 int32_t» » » WriteIndirectObj(FX_DWORD objnum, const CPDF_Obj
ect* pObj); | |
88 int32_t» » » WriteIndirectObjectToStream(FX_DWORD objnum, con
st uint8_t* pBuffer, FX_DWORD dwSize); | |
89 int32_t» » » AppendObjectNumberToXRef(FX_DWORD objnum); | |
90 void» » » » InitID(FX_BOOL bDefault = TRUE); | |
91 int32_t» » » WriteStream(const CPDF_Object* pStream, FX_DWORD
objnum, CPDF_CryptoHandler* pCrypto); | |
92 | 101 |
93 int32_t» » » m_iStage; | 102 CFX_FileSizeListArray m_ObjectOffset; |
94 FX_DWORD» » » m_dwFlags; | |
95 FX_POSITION»» » m_Pos; | |
96 FX_FILESIZE»» » m_XrefStart; | |
97 | 103 |
98 CFX_FileSizeListArray» m_ObjectOffset; | 104 CFX_DWordListArray m_ObjectSize; |
| 105 CFX_DWordArray m_NewObjNumArray; |
99 | 106 |
100 CFX_DWordListArray» » m_ObjectSize; | 107 CPDF_Array* m_pIDArray; |
101 CFX_DWordArray» » m_NewObjNumArray; | |
102 | 108 |
103 CPDF_Array*»» » m_pIDArray; | 109 int32_t m_FileVersion; |
104 | 110 friend class CPDF_ObjectStream; |
105 int32_t» » » m_FileVersion; | 111 friend class CPDF_XRefStream; |
106 friend class CPDF_ObjectStream; | |
107 friend class CPDF_XRefStream; | |
108 }; | 112 }; |
109 | 113 |
110 #endif // CORE_INCLUDE_FPDFAPI_FPDF_SERIAL_H_ | 114 #endif // CORE_INCLUDE_FPDFAPI_FPDF_SERIAL_H_ |
OLD | NEW |