| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 JS_STATIC_METHOD_ENTRY(importTextData) | 130 JS_STATIC_METHOD_ENTRY(importTextData) |
| 131 JS_STATIC_METHOD_ENTRY(insertPages) | 131 JS_STATIC_METHOD_ENTRY(insertPages) |
| 132 JS_STATIC_METHOD_ENTRY(mailForm) | 132 JS_STATIC_METHOD_ENTRY(mailForm) |
| 133 JS_STATIC_METHOD_ENTRY(print) | 133 JS_STATIC_METHOD_ENTRY(print) |
| 134 JS_STATIC_METHOD_ENTRY(removeField) | 134 JS_STATIC_METHOD_ENTRY(removeField) |
| 135 JS_STATIC_METHOD_ENTRY(replacePages) | 135 JS_STATIC_METHOD_ENTRY(replacePages) |
| 136 JS_STATIC_METHOD_ENTRY(resetForm) | 136 JS_STATIC_METHOD_ENTRY(resetForm) |
| 137 JS_STATIC_METHOD_ENTRY(removeIcon) | 137 JS_STATIC_METHOD_ENTRY(removeIcon) |
| 138 JS_STATIC_METHOD_ENTRY(saveAs) | 138 JS_STATIC_METHOD_ENTRY(saveAs) |
| 139 JS_STATIC_METHOD_ENTRY(submitForm) | 139 JS_STATIC_METHOD_ENTRY(submitForm) |
| 140 JS_STATIC_METHOD_ENTRY(syncAnnotScan) |
| 140 JS_STATIC_METHOD_ENTRY(mailDoc) | 141 JS_STATIC_METHOD_ENTRY(mailDoc) |
| 141 END_JS_STATIC_METHOD() | 142 END_JS_STATIC_METHOD() |
| 142 | 143 |
| 143 IMPLEMENT_JS_CLASS(CJS_Document, Document) | 144 IMPLEMENT_JS_CLASS(CJS_Document, Document) |
| 144 | 145 |
| 145 void CJS_Document::InitInstance(IJS_Runtime* pIRuntime) { | 146 void CJS_Document::InitInstance(IJS_Runtime* pIRuntime) { |
| 146 CJS_Runtime* pRuntime = static_cast<CJS_Runtime*>(pIRuntime); | 147 CJS_Runtime* pRuntime = static_cast<CJS_Runtime*>(pIRuntime); |
| 147 Document* pDoc = static_cast<Document*>(GetEmbedObject()); | 148 Document* pDoc = static_cast<Document*>(GetEmbedObject()); |
| 148 pDoc->AttachDoc(pRuntime->GetReaderDocument()); | 149 pDoc->AttachDoc(pRuntime->GetReaderDocument()); |
| 149 } | 150 } |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 } | 563 } |
| 563 | 564 |
| 564 FX_BOOL Document::saveAs(IJS_Context* cc, | 565 FX_BOOL Document::saveAs(IJS_Context* cc, |
| 565 const std::vector<CJS_Value>& params, | 566 const std::vector<CJS_Value>& params, |
| 566 CJS_Value& vRet, | 567 CJS_Value& vRet, |
| 567 CFX_WideString& sError) { | 568 CFX_WideString& sError) { |
| 568 // Unsafe, not supported. | 569 // Unsafe, not supported. |
| 569 return TRUE; | 570 return TRUE; |
| 570 } | 571 } |
| 571 | 572 |
| 573 FX_BOOL Document::syncAnnotScan(IJS_Context* cc, |
| 574 const std::vector<CJS_Value>& params, |
| 575 CJS_Value& vRet, |
| 576 CFX_WideString& sError) { |
| 577 return TRUE; |
| 578 } |
| 579 |
| 572 FX_BOOL Document::submitForm(IJS_Context* cc, | 580 FX_BOOL Document::submitForm(IJS_Context* cc, |
| 573 const std::vector<CJS_Value>& params, | 581 const std::vector<CJS_Value>& params, |
| 574 CJS_Value& vRet, | 582 CJS_Value& vRet, |
| 575 CFX_WideString& sError) { | 583 CFX_WideString& sError) { |
| 576 CJS_Context* pContext = static_cast<CJS_Context*>(cc); | 584 CJS_Context* pContext = static_cast<CJS_Context*>(cc); |
| 577 | 585 |
| 578 int nSize = params.size(); | 586 int nSize = params.size(); |
| 579 if (nSize < 1) { | 587 if (nSize < 1) { |
| 580 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); | 588 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); |
| 581 return FALSE; | 589 return FALSE; |
| (...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1600 } | 1608 } |
| 1601 } | 1609 } |
| 1602 | 1610 |
| 1603 for (const auto& pData : DelayDataForFieldAndControlIndex) | 1611 for (const auto& pData : DelayDataForFieldAndControlIndex) |
| 1604 Field::DoDelay(m_pDocument, pData.get()); | 1612 Field::DoDelay(m_pDocument, pData.get()); |
| 1605 } | 1613 } |
| 1606 | 1614 |
| 1607 CJS_Document* Document::GetCJSDoc() const { | 1615 CJS_Document* Document::GetCJSDoc() const { |
| 1608 return static_cast<CJS_Document*>(m_pJSObject); | 1616 return static_cast<CJS_Document*>(m_pJSObject); |
| 1609 } | 1617 } |
| OLD | NEW |