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 <memory> | 10 #include <memory> |
(...skipping 22 matching lines...) Expand all Loading... |
33 #define FPDFPERM_EXTRACT 0x0010 | 33 #define FPDFPERM_EXTRACT 0x0010 |
34 #define FPDFPERM_ANNOT_FORM 0x0020 | 34 #define FPDFPERM_ANNOT_FORM 0x0020 |
35 #define FPDFPERM_FILL_FORM 0x0100 | 35 #define FPDFPERM_FILL_FORM 0x0100 |
36 #define FPDFPERM_EXTRACT_ACCESS 0x0200 | 36 #define FPDFPERM_EXTRACT_ACCESS 0x0200 |
37 #define FPDFPERM_ASSEMBLE 0x0400 | 37 #define FPDFPERM_ASSEMBLE 0x0400 |
38 #define FPDFPERM_PRINT_HIGH 0x0800 | 38 #define FPDFPERM_PRINT_HIGH 0x0800 |
39 #define FPDF_PAGE_MAX_NUM 0xFFFFF | 39 #define FPDF_PAGE_MAX_NUM 0xFFFFF |
40 | 40 |
41 class CPDF_Document : public CPDF_IndirectObjectHolder { | 41 class CPDF_Document : public CPDF_IndirectObjectHolder { |
42 public: | 42 public: |
43 explicit CPDF_Document(CPDF_Parser* pParser); | 43 explicit CPDF_Document(std::unique_ptr<CPDF_Parser> pParser); |
44 ~CPDF_Document() override; | 44 ~CPDF_Document() override; |
45 | 45 |
46 CPDF_Parser* GetParser() const { return m_pParser; } | 46 CPDF_Parser* GetParser() const { return m_pParser.get(); } |
47 CPDF_Dictionary* GetRoot() const { return m_pRootDict; } | 47 CPDF_Dictionary* GetRoot() const { return m_pRootDict; } |
48 CPDF_Dictionary* GetInfo() const { return m_pInfoDict; } | 48 CPDF_Dictionary* GetInfo() const { return m_pInfoDict; } |
49 | 49 |
50 void GetID(CFX_ByteString& id1, CFX_ByteString& id2) const { | 50 void GetID(CFX_ByteString& id1, CFX_ByteString& id2) const { |
51 id1 = m_ID1; | 51 id1 = m_ID1; |
52 id2 = m_ID2; | 52 id2 = m_ID2; |
53 } | 53 } |
54 | 54 |
55 int GetPageCount() const; | 55 int GetPageCount() const; |
56 CPDF_Dictionary* GetPage(int iPage); | 56 CPDF_Dictionary* GetPage(int iPage); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 int nPagesToGo, | 121 int nPagesToGo, |
122 int level); | 122 int level); |
123 int FindPageIndex(CPDF_Dictionary* pNode, | 123 int FindPageIndex(CPDF_Dictionary* pNode, |
124 uint32_t& skip_count, | 124 uint32_t& skip_count, |
125 uint32_t objnum, | 125 uint32_t objnum, |
126 int& index, | 126 int& index, |
127 int level = 0); | 127 int level = 0); |
128 FX_BOOL CheckOCGVisible(CPDF_Dictionary* pOCG, FX_BOOL bPrinting); | 128 FX_BOOL CheckOCGVisible(CPDF_Dictionary* pOCG, FX_BOOL bPrinting); |
129 CPDF_Object* ParseIndirectObject(uint32_t objnum) override; | 129 CPDF_Object* ParseIndirectObject(uint32_t objnum) override; |
130 | 130 |
131 CPDF_Parser* m_pParser; | 131 std::unique_ptr<CPDF_Parser> m_pParser; |
132 CPDF_Dictionary* m_pRootDict; | 132 CPDF_Dictionary* m_pRootDict; |
133 CPDF_Dictionary* m_pInfoDict; | 133 CPDF_Dictionary* m_pInfoDict; |
134 CFX_ByteString m_ID1; | 134 CFX_ByteString m_ID1; |
135 CFX_ByteString m_ID2; | 135 CFX_ByteString m_ID2; |
136 bool m_bLinearized; | 136 bool m_bLinearized; |
137 int m_iFirstPageNo; | 137 int m_iFirstPageNo; |
138 uint32_t m_dwFirstPageObjNum; | 138 uint32_t m_dwFirstPageObjNum; |
139 CFX_ArrayTemplate<uint32_t> m_PageList; | 139 CFX_ArrayTemplate<uint32_t> m_PageList; |
140 // TODO(thestig): Figure out why this cannot be a std::unique_ptr. | 140 // TODO(thestig): Figure out why this cannot be a std::unique_ptr. |
141 CPDF_DocPageData* m_pDocPage; | 141 CPDF_DocPageData* m_pDocPage; |
142 std::unique_ptr<CPDF_DocRenderData> m_pDocRender; | 142 std::unique_ptr<CPDF_DocRenderData> m_pDocRender; |
143 std::unique_ptr<JBig2_DocumentContext> m_pCodecContext; | 143 std::unique_ptr<JBig2_DocumentContext> m_pCodecContext; |
144 std::unique_ptr<CPDF_LinkList> m_pLinksContext; | 144 std::unique_ptr<CPDF_LinkList> m_pLinksContext; |
145 | 145 |
146 private: | 146 private: |
147 void LoadDocInternal(); | 147 void LoadDocInternal(); |
148 }; | 148 }; |
149 | 149 |
150 #endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_DOCUMENT_H_ | 150 #endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_DOCUMENT_H_ |
OLD | NEW |