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 "fpdfsdk/include/fsdk_define.h" | 7 #include "fpdfsdk/include/fsdk_define.h" |
8 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h" | 8 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h" |
9 #include "fpdfsdk/include/fsdk_mgr.h" | 9 #include "fpdfsdk/include/fsdk_mgr.h" |
10 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_app.h" | 10 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_app.h" |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 void CPDFXFA_Document::GetTitle(IXFA_Doc* hDoc, CFX_WideString& wsTitle) { | 572 void CPDFXFA_Document::GetTitle(IXFA_Doc* hDoc, CFX_WideString& wsTitle) { |
573 if (hDoc != m_pXFADoc) | 573 if (hDoc != m_pXFADoc) |
574 return; | 574 return; |
575 if (m_pPDFDoc == NULL) | 575 if (m_pPDFDoc == NULL) |
576 return; | 576 return; |
577 CPDF_Dictionary* pInfoDict = m_pPDFDoc->GetInfo(); | 577 CPDF_Dictionary* pInfoDict = m_pPDFDoc->GetInfo(); |
578 | 578 |
579 if (pInfoDict == NULL) | 579 if (pInfoDict == NULL) |
580 return; | 580 return; |
581 | 581 |
582 CFX_ByteString csTitle = pInfoDict->GetString("Title"); | 582 CFX_ByteString csTitle = pInfoDict->GetStringBy("Title"); |
583 wsTitle = wsTitle.FromLocal(csTitle.GetBuffer(csTitle.GetLength())); | 583 wsTitle = wsTitle.FromLocal(csTitle.GetBuffer(csTitle.GetLength())); |
584 csTitle.ReleaseBuffer(csTitle.GetLength()); | 584 csTitle.ReleaseBuffer(csTitle.GetLength()); |
585 } | 585 } |
586 void CPDFXFA_Document::SetTitle(IXFA_Doc* hDoc, | 586 void CPDFXFA_Document::SetTitle(IXFA_Doc* hDoc, |
587 const CFX_WideStringC& wsTitle) { | 587 const CFX_WideStringC& wsTitle) { |
588 if (hDoc != m_pXFADoc) | 588 if (hDoc != m_pXFADoc) |
589 return; | 589 return; |
590 if (m_pPDFDoc == NULL) | 590 if (m_pPDFDoc == NULL) |
591 return; | 591 return; |
592 CPDF_Dictionary* pInfoDict = m_pPDFDoc->GetInfo(); | 592 CPDF_Dictionary* pInfoDict = m_pPDFDoc->GetInfo(); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 CFX_WideStringC data(L"data"); | 635 CFX_WideStringC data(L"data"); |
636 if (pXFADocHander->SavePackage(m_pXFADocView->GetDoc(), data, &fileWrite)) { | 636 if (pXFADocHander->SavePackage(m_pXFADocView->GetDoc(), data, &fileWrite)) { |
637 // TODO: Maybe report error. | 637 // TODO: Maybe report error. |
638 } | 638 } |
639 } else if (fileType == FXFA_SAVEAS_XDP) { | 639 } else if (fileType == FXFA_SAVEAS_XDP) { |
640 if (m_pPDFDoc == NULL) | 640 if (m_pPDFDoc == NULL) |
641 return; | 641 return; |
642 CPDF_Dictionary* pRoot = m_pPDFDoc->GetRoot(); | 642 CPDF_Dictionary* pRoot = m_pPDFDoc->GetRoot(); |
643 if (pRoot == NULL) | 643 if (pRoot == NULL) |
644 return; | 644 return; |
645 CPDF_Dictionary* pAcroForm = pRoot->GetDict("AcroForm"); | 645 CPDF_Dictionary* pAcroForm = pRoot->GetDictBy("AcroForm"); |
646 if (NULL == pAcroForm) | 646 if (NULL == pAcroForm) |
647 return; | 647 return; |
648 CPDF_Object* pXFA = pAcroForm->GetElement("XFA"); | 648 CPDF_Object* pXFA = pAcroForm->GetElement("XFA"); |
649 if (pXFA == NULL) | 649 if (pXFA == NULL) |
650 return; | 650 return; |
651 if (!pXFA->IsArray()) | 651 if (!pXFA->IsArray()) |
652 return; | 652 return; |
653 CPDF_Array* pArray = pXFA->GetArray(); | 653 CPDF_Array* pArray = pXFA->GetArray(); |
654 if (NULL == pArray) | 654 if (NULL == pArray) |
655 return; | 655 return; |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
940 FXFA_XMPMETA | FXFA_XFDF | FXFA_FORM; | 940 FXFA_XMPMETA | FXFA_XFDF | FXFA_FORM; |
941 if (m_pPDFDoc == NULL) { | 941 if (m_pPDFDoc == NULL) { |
942 fileStream.Flush(); | 942 fileStream.Flush(); |
943 return FALSE; | 943 return FALSE; |
944 } | 944 } |
945 CPDF_Dictionary* pRoot = m_pPDFDoc->GetRoot(); | 945 CPDF_Dictionary* pRoot = m_pPDFDoc->GetRoot(); |
946 if (pRoot == NULL) { | 946 if (pRoot == NULL) { |
947 fileStream.Flush(); | 947 fileStream.Flush(); |
948 return FALSE; | 948 return FALSE; |
949 } | 949 } |
950 CPDF_Dictionary* pAcroForm = pRoot->GetDict("AcroForm"); | 950 CPDF_Dictionary* pAcroForm = pRoot->GetDictBy("AcroForm"); |
951 if (NULL == pAcroForm) { | 951 if (NULL == pAcroForm) { |
952 fileStream.Flush(); | 952 fileStream.Flush(); |
953 return FALSE; | 953 return FALSE; |
954 } | 954 } |
955 CPDF_Object* pXFA = pAcroForm->GetElement("XFA"); | 955 CPDF_Object* pXFA = pAcroForm->GetElement("XFA"); |
956 if (pXFA == NULL) { | 956 if (pXFA == NULL) { |
957 fileStream.Flush(); | 957 fileStream.Flush(); |
958 return FALSE; | 958 return FALSE; |
959 } | 959 } |
960 if (!pXFA->IsArray()) { | 960 if (!pXFA->IsArray()) { |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1256 } | 1256 } |
1257 | 1257 |
1258 return _GetHValueByName(szPropName, hValue, | 1258 return _GetHValueByName(szPropName, hValue, |
1259 m_pSDKDoc->GetEnv()->GetJSRuntime()); | 1259 m_pSDKDoc->GetEnv()->GetJSRuntime()); |
1260 } | 1260 } |
1261 FX_BOOL CPDFXFA_Document::_GetHValueByName(const CFX_ByteStringC& utf8Name, | 1261 FX_BOOL CPDFXFA_Document::_GetHValueByName(const CFX_ByteStringC& utf8Name, |
1262 FXJSE_HVALUE hValue, | 1262 FXJSE_HVALUE hValue, |
1263 IJS_Runtime* runTime) { | 1263 IJS_Runtime* runTime) { |
1264 return runTime->GetHValueByName(utf8Name, hValue); | 1264 return runTime->GetHValueByName(utf8Name, hValue); |
1265 } | 1265 } |
OLD | NEW |