| 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/Field.h" | 7 #include "fpdfsdk/javascript/Field.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 | 940 |
| 941 FX_BOOL Field::currentValueIndices(IJS_Context* cc, | 941 FX_BOOL Field::currentValueIndices(IJS_Context* cc, |
| 942 CJS_PropValue& vp, | 942 CJS_PropValue& vp, |
| 943 CFX_WideString& sError) { | 943 CFX_WideString& sError) { |
| 944 CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); | 944 CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); |
| 945 | 945 |
| 946 if (vp.IsSetting()) { | 946 if (vp.IsSetting()) { |
| 947 if (!m_bCanSet) | 947 if (!m_bCanSet) |
| 948 return FALSE; | 948 return FALSE; |
| 949 | 949 |
| 950 CFX_DWordArray array; | 950 CFX_ArrayTemplate<FX_DWORD> array; |
| 951 | 951 |
| 952 if (vp.GetType() == CJS_Value::VT_number) { | 952 if (vp.GetType() == CJS_Value::VT_number) { |
| 953 int iSelecting = 0; | 953 int iSelecting = 0; |
| 954 vp >> iSelecting; | 954 vp >> iSelecting; |
| 955 array.Add(iSelecting); | 955 array.Add(iSelecting); |
| 956 } else if (vp.IsArrayObject()) { | 956 } else if (vp.IsArrayObject()) { |
| 957 CJS_Array SelArray(pRuntime); | 957 CJS_Array SelArray(pRuntime); |
| 958 CJS_Value SelValue(pRuntime); | 958 CJS_Value SelValue(pRuntime); |
| 959 int iSelecting; | 959 int iSelecting; |
| 960 vp >> SelArray; | 960 vp >> SelArray; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 995 vp << -1; | 995 vp << -1; |
| 996 } | 996 } |
| 997 } | 997 } |
| 998 | 998 |
| 999 return TRUE; | 999 return TRUE; |
| 1000 } | 1000 } |
| 1001 | 1001 |
| 1002 void Field::SetCurrentValueIndices(CPDFSDK_Document* pDocument, | 1002 void Field::SetCurrentValueIndices(CPDFSDK_Document* pDocument, |
| 1003 const CFX_WideString& swFieldName, | 1003 const CFX_WideString& swFieldName, |
| 1004 int nControlIndex, | 1004 int nControlIndex, |
| 1005 const CFX_DWordArray& array) { | 1005 const CFX_ArrayTemplate<FX_DWORD>& array) { |
| 1006 ASSERT(pDocument); | 1006 ASSERT(pDocument); |
| 1007 | 1007 |
| 1008 std::vector<CPDF_FormField*> FieldArray = | 1008 std::vector<CPDF_FormField*> FieldArray = |
| 1009 GetFormFields(pDocument, swFieldName); | 1009 GetFormFields(pDocument, swFieldName); |
| 1010 for (CPDF_FormField* pFormField : FieldArray) { | 1010 for (CPDF_FormField* pFormField : FieldArray) { |
| 1011 int nFieldType = pFormField->GetFieldType(); | 1011 int nFieldType = pFormField->GetFieldType(); |
| 1012 if (nFieldType == FIELDTYPE_COMBOBOX || nFieldType == FIELDTYPE_LISTBOX) { | 1012 if (nFieldType == FIELDTYPE_COMBOBOX || nFieldType == FIELDTYPE_LISTBOX) { |
| 1013 FX_DWORD dwFieldFlags = pFormField->GetFieldFlags(); | 1013 FX_DWORD dwFieldFlags = pFormField->GetFieldFlags(); |
| 1014 pFormField->ClearSelection(TRUE); | 1014 pFormField->ClearSelection(TRUE); |
| 1015 | 1015 |
| (...skipping 2405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3421 CJS_DelayData* pNewData = new CJS_DelayData; | 3421 CJS_DelayData* pNewData = new CJS_DelayData; |
| 3422 pNewData->sFieldName = m_FieldName; | 3422 pNewData->sFieldName = m_FieldName; |
| 3423 pNewData->nControlIndex = m_nFormControlIndex; | 3423 pNewData->nControlIndex = m_nFormControlIndex; |
| 3424 pNewData->eProp = prop; | 3424 pNewData->eProp = prop; |
| 3425 pNewData->color = color; | 3425 pNewData->color = color; |
| 3426 | 3426 |
| 3427 m_pJSDoc->AddDelayData(pNewData); | 3427 m_pJSDoc->AddDelayData(pNewData); |
| 3428 } | 3428 } |
| 3429 | 3429 |
| 3430 void Field::AddDelay_WordArray(enum FIELD_PROP prop, | 3430 void Field::AddDelay_WordArray(enum FIELD_PROP prop, |
| 3431 const CFX_DWordArray& array) { | 3431 const CFX_ArrayTemplate<FX_DWORD>& array) { |
| 3432 CJS_DelayData* pNewData = new CJS_DelayData; | 3432 CJS_DelayData* pNewData = new CJS_DelayData; |
| 3433 pNewData->sFieldName = m_FieldName; | 3433 pNewData->sFieldName = m_FieldName; |
| 3434 pNewData->nControlIndex = m_nFormControlIndex; | 3434 pNewData->nControlIndex = m_nFormControlIndex; |
| 3435 pNewData->eProp = prop; | 3435 pNewData->eProp = prop; |
| 3436 | 3436 |
| 3437 for (int i = 0, sz = array.GetSize(); i < sz; i++) | 3437 for (int i = 0, sz = array.GetSize(); i < sz; i++) |
| 3438 pNewData->wordarray.Add(array.GetAt(i)); | 3438 pNewData->wordarray.Add(array.GetAt(i)); |
| 3439 | 3439 |
| 3440 m_pJSDoc->AddDelayData(pNewData); | 3440 m_pJSDoc->AddDelayData(pNewData); |
| 3441 } | 3441 } |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3593 } | 3593 } |
| 3594 } | 3594 } |
| 3595 | 3595 |
| 3596 void Field::AddField(CPDFSDK_Document* pDocument, | 3596 void Field::AddField(CPDFSDK_Document* pDocument, |
| 3597 int nPageIndex, | 3597 int nPageIndex, |
| 3598 int nFieldType, | 3598 int nFieldType, |
| 3599 const CFX_WideString& sName, | 3599 const CFX_WideString& sName, |
| 3600 const CFX_FloatRect& rcCoords) { | 3600 const CFX_FloatRect& rcCoords) { |
| 3601 // Not supported. | 3601 // Not supported. |
| 3602 } | 3602 } |
| OLD | NEW |