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 "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 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
950 if (!pEnv) | 950 if (!pEnv) |
951 return FALSE; | 951 return FALSE; |
952 | 952 |
953 CFPDF_FileStream fileStream(pFileHandler); | 953 CFPDF_FileStream fileStream(pFileHandler); |
954 | 954 |
955 if (fileType == FXFA_SAVEAS_XML) { | 955 if (fileType == FXFA_SAVEAS_XML) { |
956 CFX_WideString ws; | 956 CFX_WideString ws; |
957 ws.FromLocal("data"); | 957 ws.FromLocal("data"); |
958 CFX_ByteString content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"; | 958 CFX_ByteString content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"; |
959 fileStream.WriteBlock((const FX_CHAR*)content, 0, content.GetLength()); | 959 fileStream.WriteBlock((const FX_CHAR*)content, 0, content.GetLength()); |
960 m_pXFADoc->SavePackage(ws.AsWideStringC(), &fileStream); | 960 m_pXFADoc->SavePackage(ws.AsStringC(), &fileStream); |
961 } else if (fileType == FXFA_SAVEAS_XDP) { | 961 } else if (fileType == FXFA_SAVEAS_XDP) { |
962 if (flag == 0) | 962 if (flag == 0) |
963 flag = FXFA_CONFIG | FXFA_TEMPLATE | FXFA_LOCALESET | FXFA_DATASETS | | 963 flag = FXFA_CONFIG | FXFA_TEMPLATE | FXFA_LOCALESET | FXFA_DATASETS | |
964 FXFA_XMPMETA | FXFA_XFDF | FXFA_FORM; | 964 FXFA_XMPMETA | FXFA_XFDF | FXFA_FORM; |
965 if (m_pPDFDoc == NULL) { | 965 if (m_pPDFDoc == NULL) { |
966 fileStream.Flush(); | 966 fileStream.Flush(); |
967 return FALSE; | 967 return FALSE; |
968 } | 968 } |
969 CPDF_Dictionary* pRoot = m_pPDFDoc->GetRoot(); | 969 CPDF_Dictionary* pRoot = m_pPDFDoc->GetRoot(); |
970 if (pRoot == NULL) { | 970 if (pRoot == NULL) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1011 continue; | 1011 continue; |
1012 if (pPrePDFObj->GetString() == "xmpmeta" && !(flag & FXFA_XMPMETA)) | 1012 if (pPrePDFObj->GetString() == "xmpmeta" && !(flag & FXFA_XMPMETA)) |
1013 continue; | 1013 continue; |
1014 if (pPrePDFObj->GetString() == "xfdf" && !(flag & FXFA_XFDF)) | 1014 if (pPrePDFObj->GetString() == "xfdf" && !(flag & FXFA_XFDF)) |
1015 continue; | 1015 continue; |
1016 if (pPrePDFObj->GetString() == "form" && !(flag & FXFA_FORM)) | 1016 if (pPrePDFObj->GetString() == "form" && !(flag & FXFA_FORM)) |
1017 continue; | 1017 continue; |
1018 if (pPrePDFObj->GetString() == "form") { | 1018 if (pPrePDFObj->GetString() == "form") { |
1019 CFX_WideString ws; | 1019 CFX_WideString ws; |
1020 ws.FromLocal("form"); | 1020 ws.FromLocal("form"); |
1021 m_pXFADoc->SavePackage(ws.AsWideStringC(), &fileStream); | 1021 m_pXFADoc->SavePackage(ws.AsStringC(), &fileStream); |
1022 } else if (pPrePDFObj->GetString() == "datasets") { | 1022 } else if (pPrePDFObj->GetString() == "datasets") { |
1023 CFX_WideString ws; | 1023 CFX_WideString ws; |
1024 ws.FromLocal("datasets"); | 1024 ws.FromLocal("datasets"); |
1025 m_pXFADoc->SavePackage(ws.AsWideStringC(), &fileStream); | 1025 m_pXFADoc->SavePackage(ws.AsStringC(), &fileStream); |
1026 } else { | 1026 } else { |
1027 // PDF,creator. | 1027 // PDF,creator. |
1028 } | 1028 } |
1029 } | 1029 } |
1030 } | 1030 } |
1031 return TRUE; | 1031 return TRUE; |
1032 } | 1032 } |
1033 | 1033 |
1034 void CPDFXFA_Document::_ClearChangeMark() { | 1034 void CPDFXFA_Document::_ClearChangeMark() { |
1035 if (m_pSDKDoc) | 1035 if (m_pSDKDoc) |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1272 } | 1272 } |
1273 | 1273 |
1274 return _GetHValueByName(szPropName, hValue, | 1274 return _GetHValueByName(szPropName, hValue, |
1275 m_pSDKDoc->GetEnv()->GetJSRuntime()); | 1275 m_pSDKDoc->GetEnv()->GetJSRuntime()); |
1276 } | 1276 } |
1277 FX_BOOL CPDFXFA_Document::_GetHValueByName(const CFX_ByteStringC& utf8Name, | 1277 FX_BOOL CPDFXFA_Document::_GetHValueByName(const CFX_ByteStringC& utf8Name, |
1278 FXJSE_HVALUE hValue, | 1278 FXJSE_HVALUE hValue, |
1279 IJS_Runtime* runTime) { | 1279 IJS_Runtime* runTime) { |
1280 return runTime->GetHValueByName(utf8Name, hValue); | 1280 return runTime->GetHValueByName(utf8Name, hValue); |
1281 } | 1281 } |
OLD | NEW |