• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_SRC_FPDFAPI_FPDF_EDIT_EDITINT_H_
8 #define CORE_SRC_FPDFAPI_FPDF_EDIT_EDITINT_H_
9 
10 #include "core/include/fxcrt/fx_basic.h"
11 #include "core/include/fxcrt/fx_stream.h"
12 #include "core/include/fxcrt/fx_system.h"
13 
14 class CPDF_Creator;
15 class CPDF_Object;
16 
17 class CPDF_ObjectStream {
18  public:
19   CPDF_ObjectStream();
20 
21   FX_BOOL Start();
22 
23   int32_t CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object* pObj);
24   int32_t CompressIndirectObject(FX_DWORD dwObjNum,
25                                  const uint8_t* pBuffer,
26                                  FX_DWORD dwSize);
27 
28   FX_FILESIZE End(CPDF_Creator* pCreator);
29 
30   CFX_DWordArray m_ObjNumArray;
31 
32   CFX_ByteTextBuf m_Buffer;
33   FX_DWORD m_dwObjNum;
34   int32_t m_index;
35 
36  protected:
37   CFX_DWordArray m_OffsetArray;
38 };
39 class CPDF_XRefStream {
40  public:
41   CPDF_XRefStream();
42 
43   FX_BOOL Start();
44 
45   int32_t CompressIndirectObject(FX_DWORD dwObjNum,
46                                  const CPDF_Object* pObj,
47                                  CPDF_Creator* pCreator);
48 
49   int32_t CompressIndirectObject(FX_DWORD dwObjNum,
50                                  const uint8_t* pBuffer,
51                                  FX_DWORD dwSize,
52                                  CPDF_Creator* pCreator);
53 
54   FX_BOOL End(CPDF_Creator* pCreator, FX_BOOL bEOF = FALSE);
55   FX_BOOL AddObjectNumberToIndexArray(FX_DWORD objnum);
56   FX_BOOL EndXRefStream(CPDF_Creator* pCreator);
57 
58   CFX_DWordArray m_IndexArray;
59 
60   FX_FILESIZE m_PrevOffset;
61   FX_DWORD m_dwTempObjNum;
62 
63  protected:
64   int32_t EndObjectStream(CPDF_Creator* pCreator, FX_BOOL bEOF = TRUE);
65   FX_BOOL GenerateXRefStream(CPDF_Creator* pCreator, FX_BOOL bEOF);
66   int32_t m_iSeg;
67   CPDF_ObjectStream m_ObjStream;
68   CFX_ByteTextBuf m_Buffer;
69 };
70 
71 #endif  // CORE_SRC_FPDFAPI_FPDF_EDIT_EDITINT_H_
72