| 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_EDITINT_H_ | 7 #ifndef CORE_FPDFAPI_FPDF_EDIT_EDITINT_H_ |
| 8 #define CORE_FPDFAPI_FPDF_EDIT_EDITINT_H_ | 8 #define CORE_FPDFAPI_FPDF_EDIT_EDITINT_H_ |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "core/fxcrt/include/fx_basic.h" | 12 #include "core/fxcrt/include/fx_basic.h" |
| 13 #include "core/fxcrt/include/fx_stream.h" | 13 #include "core/fxcrt/include/fx_stream.h" |
| 14 #include "core/fxcrt/include/fx_system.h" | 14 #include "core/fxcrt/include/fx_system.h" |
| 15 | 15 |
| 16 class CPDF_Creator; | 16 class CPDF_Creator; |
| 17 class CPDF_Object; | 17 class CPDF_Object; |
| 18 | 18 |
| 19 class CPDF_ObjectStream { | 19 class CPDF_ObjectStream { |
| 20 public: | 20 public: |
| 21 struct Item { | 21 struct Item { |
| 22 uint32_t objnum; | 22 uint32_t objnum; |
| 23 FX_STRSIZE offset; | 23 FX_STRSIZE offset; |
| 24 }; | 24 }; |
| 25 | 25 |
| 26 CPDF_ObjectStream(); | 26 CPDF_ObjectStream(); |
| 27 ~CPDF_ObjectStream(); |
| 27 | 28 |
| 28 void Start(); | 29 void Start(); |
| 29 FX_FILESIZE End(CPDF_Creator* pCreator); | 30 FX_FILESIZE End(CPDF_Creator* pCreator); |
| 30 void CompressIndirectObject(uint32_t dwObjNum, const CPDF_Object* pObj); | 31 void CompressIndirectObject(uint32_t dwObjNum, const CPDF_Object* pObj); |
| 31 void CompressIndirectObject(uint32_t dwObjNum, | 32 void CompressIndirectObject(uint32_t dwObjNum, |
| 32 const uint8_t* pBuffer, | 33 const uint8_t* pBuffer, |
| 33 uint32_t dwSize); | 34 uint32_t dwSize); |
| 34 | 35 |
| 35 std::vector<Item> m_Items; | 36 std::vector<Item> m_Items; |
| 36 CFX_ByteTextBuf m_Buffer; | 37 CFX_ByteTextBuf m_Buffer; |
| 37 uint32_t m_dwObjNum; | 38 uint32_t m_dwObjNum; |
| 38 int32_t m_index; | 39 int32_t m_index; |
| 39 }; | 40 }; |
| 40 | 41 |
| 41 class CPDF_XRefStream { | 42 class CPDF_XRefStream { |
| 42 public: | 43 public: |
| 43 struct Index { | 44 struct Index { |
| 44 uint32_t objnum; | 45 uint32_t objnum; |
| 45 uint32_t count; | 46 uint32_t count; |
| 46 }; | 47 }; |
| 47 | 48 |
| 48 CPDF_XRefStream(); | 49 CPDF_XRefStream(); |
| 50 ~CPDF_XRefStream(); |
| 49 | 51 |
| 50 FX_BOOL Start(); | 52 FX_BOOL Start(); |
| 51 int32_t CompressIndirectObject(uint32_t dwObjNum, | 53 int32_t CompressIndirectObject(uint32_t dwObjNum, |
| 52 const CPDF_Object* pObj, | 54 const CPDF_Object* pObj, |
| 53 CPDF_Creator* pCreator); | 55 CPDF_Creator* pCreator); |
| 54 int32_t CompressIndirectObject(uint32_t dwObjNum, | 56 int32_t CompressIndirectObject(uint32_t dwObjNum, |
| 55 const uint8_t* pBuffer, | 57 const uint8_t* pBuffer, |
| 56 uint32_t dwSize, | 58 uint32_t dwSize, |
| 57 CPDF_Creator* pCreator); | 59 CPDF_Creator* pCreator); |
| 58 FX_BOOL End(CPDF_Creator* pCreator, FX_BOOL bEOF = FALSE); | 60 FX_BOOL End(CPDF_Creator* pCreator, FX_BOOL bEOF = FALSE); |
| 59 void AddObjectNumberToIndexArray(uint32_t objnum); | 61 void AddObjectNumberToIndexArray(uint32_t objnum); |
| 60 FX_BOOL EndXRefStream(CPDF_Creator* pCreator); | 62 FX_BOOL EndXRefStream(CPDF_Creator* pCreator); |
| 61 | 63 |
| 62 std::vector<Index> m_IndexArray; | 64 std::vector<Index> m_IndexArray; |
| 63 FX_FILESIZE m_PrevOffset; | 65 FX_FILESIZE m_PrevOffset; |
| 64 uint32_t m_dwTempObjNum; | 66 uint32_t m_dwTempObjNum; |
| 65 | 67 |
| 66 protected: | 68 protected: |
| 67 int32_t EndObjectStream(CPDF_Creator* pCreator, FX_BOOL bEOF = TRUE); | 69 int32_t EndObjectStream(CPDF_Creator* pCreator, FX_BOOL bEOF = TRUE); |
| 68 FX_BOOL GenerateXRefStream(CPDF_Creator* pCreator, FX_BOOL bEOF); | 70 FX_BOOL GenerateXRefStream(CPDF_Creator* pCreator, FX_BOOL bEOF); |
| 71 |
| 69 size_t m_iSeg; | 72 size_t m_iSeg; |
| 70 CPDF_ObjectStream m_ObjStream; | 73 CPDF_ObjectStream m_ObjStream; |
| 71 CFX_ByteTextBuf m_Buffer; | 74 CFX_ByteTextBuf m_Buffer; |
| 72 }; | 75 }; |
| 73 | 76 |
| 74 #endif // CORE_FPDFAPI_FPDF_EDIT_EDITINT_H_ | 77 #endif // CORE_FPDFAPI_FPDF_EDIT_EDITINT_H_ |
| OLD | NEW |