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

Side by Side Diff: fpdfsdk/src/fsdk_baseform.cpp

Issue 1477583002: Inflict PDF_ENABLE_XFA ifdefs on XFA fpdfsdk/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifdef PDF_ENABLE_XFA
7 #include "../include/fpdfxfa/fpdfxfa_doc.h" 8 #include "../include/fpdfxfa/fpdfxfa_doc.h"
8 #include "../include/fpdfxfa/fpdfxfa_util.h" 9 #include "../include/fpdfxfa/fpdfxfa_util.h"
10 #endif
9 #include "fpdfsdk/include/formfiller/FFL_FormFiller.h" 11 #include "fpdfsdk/include/formfiller/FFL_FormFiller.h"
10 #include "fpdfsdk/include/fsdk_actionhandler.h" 12 #include "fpdfsdk/include/fsdk_actionhandler.h"
11 #include "fpdfsdk/include/fsdk_baseannot.h" 13 #include "fpdfsdk/include/fsdk_baseannot.h"
12 #include "fpdfsdk/include/fsdk_baseform.h" 14 #include "fpdfsdk/include/fsdk_baseform.h"
13 #include "fpdfsdk/include/fsdk_define.h" 15 #include "fpdfsdk/include/fsdk_define.h"
14 #include "fpdfsdk/include/fsdk_mgr.h" 16 #include "fpdfsdk/include/fsdk_mgr.h"
15 #include "fpdfsdk/include/javascript/IJavaScript.h" 17 #include "fpdfsdk/include/javascript/IJavaScript.h"
16 #include "third_party/base/nonstd_unique_ptr.h" 18 #include "third_party/base/nonstd_unique_ptr.h"
17 19
18 #define IsFloatZero(f) ((f) < 0.01 && (f) > -0.01) 20 #define IsFloatZero(f) ((f) < 0.01 && (f) > -0.01)
19 #define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb))) 21 #define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb)))
20 #define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb))) 22 #define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb)))
21 #define IsFloatEqual(fa, fb) IsFloatZero((fa) - (fb)) 23 #define IsFloatEqual(fa, fb) IsFloatZero((fa) - (fb))
22 24
23 CPDFSDK_Widget::CPDFSDK_Widget(CPDF_Annot* pAnnot, 25 CPDFSDK_Widget::CPDFSDK_Widget(CPDF_Annot* pAnnot,
24 CPDFSDK_PageView* pPageView, 26 CPDFSDK_PageView* pPageView,
25 CPDFSDK_InterForm* pInterForm) 27 CPDFSDK_InterForm* pInterForm)
26 : CPDFSDK_BAAnnot(pAnnot, pPageView), 28 : CPDFSDK_BAAnnot(pAnnot, pPageView),
27 m_pInterForm(pInterForm), 29 m_pInterForm(pInterForm),
28 m_nAppAge(0), 30 m_nAppAge(0),
31 #ifndef PDF_ENABLE_XFA
32 m_nValueAge(0) {
33 #else
29 m_nValueAge(0), 34 m_nValueAge(0),
30 m_hMixXFAWidget(NULL), 35 m_hMixXFAWidget(NULL),
31 m_pWidgetHandler(NULL) { 36 m_pWidgetHandler(NULL) {
37 #endif
32 ASSERT(m_pInterForm != NULL); 38 ASSERT(m_pInterForm != NULL);
33 } 39 }
34 40
35 CPDFSDK_Widget::~CPDFSDK_Widget() {} 41 CPDFSDK_Widget::~CPDFSDK_Widget() {}
36 42
43 #ifdef PDF_ENABLE_XFA
37 IXFA_Widget* CPDFSDK_Widget::GetMixXFAWidget() const { 44 IXFA_Widget* CPDFSDK_Widget::GetMixXFAWidget() const {
38 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument(); 45 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument();
39 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument(); 46 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument();
40 if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) { 47 if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) {
41 if (!m_hMixXFAWidget) { 48 if (!m_hMixXFAWidget) {
42 if (IXFA_DocView* pDocView = pDoc->GetXFADocView()) { 49 if (IXFA_DocView* pDocView = pDoc->GetXFADocView()) {
43 CFX_WideString sName; 50 CFX_WideString sName;
44 if (this->GetFieldType() == FIELDTYPE_RADIOBUTTON) { 51 if (this->GetFieldType() == FIELDTYPE_RADIOBUTTON) {
45 sName = this->GetAnnotName(); 52 sName = this->GetAnnotName();
46 if (sName.IsEmpty()) 53 if (sName.IsEmpty())
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 } 456 }
450 } 457 }
451 458
452 pFormField->SetValue(L"", TRUE); 459 pFormField->SetValue(L"", TRUE);
453 } break; 460 } break;
454 } 461 }
455 } 462 }
456 #endif // PDF_ENABLE_XFA 463 #endif // PDF_ENABLE_XFA
457 } 464 }
458 465
466 #endif
459 FX_BOOL CPDFSDK_Widget::IsWidgetAppearanceValid( 467 FX_BOOL CPDFSDK_Widget::IsWidgetAppearanceValid(
460 CPDF_Annot::AppearanceMode mode) { 468 CPDF_Annot::AppearanceMode mode) {
461 CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDict("AP"); 469 CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDict("AP");
462 if (!pAP) 470 if (!pAP)
463 return FALSE; 471 return FALSE;
464 472
465 // Choose the right sub-ap 473 // Choose the right sub-ap
466 const FX_CHAR* ap_entry = "N"; 474 const FX_CHAR* ap_entry = "N";
467 if (mode == CPDF_Annot::Down) 475 if (mode == CPDF_Annot::Down)
468 ap_entry = "D"; 476 ap_entry = "D";
(...skipping 26 matching lines...) Expand all
495 } 503 }
496 504
497 int CPDFSDK_Widget::GetFieldType() const { 505 int CPDFSDK_Widget::GetFieldType() const {
498 CPDF_FormField* pField = GetFormField(); 506 CPDF_FormField* pField = GetFormField();
499 ASSERT(pField != NULL); 507 ASSERT(pField != NULL);
500 508
501 return pField->GetFieldType(); 509 return pField->GetFieldType();
502 } 510 }
503 511
504 FX_BOOL CPDFSDK_Widget::IsAppearanceValid() { 512 FX_BOOL CPDFSDK_Widget::IsAppearanceValid() {
513 #ifdef PDF_ENABLE_XFA
505 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument(); 514 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument();
506 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument(); 515 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument();
507 int nDocType = pDoc->GetDocType(); 516 int nDocType = pDoc->GetDocType();
508 if (nDocType != DOCTYPE_PDF && nDocType != DOCTYPE_STATIC_XFA) 517 if (nDocType != DOCTYPE_PDF && nDocType != DOCTYPE_STATIC_XFA)
509 return TRUE; 518 return TRUE;
510 519
520 #endif
511 return CPDFSDK_BAAnnot::IsAppearanceValid(); 521 return CPDFSDK_BAAnnot::IsAppearanceValid();
512 } 522 }
513 523
514 int CPDFSDK_Widget::GetFieldFlags() const { 524 int CPDFSDK_Widget::GetFieldFlags() const {
515 CPDF_InterForm* pPDFInterForm = m_pInterForm->GetInterForm(); 525 CPDF_InterForm* pPDFInterForm = m_pInterForm->GetInterForm();
516 ASSERT(pPDFInterForm != NULL); 526 ASSERT(pPDFInterForm != NULL);
517 527
518 CPDF_FormControl* pFormControl = 528 CPDF_FormControl* pFormControl =
519 pPDFInterForm->GetControlByDict(m_pAnnot->GetAnnotDict()); 529 pPDFInterForm->GetControlByDict(m_pAnnot->GetAnnotDict());
520 CPDF_FormField* pFormField = pFormControl->GetField(); 530 CPDF_FormField* pFormField = pFormControl->GetField();
(...skipping 22 matching lines...) Expand all
543 const CPDF_Dictionary* pAnnotDict) { 553 const CPDF_Dictionary* pAnnotDict) {
544 ASSERT(pAnnotDict != NULL); 554 ASSERT(pAnnotDict != NULL);
545 return pInterForm->GetControlByDict(pAnnotDict); 555 return pInterForm->GetControlByDict(pAnnotDict);
546 } 556 }
547 557
548 int CPDFSDK_Widget::GetRotate() const { 558 int CPDFSDK_Widget::GetRotate() const {
549 CPDF_FormControl* pCtrl = GetFormControl(); 559 CPDF_FormControl* pCtrl = GetFormControl();
550 return pCtrl->GetRotation() % 360; 560 return pCtrl->GetRotation() % 360;
551 } 561 }
552 562
563 #ifdef PDF_ENABLE_XFA
553 CFX_WideString CPDFSDK_Widget::GetName() const { 564 CFX_WideString CPDFSDK_Widget::GetName() const {
554 CPDF_FormField* pFormField = GetFormField(); 565 CPDF_FormField* pFormField = GetFormField();
555 return pFormField->GetFullName(); 566 return pFormField->GetFullName();
556 } 567 }
557 568
569 #endif
558 FX_BOOL CPDFSDK_Widget::GetFillColor(FX_COLORREF& color) const { 570 FX_BOOL CPDFSDK_Widget::GetFillColor(FX_COLORREF& color) const {
559 CPDF_FormControl* pFormCtrl = GetFormControl(); 571 CPDF_FormControl* pFormCtrl = GetFormControl();
560 ASSERT(pFormCtrl != NULL); 572 ASSERT(pFormCtrl != NULL);
561 573
562 int iColorType = 0; 574 int iColorType = 0;
563 color = FX_ARGBTOCOLORREF(pFormCtrl->GetBackgroundColor(iColorType)); 575 color = FX_ARGBTOCOLORREF(pFormCtrl->GetBackgroundColor(iColorType));
564 576
565 return iColorType != COLORTYPE_TRANSPARENT; 577 return iColorType != COLORTYPE_TRANSPARENT;
566 } 578 }
567 579
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 CPDF_DefaultAppearance pDa = pFormCtrl->GetDefaultAppearance(); 611 CPDF_DefaultAppearance pDa = pFormCtrl->GetDefaultAppearance();
600 CFX_ByteString csFont = ""; 612 CFX_ByteString csFont = "";
601 FX_FLOAT fFontSize = 0.0f; 613 FX_FLOAT fFontSize = 0.0f;
602 pDa.GetFont(csFont, fFontSize); 614 pDa.GetFont(csFont, fFontSize);
603 615
604 return fFontSize; 616 return fFontSize;
605 } 617 }
606 618
607 int CPDFSDK_Widget::GetSelectedIndex(int nIndex) const { 619 int CPDFSDK_Widget::GetSelectedIndex(int nIndex) const {
608 #ifdef PDF_ENABLE_XFA 620 #ifdef PDF_ENABLE_XFA
621 #ifdef PDF_ENABLE_XFA
609 if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) { 622 if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) {
610 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHandler()) { 623 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHandler()) {
611 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) { 624 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) {
612 if (nIndex < pWidgetAcc->CountSelectedItems()) 625 if (nIndex < pWidgetAcc->CountSelectedItems())
613 return pWidgetAcc->GetSelectedItem(nIndex); 626 return pWidgetAcc->GetSelectedItem(nIndex);
614 } 627 }
615 } 628 }
616 } 629 }
617 #endif // PDF_ENABLE_XFA 630 #endif // PDF_ENABLE_XFA
618 631
632 #endif
619 CPDF_FormField* pFormField = GetFormField(); 633 CPDF_FormField* pFormField = GetFormField();
620 return pFormField->GetSelectedIndex(nIndex); 634 return pFormField->GetSelectedIndex(nIndex);
621 } 635 }
622 636
637 #ifndef PDF_ENABLE_XFA
638 CFX_WideString CPDFSDK_Widget::GetValue() const {
639 #else
Lei Zhang 2015/11/25 00:34:31 #else // PDF_ENABLE_XFA ... #ifdef PDF_ENABLE_XFA
Tom Sepez 2015/11/25 21:45:30 Yeah, these are all conflicts with the pre-existin
623 CFX_WideString CPDFSDK_Widget::GetValue(FX_BOOL bDisplay) const { 640 CFX_WideString CPDFSDK_Widget::GetValue(FX_BOOL bDisplay) const {
624 #ifdef PDF_ENABLE_XFA 641 #ifdef PDF_ENABLE_XFA
625 if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) { 642 if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) {
626 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHandler()) { 643 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHandler()) {
627 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) { 644 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) {
628 CFX_WideString sValue; 645 CFX_WideString sValue;
629 pWidgetAcc->GetValue(sValue, bDisplay ? XFA_VALUEPICTURE_Display 646 pWidgetAcc->GetValue(sValue, bDisplay ? XFA_VALUEPICTURE_Display
630 : XFA_VALUEPICTURE_Edit); 647 : XFA_VALUEPICTURE_Edit);
631 return sValue; 648 return sValue;
632 } 649 }
633 } 650 }
634 } 651 }
635 #endif // PDF_ENABLE_XFA 652 #endif // PDF_ENABLE_XFA
636 653
654 #endif
637 CPDF_FormField* pFormField = GetFormField(); 655 CPDF_FormField* pFormField = GetFormField();
638 return pFormField->GetValue(); 656 return pFormField->GetValue();
639 } 657 }
640 658
641 CFX_WideString CPDFSDK_Widget::GetDefaultValue() const { 659 CFX_WideString CPDFSDK_Widget::GetDefaultValue() const {
642 CPDF_FormField* pFormField = GetFormField(); 660 CPDF_FormField* pFormField = GetFormField();
643 ASSERT(pFormField != NULL); 661 ASSERT(pFormField != NULL);
644 662
645 return pFormField->GetDefaultValue(); 663 return pFormField->GetDefaultValue();
646 } 664 }
647 665
648 CFX_WideString CPDFSDK_Widget::GetOptionLabel(int nIndex) const { 666 CFX_WideString CPDFSDK_Widget::GetOptionLabel(int nIndex) const {
649 CPDF_FormField* pFormField = GetFormField(); 667 CPDF_FormField* pFormField = GetFormField();
650 ASSERT(pFormField != NULL); 668 ASSERT(pFormField != NULL);
651 669
652 return pFormField->GetOptionLabel(nIndex); 670 return pFormField->GetOptionLabel(nIndex);
653 } 671 }
654 672
655 int CPDFSDK_Widget::CountOptions() const { 673 int CPDFSDK_Widget::CountOptions() const {
656 CPDF_FormField* pFormField = GetFormField(); 674 CPDF_FormField* pFormField = GetFormField();
657 ASSERT(pFormField != NULL); 675 ASSERT(pFormField != NULL);
658 676
659 return pFormField->CountOptions(); 677 return pFormField->CountOptions();
660 } 678 }
661 679
662 FX_BOOL CPDFSDK_Widget::IsOptionSelected(int nIndex) const { 680 FX_BOOL CPDFSDK_Widget::IsOptionSelected(int nIndex) const {
663 #ifdef PDF_ENABLE_XFA 681 #ifdef PDF_ENABLE_XFA
682 #ifdef PDF_ENABLE_XFA
Lei Zhang 2015/11/25 00:34:31 Another double #ifdef
664 if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) { 683 if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) {
665 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHandler()) { 684 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHandler()) {
666 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) { 685 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) {
667 if (nIndex > -1 && nIndex < pWidgetAcc->CountChoiceListItems()) 686 if (nIndex > -1 && nIndex < pWidgetAcc->CountChoiceListItems())
668 return pWidgetAcc->GetItemState(nIndex); 687 return pWidgetAcc->GetItemState(nIndex);
669 688
670 return FALSE; 689 return FALSE;
671 } 690 }
672 } 691 }
673 } 692 }
674 #endif // PDF_ENABLE_XFA 693 #endif // PDF_ENABLE_XFA
675 694
695 #endif
676 CPDF_FormField* pFormField = GetFormField(); 696 CPDF_FormField* pFormField = GetFormField();
677 return pFormField->IsItemSelected(nIndex); 697 return pFormField->IsItemSelected(nIndex);
678 } 698 }
679 699
680 int CPDFSDK_Widget::GetTopVisibleIndex() const { 700 int CPDFSDK_Widget::GetTopVisibleIndex() const {
681 CPDF_FormField* pFormField = GetFormField(); 701 CPDF_FormField* pFormField = GetFormField();
682 return pFormField->GetTopVisibleIndex(); 702 return pFormField->GetTopVisibleIndex();
683 } 703 }
684 704
685 FX_BOOL CPDFSDK_Widget::IsChecked() const { 705 FX_BOOL CPDFSDK_Widget::IsChecked() const {
686 #ifdef PDF_ENABLE_XFA 706 #ifdef PDF_ENABLE_XFA
707 #ifdef PDF_ENABLE_XFA
Lei Zhang 2015/11/25 00:34:31 And another
687 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHandler()) { 708 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHandler()) {
688 if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) { 709 if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) {
689 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) { 710 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) {
690 FX_BOOL bChecked = pWidgetAcc->GetCheckState() == XFA_CHECKSTATE_On; 711 FX_BOOL bChecked = pWidgetAcc->GetCheckState() == XFA_CHECKSTATE_On;
691 return bChecked; 712 return bChecked;
692 } 713 }
693 } 714 }
694 } 715 }
695 #endif // PDF_ENABLE_XFA 716 #endif // PDF_ENABLE_XFA
696 717
718 #endif
697 CPDF_FormControl* pFormCtrl = GetFormControl(); 719 CPDF_FormControl* pFormCtrl = GetFormControl();
698 return pFormCtrl->IsChecked(); 720 return pFormCtrl->IsChecked();
699 } 721 }
700 722
701 int CPDFSDK_Widget::GetAlignment() const { 723 int CPDFSDK_Widget::GetAlignment() const {
702 CPDF_FormControl* pFormCtrl = GetFormControl(); 724 CPDF_FormControl* pFormCtrl = GetFormControl();
703 ASSERT(pFormCtrl != NULL); 725 ASSERT(pFormCtrl != NULL);
704 726
705 return pFormCtrl->GetControlAlignment(); 727 return pFormCtrl->GetControlAlignment();
706 } 728 }
707 729
708 int CPDFSDK_Widget::GetMaxLen() const { 730 int CPDFSDK_Widget::GetMaxLen() const {
709 CPDF_FormField* pFormField = GetFormField(); 731 CPDF_FormField* pFormField = GetFormField();
710 ASSERT(pFormField != NULL); 732 ASSERT(pFormField != NULL);
711 733
712 return pFormField->GetMaxLen(); 734 return pFormField->GetMaxLen();
713 } 735 }
714 736
715 void CPDFSDK_Widget::SetCheck(FX_BOOL bChecked, FX_BOOL bNotify) { 737 void CPDFSDK_Widget::SetCheck(FX_BOOL bChecked, FX_BOOL bNotify) {
716 CPDF_FormControl* pFormCtrl = GetFormControl(); 738 CPDF_FormControl* pFormCtrl = GetFormControl();
717 ASSERT(pFormCtrl != NULL); 739 ASSERT(pFormCtrl != NULL);
718 740
719 CPDF_FormField* pFormField = pFormCtrl->GetField(); 741 CPDF_FormField* pFormField = pFormCtrl->GetField();
720 ASSERT(pFormField != NULL); 742 ASSERT(pFormField != NULL);
721 743
722 pFormField->CheckControl(pFormField->GetControlIndex(pFormCtrl), bChecked, 744 pFormField->CheckControl(pFormField->GetControlIndex(pFormCtrl), bChecked,
723 bNotify); 745 bNotify);
746 #ifdef PDF_ENABLE_XFA
724 if (!IsWidgetAppearanceValid(CPDF_Annot::Normal)) 747 if (!IsWidgetAppearanceValid(CPDF_Annot::Normal))
725 ResetAppearance(TRUE); 748 ResetAppearance(TRUE);
726 if (!bNotify) 749 if (!bNotify)
727 Synchronize(TRUE); 750 Synchronize(TRUE);
751 #endif
728 } 752 }
729 753
730 void CPDFSDK_Widget::SetValue(const CFX_WideString& sValue, FX_BOOL bNotify) { 754 void CPDFSDK_Widget::SetValue(const CFX_WideString& sValue, FX_BOOL bNotify) {
731 CPDF_FormField* pFormField = GetFormField(); 755 CPDF_FormField* pFormField = GetFormField();
732 ASSERT(pFormField != NULL); 756 ASSERT(pFormField != NULL);
733 757
734 pFormField->SetValue(sValue, bNotify); 758 pFormField->SetValue(sValue, bNotify);
759 #ifdef PDF_ENABLE_XFA
735 760
736 if (!bNotify) 761 if (!bNotify)
737 Synchronize(TRUE); 762 Synchronize(TRUE);
763 #endif
738 } 764 }
739 765
740 void CPDFSDK_Widget::SetDefaultValue(const CFX_WideString& sValue) {} 766 void CPDFSDK_Widget::SetDefaultValue(const CFX_WideString& sValue) {}
741 void CPDFSDK_Widget::SetOptionSelection(int index, 767 void CPDFSDK_Widget::SetOptionSelection(int index,
742 FX_BOOL bSelected, 768 FX_BOOL bSelected,
743 FX_BOOL bNotify) { 769 FX_BOOL bNotify) {
744 CPDF_FormField* pFormField = GetFormField(); 770 CPDF_FormField* pFormField = GetFormField();
745 ASSERT(pFormField != NULL); 771 ASSERT(pFormField != NULL);
746 772
747 pFormField->SetItemSelection(index, bSelected, bNotify); 773 pFormField->SetItemSelection(index, bSelected, bNotify);
774 #ifdef PDF_ENABLE_XFA
748 775
749 if (!bNotify) 776 if (!bNotify)
750 Synchronize(TRUE); 777 Synchronize(TRUE);
778 #endif
751 } 779 }
752 780
753 void CPDFSDK_Widget::ClearSelection(FX_BOOL bNotify) { 781 void CPDFSDK_Widget::ClearSelection(FX_BOOL bNotify) {
754 CPDF_FormField* pFormField = GetFormField(); 782 CPDF_FormField* pFormField = GetFormField();
755 ASSERT(pFormField != NULL); 783 ASSERT(pFormField != NULL);
756 784
757 pFormField->ClearSelection(bNotify); 785 pFormField->ClearSelection(bNotify);
786 #ifdef PDF_ENABLE_XFA
758 787
759 if (!bNotify) 788 if (!bNotify)
760 Synchronize(TRUE); 789 Synchronize(TRUE);
790 #endif
761 } 791 }
762 792
763 void CPDFSDK_Widget::SetTopVisibleIndex(int index) {} 793 void CPDFSDK_Widget::SetTopVisibleIndex(int index) {}
764 794
765 void CPDFSDK_Widget::SetAppModified() { 795 void CPDFSDK_Widget::SetAppModified() {
766 m_bAppModified = TRUE; 796 m_bAppModified = TRUE;
767 } 797 }
768 798
769 void CPDFSDK_Widget::ClearAppModified() { 799 void CPDFSDK_Widget::ClearAppModified() {
770 m_bAppModified = FALSE; 800 m_bAppModified = FALSE;
771 } 801 }
772 802
773 FX_BOOL CPDFSDK_Widget::IsAppModified() const { 803 FX_BOOL CPDFSDK_Widget::IsAppModified() const {
774 return m_bAppModified; 804 return m_bAppModified;
775 } 805 }
776 806
807 #ifdef PDF_ENABLE_XFA
777 void CPDFSDK_Widget::ResetAppearance(FX_BOOL bValueChanged) { 808 void CPDFSDK_Widget::ResetAppearance(FX_BOOL bValueChanged) {
778 switch (GetFieldType()) { 809 switch (GetFieldType()) {
779 case FIELDTYPE_TEXTFIELD: 810 case FIELDTYPE_TEXTFIELD:
780 case FIELDTYPE_COMBOBOX: { 811 case FIELDTYPE_COMBOBOX: {
781 FX_BOOL bFormated = FALSE; 812 FX_BOOL bFormated = FALSE;
782 CFX_WideString sValue = this->OnFormat(bFormated); 813 CFX_WideString sValue = this->OnFormat(bFormated);
783 if (bFormated) 814 if (bFormated)
784 this->ResetAppearance(sValue, TRUE); 815 this->ResetAppearance(sValue, TRUE);
785 else 816 else
786 this->ResetAppearance(NULL, TRUE); 817 this->ResetAppearance(NULL, TRUE);
787 } break; 818 } break;
788 default: 819 default:
789 this->ResetAppearance(NULL, FALSE); 820 this->ResetAppearance(NULL, FALSE);
790 break; 821 break;
791 } 822 }
792 } 823 }
793 824
825 #endif
794 void CPDFSDK_Widget::ResetAppearance(const FX_WCHAR* sValue, 826 void CPDFSDK_Widget::ResetAppearance(const FX_WCHAR* sValue,
795 FX_BOOL bValueChanged) { 827 FX_BOOL bValueChanged) {
796 SetAppModified(); 828 SetAppModified();
797 829
798 m_nAppAge++; 830 m_nAppAge++;
799 if (m_nAppAge > 999999) 831 if (m_nAppAge > 999999)
800 m_nAppAge = 0; 832 m_nAppAge = 0;
801 if (bValueChanged) 833 if (bValueChanged)
802 m_nValueAge++; 834 m_nValueAge++;
803 835
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
1635 FX_WORD subWord = 0; 1667 FX_WORD subWord = 0;
1636 if ((dwFieldFlags >> 13) & 1) { 1668 if ((dwFieldFlags >> 13) & 1) {
1637 subWord = '*'; 1669 subWord = '*';
1638 pEdit->SetPasswordChar(subWord); 1670 pEdit->SetPasswordChar(subWord);
1639 } 1671 }
1640 1672
1641 int nMaxLen = pField->GetMaxLen(); 1673 int nMaxLen = pField->GetMaxLen();
1642 FX_BOOL bCharArray = (dwFieldFlags >> 24) & 1; 1674 FX_BOOL bCharArray = (dwFieldFlags >> 24) & 1;
1643 FX_FLOAT fFontSize = GetFontSize(); 1675 FX_FLOAT fFontSize = GetFontSize();
1644 1676
1677 #ifdef PDF_ENABLE_XFA
1645 CFX_WideString sValueTmp; 1678 CFX_WideString sValueTmp;
1646 if (!sValue && (NULL != this->GetMixXFAWidget())) { 1679 if (!sValue && (NULL != this->GetMixXFAWidget())) {
1647 sValueTmp = GetValue(TRUE); 1680 sValueTmp = GetValue(TRUE);
1648 sValue = sValueTmp; 1681 sValue = sValueTmp;
1649 } 1682 }
1650 1683
1684 #endif
1651 if (nMaxLen > 0) { 1685 if (nMaxLen > 0) {
1652 if (bCharArray) { 1686 if (bCharArray) {
1653 pEdit->SetCharArray(nMaxLen); 1687 pEdit->SetCharArray(nMaxLen);
1654 1688
1655 if (IsFloatZero(fFontSize)) { 1689 if (IsFloatZero(fFontSize)) {
1656 fFontSize = CPWL_Edit::GetCharArrayAutoFontSize(FontMap.GetPDFFont(0), 1690 fFontSize = CPWL_Edit::GetCharArrayAutoFontSize(FontMap.GetPDFFont(0),
1657 rcClient, nMaxLen); 1691 rcClient, nMaxLen);
1658 } 1692 }
1659 } else { 1693 } else {
1660 if (sValue) 1694 if (sValue)
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
1949 if (CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDict("AP")) { 1983 if (CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDict("AP")) {
1950 pAPDict->RemoveAt(sAPType); 1984 pAPDict->RemoveAt(sAPType);
1951 } 1985 }
1952 } 1986 }
1953 1987
1954 FX_BOOL CPDFSDK_Widget::OnAAction(CPDF_AAction::AActionType type, 1988 FX_BOOL CPDFSDK_Widget::OnAAction(CPDF_AAction::AActionType type,
1955 PDFSDK_FieldAction& data, 1989 PDFSDK_FieldAction& data,
1956 CPDFSDK_PageView* pPageView) { 1990 CPDFSDK_PageView* pPageView) {
1957 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); 1991 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument();
1958 CPDFDoc_Environment* pEnv = pDocument->GetEnv(); 1992 CPDFDoc_Environment* pEnv = pDocument->GetEnv();
1993 #ifdef PDF_ENABLE_XFA
1959 1994
1960 CPDFXFA_Document* pDoc = pDocument->GetXFADocument(); 1995 CPDFXFA_Document* pDoc = pDocument->GetXFADocument();
1961 if (IXFA_Widget* hWidget = GetMixXFAWidget()) { 1996 if (IXFA_Widget* hWidget = GetMixXFAWidget()) {
1962 XFA_EVENTTYPE eEventType = GetXFAEventType(type, data.bWillCommit); 1997 XFA_EVENTTYPE eEventType = GetXFAEventType(type, data.bWillCommit);
1963 1998
1964 if (eEventType != XFA_EVENT_Unknown) { 1999 if (eEventType != XFA_EVENT_Unknown) {
1965 if (IXFA_WidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) { 2000 if (IXFA_WidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) {
1966 CXFA_EventParam param; 2001 CXFA_EventParam param;
1967 param.m_eType = eEventType; 2002 param.m_eType = eEventType;
1968 param.m_wsChange = data.sChange; 2003 param.m_wsChange = data.sChange;
(...skipping 19 matching lines...) Expand all
1988 if (IXFA_DocView* pDocView = pDoc->GetXFADocView()) { 2023 if (IXFA_DocView* pDocView = pDoc->GetXFADocView()) {
1989 pDocView->UpdateDocView(); 2024 pDocView->UpdateDocView();
1990 } 2025 }
1991 2026
1992 if (nRet == XFA_EVENTERROR_Sucess) 2027 if (nRet == XFA_EVENTERROR_Sucess)
1993 return TRUE; 2028 return TRUE;
1994 } 2029 }
1995 } 2030 }
1996 } 2031 }
1997 2032
2033 #endif
1998 CPDF_Action action = GetAAction(type); 2034 CPDF_Action action = GetAAction(type);
1999 2035
2000 if (action && action.GetType() != CPDF_Action::Unknown) { 2036 if (action && action.GetType() != CPDF_Action::Unknown) {
2001 CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander(); 2037 CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander();
2002 return pActionHandler->DoAction_Field(action, type, pDocument, 2038 return pActionHandler->DoAction_Field(action, type, pDocument,
2003 GetFormField(), data); 2039 GetFormField(), data);
2004 } 2040 }
2005 return FALSE; 2041 return FALSE;
2006 } 2042 }
2007 2043
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
2060 2096
2061 int nFieldFlags = GetFieldFlags(); 2097 int nFieldFlags = GetFieldFlags();
2062 if ((nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY) 2098 if ((nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY)
2063 return FALSE; 2099 return FALSE;
2064 2100
2065 return TRUE; 2101 return TRUE;
2066 } 2102 }
2067 return FALSE; 2103 return FALSE;
2068 } 2104 }
2069 2105
2106 #ifdef PDF_ENABLE_XFA
2070 CPDFSDK_XFAWidget::CPDFSDK_XFAWidget(IXFA_Widget* pAnnot, 2107 CPDFSDK_XFAWidget::CPDFSDK_XFAWidget(IXFA_Widget* pAnnot,
2071 CPDFSDK_PageView* pPageView, 2108 CPDFSDK_PageView* pPageView,
2072 CPDFSDK_InterForm* pInterForm) 2109 CPDFSDK_InterForm* pInterForm)
2073 : CPDFSDK_Annot(pPageView), m_pInterForm(pInterForm), m_hXFAWidget(pAnnot) { 2110 : CPDFSDK_Annot(pPageView), m_pInterForm(pInterForm), m_hXFAWidget(pAnnot) {
2074 } 2111 }
2075 2112
2076 FX_BOOL CPDFSDK_XFAWidget::IsXFAField() { 2113 FX_BOOL CPDFSDK_XFAWidget::IsXFAField() {
2077 return TRUE; 2114 return TRUE;
2078 } 2115 }
2079 2116
2080 CFX_ByteString CPDFSDK_XFAWidget::GetType() const { 2117 CFX_ByteString CPDFSDK_XFAWidget::GetType() const {
2081 return FSDK_XFAWIDGET_TYPENAME; 2118 return FSDK_XFAWIDGET_TYPENAME;
2082 } 2119 }
2083 2120
2084 CFX_FloatRect CPDFSDK_XFAWidget::GetRect() const { 2121 CFX_FloatRect CPDFSDK_XFAWidget::GetRect() const {
2085 CPDFSDK_PageView* pPageView = GetPageView(); 2122 CPDFSDK_PageView* pPageView = GetPageView();
2086 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); 2123 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument();
2087 CPDFXFA_Document* pDoc = pDocument->GetXFADocument(); 2124 CPDFXFA_Document* pDoc = pDocument->GetXFADocument();
2088 IXFA_DocView* pDocView = pDoc->GetXFADocView(); 2125 IXFA_DocView* pDocView = pDoc->GetXFADocView();
2089 IXFA_WidgetHandler* pWidgetHandler = pDocView->GetWidgetHandler(); 2126 IXFA_WidgetHandler* pWidgetHandler = pDocView->GetWidgetHandler();
2090 2127
2091 CFX_RectF rcBBox; 2128 CFX_RectF rcBBox;
2092 pWidgetHandler->GetRect(GetXFAWidget(), rcBBox); 2129 pWidgetHandler->GetRect(GetXFAWidget(), rcBBox);
2093 2130
2094 return CFX_FloatRect(rcBBox.left, rcBBox.top, rcBBox.left + rcBBox.width, 2131 return CFX_FloatRect(rcBBox.left, rcBBox.top, rcBBox.left + rcBBox.width,
2095 rcBBox.top + rcBBox.height); 2132 rcBBox.top + rcBBox.height);
2096 } 2133 }
2097 2134
2135 #endif
2098 CPDFSDK_InterForm::CPDFSDK_InterForm(CPDFSDK_Document* pDocument) 2136 CPDFSDK_InterForm::CPDFSDK_InterForm(CPDFSDK_Document* pDocument)
2099 : m_pDocument(pDocument), 2137 : m_pDocument(pDocument),
2100 m_pInterForm(NULL), 2138 m_pInterForm(NULL),
2101 m_bCalculate(TRUE), 2139 m_bCalculate(TRUE),
2140 #ifdef PDF_ENABLE_XFA
2102 m_bXfaCalculate(TRUE), 2141 m_bXfaCalculate(TRUE),
2103 m_bXfaValidationsEnabled(TRUE), 2142 m_bXfaValidationsEnabled(TRUE),
2143 #endif
2104 m_bBusy(FALSE) { 2144 m_bBusy(FALSE) {
2105 m_pInterForm = new CPDF_InterForm(m_pDocument->GetPDFDocument(), FALSE); 2145 m_pInterForm = new CPDF_InterForm(m_pDocument->GetPDFDocument(), FALSE);
2106 m_pInterForm->SetFormNotify(this); 2146 m_pInterForm->SetFormNotify(this);
2107 2147
2108 for (int i = 0; i < kNumFieldTypes; ++i) 2148 for (int i = 0; i < kNumFieldTypes; ++i)
2109 m_bNeedHightlight[i] = FALSE; 2149 m_bNeedHightlight[i] = FALSE;
2110 m_iHighlightAlpha = 0; 2150 m_iHighlightAlpha = 0;
2111 } 2151 }
2112 2152
2113 CPDFSDK_InterForm::~CPDFSDK_InterForm() { 2153 CPDFSDK_InterForm::~CPDFSDK_InterForm() {
2114 delete m_pInterForm; 2154 delete m_pInterForm;
2115 m_pInterForm = nullptr; 2155 m_pInterForm = nullptr;
2116 m_Map.clear(); 2156 m_Map.clear();
2157 #ifdef PDF_ENABLE_XFA
2117 m_XFAMap.RemoveAll(); 2158 m_XFAMap.RemoveAll();
2159 #endif
2118 } 2160 }
2119 2161
2120 FX_BOOL CPDFSDK_InterForm::HighlightWidgets() { 2162 FX_BOOL CPDFSDK_InterForm::HighlightWidgets() {
2121 return FALSE; 2163 return FALSE;
2122 } 2164 }
2123 2165
2124 CPDFSDK_Widget* CPDFSDK_InterForm::GetSibling(CPDFSDK_Widget* pWidget, 2166 CPDFSDK_Widget* CPDFSDK_InterForm::GetSibling(CPDFSDK_Widget* pWidget,
2125 FX_BOOL bNext) const { 2167 FX_BOOL bNext) const {
2126 nonstd::unique_ptr<CBA_AnnotIterator> pIterator( 2168 nonstd::unique_ptr<CBA_AnnotIterator> pIterator(
2127 new CBA_AnnotIterator(pWidget->GetPageView(), "Widget", "")); 2169 new CBA_AnnotIterator(pWidget->GetPageView(), "Widget", ""));
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
2213 2255
2214 void CPDFSDK_InterForm::AddMap(CPDF_FormControl* pControl, 2256 void CPDFSDK_InterForm::AddMap(CPDF_FormControl* pControl,
2215 CPDFSDK_Widget* pWidget) { 2257 CPDFSDK_Widget* pWidget) {
2216 m_Map[pControl] = pWidget; 2258 m_Map[pControl] = pWidget;
2217 } 2259 }
2218 2260
2219 void CPDFSDK_InterForm::RemoveMap(CPDF_FormControl* pControl) { 2261 void CPDFSDK_InterForm::RemoveMap(CPDF_FormControl* pControl) {
2220 m_Map.erase(pControl); 2262 m_Map.erase(pControl);
2221 } 2263 }
2222 2264
2265 #ifdef PDF_ENABLE_XFA
2223 void CPDFSDK_InterForm::AddXFAMap(IXFA_Widget* hWidget, 2266 void CPDFSDK_InterForm::AddXFAMap(IXFA_Widget* hWidget,
2224 CPDFSDK_XFAWidget* pWidget) { 2267 CPDFSDK_XFAWidget* pWidget) {
2225 m_XFAMap.SetAt(hWidget, pWidget); 2268 m_XFAMap.SetAt(hWidget, pWidget);
2226 } 2269 }
2227 2270
2228 void CPDFSDK_InterForm::RemoveXFAMap(IXFA_Widget* hWidget) { 2271 void CPDFSDK_InterForm::RemoveXFAMap(IXFA_Widget* hWidget) {
2229 m_XFAMap.RemoveKey(hWidget); 2272 m_XFAMap.RemoveKey(hWidget);
2230 } 2273 }
2231 2274
2232 CPDFSDK_XFAWidget* CPDFSDK_InterForm::GetXFAWidget(IXFA_Widget* hWidget) { 2275 CPDFSDK_XFAWidget* CPDFSDK_InterForm::GetXFAWidget(IXFA_Widget* hWidget) {
2233 CPDFSDK_XFAWidget* pWidget = NULL; 2276 CPDFSDK_XFAWidget* pWidget = NULL;
2234 m_XFAMap.Lookup(hWidget, pWidget); 2277 m_XFAMap.Lookup(hWidget, pWidget);
2235 2278
2236 return pWidget; 2279 return pWidget;
2237 } 2280 }
2238 2281
2282 #endif
2239 void CPDFSDK_InterForm::EnableCalculate(FX_BOOL bEnabled) { 2283 void CPDFSDK_InterForm::EnableCalculate(FX_BOOL bEnabled) {
2240 m_bCalculate = bEnabled; 2284 m_bCalculate = bEnabled;
2241 } 2285 }
2242 2286
2243 FX_BOOL CPDFSDK_InterForm::IsCalculateEnabled() const { 2287 FX_BOOL CPDFSDK_InterForm::IsCalculateEnabled() const {
2244 return m_bCalculate; 2288 return m_bCalculate;
2245 } 2289 }
2246 2290
2291 #ifdef PDF_ENABLE_XFA
2247 void CPDFSDK_InterForm::XfaEnableCalculate(FX_BOOL bEnabled) { 2292 void CPDFSDK_InterForm::XfaEnableCalculate(FX_BOOL bEnabled) {
2248 m_bXfaCalculate = bEnabled; 2293 m_bXfaCalculate = bEnabled;
2249 } 2294 }
2250 FX_BOOL CPDFSDK_InterForm::IsXfaCalculateEnabled() const { 2295 FX_BOOL CPDFSDK_InterForm::IsXfaCalculateEnabled() const {
2251 return m_bXfaCalculate; 2296 return m_bXfaCalculate;
2252 } 2297 }
2253 2298
2254 FX_BOOL CPDFSDK_InterForm::IsXfaValidationsEnabled() { 2299 FX_BOOL CPDFSDK_InterForm::IsXfaValidationsEnabled() {
2255 return m_bXfaValidationsEnabled; 2300 return m_bXfaValidationsEnabled;
2256 } 2301 }
2257 void CPDFSDK_InterForm::XfaSetValidationsEnabled(FX_BOOL bEnabled) { 2302 void CPDFSDK_InterForm::XfaSetValidationsEnabled(FX_BOOL bEnabled) {
2258 m_bXfaValidationsEnabled = bEnabled; 2303 m_bXfaValidationsEnabled = bEnabled;
2259 } 2304 }
2260 2305
2306 #endif
2261 #ifdef _WIN32 2307 #ifdef _WIN32
2262 CPDF_Stream* CPDFSDK_InterForm::LoadImageFromFile(const CFX_WideString& sFile) { 2308 CPDF_Stream* CPDFSDK_InterForm::LoadImageFromFile(const CFX_WideString& sFile) {
2263 CPDF_Document* pDocument = m_pDocument->GetPDFDocument(); 2309 CPDF_Document* pDocument = m_pDocument->GetPDFDocument();
2264 CPDF_Stream* pRetStream = NULL; 2310 CPDF_Stream* pRetStream = NULL;
2265 2311
2266 if (CFX_DIBitmap* pBmp = CFX_WindowsDIB::LoadFromFile(sFile.c_str())) { 2312 if (CFX_DIBitmap* pBmp = CFX_WindowsDIB::LoadFromFile(sFile.c_str())) {
2267 int nWidth = pBmp->GetWidth(); 2313 int nWidth = pBmp->GetWidth();
2268 int nHeight = pBmp->GetHeight(); 2314 int nHeight = pBmp->GetHeight();
2269 2315
2270 CPDF_Image Image(pDocument); 2316 CPDF_Image Image(pDocument);
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
2653 2699
2654 FX_BOOL CPDFSDK_InterForm::ExportFieldsToFDFTextBuf( 2700 FX_BOOL CPDFSDK_InterForm::ExportFieldsToFDFTextBuf(
2655 const std::vector<CPDF_FormField*>& fields, 2701 const std::vector<CPDF_FormField*>& fields,
2656 FX_BOOL bIncludeOrExclude, 2702 FX_BOOL bIncludeOrExclude,
2657 CFX_ByteTextBuf& textBuf) { 2703 CFX_ByteTextBuf& textBuf) {
2658 nonstd::unique_ptr<CFDF_Document> pFDF(m_pInterForm->ExportToFDF( 2704 nonstd::unique_ptr<CFDF_Document> pFDF(m_pInterForm->ExportToFDF(
2659 m_pDocument->GetPath(), fields, bIncludeOrExclude)); 2705 m_pDocument->GetPath(), fields, bIncludeOrExclude));
2660 return pFDF ? pFDF->WriteBuf(textBuf) : FALSE; 2706 return pFDF ? pFDF->WriteBuf(textBuf) : FALSE;
2661 } 2707 }
2662 2708
2709 #ifdef PDF_ENABLE_XFA
2663 void CPDFSDK_InterForm::SynchronizeField(CPDF_FormField* pFormField, 2710 void CPDFSDK_InterForm::SynchronizeField(CPDF_FormField* pFormField,
2664 FX_BOOL bSynchronizeElse) { 2711 FX_BOOL bSynchronizeElse) {
2665 ASSERT(pFormField != NULL); 2712 ASSERT(pFormField != NULL);
2666 2713
2667 int x = 0; 2714 int x = 0;
2668 if (m_FieldSynchronizeMap.Lookup(pFormField, x)) 2715 if (m_FieldSynchronizeMap.Lookup(pFormField, x))
2669 return; 2716 return;
2670 2717
2671 for (int i = 0, sz = pFormField->CountControls(); i < sz; i++) { 2718 for (int i = 0, sz = pFormField->CountControls(); i < sz; i++) {
2672 CPDF_FormControl* pFormCtrl = pFormField->GetControl(i); 2719 CPDF_FormControl* pFormCtrl = pFormField->GetControl(i);
2673 ASSERT(pFormCtrl != NULL); 2720 ASSERT(pFormCtrl != NULL);
2674 2721
2675 ASSERT(m_pInterForm != NULL); 2722 ASSERT(m_pInterForm != NULL);
2676 if (CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl)) { 2723 if (CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl)) {
2677 pWidget->Synchronize(bSynchronizeElse); 2724 pWidget->Synchronize(bSynchronizeElse);
2678 } 2725 }
2679 } 2726 }
2680 } 2727 }
2681 2728
2729 #endif
2682 CFX_WideString CPDFSDK_InterForm::GetTemporaryFileName( 2730 CFX_WideString CPDFSDK_InterForm::GetTemporaryFileName(
2683 const CFX_WideString& sFileExt) { 2731 const CFX_WideString& sFileExt) {
2684 CFX_WideString sFileName; 2732 CFX_WideString sFileName;
2685 return L""; 2733 return L"";
2686 } 2734 }
2687 2735
2688 FX_BOOL CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination, 2736 FX_BOOL CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination,
2689 FX_BOOL bUrlEncoded) { 2737 FX_BOOL bUrlEncoded) {
2690 if (sDestination.IsEmpty()) 2738 if (sDestination.IsEmpty())
2691 return FALSE; 2739 return FALSE;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
2788 OnValidate(pFormField, csValue, bRC); 2836 OnValidate(pFormField, csValue, bRC);
2789 return bRC ? 1 : -1; 2837 return bRC ? 1 : -1;
2790 } 2838 }
2791 return -1; 2839 return -1;
2792 } 2840 }
2793 return 0; 2841 return 0;
2794 } 2842 }
2795 2843
2796 int CPDFSDK_InterForm::AfterValueChange(const CPDF_FormField* pField) { 2844 int CPDFSDK_InterForm::AfterValueChange(const CPDF_FormField* pField) {
2797 CPDF_FormField* pFormField = (CPDF_FormField*)pField; 2845 CPDF_FormField* pFormField = (CPDF_FormField*)pField;
2846 #ifdef PDF_ENABLE_XFA
2798 SynchronizeField(pFormField, FALSE); 2847 SynchronizeField(pFormField, FALSE);
2799 2848
2849 #endif
2800 int nType = pFormField->GetFieldType(); 2850 int nType = pFormField->GetFieldType();
2801 if (nType == FIELDTYPE_COMBOBOX || nType == FIELDTYPE_TEXTFIELD) { 2851 if (nType == FIELDTYPE_COMBOBOX || nType == FIELDTYPE_TEXTFIELD) {
2802 OnCalculate(pFormField); 2852 OnCalculate(pFormField);
2803 FX_BOOL bFormated = FALSE; 2853 FX_BOOL bFormated = FALSE;
2804 CFX_WideString sValue = OnFormat(pFormField, bFormated); 2854 CFX_WideString sValue = OnFormat(pFormField, bFormated);
2805 if (bFormated) 2855 if (bFormated)
2806 ResetFieldAppearance(pFormField, sValue.c_str(), TRUE); 2856 ResetFieldAppearance(pFormField, sValue.c_str(), TRUE);
2807 else 2857 else
2808 ResetFieldAppearance(pFormField, NULL, TRUE); 2858 ResetFieldAppearance(pFormField, NULL, TRUE);
2809 UpdateField(pFormField); 2859 UpdateField(pFormField);
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
3130 break; 3180 break;
3131 } 3181 }
3132 } 3182 }
3133 } 3183 }
3134 3184
3135 CPDF_Rect CBA_AnnotIterator::GetAnnotRect(CPDFSDK_Annot* pAnnot) { 3185 CPDF_Rect CBA_AnnotIterator::GetAnnotRect(CPDFSDK_Annot* pAnnot) {
3136 CPDF_Rect rcAnnot; 3186 CPDF_Rect rcAnnot;
3137 pAnnot->GetPDFAnnot()->GetRect(rcAnnot); 3187 pAnnot->GetPDFAnnot()->GetRect(rcAnnot);
3138 return rcAnnot; 3188 return rcAnnot;
3139 } 3189 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698