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

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

Issue 2337583002: Make javascript field observe sdk document (Closed)
Patch Set: Created 4 years, 3 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
« fpdfsdk/javascript/Field.h ('K') | « fpdfsdk/javascript/Field.h ('k') | no next file » | 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 "fpdfsdk/javascript/Field.h" 7 #include "fpdfsdk/javascript/Field.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 iControlNo = -1; 202 iControlNo = -1;
203 return; 203 return;
204 } 204 }
205 } 205 }
206 strFieldName = strFieldNameParsed.substr(0, iStart); 206 strFieldName = strFieldNameParsed.substr(0, iStart);
207 } 207 }
208 208
209 FX_BOOL Field::AttachField(Document* pDocument, 209 FX_BOOL Field::AttachField(Document* pDocument,
210 const CFX_WideString& csFieldName) { 210 const CFX_WideString& csFieldName) {
211 m_pJSDoc = pDocument; 211 m_pJSDoc = pDocument;
212 m_pDocument = pDocument->GetReaderDoc(); 212 m_pDocument.Reset(pDocument->GetReaderDoc());
213 m_bCanSet = m_pDocument->GetPermissions(FPDFPERM_FILL_FORM) || 213 m_bCanSet = m_pDocument->GetPermissions(FPDFPERM_FILL_FORM) ||
214 m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM) || 214 m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM) ||
215 m_pDocument->GetPermissions(FPDFPERM_MODIFY); 215 m_pDocument->GetPermissions(FPDFPERM_MODIFY);
216 216
217 CPDFSDK_InterForm* pRDInterForm = m_pDocument->GetInterForm(); 217 CPDFSDK_InterForm* pRDInterForm = m_pDocument->GetInterForm();
218 CPDF_InterForm* pInterForm = pRDInterForm->GetInterForm(); 218 CPDF_InterForm* pInterForm = pRDInterForm->GetInterForm();
219 CFX_WideString swFieldNameTemp = csFieldName; 219 CFX_WideString swFieldNameTemp = csFieldName;
220 swFieldNameTemp.Replace(L"..", L"."); 220 swFieldNameTemp.Replace(L"..", L".");
221 221
222 if (pInterForm->CountFields(swFieldNameTemp) <= 0) { 222 if (pInterForm->CountFields(swFieldNameTemp) <= 0) {
(...skipping 22 matching lines...) Expand all
245 CPDF_InterForm* pInterForm = pReaderInterForm->GetInterForm(); 245 CPDF_InterForm* pInterForm = pReaderInterForm->GetInterForm();
246 for (int i = 0, sz = pInterForm->CountFields(csFieldName); i < sz; ++i) { 246 for (int i = 0, sz = pInterForm->CountFields(csFieldName); i < sz; ++i) {
247 if (CPDF_FormField* pFormField = pInterForm->GetField(i, csFieldName)) 247 if (CPDF_FormField* pFormField = pInterForm->GetField(i, csFieldName))
248 fields.push_back(pFormField); 248 fields.push_back(pFormField);
249 } 249 }
250 return fields; 250 return fields;
251 } 251 }
252 252
253 std::vector<CPDF_FormField*> Field::GetFormFields( 253 std::vector<CPDF_FormField*> Field::GetFormFields(
254 const CFX_WideString& csFieldName) const { 254 const CFX_WideString& csFieldName) const {
255 return Field::GetFormFields(m_pDocument, csFieldName); 255 return Field::GetFormFields(m_pDocument.Get(), csFieldName);
256 } 256 }
257 257
258 void Field::UpdateFormField(CPDFSDK_Document* pDocument, 258 void Field::UpdateFormField(CPDFSDK_Document* pDocument,
259 CPDF_FormField* pFormField, 259 CPDF_FormField* pFormField,
260 FX_BOOL bChangeMark, 260 FX_BOOL bChangeMark,
261 FX_BOOL bResetAP, 261 FX_BOOL bResetAP,
262 FX_BOOL bRefresh) { 262 FX_BOOL bRefresh) {
263 CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm(); 263 CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm();
264 264
265 if (bResetAP) { 265 if (bResetAP) {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 if (vp.IsSetting()) { 374 if (vp.IsSetting()) {
375 if (!m_bCanSet) 375 if (!m_bCanSet)
376 return FALSE; 376 return FALSE;
377 377
378 CFX_ByteString alignStr; 378 CFX_ByteString alignStr;
379 vp >> alignStr; 379 vp >> alignStr;
380 380
381 if (m_bDelay) { 381 if (m_bDelay) {
382 AddDelay_String(FP_ALIGNMENT, alignStr); 382 AddDelay_String(FP_ALIGNMENT, alignStr);
383 } else { 383 } else {
384 Field::SetAlignment(m_pDocument, m_FieldName, m_nFormControlIndex, 384 Field::SetAlignment(m_pDocument.Get(), m_FieldName, m_nFormControlIndex,
385 alignStr); 385 alignStr);
386 } 386 }
387 } else { 387 } else {
388 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 388 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
389 if (FieldArray.empty()) 389 if (FieldArray.empty())
390 return FALSE; 390 return FALSE;
391 391
392 CPDF_FormField* pFormField = FieldArray[0]; 392 CPDF_FormField* pFormField = FieldArray[0];
393 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) 393 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD)
394 return FALSE; 394 return FALSE;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 if (vp.IsSetting()) { 430 if (vp.IsSetting()) {
431 if (!m_bCanSet) 431 if (!m_bCanSet)
432 return FALSE; 432 return FALSE;
433 433
434 CFX_ByteString strType = ""; 434 CFX_ByteString strType = "";
435 vp >> strType; 435 vp >> strType;
436 436
437 if (m_bDelay) { 437 if (m_bDelay) {
438 AddDelay_String(FP_BORDERSTYLE, strType); 438 AddDelay_String(FP_BORDERSTYLE, strType);
439 } else { 439 } else {
440 Field::SetBorderStyle(m_pDocument, m_FieldName, m_nFormControlIndex, 440 Field::SetBorderStyle(m_pDocument.Get(), m_FieldName, m_nFormControlIndex,
441 strType); 441 strType);
442 } 442 }
443 } else { 443 } else {
444 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 444 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
445 if (FieldArray.empty()) 445 if (FieldArray.empty())
446 return FALSE; 446 return FALSE;
447 447
448 CPDF_FormField* pFormField = FieldArray[0]; 448 CPDF_FormField* pFormField = FieldArray[0];
449 if (!pFormField) 449 if (!pFormField)
450 return FALSE; 450 return FALSE;
451 451
452 CPDFSDK_Widget* pWidget = 452 CPDFSDK_Widget* pWidget =
453 GetWidget(m_pDocument, GetSmartFieldControl(pFormField), false); 453 GetWidget(m_pDocument.Get(), GetSmartFieldControl(pFormField), false);
454 if (!pWidget) 454 if (!pWidget)
455 return FALSE; 455 return FALSE;
456 456
457 switch (pWidget->GetBorderStyle()) { 457 switch (pWidget->GetBorderStyle()) {
458 case BorderStyle::SOLID: 458 case BorderStyle::SOLID:
459 vp << L"solid"; 459 vp << L"solid";
460 break; 460 break;
461 case BorderStyle::DASH: 461 case BorderStyle::DASH:
462 vp << L"dashed"; 462 vp << L"dashed";
463 break; 463 break;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 if (vp.IsSetting()) { 540 if (vp.IsSetting()) {
541 if (!m_bCanSet) 541 if (!m_bCanSet)
542 return FALSE; 542 return FALSE;
543 543
544 int nVP; 544 int nVP;
545 vp >> nVP; 545 vp >> nVP;
546 546
547 if (m_bDelay) { 547 if (m_bDelay) {
548 AddDelay_Int(FP_BUTTONALIGNX, nVP); 548 AddDelay_Int(FP_BUTTONALIGNX, nVP);
549 } else { 549 } else {
550 Field::SetButtonAlignX(m_pDocument, m_FieldName, m_nFormControlIndex, 550 Field::SetButtonAlignX(m_pDocument.Get(), m_FieldName,
551 nVP); 551 m_nFormControlIndex, nVP);
552 } 552 }
553 } else { 553 } else {
554 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 554 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
555 if (FieldArray.empty()) 555 if (FieldArray.empty())
556 return FALSE; 556 return FALSE;
557 557
558 CPDF_FormField* pFormField = FieldArray[0]; 558 CPDF_FormField* pFormField = FieldArray[0];
559 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) 559 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON)
560 return FALSE; 560 return FALSE;
561 561
(...skipping 27 matching lines...) Expand all
589 if (vp.IsSetting()) { 589 if (vp.IsSetting()) {
590 if (!m_bCanSet) 590 if (!m_bCanSet)
591 return FALSE; 591 return FALSE;
592 592
593 int nVP; 593 int nVP;
594 vp >> nVP; 594 vp >> nVP;
595 595
596 if (m_bDelay) { 596 if (m_bDelay) {
597 AddDelay_Int(FP_BUTTONALIGNY, nVP); 597 AddDelay_Int(FP_BUTTONALIGNY, nVP);
598 } else { 598 } else {
599 Field::SetButtonAlignY(m_pDocument, m_FieldName, m_nFormControlIndex, 599 Field::SetButtonAlignY(m_pDocument.Get(), m_FieldName,
600 nVP); 600 m_nFormControlIndex, nVP);
601 } 601 }
602 } else { 602 } else {
603 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 603 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
604 if (FieldArray.empty()) 604 if (FieldArray.empty())
605 return FALSE; 605 return FALSE;
606 606
607 CPDF_FormField* pFormField = FieldArray[0]; 607 CPDF_FormField* pFormField = FieldArray[0];
608 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) 608 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON)
609 return FALSE; 609 return FALSE;
610 610
(...skipping 27 matching lines...) Expand all
638 if (vp.IsSetting()) { 638 if (vp.IsSetting()) {
639 if (!m_bCanSet) 639 if (!m_bCanSet)
640 return FALSE; 640 return FALSE;
641 641
642 bool bVP; 642 bool bVP;
643 vp >> bVP; 643 vp >> bVP;
644 644
645 if (m_bDelay) { 645 if (m_bDelay) {
646 AddDelay_Bool(FP_BUTTONFITBOUNDS, bVP); 646 AddDelay_Bool(FP_BUTTONFITBOUNDS, bVP);
647 } else { 647 } else {
648 Field::SetButtonFitBounds(m_pDocument, m_FieldName, m_nFormControlIndex, 648 Field::SetButtonFitBounds(m_pDocument.Get(), m_FieldName,
649 bVP); 649 m_nFormControlIndex, bVP);
650 } 650 }
651 } else { 651 } else {
652 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 652 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
653 if (FieldArray.empty()) 653 if (FieldArray.empty())
654 return FALSE; 654 return FALSE;
655 655
656 CPDF_FormField* pFormField = FieldArray[0]; 656 CPDF_FormField* pFormField = FieldArray[0];
657 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) 657 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON)
658 return FALSE; 658 return FALSE;
659 659
(...skipping 22 matching lines...) Expand all
682 if (vp.IsSetting()) { 682 if (vp.IsSetting()) {
683 if (!m_bCanSet) 683 if (!m_bCanSet)
684 return FALSE; 684 return FALSE;
685 685
686 int nVP; 686 int nVP;
687 vp >> nVP; 687 vp >> nVP;
688 688
689 if (m_bDelay) { 689 if (m_bDelay) {
690 AddDelay_Int(FP_BUTTONPOSITION, nVP); 690 AddDelay_Int(FP_BUTTONPOSITION, nVP);
691 } else { 691 } else {
692 Field::SetButtonPosition(m_pDocument, m_FieldName, m_nFormControlIndex, 692 Field::SetButtonPosition(m_pDocument.Get(), m_FieldName,
693 nVP); 693 m_nFormControlIndex, nVP);
694 } 694 }
695 } else { 695 } else {
696 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 696 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
697 if (FieldArray.empty()) 697 if (FieldArray.empty())
698 return FALSE; 698 return FALSE;
699 699
700 CPDF_FormField* pFormField = FieldArray[0]; 700 CPDF_FormField* pFormField = FieldArray[0];
701 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) 701 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON)
702 return FALSE; 702 return FALSE;
703 703
(...skipping 21 matching lines...) Expand all
725 if (vp.IsSetting()) { 725 if (vp.IsSetting()) {
726 if (!m_bCanSet) 726 if (!m_bCanSet)
727 return FALSE; 727 return FALSE;
728 728
729 int nVP; 729 int nVP;
730 vp >> nVP; 730 vp >> nVP;
731 731
732 if (m_bDelay) { 732 if (m_bDelay) {
733 AddDelay_Int(FP_BUTTONSCALEHOW, nVP); 733 AddDelay_Int(FP_BUTTONSCALEHOW, nVP);
734 } else { 734 } else {
735 Field::SetButtonScaleHow(m_pDocument, m_FieldName, m_nFormControlIndex, 735 Field::SetButtonScaleHow(m_pDocument.Get(), m_FieldName,
736 nVP); 736 m_nFormControlIndex, nVP);
737 } 737 }
738 } else { 738 } else {
739 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 739 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
740 if (FieldArray.empty()) 740 if (FieldArray.empty())
741 return FALSE; 741 return FALSE;
742 742
743 CPDF_FormField* pFormField = FieldArray[0]; 743 CPDF_FormField* pFormField = FieldArray[0];
744 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) 744 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON)
745 return FALSE; 745 return FALSE;
746 746
(...skipping 26 matching lines...) Expand all
773 if (vp.IsSetting()) { 773 if (vp.IsSetting()) {
774 if (!m_bCanSet) 774 if (!m_bCanSet)
775 return FALSE; 775 return FALSE;
776 776
777 int nVP; 777 int nVP;
778 vp >> nVP; 778 vp >> nVP;
779 779
780 if (m_bDelay) { 780 if (m_bDelay) {
781 AddDelay_Int(FP_BUTTONSCALEWHEN, nVP); 781 AddDelay_Int(FP_BUTTONSCALEWHEN, nVP);
782 } else { 782 } else {
783 Field::SetButtonScaleWhen(m_pDocument, m_FieldName, m_nFormControlIndex, 783 Field::SetButtonScaleWhen(m_pDocument.Get(), m_FieldName,
784 nVP); 784 m_nFormControlIndex, nVP);
785 } 785 }
786 } else { 786 } else {
787 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 787 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
788 if (FieldArray.empty()) 788 if (FieldArray.empty())
789 return FALSE; 789 return FALSE;
790 790
791 CPDF_FormField* pFormField = FieldArray[0]; 791 CPDF_FormField* pFormField = FieldArray[0];
792 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) 792 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON)
793 return FALSE; 793 return FALSE;
794 794
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 if (vp.IsSetting()) { 832 if (vp.IsSetting()) {
833 if (!m_bCanSet) 833 if (!m_bCanSet)
834 return FALSE; 834 return FALSE;
835 835
836 int nVP; 836 int nVP;
837 vp >> nVP; 837 vp >> nVP;
838 838
839 if (m_bDelay) { 839 if (m_bDelay) {
840 AddDelay_Int(FP_CALCORDERINDEX, nVP); 840 AddDelay_Int(FP_CALCORDERINDEX, nVP);
841 } else { 841 } else {
842 Field::SetCalcOrderIndex(m_pDocument, m_FieldName, m_nFormControlIndex, 842 Field::SetCalcOrderIndex(m_pDocument.Get(), m_FieldName,
843 nVP); 843 m_nFormControlIndex, nVP);
844 } 844 }
845 } else { 845 } else {
846 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 846 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
847 if (FieldArray.empty()) 847 if (FieldArray.empty())
848 return FALSE; 848 return FALSE;
849 849
850 CPDF_FormField* pFormField = FieldArray[0]; 850 CPDF_FormField* pFormField = FieldArray[0];
851 if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX && 851 if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX &&
852 pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) { 852 pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) {
853 return FALSE; 853 return FALSE;
(...skipping 22 matching lines...) Expand all
876 if (vp.IsSetting()) { 876 if (vp.IsSetting()) {
877 if (!m_bCanSet) 877 if (!m_bCanSet)
878 return FALSE; 878 return FALSE;
879 879
880 int nVP; 880 int nVP;
881 vp >> nVP; 881 vp >> nVP;
882 882
883 if (m_bDelay) { 883 if (m_bDelay) {
884 AddDelay_Int(FP_CHARLIMIT, nVP); 884 AddDelay_Int(FP_CHARLIMIT, nVP);
885 } else { 885 } else {
886 Field::SetCharLimit(m_pDocument, m_FieldName, m_nFormControlIndex, nVP); 886 Field::SetCharLimit(m_pDocument.Get(), m_FieldName, m_nFormControlIndex,
887 nVP);
887 } 888 }
888 } else { 889 } else {
889 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 890 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
890 if (FieldArray.empty()) 891 if (FieldArray.empty())
891 return FALSE; 892 return FALSE;
892 893
893 CPDF_FormField* pFormField = FieldArray[0]; 894 CPDF_FormField* pFormField = FieldArray[0];
894 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) 895 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD)
895 return FALSE; 896 return FALSE;
896 897
(...skipping 17 matching lines...) Expand all
914 if (vp.IsSetting()) { 915 if (vp.IsSetting()) {
915 if (!m_bCanSet) 916 if (!m_bCanSet)
916 return FALSE; 917 return FALSE;
917 918
918 bool bVP; 919 bool bVP;
919 vp >> bVP; 920 vp >> bVP;
920 921
921 if (m_bDelay) { 922 if (m_bDelay) {
922 AddDelay_Bool(FP_COMB, bVP); 923 AddDelay_Bool(FP_COMB, bVP);
923 } else { 924 } else {
924 Field::SetComb(m_pDocument, m_FieldName, m_nFormControlIndex, bVP); 925 Field::SetComb(m_pDocument.Get(), m_FieldName, m_nFormControlIndex, bVP);
925 } 926 }
926 } else { 927 } else {
927 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 928 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
928 if (FieldArray.empty()) 929 if (FieldArray.empty())
929 return FALSE; 930 return FALSE;
930 931
931 CPDF_FormField* pFormField = FieldArray[0]; 932 CPDF_FormField* pFormField = FieldArray[0];
932 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) 933 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD)
933 return FALSE; 934 return FALSE;
934 935
(...skipping 21 matching lines...) Expand all
956 if (vp.IsSetting()) { 957 if (vp.IsSetting()) {
957 if (!m_bCanSet) 958 if (!m_bCanSet)
958 return FALSE; 959 return FALSE;
959 960
960 bool bVP; 961 bool bVP;
961 vp >> bVP; 962 vp >> bVP;
962 963
963 if (m_bDelay) { 964 if (m_bDelay) {
964 AddDelay_Bool(FP_COMMITONSELCHANGE, bVP); 965 AddDelay_Bool(FP_COMMITONSELCHANGE, bVP);
965 } else { 966 } else {
966 Field::SetCommitOnSelChange(m_pDocument, m_FieldName, m_nFormControlIndex, 967 Field::SetCommitOnSelChange(m_pDocument.Get(), m_FieldName,
967 bVP); 968 m_nFormControlIndex, bVP);
968 } 969 }
969 } else { 970 } else {
970 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 971 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
971 if (FieldArray.empty()) 972 if (FieldArray.empty())
972 return FALSE; 973 return FALSE;
973 974
974 CPDF_FormField* pFormField = FieldArray[0]; 975 CPDF_FormField* pFormField = FieldArray[0];
975 if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX && 976 if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX &&
976 pFormField->GetFieldType() != FIELDTYPE_LISTBOX) { 977 pFormField->GetFieldType() != FIELDTYPE_LISTBOX) {
977 return FALSE; 978 return FALSE;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1015 for (int i = 0, sz = SelArray.GetLength(pRuntime); i < sz; i++) { 1016 for (int i = 0, sz = SelArray.GetLength(pRuntime); i < sz; i++) {
1016 SelArray.GetElement(pRuntime, i, SelValue); 1017 SelArray.GetElement(pRuntime, i, SelValue);
1017 iSelecting = SelValue.ToInt(pRuntime); 1018 iSelecting = SelValue.ToInt(pRuntime);
1018 array.push_back(iSelecting); 1019 array.push_back(iSelecting);
1019 } 1020 }
1020 } 1021 }
1021 1022
1022 if (m_bDelay) { 1023 if (m_bDelay) {
1023 AddDelay_WordArray(FP_CURRENTVALUEINDICES, array); 1024 AddDelay_WordArray(FP_CURRENTVALUEINDICES, array);
1024 } else { 1025 } else {
1025 Field::SetCurrentValueIndices(m_pDocument, m_FieldName, 1026 Field::SetCurrentValueIndices(m_pDocument.Get(), m_FieldName,
1026 m_nFormControlIndex, array); 1027 m_nFormControlIndex, array);
1027 } 1028 }
1028 } else { 1029 } else {
1029 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 1030 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
1030 if (FieldArray.empty()) 1031 if (FieldArray.empty())
1031 return FALSE; 1032 return FALSE;
1032 1033
1033 CPDF_FormField* pFormField = FieldArray[0]; 1034 CPDF_FormField* pFormField = FieldArray[0];
1034 if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX && 1035 if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX &&
1035 pFormField->GetFieldType() != FIELDTYPE_LISTBOX) { 1036 pFormField->GetFieldType() != FIELDTYPE_LISTBOX) {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1099 if (vp.IsSetting()) { 1100 if (vp.IsSetting()) {
1100 if (!m_bCanSet) 1101 if (!m_bCanSet)
1101 return FALSE; 1102 return FALSE;
1102 1103
1103 CFX_WideString WideStr; 1104 CFX_WideString WideStr;
1104 vp >> WideStr; 1105 vp >> WideStr;
1105 1106
1106 if (m_bDelay) { 1107 if (m_bDelay) {
1107 AddDelay_WideString(FP_DEFAULTVALUE, WideStr); 1108 AddDelay_WideString(FP_DEFAULTVALUE, WideStr);
1108 } else { 1109 } else {
1109 Field::SetDefaultValue(m_pDocument, m_FieldName, m_nFormControlIndex, 1110 Field::SetDefaultValue(m_pDocument.Get(), m_FieldName,
1110 WideStr); 1111 m_nFormControlIndex, WideStr);
1111 } 1112 }
1112 } else { 1113 } else {
1113 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 1114 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
1114 if (FieldArray.empty()) 1115 if (FieldArray.empty())
1115 return FALSE; 1116 return FALSE;
1116 1117
1117 CPDF_FormField* pFormField = FieldArray[0]; 1118 CPDF_FormField* pFormField = FieldArray[0];
1118 if (pFormField->GetFieldType() == FIELDTYPE_PUSHBUTTON || 1119 if (pFormField->GetFieldType() == FIELDTYPE_PUSHBUTTON ||
1119 pFormField->GetFieldType() == FIELDTYPE_SIGNATURE) { 1120 pFormField->GetFieldType() == FIELDTYPE_SIGNATURE) {
1120 return FALSE; 1121 return FALSE;
(...skipping 19 matching lines...) Expand all
1140 if (vp.IsSetting()) { 1141 if (vp.IsSetting()) {
1141 if (!m_bCanSet) 1142 if (!m_bCanSet)
1142 return FALSE; 1143 return FALSE;
1143 1144
1144 bool bVP; 1145 bool bVP;
1145 vp >> bVP; 1146 vp >> bVP;
1146 1147
1147 if (m_bDelay) { 1148 if (m_bDelay) {
1148 AddDelay_Bool(FP_DONOTSCROLL, bVP); 1149 AddDelay_Bool(FP_DONOTSCROLL, bVP);
1149 } else { 1150 } else {
1150 Field::SetDoNotScroll(m_pDocument, m_FieldName, m_nFormControlIndex, bVP); 1151 Field::SetDoNotScroll(m_pDocument.Get(), m_FieldName, m_nFormControlIndex,
1152 bVP);
1151 } 1153 }
1152 } else { 1154 } else {
1153 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 1155 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
1154 if (FieldArray.empty()) 1156 if (FieldArray.empty())
1155 return FALSE; 1157 return FALSE;
1156 1158
1157 CPDF_FormField* pFormField = FieldArray[0]; 1159 CPDF_FormField* pFormField = FieldArray[0];
1158 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) 1160 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD)
1159 return FALSE; 1161 return FALSE;
1160 1162
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 if (vp.IsSetting()) { 1239 if (vp.IsSetting()) {
1238 if (!m_bCanSet) 1240 if (!m_bCanSet)
1239 return FALSE; 1241 return FALSE;
1240 1242
1241 int nVP; 1243 int nVP;
1242 vp >> nVP; 1244 vp >> nVP;
1243 1245
1244 if (m_bDelay) { 1246 if (m_bDelay) {
1245 AddDelay_Int(FP_DISPLAY, nVP); 1247 AddDelay_Int(FP_DISPLAY, nVP);
1246 } else { 1248 } else {
1247 Field::SetDisplay(m_pDocument, m_FieldName, m_nFormControlIndex, nVP); 1249 Field::SetDisplay(m_pDocument.Get(), m_FieldName, m_nFormControlIndex,
1250 nVP);
1248 } 1251 }
1249 } else { 1252 } else {
1250 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 1253 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
1251 if (FieldArray.empty()) 1254 if (FieldArray.empty())
1252 return FALSE; 1255 return FALSE;
1253 1256
1254 CPDF_FormField* pFormField = FieldArray[0]; 1257 CPDF_FormField* pFormField = FieldArray[0];
1255 ASSERT(pFormField); 1258 ASSERT(pFormField);
1256 CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); 1259 CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm();
1257 CPDFSDK_Widget* pWidget = 1260 CPDFSDK_Widget* pWidget =
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1439 if (!vp.GetJSValue()->IsArrayObject()) 1442 if (!vp.GetJSValue()->IsArrayObject())
1440 return FALSE; 1443 return FALSE;
1441 1444
1442 vp >> crArray; 1445 vp >> crArray;
1443 1446
1444 CPWL_Color color; 1447 CPWL_Color color;
1445 color::ConvertArrayToPWLColor(pRuntime, crArray, &color); 1448 color::ConvertArrayToPWLColor(pRuntime, crArray, &color);
1446 if (m_bDelay) { 1449 if (m_bDelay) {
1447 AddDelay_Color(FP_FILLCOLOR, color); 1450 AddDelay_Color(FP_FILLCOLOR, color);
1448 } else { 1451 } else {
1449 Field::SetFillColor(m_pDocument, m_FieldName, m_nFormControlIndex, color); 1452 Field::SetFillColor(m_pDocument.Get(), m_FieldName, m_nFormControlIndex,
1453 color);
1450 } 1454 }
1451 } else { 1455 } else {
1452 CPDF_FormField* pFormField = FieldArray[0]; 1456 CPDF_FormField* pFormField = FieldArray[0];
1453 ASSERT(pFormField); 1457 ASSERT(pFormField);
1454 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); 1458 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
1455 if (!pFormControl) 1459 if (!pFormControl)
1456 return FALSE; 1460 return FALSE;
1457 1461
1458 int iColorType; 1462 int iColorType;
1459 pFormControl->GetBackgroundColor(iColorType); 1463 pFormControl->GetBackgroundColor(iColorType);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1499 if (vp.IsSetting()) { 1503 if (vp.IsSetting()) {
1500 if (!m_bCanSet) 1504 if (!m_bCanSet)
1501 return FALSE; 1505 return FALSE;
1502 1506
1503 bool bVP; 1507 bool bVP;
1504 vp >> bVP; 1508 vp >> bVP;
1505 1509
1506 if (m_bDelay) { 1510 if (m_bDelay) {
1507 AddDelay_Bool(FP_HIDDEN, bVP); 1511 AddDelay_Bool(FP_HIDDEN, bVP);
1508 } else { 1512 } else {
1509 Field::SetHidden(m_pDocument, m_FieldName, m_nFormControlIndex, bVP); 1513 Field::SetHidden(m_pDocument.Get(), m_FieldName, m_nFormControlIndex,
1514 bVP);
1510 } 1515 }
1511 } else { 1516 } else {
1512 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 1517 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
1513 if (FieldArray.empty()) 1518 if (FieldArray.empty())
1514 return FALSE; 1519 return FALSE;
1515 1520
1516 CPDF_FormField* pFormField = FieldArray[0]; 1521 CPDF_FormField* pFormField = FieldArray[0];
1517 ASSERT(pFormField); 1522 ASSERT(pFormField);
1518 CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); 1523 CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm();
1519 CPDFSDK_Widget* pWidget = 1524 CPDFSDK_Widget* pWidget =
(...skipping 28 matching lines...) Expand all
1548 if (vp.IsSetting()) { 1553 if (vp.IsSetting()) {
1549 if (!m_bCanSet) 1554 if (!m_bCanSet)
1550 return FALSE; 1555 return FALSE;
1551 1556
1552 CFX_ByteString strMode; 1557 CFX_ByteString strMode;
1553 vp >> strMode; 1558 vp >> strMode;
1554 1559
1555 if (m_bDelay) { 1560 if (m_bDelay) {
1556 AddDelay_String(FP_HIGHLIGHT, strMode); 1561 AddDelay_String(FP_HIGHLIGHT, strMode);
1557 } else { 1562 } else {
1558 Field::SetHighlight(m_pDocument, m_FieldName, m_nFormControlIndex, 1563 Field::SetHighlight(m_pDocument.Get(), m_FieldName, m_nFormControlIndex,
1559 strMode); 1564 strMode);
1560 } 1565 }
1561 } else { 1566 } else {
1562 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 1567 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
1563 if (FieldArray.empty()) 1568 if (FieldArray.empty())
1564 return FALSE; 1569 return FALSE;
1565 1570
1566 CPDF_FormField* pFormField = FieldArray[0]; 1571 CPDF_FormField* pFormField = FieldArray[0];
1567 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) 1572 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON)
1568 return FALSE; 1573 return FALSE;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1607 if (vp.IsSetting()) { 1612 if (vp.IsSetting()) {
1608 if (!m_bCanSet) 1613 if (!m_bCanSet)
1609 return FALSE; 1614 return FALSE;
1610 1615
1611 int iWidth; 1616 int iWidth;
1612 vp >> iWidth; 1617 vp >> iWidth;
1613 1618
1614 if (m_bDelay) { 1619 if (m_bDelay) {
1615 AddDelay_Int(FP_LINEWIDTH, iWidth); 1620 AddDelay_Int(FP_LINEWIDTH, iWidth);
1616 } else { 1621 } else {
1617 Field::SetLineWidth(m_pDocument, m_FieldName, m_nFormControlIndex, 1622 Field::SetLineWidth(m_pDocument.Get(), m_FieldName, m_nFormControlIndex,
1618 iWidth); 1623 iWidth);
1619 } 1624 }
1620 } else { 1625 } else {
1621 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 1626 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
1622 if (FieldArray.empty()) 1627 if (FieldArray.empty())
1623 return FALSE; 1628 return FALSE;
1624 1629
1625 CPDF_FormField* pFormField = FieldArray[0]; 1630 CPDF_FormField* pFormField = FieldArray[0];
1626 ASSERT(pFormField); 1631 ASSERT(pFormField);
1627 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); 1632 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1692 if (vp.IsSetting()) { 1697 if (vp.IsSetting()) {
1693 if (!m_bCanSet) 1698 if (!m_bCanSet)
1694 return FALSE; 1699 return FALSE;
1695 1700
1696 bool bVP; 1701 bool bVP;
1697 vp >> bVP; 1702 vp >> bVP;
1698 1703
1699 if (m_bDelay) { 1704 if (m_bDelay) {
1700 AddDelay_Bool(FP_MULTILINE, bVP); 1705 AddDelay_Bool(FP_MULTILINE, bVP);
1701 } else { 1706 } else {
1702 Field::SetMultiline(m_pDocument, m_FieldName, m_nFormControlIndex, bVP); 1707 Field::SetMultiline(m_pDocument.Get(), m_FieldName, m_nFormControlIndex,
1708 bVP);
1703 } 1709 }
1704 } else { 1710 } else {
1705 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 1711 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
1706 if (FieldArray.empty()) 1712 if (FieldArray.empty())
1707 return FALSE; 1713 return FALSE;
1708 1714
1709 CPDF_FormField* pFormField = FieldArray[0]; 1715 CPDF_FormField* pFormField = FieldArray[0];
1710 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) 1716 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD)
1711 return FALSE; 1717 return FALSE;
1712 1718
(...skipping 21 matching lines...) Expand all
1734 if (vp.IsSetting()) { 1740 if (vp.IsSetting()) {
1735 if (!m_bCanSet) 1741 if (!m_bCanSet)
1736 return FALSE; 1742 return FALSE;
1737 1743
1738 bool bVP; 1744 bool bVP;
1739 vp >> bVP; 1745 vp >> bVP;
1740 1746
1741 if (m_bDelay) { 1747 if (m_bDelay) {
1742 AddDelay_Bool(FP_MULTIPLESELECTION, bVP); 1748 AddDelay_Bool(FP_MULTIPLESELECTION, bVP);
1743 } else { 1749 } else {
1744 Field::SetMultipleSelection(m_pDocument, m_FieldName, m_nFormControlIndex, 1750 Field::SetMultipleSelection(m_pDocument.Get(), m_FieldName,
1745 bVP); 1751 m_nFormControlIndex, bVP);
1746 } 1752 }
1747 } else { 1753 } else {
1748 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 1754 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
1749 if (FieldArray.empty()) 1755 if (FieldArray.empty())
1750 return FALSE; 1756 return FALSE;
1751 1757
1752 CPDF_FormField* pFormField = FieldArray[0]; 1758 CPDF_FormField* pFormField = FieldArray[0];
1753 if (pFormField->GetFieldType() != FIELDTYPE_LISTBOX) 1759 if (pFormField->GetFieldType() != FIELDTYPE_LISTBOX)
1754 return FALSE; 1760 return FALSE;
1755 1761
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1849 if (vp.IsSetting()) { 1855 if (vp.IsSetting()) {
1850 if (!m_bCanSet) 1856 if (!m_bCanSet)
1851 return FALSE; 1857 return FALSE;
1852 1858
1853 bool bVP; 1859 bool bVP;
1854 vp >> bVP; 1860 vp >> bVP;
1855 1861
1856 if (m_bDelay) { 1862 if (m_bDelay) {
1857 AddDelay_Bool(FP_PASSWORD, bVP); 1863 AddDelay_Bool(FP_PASSWORD, bVP);
1858 } else { 1864 } else {
1859 Field::SetPassword(m_pDocument, m_FieldName, m_nFormControlIndex, bVP); 1865 Field::SetPassword(m_pDocument.Get(), m_FieldName, m_nFormControlIndex,
1866 bVP);
1860 } 1867 }
1861 } else { 1868 } else {
1862 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 1869 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
1863 if (FieldArray.empty()) 1870 if (FieldArray.empty())
1864 return FALSE; 1871 return FALSE;
1865 1872
1866 CPDF_FormField* pFormField = FieldArray[0]; 1873 CPDF_FormField* pFormField = FieldArray[0];
1867 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) 1874 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD)
1868 return FALSE; 1875 return FALSE;
1869 1876
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1911 dwFlags &= ~ANNOTFLAG_PRINT; 1918 dwFlags &= ~ANNOTFLAG_PRINT;
1912 1919
1913 if (dwFlags != pWidget->GetFlags()) { 1920 if (dwFlags != pWidget->GetFlags()) {
1914 pWidget->SetFlags(dwFlags); 1921 pWidget->SetFlags(dwFlags);
1915 bSet = TRUE; 1922 bSet = TRUE;
1916 } 1923 }
1917 } 1924 }
1918 } 1925 }
1919 1926
1920 if (bSet) 1927 if (bSet)
1921 UpdateFormField(m_pDocument, pFormField, TRUE, FALSE, TRUE); 1928 UpdateFormField(m_pDocument.Get(), pFormField, TRUE, FALSE, TRUE);
1922 } else { 1929 } else {
1923 if (m_nFormControlIndex >= pFormField->CountControls()) 1930 if (m_nFormControlIndex >= pFormField->CountControls())
1924 return FALSE; 1931 return FALSE;
1925 if (CPDF_FormControl* pFormControl = 1932 if (CPDF_FormControl* pFormControl =
1926 pFormField->GetControl(m_nFormControlIndex)) { 1933 pFormField->GetControl(m_nFormControlIndex)) {
1927 if (CPDFSDK_Widget* pWidget = 1934 if (CPDFSDK_Widget* pWidget =
1928 pInterForm->GetWidget(pFormControl, true)) { 1935 pInterForm->GetWidget(pFormControl, true)) {
1929 uint32_t dwFlags = pWidget->GetFlags(); 1936 uint32_t dwFlags = pWidget->GetFlags();
1930 if (bVP) 1937 if (bVP)
1931 dwFlags |= ANNOTFLAG_PRINT; 1938 dwFlags |= ANNOTFLAG_PRINT;
1932 else 1939 else
1933 dwFlags &= ~ANNOTFLAG_PRINT; 1940 dwFlags &= ~ANNOTFLAG_PRINT;
1934 1941
1935 if (dwFlags != pWidget->GetFlags()) { 1942 if (dwFlags != pWidget->GetFlags()) {
1936 pWidget->SetFlags(dwFlags); 1943 pWidget->SetFlags(dwFlags);
1937 UpdateFormControl(m_pDocument, 1944 UpdateFormControl(m_pDocument.Get(),
1938 pFormField->GetControl(m_nFormControlIndex), 1945 pFormField->GetControl(m_nFormControlIndex),
1939 TRUE, FALSE, TRUE); 1946 TRUE, FALSE, TRUE);
1940 } 1947 }
1941 } 1948 }
1942 } 1949 }
1943 } 1950 }
1944 } 1951 }
1945 } else { 1952 } else {
1946 CPDF_FormField* pFormField = FieldArray[0]; 1953 CPDF_FormField* pFormField = FieldArray[0];
1947 CPDFSDK_Widget* pWidget = 1954 CPDFSDK_Widget* pWidget =
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
2036 FX_FLOAT pArray[4] = {0.0f, 0.0f, 0.0f, 0.0f}; 2043 FX_FLOAT pArray[4] = {0.0f, 0.0f, 0.0f, 0.0f};
2037 pArray[0] = static_cast<FX_FLOAT>(Upper_Leftx.ToInt(pRuntime)); 2044 pArray[0] = static_cast<FX_FLOAT>(Upper_Leftx.ToInt(pRuntime));
2038 pArray[1] = static_cast<FX_FLOAT>(Lower_Righty.ToInt(pRuntime)); 2045 pArray[1] = static_cast<FX_FLOAT>(Lower_Righty.ToInt(pRuntime));
2039 pArray[2] = static_cast<FX_FLOAT>(Lower_Rightx.ToInt(pRuntime)); 2046 pArray[2] = static_cast<FX_FLOAT>(Lower_Rightx.ToInt(pRuntime));
2040 pArray[3] = static_cast<FX_FLOAT>(Upper_Lefty.ToInt(pRuntime)); 2047 pArray[3] = static_cast<FX_FLOAT>(Upper_Lefty.ToInt(pRuntime));
2041 2048
2042 CFX_FloatRect crRect(pArray); 2049 CFX_FloatRect crRect(pArray);
2043 if (m_bDelay) { 2050 if (m_bDelay) {
2044 AddDelay_Rect(FP_RECT, crRect); 2051 AddDelay_Rect(FP_RECT, crRect);
2045 } else { 2052 } else {
2046 Field::SetRect(m_pDocument, m_FieldName, m_nFormControlIndex, crRect); 2053 Field::SetRect(m_pDocument.Get(), m_FieldName, m_nFormControlIndex,
2054 crRect);
2047 } 2055 }
2048 } else { 2056 } else {
2049 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 2057 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
2050 if (FieldArray.empty()) 2058 if (FieldArray.empty())
2051 return FALSE; 2059 return FALSE;
2052 2060
2053 CPDF_FormField* pFormField = FieldArray[0]; 2061 CPDF_FormField* pFormField = FieldArray[0];
2054 CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); 2062 CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm();
2055 CPDFSDK_Widget* pWidget = 2063 CPDFSDK_Widget* pWidget =
2056 pInterForm->GetWidget(GetSmartFieldControl(pFormField), true); 2064 pInterForm->GetWidget(GetSmartFieldControl(pFormField), true);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
2208 if (vp.IsSetting()) { 2216 if (vp.IsSetting()) {
2209 if (!m_bCanSet) 2217 if (!m_bCanSet)
2210 return FALSE; 2218 return FALSE;
2211 2219
2212 int nVP; 2220 int nVP;
2213 vp >> nVP; 2221 vp >> nVP;
2214 2222
2215 if (m_bDelay) { 2223 if (m_bDelay) {
2216 AddDelay_Int(FP_ROTATION, nVP); 2224 AddDelay_Int(FP_ROTATION, nVP);
2217 } else { 2225 } else {
2218 Field::SetRotation(m_pDocument, m_FieldName, m_nFormControlIndex, nVP); 2226 Field::SetRotation(m_pDocument.Get(), m_FieldName, m_nFormControlIndex,
2227 nVP);
2219 } 2228 }
2220 } else { 2229 } else {
2221 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 2230 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
2222 if (FieldArray.empty()) 2231 if (FieldArray.empty())
2223 return FALSE; 2232 return FALSE;
2224 2233
2225 CPDF_FormField* pFormField = FieldArray[0]; 2234 CPDF_FormField* pFormField = FieldArray[0];
2226 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); 2235 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
2227 if (!pFormControl) 2236 if (!pFormControl)
2228 return FALSE; 2237 return FALSE;
(...skipping 25 matching lines...) Expand all
2254 return FALSE; 2263 return FALSE;
2255 2264
2256 vp >> crArray; 2265 vp >> crArray;
2257 2266
2258 CPWL_Color color; 2267 CPWL_Color color;
2259 color::ConvertArrayToPWLColor(pRuntime, crArray, &color); 2268 color::ConvertArrayToPWLColor(pRuntime, crArray, &color);
2260 2269
2261 if (m_bDelay) { 2270 if (m_bDelay) {
2262 AddDelay_Color(FP_STROKECOLOR, color); 2271 AddDelay_Color(FP_STROKECOLOR, color);
2263 } else { 2272 } else {
2264 Field::SetStrokeColor(m_pDocument, m_FieldName, m_nFormControlIndex, 2273 Field::SetStrokeColor(m_pDocument.Get(), m_FieldName, m_nFormControlIndex,
2265 color); 2274 color);
2266 } 2275 }
2267 } else { 2276 } else {
2268 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 2277 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
2269 if (FieldArray.empty()) 2278 if (FieldArray.empty())
2270 return FALSE; 2279 return FALSE;
2271 2280
2272 CPDF_FormField* pFormField = FieldArray[0]; 2281 CPDF_FormField* pFormField = FieldArray[0];
2273 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); 2282 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
2274 if (!pFormControl) 2283 if (!pFormControl)
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
2318 if (vp.IsSetting()) { 2327 if (vp.IsSetting()) {
2319 if (!m_bCanSet) 2328 if (!m_bCanSet)
2320 return FALSE; 2329 return FALSE;
2321 2330
2322 CFX_ByteString csBCaption; 2331 CFX_ByteString csBCaption;
2323 vp >> csBCaption; 2332 vp >> csBCaption;
2324 2333
2325 if (m_bDelay) { 2334 if (m_bDelay) {
2326 AddDelay_String(FP_STYLE, csBCaption); 2335 AddDelay_String(FP_STYLE, csBCaption);
2327 } else { 2336 } else {
2328 Field::SetStyle(m_pDocument, m_FieldName, m_nFormControlIndex, 2337 Field::SetStyle(m_pDocument.Get(), m_FieldName, m_nFormControlIndex,
2329 csBCaption); 2338 csBCaption);
2330 } 2339 }
2331 } else { 2340 } else {
2332 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 2341 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
2333 if (FieldArray.empty()) 2342 if (FieldArray.empty())
2334 return FALSE; 2343 return FALSE;
2335 2344
2336 CPDF_FormField* pFormField = FieldArray[0]; 2345 CPDF_FormField* pFormField = FieldArray[0];
2337 if (pFormField->GetFieldType() != FIELDTYPE_RADIOBUTTON && 2346 if (pFormField->GetFieldType() != FIELDTYPE_RADIOBUTTON &&
2338 pFormField->GetFieldType() != FIELDTYPE_CHECKBOX) { 2347 pFormField->GetFieldType() != FIELDTYPE_CHECKBOX) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
2399 return FALSE; 2408 return FALSE;
2400 2409
2401 vp >> crArray; 2410 vp >> crArray;
2402 2411
2403 CPWL_Color color; 2412 CPWL_Color color;
2404 color::ConvertArrayToPWLColor(pRuntime, crArray, &color); 2413 color::ConvertArrayToPWLColor(pRuntime, crArray, &color);
2405 2414
2406 if (m_bDelay) { 2415 if (m_bDelay) {
2407 AddDelay_Color(FP_TEXTCOLOR, color); 2416 AddDelay_Color(FP_TEXTCOLOR, color);
2408 } else { 2417 } else {
2409 Field::SetTextColor(m_pDocument, m_FieldName, m_nFormControlIndex, color); 2418 Field::SetTextColor(m_pDocument.Get(), m_FieldName, m_nFormControlIndex,
2419 color);
2410 } 2420 }
2411 } else { 2421 } else {
2412 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 2422 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
2413 if (FieldArray.empty()) 2423 if (FieldArray.empty())
2414 return FALSE; 2424 return FALSE;
2415 2425
2416 CPDF_FormField* pFormField = FieldArray[0]; 2426 CPDF_FormField* pFormField = FieldArray[0];
2417 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); 2427 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
2418 if (!pFormControl) 2428 if (!pFormControl)
2419 return FALSE; 2429 return FALSE;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2455 return FALSE; 2465 return FALSE;
2456 2466
2457 CFX_ByteString csFontName; 2467 CFX_ByteString csFontName;
2458 vp >> csFontName; 2468 vp >> csFontName;
2459 if (csFontName.IsEmpty()) 2469 if (csFontName.IsEmpty())
2460 return FALSE; 2470 return FALSE;
2461 2471
2462 if (m_bDelay) { 2472 if (m_bDelay) {
2463 AddDelay_String(FP_TEXTFONT, csFontName); 2473 AddDelay_String(FP_TEXTFONT, csFontName);
2464 } else { 2474 } else {
2465 Field::SetTextFont(m_pDocument, m_FieldName, m_nFormControlIndex, 2475 Field::SetTextFont(m_pDocument.Get(), m_FieldName, m_nFormControlIndex,
2466 csFontName); 2476 csFontName);
2467 } 2477 }
2468 } else { 2478 } else {
2469 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 2479 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
2470 if (FieldArray.empty()) 2480 if (FieldArray.empty())
2471 return FALSE; 2481 return FALSE;
2472 2482
2473 CPDF_FormField* pFormField = FieldArray[0]; 2483 CPDF_FormField* pFormField = FieldArray[0];
2474 ASSERT(pFormField); 2484 ASSERT(pFormField);
2475 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); 2485 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2509 if (vp.IsSetting()) { 2519 if (vp.IsSetting()) {
2510 if (!m_bCanSet) 2520 if (!m_bCanSet)
2511 return FALSE; 2521 return FALSE;
2512 2522
2513 int nVP; 2523 int nVP;
2514 vp >> nVP; 2524 vp >> nVP;
2515 2525
2516 if (m_bDelay) { 2526 if (m_bDelay) {
2517 AddDelay_Int(FP_TEXTSIZE, nVP); 2527 AddDelay_Int(FP_TEXTSIZE, nVP);
2518 } else { 2528 } else {
2519 Field::SetTextSize(m_pDocument, m_FieldName, m_nFormControlIndex, nVP); 2529 Field::SetTextSize(m_pDocument.Get(), m_FieldName, m_nFormControlIndex,
2530 nVP);
2520 } 2531 }
2521 } else { 2532 } else {
2522 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 2533 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
2523 if (FieldArray.empty()) 2534 if (FieldArray.empty())
2524 return FALSE; 2535 return FALSE;
2525 2536
2526 CPDF_FormField* pFormField = FieldArray[0]; 2537 CPDF_FormField* pFormField = FieldArray[0];
2527 ASSERT(pFormField); 2538 ASSERT(pFormField);
2528 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); 2539 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
2529 if (!pFormControl) 2540 if (!pFormControl)
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
2601 if (vp.IsSetting()) { 2612 if (vp.IsSetting()) {
2602 if (!m_bCanSet) 2613 if (!m_bCanSet)
2603 return FALSE; 2614 return FALSE;
2604 2615
2605 CFX_WideString swName; 2616 CFX_WideString swName;
2606 vp >> swName; 2617 vp >> swName;
2607 2618
2608 if (m_bDelay) { 2619 if (m_bDelay) {
2609 AddDelay_WideString(FP_USERNAME, swName); 2620 AddDelay_WideString(FP_USERNAME, swName);
2610 } else { 2621 } else {
2611 Field::SetUserName(m_pDocument, m_FieldName, m_nFormControlIndex, swName); 2622 Field::SetUserName(m_pDocument.Get(), m_FieldName, m_nFormControlIndex,
2623 swName);
2612 } 2624 }
2613 } else { 2625 } else {
2614 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 2626 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
2615 if (FieldArray.empty()) 2627 if (FieldArray.empty())
2616 return FALSE; 2628 return FALSE;
2617 2629
2618 CPDF_FormField* pFormField = FieldArray[0]; 2630 CPDF_FormField* pFormField = FieldArray[0];
2619 vp << (CFX_WideString)pFormField->GetAlternateName(); 2631 vp << (CFX_WideString)pFormField->GetAlternateName();
2620 } 2632 }
2621 2633
(...skipping 27 matching lines...) Expand all
2649 } 2661 }
2650 } else { 2662 } else {
2651 CFX_WideString swValue; 2663 CFX_WideString swValue;
2652 vp >> swValue; 2664 vp >> swValue;
2653 strArray.push_back(swValue); 2665 strArray.push_back(swValue);
2654 } 2666 }
2655 2667
2656 if (m_bDelay) { 2668 if (m_bDelay) {
2657 AddDelay_WideStringArray(FP_VALUE, strArray); 2669 AddDelay_WideStringArray(FP_VALUE, strArray);
2658 } else { 2670 } else {
2659 Field::SetValue(m_pDocument, m_FieldName, m_nFormControlIndex, strArray); 2671 Field::SetValue(m_pDocument.Get(), m_FieldName, m_nFormControlIndex,
2672 strArray);
2660 } 2673 }
2661 } else { 2674 } else {
2662 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 2675 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
2663 if (FieldArray.empty()) 2676 if (FieldArray.empty())
2664 return FALSE; 2677 return FALSE;
2665 2678
2666 CPDF_FormField* pFormField = FieldArray[0]; 2679 CPDF_FormField* pFormField = FieldArray[0];
2667 switch (pFormField->GetFieldType()) { 2680 switch (pFormField->GetFieldType()) {
2668 case FIELDTYPE_PUSHBUTTON: 2681 case FIELDTYPE_PUSHBUTTON:
2669 return FALSE; 2682 return FALSE;
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
2818 if (FieldArray.empty()) 2831 if (FieldArray.empty())
2819 return FALSE; 2832 return FALSE;
2820 2833
2821 CPDF_FormField* pFormField = FieldArray[0]; 2834 CPDF_FormField* pFormField = FieldArray[0];
2822 CPDFDoc_Environment* pApp = m_pDocument->GetEnv(); 2835 CPDFDoc_Environment* pApp = m_pDocument->GetEnv();
2823 if ((pFormField->GetFieldFlags() & FIELDFLAG_FILESELECT) && 2836 if ((pFormField->GetFieldFlags() & FIELDFLAG_FILESELECT) &&
2824 (pFormField->GetFieldType() == FIELDTYPE_TEXTFIELD)) { 2837 (pFormField->GetFieldType() == FIELDTYPE_TEXTFIELD)) {
2825 CFX_WideString wsFileName = pApp->JS_fieldBrowse(); 2838 CFX_WideString wsFileName = pApp->JS_fieldBrowse();
2826 if (!wsFileName.IsEmpty()) { 2839 if (!wsFileName.IsEmpty()) {
2827 pFormField->SetValue(wsFileName); 2840 pFormField->SetValue(wsFileName);
2828 UpdateFormField(m_pDocument, pFormField, TRUE, TRUE, TRUE); 2841 UpdateFormField(m_pDocument.Get(), pFormField, TRUE, TRUE, TRUE);
2829 } 2842 }
2830 return TRUE; 2843 return TRUE;
2831 } 2844 }
2832 return FALSE; 2845 return FALSE;
2833 } 2846 }
2834 2847
2835 FX_BOOL Field::buttonGetCaption(IJS_Context* cc, 2848 FX_BOOL Field::buttonGetCaption(IJS_Context* cc,
2836 const std::vector<CJS_Value>& params, 2849 const std::vector<CJS_Value>& params,
2837 CJS_Value& vRet, 2850 CJS_Value& vRet,
2838 CFX_WideString& sError) { 2851 CFX_WideString& sError) {
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
2962 return FALSE; 2975 return FALSE;
2963 if (nWidget < 0 || nWidget >= pFormField->CountControls()) 2976 if (nWidget < 0 || nWidget >= pFormField->CountControls())
2964 return FALSE; 2977 return FALSE;
2965 // TODO(weili): Check whether anything special needed for radio button, 2978 // TODO(weili): Check whether anything special needed for radio button,
2966 // otherwise merge these branches. 2979 // otherwise merge these branches.
2967 if (pFormField->GetFieldType() == FIELDTYPE_RADIOBUTTON) 2980 if (pFormField->GetFieldType() == FIELDTYPE_RADIOBUTTON)
2968 pFormField->CheckControl(nWidget, bCheckit, true); 2981 pFormField->CheckControl(nWidget, bCheckit, true);
2969 else 2982 else
2970 pFormField->CheckControl(nWidget, bCheckit, true); 2983 pFormField->CheckControl(nWidget, bCheckit, true);
2971 2984
2972 UpdateFormField(m_pDocument, pFormField, TRUE, TRUE, TRUE); 2985 UpdateFormField(m_pDocument.Get(), pFormField, TRUE, TRUE, TRUE);
2973 return TRUE; 2986 return TRUE;
2974 } 2987 }
2975 2988
2976 FX_BOOL Field::clearItems(IJS_Context* cc, 2989 FX_BOOL Field::clearItems(IJS_Context* cc,
2977 const std::vector<CJS_Value>& params, 2990 const std::vector<CJS_Value>& params,
2978 CJS_Value& vRet, 2991 CJS_Value& vRet,
2979 CFX_WideString& sError) { 2992 CFX_WideString& sError) {
2980 return TRUE; 2993 return TRUE;
2981 } 2994 }
2982 2995
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
3475 } 3488 }
3476 } 3489 }
3477 3490
3478 void Field::AddField(CPDFSDK_Document* pDocument, 3491 void Field::AddField(CPDFSDK_Document* pDocument,
3479 int nPageIndex, 3492 int nPageIndex,
3480 int nFieldType, 3493 int nFieldType,
3481 const CFX_WideString& sName, 3494 const CFX_WideString& sName,
3482 const CFX_FloatRect& rcCoords) { 3495 const CFX_FloatRect& rcCoords) {
3483 // Not supported. 3496 // Not supported.
3484 } 3497 }
OLDNEW
« fpdfsdk/javascript/Field.h ('K') | « fpdfsdk/javascript/Field.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698