| 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_EDIT_CPDF_CREATOR_H_ | 7 #ifndef CORE_FPDFAPI_EDIT_CPDF_CREATOR_H_ |
| 8 #define CORE_FPDFAPI_EDIT_CPDF_CREATOR_H_ | 8 #define CORE_FPDFAPI_EDIT_CPDF_CREATOR_H_ |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 CFX_ByteTextBuf& operator<<(CFX_ByteTextBuf& buf, const CPDF_Object* pObj); | 27 CFX_ByteTextBuf& operator<<(CFX_ByteTextBuf& buf, const CPDF_Object* pObj); |
| 28 | 28 |
| 29 class CPDF_Creator { | 29 class CPDF_Creator { |
| 30 public: | 30 public: |
| 31 explicit CPDF_Creator(CPDF_Document* pDoc); | 31 explicit CPDF_Creator(CPDF_Document* pDoc); |
| 32 ~CPDF_Creator(); | 32 ~CPDF_Creator(); |
| 33 | 33 |
| 34 void RemoveSecurity(); | 34 void RemoveSecurity(); |
| 35 bool Create(IFX_WriteStream* pFile, uint32_t flags = 0); | 35 bool Create(IFX_WriteStream* pFile, uint32_t flags = 0); |
| 36 int32_t Continue(IFX_Pause* pPause = nullptr); | 36 int32_t Continue(IFX_Pause* pPause = nullptr); |
| 37 FX_BOOL SetFileVersion(int32_t fileVersion = 17); | 37 bool SetFileVersion(int32_t fileVersion = 17); |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 friend class CPDF_ObjectStream; | 40 friend class CPDF_ObjectStream; |
| 41 friend class CPDF_XRefStream; | 41 friend class CPDF_XRefStream; |
| 42 | 42 |
| 43 bool Create(uint32_t flags); | 43 bool Create(uint32_t flags); |
| 44 void ResetStandardSecurity(); | 44 void ResetStandardSecurity(); |
| 45 void Clear(); | 45 void Clear(); |
| 46 | 46 |
| 47 void InitOldObjNumOffsets(); | 47 void InitOldObjNumOffsets(); |
| 48 void InitNewObjNumOffsets(); | 48 void InitNewObjNumOffsets(); |
| 49 void InitID(FX_BOOL bDefault = TRUE); | 49 void InitID(bool bDefault = true); |
| 50 | 50 |
| 51 void AppendNewObjNum(uint32_t objbum); | 51 void AppendNewObjNum(uint32_t objbum); |
| 52 int32_t AppendObjectNumberToXRef(uint32_t objnum); | 52 int32_t AppendObjectNumberToXRef(uint32_t objnum); |
| 53 | 53 |
| 54 int32_t WriteDoc_Stage1(IFX_Pause* pPause); | 54 int32_t WriteDoc_Stage1(IFX_Pause* pPause); |
| 55 int32_t WriteDoc_Stage2(IFX_Pause* pPause); | 55 int32_t WriteDoc_Stage2(IFX_Pause* pPause); |
| 56 int32_t WriteDoc_Stage3(IFX_Pause* pPause); | 56 int32_t WriteDoc_Stage3(IFX_Pause* pPause); |
| 57 int32_t WriteDoc_Stage4(IFX_Pause* pPause); | 57 int32_t WriteDoc_Stage4(IFX_Pause* pPause); |
| 58 | 58 |
| 59 int32_t WriteOldIndirectObject(uint32_t objnum); | 59 int32_t WriteOldIndirectObject(uint32_t objnum); |
| 60 int32_t WriteOldObjs(IFX_Pause* pPause); | 60 int32_t WriteOldObjs(IFX_Pause* pPause); |
| 61 int32_t WriteNewObjs(FX_BOOL bIncremental, IFX_Pause* pPause); | 61 int32_t WriteNewObjs(bool bIncremental, IFX_Pause* pPause); |
| 62 int32_t WriteIndirectObj(const CPDF_Object* pObj); | 62 int32_t WriteIndirectObj(const CPDF_Object* pObj); |
| 63 int32_t WriteDirectObj(uint32_t objnum, | 63 int32_t WriteDirectObj(uint32_t objnum, |
| 64 const CPDF_Object* pObj, | 64 const CPDF_Object* pObj, |
| 65 FX_BOOL bEncrypt = TRUE); | 65 bool bEncrypt = true); |
| 66 int32_t WriteIndirectObjectToStream(const CPDF_Object* pObj); | 66 int32_t WriteIndirectObjectToStream(const CPDF_Object* pObj); |
| 67 int32_t WriteIndirectObj(uint32_t objnum, const CPDF_Object* pObj); | 67 int32_t WriteIndirectObj(uint32_t objnum, const CPDF_Object* pObj); |
| 68 int32_t WriteIndirectObjectToStream(uint32_t objnum, | 68 int32_t WriteIndirectObjectToStream(uint32_t objnum, |
| 69 const uint8_t* pBuffer, | 69 const uint8_t* pBuffer, |
| 70 uint32_t dwSize); | 70 uint32_t dwSize); |
| 71 | 71 |
| 72 int32_t WriteStream(const CPDF_Object* pStream, | 72 int32_t WriteStream(const CPDF_Object* pStream, |
| 73 uint32_t objnum, | 73 uint32_t objnum, |
| 74 CPDF_CryptoHandler* pCrypto); | 74 CPDF_CryptoHandler* pCrypto); |
| 75 | 75 |
| 76 CPDF_Document* const m_pDocument; | 76 CPDF_Document* const m_pDocument; |
| 77 CPDF_Parser* const m_pParser; | 77 CPDF_Parser* const m_pParser; |
| 78 FX_BOOL m_bSecurityChanged; | 78 bool m_bSecurityChanged; |
| 79 CPDF_Dictionary* m_pEncryptDict; | 79 CPDF_Dictionary* m_pEncryptDict; |
| 80 uint32_t m_dwEncryptObjNum; | 80 uint32_t m_dwEncryptObjNum; |
| 81 FX_BOOL m_bEncryptCloned; | 81 bool m_bEncryptCloned; |
| 82 CPDF_CryptoHandler* m_pCryptoHandler; | 82 CPDF_CryptoHandler* m_pCryptoHandler; |
| 83 // Whether this owns the crypto handler |m_pCryptoHandler|. | 83 // Whether this owns the crypto handler |m_pCryptoHandler|. |
| 84 FX_BOOL m_bLocalCryptoHandler; | 84 bool m_bLocalCryptoHandler; |
| 85 CPDF_Object* m_pMetadata; | 85 CPDF_Object* m_pMetadata; |
| 86 std::unique_ptr<CPDF_XRefStream> m_pXRefStream; | 86 std::unique_ptr<CPDF_XRefStream> m_pXRefStream; |
| 87 int32_t m_ObjectStreamSize; | 87 int32_t m_ObjectStreamSize; |
| 88 uint32_t m_dwLastObjNum; | 88 uint32_t m_dwLastObjNum; |
| 89 CFX_FileBufferArchive m_File; | 89 CFX_FileBufferArchive m_File; |
| 90 FX_FILESIZE m_Offset; | 90 FX_FILESIZE m_Offset; |
| 91 int32_t m_iStage; | 91 int32_t m_iStage; |
| 92 uint32_t m_dwFlags; | 92 uint32_t m_dwFlags; |
| 93 FX_POSITION m_Pos; | 93 FX_POSITION m_Pos; |
| 94 FX_FILESIZE m_XrefStart; | 94 FX_FILESIZE m_XrefStart; |
| 95 CFX_FileSizeListArray m_ObjectOffset; | 95 CFX_FileSizeListArray m_ObjectOffset; |
| 96 CFX_ArrayTemplate<uint32_t> m_NewObjNumArray; | 96 CFX_ArrayTemplate<uint32_t> m_NewObjNumArray; |
| 97 std::unique_ptr<CPDF_Array, ReleaseDeleter<CPDF_Array>> m_pIDArray; | 97 std::unique_ptr<CPDF_Array, ReleaseDeleter<CPDF_Array>> m_pIDArray; |
| 98 int32_t m_FileVersion; | 98 int32_t m_FileVersion; |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 #endif // CORE_FPDFAPI_EDIT_CPDF_CREATOR_H_ | 101 #endif // CORE_FPDFAPI_EDIT_CPDF_CREATOR_H_ |
| OLD | NEW |