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