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_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 bool bVert, | 98 bool bVert, |
| 99 bool bTranslateName = false); | 99 bool bTranslateName = false); |
| 100 CPDF_Font* AddWindowsFont(LOGFONTW* pLogFont, | 100 CPDF_Font* AddWindowsFont(LOGFONTW* pLogFont, |
| 101 bool bVert, | 101 bool bVert, |
| 102 bool bTranslateName = false); | 102 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); |
|
Tom Sepez
2016/11/03 22:31:00
nit: the style guide would say int* nPagesToGo.
npm
2016/11/04 19:33:33
Done.
| |
| 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 bool bVert, | 121 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); |
| 127 bool InsertDeletePDFPage(CPDF_Dictionary* pPages, | 124 bool InsertDeletePDFPage(CPDF_Dictionary* pPages, |
| 128 int nPagesToGo, | 125 int nPagesToGo, |
| 129 CPDF_Dictionary* pPageDict, | 126 CPDF_Dictionary* pPageDict, |
| 130 bool bInsert, | 127 bool bInsert, |
| 131 std::set<CPDF_Dictionary*>* pVisited); | 128 std::set<CPDF_Dictionary*>* pVisited); |
| 132 bool InsertNewPage(int iPage, CPDF_Dictionary* pPageDict); | 129 bool InsertNewPage(int iPage, CPDF_Dictionary* pPageDict); |
| 133 | 130 |
| 134 std::unique_ptr<CPDF_Parser> m_pParser; | 131 std::unique_ptr<CPDF_Parser> m_pParser; |
| 135 CPDF_Dictionary* m_pRootDict; | 132 CPDF_Dictionary* m_pRootDict; |
| 136 CPDF_Dictionary* m_pInfoDict; | 133 CPDF_Dictionary* m_pInfoDict; |
| 134 // Vector of nodes to know current position in the page tree. Int is the index | |
|
Lei Zhang
2016/11/04 01:38:52
Maybe mention the index into this vector is the le
npm
2016/11/04 19:33:33
Done.
| |
| 135 // of the child being processed. | |
|
Tom Sepez
2016/11/03 22:31:00
nit: // of the child being processed within the d
npm
2016/11/04 19:33:33
Done.
| |
| 136 std::vector<std::pair<CPDF_Dictionary*, int>> m_pTreeTraversal; | |
|
Lei Zhang
2016/11/04 01:38:52
Should the int also be a size_t here?
npm
2016/11/04 19:33:33
Done.
| |
| 137 // Index of the next page that will be traversed from the page tree. | |
| 138 int m_iNextPageToTraverse; | |
| 137 bool m_bLinearized; | 139 bool m_bLinearized; |
| 138 int m_iFirstPageNo; | 140 int m_iFirstPageNo; |
| 139 uint32_t m_dwFirstPageObjNum; | 141 uint32_t m_dwFirstPageObjNum; |
| 140 // TODO(thestig): Figure out why this cannot be a std::unique_ptr. | 142 // TODO(thestig): Figure out why this cannot be a std::unique_ptr. |
| 141 CPDF_DocPageData* m_pDocPage; | 143 CPDF_DocPageData* m_pDocPage; |
| 142 std::unique_ptr<CPDF_DocRenderData> m_pDocRender; | 144 std::unique_ptr<CPDF_DocRenderData> m_pDocRender; |
| 143 std::unique_ptr<JBig2_DocumentContext> m_pCodecContext; | 145 std::unique_ptr<JBig2_DocumentContext> m_pCodecContext; |
| 144 std::unique_ptr<CPDF_LinkList> m_pLinksContext; | 146 std::unique_ptr<CPDF_LinkList> m_pLinksContext; |
| 145 CFX_ArrayTemplate<uint32_t> m_PageList; | 147 CFX_ArrayTemplate<uint32_t> m_PageList; |
| 146 CFX_WeakPtr<CFX_ByteStringPool> m_pByteStringPool; | 148 CFX_WeakPtr<CFX_ByteStringPool> m_pByteStringPool; |
| 147 }; | 149 }; |
| 148 | 150 |
| 149 #endif // CORE_FPDFAPI_PARSER_CPDF_DOCUMENT_H_ | 151 #endif // CORE_FPDFAPI_PARSER_CPDF_DOCUMENT_H_ |
| OLD | NEW |