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 "../../include/javascript/JavaScript.h" | 7 #include "../../include/javascript/JavaScript.h" |
8 #include "../../include/javascript/IJavaScript.h" | 8 #include "../../include/javascript/IJavaScript.h" |
9 #include "../../include/javascript/JS_Define.h" | 9 #include "../../include/javascript/JS_Define.h" |
10 #include "../../include/javascript/JS_Object.h" | 10 #include "../../include/javascript/JS_Object.h" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 CPDF_InterForm* pInterForm = pRDInterForm->GetInterForm(); | 187 CPDF_InterForm* pInterForm = pRDInterForm->GetInterForm(); |
188 ASSERT(pInterForm != NULL); | 188 ASSERT(pInterForm != NULL); |
189 | 189 |
190 CFX_WideString swFieldNameTemp = csFieldName; | 190 CFX_WideString swFieldNameTemp = csFieldName; |
191 swFieldNameTemp.Replace(L"..", L"."); | 191 swFieldNameTemp.Replace(L"..", L"."); |
192 | 192 |
193 if (pInterForm->CountFields(swFieldNameTemp) <= 0) | 193 if (pInterForm->CountFields(swFieldNameTemp) <= 0) |
194 { | 194 { |
195 std::wstring strFieldName; | 195 std::wstring strFieldName; |
196 int iControlNo = -1; | 196 int iControlNo = -1; |
197 » » ParseFieldName((FX_LPCWSTR)swFieldNameTemp, strFieldName, iContr
olNo); | 197 » » ParseFieldName(swFieldNameTemp.c_str(), strFieldName, iControlNo
); |
198 if (iControlNo == -1) return FALSE; | 198 if (iControlNo == -1) return FALSE; |
199 | 199 |
200 m_FieldName = strFieldName.c_str(); | 200 m_FieldName = strFieldName.c_str(); |
201 m_nFormControlIndex = iControlNo; | 201 m_nFormControlIndex = iControlNo; |
202 return TRUE; | 202 return TRUE; |
203 } | 203 } |
204 | 204 |
205 m_FieldName = swFieldNameTemp; | 205 m_FieldName = swFieldNameTemp; |
206 m_nFormControlIndex = -1; | 206 m_nFormControlIndex = -1; |
207 | 207 |
(...skipping 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1566 { | 1566 { |
1567 CJS_Array ExportValusArray(m_isolate); | 1567 CJS_Array ExportValusArray(m_isolate); |
1568 | 1568 |
1569 if (m_nFormControlIndex < 0) | 1569 if (m_nFormControlIndex < 0) |
1570 { | 1570 { |
1571 for (int i=0,sz=pFormField->CountControls(); i<sz; i++) | 1571 for (int i=0,sz=pFormField->CountControls(); i<sz; i++) |
1572 { | 1572 { |
1573 CPDF_FormControl* pFormControl = pFormField->Get
Control(i); | 1573 CPDF_FormControl* pFormControl = pFormField->Get
Control(i); |
1574 ASSERT(pFormControl != NULL); | 1574 ASSERT(pFormControl != NULL); |
1575 | 1575 |
1576 » » » » ExportValusArray.SetElement(i, CJS_Value(m_isola
te,(FX_LPCWSTR)pFormControl->GetExportValue())); | 1576 » » » » ExportValusArray.SetElement(i, CJS_Value(m_isola
te,pFormControl->GetExportValue().c_str())); |
1577 } | 1577 } |
1578 } | 1578 } |
1579 else | 1579 else |
1580 { | 1580 { |
1581 if(m_nFormControlIndex >= pFormField->CountControls()) r
eturn FALSE; | 1581 if(m_nFormControlIndex >= pFormField->CountControls()) r
eturn FALSE; |
1582 CPDF_FormControl* pFormControl = pFormField->GetControl(
m_nFormControlIndex); | 1582 CPDF_FormControl* pFormControl = pFormField->GetControl(
m_nFormControlIndex); |
1583 if (!pFormControl) return FALSE; | 1583 if (!pFormControl) return FALSE; |
1584 | 1584 |
1585 » » » ExportValusArray.SetElement(0, CJS_Value(m_isolate,(FX_L
PCWSTR)pFormControl->GetExportValue())); | 1585 » » » ExportValusArray.SetElement(0, CJS_Value(m_isolate,pForm
Control->GetExportValue().c_str())); |
1586 } | 1586 } |
1587 | 1587 |
1588 vp << ExportValusArray; | 1588 vp << ExportValusArray; |
1589 } | 1589 } |
1590 | 1590 |
1591 return TRUE; | 1591 return TRUE; |
1592 } | 1592 } |
1593 | 1593 |
1594 FX_BOOL Field::fileSelect(OBJ_PROP_PARAMS) | 1594 FX_BOOL Field::fileSelect(OBJ_PROP_PARAMS) |
1595 { | 1595 { |
(...skipping 1719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3315 vp << L"Yes"; | 3315 vp << L"Yes"; |
3316 else | 3316 else |
3317 vp << L"Off"; | 3317 vp << L"Off"; |
3318 } | 3318 } |
3319 else if (pFormField->GetFieldType() == FIELDTYPE_RADIOBUTTON && !(pFormF
ield->GetFieldFlags() & FIELDFLAG_RADIOSINUNISON)) | 3319 else if (pFormField->GetFieldType() == FIELDTYPE_RADIOBUTTON && !(pFormF
ield->GetFieldFlags() & FIELDFLAG_RADIOSINUNISON)) |
3320 { | 3320 { |
3321 for (int i=0, sz=pFormField->CountControls(); i<sz; i++) | 3321 for (int i=0, sz=pFormField->CountControls(); i<sz; i++) |
3322 { | 3322 { |
3323 if (pFormField->GetControl(i)->IsChecked()) | 3323 if (pFormField->GetControl(i)->IsChecked()) |
3324 { | 3324 { |
3325 » » » » vp << (FX_LPCWSTR)pFormField->GetControl(i)->Get
ExportValue(); | 3325 » » » » vp << pFormField->GetControl(i)->GetExportValue(
).c_str(); |
3326 break; | 3326 break; |
3327 } | 3327 } |
3328 else | 3328 else |
3329 vp << L"Off"; | 3329 vp << L"Off"; |
3330 } | 3330 } |
3331 } | 3331 } |
3332 else if (pFormField->GetFieldType() == FIELDTYPE_LISTBOX && (pFormField-
>CountSelectedItems() > 1)) | 3332 else if (pFormField->GetFieldType() == FIELDTYPE_LISTBOX && (pFormField-
>CountSelectedItems() > 1)) |
3333 { | 3333 { |
3334 vp << L""; | 3334 vp << L""; |
3335 } | 3335 } |
3336 else | 3336 else |
3337 » » vp << (FX_LPCWSTR)pFormField->GetValue(); | 3337 » » vp << pFormField->GetValue().c_str(); |
3338 | 3338 |
3339 return TRUE; | 3339 return TRUE; |
3340 } | 3340 } |
3341 | 3341 |
3342 /* --------------------------------- methods --------------------------------- *
/ | 3342 /* --------------------------------- methods --------------------------------- *
/ |
3343 | 3343 |
3344 FX_BOOL Field::browseForFileToSubmit(OBJ_METHOD_PARAMS) | 3344 FX_BOOL Field::browseForFileToSubmit(OBJ_METHOD_PARAMS) |
3345 { | 3345 { |
3346 ASSERT(m_pDocument != NULL); | 3346 ASSERT(m_pDocument != NULL); |
3347 | 3347 |
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4119 | 4119 |
4120 #define JS_FIELD_MINWIDTH 1 | 4120 #define JS_FIELD_MINWIDTH 1 |
4121 #define JS_FIELD_MINHEIGHT 1 | 4121 #define JS_FIELD_MINHEIGHT 1 |
4122 | 4122 |
4123 void Field::AddField(CPDFSDK_Document* pDocument, int nPageIndex, int nFieldType
, | 4123 void Field::AddField(CPDFSDK_Document* pDocument, int nPageIndex, int nFieldType
, |
4124 const CFX_WideString& sN
ame, const CPDF_Rect& rcCoords) | 4124 const CFX_WideString& sN
ame, const CPDF_Rect& rcCoords) |
4125 { | 4125 { |
4126 //Not supported. | 4126 //Not supported. |
4127 } | 4127 } |
4128 | 4128 |
OLD | NEW |