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> |
| 11 |
10 #include "core/include/fxcrt/fx_system.h" | 12 #include "core/include/fxcrt/fx_system.h" |
11 #include "fpdf_objects.h" | 13 #include "fpdf_objects.h" |
12 #include "third_party/base/nonstd_unique_ptr.h" | 14 #include "third_party/base/nonstd_unique_ptr.h" |
13 | 15 |
14 class CFDF_Document; | 16 class CFDF_Document; |
15 class CFDF_Parser; | 17 class CFDF_Parser; |
16 class CFX_AffineMatrix; | 18 class CFX_AffineMatrix; |
17 class CFX_DIBSource; | 19 class CFX_DIBSource; |
18 class CFX_FloatRect; | 20 class CFX_FloatRect; |
19 class CFX_Font; | 21 class CFX_Font; |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 void ReleaseEncryptHandler(); | 493 void ReleaseEncryptHandler(); |
492 | 494 |
493 FX_BOOL LoadLinearizedAllCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCount); | 495 FX_BOOL LoadLinearizedAllCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCount); |
494 | 496 |
495 FX_BOOL LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCount); | 497 FX_BOOL LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCount); |
496 | 498 |
497 FX_BOOL LoadLinearizedAllCrossRefV5(FX_FILESIZE pos); | 499 FX_BOOL LoadLinearizedAllCrossRefV5(FX_FILESIZE pos); |
498 | 500 |
499 FX_DWORD LoadLinearizedMainXRefTable(); | 501 FX_DWORD LoadLinearizedMainXRefTable(); |
500 | 502 |
501 CFX_MapPtrToPtr m_ObjectStreamMap; | |
502 | |
503 CPDF_StreamAcc* GetObjectStream(FX_DWORD number); | 503 CPDF_StreamAcc* GetObjectStream(FX_DWORD number); |
504 | 504 |
505 FX_BOOL IsLinearizedFile(IFX_FileRead* pFileAccess, FX_DWORD offset); | 505 FX_BOOL IsLinearizedFile(IFX_FileRead* pFileAccess, FX_DWORD offset); |
506 | 506 |
507 bool FindPosInOffsets(FX_FILESIZE pos) const; | 507 bool FindPosInOffsets(FX_FILESIZE pos) const; |
508 | 508 |
509 int m_FileVersion; | 509 int m_FileVersion; |
510 | 510 |
511 CPDF_Dictionary* m_pTrailer; | 511 CPDF_Dictionary* m_pTrailer; |
512 | 512 |
(...skipping 23 matching lines...) Expand all Loading... |
536 CFX_WordArray m_ObjVersion; | 536 CFX_WordArray m_ObjVersion; |
537 CFX_ArrayTemplate<CPDF_Dictionary*> m_Trailers; | 537 CFX_ArrayTemplate<CPDF_Dictionary*> m_Trailers; |
538 | 538 |
539 FX_BOOL m_bVersionUpdated; | 539 FX_BOOL m_bVersionUpdated; |
540 | 540 |
541 CPDF_Object* m_pLinearized; | 541 CPDF_Object* m_pLinearized; |
542 | 542 |
543 FX_DWORD m_dwFirstPageNo; | 543 FX_DWORD m_dwFirstPageNo; |
544 | 544 |
545 FX_DWORD m_dwXrefStartObjNum; | 545 FX_DWORD m_dwXrefStartObjNum; |
| 546 |
| 547 // A map of object numbers to indirect streams. Map owns the streams. |
| 548 CFX_MapPtrToPtr m_ObjectStreamMap; |
| 549 |
| 550 // Mapping of object numbers to offsets. The offsets are relative to the first |
| 551 // object in the stream. |
| 552 using StreamObjectCache = std::map<FX_DWORD, FX_DWORD>; |
| 553 |
| 554 // Mapping of streams to their object caches. This is valid as long as the |
| 555 // streams in |m_ObjectStreamMap| are valid. |
| 556 std::map<CPDF_StreamAcc*, StreamObjectCache> m_ObjCache; |
| 557 |
546 friend class CPDF_Creator; | 558 friend class CPDF_Creator; |
547 friend class CPDF_DataAvail; | 559 friend class CPDF_DataAvail; |
548 }; | 560 }; |
| 561 |
549 #define FXCIPHER_NONE 0 | 562 #define FXCIPHER_NONE 0 |
550 #define FXCIPHER_RC4 1 | 563 #define FXCIPHER_RC4 1 |
551 #define FXCIPHER_AES 2 | 564 #define FXCIPHER_AES 2 |
552 #define FXCIPHER_AES2 3 | 565 #define FXCIPHER_AES2 3 |
553 class CPDF_SecurityHandler { | 566 class CPDF_SecurityHandler { |
554 public: | 567 public: |
555 virtual ~CPDF_SecurityHandler() {} | 568 virtual ~CPDF_SecurityHandler() {} |
556 | 569 |
557 virtual FX_BOOL OnInit(CPDF_Parser* pParser, | 570 virtual FX_BOOL OnInit(CPDF_Parser* pParser, |
558 CPDF_Dictionary* pEncryptDict) = 0; | 571 CPDF_Dictionary* pEncryptDict) = 0; |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 FX_DWORD src_size, | 1008 FX_DWORD src_size, |
996 const CPDF_Dictionary* pDict, | 1009 const CPDF_Dictionary* pDict, |
997 uint8_t*& dest_buf, | 1010 uint8_t*& dest_buf, |
998 FX_DWORD& dest_size, | 1011 FX_DWORD& dest_size, |
999 CFX_ByteString& ImageEncoding, | 1012 CFX_ByteString& ImageEncoding, |
1000 CPDF_Dictionary*& pImageParms, | 1013 CPDF_Dictionary*& pImageParms, |
1001 FX_DWORD estimated_size, | 1014 FX_DWORD estimated_size, |
1002 FX_BOOL bImageAcc); | 1015 FX_BOOL bImageAcc); |
1003 | 1016 |
1004 #endif // CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_ | 1017 #endif // CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_ |
OLD | NEW |