| 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> |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 void CloseParser(FX_BOOL bReParse = FALSE); | 387 void CloseParser(FX_BOOL bReParse = FALSE); |
| 388 | 388 |
| 389 FX_DWORD GetPermissions(FX_BOOL bCheckRevision = FALSE); | 389 FX_DWORD GetPermissions(FX_BOOL bCheckRevision = FALSE); |
| 390 | 390 |
| 391 FX_BOOL IsOwner(); | 391 FX_BOOL IsOwner(); |
| 392 | 392 |
| 393 void SetPassword(const FX_CHAR* password) { m_Password = password; } | 393 void SetPassword(const FX_CHAR* password) { m_Password = password; } |
| 394 | 394 |
| 395 CFX_ByteString GetPassword() { return m_Password; } | 395 CFX_ByteString GetPassword() { return m_Password; } |
| 396 | 396 |
| 397 CPDF_SecurityHandler* GetSecurityHandler() { | |
| 398 return m_pSecurityHandler.get(); | |
| 399 } | |
| 400 | |
| 401 CPDF_CryptoHandler* GetCryptoHandler() { | 397 CPDF_CryptoHandler* GetCryptoHandler() { |
| 402 return m_Syntax.m_pCryptoHandler.get(); | 398 return m_Syntax.m_pCryptoHandler.get(); |
| 403 } | 399 } |
| 404 | 400 |
| 405 void SetSecurityHandler(CPDF_SecurityHandler* pSecurityHandler, | 401 void SetSecurityHandler(CPDF_SecurityHandler* pSecurityHandler, |
| 406 FX_BOOL bForced = FALSE); | 402 FX_BOOL bForced = FALSE); |
| 407 | 403 |
| 408 CFX_ByteString GetRecipient() { return m_bsRecipient; } | |
| 409 | |
| 410 CPDF_Dictionary* GetTrailer() { return m_pTrailer; } | 404 CPDF_Dictionary* GetTrailer() { return m_pTrailer; } |
| 411 | 405 |
| 412 FX_FILESIZE GetLastXRefOffset() { return m_LastXRefOffset; } | 406 FX_FILESIZE GetLastXRefOffset() { return m_LastXRefOffset; } |
| 413 | 407 |
| 414 CPDF_Document* GetDocument() { return m_pDocument; } | 408 CPDF_Document* GetDocument() { return m_pDocument; } |
| 415 | 409 |
| 416 CFX_ArrayTemplate<CPDF_Dictionary*>* GetOtherTrailers() { | |
| 417 return &m_Trailers; | |
| 418 } | |
| 419 | |
| 420 FX_DWORD GetRootObjNum(); | 410 FX_DWORD GetRootObjNum(); |
| 421 FX_DWORD GetInfoObjNum(); | 411 FX_DWORD GetInfoObjNum(); |
| 422 CPDF_Array* GetIDArray(); | 412 CPDF_Array* GetIDArray(); |
| 423 | 413 |
| 424 CPDF_Dictionary* GetEncryptDict() { return m_pEncryptDict; } | 414 CPDF_Dictionary* GetEncryptDict() { return m_pEncryptDict; } |
| 425 | 415 |
| 426 FX_BOOL IsEncrypted() { return GetEncryptDict() != NULL; } | |
| 427 | |
| 428 CPDF_Object* ParseIndirectObject(CPDF_IndirectObjects* pObjList, | 416 CPDF_Object* ParseIndirectObject(CPDF_IndirectObjects* pObjList, |
| 429 FX_DWORD objnum, | 417 FX_DWORD objnum, |
| 430 PARSE_CONTEXT* pContext = NULL); | 418 PARSE_CONTEXT* pContext = NULL); |
| 431 FX_DWORD GetLastObjNum(); | 419 FX_DWORD GetLastObjNum() const; |
| 420 bool IsValidObjectNumber(FX_DWORD objnum) const; |
| 432 FX_BOOL IsFormStream(FX_DWORD objnum, FX_BOOL& bForm); | 421 FX_BOOL IsFormStream(FX_DWORD objnum, FX_BOOL& bForm); |
| 433 | 422 |
| 434 FX_FILESIZE GetObjectOffset(FX_DWORD objnum); | 423 FX_FILESIZE GetObjectOffset(FX_DWORD objnum); |
| 435 | 424 |
| 436 FX_FILESIZE GetObjectSize(FX_DWORD objnum); | 425 FX_FILESIZE GetObjectSize(FX_DWORD objnum); |
| 437 | 426 |
| 438 int GetObjectVersion(FX_DWORD objnum) { return m_ObjVersion[objnum]; } | |
| 439 | |
| 440 void GetIndirectBinary(FX_DWORD objnum, uint8_t*& pBuffer, FX_DWORD& size); | 427 void GetIndirectBinary(FX_DWORD objnum, uint8_t*& pBuffer, FX_DWORD& size); |
| 441 | 428 |
| 442 FX_BOOL GetFileStreamOption() { return m_Syntax.m_bFileStream; } | |
| 443 | |
| 444 void SetFileStreamOption(FX_BOOL b) { m_Syntax.m_bFileStream = b; } | |
| 445 | |
| 446 IFX_FileRead* GetFileAccess() const { return m_Syntax.m_pFileAccess; } | 429 IFX_FileRead* GetFileAccess() const { return m_Syntax.m_pFileAccess; } |
| 447 | 430 |
| 448 int GetFileVersion() const { return m_FileVersion; } | 431 int GetFileVersion() const { return m_FileVersion; } |
| 449 | 432 |
| 450 FX_BOOL IsXRefStream() const { return m_bXRefStream; } | 433 FX_BOOL IsXRefStream() const { return m_bXRefStream; } |
| 451 CPDF_Object* ParseIndirectObjectAt(CPDF_IndirectObjects* pObjList, | 434 CPDF_Object* ParseIndirectObjectAt(CPDF_IndirectObjects* pObjList, |
| 452 FX_FILESIZE pos, | 435 FX_FILESIZE pos, |
| 453 FX_DWORD objnum, | 436 FX_DWORD objnum, |
| 454 struct PARSE_CONTEXT* pContext); | 437 struct PARSE_CONTEXT* pContext); |
| 455 | 438 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 nonstd::unique_ptr<CPDF_SecurityHandler> m_pSecurityHandler; | 499 nonstd::unique_ptr<CPDF_SecurityHandler> m_pSecurityHandler; |
| 517 | 500 |
| 518 FX_BOOL m_bForceUseSecurityHandler; | 501 FX_BOOL m_bForceUseSecurityHandler; |
| 519 | 502 |
| 520 CFX_ByteString m_bsRecipient; | 503 CFX_ByteString m_bsRecipient; |
| 521 | 504 |
| 522 CFX_ByteString m_FilePath; | 505 CFX_ByteString m_FilePath; |
| 523 | 506 |
| 524 CFX_ByteString m_Password; | 507 CFX_ByteString m_Password; |
| 525 | 508 |
| 526 CFX_FileSizeArray m_CrossRef; | 509 struct ObjectInfo { |
| 510 ObjectInfo() : pos(0) {} |
| 511 |
| 512 FX_FILESIZE pos; |
| 513 // TODO(thestig): Use fields below in place of |m_V5Type| and |m_ObjVersion| |
| 514 #if 0 |
| 515 uint8_t type; |
| 516 uint16_t gennum; |
| 517 #endif |
| 518 }; |
| 519 std::map<FX_DWORD, ObjectInfo> m_ObjectInfo; |
| 527 | 520 |
| 528 CFX_ByteArray m_V5Type; | 521 CFX_ByteArray m_V5Type; |
| 522 CFX_WordArray m_ObjVersion; |
| 529 | 523 |
| 530 CFX_FileSizeArray m_SortedOffset; | 524 CFX_FileSizeArray m_SortedOffset; |
| 531 | 525 |
| 532 CFX_WordArray m_ObjVersion; | |
| 533 CFX_ArrayTemplate<CPDF_Dictionary*> m_Trailers; | 526 CFX_ArrayTemplate<CPDF_Dictionary*> m_Trailers; |
| 534 | 527 |
| 535 FX_BOOL m_bVersionUpdated; | 528 FX_BOOL m_bVersionUpdated; |
| 536 | 529 |
| 537 CPDF_Object* m_pLinearized; | 530 CPDF_Object* m_pLinearized; |
| 538 | 531 |
| 539 FX_DWORD m_dwFirstPageNo; | 532 FX_DWORD m_dwFirstPageNo; |
| 540 | 533 |
| 541 FX_DWORD m_dwXrefStartObjNum; | 534 FX_DWORD m_dwXrefStartObjNum; |
| 542 | 535 |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1003 FX_DWORD src_size, | 996 FX_DWORD src_size, |
| 1004 const CPDF_Dictionary* pDict, | 997 const CPDF_Dictionary* pDict, |
| 1005 uint8_t*& dest_buf, | 998 uint8_t*& dest_buf, |
| 1006 FX_DWORD& dest_size, | 999 FX_DWORD& dest_size, |
| 1007 CFX_ByteString& ImageEncoding, | 1000 CFX_ByteString& ImageEncoding, |
| 1008 CPDF_Dictionary*& pImageParms, | 1001 CPDF_Dictionary*& pImageParms, |
| 1009 FX_DWORD estimated_size, | 1002 FX_DWORD estimated_size, |
| 1010 FX_BOOL bImageAcc); | 1003 FX_BOOL bImageAcc); |
| 1011 | 1004 |
| 1012 #endif // CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_ | 1005 #endif // CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_ |
| OLD | NEW |