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

Side by Side Diff: fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp

Issue 1841173002: Rename GetElementValue() to GetDirectObject{By,At}(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Fix test name Created 4 years, 8 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
« no previous file with comments | « fpdfsdk/fpdfview.cpp ('k') | fpdfsdk/fsdk_baseannot.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/fpdfapi/fpdf_parser/include/cpdf_array.h" 7 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
8 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" 8 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
9 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h"
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_string.h"
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 } 670 }
671 } else if (fileType == FXFA_SAVEAS_XDP) { 671 } else if (fileType == FXFA_SAVEAS_XDP) {
672 if (m_pPDFDoc == NULL) 672 if (m_pPDFDoc == NULL)
673 return; 673 return;
674 CPDF_Dictionary* pRoot = m_pPDFDoc->GetRoot(); 674 CPDF_Dictionary* pRoot = m_pPDFDoc->GetRoot();
675 if (pRoot == NULL) 675 if (pRoot == NULL)
676 return; 676 return;
677 CPDF_Dictionary* pAcroForm = pRoot->GetDictBy("AcroForm"); 677 CPDF_Dictionary* pAcroForm = pRoot->GetDictBy("AcroForm");
678 if (NULL == pAcroForm) 678 if (NULL == pAcroForm)
679 return; 679 return;
680 CPDF_Object* pXFA = pAcroForm->GetElement("XFA"); 680 CPDF_Object* pXFA = pAcroForm->GetObjectBy("XFA");
681 if (pXFA == NULL) 681 if (pXFA == NULL)
682 return; 682 return;
683 if (!pXFA->IsArray()) 683 if (!pXFA->IsArray())
684 return; 684 return;
685 CPDF_Array* pArray = pXFA->GetArray(); 685 CPDF_Array* pArray = pXFA->GetArray();
686 if (NULL == pArray) 686 if (NULL == pArray)
687 return; 687 return;
688 int size = pArray->GetCount(); 688 int size = pArray->GetCount();
689 for (int i = 1; i < size; i += 2) { 689 for (int i = 1; i < size; i += 2) {
690 CPDF_Object* pPDFObj = pArray->GetElement(i); 690 CPDF_Object* pPDFObj = pArray->GetObjectAt(i);
691 CPDF_Object* pPrePDFObj = pArray->GetElement(i - 1); 691 CPDF_Object* pPrePDFObj = pArray->GetObjectAt(i - 1);
692 if (!pPrePDFObj->IsString()) 692 if (!pPrePDFObj->IsString())
693 continue; 693 continue;
694 if (!pPDFObj->IsReference()) 694 if (!pPDFObj->IsReference())
695 continue; 695 continue;
696 CPDF_Object* pDirectObj = pPDFObj->GetDirect(); 696 CPDF_Object* pDirectObj = pPDFObj->GetDirect();
697 if (!pDirectObj->IsStream()) 697 if (!pDirectObj->IsStream())
698 continue; 698 continue;
699 if (pPrePDFObj->GetString() == "form") { 699 if (pPrePDFObj->GetString() == "form") {
700 CFX_WideStringC form(L"form"); 700 CFX_WideStringC form(L"form");
701 pXFADocHander->SavePackage(m_pXFADocView->GetDoc(), form, &fileWrite); 701 pXFADocHander->SavePackage(m_pXFADocView->GetDoc(), form, &fileWrite);
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 CPDF_Dictionary* pRoot = m_pPDFDoc->GetRoot(); 975 CPDF_Dictionary* pRoot = m_pPDFDoc->GetRoot();
976 if (pRoot == NULL) { 976 if (pRoot == NULL) {
977 fileStream.Flush(); 977 fileStream.Flush();
978 return FALSE; 978 return FALSE;
979 } 979 }
980 CPDF_Dictionary* pAcroForm = pRoot->GetDictBy("AcroForm"); 980 CPDF_Dictionary* pAcroForm = pRoot->GetDictBy("AcroForm");
981 if (NULL == pAcroForm) { 981 if (NULL == pAcroForm) {
982 fileStream.Flush(); 982 fileStream.Flush();
983 return FALSE; 983 return FALSE;
984 } 984 }
985 CPDF_Object* pXFA = pAcroForm->GetElement("XFA"); 985 CPDF_Object* pXFA = pAcroForm->GetObjectBy("XFA");
986 if (pXFA == NULL) { 986 if (pXFA == NULL) {
987 fileStream.Flush(); 987 fileStream.Flush();
988 return FALSE; 988 return FALSE;
989 } 989 }
990 if (!pXFA->IsArray()) { 990 if (!pXFA->IsArray()) {
991 fileStream.Flush(); 991 fileStream.Flush();
992 return FALSE; 992 return FALSE;
993 } 993 }
994 CPDF_Array* pArray = pXFA->GetArray(); 994 CPDF_Array* pArray = pXFA->GetArray();
995 if (NULL == pArray) { 995 if (NULL == pArray) {
996 fileStream.Flush(); 996 fileStream.Flush();
997 return FALSE; 997 return FALSE;
998 } 998 }
999 int size = pArray->GetCount(); 999 int size = pArray->GetCount();
1000 for (int i = 1; i < size; i += 2) { 1000 for (int i = 1; i < size; i += 2) {
1001 CPDF_Object* pPDFObj = pArray->GetElement(i); 1001 CPDF_Object* pPDFObj = pArray->GetObjectAt(i);
1002 CPDF_Object* pPrePDFObj = pArray->GetElement(i - 1); 1002 CPDF_Object* pPrePDFObj = pArray->GetObjectAt(i - 1);
1003 if (!pPrePDFObj->IsString()) 1003 if (!pPrePDFObj->IsString())
1004 continue; 1004 continue;
1005 if (!pPDFObj->IsReference()) 1005 if (!pPDFObj->IsReference())
1006 continue; 1006 continue;
1007 CPDF_Object* pDirectObj = pPDFObj->GetDirect(); 1007 CPDF_Object* pDirectObj = pPDFObj->GetDirect();
1008 if (!pDirectObj->IsStream()) 1008 if (!pDirectObj->IsStream())
1009 continue; 1009 continue;
1010 if (pPrePDFObj->GetString() == "config" && !(flag & FXFA_CONFIG)) 1010 if (pPrePDFObj->GetString() == "config" && !(flag & FXFA_CONFIG))
1011 continue; 1011 continue;
1012 if (pPrePDFObj->GetString() == "template" && !(flag & FXFA_TEMPLATE)) 1012 if (pPrePDFObj->GetString() == "template" && !(flag & FXFA_TEMPLATE))
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1278 } 1278 }
1279 1279
1280 return _GetHValueByName(szPropName, hValue, 1280 return _GetHValueByName(szPropName, hValue,
1281 m_pSDKDoc->GetEnv()->GetJSRuntime()); 1281 m_pSDKDoc->GetEnv()->GetJSRuntime());
1282 } 1282 }
1283 FX_BOOL CPDFXFA_Document::_GetHValueByName(const CFX_ByteStringC& utf8Name, 1283 FX_BOOL CPDFXFA_Document::_GetHValueByName(const CFX_ByteStringC& utf8Name,
1284 FXJSE_HVALUE hValue, 1284 FXJSE_HVALUE hValue,
1285 IJS_Runtime* runTime) { 1285 IJS_Runtime* runTime) {
1286 return runTime->GetHValueByName(utf8Name, hValue); 1286 return runTime->GetHValueByName(utf8Name, hValue);
1287 } 1287 }
OLDNEW
« no previous file with comments | « fpdfsdk/fpdfview.cpp ('k') | fpdfsdk/fsdk_baseannot.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698