Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(486)

Side by Side Diff: core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp

Issue 1630973002: Remove struct PARSE_OPTIONS. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Rebase, prior merge suspect. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 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 #include "core/include/fpdfapi/fpdf_parser.h" 7 #include "core/include/fpdfapi/fpdf_parser.h"
8 8
9 #include <set> 9 #include <set>
10 10
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 } 64 }
65 CPDF_DocRenderData* CPDF_Document::GetValidateRenderData() { 65 CPDF_DocRenderData* CPDF_Document::GetValidateRenderData() {
66 if (m_pDocRender) { 66 if (m_pDocRender) {
67 return m_pDocRender; 67 return m_pDocRender;
68 } 68 }
69 m_pDocRender = CPDF_ModuleMgr::Get()->GetRenderModule()->CreateDocData(this); 69 m_pDocRender = CPDF_ModuleMgr::Get()->GetRenderModule()->CreateDocData(this);
70 return m_pDocRender; 70 return m_pDocRender;
71 } 71 }
72 void CPDF_Document::LoadDoc() { 72 void CPDF_Document::LoadDoc() {
73 m_LastObjNum = m_pParser->GetLastObjNum(); 73 m_LastObjNum = m_pParser->GetLastObjNum();
74 CPDF_Object* pRootObj = 74 CPDF_Object* pRootObj = GetIndirectObject(m_pParser->GetRootObjNum());
75 GetIndirectObject(m_pParser->GetRootObjNum(), nullptr);
76 if (!pRootObj) { 75 if (!pRootObj) {
77 return; 76 return;
78 } 77 }
79 m_pRootDict = pRootObj->GetDict(); 78 m_pRootDict = pRootObj->GetDict();
80 if (!m_pRootDict) { 79 if (!m_pRootDict) {
81 return; 80 return;
82 } 81 }
83 CPDF_Object* pInfoObj = 82 CPDF_Object* pInfoObj = GetIndirectObject(m_pParser->GetInfoObjNum());
84 GetIndirectObject(m_pParser->GetInfoObjNum(), nullptr);
85 if (pInfoObj) { 83 if (pInfoObj) {
86 m_pInfoDict = pInfoObj->GetDict(); 84 m_pInfoDict = pInfoObj->GetDict();
87 } 85 }
88 CPDF_Array* pIDArray = m_pParser->GetIDArray(); 86 CPDF_Array* pIDArray = m_pParser->GetIDArray();
89 if (pIDArray) { 87 if (pIDArray) {
90 m_ID1 = pIDArray->GetString(0); 88 m_ID1 = pIDArray->GetString(0);
91 m_ID2 = pIDArray->GetString(1); 89 m_ID2 = pIDArray->GetString(1);
92 } 90 }
93 m_PageList.SetSize(RetrievePageCount()); 91 m_PageList.SetSize(RetrievePageCount());
94 } 92 }
95 void CPDF_Document::LoadAsynDoc(CPDF_Dictionary* pLinearized) { 93 void CPDF_Document::LoadAsynDoc(CPDF_Dictionary* pLinearized) {
96 m_bLinearized = TRUE; 94 m_bLinearized = TRUE;
97 m_LastObjNum = m_pParser->GetLastObjNum(); 95 m_LastObjNum = m_pParser->GetLastObjNum();
98 CPDF_Object* pIndirectObj = 96 CPDF_Object* pIndirectObj = GetIndirectObject(m_pParser->GetRootObjNum());
99 GetIndirectObject(m_pParser->GetRootObjNum(), nullptr);
100 m_pRootDict = pIndirectObj ? pIndirectObj->GetDict() : nullptr; 97 m_pRootDict = pIndirectObj ? pIndirectObj->GetDict() : nullptr;
101 if (!m_pRootDict) { 98 if (!m_pRootDict) {
102 return; 99 return;
103 } 100 }
104 pIndirectObj = GetIndirectObject(m_pParser->GetInfoObjNum(), nullptr); 101 pIndirectObj = GetIndirectObject(m_pParser->GetInfoObjNum());
105 m_pInfoDict = pIndirectObj ? pIndirectObj->GetDict() : nullptr; 102 m_pInfoDict = pIndirectObj ? pIndirectObj->GetDict() : nullptr;
106 CPDF_Array* pIDArray = m_pParser->GetIDArray(); 103 CPDF_Array* pIDArray = m_pParser->GetIDArray();
107 if (pIDArray) { 104 if (pIDArray) {
108 m_ID1 = pIDArray->GetString(0); 105 m_ID1 = pIDArray->GetString(0);
109 m_ID2 = pIDArray->GetString(1); 106 m_ID2 = pIDArray->GetString(1);
110 } 107 }
111 FX_DWORD dwPageCount = 0; 108 FX_DWORD dwPageCount = 0;
112 CPDF_Object* pCount = pLinearized->GetElement("N"); 109 CPDF_Object* pCount = pLinearized->GetElement("N");
113 if (ToNumber(pCount)) 110 if (ToNumber(pCount))
114 dwPageCount = pCount->GetInteger(); 111 dwPageCount = pCount->GetInteger();
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 } 172 }
176 return NULL; 173 return NULL;
177 } 174 }
178 175
179 CPDF_Dictionary* CPDF_Document::GetPage(int iPage) { 176 CPDF_Dictionary* CPDF_Document::GetPage(int iPage) {
180 if (iPage < 0 || iPage >= m_PageList.GetSize()) 177 if (iPage < 0 || iPage >= m_PageList.GetSize())
181 return nullptr; 178 return nullptr;
182 179
183 if (m_bLinearized && (iPage == (int)m_dwFirstPageNo)) { 180 if (m_bLinearized && (iPage == (int)m_dwFirstPageNo)) {
184 if (CPDF_Dictionary* pDict = 181 if (CPDF_Dictionary* pDict =
185 ToDictionary(GetIndirectObject(m_dwFirstPageObjNum, nullptr))) 182 ToDictionary(GetIndirectObject(m_dwFirstPageObjNum))) {
186 return pDict; 183 return pDict;
184 }
187 } 185 }
188 186
189 int objnum = m_PageList.GetAt(iPage); 187 int objnum = m_PageList.GetAt(iPage);
190 if (objnum) { 188 if (objnum) {
191 if (CPDF_Dictionary* pDict = 189 if (CPDF_Dictionary* pDict = ToDictionary(GetIndirectObject(objnum)))
192 ToDictionary(GetIndirectObject(objnum, nullptr))) {
193 return pDict; 190 return pDict;
194 }
195 } 191 }
196 192
197 CPDF_Dictionary* pRoot = GetRoot(); 193 CPDF_Dictionary* pRoot = GetRoot();
198 if (!pRoot) 194 if (!pRoot)
199 return nullptr; 195 return nullptr;
200 196
201 CPDF_Dictionary* pPages = pRoot->GetDict("Pages"); 197 CPDF_Dictionary* pPages = pRoot->GetDict("Pages");
202 if (!pPages) 198 if (!pPages)
203 return nullptr; 199 return nullptr;
204 200
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 333
338 void CPDF_Document::ClearPageData() { 334 void CPDF_Document::ClearPageData() {
339 if (m_pDocPage) 335 if (m_pDocPage)
340 CPDF_ModuleMgr::Get()->GetPageModule()->ClearDoc(this); 336 CPDF_ModuleMgr::Get()->GetPageModule()->ClearDoc(this);
341 } 337 }
342 338
343 void CPDF_Document::ClearRenderData() { 339 void CPDF_Document::ClearRenderData() {
344 if (m_pDocRender) 340 if (m_pDocRender)
345 CPDF_ModuleMgr::Get()->GetRenderModule()->ClearDocData(m_pDocRender); 341 CPDF_ModuleMgr::Get()->GetRenderModule()->ClearDocData(m_pDocRender);
346 } 342 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp ('k') | core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698