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 <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 | 140 |
141 void CJS_Document::InitInstance(IJS_Runtime* pIRuntime) { | 141 void CJS_Document::InitInstance(IJS_Runtime* pIRuntime) { |
142 CJS_Runtime* pRuntime = static_cast<CJS_Runtime*>(pIRuntime); | 142 CJS_Runtime* pRuntime = static_cast<CJS_Runtime*>(pIRuntime); |
143 Document* pDoc = static_cast<Document*>(GetEmbedObject()); | 143 Document* pDoc = static_cast<Document*>(GetEmbedObject()); |
144 pDoc->AttachDoc(pRuntime->GetReaderDocument()); | 144 pDoc->AttachDoc(pRuntime->GetReaderDocument()); |
145 pDoc->SetIsolate(pRuntime->GetIsolate()); | 145 pDoc->SetIsolate(pRuntime->GetIsolate()); |
146 } | 146 } |
147 | 147 |
148 Document::Document(CJS_Object* pJSObject) | 148 Document::Document(CJS_Object* pJSObject) |
149 : CJS_EmbedObj(pJSObject), | 149 : CJS_EmbedObj(pJSObject), |
150 m_isolate(NULL), | 150 m_isolate(nullptr), |
151 m_pDocument(NULL), | 151 m_pDocument(nullptr), |
152 m_cwBaseURL(L""), | 152 m_cwBaseURL(L""), |
153 m_bDelay(FALSE) {} | 153 m_bDelay(FALSE) {} |
154 | 154 |
155 Document::~Document() { | 155 Document::~Document() { |
156 } | 156 } |
157 | 157 |
158 // the total number of fileds in document. | 158 // the total number of fileds in document. |
159 FX_BOOL Document::numFields(IJS_Context* cc, | 159 FX_BOOL Document::numFields(IJS_Context* cc, |
160 CJS_PropValue& vp, | 160 CJS_PropValue& vp, |
161 CFX_WideString& sError) { | 161 CFX_WideString& sError) { |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 cSubject = | 708 cSubject = |
709 CJS_Value(pRuntime, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); | 709 CJS_Value(pRuntime, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); |
710 | 710 |
711 pValue = FXJS_GetObjectElement(isolate, pObj, L"cMsg"); | 711 pValue = FXJS_GetObjectElement(isolate, pObj, L"cMsg"); |
712 cMsg = | 712 cMsg = |
713 CJS_Value(pRuntime, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); | 713 CJS_Value(pRuntime, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); |
714 } | 714 } |
715 | 715 |
716 pRuntime->BeginBlock(); | 716 pRuntime->BeginBlock(); |
717 CPDFDoc_Environment* pEnv = pRuntime->GetReaderApp(); | 717 CPDFDoc_Environment* pEnv = pRuntime->GetReaderApp(); |
718 pEnv->JS_docmailForm(NULL, 0, bUI, cTo.c_str(), cSubject.c_str(), cCc.c_str(), | 718 pEnv->JS_docmailForm(nullptr, 0, bUI, cTo.c_str(), cSubject.c_str(), |
719 cBcc.c_str(), cMsg.c_str()); | 719 cCc.c_str(), cBcc.c_str(), cMsg.c_str()); |
720 pRuntime->EndBlock(); | 720 pRuntime->EndBlock(); |
721 | 721 |
722 return TRUE; | 722 return TRUE; |
723 } | 723 } |
724 | 724 |
725 FX_BOOL Document::author(IJS_Context* cc, | 725 FX_BOOL Document::author(IJS_Context* cc, |
726 CJS_PropValue& vp, | 726 CJS_PropValue& vp, |
727 CFX_WideString& sError) { | 727 CFX_WideString& sError) { |
728 CPDF_Dictionary* pDictionary = m_pDocument->GetPDFDocument()->GetInfo(); | 728 CPDF_Dictionary* pDictionary = m_pDocument->GetPDFDocument()->GetInfo(); |
729 if (!pDictionary) | 729 if (!pDictionary) |
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1582 } | 1582 } |
1583 } | 1583 } |
1584 | 1584 |
1585 for (const auto& pData : DelayDataForFieldAndControlIndex) | 1585 for (const auto& pData : DelayDataForFieldAndControlIndex) |
1586 Field::DoDelay(m_pDocument, pData.get()); | 1586 Field::DoDelay(m_pDocument, pData.get()); |
1587 } | 1587 } |
1588 | 1588 |
1589 CJS_Document* Document::GetCJSDoc() const { | 1589 CJS_Document* Document::GetCJSDoc() const { |
1590 return static_cast<CJS_Document*>(m_pJSObject); | 1590 return static_cast<CJS_Document*>(m_pJSObject); |
1591 } | 1591 } |
OLD | NEW |