Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_DOCUMENT_H_ | 7 #ifndef CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_DOCUMENT_H_ |
| 8 #define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_DOCUMENT_H_ | 8 #define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_DOCUMENT_H_ |
| 9 | 9 |
| 10 #include <functional> | 10 #include <functional> |
| 11 #include <memory> | 11 #include <memory> |
| 12 | 12 |
| 13 #include "core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h" | 13 #include "core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h" |
| 14 #include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" | 14 #include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" |
| 15 #include "core/fpdfdoc/include/cpdf_linklist.h" | 15 #include "core/fpdfdoc/include/cpdf_linklist.h" |
| 16 #include "core/fxcrt/include/cfx_string_pool_template.h" | |
| 16 #include "core/fxcrt/include/fx_basic.h" | 17 #include "core/fxcrt/include/fx_basic.h" |
| 17 | 18 |
| 18 class CFX_Font; | 19 class CFX_Font; |
| 19 class CFX_Matrix; | 20 class CFX_Matrix; |
| 20 class CPDF_ColorSpace; | 21 class CPDF_ColorSpace; |
| 21 class CPDF_DocPageData; | 22 class CPDF_DocPageData; |
| 22 class CPDF_DocRenderData; | 23 class CPDF_DocRenderData; |
| 23 class CPDF_Font; | 24 class CPDF_Font; |
| 24 class CPDF_FontEncoding; | 25 class CPDF_FontEncoding; |
| 25 class CPDF_IccProfile; | 26 class CPDF_IccProfile; |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 40 #define FPDF_PAGE_MAX_NUM 0xFFFFF | 41 #define FPDF_PAGE_MAX_NUM 0xFFFFF |
| 41 | 42 |
| 42 class CPDF_Document : public CPDF_IndirectObjectHolder { | 43 class CPDF_Document : public CPDF_IndirectObjectHolder { |
| 43 public: | 44 public: |
| 44 explicit CPDF_Document(std::unique_ptr<CPDF_Parser> pParser); | 45 explicit CPDF_Document(std::unique_ptr<CPDF_Parser> pParser); |
| 45 ~CPDF_Document() override; | 46 ~CPDF_Document() override; |
| 46 | 47 |
| 47 CPDF_Parser* GetParser() const { return m_pParser.get(); } | 48 CPDF_Parser* GetParser() const { return m_pParser.get(); } |
| 48 CPDF_Dictionary* GetRoot() const { return m_pRootDict; } | 49 CPDF_Dictionary* GetRoot() const { return m_pRootDict; } |
| 49 CPDF_Dictionary* GetInfo() const { return m_pInfoDict; } | 50 CPDF_Dictionary* GetInfo() const { return m_pInfoDict; } |
| 51 CFX_ByteStringPool* GetByteStringPool() { return &m_ByteStringPool; } | |
| 50 | 52 |
| 51 int GetPageCount() const; | 53 int GetPageCount() const; |
| 52 CPDF_Dictionary* GetPage(int iPage); | 54 CPDF_Dictionary* GetPage(int iPage); |
| 53 int GetPageIndex(uint32_t objnum); | 55 int GetPageIndex(uint32_t objnum); |
| 54 uint32_t GetUserPermissions() const; | 56 uint32_t GetUserPermissions() const; |
| 55 CPDF_DocPageData* GetPageData() const { return m_pDocPage; } | 57 CPDF_DocPageData* GetPageData() const { return m_pDocPage; } |
| 56 | 58 |
| 57 std::unique_ptr<JBig2_DocumentContext>* CodecContext() { | 59 std::unique_ptr<JBig2_DocumentContext>* CodecContext() { |
| 58 return &m_pCodecContext; | 60 return &m_pCodecContext; |
| 59 } | 61 } |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 CPDF_Dictionary* m_pInfoDict; | 119 CPDF_Dictionary* m_pInfoDict; |
| 118 bool m_bLinearized; | 120 bool m_bLinearized; |
| 119 int m_iFirstPageNo; | 121 int m_iFirstPageNo; |
| 120 uint32_t m_dwFirstPageObjNum; | 122 uint32_t m_dwFirstPageObjNum; |
| 121 CFX_ArrayTemplate<uint32_t> m_PageList; | 123 CFX_ArrayTemplate<uint32_t> m_PageList; |
| 122 // TODO(thestig): Figure out why this cannot be a std::unique_ptr. | 124 // TODO(thestig): Figure out why this cannot be a std::unique_ptr. |
| 123 CPDF_DocPageData* m_pDocPage; | 125 CPDF_DocPageData* m_pDocPage; |
| 124 std::unique_ptr<CPDF_DocRenderData> m_pDocRender; | 126 std::unique_ptr<CPDF_DocRenderData> m_pDocRender; |
| 125 std::unique_ptr<JBig2_DocumentContext> m_pCodecContext; | 127 std::unique_ptr<JBig2_DocumentContext> m_pCodecContext; |
| 126 std::unique_ptr<CPDF_LinkList> m_pLinksContext; | 128 std::unique_ptr<CPDF_LinkList> m_pLinksContext; |
| 129 CFX_ByteStringPool m_ByteStringPool; | |
|
Lei Zhang
2016/09/20 23:48:23
Dumb question: Why have a CFX_ByteStringPool per C
Tom Sepez
2016/09/27 20:42:56
Exactly. I wouldn't want an unloaded document to
| |
| 127 | 130 |
| 128 private: | 131 private: |
| 129 void LoadDocInternal(); | 132 void LoadDocInternal(); |
| 130 size_t CalculateEncodingDict(int charset, CPDF_Dictionary* pBaseDict); | 133 size_t CalculateEncodingDict(int charset, CPDF_Dictionary* pBaseDict); |
| 131 CPDF_Dictionary* GetPagesDict() const; | 134 CPDF_Dictionary* GetPagesDict() const; |
| 132 CPDF_Dictionary* ProcessbCJK( | 135 CPDF_Dictionary* ProcessbCJK( |
| 133 CPDF_Dictionary* pBaseDict, | 136 CPDF_Dictionary* pBaseDict, |
| 134 int charset, | 137 int charset, |
| 135 FX_BOOL bVert, | 138 FX_BOOL bVert, |
| 136 CFX_ByteString basefont, | 139 CFX_ByteString basefont, |
| 137 std::function<void(FX_WCHAR, FX_WCHAR, CPDF_Array*)> Insert); | 140 std::function<void(FX_WCHAR, FX_WCHAR, CPDF_Array*)> Insert); |
| 138 }; | 141 }; |
| 139 | 142 |
| 140 #endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_DOCUMENT_H_ | 143 #endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_DOCUMENT_H_ |
| OLD | NEW |