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_FPDFAPI_FPDF_EDIT_INCLUDE_CPDF_CREATOR_H_ | 7 #ifndef CORE_FPDFAPI_FPDF_EDIT_INCLUDE_CPDF_CREATOR_H_ |
8 #define CORE_FPDFAPI_FPDF_EDIT_INCLUDE_CPDF_CREATOR_H_ | 8 #define CORE_FPDFAPI_FPDF_EDIT_INCLUDE_CPDF_CREATOR_H_ |
9 | 9 |
| 10 #include <memory> |
| 11 |
10 #include "core/fxcrt/include/fx_basic.h" | 12 #include "core/fxcrt/include/fx_basic.h" |
11 | 13 |
12 class CPDF_Array; | 14 class CPDF_Array; |
13 class CPDF_CryptoHandler; | 15 class CPDF_CryptoHandler; |
14 class CPDF_Dictionary; | 16 class CPDF_Dictionary; |
15 class CPDF_Document; | 17 class CPDF_Document; |
16 class CPDF_Object; | 18 class CPDF_Object; |
17 class CPDF_Parser; | 19 class CPDF_Parser; |
18 class CPDF_XRefStream; | 20 class CPDF_XRefStream; |
19 | 21 |
20 #define FPDFCREATE_INCREMENTAL 1 | 22 #define FPDFCREATE_INCREMENTAL 1 |
21 #define FPDFCREATE_NO_ORIGINAL 2 | 23 #define FPDFCREATE_NO_ORIGINAL 2 |
22 #define FPDFCREATE_PROGRESSIVE 4 | 24 #define FPDFCREATE_PROGRESSIVE 4 |
23 #define FPDFCREATE_OBJECTSTREAM 8 | 25 #define FPDFCREATE_OBJECTSTREAM 8 |
24 | 26 |
25 CFX_ByteTextBuf& operator<<(CFX_ByteTextBuf& buf, const CPDF_Object* pObj); | 27 CFX_ByteTextBuf& operator<<(CFX_ByteTextBuf& buf, const CPDF_Object* pObj); |
26 | 28 |
27 class CPDF_Creator { | 29 class CPDF_Creator { |
28 public: | 30 public: |
29 CPDF_Creator(CPDF_Document* pDoc); | 31 explicit CPDF_Creator(CPDF_Document* pDoc); |
30 ~CPDF_Creator(); | 32 ~CPDF_Creator(); |
31 | 33 |
32 void RemoveSecurity(); | 34 void RemoveSecurity(); |
33 bool Create(IFX_StreamWrite* pFile, uint32_t flags = 0); | 35 bool Create(IFX_StreamWrite* pFile, uint32_t flags = 0); |
34 int32_t Continue(IFX_Pause* pPause = NULL); | 36 int32_t Continue(IFX_Pause* pPause = NULL); |
35 FX_BOOL SetFileVersion(int32_t fileVersion = 17); | 37 FX_BOOL SetFileVersion(int32_t fileVersion = 17); |
36 | 38 |
37 private: | 39 private: |
38 friend class CPDF_ObjectStream; | 40 friend class CPDF_ObjectStream; |
39 friend class CPDF_XRefStream; | 41 friend class CPDF_XRefStream; |
(...skipping 24 matching lines...) Expand all Loading... |
64 int32_t WriteIndirectObjectToStream(const CPDF_Object* pObj); | 66 int32_t WriteIndirectObjectToStream(const CPDF_Object* pObj); |
65 int32_t WriteIndirectObj(uint32_t objnum, const CPDF_Object* pObj); | 67 int32_t WriteIndirectObj(uint32_t objnum, const CPDF_Object* pObj); |
66 int32_t WriteIndirectObjectToStream(uint32_t objnum, | 68 int32_t WriteIndirectObjectToStream(uint32_t objnum, |
67 const uint8_t* pBuffer, | 69 const uint8_t* pBuffer, |
68 uint32_t dwSize); | 70 uint32_t dwSize); |
69 | 71 |
70 int32_t WriteStream(const CPDF_Object* pStream, | 72 int32_t WriteStream(const CPDF_Object* pStream, |
71 uint32_t objnum, | 73 uint32_t objnum, |
72 CPDF_CryptoHandler* pCrypto); | 74 CPDF_CryptoHandler* pCrypto); |
73 | 75 |
74 CPDF_Document* m_pDocument; | 76 CPDF_Document* const m_pDocument; |
75 CPDF_Parser* m_pParser; | 77 CPDF_Parser* const m_pParser; |
76 FX_BOOL m_bCompress; | |
77 FX_BOOL m_bSecurityChanged; | 78 FX_BOOL m_bSecurityChanged; |
78 CPDF_Dictionary* m_pEncryptDict; | 79 CPDF_Dictionary* m_pEncryptDict; |
79 uint32_t m_dwEnryptObjNum; | 80 uint32_t m_dwEncryptObjNum; |
80 FX_BOOL m_bEncryptCloned; | 81 FX_BOOL m_bEncryptCloned; |
81 CPDF_CryptoHandler* m_pCryptoHandler; | 82 CPDF_CryptoHandler* m_pCryptoHandler; |
82 FX_BOOL m_bLocalCryptoHandler; | 83 FX_BOOL m_bLocalCryptoHandler; |
83 FX_BOOL m_bEncryptMetadata; | |
84 CPDF_Object* m_pMetadata; | 84 CPDF_Object* m_pMetadata; |
85 CPDF_XRefStream* m_pXRefStream; | 85 std::unique_ptr<CPDF_XRefStream> m_pXRefStream; |
86 int32_t m_ObjectStreamSize; | 86 int32_t m_ObjectStreamSize; |
87 uint32_t m_dwLastObjNum; | 87 uint32_t m_dwLastObjNum; |
88 CFX_FileBufferArchive m_File; | 88 CFX_FileBufferArchive m_File; |
89 FX_FILESIZE m_Offset; | 89 FX_FILESIZE m_Offset; |
90 int32_t m_iStage; | 90 int32_t m_iStage; |
91 uint32_t m_dwFlags; | 91 uint32_t m_dwFlags; |
92 FX_POSITION m_Pos; | 92 FX_POSITION m_Pos; |
93 FX_FILESIZE m_XrefStart; | 93 FX_FILESIZE m_XrefStart; |
94 CFX_FileSizeListArray m_ObjectOffset; | 94 CFX_FileSizeListArray m_ObjectOffset; |
95 CFX_ArrayTemplate<uint32_t> m_NewObjNumArray; | 95 CFX_ArrayTemplate<uint32_t> m_NewObjNumArray; |
96 CPDF_Array* m_pIDArray; | 96 CPDF_Array* m_pIDArray; |
97 int32_t m_FileVersion; | 97 int32_t m_FileVersion; |
98 }; | 98 }; |
99 | 99 |
100 #endif // CORE_FPDFAPI_FPDF_EDIT_INCLUDE_CPDF_CREATOR_H_ | 100 #endif // CORE_FPDFAPI_FPDF_EDIT_INCLUDE_CPDF_CREATOR_H_ |
OLD | NEW |