| 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/javascript/Document.h" | 7 #include "fpdfsdk/javascript/Document.h" |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 CFX_WideString cSubject = | 395 CFX_WideString cSubject = |
| 396 iLength > 4 ? params[4].ToCFXWideString(pRuntime) : L""; | 396 iLength > 4 ? params[4].ToCFXWideString(pRuntime) : L""; |
| 397 CFX_WideString cMsg = iLength > 5 ? params[5].ToCFXWideString(pRuntime) : L""; | 397 CFX_WideString cMsg = iLength > 5 ? params[5].ToCFXWideString(pRuntime) : L""; |
| 398 | 398 |
| 399 CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm(); | 399 CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm(); |
| 400 CFX_ByteTextBuf textBuf; | 400 CFX_ByteTextBuf textBuf; |
| 401 if (!pInterForm->ExportFormToFDFTextBuf(textBuf)) | 401 if (!pInterForm->ExportFormToFDFTextBuf(textBuf)) |
| 402 return FALSE; | 402 return FALSE; |
| 403 | 403 |
| 404 pRuntime->BeginBlock(); | 404 pRuntime->BeginBlock(); |
| 405 CPDFSDK_FormFillEnvironment* pEnv = pContext->GetFormFillEnv(); | 405 CPDFSDK_FormFillEnvironment* pFormFillEnv = pContext->GetFormFillEnv(); |
| 406 pEnv->JS_docmailForm(textBuf.GetBuffer(), textBuf.GetLength(), bUI, | 406 pFormFillEnv->JS_docmailForm(textBuf.GetBuffer(), textBuf.GetLength(), bUI, |
| 407 cTo.c_str(), cSubject.c_str(), cCc.c_str(), cBcc.c_str(), | 407 cTo.c_str(), cSubject.c_str(), cCc.c_str(), |
| 408 cMsg.c_str()); | 408 cBcc.c_str(), cMsg.c_str()); |
| 409 pRuntime->EndBlock(); | 409 pRuntime->EndBlock(); |
| 410 return TRUE; | 410 return TRUE; |
| 411 } | 411 } |
| 412 | 412 |
| 413 FX_BOOL Document::print(IJS_Context* cc, | 413 FX_BOOL Document::print(IJS_Context* cc, |
| 414 const std::vector<CJS_Value>& params, | 414 const std::vector<CJS_Value>& params, |
| 415 CJS_Value& vRet, | 415 CJS_Value& vRet, |
| 416 CFX_WideString& sError) { | 416 CFX_WideString& sError) { |
| 417 if (!m_pFormFillEnv) { | 417 if (!m_pFormFillEnv) { |
| 418 sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); | 418 sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 744 cBcc = CJS_Value(pRuntime, pValue).ToCFXWideString(pRuntime); | 744 cBcc = CJS_Value(pRuntime, pValue).ToCFXWideString(pRuntime); |
| 745 | 745 |
| 746 pValue = pRuntime->GetObjectProperty(pObj, L"cSubject"); | 746 pValue = pRuntime->GetObjectProperty(pObj, L"cSubject"); |
| 747 cSubject = CJS_Value(pRuntime, pValue).ToCFXWideString(pRuntime); | 747 cSubject = CJS_Value(pRuntime, pValue).ToCFXWideString(pRuntime); |
| 748 | 748 |
| 749 pValue = pRuntime->GetObjectProperty(pObj, L"cMsg"); | 749 pValue = pRuntime->GetObjectProperty(pObj, L"cMsg"); |
| 750 cMsg = CJS_Value(pRuntime, pValue).ToCFXWideString(pRuntime); | 750 cMsg = CJS_Value(pRuntime, pValue).ToCFXWideString(pRuntime); |
| 751 } | 751 } |
| 752 | 752 |
| 753 pRuntime->BeginBlock(); | 753 pRuntime->BeginBlock(); |
| 754 CPDFSDK_FormFillEnvironment* pEnv = pRuntime->GetFormFillEnv(); | 754 CPDFSDK_FormFillEnvironment* pFormFillEnv = pRuntime->GetFormFillEnv(); |
| 755 pEnv->JS_docmailForm(nullptr, 0, bUI, cTo.c_str(), cSubject.c_str(), | 755 pFormFillEnv->JS_docmailForm(nullptr, 0, bUI, cTo.c_str(), cSubject.c_str(), |
| 756 cCc.c_str(), cBcc.c_str(), cMsg.c_str()); | 756 cCc.c_str(), cBcc.c_str(), cMsg.c_str()); |
| 757 pRuntime->EndBlock(); | 757 pRuntime->EndBlock(); |
| 758 | 758 |
| 759 return TRUE; | 759 return TRUE; |
| 760 } | 760 } |
| 761 | 761 |
| 762 FX_BOOL Document::author(IJS_Context* cc, | 762 FX_BOOL Document::author(IJS_Context* cc, |
| 763 CJS_PropValue& vp, | 763 CJS_PropValue& vp, |
| 764 CFX_WideString& sError) { | 764 CFX_WideString& sError) { |
| 765 return getPropertyInternal(cc, vp, "Author", sError); | 765 return getPropertyInternal(cc, vp, "Author", sError); |
| 766 } | 766 } |
| (...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1715 } | 1715 } |
| 1716 } | 1716 } |
| 1717 | 1717 |
| 1718 for (const auto& pData : DelayDataForFieldAndControlIndex) | 1718 for (const auto& pData : DelayDataForFieldAndControlIndex) |
| 1719 Field::DoDelay(m_pFormFillEnv.Get(), pData.get()); | 1719 Field::DoDelay(m_pFormFillEnv.Get(), pData.get()); |
| 1720 } | 1720 } |
| 1721 | 1721 |
| 1722 CJS_Document* Document::GetCJSDoc() const { | 1722 CJS_Document* Document::GetCJSDoc() const { |
| 1723 return static_cast<CJS_Document*>(m_pJSObject); | 1723 return static_cast<CJS_Document*>(m_pJSObject); |
| 1724 } | 1724 } |
| OLD | NEW |