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

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

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

Powered by Google App Engine
This is Rietveld 408576698