| 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_INCLUDE_FPDFAPI_FPDF_PARSER_H_ | 7 #ifndef CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_ |
| 8 #define CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_ | 8 #define CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_ |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> | 11 #include <memory> |
| 12 | 12 |
| 13 #include "core/include/fpdfapi/fpdf_objects.h" |
| 13 #include "core/include/fxcrt/fx_system.h" | 14 #include "core/include/fxcrt/fx_system.h" |
| 14 #include "fpdf_objects.h" | |
| 15 | 15 |
| 16 class CFDF_Document; | |
| 17 class CFDF_Parser; | |
| 18 class CFX_DIBSource; | |
| 19 class CFX_FloatRect; | |
| 20 class CFX_Font; | 16 class CFX_Font; |
| 21 class CFX_Matrix; | 17 class CFX_Matrix; |
| 22 class CFX_PrivateData; | |
| 23 class CPDF_ColorSpace; | 18 class CPDF_ColorSpace; |
| 24 class CPDF_CryptoHandler; | 19 class CPDF_CryptoHandler; |
| 25 class CPDF_DocPageData; | 20 class CPDF_DocPageData; |
| 26 class CPDF_DocRenderData; | 21 class CPDF_DocRenderData; |
| 27 class CPDF_Document; | |
| 28 class CPDF_Font; | 22 class CPDF_Font; |
| 29 class CPDF_FontEncoding; | 23 class CPDF_FontEncoding; |
| 30 class CPDF_HintTables; | |
| 31 class CPDF_IccProfile; | 24 class CPDF_IccProfile; |
| 32 class CPDF_Image; | 25 class CPDF_Image; |
| 33 class CPDF_ModuleMgr; | |
| 34 class CPDF_Object; | 26 class CPDF_Object; |
| 35 class CPDF_Parser; | 27 class CPDF_Parser; |
| 36 class CPDF_Pattern; | 28 class CPDF_Pattern; |
| 37 class CPDF_Point; | |
| 38 class CPDF_SecurityHandler; | 29 class CPDF_SecurityHandler; |
| 39 class CPDF_StandardSecurityHandler; | 30 class CPDF_StandardSecurityHandler; |
| 40 class IFX_FileRead; | 31 class IFX_FileRead; |
| 41 | 32 |
| 42 #define FPDFPERM_PRINT 0x0004 | 33 #define FPDFPERM_PRINT 0x0004 |
| 43 #define FPDFPERM_MODIFY 0x0008 | 34 #define FPDFPERM_MODIFY 0x0008 |
| 44 #define FPDFPERM_EXTRACT 0x0010 | 35 #define FPDFPERM_EXTRACT 0x0010 |
| 45 #define FPDFPERM_ANNOT_FORM 0x0020 | 36 #define FPDFPERM_ANNOT_FORM 0x0020 |
| 46 #define FPDFPERM_FILL_FORM 0x0100 | 37 #define FPDFPERM_FILL_FORM 0x0100 |
| 47 #define FPDFPERM_EXTRACT_ACCESS 0x0200 | 38 #define FPDFPERM_EXTRACT_ACCESS 0x0200 |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 | 404 |
| 414 CPDF_Dictionary* GetEncryptDict() { return m_pEncryptDict; } | 405 CPDF_Dictionary* GetEncryptDict() { return m_pEncryptDict; } |
| 415 | 406 |
| 416 CPDF_Object* ParseIndirectObject(CPDF_IndirectObjects* pObjList, | 407 CPDF_Object* ParseIndirectObject(CPDF_IndirectObjects* pObjList, |
| 417 FX_DWORD objnum, | 408 FX_DWORD objnum, |
| 418 PARSE_CONTEXT* pContext = NULL); | 409 PARSE_CONTEXT* pContext = NULL); |
| 419 FX_DWORD GetLastObjNum() const; | 410 FX_DWORD GetLastObjNum() const; |
| 420 bool IsValidObjectNumber(FX_DWORD objnum) const; | 411 bool IsValidObjectNumber(FX_DWORD objnum) const; |
| 421 FX_BOOL IsFormStream(FX_DWORD objnum, FX_BOOL& bForm); | 412 FX_BOOL IsFormStream(FX_DWORD objnum, FX_BOOL& bForm); |
| 422 | 413 |
| 423 FX_FILESIZE GetObjectOffset(FX_DWORD objnum); | 414 FX_FILESIZE GetObjectOffset(FX_DWORD objnum) const; |
| 424 | 415 |
| 425 FX_FILESIZE GetObjectSize(FX_DWORD objnum); | 416 FX_FILESIZE GetObjectSize(FX_DWORD objnum) const; |
| 426 | 417 |
| 427 void GetIndirectBinary(FX_DWORD objnum, uint8_t*& pBuffer, FX_DWORD& size); | 418 void GetIndirectBinary(FX_DWORD objnum, uint8_t*& pBuffer, FX_DWORD& size); |
| 428 | 419 |
| 429 IFX_FileRead* GetFileAccess() const { return m_Syntax.m_pFileAccess; } | 420 IFX_FileRead* GetFileAccess() const { return m_Syntax.m_pFileAccess; } |
| 430 | 421 |
| 431 int GetFileVersion() const { return m_FileVersion; } | 422 int GetFileVersion() const { return m_FileVersion; } |
| 432 | 423 |
| 433 FX_BOOL IsXRefStream() const { return m_bXRefStream; } | 424 FX_BOOL IsXRefStream() const { return m_bXRefStream; } |
| 434 CPDF_Object* ParseIndirectObjectAt(CPDF_IndirectObjects* pObjList, | 425 CPDF_Object* ParseIndirectObjectAt(CPDF_IndirectObjects* pObjList, |
| 435 FX_FILESIZE pos, | 426 FX_FILESIZE pos, |
| 436 FX_DWORD objnum, | 427 FX_DWORD objnum, |
| 437 struct PARSE_CONTEXT* pContext); | 428 struct PARSE_CONTEXT* pContext); |
| 438 | 429 |
| 439 CPDF_Object* ParseIndirectObjectAtByStrict(CPDF_IndirectObjects* pObjList, | 430 CPDF_Object* ParseIndirectObjectAtByStrict(CPDF_IndirectObjects* pObjList, |
| 440 FX_FILESIZE pos, | 431 FX_FILESIZE pos, |
| 441 FX_DWORD objnum, | 432 FX_DWORD objnum, |
| 442 struct PARSE_CONTEXT* pContext, | 433 struct PARSE_CONTEXT* pContext, |
| 443 FX_FILESIZE* pResultPos); | 434 FX_FILESIZE* pResultPos); |
| 444 | 435 |
| 445 FX_DWORD StartAsynParse(IFX_FileRead* pFile, | 436 FX_DWORD StartAsynParse(IFX_FileRead* pFile, |
| 446 FX_BOOL bReParse = FALSE, | 437 FX_BOOL bReParse = FALSE, |
| 447 FX_BOOL bOwnFileRead = TRUE); | 438 FX_BOOL bOwnFileRead = TRUE); |
| 448 | 439 |
| 449 FX_DWORD GetFirstPageNo() { return m_dwFirstPageNo; } | 440 FX_DWORD GetFirstPageNo() { return m_dwFirstPageNo; } |
| 450 | 441 |
| 451 protected: | 442 protected: |
| 452 CPDF_Document* m_pDocument; | |
| 453 | |
| 454 CPDF_SyntaxParser m_Syntax; | |
| 455 FX_BOOL m_bOwnFileRead; | |
| 456 CPDF_Object* ParseDirect(CPDF_Object* pObj); | 443 CPDF_Object* ParseDirect(CPDF_Object* pObj); |
| 457 | 444 |
| 458 FX_BOOL LoadAllCrossRefV4(FX_FILESIZE pos); | 445 FX_BOOL LoadAllCrossRefV4(FX_FILESIZE pos); |
| 459 | 446 |
| 460 FX_BOOL LoadAllCrossRefV5(FX_FILESIZE pos); | 447 FX_BOOL LoadAllCrossRefV5(FX_FILESIZE pos); |
| 461 | 448 |
| 462 bool LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_BOOL bSkip); | 449 bool LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_BOOL bSkip); |
| 463 | 450 |
| 464 FX_BOOL LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef); | 451 FX_BOOL LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef); |
| 465 | 452 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 478 FX_BOOL LoadLinearizedAllCrossRefV5(FX_FILESIZE pos); | 465 FX_BOOL LoadLinearizedAllCrossRefV5(FX_FILESIZE pos); |
| 479 | 466 |
| 480 FX_DWORD LoadLinearizedMainXRefTable(); | 467 FX_DWORD LoadLinearizedMainXRefTable(); |
| 481 | 468 |
| 482 CPDF_StreamAcc* GetObjectStream(FX_DWORD number); | 469 CPDF_StreamAcc* GetObjectStream(FX_DWORD number); |
| 483 | 470 |
| 484 FX_BOOL IsLinearizedFile(IFX_FileRead* pFileAccess, FX_DWORD offset); | 471 FX_BOOL IsLinearizedFile(IFX_FileRead* pFileAccess, FX_DWORD offset); |
| 485 | 472 |
| 486 bool FindPosInOffsets(FX_FILESIZE pos) const; | 473 bool FindPosInOffsets(FX_FILESIZE pos) const; |
| 487 | 474 |
| 475 void SetEncryptDictionary(CPDF_Dictionary* pDict); |
| 476 |
| 477 FX_FILESIZE GetObjectPositionOrZero(FX_DWORD objnum) const; |
| 478 |
| 479 CPDF_Document* m_pDocument; |
| 480 |
| 481 CPDF_SyntaxParser m_Syntax; |
| 482 FX_BOOL m_bOwnFileRead; |
| 488 int m_FileVersion; | 483 int m_FileVersion; |
| 489 | 484 |
| 490 CPDF_Dictionary* m_pTrailer; | 485 CPDF_Dictionary* m_pTrailer; |
| 491 | 486 |
| 492 CPDF_Dictionary* m_pEncryptDict; | 487 CPDF_Dictionary* m_pEncryptDict; |
| 493 void SetEncryptDictionary(CPDF_Dictionary* pDict); | |
| 494 | 488 |
| 495 FX_FILESIZE m_LastXRefOffset; | 489 FX_FILESIZE m_LastXRefOffset; |
| 496 | 490 |
| 497 FX_BOOL m_bXRefStream; | 491 FX_BOOL m_bXRefStream; |
| 498 | 492 |
| 499 std::unique_ptr<CPDF_SecurityHandler> m_pSecurityHandler; | 493 std::unique_ptr<CPDF_SecurityHandler> m_pSecurityHandler; |
| 500 | 494 |
| 501 FX_BOOL m_bForceUseSecurityHandler; | 495 FX_BOOL m_bForceUseSecurityHandler; |
| 502 | 496 |
| 503 CFX_ByteString m_bsRecipient; | 497 CFX_ByteString m_bsRecipient; |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 996 FX_DWORD src_size, | 990 FX_DWORD src_size, |
| 997 const CPDF_Dictionary* pDict, | 991 const CPDF_Dictionary* pDict, |
| 998 uint8_t*& dest_buf, | 992 uint8_t*& dest_buf, |
| 999 FX_DWORD& dest_size, | 993 FX_DWORD& dest_size, |
| 1000 CFX_ByteString& ImageEncoding, | 994 CFX_ByteString& ImageEncoding, |
| 1001 CPDF_Dictionary*& pImageParms, | 995 CPDF_Dictionary*& pImageParms, |
| 1002 FX_DWORD estimated_size, | 996 FX_DWORD estimated_size, |
| 1003 FX_BOOL bImageAcc); | 997 FX_BOOL bImageAcc); |
| 1004 | 998 |
| 1005 #endif // CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_ | 999 #endif // CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_ |
| OLD | NEW |