OLD | NEW |
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/cpdfxfa_docenvironment.h" | 7 #include "fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h" |
8 | 8 |
| 9 #include <memory> |
| 10 |
9 #include "core/fpdfapi/parser/cpdf_array.h" | 11 #include "core/fpdfapi/parser/cpdf_array.h" |
10 #include "core/fpdfapi/parser/cpdf_stream_acc.h" | 12 #include "core/fpdfapi/parser/cpdf_stream_acc.h" |
11 #include "core/fpdfapi/parser/cpdf_string.h" | 13 #include "core/fpdfapi/parser/cpdf_string.h" |
12 #include "fpdfsdk/cpdfsdk_formfillenvironment.h" | 14 #include "fpdfsdk/cpdfsdk_formfillenvironment.h" |
13 #include "fpdfsdk/cpdfsdk_interform.h" | 15 #include "fpdfsdk/cpdfsdk_interform.h" |
14 #include "fpdfsdk/cpdfsdk_pageview.h" | 16 #include "fpdfsdk/cpdfsdk_pageview.h" |
15 #include "fpdfsdk/fpdfxfa/cpdfxfa_context.h" | 17 #include "fpdfsdk/fpdfxfa/cpdfxfa_context.h" |
16 #include "fpdfsdk/fpdfxfa/cpdfxfa_page.h" | 18 #include "fpdfsdk/fpdfxfa/cpdfxfa_page.h" |
17 #include "fpdfsdk/javascript/ijs_runtime.h" | 19 #include "fpdfsdk/javascript/ijs_runtime.h" |
18 #include "xfa/fxfa/xfa_ffdocview.h" | 20 #include "xfa/fxfa/xfa_ffdocview.h" |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 wsTitle = wsTitle.FromLocal(csTitle.GetBuffer(csTitle.GetLength())); | 393 wsTitle = wsTitle.FromLocal(csTitle.GetBuffer(csTitle.GetLength())); |
392 csTitle.ReleaseBuffer(csTitle.GetLength()); | 394 csTitle.ReleaseBuffer(csTitle.GetLength()); |
393 } | 395 } |
394 | 396 |
395 void CPDFXFA_DocEnvironment::SetTitle(CXFA_FFDoc* hDoc, | 397 void CPDFXFA_DocEnvironment::SetTitle(CXFA_FFDoc* hDoc, |
396 const CFX_WideString& wsTitle) { | 398 const CFX_WideString& wsTitle) { |
397 if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetPDFDoc()) | 399 if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetPDFDoc()) |
398 return; | 400 return; |
399 | 401 |
400 if (CPDF_Dictionary* pInfoDict = m_pContext->GetPDFDoc()->GetInfo()) | 402 if (CPDF_Dictionary* pInfoDict = m_pContext->GetPDFDoc()->GetInfo()) |
401 pInfoDict->SetFor("Title", new CPDF_String(wsTitle)); | 403 pInfoDict->SetNewFor<CPDF_String>("Title", wsTitle); |
402 } | 404 } |
403 | 405 |
404 void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc, | 406 void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc, |
405 const CFX_WideString& wsFilePath, | 407 const CFX_WideString& wsFilePath, |
406 bool bXDP) { | 408 bool bXDP) { |
407 if (hDoc != m_pContext->GetXFADoc()) | 409 if (hDoc != m_pContext->GetXFADoc()) |
408 return; | 410 return; |
409 | 411 |
410 if (m_pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA && | 412 if (m_pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA && |
411 m_pContext->GetDocType() != DOCTYPE_STATIC_XFA) { | 413 m_pContext->GetDocType() != DOCTYPE_STATIC_XFA) { |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 !m_pContext->GetFormFillEnv()->GetJSRuntime()) { | 1019 !m_pContext->GetFormFillEnv()->GetJSRuntime()) { |
1018 return false; | 1020 return false; |
1019 } | 1021 } |
1020 | 1022 |
1021 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv(); | 1023 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv(); |
1022 if (!m_pJSContext) | 1024 if (!m_pJSContext) |
1023 m_pJSContext = pFormFillEnv->GetJSRuntime()->NewContext(); | 1025 m_pJSContext = pFormFillEnv->GetJSRuntime()->NewContext(); |
1024 | 1026 |
1025 return pFormFillEnv->GetJSRuntime()->GetValueByName(szPropName, pValue); | 1027 return pFormFillEnv->GetJSRuntime()->GetValueByName(szPropName, pValue); |
1026 } | 1028 } |
OLD | NEW |