| 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> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <stack> | |
| 13 | 12 |
| 14 #include "core/fpdfapi/parser/cpdf_indirect_object_holder.h" | 13 #include "core/fpdfapi/parser/cpdf_indirect_object_holder.h" |
| 15 #include "core/fpdfapi/parser/cpdf_object.h" | 14 #include "core/fpdfapi/parser/cpdf_object.h" |
| 16 #include "core/fpdfdoc/cpdf_linklist.h" | 15 #include "core/fpdfdoc/cpdf_linklist.h" |
| 17 #include "core/fxcrt/cfx_string_pool_template.h" | 16 #include "core/fxcrt/cfx_string_pool_template.h" |
| 18 #include "core/fxcrt/cfx_weak_ptr.h" | 17 #include "core/fxcrt/cfx_weak_ptr.h" |
| 19 #include "core/fxcrt/fx_basic.h" | 18 #include "core/fxcrt/fx_basic.h" |
| 20 | 19 |
| 21 class CFX_Font; | 20 class CFX_Font; |
| 22 class CFX_Matrix; | 21 class CFX_Matrix; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 CPDF_Font* AddWindowsFont(LOGFONTW* pLogFont, | 100 CPDF_Font* AddWindowsFont(LOGFONTW* pLogFont, |
| 102 FX_BOOL bVert, | 101 FX_BOOL bVert, |
| 103 FX_BOOL bTranslateName = FALSE); | 102 FX_BOOL bTranslateName = FALSE); |
| 104 #endif | 103 #endif |
| 105 | 104 |
| 106 private: | 105 private: |
| 107 friend class CPDF_TestDocument; | 106 friend class CPDF_TestDocument; |
| 108 | 107 |
| 109 // Retrieve page count information by getting count value from the tree nodes | 108 // Retrieve page count information by getting count value from the tree nodes |
| 110 int RetrievePageCount() const; | 109 int RetrievePageCount() const; |
| 111 CPDF_Dictionary* TraversePDFPages(int iPage, int nPagesToGo); | 110 CPDF_Dictionary* FindPDFPage(CPDF_Dictionary* pPages, |
| 111 int iPage, |
| 112 int nPagesToGo, |
| 113 int level); |
| 112 int FindPageIndex(CPDF_Dictionary* pNode, | 114 int FindPageIndex(CPDF_Dictionary* pNode, |
| 113 uint32_t& skip_count, | 115 uint32_t& skip_count, |
| 114 uint32_t objnum, | 116 uint32_t objnum, |
| 115 int& index, | 117 int& index, |
| 116 int level = 0); | 118 int level = 0); |
| 117 CPDF_Object* ParseIndirectObject(uint32_t objnum) override; | 119 CPDF_Object* ParseIndirectObject(uint32_t objnum) override; |
| 118 void LoadDocInternal(); | 120 void LoadDocInternal(); |
| 119 size_t CalculateEncodingDict(int charset, CPDF_Dictionary* pBaseDict); | 121 size_t CalculateEncodingDict(int charset, CPDF_Dictionary* pBaseDict); |
| 120 CPDF_Dictionary* GetPagesDict() const; | 122 CPDF_Dictionary* GetPagesDict() const; |
| 121 CPDF_Dictionary* ProcessbCJK( | 123 CPDF_Dictionary* ProcessbCJK( |
| 122 CPDF_Dictionary* pBaseDict, | 124 CPDF_Dictionary* pBaseDict, |
| 123 int charset, | 125 int charset, |
| 124 FX_BOOL bVert, | 126 FX_BOOL bVert, |
| 125 CFX_ByteString basefont, | 127 CFX_ByteString basefont, |
| 126 std::function<void(FX_WCHAR, FX_WCHAR, CPDF_Array*)> Insert); | 128 std::function<void(FX_WCHAR, FX_WCHAR, CPDF_Array*)> Insert); |
| 127 int InsertDeletePDFPage(CPDF_Dictionary* pPages, | 129 |
| 128 int nPagesToGo, | |
| 129 CPDF_Dictionary* pPage, | |
| 130 FX_BOOL bInsert, | |
| 131 std::set<CPDF_Dictionary*>* pVisited); | |
| 132 int InsertNewPage(int iPage, | |
| 133 CPDF_Dictionary* pPageDict, | |
| 134 CFX_ArrayTemplate<uint32_t>& pageList); | |
| 135 std::unique_ptr<CPDF_Parser> m_pParser; | 130 std::unique_ptr<CPDF_Parser> m_pParser; |
| 136 CPDF_Dictionary* m_pRootDict; | 131 CPDF_Dictionary* m_pRootDict; |
| 137 CPDF_Dictionary* m_pInfoDict; | 132 CPDF_Dictionary* m_pInfoDict; |
| 138 std::stack<std::pair<CPDF_Dictionary*, int>> m_pTreeTraversal; | |
| 139 int m_iLastPageTraversed; | |
| 140 bool m_bLinearized; | 133 bool m_bLinearized; |
| 141 int m_iFirstPageNo; | 134 int m_iFirstPageNo; |
| 142 uint32_t m_dwFirstPageObjNum; | 135 uint32_t m_dwFirstPageObjNum; |
| 143 // TODO(thestig): Figure out why this cannot be a std::unique_ptr. | 136 // TODO(thestig): Figure out why this cannot be a std::unique_ptr. |
| 144 CPDF_DocPageData* m_pDocPage; | 137 CPDF_DocPageData* m_pDocPage; |
| 145 std::unique_ptr<CPDF_DocRenderData> m_pDocRender; | 138 std::unique_ptr<CPDF_DocRenderData> m_pDocRender; |
| 146 std::unique_ptr<JBig2_DocumentContext> m_pCodecContext; | 139 std::unique_ptr<JBig2_DocumentContext> m_pCodecContext; |
| 147 std::unique_ptr<CPDF_LinkList> m_pLinksContext; | 140 std::unique_ptr<CPDF_LinkList> m_pLinksContext; |
| 148 CFX_ArrayTemplate<uint32_t> m_PageList; | 141 CFX_ArrayTemplate<uint32_t> m_PageList; |
| 149 CFX_WeakPtr<CFX_ByteStringPool> m_pByteStringPool; | 142 CFX_WeakPtr<CFX_ByteStringPool> m_pByteStringPool; |
| 150 }; | 143 }; |
| 151 | 144 |
| 152 #endif // CORE_FPDFAPI_PARSER_CPDF_DOCUMENT_H_ | 145 #endif // CORE_FPDFAPI_PARSER_CPDF_DOCUMENT_H_ |
| OLD | NEW |