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/PublicMethods.h" | 7 #include "fpdfsdk/javascript/PublicMethods.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
(...skipping 1704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1715 | 1715 |
1716 CFX_WideString sFunction = params[0].ToCFXWideString(); | 1716 CFX_WideString sFunction = params[0].ToCFXWideString(); |
1717 double dValue = wcscmp(sFunction.c_str(), L"PRD") == 0 ? 1.0 : 0.0; | 1717 double dValue = wcscmp(sFunction.c_str(), L"PRD") == 0 ? 1.0 : 0.0; |
1718 | 1718 |
1719 CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); | 1719 CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); |
1720 CJS_Array FieldNameArray = AF_MakeArrayFromList(pRuntime, params1); | 1720 CJS_Array FieldNameArray = AF_MakeArrayFromList(pRuntime, params1); |
1721 int nFieldsCount = 0; | 1721 int nFieldsCount = 0; |
1722 | 1722 |
1723 for (int i = 0, isz = FieldNameArray.GetLength(); i < isz; i++) { | 1723 for (int i = 0, isz = FieldNameArray.GetLength(); i < isz; i++) { |
1724 CJS_Value jsValue(pRuntime); | 1724 CJS_Value jsValue(pRuntime); |
1725 FieldNameArray.GetElement(i, jsValue); | 1725 FieldNameArray.GetObjectBy(i, jsValue); |
1726 CFX_WideString wsFieldName = jsValue.ToCFXWideString(); | 1726 CFX_WideString wsFieldName = jsValue.ToCFXWideString(); |
1727 | 1727 |
1728 for (int j = 0, jsz = pInterForm->CountFields(wsFieldName); j < jsz; j++) { | 1728 for (int j = 0, jsz = pInterForm->CountFields(wsFieldName); j < jsz; j++) { |
1729 if (CPDF_FormField* pFormField = pInterForm->GetField(j, wsFieldName)) { | 1729 if (CPDF_FormField* pFormField = pInterForm->GetField(j, wsFieldName)) { |
1730 double dTemp = 0.0; | 1730 double dTemp = 0.0; |
1731 switch (pFormField->GetFieldType()) { | 1731 switch (pFormField->GetFieldType()) { |
1732 case FIELDTYPE_TEXTFIELD: | 1732 case FIELDTYPE_TEXTFIELD: |
1733 case FIELDTYPE_COMBOBOX: { | 1733 case FIELDTYPE_COMBOBOX: { |
1734 CFX_WideString trimmed = pFormField->GetValue(); | 1734 CFX_WideString trimmed = pFormField->GetValue(); |
1735 trimmed.TrimRight(); | 1735 trimmed.TrimRight(); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1875 nums.SetElement(nIndex, CJS_Value(pRuntime, sPart.c_str())); | 1875 nums.SetElement(nIndex, CJS_Value(pRuntime, sPart.c_str())); |
1876 } | 1876 } |
1877 | 1877 |
1878 if (nums.GetLength() > 0) | 1878 if (nums.GetLength() > 0) |
1879 vRet = nums; | 1879 vRet = nums; |
1880 else | 1880 else |
1881 vRet.SetNull(); | 1881 vRet.SetNull(); |
1882 | 1882 |
1883 return TRUE; | 1883 return TRUE; |
1884 } | 1884 } |
OLD | NEW |