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

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

Issue 2334323005: Rename dictionary set and get methods (Closed)
Patch Set: Created 4 years, 3 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/javascript/Document.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 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 #include "fpdfsdk/fpdfxfa/include/cpdfxfa_docenvironment.h" 7 #include "fpdfsdk/fpdfxfa/include/cpdfxfa_docenvironment.h"
8 8
9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_string.h"
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 379
380 void CPDFXFA_DocEnvironment::GetTitle(CXFA_FFDoc* hDoc, 380 void CPDFXFA_DocEnvironment::GetTitle(CXFA_FFDoc* hDoc,
381 CFX_WideString& wsTitle) { 381 CFX_WideString& wsTitle) {
382 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetPDFDoc()) 382 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetPDFDoc())
383 return; 383 return;
384 384
385 CPDF_Dictionary* pInfoDict = m_pDocument->GetPDFDoc()->GetInfo(); 385 CPDF_Dictionary* pInfoDict = m_pDocument->GetPDFDoc()->GetInfo();
386 if (!pInfoDict) 386 if (!pInfoDict)
387 return; 387 return;
388 388
389 CFX_ByteString csTitle = pInfoDict->GetStringBy("Title"); 389 CFX_ByteString csTitle = pInfoDict->GetStringFor("Title");
390 wsTitle = wsTitle.FromLocal(csTitle.GetBuffer(csTitle.GetLength())); 390 wsTitle = wsTitle.FromLocal(csTitle.GetBuffer(csTitle.GetLength()));
391 csTitle.ReleaseBuffer(csTitle.GetLength()); 391 csTitle.ReleaseBuffer(csTitle.GetLength());
392 } 392 }
393 393
394 void CPDFXFA_DocEnvironment::SetTitle(CXFA_FFDoc* hDoc, 394 void CPDFXFA_DocEnvironment::SetTitle(CXFA_FFDoc* hDoc,
395 const CFX_WideString& wsTitle) { 395 const CFX_WideString& wsTitle) {
396 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetPDFDoc()) 396 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetPDFDoc())
397 return; 397 return;
398 398
399 if (CPDF_Dictionary* pInfoDict = m_pDocument->GetPDFDoc()->GetInfo()) 399 if (CPDF_Dictionary* pInfoDict = m_pDocument->GetPDFDoc()->GetInfo())
400 pInfoDict->SetAt("Title", new CPDF_String(wsTitle)); 400 pInfoDict->SetFor("Title", new CPDF_String(wsTitle));
401 } 401 }
402 402
403 void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc, 403 void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc,
404 const CFX_WideString& wsFilePath, 404 const CFX_WideString& wsFilePath,
405 FX_BOOL bXDP) { 405 FX_BOOL bXDP) {
406 if (hDoc != m_pDocument->GetXFADoc()) 406 if (hDoc != m_pDocument->GetXFADoc())
407 return; 407 return;
408 408
409 if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA && 409 if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA &&
410 m_pDocument->GetDocType() != DOCTYPE_STATIC_XFA) 410 m_pDocument->GetDocType() != DOCTYPE_STATIC_XFA)
(...skipping 29 matching lines...) Expand all
440 m_pDocument->GetXFADocView()->GetDoc()->SavePackage(XFA_HASHCODE_Data, 440 m_pDocument->GetXFADocView()->GetDoc()->SavePackage(XFA_HASHCODE_Data,
441 &fileWrite, nullptr); 441 &fileWrite, nullptr);
442 } else if (fileType == FXFA_SAVEAS_XDP) { 442 } else if (fileType == FXFA_SAVEAS_XDP) {
443 if (!m_pDocument->GetPDFDoc()) 443 if (!m_pDocument->GetPDFDoc())
444 return; 444 return;
445 445
446 CPDF_Dictionary* pRoot = m_pDocument->GetPDFDoc()->GetRoot(); 446 CPDF_Dictionary* pRoot = m_pDocument->GetPDFDoc()->GetRoot();
447 if (!pRoot) 447 if (!pRoot)
448 return; 448 return;
449 449
450 CPDF_Dictionary* pAcroForm = pRoot->GetDictBy("AcroForm"); 450 CPDF_Dictionary* pAcroForm = pRoot->GetDictFor("AcroForm");
451 if (!pAcroForm) 451 if (!pAcroForm)
452 return; 452 return;
453 453
454 CPDF_Array* pArray = ToArray(pAcroForm->GetObjectBy("XFA")); 454 CPDF_Array* pArray = ToArray(pAcroForm->GetObjectFor("XFA"));
455 if (!pArray) 455 if (!pArray)
456 return; 456 return;
457 457
458 int size = pArray->GetCount(); 458 int size = pArray->GetCount();
459 for (int i = 1; i < size; i += 2) { 459 for (int i = 1; i < size; i += 2) {
460 CPDF_Object* pPDFObj = pArray->GetObjectAt(i); 460 CPDF_Object* pPDFObj = pArray->GetObjectAt(i);
461 CPDF_Object* pPrePDFObj = pArray->GetObjectAt(i - 1); 461 CPDF_Object* pPrePDFObj = pArray->GetObjectAt(i - 1);
462 if (!pPrePDFObj->IsString()) 462 if (!pPrePDFObj->IsString())
463 continue; 463 continue;
464 if (!pPDFObj->IsReference()) 464 if (!pPDFObj->IsReference())
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 fileStream.Flush(); 741 fileStream.Flush();
742 return FALSE; 742 return FALSE;
743 } 743 }
744 744
745 CPDF_Dictionary* pRoot = m_pDocument->GetPDFDoc()->GetRoot(); 745 CPDF_Dictionary* pRoot = m_pDocument->GetPDFDoc()->GetRoot();
746 if (!pRoot) { 746 if (!pRoot) {
747 fileStream.Flush(); 747 fileStream.Flush();
748 return FALSE; 748 return FALSE;
749 } 749 }
750 750
751 CPDF_Dictionary* pAcroForm = pRoot->GetDictBy("AcroForm"); 751 CPDF_Dictionary* pAcroForm = pRoot->GetDictFor("AcroForm");
752 if (!pAcroForm) { 752 if (!pAcroForm) {
753 fileStream.Flush(); 753 fileStream.Flush();
754 return FALSE; 754 return FALSE;
755 } 755 }
756 756
757 CPDF_Array* pArray = ToArray(pAcroForm->GetObjectBy("XFA")); 757 CPDF_Array* pArray = ToArray(pAcroForm->GetObjectFor("XFA"));
758 if (!pArray) { 758 if (!pArray) {
759 fileStream.Flush(); 759 fileStream.Flush();
760 return FALSE; 760 return FALSE;
761 } 761 }
762 762
763 int size = pArray->GetCount(); 763 int size = pArray->GetCount();
764 for (int i = 1; i < size; i += 2) { 764 for (int i = 1; i < size; i += 2) {
765 CPDF_Object* pPDFObj = pArray->GetObjectAt(i); 765 CPDF_Object* pPDFObj = pArray->GetObjectAt(i);
766 CPDF_Object* pPrePDFObj = pArray->GetObjectAt(i - 1); 766 CPDF_Object* pPrePDFObj = pArray->GetObjectAt(i - 1);
767 if (!pPrePDFObj->IsString()) 767 if (!pPrePDFObj->IsString())
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 if (!m_pJSContext) { 1012 if (!m_pJSContext) {
1013 m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->SetReaderDocument( 1013 m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->SetReaderDocument(
1014 m_pDocument->GetSDKDoc()); 1014 m_pDocument->GetSDKDoc());
1015 m_pJSContext = 1015 m_pJSContext =
1016 m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->NewContext(); 1016 m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->NewContext();
1017 } 1017 }
1018 1018
1019 return m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->GetValueByName( 1019 return m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->GetValueByName(
1020 szPropName, pValue); 1020 szPropName, pValue);
1021 } 1021 }
OLDNEW
« no previous file with comments | « fpdfsdk/fpdfview.cpp ('k') | fpdfsdk/javascript/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698