Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: fpdfsdk/src/javascript/Field.cpp

Issue 1258093002: FX Bool considered harmful, part 3 (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/src/javascript/Document.cpp ('k') | fpdfsdk/src/javascript/Icon.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 JS_STATIC_METHOD_ENTRY(signatureGetModifications) 103 JS_STATIC_METHOD_ENTRY(signatureGetModifications)
104 JS_STATIC_METHOD_ENTRY(signatureGetSeedValue) 104 JS_STATIC_METHOD_ENTRY(signatureGetSeedValue)
105 JS_STATIC_METHOD_ENTRY(signatureInfo) 105 JS_STATIC_METHOD_ENTRY(signatureInfo)
106 JS_STATIC_METHOD_ENTRY(signatureSetSeedValue) 106 JS_STATIC_METHOD_ENTRY(signatureSetSeedValue)
107 JS_STATIC_METHOD_ENTRY(signatureSign) 107 JS_STATIC_METHOD_ENTRY(signatureSign)
108 JS_STATIC_METHOD_ENTRY(signatureValidate) 108 JS_STATIC_METHOD_ENTRY(signatureValidate)
109 END_JS_STATIC_METHOD() 109 END_JS_STATIC_METHOD()
110 110
111 IMPLEMENT_JS_CLASS(CJS_Field, Field) 111 IMPLEMENT_JS_CLASS(CJS_Field, Field)
112 112
113 FX_BOOL CJS_Field::InitInstance(IFXJS_Context* cc) 113 bool CJS_Field::InitInstance(IFXJS_Context* cc)
114 { 114 {
115 CJS_Context* pContext = (CJS_Context*)cc; 115 CJS_Context* pContext = (CJS_Context*)cc;
116 ASSERT(pContext != NULL); 116 ASSERT(pContext != NULL);
117 117
118 Field* pField = (Field*)GetEmbedObject(); 118 Field* pField = (Field*)GetEmbedObject();
119 ASSERT(pField != NULL); 119 ASSERT(pField != NULL);
120 120
121 pField->SetIsolate(pContext->GetJSRuntime()->GetIsolate()); 121 pField->SetIsolate(pContext->GetJSRuntime()->GetIsolate());
122 122
123 return TRUE; 123 return true;
124 }; 124 };
125 125
126 Field::Field(CJS_Object* pJSObject): CJS_EmbedObj(pJSObject), 126 Field::Field(CJS_Object* pJSObject): CJS_EmbedObj(pJSObject),
127 m_pJSDoc(NULL), 127 m_pJSDoc(NULL),
128 m_pDocument(NULL), 128 m_pDocument(NULL),
129 m_nFormControlIndex(-1), 129 m_nFormControlIndex(-1),
130 m_bCanSet(FALSE), 130 m_bCanSet(false),
131 m_bDelay(FALSE), 131 m_bDelay(false),
132 m_isolate(NULL) 132 m_isolate(NULL)
133 { 133 {
134 } 134 }
135 135
136 Field::~Field() 136 Field::~Field()
137 { 137 {
138 } 138 }
139 139
140 //note: iControlNo = -1, means not a widget. 140 //note: iControlNo = -1, means not a widget.
141 void Field::ParseFieldName(const std::wstring &strFieldNameParsed,std::wstring & strFieldName,int & iControlNo) 141 void Field::ParseFieldName(const std::wstring &strFieldNameParsed,std::wstring & strFieldName,int & iControlNo)
(...skipping 19 matching lines...) Expand all
161 { 161 {
162 strFieldName = strFieldNameParsed; 162 strFieldName = strFieldNameParsed;
163 iControlNo = -1; 163 iControlNo = -1;
164 return; 164 return;
165 } 165 }
166 166
167 } 167 }
168 strFieldName = strFieldNameParsed.substr(0,iStart); 168 strFieldName = strFieldNameParsed.substr(0,iStart);
169 } 169 }
170 170
171 FX_BOOL Field::AttachField(Document* pDocument, const CFX_WideString& csFieldNam e) 171 bool Field::AttachField(Document* pDocument, const CFX_WideString& csFieldName)
172 { 172 {
173 ASSERT(pDocument != NULL); 173 ASSERT(pDocument != NULL);
174 m_pJSDoc = pDocument; 174 m_pJSDoc = pDocument;
175 175
176 m_pDocument = pDocument->GetReaderDoc(); 176 m_pDocument = pDocument->GetReaderDoc();
177 ASSERT(m_pDocument != NULL); 177 ASSERT(m_pDocument != NULL);
178 178
179 m_bCanSet = m_pDocument->GetPermissions(FPDFPERM_FILL_FORM) || 179 m_bCanSet = m_pDocument->GetPermissions(FPDFPERM_FILL_FORM) ||
180 m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM) || 180 m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM) ||
181 m_pDocument->GetPermissions(FPDFPERM_MODIFY); 181 m_pDocument->GetPermissions(FPDFPERM_MODIFY);
182 182
183 CPDFSDK_InterForm* pRDInterForm = m_pDocument->GetInterForm(); 183 CPDFSDK_InterForm* pRDInterForm = m_pDocument->GetInterForm();
184 ASSERT(pRDInterForm != NULL); 184 ASSERT(pRDInterForm != NULL);
185 185
186 CPDF_InterForm* pInterForm = pRDInterForm->GetInterForm(); 186 CPDF_InterForm* pInterForm = pRDInterForm->GetInterForm();
187 ASSERT(pInterForm != NULL); 187 ASSERT(pInterForm != NULL);
188 188
189 CFX_WideString swFieldNameTemp = csFieldName; 189 CFX_WideString swFieldNameTemp = csFieldName;
190 swFieldNameTemp.Replace(L"..", L"."); 190 swFieldNameTemp.Replace(L"..", L".");
191 191
192 if (pInterForm->CountFields(swFieldNameTemp) <= 0) 192 if (pInterForm->CountFields(swFieldNameTemp) <= 0)
193 { 193 {
194 std::wstring strFieldName; 194 std::wstring strFieldName;
195 int iControlNo = -1; 195 int iControlNo = -1;
196 ParseFieldName(swFieldNameTemp.c_str(), strFieldName, iControlNo); 196 ParseFieldName(swFieldNameTemp.c_str(), strFieldName, iControlNo);
197 if (iControlNo == -1) return FALSE; 197 if (iControlNo == -1) return false;
198 198
199 m_FieldName = strFieldName.c_str(); 199 m_FieldName = strFieldName.c_str();
200 m_nFormControlIndex = iControlNo; 200 m_nFormControlIndex = iControlNo;
201 return TRUE; 201 return true;
202 } 202 }
203 203
204 m_FieldName = swFieldNameTemp; 204 m_FieldName = swFieldNameTemp;
205 m_nFormControlIndex = -1; 205 m_nFormControlIndex = -1;
206 206
207 return TRUE; 207 return true;
208 } 208 }
209 209
210 void Field::GetFormFields(CPDFSDK_Document* pDocument, const CFX_WideString& csF ieldName, CFX_PtrArray& FieldArray) 210 void Field::GetFormFields(CPDFSDK_Document* pDocument, const CFX_WideString& csF ieldName, CFX_PtrArray& FieldArray)
211 { 211 {
212 ASSERT(pDocument != NULL); 212 ASSERT(pDocument != NULL);
213 213
214 CPDFSDK_InterForm* pReaderInterForm = pDocument->GetInterForm(); 214 CPDFSDK_InterForm* pReaderInterForm = pDocument->GetInterForm();
215 ASSERT(pReaderInterForm != NULL); 215 ASSERT(pReaderInterForm != NULL);
216 216
217 CPDF_InterForm* pInterForm = pReaderInterForm->GetInterForm(); 217 CPDF_InterForm* pInterForm = pReaderInterForm->GetInterForm();
218 ASSERT(pInterForm != NULL); 218 ASSERT(pInterForm != NULL);
219 219
220 ASSERT(FieldArray.GetSize() == 0); 220 ASSERT(FieldArray.GetSize() == 0);
221 221
222 for (int i=0,sz=pInterForm->CountFields(csFieldName); i<sz; i++) 222 for (int i=0,sz=pInterForm->CountFields(csFieldName); i<sz; i++)
223 { 223 {
224 if (CPDF_FormField* pFormField = pInterForm->GetField(i, csFieldName)) 224 if (CPDF_FormField* pFormField = pInterForm->GetField(i, csFieldName))
225 FieldArray.Add((void*)pFormField); 225 FieldArray.Add((void*)pFormField);
226 } 226 }
227 } 227 }
228 228
229 void Field::GetFormFields(const CFX_WideString& csFieldName, CFX_PtrArray& Field Array) 229 void Field::GetFormFields(const CFX_WideString& csFieldName, CFX_PtrArray& Field Array)
230 { 230 {
231 ASSERT(m_pDocument != NULL); 231 ASSERT(m_pDocument != NULL);
232 232
233 Field::GetFormFields(m_pDocument, csFieldName, FieldArray); 233 Field::GetFormFields(m_pDocument, csFieldName, FieldArray);
234 } 234 }
235 235
236 void Field::UpdateFormField(CPDFSDK_Document* pDocument, CPDF_FormField* pFormFi eld, 236 void Field::UpdateFormField(CPDFSDK_Document* pDocument, CPDF_FormField* pFormFi eld,
237 FX_BOOL bChangeMark, FX_BOOL bResetAP, FX_BOOL bRefr esh) 237 bool bChangeMark, bool bResetAP, bool bRefresh)
238 { 238 {
239 ASSERT(pDocument != NULL); 239 ASSERT(pDocument != NULL);
240 ASSERT(pFormField != NULL); 240 ASSERT(pFormField != NULL);
241 241
242 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm( ); 242 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm( );
243 ASSERT(pInterForm != NULL); 243 ASSERT(pInterForm != NULL);
244 244
245 CFX_PtrArray widgets; 245 CFX_PtrArray widgets;
246 pInterForm->GetWidgets(pFormField, widgets); 246 pInterForm->GetWidgets(pFormField, widgets);
247 247
248 if (bResetAP) 248 if (bResetAP)
249 { 249 {
250 int nFieldType = pFormField->GetFieldType(); 250 int nFieldType = pFormField->GetFieldType();
251 if (nFieldType == FIELDTYPE_COMBOBOX || nFieldType == FIELDTYPE_TEXTFIEL D) 251 if (nFieldType == FIELDTYPE_COMBOBOX || nFieldType == FIELDTYPE_TEXTFIEL D)
252 { 252 {
253 for (int i=0,sz=widgets.GetSize(); i<sz; i++) 253 for (int i=0,sz=widgets.GetSize(); i<sz; i++)
254 { 254 {
255 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)widgets.GetAt(i); 255 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)widgets.GetAt(i);
256 ASSERT(pWidget != NULL); 256 ASSERT(pWidget != NULL);
257 257
258 FX_BOOL bFormated = FALSE; 258 bool bFormated = false;
259 CFX_WideString sValue = pWidget->OnFormat(bFormated); 259 CFX_WideString sValue = pWidget->OnFormat(bFormated);
260 if (bFormated) 260 if (bFormated)
261 pWidget->ResetAppearance(sValue.c_str(), FALSE); 261 pWidget->ResetAppearance(sValue.c_str(), false);
262 else 262 else
263 pWidget->ResetAppearance(NULL, FALSE); 263 pWidget->ResetAppearance(NULL, false);
264 } 264 }
265 } 265 }
266 else 266 else
267 { 267 {
268 for (int i=0,sz=widgets.GetSize(); i<sz; i++) 268 for (int i=0,sz=widgets.GetSize(); i<sz; i++)
269 { 269 {
270 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)widgets.GetAt(i); 270 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)widgets.GetAt(i);
271 ASSERT(pWidget != NULL); 271 ASSERT(pWidget != NULL);
272 272
273 pWidget->ResetAppearance(NULL, FALSE); 273 pWidget->ResetAppearance(NULL, false);
274 } 274 }
275 } 275 }
276 } 276 }
277 277
278 if (bRefresh) 278 if (bRefresh)
279 { 279 {
280 for (int i=0,sz=widgets.GetSize(); i<sz; i++) 280 for (int i=0,sz=widgets.GetSize(); i<sz; i++)
281 { 281 {
282 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)widgets.GetAt(i); 282 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)widgets.GetAt(i);
283 ASSERT(pWidget != NULL); 283 ASSERT(pWidget != NULL);
284 284
285 CPDFSDK_InterForm * pInterForm = pWidget->GetInterForm(); 285 CPDFSDK_InterForm * pInterForm = pWidget->GetInterForm();
286 CPDFSDK_Document* pDoc = pInterForm->GetDocument(); 286 CPDFSDK_Document* pDoc = pInterForm->GetDocument();
287 // CReader_Page* pPage = pWidget->GetPage(); 287 // CReader_Page* pPage = pWidget->GetPage();
288 ASSERT(pDoc != NULL); 288 ASSERT(pDoc != NULL);
289 pDoc->UpdateAllViews(NULL, pWidget); 289 pDoc->UpdateAllViews(NULL, pWidget);
290 } 290 }
291 } 291 }
292 292
293 if (bChangeMark) 293 if (bChangeMark)
294 pDocument->SetChangeMark(); 294 pDocument->SetChangeMark();
295 } 295 }
296 296
297 void Field::UpdateFormControl(CPDFSDK_Document* pDocument, CPDF_FormControl* pFo rmControl, 297 void Field::UpdateFormControl(CPDFSDK_Document* pDocument, CPDF_FormControl* pFo rmControl,
298 FX_BOOL bChangeMark, FX_BOOL bResetAP, FX_BOOL bRefr esh) 298 bool bChangeMark, bool bResetAP, bool bRefresh)
299 { 299 {
300 ASSERT(pDocument != NULL); 300 ASSERT(pDocument != NULL);
301 ASSERT(pFormControl != NULL); 301 ASSERT(pFormControl != NULL);
302 302
303 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm( ); 303 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm( );
304 ASSERT(pInterForm != NULL); 304 ASSERT(pInterForm != NULL);
305 305
306 CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl); 306 CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl);
307 307
308 if (pWidget) 308 if (pWidget)
309 { 309 {
310 if (bResetAP) 310 if (bResetAP)
311 { 311 {
312 int nFieldType = pWidget->GetFieldType(); 312 int nFieldType = pWidget->GetFieldType();
313 if (nFieldType == FIELDTYPE_COMBOBOX || nFieldType == FIELDTYPE_TEXT FIELD) 313 if (nFieldType == FIELDTYPE_COMBOBOX || nFieldType == FIELDTYPE_TEXT FIELD)
314 { 314 {
315 FX_BOOL bFormated = FALSE; 315 bool bFormated = false;
316 CFX_WideString sValue = pWidget->OnFormat(bFormated); 316 CFX_WideString sValue = pWidget->OnFormat(bFormated);
317 if (bFormated) 317 if (bFormated)
318 pWidget->ResetAppearance(sValue.c_str(), FALSE); 318 pWidget->ResetAppearance(sValue.c_str(), false);
319 else 319 else
320 pWidget->ResetAppearance(NULL, FALSE); 320 pWidget->ResetAppearance(NULL, false);
321 } 321 }
322 else 322 else
323 { 323 {
324 pWidget->ResetAppearance(NULL, FALSE); 324 pWidget->ResetAppearance(NULL, false);
325 } 325 }
326 } 326 }
327 327
328 if (bRefresh) 328 if (bRefresh)
329 { 329 {
330 CPDFSDK_InterForm * pInterForm = pWidget->GetInterForm(); 330 CPDFSDK_InterForm * pInterForm = pWidget->GetInterForm();
331 CPDFSDK_Document* pDoc = pInterForm->GetDocument(); 331 CPDFSDK_Document* pDoc = pInterForm->GetDocument();
332 ASSERT(pDoc != NULL); 332 ASSERT(pDoc != NULL);
333 pDoc->UpdateAllViews(NULL, pWidget); 333 pDoc->UpdateAllViews(NULL, pWidget);
334 } 334 }
335 335
336 } 336 }
337 337
338 if (bChangeMark) 338 if (bChangeMark)
339 pDocument->SetChangeMark(); 339 pDocument->SetChangeMark();
340 } 340 }
341 341
342 CPDFSDK_Widget* Field::GetWidget(CPDFSDK_Document* pDocument, CPDF_FormControl* pFormControl) 342 CPDFSDK_Widget* Field::GetWidget(CPDFSDK_Document* pDocument, CPDF_FormControl* pFormControl)
343 { 343 {
344 ASSERT(pDocument != NULL); 344 ASSERT(pDocument != NULL);
345 ASSERT(pFormControl != NULL); 345 ASSERT(pFormControl != NULL);
346 346
347 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm( ); 347 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm( );
348 ASSERT(pInterForm != NULL); 348 ASSERT(pInterForm != NULL);
349 349
350 return pInterForm->GetWidget(pFormControl); 350 return pInterForm->GetWidget(pFormControl);
351 } 351 }
352 352
353 FX_BOOL Field::ValueIsOccur(CPDF_FormField* pFormField, CFX_WideString csOptLabe l) 353 bool Field::ValueIsOccur(CPDF_FormField* pFormField, CFX_WideString csOptLabel)
354 { 354 {
355 ASSERT(pFormField != NULL); 355 ASSERT(pFormField != NULL);
356 356
357 for (int i=0,sz = pFormField->CountOptions(); i < sz; i++) 357 for (int i=0,sz = pFormField->CountOptions(); i < sz; i++)
358 { 358 {
359 if (csOptLabel.Compare(pFormField->GetOptionLabel(i)) == 0) 359 if (csOptLabel.Compare(pFormField->GetOptionLabel(i)) == 0)
360 return TRUE; 360 return true;
361 } 361 }
362 362
363 return FALSE; 363 return false;
364 } 364 }
365 365
366 CPDF_FormControl* Field::GetSmartFieldControl(CPDF_FormField* pFormField) 366 CPDF_FormControl* Field::GetSmartFieldControl(CPDF_FormField* pFormField)
367 { 367 {
368 if (!pFormField->CountControls() || m_nFormControlIndex >= pFormField->Count Controls()) 368 if (!pFormField->CountControls() || m_nFormControlIndex >= pFormField->Count Controls())
369 return NULL; 369 return NULL;
370 370
371 if (m_nFormControlIndex < 0) 371 if (m_nFormControlIndex < 0)
372 return pFormField->GetControl(0); 372 return pFormField->GetControl(0);
373 373
374 return pFormField->GetControl(m_nFormControlIndex); 374 return pFormField->GetControl(m_nFormControlIndex);
375 } 375 }
376 376
377 /* ---------------------------------------- property --------------------------- ------------- */ 377 /* ---------------------------------------- property --------------------------- ------------- */
378 378
379 FX_BOOL Field::alignment(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s Error) 379 bool Field::alignment(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErr or)
380 { 380 {
381 ASSERT(m_pDocument != NULL); 381 ASSERT(m_pDocument != NULL);
382 382
383 if (vp.IsSetting()) 383 if (vp.IsSetting())
384 { 384 {
385 if (!m_bCanSet) return FALSE; 385 if (!m_bCanSet) return false;
386 386
387 CFX_ByteString alignStr; 387 CFX_ByteString alignStr;
388 vp >> alignStr; 388 vp >> alignStr;
389 389
390 if (m_bDelay) 390 if (m_bDelay)
391 { 391 {
392 AddDelay_String(FP_ALIGNMENT, alignStr); 392 AddDelay_String(FP_ALIGNMENT, alignStr);
393 } 393 }
394 else 394 else
395 { 395 {
396 Field::SetAlignment(m_pDocument, m_FieldName, m_nFormControlIndex, a lignStr); 396 Field::SetAlignment(m_pDocument, m_FieldName, m_nFormControlIndex, a lignStr);
397 } 397 }
398 } 398 }
399 else 399 else
400 { 400 {
401 CFX_PtrArray FieldArray; 401 CFX_PtrArray FieldArray;
402 GetFormFields(m_FieldName, FieldArray); 402 GetFormFields(m_FieldName, FieldArray);
403 if (FieldArray.GetSize() <= 0) return FALSE; 403 if (FieldArray.GetSize() <= 0) return false;
404 404
405 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 405 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
406 ASSERT(pFormField != NULL); 406 ASSERT(pFormField != NULL);
407 407
408 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) 408 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD)
409 return FALSE; 409 return false;
410 410
411 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); 411 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
412 if (!pFormControl)return FALSE; 412 if (!pFormControl)return false;
413 413
414 switch (pFormControl->GetControlAlignment()) 414 switch (pFormControl->GetControlAlignment())
415 { 415 {
416 case 1: 416 case 1:
417 vp << L"center"; 417 vp << L"center";
418 break; 418 break;
419 case 0: 419 case 0:
420 vp << L"left"; 420 vp << L"left";
421 break; 421 break;
422 case 2: 422 case 2:
423 vp << L"right"; 423 vp << L"right";
424 break; 424 break;
425 default: 425 default:
426 vp << L""; 426 vp << L"";
427 } 427 }
428 } 428 }
429 429
430 return TRUE; 430 return true;
431 } 431 }
432 432
433 void Field::SetAlignment(CPDFSDK_Document* pDocument, const CFX_WideString& swFi eldName, int nControlIndex, 433 void Field::SetAlignment(CPDFSDK_Document* pDocument, const CFX_WideString& swFi eldName, int nControlIndex,
434 const CFX_ByteString& string) 434 const CFX_ByteString& string)
435 { 435 {
436 //Not supported. 436 //Not supported.
437 } 437 }
438 438
439 FX_BOOL Field::borderStyle(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) 439 bool Field::borderStyle(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE rror)
440 { 440 {
441 ASSERT(m_pDocument != NULL); 441 ASSERT(m_pDocument != NULL);
442 442
443 if (vp.IsSetting()) 443 if (vp.IsSetting())
444 { 444 {
445 if (!m_bCanSet) return FALSE; 445 if (!m_bCanSet) return false;
446 446
447 CFX_ByteString strType = ""; 447 CFX_ByteString strType = "";
448 vp >> strType; 448 vp >> strType;
449 449
450 if (m_bDelay) 450 if (m_bDelay)
451 { 451 {
452 AddDelay_String(FP_BORDERSTYLE, strType); 452 AddDelay_String(FP_BORDERSTYLE, strType);
453 } 453 }
454 else 454 else
455 { 455 {
456 Field::SetBorderStyle(m_pDocument, m_FieldName, m_nFormControlIndex, strType); 456 Field::SetBorderStyle(m_pDocument, m_FieldName, m_nFormControlIndex, strType);
457 } 457 }
458 } 458 }
459 else 459 else
460 { 460 {
461 CFX_PtrArray FieldArray; 461 CFX_PtrArray FieldArray;
462 GetFormFields(m_FieldName, FieldArray); 462 GetFormFields(m_FieldName, FieldArray);
463 if (FieldArray.GetSize() <= 0) return FALSE; 463 if (FieldArray.GetSize() <= 0) return false;
464 464
465 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 465 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
466 if (!pFormField) return FALSE; 466 if (!pFormField) return false;
467 467
468 CPDFSDK_Widget* pWidget = GetWidget(m_pDocument, GetSmartFieldControl(pF ormField)); 468 CPDFSDK_Widget* pWidget = GetWidget(m_pDocument, GetSmartFieldControl(pF ormField));
469 if (!pWidget) return FALSE; 469 if (!pWidget) return false;
470 470
471 int nBorderstyle = pWidget->GetBorderStyle(); 471 int nBorderstyle = pWidget->GetBorderStyle();
472 472
473 switch (nBorderstyle) 473 switch (nBorderstyle)
474 { 474 {
475 case BBS_SOLID: 475 case BBS_SOLID:
476 vp << L"solid"; 476 vp << L"solid";
477 break; 477 break;
478 case BBS_DASH: 478 case BBS_DASH:
479 vp << L"dashed"; 479 vp << L"dashed";
480 break; 480 break;
481 case BBS_BEVELED: 481 case BBS_BEVELED:
482 vp << L"beveled"; 482 vp << L"beveled";
483 break; 483 break;
484 case BBS_INSET: 484 case BBS_INSET:
485 vp << L"inset"; 485 vp << L"inset";
486 break; 486 break;
487 case BBS_UNDERLINE: 487 case BBS_UNDERLINE:
488 vp << L"underline"; 488 vp << L"underline";
489 break; 489 break;
490 default: 490 default:
491 vp << L""; 491 vp << L"";
492 break; 492 break;
493 } 493 }
494 } 494 }
495 495
496 return TRUE; 496 return true;
497 } 497 }
498 498
499 void Field::SetBorderStyle(CPDFSDK_Document* pDocument, const CFX_WideString& sw FieldName, int nControlIndex, 499 void Field::SetBorderStyle(CPDFSDK_Document* pDocument, const CFX_WideString& sw FieldName, int nControlIndex,
500 const CFX_ByteString& string) 500 const CFX_ByteString& string)
501 { 501 {
502 ASSERT(pDocument != NULL); 502 ASSERT(pDocument != NULL);
503 503
504 int nBorderStyle = 0; 504 int nBorderStyle = 0;
505 505
506 if (string == "solid") 506 if (string == "solid")
(...skipping 11 matching lines...) Expand all
518 CFX_PtrArray FieldArray; 518 CFX_PtrArray FieldArray;
519 GetFormFields(pDocument, swFieldName, FieldArray); 519 GetFormFields(pDocument, swFieldName, FieldArray);
520 520
521 for (int i=0,isz=FieldArray.GetSize(); i<isz; i++) 521 for (int i=0,isz=FieldArray.GetSize(); i<isz; i++)
522 { 522 {
523 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(i); 523 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(i);
524 ASSERT(pFormField != NULL); 524 ASSERT(pFormField != NULL);
525 525
526 if (nControlIndex < 0) 526 if (nControlIndex < 0)
527 { 527 {
528 FX_BOOL bSet = FALSE; 528 bool bSet = false;
529 for (int j=0,jsz = pFormField->CountControls(); j<jsz; j++) 529 for (int j=0,jsz = pFormField->CountControls(); j<jsz; j++)
530 { 530 {
531 if (CPDFSDK_Widget* pWidget = GetWidget(pDocument, pFormField->G etControl(j))) 531 if (CPDFSDK_Widget* pWidget = GetWidget(pDocument, pFormField->G etControl(j)))
532 { 532 {
533 if (pWidget->GetBorderStyle() != nBorderStyle) 533 if (pWidget->GetBorderStyle() != nBorderStyle)
534 { 534 {
535 pWidget->SetBorderStyle(nBorderStyle); 535 pWidget->SetBorderStyle(nBorderStyle);
536 bSet = TRUE; 536 bSet = true;
537 } 537 }
538 } 538 }
539 } 539 }
540 if (bSet) UpdateFormField(pDocument, pFormField, TRUE, TRUE, TRUE); 540 if (bSet) UpdateFormField(pDocument, pFormField, true, true, true);
541 } 541 }
542 else 542 else
543 { 543 {
544 if(nControlIndex >= pFormField->CountControls()) return; 544 if(nControlIndex >= pFormField->CountControls()) return;
545 if (CPDF_FormControl* pFormControl = pFormField->GetControl(nControl Index)) 545 if (CPDF_FormControl* pFormControl = pFormField->GetControl(nControl Index))
546 { 546 {
547 if (CPDFSDK_Widget* pWidget = GetWidget(pDocument, pFormControl) ) 547 if (CPDFSDK_Widget* pWidget = GetWidget(pDocument, pFormControl) )
548 { 548 {
549 if (pWidget->GetBorderStyle() != nBorderStyle) 549 if (pWidget->GetBorderStyle() != nBorderStyle)
550 { 550 {
551 pWidget->SetBorderStyle(nBorderStyle); 551 pWidget->SetBorderStyle(nBorderStyle);
552 UpdateFormControl(pDocument, pFormControl, TRUE, TRUE, T RUE); 552 UpdateFormControl(pDocument, pFormControl, true, true, t rue);
553 } 553 }
554 } 554 }
555 } 555 }
556 } 556 }
557 } 557 }
558 } 558 }
559 559
560 FX_BOOL Field::buttonAlignX(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString & sError) 560 bool Field::buttonAlignX(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s Error)
561 { 561 {
562 ASSERT(m_pDocument != NULL); 562 ASSERT(m_pDocument != NULL);
563 563
564 if (vp.IsSetting()) 564 if (vp.IsSetting())
565 { 565 {
566 if (!m_bCanSet) return FALSE; 566 if (!m_bCanSet) return false;
567 567
568 int nVP; 568 int nVP;
569 vp >> nVP; 569 vp >> nVP;
570 570
571 if (m_bDelay) 571 if (m_bDelay)
572 { 572 {
573 AddDelay_Int(FP_BUTTONALIGNX, nVP); 573 AddDelay_Int(FP_BUTTONALIGNX, nVP);
574 } 574 }
575 else 575 else
576 { 576 {
577 Field::SetButtonAlignX(m_pDocument, m_FieldName, m_nFormControlIndex , nVP); 577 Field::SetButtonAlignX(m_pDocument, m_FieldName, m_nFormControlIndex , nVP);
578 } 578 }
579 } 579 }
580 else 580 else
581 { 581 {
582 CFX_PtrArray FieldArray; 582 CFX_PtrArray FieldArray;
583 GetFormFields(m_FieldName,FieldArray); 583 GetFormFields(m_FieldName,FieldArray);
584 if (FieldArray.GetSize() <= 0) return FALSE; 584 if (FieldArray.GetSize() <= 0) return false;
585 585
586 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 586 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
587 ASSERT(pFormField != NULL); 587 ASSERT(pFormField != NULL);
588 588
589 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) 589 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON)
590 return FALSE; 590 return false;
591 591
592 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); 592 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
593 if (!pFormControl)return FALSE; 593 if (!pFormControl)return false;
594 594
595 CPDF_IconFit IconFit = pFormControl->GetIconFit(); 595 CPDF_IconFit IconFit = pFormControl->GetIconFit();
596 596
597 FX_FLOAT fLeft,fBottom; 597 FX_FLOAT fLeft,fBottom;
598 IconFit.GetIconPosition(fLeft,fBottom); 598 IconFit.GetIconPosition(fLeft,fBottom);
599 599
600 vp << (int32_t)fLeft; 600 vp << (int32_t)fLeft;
601 } 601 }
602 602
603 return TRUE; 603 return true;
604 } 604 }
605 605
606 void Field::SetButtonAlignX(CPDFSDK_Document* pDocument, const CFX_WideString& s wFieldName, int nControlIndex, int number) 606 void Field::SetButtonAlignX(CPDFSDK_Document* pDocument, const CFX_WideString& s wFieldName, int nControlIndex, int number)
607 { 607 {
608 //Not supported. 608 //Not supported.
609 } 609 }
610 610
611 FX_BOOL Field::buttonAlignY(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString & sError) 611 bool Field::buttonAlignY(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s Error)
612 { 612 {
613 ASSERT(m_pDocument != NULL); 613 ASSERT(m_pDocument != NULL);
614 614
615 if (vp.IsSetting()) 615 if (vp.IsSetting())
616 { 616 {
617 if (!m_bCanSet) return FALSE; 617 if (!m_bCanSet) return false;
618 618
619 int nVP; 619 int nVP;
620 vp >> nVP; 620 vp >> nVP;
621 621
622 if (m_bDelay) 622 if (m_bDelay)
623 { 623 {
624 AddDelay_Int(FP_BUTTONALIGNY, nVP); 624 AddDelay_Int(FP_BUTTONALIGNY, nVP);
625 } 625 }
626 else 626 else
627 { 627 {
628 Field::SetButtonAlignY(m_pDocument, m_FieldName, m_nFormControlIndex , nVP); 628 Field::SetButtonAlignY(m_pDocument, m_FieldName, m_nFormControlIndex , nVP);
629 } 629 }
630 } 630 }
631 else 631 else
632 { 632 {
633 CFX_PtrArray FieldArray; 633 CFX_PtrArray FieldArray;
634 GetFormFields(m_FieldName,FieldArray); 634 GetFormFields(m_FieldName,FieldArray);
635 if (FieldArray.GetSize() <= 0) return FALSE; 635 if (FieldArray.GetSize() <= 0) return false;
636 636
637 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 637 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
638 ASSERT(pFormField != NULL); 638 ASSERT(pFormField != NULL);
639 639
640 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) 640 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON)
641 return FALSE; 641 return false;
642 642
643 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); 643 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
644 if (!pFormControl)return FALSE; 644 if (!pFormControl)return false;
645 645
646 CPDF_IconFit IconFit = pFormControl->GetIconFit(); 646 CPDF_IconFit IconFit = pFormControl->GetIconFit();
647 647
648 FX_FLOAT fLeft,fBottom; 648 FX_FLOAT fLeft,fBottom;
649 IconFit.GetIconPosition(fLeft,fBottom); 649 IconFit.GetIconPosition(fLeft,fBottom);
650 650
651 vp << (int32_t)fBottom; 651 vp << (int32_t)fBottom;
652 } 652 }
653 653
654 return TRUE; 654 return true;
655 } 655 }
656 656
657 void Field::SetButtonAlignY(CPDFSDK_Document* pDocument, const CFX_WideString& s wFieldName, int nControlIndex, int number) 657 void Field::SetButtonAlignY(CPDFSDK_Document* pDocument, const CFX_WideString& s wFieldName, int nControlIndex, int number)
658 { 658 {
659 //Not supported. 659 //Not supported.
660 } 660 }
661 661
662 FX_BOOL Field::buttonFitBounds(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStr ing& sError) 662 bool Field::buttonFitBounds(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString & sError)
663 { 663 {
664 ASSERT(m_pDocument != NULL); 664 ASSERT(m_pDocument != NULL);
665 665
666 if (vp.IsSetting()) 666 if (vp.IsSetting())
667 { 667 {
668 if (!m_bCanSet) return FALSE; 668 if (!m_bCanSet) return false;
669 669
670 bool bVP; 670 bool bVP;
671 vp >> bVP; 671 vp >> bVP;
672 672
673 if (m_bDelay) 673 if (m_bDelay)
674 { 674 {
675 AddDelay_Bool(FP_BUTTONFITBOUNDS, bVP); 675 AddDelay_Bool(FP_BUTTONFITBOUNDS, bVP);
676 } 676 }
677 else 677 else
678 { 678 {
679 Field::SetButtonFitBounds(m_pDocument, m_FieldName, m_nFormControlIn dex, bVP); 679 Field::SetButtonFitBounds(m_pDocument, m_FieldName, m_nFormControlIn dex, bVP);
680 } 680 }
681 } 681 }
682 else 682 else
683 { 683 {
684 CFX_PtrArray FieldArray; 684 CFX_PtrArray FieldArray;
685 GetFormFields(m_FieldName,FieldArray); 685 GetFormFields(m_FieldName,FieldArray);
686 if (FieldArray.GetSize() <= 0) return FALSE; 686 if (FieldArray.GetSize() <= 0) return false;
687 687
688 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 688 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
689 ASSERT(pFormField != NULL); 689 ASSERT(pFormField != NULL);
690 690
691 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) 691 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON)
692 return FALSE; 692 return false;
693 693
694 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); 694 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
695 if (!pFormControl)return FALSE; 695 if (!pFormControl)return false;
696 696
697 CPDF_IconFit IconFit = pFormControl->GetIconFit(); 697 CPDF_IconFit IconFit = pFormControl->GetIconFit();
698 vp << IconFit.GetFittingBounds(); 698 vp << IconFit.GetFittingBounds();
699 } 699 }
700 700
701 return TRUE; 701 return true;
702 } 702 }
703 703
704 void Field::SetButtonFitBounds(CPDFSDK_Document* pDocument, const CFX_WideString & swFieldName, int nControlIndex, bool b) 704 void Field::SetButtonFitBounds(CPDFSDK_Document* pDocument, const CFX_WideString & swFieldName, int nControlIndex, bool b)
705 { 705 {
706 //Not supported. 706 //Not supported.
707 } 707 }
708 708
709 FX_BOOL Field::buttonPosition(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStri ng& sError) 709 bool Field::buttonPosition(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
710 { 710 {
711 ASSERT(m_pDocument != NULL); 711 ASSERT(m_pDocument != NULL);
712 712
713 if (vp.IsSetting()) 713 if (vp.IsSetting())
714 { 714 {
715 if (!m_bCanSet) return FALSE; 715 if (!m_bCanSet) return false;
716 716
717 int nVP; 717 int nVP;
718 vp >> nVP; 718 vp >> nVP;
719 719
720 if (m_bDelay) 720 if (m_bDelay)
721 { 721 {
722 AddDelay_Int(FP_BUTTONPOSITION, nVP); 722 AddDelay_Int(FP_BUTTONPOSITION, nVP);
723 } 723 }
724 else 724 else
725 { 725 {
726 Field::SetButtonPosition(m_pDocument, m_FieldName, m_nFormControlInd ex, nVP); 726 Field::SetButtonPosition(m_pDocument, m_FieldName, m_nFormControlInd ex, nVP);
727 } 727 }
728 } 728 }
729 else 729 else
730 { 730 {
731 CFX_PtrArray FieldArray; 731 CFX_PtrArray FieldArray;
732 GetFormFields(m_FieldName,FieldArray); 732 GetFormFields(m_FieldName,FieldArray);
733 if (FieldArray.GetSize() <= 0) return FALSE; 733 if (FieldArray.GetSize() <= 0) return false;
734 734
735 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 735 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
736 ASSERT(pFormField != NULL); 736 ASSERT(pFormField != NULL);
737 737
738 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) 738 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON)
739 return FALSE; 739 return false;
740 740
741 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); 741 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
742 if (!pFormControl)return FALSE; 742 if (!pFormControl)return false;
743 743
744 vp << pFormControl->GetTextPosition(); 744 vp << pFormControl->GetTextPosition();
745 } 745 }
746 return TRUE; 746 return true;
747 } 747 }
748 748
749 void Field::SetButtonPosition(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number) 749 void Field::SetButtonPosition(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number)
750 { 750 {
751 //Not supported. 751 //Not supported.
752 } 752 }
753 753
754 FX_BOOL Field::buttonScaleHow(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStri ng& sError) 754 bool Field::buttonScaleHow(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
755 { 755 {
756 ASSERT(m_pDocument != NULL); 756 ASSERT(m_pDocument != NULL);
757 757
758 if (vp.IsSetting()) 758 if (vp.IsSetting())
759 { 759 {
760 if (!m_bCanSet) return FALSE; 760 if (!m_bCanSet) return false;
761 761
762 int nVP; 762 int nVP;
763 vp >> nVP; 763 vp >> nVP;
764 764
765 if (m_bDelay) 765 if (m_bDelay)
766 { 766 {
767 AddDelay_Int(FP_BUTTONSCALEHOW, nVP); 767 AddDelay_Int(FP_BUTTONSCALEHOW, nVP);
768 } 768 }
769 else 769 else
770 { 770 {
771 Field::SetButtonScaleHow(m_pDocument, m_FieldName, m_nFormControlInd ex, nVP); 771 Field::SetButtonScaleHow(m_pDocument, m_FieldName, m_nFormControlInd ex, nVP);
772 } 772 }
773 } 773 }
774 else 774 else
775 { 775 {
776 CFX_PtrArray FieldArray; 776 CFX_PtrArray FieldArray;
777 GetFormFields(m_FieldName, FieldArray); 777 GetFormFields(m_FieldName, FieldArray);
778 if (FieldArray.GetSize() <= 0) return FALSE; 778 if (FieldArray.GetSize() <= 0) return false;
779 779
780 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 780 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
781 ASSERT(pFormField != NULL); 781 ASSERT(pFormField != NULL);
782 782
783 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) 783 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON)
784 return FALSE; 784 return false;
785 785
786 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); 786 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
787 if (!pFormControl)return FALSE; 787 if (!pFormControl)return false;
788 788
789 CPDF_IconFit IconFit = pFormControl->GetIconFit(); 789 CPDF_IconFit IconFit = pFormControl->GetIconFit();
790 if (IconFit.IsProportionalScale()) 790 if (IconFit.IsProportionalScale())
791 vp << (int32_t)0; 791 vp << (int32_t)0;
792 else 792 else
793 vp << (int32_t)1; 793 vp << (int32_t)1;
794 } 794 }
795 795
796 return TRUE; 796 return true;
797 } 797 }
798 798
799 void Field::SetButtonScaleHow(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number) 799 void Field::SetButtonScaleHow(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number)
800 { 800 {
801 //Not supported. 801 //Not supported.
802 } 802 }
803 803
804 FX_BOOL Field::buttonScaleWhen(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStr ing& sError) 804 bool Field::buttonScaleWhen(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString & sError)
805 { 805 {
806 ASSERT(m_pDocument != NULL); 806 ASSERT(m_pDocument != NULL);
807 807
808 if (vp.IsSetting()) 808 if (vp.IsSetting())
809 { 809 {
810 if (!m_bCanSet) return FALSE; 810 if (!m_bCanSet) return false;
811 811
812 int nVP; 812 int nVP;
813 vp >> nVP; 813 vp >> nVP;
814 814
815 if (m_bDelay) 815 if (m_bDelay)
816 { 816 {
817 AddDelay_Int(FP_BUTTONSCALEWHEN, nVP); 817 AddDelay_Int(FP_BUTTONSCALEWHEN, nVP);
818 } 818 }
819 else 819 else
820 { 820 {
821 Field::SetButtonScaleWhen(m_pDocument, m_FieldName, m_nFormControlIn dex, nVP); 821 Field::SetButtonScaleWhen(m_pDocument, m_FieldName, m_nFormControlIn dex, nVP);
822 } 822 }
823 } 823 }
824 else 824 else
825 { 825 {
826 CFX_PtrArray FieldArray; 826 CFX_PtrArray FieldArray;
827 GetFormFields(m_FieldName,FieldArray); 827 GetFormFields(m_FieldName,FieldArray);
828 if (FieldArray.GetSize() <= 0) return FALSE; 828 if (FieldArray.GetSize() <= 0) return false;
829 829
830 CPDF_FormField* pFormField = (CPDF_FormField*) FieldArray.ElementAt(0); 830 CPDF_FormField* pFormField = (CPDF_FormField*) FieldArray.ElementAt(0);
831 ASSERT(pFormField != NULL); 831 ASSERT(pFormField != NULL);
832 832
833 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) 833 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON)
834 return FALSE; 834 return false;
835 835
836 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); 836 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
837 if (!pFormControl) return FALSE; 837 if (!pFormControl) return false;
838 838
839 CPDF_IconFit IconFit = pFormControl->GetIconFit(); 839 CPDF_IconFit IconFit = pFormControl->GetIconFit();
840 int ScaleM = IconFit.GetScaleMethod(); 840 int ScaleM = IconFit.GetScaleMethod();
841 switch (ScaleM) 841 switch (ScaleM)
842 { 842 {
843 case CPDF_IconFit::Always : 843 case CPDF_IconFit::Always :
844 vp << (int32_t) CPDF_IconFit::Always; 844 vp << (int32_t) CPDF_IconFit::Always;
845 break; 845 break;
846 case CPDF_IconFit::Bigger : 846 case CPDF_IconFit::Bigger :
847 vp << (int32_t) CPDF_IconFit::Bigger; 847 vp << (int32_t) CPDF_IconFit::Bigger;
848 break; 848 break;
849 case CPDF_IconFit::Never : 849 case CPDF_IconFit::Never :
850 vp << (int32_t) CPDF_IconFit::Never; 850 vp << (int32_t) CPDF_IconFit::Never;
851 break; 851 break;
852 case CPDF_IconFit::Smaller : 852 case CPDF_IconFit::Smaller :
853 vp << (int32_t) CPDF_IconFit::Smaller; 853 vp << (int32_t) CPDF_IconFit::Smaller;
854 break; 854 break;
855 } 855 }
856 } 856 }
857 857
858 return TRUE; 858 return true;
859 } 859 }
860 860
861 void Field::SetButtonScaleWhen(CPDFSDK_Document* pDocument, const CFX_WideString & swFieldName, int nControlIndex, int number) 861 void Field::SetButtonScaleWhen(CPDFSDK_Document* pDocument, const CFX_WideString & swFieldName, int nControlIndex, int number)
862 { 862 {
863 //Not supported. 863 //Not supported.
864 } 864 }
865 865
866 FX_BOOL Field::calcOrderIndex(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStri ng& sError) 866 bool Field::calcOrderIndex(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
867 { 867 {
868 ASSERT(m_pDocument != NULL); 868 ASSERT(m_pDocument != NULL);
869 869
870 if (vp.IsSetting()) 870 if (vp.IsSetting())
871 { 871 {
872 if (!m_bCanSet) return FALSE; 872 if (!m_bCanSet) return false;
873 873
874 int nVP; 874 int nVP;
875 vp >> nVP; 875 vp >> nVP;
876 876
877 if (m_bDelay) 877 if (m_bDelay)
878 { 878 {
879 AddDelay_Int(FP_CALCORDERINDEX, nVP); 879 AddDelay_Int(FP_CALCORDERINDEX, nVP);
880 } 880 }
881 else 881 else
882 { 882 {
883 Field::SetCalcOrderIndex(m_pDocument, m_FieldName, m_nFormControlInd ex, nVP); 883 Field::SetCalcOrderIndex(m_pDocument, m_FieldName, m_nFormControlInd ex, nVP);
884 } 884 }
885 } 885 }
886 else 886 else
887 { 887 {
888 CFX_PtrArray FieldArray; 888 CFX_PtrArray FieldArray;
889 GetFormFields(m_FieldName, FieldArray); 889 GetFormFields(m_FieldName, FieldArray);
890 if (FieldArray.GetSize() <= 0) return FALSE; 890 if (FieldArray.GetSize() <= 0) return false;
891 891
892 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 892 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
893 ASSERT(pFormField != NULL); 893 ASSERT(pFormField != NULL);
894 894
895 if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX && pFormField->GetF ieldType() != FIELDTYPE_TEXTFIELD) 895 if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX && pFormField->GetF ieldType() != FIELDTYPE_TEXTFIELD)
896 return FALSE; 896 return false;
897 897
898 CPDFSDK_InterForm* pRDInterForm = m_pDocument->GetInterForm(); 898 CPDFSDK_InterForm* pRDInterForm = m_pDocument->GetInterForm();
899 ASSERT(pRDInterForm != NULL); 899 ASSERT(pRDInterForm != NULL);
900 900
901 CPDF_InterForm* pInterForm = pRDInterForm->GetInterForm(); 901 CPDF_InterForm* pInterForm = pRDInterForm->GetInterForm();
902 ASSERT(pInterForm != NULL); 902 ASSERT(pInterForm != NULL);
903 903
904 vp << (int32_t)pInterForm->FindFieldInCalculationOrder(pFormField); 904 vp << (int32_t)pInterForm->FindFieldInCalculationOrder(pFormField);
905 } 905 }
906 906
907 return TRUE; 907 return true;
908 } 908 }
909 909
910 void Field::SetCalcOrderIndex(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number) 910 void Field::SetCalcOrderIndex(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number)
911 { 911 {
912 //Not supported. 912 //Not supported.
913 } 913 }
914 914
915 FX_BOOL Field::charLimit(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s Error) 915 bool Field::charLimit(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErr or)
916 { 916 {
917 ASSERT(m_pDocument != NULL); 917 ASSERT(m_pDocument != NULL);
918 918
919 if (vp.IsSetting()) 919 if (vp.IsSetting())
920 { 920 {
921 if (!m_bCanSet) return FALSE; 921 if (!m_bCanSet) return false;
922 922
923 int nVP; 923 int nVP;
924 vp >> nVP; 924 vp >> nVP;
925 925
926 if (m_bDelay) 926 if (m_bDelay)
927 { 927 {
928 AddDelay_Int(FP_CHARLIMIT, nVP); 928 AddDelay_Int(FP_CHARLIMIT, nVP);
929 } 929 }
930 else 930 else
931 { 931 {
932 Field::SetCharLimit(m_pDocument, m_FieldName, m_nFormControlIndex, n VP); 932 Field::SetCharLimit(m_pDocument, m_FieldName, m_nFormControlIndex, n VP);
933 } 933 }
934 } 934 }
935 else 935 else
936 { 936 {
937 CFX_PtrArray FieldArray; 937 CFX_PtrArray FieldArray;
938 GetFormFields(m_FieldName, FieldArray); 938 GetFormFields(m_FieldName, FieldArray);
939 if (FieldArray.GetSize() <= 0) return FALSE; 939 if (FieldArray.GetSize() <= 0) return false;
940 940
941 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 941 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
942 ASSERT(pFormField != NULL); 942 ASSERT(pFormField != NULL);
943 943
944 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) 944 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD)
945 return FALSE; 945 return false;
946 946
947 vp << (int32_t)pFormField->GetMaxLen(); 947 vp << (int32_t)pFormField->GetMaxLen();
948 } 948 }
949 return TRUE; 949 return true;
950 } 950 }
951 951
952 void Field::SetCharLimit(CPDFSDK_Document* pDocument, const CFX_WideString& swFi eldName, int nControlIndex, int number) 952 void Field::SetCharLimit(CPDFSDK_Document* pDocument, const CFX_WideString& swFi eldName, int nControlIndex, int number)
953 { 953 {
954 //Not supported. 954 //Not supported.
955 } 955 }
956 956
957 FX_BOOL Field::comb(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError ) 957 bool Field::comb(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
958 { 958 {
959 ASSERT(m_pDocument != NULL); 959 ASSERT(m_pDocument != NULL);
960 960
961 if (vp.IsSetting()) 961 if (vp.IsSetting())
962 { 962 {
963 if (!m_bCanSet) return FALSE; 963 if (!m_bCanSet) return false;
964 964
965 bool bVP; 965 bool bVP;
966 vp >> bVP; 966 vp >> bVP;
967 967
968 if (m_bDelay) 968 if (m_bDelay)
969 { 969 {
970 AddDelay_Bool(FP_COMB, bVP); 970 AddDelay_Bool(FP_COMB, bVP);
971 } 971 }
972 else 972 else
973 { 973 {
974 Field::SetComb(m_pDocument, m_FieldName, m_nFormControlIndex, bVP); 974 Field::SetComb(m_pDocument, m_FieldName, m_nFormControlIndex, bVP);
975 } 975 }
976 } 976 }
977 else 977 else
978 { 978 {
979 CFX_PtrArray FieldArray; 979 CFX_PtrArray FieldArray;
980 GetFormFields(m_FieldName,FieldArray); 980 GetFormFields(m_FieldName,FieldArray);
981 if (FieldArray.GetSize() <= 0) return FALSE; 981 if (FieldArray.GetSize() <= 0) return false;
982 982
983 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 983 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
984 ASSERT(pFormField != NULL); 984 ASSERT(pFormField != NULL);
985 985
986 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) 986 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD)
987 return FALSE; 987 return false;
988 988
989 if (pFormField->GetFieldFlags() & FIELDFLAG_COMB) 989 if (pFormField->GetFieldFlags() & FIELDFLAG_COMB)
990 vp << true; 990 vp << true;
991 else 991 else
992 vp << false; 992 vp << false;
993 } 993 }
994 994
995 return TRUE; 995 return true;
996 } 996 }
997 997
998 void Field::SetComb(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldNa me, int nControlIndex, bool b) 998 void Field::SetComb(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldNa me, int nControlIndex, bool b)
999 { 999 {
1000 //Not supported. 1000 //Not supported.
1001 } 1001 }
1002 1002
1003 FX_BOOL Field::commitOnSelChange(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideS tring& sError) 1003 bool Field::commitOnSelChange(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStri ng& sError)
1004 { 1004 {
1005 ASSERT(m_pDocument != NULL); 1005 ASSERT(m_pDocument != NULL);
1006 1006
1007 if (vp.IsSetting()) 1007 if (vp.IsSetting())
1008 { 1008 {
1009 if (!m_bCanSet) return FALSE; 1009 if (!m_bCanSet) return false;
1010 1010
1011 bool bVP; 1011 bool bVP;
1012 vp >> bVP; 1012 vp >> bVP;
1013 1013
1014 if (m_bDelay) 1014 if (m_bDelay)
1015 { 1015 {
1016 AddDelay_Bool(FP_COMMITONSELCHANGE, bVP); 1016 AddDelay_Bool(FP_COMMITONSELCHANGE, bVP);
1017 } 1017 }
1018 else 1018 else
1019 { 1019 {
1020 Field::SetCommitOnSelChange(m_pDocument, m_FieldName, m_nFormControl Index, bVP); 1020 Field::SetCommitOnSelChange(m_pDocument, m_FieldName, m_nFormControl Index, bVP);
1021 } 1021 }
1022 } 1022 }
1023 else 1023 else
1024 { 1024 {
1025 CFX_PtrArray FieldArray; 1025 CFX_PtrArray FieldArray;
1026 GetFormFields(m_FieldName,FieldArray); 1026 GetFormFields(m_FieldName,FieldArray);
1027 if (FieldArray.GetSize() <= 0) return FALSE; 1027 if (FieldArray.GetSize() <= 0) return false;
1028 1028
1029 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 1029 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
1030 ASSERT(pFormField != NULL); 1030 ASSERT(pFormField != NULL);
1031 1031
1032 if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX && pFormField->GetF ieldType() != FIELDTYPE_LISTBOX) 1032 if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX && pFormField->GetF ieldType() != FIELDTYPE_LISTBOX)
1033 return FALSE; 1033 return false;
1034 1034
1035 if (pFormField->GetFieldFlags() & FIELDFLAG_COMMITONSELCHANGE) 1035 if (pFormField->GetFieldFlags() & FIELDFLAG_COMMITONSELCHANGE)
1036 vp << true; 1036 vp << true;
1037 else 1037 else
1038 vp << false; 1038 vp << false;
1039 } 1039 }
1040 1040
1041 return TRUE; 1041 return true;
1042 } 1042 }
1043 1043
1044 void Field::SetCommitOnSelChange(CPDFSDK_Document* pDocument, const CFX_WideStri ng& swFieldName, int nControlIndex, bool b) 1044 void Field::SetCommitOnSelChange(CPDFSDK_Document* pDocument, const CFX_WideStri ng& swFieldName, int nControlIndex, bool b)
1045 { 1045 {
1046 //Not supported. 1046 //Not supported.
1047 } 1047 }
1048 1048
1049 FX_BOOL Field::currentValueIndices(IFXJS_Context* cc, CJS_PropValue& vp, CFX_Wid eString& sError) 1049 bool Field::currentValueIndices(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideSt ring& sError)
1050 { 1050 {
1051 ASSERT(m_pDocument != NULL); 1051 ASSERT(m_pDocument != NULL);
1052 1052
1053 if (vp.IsSetting()) 1053 if (vp.IsSetting())
1054 { 1054 {
1055 if (!m_bCanSet) return FALSE; 1055 if (!m_bCanSet) return false;
1056 1056
1057 CFX_DWordArray array; 1057 CFX_DWordArray array;
1058 1058
1059 if (vp.GetType() == VT_number) 1059 if (vp.GetType() == VT_number)
1060 { 1060 {
1061 int iSelecting = 0; 1061 int iSelecting = 0;
1062 vp >> iSelecting; 1062 vp >> iSelecting;
1063 array.Add(iSelecting); 1063 array.Add(iSelecting);
1064 } 1064 }
1065 else if (vp.IsArrayObject()) 1065 else if (vp.IsArrayObject())
(...skipping 16 matching lines...) Expand all
1082 } 1082 }
1083 else 1083 else
1084 { 1084 {
1085 Field::SetCurrentValueIndices(m_pDocument, m_FieldName, m_nFormContr olIndex, array); 1085 Field::SetCurrentValueIndices(m_pDocument, m_FieldName, m_nFormContr olIndex, array);
1086 } 1086 }
1087 } 1087 }
1088 else 1088 else
1089 { 1089 {
1090 CFX_PtrArray FieldArray; 1090 CFX_PtrArray FieldArray;
1091 GetFormFields(m_FieldName,FieldArray); 1091 GetFormFields(m_FieldName,FieldArray);
1092 if (FieldArray.GetSize() <= 0) return FALSE; 1092 if (FieldArray.GetSize() <= 0) return false;
1093 1093
1094 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 1094 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
1095 ASSERT(pFormField != NULL); 1095 ASSERT(pFormField != NULL);
1096 1096
1097 if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX && pFormField->GetF ieldType() != FIELDTYPE_LISTBOX) 1097 if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX && pFormField->GetF ieldType() != FIELDTYPE_LISTBOX)
1098 return FALSE; 1098 return false;
1099 1099
1100 if (pFormField->CountSelectedItems() == 1) 1100 if (pFormField->CountSelectedItems() == 1)
1101 vp << pFormField->GetSelectedIndex(0); 1101 vp << pFormField->GetSelectedIndex(0);
1102 else if (pFormField->CountSelectedItems() > 1) 1102 else if (pFormField->CountSelectedItems() > 1)
1103 { 1103 {
1104 CJS_Array SelArray(m_isolate); 1104 CJS_Array SelArray(m_isolate);
1105 for (int i=0,sz=pFormField->CountSelectedItems(); i<sz; i++) 1105 for (int i=0,sz=pFormField->CountSelectedItems(); i<sz; i++)
1106 { 1106 {
1107 SelArray.SetElement(i, CJS_Value(m_isolate,pFormField->GetSelect edIndex(i))); 1107 SelArray.SetElement(i, CJS_Value(m_isolate,pFormField->GetSelect edIndex(i)));
1108 } 1108 }
1109 vp << SelArray; 1109 vp << SelArray;
1110 } 1110 }
1111 else 1111 else
1112 vp << -1; 1112 vp << -1;
1113 } 1113 }
1114 1114
1115 return TRUE; 1115 return true;
1116 } 1116 }
1117 1117
1118 void Field::SetCurrentValueIndices(CPDFSDK_Document* pDocument, const CFX_WideSt ring& swFieldName, int nControlIndex, 1118 void Field::SetCurrentValueIndices(CPDFSDK_Document* pDocument, const CFX_WideSt ring& swFieldName, int nControlIndex,
1119 const CFX_DWordArray& array) 1119 const CFX_DWordArray& array)
1120 { 1120 {
1121 ASSERT(pDocument != NULL); 1121 ASSERT(pDocument != NULL);
1122 1122
1123 CFX_PtrArray FieldArray; 1123 CFX_PtrArray FieldArray;
1124 GetFormFields(pDocument, swFieldName, FieldArray); 1124 GetFormFields(pDocument, swFieldName, FieldArray);
1125 1125
1126 for (int i=0,isz=FieldArray.GetSize(); i<isz; i++) 1126 for (int i=0,isz=FieldArray.GetSize(); i<isz; i++)
1127 { 1127 {
1128 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(i); 1128 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(i);
1129 ASSERT(pFormField != NULL); 1129 ASSERT(pFormField != NULL);
1130 1130
1131 int nFieldType = pFormField->GetFieldType(); 1131 int nFieldType = pFormField->GetFieldType();
1132 if (nFieldType == FIELDTYPE_COMBOBOX || nFieldType == FIELDTYPE_LISTBOX) 1132 if (nFieldType == FIELDTYPE_COMBOBOX || nFieldType == FIELDTYPE_LISTBOX)
1133 { 1133 {
1134 FX_DWORD dwFieldFlags = pFormField->GetFieldFlags(); 1134 FX_DWORD dwFieldFlags = pFormField->GetFieldFlags();
1135 pFormField->ClearSelection(TRUE); 1135 pFormField->ClearSelection(true);
1136 1136
1137 for (int i=0,sz=array.GetSize(); i<sz; i++) 1137 for (int i=0,sz=array.GetSize(); i<sz; i++)
1138 { 1138 {
1139 if (i>0 && !(dwFieldFlags & (1<<21))) 1139 if (i>0 && !(dwFieldFlags & (1<<21)))
1140 { 1140 {
1141 break; 1141 break;
1142 } 1142 }
1143 1143
1144 int iSelecting = (int32_t)array.GetAt(i); 1144 int iSelecting = (int32_t)array.GetAt(i);
1145 if (iSelecting < pFormField->CountOptions() && !pFormField->IsIt emSelected(iSelecting)) 1145 if (iSelecting < pFormField->CountOptions() && !pFormField->IsIt emSelected(iSelecting))
1146 pFormField->SetItemSelection(iSelecting, TRUE); 1146 pFormField->SetItemSelection(iSelecting, true);
1147 1147
1148 } 1148 }
1149 UpdateFormField(pDocument, pFormField, TRUE, TRUE, TRUE); 1149 UpdateFormField(pDocument, pFormField, true, true, true);
1150 } 1150 }
1151 } 1151 }
1152 } 1152 }
1153 1153
1154 FX_BOOL Field::defaultStyle(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString & sError) 1154 bool Field::defaultStyle(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s Error)
1155 { 1155 {
1156 // MQG sError = JSGetStringFromID(IDS_STRING_NOTSUPPORT); 1156 // MQG sError = JSGetStringFromID(IDS_STRING_NOTSUPPORT);
1157 return FALSE; 1157 return false;
1158 1158
1159 if (vp.IsSetting()) 1159 if (vp.IsSetting())
1160 { 1160 {
1161 if (!m_bCanSet) return FALSE; 1161 if (!m_bCanSet) return false;
1162 1162
1163 ; 1163 ;
1164 } 1164 }
1165 else 1165 else
1166 { 1166 {
1167 ; 1167 ;
1168 } 1168 }
1169 return TRUE; 1169 return true;
1170 } 1170 }
1171 1171
1172 void Field::SetDefaultStyle(CPDFSDK_Document* pDocument, const CFX_WideString& s wFieldName, int nControlIndex) 1172 void Field::SetDefaultStyle(CPDFSDK_Document* pDocument, const CFX_WideString& s wFieldName, int nControlIndex)
1173 { 1173 {
1174 //Not supported. 1174 //Not supported.
1175 } 1175 }
1176 1176
1177 FX_BOOL Field::defaultValue(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString & sError) 1177 bool Field::defaultValue(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s Error)
1178 { 1178 {
1179 ASSERT(m_pDocument != NULL); 1179 ASSERT(m_pDocument != NULL);
1180 1180
1181 if (vp.IsSetting()) 1181 if (vp.IsSetting())
1182 { 1182 {
1183 if (!m_bCanSet) return FALSE; 1183 if (!m_bCanSet) return false;
1184 1184
1185 CFX_WideString WideStr; 1185 CFX_WideString WideStr;
1186 vp >> WideStr; 1186 vp >> WideStr;
1187 1187
1188 if (m_bDelay) 1188 if (m_bDelay)
1189 { 1189 {
1190 AddDelay_WideString(FP_DEFAULTVALUE, WideStr); 1190 AddDelay_WideString(FP_DEFAULTVALUE, WideStr);
1191 } 1191 }
1192 else 1192 else
1193 { 1193 {
1194 Field::SetDefaultValue(m_pDocument, m_FieldName, m_nFormControlIndex , WideStr); 1194 Field::SetDefaultValue(m_pDocument, m_FieldName, m_nFormControlIndex , WideStr);
1195 } 1195 }
1196 } 1196 }
1197 else 1197 else
1198 { 1198 {
1199 CFX_PtrArray FieldArray; 1199 CFX_PtrArray FieldArray;
1200 GetFormFields(m_FieldName,FieldArray); 1200 GetFormFields(m_FieldName,FieldArray);
1201 if (FieldArray.GetSize() <= 0) return FALSE; 1201 if (FieldArray.GetSize() <= 0) return false;
1202 1202
1203 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 1203 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
1204 ASSERT(pFormField != NULL); 1204 ASSERT(pFormField != NULL);
1205 1205
1206 if (pFormField->GetFieldType() == FIELDTYPE_PUSHBUTTON || 1206 if (pFormField->GetFieldType() == FIELDTYPE_PUSHBUTTON ||
1207 pFormField->GetFieldType() == FIELDTYPE_SIGNATURE) 1207 pFormField->GetFieldType() == FIELDTYPE_SIGNATURE)
1208 return FALSE; 1208 return false;
1209 1209
1210 vp << pFormField->GetDefaultValue(); 1210 vp << pFormField->GetDefaultValue();
1211 } 1211 }
1212 return TRUE; 1212 return true;
1213 } 1213 }
1214 1214
1215 void Field::SetDefaultValue(CPDFSDK_Document* pDocument, const CFX_WideString& s wFieldName, int nControlIndex, 1215 void Field::SetDefaultValue(CPDFSDK_Document* pDocument, const CFX_WideString& s wFieldName, int nControlIndex,
1216 const CFX_WideString& string) 1216 const CFX_WideString& string)
1217 { 1217 {
1218 //Not supported. 1218 //Not supported.
1219 } 1219 }
1220 1220
1221 FX_BOOL Field::doNotScroll(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) 1221 bool Field::doNotScroll(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE rror)
1222 { 1222 {
1223 ASSERT(m_pDocument != NULL); 1223 ASSERT(m_pDocument != NULL);
1224 1224
1225 if (vp.IsSetting()) 1225 if (vp.IsSetting())
1226 { 1226 {
1227 if (!m_bCanSet) return FALSE; 1227 if (!m_bCanSet) return false;
1228 1228
1229 bool bVP; 1229 bool bVP;
1230 vp >> bVP; 1230 vp >> bVP;
1231 1231
1232 if (m_bDelay) 1232 if (m_bDelay)
1233 { 1233 {
1234 AddDelay_Bool(FP_DONOTSCROLL, bVP); 1234 AddDelay_Bool(FP_DONOTSCROLL, bVP);
1235 } 1235 }
1236 else 1236 else
1237 { 1237 {
1238 Field::SetDoNotScroll(m_pDocument, m_FieldName, m_nFormControlIndex, bVP); 1238 Field::SetDoNotScroll(m_pDocument, m_FieldName, m_nFormControlIndex, bVP);
1239 } 1239 }
1240 } 1240 }
1241 else 1241 else
1242 { 1242 {
1243 CFX_PtrArray FieldArray; 1243 CFX_PtrArray FieldArray;
1244 GetFormFields(m_FieldName,FieldArray); 1244 GetFormFields(m_FieldName,FieldArray);
1245 if (FieldArray.GetSize() <= 0) return FALSE; 1245 if (FieldArray.GetSize() <= 0) return false;
1246 1246
1247 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 1247 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
1248 ASSERT(pFormField != NULL); 1248 ASSERT(pFormField != NULL);
1249 1249
1250 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) 1250 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD)
1251 return FALSE; 1251 return false;
1252 1252
1253 if (pFormField->GetFieldFlags() & FIELDFLAG_DONOTSCROLL) 1253 if (pFormField->GetFieldFlags() & FIELDFLAG_DONOTSCROLL)
1254 vp << true; 1254 vp << true;
1255 else 1255 else
1256 vp << false; 1256 vp << false;
1257 } 1257 }
1258 1258
1259 return TRUE; 1259 return true;
1260 } 1260 }
1261 1261
1262 void Field::SetDoNotScroll(CPDFSDK_Document* pDocument, const CFX_WideString& sw FieldName, int nControlIndex, bool b) 1262 void Field::SetDoNotScroll(CPDFSDK_Document* pDocument, const CFX_WideString& sw FieldName, int nControlIndex, bool b)
1263 { 1263 {
1264 //Not supported. 1264 //Not supported.
1265 } 1265 }
1266 1266
1267 FX_BOOL Field::doNotSpellCheck(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStr ing& sError) 1267 bool Field::doNotSpellCheck(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString & sError)
1268 { 1268 {
1269 ASSERT(m_pDocument != NULL); 1269 ASSERT(m_pDocument != NULL);
1270 1270
1271 if (vp.IsSetting()) 1271 if (vp.IsSetting())
1272 { 1272 {
1273 if (!m_bCanSet) return FALSE; 1273 if (!m_bCanSet) return false;
1274 1274
1275 bool bVP; 1275 bool bVP;
1276 vp >> bVP; 1276 vp >> bVP;
1277 } 1277 }
1278 else 1278 else
1279 { 1279 {
1280 CFX_PtrArray FieldArray; 1280 CFX_PtrArray FieldArray;
1281 GetFormFields(m_FieldName,FieldArray); 1281 GetFormFields(m_FieldName,FieldArray);
1282 if (FieldArray.GetSize() <= 0) return FALSE; 1282 if (FieldArray.GetSize() <= 0) return false;
1283 1283
1284 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 1284 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
1285 ASSERT(pFormField != NULL); 1285 ASSERT(pFormField != NULL);
1286 1286
1287 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD && 1287 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD &&
1288 pFormField->GetFieldType() != FIELDTYPE_COMBOBOX) 1288 pFormField->GetFieldType() != FIELDTYPE_COMBOBOX)
1289 return FALSE; 1289 return false;
1290 1290
1291 if (pFormField->GetFieldFlags() & FIELDFLAG_DONOTSPELLCHECK) 1291 if (pFormField->GetFieldFlags() & FIELDFLAG_DONOTSPELLCHECK)
1292 vp << true; 1292 vp << true;
1293 else 1293 else
1294 vp << false; 1294 vp << false;
1295 } 1295 }
1296 1296
1297 return TRUE; 1297 return true;
1298 } 1298 }
1299 1299
1300 void Field::SetDelay(FX_BOOL bDelay) 1300 void Field::SetDelay(bool bDelay)
1301 { 1301 {
1302 m_bDelay = bDelay; 1302 m_bDelay = bDelay;
1303 1303
1304 if (!m_bDelay) 1304 if (!m_bDelay)
1305 { 1305 {
1306 if (m_pJSDoc) 1306 if (m_pJSDoc)
1307 m_pJSDoc->DoFieldDelay(m_FieldName, m_nFormControlIndex); 1307 m_pJSDoc->DoFieldDelay(m_FieldName, m_nFormControlIndex);
1308 } 1308 }
1309 } 1309 }
1310 1310
1311 FX_BOOL Field::delay(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro r) 1311 bool Field::delay(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
1312 { 1312 {
1313 if (vp.IsSetting()) 1313 if (vp.IsSetting())
1314 { 1314 {
1315 if (!m_bCanSet) return FALSE; 1315 if (!m_bCanSet) return false;
1316 1316
1317 bool bVP; 1317 bool bVP;
1318 vp >> bVP; 1318 vp >> bVP;
1319 1319
1320 SetDelay(bVP); 1320 SetDelay(bVP);
1321 } 1321 }
1322 else 1322 else
1323 { 1323 {
1324 vp << m_bDelay; 1324 vp << m_bDelay;
1325 } 1325 }
1326 return TRUE; 1326 return true;
1327 } 1327 }
1328 1328
1329 FX_BOOL Field::display(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sEr ror) 1329 bool Field::display(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError )
1330 { 1330 {
1331 ASSERT(m_pDocument != NULL); 1331 ASSERT(m_pDocument != NULL);
1332 1332
1333 if (vp.IsSetting()) 1333 if (vp.IsSetting())
1334 { 1334 {
1335 if (!m_bCanSet) return FALSE; 1335 if (!m_bCanSet) return false;
1336 1336
1337 int nVP; 1337 int nVP;
1338 vp >> nVP; 1338 vp >> nVP;
1339 1339
1340 if (m_bDelay) 1340 if (m_bDelay)
1341 { 1341 {
1342 AddDelay_Int(FP_DISPLAY, nVP); 1342 AddDelay_Int(FP_DISPLAY, nVP);
1343 } 1343 }
1344 else 1344 else
1345 { 1345 {
1346 Field::SetDisplay(m_pDocument, m_FieldName, m_nFormControlIndex, nVP ); 1346 Field::SetDisplay(m_pDocument, m_FieldName, m_nFormControlIndex, nVP );
1347 } 1347 }
1348 } 1348 }
1349 else 1349 else
1350 { 1350 {
1351 CFX_PtrArray FieldArray; 1351 CFX_PtrArray FieldArray;
1352 GetFormFields(m_FieldName,FieldArray); 1352 GetFormFields(m_FieldName,FieldArray);
1353 if (FieldArray.GetSize() <= 0) return FALSE; 1353 if (FieldArray.GetSize() <= 0) return false;
1354 1354
1355 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 1355 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
1356 ASSERT(pFormField != NULL); 1356 ASSERT(pFormField != NULL);
1357 1357
1358 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInte rForm(); 1358 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInte rForm();
1359 ASSERT(pInterForm != NULL); 1359 ASSERT(pInterForm != NULL);
1360 1360
1361 CPDFSDK_Widget* pWidget = pInterForm->GetWidget(GetSmartFieldControl(pFo rmField)); 1361 CPDFSDK_Widget* pWidget = pInterForm->GetWidget(GetSmartFieldControl(pFo rmField));
1362 if (!pWidget)return FALSE; 1362 if (!pWidget)return false;
1363 1363
1364 FX_DWORD dwFlag = pWidget->GetFlags(); 1364 FX_DWORD dwFlag = pWidget->GetFlags();
1365 1365
1366 if (ANNOTFLAG_INVISIBLE & dwFlag || ANNOTFLAG_HIDDEN & dwFlag) 1366 if (ANNOTFLAG_INVISIBLE & dwFlag || ANNOTFLAG_HIDDEN & dwFlag)
1367 { 1367 {
1368 vp << (int32_t)1; 1368 vp << (int32_t)1;
1369 } 1369 }
1370 else 1370 else
1371 { 1371 {
1372 if (ANNOTFLAG_PRINT & dwFlag) 1372 if (ANNOTFLAG_PRINT & dwFlag)
1373 { 1373 {
1374 if (ANNOTFLAG_NOVIEW & dwFlag) 1374 if (ANNOTFLAG_NOVIEW & dwFlag)
1375 { 1375 {
1376 vp << (int32_t)3; 1376 vp << (int32_t)3;
1377 } 1377 }
1378 else 1378 else
1379 { 1379 {
1380 vp << (int32_t)0; 1380 vp << (int32_t)0;
1381 } 1381 }
1382 } 1382 }
1383 else 1383 else
1384 { 1384 {
1385 vp << (int32_t)2; 1385 vp << (int32_t)2;
1386 } 1386 }
1387 } 1387 }
1388 } 1388 }
1389 1389
1390 return TRUE; 1390 return true;
1391 } 1391 }
1392 1392
1393 void Field::SetDisplay(CPDFSDK_Document* pDocument, const CFX_WideString& swFiel dName, int nControlIndex, int number) 1393 void Field::SetDisplay(CPDFSDK_Document* pDocument, const CFX_WideString& swFiel dName, int nControlIndex, int number)
1394 { 1394 {
1395 ASSERT(pDocument != NULL); 1395 ASSERT(pDocument != NULL);
1396 1396
1397 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm( ); 1397 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm( );
1398 ASSERT(pInterForm != NULL); 1398 ASSERT(pInterForm != NULL);
1399 1399
1400 CFX_PtrArray FieldArray; 1400 CFX_PtrArray FieldArray;
1401 GetFormFields(pDocument, swFieldName, FieldArray); 1401 GetFormFields(pDocument, swFieldName, FieldArray);
1402 1402
1403 for (int i=0,isz=FieldArray.GetSize(); i<isz; i++) 1403 for (int i=0,isz=FieldArray.GetSize(); i<isz; i++)
1404 { 1404 {
1405 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(i); 1405 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(i);
1406 ASSERT(pFormField != NULL); 1406 ASSERT(pFormField != NULL);
1407 1407
1408 if (nControlIndex < 0) 1408 if (nControlIndex < 0)
1409 { 1409 {
1410 FX_BOOL bSet = FALSE; 1410 bool bSet = false;
1411 for (int j=0,jsz = pFormField->CountControls(); j<jsz; j++) 1411 for (int j=0,jsz = pFormField->CountControls(); j<jsz; j++)
1412 { 1412 {
1413 CPDF_FormControl* pFormControl = pFormField->GetControl(j); 1413 CPDF_FormControl* pFormControl = pFormField->GetControl(j);
1414 ASSERT(pFormControl != NULL); 1414 ASSERT(pFormControl != NULL);
1415 1415
1416 if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl )) 1416 if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl ))
1417 { 1417 {
1418 FX_DWORD dwFlag = pWidget->GetFlags(); 1418 FX_DWORD dwFlag = pWidget->GetFlags();
1419 switch (number) 1419 switch (number)
1420 { 1420 {
(...skipping 17 matching lines...) Expand all
1438 case 3: 1438 case 3:
1439 dwFlag |= ANNOTFLAG_NOVIEW; 1439 dwFlag |= ANNOTFLAG_NOVIEW;
1440 dwFlag |= ANNOTFLAG_PRINT; 1440 dwFlag |= ANNOTFLAG_PRINT;
1441 dwFlag &= (~ANNOTFLAG_HIDDEN); 1441 dwFlag &= (~ANNOTFLAG_HIDDEN);
1442 break; 1442 break;
1443 } 1443 }
1444 1444
1445 if (dwFlag != pWidget->GetFlags()) 1445 if (dwFlag != pWidget->GetFlags())
1446 { 1446 {
1447 pWidget->SetFlags(dwFlag); 1447 pWidget->SetFlags(dwFlag);
1448 bSet = TRUE; 1448 bSet = true;
1449 } 1449 }
1450 } 1450 }
1451 } 1451 }
1452 1452
1453 if (bSet) UpdateFormField(pDocument, pFormField, TRUE, FALSE, TRUE); 1453 if (bSet) UpdateFormField(pDocument, pFormField, true, false, true);
1454 } 1454 }
1455 else 1455 else
1456 { 1456 {
1457 if(nControlIndex >= pFormField->CountControls()) return; 1457 if(nControlIndex >= pFormField->CountControls()) return;
1458 if (CPDF_FormControl* pFormControl = pFormField->GetControl(nControl Index)) 1458 if (CPDF_FormControl* pFormControl = pFormField->GetControl(nControl Index))
1459 { 1459 {
1460 if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl )) 1460 if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl ))
1461 { 1461 {
1462 1462
1463 FX_DWORD dwFlag = pWidget->GetFlags(); 1463 FX_DWORD dwFlag = pWidget->GetFlags();
(...skipping 18 matching lines...) Expand all
1482 break; 1482 break;
1483 case 3: 1483 case 3:
1484 dwFlag |= ANNOTFLAG_NOVIEW; 1484 dwFlag |= ANNOTFLAG_NOVIEW;
1485 dwFlag |= ANNOTFLAG_PRINT; 1485 dwFlag |= ANNOTFLAG_PRINT;
1486 dwFlag &= (~ANNOTFLAG_HIDDEN); 1486 dwFlag &= (~ANNOTFLAG_HIDDEN);
1487 break; 1487 break;
1488 } 1488 }
1489 if (dwFlag != pWidget->GetFlags()) 1489 if (dwFlag != pWidget->GetFlags())
1490 { 1490 {
1491 pWidget->SetFlags(dwFlag); 1491 pWidget->SetFlags(dwFlag);
1492 UpdateFormControl(pDocument, pFormControl, TRUE, FALSE, TRUE); 1492 UpdateFormControl(pDocument, pFormControl, true, false, true);
1493 } 1493 }
1494 } 1494 }
1495 } 1495 }
1496 } 1496 }
1497 } 1497 }
1498 } 1498 }
1499 1499
1500 FX_BOOL Field::doc(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) 1500 bool Field::doc(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
1501 { 1501 {
1502 if (!vp.IsGetting()) { 1502 if (!vp.IsGetting()) {
1503 return FALSE; 1503 return false;
1504 } 1504 }
1505 vp << m_pJSDoc->GetCJSDoc(); 1505 vp << m_pJSDoc->GetCJSDoc();
1506 return TRUE; 1506 return true;
1507 } 1507 }
1508 1508
1509 FX_BOOL Field::editable(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE rror) 1509 bool Field::editable(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro r)
1510 { 1510 {
1511 ASSERT(m_pDocument != NULL); 1511 ASSERT(m_pDocument != NULL);
1512 if (vp.IsSetting()) 1512 if (vp.IsSetting())
1513 { 1513 {
1514 if (!m_bCanSet) return FALSE; 1514 if (!m_bCanSet) return false;
1515 1515
1516 bool bVP; 1516 bool bVP;
1517 vp >> bVP; 1517 vp >> bVP;
1518 } 1518 }
1519 else 1519 else
1520 { 1520 {
1521 CFX_PtrArray FieldArray; 1521 CFX_PtrArray FieldArray;
1522 GetFormFields(m_FieldName, FieldArray); 1522 GetFormFields(m_FieldName, FieldArray);
1523 if (FieldArray.GetSize() <= 0) return FALSE; 1523 if (FieldArray.GetSize() <= 0) return false;
1524 1524
1525 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 1525 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
1526 ASSERT(pFormField != NULL); 1526 ASSERT(pFormField != NULL);
1527 1527
1528 if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX) 1528 if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX)
1529 return FALSE; 1529 return false;
1530 1530
1531 if (pFormField->GetFieldFlags() & FIELDFLAG_EDIT) 1531 if (pFormField->GetFieldFlags() & FIELDFLAG_EDIT)
1532 vp << true; 1532 vp << true;
1533 else 1533 else
1534 vp << false; 1534 vp << false;
1535 } 1535 }
1536 1536
1537 return TRUE; 1537 return true;
1538 } 1538 }
1539 1539
1540 FX_BOOL Field::exportValues(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString & sError) 1540 bool Field::exportValues(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s Error)
1541 { 1541 {
1542 ASSERT(m_pDocument != NULL); 1542 ASSERT(m_pDocument != NULL);
1543 1543
1544 CFX_PtrArray FieldArray; 1544 CFX_PtrArray FieldArray;
1545 GetFormFields(m_FieldName,FieldArray); 1545 GetFormFields(m_FieldName,FieldArray);
1546 if (FieldArray.GetSize() <= 0) 1546 if (FieldArray.GetSize() <= 0)
1547 return FALSE; 1547 return false;
1548 1548
1549 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 1549 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
1550 if (pFormField->GetFieldType() != FIELDTYPE_CHECKBOX && 1550 if (pFormField->GetFieldType() != FIELDTYPE_CHECKBOX &&
1551 pFormField->GetFieldType() != FIELDTYPE_RADIOBUTTON) 1551 pFormField->GetFieldType() != FIELDTYPE_RADIOBUTTON)
1552 return FALSE; 1552 return false;
1553 1553
1554 if (vp.IsSetting()) 1554 if (vp.IsSetting())
1555 { 1555 {
1556 if (!m_bCanSet) 1556 if (!m_bCanSet)
1557 return FALSE; 1557 return false;
1558 1558
1559 if (!vp.IsArrayObject()) 1559 if (!vp.IsArrayObject())
1560 return FALSE; 1560 return false;
1561 } 1561 }
1562 else 1562 else
1563 { 1563 {
1564 CJS_Array ExportValusArray(m_isolate); 1564 CJS_Array ExportValusArray(m_isolate);
1565 if (m_nFormControlIndex < 0) 1565 if (m_nFormControlIndex < 0)
1566 { 1566 {
1567 for (int i=0,sz=pFormField->CountControls(); i<sz; i++) 1567 for (int i=0,sz=pFormField->CountControls(); i<sz; i++)
1568 { 1568 {
1569 CPDF_FormControl* pFormControl = pFormField->GetControl(i); 1569 CPDF_FormControl* pFormControl = pFormField->GetControl(i);
1570 ExportValusArray.SetElement(i, CJS_Value(m_isolate,pFormControl- >GetExportValue().c_str())); 1570 ExportValusArray.SetElement(i, CJS_Value(m_isolate,pFormControl- >GetExportValue().c_str()));
1571 } 1571 }
1572 } 1572 }
1573 else 1573 else
1574 { 1574 {
1575 if (m_nFormControlIndex >= pFormField->CountControls()) 1575 if (m_nFormControlIndex >= pFormField->CountControls())
1576 return FALSE; 1576 return false;
1577 1577
1578 CPDF_FormControl* pFormControl = pFormField->GetControl(m_nFormContr olIndex); 1578 CPDF_FormControl* pFormControl = pFormField->GetControl(m_nFormContr olIndex);
1579 if (!pFormControl) 1579 if (!pFormControl)
1580 return FALSE; 1580 return false;
1581 1581
1582 ExportValusArray.SetElement(0, CJS_Value(m_isolate,pFormControl->Get ExportValue().c_str())); 1582 ExportValusArray.SetElement(0, CJS_Value(m_isolate,pFormControl->Get ExportValue().c_str()));
1583 } 1583 }
1584 vp << ExportValusArray; 1584 vp << ExportValusArray;
1585 } 1585 }
1586 return TRUE; 1586 return true;
1587 } 1587 }
1588 1588
1589 FX_BOOL Field::fileSelect(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) 1589 bool Field::fileSelect(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sEr ror)
1590 { 1590 {
1591 ASSERT(m_pDocument != NULL); 1591 ASSERT(m_pDocument != NULL);
1592 1592
1593 CFX_PtrArray FieldArray; 1593 CFX_PtrArray FieldArray;
1594 GetFormFields(m_FieldName, FieldArray); 1594 GetFormFields(m_FieldName, FieldArray);
1595 if (FieldArray.GetSize() <= 0) 1595 if (FieldArray.GetSize() <= 0)
1596 return FALSE; 1596 return false;
1597 1597
1598 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 1598 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
1599 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) 1599 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD)
1600 return FALSE; 1600 return false;
1601 1601
1602 if (vp.IsSetting()) 1602 if (vp.IsSetting())
1603 { 1603 {
1604 if (!m_bCanSet) 1604 if (!m_bCanSet)
1605 return FALSE; 1605 return false;
1606 1606
1607 bool bVP; 1607 bool bVP;
1608 vp >> bVP; 1608 vp >> bVP;
1609 } 1609 }
1610 else 1610 else
1611 { 1611 {
1612 if (pFormField->GetFieldFlags() & FIELDFLAG_FILESELECT) 1612 if (pFormField->GetFieldFlags() & FIELDFLAG_FILESELECT)
1613 vp << true; 1613 vp << true;
1614 else 1614 else
1615 vp << false; 1615 vp << false;
1616 } 1616 }
1617 return TRUE; 1617 return true;
1618 } 1618 }
1619 1619
1620 FX_BOOL Field::fillColor(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s Error) 1620 bool Field::fillColor(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErr or)
1621 { 1621 {
1622 ASSERT(m_pDocument != NULL); 1622 ASSERT(m_pDocument != NULL);
1623 1623
1624 CJS_Array crArray(m_isolate); 1624 CJS_Array crArray(m_isolate);
1625 1625
1626 CFX_PtrArray FieldArray; 1626 CFX_PtrArray FieldArray;
1627 GetFormFields(m_FieldName, FieldArray); 1627 GetFormFields(m_FieldName, FieldArray);
1628 if (FieldArray.GetSize() <= 0) 1628 if (FieldArray.GetSize() <= 0)
1629 return FALSE; 1629 return false;
1630 1630
1631 if (vp.IsSetting()) 1631 if (vp.IsSetting())
1632 { 1632 {
1633 if (!m_bCanSet) 1633 if (!m_bCanSet)
1634 return FALSE; 1634 return false;
1635 1635
1636 if (!vp.IsArrayObject()) 1636 if (!vp.IsArrayObject())
1637 return FALSE; 1637 return false;
1638 1638
1639 vp >> crArray; 1639 vp >> crArray;
1640 1640
1641 CPWL_Color color; 1641 CPWL_Color color;
1642 color::ConvertArrayToPWLColor(crArray, color); 1642 color::ConvertArrayToPWLColor(crArray, color);
1643 if (m_bDelay) 1643 if (m_bDelay)
1644 { 1644 {
1645 AddDelay_Color(FP_FILLCOLOR, color); 1645 AddDelay_Color(FP_FILLCOLOR, color);
1646 } 1646 }
1647 else 1647 else
1648 { 1648 {
1649 Field::SetFillColor(m_pDocument, m_FieldName, m_nFormControlIndex, c olor); 1649 Field::SetFillColor(m_pDocument, m_FieldName, m_nFormControlIndex, c olor);
1650 } 1650 }
1651 } 1651 }
1652 else 1652 else
1653 { 1653 {
1654 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 1654 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
1655 ASSERT(pFormField != NULL); 1655 ASSERT(pFormField != NULL);
1656 1656
1657 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); 1657 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
1658 if (!pFormControl) 1658 if (!pFormControl)
1659 return FALSE; 1659 return false;
1660 1660
1661 int iColorType; 1661 int iColorType;
1662 pFormControl->GetBackgroundColor(iColorType); 1662 pFormControl->GetBackgroundColor(iColorType);
1663 1663
1664 CPWL_Color color; 1664 CPWL_Color color;
1665 if (iColorType == COLORTYPE_TRANSPARENT) 1665 if (iColorType == COLORTYPE_TRANSPARENT)
1666 { 1666 {
1667 color = CPWL_Color(COLORTYPE_TRANSPARENT); 1667 color = CPWL_Color(COLORTYPE_TRANSPARENT);
1668 } 1668 }
1669 else if (iColorType == COLORTYPE_GRAY) 1669 else if (iColorType == COLORTYPE_GRAY)
1670 { 1670 {
1671 color = CPWL_Color(COLORTYPE_GRAY, pFormControl->GetOriginalBackgrou ndColor(0)); 1671 color = CPWL_Color(COLORTYPE_GRAY, pFormControl->GetOriginalBackgrou ndColor(0));
1672 } 1672 }
1673 else if (iColorType == COLORTYPE_RGB) 1673 else if (iColorType == COLORTYPE_RGB)
1674 { 1674 {
1675 color = CPWL_Color(COLORTYPE_RGB, pFormControl->GetOriginalBackgroun dColor(0), 1675 color = CPWL_Color(COLORTYPE_RGB, pFormControl->GetOriginalBackgroun dColor(0),
1676 pFormControl->GetOriginalBackgroundColor(1), 1676 pFormControl->GetOriginalBackgroundColor(1),
1677 pFormControl->GetOriginalBackgroundColor(2)); 1677 pFormControl->GetOriginalBackgroundColor(2));
1678 } 1678 }
1679 else if (iColorType == COLORTYPE_CMYK) 1679 else if (iColorType == COLORTYPE_CMYK)
1680 { 1680 {
1681 color = CPWL_Color(COLORTYPE_CMYK, pFormControl->GetOriginalBackgrou ndColor(0), 1681 color = CPWL_Color(COLORTYPE_CMYK, pFormControl->GetOriginalBackgrou ndColor(0),
1682 pFormControl->GetOriginalBackgroundColor(1), 1682 pFormControl->GetOriginalBackgroundColor(1),
1683 pFormControl->GetOriginalBackgroundColor(2), 1683 pFormControl->GetOriginalBackgroundColor(2),
1684 pFormControl->GetOriginalBackgroundColor(3)); 1684 pFormControl->GetOriginalBackgroundColor(3));
1685 } 1685 }
1686 else 1686 else
1687 return FALSE; 1687 return false;
1688 1688
1689 color::ConvertPWLColorToArray(color, crArray); 1689 color::ConvertPWLColorToArray(color, crArray);
1690 vp << crArray; 1690 vp << crArray;
1691 } 1691 }
1692 1692
1693 return TRUE; 1693 return true;
1694 } 1694 }
1695 1695
1696 void Field::SetFillColor(CPDFSDK_Document* pDocument, const CFX_WideString& swFi eldName, int nControlIndex, const CPWL_Color& color) 1696 void Field::SetFillColor(CPDFSDK_Document* pDocument, const CFX_WideString& swFi eldName, int nControlIndex, const CPWL_Color& color)
1697 { 1697 {
1698 //Not supported. 1698 //Not supported.
1699 } 1699 }
1700 1700
1701 FX_BOOL Field::hidden(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErr or) 1701 bool Field::hidden(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
1702 { 1702 {
1703 ASSERT(m_pDocument != NULL); 1703 ASSERT(m_pDocument != NULL);
1704 1704
1705 if (vp.IsSetting()) 1705 if (vp.IsSetting())
1706 { 1706 {
1707 if (!m_bCanSet) return FALSE; 1707 if (!m_bCanSet) return false;
1708 1708
1709 bool bVP; 1709 bool bVP;
1710 vp >> bVP; 1710 vp >> bVP;
1711 1711
1712 if (m_bDelay) 1712 if (m_bDelay)
1713 { 1713 {
1714 AddDelay_Bool(FP_HIDDEN, bVP); 1714 AddDelay_Bool(FP_HIDDEN, bVP);
1715 } 1715 }
1716 else 1716 else
1717 { 1717 {
1718 Field::SetHidden(m_pDocument, m_FieldName, m_nFormControlIndex, bVP) ; 1718 Field::SetHidden(m_pDocument, m_FieldName, m_nFormControlIndex, bVP) ;
1719 } 1719 }
1720 } 1720 }
1721 else 1721 else
1722 { 1722 {
1723 CFX_PtrArray FieldArray; 1723 CFX_PtrArray FieldArray;
1724 GetFormFields(m_FieldName,FieldArray); 1724 GetFormFields(m_FieldName,FieldArray);
1725 if (FieldArray.GetSize() <= 0) return FALSE; 1725 if (FieldArray.GetSize() <= 0) return false;
1726 1726
1727 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 1727 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
1728 ASSERT(pFormField != NULL); 1728 ASSERT(pFormField != NULL);
1729 1729
1730 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInte rForm(); 1730 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInte rForm();
1731 ASSERT(pInterForm != NULL); 1731 ASSERT(pInterForm != NULL);
1732 1732
1733 CPDFSDK_Widget* pWidget = pInterForm->GetWidget(GetSmartFieldControl(pFo rmField)); 1733 CPDFSDK_Widget* pWidget = pInterForm->GetWidget(GetSmartFieldControl(pFo rmField));
1734 if (!pWidget) return FALSE; 1734 if (!pWidget) return false;
1735 1735
1736 FX_DWORD dwFlags = pWidget->GetFlags(); 1736 FX_DWORD dwFlags = pWidget->GetFlags();
1737 1737
1738 if (ANNOTFLAG_INVISIBLE & dwFlags || ANNOTFLAG_HIDDEN & dwFlags) 1738 if (ANNOTFLAG_INVISIBLE & dwFlags || ANNOTFLAG_HIDDEN & dwFlags)
1739 { 1739 {
1740 vp << true; 1740 vp << true;
1741 } 1741 }
1742 else 1742 else
1743 vp << false; 1743 vp << false;
1744 } 1744 }
1745 1745
1746 return TRUE; 1746 return true;
1747 } 1747 }
1748 1748
1749 void Field::SetHidden(CPDFSDK_Document* pDocument, const CFX_WideString& swField Name, int nControlIndex, bool b) 1749 void Field::SetHidden(CPDFSDK_Document* pDocument, const CFX_WideString& swField Name, int nControlIndex, bool b)
1750 { 1750 {
1751 ASSERT(pDocument != NULL); 1751 ASSERT(pDocument != NULL);
1752 1752
1753 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm( ); 1753 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm( );
1754 ASSERT(pInterForm != NULL); 1754 ASSERT(pInterForm != NULL);
1755 1755
1756 CFX_PtrArray FieldArray; 1756 CFX_PtrArray FieldArray;
1757 GetFormFields(pDocument, swFieldName, FieldArray); 1757 GetFormFields(pDocument, swFieldName, FieldArray);
1758 1758
1759 for (int i=0,isz=FieldArray.GetSize(); i<isz; i++) 1759 for (int i=0,isz=FieldArray.GetSize(); i<isz; i++)
1760 { 1760 {
1761 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(i); 1761 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(i);
1762 ASSERT(pFormField != NULL); 1762 ASSERT(pFormField != NULL);
1763 1763
1764 if (nControlIndex < 0) 1764 if (nControlIndex < 0)
1765 { 1765 {
1766 FX_BOOL bSet = FALSE; 1766 bool bSet = false;
1767 for (int j=0,jsz = pFormField->CountControls(); j<jsz; j++) 1767 for (int j=0,jsz = pFormField->CountControls(); j<jsz; j++)
1768 { 1768 {
1769 if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormField-> GetControl(j))) 1769 if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormField-> GetControl(j)))
1770 { 1770 {
1771 FX_DWORD dwFlags = pWidget->GetFlags(); 1771 FX_DWORD dwFlags = pWidget->GetFlags();
1772 1772
1773 if (b) 1773 if (b)
1774 { 1774 {
1775 dwFlags &= (~ANNOTFLAG_INVISIBLE); 1775 dwFlags &= (~ANNOTFLAG_INVISIBLE);
1776 dwFlags &= (~ANNOTFLAG_NOVIEW); 1776 dwFlags &= (~ANNOTFLAG_NOVIEW);
1777 dwFlags |= (ANNOTFLAG_HIDDEN | ANNOTFLAG_PRINT); 1777 dwFlags |= (ANNOTFLAG_HIDDEN | ANNOTFLAG_PRINT);
1778 } 1778 }
1779 else 1779 else
1780 { 1780 {
1781 dwFlags &= (~ANNOTFLAG_INVISIBLE); 1781 dwFlags &= (~ANNOTFLAG_INVISIBLE);
1782 dwFlags &= (~ANNOTFLAG_HIDDEN); 1782 dwFlags &= (~ANNOTFLAG_HIDDEN);
1783 dwFlags &= (~ANNOTFLAG_NOVIEW); 1783 dwFlags &= (~ANNOTFLAG_NOVIEW);
1784 dwFlags |= ANNOTFLAG_PRINT; 1784 dwFlags |= ANNOTFLAG_PRINT;
1785 } 1785 }
1786 1786
1787 if (dwFlags != pWidget->GetFlags()) 1787 if (dwFlags != pWidget->GetFlags())
1788 { 1788 {
1789 pWidget->SetFlags(dwFlags); 1789 pWidget->SetFlags(dwFlags);
1790 bSet = TRUE; 1790 bSet = true;
1791 } 1791 }
1792 } 1792 }
1793 } 1793 }
1794 1794
1795 if (bSet) 1795 if (bSet)
1796 UpdateFormField(pDocument, pFormField, TRUE, FALSE, TRUE); 1796 UpdateFormField(pDocument, pFormField, true, false, true);
1797 } 1797 }
1798 else 1798 else
1799 { 1799 {
1800 if(nControlIndex >= pFormField->CountControls()) return; 1800 if(nControlIndex >= pFormField->CountControls()) return;
1801 if (CPDF_FormControl* pFormControl = pFormField->GetControl(nControl Index)) 1801 if (CPDF_FormControl* pFormControl = pFormField->GetControl(nControl Index))
1802 { 1802 {
1803 if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl )) 1803 if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl ))
1804 { 1804 {
1805 FX_DWORD dwFlags = pWidget->GetFlags(); 1805 FX_DWORD dwFlags = pWidget->GetFlags();
1806 1806
1807 if (b) 1807 if (b)
1808 { 1808 {
1809 dwFlags &= (~ANNOTFLAG_INVISIBLE); 1809 dwFlags &= (~ANNOTFLAG_INVISIBLE);
1810 dwFlags &= (~ANNOTFLAG_NOVIEW); 1810 dwFlags &= (~ANNOTFLAG_NOVIEW);
1811 dwFlags |= (ANNOTFLAG_HIDDEN | ANNOTFLAG_PRINT); 1811 dwFlags |= (ANNOTFLAG_HIDDEN | ANNOTFLAG_PRINT);
1812 } 1812 }
1813 else 1813 else
1814 { 1814 {
1815 dwFlags &= (~ANNOTFLAG_INVISIBLE); 1815 dwFlags &= (~ANNOTFLAG_INVISIBLE);
1816 dwFlags &= (~ANNOTFLAG_HIDDEN); 1816 dwFlags &= (~ANNOTFLAG_HIDDEN);
1817 dwFlags &= (~ANNOTFLAG_NOVIEW); 1817 dwFlags &= (~ANNOTFLAG_NOVIEW);
1818 dwFlags |= ANNOTFLAG_PRINT; 1818 dwFlags |= ANNOTFLAG_PRINT;
1819 } 1819 }
1820 1820
1821 if (dwFlags != pWidget->GetFlags()) 1821 if (dwFlags != pWidget->GetFlags())
1822 { 1822 {
1823 pWidget->SetFlags(dwFlags); 1823 pWidget->SetFlags(dwFlags);
1824 UpdateFormControl(pDocument, pFormControl, TRUE, FALSE, TRUE); 1824 UpdateFormControl(pDocument, pFormControl, true, false, true);
1825 } 1825 }
1826 } 1826 }
1827 } 1827 }
1828 } 1828 }
1829 } 1829 }
1830 } 1830 }
1831 1831
1832 FX_BOOL Field::highlight(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s Error) 1832 bool Field::highlight(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErr or)
1833 { 1833 {
1834 ASSERT(m_pDocument != NULL); 1834 ASSERT(m_pDocument != NULL);
1835 1835
1836 if (vp.IsSetting()) 1836 if (vp.IsSetting())
1837 { 1837 {
1838 if (!m_bCanSet) return FALSE; 1838 if (!m_bCanSet) return false;
1839 1839
1840 CFX_ByteString strMode; 1840 CFX_ByteString strMode;
1841 vp >> strMode; 1841 vp >> strMode;
1842 1842
1843 if (m_bDelay) 1843 if (m_bDelay)
1844 { 1844 {
1845 AddDelay_String(FP_HIGHLIGHT, strMode); 1845 AddDelay_String(FP_HIGHLIGHT, strMode);
1846 } 1846 }
1847 else 1847 else
1848 { 1848 {
1849 Field::SetHighlight(m_pDocument, m_FieldName, m_nFormControlIndex, s trMode); 1849 Field::SetHighlight(m_pDocument, m_FieldName, m_nFormControlIndex, s trMode);
1850 } 1850 }
1851 } 1851 }
1852 else 1852 else
1853 { 1853 {
1854 CFX_PtrArray FieldArray; 1854 CFX_PtrArray FieldArray;
1855 GetFormFields(m_FieldName,FieldArray); 1855 GetFormFields(m_FieldName,FieldArray);
1856 if (FieldArray.GetSize() <= 0) return FALSE; 1856 if (FieldArray.GetSize() <= 0) return false;
1857 1857
1858 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 1858 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
1859 ASSERT(pFormField != NULL); 1859 ASSERT(pFormField != NULL);
1860 1860
1861 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) 1861 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON)
1862 return FALSE; 1862 return false;
1863 1863
1864 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); 1864 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
1865 if (!pFormControl) return FALSE; 1865 if (!pFormControl) return false;
1866 1866
1867 int eHM = pFormControl->GetHighlightingMode(); 1867 int eHM = pFormControl->GetHighlightingMode();
1868 switch (eHM) 1868 switch (eHM)
1869 { 1869 {
1870 case CPDF_FormControl::None: 1870 case CPDF_FormControl::None:
1871 vp << L"none"; 1871 vp << L"none";
1872 break; 1872 break;
1873 case CPDF_FormControl::Push: 1873 case CPDF_FormControl::Push:
1874 vp << L"push"; 1874 vp << L"push";
1875 break; 1875 break;
1876 case CPDF_FormControl::Invert: 1876 case CPDF_FormControl::Invert:
1877 vp << L"invert"; 1877 vp << L"invert";
1878 break; 1878 break;
1879 case CPDF_FormControl::Outline: 1879 case CPDF_FormControl::Outline:
1880 vp << L"outline"; 1880 vp << L"outline";
1881 break; 1881 break;
1882 case CPDF_FormControl::Toggle: 1882 case CPDF_FormControl::Toggle:
1883 vp << L"toggle"; 1883 vp << L"toggle";
1884 break; 1884 break;
1885 } 1885 }
1886 } 1886 }
1887 1887
1888 return TRUE; 1888 return true;
1889 } 1889 }
1890 1890
1891 void Field::SetHighlight(CPDFSDK_Document* pDocument, const CFX_WideString& swFi eldName, int nControlIndex, const CFX_ByteString& string) 1891 void Field::SetHighlight(CPDFSDK_Document* pDocument, const CFX_WideString& swFi eldName, int nControlIndex, const CFX_ByteString& string)
1892 { 1892 {
1893 //Not supported. 1893 //Not supported.
1894 } 1894 }
1895 1895
1896 FX_BOOL Field::lineWidth(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s Error) 1896 bool Field::lineWidth(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErr or)
1897 { 1897 {
1898 ASSERT(m_pDocument != NULL); 1898 ASSERT(m_pDocument != NULL);
1899 1899
1900 if (vp.IsSetting()) 1900 if (vp.IsSetting())
1901 { 1901 {
1902 if (!m_bCanSet) return FALSE; 1902 if (!m_bCanSet) return false;
1903 1903
1904 int iWidth; 1904 int iWidth;
1905 vp >> iWidth; 1905 vp >> iWidth;
1906 1906
1907 if (m_bDelay) 1907 if (m_bDelay)
1908 { 1908 {
1909 AddDelay_Int(FP_LINEWIDTH, iWidth); 1909 AddDelay_Int(FP_LINEWIDTH, iWidth);
1910 } 1910 }
1911 else 1911 else
1912 { 1912 {
1913 Field::SetLineWidth(m_pDocument, m_FieldName, m_nFormControlIndex, i Width); 1913 Field::SetLineWidth(m_pDocument, m_FieldName, m_nFormControlIndex, i Width);
1914 } 1914 }
1915 } 1915 }
1916 else 1916 else
1917 { 1917 {
1918 CFX_PtrArray FieldArray; 1918 CFX_PtrArray FieldArray;
1919 GetFormFields(m_FieldName,FieldArray); 1919 GetFormFields(m_FieldName,FieldArray);
1920 if (FieldArray.GetSize() <= 0) return FALSE; 1920 if (FieldArray.GetSize() <= 0) return false;
1921 1921
1922 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 1922 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
1923 ASSERT(pFormField != NULL); 1923 ASSERT(pFormField != NULL);
1924 1924
1925 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); 1925 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
1926 if (!pFormControl) return FALSE; 1926 if (!pFormControl) return false;
1927 1927
1928 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInte rForm(); 1928 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInte rForm();
1929 ASSERT(pInterForm != NULL); 1929 ASSERT(pInterForm != NULL);
1930 1930
1931 if(!pFormField->CountControls()) return FALSE; 1931 if(!pFormField->CountControls()) return false;
1932 1932
1933 CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormField->GetControl(0 )); 1933 CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormField->GetControl(0 ));
1934 if (!pWidget) return FALSE; 1934 if (!pWidget) return false;
1935 1935
1936 vp << (int32_t)pWidget->GetBorderWidth(); 1936 vp << (int32_t)pWidget->GetBorderWidth();
1937 } 1937 }
1938 1938
1939 return TRUE; 1939 return true;
1940 } 1940 }
1941 1941
1942 void Field::SetLineWidth(CPDFSDK_Document* pDocument, const CFX_WideString& swFi eldName, int nControlIndex, int number) 1942 void Field::SetLineWidth(CPDFSDK_Document* pDocument, const CFX_WideString& swFi eldName, int nControlIndex, int number)
1943 { 1943 {
1944 ASSERT(pDocument != NULL); 1944 ASSERT(pDocument != NULL);
1945 1945
1946 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm( ); 1946 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm( );
1947 ASSERT(pInterForm != NULL); 1947 ASSERT(pInterForm != NULL);
1948 1948
1949 CFX_PtrArray FieldArray; 1949 CFX_PtrArray FieldArray;
1950 GetFormFields(pDocument, swFieldName, FieldArray); 1950 GetFormFields(pDocument, swFieldName, FieldArray);
1951 1951
1952 for (int i=0,isz=FieldArray.GetSize(); i<isz; i++) 1952 for (int i=0,isz=FieldArray.GetSize(); i<isz; i++)
1953 { 1953 {
1954 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(i); 1954 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(i);
1955 ASSERT(pFormField != NULL); 1955 ASSERT(pFormField != NULL);
1956 1956
1957 if (nControlIndex < 0) 1957 if (nControlIndex < 0)
1958 { 1958 {
1959 FX_BOOL bSet = FALSE; 1959 bool bSet = false;
1960 for (int j=0,jsz=pFormField->CountControls(); j<jsz; j++) 1960 for (int j=0,jsz=pFormField->CountControls(); j<jsz; j++)
1961 { 1961 {
1962 CPDF_FormControl* pFormControl = pFormField->GetControl(j); 1962 CPDF_FormControl* pFormControl = pFormField->GetControl(j);
1963 ASSERT(pFormControl != NULL); 1963 ASSERT(pFormControl != NULL);
1964 1964
1965 if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl )) 1965 if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl ))
1966 { 1966 {
1967 if (number != pWidget->GetBorderWidth()) 1967 if (number != pWidget->GetBorderWidth())
1968 { 1968 {
1969 pWidget->SetBorderWidth(number); 1969 pWidget->SetBorderWidth(number);
1970 bSet = TRUE; 1970 bSet = true;
1971 } 1971 }
1972 } 1972 }
1973 } 1973 }
1974 if (bSet) UpdateFormField(pDocument, pFormField, TRUE, TRUE, TRUE); 1974 if (bSet) UpdateFormField(pDocument, pFormField, true, true, true);
1975 } 1975 }
1976 else 1976 else
1977 { 1977 {
1978 if(nControlIndex >= pFormField->CountControls()) return; 1978 if(nControlIndex >= pFormField->CountControls()) return;
1979 if (CPDF_FormControl* pFormControl = pFormField->GetControl(nControl Index)) 1979 if (CPDF_FormControl* pFormControl = pFormField->GetControl(nControl Index))
1980 { 1980 {
1981 if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl )) 1981 if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl ))
1982 { 1982 {
1983 if (number != pWidget->GetBorderWidth()) 1983 if (number != pWidget->GetBorderWidth())
1984 { 1984 {
1985 pWidget->SetBorderWidth(number); 1985 pWidget->SetBorderWidth(number);
1986 UpdateFormControl(pDocument, pFormControl, TRUE, TRUE, T RUE); 1986 UpdateFormControl(pDocument, pFormControl, true, true, t rue);
1987 } 1987 }
1988 } 1988 }
1989 } 1989 }
1990 } 1990 }
1991 } 1991 }
1992 } 1992 }
1993 1993
1994 FX_BOOL Field::multiline(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s Error) 1994 bool Field::multiline(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErr or)
1995 { 1995 {
1996 ASSERT(m_pDocument != NULL); 1996 ASSERT(m_pDocument != NULL);
1997 1997
1998 if (vp.IsSetting()) 1998 if (vp.IsSetting())
1999 { 1999 {
2000 if (!m_bCanSet) return FALSE; 2000 if (!m_bCanSet) return false;
2001 2001
2002 bool bVP; 2002 bool bVP;
2003 vp >> bVP; 2003 vp >> bVP;
2004 2004
2005 if (m_bDelay) 2005 if (m_bDelay)
2006 { 2006 {
2007 AddDelay_Bool(FP_MULTILINE, bVP); 2007 AddDelay_Bool(FP_MULTILINE, bVP);
2008 } 2008 }
2009 else 2009 else
2010 { 2010 {
2011 Field::SetMultiline(m_pDocument, m_FieldName, m_nFormControlIndex, b VP); 2011 Field::SetMultiline(m_pDocument, m_FieldName, m_nFormControlIndex, b VP);
2012 } 2012 }
2013 } 2013 }
2014 else 2014 else
2015 { 2015 {
2016 CFX_PtrArray FieldArray; 2016 CFX_PtrArray FieldArray;
2017 GetFormFields(m_FieldName, FieldArray); 2017 GetFormFields(m_FieldName, FieldArray);
2018 if (FieldArray.GetSize() <= 0) return FALSE; 2018 if (FieldArray.GetSize() <= 0) return false;
2019 2019
2020 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 2020 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
2021 ASSERT(pFormField != NULL); 2021 ASSERT(pFormField != NULL);
2022 2022
2023 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) 2023 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD)
2024 return FALSE; 2024 return false;
2025 2025
2026 if (pFormField->GetFieldFlags() & FIELDFLAG_MULTILINE) 2026 if (pFormField->GetFieldFlags() & FIELDFLAG_MULTILINE)
2027 vp << true; 2027 vp << true;
2028 else 2028 else
2029 vp << false; 2029 vp << false;
2030 } 2030 }
2031 2031
2032 return TRUE; 2032 return true;
2033 } 2033 }
2034 2034
2035 void Field::SetMultiline(CPDFSDK_Document* pDocument, const CFX_WideString& swFi eldName, int nControlIndex, bool b) 2035 void Field::SetMultiline(CPDFSDK_Document* pDocument, const CFX_WideString& swFi eldName, int nControlIndex, bool b)
2036 { 2036 {
2037 //Not supported. 2037 //Not supported.
2038 } 2038 }
2039 2039
2040 FX_BOOL Field::multipleSelection(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideS tring& sError) 2040 bool Field::multipleSelection(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStri ng& sError)
2041 { 2041 {
2042 ASSERT(m_pDocument != NULL); 2042 ASSERT(m_pDocument != NULL);
2043 2043
2044 if (vp.IsSetting()) 2044 if (vp.IsSetting())
2045 { 2045 {
2046 if (!m_bCanSet) return FALSE; 2046 if (!m_bCanSet) return false;
2047 2047
2048 bool bVP; 2048 bool bVP;
2049 vp >> bVP; 2049 vp >> bVP;
2050 2050
2051 if (m_bDelay) 2051 if (m_bDelay)
2052 { 2052 {
2053 AddDelay_Bool(FP_MULTIPLESELECTION, bVP); 2053 AddDelay_Bool(FP_MULTIPLESELECTION, bVP);
2054 } 2054 }
2055 else 2055 else
2056 { 2056 {
2057 Field::SetMultipleSelection(m_pDocument, m_FieldName, m_nFormControl Index, bVP); 2057 Field::SetMultipleSelection(m_pDocument, m_FieldName, m_nFormControl Index, bVP);
2058 } 2058 }
2059 } 2059 }
2060 else 2060 else
2061 { 2061 {
2062 CFX_PtrArray FieldArray; 2062 CFX_PtrArray FieldArray;
2063 GetFormFields(m_FieldName,FieldArray); 2063 GetFormFields(m_FieldName,FieldArray);
2064 if (FieldArray.GetSize() <= 0) return FALSE; 2064 if (FieldArray.GetSize() <= 0) return false;
2065 2065
2066 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 2066 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
2067 ASSERT(pFormField != NULL); 2067 ASSERT(pFormField != NULL);
2068 2068
2069 if (pFormField->GetFieldType() != FIELDTYPE_LISTBOX) 2069 if (pFormField->GetFieldType() != FIELDTYPE_LISTBOX)
2070 return FALSE; 2070 return false;
2071 2071
2072 if (pFormField->GetFieldFlags() & FIELDFLAG_MULTISELECT) 2072 if (pFormField->GetFieldFlags() & FIELDFLAG_MULTISELECT)
2073 vp << true; 2073 vp << true;
2074 else 2074 else
2075 vp << false; 2075 vp << false;
2076 } 2076 }
2077 2077
2078 return TRUE; 2078 return true;
2079 } 2079 }
2080 2080
2081 void Field::SetMultipleSelection(CPDFSDK_Document* pDocument, const CFX_WideStri ng& swFieldName, int nControlIndex, bool b) 2081 void Field::SetMultipleSelection(CPDFSDK_Document* pDocument, const CFX_WideStri ng& swFieldName, int nControlIndex, bool b)
2082 { 2082 {
2083 //Not supported. 2083 //Not supported.
2084 } 2084 }
2085 2085
2086 FX_BOOL Field::name(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError ) 2086 bool Field::name(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
2087 { 2087 {
2088 if (!vp.IsGetting()) return FALSE; 2088 if (!vp.IsGetting()) return false;
2089 2089
2090 CFX_PtrArray FieldArray; 2090 CFX_PtrArray FieldArray;
2091 GetFormFields(m_FieldName, FieldArray); 2091 GetFormFields(m_FieldName, FieldArray);
2092 if (FieldArray.GetSize() <= 0) return FALSE; 2092 if (FieldArray.GetSize() <= 0) return false;
2093 2093
2094 vp << m_FieldName; 2094 vp << m_FieldName;
2095 2095
2096 return TRUE; 2096 return true;
2097 } 2097 }
2098 2098
2099 FX_BOOL Field::numItems(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE rror) 2099 bool Field::numItems(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro r)
2100 { 2100 {
2101 CFX_PtrArray FieldArray; 2101 CFX_PtrArray FieldArray;
2102 GetFormFields(m_FieldName, FieldArray); 2102 GetFormFields(m_FieldName, FieldArray);
2103 if (FieldArray.GetSize() <= 0) return FALSE; 2103 if (FieldArray.GetSize() <= 0) return false;
2104 2104
2105 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 2105 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
2106 ASSERT(pFormField != NULL); 2106 ASSERT(pFormField != NULL);
2107 2107
2108 if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX && 2108 if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX &&
2109 pFormField->GetFieldType() != FIELDTYPE_LISTBOX) 2109 pFormField->GetFieldType() != FIELDTYPE_LISTBOX)
2110 return FALSE; 2110 return false;
2111 2111
2112 if (!vp.IsGetting()) return FALSE; 2112 if (!vp.IsGetting()) return false;
2113 2113
2114 vp << (int32_t)pFormField->CountOptions(); 2114 vp << (int32_t)pFormField->CountOptions();
2115 2115
2116 return TRUE; 2116 return true;
2117 } 2117 }
2118 2118
2119 FX_BOOL Field::page(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError ) 2119 bool Field::page(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
2120 { 2120 {
2121 if (!vp.IsGetting()) return FALSE; 2121 if (!vp.IsGetting()) return false;
2122 2122
2123 CFX_PtrArray FieldArray; 2123 CFX_PtrArray FieldArray;
2124 GetFormFields(m_FieldName, FieldArray); 2124 GetFormFields(m_FieldName, FieldArray);
2125 if (FieldArray.GetSize() <= 0) return FALSE; 2125 if (FieldArray.GetSize() <= 0) return false;
2126 2126
2127 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 2127 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
2128 if (!pFormField) return FALSE; 2128 if (!pFormField) return false;
2129 2129
2130 ASSERT(m_pDocument != NULL); 2130 ASSERT(m_pDocument != NULL);
2131 2131
2132 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInterFor m(); 2132 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInterFor m();
2133 ASSERT(pInterForm != NULL); 2133 ASSERT(pInterForm != NULL);
2134 2134
2135 CFX_PtrArray widgetArray; 2135 CFX_PtrArray widgetArray;
2136 pInterForm->GetWidgets(pFormField, widgetArray); 2136 pInterForm->GetWidgets(pFormField, widgetArray);
2137 2137
2138 if (widgetArray.GetSize() > 0) 2138 if (widgetArray.GetSize() > 0)
2139 { 2139 {
2140 CJS_Array PageArray(m_isolate); 2140 CJS_Array PageArray(m_isolate);
2141 2141
2142 for (int i=0,sz=widgetArray.GetSize(); i<sz; i++) 2142 for (int i=0,sz=widgetArray.GetSize(); i<sz; i++)
2143 { 2143 {
2144 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)widgetArray.GetAt(i); 2144 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)widgetArray.GetAt(i);
2145 ASSERT(pWidget != NULL); 2145 ASSERT(pWidget != NULL);
2146 2146
2147 CPDFSDK_PageView* pPageView = pWidget->GetPageView(); 2147 CPDFSDK_PageView* pPageView = pWidget->GetPageView();
2148 if(!pPageView) 2148 if(!pPageView)
2149 return FALSE; 2149 return false;
2150 2150
2151 PageArray.SetElement(i, CJS_Value(m_isolate,(int32_t)pPageView->GetP ageIndex())); 2151 PageArray.SetElement(i, CJS_Value(m_isolate,(int32_t)pPageView->GetP ageIndex()));
2152 } 2152 }
2153 2153
2154 vp << PageArray; 2154 vp << PageArray;
2155 } 2155 }
2156 else 2156 else
2157 { 2157 {
2158 vp << (int32_t) -1; 2158 vp << (int32_t) -1;
2159 } 2159 }
2160 2160
2161 return TRUE; 2161 return true;
2162 } 2162 }
2163 2163
2164 FX_BOOL Field::password(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE rror) 2164 bool Field::password(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro r)
2165 { 2165 {
2166 ASSERT(m_pDocument != NULL); 2166 ASSERT(m_pDocument != NULL);
2167 2167
2168 if (vp.IsSetting()) 2168 if (vp.IsSetting())
2169 { 2169 {
2170 if (!m_bCanSet) return FALSE; 2170 if (!m_bCanSet) return false;
2171 2171
2172 bool bVP; 2172 bool bVP;
2173 vp >> bVP; 2173 vp >> bVP;
2174 2174
2175 if (m_bDelay) 2175 if (m_bDelay)
2176 { 2176 {
2177 AddDelay_Bool(FP_PASSWORD, bVP); 2177 AddDelay_Bool(FP_PASSWORD, bVP);
2178 } 2178 }
2179 else 2179 else
2180 { 2180 {
2181 Field::SetPassword(m_pDocument, m_FieldName, m_nFormControlIndex, bV P); 2181 Field::SetPassword(m_pDocument, m_FieldName, m_nFormControlIndex, bV P);
2182 } 2182 }
2183 } 2183 }
2184 else 2184 else
2185 { 2185 {
2186 CFX_PtrArray FieldArray; 2186 CFX_PtrArray FieldArray;
2187 GetFormFields(m_FieldName,FieldArray); 2187 GetFormFields(m_FieldName,FieldArray);
2188 if (FieldArray.GetSize() <= 0) return FALSE; 2188 if (FieldArray.GetSize() <= 0) return false;
2189 2189
2190 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 2190 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
2191 ASSERT(pFormField != NULL); 2191 ASSERT(pFormField != NULL);
2192 2192
2193 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) 2193 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD)
2194 return FALSE; 2194 return false;
2195 2195
2196 if (pFormField->GetFieldFlags() & FIELDFLAG_PASSWORD) 2196 if (pFormField->GetFieldFlags() & FIELDFLAG_PASSWORD)
2197 vp << true; 2197 vp << true;
2198 else 2198 else
2199 vp << false; 2199 vp << false;
2200 } 2200 }
2201 2201
2202 return TRUE; 2202 return true;
2203 } 2203 }
2204 2204
2205 void Field::SetPassword(CPDFSDK_Document* pDocument, const CFX_WideString& swFie ldName, int nControlIndex, bool b) 2205 void Field::SetPassword(CPDFSDK_Document* pDocument, const CFX_WideString& swFie ldName, int nControlIndex, bool b)
2206 { 2206 {
2207 //Not supported. 2207 //Not supported.
2208 } 2208 }
2209 2209
2210 FX_BOOL Field::print(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro r) 2210 bool Field::print(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
2211 { 2211 {
2212 ASSERT(m_pDocument != NULL); 2212 ASSERT(m_pDocument != NULL);
2213 2213
2214 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInterFor m(); 2214 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInterFor m();
2215 ASSERT(pInterForm != NULL); 2215 ASSERT(pInterForm != NULL);
2216 2216
2217 CFX_PtrArray FieldArray; 2217 CFX_PtrArray FieldArray;
2218 GetFormFields(m_FieldName, FieldArray); 2218 GetFormFields(m_FieldName, FieldArray);
2219 if (FieldArray.GetSize() <= 0) return FALSE; 2219 if (FieldArray.GetSize() <= 0) return false;
2220 2220
2221 if (vp.IsSetting()) 2221 if (vp.IsSetting())
2222 { 2222 {
2223 if (!m_bCanSet) return FALSE; 2223 if (!m_bCanSet) return false;
2224 2224
2225 bool bVP; 2225 bool bVP;
2226 vp >> bVP; 2226 vp >> bVP;
2227 2227
2228 for (int i=0,isz=FieldArray.GetSize(); i<isz; i++) 2228 for (int i=0,isz=FieldArray.GetSize(); i<isz; i++)
2229 { 2229 {
2230 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(i ); 2230 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(i );
2231 ASSERT(pFormField != NULL); 2231 ASSERT(pFormField != NULL);
2232 2232
2233 if (m_nFormControlIndex < 0) 2233 if (m_nFormControlIndex < 0)
2234 { 2234 {
2235 FX_BOOL bSet = FALSE; 2235 bool bSet = false;
2236 for (int j=0,jsz = pFormField->CountControls(); j<jsz; j++) 2236 for (int j=0,jsz = pFormField->CountControls(); j<jsz; j++)
2237 { 2237 {
2238 if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormFie ld->GetControl(j))) 2238 if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormFie ld->GetControl(j)))
2239 { 2239 {
2240 FX_DWORD dwFlags = pWidget->GetFlags(); 2240 FX_DWORD dwFlags = pWidget->GetFlags();
2241 if (bVP) 2241 if (bVP)
2242 dwFlags |= ANNOTFLAG_PRINT; 2242 dwFlags |= ANNOTFLAG_PRINT;
2243 else 2243 else
2244 dwFlags &= ~ANNOTFLAG_PRINT; 2244 dwFlags &= ~ANNOTFLAG_PRINT;
2245 2245
2246 if (dwFlags != pWidget->GetFlags()) 2246 if (dwFlags != pWidget->GetFlags())
2247 { 2247 {
2248 pWidget->SetFlags(dwFlags); 2248 pWidget->SetFlags(dwFlags);
2249 bSet = TRUE; 2249 bSet = true;
2250 } 2250 }
2251 } 2251 }
2252 } 2252 }
2253 2253
2254 if (bSet) 2254 if (bSet)
2255 UpdateFormField(m_pDocument, pFormField, TRUE, FALSE, TRUE); 2255 UpdateFormField(m_pDocument, pFormField, true, false, true);
2256 } 2256 }
2257 else 2257 else
2258 { 2258 {
2259 if(m_nFormControlIndex >= pFormField->CountControls()) return FA LSE; 2259 if(m_nFormControlIndex >= pFormField->CountControls()) return fa lse;
2260 if (CPDF_FormControl* pFormControl = pFormField->GetControl(m_nF ormControlIndex)) 2260 if (CPDF_FormControl* pFormControl = pFormField->GetControl(m_nF ormControlIndex))
2261 { 2261 {
2262 if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormCon trol)) 2262 if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormCon trol))
2263 { 2263 {
2264 FX_DWORD dwFlags = pWidget->GetFlags(); 2264 FX_DWORD dwFlags = pWidget->GetFlags();
2265 if (bVP) 2265 if (bVP)
2266 dwFlags |= ANNOTFLAG_PRINT; 2266 dwFlags |= ANNOTFLAG_PRINT;
2267 else 2267 else
2268 dwFlags &= ~ANNOTFLAG_PRINT; 2268 dwFlags &= ~ANNOTFLAG_PRINT;
2269 2269
2270 if (dwFlags != pWidget->GetFlags()) 2270 if (dwFlags != pWidget->GetFlags())
2271 { 2271 {
2272 pWidget->SetFlags(dwFlags); 2272 pWidget->SetFlags(dwFlags);
2273 UpdateFormControl(m_pDocument, pFormField->GetContro l(m_nFormControlIndex), TRUE, FALSE, TRUE); 2273 UpdateFormControl(m_pDocument, pFormField->GetContro l(m_nFormControlIndex), true, false, true);
2274 } 2274 }
2275 } 2275 }
2276 } 2276 }
2277 } 2277 }
2278 } 2278 }
2279 } 2279 }
2280 else 2280 else
2281 { 2281 {
2282 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 2282 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
2283 ASSERT(pFormField != NULL); 2283 ASSERT(pFormField != NULL);
2284 2284
2285 CPDFSDK_Widget* pWidget = pInterForm->GetWidget(GetSmartFieldControl(pFo rmField)); 2285 CPDFSDK_Widget* pWidget = pInterForm->GetWidget(GetSmartFieldControl(pFo rmField));
2286 if (!pWidget) return FALSE; 2286 if (!pWidget) return false;
2287 2287
2288 if (pWidget->GetFlags() & ANNOTFLAG_PRINT) 2288 if (pWidget->GetFlags() & ANNOTFLAG_PRINT)
2289 vp << true; 2289 vp << true;
2290 else 2290 else
2291 vp << false; 2291 vp << false;
2292 } 2292 }
2293 2293
2294 return TRUE; 2294 return true;
2295 } 2295 }
2296 2296
2297 FX_BOOL Field::radiosInUnison(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStri ng& sError) 2297 bool Field::radiosInUnison(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
2298 { 2298 {
2299 ASSERT(m_pDocument != NULL); 2299 ASSERT(m_pDocument != NULL);
2300 2300
2301 CFX_PtrArray FieldArray; 2301 CFX_PtrArray FieldArray;
2302 GetFormFields(m_FieldName,FieldArray); 2302 GetFormFields(m_FieldName,FieldArray);
2303 if (FieldArray.GetSize() <= 0) return FALSE; 2303 if (FieldArray.GetSize() <= 0) return false;
2304 2304
2305 if (vp.IsSetting()) 2305 if (vp.IsSetting())
2306 { 2306 {
2307 if (!m_bCanSet) return FALSE; 2307 if (!m_bCanSet) return false;
2308 2308
2309 bool bVP; 2309 bool bVP;
2310 vp >> bVP; 2310 vp >> bVP;
2311 2311
2312 } 2312 }
2313 else 2313 else
2314 { 2314 {
2315 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 2315 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
2316 ASSERT(pFormField != NULL); 2316 ASSERT(pFormField != NULL);
2317 2317
2318 if (pFormField->GetFieldType() != FIELDTYPE_RADIOBUTTON) 2318 if (pFormField->GetFieldType() != FIELDTYPE_RADIOBUTTON)
2319 return FALSE; 2319 return false;
2320 2320
2321 if (pFormField->GetFieldFlags() & FIELDFLAG_RADIOSINUNISON) 2321 if (pFormField->GetFieldFlags() & FIELDFLAG_RADIOSINUNISON)
2322 vp << true; 2322 vp << true;
2323 else 2323 else
2324 vp << false; 2324 vp << false;
2325 } 2325 }
2326 2326
2327 return TRUE; 2327 return true;
2328 } 2328 }
2329 2329
2330 FX_BOOL Field::readonly(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE rror) 2330 bool Field::readonly(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro r)
2331 { 2331 {
2332 ASSERT(m_pDocument != NULL); 2332 ASSERT(m_pDocument != NULL);
2333 2333
2334 CFX_PtrArray FieldArray; 2334 CFX_PtrArray FieldArray;
2335 GetFormFields(m_FieldName,FieldArray); 2335 GetFormFields(m_FieldName,FieldArray);
2336 if (FieldArray.GetSize() <= 0) return FALSE; 2336 if (FieldArray.GetSize() <= 0) return false;
2337 2337
2338 if (vp.IsSetting()) 2338 if (vp.IsSetting())
2339 { 2339 {
2340 if (!m_bCanSet) return FALSE; 2340 if (!m_bCanSet) return false;
2341 2341
2342 bool bVP; 2342 bool bVP;
2343 vp >> bVP; 2343 vp >> bVP;
2344 2344
2345 } 2345 }
2346 else 2346 else
2347 { 2347 {
2348 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 2348 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
2349 ASSERT(pFormField != NULL); 2349 ASSERT(pFormField != NULL);
2350 2350
2351 if (pFormField->GetFieldFlags() & FIELDFLAG_READONLY) 2351 if (pFormField->GetFieldFlags() & FIELDFLAG_READONLY)
2352 vp << true; 2352 vp << true;
2353 else 2353 else
2354 vp << false; 2354 vp << false;
2355 } 2355 }
2356 2356
2357 return TRUE; 2357 return true;
2358 } 2358 }
2359 2359
2360 FX_BOOL Field::rect(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError ) 2360 bool Field::rect(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
2361 { 2361 {
2362 ASSERT(m_pDocument != NULL); 2362 ASSERT(m_pDocument != NULL);
2363 2363
2364 if (vp.IsSetting()) 2364 if (vp.IsSetting())
2365 { 2365 {
2366 if (!m_bCanSet) return FALSE; 2366 if (!m_bCanSet) return false;
2367 if (!vp.IsArrayObject())return FALSE; 2367 if (!vp.IsArrayObject())return false;
2368 2368
2369 CJS_Array rcArray(m_isolate); 2369 CJS_Array rcArray(m_isolate);
2370 vp >> rcArray; 2370 vp >> rcArray;
2371 CJS_Value Upper_Leftx(m_isolate), Upper_Lefty(m_isolate), Lower_Rightx(m _isolate), Lower_Righty(m_isolate); 2371 CJS_Value Upper_Leftx(m_isolate), Upper_Lefty(m_isolate), Lower_Rightx(m _isolate), Lower_Righty(m_isolate);
2372 rcArray.GetElement(0, Upper_Leftx); 2372 rcArray.GetElement(0, Upper_Leftx);
2373 rcArray.GetElement(1, Upper_Lefty); 2373 rcArray.GetElement(1, Upper_Lefty);
2374 rcArray.GetElement(2, Lower_Rightx); 2374 rcArray.GetElement(2, Lower_Rightx);
2375 rcArray.GetElement(3, Lower_Righty); 2375 rcArray.GetElement(3, Lower_Righty);
2376 2376
2377 FX_FLOAT pArray[4] = {0.0f,0.0f,0.0f,0.0f}; 2377 FX_FLOAT pArray[4] = {0.0f,0.0f,0.0f,0.0f};
(...skipping 10 matching lines...) Expand all
2388 } 2388 }
2389 else 2389 else
2390 { 2390 {
2391 Field::SetRect(m_pDocument, m_FieldName, m_nFormControlIndex, crRect ); 2391 Field::SetRect(m_pDocument, m_FieldName, m_nFormControlIndex, crRect );
2392 } 2392 }
2393 } 2393 }
2394 else 2394 else
2395 { 2395 {
2396 CFX_PtrArray FieldArray; 2396 CFX_PtrArray FieldArray;
2397 GetFormFields(m_FieldName,FieldArray); 2397 GetFormFields(m_FieldName,FieldArray);
2398 if (FieldArray.GetSize() <= 0) return FALSE; 2398 if (FieldArray.GetSize() <= 0) return false;
2399 2399
2400 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 2400 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
2401 ASSERT(pFormField != NULL); 2401 ASSERT(pFormField != NULL);
2402 2402
2403 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInte rForm(); 2403 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInte rForm();
2404 ASSERT(pInterForm != NULL); 2404 ASSERT(pInterForm != NULL);
2405 2405
2406 CPDFSDK_Widget* pWidget = pInterForm->GetWidget(GetSmartFieldControl(pFo rmField)); 2406 CPDFSDK_Widget* pWidget = pInterForm->GetWidget(GetSmartFieldControl(pFo rmField));
2407 if (!pWidget) return FALSE; 2407 if (!pWidget) return false;
2408 2408
2409 CFX_FloatRect crRect = pWidget->GetRect(); 2409 CFX_FloatRect crRect = pWidget->GetRect();
2410 CJS_Value Upper_Leftx(m_isolate),Upper_Lefty(m_isolate),Lower_Rightx(m_i solate),Lower_Righty(m_isolate); 2410 CJS_Value Upper_Leftx(m_isolate),Upper_Lefty(m_isolate),Lower_Rightx(m_i solate),Lower_Righty(m_isolate);
2411 Upper_Leftx = (int32_t)crRect.left; 2411 Upper_Leftx = (int32_t)crRect.left;
2412 Upper_Lefty = (int32_t)crRect.top; 2412 Upper_Lefty = (int32_t)crRect.top;
2413 Lower_Rightx = (int32_t)crRect.right; 2413 Lower_Rightx = (int32_t)crRect.right;
2414 Lower_Righty = (int32_t)crRect.bottom; 2414 Lower_Righty = (int32_t)crRect.bottom;
2415 2415
2416 CJS_Array rcArray(m_isolate); 2416 CJS_Array rcArray(m_isolate);
2417 rcArray.SetElement(0,Upper_Leftx); 2417 rcArray.SetElement(0,Upper_Leftx);
2418 rcArray.SetElement(1,Upper_Lefty); 2418 rcArray.SetElement(1,Upper_Lefty);
2419 rcArray.SetElement(2,Lower_Rightx); 2419 rcArray.SetElement(2,Lower_Rightx);
2420 rcArray.SetElement(3,Lower_Righty); 2420 rcArray.SetElement(3,Lower_Righty);
2421 2421
2422 vp << rcArray; 2422 vp << rcArray;
2423 } 2423 }
2424 2424
2425 return TRUE; 2425 return true;
2426 } 2426 }
2427 2427
2428 void Field::SetRect(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldNa me, int nControlIndex, const CPDF_Rect& rect) 2428 void Field::SetRect(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldNa me, int nControlIndex, const CPDF_Rect& rect)
2429 { 2429 {
2430 ASSERT(pDocument != NULL); 2430 ASSERT(pDocument != NULL);
2431 2431
2432 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm( ); 2432 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm( );
2433 ASSERT(pInterForm != NULL); 2433 ASSERT(pInterForm != NULL);
2434 2434
2435 CFX_PtrArray FieldArray; 2435 CFX_PtrArray FieldArray;
2436 GetFormFields(pDocument, swFieldName, FieldArray); 2436 GetFormFields(pDocument, swFieldName, FieldArray);
2437 2437
2438 for (int i=0,isz=FieldArray.GetSize(); i<isz; i++) 2438 for (int i=0,isz=FieldArray.GetSize(); i<isz; i++)
2439 { 2439 {
2440 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(i); 2440 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(i);
2441 ASSERT(pFormField != NULL); 2441 ASSERT(pFormField != NULL);
2442 2442
2443 if (nControlIndex < 0) 2443 if (nControlIndex < 0)
2444 { 2444 {
2445 FX_BOOL bSet = FALSE; 2445 bool bSet = false;
2446 for (int i=0, sz=pFormField->CountControls(); i<sz; i++) 2446 for (int i=0, sz=pFormField->CountControls(); i<sz; i++)
2447 { 2447 {
2448 CPDF_FormControl* pFormControl = pFormField->GetControl(i); 2448 CPDF_FormControl* pFormControl = pFormField->GetControl(i);
2449 ASSERT(pFormControl != NULL); 2449 ASSERT(pFormControl != NULL);
2450 2450
2451 if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl )) 2451 if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl ))
2452 { 2452 {
2453 CPDF_Rect crRect = rect; 2453 CPDF_Rect crRect = rect;
2454 2454
2455 CPDF_Page* pPDFPage = pWidget->GetPDFPage(); 2455 CPDF_Page* pPDFPage = pWidget->GetPDFPage();
2456 ASSERT(pPDFPage != NULL); 2456 ASSERT(pPDFPage != NULL);
2457 2457
2458 // CPDF_Page* pPDFPage = pPage->GetPage(); 2458 // CPDF_Page* pPDFPage = pPage->GetPage();
2459 // ASSERT(pPDFPage != NULL); 2459 // ASSERT(pPDFPage != NULL);
2460 2460
2461 crRect.Intersect(pPDFPage->GetPageBBox()); 2461 crRect.Intersect(pPDFPage->GetPageBBox());
2462 2462
2463 if (!crRect.IsEmpty()) 2463 if (!crRect.IsEmpty())
2464 { 2464 {
2465 CPDF_Rect rcOld = pWidget->GetRect(); 2465 CPDF_Rect rcOld = pWidget->GetRect();
2466 if (crRect.left != rcOld.left || 2466 if (crRect.left != rcOld.left ||
2467 crRect.right != rcOld.right || 2467 crRect.right != rcOld.right ||
2468 crRect.top != rcOld.top || 2468 crRect.top != rcOld.top ||
2469 crRect.bottom != rcOld.bottom) 2469 crRect.bottom != rcOld.bottom)
2470 { 2470 {
2471 pWidget->SetRect(crRect); 2471 pWidget->SetRect(crRect);
2472 bSet = TRUE; 2472 bSet = true;
2473 } 2473 }
2474 } 2474 }
2475 } 2475 }
2476 } 2476 }
2477 2477
2478 if (bSet) UpdateFormField(pDocument, pFormField, TRUE, TRUE, TRUE); 2478 if (bSet) UpdateFormField(pDocument, pFormField, true, true, true);
2479 } 2479 }
2480 else 2480 else
2481 { 2481 {
2482 if(nControlIndex >= pFormField->CountControls()) return; 2482 if(nControlIndex >= pFormField->CountControls()) return;
2483 if (CPDF_FormControl* pFormControl = pFormField->GetControl(nControl Index)) 2483 if (CPDF_FormControl* pFormControl = pFormField->GetControl(nControl Index))
2484 { 2484 {
2485 if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl )) 2485 if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl ))
2486 { 2486 {
2487 CPDF_Rect crRect = rect; 2487 CPDF_Rect crRect = rect;
2488 2488
2489 CPDF_Page* pPDFPage = pWidget->GetPDFPage(); 2489 CPDF_Page* pPDFPage = pWidget->GetPDFPage();
2490 ASSERT(pPDFPage != NULL); 2490 ASSERT(pPDFPage != NULL);
2491 2491
2492 // CPDF_Page* pPDFPage = pPage->GetPage(); 2492 // CPDF_Page* pPDFPage = pPage->GetPage();
2493 // ASSERT(pPDFPage != NULL); 2493 // ASSERT(pPDFPage != NULL);
2494 2494
2495 crRect.Intersect(pPDFPage->GetPageBBox()); 2495 crRect.Intersect(pPDFPage->GetPageBBox());
2496 2496
2497 if (!crRect.IsEmpty()) 2497 if (!crRect.IsEmpty())
2498 { 2498 {
2499 CPDF_Rect rcOld = pWidget->GetRect(); 2499 CPDF_Rect rcOld = pWidget->GetRect();
2500 if (crRect.left != rcOld.left || 2500 if (crRect.left != rcOld.left ||
2501 crRect.right != rcOld.right || 2501 crRect.right != rcOld.right ||
2502 crRect.top != rcOld.top || 2502 crRect.top != rcOld.top ||
2503 crRect.bottom != rcOld.bottom) 2503 crRect.bottom != rcOld.bottom)
2504 { 2504 {
2505 pWidget->SetRect(crRect); 2505 pWidget->SetRect(crRect);
2506 UpdateFormControl(pDocument, pFormControl, TRUE, TRU E, TRUE); 2506 UpdateFormControl(pDocument, pFormControl, true, tru e, true);
2507 } 2507 }
2508 } 2508 }
2509 } 2509 }
2510 } 2510 }
2511 } 2511 }
2512 } 2512 }
2513 } 2513 }
2514 2514
2515 FX_BOOL Field::required(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE rror) 2515 bool Field::required(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro r)
2516 { 2516 {
2517 ASSERT(m_pDocument != NULL); 2517 ASSERT(m_pDocument != NULL);
2518 2518
2519 CFX_PtrArray FieldArray; 2519 CFX_PtrArray FieldArray;
2520 GetFormFields(m_FieldName,FieldArray); 2520 GetFormFields(m_FieldName,FieldArray);
2521 if (FieldArray.GetSize() <= 0) return FALSE; 2521 if (FieldArray.GetSize() <= 0) return false;
2522 2522
2523 if (vp.IsSetting()) 2523 if (vp.IsSetting())
2524 { 2524 {
2525 if (!m_bCanSet) return FALSE; 2525 if (!m_bCanSet) return false;
2526 2526
2527 2527
2528 bool bVP; 2528 bool bVP;
2529 vp >> bVP; 2529 vp >> bVP;
2530 2530
2531 } 2531 }
2532 else 2532 else
2533 { 2533 {
2534 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 2534 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
2535 ASSERT(pFormField != NULL); 2535 ASSERT(pFormField != NULL);
2536 2536
2537 if (pFormField->GetFieldType() == FIELDTYPE_PUSHBUTTON) 2537 if (pFormField->GetFieldType() == FIELDTYPE_PUSHBUTTON)
2538 return FALSE; 2538 return false;
2539 2539
2540 if (pFormField->GetFieldFlags() & FIELDFLAG_REQUIRED) 2540 if (pFormField->GetFieldFlags() & FIELDFLAG_REQUIRED)
2541 vp << true; 2541 vp << true;
2542 else 2542 else
2543 vp << false; 2543 vp << false;
2544 } 2544 }
2545 2545
2546 return TRUE; 2546 return true;
2547 } 2547 }
2548 2548
2549 FX_BOOL Field::richText(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE rror) 2549 bool Field::richText(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro r)
2550 { 2550 {
2551 ASSERT(m_pDocument != NULL); 2551 ASSERT(m_pDocument != NULL);
2552 2552
2553 if (vp.IsSetting()) 2553 if (vp.IsSetting())
2554 { 2554 {
2555 if (!m_bCanSet) return FALSE; 2555 if (!m_bCanSet) return false;
2556 2556
2557 bool bVP; 2557 bool bVP;
2558 vp >> bVP; 2558 vp >> bVP;
2559 2559
2560 if (m_bDelay) 2560 if (m_bDelay)
2561 { 2561 {
2562 AddDelay_Bool(FP_RICHTEXT, bVP); 2562 AddDelay_Bool(FP_RICHTEXT, bVP);
2563 } 2563 }
2564 else 2564 else
2565 { 2565 {
2566 Field::SetRichText(m_pDocument, m_FieldName, m_nFormControlIndex, bV P); 2566 Field::SetRichText(m_pDocument, m_FieldName, m_nFormControlIndex, bV P);
2567 } 2567 }
2568 } 2568 }
2569 else 2569 else
2570 { 2570 {
2571 CFX_PtrArray FieldArray; 2571 CFX_PtrArray FieldArray;
2572 GetFormFields(m_FieldName,FieldArray); 2572 GetFormFields(m_FieldName,FieldArray);
2573 if (FieldArray.GetSize() <= 0) return FALSE; 2573 if (FieldArray.GetSize() <= 0) return false;
2574 2574
2575 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 2575 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
2576 ASSERT(pFormField != NULL); 2576 ASSERT(pFormField != NULL);
2577 2577
2578 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) 2578 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD)
2579 return FALSE; 2579 return false;
2580 2580
2581 if (pFormField->GetFieldFlags() & FIELDFLAG_RICHTEXT) 2581 if (pFormField->GetFieldFlags() & FIELDFLAG_RICHTEXT)
2582 vp << true; 2582 vp << true;
2583 else 2583 else
2584 vp << false; 2584 vp << false;
2585 } 2585 }
2586 2586
2587 return TRUE; 2587 return true;
2588 } 2588 }
2589 2589
2590 void Field::SetRichText(CPDFSDK_Document* pDocument, const CFX_WideString& swFie ldName, int nControlIndex, bool b) 2590 void Field::SetRichText(CPDFSDK_Document* pDocument, const CFX_WideString& swFie ldName, int nControlIndex, bool b)
2591 { 2591 {
2592 //Not supported. 2592 //Not supported.
2593 } 2593 }
2594 2594
2595 FX_BOOL Field::richValue(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s Error) 2595 bool Field::richValue(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErr or)
2596 { 2596 {
2597 return TRUE; 2597 return true;
2598 if (vp.IsSetting()) 2598 if (vp.IsSetting())
2599 { 2599 {
2600 if (!m_bCanSet) return FALSE; 2600 if (!m_bCanSet) return false;
2601 ; 2601 ;
2602 } 2602 }
2603 else 2603 else
2604 { 2604 {
2605 ; 2605 ;
2606 } 2606 }
2607 return TRUE; 2607 return true;
2608 } 2608 }
2609 2609
2610 void Field::SetRichValue(CPDFSDK_Document* pDocument, const CFX_WideString& swFi eldName, int nControlIndex) 2610 void Field::SetRichValue(CPDFSDK_Document* pDocument, const CFX_WideString& swFi eldName, int nControlIndex)
2611 { 2611 {
2612 //Not supported. 2612 //Not supported.
2613 } 2613 }
2614 2614
2615 FX_BOOL Field::rotation(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE rror) 2615 bool Field::rotation(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro r)
2616 { 2616 {
2617 ASSERT(m_pDocument != NULL); 2617 ASSERT(m_pDocument != NULL);
2618 2618
2619 if (vp.IsSetting()) 2619 if (vp.IsSetting())
2620 { 2620 {
2621 if (!m_bCanSet) return FALSE; 2621 if (!m_bCanSet) return false;
2622 2622
2623 int nVP; 2623 int nVP;
2624 vp >> nVP; 2624 vp >> nVP;
2625 2625
2626 if (m_bDelay) 2626 if (m_bDelay)
2627 { 2627 {
2628 AddDelay_Int(FP_ROTATION, nVP); 2628 AddDelay_Int(FP_ROTATION, nVP);
2629 } 2629 }
2630 else 2630 else
2631 { 2631 {
2632 Field::SetRotation(m_pDocument, m_FieldName, m_nFormControlIndex, nV P); 2632 Field::SetRotation(m_pDocument, m_FieldName, m_nFormControlIndex, nV P);
2633 } 2633 }
2634 } 2634 }
2635 else 2635 else
2636 { 2636 {
2637 CFX_PtrArray FieldArray; 2637 CFX_PtrArray FieldArray;
2638 GetFormFields(m_FieldName,FieldArray); 2638 GetFormFields(m_FieldName,FieldArray);
2639 if (FieldArray.GetSize() <= 0) return FALSE; 2639 if (FieldArray.GetSize() <= 0) return false;
2640 2640
2641 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 2641 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
2642 ASSERT(pFormField != NULL); 2642 ASSERT(pFormField != NULL);
2643 2643
2644 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); 2644 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
2645 if (!pFormControl)return FALSE; 2645 if (!pFormControl)return false;
2646 2646
2647 vp << (int32_t)pFormControl->GetRotation(); 2647 vp << (int32_t)pFormControl->GetRotation();
2648 } 2648 }
2649 2649
2650 return TRUE; 2650 return true;
2651 } 2651 }
2652 2652
2653 void Field::SetRotation(CPDFSDK_Document* pDocument, const CFX_WideString& swFie ldName, int nControlIndex, int number) 2653 void Field::SetRotation(CPDFSDK_Document* pDocument, const CFX_WideString& swFie ldName, int nControlIndex, int number)
2654 { 2654 {
2655 //Not supported. 2655 //Not supported.
2656 } 2656 }
2657 2657
2658 FX_BOOL Field::strokeColor(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) 2658 bool Field::strokeColor(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE rror)
2659 { 2659 {
2660 ASSERT(m_pDocument != NULL); 2660 ASSERT(m_pDocument != NULL);
2661 2661
2662 if (vp.IsSetting()) 2662 if (vp.IsSetting())
2663 { 2663 {
2664 if (!m_bCanSet) return FALSE; 2664 if (!m_bCanSet) return false;
2665 2665
2666 if (!vp.IsArrayObject())return FALSE; 2666 if (!vp.IsArrayObject())return false;
2667 2667
2668 CJS_Array crArray(m_isolate); 2668 CJS_Array crArray(m_isolate);
2669 vp >> crArray; 2669 vp >> crArray;
2670 2670
2671 CPWL_Color color; 2671 CPWL_Color color;
2672 color::ConvertArrayToPWLColor(crArray, color); 2672 color::ConvertArrayToPWLColor(crArray, color);
2673 2673
2674 if (m_bDelay) 2674 if (m_bDelay)
2675 { 2675 {
2676 AddDelay_Color(FP_STROKECOLOR, color); 2676 AddDelay_Color(FP_STROKECOLOR, color);
2677 } 2677 }
2678 else 2678 else
2679 { 2679 {
2680 Field::SetStrokeColor(m_pDocument, m_FieldName, m_nFormControlIndex, color); 2680 Field::SetStrokeColor(m_pDocument, m_FieldName, m_nFormControlIndex, color);
2681 } 2681 }
2682 } 2682 }
2683 else 2683 else
2684 { 2684 {
2685 CFX_PtrArray FieldArray; 2685 CFX_PtrArray FieldArray;
2686 GetFormFields(m_FieldName,FieldArray); 2686 GetFormFields(m_FieldName,FieldArray);
2687 if (FieldArray.GetSize() <= 0) return FALSE; 2687 if (FieldArray.GetSize() <= 0) return false;
2688 2688
2689 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 2689 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
2690 ASSERT(pFormField != NULL); 2690 ASSERT(pFormField != NULL);
2691 2691
2692 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); 2692 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
2693 if (!pFormControl)return FALSE; 2693 if (!pFormControl)return false;
2694 2694
2695 int iColorType; 2695 int iColorType;
2696 pFormControl->GetBorderColor(iColorType); 2696 pFormControl->GetBorderColor(iColorType);
2697 2697
2698 CPWL_Color color; 2698 CPWL_Color color;
2699 2699
2700 if (iColorType == COLORTYPE_TRANSPARENT) 2700 if (iColorType == COLORTYPE_TRANSPARENT)
2701 { 2701 {
2702 color = CPWL_Color(COLORTYPE_TRANSPARENT); 2702 color = CPWL_Color(COLORTYPE_TRANSPARENT);
2703 } 2703 }
2704 else if (iColorType == COLORTYPE_GRAY) 2704 else if (iColorType == COLORTYPE_GRAY)
2705 { 2705 {
2706 color = CPWL_Color(COLORTYPE_GRAY, pFormControl->GetOriginalBorderCo lor(0)); 2706 color = CPWL_Color(COLORTYPE_GRAY, pFormControl->GetOriginalBorderCo lor(0));
2707 } 2707 }
2708 else if (iColorType == COLORTYPE_RGB) 2708 else if (iColorType == COLORTYPE_RGB)
2709 { 2709 {
2710 color = CPWL_Color(COLORTYPE_RGB, pFormControl->GetOriginalBorderCol or(0), 2710 color = CPWL_Color(COLORTYPE_RGB, pFormControl->GetOriginalBorderCol or(0),
2711 pFormControl->GetOriginalBorderColor(1), 2711 pFormControl->GetOriginalBorderColor(1),
2712 pFormControl->GetOriginalBorderColor(2)); 2712 pFormControl->GetOriginalBorderColor(2));
2713 } 2713 }
2714 else if (iColorType == COLORTYPE_CMYK) 2714 else if (iColorType == COLORTYPE_CMYK)
2715 { 2715 {
2716 color = CPWL_Color(COLORTYPE_CMYK, pFormControl->GetOriginalBorderCo lor(0), 2716 color = CPWL_Color(COLORTYPE_CMYK, pFormControl->GetOriginalBorderCo lor(0),
2717 pFormControl->GetOriginalBorderColor(1), 2717 pFormControl->GetOriginalBorderColor(1),
2718 pFormControl->GetOriginalBorderColor(2), 2718 pFormControl->GetOriginalBorderColor(2),
2719 pFormControl->GetOriginalBorderColor(3)); 2719 pFormControl->GetOriginalBorderColor(3));
2720 } 2720 }
2721 else 2721 else
2722 return FALSE; 2722 return false;
2723 2723
2724 CJS_Array crArray(m_isolate); 2724 CJS_Array crArray(m_isolate);
2725 color::ConvertPWLColorToArray(color, crArray); 2725 color::ConvertPWLColorToArray(color, crArray);
2726 vp << crArray; 2726 vp << crArray;
2727 } 2727 }
2728 2728
2729 return TRUE; 2729 return true;
2730 } 2730 }
2731 2731
2732 void Field::SetStrokeColor(CPDFSDK_Document* pDocument, const CFX_WideString& sw FieldName, int nControlIndex, const CPWL_Color& color) 2732 void Field::SetStrokeColor(CPDFSDK_Document* pDocument, const CFX_WideString& sw FieldName, int nControlIndex, const CPWL_Color& color)
2733 { 2733 {
2734 //Not supported. 2734 //Not supported.
2735 } 2735 }
2736 2736
2737 FX_BOOL Field::style(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro r) 2737 bool Field::style(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
2738 { 2738 {
2739 ASSERT(m_pDocument != NULL); 2739 ASSERT(m_pDocument != NULL);
2740 2740
2741 if (vp.IsSetting()) 2741 if (vp.IsSetting())
2742 { 2742 {
2743 if (!m_bCanSet) return FALSE; 2743 if (!m_bCanSet) return false;
2744 2744
2745 CFX_ByteString csBCaption; 2745 CFX_ByteString csBCaption;
2746 vp >> csBCaption; 2746 vp >> csBCaption;
2747 2747
2748 if (m_bDelay) 2748 if (m_bDelay)
2749 { 2749 {
2750 AddDelay_String(FP_STYLE, csBCaption); 2750 AddDelay_String(FP_STYLE, csBCaption);
2751 } 2751 }
2752 else 2752 else
2753 { 2753 {
2754 Field::SetStyle(m_pDocument, m_FieldName, m_nFormControlIndex, csBCa ption); 2754 Field::SetStyle(m_pDocument, m_FieldName, m_nFormControlIndex, csBCa ption);
2755 } 2755 }
2756 } 2756 }
2757 else 2757 else
2758 { 2758 {
2759 CFX_PtrArray FieldArray; 2759 CFX_PtrArray FieldArray;
2760 GetFormFields(m_FieldName,FieldArray); 2760 GetFormFields(m_FieldName,FieldArray);
2761 if (FieldArray.GetSize() <= 0) return FALSE; 2761 if (FieldArray.GetSize() <= 0) return false;
2762 2762
2763 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 2763 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
2764 ASSERT(pFormField != NULL); 2764 ASSERT(pFormField != NULL);
2765 2765
2766 if (pFormField->GetFieldType() != FIELDTYPE_RADIOBUTTON && 2766 if (pFormField->GetFieldType() != FIELDTYPE_RADIOBUTTON &&
2767 pFormField->GetFieldType() != FIELDTYPE_CHECKBOX) 2767 pFormField->GetFieldType() != FIELDTYPE_CHECKBOX)
2768 return FALSE; 2768 return false;
2769 2769
2770 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); 2770 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
2771 if (!pFormControl) return FALSE; 2771 if (!pFormControl) return false;
2772 2772
2773 CFX_WideString csWCaption = pFormControl->GetNormalCaption(); 2773 CFX_WideString csWCaption = pFormControl->GetNormalCaption();
2774 CFX_ByteString csBCaption; 2774 CFX_ByteString csBCaption;
2775 2775
2776 switch (csWCaption[0]) 2776 switch (csWCaption[0])
2777 { 2777 {
2778 case L'l': 2778 case L'l':
2779 csBCaption = "circle"; 2779 csBCaption = "circle";
2780 break; 2780 break;
2781 case L'8': 2781 case L'8':
2782 csBCaption = "cross"; 2782 csBCaption = "cross";
2783 break; 2783 break;
2784 case L'u': 2784 case L'u':
2785 csBCaption = "diamond"; 2785 csBCaption = "diamond";
2786 break; 2786 break;
2787 case L'n': 2787 case L'n':
2788 csBCaption = "square"; 2788 csBCaption = "square";
2789 break; 2789 break;
2790 case L'H': 2790 case L'H':
2791 csBCaption = "star"; 2791 csBCaption = "star";
2792 break; 2792 break;
2793 default: //L'4' 2793 default: //L'4'
2794 csBCaption = "check"; 2794 csBCaption = "check";
2795 break; 2795 break;
2796 } 2796 }
2797 vp << csBCaption; 2797 vp << csBCaption;
2798 } 2798 }
2799 2799
2800 return TRUE; 2800 return true;
2801 } 2801 }
2802 2802
2803 void Field::SetStyle(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldN ame, int nControlIndex, 2803 void Field::SetStyle(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldN ame, int nControlIndex,
2804 const CFX_ByteString& string) 2804 const CFX_ByteString& string)
2805 { 2805 {
2806 //Not supported. 2806 //Not supported.
2807 } 2807 }
2808 2808
2809 FX_BOOL Field::submitName(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) 2809 bool Field::submitName(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sEr ror)
2810 { 2810 {
2811 return TRUE; 2811 return true;
2812 } 2812 }
2813 2813
2814 FX_BOOL Field::textColor(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s Error) 2814 bool Field::textColor(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErr or)
2815 { 2815 {
2816 ASSERT(m_pDocument != NULL); 2816 ASSERT(m_pDocument != NULL);
2817 2817
2818 if (vp.IsSetting()) 2818 if (vp.IsSetting())
2819 { 2819 {
2820 if (!m_bCanSet) return FALSE; 2820 if (!m_bCanSet) return false;
2821 2821
2822 CJS_Array crArray(m_isolate); 2822 CJS_Array crArray(m_isolate);
2823 if (!vp.IsArrayObject())return FALSE; 2823 if (!vp.IsArrayObject())return false;
2824 vp >> crArray; 2824 vp >> crArray;
2825 2825
2826 CPWL_Color color; 2826 CPWL_Color color;
2827 color::ConvertArrayToPWLColor(crArray, color); 2827 color::ConvertArrayToPWLColor(crArray, color);
2828 2828
2829 if (m_bDelay) 2829 if (m_bDelay)
2830 { 2830 {
2831 AddDelay_Color(FP_TEXTCOLOR, color); 2831 AddDelay_Color(FP_TEXTCOLOR, color);
2832 } 2832 }
2833 else 2833 else
2834 { 2834 {
2835 Field::SetTextColor(m_pDocument, m_FieldName, m_nFormControlIndex, c olor); 2835 Field::SetTextColor(m_pDocument, m_FieldName, m_nFormControlIndex, c olor);
2836 } 2836 }
2837 } 2837 }
2838 else 2838 else
2839 { 2839 {
2840 CFX_PtrArray FieldArray; 2840 CFX_PtrArray FieldArray;
2841 GetFormFields(m_FieldName,FieldArray); 2841 GetFormFields(m_FieldName,FieldArray);
2842 if (FieldArray.GetSize() <= 0) return FALSE; 2842 if (FieldArray.GetSize() <= 0) return false;
2843 2843
2844 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 2844 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
2845 ASSERT(pFormField != NULL); 2845 ASSERT(pFormField != NULL);
2846 2846
2847 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); 2847 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
2848 if (!pFormControl)return FALSE; 2848 if (!pFormControl)return false;
2849 2849
2850 int iColorType; 2850 int iColorType;
2851 FX_ARGB color; 2851 FX_ARGB color;
2852 CPDF_DefaultAppearance FieldAppearance = pFormControl->GetDefaultAppeara nce(); 2852 CPDF_DefaultAppearance FieldAppearance = pFormControl->GetDefaultAppeara nce();
2853 FieldAppearance.GetColor(color, iColorType); 2853 FieldAppearance.GetColor(color, iColorType);
2854 int32_t a,r,g,b; 2854 int32_t a,r,g,b;
2855 ArgbDecode(color, a, r, g, b); 2855 ArgbDecode(color, a, r, g, b);
2856 2856
2857 CPWL_Color crRet = CPWL_Color(COLORTYPE_RGB, r / 255.0f, 2857 CPWL_Color crRet = CPWL_Color(COLORTYPE_RGB, r / 255.0f,
2858 g / 255.0f, 2858 g / 255.0f,
2859 b / 255.0f); 2859 b / 255.0f);
2860 2860
2861 if (iColorType == COLORTYPE_TRANSPARENT) 2861 if (iColorType == COLORTYPE_TRANSPARENT)
2862 crRet = CPWL_Color(COLORTYPE_TRANSPARENT); 2862 crRet = CPWL_Color(COLORTYPE_TRANSPARENT);
2863 2863
2864 CJS_Array crArray(m_isolate); 2864 CJS_Array crArray(m_isolate);
2865 color::ConvertPWLColorToArray(crRet, crArray); 2865 color::ConvertPWLColorToArray(crRet, crArray);
2866 vp << crArray; 2866 vp << crArray;
2867 } 2867 }
2868 2868
2869 return TRUE; 2869 return true;
2870 } 2870 }
2871 2871
2872 void Field::SetTextColor(CPDFSDK_Document* pDocument, const CFX_WideString& swFi eldName, int nControlIndex, const CPWL_Color& color) 2872 void Field::SetTextColor(CPDFSDK_Document* pDocument, const CFX_WideString& swFi eldName, int nControlIndex, const CPWL_Color& color)
2873 { 2873 {
2874 //Not supported. 2874 //Not supported.
2875 } 2875 }
2876 2876
2877 FX_BOOL Field::textFont(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE rror) 2877 bool Field::textFont(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro r)
2878 { 2878 {
2879 ASSERT(m_pDocument != NULL); 2879 ASSERT(m_pDocument != NULL);
2880 2880
2881 if (vp.IsSetting()) 2881 if (vp.IsSetting())
2882 { 2882 {
2883 if (!m_bCanSet) return FALSE; 2883 if (!m_bCanSet) return false;
2884 2884
2885 CFX_ByteString csFontName; 2885 CFX_ByteString csFontName;
2886 vp >> csFontName; 2886 vp >> csFontName;
2887 if (csFontName.IsEmpty()) return FALSE; 2887 if (csFontName.IsEmpty()) return false;
2888 2888
2889 if (m_bDelay) 2889 if (m_bDelay)
2890 { 2890 {
2891 AddDelay_String(FP_TEXTFONT, csFontName); 2891 AddDelay_String(FP_TEXTFONT, csFontName);
2892 } 2892 }
2893 else 2893 else
2894 { 2894 {
2895 Field::SetTextFont(m_pDocument, m_FieldName, m_nFormControlIndex, cs FontName); 2895 Field::SetTextFont(m_pDocument, m_FieldName, m_nFormControlIndex, cs FontName);
2896 } 2896 }
2897 } 2897 }
2898 else 2898 else
2899 { 2899 {
2900 CFX_PtrArray FieldArray; 2900 CFX_PtrArray FieldArray;
2901 GetFormFields(m_FieldName,FieldArray); 2901 GetFormFields(m_FieldName,FieldArray);
2902 if (FieldArray.GetSize() <= 0) return FALSE; 2902 if (FieldArray.GetSize() <= 0) return false;
2903 2903
2904 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 2904 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
2905 ASSERT(pFormField != NULL); 2905 ASSERT(pFormField != NULL);
2906 2906
2907 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); 2907 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
2908 if (!pFormControl)return FALSE; 2908 if (!pFormControl)return false;
2909 2909
2910 int nFieldType = pFormField->GetFieldType(); 2910 int nFieldType = pFormField->GetFieldType();
2911 2911
2912 if (nFieldType == FIELDTYPE_PUSHBUTTON || 2912 if (nFieldType == FIELDTYPE_PUSHBUTTON ||
2913 nFieldType == FIELDTYPE_COMBOBOX || 2913 nFieldType == FIELDTYPE_COMBOBOX ||
2914 nFieldType == FIELDTYPE_LISTBOX || 2914 nFieldType == FIELDTYPE_LISTBOX ||
2915 nFieldType == FIELDTYPE_TEXTFIELD) 2915 nFieldType == FIELDTYPE_TEXTFIELD)
2916 { 2916 {
2917 CPDF_Font * pFont = pFormControl->GetDefaultControlFont(); 2917 CPDF_Font * pFont = pFormControl->GetDefaultControlFont();
2918 if (!pFont) return FALSE; 2918 if (!pFont) return false;
2919 2919
2920 vp << pFont->GetBaseFont(); 2920 vp << pFont->GetBaseFont();
2921 } 2921 }
2922 else 2922 else
2923 return FALSE; 2923 return false;
2924 } 2924 }
2925 2925
2926 return TRUE; 2926 return true;
2927 } 2927 }
2928 2928
2929 void Field::SetTextFont(CPDFSDK_Document* pDocument, const CFX_WideString& swFie ldName, int nControlIndex, const CFX_ByteString& string) 2929 void Field::SetTextFont(CPDFSDK_Document* pDocument, const CFX_WideString& swFie ldName, int nControlIndex, const CFX_ByteString& string)
2930 { 2930 {
2931 //Not supported. 2931 //Not supported.
2932 } 2932 }
2933 2933
2934 FX_BOOL Field::textSize(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE rror) 2934 bool Field::textSize(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro r)
2935 { 2935 {
2936 ASSERT(m_pDocument != NULL); 2936 ASSERT(m_pDocument != NULL);
2937 2937
2938 if (vp.IsSetting()) 2938 if (vp.IsSetting())
2939 { 2939 {
2940 if (!m_bCanSet) return FALSE; 2940 if (!m_bCanSet) return false;
2941 2941
2942 int nVP; 2942 int nVP;
2943 vp >> nVP; 2943 vp >> nVP;
2944 2944
2945 if (m_bDelay) 2945 if (m_bDelay)
2946 { 2946 {
2947 AddDelay_Int(FP_TEXTSIZE, nVP); 2947 AddDelay_Int(FP_TEXTSIZE, nVP);
2948 } 2948 }
2949 else 2949 else
2950 { 2950 {
2951 Field::SetTextSize(m_pDocument, m_FieldName, m_nFormControlIndex, nV P); 2951 Field::SetTextSize(m_pDocument, m_FieldName, m_nFormControlIndex, nV P);
2952 } 2952 }
2953 } 2953 }
2954 else 2954 else
2955 { 2955 {
2956 CFX_PtrArray FieldArray; 2956 CFX_PtrArray FieldArray;
2957 GetFormFields(m_FieldName,FieldArray); 2957 GetFormFields(m_FieldName,FieldArray);
2958 if (FieldArray.GetSize() <= 0) return FALSE; 2958 if (FieldArray.GetSize() <= 0) return false;
2959 2959
2960 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 2960 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
2961 ASSERT(pFormField != NULL); 2961 ASSERT(pFormField != NULL);
2962 2962
2963 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); 2963 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
2964 if (!pFormControl)return FALSE; 2964 if (!pFormControl)return false;
2965 2965
2966 CPDF_DefaultAppearance FieldAppearance = pFormControl->GetDefaultAppeara nce(); 2966 CPDF_DefaultAppearance FieldAppearance = pFormControl->GetDefaultAppeara nce();
2967 2967
2968 CFX_ByteString csFontNameTag; 2968 CFX_ByteString csFontNameTag;
2969 FX_FLOAT fFontSize; 2969 FX_FLOAT fFontSize;
2970 FieldAppearance.GetFont(csFontNameTag,fFontSize); 2970 FieldAppearance.GetFont(csFontNameTag,fFontSize);
2971 2971
2972 vp << (int)fFontSize; 2972 vp << (int)fFontSize;
2973 } 2973 }
2974 2974
2975 return TRUE; 2975 return true;
2976 } 2976 }
2977 2977
2978 void Field::SetTextSize(CPDFSDK_Document* pDocument, const CFX_WideString& swFie ldName, int nControlIndex, int number) 2978 void Field::SetTextSize(CPDFSDK_Document* pDocument, const CFX_WideString& swFie ldName, int nControlIndex, int number)
2979 { 2979 {
2980 //Not supported. 2980 //Not supported.
2981 } 2981 }
2982 2982
2983 FX_BOOL Field::type(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError ) 2983 bool Field::type(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
2984 { 2984 {
2985 ASSERT(m_pDocument != NULL); 2985 ASSERT(m_pDocument != NULL);
2986 2986
2987 if (!vp.IsGetting()) return FALSE; 2987 if (!vp.IsGetting()) return false;
2988 2988
2989 CFX_PtrArray FieldArray; 2989 CFX_PtrArray FieldArray;
2990 GetFormFields(m_FieldName,FieldArray); 2990 GetFormFields(m_FieldName,FieldArray);
2991 if (FieldArray.GetSize() <= 0) return FALSE; 2991 if (FieldArray.GetSize() <= 0) return false;
2992 2992
2993 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 2993 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
2994 ASSERT(pFormField != NULL); 2994 ASSERT(pFormField != NULL);
2995 2995
2996 switch (pFormField->GetFieldType()) 2996 switch (pFormField->GetFieldType())
2997 { 2997 {
2998 case FIELDTYPE_UNKNOWN: 2998 case FIELDTYPE_UNKNOWN:
2999 vp << L"unknown"; 2999 vp << L"unknown";
3000 break; 3000 break;
3001 case FIELDTYPE_PUSHBUTTON: 3001 case FIELDTYPE_PUSHBUTTON:
(...skipping 15 matching lines...) Expand all
3017 vp << L"text"; 3017 vp << L"text";
3018 break; 3018 break;
3019 case FIELDTYPE_SIGNATURE: 3019 case FIELDTYPE_SIGNATURE:
3020 vp << L"signature"; 3020 vp << L"signature";
3021 break; 3021 break;
3022 default : 3022 default :
3023 vp << L"unknown"; 3023 vp << L"unknown";
3024 break; 3024 break;
3025 } 3025 }
3026 3026
3027 return TRUE; 3027 return true;
3028 } 3028 }
3029 3029
3030 FX_BOOL Field::userName(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE rror) 3030 bool Field::userName(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro r)
3031 { 3031 {
3032 ASSERT(m_pDocument != NULL); 3032 ASSERT(m_pDocument != NULL);
3033 3033
3034 if (vp.IsSetting()) 3034 if (vp.IsSetting())
3035 { 3035 {
3036 if (!m_bCanSet) return FALSE; 3036 if (!m_bCanSet) return false;
3037 3037
3038 CFX_WideString swName; 3038 CFX_WideString swName;
3039 vp >> swName; 3039 vp >> swName;
3040 3040
3041 if (m_bDelay) 3041 if (m_bDelay)
3042 { 3042 {
3043 AddDelay_WideString(FP_USERNAME, swName); 3043 AddDelay_WideString(FP_USERNAME, swName);
3044 } 3044 }
3045 else 3045 else
3046 { 3046 {
3047 Field::SetUserName(m_pDocument, m_FieldName, m_nFormControlIndex, sw Name); 3047 Field::SetUserName(m_pDocument, m_FieldName, m_nFormControlIndex, sw Name);
3048 } 3048 }
3049 } 3049 }
3050 else 3050 else
3051 { 3051 {
3052 CFX_PtrArray FieldArray; 3052 CFX_PtrArray FieldArray;
3053 GetFormFields(m_FieldName,FieldArray); 3053 GetFormFields(m_FieldName,FieldArray);
3054 if (FieldArray.GetSize() <= 0) return FALSE; 3054 if (FieldArray.GetSize() <= 0) return false;
3055 3055
3056 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 3056 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
3057 ASSERT(pFormField != NULL); 3057 ASSERT(pFormField != NULL);
3058 3058
3059 vp << (CFX_WideString)pFormField->GetAlternateName(); 3059 vp << (CFX_WideString)pFormField->GetAlternateName();
3060 } 3060 }
3061 3061
3062 return TRUE; 3062 return true;
3063 } 3063 }
3064 3064
3065 void Field::SetUserName(CPDFSDK_Document* pDocument, const CFX_WideString& swFie ldName, int nControlIndex, const CFX_WideString& string) 3065 void Field::SetUserName(CPDFSDK_Document* pDocument, const CFX_WideString& swFie ldName, int nControlIndex, const CFX_WideString& string)
3066 { 3066 {
3067 //Not supported. 3067 //Not supported.
3068 } 3068 }
3069 3069
3070 FX_BOOL Field::value(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro r) 3070 bool Field::value(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
3071 { 3071 {
3072 ASSERT(m_pDocument != NULL); 3072 ASSERT(m_pDocument != NULL);
3073 3073
3074 if (vp.IsSetting()) 3074 if (vp.IsSetting())
3075 { 3075 {
3076 if (!m_bCanSet) return FALSE; 3076 if (!m_bCanSet) return false;
3077 3077
3078 CJS_WideStringArray strArray; 3078 CJS_WideStringArray strArray;
3079 3079
3080 if (vp.IsArrayObject()) 3080 if (vp.IsArrayObject())
3081 { 3081 {
3082 CJS_Array ValueArray(m_isolate); 3082 CJS_Array ValueArray(m_isolate);
3083 vp.ConvertToArray(ValueArray); 3083 vp.ConvertToArray(ValueArray);
3084 for (int i = 0,sz = ValueArray.GetLength(); i < sz; i++) 3084 for (int i = 0,sz = ValueArray.GetLength(); i < sz; i++)
3085 { 3085 {
3086 CJS_Value ElementValue(m_isolate); 3086 CJS_Value ElementValue(m_isolate);
(...skipping 15 matching lines...) Expand all
3102 } 3102 }
3103 else 3103 else
3104 { 3104 {
3105 Field::SetValue(m_pDocument, m_FieldName, m_nFormControlIndex, strAr ray); 3105 Field::SetValue(m_pDocument, m_FieldName, m_nFormControlIndex, strAr ray);
3106 } 3106 }
3107 } 3107 }
3108 else 3108 else
3109 { 3109 {
3110 CFX_PtrArray FieldArray; 3110 CFX_PtrArray FieldArray;
3111 GetFormFields(m_FieldName,FieldArray); 3111 GetFormFields(m_FieldName,FieldArray);
3112 if (FieldArray.GetSize() <= 0) return FALSE; 3112 if (FieldArray.GetSize() <= 0) return false;
3113 3113
3114 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 3114 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
3115 ASSERT(pFormField != NULL); 3115 ASSERT(pFormField != NULL);
3116 3116
3117 3117
3118 3118
3119 switch (pFormField->GetFieldType()) 3119 switch (pFormField->GetFieldType())
3120 { 3120 {
3121 case FIELDTYPE_PUSHBUTTON: 3121 case FIELDTYPE_PUSHBUTTON:
3122 return FALSE; 3122 return false;
3123 case FIELDTYPE_COMBOBOX: 3123 case FIELDTYPE_COMBOBOX:
3124 case FIELDTYPE_TEXTFIELD: 3124 case FIELDTYPE_TEXTFIELD:
3125 { 3125 {
3126 CFX_WideString swValue = pFormField->GetValue(); 3126 CFX_WideString swValue = pFormField->GetValue();
3127 3127
3128 double dRet; 3128 double dRet;
3129 FX_BOOL bDot; 3129 bool bDot;
3130 if (CJS_PublicMethods::ConvertStringToNumber(swValue.c_str(), dR et, bDot)) 3130 if (CJS_PublicMethods::ConvertStringToNumber(swValue.c_str(), dR et, bDot))
3131 { 3131 {
3132 if (bDot) 3132 if (bDot)
3133 vp << dRet; 3133 vp << dRet;
3134 else 3134 else
3135 vp << dRet; 3135 vp << dRet;
3136 } 3136 }
3137 else 3137 else
3138 vp << swValue; 3138 vp << swValue;
3139 } 3139 }
(...skipping 13 matching lines...) Expand all
3153 ElementValue = pFormField->GetOptionLabel(iIndex).c_ str(); 3153 ElementValue = pFormField->GetOptionLabel(iIndex).c_ str();
3154 ValueArray.SetElement(i, ElementValue); 3154 ValueArray.SetElement(i, ElementValue);
3155 } 3155 }
3156 vp << ValueArray; 3156 vp << ValueArray;
3157 } 3157 }
3158 else 3158 else
3159 { 3159 {
3160 CFX_WideString swValue = pFormField->GetValue(); 3160 CFX_WideString swValue = pFormField->GetValue();
3161 3161
3162 double dRet; 3162 double dRet;
3163 FX_BOOL bDot; 3163 bool bDot;
3164 if (CJS_PublicMethods::ConvertStringToNumber(swValue.c_str() , dRet, bDot)) 3164 if (CJS_PublicMethods::ConvertStringToNumber(swValue.c_str() , dRet, bDot))
3165 { 3165 {
3166 if (bDot) 3166 if (bDot)
3167 vp << dRet; 3167 vp << dRet;
3168 else 3168 else
3169 vp << dRet; 3169 vp << dRet;
3170 } 3170 }
3171 else 3171 else
3172 vp << swValue; 3172 vp << swValue;
3173 } 3173 }
3174 } 3174 }
3175 break; 3175 break;
3176 case FIELDTYPE_CHECKBOX: 3176 case FIELDTYPE_CHECKBOX:
3177 case FIELDTYPE_RADIOBUTTON: 3177 case FIELDTYPE_RADIOBUTTON:
3178 { 3178 {
3179 FX_BOOL bFind = FALSE; 3179 bool bFind = false;
3180 for (int i = 0 , sz = pFormField->CountControls(); i < sz; i++) 3180 for (int i = 0 , sz = pFormField->CountControls(); i < sz; i++)
3181 { 3181 {
3182 if (pFormField->GetControl(i)->IsChecked()) 3182 if (pFormField->GetControl(i)->IsChecked())
3183 { 3183 {
3184 CFX_WideString swValue = pFormField->GetControl(i)->GetE xportValue(); 3184 CFX_WideString swValue = pFormField->GetControl(i)->GetE xportValue();
3185 double dRet; 3185 double dRet;
3186 FX_BOOL bDot; 3186 bool bDot;
3187 if (CJS_PublicMethods::ConvertStringToNumber(swValue.c_s tr(), dRet, bDot)) 3187 if (CJS_PublicMethods::ConvertStringToNumber(swValue.c_s tr(), dRet, bDot))
3188 { 3188 {
3189 if (bDot) 3189 if (bDot)
3190 vp << dRet; 3190 vp << dRet;
3191 else 3191 else
3192 vp << dRet; 3192 vp << dRet;
3193 } 3193 }
3194 else 3194 else
3195 vp << swValue; 3195 vp << swValue;
3196 3196
3197 bFind = TRUE; 3197 bFind = true;
3198 break; 3198 break;
3199 } 3199 }
3200 else 3200 else
3201 continue; 3201 continue;
3202 } 3202 }
3203 if (!bFind) 3203 if (!bFind)
3204 vp << L"Off"; 3204 vp << L"Off";
3205 } 3205 }
3206 break; 3206 break;
3207 default: 3207 default:
3208 vp << pFormField->GetValue(); 3208 vp << pFormField->GetValue();
3209 break; 3209 break;
3210 } 3210 }
3211 } 3211 }
3212 3212
3213 return TRUE; 3213 return true;
3214 } 3214 }
3215 3215
3216 void Field::SetValue(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldN ame, 3216 void Field::SetValue(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldN ame,
3217 int nControlIndex, const CJS_WideStringArray& strArray) 3217 int nControlIndex, const CJS_WideStringArray& strArray)
3218 { 3218 {
3219 ASSERT(pDocument != NULL); 3219 ASSERT(pDocument != NULL);
3220 3220
3221 if (strArray.GetSize() < 1) return; 3221 if (strArray.GetSize() < 1) return;
3222 3222
3223 CFX_PtrArray FieldArray; 3223 CFX_PtrArray FieldArray;
3224 GetFormFields(pDocument, swFieldName, FieldArray); 3224 GetFormFields(pDocument, swFieldName, FieldArray);
3225 3225
3226 for (int i=0,isz=FieldArray.GetSize(); i<isz; i++) 3226 for (int i=0,isz=FieldArray.GetSize(); i<isz; i++)
3227 { 3227 {
3228 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(i); 3228 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(i);
3229 ASSERT(pFormField != NULL); 3229 ASSERT(pFormField != NULL);
3230 3230
3231 if (pFormField->GetFullName().Compare(swFieldName) != 0) 3231 if (pFormField->GetFullName().Compare(swFieldName) != 0)
3232 continue; 3232 continue;
3233 3233
3234 switch (pFormField->GetFieldType()) 3234 switch (pFormField->GetFieldType())
3235 { 3235 {
3236 case FIELDTYPE_TEXTFIELD: 3236 case FIELDTYPE_TEXTFIELD:
3237 case FIELDTYPE_COMBOBOX: 3237 case FIELDTYPE_COMBOBOX:
3238 if (pFormField->GetValue() != strArray.GetAt(0)) 3238 if (pFormField->GetValue() != strArray.GetAt(0))
3239 { 3239 {
3240 CFX_WideString WideString = strArray.GetAt(0); 3240 CFX_WideString WideString = strArray.GetAt(0);
3241 pFormField->SetValue(strArray.GetAt(0), TRUE); 3241 pFormField->SetValue(strArray.GetAt(0), true);
3242 UpdateFormField(pDocument, pFormField, TRUE, FALSE, TRUE); 3242 UpdateFormField(pDocument, pFormField, true, false, true);
3243 } 3243 }
3244 break; 3244 break;
3245 case FIELDTYPE_CHECKBOX: //mantis: 0004493 3245 case FIELDTYPE_CHECKBOX: //mantis: 0004493
3246 case FIELDTYPE_RADIOBUTTON: 3246 case FIELDTYPE_RADIOBUTTON:
3247 { 3247 {
3248 if (pFormField->GetValue() != strArray.GetAt(0)) 3248 if (pFormField->GetValue() != strArray.GetAt(0))
3249 { 3249 {
3250 pFormField->SetValue(strArray.GetAt(0), TRUE); 3250 pFormField->SetValue(strArray.GetAt(0), true);
3251 UpdateFormField(pDocument, pFormField, TRUE, FALSE, TRUE); 3251 UpdateFormField(pDocument, pFormField, true, false, true);
3252 } 3252 }
3253 } 3253 }
3254 break; 3254 break;
3255 case FIELDTYPE_LISTBOX: 3255 case FIELDTYPE_LISTBOX:
3256 { 3256 {
3257 FX_BOOL bModified = FALSE; 3257 bool bModified = false;
3258 3258
3259 for (int i=0,sz=strArray.GetSize(); i<sz; i++) 3259 for (int i=0,sz=strArray.GetSize(); i<sz; i++)
3260 { 3260 {
3261 int iIndex = pFormField->FindOption(strArray.GetAt(i)); 3261 int iIndex = pFormField->FindOption(strArray.GetAt(i));
3262 3262
3263 if (!pFormField->IsItemSelected(iIndex)) 3263 if (!pFormField->IsItemSelected(iIndex))
3264 { 3264 {
3265 bModified = TRUE; 3265 bModified = true;
3266 break; 3266 break;
3267 } 3267 }
3268 } 3268 }
3269 3269
3270 if (bModified) 3270 if (bModified)
3271 { 3271 {
3272 pFormField->ClearSelection(TRUE); 3272 pFormField->ClearSelection(true);
3273 for (int i=0,sz=strArray.GetSize(); i<sz; i++) 3273 for (int i=0,sz=strArray.GetSize(); i<sz; i++)
3274 { 3274 {
3275 int iIndex = pFormField->FindOption(strArray.GetAt(i)); 3275 int iIndex = pFormField->FindOption(strArray.GetAt(i));
3276 pFormField->SetItemSelection(iIndex, TRUE, TRUE); 3276 pFormField->SetItemSelection(iIndex, true, true);
3277 } 3277 }
3278 3278
3279 UpdateFormField(pDocument, pFormField, TRUE, FALSE, TRUE); 3279 UpdateFormField(pDocument, pFormField, true, false, true);
3280 } 3280 }
3281 } 3281 }
3282 break; 3282 break;
3283 default: 3283 default:
3284 break; 3284 break;
3285 } 3285 }
3286 } 3286 }
3287 } 3287 }
3288 3288
3289 FX_BOOL Field::valueAsString(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStrin g& sError) 3289 bool Field::valueAsString(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
3290 { 3290 {
3291 ASSERT(m_pDocument != NULL); 3291 ASSERT(m_pDocument != NULL);
3292 3292
3293 if (!vp.IsGetting()) return FALSE; 3293 if (!vp.IsGetting()) return false;
3294 3294
3295 CFX_PtrArray FieldArray; 3295 CFX_PtrArray FieldArray;
3296 GetFormFields(m_FieldName,FieldArray); 3296 GetFormFields(m_FieldName,FieldArray);
3297 if (FieldArray.GetSize() <= 0) return FALSE; 3297 if (FieldArray.GetSize() <= 0) return false;
3298 3298
3299 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 3299 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
3300 ASSERT(pFormField != NULL); 3300 ASSERT(pFormField != NULL);
3301 3301
3302 if (pFormField->GetFieldType() == FIELDTYPE_PUSHBUTTON) 3302 if (pFormField->GetFieldType() == FIELDTYPE_PUSHBUTTON)
3303 return FALSE; 3303 return false;
3304 3304
3305 if (pFormField->GetFieldType() == FIELDTYPE_CHECKBOX) 3305 if (pFormField->GetFieldType() == FIELDTYPE_CHECKBOX)
3306 { 3306 {
3307 if(!pFormField->CountControls()) return FALSE; 3307 if(!pFormField->CountControls()) return false;
3308 3308
3309 if (pFormField->GetControl(0)->IsChecked()) 3309 if (pFormField->GetControl(0)->IsChecked())
3310 vp << L"Yes"; 3310 vp << L"Yes";
3311 else 3311 else
3312 vp << L"Off"; 3312 vp << L"Off";
3313 } 3313 }
3314 else if (pFormField->GetFieldType() == FIELDTYPE_RADIOBUTTON && !(pFormField ->GetFieldFlags() & FIELDFLAG_RADIOSINUNISON)) 3314 else if (pFormField->GetFieldType() == FIELDTYPE_RADIOBUTTON && !(pFormField ->GetFieldFlags() & FIELDFLAG_RADIOSINUNISON))
3315 { 3315 {
3316 for (int i=0, sz=pFormField->CountControls(); i<sz; i++) 3316 for (int i=0, sz=pFormField->CountControls(); i<sz; i++)
3317 { 3317 {
3318 if (pFormField->GetControl(i)->IsChecked()) 3318 if (pFormField->GetControl(i)->IsChecked())
3319 { 3319 {
3320 vp << pFormField->GetControl(i)->GetExportValue().c_str(); 3320 vp << pFormField->GetControl(i)->GetExportValue().c_str();
3321 break; 3321 break;
3322 } 3322 }
3323 else 3323 else
3324 vp << L"Off"; 3324 vp << L"Off";
3325 } 3325 }
3326 } 3326 }
3327 else if (pFormField->GetFieldType() == FIELDTYPE_LISTBOX && (pFormField->Cou ntSelectedItems() > 1)) 3327 else if (pFormField->GetFieldType() == FIELDTYPE_LISTBOX && (pFormField->Cou ntSelectedItems() > 1))
3328 { 3328 {
3329 vp << L""; 3329 vp << L"";
3330 } 3330 }
3331 else 3331 else
3332 vp << pFormField->GetValue().c_str(); 3332 vp << pFormField->GetValue().c_str();
3333 3333
3334 return TRUE; 3334 return true;
3335 } 3335 }
3336 3336
3337 /* --------------------------------- methods --------------------------------- * / 3337 /* --------------------------------- methods --------------------------------- * /
3338 3338
3339 FX_BOOL Field::browseForFileToSubmit(IFXJS_Context* cc, const CJS_Parameters& pa rams, CJS_Value& vRet, CFX_WideString& sError) 3339 bool Field::browseForFileToSubmit(IFXJS_Context* cc, const CJS_Parameters& param s, CJS_Value& vRet, CFX_WideString& sError)
3340 { 3340 {
3341 ASSERT(m_pDocument != NULL); 3341 ASSERT(m_pDocument != NULL);
3342 3342
3343 CFX_PtrArray FieldArray; 3343 CFX_PtrArray FieldArray;
3344 GetFormFields(m_FieldName, FieldArray); 3344 GetFormFields(m_FieldName, FieldArray);
3345 if (FieldArray.GetSize() <= 0) return FALSE; 3345 if (FieldArray.GetSize() <= 0) return false;
3346 3346
3347 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 3347 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
3348 ASSERT(pFormField != NULL); 3348 ASSERT(pFormField != NULL);
3349 3349
3350 CPDFDoc_Environment* pApp = m_pDocument->GetEnv(); 3350 CPDFDoc_Environment* pApp = m_pDocument->GetEnv();
3351 ASSERT(pApp != NULL); 3351 ASSERT(pApp != NULL);
3352 3352
3353 if ((pFormField->GetFieldFlags() & FIELDFLAG_FILESELECT) && 3353 if ((pFormField->GetFieldFlags() & FIELDFLAG_FILESELECT) &&
3354 (pFormField->GetFieldType() == FIELDTYPE_TEXTFIELD)) 3354 (pFormField->GetFieldType() == FIELDTYPE_TEXTFIELD))
3355 { 3355 {
3356 CFX_WideString wsFileName = pApp->JS_fieldBrowse(); 3356 CFX_WideString wsFileName = pApp->JS_fieldBrowse();
3357 if(!wsFileName.IsEmpty()) 3357 if(!wsFileName.IsEmpty())
3358 { 3358 {
3359 pFormField->SetValue(wsFileName); 3359 pFormField->SetValue(wsFileName);
3360 UpdateFormField(m_pDocument, pFormField, TRUE, TRUE, TRUE); 3360 UpdateFormField(m_pDocument, pFormField, true, true, true);
3361 } 3361 }
3362 } 3362 }
3363 else 3363 else
3364 return FALSE; 3364 return false;
3365 3365
3366 return TRUE; 3366 return true;
3367 } 3367 }
3368 3368
3369 3369
3370 FX_BOOL Field::buttonGetCaption(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError) 3370 bool Field::buttonGetCaption(IFXJS_Context* cc, const CJS_Parameters& params, CJ S_Value& vRet, CFX_WideString& sError)
3371 { 3371 {
3372 ASSERT(m_pDocument != NULL); 3372 ASSERT(m_pDocument != NULL);
3373 3373
3374 int nface = 0; 3374 int nface = 0;
3375 int iSize = params.size(); 3375 int iSize = params.size();
3376 if (iSize >= 1) 3376 if (iSize >= 1)
3377 nface = params[0].ToInt(); 3377 nface = params[0].ToInt();
3378 3378
3379 CFX_PtrArray FieldArray; 3379 CFX_PtrArray FieldArray;
3380 GetFormFields(m_FieldName,FieldArray); 3380 GetFormFields(m_FieldName,FieldArray);
3381 if (FieldArray.GetSize() <= 0) return FALSE; 3381 if (FieldArray.GetSize() <= 0) return false;
3382 3382
3383 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 3383 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
3384 ASSERT(pFormField != NULL); 3384 ASSERT(pFormField != NULL);
3385 3385
3386 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) 3386 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON)
3387 return FALSE; 3387 return false;
3388 3388
3389 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); 3389 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
3390 if (!pFormControl)return FALSE; 3390 if (!pFormControl)return false;
3391 3391
3392 if (nface == 0) 3392 if (nface == 0)
3393 vRet = pFormControl->GetNormalCaption().c_str(); 3393 vRet = pFormControl->GetNormalCaption().c_str();
3394 else if (nface == 1) 3394 else if (nface == 1)
3395 vRet = pFormControl->GetDownCaption().c_str(); 3395 vRet = pFormControl->GetDownCaption().c_str();
3396 else if (nface == 2) 3396 else if (nface == 2)
3397 vRet = pFormControl->GetRolloverCaption().c_str(); 3397 vRet = pFormControl->GetRolloverCaption().c_str();
3398 else 3398 else
3399 return FALSE; 3399 return false;
3400 3400
3401 return TRUE; 3401 return true;
3402 } 3402 }
3403 3403
3404 //#pragma warning(disable: 4800) 3404 //#pragma warning(disable: 4800)
3405 3405
3406 FX_BOOL Field::buttonGetIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJ S_Value& vRet, CFX_WideString& sError) 3406 bool Field::buttonGetIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V alue& vRet, CFX_WideString& sError)
3407 { 3407 {
3408 ASSERT(m_pDocument != NULL); 3408 ASSERT(m_pDocument != NULL);
3409 3409
3410 int nface = 0; 3410 int nface = 0;
3411 int iSize = params.size(); 3411 int iSize = params.size();
3412 if (iSize >= 1) 3412 if (iSize >= 1)
3413 nface = params[0].ToInt(); 3413 nface = params[0].ToInt();
3414 3414
3415 CFX_PtrArray FieldArray; 3415 CFX_PtrArray FieldArray;
3416 GetFormFields(m_FieldName,FieldArray); 3416 GetFormFields(m_FieldName,FieldArray);
3417 if (FieldArray.GetSize() <= 0) return FALSE; 3417 if (FieldArray.GetSize() <= 0) return false;
3418 3418
3419 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 3419 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
3420 ASSERT(pFormField != NULL); 3420 ASSERT(pFormField != NULL);
3421 3421
3422 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) 3422 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON)
3423 return FALSE; 3423 return false;
3424 3424
3425 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); 3425 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
3426 if (!pFormControl)return FALSE; 3426 if (!pFormControl)return false;
3427 3427
3428 CJS_Context* pContext = (CJS_Context*)cc; 3428 CJS_Context* pContext = (CJS_Context*)cc;
3429 ASSERT(pContext != NULL); 3429 ASSERT(pContext != NULL);
3430 3430
3431 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); 3431 CJS_Runtime* pRuntime = pContext->GetJSRuntime();
3432 ASSERT(pRuntime != NULL); 3432 ASSERT(pRuntime != NULL);
3433 3433
3434 JSFXObject pObj = JS_NewFxDynamicObj(*pRuntime, pContext, JS_GetObjDefnID(*p Runtime, L"Icon")); 3434 JSFXObject pObj = JS_NewFxDynamicObj(*pRuntime, pContext, JS_GetObjDefnID(*p Runtime, L"Icon"));
3435 ASSERT(pObj.IsEmpty() == FALSE); 3435 ASSERT(pObj.IsEmpty() == false);
3436 3436
3437 CJS_Icon* pJS_Icon = (CJS_Icon*)JS_GetPrivate(pObj); 3437 CJS_Icon* pJS_Icon = (CJS_Icon*)JS_GetPrivate(pObj);
3438 ASSERT(pJS_Icon != NULL); 3438 ASSERT(pJS_Icon != NULL);
3439 3439
3440 Icon* pIcon = (Icon*)pJS_Icon->GetEmbedObject(); 3440 Icon* pIcon = (Icon*)pJS_Icon->GetEmbedObject();
3441 ASSERT(pIcon != NULL); 3441 ASSERT(pIcon != NULL);
3442 3442
3443 CPDF_Stream* pIconStream = NULL; 3443 CPDF_Stream* pIconStream = NULL;
3444 if (nface == 0) 3444 if (nface == 0)
3445 pIconStream = pFormControl->GetNormalIcon(); 3445 pIconStream = pFormControl->GetNormalIcon();
3446 else if (nface == 1) 3446 else if (nface == 1)
3447 pIconStream = pFormControl->GetDownIcon(); 3447 pIconStream = pFormControl->GetDownIcon();
3448 else if (nface == 2) 3448 else if (nface == 2)
3449 pIconStream = pFormControl->GetRolloverIcon(); 3449 pIconStream = pFormControl->GetRolloverIcon();
3450 else 3450 else
3451 return FALSE; 3451 return false;
3452 3452
3453 pIcon->SetStream(pIconStream); 3453 pIcon->SetStream(pIconStream);
3454 vRet = pJS_Icon; 3454 vRet = pJS_Icon;
3455 3455
3456 return TRUE; 3456 return true;
3457 } 3457 }
3458 3458
3459 //#pragma warning(default: 4800) 3459 //#pragma warning(default: 4800)
3460 3460
3461 FX_BOOL Field::buttonImportIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError) 3461 bool Field::buttonImportIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJ S_Value& vRet, CFX_WideString& sError)
3462 { 3462 {
3463 #if 0 3463 #if 0
3464 ASSERT(m_pDocument != NULL); 3464 ASSERT(m_pDocument != NULL);
3465 3465
3466 CFX_PtrArray FieldArray; 3466 CFX_PtrArray FieldArray;
3467 GetFormFields(m_FieldName,FieldArray); 3467 GetFormFields(m_FieldName,FieldArray);
3468 if (FieldArray.GetSize() <= 0) return FALSE; 3468 if (FieldArray.GetSize() <= 0) return false;
3469 3469
3470 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 3470 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
3471 if (!pFormField)return FALSE; 3471 if (!pFormField)return false;
3472 3472
3473 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); 3473 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv();
3474 ASSERT(pEnv); 3474 ASSERT(pEnv);
3475 3475
3476 CFX_WideString sIconFileName = pEnv->JS_fieldBrowse(); 3476 CFX_WideString sIconFileName = pEnv->JS_fieldBrowse();
3477 if (sIconFileName.IsEmpty()) 3477 if (sIconFileName.IsEmpty())
3478 { 3478 {
3479 vRet = 1; 3479 vRet = 1;
3480 return TRUE; 3480 return true;
3481 } 3481 }
3482 3482
3483 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInterFor m(); 3483 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInterFor m();
3484 ASSERT(pInterForm != NULL); 3484 ASSERT(pInterForm != NULL);
3485 3485
3486 CPDF_Stream* pStream = pInterForm->LoadImageFromFile(sIconFileName); 3486 CPDF_Stream* pStream = pInterForm->LoadImageFromFile(sIconFileName);
3487 if (!pStream) 3487 if (!pStream)
3488 { 3488 {
3489 vRet = -1; 3489 vRet = -1;
3490 return TRUE; 3490 return true;
3491 } 3491 }
3492 3492
3493 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); 3493 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
3494 if (!pFormControl)return FALSE; 3494 if (!pFormControl)return false;
3495 3495
3496 pFormControl->SetNormalIcon(pStream); 3496 pFormControl->SetNormalIcon(pStream);
3497 UpdateFormControl(m_pDocument, pFormControl, TRUE, TRUE, TRUE); 3497 UpdateFormControl(m_pDocument, pFormControl, true, true, true);
3498 3498
3499 vRet = 0; 3499 vRet = 0;
3500 #endif // 0 3500 #endif // 0
3501 return TRUE; 3501 return true;
3502 } 3502 }
3503 3503
3504 FX_BOOL Field::buttonSetCaption(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError) 3504 bool Field::buttonSetCaption(IFXJS_Context* cc, const CJS_Parameters& params, CJ S_Value& vRet, CFX_WideString& sError)
3505 { 3505 {
3506 return FALSE; 3506 return false;
3507 } 3507 }
3508 3508
3509 FX_BOOL Field::buttonSetIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJ S_Value& vRet, CFX_WideString& sError) 3509 bool Field::buttonSetIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V alue& vRet, CFX_WideString& sError)
3510 { 3510 {
3511 return FALSE; 3511 return false;
3512 } 3512 }
3513 3513
3514 FX_BOOL Field::checkThisBox(IFXJS_Context* cc, const CJS_Parameters& params, CJS _Value& vRet, CFX_WideString& sError) 3514 bool Field::checkThisBox(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Va lue& vRet, CFX_WideString& sError)
3515 { 3515 {
3516 ASSERT(m_pDocument != NULL); 3516 ASSERT(m_pDocument != NULL);
3517 3517
3518 if (!m_bCanSet) return FALSE; 3518 if (!m_bCanSet) return false;
3519 3519
3520 int iSize = params.size(); 3520 int iSize = params.size();
3521 if (iSize < 1) 3521 if (iSize < 1)
3522 return FALSE; 3522 return false;
3523 3523
3524 int nWidget = params[0].ToInt(); 3524 int nWidget = params[0].ToInt();
3525 3525
3526 FX_BOOL bCheckit = TRUE; 3526 bool bCheckit = true;
3527 if (iSize >= 2) 3527 if (iSize >= 2)
3528 bCheckit = params[1].ToBool(); 3528 bCheckit = params[1].ToBool();
3529 3529
3530 CFX_PtrArray FieldArray; 3530 CFX_PtrArray FieldArray;
3531 GetFormFields(m_FieldName,FieldArray); 3531 GetFormFields(m_FieldName,FieldArray);
3532 if (FieldArray.GetSize() <= 0) return FALSE; 3532 if (FieldArray.GetSize() <= 0) return false;
3533 3533
3534 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 3534 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
3535 ASSERT(pFormField != NULL); 3535 ASSERT(pFormField != NULL);
3536 3536
3537 if (pFormField->GetFieldType() != FIELDTYPE_CHECKBOX && pFormField->GetField Type() != FIELDTYPE_RADIOBUTTON) 3537 if (pFormField->GetFieldType() != FIELDTYPE_CHECKBOX && pFormField->GetField Type() != FIELDTYPE_RADIOBUTTON)
3538 return FALSE; 3538 return false;
3539 if(nWidget <0 || nWidget >= pFormField->CountControls()) 3539 if(nWidget <0 || nWidget >= pFormField->CountControls())
3540 return FALSE; 3540 return false;
3541 if (pFormField->GetFieldType() == FIELDTYPE_RADIOBUTTON) 3541 if (pFormField->GetFieldType() == FIELDTYPE_RADIOBUTTON)
3542 pFormField->CheckControl(nWidget, bCheckit, TRUE); 3542 pFormField->CheckControl(nWidget, bCheckit, true);
3543 else 3543 else
3544 pFormField->CheckControl(nWidget, bCheckit, TRUE); 3544 pFormField->CheckControl(nWidget, bCheckit, true);
3545 3545
3546 UpdateFormField(m_pDocument, pFormField, TRUE, TRUE, TRUE); 3546 UpdateFormField(m_pDocument, pFormField, true, true, true);
3547 return TRUE; 3547 return true;
3548 } 3548 }
3549 3549
3550 FX_BOOL Field::clearItems(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V alue& vRet, CFX_WideString& sError) 3550 bool Field::clearItems(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Valu e& vRet, CFX_WideString& sError)
3551 { 3551 {
3552 return TRUE; 3552 return true;
3553 } 3553 }
3554 3554
3555 FX_BOOL Field::defaultIsChecked(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError) 3555 bool Field::defaultIsChecked(IFXJS_Context* cc, const CJS_Parameters& params, CJ S_Value& vRet, CFX_WideString& sError)
3556 { 3556 {
3557 ASSERT(m_pDocument != NULL); 3557 ASSERT(m_pDocument != NULL);
3558 3558
3559 if (!m_bCanSet) return FALSE; 3559 if (!m_bCanSet) return false;
3560 3560
3561 int iSize = params.size(); 3561 int iSize = params.size();
3562 if (iSize < 1) 3562 if (iSize < 1)
3563 return FALSE; 3563 return false;
3564 3564
3565 int nWidget = params[0].ToInt(); 3565 int nWidget = params[0].ToInt();
3566 3566
3567 CFX_PtrArray FieldArray; 3567 CFX_PtrArray FieldArray;
3568 GetFormFields(m_FieldName,FieldArray); 3568 GetFormFields(m_FieldName,FieldArray);
3569 if (FieldArray.GetSize() <= 0) return FALSE; 3569 if (FieldArray.GetSize() <= 0) return false;
3570 3570
3571 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 3571 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
3572 ASSERT(pFormField != NULL); 3572 ASSERT(pFormField != NULL);
3573 3573
3574 if(nWidget <0 || nWidget >= pFormField->CountControls()) 3574 if(nWidget <0 || nWidget >= pFormField->CountControls())
3575 { 3575 {
3576 vRet = FALSE; 3576 vRet = false;
3577 return FALSE; 3577 return false;
3578 } 3578 }
3579 if ((pFormField->GetFieldType() == FIELDTYPE_CHECKBOX) 3579 if ((pFormField->GetFieldType() == FIELDTYPE_CHECKBOX)
3580 || (pFormField->GetFieldType() == FIELDTYPE_RADIOBUTTON)) 3580 || (pFormField->GetFieldType() == FIELDTYPE_RADIOBUTTON))
3581 { 3581 {
3582 3582
3583 vRet = TRUE; 3583 vRet = true;
3584 } 3584 }
3585 else 3585 else
3586 vRet = FALSE; 3586 vRet = false;
3587 3587
3588 return TRUE; 3588 return true;
3589 } 3589 }
3590 3590
3591 FX_BOOL Field::deleteItemAt(IFXJS_Context* cc, const CJS_Parameters& params, CJS _Value& vRet, CFX_WideString& sError) 3591 bool Field::deleteItemAt(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Va lue& vRet, CFX_WideString& sError)
3592 { 3592 {
3593 return TRUE; 3593 return true;
3594 } 3594 }
3595 3595
3596 int JS_COMPARESTRING(CFX_WideString* ps1, CFX_WideString* ps2) 3596 int JS_COMPARESTRING(CFX_WideString* ps1, CFX_WideString* ps2)
3597 { 3597 {
3598 ASSERT(ps1 != NULL); 3598 ASSERT(ps1 != NULL);
3599 ASSERT(ps2 != NULL); 3599 ASSERT(ps2 != NULL);
3600 3600
3601 return ps1->Compare(*ps2); 3601 return ps1->Compare(*ps2);
3602 } 3602 }
3603 3603
3604 3604
3605 FX_BOOL Field::getArray(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Val ue& vRet, CFX_WideString& sError) 3605 bool Field::getArray(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
3606 { 3606 {
3607 ASSERT(m_pDocument != NULL); 3607 ASSERT(m_pDocument != NULL);
3608 3608
3609 CFX_PtrArray FieldArray; 3609 CFX_PtrArray FieldArray;
3610 GetFormFields(m_FieldName,FieldArray); 3610 GetFormFields(m_FieldName,FieldArray);
3611 if (FieldArray.GetSize() <= 0) return FALSE; 3611 if (FieldArray.GetSize() <= 0) return false;
3612 3612
3613 CGW_ArrayTemplate<CFX_WideString*> swSort; 3613 CGW_ArrayTemplate<CFX_WideString*> swSort;
3614 3614
3615 for (int i=0,sz=FieldArray.GetSize(); i<sz; i++) 3615 for (int i=0,sz=FieldArray.GetSize(); i<sz; i++)
3616 { 3616 {
3617 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(i); 3617 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(i);
3618 ASSERT(pFormField != NULL); 3618 ASSERT(pFormField != NULL);
3619 3619
3620 swSort.Add(new CFX_WideString(pFormField->GetFullName())); 3620 swSort.Add(new CFX_WideString(pFormField->GetFullName()));
3621 3621
3622 } 3622 }
3623 swSort.Sort(JS_COMPARESTRING); 3623 swSort.Sort(JS_COMPARESTRING);
3624 3624
3625 CJS_Context* pContext = (CJS_Context*)cc; 3625 CJS_Context* pContext = (CJS_Context*)cc;
3626 ASSERT(pContext != NULL); 3626 ASSERT(pContext != NULL);
3627 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); 3627 CJS_Runtime* pRuntime = pContext->GetJSRuntime();
3628 ASSERT(pRuntime != NULL); 3628 ASSERT(pRuntime != NULL);
3629 3629
3630 CJS_Array FormFieldArray(m_isolate); 3630 CJS_Array FormFieldArray(m_isolate);
3631 for (int j=0,jsz = swSort.GetSize(); j<jsz; j++) 3631 for (int j=0,jsz = swSort.GetSize(); j<jsz; j++)
3632 { 3632 {
3633 CFX_WideString* pStr = swSort.GetAt(j); 3633 CFX_WideString* pStr = swSort.GetAt(j);
3634 3634
3635 JSFXObject pObj = JS_NewFxDynamicObj(*pRuntime, pContext, JS_GetObjDefnI D(*pRuntime, L"Field")); 3635 JSFXObject pObj = JS_NewFxDynamicObj(*pRuntime, pContext, JS_GetObjDefnI D(*pRuntime, L"Field"));
3636 ASSERT(pObj.IsEmpty() == FALSE); 3636 ASSERT(pObj.IsEmpty() == false);
3637 3637
3638 CJS_Field* pJSField = (CJS_Field*)JS_GetPrivate(pObj); 3638 CJS_Field* pJSField = (CJS_Field*)JS_GetPrivate(pObj);
3639 ASSERT(pJSField != NULL); 3639 ASSERT(pJSField != NULL);
3640 3640
3641 Field* pField = (Field*)pJSField->GetEmbedObject(); 3641 Field* pField = (Field*)pJSField->GetEmbedObject();
3642 ASSERT(pField != NULL); 3642 ASSERT(pField != NULL);
3643 3643
3644 pField->AttachField(m_pJSDoc, *pStr); 3644 pField->AttachField(m_pJSDoc, *pStr);
3645 3645
3646 CJS_Value FormFieldValue(m_isolate); 3646 CJS_Value FormFieldValue(m_isolate);
3647 FormFieldValue = pJSField; 3647 FormFieldValue = pJSField;
3648 FormFieldArray.SetElement(j, FormFieldValue); 3648 FormFieldArray.SetElement(j, FormFieldValue);
3649 3649
3650 delete pStr; 3650 delete pStr;
3651 } 3651 }
3652 3652
3653 vRet = FormFieldArray; 3653 vRet = FormFieldArray;
3654 swSort.RemoveAll(); 3654 swSort.RemoveAll();
3655 return TRUE; 3655 return true;
3656 } 3656 }
3657 3657
3658 FX_BOOL Field::getItemAt(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Va lue& vRet, CFX_WideString& sError) 3658 bool Field::getItemAt(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value & vRet, CFX_WideString& sError)
3659 { 3659 {
3660 ASSERT(m_pDocument != NULL); 3660 ASSERT(m_pDocument != NULL);
3661 int iSize = params.size(); 3661 int iSize = params.size();
3662 3662
3663 int nIdx = -1; 3663 int nIdx = -1;
3664 if (iSize >= 1) 3664 if (iSize >= 1)
3665 nIdx = params[0].ToInt(); 3665 nIdx = params[0].ToInt();
3666 3666
3667 FX_BOOL bExport = TRUE; 3667 bool bExport = true;
3668 if (iSize >= 2) 3668 if (iSize >= 2)
3669 bExport = params[1].ToBool(); 3669 bExport = params[1].ToBool();
3670 3670
3671 CFX_PtrArray FieldArray; 3671 CFX_PtrArray FieldArray;
3672 GetFormFields(m_FieldName,FieldArray); 3672 GetFormFields(m_FieldName,FieldArray);
3673 if (FieldArray.GetSize() <= 0) return FALSE; 3673 if (FieldArray.GetSize() <= 0) return false;
3674 3674
3675 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 3675 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
3676 ASSERT(pFormField != NULL); 3676 ASSERT(pFormField != NULL);
3677 3677
3678 if ((pFormField->GetFieldType() == FIELDTYPE_LISTBOX) 3678 if ((pFormField->GetFieldType() == FIELDTYPE_LISTBOX)
3679 || (pFormField->GetFieldType() == FIELDTYPE_COMBOBOX)) 3679 || (pFormField->GetFieldType() == FIELDTYPE_COMBOBOX))
3680 { 3680 {
3681 if (nIdx == -1 || nIdx > pFormField->CountOptions()) 3681 if (nIdx == -1 || nIdx > pFormField->CountOptions())
3682 nIdx = pFormField->CountOptions() -1; 3682 nIdx = pFormField->CountOptions() -1;
3683 if (bExport) 3683 if (bExport)
3684 { 3684 {
3685 CFX_WideString strval = pFormField->GetOptionValue(nIdx); 3685 CFX_WideString strval = pFormField->GetOptionValue(nIdx);
3686 if (strval.IsEmpty()) 3686 if (strval.IsEmpty())
3687 vRet = pFormField->GetOptionLabel(nIdx).c_str(); 3687 vRet = pFormField->GetOptionLabel(nIdx).c_str();
3688 else 3688 else
3689 vRet = strval.c_str(); 3689 vRet = strval.c_str();
3690 } 3690 }
3691 else 3691 else
3692 vRet = pFormField->GetOptionLabel(nIdx).c_str(); 3692 vRet = pFormField->GetOptionLabel(nIdx).c_str();
3693 } 3693 }
3694 else 3694 else
3695 return FALSE; 3695 return false;
3696 3696
3697 return TRUE; 3697 return true;
3698 } 3698 }
3699 3699
3700 FX_BOOL Field::getLock(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Valu e& vRet, CFX_WideString& sError) 3700 bool Field::getLock(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
3701 { 3701 {
3702 return FALSE; 3702 return false;
3703 } 3703 }
3704 3704
3705 FX_BOOL Field::insertItemAt(IFXJS_Context* cc, const CJS_Parameters& params, CJS _Value& vRet, CFX_WideString& sError) 3705 bool Field::insertItemAt(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Va lue& vRet, CFX_WideString& sError)
3706 { 3706 {
3707 return TRUE; 3707 return true;
3708 } 3708 }
3709 3709
3710 FX_BOOL Field::isBoxChecked(IFXJS_Context* cc, const CJS_Parameters& params, CJS _Value& vRet, CFX_WideString& sError) 3710 bool Field::isBoxChecked(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Va lue& vRet, CFX_WideString& sError)
3711 { 3711 {
3712 ASSERT(m_pDocument != NULL); 3712 ASSERT(m_pDocument != NULL);
3713 3713
3714 int nIndex = -1; 3714 int nIndex = -1;
3715 if (params.size() >= 1) 3715 if (params.size() >= 1)
3716 nIndex = params[0].ToInt(); 3716 nIndex = params[0].ToInt();
3717 3717
3718 CFX_PtrArray FieldArray; 3718 CFX_PtrArray FieldArray;
3719 GetFormFields(m_FieldName,FieldArray); 3719 GetFormFields(m_FieldName,FieldArray);
3720 if (FieldArray.GetSize() <= 0) return FALSE; 3720 if (FieldArray.GetSize() <= 0) return false;
3721 3721
3722 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 3722 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
3723 ASSERT(pFormField != NULL); 3723 ASSERT(pFormField != NULL);
3724 3724
3725 if(nIndex <0 || nIndex >= pFormField->CountControls()) 3725 if(nIndex <0 || nIndex >= pFormField->CountControls())
3726 { 3726 {
3727 vRet = FALSE; 3727 vRet = false;
3728 return FALSE; 3728 return false;
3729 } 3729 }
3730 3730
3731 if ((pFormField->GetFieldType() == FIELDTYPE_CHECKBOX) 3731 if ((pFormField->GetFieldType() == FIELDTYPE_CHECKBOX)
3732 || (pFormField->GetFieldType() == FIELDTYPE_RADIOBUTTON)) 3732 || (pFormField->GetFieldType() == FIELDTYPE_RADIOBUTTON))
3733 { 3733 {
3734 if (pFormField->GetControl(nIndex)->IsChecked() !=0 ) 3734 if (pFormField->GetControl(nIndex)->IsChecked() !=0 )
3735 vRet = TRUE; 3735 vRet = true;
3736 else 3736 else
3737 vRet = FALSE; 3737 vRet = false;
3738 } 3738 }
3739 else 3739 else
3740 vRet = FALSE; 3740 vRet = false;
3741 3741
3742 return TRUE; 3742 return true;
3743 } 3743 }
3744 3744
3745 FX_BOOL Field::isDefaultChecked(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError) 3745 bool Field::isDefaultChecked(IFXJS_Context* cc, const CJS_Parameters& params, CJ S_Value& vRet, CFX_WideString& sError)
3746 { 3746 {
3747 ASSERT(m_pDocument != NULL); 3747 ASSERT(m_pDocument != NULL);
3748 3748
3749 int nIndex = -1; 3749 int nIndex = -1;
3750 if (params.size() >= 1) 3750 if (params.size() >= 1)
3751 nIndex = params[0].ToInt(); 3751 nIndex = params[0].ToInt();
3752 3752
3753 CFX_PtrArray FieldArray; 3753 CFX_PtrArray FieldArray;
3754 GetFormFields(m_FieldName,FieldArray); 3754 GetFormFields(m_FieldName,FieldArray);
3755 if (FieldArray.GetSize() <= 0) return FALSE; 3755 if (FieldArray.GetSize() <= 0) return false;
3756 3756
3757 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 3757 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
3758 ASSERT(pFormField != NULL); 3758 ASSERT(pFormField != NULL);
3759 3759
3760 if(nIndex <0 || nIndex >= pFormField->CountControls()) 3760 if(nIndex <0 || nIndex >= pFormField->CountControls())
3761 { 3761 {
3762 vRet = FALSE; 3762 vRet = false;
3763 return FALSE; 3763 return false;
3764 } 3764 }
3765 if ((pFormField->GetFieldType() == FIELDTYPE_CHECKBOX) 3765 if ((pFormField->GetFieldType() == FIELDTYPE_CHECKBOX)
3766 || (pFormField->GetFieldType() == FIELDTYPE_RADIOBUTTON)) 3766 || (pFormField->GetFieldType() == FIELDTYPE_RADIOBUTTON))
3767 { 3767 {
3768 if (pFormField->GetControl(nIndex)->IsDefaultChecked() != 0) 3768 if (pFormField->GetControl(nIndex)->IsDefaultChecked() != 0)
3769 vRet = TRUE; 3769 vRet = true;
3770 else 3770 else
3771 vRet = FALSE; 3771 vRet = false;
3772 } 3772 }
3773 else 3773 else
3774 vRet = FALSE; 3774 vRet = false;
3775 3775
3776 return TRUE; 3776 return true;
3777 } 3777 }
3778 3778
3779 FX_BOOL Field::setAction(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Va lue& vRet, CFX_WideString& sError) 3779 bool Field::setAction(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value & vRet, CFX_WideString& sError)
3780 { 3780 {
3781 return TRUE; 3781 return true;
3782 } 3782 }
3783 3783
3784 FX_BOOL Field::setFocus(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Val ue& vRet, CFX_WideString& sError) 3784 bool Field::setFocus(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
3785 { 3785 {
3786 ASSERT(m_pDocument != NULL); 3786 ASSERT(m_pDocument != NULL);
3787 3787
3788 CFX_PtrArray FieldArray; 3788 CFX_PtrArray FieldArray;
3789 GetFormFields(m_FieldName,FieldArray); 3789 GetFormFields(m_FieldName,FieldArray);
3790 if (FieldArray.GetSize() <= 0) return FALSE; 3790 if (FieldArray.GetSize() <= 0) return false;
3791 3791
3792 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 3792 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
3793 ASSERT(pFormField != NULL); 3793 ASSERT(pFormField != NULL);
3794 3794
3795 int32_t nCount = pFormField->CountControls(); 3795 int32_t nCount = pFormField->CountControls();
3796 3796
3797 if (nCount < 1) return FALSE; 3797 if (nCount < 1) return false;
3798 3798
3799 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInterFor m(); 3799 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInterFor m();
3800 ASSERT(pInterForm != NULL); 3800 ASSERT(pInterForm != NULL);
3801 3801
3802 CPDFSDK_Widget* pWidget = NULL; 3802 CPDFSDK_Widget* pWidget = NULL;
3803 if (nCount == 1) 3803 if (nCount == 1)
3804 { 3804 {
3805 pWidget = pInterForm->GetWidget(pFormField->GetControl(0)); 3805 pWidget = pInterForm->GetWidget(pFormField->GetControl(0));
3806 } 3806 }
3807 else 3807 else
3808 { 3808 {
3809 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); 3809 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv();
3810 ASSERT(pEnv); 3810 ASSERT(pEnv);
3811 CPDF_Page* pPage = (CPDF_Page*)pEnv->FFI_GetCurrentPage(m_pDocument->Get Document()); 3811 CPDF_Page* pPage = (CPDF_Page*)pEnv->FFI_GetCurrentPage(m_pDocument->Get Document());
3812 if(!pPage) 3812 if(!pPage)
3813 return FALSE; 3813 return false;
3814 if (CPDFSDK_PageView* pCurPageView = m_pDocument->GetPageView(pPage)) 3814 if (CPDFSDK_PageView* pCurPageView = m_pDocument->GetPageView(pPage))
3815 { 3815 {
3816 for (int32_t i=0; i<nCount; i++) 3816 for (int32_t i=0; i<nCount; i++)
3817 { 3817 {
3818 if (CPDFSDK_Widget* pTempWidget = pInterForm->GetWidget(pFormFi eld->GetControl(i))) 3818 if (CPDFSDK_Widget* pTempWidget = pInterForm->GetWidget(pFormFi eld->GetControl(i)))
3819 { 3819 {
3820 if (pTempWidget->GetPDFPage() == pCurPageView->GetPDFPage()) 3820 if (pTempWidget->GetPDFPage() == pCurPageView->GetPDFPage())
3821 { 3821 {
3822 pWidget = pTempWidget; 3822 pWidget = pTempWidget;
3823 break; 3823 break;
3824 } 3824 }
3825 } 3825 }
3826 } 3826 }
3827 } 3827 }
3828 } 3828 }
3829 3829
3830 if (pWidget) 3830 if (pWidget)
3831 { 3831 {
3832 m_pDocument->SetFocusAnnot(pWidget); 3832 m_pDocument->SetFocusAnnot(pWidget);
3833 } 3833 }
3834 3834
3835 return TRUE; 3835 return true;
3836 } 3836 }
3837 3837
3838 FX_BOOL Field::setItems(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Val ue& vRet, CFX_WideString& sError) 3838 bool Field::setItems(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
3839 { 3839 {
3840 return TRUE; 3840 return true;
3841 } 3841 }
3842 3842
3843 FX_BOOL Field::setLock(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Valu e& vRet, CFX_WideString& sError) 3843 bool Field::setLock(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
3844 { 3844 {
3845 return FALSE; 3845 return false;
3846 } 3846 }
3847 3847
3848 FX_BOOL Field::signatureGetModifications(IFXJS_Context* cc, const CJS_Parameters & params, CJS_Value& vRet, CFX_WideString& sError) 3848 bool Field::signatureGetModifications(IFXJS_Context* cc, const CJS_Parameters& p arams, CJS_Value& vRet, CFX_WideString& sError)
3849 { 3849 {
3850 return FALSE; 3850 return false;
3851 } 3851 }
3852 3852
3853 FX_BOOL Field::signatureGetSeedValue(IFXJS_Context* cc, const CJS_Parameters& pa rams, CJS_Value& vRet, CFX_WideString& sError) 3853 bool Field::signatureGetSeedValue(IFXJS_Context* cc, const CJS_Parameters& param s, CJS_Value& vRet, CFX_WideString& sError)
3854 { 3854 {
3855 return FALSE; 3855 return false;
3856 } 3856 }
3857 3857
3858 FX_BOOL Field::signatureInfo(IFXJS_Context* cc, const CJS_Parameters& params, CJ S_Value& vRet, CFX_WideString& sError) 3858 bool Field::signatureInfo(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V alue& vRet, CFX_WideString& sError)
3859 { 3859 {
3860 return FALSE; 3860 return false;
3861 } 3861 }
3862 3862
3863 FX_BOOL Field::signatureSetSeedValue(IFXJS_Context* cc, const CJS_Parameters& pa rams, CJS_Value& vRet, CFX_WideString& sError) 3863 bool Field::signatureSetSeedValue(IFXJS_Context* cc, const CJS_Parameters& param s, CJS_Value& vRet, CFX_WideString& sError)
3864 { 3864 {
3865 return FALSE; 3865 return false;
3866 } 3866 }
3867 3867
3868 FX_BOOL Field::signatureSign(IFXJS_Context* cc, const CJS_Parameters& params, CJ S_Value& vRet, CFX_WideString& sError) 3868 bool Field::signatureSign(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V alue& vRet, CFX_WideString& sError)
3869 { 3869 {
3870 return FALSE; 3870 return false;
3871 } 3871 }
3872 3872
3873 FX_BOOL Field::signatureValidate(IFXJS_Context* cc, const CJS_Parameters& params , CJS_Value& vRet, CFX_WideString& sError) 3873 bool Field::signatureValidate(IFXJS_Context* cc, const CJS_Parameters& params, C JS_Value& vRet, CFX_WideString& sError)
3874 { 3874 {
3875 return FALSE; 3875 return false;
3876 } 3876 }
3877 3877
3878 FX_BOOL Field::source(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErr or) 3878 bool Field::source(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
3879 { 3879 {
3880 if (vp.IsGetting()) 3880 if (vp.IsGetting())
3881 { 3881 {
3882 vp << (CJS_Object*)NULL; 3882 vp << (CJS_Object*)NULL;
3883 } 3883 }
3884 3884
3885 return TRUE; 3885 return true;
3886 } 3886 }
3887 3887
3888 /////////////////////////////////////////// delay ////////////////////////////// /////////////// 3888 /////////////////////////////////////////// delay ////////////////////////////// ///////////////
3889 3889
3890 void Field::AddDelay_Int(enum FIELD_PROP prop, int32_t n) 3890 void Field::AddDelay_Int(enum FIELD_PROP prop, int32_t n)
3891 { 3891 {
3892 ASSERT(m_pJSDoc != NULL); 3892 ASSERT(m_pJSDoc != NULL);
3893 3893
3894 CJS_DelayData* pNewData = new CJS_DelayData; 3894 CJS_DelayData* pNewData = new CJS_DelayData;
3895 pNewData->sFieldName = m_FieldName; 3895 pNewData->sFieldName = m_FieldName;
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
4107 4107
4108 #define JS_FIELD_MINWIDTH 1 4108 #define JS_FIELD_MINWIDTH 1
4109 #define JS_FIELD_MINHEIGHT 1 4109 #define JS_FIELD_MINHEIGHT 1
4110 4110
4111 void Field::AddField(CPDFSDK_Document* pDocument, int nPageIndex, int nFieldType , 4111 void Field::AddField(CPDFSDK_Document* pDocument, int nPageIndex, int nFieldType ,
4112 const CFX_WideString& sName, const CPDF_Rect& rcCoords) 4112 const CFX_WideString& sName, const CPDF_Rect& rcCoords)
4113 { 4113 {
4114 //Not supported. 4114 //Not supported.
4115 } 4115 }
4116 4116
OLDNEW
« no previous file with comments | « fpdfsdk/src/javascript/Document.cpp ('k') | fpdfsdk/src/javascript/Icon.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698