| OLD | NEW |
| 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 "xfa/fxfa/include/xfa_ffdoc.h" | 7 #include "xfa/fxfa/include/xfa_ffdoc.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 return TRUE; | 296 return TRUE; |
| 297 } | 297 } |
| 298 FX_BOOL CXFA_FFDoc::OpenDoc(CPDF_Document* pPDFDoc) { | 298 FX_BOOL CXFA_FFDoc::OpenDoc(CPDF_Document* pPDFDoc) { |
| 299 if (!pPDFDoc) | 299 if (!pPDFDoc) |
| 300 return FALSE; | 300 return FALSE; |
| 301 | 301 |
| 302 CPDF_Dictionary* pRoot = pPDFDoc->GetRoot(); | 302 CPDF_Dictionary* pRoot = pPDFDoc->GetRoot(); |
| 303 if (!pRoot) | 303 if (!pRoot) |
| 304 return FALSE; | 304 return FALSE; |
| 305 | 305 |
| 306 CPDF_Dictionary* pAcroForm = pRoot->GetDictBy("AcroForm"); | 306 CPDF_Dictionary* pAcroForm = pRoot->GetDictFor("AcroForm"); |
| 307 if (!pAcroForm) | 307 if (!pAcroForm) |
| 308 return FALSE; | 308 return FALSE; |
| 309 | 309 |
| 310 CPDF_Object* pElementXFA = pAcroForm->GetDirectObjectBy("XFA"); | 310 CPDF_Object* pElementXFA = pAcroForm->GetDirectObjectFor("XFA"); |
| 311 if (!pElementXFA) | 311 if (!pElementXFA) |
| 312 return FALSE; | 312 return FALSE; |
| 313 | 313 |
| 314 CFX_ArrayTemplate<CPDF_Stream*> xfaStreams; | 314 CFX_ArrayTemplate<CPDF_Stream*> xfaStreams; |
| 315 if (pElementXFA->IsArray()) { | 315 if (pElementXFA->IsArray()) { |
| 316 CPDF_Array* pXFAArray = (CPDF_Array*)pElementXFA; | 316 CPDF_Array* pXFAArray = (CPDF_Array*)pElementXFA; |
| 317 for (size_t i = 0; i < pXFAArray->GetCount() / 2; i++) { | 317 for (size_t i = 0; i < pXFAArray->GetCount() / 2; i++) { |
| 318 if (CPDF_Stream* pStream = pXFAArray->GetStreamAt(i * 2 + 1)) | 318 if (CPDF_Stream* pStream = pXFAArray->GetStreamAt(i * 2 + 1)) |
| 319 xfaStreams.Add(pStream); | 319 xfaStreams.Add(pStream); |
| 320 } | 320 } |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 if (it != m_HashToDibDpiMap.end()) { | 380 if (it != m_HashToDibDpiMap.end()) { |
| 381 iImageXDpi = it->second.iImageXDpi; | 381 iImageXDpi = it->second.iImageXDpi; |
| 382 iImageYDpi = it->second.iImageYDpi; | 382 iImageYDpi = it->second.iImageYDpi; |
| 383 return static_cast<CFX_DIBitmap*>(it->second.pDibSource); | 383 return static_cast<CFX_DIBitmap*>(it->second.pDibSource); |
| 384 } | 384 } |
| 385 | 385 |
| 386 CPDF_Dictionary* pRoot = m_pPDFDoc->GetRoot(); | 386 CPDF_Dictionary* pRoot = m_pPDFDoc->GetRoot(); |
| 387 if (!pRoot) | 387 if (!pRoot) |
| 388 return nullptr; | 388 return nullptr; |
| 389 | 389 |
| 390 CPDF_Dictionary* pNames = pRoot->GetDictBy("Names"); | 390 CPDF_Dictionary* pNames = pRoot->GetDictFor("Names"); |
| 391 if (!pNames) | 391 if (!pNames) |
| 392 return nullptr; | 392 return nullptr; |
| 393 | 393 |
| 394 CPDF_Dictionary* pXFAImages = pNames->GetDictBy("XFAImages"); | 394 CPDF_Dictionary* pXFAImages = pNames->GetDictFor("XFAImages"); |
| 395 if (!pXFAImages) | 395 if (!pXFAImages) |
| 396 return nullptr; | 396 return nullptr; |
| 397 | 397 |
| 398 CPDF_NameTree nametree(pXFAImages); | 398 CPDF_NameTree nametree(pXFAImages); |
| 399 CFX_ByteString bsName = PDF_EncodeText(wsName.c_str(), wsName.GetLength()); | 399 CFX_ByteString bsName = PDF_EncodeText(wsName.c_str(), wsName.GetLength()); |
| 400 CPDF_Object* pObject = nametree.LookupValue(bsName); | 400 CPDF_Object* pObject = nametree.LookupValue(bsName); |
| 401 if (!pObject) { | 401 if (!pObject) { |
| 402 for (size_t i = 0; i < nametree.GetCount(); i++) { | 402 for (size_t i = 0; i < nametree.GetCount(); i++) { |
| 403 CFX_ByteString bsTemp; | 403 CFX_ByteString bsTemp; |
| 404 CPDF_Object* pTempObject = nametree.LookupValue(i, bsTemp); | 404 CPDF_Object* pTempObject = nametree.LookupValue(i, bsTemp); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 | 443 |
| 444 return !!pExport->Export( | 444 return !!pExport->Export( |
| 445 pFile, pNode, 0, bsChecksum.GetLength() ? bsChecksum.c_str() : nullptr); | 445 pFile, pNode, 0, bsChecksum.GetLength() ? bsChecksum.c_str() : nullptr); |
| 446 } | 446 } |
| 447 | 447 |
| 448 FX_BOOL CXFA_FFDoc::ImportData(IFX_FileRead* pStream, FX_BOOL bXDP) { | 448 FX_BOOL CXFA_FFDoc::ImportData(IFX_FileRead* pStream, FX_BOOL bXDP) { |
| 449 std::unique_ptr<CXFA_DataImporter> importer( | 449 std::unique_ptr<CXFA_DataImporter> importer( |
| 450 new CXFA_DataImporter(m_pDocumentParser->GetDocument())); | 450 new CXFA_DataImporter(m_pDocumentParser->GetDocument())); |
| 451 return importer->ImportData(pStream); | 451 return importer->ImportData(pStream); |
| 452 } | 452 } |
| OLD | NEW |