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 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 aName.Attach(params[0].ToV8Array()); | 545 aName.Attach(params[0].ToV8Array()); |
546 break; | 546 break; |
547 case CJS_Value::VT_string: | 547 case CJS_Value::VT_string: |
548 aName.SetElement(0, params[0]); | 548 aName.SetElement(0, params[0]); |
549 break; | 549 break; |
550 } | 550 } |
551 | 551 |
552 std::vector<CPDF_FormField*> aFields; | 552 std::vector<CPDF_FormField*> aFields; |
553 for (int i = 0, isz = aName.GetLength(); i < isz; ++i) { | 553 for (int i = 0, isz = aName.GetLength(); i < isz; ++i) { |
554 CJS_Value valElement(pRuntime); | 554 CJS_Value valElement(pRuntime); |
555 aName.GetElement(i, valElement); | 555 aName.GetObjectBy(i, valElement); |
556 CFX_WideString swVal = valElement.ToCFXWideString(); | 556 CFX_WideString swVal = valElement.ToCFXWideString(); |
557 for (int j = 0, jsz = pPDFForm->CountFields(swVal); j < jsz; ++j) | 557 for (int j = 0, jsz = pPDFForm->CountFields(swVal); j < jsz; ++j) |
558 aFields.push_back(pPDFForm->GetField(j, swVal)); | 558 aFields.push_back(pPDFForm->GetField(j, swVal)); |
559 } | 559 } |
560 | 560 |
561 if (!aFields.empty()) { | 561 if (!aFields.empty()) { |
562 pPDFForm->ResetForm(aFields, TRUE, TRUE); | 562 pPDFForm->ResetForm(aFields, TRUE, TRUE); |
563 m_pDocument->SetChangeMark(); | 563 m_pDocument->SetChangeMark(); |
564 } | 564 } |
565 | 565 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 pRuntime->BeginBlock(); | 627 pRuntime->BeginBlock(); |
628 pInterForm->SubmitForm(strURL, FALSE); | 628 pInterForm->SubmitForm(strURL, FALSE); |
629 pRuntime->EndBlock(); | 629 pRuntime->EndBlock(); |
630 } | 630 } |
631 return TRUE; | 631 return TRUE; |
632 } | 632 } |
633 | 633 |
634 std::vector<CPDF_FormField*> fieldObjects; | 634 std::vector<CPDF_FormField*> fieldObjects; |
635 for (int i = 0, sz = aFields.GetLength(); i < sz; ++i) { | 635 for (int i = 0, sz = aFields.GetLength(); i < sz; ++i) { |
636 CJS_Value valName(pRuntime); | 636 CJS_Value valName(pRuntime); |
637 aFields.GetElement(i, valName); | 637 aFields.GetObjectBy(i, valName); |
638 | 638 |
639 CFX_WideString sName = valName.ToCFXWideString(); | 639 CFX_WideString sName = valName.ToCFXWideString(); |
640 CPDF_InterForm* pPDFForm = pInterForm->GetInterForm(); | 640 CPDF_InterForm* pPDFForm = pInterForm->GetInterForm(); |
641 for (int j = 0, jsz = pPDFForm->CountFields(sName); j < jsz; ++j) { | 641 for (int j = 0, jsz = pPDFForm->CountFields(sName); j < jsz; ++j) { |
642 CPDF_FormField* pField = pPDFForm->GetField(j, sName); | 642 CPDF_FormField* pField = pPDFForm->GetField(j, sName); |
643 if (!bEmpty && pField->GetValue().IsEmpty()) | 643 if (!bEmpty && pField->GetValue().IsEmpty()) |
644 continue; | 644 continue; |
645 | 645 |
646 fieldObjects.push_back(pField); | 646 fieldObjects.push_back(pField); |
647 } | 647 } |
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1596 } | 1596 } |
1597 } | 1597 } |
1598 | 1598 |
1599 for (const auto& pData : DelayDataForFieldAndControlIndex) | 1599 for (const auto& pData : DelayDataForFieldAndControlIndex) |
1600 Field::DoDelay(m_pDocument, pData.get()); | 1600 Field::DoDelay(m_pDocument, pData.get()); |
1601 } | 1601 } |
1602 | 1602 |
1603 CJS_Document* Document::GetCJSDoc() const { | 1603 CJS_Document* Document::GetCJSDoc() const { |
1604 return static_cast<CJS_Document*>(m_pJSObject); | 1604 return static_cast<CJS_Document*>(m_pJSObject); |
1605 } | 1605 } |
OLD | NEW |