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

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

Issue 1529553003: Merge to XFA: Get rid of most instance of 'foo != NULL' (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years 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
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 "Field.h" 7 #include "Field.h"
8 8
9 #include "Document.h" 9 #include "Document.h"
10 #include "Icon.h" 10 #include "Icon.h"
11 #include "JS_Context.h" 11 #include "JS_Context.h"
12 #include "JS_Define.h" 12 #include "JS_Define.h"
13 #include "JS_EventHandler.h" 13 #include "JS_EventHandler.h"
14 #include "JS_Object.h" 14 #include "JS_Object.h"
15 #include "JS_Runtime.h" 15 #include "JS_Runtime.h"
16 #include "JS_Value.h" 16 #include "JS_Value.h"
17 #include "PublicMethods.h" 17 #include "PublicMethods.h"
18 #include "color.h" 18 #include "color.h"
19 #include "fpdfsdk/include/fsdk_mgr.h" // For CPDFDoc_Environment. 19 #include "fpdfsdk/include/fsdk_mgr.h" // For CPDFDoc_Environment.
20 #include "fpdfsdk/include/javascript/IJavaScript.h" 20 #include "fpdfsdk/include/javascript/IJavaScript.h"
21 21
22 /* ---------------------- Field ---------------------- */
23
24 BEGIN_JS_STATIC_CONST(CJS_Field) 22 BEGIN_JS_STATIC_CONST(CJS_Field)
25 END_JS_STATIC_CONST() 23 END_JS_STATIC_CONST()
26 24
27 BEGIN_JS_STATIC_PROP(CJS_Field) 25 BEGIN_JS_STATIC_PROP(CJS_Field)
28 JS_STATIC_PROP_ENTRY(alignment) 26 JS_STATIC_PROP_ENTRY(alignment)
29 JS_STATIC_PROP_ENTRY(borderStyle) 27 JS_STATIC_PROP_ENTRY(borderStyle)
30 JS_STATIC_PROP_ENTRY(buttonAlignX) 28 JS_STATIC_PROP_ENTRY(buttonAlignX)
31 JS_STATIC_PROP_ENTRY(buttonAlignY) 29 JS_STATIC_PROP_ENTRY(buttonAlignY)
32 JS_STATIC_PROP_ENTRY(buttonFitBounds) 30 JS_STATIC_PROP_ENTRY(buttonFitBounds)
33 JS_STATIC_PROP_ENTRY(buttonPosition) 31 JS_STATIC_PROP_ENTRY(buttonPosition)
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 strFieldName = strFieldNameParsed; 147 strFieldName = strFieldNameParsed;
150 iControlNo = -1; 148 iControlNo = -1;
151 return; 149 return;
152 } 150 }
153 } 151 }
154 strFieldName = strFieldNameParsed.substr(0, iStart); 152 strFieldName = strFieldNameParsed.substr(0, iStart);
155 } 153 }
156 154
157 FX_BOOL Field::AttachField(Document* pDocument, 155 FX_BOOL Field::AttachField(Document* pDocument,
158 const CFX_WideString& csFieldName) { 156 const CFX_WideString& csFieldName) {
159 ASSERT(pDocument != NULL);
160 m_pJSDoc = pDocument; 157 m_pJSDoc = pDocument;
161
162 m_pDocument = pDocument->GetReaderDoc(); 158 m_pDocument = pDocument->GetReaderDoc();
163 ASSERT(m_pDocument != NULL);
164
165 m_bCanSet = m_pDocument->GetPermissions(FPDFPERM_FILL_FORM) || 159 m_bCanSet = m_pDocument->GetPermissions(FPDFPERM_FILL_FORM) ||
166 m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM) || 160 m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM) ||
167 m_pDocument->GetPermissions(FPDFPERM_MODIFY); 161 m_pDocument->GetPermissions(FPDFPERM_MODIFY);
168 162
169 CPDFSDK_InterForm* pRDInterForm = m_pDocument->GetInterForm(); 163 CPDFSDK_InterForm* pRDInterForm = m_pDocument->GetInterForm();
170 ASSERT(pRDInterForm != NULL);
171
172 CPDF_InterForm* pInterForm = pRDInterForm->GetInterForm(); 164 CPDF_InterForm* pInterForm = pRDInterForm->GetInterForm();
173 ASSERT(pInterForm != NULL);
174
175 CFX_WideString swFieldNameTemp = csFieldName; 165 CFX_WideString swFieldNameTemp = csFieldName;
176 swFieldNameTemp.Replace(L"..", L"."); 166 swFieldNameTemp.Replace(L"..", L".");
177 167
178 if (pInterForm->CountFields(swFieldNameTemp) <= 0) { 168 if (pInterForm->CountFields(swFieldNameTemp) <= 0) {
179 std::wstring strFieldName; 169 std::wstring strFieldName;
180 int iControlNo = -1; 170 int iControlNo = -1;
181 ParseFieldName(swFieldNameTemp.c_str(), strFieldName, iControlNo); 171 ParseFieldName(swFieldNameTemp.c_str(), strFieldName, iControlNo);
182 if (iControlNo == -1) 172 if (iControlNo == -1)
183 return FALSE; 173 return FALSE;
184 174
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 234
245 if (bChangeMark) 235 if (bChangeMark)
246 pDocument->SetChangeMark(); 236 pDocument->SetChangeMark();
247 } 237 }
248 238
249 void Field::UpdateFormControl(CPDFSDK_Document* pDocument, 239 void Field::UpdateFormControl(CPDFSDK_Document* pDocument,
250 CPDF_FormControl* pFormControl, 240 CPDF_FormControl* pFormControl,
251 FX_BOOL bChangeMark, 241 FX_BOOL bChangeMark,
252 FX_BOOL bResetAP, 242 FX_BOOL bResetAP,
253 FX_BOOL bRefresh) { 243 FX_BOOL bRefresh) {
254 ASSERT(pDocument != NULL); 244 ASSERT(pFormControl);
255 ASSERT(pFormControl != NULL);
256 245
257 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); 246 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm();
258 ASSERT(pInterForm != NULL);
259
260 CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl); 247 CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl);
261 248
262 if (pWidget) { 249 if (pWidget) {
263 if (bResetAP) { 250 if (bResetAP) {
264 int nFieldType = pWidget->GetFieldType(); 251 int nFieldType = pWidget->GetFieldType();
265 if (nFieldType == FIELDTYPE_COMBOBOX || 252 if (nFieldType == FIELDTYPE_COMBOBOX ||
266 nFieldType == FIELDTYPE_TEXTFIELD) { 253 nFieldType == FIELDTYPE_TEXTFIELD) {
267 FX_BOOL bFormated = FALSE; 254 FX_BOOL bFormated = FALSE;
268 CFX_WideString sValue = pWidget->OnFormat(bFormated); 255 CFX_WideString sValue = pWidget->OnFormat(bFormated);
269 if (bFormated) 256 if (bFormated)
270 pWidget->ResetAppearance(sValue.c_str(), FALSE); 257 pWidget->ResetAppearance(sValue.c_str(), FALSE);
271 else 258 else
272 pWidget->ResetAppearance(NULL, FALSE); 259 pWidget->ResetAppearance(NULL, FALSE);
273 } else { 260 } else {
274 pWidget->ResetAppearance(NULL, FALSE); 261 pWidget->ResetAppearance(NULL, FALSE);
275 } 262 }
276 } 263 }
277 264
278 if (bRefresh) { 265 if (bRefresh) {
279 CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm(); 266 CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm();
280 CPDFSDK_Document* pDoc = pInterForm->GetDocument(); 267 CPDFSDK_Document* pDoc = pInterForm->GetDocument();
281 ASSERT(pDoc != NULL);
282 pDoc->UpdateAllViews(NULL, pWidget); 268 pDoc->UpdateAllViews(NULL, pWidget);
283 } 269 }
284 } 270 }
285 271
286 if (bChangeMark) 272 if (bChangeMark)
287 pDocument->SetChangeMark(); 273 pDocument->SetChangeMark();
288 } 274 }
289 275
290 CPDFSDK_Widget* Field::GetWidget(CPDFSDK_Document* pDocument, 276 CPDFSDK_Widget* Field::GetWidget(CPDFSDK_Document* pDocument,
291 CPDF_FormControl* pFormControl) { 277 CPDF_FormControl* pFormControl) {
292 CPDFSDK_InterForm* pInterForm = 278 CPDFSDK_InterForm* pInterForm =
293 static_cast<CPDFSDK_InterForm*>(pDocument->GetInterForm()); 279 static_cast<CPDFSDK_InterForm*>(pDocument->GetInterForm());
294 return pInterForm ? pInterForm->GetWidget(pFormControl) : nullptr; 280 return pInterForm ? pInterForm->GetWidget(pFormControl) : nullptr;
295 } 281 }
296 282
297 FX_BOOL Field::ValueIsOccur(CPDF_FormField* pFormField, 283 FX_BOOL Field::ValueIsOccur(CPDF_FormField* pFormField,
298 CFX_WideString csOptLabel) { 284 CFX_WideString csOptLabel) {
299 ASSERT(pFormField != NULL);
300
301 for (int i = 0, sz = pFormField->CountOptions(); i < sz; i++) { 285 for (int i = 0, sz = pFormField->CountOptions(); i < sz; i++) {
302 if (csOptLabel.Compare(pFormField->GetOptionLabel(i)) == 0) 286 if (csOptLabel.Compare(pFormField->GetOptionLabel(i)) == 0)
303 return TRUE; 287 return TRUE;
304 } 288 }
305 289
306 return FALSE; 290 return FALSE;
307 } 291 }
308 292
309 CPDF_FormControl* Field::GetSmartFieldControl(CPDF_FormField* pFormField) { 293 CPDF_FormControl* Field::GetSmartFieldControl(CPDF_FormField* pFormField) {
310 if (!pFormField->CountControls() || 294 if (!pFormField->CountControls() ||
311 m_nFormControlIndex >= pFormField->CountControls()) 295 m_nFormControlIndex >= pFormField->CountControls())
312 return NULL; 296 return NULL;
313 297
314 if (m_nFormControlIndex < 0) 298 if (m_nFormControlIndex < 0)
315 return pFormField->GetControl(0); 299 return pFormField->GetControl(0);
316 300
317 return pFormField->GetControl(m_nFormControlIndex); 301 return pFormField->GetControl(m_nFormControlIndex);
318 } 302 }
319 303
320 /* ---------------------------------------- property
321 * ---------------------------------------- */
322
323 FX_BOOL Field::alignment(IJS_Context* cc, 304 FX_BOOL Field::alignment(IJS_Context* cc,
324 CJS_PropValue& vp, 305 CJS_PropValue& vp,
325 CFX_WideString& sError) { 306 CFX_WideString& sError) {
326 ASSERT(m_pDocument != NULL); 307 ASSERT(m_pDocument);
327 308
328 if (vp.IsSetting()) { 309 if (vp.IsSetting()) {
329 if (!m_bCanSet) 310 if (!m_bCanSet)
330 return FALSE; 311 return FALSE;
331 312
332 CFX_ByteString alignStr; 313 CFX_ByteString alignStr;
333 vp >> alignStr; 314 vp >> alignStr;
334 315
335 if (m_bDelay) { 316 if (m_bDelay) {
336 AddDelay_String(FP_ALIGNMENT, alignStr); 317 AddDelay_String(FP_ALIGNMENT, alignStr);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 void Field::SetAlignment(CPDFSDK_Document* pDocument, 353 void Field::SetAlignment(CPDFSDK_Document* pDocument,
373 const CFX_WideString& swFieldName, 354 const CFX_WideString& swFieldName,
374 int nControlIndex, 355 int nControlIndex,
375 const CFX_ByteString& string) { 356 const CFX_ByteString& string) {
376 // Not supported. 357 // Not supported.
377 } 358 }
378 359
379 FX_BOOL Field::borderStyle(IJS_Context* cc, 360 FX_BOOL Field::borderStyle(IJS_Context* cc,
380 CJS_PropValue& vp, 361 CJS_PropValue& vp,
381 CFX_WideString& sError) { 362 CFX_WideString& sError) {
382 ASSERT(m_pDocument != NULL); 363 ASSERT(m_pDocument);
383 364
384 if (vp.IsSetting()) { 365 if (vp.IsSetting()) {
385 if (!m_bCanSet) 366 if (!m_bCanSet)
386 return FALSE; 367 return FALSE;
387 368
388 CFX_ByteString strType = ""; 369 CFX_ByteString strType = "";
389 vp >> strType; 370 vp >> strType;
390 371
391 if (m_bDelay) { 372 if (m_bDelay) {
392 AddDelay_String(FP_BORDERSTYLE, strType); 373 AddDelay_String(FP_BORDERSTYLE, strType);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 } 413 }
433 } 414 }
434 415
435 return TRUE; 416 return TRUE;
436 } 417 }
437 418
438 void Field::SetBorderStyle(CPDFSDK_Document* pDocument, 419 void Field::SetBorderStyle(CPDFSDK_Document* pDocument,
439 const CFX_WideString& swFieldName, 420 const CFX_WideString& swFieldName,
440 int nControlIndex, 421 int nControlIndex,
441 const CFX_ByteString& string) { 422 const CFX_ByteString& string) {
442 ASSERT(pDocument != NULL); 423 ASSERT(pDocument);
443 424
444 int nBorderStyle = 0; 425 int nBorderStyle = 0;
445 426
446 if (string == "solid") 427 if (string == "solid")
447 nBorderStyle = BBS_SOLID; 428 nBorderStyle = BBS_SOLID;
448 else if (string == "beveled") 429 else if (string == "beveled")
449 nBorderStyle = BBS_BEVELED; 430 nBorderStyle = BBS_BEVELED;
450 else if (string == "dashed") 431 else if (string == "dashed")
451 nBorderStyle = BBS_DASH; 432 nBorderStyle = BBS_DASH;
452 else if (string == "inset") 433 else if (string == "inset")
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 } 465 }
485 } 466 }
486 } 467 }
487 } 468 }
488 } 469 }
489 } 470 }
490 471
491 FX_BOOL Field::buttonAlignX(IJS_Context* cc, 472 FX_BOOL Field::buttonAlignX(IJS_Context* cc,
492 CJS_PropValue& vp, 473 CJS_PropValue& vp,
493 CFX_WideString& sError) { 474 CFX_WideString& sError) {
494 ASSERT(m_pDocument != NULL); 475 ASSERT(m_pDocument);
495 476
496 if (vp.IsSetting()) { 477 if (vp.IsSetting()) {
497 if (!m_bCanSet) 478 if (!m_bCanSet)
498 return FALSE; 479 return FALSE;
499 480
500 int nVP; 481 int nVP;
501 vp >> nVP; 482 vp >> nVP;
502 483
503 if (m_bDelay) { 484 if (m_bDelay) {
504 AddDelay_Int(FP_BUTTONALIGNX, nVP); 485 AddDelay_Int(FP_BUTTONALIGNX, nVP);
(...skipping 28 matching lines...) Expand all
533 void Field::SetButtonAlignX(CPDFSDK_Document* pDocument, 514 void Field::SetButtonAlignX(CPDFSDK_Document* pDocument,
534 const CFX_WideString& swFieldName, 515 const CFX_WideString& swFieldName,
535 int nControlIndex, 516 int nControlIndex,
536 int number) { 517 int number) {
537 // Not supported. 518 // Not supported.
538 } 519 }
539 520
540 FX_BOOL Field::buttonAlignY(IJS_Context* cc, 521 FX_BOOL Field::buttonAlignY(IJS_Context* cc,
541 CJS_PropValue& vp, 522 CJS_PropValue& vp,
542 CFX_WideString& sError) { 523 CFX_WideString& sError) {
543 ASSERT(m_pDocument != NULL); 524 ASSERT(m_pDocument);
544 525
545 if (vp.IsSetting()) { 526 if (vp.IsSetting()) {
546 if (!m_bCanSet) 527 if (!m_bCanSet)
547 return FALSE; 528 return FALSE;
548 529
549 int nVP; 530 int nVP;
550 vp >> nVP; 531 vp >> nVP;
551 532
552 if (m_bDelay) { 533 if (m_bDelay) {
553 AddDelay_Int(FP_BUTTONALIGNY, nVP); 534 AddDelay_Int(FP_BUTTONALIGNY, nVP);
(...skipping 28 matching lines...) Expand all
582 void Field::SetButtonAlignY(CPDFSDK_Document* pDocument, 563 void Field::SetButtonAlignY(CPDFSDK_Document* pDocument,
583 const CFX_WideString& swFieldName, 564 const CFX_WideString& swFieldName,
584 int nControlIndex, 565 int nControlIndex,
585 int number) { 566 int number) {
586 // Not supported. 567 // Not supported.
587 } 568 }
588 569
589 FX_BOOL Field::buttonFitBounds(IJS_Context* cc, 570 FX_BOOL Field::buttonFitBounds(IJS_Context* cc,
590 CJS_PropValue& vp, 571 CJS_PropValue& vp,
591 CFX_WideString& sError) { 572 CFX_WideString& sError) {
592 ASSERT(m_pDocument != NULL); 573 ASSERT(m_pDocument);
593 574
594 if (vp.IsSetting()) { 575 if (vp.IsSetting()) {
595 if (!m_bCanSet) 576 if (!m_bCanSet)
596 return FALSE; 577 return FALSE;
597 578
598 bool bVP; 579 bool bVP;
599 vp >> bVP; 580 vp >> bVP;
600 581
601 if (m_bDelay) { 582 if (m_bDelay) {
602 AddDelay_Bool(FP_BUTTONFITBOUNDS, bVP); 583 AddDelay_Bool(FP_BUTTONFITBOUNDS, bVP);
(...skipping 24 matching lines...) Expand all
627 void Field::SetButtonFitBounds(CPDFSDK_Document* pDocument, 608 void Field::SetButtonFitBounds(CPDFSDK_Document* pDocument,
628 const CFX_WideString& swFieldName, 609 const CFX_WideString& swFieldName,
629 int nControlIndex, 610 int nControlIndex,
630 bool b) { 611 bool b) {
631 // Not supported. 612 // Not supported.
632 } 613 }
633 614
634 FX_BOOL Field::buttonPosition(IJS_Context* cc, 615 FX_BOOL Field::buttonPosition(IJS_Context* cc,
635 CJS_PropValue& vp, 616 CJS_PropValue& vp,
636 CFX_WideString& sError) { 617 CFX_WideString& sError) {
637 ASSERT(m_pDocument != NULL); 618 ASSERT(m_pDocument);
638 619
639 if (vp.IsSetting()) { 620 if (vp.IsSetting()) {
640 if (!m_bCanSet) 621 if (!m_bCanSet)
641 return FALSE; 622 return FALSE;
642 623
643 int nVP; 624 int nVP;
644 vp >> nVP; 625 vp >> nVP;
645 626
646 if (m_bDelay) { 627 if (m_bDelay) {
647 AddDelay_Int(FP_BUTTONPOSITION, nVP); 628 AddDelay_Int(FP_BUTTONPOSITION, nVP);
(...skipping 22 matching lines...) Expand all
670 void Field::SetButtonPosition(CPDFSDK_Document* pDocument, 651 void Field::SetButtonPosition(CPDFSDK_Document* pDocument,
671 const CFX_WideString& swFieldName, 652 const CFX_WideString& swFieldName,
672 int nControlIndex, 653 int nControlIndex,
673 int number) { 654 int number) {
674 // Not supported. 655 // Not supported.
675 } 656 }
676 657
677 FX_BOOL Field::buttonScaleHow(IJS_Context* cc, 658 FX_BOOL Field::buttonScaleHow(IJS_Context* cc,
678 CJS_PropValue& vp, 659 CJS_PropValue& vp,
679 CFX_WideString& sError) { 660 CFX_WideString& sError) {
680 ASSERT(m_pDocument != NULL); 661 ASSERT(m_pDocument);
681 662
682 if (vp.IsSetting()) { 663 if (vp.IsSetting()) {
683 if (!m_bCanSet) 664 if (!m_bCanSet)
684 return FALSE; 665 return FALSE;
685 666
686 int nVP; 667 int nVP;
687 vp >> nVP; 668 vp >> nVP;
688 669
689 if (m_bDelay) { 670 if (m_bDelay) {
690 AddDelay_Int(FP_BUTTONSCALEHOW, nVP); 671 AddDelay_Int(FP_BUTTONSCALEHOW, nVP);
(...skipping 27 matching lines...) Expand all
718 void Field::SetButtonScaleHow(CPDFSDK_Document* pDocument, 699 void Field::SetButtonScaleHow(CPDFSDK_Document* pDocument,
719 const CFX_WideString& swFieldName, 700 const CFX_WideString& swFieldName,
720 int nControlIndex, 701 int nControlIndex,
721 int number) { 702 int number) {
722 // Not supported. 703 // Not supported.
723 } 704 }
724 705
725 FX_BOOL Field::buttonScaleWhen(IJS_Context* cc, 706 FX_BOOL Field::buttonScaleWhen(IJS_Context* cc,
726 CJS_PropValue& vp, 707 CJS_PropValue& vp,
727 CFX_WideString& sError) { 708 CFX_WideString& sError) {
728 ASSERT(m_pDocument != NULL); 709 ASSERT(m_pDocument);
729 710
730 if (vp.IsSetting()) { 711 if (vp.IsSetting()) {
731 if (!m_bCanSet) 712 if (!m_bCanSet)
732 return FALSE; 713 return FALSE;
733 714
734 int nVP; 715 int nVP;
735 vp >> nVP; 716 vp >> nVP;
736 717
737 if (m_bDelay) { 718 if (m_bDelay) {
738 AddDelay_Int(FP_BUTTONSCALEWHEN, nVP); 719 AddDelay_Int(FP_BUTTONSCALEWHEN, nVP);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 void Field::SetButtonScaleWhen(CPDFSDK_Document* pDocument, 758 void Field::SetButtonScaleWhen(CPDFSDK_Document* pDocument,
778 const CFX_WideString& swFieldName, 759 const CFX_WideString& swFieldName,
779 int nControlIndex, 760 int nControlIndex,
780 int number) { 761 int number) {
781 // Not supported. 762 // Not supported.
782 } 763 }
783 764
784 FX_BOOL Field::calcOrderIndex(IJS_Context* cc, 765 FX_BOOL Field::calcOrderIndex(IJS_Context* cc,
785 CJS_PropValue& vp, 766 CJS_PropValue& vp,
786 CFX_WideString& sError) { 767 CFX_WideString& sError) {
787 ASSERT(m_pDocument != NULL); 768 ASSERT(m_pDocument);
788 769
789 if (vp.IsSetting()) { 770 if (vp.IsSetting()) {
790 if (!m_bCanSet) 771 if (!m_bCanSet)
791 return FALSE; 772 return FALSE;
792 773
793 int nVP; 774 int nVP;
794 vp >> nVP; 775 vp >> nVP;
795 776
796 if (m_bDelay) { 777 if (m_bDelay) {
797 AddDelay_Int(FP_CALCORDERINDEX, nVP); 778 AddDelay_Int(FP_CALCORDERINDEX, nVP);
798 } else { 779 } else {
799 Field::SetCalcOrderIndex(m_pDocument, m_FieldName, m_nFormControlIndex, 780 Field::SetCalcOrderIndex(m_pDocument, m_FieldName, m_nFormControlIndex,
800 nVP); 781 nVP);
801 } 782 }
802 } else { 783 } else {
803 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 784 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
804 if (FieldArray.empty()) 785 if (FieldArray.empty())
805 return FALSE; 786 return FALSE;
806 787
807 CPDF_FormField* pFormField = FieldArray[0]; 788 CPDF_FormField* pFormField = FieldArray[0];
808 if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX && 789 if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX &&
809 pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) { 790 pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) {
810 return FALSE; 791 return FALSE;
811 } 792 }
812 793
813 CPDFSDK_InterForm* pRDInterForm = m_pDocument->GetInterForm(); 794 CPDFSDK_InterForm* pRDInterForm = m_pDocument->GetInterForm();
814 ASSERT(pRDInterForm != NULL);
815
816 CPDF_InterForm* pInterForm = pRDInterForm->GetInterForm(); 795 CPDF_InterForm* pInterForm = pRDInterForm->GetInterForm();
817 ASSERT(pInterForm != NULL);
818
819 vp << (int32_t)pInterForm->FindFieldInCalculationOrder(pFormField); 796 vp << (int32_t)pInterForm->FindFieldInCalculationOrder(pFormField);
820 } 797 }
821 798
822 return TRUE; 799 return TRUE;
823 } 800 }
824 801
825 void Field::SetCalcOrderIndex(CPDFSDK_Document* pDocument, 802 void Field::SetCalcOrderIndex(CPDFSDK_Document* pDocument,
826 const CFX_WideString& swFieldName, 803 const CFX_WideString& swFieldName,
827 int nControlIndex, 804 int nControlIndex,
828 int number) { 805 int number) {
829 // Not supported. 806 // Not supported.
830 } 807 }
831 808
832 FX_BOOL Field::charLimit(IJS_Context* cc, 809 FX_BOOL Field::charLimit(IJS_Context* cc,
833 CJS_PropValue& vp, 810 CJS_PropValue& vp,
834 CFX_WideString& sError) { 811 CFX_WideString& sError) {
835 ASSERT(m_pDocument != NULL); 812 ASSERT(m_pDocument);
836 813
837 if (vp.IsSetting()) { 814 if (vp.IsSetting()) {
838 if (!m_bCanSet) 815 if (!m_bCanSet)
839 return FALSE; 816 return FALSE;
840 817
841 int nVP; 818 int nVP;
842 vp >> nVP; 819 vp >> nVP;
843 820
844 if (m_bDelay) { 821 if (m_bDelay) {
845 AddDelay_Int(FP_CHARLIMIT, nVP); 822 AddDelay_Int(FP_CHARLIMIT, nVP);
(...skipping 17 matching lines...) Expand all
863 void Field::SetCharLimit(CPDFSDK_Document* pDocument, 840 void Field::SetCharLimit(CPDFSDK_Document* pDocument,
864 const CFX_WideString& swFieldName, 841 const CFX_WideString& swFieldName,
865 int nControlIndex, 842 int nControlIndex,
866 int number) { 843 int number) {
867 // Not supported. 844 // Not supported.
868 } 845 }
869 846
870 FX_BOOL Field::comb(IJS_Context* cc, 847 FX_BOOL Field::comb(IJS_Context* cc,
871 CJS_PropValue& vp, 848 CJS_PropValue& vp,
872 CFX_WideString& sError) { 849 CFX_WideString& sError) {
873 ASSERT(m_pDocument != NULL); 850 ASSERT(m_pDocument);
874 851
875 if (vp.IsSetting()) { 852 if (vp.IsSetting()) {
876 if (!m_bCanSet) 853 if (!m_bCanSet)
877 return FALSE; 854 return FALSE;
878 855
879 bool bVP; 856 bool bVP;
880 vp >> bVP; 857 vp >> bVP;
881 858
882 if (m_bDelay) { 859 if (m_bDelay) {
883 AddDelay_Bool(FP_COMB, bVP); 860 AddDelay_Bool(FP_COMB, bVP);
(...skipping 21 matching lines...) Expand all
905 void Field::SetComb(CPDFSDK_Document* pDocument, 882 void Field::SetComb(CPDFSDK_Document* pDocument,
906 const CFX_WideString& swFieldName, 883 const CFX_WideString& swFieldName,
907 int nControlIndex, 884 int nControlIndex,
908 bool b) { 885 bool b) {
909 // Not supported. 886 // Not supported.
910 } 887 }
911 888
912 FX_BOOL Field::commitOnSelChange(IJS_Context* cc, 889 FX_BOOL Field::commitOnSelChange(IJS_Context* cc,
913 CJS_PropValue& vp, 890 CJS_PropValue& vp,
914 CFX_WideString& sError) { 891 CFX_WideString& sError) {
915 ASSERT(m_pDocument != NULL); 892 ASSERT(m_pDocument);
916 893
917 if (vp.IsSetting()) { 894 if (vp.IsSetting()) {
918 if (!m_bCanSet) 895 if (!m_bCanSet)
919 return FALSE; 896 return FALSE;
920 897
921 bool bVP; 898 bool bVP;
922 vp >> bVP; 899 vp >> bVP;
923 900
924 if (m_bDelay) { 901 if (m_bDelay) {
925 AddDelay_Bool(FP_COMMITONSELCHANGE, bVP); 902 AddDelay_Bool(FP_COMMITONSELCHANGE, bVP);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 } 989 }
1013 } 990 }
1014 991
1015 return TRUE; 992 return TRUE;
1016 } 993 }
1017 994
1018 void Field::SetCurrentValueIndices(CPDFSDK_Document* pDocument, 995 void Field::SetCurrentValueIndices(CPDFSDK_Document* pDocument,
1019 const CFX_WideString& swFieldName, 996 const CFX_WideString& swFieldName,
1020 int nControlIndex, 997 int nControlIndex,
1021 const CFX_DWordArray& array) { 998 const CFX_DWordArray& array) {
1022 ASSERT(pDocument != NULL); 999 ASSERT(pDocument);
1023 1000
1024 std::vector<CPDF_FormField*> FieldArray = 1001 std::vector<CPDF_FormField*> FieldArray =
1025 GetFormFields(pDocument, swFieldName); 1002 GetFormFields(pDocument, swFieldName);
1026 for (CPDF_FormField* pFormField : FieldArray) { 1003 for (CPDF_FormField* pFormField : FieldArray) {
1027 int nFieldType = pFormField->GetFieldType(); 1004 int nFieldType = pFormField->GetFieldType();
1028 if (nFieldType == FIELDTYPE_COMBOBOX || nFieldType == FIELDTYPE_LISTBOX) { 1005 if (nFieldType == FIELDTYPE_COMBOBOX || nFieldType == FIELDTYPE_LISTBOX) {
1029 FX_DWORD dwFieldFlags = pFormField->GetFieldFlags(); 1006 FX_DWORD dwFieldFlags = pFormField->GetFieldFlags();
1030 pFormField->ClearSelection(TRUE); 1007 pFormField->ClearSelection(TRUE);
1031 1008
1032 for (int i = 0, sz = array.GetSize(); i < sz; i++) { 1009 for (int i = 0, sz = array.GetSize(); i < sz; i++) {
(...skipping 19 matching lines...) Expand all
1052 1029
1053 void Field::SetDefaultStyle(CPDFSDK_Document* pDocument, 1030 void Field::SetDefaultStyle(CPDFSDK_Document* pDocument,
1054 const CFX_WideString& swFieldName, 1031 const CFX_WideString& swFieldName,
1055 int nControlIndex) { 1032 int nControlIndex) {
1056 // Not supported. 1033 // Not supported.
1057 } 1034 }
1058 1035
1059 FX_BOOL Field::defaultValue(IJS_Context* cc, 1036 FX_BOOL Field::defaultValue(IJS_Context* cc,
1060 CJS_PropValue& vp, 1037 CJS_PropValue& vp,
1061 CFX_WideString& sError) { 1038 CFX_WideString& sError) {
1062 ASSERT(m_pDocument != NULL); 1039 ASSERT(m_pDocument);
1063 1040
1064 if (vp.IsSetting()) { 1041 if (vp.IsSetting()) {
1065 if (!m_bCanSet) 1042 if (!m_bCanSet)
1066 return FALSE; 1043 return FALSE;
1067 1044
1068 CFX_WideString WideStr; 1045 CFX_WideString WideStr;
1069 vp >> WideStr; 1046 vp >> WideStr;
1070 1047
1071 if (m_bDelay) { 1048 if (m_bDelay) {
1072 AddDelay_WideString(FP_DEFAULTVALUE, WideStr); 1049 AddDelay_WideString(FP_DEFAULTVALUE, WideStr);
(...skipping 20 matching lines...) Expand all
1093 void Field::SetDefaultValue(CPDFSDK_Document* pDocument, 1070 void Field::SetDefaultValue(CPDFSDK_Document* pDocument,
1094 const CFX_WideString& swFieldName, 1071 const CFX_WideString& swFieldName,
1095 int nControlIndex, 1072 int nControlIndex,
1096 const CFX_WideString& string) { 1073 const CFX_WideString& string) {
1097 // Not supported. 1074 // Not supported.
1098 } 1075 }
1099 1076
1100 FX_BOOL Field::doNotScroll(IJS_Context* cc, 1077 FX_BOOL Field::doNotScroll(IJS_Context* cc,
1101 CJS_PropValue& vp, 1078 CJS_PropValue& vp,
1102 CFX_WideString& sError) { 1079 CFX_WideString& sError) {
1103 ASSERT(m_pDocument != NULL); 1080 ASSERT(m_pDocument);
1104 1081
1105 if (vp.IsSetting()) { 1082 if (vp.IsSetting()) {
1106 if (!m_bCanSet) 1083 if (!m_bCanSet)
1107 return FALSE; 1084 return FALSE;
1108 1085
1109 bool bVP; 1086 bool bVP;
1110 vp >> bVP; 1087 vp >> bVP;
1111 1088
1112 if (m_bDelay) { 1089 if (m_bDelay) {
1113 AddDelay_Bool(FP_DONOTSCROLL, bVP); 1090 AddDelay_Bool(FP_DONOTSCROLL, bVP);
(...skipping 21 matching lines...) Expand all
1135 void Field::SetDoNotScroll(CPDFSDK_Document* pDocument, 1112 void Field::SetDoNotScroll(CPDFSDK_Document* pDocument,
1136 const CFX_WideString& swFieldName, 1113 const CFX_WideString& swFieldName,
1137 int nControlIndex, 1114 int nControlIndex,
1138 bool b) { 1115 bool b) {
1139 // Not supported. 1116 // Not supported.
1140 } 1117 }
1141 1118
1142 FX_BOOL Field::doNotSpellCheck(IJS_Context* cc, 1119 FX_BOOL Field::doNotSpellCheck(IJS_Context* cc,
1143 CJS_PropValue& vp, 1120 CJS_PropValue& vp,
1144 CFX_WideString& sError) { 1121 CFX_WideString& sError) {
1145 ASSERT(m_pDocument != NULL); 1122 ASSERT(m_pDocument);
1146 1123
1147 if (vp.IsSetting()) { 1124 if (vp.IsSetting()) {
1148 if (!m_bCanSet) 1125 if (!m_bCanSet)
1149 return FALSE; 1126 return FALSE;
1150 1127
1151 bool bVP; 1128 bool bVP;
1152 vp >> bVP; 1129 vp >> bVP;
1153 } else { 1130 } else {
1154 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 1131 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
1155 if (FieldArray.empty()) 1132 if (FieldArray.empty())
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 SetDelay(bVP); 1169 SetDelay(bVP);
1193 } else { 1170 } else {
1194 vp << m_bDelay; 1171 vp << m_bDelay;
1195 } 1172 }
1196 return TRUE; 1173 return TRUE;
1197 } 1174 }
1198 1175
1199 FX_BOOL Field::display(IJS_Context* cc, 1176 FX_BOOL Field::display(IJS_Context* cc,
1200 CJS_PropValue& vp, 1177 CJS_PropValue& vp,
1201 CFX_WideString& sError) { 1178 CFX_WideString& sError) {
1202 ASSERT(m_pDocument != NULL);
1203
1204 if (vp.IsSetting()) { 1179 if (vp.IsSetting()) {
1205 if (!m_bCanSet) 1180 if (!m_bCanSet)
1206 return FALSE; 1181 return FALSE;
1207 1182
1208 int nVP; 1183 int nVP;
1209 vp >> nVP; 1184 vp >> nVP;
1210 1185
1211 if (m_bDelay) { 1186 if (m_bDelay) {
1212 AddDelay_Int(FP_DISPLAY, nVP); 1187 AddDelay_Int(FP_DISPLAY, nVP);
1213 } else { 1188 } else {
(...skipping 30 matching lines...) Expand all
1244 } 1219 }
1245 } 1220 }
1246 1221
1247 return TRUE; 1222 return TRUE;
1248 } 1223 }
1249 1224
1250 void Field::SetDisplay(CPDFSDK_Document* pDocument, 1225 void Field::SetDisplay(CPDFSDK_Document* pDocument,
1251 const CFX_WideString& swFieldName, 1226 const CFX_WideString& swFieldName,
1252 int nControlIndex, 1227 int nControlIndex,
1253 int number) { 1228 int number) {
1254 ASSERT(pDocument != NULL);
1255
1256 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); 1229 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm();
1257 ASSERT(pInterForm != NULL);
1258
1259 std::vector<CPDF_FormField*> FieldArray = 1230 std::vector<CPDF_FormField*> FieldArray =
1260 GetFormFields(pDocument, swFieldName); 1231 GetFormFields(pDocument, swFieldName);
1261 for (CPDF_FormField* pFormField : FieldArray) { 1232 for (CPDF_FormField* pFormField : FieldArray) {
1262 if (nControlIndex < 0) { 1233 if (nControlIndex < 0) {
1263 FX_BOOL bSet = FALSE; 1234 FX_BOOL bSet = FALSE;
1264 for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) { 1235 for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) {
1265 CPDF_FormControl* pFormControl = pFormField->GetControl(i); 1236 CPDF_FormControl* pFormControl = pFormField->GetControl(i);
1266 ASSERT(pFormControl != NULL); 1237 ASSERT(pFormControl);
1267 1238
1268 if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl)) { 1239 if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl)) {
1269 FX_DWORD dwFlag = pWidget->GetFlags(); 1240 FX_DWORD dwFlag = pWidget->GetFlags();
1270 switch (number) { 1241 switch (number) {
1271 case 0: 1242 case 0:
1272 dwFlag &= (~ANNOTFLAG_INVISIBLE); 1243 dwFlag &= (~ANNOTFLAG_INVISIBLE);
1273 dwFlag &= (~ANNOTFLAG_HIDDEN); 1244 dwFlag &= (~ANNOTFLAG_HIDDEN);
1274 dwFlag &= (~ANNOTFLAG_NOVIEW); 1245 dwFlag &= (~ANNOTFLAG_NOVIEW);
1275 dwFlag |= ANNOTFLAG_PRINT; 1246 dwFlag |= ANNOTFLAG_PRINT;
1276 break; 1247 break;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1346 if (!vp.IsGetting()) { 1317 if (!vp.IsGetting()) {
1347 return FALSE; 1318 return FALSE;
1348 } 1319 }
1349 vp << m_pJSDoc->GetCJSDoc(); 1320 vp << m_pJSDoc->GetCJSDoc();
1350 return TRUE; 1321 return TRUE;
1351 } 1322 }
1352 1323
1353 FX_BOOL Field::editable(IJS_Context* cc, 1324 FX_BOOL Field::editable(IJS_Context* cc,
1354 CJS_PropValue& vp, 1325 CJS_PropValue& vp,
1355 CFX_WideString& sError) { 1326 CFX_WideString& sError) {
1356 ASSERT(m_pDocument != NULL);
1357 if (vp.IsSetting()) { 1327 if (vp.IsSetting()) {
1358 if (!m_bCanSet) 1328 if (!m_bCanSet)
1359 return FALSE; 1329 return FALSE;
1360 1330
1361 bool bVP; 1331 bool bVP;
1362 vp >> bVP; 1332 vp >> bVP;
1363 } else { 1333 } else {
1364 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 1334 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
1365 if (FieldArray.empty()) 1335 if (FieldArray.empty())
1366 return FALSE; 1336 return FALSE;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1419 0, CJS_Value(pRuntime, pFormControl->GetExportValue().c_str())); 1389 0, CJS_Value(pRuntime, pFormControl->GetExportValue().c_str()));
1420 } 1390 }
1421 vp << ExportValusArray; 1391 vp << ExportValusArray;
1422 } 1392 }
1423 return TRUE; 1393 return TRUE;
1424 } 1394 }
1425 1395
1426 FX_BOOL Field::fileSelect(IJS_Context* cc, 1396 FX_BOOL Field::fileSelect(IJS_Context* cc,
1427 CJS_PropValue& vp, 1397 CJS_PropValue& vp,
1428 CFX_WideString& sError) { 1398 CFX_WideString& sError) {
1429 ASSERT(m_pDocument != NULL);
1430
1431 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 1399 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
1432 if (FieldArray.empty()) 1400 if (FieldArray.empty())
1433 return FALSE; 1401 return FALSE;
1434 1402
1435 CPDF_FormField* pFormField = FieldArray[0]; 1403 CPDF_FormField* pFormField = FieldArray[0];
1436 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) 1404 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD)
1437 return FALSE; 1405 return FALSE;
1438 1406
1439 if (vp.IsSetting()) { 1407 if (vp.IsSetting()) {
1440 if (!m_bCanSet) 1408 if (!m_bCanSet)
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1517 void Field::SetFillColor(CPDFSDK_Document* pDocument, 1485 void Field::SetFillColor(CPDFSDK_Document* pDocument,
1518 const CFX_WideString& swFieldName, 1486 const CFX_WideString& swFieldName,
1519 int nControlIndex, 1487 int nControlIndex,
1520 const CPWL_Color& color) { 1488 const CPWL_Color& color) {
1521 // Not supported. 1489 // Not supported.
1522 } 1490 }
1523 1491
1524 FX_BOOL Field::hidden(IJS_Context* cc, 1492 FX_BOOL Field::hidden(IJS_Context* cc,
1525 CJS_PropValue& vp, 1493 CJS_PropValue& vp,
1526 CFX_WideString& sError) { 1494 CFX_WideString& sError) {
1527 ASSERT(m_pDocument != NULL);
1528
1529 if (vp.IsSetting()) { 1495 if (vp.IsSetting()) {
1530 if (!m_bCanSet) 1496 if (!m_bCanSet)
1531 return FALSE; 1497 return FALSE;
1532 1498
1533 bool bVP; 1499 bool bVP;
1534 vp >> bVP; 1500 vp >> bVP;
1535 1501
1536 if (m_bDelay) { 1502 if (m_bDelay) {
1537 AddDelay_Bool(FP_HIDDEN, bVP); 1503 AddDelay_Bool(FP_HIDDEN, bVP);
1538 } else { 1504 } else {
(...skipping 21 matching lines...) Expand all
1560 vp << false; 1526 vp << false;
1561 } 1527 }
1562 1528
1563 return TRUE; 1529 return TRUE;
1564 } 1530 }
1565 1531
1566 void Field::SetHidden(CPDFSDK_Document* pDocument, 1532 void Field::SetHidden(CPDFSDK_Document* pDocument,
1567 const CFX_WideString& swFieldName, 1533 const CFX_WideString& swFieldName,
1568 int nControlIndex, 1534 int nControlIndex,
1569 bool b) { 1535 bool b) {
1570 ASSERT(pDocument != NULL);
1571
1572 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); 1536 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm();
1573 ASSERT(pInterForm != NULL);
1574
1575 std::vector<CPDF_FormField*> FieldArray = 1537 std::vector<CPDF_FormField*> FieldArray =
1576 GetFormFields(pDocument, swFieldName); 1538 GetFormFields(pDocument, swFieldName);
1577 for (CPDF_FormField* pFormField : FieldArray) { 1539 for (CPDF_FormField* pFormField : FieldArray) {
1578 if (nControlIndex < 0) { 1540 if (nControlIndex < 0) {
1579 FX_BOOL bSet = FALSE; 1541 FX_BOOL bSet = FALSE;
1580 for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) { 1542 for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) {
1581 if (CPDFSDK_Widget* pWidget = 1543 if (CPDFSDK_Widget* pWidget =
1582 pInterForm->GetWidget(pFormField->GetControl(i))) { 1544 pInterForm->GetWidget(pFormField->GetControl(i))) {
1583 FX_DWORD dwFlags = pWidget->GetFlags(); 1545 FX_DWORD dwFlags = pWidget->GetFlags();
1584 1546
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1627 } 1589 }
1628 } 1590 }
1629 } 1591 }
1630 } 1592 }
1631 } 1593 }
1632 } 1594 }
1633 1595
1634 FX_BOOL Field::highlight(IJS_Context* cc, 1596 FX_BOOL Field::highlight(IJS_Context* cc,
1635 CJS_PropValue& vp, 1597 CJS_PropValue& vp,
1636 CFX_WideString& sError) { 1598 CFX_WideString& sError) {
1637 ASSERT(m_pDocument != NULL); 1599 ASSERT(m_pDocument);
1638 1600
1639 if (vp.IsSetting()) { 1601 if (vp.IsSetting()) {
1640 if (!m_bCanSet) 1602 if (!m_bCanSet)
1641 return FALSE; 1603 return FALSE;
1642 1604
1643 CFX_ByteString strMode; 1605 CFX_ByteString strMode;
1644 vp >> strMode; 1606 vp >> strMode;
1645 1607
1646 if (m_bDelay) { 1608 if (m_bDelay) {
1647 AddDelay_String(FP_HIGHLIGHT, strMode); 1609 AddDelay_String(FP_HIGHLIGHT, strMode);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1688 void Field::SetHighlight(CPDFSDK_Document* pDocument, 1650 void Field::SetHighlight(CPDFSDK_Document* pDocument,
1689 const CFX_WideString& swFieldName, 1651 const CFX_WideString& swFieldName,
1690 int nControlIndex, 1652 int nControlIndex,
1691 const CFX_ByteString& string) { 1653 const CFX_ByteString& string) {
1692 // Not supported. 1654 // Not supported.
1693 } 1655 }
1694 1656
1695 FX_BOOL Field::lineWidth(IJS_Context* cc, 1657 FX_BOOL Field::lineWidth(IJS_Context* cc,
1696 CJS_PropValue& vp, 1658 CJS_PropValue& vp,
1697 CFX_WideString& sError) { 1659 CFX_WideString& sError) {
1698 ASSERT(m_pDocument != NULL);
1699
1700 if (vp.IsSetting()) { 1660 if (vp.IsSetting()) {
1701 if (!m_bCanSet) 1661 if (!m_bCanSet)
1702 return FALSE; 1662 return FALSE;
1703 1663
1704 int iWidth; 1664 int iWidth;
1705 vp >> iWidth; 1665 vp >> iWidth;
1706 1666
1707 if (m_bDelay) { 1667 if (m_bDelay) {
1708 AddDelay_Int(FP_LINEWIDTH, iWidth); 1668 AddDelay_Int(FP_LINEWIDTH, iWidth);
1709 } else { 1669 } else {
1710 Field::SetLineWidth(m_pDocument, m_FieldName, m_nFormControlIndex, 1670 Field::SetLineWidth(m_pDocument, m_FieldName, m_nFormControlIndex,
1711 iWidth); 1671 iWidth);
1712 } 1672 }
1713 } else { 1673 } else {
1714 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 1674 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
1715 if (FieldArray.empty()) 1675 if (FieldArray.empty())
1716 return FALSE; 1676 return FALSE;
1717 1677
1718 CPDF_FormField* pFormField = FieldArray[0]; 1678 CPDF_FormField* pFormField = FieldArray[0];
1719 ASSERT(pFormField); 1679 ASSERT(pFormField);
1720 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); 1680 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
1721 if (!pFormControl) 1681 if (!pFormControl)
1722 return FALSE; 1682 return FALSE;
1723 1683
1724 CPDFSDK_InterForm* pInterForm = 1684 CPDFSDK_InterForm* pInterForm =
1725 (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); 1685 (CPDFSDK_InterForm*)m_pDocument->GetInterForm();
1726 ASSERT(pInterForm != NULL);
1727
1728 if (!pFormField->CountControls()) 1686 if (!pFormField->CountControls())
1729 return FALSE; 1687 return FALSE;
1730 1688
1731 CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormField->GetControl(0)); 1689 CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormField->GetControl(0));
1732 if (!pWidget) 1690 if (!pWidget)
1733 return FALSE; 1691 return FALSE;
1734 1692
1735 vp << (int32_t)pWidget->GetBorderWidth(); 1693 vp << (int32_t)pWidget->GetBorderWidth();
1736 } 1694 }
1737 1695
1738 return TRUE; 1696 return TRUE;
1739 } 1697 }
1740 1698
1741 void Field::SetLineWidth(CPDFSDK_Document* pDocument, 1699 void Field::SetLineWidth(CPDFSDK_Document* pDocument,
1742 const CFX_WideString& swFieldName, 1700 const CFX_WideString& swFieldName,
1743 int nControlIndex, 1701 int nControlIndex,
1744 int number) { 1702 int number) {
1745 ASSERT(pDocument != NULL);
1746
1747 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); 1703 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm();
1748 ASSERT(pInterForm != NULL);
1749 1704
1750 std::vector<CPDF_FormField*> FieldArray = 1705 std::vector<CPDF_FormField*> FieldArray =
1751 GetFormFields(pDocument, swFieldName); 1706 GetFormFields(pDocument, swFieldName);
1752 for (CPDF_FormField* pFormField : FieldArray) { 1707 for (CPDF_FormField* pFormField : FieldArray) {
1753 if (nControlIndex < 0) { 1708 if (nControlIndex < 0) {
1754 FX_BOOL bSet = FALSE; 1709 FX_BOOL bSet = FALSE;
1755 for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) { 1710 for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) {
1756 CPDF_FormControl* pFormControl = pFormField->GetControl(i); 1711 CPDF_FormControl* pFormControl = pFormField->GetControl(i);
1757 ASSERT(pFormControl != NULL); 1712 ASSERT(pFormControl);
1758 1713
1759 if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl)) { 1714 if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl)) {
1760 if (number != pWidget->GetBorderWidth()) { 1715 if (number != pWidget->GetBorderWidth()) {
1761 pWidget->SetBorderWidth(number); 1716 pWidget->SetBorderWidth(number);
1762 bSet = TRUE; 1717 bSet = TRUE;
1763 } 1718 }
1764 } 1719 }
1765 } 1720 }
1766 if (bSet) 1721 if (bSet)
1767 UpdateFormField(pDocument, pFormField, TRUE, TRUE, TRUE); 1722 UpdateFormField(pDocument, pFormField, TRUE, TRUE, TRUE);
1768 } else { 1723 } else {
1769 if (nControlIndex >= pFormField->CountControls()) 1724 if (nControlIndex >= pFormField->CountControls())
1770 return; 1725 return;
1771 if (CPDF_FormControl* pFormControl = 1726 if (CPDF_FormControl* pFormControl =
1772 pFormField->GetControl(nControlIndex)) { 1727 pFormField->GetControl(nControlIndex)) {
1773 if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl)) { 1728 if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl)) {
1774 if (number != pWidget->GetBorderWidth()) { 1729 if (number != pWidget->GetBorderWidth()) {
1775 pWidget->SetBorderWidth(number); 1730 pWidget->SetBorderWidth(number);
1776 UpdateFormControl(pDocument, pFormControl, TRUE, TRUE, TRUE); 1731 UpdateFormControl(pDocument, pFormControl, TRUE, TRUE, TRUE);
1777 } 1732 }
1778 } 1733 }
1779 } 1734 }
1780 } 1735 }
1781 } 1736 }
1782 } 1737 }
1783 1738
1784 FX_BOOL Field::multiline(IJS_Context* cc, 1739 FX_BOOL Field::multiline(IJS_Context* cc,
1785 CJS_PropValue& vp, 1740 CJS_PropValue& vp,
1786 CFX_WideString& sError) { 1741 CFX_WideString& sError) {
1787 ASSERT(m_pDocument != NULL); 1742 ASSERT(m_pDocument);
1788 1743
1789 if (vp.IsSetting()) { 1744 if (vp.IsSetting()) {
1790 if (!m_bCanSet) 1745 if (!m_bCanSet)
1791 return FALSE; 1746 return FALSE;
1792 1747
1793 bool bVP; 1748 bool bVP;
1794 vp >> bVP; 1749 vp >> bVP;
1795 1750
1796 if (m_bDelay) { 1751 if (m_bDelay) {
1797 AddDelay_Bool(FP_MULTILINE, bVP); 1752 AddDelay_Bool(FP_MULTILINE, bVP);
(...skipping 21 matching lines...) Expand all
1819 void Field::SetMultiline(CPDFSDK_Document* pDocument, 1774 void Field::SetMultiline(CPDFSDK_Document* pDocument,
1820 const CFX_WideString& swFieldName, 1775 const CFX_WideString& swFieldName,
1821 int nControlIndex, 1776 int nControlIndex,
1822 bool b) { 1777 bool b) {
1823 // Not supported. 1778 // Not supported.
1824 } 1779 }
1825 1780
1826 FX_BOOL Field::multipleSelection(IJS_Context* cc, 1781 FX_BOOL Field::multipleSelection(IJS_Context* cc,
1827 CJS_PropValue& vp, 1782 CJS_PropValue& vp,
1828 CFX_WideString& sError) { 1783 CFX_WideString& sError) {
1829 ASSERT(m_pDocument != NULL); 1784 ASSERT(m_pDocument);
1830 1785
1831 if (vp.IsSetting()) { 1786 if (vp.IsSetting()) {
1832 if (!m_bCanSet) 1787 if (!m_bCanSet)
1833 return FALSE; 1788 return FALSE;
1834 1789
1835 bool bVP; 1790 bool bVP;
1836 vp >> bVP; 1791 vp >> bVP;
1837 1792
1838 if (m_bDelay) { 1793 if (m_bDelay) {
1839 AddDelay_Bool(FP_MULTIPLESELECTION, bVP); 1794 AddDelay_Bool(FP_MULTIPLESELECTION, bVP);
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1934 i, CJS_Value(pRuntime, (int32_t)pPageView->GetPageIndex())); 1889 i, CJS_Value(pRuntime, (int32_t)pPageView->GetPageIndex()));
1935 } 1890 }
1936 1891
1937 vp << PageArray; 1892 vp << PageArray;
1938 return TRUE; 1893 return TRUE;
1939 } 1894 }
1940 1895
1941 FX_BOOL Field::password(IJS_Context* cc, 1896 FX_BOOL Field::password(IJS_Context* cc,
1942 CJS_PropValue& vp, 1897 CJS_PropValue& vp,
1943 CFX_WideString& sError) { 1898 CFX_WideString& sError) {
1944 ASSERT(m_pDocument != NULL); 1899 ASSERT(m_pDocument);
1945 1900
1946 if (vp.IsSetting()) { 1901 if (vp.IsSetting()) {
1947 if (!m_bCanSet) 1902 if (!m_bCanSet)
1948 return FALSE; 1903 return FALSE;
1949 1904
1950 bool bVP; 1905 bool bVP;
1951 vp >> bVP; 1906 vp >> bVP;
1952 1907
1953 if (m_bDelay) { 1908 if (m_bDelay) {
1954 AddDelay_Bool(FP_PASSWORD, bVP); 1909 AddDelay_Bool(FP_PASSWORD, bVP);
(...skipping 21 matching lines...) Expand all
1976 void Field::SetPassword(CPDFSDK_Document* pDocument, 1931 void Field::SetPassword(CPDFSDK_Document* pDocument,
1977 const CFX_WideString& swFieldName, 1932 const CFX_WideString& swFieldName,
1978 int nControlIndex, 1933 int nControlIndex,
1979 bool b) { 1934 bool b) {
1980 // Not supported. 1935 // Not supported.
1981 } 1936 }
1982 1937
1983 FX_BOOL Field::print(IJS_Context* cc, 1938 FX_BOOL Field::print(IJS_Context* cc,
1984 CJS_PropValue& vp, 1939 CJS_PropValue& vp,
1985 CFX_WideString& sError) { 1940 CFX_WideString& sError) {
1986 ASSERT(m_pDocument != NULL);
1987
1988 CPDFSDK_InterForm* pInterForm = 1941 CPDFSDK_InterForm* pInterForm =
1989 (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); 1942 (CPDFSDK_InterForm*)m_pDocument->GetInterForm();
1990 ASSERT(pInterForm != NULL);
1991
1992 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 1943 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
1993 if (FieldArray.empty()) 1944 if (FieldArray.empty())
1994 return FALSE; 1945 return FALSE;
1995 1946
1996 if (vp.IsSetting()) { 1947 if (vp.IsSetting()) {
1997 if (!m_bCanSet) 1948 if (!m_bCanSet)
1998 return FALSE; 1949 return FALSE;
1999 1950
2000 bool bVP; 1951 bool bVP;
2001 vp >> bVP; 1952 vp >> bVP;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
2055 else 2006 else
2056 vp << false; 2007 vp << false;
2057 } 2008 }
2058 2009
2059 return TRUE; 2010 return TRUE;
2060 } 2011 }
2061 2012
2062 FX_BOOL Field::radiosInUnison(IJS_Context* cc, 2013 FX_BOOL Field::radiosInUnison(IJS_Context* cc,
2063 CJS_PropValue& vp, 2014 CJS_PropValue& vp,
2064 CFX_WideString& sError) { 2015 CFX_WideString& sError) {
2065 ASSERT(m_pDocument != NULL);
2066
2067 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 2016 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
2068 if (FieldArray.empty()) 2017 if (FieldArray.empty())
2069 return FALSE; 2018 return FALSE;
2070 2019
2071 if (vp.IsSetting()) { 2020 if (vp.IsSetting()) {
2072 if (!m_bCanSet) 2021 if (!m_bCanSet)
2073 return FALSE; 2022 return FALSE;
2074 2023
2075 bool bVP; 2024 bool bVP;
2076 vp >> bVP; 2025 vp >> bVP;
2077 2026
2078 } else { 2027 } else {
2079 CPDF_FormField* pFormField = FieldArray[0]; 2028 CPDF_FormField* pFormField = FieldArray[0];
2080 if (pFormField->GetFieldType() != FIELDTYPE_RADIOBUTTON) 2029 if (pFormField->GetFieldType() != FIELDTYPE_RADIOBUTTON)
2081 return FALSE; 2030 return FALSE;
2082 2031
2083 if (pFormField->GetFieldFlags() & FIELDFLAG_RADIOSINUNISON) 2032 if (pFormField->GetFieldFlags() & FIELDFLAG_RADIOSINUNISON)
2084 vp << true; 2033 vp << true;
2085 else 2034 else
2086 vp << false; 2035 vp << false;
2087 } 2036 }
2088 2037
2089 return TRUE; 2038 return TRUE;
2090 } 2039 }
2091 2040
2092 FX_BOOL Field::readonly(IJS_Context* cc, 2041 FX_BOOL Field::readonly(IJS_Context* cc,
2093 CJS_PropValue& vp, 2042 CJS_PropValue& vp,
2094 CFX_WideString& sError) { 2043 CFX_WideString& sError) {
2095 ASSERT(m_pDocument != NULL);
2096
2097 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 2044 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
2098 if (FieldArray.empty()) 2045 if (FieldArray.empty())
2099 return FALSE; 2046 return FALSE;
2100 2047
2101 if (vp.IsSetting()) { 2048 if (vp.IsSetting()) {
2102 if (!m_bCanSet) 2049 if (!m_bCanSet)
2103 return FALSE; 2050 return FALSE;
2104 2051
2105 bool bVP; 2052 bool bVP;
2106 vp >> bVP; 2053 vp >> bVP;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
2176 rcArray.SetElement(3, Lower_Righty); 2123 rcArray.SetElement(3, Lower_Righty);
2177 vp << rcArray; 2124 vp << rcArray;
2178 } 2125 }
2179 return TRUE; 2126 return TRUE;
2180 } 2127 }
2181 2128
2182 void Field::SetRect(CPDFSDK_Document* pDocument, 2129 void Field::SetRect(CPDFSDK_Document* pDocument,
2183 const CFX_WideString& swFieldName, 2130 const CFX_WideString& swFieldName,
2184 int nControlIndex, 2131 int nControlIndex,
2185 const CPDF_Rect& rect) { 2132 const CPDF_Rect& rect) {
2186 ASSERT(pDocument != NULL);
2187
2188 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); 2133 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm();
2189 ASSERT(pInterForm != NULL);
2190 2134
2191 std::vector<CPDF_FormField*> FieldArray = 2135 std::vector<CPDF_FormField*> FieldArray =
2192 GetFormFields(pDocument, swFieldName); 2136 GetFormFields(pDocument, swFieldName);
2193 for (CPDF_FormField* pFormField : FieldArray) { 2137 for (CPDF_FormField* pFormField : FieldArray) {
2194 if (nControlIndex < 0) { 2138 if (nControlIndex < 0) {
2195 FX_BOOL bSet = FALSE; 2139 FX_BOOL bSet = FALSE;
2196 for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) { 2140 for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) {
2197 CPDF_FormControl* pFormControl = pFormField->GetControl(i); 2141 CPDF_FormControl* pFormControl = pFormField->GetControl(i);
2198 ASSERT(pFormControl != NULL); 2142 ASSERT(pFormControl);
2199 2143
2200 if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl)) { 2144 if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl)) {
2201 CPDF_Rect crRect = rect; 2145 CPDF_Rect crRect = rect;
2202 2146
2203 CPDF_Page* pPDFPage = pWidget->GetPDFPage(); 2147 CPDF_Page* pPDFPage = pWidget->GetPDFPage();
2204 crRect.Intersect(pPDFPage->GetPageBBox()); 2148 crRect.Intersect(pPDFPage->GetPageBBox());
2205 2149
2206 if (!crRect.IsEmpty()) { 2150 if (!crRect.IsEmpty()) {
2207 CPDF_Rect rcOld = pWidget->GetRect(); 2151 CPDF_Rect rcOld = pWidget->GetRect();
2208 if (crRect.left != rcOld.left || crRect.right != rcOld.right || 2152 if (crRect.left != rcOld.left || crRect.right != rcOld.right ||
2209 crRect.top != rcOld.top || crRect.bottom != rcOld.bottom) { 2153 crRect.top != rcOld.top || crRect.bottom != rcOld.bottom) {
2210 pWidget->SetRect(crRect); 2154 pWidget->SetRect(crRect);
2211 bSet = TRUE; 2155 bSet = TRUE;
2212 } 2156 }
2213 } 2157 }
2214 } 2158 }
2215 } 2159 }
2216 2160
2217 if (bSet) 2161 if (bSet)
2218 UpdateFormField(pDocument, pFormField, TRUE, TRUE, TRUE); 2162 UpdateFormField(pDocument, pFormField, TRUE, TRUE, TRUE);
2219 } else { 2163 } else {
2220 if (nControlIndex >= pFormField->CountControls()) 2164 if (nControlIndex >= pFormField->CountControls())
2221 return; 2165 return;
2222 if (CPDF_FormControl* pFormControl = 2166 if (CPDF_FormControl* pFormControl =
2223 pFormField->GetControl(nControlIndex)) { 2167 pFormField->GetControl(nControlIndex)) {
2224 if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl)) { 2168 if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl)) {
2225 CPDF_Rect crRect = rect; 2169 CPDF_Rect crRect = rect;
2226 2170
2227 CPDF_Page* pPDFPage = pWidget->GetPDFPage(); 2171 CPDF_Page* pPDFPage = pWidget->GetPDFPage();
2228 ASSERT(pPDFPage != NULL);
2229
2230 // CPDF_Page* pPDFPage = pPage->GetPage();
2231 // ASSERT(pPDFPage != NULL);
2232
2233 crRect.Intersect(pPDFPage->GetPageBBox()); 2172 crRect.Intersect(pPDFPage->GetPageBBox());
2234 2173
2235 if (!crRect.IsEmpty()) { 2174 if (!crRect.IsEmpty()) {
2236 CPDF_Rect rcOld = pWidget->GetRect(); 2175 CPDF_Rect rcOld = pWidget->GetRect();
2237 if (crRect.left != rcOld.left || crRect.right != rcOld.right || 2176 if (crRect.left != rcOld.left || crRect.right != rcOld.right ||
2238 crRect.top != rcOld.top || crRect.bottom != rcOld.bottom) { 2177 crRect.top != rcOld.top || crRect.bottom != rcOld.bottom) {
2239 pWidget->SetRect(crRect); 2178 pWidget->SetRect(crRect);
2240 UpdateFormControl(pDocument, pFormControl, TRUE, TRUE, TRUE); 2179 UpdateFormControl(pDocument, pFormControl, TRUE, TRUE, TRUE);
2241 } 2180 }
2242 } 2181 }
2243 } 2182 }
2244 } 2183 }
2245 } 2184 }
2246 } 2185 }
2247 } 2186 }
2248 2187
2249 FX_BOOL Field::required(IJS_Context* cc, 2188 FX_BOOL Field::required(IJS_Context* cc,
2250 CJS_PropValue& vp, 2189 CJS_PropValue& vp,
2251 CFX_WideString& sError) { 2190 CFX_WideString& sError) {
2252 ASSERT(m_pDocument != NULL);
2253
2254 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 2191 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
2255 if (FieldArray.empty()) 2192 if (FieldArray.empty())
2256 return FALSE; 2193 return FALSE;
2257 2194
2258 if (vp.IsSetting()) { 2195 if (vp.IsSetting()) {
2259 if (!m_bCanSet) 2196 if (!m_bCanSet)
2260 return FALSE; 2197 return FALSE;
2261 2198
2262 bool bVP; 2199 bool bVP;
2263 vp >> bVP; 2200 vp >> bVP;
2264 2201
2265 } else { 2202 } else {
2266 CPDF_FormField* pFormField = FieldArray[0]; 2203 CPDF_FormField* pFormField = FieldArray[0];
2267 if (pFormField->GetFieldType() == FIELDTYPE_PUSHBUTTON) 2204 if (pFormField->GetFieldType() == FIELDTYPE_PUSHBUTTON)
2268 return FALSE; 2205 return FALSE;
2269 2206
2270 if (pFormField->GetFieldFlags() & FIELDFLAG_REQUIRED) 2207 if (pFormField->GetFieldFlags() & FIELDFLAG_REQUIRED)
2271 vp << true; 2208 vp << true;
2272 else 2209 else
2273 vp << false; 2210 vp << false;
2274 } 2211 }
2275 2212
2276 return TRUE; 2213 return TRUE;
2277 } 2214 }
2278 2215
2279 FX_BOOL Field::richText(IJS_Context* cc, 2216 FX_BOOL Field::richText(IJS_Context* cc,
2280 CJS_PropValue& vp, 2217 CJS_PropValue& vp,
2281 CFX_WideString& sError) { 2218 CFX_WideString& sError) {
2282 ASSERT(m_pDocument != NULL); 2219 ASSERT(m_pDocument);
2283 2220
2284 if (vp.IsSetting()) { 2221 if (vp.IsSetting()) {
2285 if (!m_bCanSet) 2222 if (!m_bCanSet)
2286 return FALSE; 2223 return FALSE;
2287 2224
2288 bool bVP; 2225 bool bVP;
2289 vp >> bVP; 2226 vp >> bVP;
2290 2227
2291 if (m_bDelay) { 2228 if (m_bDelay) {
2292 AddDelay_Bool(FP_RICHTEXT, bVP); 2229 AddDelay_Bool(FP_RICHTEXT, bVP);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2326 2263
2327 void Field::SetRichValue(CPDFSDK_Document* pDocument, 2264 void Field::SetRichValue(CPDFSDK_Document* pDocument,
2328 const CFX_WideString& swFieldName, 2265 const CFX_WideString& swFieldName,
2329 int nControlIndex) { 2266 int nControlIndex) {
2330 // Not supported. 2267 // Not supported.
2331 } 2268 }
2332 2269
2333 FX_BOOL Field::rotation(IJS_Context* cc, 2270 FX_BOOL Field::rotation(IJS_Context* cc,
2334 CJS_PropValue& vp, 2271 CJS_PropValue& vp,
2335 CFX_WideString& sError) { 2272 CFX_WideString& sError) {
2336 ASSERT(m_pDocument != NULL); 2273 ASSERT(m_pDocument);
2337 2274
2338 if (vp.IsSetting()) { 2275 if (vp.IsSetting()) {
2339 if (!m_bCanSet) 2276 if (!m_bCanSet)
2340 return FALSE; 2277 return FALSE;
2341 2278
2342 int nVP; 2279 int nVP;
2343 vp >> nVP; 2280 vp >> nVP;
2344 2281
2345 if (m_bDelay) { 2282 if (m_bDelay) {
2346 AddDelay_Int(FP_ROTATION, nVP); 2283 AddDelay_Int(FP_ROTATION, nVP);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
2436 void Field::SetStrokeColor(CPDFSDK_Document* pDocument, 2373 void Field::SetStrokeColor(CPDFSDK_Document* pDocument,
2437 const CFX_WideString& swFieldName, 2374 const CFX_WideString& swFieldName,
2438 int nControlIndex, 2375 int nControlIndex,
2439 const CPWL_Color& color) { 2376 const CPWL_Color& color) {
2440 // Not supported. 2377 // Not supported.
2441 } 2378 }
2442 2379
2443 FX_BOOL Field::style(IJS_Context* cc, 2380 FX_BOOL Field::style(IJS_Context* cc,
2444 CJS_PropValue& vp, 2381 CJS_PropValue& vp,
2445 CFX_WideString& sError) { 2382 CFX_WideString& sError) {
2446 ASSERT(m_pDocument != NULL); 2383 ASSERT(m_pDocument);
2447 2384
2448 if (vp.IsSetting()) { 2385 if (vp.IsSetting()) {
2449 if (!m_bCanSet) 2386 if (!m_bCanSet)
2450 return FALSE; 2387 return FALSE;
2451 2388
2452 CFX_ByteString csBCaption; 2389 CFX_ByteString csBCaption;
2453 vp >> csBCaption; 2390 vp >> csBCaption;
2454 2391
2455 if (m_bDelay) { 2392 if (m_bDelay) {
2456 AddDelay_String(FP_STYLE, csBCaption); 2393 AddDelay_String(FP_STYLE, csBCaption);
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
2571 void Field::SetTextColor(CPDFSDK_Document* pDocument, 2508 void Field::SetTextColor(CPDFSDK_Document* pDocument,
2572 const CFX_WideString& swFieldName, 2509 const CFX_WideString& swFieldName,
2573 int nControlIndex, 2510 int nControlIndex,
2574 const CPWL_Color& color) { 2511 const CPWL_Color& color) {
2575 // Not supported. 2512 // Not supported.
2576 } 2513 }
2577 2514
2578 FX_BOOL Field::textFont(IJS_Context* cc, 2515 FX_BOOL Field::textFont(IJS_Context* cc,
2579 CJS_PropValue& vp, 2516 CJS_PropValue& vp,
2580 CFX_WideString& sError) { 2517 CFX_WideString& sError) {
2581 ASSERT(m_pDocument != NULL); 2518 ASSERT(m_pDocument);
2582 2519
2583 if (vp.IsSetting()) { 2520 if (vp.IsSetting()) {
2584 if (!m_bCanSet) 2521 if (!m_bCanSet)
2585 return FALSE; 2522 return FALSE;
2586 2523
2587 CFX_ByteString csFontName; 2524 CFX_ByteString csFontName;
2588 vp >> csFontName; 2525 vp >> csFontName;
2589 if (csFontName.IsEmpty()) 2526 if (csFontName.IsEmpty())
2590 return FALSE; 2527 return FALSE;
2591 2528
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2627 void Field::SetTextFont(CPDFSDK_Document* pDocument, 2564 void Field::SetTextFont(CPDFSDK_Document* pDocument,
2628 const CFX_WideString& swFieldName, 2565 const CFX_WideString& swFieldName,
2629 int nControlIndex, 2566 int nControlIndex,
2630 const CFX_ByteString& string) { 2567 const CFX_ByteString& string) {
2631 // Not supported. 2568 // Not supported.
2632 } 2569 }
2633 2570
2634 FX_BOOL Field::textSize(IJS_Context* cc, 2571 FX_BOOL Field::textSize(IJS_Context* cc,
2635 CJS_PropValue& vp, 2572 CJS_PropValue& vp,
2636 CFX_WideString& sError) { 2573 CFX_WideString& sError) {
2637 ASSERT(m_pDocument != NULL); 2574 ASSERT(m_pDocument);
2638 2575
2639 if (vp.IsSetting()) { 2576 if (vp.IsSetting()) {
2640 if (!m_bCanSet) 2577 if (!m_bCanSet)
2641 return FALSE; 2578 return FALSE;
2642 2579
2643 int nVP; 2580 int nVP;
2644 vp >> nVP; 2581 vp >> nVP;
2645 2582
2646 if (m_bDelay) { 2583 if (m_bDelay) {
2647 AddDelay_Int(FP_TEXTSIZE, nVP); 2584 AddDelay_Int(FP_TEXTSIZE, nVP);
(...skipping 27 matching lines...) Expand all
2675 void Field::SetTextSize(CPDFSDK_Document* pDocument, 2612 void Field::SetTextSize(CPDFSDK_Document* pDocument,
2676 const CFX_WideString& swFieldName, 2613 const CFX_WideString& swFieldName,
2677 int nControlIndex, 2614 int nControlIndex,
2678 int number) { 2615 int number) {
2679 // Not supported. 2616 // Not supported.
2680 } 2617 }
2681 2618
2682 FX_BOOL Field::type(IJS_Context* cc, 2619 FX_BOOL Field::type(IJS_Context* cc,
2683 CJS_PropValue& vp, 2620 CJS_PropValue& vp,
2684 CFX_WideString& sError) { 2621 CFX_WideString& sError) {
2685 ASSERT(m_pDocument != NULL);
2686
2687 if (!vp.IsGetting()) 2622 if (!vp.IsGetting())
2688 return FALSE; 2623 return FALSE;
2689 2624
2690 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 2625 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
2691 if (FieldArray.empty()) 2626 if (FieldArray.empty())
2692 return FALSE; 2627 return FALSE;
2693 2628
2694 CPDF_FormField* pFormField = FieldArray[0]; 2629 CPDF_FormField* pFormField = FieldArray[0];
2695 switch (pFormField->GetFieldType()) { 2630 switch (pFormField->GetFieldType()) {
2696 case FIELDTYPE_UNKNOWN: 2631 case FIELDTYPE_UNKNOWN:
(...skipping 24 matching lines...) Expand all
2721 vp << L"unknown"; 2656 vp << L"unknown";
2722 break; 2657 break;
2723 } 2658 }
2724 2659
2725 return TRUE; 2660 return TRUE;
2726 } 2661 }
2727 2662
2728 FX_BOOL Field::userName(IJS_Context* cc, 2663 FX_BOOL Field::userName(IJS_Context* cc,
2729 CJS_PropValue& vp, 2664 CJS_PropValue& vp,
2730 CFX_WideString& sError) { 2665 CFX_WideString& sError) {
2731 ASSERT(m_pDocument != NULL); 2666 ASSERT(m_pDocument);
2732 2667
2733 if (vp.IsSetting()) { 2668 if (vp.IsSetting()) {
2734 if (!m_bCanSet) 2669 if (!m_bCanSet)
2735 return FALSE; 2670 return FALSE;
2736 2671
2737 CFX_WideString swName; 2672 CFX_WideString swName;
2738 vp >> swName; 2673 vp >> swName;
2739 2674
2740 if (m_bDelay) { 2675 if (m_bDelay) {
2741 AddDelay_WideString(FP_USERNAME, swName); 2676 AddDelay_WideString(FP_USERNAME, swName);
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
2874 } 2809 }
2875 } 2810 }
2876 2811
2877 return TRUE; 2812 return TRUE;
2878 } 2813 }
2879 2814
2880 void Field::SetValue(CPDFSDK_Document* pDocument, 2815 void Field::SetValue(CPDFSDK_Document* pDocument,
2881 const CFX_WideString& swFieldName, 2816 const CFX_WideString& swFieldName,
2882 int nControlIndex, 2817 int nControlIndex,
2883 const CJS_WideStringArray& strArray) { 2818 const CJS_WideStringArray& strArray) {
2884 ASSERT(pDocument != NULL); 2819 ASSERT(pDocument);
2885 2820
2886 if (strArray.GetSize() < 1) 2821 if (strArray.GetSize() < 1)
2887 return; 2822 return;
2888 2823
2889 std::vector<CPDF_FormField*> FieldArray = 2824 std::vector<CPDF_FormField*> FieldArray =
2890 GetFormFields(pDocument, swFieldName); 2825 GetFormFields(pDocument, swFieldName);
2891 2826
2892 for (CPDF_FormField* pFormField : FieldArray) { 2827 for (CPDF_FormField* pFormField : FieldArray) {
2893 if (pFormField->GetFullName().Compare(swFieldName) != 0) 2828 if (pFormField->GetFullName().Compare(swFieldName) != 0)
2894 continue; 2829 continue;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
2933 } break; 2868 } break;
2934 default: 2869 default:
2935 break; 2870 break;
2936 } 2871 }
2937 } 2872 }
2938 } 2873 }
2939 2874
2940 FX_BOOL Field::valueAsString(IJS_Context* cc, 2875 FX_BOOL Field::valueAsString(IJS_Context* cc,
2941 CJS_PropValue& vp, 2876 CJS_PropValue& vp,
2942 CFX_WideString& sError) { 2877 CFX_WideString& sError) {
2943 ASSERT(m_pDocument != NULL);
2944
2945 if (!vp.IsGetting()) 2878 if (!vp.IsGetting())
2946 return FALSE; 2879 return FALSE;
2947 2880
2948 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 2881 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
2949 if (FieldArray.empty()) 2882 if (FieldArray.empty())
2950 return FALSE; 2883 return FALSE;
2951 2884
2952 CPDF_FormField* pFormField = FieldArray[0]; 2885 CPDF_FormField* pFormField = FieldArray[0];
2953 if (pFormField->GetFieldType() == FIELDTYPE_PUSHBUTTON) 2886 if (pFormField->GetFieldType() == FIELDTYPE_PUSHBUTTON)
2954 return FALSE; 2887 return FALSE;
(...skipping 19 matching lines...) Expand all
2974 } else if (pFormField->GetFieldType() == FIELDTYPE_LISTBOX && 2907 } else if (pFormField->GetFieldType() == FIELDTYPE_LISTBOX &&
2975 (pFormField->CountSelectedItems() > 1)) { 2908 (pFormField->CountSelectedItems() > 1)) {
2976 vp << L""; 2909 vp << L"";
2977 } else { 2910 } else {
2978 vp << pFormField->GetValue().c_str(); 2911 vp << pFormField->GetValue().c_str();
2979 } 2912 }
2980 2913
2981 return TRUE; 2914 return TRUE;
2982 } 2915 }
2983 2916
2984 /* --------------------------------- methods ---------------------------------
2985 */
2986
2987 FX_BOOL Field::browseForFileToSubmit(IJS_Context* cc, 2917 FX_BOOL Field::browseForFileToSubmit(IJS_Context* cc,
2988 const std::vector<CJS_Value>& params, 2918 const std::vector<CJS_Value>& params,
2989 CJS_Value& vRet, 2919 CJS_Value& vRet,
2990 CFX_WideString& sError) { 2920 CFX_WideString& sError) {
2991 ASSERT(m_pDocument != NULL);
2992
2993 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 2921 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
2994 if (FieldArray.empty()) 2922 if (FieldArray.empty())
2995 return FALSE; 2923 return FALSE;
2996 2924
2997 CPDF_FormField* pFormField = FieldArray[0]; 2925 CPDF_FormField* pFormField = FieldArray[0];
2998 CPDFDoc_Environment* pApp = m_pDocument->GetEnv(); 2926 CPDFDoc_Environment* pApp = m_pDocument->GetEnv();
2999 if ((pFormField->GetFieldFlags() & FIELDFLAG_FILESELECT) && 2927 if ((pFormField->GetFieldFlags() & FIELDFLAG_FILESELECT) &&
3000 (pFormField->GetFieldType() == FIELDTYPE_TEXTFIELD)) { 2928 (pFormField->GetFieldType() == FIELDTYPE_TEXTFIELD)) {
3001 CFX_WideString wsFileName = pApp->JS_fieldBrowse(); 2929 CFX_WideString wsFileName = pApp->JS_fieldBrowse();
3002 if (!wsFileName.IsEmpty()) { 2930 if (!wsFileName.IsEmpty()) {
3003 pFormField->SetValue(wsFileName); 2931 pFormField->SetValue(wsFileName);
3004 UpdateFormField(m_pDocument, pFormField, TRUE, TRUE, TRUE); 2932 UpdateFormField(m_pDocument, pFormField, TRUE, TRUE, TRUE);
3005 } 2933 }
3006 return TRUE; 2934 return TRUE;
3007 } 2935 }
3008 return FALSE; 2936 return FALSE;
3009 } 2937 }
3010 2938
3011 FX_BOOL Field::buttonGetCaption(IJS_Context* cc, 2939 FX_BOOL Field::buttonGetCaption(IJS_Context* cc,
3012 const std::vector<CJS_Value>& params, 2940 const std::vector<CJS_Value>& params,
3013 CJS_Value& vRet, 2941 CJS_Value& vRet,
3014 CFX_WideString& sError) { 2942 CFX_WideString& sError) {
3015 ASSERT(m_pDocument != NULL);
3016
3017 int nface = 0; 2943 int nface = 0;
3018 int iSize = params.size(); 2944 int iSize = params.size();
3019 if (iSize >= 1) 2945 if (iSize >= 1)
3020 nface = params[0].ToInt(); 2946 nface = params[0].ToInt();
3021 2947
3022 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 2948 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
3023 if (FieldArray.empty()) 2949 if (FieldArray.empty())
3024 return FALSE; 2950 return FALSE;
3025 2951
3026 CPDF_FormField* pFormField = FieldArray[0]; 2952 CPDF_FormField* pFormField = FieldArray[0];
(...skipping 13 matching lines...) Expand all
3040 else 2966 else
3041 return FALSE; 2967 return FALSE;
3042 2968
3043 return TRUE; 2969 return TRUE;
3044 } 2970 }
3045 2971
3046 FX_BOOL Field::buttonGetIcon(IJS_Context* cc, 2972 FX_BOOL Field::buttonGetIcon(IJS_Context* cc,
3047 const std::vector<CJS_Value>& params, 2973 const std::vector<CJS_Value>& params,
3048 CJS_Value& vRet, 2974 CJS_Value& vRet,
3049 CFX_WideString& sError) { 2975 CFX_WideString& sError) {
3050 ASSERT(m_pDocument != NULL);
3051
3052 int nface = 0; 2976 int nface = 0;
3053 int iSize = params.size(); 2977 int iSize = params.size();
3054 if (iSize >= 1) 2978 if (iSize >= 1)
3055 nface = params[0].ToInt(); 2979 nface = params[0].ToInt();
3056 2980
3057 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 2981 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
3058 if (FieldArray.empty()) 2982 if (FieldArray.empty())
3059 return FALSE; 2983 return FALSE;
3060 2984
3061 CPDF_FormField* pFormField = FieldArray[0]; 2985 CPDF_FormField* pFormField = FieldArray[0];
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
3109 const std::vector<CJS_Value>& params, 3033 const std::vector<CJS_Value>& params,
3110 CJS_Value& vRet, 3034 CJS_Value& vRet,
3111 CFX_WideString& sError) { 3035 CFX_WideString& sError) {
3112 return FALSE; 3036 return FALSE;
3113 } 3037 }
3114 3038
3115 FX_BOOL Field::checkThisBox(IJS_Context* cc, 3039 FX_BOOL Field::checkThisBox(IJS_Context* cc,
3116 const std::vector<CJS_Value>& params, 3040 const std::vector<CJS_Value>& params,
3117 CJS_Value& vRet, 3041 CJS_Value& vRet,
3118 CFX_WideString& sError) { 3042 CFX_WideString& sError) {
3119 ASSERT(m_pDocument != NULL); 3043 ASSERT(m_pDocument);
3120 3044
3121 if (!m_bCanSet) 3045 if (!m_bCanSet)
3122 return FALSE; 3046 return FALSE;
3123 3047
3124 int iSize = params.size(); 3048 int iSize = params.size();
3125 if (iSize < 1) 3049 if (iSize < 1)
3126 return FALSE; 3050 return FALSE;
3127 3051
3128 int nWidget = params[0].ToInt(); 3052 int nWidget = params[0].ToInt();
3129 3053
(...skipping 24 matching lines...) Expand all
3154 const std::vector<CJS_Value>& params, 3078 const std::vector<CJS_Value>& params,
3155 CJS_Value& vRet, 3079 CJS_Value& vRet,
3156 CFX_WideString& sError) { 3080 CFX_WideString& sError) {
3157 return TRUE; 3081 return TRUE;
3158 } 3082 }
3159 3083
3160 FX_BOOL Field::defaultIsChecked(IJS_Context* cc, 3084 FX_BOOL Field::defaultIsChecked(IJS_Context* cc,
3161 const std::vector<CJS_Value>& params, 3085 const std::vector<CJS_Value>& params,
3162 CJS_Value& vRet, 3086 CJS_Value& vRet,
3163 CFX_WideString& sError) { 3087 CFX_WideString& sError) {
3164 ASSERT(m_pDocument != NULL);
3165
3166 if (!m_bCanSet) 3088 if (!m_bCanSet)
3167 return FALSE; 3089 return FALSE;
3168 3090
3169 int iSize = params.size(); 3091 int iSize = params.size();
3170 if (iSize < 1) 3092 if (iSize < 1)
3171 return FALSE; 3093 return FALSE;
3172 3094
3173 int nWidget = params[0].ToInt(); 3095 int nWidget = params[0].ToInt();
3174 3096
3175 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 3097 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
(...skipping 12 matching lines...) Expand all
3188 } 3110 }
3189 3111
3190 FX_BOOL Field::deleteItemAt(IJS_Context* cc, 3112 FX_BOOL Field::deleteItemAt(IJS_Context* cc,
3191 const std::vector<CJS_Value>& params, 3113 const std::vector<CJS_Value>& params,
3192 CJS_Value& vRet, 3114 CJS_Value& vRet,
3193 CFX_WideString& sError) { 3115 CFX_WideString& sError) {
3194 return TRUE; 3116 return TRUE;
3195 } 3117 }
3196 3118
3197 int JS_COMPARESTRING(CFX_WideString* ps1, CFX_WideString* ps2) { 3119 int JS_COMPARESTRING(CFX_WideString* ps1, CFX_WideString* ps2) {
3198 ASSERT(ps1 != NULL);
3199 ASSERT(ps2 != NULL);
3200
3201 return ps1->Compare(*ps2); 3120 return ps1->Compare(*ps2);
3202 } 3121 }
3203 3122
3204 FX_BOOL Field::getArray(IJS_Context* cc, 3123 FX_BOOL Field::getArray(IJS_Context* cc,
3205 const std::vector<CJS_Value>& params, 3124 const std::vector<CJS_Value>& params,
3206 CJS_Value& vRet, 3125 CJS_Value& vRet,
3207 CFX_WideString& sError) { 3126 CFX_WideString& sError) {
3208 ASSERT(m_pDocument != NULL);
3209
3210 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 3127 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
3211 if (FieldArray.empty()) 3128 if (FieldArray.empty())
3212 return FALSE; 3129 return FALSE;
3213 3130
3214 CGW_ArrayTemplate<CFX_WideString*> swSort; 3131 CGW_ArrayTemplate<CFX_WideString*> swSort;
3215 3132
3216 for (CPDF_FormField* pFormField : FieldArray) 3133 for (CPDF_FormField* pFormField : FieldArray)
3217 swSort.Add(new CFX_WideString(pFormField->GetFullName())); 3134 swSort.Add(new CFX_WideString(pFormField->GetFullName()));
3218 swSort.Sort(JS_COMPARESTRING); 3135 swSort.Sort(JS_COMPARESTRING);
3219 3136
(...skipping 20 matching lines...) Expand all
3240 3157
3241 vRet = FormFieldArray; 3158 vRet = FormFieldArray;
3242 swSort.RemoveAll(); 3159 swSort.RemoveAll();
3243 return TRUE; 3160 return TRUE;
3244 } 3161 }
3245 3162
3246 FX_BOOL Field::getItemAt(IJS_Context* cc, 3163 FX_BOOL Field::getItemAt(IJS_Context* cc,
3247 const std::vector<CJS_Value>& params, 3164 const std::vector<CJS_Value>& params,
3248 CJS_Value& vRet, 3165 CJS_Value& vRet,
3249 CFX_WideString& sError) { 3166 CFX_WideString& sError) {
3250 ASSERT(m_pDocument != NULL);
3251 int iSize = params.size(); 3167 int iSize = params.size();
3252 3168
3253 int nIdx = -1; 3169 int nIdx = -1;
3254 if (iSize >= 1) 3170 if (iSize >= 1)
3255 nIdx = params[0].ToInt(); 3171 nIdx = params[0].ToInt();
3256 3172
3257 FX_BOOL bExport = TRUE; 3173 FX_BOOL bExport = TRUE;
3258 if (iSize >= 2) 3174 if (iSize >= 2)
3259 bExport = params[1].ToBool(); 3175 bExport = params[1].ToBool();
3260 3176
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
3294 const std::vector<CJS_Value>& params, 3210 const std::vector<CJS_Value>& params,
3295 CJS_Value& vRet, 3211 CJS_Value& vRet,
3296 CFX_WideString& sError) { 3212 CFX_WideString& sError) {
3297 return TRUE; 3213 return TRUE;
3298 } 3214 }
3299 3215
3300 FX_BOOL Field::isBoxChecked(IJS_Context* cc, 3216 FX_BOOL Field::isBoxChecked(IJS_Context* cc,
3301 const std::vector<CJS_Value>& params, 3217 const std::vector<CJS_Value>& params,
3302 CJS_Value& vRet, 3218 CJS_Value& vRet,
3303 CFX_WideString& sError) { 3219 CFX_WideString& sError) {
3304 ASSERT(m_pDocument != NULL);
3305
3306 int nIndex = -1; 3220 int nIndex = -1;
3307 if (params.size() >= 1) 3221 if (params.size() >= 1)
3308 nIndex = params[0].ToInt(); 3222 nIndex = params[0].ToInt();
3309 3223
3310 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 3224 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
3311 if (FieldArray.empty()) 3225 if (FieldArray.empty())
3312 return FALSE; 3226 return FALSE;
3313 3227
3314 CPDF_FormField* pFormField = FieldArray[0]; 3228 CPDF_FormField* pFormField = FieldArray[0];
3315 if (nIndex < 0 || nIndex >= pFormField->CountControls()) { 3229 if (nIndex < 0 || nIndex >= pFormField->CountControls()) {
(...skipping 11 matching lines...) Expand all
3327 vRet = FALSE; 3241 vRet = FALSE;
3328 } 3242 }
3329 3243
3330 return TRUE; 3244 return TRUE;
3331 } 3245 }
3332 3246
3333 FX_BOOL Field::isDefaultChecked(IJS_Context* cc, 3247 FX_BOOL Field::isDefaultChecked(IJS_Context* cc,
3334 const std::vector<CJS_Value>& params, 3248 const std::vector<CJS_Value>& params,
3335 CJS_Value& vRet, 3249 CJS_Value& vRet,
3336 CFX_WideString& sError) { 3250 CFX_WideString& sError) {
3337 ASSERT(m_pDocument != NULL);
3338
3339 int nIndex = -1; 3251 int nIndex = -1;
3340 if (params.size() >= 1) 3252 if (params.size() >= 1)
3341 nIndex = params[0].ToInt(); 3253 nIndex = params[0].ToInt();
3342 3254
3343 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 3255 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
3344 if (FieldArray.empty()) 3256 if (FieldArray.empty())
3345 return FALSE; 3257 return FALSE;
3346 3258
3347 CPDF_FormField* pFormField = FieldArray[0]; 3259 CPDF_FormField* pFormField = FieldArray[0];
3348 if (nIndex < 0 || nIndex >= pFormField->CountControls()) { 3260 if (nIndex < 0 || nIndex >= pFormField->CountControls()) {
(...skipping 17 matching lines...) Expand all
3366 const std::vector<CJS_Value>& params, 3278 const std::vector<CJS_Value>& params,
3367 CJS_Value& vRet, 3279 CJS_Value& vRet,
3368 CFX_WideString& sError) { 3280 CFX_WideString& sError) {
3369 return TRUE; 3281 return TRUE;
3370 } 3282 }
3371 3283
3372 FX_BOOL Field::setFocus(IJS_Context* cc, 3284 FX_BOOL Field::setFocus(IJS_Context* cc,
3373 const std::vector<CJS_Value>& params, 3285 const std::vector<CJS_Value>& params,
3374 CJS_Value& vRet, 3286 CJS_Value& vRet,
3375 CFX_WideString& sError) { 3287 CFX_WideString& sError) {
3376 ASSERT(m_pDocument != NULL);
3377
3378 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 3288 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
3379 if (FieldArray.empty()) 3289 if (FieldArray.empty())
3380 return FALSE; 3290 return FALSE;
3381 3291
3382 CPDF_FormField* pFormField = FieldArray[0]; 3292 CPDF_FormField* pFormField = FieldArray[0];
3383 int32_t nCount = pFormField->CountControls(); 3293 int32_t nCount = pFormField->CountControls();
3384 if (nCount < 1) 3294 if (nCount < 1)
3385 return FALSE; 3295 return FALSE;
3386 3296
3387 CPDFSDK_InterForm* pInterForm = 3297 CPDFSDK_InterForm* pInterForm =
3388 (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); 3298 (CPDFSDK_InterForm*)m_pDocument->GetInterForm();
3389 ASSERT(pInterForm != NULL);
3390
3391 CPDFSDK_Widget* pWidget = NULL; 3299 CPDFSDK_Widget* pWidget = NULL;
3392 if (nCount == 1) { 3300 if (nCount == 1) {
3393 pWidget = pInterForm->GetWidget(pFormField->GetControl(0)); 3301 pWidget = pInterForm->GetWidget(pFormField->GetControl(0));
3394 } else { 3302 } else {
3395 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); 3303 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv();
3396 UnderlyingPageType* pPage = UnderlyingFromFPDFPage( 3304 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(
3397 pEnv->FFI_GetCurrentPage(m_pDocument->GetUnderlyingDocument())); 3305 pEnv->FFI_GetCurrentPage(m_pDocument->GetUnderlyingDocument()));
3398 if (!pPage) 3306 if (!pPage)
3399 return FALSE; 3307 return FALSE;
3400 if (CPDFSDK_PageView* pCurPageView = m_pDocument->GetPageView(pPage)) { 3308 if (CPDFSDK_PageView* pCurPageView = m_pDocument->GetPageView(pPage)) {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
3476 FX_BOOL Field::source(IJS_Context* cc, 3384 FX_BOOL Field::source(IJS_Context* cc,
3477 CJS_PropValue& vp, 3385 CJS_PropValue& vp,
3478 CFX_WideString& sError) { 3386 CFX_WideString& sError) {
3479 if (vp.IsGetting()) { 3387 if (vp.IsGetting()) {
3480 vp << (CJS_Object*)NULL; 3388 vp << (CJS_Object*)NULL;
3481 } 3389 }
3482 3390
3483 return TRUE; 3391 return TRUE;
3484 } 3392 }
3485 3393
3486 /////////////////////////////////////////// delay
3487 ////////////////////////////////////////////////
3488
3489 void Field::AddDelay_Int(enum FIELD_PROP prop, int32_t n) { 3394 void Field::AddDelay_Int(enum FIELD_PROP prop, int32_t n) {
3490 ASSERT(m_pJSDoc != NULL);
3491
3492 CJS_DelayData* pNewData = new CJS_DelayData; 3395 CJS_DelayData* pNewData = new CJS_DelayData;
3493 pNewData->sFieldName = m_FieldName; 3396 pNewData->sFieldName = m_FieldName;
3494 pNewData->nControlIndex = m_nFormControlIndex; 3397 pNewData->nControlIndex = m_nFormControlIndex;
3495 pNewData->eProp = prop; 3398 pNewData->eProp = prop;
3496 pNewData->num = n; 3399 pNewData->num = n;
3497 3400
3498 m_pJSDoc->AddDelayData(pNewData); 3401 m_pJSDoc->AddDelayData(pNewData);
3499 } 3402 }
3500 3403
3501 void Field::AddDelay_Bool(enum FIELD_PROP prop, bool b) { 3404 void Field::AddDelay_Bool(enum FIELD_PROP prop, bool b) {
3502 ASSERT(m_pJSDoc != NULL);
3503
3504 CJS_DelayData* pNewData = new CJS_DelayData; 3405 CJS_DelayData* pNewData = new CJS_DelayData;
3505 pNewData->sFieldName = m_FieldName; 3406 pNewData->sFieldName = m_FieldName;
3506 pNewData->nControlIndex = m_nFormControlIndex; 3407 pNewData->nControlIndex = m_nFormControlIndex;
3507 pNewData->eProp = prop; 3408 pNewData->eProp = prop;
3508 pNewData->b = b; 3409 pNewData->b = b;
3509 3410
3510 m_pJSDoc->AddDelayData(pNewData); 3411 m_pJSDoc->AddDelayData(pNewData);
3511 } 3412 }
3512 3413
3513 void Field::AddDelay_String(enum FIELD_PROP prop, 3414 void Field::AddDelay_String(enum FIELD_PROP prop,
3514 const CFX_ByteString& string) { 3415 const CFX_ByteString& string) {
3515 ASSERT(m_pJSDoc != NULL);
3516
3517 CJS_DelayData* pNewData = new CJS_DelayData; 3416 CJS_DelayData* pNewData = new CJS_DelayData;
3518 pNewData->sFieldName = m_FieldName; 3417 pNewData->sFieldName = m_FieldName;
3519 pNewData->nControlIndex = m_nFormControlIndex; 3418 pNewData->nControlIndex = m_nFormControlIndex;
3520 pNewData->eProp = prop; 3419 pNewData->eProp = prop;
3521 pNewData->string = string; 3420 pNewData->string = string;
3522 3421
3523 m_pJSDoc->AddDelayData(pNewData); 3422 m_pJSDoc->AddDelayData(pNewData);
3524 } 3423 }
3525 3424
3526 void Field::AddDelay_WideString(enum FIELD_PROP prop, 3425 void Field::AddDelay_WideString(enum FIELD_PROP prop,
3527 const CFX_WideString& string) { 3426 const CFX_WideString& string) {
3528 ASSERT(m_pJSDoc != NULL);
3529
3530 CJS_DelayData* pNewData = new CJS_DelayData; 3427 CJS_DelayData* pNewData = new CJS_DelayData;
3531 pNewData->sFieldName = m_FieldName; 3428 pNewData->sFieldName = m_FieldName;
3532 pNewData->nControlIndex = m_nFormControlIndex; 3429 pNewData->nControlIndex = m_nFormControlIndex;
3533 pNewData->eProp = prop; 3430 pNewData->eProp = prop;
3534 pNewData->widestring = string; 3431 pNewData->widestring = string;
3535 3432
3536 m_pJSDoc->AddDelayData(pNewData); 3433 m_pJSDoc->AddDelayData(pNewData);
3537 } 3434 }
3538 3435
3539 void Field::AddDelay_Rect(enum FIELD_PROP prop, const CPDF_Rect& rect) { 3436 void Field::AddDelay_Rect(enum FIELD_PROP prop, const CPDF_Rect& rect) {
3540 ASSERT(m_pJSDoc != NULL);
3541
3542 CJS_DelayData* pNewData = new CJS_DelayData; 3437 CJS_DelayData* pNewData = new CJS_DelayData;
3543 pNewData->sFieldName = m_FieldName; 3438 pNewData->sFieldName = m_FieldName;
3544 pNewData->nControlIndex = m_nFormControlIndex; 3439 pNewData->nControlIndex = m_nFormControlIndex;
3545 pNewData->eProp = prop; 3440 pNewData->eProp = prop;
3546 pNewData->rect = rect; 3441 pNewData->rect = rect;
3547 3442
3548 m_pJSDoc->AddDelayData(pNewData); 3443 m_pJSDoc->AddDelayData(pNewData);
3549 } 3444 }
3550 3445
3551 void Field::AddDelay_Color(enum FIELD_PROP prop, const CPWL_Color& color) { 3446 void Field::AddDelay_Color(enum FIELD_PROP prop, const CPWL_Color& color) {
3552 ASSERT(m_pJSDoc != NULL);
3553
3554 CJS_DelayData* pNewData = new CJS_DelayData; 3447 CJS_DelayData* pNewData = new CJS_DelayData;
3555 pNewData->sFieldName = m_FieldName; 3448 pNewData->sFieldName = m_FieldName;
3556 pNewData->nControlIndex = m_nFormControlIndex; 3449 pNewData->nControlIndex = m_nFormControlIndex;
3557 pNewData->eProp = prop; 3450 pNewData->eProp = prop;
3558 pNewData->color = color; 3451 pNewData->color = color;
3559 3452
3560 m_pJSDoc->AddDelayData(pNewData); 3453 m_pJSDoc->AddDelayData(pNewData);
3561 } 3454 }
3562 3455
3563 void Field::AddDelay_WordArray(enum FIELD_PROP prop, 3456 void Field::AddDelay_WordArray(enum FIELD_PROP prop,
3564 const CFX_DWordArray& array) { 3457 const CFX_DWordArray& array) {
3565 ASSERT(m_pJSDoc != NULL);
3566
3567 CJS_DelayData* pNewData = new CJS_DelayData; 3458 CJS_DelayData* pNewData = new CJS_DelayData;
3568 pNewData->sFieldName = m_FieldName; 3459 pNewData->sFieldName = m_FieldName;
3569 pNewData->nControlIndex = m_nFormControlIndex; 3460 pNewData->nControlIndex = m_nFormControlIndex;
3570 pNewData->eProp = prop; 3461 pNewData->eProp = prop;
3571 3462
3572 for (int i = 0, sz = array.GetSize(); i < sz; i++) 3463 for (int i = 0, sz = array.GetSize(); i < sz; i++)
3573 pNewData->wordarray.Add(array.GetAt(i)); 3464 pNewData->wordarray.Add(array.GetAt(i));
3574 3465
3575 m_pJSDoc->AddDelayData(pNewData); 3466 m_pJSDoc->AddDelayData(pNewData);
3576 } 3467 }
3577 3468
3578 void Field::AddDelay_WideStringArray(enum FIELD_PROP prop, 3469 void Field::AddDelay_WideStringArray(enum FIELD_PROP prop,
3579 const CJS_WideStringArray& array) { 3470 const CJS_WideStringArray& array) {
3580 ASSERT(m_pJSDoc != NULL);
3581
3582 CJS_DelayData* pNewData = new CJS_DelayData; 3471 CJS_DelayData* pNewData = new CJS_DelayData;
3583 pNewData->sFieldName = m_FieldName; 3472 pNewData->sFieldName = m_FieldName;
3584 pNewData->nControlIndex = m_nFormControlIndex; 3473 pNewData->nControlIndex = m_nFormControlIndex;
3585 pNewData->eProp = prop; 3474 pNewData->eProp = prop;
3586 for (int i = 0, sz = array.GetSize(); i < sz; i++) 3475 for (int i = 0, sz = array.GetSize(); i < sz; i++)
3587 pNewData->widestringarray.Add(array.GetAt(i)); 3476 pNewData->widestringarray.Add(array.GetAt(i));
3588 3477
3589 m_pJSDoc->AddDelayData(pNewData); 3478 m_pJSDoc->AddDelayData(pNewData);
3590 } 3479 }
3591 3480
3592 void Field::DoDelay(CPDFSDK_Document* pDocument, CJS_DelayData* pData) { 3481 void Field::DoDelay(CPDFSDK_Document* pDocument, CJS_DelayData* pData) {
3593 ASSERT(pDocument != NULL); 3482 ASSERT(pDocument);
3594 ASSERT(pData != NULL);
3595 3483
3596 switch (pData->eProp) { 3484 switch (pData->eProp) {
3597 case FP_ALIGNMENT: 3485 case FP_ALIGNMENT:
3598 Field::SetAlignment(pDocument, pData->sFieldName, pData->nControlIndex, 3486 Field::SetAlignment(pDocument, pData->sFieldName, pData->nControlIndex,
3599 pData->string); 3487 pData->string);
3600 break; 3488 break;
3601 case FP_BORDERSTYLE: 3489 case FP_BORDERSTYLE:
3602 Field::SetBorderStyle(pDocument, pData->sFieldName, pData->nControlIndex, 3490 Field::SetBorderStyle(pDocument, pData->sFieldName, pData->nControlIndex,
3603 pData->string); 3491 pData->string);
3604 break; 3492 break;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
3724 Field::SetUserName(pDocument, pData->sFieldName, pData->nControlIndex, 3612 Field::SetUserName(pDocument, pData->sFieldName, pData->nControlIndex,
3725 pData->widestring); 3613 pData->widestring);
3726 break; 3614 break;
3727 case FP_VALUE: 3615 case FP_VALUE:
3728 Field::SetValue(pDocument, pData->sFieldName, pData->nControlIndex, 3616 Field::SetValue(pDocument, pData->sFieldName, pData->nControlIndex,
3729 pData->widestringarray); 3617 pData->widestringarray);
3730 break; 3618 break;
3731 } 3619 }
3732 } 3620 }
3733 3621
3734 #define JS_FIELD_MINWIDTH 1
3735 #define JS_FIELD_MINHEIGHT 1
3736
3737 void Field::AddField(CPDFSDK_Document* pDocument, 3622 void Field::AddField(CPDFSDK_Document* pDocument,
3738 int nPageIndex, 3623 int nPageIndex,
3739 int nFieldType, 3624 int nFieldType,
3740 const CFX_WideString& sName, 3625 const CFX_WideString& sName,
3741 const CPDF_Rect& rcCoords) { 3626 const CPDF_Rect& rcCoords) {
3742 // Not supported. 3627 // Not supported.
3743 } 3628 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698