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 _FPDF_PARSER_ | 7 #ifndef _FPDF_PARSER_ |
8 #define _FPDF_PARSER_ | 8 #define _FPDF_PARSER_ |
9 #ifndef _FX_BASIC_H_ | 9 #ifndef _FX_BASIC_H_ |
10 #include "../fxcrt/fx_ext.h" | 10 #include "../fxcrt/fx_ext.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #define FPDFPERM_EXTRACT 0x0010 | 42 #define FPDFPERM_EXTRACT 0x0010 |
43 #define FPDFPERM_ANNOT_FORM 0x0020 | 43 #define FPDFPERM_ANNOT_FORM 0x0020 |
44 #define FPDFPERM_FILL_FORM 0x0100 | 44 #define FPDFPERM_FILL_FORM 0x0100 |
45 #define FPDFPERM_EXTRACT_ACCESS 0x0200 | 45 #define FPDFPERM_EXTRACT_ACCESS 0x0200 |
46 #define FPDFPERM_ASSEMBLE 0x0400 | 46 #define FPDFPERM_ASSEMBLE 0x0400 |
47 #define FPDFPERM_PRINT_HIGH 0x0800 | 47 #define FPDFPERM_PRINT_HIGH 0x0800 |
48 #define FPDF_PAGE_MAX_NUM 0xFFFFF | 48 #define FPDF_PAGE_MAX_NUM 0xFFFFF |
49 class IPDF_EnumPageHandler | 49 class IPDF_EnumPageHandler |
50 { | 50 { |
51 public: | 51 public: |
52 | 52 virtual ~IPDF_EnumPageHandler() { } |
53 virtual FX_BOOL EnumPage(CPDF_Dictionary* pPageDict) = 0; | 53 virtual FX_BOOL EnumPage(CPDF_Dictionary* pPageDict) = 0; |
54 }; | 54 }; |
55 class CPDF_Document : public CFX_PrivateData, public CPDF_IndirectObjects | 55 class CPDF_Document : public CFX_PrivateData, public CPDF_IndirectObjects |
56 { | 56 { |
57 public: | 57 public: |
58 | 58 |
59 CPDF_Document(IPDF_DocParser* pParser); | 59 CPDF_Document(IPDF_DocParser* pParser); |
60 | 60 |
61 CPDF_Document(); | 61 CPDF_Document(); |
62 | 62 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 | 240 |
241 FX_DWORD m_dwSize; | 241 FX_DWORD m_dwSize; |
242 | 242 |
243 FX_DWORD m_dwCurPos; | 243 FX_DWORD m_dwCurPos; |
244 }; | 244 }; |
245 class CPDF_SyntaxParser : public CFX_Object | 245 class CPDF_SyntaxParser : public CFX_Object |
246 { | 246 { |
247 public: | 247 public: |
248 | 248 |
249 CPDF_SyntaxParser(); | 249 CPDF_SyntaxParser(); |
250 | 250 virtual ~CPDF_SyntaxParser(); |
251 ~CPDF_SyntaxParser(); | |
252 | 251 |
253 void InitParser(IFX_FileRead* pFileAccess, FX
_DWORD HeaderOffset); | 252 void InitParser(IFX_FileRead* pFileAccess, FX
_DWORD HeaderOffset); |
254 | 253 |
255 FX_FILESIZE SavePos() | 254 FX_FILESIZE SavePos() |
256 { | 255 { |
257 return m_Pos; | 256 return m_Pos; |
258 } | 257 } |
259 | 258 |
260 void RestorePos(FX_FILESIZE pos) | 259 void RestorePos(FX_FILESIZE pos) |
261 { | 260 { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 | 358 |
360 FX_FILESIZE m_DictEnd; | 359 FX_FILESIZE m_DictEnd; |
361 | 360 |
362 FX_FILESIZE m_DataStart; | 361 FX_FILESIZE m_DataStart; |
363 | 362 |
364 FX_FILESIZE m_DataEnd; | 363 FX_FILESIZE m_DataEnd; |
365 }; | 364 }; |
366 class IPDF_DocParser : public CFX_Object | 365 class IPDF_DocParser : public CFX_Object |
367 { | 366 { |
368 public: | 367 public: |
369 | 368 virtual ~IPDF_DocParser() { } |
370 virtual FX_DWORD GetRootObjNum() = 0; | 369 virtual FX_DWORD GetRootObjNum() = 0; |
371 | 370 |
372 virtual FX_DWORD GetInfoObjNum() = 0; | 371 virtual FX_DWORD GetInfoObjNum() = 0; |
373 | 372 |
374 virtual CPDF_Object* ParseIndirectObject(CPDF_IndirectObjects* pObjLi
st, FX_DWORD objnum, PARSE_CONTEXT* pContext = NULL) = 0; | 373 virtual CPDF_Object* ParseIndirectObject(CPDF_IndirectObjects* pObjLi
st, FX_DWORD objnum, PARSE_CONTEXT* pContext = NULL) = 0; |
375 | 374 |
376 virtual FX_DWORD GetLastObjNum() = 0; | 375 virtual FX_DWORD GetLastObjNum() = 0; |
377 | 376 |
378 virtual CPDF_Array* GetIDArray() = 0; | 377 virtual CPDF_Array* GetIDArray() = 0; |
379 | 378 |
(...skipping 15 matching lines...) Expand all Loading... |
395 #define PDFPARSE_ERROR_FILE 1 | 394 #define PDFPARSE_ERROR_FILE 1 |
396 #define PDFPARSE_ERROR_FORMAT 2 | 395 #define PDFPARSE_ERROR_FORMAT 2 |
397 #define PDFPARSE_ERROR_PASSWORD 3 | 396 #define PDFPARSE_ERROR_PASSWORD 3 |
398 #define PDFPARSE_ERROR_HANDLER 4 | 397 #define PDFPARSE_ERROR_HANDLER 4 |
399 #define PDFPARSE_ERROR_CERT 5 | 398 #define PDFPARSE_ERROR_CERT 5 |
400 class CPDF_Parser FX_FINAL : public IPDF_DocParser | 399 class CPDF_Parser FX_FINAL : public IPDF_DocParser |
401 { | 400 { |
402 public: | 401 public: |
403 | 402 |
404 CPDF_Parser(); | 403 CPDF_Parser(); |
405 | 404 ~CPDF_Parser() override; |
406 ~CPDF_Parser(); | |
407 | 405 |
408 FX_DWORD StartParse(FX_LPCSTR filename, FX_BOOL bReParse
= FALSE); | 406 FX_DWORD StartParse(FX_LPCSTR filename, FX_BOOL bReParse
= FALSE); |
409 | 407 |
410 FX_DWORD StartParse(FX_LPCWSTR filename, FX_BOOL bReParse
= FALSE); | 408 FX_DWORD StartParse(FX_LPCWSTR filename, FX_BOOL bReParse
= FALSE); |
411 | 409 |
412 FX_DWORD StartParse(IFX_FileRead* pFile, FX_BOOL bReParse
= FALSE, FX_BOOL bOwnFileRead = TRUE); | 410 FX_DWORD StartParse(IFX_FileRead* pFile, FX_BOOL bReParse
= FALSE, FX_BOOL bOwnFileRead = TRUE); |
413 | 411 |
414 void CloseParser(FX_BOOL bReParse = FALSE); | 412 void CloseParser(FX_BOOL bReParse = FALSE); |
415 | 413 |
416 virtual FX_DWORD GetPermissions(FX_BOOL bCheckRevision = FALSE) FX_OVERRI
DE; | 414 virtual FX_DWORD GetPermissions(FX_BOOL bCheckRevision = FALSE) FX_OVERRI
DE; |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
846 | 844 |
847 CPDF_Object* LookupValue(int num); | 845 CPDF_Object* LookupValue(int num); |
848 protected: | 846 protected: |
849 | 847 |
850 CPDF_Dictionary* m_pRoot; | 848 CPDF_Dictionary* m_pRoot; |
851 }; | 849 }; |
852 | 850 |
853 class IFX_FileAvail | 851 class IFX_FileAvail |
854 { | 852 { |
855 public: | 853 public: |
856 | 854 virtual ~IFX_FileAvail() { } |
857 virtual FX_BOOL IsDataAvail( FX_FILESIZE offset, FX_DWOR
D size) = 0; | 855 virtual FX_BOOL IsDataAvail( FX_FILESIZE offset, FX_DWOR
D size) = 0; |
858 }; | 856 }; |
859 class IFX_DownloadHints | 857 class IFX_DownloadHints |
860 { | 858 { |
861 public: | 859 public: |
862 | 860 virtual ~IFX_DownloadHints() { } |
863 virtual void AddSegment(FX_FILESIZE offset, FX_DWORD
size) = 0; | 861 virtual void AddSegment(FX_FILESIZE offset, FX_DWORD
size) = 0; |
864 }; | 862 }; |
865 #define PDF_IS_LINEARIZED 1 | 863 #define PDF_IS_LINEARIZED 1 |
866 #define PDF_NOT_LINEARIZED 0 | 864 #define PDF_NOT_LINEARIZED 0 |
867 #define PDF_UNKNOW_LINEARIZED -1 | 865 #define PDF_UNKNOW_LINEARIZED -1 |
868 #define PDFFORM_NOTAVAIL 0 | 866 #define PDFFORM_NOTAVAIL 0 |
869 #define PDFFORM_AVAIL 1 | 867 #define PDFFORM_AVAIL 1 |
870 #define PDFFORM_NOTEXIST 2 | 868 #define PDFFORM_NOTEXIST 2 |
871 class IPDF_DataAvail | 869 class IPDF_DataAvail |
872 { | 870 { |
873 public: | 871 public: |
| 872 virtual ~IPDF_DataAvail() { } |
874 | 873 |
875 virtual FX_BOOL IsDocAvail(IFX_DownloadHints* pHints) =
0; | 874 virtual FX_BOOL IsDocAvail(IFX_DownloadHints* pHints) =
0; |
876 | 875 |
877 | |
878 virtual void SetDocument(CPDF_Document* pDoc) = 0; | 876 virtual void SetDocument(CPDF_Document* pDoc) = 0; |
879 | 877 |
880 | |
881 virtual FX_BOOL IsPageAvail(int iPage, IFX_DownloadHints
* pHints) = 0; | 878 virtual FX_BOOL IsPageAvail(int iPage, IFX_DownloadHints
* pHints) = 0; |
882 | 879 |
883 virtual FX_BOOL IsLinearized() = 0; | 880 virtual FX_BOOL IsLinearized() = 0; |
884 | 881 |
885 virtual FX_INT32 IsFormAvail(IFX_DownloadHints *pHints) = 0; | 882 virtual FX_INT32 IsFormAvail(IFX_DownloadHints *pHints) = 0; |
886 | 883 |
887 virtual FX_INT32 IsLinearizedPDF() = 0; | 884 virtual FX_INT32 IsLinearizedPDF() = 0; |
888 | 885 |
889 virtual void GetLinearizedMainXRefInfo(FX_FIL
ESIZE *pPos, FX_DWORD *pSize) = 0; | 886 virtual void GetLinearizedMainXRefInfo(FX_FIL
ESIZE *pPos, FX_DWORD *pSize) = 0; |
890 }; | 887 }; |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 | 1135 |
1139 FX_BOOL m_bCurPageDictLoadOK; | 1136 FX_BOOL m_bCurPageDictLoadOK; |
1140 | 1137 |
1141 CPDF_PageNode m_pageNodes; | 1138 CPDF_PageNode m_pageNodes; |
1142 | 1139 |
1143 CFX_CMapDWordToDWord * m_pageMapCheckState; | 1140 CFX_CMapDWordToDWord * m_pageMapCheckState; |
1144 | 1141 |
1145 CFX_CMapDWordToDWord * m_pagesLoadState; | 1142 CFX_CMapDWordToDWord * m_pagesLoadState; |
1146 }; | 1143 }; |
1147 #endif | 1144 #endif |
OLD | NEW |