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_PARSER_CPDF_DOCUMENT_H_ | 7 #ifndef CORE_FPDFAPI_PARSER_CPDF_DOCUMENT_H_ |
8 #define CORE_FPDFAPI_PARSER_CPDF_DOCUMENT_H_ | 8 #define CORE_FPDFAPI_PARSER_CPDF_DOCUMENT_H_ |
9 | 9 |
10 #include <functional> | 10 #include <functional> |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 FX_BOOL bVert, | 98 FX_BOOL bVert, |
99 FX_BOOL bTranslateName = FALSE); | 99 FX_BOOL bTranslateName = FALSE); |
100 CPDF_Font* AddWindowsFont(LOGFONTW* pLogFont, | 100 CPDF_Font* AddWindowsFont(LOGFONTW* pLogFont, |
101 FX_BOOL bVert, | 101 FX_BOOL bVert, |
102 FX_BOOL bTranslateName = FALSE); | 102 FX_BOOL bTranslateName = FALSE); |
103 #endif | 103 #endif |
104 | 104 |
105 protected: | 105 protected: |
106 // Retrieve page count information by getting count value from the tree nodes | 106 // Retrieve page count information by getting count value from the tree nodes |
107 int RetrievePageCount() const; | 107 int RetrievePageCount() const; |
108 CPDF_Dictionary* FindPDFPage(CPDF_Dictionary* pPages, | 108 CPDF_Dictionary* TraversePDFPages(int iPage, int& nPagesToGo, int level); |
109 int iPage, | |
110 int nPagesToGo, | |
111 int level); | |
112 int FindPageIndex(CPDF_Dictionary* pNode, | 109 int FindPageIndex(CPDF_Dictionary* pNode, |
113 uint32_t& skip_count, | 110 uint32_t& skip_count, |
114 uint32_t objnum, | 111 uint32_t objnum, |
115 int& index, | 112 int& index, |
116 int level = 0); | 113 int level = 0); |
117 CPDF_Object* ParseIndirectObject(uint32_t objnum) override; | 114 CPDF_Object* ParseIndirectObject(uint32_t objnum) override; |
118 void LoadDocInternal(); | 115 void LoadDocInternal(); |
119 size_t CalculateEncodingDict(int charset, CPDF_Dictionary* pBaseDict); | 116 size_t CalculateEncodingDict(int charset, CPDF_Dictionary* pBaseDict); |
120 CPDF_Dictionary* GetPagesDict() const; | 117 CPDF_Dictionary* GetPagesDict() const; |
121 CPDF_Dictionary* ProcessbCJK( | 118 CPDF_Dictionary* ProcessbCJK( |
122 CPDF_Dictionary* pBaseDict, | 119 CPDF_Dictionary* pBaseDict, |
123 int charset, | 120 int charset, |
124 FX_BOOL bVert, | 121 FX_BOOL bVert, |
125 CFX_ByteString basefont, | 122 CFX_ByteString basefont, |
126 std::function<void(FX_WCHAR, FX_WCHAR, CPDF_Array*)> Insert); | 123 std::function<void(FX_WCHAR, FX_WCHAR, CPDF_Array*)> Insert); |
| 124 int InsertDeletePDFPage(CPDF_Dictionary* pPages, |
| 125 int nPagesToGo, |
| 126 CPDF_Dictionary* pPage, |
| 127 FX_BOOL bInsert, |
| 128 std::set<CPDF_Dictionary*>* pVisited); |
| 129 int InsertNewPage(int iPage, |
| 130 CPDF_Dictionary* pPageDict, |
| 131 CFX_ArrayTemplate<uint32_t>& pageList); |
127 | 132 |
128 std::unique_ptr<CPDF_Parser> m_pParser; | 133 std::unique_ptr<CPDF_Parser> m_pParser; |
129 CPDF_Dictionary* m_pRootDict; | 134 CPDF_Dictionary* m_pRootDict; |
130 CPDF_Dictionary* m_pInfoDict; | 135 CPDF_Dictionary* m_pInfoDict; |
| 136 // Vector of nodes to know current position in the page tree. Int is the index |
| 137 // of the child being processed. |
| 138 std::vector<std::pair<CPDF_Dictionary*, int>> m_pTreeTraversal; |
| 139 // Index of last page (leaf) processed from page tree. |
| 140 int m_iLastPageTraversed; |
131 bool m_bLinearized; | 141 bool m_bLinearized; |
132 int m_iFirstPageNo; | 142 int m_iFirstPageNo; |
133 uint32_t m_dwFirstPageObjNum; | 143 uint32_t m_dwFirstPageObjNum; |
134 // TODO(thestig): Figure out why this cannot be a std::unique_ptr. | 144 // TODO(thestig): Figure out why this cannot be a std::unique_ptr. |
135 CPDF_DocPageData* m_pDocPage; | 145 CPDF_DocPageData* m_pDocPage; |
136 std::unique_ptr<CPDF_DocRenderData> m_pDocRender; | 146 std::unique_ptr<CPDF_DocRenderData> m_pDocRender; |
137 std::unique_ptr<JBig2_DocumentContext> m_pCodecContext; | 147 std::unique_ptr<JBig2_DocumentContext> m_pCodecContext; |
138 std::unique_ptr<CPDF_LinkList> m_pLinksContext; | 148 std::unique_ptr<CPDF_LinkList> m_pLinksContext; |
139 CFX_ArrayTemplate<uint32_t> m_PageList; | 149 CFX_ArrayTemplate<uint32_t> m_PageList; |
140 CFX_WeakPtr<CFX_ByteStringPool> m_pByteStringPool; | 150 CFX_WeakPtr<CFX_ByteStringPool> m_pByteStringPool; |
141 }; | 151 }; |
142 | 152 |
143 #endif // CORE_FPDFAPI_PARSER_CPDF_DOCUMENT_H_ | 153 #endif // CORE_FPDFAPI_PARSER_CPDF_DOCUMENT_H_ |
OLD | NEW |