diff options
author | Artem Strygin <art-snake@yandex-team.ru> | 2018-06-27 18:15:10 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-06-27 18:15:10 +0000 |
commit | 20eca1e383b7dce69cd791d42bda3558a3966301 (patch) | |
tree | d3fded7303e8326d3883ca51b6bed2ad2438b6da /core/fpdfapi/parser/cpdf_document.h | |
parent | 00ba8bbea0ff57d6f11257736408e530e54ef642 (diff) | |
download | pdfium-20eca1e383b7dce69cd791d42bda3558a3966301.tar.xz |
Rework of loading of CPDF_Document.
Improve CPDF_Document interface.
Fix relationship between CPDF_Document and CPDF_Parser.
This CL changes CPDF_Document to internally create the CPDF_Parser
and removes the need for the CPDF_Parser to know about the CPDF_Document.
Change-Id: Iec7aef19575c90f30b9a6c919dfd4f4417e4caf2
Reviewed-on: https://pdfium-review.googlesource.com/35630
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi/parser/cpdf_document.h')
-rw-r--r-- | core/fpdfapi/parser/cpdf_document.h | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/core/fpdfapi/parser/cpdf_document.h b/core/fpdfapi/parser/cpdf_document.h index 8d0aa08009..328f09b6ef 100644 --- a/core/fpdfapi/parser/cpdf_document.h +++ b/core/fpdfapi/parser/cpdf_document.h @@ -15,9 +15,10 @@ #include "core/fpdfapi/page/cpdf_image.h" #include "core/fpdfapi/page/cpdf_page.h" -#include "core/fpdfapi/parser/cpdf_indirect_object_holder.h" #include "core/fpdfapi/parser/cpdf_object.h" +#include "core/fpdfapi/parser/cpdf_parser.h" #include "core/fpdfdoc/cpdf_linklist.h" +#include "core/fxcrt/retain_ptr.h" class CFX_Font; class CFX_Matrix; @@ -30,7 +31,9 @@ class CPDF_IccProfile; class CPDF_LinearizedHeader; class CPDF_Parser; class CPDF_Pattern; +class CPDF_ReadValidator; class CPDF_StreamAcc; +class IFX_SeekableReadStream; class JBig2_DocumentContext; #define FPDFPERM_MODIFY 0x0008 @@ -38,7 +41,7 @@ class JBig2_DocumentContext; #define FPDFPERM_FILL_FORM 0x0100 #define FPDFPERM_EXTRACT_ACCESS 0x0200 -class CPDF_Document : public CPDF_IndirectObjectHolder { +class CPDF_Document : public CPDF_Parser::ParsedObjectsHolder { public: // Type from which the XFA extension can subclass itself. class Extension { @@ -52,7 +55,7 @@ class CPDF_Document : public CPDF_IndirectObjectHolder { static const int kPageMaxNum = 0xFFFFF; - explicit CPDF_Document(std::unique_ptr<CPDF_Parser> pParser); + CPDF_Document(); ~CPDF_Document() override; Extension* GetExtension() const { return m_pExtension.get(); } @@ -96,7 +99,16 @@ class CPDF_Document : public CPDF_IndirectObjectHolder { RetainPtr<CPDF_StreamAcc> LoadFontFile(const CPDF_Stream* pStream); RetainPtr<CPDF_IccProfile> LoadIccProfile(const CPDF_Stream* pStream); - void LoadDoc(); + // CPDF_Parser::ParsedObjectsHolder overrides: + bool TryInit() override; + + CPDF_Parser::Error LoadDoc( + const RetainPtr<IFX_SeekableReadStream>& pFileAccess, + const char* password); + CPDF_Parser::Error LoadLinearizedDoc( + const RetainPtr<CPDF_ReadValidator>& validator, + const char* password); + void LoadPages(); void CreateNewDoc(); @@ -144,6 +156,7 @@ class CPDF_Document : public CPDF_IndirectObjectHolder { std::set<CPDF_Dictionary*>* pVisited); bool InsertNewPage(int iPage, CPDF_Dictionary* pPageDict); void ResetTraversal(); + void SetParser(std::unique_ptr<CPDF_Parser> pParser); std::unique_ptr<CPDF_Parser> m_pParser; UnownedPtr<CPDF_Dictionary> m_pRootDict; |