OLD | NEW |
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 "../../third_party/base/nonstd_unique_ptr.h" | 7 #include "../../third_party/base/nonstd_unique_ptr.h" |
8 #include "../include/fsdk_define.h" | 8 #include "../include/fsdk_define.h" |
9 #include "../include/fpdfxfa/fpdfxfa_doc.h" | 9 #include "../include/fpdfxfa/fpdfxfa_doc.h" |
10 #include "../include/fpdfxfa/fpdfxfa_util.h" | 10 #include "../include/fpdfxfa/fpdfxfa_util.h" |
11 #include "../include/fsdk_mgr.h" | 11 #include "../include/fsdk_mgr.h" |
12 #include "../include/fsdk_baseannot.h" | 12 #include "../include/fsdk_baseannot.h" |
13 #include "../include/fsdk_baseform.h" | 13 #include "../include/fsdk_baseform.h" |
14 #include "../include/formfiller/FFL_FormFiller.h" | 14 #include "../include/formfiller/FFL_FormFiller.h" |
15 #include "../include/fsdk_actionhandler.h" | 15 #include "../include/fsdk_actionhandler.h" |
16 | 16 |
17 #include "../include/javascript/IJavaScript.h" | 17 #include "../include/javascript/IJavaScript.h" |
18 | 18 |
19 //------------------------------------------------------------------------------
------ | 19 //------------------------------------------------------------------------------
------ |
20 //*» » » » » » » » » »
CPDFSDK_Widget | 20 //* CPDFSDK_Widget |
21 //------------------------------------------------------------------------------
------ | 21 //------------------------------------------------------------------------------
------ |
22 | 22 |
23 #define IsFloatZero(f)» » » » » » ((f) < 0.01 && (
f) > -0.01) | 23 #define IsFloatZero(f) ((f) < 0.01 && (f) > -0.01) |
24 #define IsFloatBigger(fa,fb)» » » » ((fa) > (fb) && !IsFloat
Zero((fa) - (fb))) | 24 #define IsFloatBigger(fa,fb) ((fa) > (fb) && !IsFloatZero((fa) -
(fb))) |
25 #define IsFloatSmaller(fa,fb)» » » » ((fa) < (fb) && !IsFloat
Zero((fa) - (fb))) | 25 #define IsFloatSmaller(fa,fb) ((fa) < (fb) && !IsFloatZero((fa) -
(fb))) |
26 #define IsFloatEqual(fa,fb)» » » » » IsFloatZero((fa)
-(fb)) | 26 #define IsFloatEqual(fa,fb) IsFloatZero((fa)-(fb)) |
27 | 27 |
28 CPDFSDK_Widget::CPDFSDK_Widget(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPageView,
CPDFSDK_InterForm* pInterForm) : | 28 CPDFSDK_Widget::CPDFSDK_Widget(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPageView,
CPDFSDK_InterForm* pInterForm) : |
29 CPDFSDK_BAAnnot(pAnnot, pPageView), | 29 CPDFSDK_BAAnnot(pAnnot, pPageView), |
30 m_pInterForm(pInterForm), | 30 m_pInterForm(pInterForm), |
31 m_nAppAge(0), | 31 m_nAppAge(0), |
32 m_nValueAge(0), | 32 m_nValueAge(0), |
33 m_hMixXFAWidget(NULL), | 33 m_hMixXFAWidget(NULL), |
34 m_pWidgetHandler(NULL) | 34 m_pWidgetHandler(NULL) |
35 { | 35 { |
36 » ASSERT(m_pInterForm != NULL); | 36 ASSERT(m_pInterForm != NULL); |
37 } | 37 } |
38 | 38 |
39 CPDFSDK_Widget::~CPDFSDK_Widget() | 39 CPDFSDK_Widget::~CPDFSDK_Widget() |
40 { | 40 { |
41 | 41 |
42 } | 42 } |
43 | 43 |
44 IXFA_Widget* CPDFSDK_Widget::GetMixXFAWidget() | 44 IXFA_Widget* CPDFSDK_Widget::GetMixXFAWidget() |
45 { | 45 { |
46 ASSERT(m_pPageView != NULL); | 46 ASSERT(m_pPageView != NULL); |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 pFormField->SetValue(L"", TRUE); | 558 pFormField->SetValue(L"", TRUE); |
559 } | 559 } |
560 break; | 560 break; |
561 } | 561 } |
562 } | 562 } |
563 } | 563 } |
564 | 564 |
565 FX_BOOL CPDFSDK_Widget::IsWidgetAppearanceValid(CPDF_Annot::AppearanceMo
de mode) | 565 FX_BOOL CPDFSDK_Widget::IsWidgetAppearanceValid(CPDF_Annot::AppearanceMo
de mode) |
566 { | 566 { |
567 CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDict("AP"); | 567 CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDict("AP"); |
568 » if (pAP == NULL) return FALSE; | 568 » if (!pAP) |
| 569 return FALSE; |
569 | 570 |
570 // Choose the right sub-ap | 571 // Choose the right sub-ap |
571 const FX_CHAR* ap_entry = "N"; | 572 const FX_CHAR* ap_entry = "N"; |
572 if (mode == CPDF_Annot::Down) | 573 if (mode == CPDF_Annot::Down) |
573 ap_entry = "D"; | 574 ap_entry = "D"; |
574 else if (mode == CPDF_Annot::Rollover) | 575 else if (mode == CPDF_Annot::Rollover) |
575 ap_entry = "R"; | 576 ap_entry = "R"; |
576 if (!pAP->KeyExist(ap_entry)) | 577 if (!pAP->KeyExist(ap_entry)) |
577 ap_entry = "N"; | 578 ap_entry = "N"; |
578 | 579 |
579 // Get the AP stream or subdirectory | 580 // Get the AP stream or subdirectory |
580 CPDF_Object* psub = pAP->GetElementValue(ap_entry); | 581 CPDF_Object* psub = pAP->GetElementValue(ap_entry); |
581 » if (psub == NULL) return FALSE; | 582 » if (!psub) |
| 583 return FALSE; |
582 | 584 |
583 int nFieldType = GetFieldType(); | 585 int nFieldType = GetFieldType(); |
584 switch (nFieldType) | 586 switch (nFieldType) |
585 { | 587 { |
586 case FIELDTYPE_PUSHBUTTON: | 588 case FIELDTYPE_PUSHBUTTON: |
587 case FIELDTYPE_COMBOBOX: | 589 case FIELDTYPE_COMBOBOX: |
588 case FIELDTYPE_LISTBOX: | 590 case FIELDTYPE_LISTBOX: |
589 case FIELDTYPE_TEXTFIELD: | 591 case FIELDTYPE_TEXTFIELD: |
590 case FIELDTYPE_SIGNATURE: | 592 case FIELDTYPE_SIGNATURE: |
591 return psub->GetType() == PDFOBJ_STREAM; | 593 return psub->GetType() == PDFOBJ_STREAM; |
592 case FIELDTYPE_CHECKBOX: | 594 case FIELDTYPE_CHECKBOX: |
593 case FIELDTYPE_RADIOBUTTON: | 595 case FIELDTYPE_RADIOBUTTON: |
594 if (psub->GetType() == PDFOBJ_DICTIONARY) | 596 if (psub->GetType() == PDFOBJ_DICTIONARY) |
595 { | 597 { |
596 CPDF_Dictionary* pSubDict = (CPDF_Dictionary*)psub; | 598 CPDF_Dictionary* pSubDict = (CPDF_Dictionary*)psub; |
597 | |
598 return pSubDict->GetStream(GetAppState()) != NULL; | 599 return pSubDict->GetStream(GetAppState()) != NULL; |
599 } | 600 } |
600 » » else | 601 return FALSE; |
601 » » » return FALSE; | |
602 » » break; | |
603 } | 602 } |
604 | 603 return TRUE; |
605 » return TRUE; | |
606 } | 604 } |
607 | 605 |
608 int» CPDFSDK_Widget::GetFieldType() const | 606 int CPDFSDK_Widget::GetFieldType() const |
609 { | 607 { |
610 » CPDF_FormField* pField = GetFormField(); | 608 CPDF_FormField* pField = GetFormField(); |
611 » ASSERT(pField != NULL); | 609 ASSERT(pField != NULL); |
612 | 610 |
613 » return pField->GetFieldType(); | 611 return pField->GetFieldType(); |
614 } | 612 } |
615 | 613 |
616 FX_BOOL CPDFSDK_Widget::IsAppearanceValid() | 614 FX_BOOL CPDFSDK_Widget::IsAppearanceValid() |
617 { | 615 { |
618 ASSERT(m_pPageView != NULL); | 616 ASSERT(m_pPageView != NULL); |
619 | 617 |
620 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument(); | 618 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument(); |
621 ASSERT(pSDKDoc != NULL); | 619 ASSERT(pSDKDoc != NULL); |
622 | 620 |
623 CPDFXFA_Document* pDoc = pSDKDoc->GetDocument(); | 621 CPDFXFA_Document* pDoc = pSDKDoc->GetDocument(); |
624 ASSERT(pDoc != NULL); | 622 ASSERT(pDoc != NULL); |
625 | 623 |
626 int nDocType = pDoc->GetDocType(); | 624 int nDocType = pDoc->GetDocType(); |
627 if (nDocType == DOCTYPE_PDF || nDocType == DOCTYPE_STATIC_XFA) | 625 if (nDocType == DOCTYPE_PDF || nDocType == DOCTYPE_STATIC_XFA) |
628 return CPDFSDK_BAAnnot::IsAppearanceValid(); | 626 return CPDFSDK_BAAnnot::IsAppearanceValid(); |
629 | 627 |
630 return TRUE; | 628 return TRUE; |
631 } | 629 } |
632 | 630 |
633 int CPDFSDK_Widget::GetFieldFlags() const | 631 int CPDFSDK_Widget::GetFieldFlags() const |
634 { | 632 { |
635 » CPDF_InterForm* pPDFInterForm = m_pInterForm->GetInterForm(); | 633 CPDF_InterForm* pPDFInterForm = m_pInterForm->GetInterForm(); |
636 » ASSERT(pPDFInterForm != NULL); | 634 ASSERT(pPDFInterForm != NULL); |
637 | 635 |
638 » CPDF_FormControl* pFormControl = pPDFInterForm->GetControlByDict(m_pAnno
t->GetAnnotDict()); | 636 CPDF_FormControl* pFormControl = pPDFInterForm->GetControlByDict(m_pAnnot->G
etAnnotDict()); |
639 » CPDF_FormField* pFormField = pFormControl->GetField(); | 637 CPDF_FormField* pFormField = pFormControl->GetField(); |
640 » return pFormField->GetFieldFlags(); | 638 return pFormField->GetFieldFlags(); |
641 } | 639 } |
642 | 640 |
643 CFX_ByteString CPDFSDK_Widget::GetSubType() const | 641 CFX_ByteString CPDFSDK_Widget::GetSubType() const |
644 { | 642 { |
645 » int nType = GetFieldType(); | 643 int nType = GetFieldType(); |
646 | 644 |
647 » if (nType == FIELDTYPE_SIGNATURE) | 645 if (nType == FIELDTYPE_SIGNATURE) |
648 » » return BFFT_SIGNATURE; | 646 return BFFT_SIGNATURE; |
649 » return CPDFSDK_Annot::GetSubType(); | 647 return CPDFSDK_Annot::GetSubType(); |
650 } | 648 } |
651 | 649 |
652 CPDF_FormField*»CPDFSDK_Widget::GetFormField() const | 650 CPDF_FormField* CPDFSDK_Widget::GetFormField() const |
653 { | 651 { |
654 » ASSERT(m_pInterForm != NULL); | 652 ASSERT(m_pInterForm != NULL); |
655 | 653 |
656 » CPDF_FormControl* pCtrl = GetFormControl(); | 654 CPDF_FormControl* pCtrl = GetFormControl(); |
657 » ASSERT(pCtrl != NULL); | 655 ASSERT(pCtrl != NULL); |
658 | 656 |
659 » return pCtrl->GetField(); | 657 return pCtrl->GetField(); |
660 } | 658 } |
661 | 659 |
662 CPDF_FormControl* CPDFSDK_Widget::GetFormControl() const | 660 CPDF_FormControl* CPDFSDK_Widget::GetFormControl() const |
663 { | 661 { |
664 » ASSERT(m_pInterForm != NULL); | 662 ASSERT(m_pInterForm != NULL); |
665 | 663 |
666 » CPDF_InterForm* pPDFInterForm = m_pInterForm->GetInterForm(); | 664 CPDF_InterForm* pPDFInterForm = m_pInterForm->GetInterForm(); |
667 » ASSERT(pPDFInterForm != NULL); | 665 ASSERT(pPDFInterForm != NULL); |
668 | 666 |
669 » return pPDFInterForm->GetControlByDict(GetAnnotDict()); | 667 return pPDFInterForm->GetControlByDict(GetAnnotDict()); |
670 } | 668 } |
671 | 669 |
672 CPDF_FormControl* CPDFSDK_Widget::GetFormControl(CPDF_InterForm* pInterForm, CPD
F_Dictionary* pAnnotDict) | 670 CPDF_FormControl* CPDFSDK_Widget::GetFormControl(CPDF_InterForm* pInterForm, CPD
F_Dictionary* pAnnotDict) |
673 { | 671 { |
674 » ASSERT(pInterForm != NULL); | 672 ASSERT(pInterForm != NULL); |
675 » ASSERT(pAnnotDict != NULL); | 673 ASSERT(pAnnotDict != NULL); |
676 | 674 |
677 » CPDF_FormControl* pControl = pInterForm->GetControlByDict(pAnnotDict); | 675 CPDF_FormControl* pControl = pInterForm->GetControlByDict(pAnnotDict); |
678 | 676 |
679 » return pControl; | 677 return pControl; |
680 } | 678 } |
681 | 679 |
682 int CPDFSDK_Widget::GetRotate() const | 680 int CPDFSDK_Widget::GetRotate() const |
683 { | 681 { |
684 » CPDF_FormControl* pCtrl = GetFormControl(); | 682 CPDF_FormControl* pCtrl = GetFormControl(); |
685 » ASSERT(pCtrl != NULL); | 683 ASSERT(pCtrl != NULL); |
686 | 684 |
687 » return pCtrl->GetRotation() % 360; | 685 return pCtrl->GetRotation() % 360; |
688 } | 686 } |
689 | 687 |
690 CFX_WideString CPDFSDK_Widget::GetName() | 688 CFX_WideString CPDFSDK_Widget::GetName() |
691 { | 689 { |
692 ASSERT(m_pInterForm != NULL); | 690 ASSERT(m_pInterForm != NULL); |
693 | 691 |
694 CPDF_FormField* pFormField = GetFormField(); | 692 CPDF_FormField* pFormField = GetFormField(); |
695 ASSERT(pFormField != NULL); | 693 ASSERT(pFormField != NULL); |
696 | 694 |
697 return pFormField->GetFullName(); | 695 return pFormField->GetFullName(); |
698 } | 696 } |
699 | 697 |
700 FX_BOOL CPDFSDK_Widget::GetFillColor(FX_COLORREF& color) const | 698 FX_BOOL CPDFSDK_Widget::GetFillColor(FX_COLORREF& color) const |
701 { | 699 { |
702 » CPDF_FormControl* pFormCtrl = GetFormControl(); | 700 CPDF_FormControl* pFormCtrl = GetFormControl(); |
703 » ASSERT(pFormCtrl != NULL); | 701 ASSERT(pFormCtrl != NULL); |
704 | 702 |
705 » int iColorType = 0; | 703 int iColorType = 0; |
706 » color = FX_ARGBTOCOLORREF(pFormCtrl->GetBackgroundColor(iColorType)); | 704 color = FX_ARGBTOCOLORREF(pFormCtrl->GetBackgroundColor(iColorType)); |
707 | 705 |
708 » return iColorType != COLORTYPE_TRANSPARENT; | 706 return iColorType != COLORTYPE_TRANSPARENT; |
709 } | 707 } |
710 | 708 |
711 FX_BOOL»CPDFSDK_Widget::GetBorderColor(FX_COLORREF& color) const | 709 FX_BOOL CPDFSDK_Widget::GetBorderColor(FX_COLORREF& color) const |
712 { | 710 { |
713 » CPDF_FormControl* pFormCtrl = GetFormControl(); | 711 CPDF_FormControl* pFormCtrl = GetFormControl(); |
714 » ASSERT(pFormCtrl != NULL); | 712 ASSERT(pFormCtrl != NULL); |
715 | 713 |
716 » int iColorType = 0; | 714 int iColorType = 0; |
717 » color = FX_ARGBTOCOLORREF(pFormCtrl->GetBorderColor(iColorType)); | 715 color = FX_ARGBTOCOLORREF(pFormCtrl->GetBorderColor(iColorType)); |
718 | 716 |
719 » return iColorType != COLORTYPE_TRANSPARENT; | 717 return iColorType != COLORTYPE_TRANSPARENT; |
720 } | 718 } |
721 | 719 |
722 FX_BOOL»CPDFSDK_Widget::GetTextColor(FX_COLORREF& color) const | 720 FX_BOOL CPDFSDK_Widget::GetTextColor(FX_COLORREF& color) const |
723 { | 721 { |
724 » CPDF_FormControl* pFormCtrl = GetFormControl(); | 722 CPDF_FormControl* pFormCtrl = GetFormControl(); |
725 » ASSERT(pFormCtrl != NULL); | 723 ASSERT(pFormCtrl != NULL); |
726 | 724 |
727 » CPDF_DefaultAppearance da = pFormCtrl->GetDefaultAppearance(); | 725 CPDF_DefaultAppearance da = pFormCtrl->GetDefaultAppearance(); |
728 » if (da.HasColor()) | 726 if (da.HasColor()) |
729 » { | 727 { |
730 » » FX_ARGB argb; | 728 FX_ARGB argb; |
731 » » int iColorType = COLORTYPE_TRANSPARENT; | 729 int iColorType = COLORTYPE_TRANSPARENT; |
732 » » da.GetColor(argb, iColorType); | 730 da.GetColor(argb, iColorType); |
733 » » color = FX_ARGBTOCOLORREF(argb); | 731 color = FX_ARGBTOCOLORREF(argb); |
734 | 732 |
735 » » return iColorType != COLORTYPE_TRANSPARENT; | 733 return iColorType != COLORTYPE_TRANSPARENT; |
736 » } | 734 } |
737 | 735 |
738 » return FALSE; | 736 return FALSE; |
739 } | 737 } |
740 | 738 |
741 FX_FLOAT CPDFSDK_Widget::GetFontSize() const | 739 FX_FLOAT CPDFSDK_Widget::GetFontSize() const |
742 { | 740 { |
743 » CPDF_FormControl* pFormCtrl = GetFormControl(); | 741 CPDF_FormControl* pFormCtrl = GetFormControl(); |
744 » ASSERT(pFormCtrl != NULL); | 742 ASSERT(pFormCtrl != NULL); |
745 | 743 |
746 » CPDF_DefaultAppearance pDa = pFormCtrl->GetDefaultAppearance(); | 744 CPDF_DefaultAppearance pDa = pFormCtrl->GetDefaultAppearance(); |
747 » CFX_ByteString csFont = ""; | 745 CFX_ByteString csFont = ""; |
748 » FX_FLOAT fFontSize = 0.0f; | 746 FX_FLOAT fFontSize = 0.0f; |
749 » pDa.GetFont(csFont, fFontSize); | 747 pDa.GetFont(csFont, fFontSize); |
750 | 748 |
751 » return fFontSize; | 749 return fFontSize; |
752 } | 750 } |
753 | 751 |
754 int CPDFSDK_Widget::GetSelectedIndex(int nIndex) | 752 int CPDFSDK_Widget::GetSelectedIndex(int nIndex) |
755 { | 753 { |
756 if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) | 754 if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) |
757 { | 755 { |
758 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHa
ndler()) | 756 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHa
ndler()) |
759 { | 757 { |
760 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetD
ataAcc(hWidget)) | 758 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetD
ataAcc(hWidget)) |
761 { | 759 { |
762 if (nIndex < pWidgetAcc->CountSelectedItems()) | 760 if (nIndex < pWidgetAcc->CountSelectedItems()) |
763 return pWidgetAcc->GetSelectedItem(nInde
x); | 761 return pWidgetAcc->GetSelectedItem(nInde
x); |
764 } | 762 } |
765 } | 763 } |
766 } | 764 } |
767 | 765 |
768 CPDF_FormField* pFormField = GetFormField(); | 766 CPDF_FormField* pFormField = GetFormField(); |
769 ASSERT(pFormField != NULL); | 767 ASSERT(pFormField != NULL); |
770 | 768 |
771 » return pFormField->GetSelectedIndex(nIndex); | 769 return pFormField->GetSelectedIndex(nIndex); |
772 } | 770 } |
773 | 771 |
774 CFX_WideString CPDFSDK_Widget::GetValue(FX_BOOL bDisplay) | 772 CFX_WideString CPDFSDK_Widget::GetValue(FX_BOOL bDisplay) |
775 { | 773 { |
776 if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) | 774 if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) |
777 { | 775 { |
778 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHa
ndler()) | 776 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHa
ndler()) |
779 { | 777 { |
780 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetD
ataAcc(hWidget)) | 778 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetD
ataAcc(hWidget)) |
781 { | 779 { |
782 CFX_WideString sValue; | 780 CFX_WideString sValue; |
783 pWidgetAcc->GetValue(sValue, bDisplay ? XFA_VALU
EPICTURE_Display : XFA_VALUEPICTURE_Edit); | 781 pWidgetAcc->GetValue(sValue, bDisplay ? XFA_VALU
EPICTURE_Display : XFA_VALUEPICTURE_Edit); |
784 return sValue; | 782 return sValue; |
785 } | 783 } |
786 } | 784 } |
787 } | 785 } |
788 | 786 |
789 CPDF_FormField* pFormField = GetFormField(); | 787 CPDF_FormField* pFormField = GetFormField(); |
790 ASSERT(pFormField != NULL); | 788 ASSERT(pFormField != NULL); |
791 | 789 |
792 » return pFormField->GetValue(); | 790 return pFormField->GetValue(); |
793 } | 791 } |
794 | 792 |
795 CFX_WideString CPDFSDK_Widget::GetDefaultValue() const | 793 CFX_WideString CPDFSDK_Widget::GetDefaultValue() const |
796 { | 794 { |
797 » CPDF_FormField*»pFormField = GetFormField(); | 795 CPDF_FormField* pFormField = GetFormField(); |
798 » ASSERT(pFormField != NULL); | 796 ASSERT(pFormField != NULL); |
799 | 797 |
800 » return pFormField->GetDefaultValue(); | 798 return pFormField->GetDefaultValue(); |
801 } | 799 } |
802 | 800 |
803 CFX_WideString CPDFSDK_Widget::GetOptionLabel(int nIndex) const | 801 CFX_WideString CPDFSDK_Widget::GetOptionLabel(int nIndex) const |
804 { | 802 { |
805 » CPDF_FormField*»pFormField = GetFormField(); | 803 CPDF_FormField* pFormField = GetFormField(); |
806 » ASSERT(pFormField != NULL); | 804 ASSERT(pFormField != NULL); |
807 | 805 |
808 » return pFormField->GetOptionLabel(nIndex); | 806 return pFormField->GetOptionLabel(nIndex); |
809 } | 807 } |
810 | 808 |
811 int» CPDFSDK_Widget::CountOptions() const | 809 int CPDFSDK_Widget::CountOptions() const |
812 { | 810 { |
813 » CPDF_FormField*»pFormField = GetFormField(); | 811 CPDF_FormField* pFormField = GetFormField(); |
814 » ASSERT(pFormField != NULL); | 812 ASSERT(pFormField != NULL); |
815 | 813 |
816 » return pFormField->CountOptions(); | 814 return pFormField->CountOptions(); |
817 } | 815 } |
818 | 816 |
819 FX_BOOL CPDFSDK_Widget::IsOptionSelected(int nIndex) | 817 FX_BOOL CPDFSDK_Widget::IsOptionSelected(int nIndex) |
820 { | 818 { |
821 if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) | 819 if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) |
822 { | 820 { |
823 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHa
ndler()) | 821 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHa
ndler()) |
824 { | 822 { |
825 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetD
ataAcc(hWidget)) | 823 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetD
ataAcc(hWidget)) |
826 { | 824 { |
827 if (nIndex > -1 && nIndex < pWidgetAcc->CountCho
iceListItems()) | 825 if (nIndex > -1 && nIndex < pWidgetAcc->CountCho
iceListItems()) |
828 return pWidgetAcc->GetItemState(nIndex); | 826 return pWidgetAcc->GetItemState(nIndex); |
829 » » » » else | 827 |
830 » » » » » return FALSE; | 828 return FALSE; |
831 } | 829 } |
832 } | 830 } |
833 } | 831 } |
834 | 832 |
835 CPDF_FormField* pFormField = GetFormField(); | 833 CPDF_FormField* pFormField = GetFormField(); |
836 » ASSERT(pFormField != NULL); | 834 return pFormField->IsItemSelected(nIndex); |
837 | |
838 » return pFormField->IsItemSelected(nIndex); | |
839 } | 835 } |
840 | 836 |
841 int» CPDFSDK_Widget::GetTopVisibleIndex() const | 837 int CPDFSDK_Widget::GetTopVisibleIndex() const |
842 { | 838 { |
843 » CPDF_FormField*»pFormField = GetFormField(); | 839 CPDF_FormField* pFormField = GetFormField(); |
844 » ASSERT(pFormField != NULL); | 840 return pFormField->GetTopVisibleIndex(); |
845 | |
846 » return pFormField->GetTopVisibleIndex(); | |
847 } | 841 } |
848 | 842 |
849 FX_BOOL CPDFSDK_Widget::IsChecked() | 843 FX_BOOL CPDFSDK_Widget::IsChecked() |
850 { | 844 { |
851 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHandler()) | 845 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHandler()) |
852 { | 846 { |
853 if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) | 847 if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) |
854 { | 848 { |
855 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetD
ataAcc(hWidget)) | 849 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetD
ataAcc(hWidget)) |
856 { | 850 { |
857 FX_BOOL bChecked = pWidgetAcc->GetCheckState() =
= XFA_CHECKSTATE_On; | 851 FX_BOOL bChecked = pWidgetAcc->GetCheckState() =
= XFA_CHECKSTATE_On; |
858 return bChecked; | 852 return bChecked; |
859 } | 853 } |
860 } | 854 } |
861 } | 855 } |
862 | 856 |
863 CPDF_FormControl* pFormCtrl = GetFormControl(); | 857 CPDF_FormControl* pFormCtrl = GetFormControl(); |
864 ASSERT(pFormCtrl != NULL); | 858 ASSERT(pFormCtrl != NULL); |
865 | 859 |
866 » return pFormCtrl->IsChecked(); | 860 return pFormCtrl->IsChecked(); |
867 } | 861 } |
868 | 862 |
869 int» CPDFSDK_Widget::GetAlignment() const | 863 int CPDFSDK_Widget::GetAlignment() const |
870 { | 864 { |
871 » CPDF_FormControl* pFormCtrl = GetFormControl(); | 865 CPDF_FormControl* pFormCtrl = GetFormControl(); |
872 » ASSERT(pFormCtrl != NULL); | 866 ASSERT(pFormCtrl != NULL); |
873 | 867 |
874 » return pFormCtrl->GetControlAlignment(); | 868 return pFormCtrl->GetControlAlignment(); |
875 } | 869 } |
876 | 870 |
877 int» CPDFSDK_Widget::GetMaxLen() const | 871 int CPDFSDK_Widget::GetMaxLen() const |
878 { | 872 { |
879 » CPDF_FormField*»pFormField = GetFormField(); | 873 CPDF_FormField* pFormField = GetFormField(); |
880 » ASSERT(pFormField != NULL); | 874 ASSERT(pFormField != NULL); |
881 | 875 |
882 » return pFormField->GetMaxLen(); | 876 return pFormField->GetMaxLen(); |
883 } | 877 } |
884 | 878 |
885 void CPDFSDK_Widget::SetCheck(FX_BOOL bChecked, FX_BOOL bNotify) | 879 void CPDFSDK_Widget::SetCheck(FX_BOOL bChecked, FX_BOOL bNotify) |
886 { | 880 { |
887 » CPDF_FormControl* pFormCtrl = GetFormControl(); | 881 CPDF_FormControl* pFormCtrl = GetFormControl(); |
888 » ASSERT(pFormCtrl != NULL); | 882 ASSERT(pFormCtrl != NULL); |
889 | 883 |
890 » CPDF_FormField*»pFormField = pFormCtrl->GetField(); | 884 CPDF_FormField* pFormField = pFormCtrl->GetField(); |
891 » ASSERT(pFormField != NULL); | 885 ASSERT(pFormField != NULL); |
892 | 886 |
893 pFormField->CheckControl(pFormField->GetControlIndex(pFormCtrl), bChecke
d, bNotify); | 887 pFormField->CheckControl(pFormField->GetControlIndex(pFormCtrl), bChecke
d, bNotify); |
894 if (!IsWidgetAppearanceValid(CPDF_Annot::Normal)) | 888 if (!IsWidgetAppearanceValid(CPDF_Annot::Normal)) |
895 ResetAppearance(TRUE); | 889 ResetAppearance(TRUE); |
896 if (!bNotify) | 890 if (!bNotify) |
897 Synchronize(TRUE); | 891 Synchronize(TRUE); |
898 } | 892 } |
899 | 893 |
900 void CPDFSDK_Widget::SetValue(const CFX_WideString& sValue, FX_BOOL bNotify) | 894 void CPDFSDK_Widget::SetValue(const CFX_WideString& sValue, FX_BOOL bNotify) |
901 { | 895 { |
902 » CPDF_FormField*»pFormField = GetFormField(); | 896 CPDF_FormField* pFormField = GetFormField(); |
903 » ASSERT(pFormField != NULL); | 897 ASSERT(pFormField != NULL); |
904 | 898 |
905 pFormField->SetValue(sValue, bNotify); | 899 pFormField->SetValue(sValue, bNotify); |
906 | 900 |
907 if (!bNotify) | 901 if (!bNotify) |
908 Synchronize(TRUE); | 902 Synchronize(TRUE); |
909 } | 903 } |
910 | 904 |
911 void CPDFSDK_Widget::SetDefaultValue(const CFX_WideString& sValue) | 905 void CPDFSDK_Widget::SetDefaultValue(const CFX_WideString& sValue) |
912 { | 906 { |
913 } | 907 } |
914 void CPDFSDK_Widget::SetOptionSelection(int index, FX_BOOL bSelected, FX_BOOL bN
otify) | 908 void CPDFSDK_Widget::SetOptionSelection(int index, FX_BOOL bSelected, FX_BOOL bN
otify) |
915 { | 909 { |
916 » CPDF_FormField* pFormField = GetFormField(); | 910 CPDF_FormField* pFormField = GetFormField(); |
917 » ASSERT(pFormField != NULL); | 911 ASSERT(pFormField != NULL); |
918 | 912 |
919 pFormField->SetItemSelection(index, bSelected, bNotify); | 913 pFormField->SetItemSelection(index, bSelected, bNotify); |
920 | 914 |
921 if (!bNotify) | 915 if (!bNotify) |
922 Synchronize(TRUE); | 916 Synchronize(TRUE); |
923 } | 917 } |
924 | 918 |
925 void CPDFSDK_Widget::ClearSelection(FX_BOOL bNotify) | 919 void CPDFSDK_Widget::ClearSelection(FX_BOOL bNotify) |
926 { | 920 { |
927 » CPDF_FormField* pFormField = GetFormField(); | 921 CPDF_FormField* pFormField = GetFormField(); |
928 » ASSERT(pFormField != NULL); | 922 ASSERT(pFormField != NULL); |
929 | 923 |
930 pFormField->ClearSelection(bNotify); | 924 pFormField->ClearSelection(bNotify); |
931 | 925 |
932 if (!bNotify) | 926 if (!bNotify) |
933 Synchronize(TRUE); | 927 Synchronize(TRUE); |
934 } | 928 } |
935 | 929 |
936 void CPDFSDK_Widget::SetTopVisibleIndex(int index) | 930 void CPDFSDK_Widget::SetTopVisibleIndex(int index) |
937 { | 931 { |
938 } | 932 } |
939 | 933 |
940 void CPDFSDK_Widget::SetAppModified() | 934 void CPDFSDK_Widget::SetAppModified() |
941 { | 935 { |
942 » m_bAppModified = TRUE; | 936 m_bAppModified = TRUE; |
943 } | 937 } |
944 | 938 |
945 void CPDFSDK_Widget::ClearAppModified() | 939 void CPDFSDK_Widget::ClearAppModified() |
946 { | 940 { |
947 » m_bAppModified = FALSE; | 941 m_bAppModified = FALSE; |
948 } | 942 } |
949 | 943 |
950 FX_BOOL CPDFSDK_Widget::IsAppModified() const | 944 FX_BOOL CPDFSDK_Widget::IsAppModified() const |
951 { | 945 { |
952 » return m_bAppModified; | 946 return m_bAppModified; |
953 } | 947 } |
954 | 948 |
955 void CPDFSDK_Widget::ResetAppearance(FX_BOOL bValueChanged) | 949 void CPDFSDK_Widget::ResetAppearance(FX_BOOL bValueChanged) |
956 { | 950 { |
957 switch (GetFieldType()) | 951 switch (GetFieldType()) |
958 { | 952 { |
959 case FIELDTYPE_TEXTFIELD: | 953 case FIELDTYPE_TEXTFIELD: |
960 case FIELDTYPE_COMBOBOX: | 954 case FIELDTYPE_COMBOBOX: |
961 { | 955 { |
962 FX_BOOL bFormated = FALSE; | 956 FX_BOOL bFormated = FALSE; |
963 CFX_WideString sValue = this->OnFormat(bFormated); | 957 CFX_WideString sValue = this->OnFormat(bFormated); |
964 if (bFormated) | 958 if (bFormated) |
965 this->ResetAppearance(sValue, TRUE); | 959 this->ResetAppearance(sValue, TRUE); |
966 else | 960 else |
967 this->ResetAppearance(NULL, TRUE); | 961 this->ResetAppearance(NULL, TRUE); |
968 } | 962 } |
969 break; | 963 break; |
970 default: | 964 default: |
971 this->ResetAppearance(NULL, FALSE); | 965 this->ResetAppearance(NULL, FALSE); |
972 break; | 966 break; |
973 } | 967 } |
974 } | 968 } |
975 | 969 |
976 void CPDFSDK_Widget::ResetAppearance(const FX_WCHAR* sValue, FX_BOOL bValueChang
ed) | 970 void CPDFSDK_Widget::ResetAppearance(const FX_WCHAR* sValue, FX_BOOL bValueChang
ed) |
977 { | 971 { |
978 » SetAppModified(); | 972 SetAppModified(); |
979 | 973 |
980 » m_nAppAge++; | 974 m_nAppAge++; |
981 » if (m_nAppAge > 999999) | 975 if (m_nAppAge > 999999) |
982 » » m_nAppAge = 0; | 976 m_nAppAge = 0; |
983 » if (bValueChanged) | 977 if (bValueChanged) |
984 » » m_nValueAge++; | 978 m_nValueAge++; |
985 | 979 |
986 » int nFieldType = GetFieldType(); | 980 int nFieldType = GetFieldType(); |
987 | 981 |
988 » switch (nFieldType) | 982 switch (nFieldType) |
989 » { | 983 { |
990 » case FIELDTYPE_PUSHBUTTON: | 984 case FIELDTYPE_PUSHBUTTON: |
991 » » ResetAppearance_PushButton(); | 985 ResetAppearance_PushButton(); |
992 » » break; | 986 break; |
993 » case FIELDTYPE_CHECKBOX: | 987 case FIELDTYPE_CHECKBOX: |
994 » » ResetAppearance_CheckBox(); | 988 ResetAppearance_CheckBox(); |
995 » » break; | 989 break; |
996 » case FIELDTYPE_RADIOBUTTON: | 990 case FIELDTYPE_RADIOBUTTON: |
997 » » ResetAppearance_RadioButton(); | 991 ResetAppearance_RadioButton(); |
998 » » break; | 992 break; |
999 » case FIELDTYPE_COMBOBOX: | 993 case FIELDTYPE_COMBOBOX: |
1000 » » ResetAppearance_ComboBox(sValue); | 994 ResetAppearance_ComboBox(sValue); |
1001 » » break; | 995 break; |
1002 » case FIELDTYPE_LISTBOX: | 996 case FIELDTYPE_LISTBOX: |
1003 » » ResetAppearance_ListBox(); | 997 ResetAppearance_ListBox(); |
1004 » » break; | 998 break; |
1005 » case FIELDTYPE_TEXTFIELD: | 999 case FIELDTYPE_TEXTFIELD: |
1006 » » ResetAppearance_TextField(sValue); | 1000 ResetAppearance_TextField(sValue); |
1007 » » break; | 1001 break; |
1008 » } | 1002 } |
1009 | 1003 |
1010 » ASSERT(m_pAnnot != NULL); | 1004 ASSERT(m_pAnnot != NULL); |
1011 » m_pAnnot->ClearCachedAP(); | 1005 m_pAnnot->ClearCachedAP(); |
1012 } | 1006 } |
1013 | 1007 |
1014 CFX_WideString CPDFSDK_Widget::OnFormat(FX_BOOL& bFormated) | 1008 CFX_WideString CPDFSDK_Widget::OnFormat(FX_BOOL& bFormated) |
1015 { | 1009 { |
1016 CPDF_FormField* pFormField = GetFormField(); | 1010 CPDF_FormField* pFormField = GetFormField(); |
1017 ASSERT(pFormField != NULL); | 1011 ASSERT(pFormField != NULL); |
1018 return m_pInterForm->OnFormat(pFormField, bFormated); | 1012 return m_pInterForm->OnFormat(pFormField, bFormated); |
1019 } | 1013 } |
1020 | 1014 |
1021 void CPDFSDK_Widget::ResetFieldAppearance(FX_BOOL bValueChanged) | 1015 void CPDFSDK_Widget::ResetFieldAppearance(FX_BOOL bValueChanged) |
1022 { | 1016 { |
1023 » CPDF_FormField* pFormField = GetFormField(); | 1017 CPDF_FormField* pFormField = GetFormField(); |
1024 » ASSERT(pFormField != NULL); | 1018 ASSERT(pFormField != NULL); |
1025 | 1019 |
1026 » ASSERT(m_pInterForm != NULL); | 1020 ASSERT(m_pInterForm != NULL); |
1027 | 1021 |
1028 » m_pInterForm->ResetFieldAppearance(pFormField, NULL, bValueChanged); | 1022 m_pInterForm->ResetFieldAppearance(pFormField, NULL, bValueChanged); |
1029 } | 1023 } |
1030 | 1024 |
1031 void» CPDFSDK_Widget::DrawAppearance(CFX_RenderDevice* pDevice, const CPDF_Mat
rix* pUser2Device, | 1025 void CPDFSDK_Widget::DrawAppearance(CFX_RenderDevice* pDevice, const CPDF_Mat
rix* pUser2Device, |
1032 » » CPDF_Annot::AppearanceMode mode, const CPDF_RenderOptions* pOpti
ons) | 1026 CPDF_Annot::AppearanceMode mode, const CPDF_RenderOptions* pOptions) |
1033 { | 1027 { |
1034 » int nFieldType = GetFieldType(); | 1028 int nFieldType = GetFieldType(); |
1035 | 1029 |
1036 » if ((nFieldType == FIELDTYPE_CHECKBOX || nFieldType == FIELDTYPE_RADIOBU
TTON) && | 1030 if ((nFieldType == FIELDTYPE_CHECKBOX || nFieldType == FIELDTYPE_RADIOBUTTON
) && |
1037 » » mode == CPDF_Annot::Normal && | 1031 mode == CPDF_Annot::Normal && |
1038 » » !IsWidgetAppearanceValid(CPDF_Annot::Normal)) | 1032 !IsWidgetAppearanceValid(CPDF_Annot::Normal)) |
1039 » { | 1033 { |
1040 » » CFX_PathData pathData; | 1034 CFX_PathData pathData; |
1041 | 1035 |
1042 » » CPDF_Rect rcAnnot = GetRect(); | 1036 CPDF_Rect rcAnnot = GetRect(); |
1043 | 1037 |
1044 » » pathData.AppendRect(rcAnnot.left, rcAnnot.bottom, | 1038 pathData.AppendRect(rcAnnot.left, rcAnnot.bottom, |
1045 » » » rcAnnot.right, rcAnnot.top); | 1039 rcAnnot.right, rcAnnot.top); |
1046 | 1040 |
1047 » » CFX_GraphStateData gsd; | 1041 CFX_GraphStateData gsd; |
1048 » » gsd.m_LineWidth = 0.0f; | 1042 gsd.m_LineWidth = 0.0f; |
1049 | 1043 |
1050 pDevice->DrawPath(&pathData, pUser2Device, &gsd, 0, 0xFFAAAAAA,
FXFILL_ALTERNATE); | 1044 pDevice->DrawPath(&pathData, pUser2Device, &gsd, 0, 0xFFAAAAAA,
FXFILL_ALTERNATE); |
1051 } | 1045 } |
1052 else | 1046 else |
1053 { | 1047 { |
1054 CPDFSDK_BAAnnot::DrawAppearance(pDevice, pUser2Device, mode, pOp
tions); | 1048 CPDFSDK_BAAnnot::DrawAppearance(pDevice, pUser2Device, mode, pOp
tions); |
1055 } | 1049 } |
1056 } | 1050 } |
1057 | 1051 |
1058 void CPDFSDK_Widget::UpdateField() | 1052 void CPDFSDK_Widget::UpdateField() |
1059 { | 1053 { |
1060 » CPDF_FormField* pFormField = GetFormField(); | 1054 CPDF_FormField* pFormField = GetFormField(); |
1061 » ASSERT(pFormField != NULL); | 1055 ASSERT(pFormField != NULL); |
1062 | 1056 |
1063 » ASSERT(m_pInterForm != NULL); | 1057 ASSERT(m_pInterForm != NULL); |
1064 » m_pInterForm->UpdateField(pFormField); | 1058 m_pInterForm->UpdateField(pFormField); |
1065 } | 1059 } |
1066 | 1060 |
1067 void CPDFSDK_Widget::DrawShadow(CFX_RenderDevice* pDevice, CPDFSDK_PageView* pPa
geView) | 1061 void CPDFSDK_Widget::DrawShadow(CFX_RenderDevice* pDevice, CPDFSDK_PageView* pPa
geView) |
1068 { | 1062 { |
1069 » ASSERT(m_pInterForm != NULL); | 1063 ASSERT(m_pInterForm != NULL); |
1070 | 1064 |
1071 » int nFieldType = GetFieldType(); | 1065 int nFieldType = GetFieldType(); |
1072 » if (m_pInterForm->IsNeedHighLight(nFieldType)) | 1066 if (m_pInterForm->IsNeedHighLight(nFieldType)) |
1073 » { | 1067 { |
1074 | 1068 |
1075 // » » if (nFieldType != FIELDTYPE_PUSHBUTTON) | 1069 // if (nFieldType != FIELDTYPE_PUSHBUTTON) |
1076 // » » { | 1070 // { |
1077 » » » CPDF_Rect rc = GetRect(); | 1071 CPDF_Rect rc = GetRect(); |
1078 » » » FX_COLORREF color = m_pInterForm->GetHighlightColor(nFie
ldType); | 1072 FX_COLORREF color = m_pInterForm->GetHighlightColor(nFieldType); |
1079 » » » uint8_t alpha = m_pInterForm->GetHighlightAlpha(); | 1073 uint8_t alpha = m_pInterForm->GetHighlightAlpha(); |
1080 | 1074 |
1081 » » » CFX_FloatRect rcDevice; | 1075 CFX_FloatRect rcDevice; |
1082 » » » ASSERT(m_pInterForm->GetDocument()); | 1076 ASSERT(m_pInterForm->GetDocument()); |
1083 » » » CPDFDoc_Environment* pEnv = m_pInterForm->GetDocument()-
>GetEnv(); | 1077 CPDFDoc_Environment* pEnv = m_pInterForm->GetDocument()->GetEnv(); |
1084 » » » if(!pEnv) | 1078 if(!pEnv) |
1085 » » » » return; | 1079 return; |
1086 » » » CFX_AffineMatrix page2device; | 1080 CFX_AffineMatrix page2device; |
1087 » » » pPageView->GetCurrentMatrix(page2device); | 1081 pPageView->GetCurrentMatrix(page2device); |
1088 » » » page2device.Transform(((FX_FLOAT)rc.left), ((FX_FLOAT)rc
.bottom), rcDevice.left, rcDevice.bottom); | 1082 page2device.Transform(((FX_FLOAT)rc.left), ((FX_FLOAT)rc.bottom), rc
Device.left, rcDevice.bottom); |
1089 // » » » pEnv->FFI_PageToDevice(m_pPageView->GetPDFPage(), rc.lef
t, rc.bottom, &rcDevice.left, &rcDevice.bottom); | 1083 // pEnv->FFI_PageToDevice(m_pPageView->GetPDFPage(), rc.left, rc.bottom
, &rcDevice.left, &rcDevice.bottom); |
1090 // » » » pEnv->FFI_PageToDevice(m_pPageView->GetPDFPage(), rc.rig
ht, rc.top, &rcDevice.right, &rcDevice.top); | 1084 // pEnv->FFI_PageToDevice(m_pPageView->GetPDFPage(), rc.right, rc.top,
&rcDevice.right, &rcDevice.top); |
1091 » » » page2device.Transform(((FX_FLOAT)rc.right), ((FX_FLOAT)r
c.top), rcDevice.right, rcDevice.top); | 1085 page2device.Transform(((FX_FLOAT)rc.right), ((FX_FLOAT)rc.top), rcDe
vice.right, rcDevice.top); |
1092 | 1086 |
1093 » » » rcDevice.Normalize(); | 1087 rcDevice.Normalize(); |
1094 | 1088 |
1095 » » » FX_ARGB argb = ArgbEncode((int)alpha, color); | 1089 FX_ARGB argb = ArgbEncode((int)alpha, color); |
1096 » » » FX_RECT rcDev((int)rcDevice.left,(int)rcDevice.top,(int)
rcDevice.right,(int)rcDevice.bottom); | 1090 FX_RECT rcDev((int)rcDevice.left,(int)rcDevice.top,(int)rcDevice.rig
ht,(int)rcDevice.bottom); |
1097 » » » pDevice->FillRect(&rcDev, argb); | 1091 pDevice->FillRect(&rcDev, argb); |
1098 » » » /* » » }*/ | 1092 /* }*/ |
1099 » } | 1093 } |
1100 } | 1094 } |
1101 | 1095 |
1102 void CPDFSDK_Widget::ResetAppearance_PushButton() | 1096 void CPDFSDK_Widget::ResetAppearance_PushButton() |
1103 { | 1097 { |
1104 CPDF_FormControl* pControl = GetFormControl(); | 1098 CPDF_FormControl* pControl = GetFormControl(); |
1105 ASSERT(pControl != NULL); | 1099 ASSERT(pControl != NULL); |
1106 | 1100 |
1107 | 1101 |
1108 | 1102 |
1109 CPDF_Rect rcWindow = GetRotatedRect(); | 1103 CPDF_Rect rcWindow = GetRotatedRect(); |
1110 | 1104 |
1111 int32_t nLayout = 0; | 1105 int32_t nLayout = 0; |
1112 | 1106 |
1113 switch (pControl->GetTextPosition()) | 1107 switch (pControl->GetTextPosition()) |
1114 { | 1108 { |
1115 case TEXTPOS_ICON: | 1109 case TEXTPOS_ICON: |
1116 nLayout = PPBL_ICON; | 1110 nLayout = PPBL_ICON; |
1117 break; | 1111 break; |
1118 case TEXTPOS_BELOW: | 1112 case TEXTPOS_BELOW: |
1119 nLayout = PPBL_ICONTOPLABELBOTTOM; | 1113 nLayout = PPBL_ICONTOPLABELBOTTOM; |
1120 break; | 1114 break; |
1121 case TEXTPOS_ABOVE: | 1115 case TEXTPOS_ABOVE: |
1122 nLayout = PPBL_LABELTOPICONBOTTOM; | 1116 nLayout = PPBL_LABELTOPICONBOTTOM; |
1123 break; | 1117 break; |
1124 case TEXTPOS_RIGHT: | 1118 case TEXTPOS_RIGHT: |
1125 nLayout = PPBL_ICONLEFTLABELRIGHT; | 1119 nLayout = PPBL_ICONLEFTLABELRIGHT; |
1126 break; | 1120 break; |
1127 case TEXTPOS_LEFT: | 1121 case TEXTPOS_LEFT: |
1128 nLayout = PPBL_LABELLEFTICONRIGHT; | 1122 nLayout = PPBL_LABELLEFTICONRIGHT; |
1129 break; | 1123 break; |
1130 case TEXTPOS_OVERLAID: | 1124 case TEXTPOS_OVERLAID: |
1131 nLayout = PPBL_LABELOVERICON; | 1125 nLayout = PPBL_LABELOVERICON; |
1132 break; | 1126 break; |
1133 default: | 1127 default: |
1134 nLayout = PPBL_LABEL; | 1128 nLayout = PPBL_LABEL; |
1135 break; | 1129 break; |
1136 } | 1130 } |
1137 | 1131 |
1138 CPWL_Color crBackground, crBorder; | 1132 CPWL_Color crBackground, crBorder; |
1139 | 1133 |
1140 int iColorType; | 1134 int iColorType; |
1141 FX_FLOAT fc[4]; | 1135 FX_FLOAT fc[4]; |
1142 | 1136 |
1143 pControl->GetOriginalBackgroundColor(iColorType, fc); | 1137 pControl->GetOriginalBackgroundColor(iColorType, fc); |
1144 if (iColorType > 0) | 1138 if (iColorType > 0) |
1145 crBackground = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]
); | 1139 crBackground = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); |
1146 | 1140 |
1147 pControl->GetOriginalBorderColor(iColorType, fc); | 1141 pControl->GetOriginalBorderColor(iColorType, fc); |
1148 if (iColorType > 0) | 1142 if (iColorType > 0) |
1149 crBorder = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); | 1143 crBorder = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); |
1150 | 1144 |
1151 FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); | 1145 FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); |
1152 int32_t nBorderStyle = 0; | 1146 int32_t nBorderStyle = 0; |
1153 CPWL_Dash dsBorder(3,0,0); | 1147 CPWL_Dash dsBorder(3,0,0); |
1154 CPWL_Color crLeftTop,crRightBottom; | 1148 CPWL_Color crLeftTop,crRightBottom; |
1155 | 1149 |
1156 switch (GetBorderStyle()) | 1150 switch (GetBorderStyle()) |
1157 { | 1151 { |
1158 case BBS_DASH: | 1152 case BBS_DASH: |
1159 nBorderStyle = PBS_DASH; | 1153 nBorderStyle = PBS_DASH; |
1160 dsBorder = CPWL_Dash(3, 3, 0); | 1154 dsBorder = CPWL_Dash(3, 3, 0); |
1161 break; | 1155 break; |
1162 case BBS_BEVELED: | 1156 case BBS_BEVELED: |
1163 nBorderStyle = PBS_BEVELED; | 1157 nBorderStyle = PBS_BEVELED; |
1164 fBorderWidth *= 2; | 1158 fBorderWidth *= 2; |
1165 crLeftTop = CPWL_Color(COLORTYPE_GRAY,1); | 1159 crLeftTop = CPWL_Color(COLORTYPE_GRAY,1); |
1166 crRightBottom = CPWL_Utils::DevideColor(crBackground,2); | 1160 crRightBottom = CPWL_Utils::DevideColor(crBackground,2); |
1167 break; | 1161 break; |
1168 case BBS_INSET: | 1162 case BBS_INSET: |
1169 nBorderStyle = PBS_INSET; | 1163 nBorderStyle = PBS_INSET; |
1170 fBorderWidth *= 2; | 1164 fBorderWidth *= 2; |
1171 crLeftTop = CPWL_Color(COLORTYPE_GRAY,0.5); | 1165 crLeftTop = CPWL_Color(COLORTYPE_GRAY,0.5); |
1172 crRightBottom = CPWL_Color(COLORTYPE_GRAY,0.75); | 1166 crRightBottom = CPWL_Color(COLORTYPE_GRAY,0.75); |
1173 break; | 1167 break; |
1174 case BBS_UNDERLINE: | 1168 case BBS_UNDERLINE: |
1175 nBorderStyle = PBS_UNDERLINED; | 1169 nBorderStyle = PBS_UNDERLINED; |
1176 break; | 1170 break; |
1177 default: | 1171 default: |
1178 nBorderStyle = PBS_SOLID; | 1172 nBorderStyle = PBS_SOLID; |
1179 break; | 1173 break; |
1180 } | 1174 } |
1181 | 1175 |
1182 CPDF_Rect rcClient = CPWL_Utils::DeflateRect(rcWindow,fBorderWidth); | 1176 CPDF_Rect rcClient = CPWL_Utils::DeflateRect(rcWindow,fBorderWidth); |
1183 | 1177 |
1184 CPWL_Color crText(COLORTYPE_GRAY,0); | 1178 CPWL_Color crText(COLORTYPE_GRAY,0); |
1185 | 1179 |
1186 FX_FLOAT fFontSize = 12.0f; | 1180 FX_FLOAT fFontSize = 12.0f; |
1187 CFX_ByteString csNameTag; | 1181 CFX_ByteString csNameTag; |
1188 | 1182 |
1189 CPDF_DefaultAppearance da = pControl->GetDefaultAppearance(); | 1183 CPDF_DefaultAppearance da = pControl->GetDefaultAppearance(); |
1190 if (da.HasColor()) | 1184 if (da.HasColor()) |
1191 { | 1185 { |
1192 da.GetColor(iColorType, fc); | 1186 da.GetColor(iColorType, fc); |
1193 crText = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); | 1187 crText = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); |
1194 } | 1188 } |
1195 | 1189 |
1196 if (da.HasFont()) | 1190 if (da.HasFont()) |
1197 da.GetFont(csNameTag, fFontSize); | 1191 da.GetFont(csNameTag, fFontSize); |
1198 | 1192 |
1199 CFX_WideString csWCaption; | 1193 CFX_WideString csWCaption; |
1200 CFX_WideString csNormalCaption, csRolloverCaption, csDownCaption; | 1194 CFX_WideString csNormalCaption, csRolloverCaption, csDownCaption; |
1201 | 1195 |
1202 if (pControl->HasMKEntry("CA")) | 1196 if (pControl->HasMKEntry("CA")) |
1203 { | 1197 { |
1204 csNormalCaption = pControl->GetNormalCaption(); | 1198 csNormalCaption = pControl->GetNormalCaption(); |
1205 } | 1199 } |
1206 if (pControl->HasMKEntry("RC")) | 1200 if (pControl->HasMKEntry("RC")) |
1207 { | 1201 { |
1208 csRolloverCaption = pControl->GetRolloverCaption(); | 1202 csRolloverCaption = pControl->GetRolloverCaption(); |
1209 } | 1203 } |
1210 if (pControl->HasMKEntry("AC")) | 1204 if (pControl->HasMKEntry("AC")) |
1211 { | 1205 { |
1212 csDownCaption = pControl->GetDownCaption(); | 1206 csDownCaption = pControl->GetDownCaption(); |
1213 } | 1207 } |
1214 | 1208 |
1215 CPDF_Stream* pNormalIcon = NULL; | 1209 CPDF_Stream* pNormalIcon = NULL; |
1216 CPDF_Stream* pRolloverIcon = NULL; | 1210 CPDF_Stream* pRolloverIcon = NULL; |
1217 CPDF_Stream* pDownIcon = NULL; | 1211 CPDF_Stream* pDownIcon = NULL; |
1218 | 1212 |
1219 if (pControl->HasMKEntry("I")) | 1213 if (pControl->HasMKEntry("I")) |
1220 { | 1214 { |
1221 pNormalIcon = pControl->GetNormalIcon(); | 1215 pNormalIcon = pControl->GetNormalIcon(); |
1222 } | 1216 } |
1223 if (pControl->HasMKEntry("RI")) | 1217 if (pControl->HasMKEntry("RI")) |
1224 { | 1218 { |
1225 pRolloverIcon = pControl->GetRolloverIcon(); | 1219 pRolloverIcon = pControl->GetRolloverIcon(); |
1226 } | 1220 } |
1227 if (pControl->HasMKEntry("IX")) | 1221 if (pControl->HasMKEntry("IX")) |
1228 { | 1222 { |
1229 pDownIcon = pControl->GetDownIcon(); | 1223 pDownIcon = pControl->GetDownIcon(); |
1230 } | 1224 } |
1231 | 1225 |
1232 if (pNormalIcon) | 1226 if (pNormalIcon) |
1233 { | 1227 { |
1234 if (CPDF_Dictionary* pImageDict = pNormalIcon->GetDict()) | 1228 if (CPDF_Dictionary* pImageDict = pNormalIcon->GetDict()) |
1235 { | 1229 { |
1236 if (pImageDict->GetString("Name").IsEmpty()) | 1230 if (pImageDict->GetString("Name").IsEmpty()) |
1237 pImageDict->SetAtString("Name", "ImgA"); | 1231 pImageDict->SetAtString("Name", "ImgA"); |
1238 } | 1232 } |
1239 } | 1233 } |
1240 | 1234 |
1241 if (pRolloverIcon) | 1235 if (pRolloverIcon) |
1242 { | 1236 { |
1243 if (CPDF_Dictionary* pImageDict = pRolloverIcon->GetDict()) | 1237 if (CPDF_Dictionary* pImageDict = pRolloverIcon->GetDict()) |
1244 { | 1238 { |
1245 if (pImageDict->GetString("Name").IsEmpty()) | 1239 if (pImageDict->GetString("Name").IsEmpty()) |
1246 pImageDict->SetAtString("Name", "ImgB"); | 1240 pImageDict->SetAtString("Name", "ImgB"); |
1247 } | 1241 } |
1248 } | 1242 } |
1249 | 1243 |
1250 if (pDownIcon) | 1244 if (pDownIcon) |
1251 { | 1245 { |
1252 if (CPDF_Dictionary* pImageDict = pDownIcon->GetDict()) | 1246 if (CPDF_Dictionary* pImageDict = pDownIcon->GetDict()) |
1253 { | 1247 { |
1254 if (pImageDict->GetString("Name").IsEmpty()) | 1248 if (pImageDict->GetString("Name").IsEmpty()) |
1255 pImageDict->SetAtString("Name", "ImgC"); | 1249 pImageDict->SetAtString("Name", "ImgC"); |
1256 } | 1250 } |
1257 } | 1251 } |
1258 | 1252 |
1259 CPDF_IconFit iconFit = pControl->GetIconFit(); | 1253 CPDF_IconFit iconFit = pControl->GetIconFit(); |
1260 | 1254 |
1261 CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); | 1255 CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); |
1262 ASSERT(pDoc != NULL); | 1256 ASSERT(pDoc != NULL); |
1263 CPDFDoc_Environment* pEnv = pDoc->GetEnv(); | 1257 CPDFDoc_Environment* pEnv = pDoc->GetEnv(); |
1264 | 1258 |
1265 CBA_FontMap FontMap(this,pEnv->GetSysHandler());//, ISystemHandle::GetSy
stemHandler(m_pBaseForm->GetEnv())); | 1259 CBA_FontMap FontMap(this,pEnv->GetSysHandler());//, ISystemHandle::GetSystem
Handler(m_pBaseForm->GetEnv())); |
1266 FontMap.Initial(); | 1260 FontMap.Initial(); |
1267 | 1261 |
1268 FontMap.SetAPType("N"); | 1262 FontMap.SetAPType("N"); |
1269 | 1263 |
1270 CFX_ByteString csAP = CPWL_Utils::GetRectFillAppStream(rcWindow, crBackg
round) + | 1264 CFX_ByteString csAP = CPWL_Utils::GetRectFillAppStream(rcWindow, crBackgroun
d) + |
1271 CPWL_Utils::GetBorderAppStream(rcWindow, fBorderWidth, crBorder,
crLeftTop, crRightBottom, nBorderStyle, dsBorder) + | 1265 CPWL_Utils::GetBorderAppStream(rcWindow, fBorderWidth, crBorder, crLeftT
op, crRightBottom, nBorderStyle, dsBorder) + |
1272 CPWL_Utils::GetPushButtonAppStream(iconFit.GetFittingBounds() ?
rcWindow : rcClient, &FontMap, pNormalIcon, iconFit, csNormalCaption, crText, fF
ontSize, nLayout); | 1266 CPWL_Utils::GetPushButtonAppStream(iconFit.GetFittingBounds() ? rcWindow
: rcClient, &FontMap, pNormalIcon, iconFit, csNormalCaption, crText, fFontSize,
nLayout); |
1273 | 1267 |
1274 WriteAppearance("N", GetRotatedRect(), GetMatrix(), csAP); | 1268 WriteAppearance("N", GetRotatedRect(), GetMatrix(), csAP); |
1275 if (pNormalIcon) | 1269 if (pNormalIcon) |
1276 AddImageToAppearance("N", pNormalIcon); | 1270 AddImageToAppearance("N", pNormalIcon); |
1277 | 1271 |
1278 CPDF_FormControl::HighlightingMode eHLM = pControl->GetHighlightingMode(
); | 1272 CPDF_FormControl::HighlightingMode eHLM = pControl->GetHighlightingMode(); |
1279 if (eHLM == CPDF_FormControl::Push || eHLM == CPDF_FormControl::Toggle) | 1273 if (eHLM == CPDF_FormControl::Push || eHLM == CPDF_FormControl::Toggle) |
1280 { | 1274 { |
1281 if (csRolloverCaption.IsEmpty() && !pRolloverIcon) | 1275 if (csRolloverCaption.IsEmpty() && !pRolloverIcon) |
1282 { | 1276 { |
1283 csRolloverCaption = csNormalCaption; | 1277 csRolloverCaption = csNormalCaption; |
1284 pRolloverIcon = pNormalIcon; | 1278 pRolloverIcon = pNormalIcon; |
1285 } | 1279 } |
1286 | 1280 |
1287 FontMap.SetAPType("R"); | 1281 FontMap.SetAPType("R"); |
1288 | 1282 |
1289 csAP = CPWL_Utils::GetRectFillAppStream(rcWindow, crBackground)
+ | 1283 csAP = CPWL_Utils::GetRectFillAppStream(rcWindow, crBackground) + |
1290 CPWL_Utils::GetBorderAppStream(rcWindow, fBorder
Width, crBorder, crLeftTop, crRightBottom, nBorderStyle, dsBorder) + | 1284 CPWL_Utils::GetBorderAppStream(rcWindow, fBorderWidth, crBorder,
crLeftTop, crRightBottom, nBorderStyle, dsBorder) + |
1291 CPWL_Utils::GetPushButtonAppStream(iconFit.GetFi
ttingBounds() ? rcWindow : rcClient, &FontMap, pRolloverIcon, iconFit, csRollove
rCaption, crText, fFontSize, nLayout); | 1285 CPWL_Utils::GetPushButtonAppStream(iconFit.GetFittingBounds() ?
rcWindow : rcClient, &FontMap, pRolloverIcon, iconFit, csRolloverCaption, crText
, fFontSize, nLayout); |
1292 | 1286 |
1293 WriteAppearance("R", GetRotatedRect(), GetMatrix(), csAP); | 1287 WriteAppearance("R", GetRotatedRect(), GetMatrix(), csAP); |
1294 if (pRolloverIcon) | 1288 if (pRolloverIcon) |
1295 AddImageToAppearance("R", pRolloverIcon); | 1289 AddImageToAppearance("R", pRolloverIcon); |
1296 | 1290 |
1297 if (csDownCaption.IsEmpty() && !pDownIcon) | 1291 if (csDownCaption.IsEmpty() && !pDownIcon) |
1298 { | 1292 { |
1299 csDownCaption = csNormalCaption; | 1293 csDownCaption = csNormalCaption; |
1300 pDownIcon = pNormalIcon; | 1294 pDownIcon = pNormalIcon; |
1301 } | 1295 } |
1302 | 1296 |
1303 switch (nBorderStyle) | 1297 switch (nBorderStyle) |
1304 { | 1298 { |
1305 case PBS_BEVELED: | 1299 case PBS_BEVELED: |
1306 { | 1300 { |
1307 CPWL_Color crTemp = crLeftTop; | 1301 CPWL_Color crTemp = crLeftTop; |
1308 crLeftTop = crRightBottom; | 1302 crLeftTop = crRightBottom; |
1309 crRightBottom = crTemp; | 1303 crRightBottom = crTemp; |
1310 } | 1304 } |
1311 break; | 1305 break; |
1312 case PBS_INSET: | 1306 case PBS_INSET: |
1313 crLeftTop = CPWL_Color(COLORTYPE_GRAY,0); | 1307 crLeftTop = CPWL_Color(COLORTYPE_GRAY,0); |
1314 crRightBottom = CPWL_Color(COLORTYPE_GRAY,1); | 1308 crRightBottom = CPWL_Color(COLORTYPE_GRAY,1); |
1315 break; | 1309 break; |
1316 } | 1310 } |
1317 | 1311 |
1318 FontMap.SetAPType("D"); | 1312 FontMap.SetAPType("D"); |
1319 | 1313 |
1320 csAP = CPWL_Utils::GetRectFillAppStream(rcWindow, CPWL_Utils::Su
bstractColor(crBackground,0.25f)) + | 1314 csAP = CPWL_Utils::GetRectFillAppStream(rcWindow, CPWL_Utils::SubstractC
olor(crBackground,0.25f)) + |
1321 CPWL_Utils::GetBorderAppStream(rcWindow, fBorderWidth, c
rBorder, crLeftTop, crRightBottom, nBorderStyle, dsBorder) + | 1315 CPWL_Utils::GetBorderAppStream(rcWindow, fBorderWidth, crBorder, crL
eftTop, crRightBottom, nBorderStyle, dsBorder) + |
1322 CPWL_Utils::GetPushButtonAppStream(iconFit.GetFittingBou
nds() ? rcWindow : rcClient, &FontMap, pDownIcon, iconFit, csDownCaption, crText
, fFontSize, nLayout); | 1316 CPWL_Utils::GetPushButtonAppStream(iconFit.GetFittingBounds() ? rcWi
ndow : rcClient, &FontMap, pDownIcon, iconFit, csDownCaption, crText, fFontSize,
nLayout); |
1323 | 1317 |
1324 WriteAppearance("D", GetRotatedRect(), GetMatrix(), csAP); | 1318 WriteAppearance("D", GetRotatedRect(), GetMatrix(), csAP); |
1325 if (pDownIcon) | 1319 if (pDownIcon) |
1326 AddImageToAppearance("D", pDownIcon); | 1320 AddImageToAppearance("D", pDownIcon); |
1327 } | 1321 } |
1328 else | 1322 else |
1329 { | 1323 { |
1330 RemoveAppearance("D"); | 1324 RemoveAppearance("D"); |
1331 RemoveAppearance("R"); | 1325 RemoveAppearance("R"); |
1332 } | 1326 } |
1333 } | 1327 } |
1334 | 1328 |
1335 void CPDFSDK_Widget::ResetAppearance_CheckBox() | 1329 void CPDFSDK_Widget::ResetAppearance_CheckBox() |
1336 { | 1330 { |
1337 » CPDF_FormControl* pControl = GetFormControl(); | 1331 CPDF_FormControl* pControl = GetFormControl(); |
1338 » ASSERT(pControl != NULL); | 1332 ASSERT(pControl != NULL); |
1339 | 1333 |
1340 | 1334 |
1341 | 1335 |
1342 » CPWL_Color crBackground, crBorder, crText; | 1336 CPWL_Color crBackground, crBorder, crText; |
1343 | 1337 |
1344 » int iColorType; | 1338 int iColorType; |
1345 » FX_FLOAT fc[4]; | 1339 FX_FLOAT fc[4]; |
1346 | 1340 |
1347 » pControl->GetOriginalBackgroundColor(iColorType, fc); | 1341 pControl->GetOriginalBackgroundColor(iColorType, fc); |
1348 » if (iColorType > 0) | 1342 if (iColorType > 0) |
1349 » » crBackground = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]
); | 1343 crBackground = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); |
1350 | 1344 |
1351 » pControl->GetOriginalBorderColor(iColorType, fc); | 1345 pControl->GetOriginalBorderColor(iColorType, fc); |
1352 » if (iColorType > 0) | 1346 if (iColorType > 0) |
1353 » » crBorder = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); | 1347 crBorder = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); |
1354 | 1348 |
1355 » FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); | 1349 FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); |
1356 » int32_t nBorderStyle = 0; | 1350 int32_t nBorderStyle = 0; |
1357 » CPWL_Dash dsBorder(3,0,0); | 1351 CPWL_Dash dsBorder(3,0,0); |
1358 » CPWL_Color crLeftTop,crRightBottom; | 1352 CPWL_Color crLeftTop,crRightBottom; |
1359 | 1353 |
1360 » switch (GetBorderStyle()) | 1354 switch (GetBorderStyle()) |
1361 » { | 1355 { |
1362 » case BBS_DASH: | 1356 case BBS_DASH: |
1363 » » nBorderStyle = PBS_DASH; | 1357 nBorderStyle = PBS_DASH; |
1364 » » dsBorder = CPWL_Dash(3, 3, 0); | 1358 dsBorder = CPWL_Dash(3, 3, 0); |
1365 » » break; | 1359 break; |
1366 » case BBS_BEVELED: | 1360 case BBS_BEVELED: |
1367 » » nBorderStyle = PBS_BEVELED; | 1361 nBorderStyle = PBS_BEVELED; |
1368 » » fBorderWidth *= 2; | 1362 fBorderWidth *= 2; |
1369 » » crLeftTop = CPWL_Color(COLORTYPE_GRAY,1); | 1363 crLeftTop = CPWL_Color(COLORTYPE_GRAY,1); |
1370 » » crRightBottom = CPWL_Utils::DevideColor(crBackground,2); | 1364 crRightBottom = CPWL_Utils::DevideColor(crBackground,2); |
1371 » » break; | 1365 break; |
1372 » case BBS_INSET: | 1366 case BBS_INSET: |
1373 » » nBorderStyle = PBS_INSET; | 1367 nBorderStyle = PBS_INSET; |
1374 » » fBorderWidth *= 2; | 1368 fBorderWidth *= 2; |
1375 » » crLeftTop = CPWL_Color(COLORTYPE_GRAY,0.5); | 1369 crLeftTop = CPWL_Color(COLORTYPE_GRAY,0.5); |
1376 » » crRightBottom = CPWL_Color(COLORTYPE_GRAY,0.75); | 1370 crRightBottom = CPWL_Color(COLORTYPE_GRAY,0.75); |
1377 » » break; | 1371 break; |
1378 » case BBS_UNDERLINE: | 1372 case BBS_UNDERLINE: |
1379 » » nBorderStyle = PBS_UNDERLINED; | 1373 nBorderStyle = PBS_UNDERLINED; |
1380 » » break; | 1374 break; |
1381 » default: | 1375 default: |
1382 » » nBorderStyle = PBS_SOLID; | 1376 nBorderStyle = PBS_SOLID; |
1383 » » break; | 1377 break; |
1384 » } | 1378 } |
1385 | 1379 |
1386 » CPDF_Rect rcWindow = GetRotatedRect(); | 1380 CPDF_Rect rcWindow = GetRotatedRect(); |
1387 » CPDF_Rect rcClient = CPWL_Utils::DeflateRect(rcWindow,fBorderWidth); | 1381 CPDF_Rect rcClient = CPWL_Utils::DeflateRect(rcWindow,fBorderWidth); |
1388 | 1382 |
1389 » CPDF_DefaultAppearance da = pControl->GetDefaultAppearance(); | 1383 CPDF_DefaultAppearance da = pControl->GetDefaultAppearance(); |
1390 » if (da.HasColor()) | 1384 if (da.HasColor()) |
1391 » { | 1385 { |
1392 » » da.GetColor(iColorType, fc); | 1386 da.GetColor(iColorType, fc); |
1393 » » crText = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); | 1387 crText = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); |
1394 » } | 1388 } |
1395 | 1389 |
1396 » int32_t nStyle = 0; | 1390 int32_t nStyle = 0; |
1397 | 1391 |
1398 » CFX_WideString csWCaption = pControl->GetNormalCaption(); | 1392 CFX_WideString csWCaption = pControl->GetNormalCaption(); |
1399 » if (csWCaption.GetLength() > 0) | 1393 if (csWCaption.GetLength() > 0) |
1400 » { | 1394 { |
1401 » » switch (csWCaption[0]) | 1395 switch (csWCaption[0]) |
1402 » » { | 1396 { |
1403 » » case L'l': | 1397 case L'l': |
1404 » » » nStyle = PCS_CIRCLE; | 1398 nStyle = PCS_CIRCLE; |
1405 » » » break; | 1399 break; |
1406 » » case L'8': | 1400 case L'8': |
1407 » » » nStyle = PCS_CROSS; | 1401 nStyle = PCS_CROSS; |
1408 » » » break; | 1402 break; |
1409 » » case L'u': | 1403 case L'u': |
1410 » » » nStyle = PCS_DIAMOND; | 1404 nStyle = PCS_DIAMOND; |
1411 » » » break; | 1405 break; |
1412 » » case L'n': | 1406 case L'n': |
1413 » » » nStyle = PCS_SQUARE; | 1407 nStyle = PCS_SQUARE; |
1414 » » » break; | 1408 break; |
1415 » » case L'H': | 1409 case L'H': |
1416 » » » nStyle = PCS_STAR; | 1410 nStyle = PCS_STAR; |
1417 » » » break; | 1411 break; |
1418 » » default: //L'4' | 1412 default: //L'4' |
1419 » » » nStyle = PCS_CHECK; | 1413 nStyle = PCS_CHECK; |
1420 » » » break; | 1414 break; |
1421 » » } | 1415 } |
1422 » } | 1416 } |
1423 » else | 1417 else |
1424 » { | 1418 { |
1425 » » nStyle = PCS_CHECK; | 1419 nStyle = PCS_CHECK; |
1426 » } | 1420 } |
1427 | 1421 |
1428 » CFX_ByteString csAP_N_ON = CPWL_Utils::GetRectFillAppStream(rcWindow,crB
ackground) + | 1422 CFX_ByteString csAP_N_ON = CPWL_Utils::GetRectFillAppStream(rcWindow,crBackg
round) + |
1429 » » CPWL_Utils::GetBorderAppStream(rcWindow,fBorderWidth,crBorder,cr
LeftTop,crRightBottom,nBorderStyle,dsBorder); | 1423 CPWL_Utils::GetBorderAppStream(rcWindow,fBorderWidth,crBorder,crLeftTop,
crRightBottom,nBorderStyle,dsBorder); |
1430 | 1424 |
1431 » CFX_ByteString csAP_N_OFF = csAP_N_ON; | 1425 CFX_ByteString csAP_N_OFF = csAP_N_ON; |
1432 | 1426 |
1433 » switch (nBorderStyle) | 1427 switch (nBorderStyle) |
1434 » { | 1428 { |
1435 » case PBS_BEVELED: | 1429 case PBS_BEVELED: |
1436 » » { | 1430 { |
1437 » » » CPWL_Color crTemp = crLeftTop; | 1431 CPWL_Color crTemp = crLeftTop; |
1438 » » » crLeftTop = crRightBottom; | 1432 crLeftTop = crRightBottom; |
1439 » » » crRightBottom = crTemp; | 1433 crRightBottom = crTemp; |
1440 » » } | 1434 } |
1441 » » break; | 1435 break; |
1442 » case PBS_INSET: | 1436 case PBS_INSET: |
1443 » » crLeftTop = CPWL_Color(COLORTYPE_GRAY,0); | 1437 crLeftTop = CPWL_Color(COLORTYPE_GRAY,0); |
1444 » » crRightBottom = CPWL_Color(COLORTYPE_GRAY,1); | 1438 crRightBottom = CPWL_Color(COLORTYPE_GRAY,1); |
1445 » » break; | 1439 break; |
1446 » } | 1440 } |
1447 | 1441 |
1448 » CFX_ByteString csAP_D_ON = CPWL_Utils::GetRectFillAppStream(rcWindow,CPW
L_Utils::SubstractColor(crBackground,0.25f)) + | 1442 CFX_ByteString csAP_D_ON = CPWL_Utils::GetRectFillAppStream(rcWindow,CPWL_Ut
ils::SubstractColor(crBackground,0.25f)) + |
1449 » » CPWL_Utils::GetBorderAppStream(rcWindow,fBorderWidth,crBorder,cr
LeftTop,crRightBottom,nBorderStyle,dsBorder); | 1443 CPWL_Utils::GetBorderAppStream(rcWindow,fBorderWidth,crBorder,crLeftTop,
crRightBottom,nBorderStyle,dsBorder); |
1450 | 1444 |
1451 » CFX_ByteString csAP_D_OFF = csAP_D_ON; | 1445 CFX_ByteString csAP_D_OFF = csAP_D_ON; |
1452 | 1446 |
1453 » csAP_N_ON += CPWL_Utils::GetCheckBoxAppStream(rcClient,nStyle,crText); | 1447 csAP_N_ON += CPWL_Utils::GetCheckBoxAppStream(rcClient,nStyle,crText); |
1454 » csAP_D_ON += CPWL_Utils::GetCheckBoxAppStream(rcClient,nStyle,crText); | 1448 csAP_D_ON += CPWL_Utils::GetCheckBoxAppStream(rcClient,nStyle,crText); |
1455 | 1449 |
1456 » WriteAppearance("N", GetRotatedRect(), GetMatrix(), csAP_N_ON, pControl-
>GetCheckedAPState()); | 1450 WriteAppearance("N", GetRotatedRect(), GetMatrix(), csAP_N_ON, pControl->Get
CheckedAPState()); |
1457 » WriteAppearance("N", GetRotatedRect(), GetMatrix(), csAP_N_OFF, "Off"); | 1451 WriteAppearance("N", GetRotatedRect(), GetMatrix(), csAP_N_OFF, "Off"); |
1458 | 1452 |
1459 » WriteAppearance("D", GetRotatedRect(), GetMatrix(), csAP_D_ON, pControl-
>GetCheckedAPState()); | 1453 WriteAppearance("D", GetRotatedRect(), GetMatrix(), csAP_D_ON, pControl->Get
CheckedAPState()); |
1460 » WriteAppearance("D", GetRotatedRect(), GetMatrix(), csAP_D_OFF, "Off"); | 1454 WriteAppearance("D", GetRotatedRect(), GetMatrix(), csAP_D_OFF, "Off"); |
1461 | 1455 |
1462 » CFX_ByteString csAS = GetAppState(); | 1456 CFX_ByteString csAS = GetAppState(); |
1463 » if (csAS.IsEmpty()) | 1457 if (csAS.IsEmpty()) |
1464 » » SetAppState("Off"); | 1458 SetAppState("Off"); |
1465 } | 1459 } |
1466 | 1460 |
1467 void CPDFSDK_Widget::ResetAppearance_RadioButton() | 1461 void CPDFSDK_Widget::ResetAppearance_RadioButton() |
1468 { | 1462 { |
1469 » CPDF_FormControl* pControl = GetFormControl(); | 1463 CPDF_FormControl* pControl = GetFormControl(); |
1470 » ASSERT(pControl != NULL); | 1464 ASSERT(pControl != NULL); |
1471 | 1465 |
1472 | 1466 |
1473 | 1467 |
1474 » CPWL_Color crBackground, crBorder, crText; | 1468 CPWL_Color crBackground, crBorder, crText; |
1475 | 1469 |
1476 » int iColorType; | 1470 int iColorType; |
1477 » FX_FLOAT fc[4]; | 1471 FX_FLOAT fc[4]; |
1478 | 1472 |
1479 » pControl->GetOriginalBackgroundColor(iColorType, fc); | 1473 pControl->GetOriginalBackgroundColor(iColorType, fc); |
1480 » if (iColorType > 0) | 1474 if (iColorType > 0) |
1481 » » crBackground = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]
); | 1475 crBackground = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); |
1482 | 1476 |
1483 » pControl->GetOriginalBorderColor(iColorType, fc); | 1477 pControl->GetOriginalBorderColor(iColorType, fc); |
1484 » if (iColorType > 0) | 1478 if (iColorType > 0) |
1485 » » crBorder = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); | 1479 crBorder = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); |
1486 | 1480 |
1487 » FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); | 1481 FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); |
1488 » int32_t nBorderStyle = 0; | 1482 int32_t nBorderStyle = 0; |
1489 » CPWL_Dash dsBorder(3,0,0); | 1483 CPWL_Dash dsBorder(3,0,0); |
1490 » CPWL_Color crLeftTop,crRightBottom; | 1484 CPWL_Color crLeftTop,crRightBottom; |
1491 | 1485 |
1492 » switch (GetBorderStyle()) | 1486 switch (GetBorderStyle()) |
1493 » { | 1487 { |
1494 » case BBS_DASH: | 1488 case BBS_DASH: |
1495 » » nBorderStyle = PBS_DASH; | 1489 nBorderStyle = PBS_DASH; |
1496 » » dsBorder = CPWL_Dash(3, 3, 0); | 1490 dsBorder = CPWL_Dash(3, 3, 0); |
1497 » » break; | 1491 break; |
1498 » case BBS_BEVELED: | 1492 case BBS_BEVELED: |
1499 » » nBorderStyle = PBS_BEVELED; | 1493 nBorderStyle = PBS_BEVELED; |
1500 » » fBorderWidth *= 2; | 1494 fBorderWidth *= 2; |
1501 » » crLeftTop = CPWL_Color(COLORTYPE_GRAY,1); | 1495 crLeftTop = CPWL_Color(COLORTYPE_GRAY,1); |
1502 » » crRightBottom = CPWL_Utils::DevideColor(crBackground,2); | 1496 crRightBottom = CPWL_Utils::DevideColor(crBackground,2); |
1503 » » break; | 1497 break; |
1504 » case BBS_INSET: | 1498 case BBS_INSET: |
1505 » » nBorderStyle = PBS_INSET; | 1499 nBorderStyle = PBS_INSET; |
1506 » » fBorderWidth *= 2; | 1500 fBorderWidth *= 2; |
1507 » » crLeftTop = CPWL_Color(COLORTYPE_GRAY,0.5); | 1501 crLeftTop = CPWL_Color(COLORTYPE_GRAY,0.5); |
1508 » » crRightBottom = CPWL_Color(COLORTYPE_GRAY,0.75); | 1502 crRightBottom = CPWL_Color(COLORTYPE_GRAY,0.75); |
1509 » » break; | 1503 break; |
1510 » case BBS_UNDERLINE: | 1504 case BBS_UNDERLINE: |
1511 » » nBorderStyle = PBS_UNDERLINED; | 1505 nBorderStyle = PBS_UNDERLINED; |
1512 » » break; | 1506 break; |
1513 » default: | 1507 default: |
1514 » » nBorderStyle = PBS_SOLID; | 1508 nBorderStyle = PBS_SOLID; |
1515 » » break; | 1509 break; |
1516 » } | 1510 } |
1517 | 1511 |
1518 » CPDF_Rect rcWindow = GetRotatedRect(); | 1512 CPDF_Rect rcWindow = GetRotatedRect(); |
1519 » CPDF_Rect rcClient = CPWL_Utils::DeflateRect(rcWindow, fBorderWidth); | 1513 CPDF_Rect rcClient = CPWL_Utils::DeflateRect(rcWindow, fBorderWidth); |
1520 | 1514 |
1521 » CPDF_DefaultAppearance da = pControl->GetDefaultAppearance(); | 1515 CPDF_DefaultAppearance da = pControl->GetDefaultAppearance(); |
1522 » if (da.HasColor()) | 1516 if (da.HasColor()) |
1523 » { | 1517 { |
1524 » » da.GetColor(iColorType, fc); | 1518 da.GetColor(iColorType, fc); |
1525 » » crText = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); | 1519 crText = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); |
1526 » } | 1520 } |
1527 | 1521 |
1528 » int32_t nStyle = 0; | 1522 int32_t nStyle = 0; |
1529 | 1523 |
1530 » CFX_WideString csWCaption = pControl->GetNormalCaption(); | 1524 CFX_WideString csWCaption = pControl->GetNormalCaption(); |
1531 » if (csWCaption.GetLength() > 0) | 1525 if (csWCaption.GetLength() > 0) |
1532 » { | 1526 { |
1533 » » switch (csWCaption[0]) | 1527 switch (csWCaption[0]) |
1534 » » { | 1528 { |
1535 » » default: //L'l': | 1529 default: //L'l': |
1536 » » » nStyle = PCS_CIRCLE; | 1530 nStyle = PCS_CIRCLE; |
1537 » » » break; | 1531 break; |
1538 » » case L'8': | 1532 case L'8': |
1539 » » » nStyle = PCS_CROSS; | 1533 nStyle = PCS_CROSS; |
1540 » » » break; | 1534 break; |
1541 » » case L'u': | 1535 case L'u': |
1542 » » » nStyle = PCS_DIAMOND; | 1536 nStyle = PCS_DIAMOND; |
1543 » » » break; | 1537 break; |
1544 » » case L'n': | 1538 case L'n': |
1545 » » » nStyle = PCS_SQUARE; | 1539 nStyle = PCS_SQUARE; |
1546 » » » break; | 1540 break; |
1547 » » case L'H': | 1541 case L'H': |
1548 » » » nStyle = PCS_STAR; | 1542 nStyle = PCS_STAR; |
1549 » » » break; | 1543 break; |
1550 » » case L'4': | 1544 case L'4': |
1551 » » » nStyle = PCS_CHECK; | 1545 nStyle = PCS_CHECK; |
1552 » » » break; | 1546 break; |
1553 » » } | 1547 } |
1554 » } | 1548 } |
1555 » else | 1549 else |
1556 » { | 1550 { |
1557 » » nStyle = PCS_CIRCLE; | 1551 nStyle = PCS_CIRCLE; |
1558 » } | 1552 } |
1559 | 1553 |
1560 » CFX_ByteString csAP_N_ON; | 1554 CFX_ByteString csAP_N_ON; |
1561 | 1555 |
1562 » CPDF_Rect rcCenter = CPWL_Utils::DeflateRect(CPWL_Utils::GetCenterSquare
(rcWindow), 1.0f); | 1556 CPDF_Rect rcCenter = CPWL_Utils::DeflateRect(CPWL_Utils::GetCenterSquare(rcW
indow), 1.0f); |
1563 | 1557 |
1564 » if (nStyle == PCS_CIRCLE) | 1558 if (nStyle == PCS_CIRCLE) |
1565 » { | 1559 { |
1566 » » if (nBorderStyle == PBS_BEVELED) | 1560 if (nBorderStyle == PBS_BEVELED) |
1567 » » { | 1561 { |
1568 » » » crLeftTop = CPWL_Color(COLORTYPE_GRAY, 1); | 1562 crLeftTop = CPWL_Color(COLORTYPE_GRAY, 1); |
1569 » » » crRightBottom = CPWL_Utils::SubstractColor(crBackground,
0.25f); | 1563 crRightBottom = CPWL_Utils::SubstractColor(crBackground,0.25f); |
1570 » » } | 1564 } |
1571 » » else if (nBorderStyle == PBS_INSET) | 1565 else if (nBorderStyle == PBS_INSET) |
1572 » » { | 1566 { |
1573 » » » crLeftTop = CPWL_Color(COLORTYPE_GRAY,0.5f); | 1567 crLeftTop = CPWL_Color(COLORTYPE_GRAY,0.5f); |
1574 » » » crRightBottom = CPWL_Color(COLORTYPE_GRAY,0.75f); | 1568 crRightBottom = CPWL_Color(COLORTYPE_GRAY,0.75f); |
1575 » » } | 1569 } |
1576 | 1570 |
1577 » » csAP_N_ON = CPWL_Utils::GetCircleFillAppStream(rcCenter,crBackgr
ound) + | 1571 csAP_N_ON = CPWL_Utils::GetCircleFillAppStream(rcCenter,crBackground) + |
1578 » » » CPWL_Utils::GetCircleBorderAppStream(rcCenter,fBorderWid
th,crBorder,crLeftTop,crRightBottom,nBorderStyle,dsBorder); | 1572 CPWL_Utils::GetCircleBorderAppStream(rcCenter,fBorderWidth,crBorder,
crLeftTop,crRightBottom,nBorderStyle,dsBorder); |
1579 » } | 1573 } |
1580 » else | 1574 else |
1581 » { | 1575 { |
1582 » » csAP_N_ON = CPWL_Utils::GetRectFillAppStream(rcWindow,crBackgrou
nd) + | 1576 csAP_N_ON = CPWL_Utils::GetRectFillAppStream(rcWindow,crBackground) + |
1583 » » » CPWL_Utils::GetBorderAppStream(rcWindow,fBorderWidth,crB
order,crLeftTop,crRightBottom,nBorderStyle,dsBorder); | 1577 CPWL_Utils::GetBorderAppStream(rcWindow,fBorderWidth,crBorder,crLeft
Top,crRightBottom,nBorderStyle,dsBorder); |
1584 » } | 1578 } |
1585 | 1579 |
1586 » CFX_ByteString csAP_N_OFF = csAP_N_ON; | 1580 CFX_ByteString csAP_N_OFF = csAP_N_ON; |
1587 | 1581 |
1588 » switch (nBorderStyle) | 1582 switch (nBorderStyle) |
1589 » { | 1583 { |
1590 » case PBS_BEVELED: | 1584 case PBS_BEVELED: |
1591 » » { | 1585 { |
1592 » » » CPWL_Color crTemp = crLeftTop; | 1586 CPWL_Color crTemp = crLeftTop; |
1593 » » » crLeftTop = crRightBottom; | 1587 crLeftTop = crRightBottom; |
1594 » » » crRightBottom = crTemp; | 1588 crRightBottom = crTemp; |
1595 » » } | 1589 } |
1596 » » break; | 1590 break; |
1597 » case PBS_INSET: | 1591 case PBS_INSET: |
1598 » » crLeftTop = CPWL_Color(COLORTYPE_GRAY,0); | 1592 crLeftTop = CPWL_Color(COLORTYPE_GRAY,0); |
1599 » » crRightBottom = CPWL_Color(COLORTYPE_GRAY,1); | 1593 crRightBottom = CPWL_Color(COLORTYPE_GRAY,1); |
1600 » » break; | 1594 break; |
1601 » } | 1595 } |
1602 | 1596 |
1603 » CFX_ByteString csAP_D_ON; | 1597 CFX_ByteString csAP_D_ON; |
1604 | 1598 |
1605 » if (nStyle == PCS_CIRCLE) | 1599 if (nStyle == PCS_CIRCLE) |
1606 » { | 1600 { |
1607 » » CPWL_Color crBK = CPWL_Utils::SubstractColor(crBackground,0.25f)
; | 1601 CPWL_Color crBK = CPWL_Utils::SubstractColor(crBackground,0.25f); |
1608 » » if (nBorderStyle == PBS_BEVELED) | 1602 if (nBorderStyle == PBS_BEVELED) |
1609 » » { | 1603 { |
1610 » » » crLeftTop = CPWL_Utils::SubstractColor(crBackground,0.25
f); | 1604 crLeftTop = CPWL_Utils::SubstractColor(crBackground,0.25f); |
1611 » » » crRightBottom = CPWL_Color(COLORTYPE_GRAY, 1); | 1605 crRightBottom = CPWL_Color(COLORTYPE_GRAY, 1); |
1612 » » » crBK = crBackground; | 1606 crBK = crBackground; |
1613 » » } | 1607 } |
1614 » » else if (nBorderStyle == PBS_INSET) | 1608 else if (nBorderStyle == PBS_INSET) |
1615 » » { | 1609 { |
1616 » » » crLeftTop = CPWL_Color(COLORTYPE_GRAY,0); | 1610 crLeftTop = CPWL_Color(COLORTYPE_GRAY,0); |
1617 » » » crRightBottom = CPWL_Color(COLORTYPE_GRAY,1); | 1611 crRightBottom = CPWL_Color(COLORTYPE_GRAY,1); |
1618 » » } | 1612 } |
1619 | 1613 |
1620 » » csAP_D_ON = CPWL_Utils::GetCircleFillAppStream(rcCenter,crBK) | 1614 csAP_D_ON = CPWL_Utils::GetCircleFillAppStream(rcCenter,crBK) |
1621 » » » + CPWL_Utils::GetCircleBorderAppStream(rcCenter,fBorderW
idth,crBorder,crLeftTop,crRightBottom,nBorderStyle,dsBorder); | 1615 + CPWL_Utils::GetCircleBorderAppStream(rcCenter,fBorderWidth,crBorde
r,crLeftTop,crRightBottom,nBorderStyle,dsBorder); |
1622 » } | 1616 } |
1623 » else | 1617 else |
1624 » { | 1618 { |
1625 » » csAP_D_ON = CPWL_Utils::GetRectFillAppStream(rcWindow,CPWL_Utils
::SubstractColor(crBackground,0.25f)) + | 1619 csAP_D_ON = CPWL_Utils::GetRectFillAppStream(rcWindow,CPWL_Utils::Substr
actColor(crBackground,0.25f)) + |
1626 » » » CPWL_Utils::GetBorderAppStream(rcWindow,fBorderWidth,crB
order,crLeftTop,crRightBottom,nBorderStyle,dsBorder); | 1620 CPWL_Utils::GetBorderAppStream(rcWindow,fBorderWidth,crBorder,crLeft
Top,crRightBottom,nBorderStyle,dsBorder); |
1627 » } | 1621 } |
1628 | 1622 |
1629 » CFX_ByteString csAP_D_OFF = csAP_D_ON; | 1623 CFX_ByteString csAP_D_OFF = csAP_D_ON; |
1630 | 1624 |
1631 » csAP_N_ON += CPWL_Utils::GetRadioButtonAppStream(rcClient,nStyle,crText)
; | 1625 csAP_N_ON += CPWL_Utils::GetRadioButtonAppStream(rcClient,nStyle,crText); |
1632 » csAP_D_ON += CPWL_Utils::GetRadioButtonAppStream(rcClient,nStyle,crText)
; | 1626 csAP_D_ON += CPWL_Utils::GetRadioButtonAppStream(rcClient,nStyle,crText); |
1633 | 1627 |
1634 » WriteAppearance("N", GetRotatedRect(), GetMatrix(), csAP_N_ON, pControl-
>GetCheckedAPState()); | 1628 WriteAppearance("N", GetRotatedRect(), GetMatrix(), csAP_N_ON, pControl->Get
CheckedAPState()); |
1635 » WriteAppearance("N", GetRotatedRect(), GetMatrix(), csAP_N_OFF, "Off"); | 1629 WriteAppearance("N", GetRotatedRect(), GetMatrix(), csAP_N_OFF, "Off"); |
1636 | 1630 |
1637 » WriteAppearance("D", GetRotatedRect(), GetMatrix(), csAP_D_ON, pControl-
>GetCheckedAPState()); | 1631 WriteAppearance("D", GetRotatedRect(), GetMatrix(), csAP_D_ON, pControl->Get
CheckedAPState()); |
1638 » WriteAppearance("D", GetRotatedRect(), GetMatrix(), csAP_D_OFF, "Off"); | 1632 WriteAppearance("D", GetRotatedRect(), GetMatrix(), csAP_D_OFF, "Off"); |
1639 | 1633 |
1640 » CFX_ByteString csAS = GetAppState(); | 1634 CFX_ByteString csAS = GetAppState(); |
1641 » if (csAS.IsEmpty()) | 1635 if (csAS.IsEmpty()) |
1642 » » SetAppState("Off"); | 1636 SetAppState("Off"); |
1643 } | 1637 } |
1644 | 1638 |
1645 void CPDFSDK_Widget::ResetAppearance_ComboBox(const FX_WCHAR* sValue) | 1639 void CPDFSDK_Widget::ResetAppearance_ComboBox(const FX_WCHAR* sValue) |
1646 { | 1640 { |
1647 » CPDF_FormControl* pControl = GetFormControl(); | 1641 CPDF_FormControl* pControl = GetFormControl(); |
1648 » ASSERT(pControl != NULL); | 1642 ASSERT(pControl != NULL); |
1649 » CPDF_FormField* pField = pControl->GetField(); | 1643 CPDF_FormField* pField = pControl->GetField(); |
1650 » ASSERT(pField != NULL); | 1644 ASSERT(pField != NULL); |
1651 | 1645 |
1652 » CFX_ByteTextBuf sBody, sLines; | 1646 CFX_ByteTextBuf sBody, sLines; |
1653 | 1647 |
1654 » CPDF_Rect rcClient = GetClientRect(); | 1648 CPDF_Rect rcClient = GetClientRect(); |
1655 » CPDF_Rect rcButton = rcClient; | 1649 CPDF_Rect rcButton = rcClient; |
1656 » rcButton.left = rcButton.right - 13; | 1650 rcButton.left = rcButton.right - 13; |
1657 » rcButton.Normalize(); | 1651 rcButton.Normalize(); |
1658 | 1652 |
1659 » if (IFX_Edit * pEdit = IFX_Edit::NewEdit()) | 1653 if (IFX_Edit * pEdit = IFX_Edit::NewEdit()) |
1660 » { | 1654 { |
1661 » » pEdit->EnableRefresh(FALSE); | 1655 pEdit->EnableRefresh(FALSE); |
1662 | 1656 |
1663 » » CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); | 1657 CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); |
1664 » » ASSERT(pDoc != NULL); | 1658 ASSERT(pDoc != NULL); |
1665 » » CPDFDoc_Environment* pEnv = pDoc->GetEnv(); | 1659 CPDFDoc_Environment* pEnv = pDoc->GetEnv(); |
1666 » » CBA_FontMap FontMap(this,pEnv->GetSysHandler()); | 1660 CBA_FontMap FontMap(this,pEnv->GetSysHandler()); |
1667 » » FontMap.Initial(); | 1661 FontMap.Initial(); |
1668 » » pEdit->SetFontMap(&FontMap); | 1662 pEdit->SetFontMap(&FontMap); |
1669 | 1663 |
1670 » » CPDF_Rect rcEdit = rcClient; | 1664 CPDF_Rect rcEdit = rcClient; |
1671 » » rcEdit.right = rcButton.left; | 1665 rcEdit.right = rcButton.left; |
1672 » » rcEdit.Normalize(); | 1666 rcEdit.Normalize(); |
1673 | 1667 |
1674 » » pEdit->SetPlateRect(rcEdit); | 1668 pEdit->SetPlateRect(rcEdit); |
1675 » » pEdit->SetAlignmentV(1); | 1669 pEdit->SetAlignmentV(1); |
1676 | 1670 |
1677 » » FX_FLOAT fFontSize = GetFontSize(); | 1671 FX_FLOAT fFontSize = GetFontSize(); |
1678 » » if (IsFloatZero(fFontSize)) | 1672 if (IsFloatZero(fFontSize)) |
1679 » » » pEdit->SetAutoFontSize(TRUE); | 1673 pEdit->SetAutoFontSize(TRUE); |
1680 » » else | 1674 else |
1681 » » » pEdit->SetFontSize(fFontSize); | 1675 pEdit->SetFontSize(fFontSize); |
1682 | 1676 |
1683 » » pEdit->Initialize(); | 1677 pEdit->Initialize(); |
1684 | 1678 |
1685 » » if (sValue) | 1679 if (sValue) |
1686 » » » pEdit->SetText(sValue); | 1680 pEdit->SetText(sValue); |
1687 » » else | 1681 else |
1688 » » { | 1682 { |
1689 » » » int32_t nCurSel = pField->GetSelectedIndex(0); | 1683 int32_t nCurSel = pField->GetSelectedIndex(0); |
1690 | 1684 |
1691 » » » if (nCurSel < 0) | 1685 if (nCurSel < 0) |
1692 » » » » pEdit->SetText(pField->GetValue().c_str()); | 1686 pEdit->SetText(pField->GetValue().c_str()); |
1693 » » » else | 1687 else |
1694 » » » » pEdit->SetText(pField->GetOptionLabel(nCurSel).c
_str()); | 1688 pEdit->SetText(pField->GetOptionLabel(nCurSel).c_str()); |
1695 » » } | 1689 } |
1696 | 1690 |
1697 » » CPDF_Rect rcContent = pEdit->GetContentRect(); | 1691 CPDF_Rect rcContent = pEdit->GetContentRect(); |
1698 | 1692 |
1699 » » CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(pEdit,CPDF_P
oint(0.0f,0.0f)); | 1693 CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(pEdit,CPDF_Point(0.0
f,0.0f)); |
1700 » » if (sEdit.GetLength() > 0) | 1694 if (sEdit.GetLength() > 0) |
1701 » » { | 1695 { |
1702 » » » sBody << "/Tx BMC\n" << "q\n"; | 1696 sBody << "/Tx BMC\n" << "q\n"; |
1703 » » » if (rcContent.Width() > rcEdit.Width() || | 1697 if (rcContent.Width() > rcEdit.Width() || |
1704 » » » » rcContent.Height() > rcEdit.Height()) | 1698 rcContent.Height() > rcEdit.Height()) |
1705 » » » { | 1699 { |
1706 » » » » sBody << rcEdit.left << " " << rcEdit.bottom <<
" " | 1700 sBody << rcEdit.left << " " << rcEdit.bottom << " " |
1707 » » » » » << rcEdit.Width() << " " << rcEdit.Heigh
t() << " re\nW\nn\n"; | 1701 << rcEdit.Width() << " " << rcEdit.Height() << " re\nW\nn\n"
; |
1708 » » » } | 1702 } |
1709 | 1703 |
1710 » » » CPWL_Color crText = GetTextPWLColor(); | 1704 CPWL_Color crText = GetTextPWLColor(); |
1711 » » » sBody << "BT\n" << CPWL_Utils::GetColorAppStream(crText)
<< sEdit << "ET\n" << "Q\nEMC\n"; | 1705 sBody << "BT\n" << CPWL_Utils::GetColorAppStream(crText) << sEdit <<
"ET\n" << "Q\nEMC\n"; |
1712 » » } | 1706 } |
1713 | 1707 |
1714 » » IFX_Edit::DelEdit(pEdit); | 1708 IFX_Edit::DelEdit(pEdit); |
1715 » } | 1709 } |
1716 | 1710 |
1717 » sBody << CPWL_Utils::GetDropButtonAppStream(rcButton); | 1711 sBody << CPWL_Utils::GetDropButtonAppStream(rcButton); |
1718 | 1712 |
1719 » CFX_ByteString sAP = GetBackgroundAppStream() + GetBorderAppStream() + s
Lines.GetByteString() + sBody.GetByteString(); | 1713 CFX_ByteString sAP = GetBackgroundAppStream() + GetBorderAppStream() + sLine
s.GetByteString() + sBody.GetByteString(); |
1720 | 1714 |
1721 » WriteAppearance("N", GetRotatedRect(), GetMatrix(), sAP); | 1715 WriteAppearance("N", GetRotatedRect(), GetMatrix(), sAP); |
1722 } | 1716 } |
1723 | 1717 |
1724 void CPDFSDK_Widget::ResetAppearance_ListBox() | 1718 void CPDFSDK_Widget::ResetAppearance_ListBox() |
1725 { | 1719 { |
1726 » CPDF_FormControl* pControl = GetFormControl(); | 1720 CPDF_FormControl* pControl = GetFormControl(); |
1727 » ASSERT(pControl != NULL); | 1721 ASSERT(pControl != NULL); |
1728 » CPDF_FormField* pField = pControl->GetField(); | 1722 CPDF_FormField* pField = pControl->GetField(); |
1729 » ASSERT(pField != NULL); | 1723 ASSERT(pField != NULL); |
1730 | 1724 |
1731 » CPDF_Rect rcClient = GetClientRect(); | 1725 CPDF_Rect rcClient = GetClientRect(); |
1732 | 1726 |
1733 » CFX_ByteTextBuf sBody, sLines; | 1727 CFX_ByteTextBuf sBody, sLines; |
1734 | 1728 |
1735 » if (IFX_Edit * pEdit = IFX_Edit::NewEdit()) | 1729 if (IFX_Edit * pEdit = IFX_Edit::NewEdit()) |
1736 » { | 1730 { |
1737 » » pEdit->EnableRefresh(FALSE); | 1731 pEdit->EnableRefresh(FALSE); |
1738 | 1732 |
1739 » » CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); | 1733 CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); |
1740 » » ASSERT(pDoc != NULL); | 1734 ASSERT(pDoc != NULL); |
1741 » » CPDFDoc_Environment* pEnv = pDoc->GetEnv(); | 1735 CPDFDoc_Environment* pEnv = pDoc->GetEnv(); |
1742 | 1736 |
1743 » » CBA_FontMap FontMap(this,pEnv->GetSysHandler()); | 1737 CBA_FontMap FontMap(this,pEnv->GetSysHandler()); |
1744 » » FontMap.Initial(); | 1738 FontMap.Initial(); |
1745 » » pEdit->SetFontMap(&FontMap); | 1739 pEdit->SetFontMap(&FontMap); |
1746 | 1740 |
1747 » » pEdit->SetPlateRect(CPDF_Rect(rcClient.left,0.0f,rcClient.right,
0.0f)); | 1741 pEdit->SetPlateRect(CPDF_Rect(rcClient.left,0.0f,rcClient.right,0.0f)); |
1748 | 1742 |
1749 » » FX_FLOAT fFontSize = GetFontSize(); | 1743 FX_FLOAT fFontSize = GetFontSize(); |
1750 | 1744 |
1751 » » if (IsFloatZero(fFontSize)) | 1745 if (IsFloatZero(fFontSize)) |
1752 » » » pEdit->SetFontSize(12.0f); | 1746 pEdit->SetFontSize(12.0f); |
1753 » » else | 1747 else |
1754 » » » pEdit->SetFontSize(fFontSize); | 1748 pEdit->SetFontSize(fFontSize); |
1755 | 1749 |
1756 » » pEdit->Initialize(); | 1750 pEdit->Initialize(); |
1757 | 1751 |
1758 » » CFX_ByteTextBuf sList; | 1752 CFX_ByteTextBuf sList; |
1759 » » FX_FLOAT fy = rcClient.top; | 1753 FX_FLOAT fy = rcClient.top; |
1760 | 1754 |
1761 » » int32_t nTop = pField->GetTopVisibleIndex(); | 1755 int32_t nTop = pField->GetTopVisibleIndex(); |
1762 » » int32_t nCount = pField->CountOptions(); | 1756 int32_t nCount = pField->CountOptions(); |
1763 » » int32_t nSelCount = pField->CountSelectedItems(); | 1757 int32_t nSelCount = pField->CountSelectedItems(); |
1764 | 1758 |
1765 » » for (int32_t i=nTop; i<nCount; i++) | 1759 for (int32_t i=nTop; i<nCount; i++) |
1766 » » { | 1760 { |
1767 » » » FX_BOOL bSelected = FALSE; | 1761 FX_BOOL bSelected = FALSE; |
1768 » » » for (int32_t j=0; j<nSelCount; j++) | 1762 for (int32_t j=0; j<nSelCount; j++) |
1769 » » » { | 1763 { |
1770 » » » » if (pField->GetSelectedIndex(j) == i) | 1764 if (pField->GetSelectedIndex(j) == i) |
1771 » » » » { | 1765 { |
1772 » » » » » bSelected = TRUE; | 1766 bSelected = TRUE; |
1773 » » » » » break; | 1767 break; |
1774 » » » » } | 1768 } |
1775 » » » } | 1769 } |
1776 | 1770 |
1777 » » » pEdit->SetText(pField->GetOptionLabel(i).c_str()); | 1771 pEdit->SetText(pField->GetOptionLabel(i).c_str()); |
1778 | 1772 |
1779 » » » CPDF_Rect rcContent = pEdit->GetContentRect(); | 1773 CPDF_Rect rcContent = pEdit->GetContentRect(); |
1780 » » » FX_FLOAT fItemHeight = rcContent.Height(); | 1774 FX_FLOAT fItemHeight = rcContent.Height(); |
1781 | 1775 |
1782 » » » if (bSelected) | 1776 if (bSelected) |
1783 » » » { | 1777 { |
1784 » » » » CPDF_Rect rcItem = CPDF_Rect(rcClient.left,fy-fI
temHeight,rcClient.right,fy); | 1778 CPDF_Rect rcItem = CPDF_Rect(rcClient.left,fy-fItemHeight,rcClie
nt.right,fy); |
1785 » » » » sList << "q\n" << CPWL_Utils::GetColorAppStream(
CPWL_Color(COLORTYPE_RGB,0,51.0f/255.0f,113.0f/255.0f),TRUE) | 1779 sList << "q\n" << CPWL_Utils::GetColorAppStream(CPWL_Color(COLOR
TYPE_RGB,0,51.0f/255.0f,113.0f/255.0f),TRUE) |
1786 » » » » » << rcItem.left << " " << rcItem.bottom <
< " " << rcItem.Width() << " " << rcItem.Height() << " re f\n" << "Q\n"; | 1780 << rcItem.left << " " << rcItem.bottom << " " << rcItem.Widt
h() << " " << rcItem.Height() << " re f\n" << "Q\n"; |
1787 | 1781 |
1788 » » » » sList << "BT\n" << CPWL_Utils::GetColorAppStream
(CPWL_Color(COLORTYPE_GRAY,1),TRUE) << | 1782 sList << "BT\n" << CPWL_Utils::GetColorAppStream(CPWL_Color(COLO
RTYPE_GRAY,1),TRUE) << |
1789 » » » » » CPWL_Utils::GetEditAppStream(pEdit,CPDF_
Point(0.0f,fy)) << "ET\n"; | 1783 CPWL_Utils::GetEditAppStream(pEdit,CPDF_Point(0.0f,fy)) << "
ET\n"; |
1790 » » » } | 1784 } |
1791 » » » else | 1785 else |
1792 » » » { | 1786 { |
1793 » » » » CPWL_Color crText = GetTextPWLColor(); | 1787 CPWL_Color crText = GetTextPWLColor(); |
1794 » » » » sList << "BT\n" << CPWL_Utils::GetColorAppStream
(crText,TRUE) << | 1788 sList << "BT\n" << CPWL_Utils::GetColorAppStream(crText,TRUE) << |
1795 » » » » CPWL_Utils::GetEditAppStream(pEdit,CPDF_Point(0.
0f,fy)) << "ET\n"; | 1789 CPWL_Utils::GetEditAppStream(pEdit,CPDF_Point(0.0f,fy)) << "ET\n
"; |
1796 » » » } | 1790 } |
1797 | 1791 |
1798 » » » fy -= fItemHeight; | 1792 fy -= fItemHeight; |
1799 » » } | 1793 } |
1800 | 1794 |
1801 » » if (sList.GetSize() > 0) | 1795 if (sList.GetSize() > 0) |
1802 » » { | 1796 { |
1803 » » » sBody << "/Tx BMC\n" << "q\n" << rcClient.left << " " <<
rcClient.bottom << " " | 1797 sBody << "/Tx BMC\n" << "q\n" << rcClient.left << " " << rcClient.bo
ttom << " " |
1804 » » » » » << rcClient.Width() << " " << rcClient.H
eight() << " re\nW\nn\n"; | 1798 << rcClient.Width() << " " << rcClient.Height() << " re\nW\n
n\n"; |
1805 » » » sBody << sList << "Q\nEMC\n"; | 1799 sBody << sList << "Q\nEMC\n"; |
1806 » » } | 1800 } |
1807 | 1801 |
1808 » » IFX_Edit::DelEdit(pEdit); | 1802 IFX_Edit::DelEdit(pEdit); |
1809 » } | 1803 } |
1810 | 1804 |
1811 » CFX_ByteString sAP = GetBackgroundAppStream() + GetBorderAppStream() + s
Lines.GetByteString() + sBody.GetByteString(); | 1805 CFX_ByteString sAP = GetBackgroundAppStream() + GetBorderAppStream() + sLine
s.GetByteString() + sBody.GetByteString(); |
1812 | 1806 |
1813 » WriteAppearance("N", GetRotatedRect(), GetMatrix(), sAP); | 1807 WriteAppearance("N", GetRotatedRect(), GetMatrix(), sAP); |
1814 } | 1808 } |
1815 | 1809 |
1816 void CPDFSDK_Widget::ResetAppearance_TextField(const FX_WCHAR* sValue) | 1810 void CPDFSDK_Widget::ResetAppearance_TextField(const FX_WCHAR* sValue) |
1817 { | 1811 { |
1818 CPDF_FormControl* pControl = GetFormControl(); | 1812 CPDF_FormControl* pControl = GetFormControl(); |
1819 ASSERT(pControl != NULL); | 1813 ASSERT(pControl != NULL); |
1820 CPDF_FormField* pField = pControl->GetField(); | 1814 CPDF_FormField* pField = pControl->GetField(); |
1821 ASSERT(pField != NULL); | 1815 ASSERT(pField != NULL); |
1822 | 1816 |
1823 CFX_ByteTextBuf sBody, sLines; | 1817 CFX_ByteTextBuf sBody, sLines; |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1972 | 1966 |
1973 IFX_Edit::DelEdit(pEdit); | 1967 IFX_Edit::DelEdit(pEdit); |
1974 } | 1968 } |
1975 | 1969 |
1976 CFX_ByteString sAP = GetBackgroundAppStream() + GetBorderAppStream() + s
Lines.GetByteString() + sBody.GetByteString(); | 1970 CFX_ByteString sAP = GetBackgroundAppStream() + GetBorderAppStream() + s
Lines.GetByteString() + sBody.GetByteString(); |
1977 WriteAppearance("N", GetRotatedRect(), GetMatrix(), sAP); | 1971 WriteAppearance("N", GetRotatedRect(), GetMatrix(), sAP); |
1978 } | 1972 } |
1979 | 1973 |
1980 CPDF_Rect CPDFSDK_Widget::GetClientRect() const | 1974 CPDF_Rect CPDFSDK_Widget::GetClientRect() const |
1981 { | 1975 { |
1982 » CPDF_Rect rcWindow = GetRotatedRect(); | 1976 CPDF_Rect rcWindow = GetRotatedRect(); |
1983 » FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); | 1977 FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); |
1984 » switch (GetBorderStyle()) | 1978 switch (GetBorderStyle()) |
1985 » { | 1979 { |
1986 » case BBS_BEVELED: | 1980 case BBS_BEVELED: |
1987 » case BBS_INSET: | 1981 case BBS_INSET: |
1988 » » fBorderWidth *= 2.0f; | 1982 fBorderWidth *= 2.0f; |
1989 » » break; | 1983 break; |
1990 » } | 1984 } |
1991 | 1985 |
1992 » return CPWL_Utils::DeflateRect(rcWindow, fBorderWidth); | 1986 return CPWL_Utils::DeflateRect(rcWindow, fBorderWidth); |
1993 } | 1987 } |
1994 | 1988 |
1995 CPDF_Rect CPDFSDK_Widget::GetRotatedRect() const | 1989 CPDF_Rect CPDFSDK_Widget::GetRotatedRect() const |
1996 { | 1990 { |
1997 » CPDF_Rect rectAnnot = GetRect(); | 1991 CPDF_Rect rectAnnot = GetRect(); |
1998 » FX_FLOAT fWidth = rectAnnot.right - rectAnnot.left; | 1992 FX_FLOAT fWidth = rectAnnot.right - rectAnnot.left; |
1999 » FX_FLOAT fHeight = rectAnnot.top - rectAnnot.bottom; | 1993 FX_FLOAT fHeight = rectAnnot.top - rectAnnot.bottom; |
2000 | 1994 |
2001 » CPDF_FormControl* pControl = GetFormControl(); | 1995 CPDF_FormControl* pControl = GetFormControl(); |
2002 » ASSERT(pControl != NULL); | 1996 CPDF_Rect rcPDFWindow; |
2003 | 1997 switch(abs(pControl->GetRotation() % 360)) |
2004 » CPDF_Rect rcPDFWindow; | 1998 { |
2005 » switch(abs(pControl->GetRotation() % 360)) | 1999 case 0: |
2006 » { | 2000 case 180: |
2007 » » case 0: | 2001 default: |
2008 » » case 180: | 2002 rcPDFWindow = CPDF_Rect(0, 0, fWidth, fHeight); |
2009 » » default: | 2003 break; |
2010 » » » rcPDFWindow = CPDF_Rect(0, 0, fWidth, fHeight); | 2004 case 90: |
2011 » » » break; | 2005 case 270: |
2012 » » case 90: | 2006 rcPDFWindow = CPDF_Rect(0, 0, fHeight, fWidth); |
2013 » » case 270: | 2007 break; |
2014 » » » rcPDFWindow = CPDF_Rect(0, 0, fHeight, fWidth); | 2008 } |
2015 » » » break; | 2009 |
2016 » } | 2010 return rcPDFWindow; |
2017 | |
2018 » return rcPDFWindow; | |
2019 } | 2011 } |
2020 | 2012 |
2021 CFX_ByteString CPDFSDK_Widget::GetBackgroundAppStream() const | 2013 CFX_ByteString CPDFSDK_Widget::GetBackgroundAppStream() const |
2022 { | 2014 { |
2023 » CPWL_Color crBackground = GetFillPWLColor(); | 2015 CPWL_Color crBackground = GetFillPWLColor(); |
2024 » if (crBackground.nColorType != COLORTYPE_TRANSPARENT) | 2016 if (crBackground.nColorType != COLORTYPE_TRANSPARENT) { |
2025 » » return CPWL_Utils::GetRectFillAppStream(GetRotatedRect(), crBack
ground); | 2017 return CPWL_Utils::GetRectFillAppStream(GetRotatedRect(), crBackground); |
2026 » else | 2018 } |
2027 » » return ""; | 2019 return ""; |
2028 } | 2020 } |
2029 | 2021 |
2030 CFX_ByteString CPDFSDK_Widget::GetBorderAppStream() const | 2022 CFX_ByteString CPDFSDK_Widget::GetBorderAppStream() const |
2031 { | 2023 { |
2032 » CPDF_Rect rcWindow = GetRotatedRect(); | 2024 CPDF_Rect rcWindow = GetRotatedRect(); |
2033 » CPWL_Color crBorder = GetBorderPWLColor(); | 2025 CPWL_Color crBorder = GetBorderPWLColor(); |
2034 » CPWL_Color crBackground = GetFillPWLColor(); | 2026 CPWL_Color crBackground = GetFillPWLColor(); |
2035 » CPWL_Color crLeftTop, crRightBottom; | 2027 CPWL_Color crLeftTop, crRightBottom; |
2036 | 2028 |
2037 » FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); | 2029 FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); |
2038 » int32_t nBorderStyle = 0; | 2030 int32_t nBorderStyle = 0; |
2039 » CPWL_Dash dsBorder(3,0,0); | 2031 CPWL_Dash dsBorder(3,0,0); |
2040 | 2032 |
2041 » switch (GetBorderStyle()) | 2033 switch (GetBorderStyle()) |
2042 » { | 2034 { |
2043 » case BBS_DASH: | 2035 case BBS_DASH: |
2044 » » nBorderStyle = PBS_DASH; | 2036 nBorderStyle = PBS_DASH; |
2045 » » dsBorder = CPWL_Dash(3, 3, 0); | 2037 dsBorder = CPWL_Dash(3, 3, 0); |
2046 » » break; | 2038 break; |
2047 » case BBS_BEVELED: | 2039 case BBS_BEVELED: |
2048 » » nBorderStyle = PBS_BEVELED; | 2040 nBorderStyle = PBS_BEVELED; |
2049 » » fBorderWidth *= 2; | 2041 fBorderWidth *= 2; |
2050 » » crLeftTop = CPWL_Color(COLORTYPE_GRAY, 1); | 2042 crLeftTop = CPWL_Color(COLORTYPE_GRAY, 1); |
2051 » » crRightBottom = CPWL_Utils::DevideColor(crBackground, 2); | 2043 crRightBottom = CPWL_Utils::DevideColor(crBackground, 2); |
2052 » » break; | 2044 break; |
2053 » case BBS_INSET: | 2045 case BBS_INSET: |
2054 » » nBorderStyle = PBS_INSET; | 2046 nBorderStyle = PBS_INSET; |
2055 » » fBorderWidth *= 2; | 2047 fBorderWidth *= 2; |
2056 » » crLeftTop = CPWL_Color(COLORTYPE_GRAY, 0.5); | 2048 crLeftTop = CPWL_Color(COLORTYPE_GRAY, 0.5); |
2057 » » crRightBottom = CPWL_Color(COLORTYPE_GRAY, 0.75); | 2049 crRightBottom = CPWL_Color(COLORTYPE_GRAY, 0.75); |
2058 » » break; | 2050 break; |
2059 » case BBS_UNDERLINE: | 2051 case BBS_UNDERLINE: |
2060 » » nBorderStyle = PBS_UNDERLINED; | 2052 nBorderStyle = PBS_UNDERLINED; |
2061 » » break; | 2053 break; |
2062 » default: | 2054 default: |
2063 » » nBorderStyle = PBS_SOLID; | 2055 nBorderStyle = PBS_SOLID; |
2064 » » break; | 2056 break; |
2065 » } | 2057 } |
2066 | 2058 |
2067 » return CPWL_Utils::GetBorderAppStream(rcWindow, fBorderWidth, crBorder,
crLeftTop, | 2059 return CPWL_Utils::GetBorderAppStream(rcWindow, fBorderWidth, crBorder, crLe
ftTop, |
2068 » » crRightBottom, nBorderStyle, dsBorder); | 2060 crRightBottom, nBorderStyle, dsBorder); |
2069 } | 2061 } |
2070 | 2062 |
2071 CPDF_Matrix CPDFSDK_Widget::GetMatrix() const | 2063 CPDF_Matrix CPDFSDK_Widget::GetMatrix() const |
2072 { | 2064 { |
2073 » CPDF_Matrix mt; | 2065 CPDF_Matrix mt; |
2074 » CPDF_FormControl* pControl = GetFormControl(); | 2066 CPDF_FormControl* pControl = GetFormControl(); |
2075 » ASSERT(pControl != NULL); | 2067 ASSERT(pControl != NULL); |
2076 | 2068 |
2077 » CPDF_Rect rcAnnot = GetRect(); | 2069 CPDF_Rect rcAnnot = GetRect(); |
2078 » FX_FLOAT fWidth = rcAnnot.right - rcAnnot.left; | 2070 FX_FLOAT fWidth = rcAnnot.right - rcAnnot.left; |
2079 » FX_FLOAT fHeight = rcAnnot.top - rcAnnot.bottom; | 2071 FX_FLOAT fHeight = rcAnnot.top - rcAnnot.bottom; |
2080 | 2072 |
2081 | 2073 |
2082 | 2074 |
2083 » switch (abs(pControl->GetRotation() % 360)) | 2075 switch (abs(pControl->GetRotation() % 360)) |
2084 » { | 2076 { |
2085 » » case 0: | 2077 case 0: |
2086 » » default: | 2078 default: |
2087 » » » mt = CPDF_Matrix(1, 0, 0, 1, 0, 0); | 2079 mt = CPDF_Matrix(1, 0, 0, 1, 0, 0); |
2088 » » » break; | 2080 break; |
2089 » » case 90: | 2081 case 90: |
2090 » » » mt = CPDF_Matrix(0, 1, -1, 0, fWidth, 0); | 2082 mt = CPDF_Matrix(0, 1, -1, 0, fWidth, 0); |
2091 » » » break; | 2083 break; |
2092 » » case 180: | 2084 case 180: |
2093 » » » mt = CPDF_Matrix(-1, 0, 0, -1, fWidth, fHeight); | 2085 mt = CPDF_Matrix(-1, 0, 0, -1, fWidth, fHeight); |
2094 » » » break; | 2086 break; |
2095 » » case 270: | 2087 case 270: |
2096 » » » mt = CPDF_Matrix(0, -1, 1, 0, 0, fHeight); | 2088 mt = CPDF_Matrix(0, -1, 1, 0, 0, fHeight); |
2097 » » » break; | 2089 break; |
2098 » } | 2090 } |
2099 | 2091 |
2100 » return mt; | 2092 return mt; |
2101 } | 2093 } |
2102 | 2094 |
2103 CPWL_Color CPDFSDK_Widget::GetTextPWLColor() const | 2095 CPWL_Color CPDFSDK_Widget::GetTextPWLColor() const |
2104 { | 2096 { |
2105 » CPWL_Color crText = CPWL_Color(COLORTYPE_GRAY, 0); | 2097 CPWL_Color crText = CPWL_Color(COLORTYPE_GRAY, 0); |
2106 | 2098 |
2107 » CPDF_FormControl* pFormCtrl = GetFormControl(); | 2099 CPDF_FormControl* pFormCtrl = GetFormControl(); |
2108 » ASSERT(pFormCtrl != NULL); | 2100 ASSERT(pFormCtrl != NULL); |
2109 | 2101 |
2110 » CPDF_DefaultAppearance da = pFormCtrl->GetDefaultAppearance(); | 2102 CPDF_DefaultAppearance da = pFormCtrl->GetDefaultAppearance(); |
2111 » if (da.HasColor()) | 2103 if (da.HasColor()) |
2112 » { | 2104 { |
2113 » » int32_t iColorType; | 2105 int32_t iColorType; |
2114 » » FX_FLOAT fc[4]; | 2106 FX_FLOAT fc[4]; |
2115 » » da.GetColor(iColorType, fc); | 2107 da.GetColor(iColorType, fc); |
2116 » » crText = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); | 2108 crText = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); |
2117 » } | 2109 } |
2118 | 2110 |
2119 » return crText; | 2111 return crText; |
2120 } | 2112 } |
2121 | 2113 |
2122 CPWL_Color CPDFSDK_Widget::GetBorderPWLColor() const | 2114 CPWL_Color CPDFSDK_Widget::GetBorderPWLColor() const |
2123 { | 2115 { |
2124 » CPWL_Color crBorder; | 2116 CPWL_Color crBorder; |
2125 | 2117 |
2126 » CPDF_FormControl* pFormCtrl = GetFormControl(); | 2118 CPDF_FormControl* pFormCtrl = GetFormControl(); |
2127 » ASSERT(pFormCtrl != NULL); | 2119 ASSERT(pFormCtrl != NULL); |
2128 | 2120 |
2129 » int32_t iColorType; | 2121 int32_t iColorType; |
2130 » FX_FLOAT fc[4]; | 2122 FX_FLOAT fc[4]; |
2131 » pFormCtrl->GetOriginalBorderColor(iColorType, fc); | 2123 pFormCtrl->GetOriginalBorderColor(iColorType, fc); |
2132 » if (iColorType > 0) | 2124 if (iColorType > 0) |
2133 » » crBorder = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); | 2125 crBorder = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); |
2134 | 2126 |
2135 » return crBorder; | 2127 return crBorder; |
2136 } | 2128 } |
2137 | 2129 |
2138 CPWL_Color CPDFSDK_Widget::GetFillPWLColor() const | 2130 CPWL_Color CPDFSDK_Widget::GetFillPWLColor() const |
2139 { | 2131 { |
2140 » CPWL_Color crFill; | 2132 CPWL_Color crFill; |
2141 | 2133 |
2142 » CPDF_FormControl* pFormCtrl = GetFormControl(); | 2134 CPDF_FormControl* pFormCtrl = GetFormControl(); |
2143 » ASSERT(pFormCtrl != NULL); | 2135 ASSERT(pFormCtrl != NULL); |
2144 | 2136 |
2145 » int32_t iColorType; | 2137 int32_t iColorType; |
2146 » FX_FLOAT fc[4]; | 2138 FX_FLOAT fc[4]; |
2147 » pFormCtrl->GetOriginalBackgroundColor(iColorType, fc); | 2139 pFormCtrl->GetOriginalBackgroundColor(iColorType, fc); |
2148 » if (iColorType > 0) | 2140 if (iColorType > 0) |
2149 » » crFill = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); | 2141 crFill = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); |
2150 | 2142 |
2151 » return crFill; | 2143 return crFill; |
2152 } | 2144 } |
2153 | 2145 |
2154 void CPDFSDK_Widget::AddImageToAppearance(const CFX_ByteString& sAPType, CPDF_St
ream* pImage) | 2146 void CPDFSDK_Widget::AddImageToAppearance(const CFX_ByteString& sAPType, CPDF_St
ream* pImage) |
2155 { | 2147 { |
2156 » ASSERT(pImage != NULL); | 2148 ASSERT(pImage != NULL); |
2157 | 2149 |
2158 » CPDF_Document* pDoc = m_pPageView->GetPDFDocument();//pDocument->GetDocu
ment(); | 2150 CPDF_Document* pDoc = m_pPageView->GetPDFDocument();//pDocument->GetDocument
(); |
2159 » ASSERT(pDoc != NULL); | 2151 ASSERT(pDoc != NULL); |
2160 | 2152 |
2161 » CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDict("AP"); | 2153 CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDict("AP"); |
2162 » ASSERT(pAPDict != NULL); | 2154 ASSERT(pAPDict != NULL); |
2163 | 2155 |
2164 » CPDF_Stream* pStream = pAPDict->GetStream(sAPType); | 2156 CPDF_Stream* pStream = pAPDict->GetStream(sAPType); |
2165 » ASSERT(pStream != NULL); | 2157 ASSERT(pStream != NULL); |
2166 | 2158 |
2167 » CPDF_Dictionary* pStreamDict = pStream->GetDict(); | 2159 CPDF_Dictionary* pStreamDict = pStream->GetDict(); |
2168 » ASSERT(pStreamDict != NULL); | 2160 ASSERT(pStreamDict != NULL); |
2169 | 2161 |
2170 » CFX_ByteString sImageAlias = "IMG"; | 2162 CFX_ByteString sImageAlias = "IMG"; |
2171 | 2163 |
2172 » if (CPDF_Dictionary* pImageDict = pImage->GetDict()) | 2164 if (CPDF_Dictionary* pImageDict = pImage->GetDict()) |
2173 » { | 2165 { |
2174 » » sImageAlias = pImageDict->GetString("Name"); | 2166 sImageAlias = pImageDict->GetString("Name"); |
2175 » » if (sImageAlias.IsEmpty()) | 2167 if (sImageAlias.IsEmpty()) |
2176 » » » sImageAlias = "IMG"; | 2168 sImageAlias = "IMG"; |
2177 » } | 2169 } |
2178 | 2170 |
2179 CPDF_Dictionary* pStreamResList = pStreamDict->GetDict("Resources"); | 2171 CPDF_Dictionary* pStreamResList = pStreamDict->GetDict("Resources"); |
2180 if (!pStreamResList) | 2172 if (!pStreamResList) |
2181 { | 2173 { |
2182 pStreamResList = FX_NEW CPDF_Dictionary(); | 2174 pStreamResList = FX_NEW CPDF_Dictionary(); |
2183 pStreamDict->SetAt("Resources", pStreamResList); | 2175 pStreamDict->SetAt("Resources", pStreamResList); |
2184 } | 2176 } |
2185 | 2177 |
2186 if (pStreamResList) | 2178 if (pStreamResList) |
2187 { | 2179 { |
2188 CPDF_Dictionary* pXObject = FX_NEW CPDF_Dictionary; | 2180 CPDF_Dictionary* pXObject = FX_NEW CPDF_Dictionary; |
2189 pXObject->SetAtReference(sImageAlias, pDoc, pImage); | 2181 pXObject->SetAtReference(sImageAlias, pDoc, pImage); |
2190 pStreamResList->SetAt("XObject", pXObject); | 2182 pStreamResList->SetAt("XObject", pXObject); |
2191 } | 2183 } |
2192 } | 2184 } |
2193 | 2185 |
2194 void CPDFSDK_Widget::RemoveAppearance(const CFX_ByteString& sAPType) | 2186 void CPDFSDK_Widget::RemoveAppearance(const CFX_ByteString& sAPType) |
2195 { | 2187 { |
2196 » if (CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDict("AP")) | 2188 if (CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDict("AP")) |
2197 » { | 2189 { |
2198 » » pAPDict->RemoveAt(sAPType); | 2190 pAPDict->RemoveAt(sAPType); |
2199 » } | 2191 } |
2200 } | 2192 } |
2201 | 2193 |
2202 FX_BOOL CPDFSDK_Widget::OnAAction(CPDF_AAction::AActionType type, PDFSDK_FieldAc
tion& data, CPDFSDK_PageView* pPageView) | 2194 FX_BOOL CPDFSDK_Widget::OnAAction(CPDF_AAction::AActionType type, PDFSDK_FieldAc
tion& data, CPDFSDK_PageView* pPageView) |
2203 { | 2195 { |
2204 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); | 2196 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); |
2205 ASSERT(pDocument != NULL); | 2197 ASSERT(pDocument != NULL); |
2206 | 2198 |
2207 CPDFXFA_Document* pDoc = pDocument->GetDocument(); | 2199 CPDFXFA_Document* pDoc = pDocument->GetDocument(); |
2208 ASSERT(pDoc != NULL); | 2200 ASSERT(pDoc != NULL); |
2209 | 2201 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2247 if (nRet == XFA_EVENTERROR_Sucess) | 2239 if (nRet == XFA_EVENTERROR_Sucess) |
2248 return TRUE; | 2240 return TRUE; |
2249 } | 2241 } |
2250 } | 2242 } |
2251 } | 2243 } |
2252 | 2244 |
2253 CPDF_Action action = GetAAction(type); | 2245 CPDF_Action action = GetAAction(type); |
2254 | 2246 |
2255 if (action && action.GetType() != CPDF_Action::Unknown) | 2247 if (action && action.GetType() != CPDF_Action::Unknown) |
2256 { | 2248 { |
2257 » » CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander();
/*(CPDFSDK_ActionHandler*)pApp->GetActionHandler();*/ | 2249 CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander(); |
2258 » » ASSERT(pActionHandler != NULL); | 2250 return pActionHandler->DoAction_Field(action, type, pDocument, GetFormFi
eld(), data); |
2259 | 2251 } |
2260 » » return pActionHandler->DoAction_Field(action, type, pDocument, G
etFormField(), data); | |
2261 » } | |
2262 | |
2263 return FALSE; | 2252 return FALSE; |
2264 } | 2253 } |
2265 | 2254 |
2266 CPDF_Action CPDFSDK_Widget::GetAAction(CPDF_AAction::AActionType eAAT) | 2255 CPDF_Action CPDFSDK_Widget::GetAAction(CPDF_AAction::AActionType eAAT) |
2267 { | 2256 { |
2268 switch (eAAT) | 2257 switch (eAAT) |
2269 { | 2258 { |
2270 case CPDF_AAction::CursorEnter: | 2259 case CPDF_AAction::CursorEnter: |
2271 case CPDF_AAction::CursorExit: | 2260 case CPDF_AAction::CursorExit: |
2272 case CPDF_AAction::ButtonDown: | 2261 case CPDF_AAction::ButtonDown: |
(...skipping 13 matching lines...) Expand all Loading... |
2286 { | 2275 { |
2287 CPDF_FormField* pField = GetFormField(); | 2276 CPDF_FormField* pField = GetFormField(); |
2288 if (CPDF_AAction aa = pField->GetAdditionalAction()) | 2277 if (CPDF_AAction aa = pField->GetAdditionalAction()) |
2289 return aa.GetAction(eAAT); | 2278 return aa.GetAction(eAAT); |
2290 return CPDFSDK_BAAnnot::GetAAction(eAAT); | 2279 return CPDFSDK_BAAnnot::GetAAction(eAAT); |
2291 } | 2280 } |
2292 default: | 2281 default: |
2293 break; | 2282 break; |
2294 } | 2283 } |
2295 | 2284 |
2296 » return CPDF_Action(); | 2285 return CPDF_Action(); |
2297 } | 2286 } |
2298 | 2287 |
2299 | 2288 |
2300 CFX_WideString CPDFSDK_Widget::GetAlternateName() const | 2289 CFX_WideString CPDFSDK_Widget::GetAlternateName() const |
2301 { | 2290 { |
2302 » CPDF_FormField*»pFormField = GetFormField(); | 2291 CPDF_FormField* pFormField = GetFormField(); |
2303 » ASSERT(pFormField != NULL); | 2292 ASSERT(pFormField != NULL); |
2304 | 2293 |
2305 » return pFormField->GetAlternateName(); | 2294 return pFormField->GetAlternateName(); |
2306 } | 2295 } |
2307 | 2296 |
2308 int32_t»CPDFSDK_Widget::GetAppearanceAge() const | 2297 int32_t CPDFSDK_Widget::GetAppearanceAge() const |
2309 { | 2298 { |
2310 » return m_nAppAge; | 2299 return m_nAppAge; |
2311 } | 2300 } |
2312 | 2301 |
2313 int32_t CPDFSDK_Widget::GetValueAge() const | 2302 int32_t CPDFSDK_Widget::GetValueAge() const |
2314 { | 2303 { |
2315 » return m_nValueAge; | 2304 return m_nValueAge; |
2316 } | 2305 } |
2317 | 2306 |
2318 | 2307 |
2319 FX_BOOL»CPDFSDK_Widget::HitTest(FX_FLOAT pageX, FX_FLOAT pageY) | 2308 FX_BOOL CPDFSDK_Widget::HitTest(FX_FLOAT pageX, FX_FLOAT pageY) |
2320 { | 2309 { |
2321 » CPDF_Annot* pAnnot = GetPDFAnnot(); | 2310 CPDF_Annot* pAnnot = GetPDFAnnot(); |
2322 » CFX_FloatRect annotRect; | 2311 CFX_FloatRect annotRect; |
2323 » pAnnot->GetRect(annotRect); | 2312 pAnnot->GetRect(annotRect); |
2324 » if(annotRect.Contains(pageX, pageY)) | 2313 if(annotRect.Contains(pageX, pageY)) |
2325 » { | 2314 { |
2326 » » if (!IsVisible()) return FALSE; | 2315 if (!IsVisible()) return FALSE; |
2327 | 2316 |
2328 » » int nFieldFlags = GetFieldFlags(); | 2317 int nFieldFlags = GetFieldFlags(); |
2329 » » if ((nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY) | 2318 if ((nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY) |
2330 » » » return FALSE; | 2319 return FALSE; |
2331 | 2320 |
2332 » » return TRUE; | 2321 return TRUE; |
2333 » } | 2322 } |
2334 » return FALSE; | 2323 return FALSE; |
2335 } | 2324 } |
2336 | 2325 |
2337 //CPDFSDK_XFAWidget | 2326 //CPDFSDK_XFAWidget |
2338 CPDFSDK_XFAWidget::CPDFSDK_XFAWidget(IXFA_Widget* pAnnot, CPDFSDK_PageView* pPag
eView, CPDFSDK_InterForm* pInterForm) : | 2327 CPDFSDK_XFAWidget::CPDFSDK_XFAWidget(IXFA_Widget* pAnnot, CPDFSDK_PageView* pPag
eView, CPDFSDK_InterForm* pInterForm) : |
2339 CPDFSDK_Annot(pPageView), | 2328 CPDFSDK_Annot(pPageView), |
2340 m_hXFAWidget(pAnnot), | 2329 m_hXFAWidget(pAnnot), |
2341 m_pInterForm(pInterForm) | 2330 m_pInterForm(pInterForm) |
2342 { | 2331 { |
2343 | 2332 |
2344 } | 2333 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2383 m_bCalculate(TRUE), | 2372 m_bCalculate(TRUE), |
2384 m_bXfaCalculate(TRUE), | 2373 m_bXfaCalculate(TRUE), |
2385 m_bXfaValidationsEnabled(TRUE), | 2374 m_bXfaValidationsEnabled(TRUE), |
2386 m_bBusy(FALSE) | 2375 m_bBusy(FALSE) |
2387 { | 2376 { |
2388 ASSERT(m_pDocument != NULL); | 2377 ASSERT(m_pDocument != NULL); |
2389 m_pInterForm = new CPDF_InterForm(m_pDocument->GetDocument()->GetPDFDoc(
), FALSE); | 2378 m_pInterForm = new CPDF_InterForm(m_pDocument->GetDocument()->GetPDFDoc(
), FALSE); |
2390 ASSERT(m_pInterForm != NULL); | 2379 ASSERT(m_pInterForm != NULL); |
2391 m_pInterForm->SetFormNotify(this); | 2380 m_pInterForm->SetFormNotify(this); |
2392 | 2381 |
2393 » for(int i=0; i<6; i++) | 2382 for(int i=0; i<6; i++) |
2394 » » m_bNeedHightlight[i] = FALSE; | 2383 m_bNeedHightlight[i] = FALSE; |
2395 » m_iHighlightAlpha = 0; | 2384 m_iHighlightAlpha = 0; |
2396 } | 2385 } |
2397 | 2386 |
2398 CPDFSDK_InterForm::~CPDFSDK_InterForm() | 2387 CPDFSDK_InterForm::~CPDFSDK_InterForm() |
2399 { | 2388 { |
2400 delete m_pInterForm; | 2389 delete m_pInterForm; |
2401 m_pInterForm = nullptr; | 2390 m_pInterForm = nullptr; |
2402 | 2391 |
2403 m_Map.clear(); | 2392 m_Map.clear(); |
2404 m_XFAMap.RemoveAll(); | 2393 m_XFAMap.RemoveAll(); |
2405 } | 2394 } |
2406 | 2395 |
2407 FX_BOOL CPDFSDK_InterForm::HighlightWidgets() | 2396 FX_BOOL CPDFSDK_InterForm::HighlightWidgets() |
2408 { | 2397 { |
2409 » return FALSE; | 2398 return FALSE; |
2410 } | 2399 } |
2411 | 2400 |
2412 CPDFSDK_Widget* CPDFSDK_InterForm::GetSibling(CPDFSDK_Widget* pWidget, FX_BOOL b
Next) const | 2401 CPDFSDK_Widget* CPDFSDK_InterForm::GetSibling(CPDFSDK_Widget* pWidget, FX_BOOL b
Next) const |
2413 { | 2402 { |
2414 nonstd::unique_ptr<CBA_AnnotIterator> pIterator( | 2403 nonstd::unique_ptr<CBA_AnnotIterator> pIterator( |
2415 new CBA_AnnotIterator(pWidget->GetPageView(), "Widget", "")); | 2404 new CBA_AnnotIterator(pWidget->GetPageView(), "Widget", "")); |
2416 | 2405 |
2417 if (bNext) { | 2406 if (bNext) { |
2418 return (CPDFSDK_Widget*)pIterator->GetNextAnnot(pWidget); | 2407 return (CPDFSDK_Widget*)pIterator->GetNextAnnot(pWidget); |
2419 } | 2408 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2451 } | 2440 } |
2452 } | 2441 } |
2453 | 2442 |
2454 if (!pPage) | 2443 if (!pPage) |
2455 return nullptr; | 2444 return nullptr; |
2456 return (CPDFSDK_Widget*)pPage->GetAnnotByDict(pControlDict); | 2445 return (CPDFSDK_Widget*)pPage->GetAnnotByDict(pControlDict); |
2457 } | 2446 } |
2458 | 2447 |
2459 void CPDFSDK_InterForm::GetWidgets(const CFX_WideString& sFieldName, CFX_PtrArra
y& widgets) | 2448 void CPDFSDK_InterForm::GetWidgets(const CFX_WideString& sFieldName, CFX_PtrArra
y& widgets) |
2460 { | 2449 { |
2461 » ASSERT(m_pInterForm != NULL); | 2450 ASSERT(m_pInterForm != NULL); |
2462 | 2451 |
2463 » for (int i=0,sz=m_pInterForm->CountFields(sFieldName); i<sz; i++) | 2452 for (int i=0,sz=m_pInterForm->CountFields(sFieldName); i<sz; i++) |
2464 » { | 2453 { |
2465 » » CPDF_FormField* pFormField = m_pInterForm->GetField(i, sFieldNam
e); | 2454 CPDF_FormField* pFormField = m_pInterForm->GetField(i, sFieldName); |
2466 » » ASSERT(pFormField != NULL); | 2455 ASSERT(pFormField != NULL); |
2467 | 2456 |
2468 » » GetWidgets(pFormField, widgets); | 2457 GetWidgets(pFormField, widgets); |
2469 » } | 2458 } |
2470 } | 2459 } |
2471 | 2460 |
2472 void CPDFSDK_InterForm::GetWidgets(CPDF_FormField* pField, CFX_PtrArray& widgets
) | 2461 void CPDFSDK_InterForm::GetWidgets(CPDF_FormField* pField, CFX_PtrArray& widgets
) |
2473 { | 2462 { |
2474 » ASSERT(pField != NULL); | 2463 ASSERT(pField != NULL); |
2475 | 2464 |
2476 » for (int i=0,isz=pField->CountControls(); i<isz; i++) | 2465 for (int i=0,isz=pField->CountControls(); i<isz; i++) |
2477 » { | 2466 { |
2478 » » CPDF_FormControl* pFormCtrl = pField->GetControl(i); | 2467 CPDF_FormControl* pFormCtrl = pField->GetControl(i); |
2479 » » ASSERT(pFormCtrl != NULL); | 2468 ASSERT(pFormCtrl != NULL); |
2480 | 2469 |
2481 » » CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl); | 2470 CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl); |
2482 | 2471 |
2483 » » if (pWidget) | 2472 if (pWidget) |
2484 » » » widgets.Add(pWidget); | 2473 widgets.Add(pWidget); |
2485 » } | 2474 } |
2486 } | 2475 } |
2487 | 2476 |
2488 int CPDFSDK_InterForm::GetPageIndexByAnnotDict(CPDF_Document* pDocument, CPDF_Di
ctionary* pAnnotDict) const | 2477 int CPDFSDK_InterForm::GetPageIndexByAnnotDict(CPDF_Document* pDocument, CPDF_Di
ctionary* pAnnotDict) const |
2489 { | 2478 { |
2490 » ASSERT(pDocument != NULL); | 2479 ASSERT(pDocument != NULL); |
2491 » ASSERT(pAnnotDict != NULL); | 2480 ASSERT(pAnnotDict != NULL); |
2492 | 2481 |
2493 » for (int i=0,sz=pDocument->GetPageCount(); i<sz; i++) | 2482 for (int i=0,sz=pDocument->GetPageCount(); i<sz; i++) |
2494 » { | 2483 { |
2495 » » if (CPDF_Dictionary* pPageDict = pDocument->GetPage(i)) | 2484 if (CPDF_Dictionary* pPageDict = pDocument->GetPage(i)) |
2496 » » { | 2485 { |
2497 » » » if (CPDF_Array* pAnnots = pPageDict->GetArray("Annots")) | 2486 if (CPDF_Array* pAnnots = pPageDict->GetArray("Annots")) |
2498 » » » { | 2487 { |
2499 » » » » for (int j=0,jsz=pAnnots->GetCount(); j<jsz; j++
) | 2488 for (int j=0,jsz=pAnnots->GetCount(); j<jsz; j++) |
2500 » » » » { | 2489 { |
2501 » » » » » CPDF_Object* pDict = pAnnots->GetElement
Value(j); | 2490 CPDF_Object* pDict = pAnnots->GetElementValue(j); |
2502 » » » » » if (pAnnotDict == pDict) | 2491 if (pAnnotDict == pDict) |
2503 » » » » » { | 2492 { |
2504 » » » » » » return i; | 2493 return i; |
2505 » » » » » } | 2494 } |
2506 » » » » } | 2495 } |
2507 » » » } | 2496 } |
2508 » » } | 2497 } |
2509 » } | 2498 } |
2510 | 2499 |
2511 » return -1; | 2500 return -1; |
2512 } | 2501 } |
2513 | 2502 |
2514 void CPDFSDK_InterForm::AddMap(CPDF_FormControl* pControl, CPDFSDK_Widget* pWidg
et) | 2503 void CPDFSDK_InterForm::AddMap(CPDF_FormControl* pControl, CPDFSDK_Widget* pWidg
et) |
2515 { | 2504 { |
2516 m_Map[pControl] = pWidget; | 2505 m_Map[pControl] = pWidget; |
2517 } | 2506 } |
2518 | 2507 |
2519 void CPDFSDK_InterForm::RemoveMap(CPDF_FormControl* pControl) | 2508 void CPDFSDK_InterForm::RemoveMap(CPDF_FormControl* pControl) |
2520 { | 2509 { |
2521 m_Map.erase(pControl); | 2510 m_Map.erase(pControl); |
(...skipping 12 matching lines...) Expand all Loading... |
2534 CPDFSDK_XFAWidget* CPDFSDK_InterForm::GetXFAWidget(IXFA_Widget* hWidget) | 2523 CPDFSDK_XFAWidget* CPDFSDK_InterForm::GetXFAWidget(IXFA_Widget* hWidget) |
2535 { | 2524 { |
2536 CPDFSDK_XFAWidget* pWidget = NULL; | 2525 CPDFSDK_XFAWidget* pWidget = NULL; |
2537 m_XFAMap.Lookup(hWidget, pWidget); | 2526 m_XFAMap.Lookup(hWidget, pWidget); |
2538 | 2527 |
2539 return pWidget; | 2528 return pWidget; |
2540 } | 2529 } |
2541 | 2530 |
2542 void CPDFSDK_InterForm::EnableCalculate(FX_BOOL bEnabled) | 2531 void CPDFSDK_InterForm::EnableCalculate(FX_BOOL bEnabled) |
2543 { | 2532 { |
2544 » m_bCalculate = bEnabled; | 2533 m_bCalculate = bEnabled; |
2545 } | 2534 } |
2546 | 2535 |
2547 FX_BOOL CPDFSDK_InterForm::IsCalculateEnabled() const | 2536 FX_BOOL CPDFSDK_InterForm::IsCalculateEnabled() const |
2548 { | 2537 { |
2549 » return m_bCalculate; | 2538 return m_bCalculate; |
2550 } | 2539 } |
2551 | 2540 |
2552 void CPDFSDK_InterForm::XfaEnableCalculate(FX_BOOL bEnabled) | 2541 void CPDFSDK_InterForm::XfaEnableCalculate(FX_BOOL bEnabled) |
2553 { | 2542 { |
2554 m_bXfaCalculate = bEnabled; | 2543 m_bXfaCalculate = bEnabled; |
2555 } | 2544 } |
2556 FX_BOOL CPDFSDK_InterForm::IsXfaCalculateEnabled() const | 2545 FX_BOOL CPDFSDK_InterForm::IsXfaCalculateEnabled() const |
2557 { | 2546 { |
2558 return m_bXfaCalculate; | 2547 return m_bXfaCalculate; |
2559 } | 2548 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2627 | 2616 |
2628 delete pBmp; | 2617 delete pBmp; |
2629 } | 2618 } |
2630 | 2619 |
2631 return pRetStream; | 2620 return pRetStream; |
2632 } | 2621 } |
2633 #endif | 2622 #endif |
2634 | 2623 |
2635 void CPDFSDK_InterForm::OnCalculate(CPDF_FormField* pFormField) | 2624 void CPDFSDK_InterForm::OnCalculate(CPDF_FormField* pFormField) |
2636 { | 2625 { |
2637 » ASSERT(m_pDocument != NULL); | 2626 ASSERT(m_pDocument != NULL); |
2638 » CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); | 2627 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); |
2639 » ASSERT(pEnv); | 2628 ASSERT(pEnv); |
2640 » if(!pEnv->IsJSInitiated()) | 2629 if(!pEnv->IsJSInitiated()) |
2641 » » return; | 2630 return; |
2642 | 2631 |
2643 » if (m_bBusy) return; | 2632 if (m_bBusy) return; |
2644 | 2633 |
2645 » m_bBusy = TRUE; | 2634 m_bBusy = TRUE; |
2646 | 2635 |
2647 » if (IsCalculateEnabled()) | 2636 if (IsCalculateEnabled()) |
2648 » { | 2637 { |
2649 » » IFXJS_Runtime* pRuntime = m_pDocument->GetJsRuntime(); | 2638 IFXJS_Runtime* pRuntime = m_pDocument->GetJsRuntime(); |
2650 » » ASSERT(pRuntime != NULL); | 2639 ASSERT(pRuntime != NULL); |
2651 | 2640 |
2652 » » pRuntime->SetReaderDocument(m_pDocument); | 2641 pRuntime->SetReaderDocument(m_pDocument); |
2653 | 2642 |
2654 » » int nSize = m_pInterForm->CountFieldsInCalculationOrder(); | 2643 int nSize = m_pInterForm->CountFieldsInCalculationOrder(); |
2655 » » for (int i=0; i<nSize; i++) | 2644 for (int i=0; i<nSize; i++) |
2656 » » { | 2645 { |
2657 » » » if(CPDF_FormField* pField = m_pInterForm->GetFieldInCalc
ulationOrder(i)) | 2646 if(CPDF_FormField* pField = m_pInterForm->GetFieldInCalculationOrder
(i)) |
2658 » » » { | 2647 { |
2659 //» » » ASSERT(pField != NULL); | 2648 // ASSERT(pField != NULL); |
2660 » » » » int nType = pField->GetFieldType(); | 2649 int nType = pField->GetFieldType(); |
2661 » » » » if (nType == FIELDTYPE_COMBOBOX || nType == FIEL
DTYPE_TEXTFIELD) | 2650 if (nType == FIELDTYPE_COMBOBOX || nType == FIELDTYPE_TEXTFIELD) |
2662 » » » » { | 2651 { |
2663 » » » » » CPDF_AAction aAction = pField->GetAdditi
onalAction(); | 2652 CPDF_AAction aAction = pField->GetAdditionalAction(); |
2664 » » » » » if (aAction && aAction.ActionExist(CPDF_
AAction::Calculate)) | 2653 if (aAction && aAction.ActionExist(CPDF_AAction::Calculate)) |
2665 » » » » » { | 2654 { |
2666 » » » » » » CPDF_Action action = aAction.Get
Action(CPDF_AAction::Calculate); | 2655 CPDF_Action action = aAction.GetAction(CPDF_AAction::Cal
culate); |
2667 » » » » » » if (action) | 2656 if (action) |
2668 » » » » » » { | 2657 { |
2669 » » » » » » » CFX_WideString csJS = ac
tion.GetJavaScript(); | 2658 CFX_WideString csJS = action.GetJavaScript(); |
2670 » » » » » » » if (!csJS.IsEmpty()) | 2659 if (!csJS.IsEmpty()) |
2671 » » » » » » » { | 2660 { |
2672 » » » » » » » » IFXJS_Context* p
Context = pRuntime->NewContext(); | 2661 IFXJS_Context* pContext = pRuntime->NewContext()
; |
2673 » » » » » » » » ASSERT(pContext
!= NULL); | 2662 ASSERT(pContext != NULL); |
2674 | 2663 |
2675 » » » » » » » » CFX_WideString s
OldValue = pField->GetValue(); | 2664 CFX_WideString sOldValue = pField->GetValue(); |
2676 » » » » » » » » CFX_WideString s
Value = sOldValue; | 2665 CFX_WideString sValue = sOldValue; |
2677 » » » » » » » » FX_BOOL bRC = TR
UE; | 2666 FX_BOOL bRC = TRUE; |
2678 » » » » » » » » pContext->OnFiel
d_Calculate(pFormField, pField, sValue, bRC); | 2667 pContext->OnField_Calculate(pFormField, pField,
sValue, bRC); |
2679 | 2668 |
2680 » » » » » » » » CFX_WideString s
Info; | 2669 CFX_WideString sInfo; |
2681 » » » » » » » » FX_BOOL bRet = p
Context->RunScript(csJS, sInfo); | 2670 FX_BOOL bRet = pContext->RunScript(csJS, sInfo); |
2682 » » » » » » » » pRuntime->Releas
eContext(pContext); | 2671 pRuntime->ReleaseContext(pContext); |
2683 | 2672 |
2684 » » » » » » » » if (bRet) | 2673 if (bRet) |
2685 » » » » » » » » { | 2674 { |
2686 » » » » » » » » » if (bRC) | 2675 if (bRC) |
2687 » » » » » » » » » { | 2676 { |
2688 » » » » » » » » » »
if (sValue.Compare(sOldValue) != 0) | 2677 if (sValue.Compare(sOldValue) != 0) |
2689 » » » » » » » » » »
» pField->SetValue(sValue, TRUE); | 2678 pField->SetValue(sValue, TRUE); |
2690 » » » » » » » » » } | 2679 } |
2691 » » » » » » » » } | 2680 } |
2692 » » » » » » » } | 2681 } |
2693 » » » » » » } | 2682 } |
2694 » » » » » } | 2683 } |
2695 » » » » } | 2684 } |
2696 » » » } | 2685 } |
2697 » » } | 2686 } |
2698 | 2687 |
2699 | 2688 |
2700 » } | 2689 } |
2701 | 2690 |
2702 » m_bBusy = FALSE; | 2691 m_bBusy = FALSE; |
2703 } | 2692 } |
2704 | 2693 |
2705 CFX_WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField, FX_BOOL&
bFormated) | 2694 CFX_WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField, FX_BOOL&
bFormated) |
2706 { | 2695 { |
2707 » ASSERT(m_pDocument != NULL); | 2696 ASSERT(m_pDocument != NULL); |
2708 » ASSERT(pFormField != NULL); | 2697 ASSERT(pFormField != NULL); |
2709 | 2698 |
2710 » CFX_WideString sValue = pFormField->GetValue(); | 2699 CFX_WideString sValue = pFormField->GetValue(); |
2711 » CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); | 2700 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); |
2712 » ASSERT(pEnv); | 2701 ASSERT(pEnv); |
2713 » if(!pEnv->IsJSInitiated()) | 2702 if(!pEnv->IsJSInitiated()) |
2714 » { | 2703 { |
2715 » » bFormated = FALSE; | 2704 bFormated = FALSE; |
2716 » » return sValue; | 2705 return sValue; |
2717 » } | 2706 } |
2718 | 2707 |
2719 » IFXJS_Runtime* pRuntime = m_pDocument->GetJsRuntime(); | 2708 IFXJS_Runtime* pRuntime = m_pDocument->GetJsRuntime(); |
2720 » ASSERT(pRuntime != NULL); | 2709 ASSERT(pRuntime != NULL); |
2721 | 2710 |
2722 » pRuntime->SetReaderDocument(m_pDocument); | 2711 pRuntime->SetReaderDocument(m_pDocument); |
2723 | 2712 |
2724 » if (pFormField->GetFieldType() == FIELDTYPE_COMBOBOX) | 2713 if (pFormField->GetFieldType() == FIELDTYPE_COMBOBOX) |
2725 » { | 2714 { |
2726 » » if (pFormField->CountSelectedItems() > 0) | 2715 if (pFormField->CountSelectedItems() > 0) |
2727 » » { | 2716 { |
2728 » » » int index = pFormField->GetSelectedIndex(0); | 2717 int index = pFormField->GetSelectedIndex(0); |
2729 » » » if (index >= 0) | 2718 if (index >= 0) |
2730 » » » » sValue = pFormField->GetOptionLabel(index); | 2719 sValue = pFormField->GetOptionLabel(index); |
2731 » » } | 2720 } |
2732 » } | 2721 } |
2733 | 2722 |
2734 » bFormated = FALSE; | 2723 bFormated = FALSE; |
2735 | 2724 |
2736 » CPDF_AAction aAction = pFormField->GetAdditionalAction(); | 2725 CPDF_AAction aAction = pFormField->GetAdditionalAction(); |
2737 » if (aAction != NULL && aAction.ActionExist(CPDF_AAction::Format)) | 2726 if (aAction != NULL && aAction.ActionExist(CPDF_AAction::Format)) |
2738 » { | 2727 { |
2739 » » CPDF_Action action = aAction.GetAction(CPDF_AAction::Format); | 2728 CPDF_Action action = aAction.GetAction(CPDF_AAction::Format); |
2740 » » if (action) | 2729 if (action) |
2741 » » { | 2730 { |
2742 » » » CFX_WideString script = action.GetJavaScript(); | 2731 CFX_WideString script = action.GetJavaScript(); |
2743 » » » if (!script.IsEmpty()) | 2732 if (!script.IsEmpty()) |
2744 » » » { | 2733 { |
2745 » » » » CFX_WideString Value = sValue; | 2734 CFX_WideString Value = sValue; |
2746 | 2735 |
2747 » » » » IFXJS_Context* pContext = pRuntime->NewContext()
; | 2736 IFXJS_Context* pContext = pRuntime->NewContext(); |
2748 » » » » ASSERT(pContext != NULL); | 2737 ASSERT(pContext != NULL); |
2749 | 2738 |
2750 » » » » pContext->OnField_Format(pFormField, Value, TRUE
); | 2739 pContext->OnField_Format(pFormField, Value, TRUE); |
2751 | 2740 |
2752 » » » » CFX_WideString sInfo; | 2741 CFX_WideString sInfo; |
2753 » » » » FX_BOOL bRet = pContext->RunScript(script, sInfo
); | 2742 FX_BOOL bRet = pContext->RunScript(script, sInfo); |
2754 » » » » pRuntime->ReleaseContext(pContext); | 2743 pRuntime->ReleaseContext(pContext); |
2755 | 2744 |
2756 » » » » if (bRet) | 2745 if (bRet) |
2757 » » » » { | 2746 { |
2758 » » » » » sValue = Value; | 2747 sValue = Value; |
2759 » » » » » bFormated = TRUE; | 2748 bFormated = TRUE; |
2760 » » » » } | 2749 } |
2761 » » » } | 2750 } |
2762 » » } | 2751 } |
2763 » } | 2752 } |
2764 | 2753 |
2765 » return sValue; | 2754 return sValue; |
2766 } | 2755 } |
2767 | 2756 |
2768 void CPDFSDK_InterForm::ResetFieldAppearance(CPDF_FormField* pFormField, const F
X_WCHAR* sValue, FX_BOOL bValueChanged) | 2757 void CPDFSDK_InterForm::ResetFieldAppearance(CPDF_FormField* pFormField, const F
X_WCHAR* sValue, FX_BOOL bValueChanged) |
2769 { | 2758 { |
2770 » ASSERT(pFormField != NULL); | 2759 ASSERT(pFormField != NULL); |
2771 | 2760 |
2772 » for (int i=0,sz=pFormField->CountControls(); i<sz; i++) | 2761 for (int i=0,sz=pFormField->CountControls(); i<sz; i++) |
2773 » { | 2762 { |
2774 » » CPDF_FormControl* pFormCtrl = pFormField->GetControl(i); | 2763 CPDF_FormControl* pFormCtrl = pFormField->GetControl(i); |
2775 » » ASSERT(pFormCtrl != NULL); | 2764 ASSERT(pFormCtrl != NULL); |
2776 | 2765 |
2777 » » ASSERT(m_pInterForm != NULL); | 2766 ASSERT(m_pInterForm != NULL); |
2778 » » if(CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl)) | 2767 if(CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl)) |
2779 » » » pWidget->ResetAppearance(sValue, bValueChanged); | 2768 pWidget->ResetAppearance(sValue, bValueChanged); |
2780 » } | 2769 } |
2781 } | 2770 } |
2782 | 2771 |
2783 void CPDFSDK_InterForm::UpdateField(CPDF_FormField* pFormField) | 2772 void CPDFSDK_InterForm::UpdateField(CPDF_FormField* pFormField) |
2784 { | 2773 { |
2785 » ASSERT(pFormField != NULL); | 2774 ASSERT(pFormField != NULL); |
2786 | 2775 |
2787 » for (int i=0,sz=pFormField->CountControls(); i<sz; i++) | 2776 for (int i=0,sz=pFormField->CountControls(); i<sz; i++) |
2788 » { | 2777 { |
2789 » » CPDF_FormControl* pFormCtrl = pFormField->GetControl(i); | 2778 CPDF_FormControl* pFormCtrl = pFormField->GetControl(i); |
2790 » » ASSERT(pFormCtrl != NULL); | 2779 ASSERT(pFormCtrl != NULL); |
2791 | 2780 |
2792 » » if(CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl)) | 2781 if(CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl)) |
2793 » » { | 2782 { |
2794 » » » CPDFDoc_Environment * pEnv = m_pDocument->GetEnv(); | 2783 CPDFDoc_Environment * pEnv = m_pDocument->GetEnv(); |
2795 » » » CFFL_IFormFiller* pIFormFiller = pEnv->GetIFormFiller(); | 2784 CFFL_IFormFiller* pIFormFiller = pEnv->GetIFormFiller(); |
2796 | 2785 |
2797 CPDFXFA_Page * pPage = pWidget->GetPDFXFAPage(); | 2786 CPDFXFA_Page * pPage = pWidget->GetPDFXFAPage(); |
2798 CPDFSDK_PageView * pPageView = m_pDocument->GetPageView(
pPage,FALSE); | 2787 CPDFSDK_PageView * pPageView = m_pDocument->GetPageView(
pPage,FALSE); |
2799 | 2788 |
2800 » » » FX_RECT rcBBox = pIFormFiller->GetViewBBox(pPageView, pW
idget); | 2789 FX_RECT rcBBox = pIFormFiller->GetViewBBox(pPageView, pWidget); |
2801 | 2790 |
2802 » » » pEnv->FFI_Invalidate(pPage,rcBBox.left, rcBBox.top, rcBB
ox.right, rcBBox.bottom); | 2791 pEnv->FFI_Invalidate(pPage,rcBBox.left, rcBBox.top, rcBBox.right, rc
BBox.bottom); |
2803 » » } | 2792 } |
2804 » } | 2793 } |
2805 } | 2794 } |
2806 | 2795 |
2807 void CPDFSDK_InterForm::OnKeyStrokeCommit(CPDF_FormField* pFormField, CFX_WideSt
ring& csValue, FX_BOOL& bRC) | 2796 void CPDFSDK_InterForm::OnKeyStrokeCommit(CPDF_FormField* pFormField, CFX_WideSt
ring& csValue, FX_BOOL& bRC) |
2808 { | 2797 { |
2809 » ASSERT(pFormField != NULL); | 2798 ASSERT(pFormField != NULL); |
2810 | 2799 |
2811 » CPDF_AAction aAction = pFormField->GetAdditionalAction(); | 2800 CPDF_AAction aAction = pFormField->GetAdditionalAction(); |
2812 » if (aAction != NULL && aAction.ActionExist(CPDF_AAction::KeyStroke)) | 2801 if (aAction != NULL && aAction.ActionExist(CPDF_AAction::KeyStroke)) |
2813 » { | 2802 { |
2814 » » CPDF_Action action = aAction.GetAction(CPDF_AAction::KeyStroke); | 2803 CPDF_Action action = aAction.GetAction(CPDF_AAction::KeyStroke); |
2815 » » if (action) | 2804 if (action) |
2816 » » { | 2805 { |
2817 » » » ASSERT(m_pDocument != NULL); | 2806 ASSERT(m_pDocument != NULL); |
2818 » » » CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); | 2807 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); |
2819 » » » ASSERT(pEnv != NULL); | 2808 ASSERT(pEnv != NULL); |
2820 | 2809 |
2821 » » » CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionH
ander(); | 2810 CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander(); |
2822 » » » ASSERT(pActionHandler != NULL); | 2811 ASSERT(pActionHandler != NULL); |
2823 | 2812 |
2824 » » » PDFSDK_FieldAction fa; | 2813 PDFSDK_FieldAction fa; |
2825 » » » fa.bModifier = pEnv->FFI_IsCTRLKeyDown(0); | 2814 fa.bModifier = pEnv->FFI_IsCTRLKeyDown(0); |
2826 » » » fa.bShift = pEnv->FFI_IsSHIFTKeyDown(0); | 2815 fa.bShift = pEnv->FFI_IsSHIFTKeyDown(0); |
2827 » » » fa.sValue = csValue; | 2816 fa.sValue = csValue; |
2828 | 2817 |
2829 » » » pActionHandler->DoAction_FieldJavaScript(action, CPDF_AA
ction::KeyStroke, | 2818 pActionHandler->DoAction_FieldJavaScript(action, CPDF_AAction::KeySt
roke, |
2830 » » » » m_pDocument, pFormField, fa); | 2819 m_pDocument, pFormField, fa); |
2831 » » » bRC = fa.bRC; | 2820 bRC = fa.bRC; |
2832 » » } | 2821 } |
2833 » } | 2822 } |
2834 } | 2823 } |
2835 | 2824 |
2836 void CPDFSDK_InterForm::OnValidate(CPDF_FormField* pFormField, CFX_WideString& c
sValue, FX_BOOL& bRC) | 2825 void CPDFSDK_InterForm::OnValidate(CPDF_FormField* pFormField, CFX_WideString& c
sValue, FX_BOOL& bRC) |
2837 { | 2826 { |
2838 » ASSERT(pFormField != NULL); | 2827 ASSERT(pFormField != NULL); |
2839 | 2828 |
2840 » CPDF_AAction aAction = pFormField->GetAdditionalAction(); | 2829 CPDF_AAction aAction = pFormField->GetAdditionalAction(); |
2841 » if (aAction != NULL && aAction.ActionExist(CPDF_AAction::Validate)) | 2830 if (aAction != NULL && aAction.ActionExist(CPDF_AAction::Validate)) |
2842 » { | 2831 { |
2843 » » CPDF_Action action = aAction.GetAction(CPDF_AAction::Validate); | 2832 CPDF_Action action = aAction.GetAction(CPDF_AAction::Validate); |
2844 » » if (action) | 2833 if (action) |
2845 » » { | 2834 { |
2846 » » » ASSERT(m_pDocument != NULL); | 2835 ASSERT(m_pDocument != NULL); |
2847 » » » CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); | 2836 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); |
2848 » » » ASSERT(pEnv != NULL); | 2837 ASSERT(pEnv != NULL); |
2849 | 2838 |
2850 » » » CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionH
ander(); | 2839 CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander(); |
2851 » » » ASSERT(pActionHandler != NULL); | 2840 ASSERT(pActionHandler != NULL); |
2852 | 2841 |
2853 » » » PDFSDK_FieldAction fa; | 2842 PDFSDK_FieldAction fa; |
2854 » » » fa.bModifier = pEnv->FFI_IsCTRLKeyDown(0); | 2843 fa.bModifier = pEnv->FFI_IsCTRLKeyDown(0); |
2855 » » » fa.bShift = pEnv->FFI_IsSHIFTKeyDown(0); | 2844 fa.bShift = pEnv->FFI_IsSHIFTKeyDown(0); |
2856 » » » fa.sValue = csValue; | 2845 fa.sValue = csValue; |
2857 | 2846 |
2858 » » » pActionHandler->DoAction_FieldJavaScript(action, CPDF_AA
ction::Validate, m_pDocument, pFormField, fa); | 2847 pActionHandler->DoAction_FieldJavaScript(action, CPDF_AAction::Valid
ate, m_pDocument, pFormField, fa); |
2859 » » » bRC = fa.bRC; | 2848 bRC = fa.bRC; |
2860 | 2849 |
2861 » » } | 2850 } |
2862 » } | 2851 } |
2863 } | 2852 } |
2864 | 2853 |
2865 /* ----------------------------- action ----------------------------- */ | 2854 /* ----------------------------- action ----------------------------- */ |
2866 | 2855 |
2867 FX_BOOL CPDFSDK_InterForm::DoAction_Hide(const CPDF_Action& action) | 2856 FX_BOOL CPDFSDK_InterForm::DoAction_Hide(const CPDF_Action& action) |
2868 { | 2857 { |
2869 » ASSERT(action); | 2858 ASSERT(action); |
2870 | 2859 |
2871 » CPDF_ActionFields af = action.GetWidgets(); | 2860 CPDF_ActionFields af = action.GetWidgets(); |
2872 » CFX_PtrArray fieldObjects; | 2861 CFX_PtrArray fieldObjects; |
2873 » af.GetAllFields(fieldObjects); | 2862 af.GetAllFields(fieldObjects); |
2874 » CFX_PtrArray widgetArray; | 2863 CFX_PtrArray widgetArray; |
2875 » CFX_PtrArray fields; | 2864 CFX_PtrArray fields; |
2876 » GetFieldFromObjects(fieldObjects, fields); | 2865 GetFieldFromObjects(fieldObjects, fields); |
2877 | 2866 |
2878 » FX_BOOL bHide = action.GetHideStatus(); | 2867 FX_BOOL bHide = action.GetHideStatus(); |
2879 | 2868 |
2880 » FX_BOOL bChanged = FALSE; | 2869 FX_BOOL bChanged = FALSE; |
2881 | 2870 |
2882 » for (int i=0, sz=fields.GetSize(); i<sz; i++) | 2871 for (int i=0, sz=fields.GetSize(); i<sz; i++) |
2883 » { | 2872 { |
2884 » » CPDF_FormField* pField = (CPDF_FormField*)fields[i]; | 2873 CPDF_FormField* pField = (CPDF_FormField*)fields[i]; |
2885 » » ASSERT(pField != NULL); | 2874 ASSERT(pField != NULL); |
2886 | 2875 |
2887 | 2876 |
2888 » » for (int j=0,jsz=pField->CountControls(); j<jsz; j++) | 2877 for (int j=0,jsz=pField->CountControls(); j<jsz; j++) |
2889 » » { | 2878 { |
2890 » » » CPDF_FormControl* pControl = pField->GetControl(j); | 2879 CPDF_FormControl* pControl = pField->GetControl(j); |
2891 » » » ASSERT(pControl != NULL); | 2880 ASSERT(pControl != NULL); |
2892 | 2881 |
2893 » » » if (CPDFSDK_Widget* pWidget = GetWidget(pControl)) | 2882 if (CPDFSDK_Widget* pWidget = GetWidget(pControl)) |
2894 » » » { | 2883 { |
2895 » » » » int nFlags = pWidget->GetFlags(); | 2884 int nFlags = pWidget->GetFlags(); |
2896 » » » » if (bHide) | 2885 if (bHide) |
2897 » » » » { | 2886 { |
2898 » » » » » nFlags &= (~ANNOTFLAG_INVISIBLE); | 2887 nFlags &= (~ANNOTFLAG_INVISIBLE); |
2899 » » » » » nFlags &= (~ANNOTFLAG_NOVIEW); | 2888 nFlags &= (~ANNOTFLAG_NOVIEW); |
2900 » » » » » nFlags |= (ANNOTFLAG_HIDDEN); | 2889 nFlags |= (ANNOTFLAG_HIDDEN); |
2901 » » » » } | 2890 } |
2902 » » » » else | 2891 else |
2903 » » » » { | 2892 { |
2904 » » » » » nFlags &= (~ANNOTFLAG_INVISIBLE); | 2893 nFlags &= (~ANNOTFLAG_INVISIBLE); |
2905 » » » » » nFlags &= (~ANNOTFLAG_HIDDEN); | 2894 nFlags &= (~ANNOTFLAG_HIDDEN); |
2906 » » » » » nFlags &= (~ANNOTFLAG_NOVIEW); | 2895 nFlags &= (~ANNOTFLAG_NOVIEW); |
2907 » » » » } | 2896 } |
2908 » » » » pWidget->SetFlags(nFlags); | 2897 pWidget->SetFlags(nFlags); |
2909 | 2898 |
2910 » » » » CPDFSDK_PageView* pPageView = pWidget->GetPageVi
ew(); | 2899 CPDFSDK_PageView* pPageView = pWidget->GetPageView(); |
2911 » » » » ASSERT(pPageView != NULL); | 2900 ASSERT(pPageView != NULL); |
2912 | 2901 |
2913 » » » » pPageView->UpdateView(pWidget); | 2902 pPageView->UpdateView(pWidget); |
2914 | 2903 |
2915 » » » » bChanged = TRUE; | 2904 bChanged = TRUE; |
2916 » » » } | 2905 } |
2917 » » } | 2906 } |
2918 » } | 2907 } |
2919 | 2908 |
2920 » return bChanged; | 2909 return bChanged; |
2921 } | 2910 } |
2922 | 2911 |
2923 FX_BOOL CPDFSDK_InterForm::DoAction_SubmitForm(const CPDF_Action& action) | 2912 FX_BOOL CPDFSDK_InterForm::DoAction_SubmitForm(const CPDF_Action& action) |
2924 { | 2913 { |
2925 » ASSERT(action); | 2914 ASSERT(m_pInterForm != NULL); |
2926 » ASSERT(m_pInterForm != NULL); | 2915 CFX_WideString sDestination = action.GetFilePath(); |
2927 | 2916 if (sDestination.IsEmpty()) |
2928 » CFX_WideString sDestination = action.GetFilePath(); | 2917 return FALSE; |
2929 » if (sDestination.IsEmpty()) return FALSE; | 2918 |
2930 | 2919 CPDF_Dictionary* pActionDict = action.GetDict(); |
2931 » CPDF_Dictionary* pActionDict = action.GetDict(); | 2920 if (pActionDict->KeyExist("Fields")) |
2932 » if (pActionDict->KeyExist("Fields")) | 2921 { |
2933 » { | 2922 CPDF_ActionFields af = action.GetWidgets(); |
2934 » » CPDF_ActionFields af = action.GetWidgets(); | 2923 FX_DWORD dwFlags = action.GetFlags(); |
2935 » » FX_DWORD dwFlags = action.GetFlags(); | 2924 CFX_PtrArray fieldObjects; |
2936 | 2925 af.GetAllFields(fieldObjects); |
2937 » » CFX_PtrArray fieldObjects; | 2926 |
2938 » » af.GetAllFields(fieldObjects); | 2927 CFX_PtrArray fields; |
2939 » » CFX_PtrArray fields; | 2928 GetFieldFromObjects(fieldObjects, fields); |
2940 » » GetFieldFromObjects(fieldObjects, fields); | 2929 if (fields.GetSize() != 0) |
2941 | 2930 { |
2942 » » if (fields.GetSize() != 0) | 2931 FX_BOOL bIncludeOrExclude = !(dwFlags & 0x01); |
2943 » » { | 2932 if (m_pInterForm->CheckRequiredFields(&fields, bIncludeOrExclude)) |
2944 » » » FX_BOOL bIncludeOrExclude = !(dwFlags & 0x01); | 2933 return FALSE; |
2945 » » » if (m_pInterForm->CheckRequiredFields(&fields, bIncludeO
rExclude)) | 2934 |
2946 » » » { | 2935 return SubmitFields(sDestination, fields, bIncludeOrExclude, FALSE); |
2947 » » » » return FALSE; | 2936 } |
2948 » » » } | 2937 } |
2949 » » » return SubmitFields(sDestination, fields, bIncludeOrExcl
ude, FALSE); | 2938 if (m_pInterForm->CheckRequiredFields()) |
2950 » » } | 2939 return FALSE; |
2951 » » else | 2940 |
2952 » » { | 2941 return SubmitForm(sDestination, FALSE); |
2953 » » » if ( m_pInterForm->CheckRequiredFields()) | |
2954 » » » { | |
2955 » » » » return FALSE; | |
2956 » » » } | |
2957 | |
2958 » » » return SubmitForm(sDestination, FALSE); | |
2959 » » } | |
2960 » } | |
2961 » else | |
2962 » { | |
2963 » » if ( m_pInterForm->CheckRequiredFields()) | |
2964 » » { | |
2965 » » » return FALSE; | |
2966 » » } | |
2967 | |
2968 » » return SubmitForm(sDestination, FALSE); | |
2969 » } | |
2970 } | 2942 } |
2971 | 2943 |
2972 FX_BOOL CPDFSDK_InterForm::SubmitFields(const CFX_WideString& csDestination, con
st CFX_PtrArray& fields, | 2944 FX_BOOL CPDFSDK_InterForm::SubmitFields(const CFX_WideString& csDestination, con
st CFX_PtrArray& fields, |
2973 » » » » » » » » » FX_BOOL
bIncludeOrExclude, FX_BOOL bUrlEncoded) | 2945 FX_BOOL bIncludeOrExclude, FX_BOOL bUrlEncod
ed) |
2974 { | 2946 { |
2975 » CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); | 2947 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); |
2976 » ASSERT(pEnv != NULL); | 2948 ASSERT(pEnv != NULL); |
2977 | 2949 |
2978 » CFX_ByteTextBuf textBuf; | 2950 CFX_ByteTextBuf textBuf; |
2979 » ExportFieldsToFDFTextBuf(fields, bIncludeOrExclude, textBuf); | 2951 ExportFieldsToFDFTextBuf(fields, bIncludeOrExclude, textBuf); |
2980 | 2952 |
2981 » uint8_t* pBuffer = textBuf.GetBuffer(); | 2953 uint8_t* pBuffer = textBuf.GetBuffer(); |
2982 » FX_STRSIZE nBufSize = textBuf.GetLength(); | 2954 FX_STRSIZE nBufSize = textBuf.GetLength(); |
2983 | 2955 |
2984 » if (bUrlEncoded) | 2956 if (bUrlEncoded) |
2985 » { | 2957 { |
2986 » » if(!FDFToURLEncodedData(pBuffer, nBufSize)) | 2958 if(!FDFToURLEncodedData(pBuffer, nBufSize)) |
2987 » » » return FALSE; | 2959 return FALSE; |
2988 » } | 2960 } |
2989 | 2961 |
2990 » pEnv->JS_docSubmitForm(pBuffer, nBufSize, csDestination.c_str()); | 2962 pEnv->JS_docSubmitForm(pBuffer, nBufSize, csDestination.c_str()); |
2991 | 2963 |
2992 » return TRUE; | 2964 return TRUE; |
2993 } | 2965 } |
2994 | 2966 |
2995 void CPDFSDK_InterForm::DoFDFBuffer(CFX_ByteString sBuffer) | 2967 void CPDFSDK_InterForm::DoFDFBuffer(CFX_ByteString sBuffer) |
2996 { | 2968 { |
2997 » ASSERT(m_pDocument != NULL); | 2969 ASSERT(m_pDocument != NULL); |
2998 | 2970 |
2999 » if (CFDF_Document *pFDFDocument = CFDF_Document::ParseMemory((const unsi
gned char *)sBuffer.GetBuffer(sBuffer.GetLength()), sBuffer.GetLength())) | 2971 if (CFDF_Document *pFDFDocument = CFDF_Document::ParseMemory((const unsigned
char *)sBuffer.GetBuffer(sBuffer.GetLength()), sBuffer.GetLength())) |
3000 » { | 2972 { |
3001 » » CPDF_Dictionary* pRootDic = pFDFDocument->GetRoot(); | 2973 CPDF_Dictionary* pRootDic = pFDFDocument->GetRoot(); |
3002 » » if(pRootDic) | 2974 if(pRootDic) |
3003 » » { | 2975 { |
3004 » » » CPDF_Dictionary * pFDFDict=pRootDic->GetDict("FDF"); | 2976 CPDF_Dictionary * pFDFDict=pRootDic->GetDict("FDF"); |
3005 » » » if(pFDFDict) | 2977 if(pFDFDict) |
3006 » » » { | 2978 { |
3007 » » » » CPDF_Dictionary * pJSDict = pFDFDict->GetDict("J
avaScript"); | 2979 CPDF_Dictionary * pJSDict = pFDFDict->GetDict("JavaScript"); |
3008 » » » » if(pJSDict) | 2980 if(pJSDict) |
3009 » » » » { | 2981 { |
3010 » » » » » CFX_WideString csJS; | 2982 CFX_WideString csJS; |
3011 | 2983 |
3012 » » » » » CPDF_Object* pJS = pJSDict->GetElementVa
lue("Before"); | 2984 CPDF_Object* pJS = pJSDict->GetElementValue("Before"); |
3013 » » » » » if (pJS != NULL) | 2985 if (pJS != NULL) |
3014 » » » » » { | 2986 { |
3015 » » » » » » int iType = pJS->GetType(); | 2987 int iType = pJS->GetType(); |
3016 » » » » » » if (iType == PDFOBJ_STRING) | 2988 if (iType == PDFOBJ_STRING) |
3017 » » » » » » » csJS = pJSDict->GetUnico
deText("Before"); | 2989 csJS = pJSDict->GetUnicodeText("Before"); |
3018 » » » » » » else if (iType == PDFOBJ_STREAM) | 2990 else if (iType == PDFOBJ_STREAM) |
3019 » » » » » » » csJS = pJS->GetUnicodeTe
xt(); | 2991 csJS = pJS->GetUnicodeText(); |
3020 » » » » » } | 2992 } |
3021 | 2993 |
3022 » » » » } | 2994 } |
3023 » » » } | 2995 } |
3024 » » } | 2996 } |
3025 » » delete pFDFDocument; | 2997 delete pFDFDocument; |
3026 » } | 2998 } |
3027 | 2999 |
3028 » sBuffer.ReleaseBuffer(); | 3000 sBuffer.ReleaseBuffer(); |
3029 } | 3001 } |
3030 | 3002 |
3031 FX_BOOL CPDFSDK_InterForm::FDFToURLEncodedData(CFX_WideString csFDFFile, CFX_Wid
eString csTxtFile) | 3003 FX_BOOL CPDFSDK_InterForm::FDFToURLEncodedData(CFX_WideString csFDFFile, CFX_Wid
eString csTxtFile) |
3032 { | 3004 { |
3033 » return TRUE; | 3005 return TRUE; |
3034 } | 3006 } |
3035 | 3007 |
3036 FX_BOOL CPDFSDK_InterForm::FDFToURLEncodedData(uint8_t*& pBuf, FX_STRSIZE& nBufS
ize) | 3008 FX_BOOL CPDFSDK_InterForm::FDFToURLEncodedData(uint8_t*& pBuf, FX_STRSIZE& nBufS
ize) |
3037 { | 3009 { |
3038 » CFDF_Document* pFDF = CFDF_Document::ParseMemory(pBuf, nBufSize); | 3010 CFDF_Document* pFDF = CFDF_Document::ParseMemory(pBuf, nBufSize); |
3039 » if (pFDF) | 3011 if (pFDF) |
3040 » { | 3012 { |
3041 » » CPDF_Dictionary* pMainDict = pFDF->GetRoot()->GetDict("FDF"); | 3013 CPDF_Dictionary* pMainDict = pFDF->GetRoot()->GetDict("FDF"); |
3042 » » if (pMainDict == NULL) return FALSE; | 3014 if (pMainDict == NULL) return FALSE; |
3043 | 3015 |
3044 » » // Get fields | 3016 // Get fields |
3045 » » CPDF_Array* pFields = pMainDict->GetArray("Fields"); | 3017 CPDF_Array* pFields = pMainDict->GetArray("Fields"); |
3046 » » if (pFields == NULL) return FALSE; | 3018 if (pFields == NULL) return FALSE; |
3047 | 3019 |
3048 » » CFX_ByteTextBuf fdfEncodedData; | 3020 CFX_ByteTextBuf fdfEncodedData; |
3049 | 3021 |
3050 » » for (FX_DWORD i = 0; i < pFields->GetCount(); i ++) | 3022 for (FX_DWORD i = 0; i < pFields->GetCount(); i ++) |
3051 » » { | 3023 { |
3052 » » » CPDF_Dictionary* pField = pFields->GetDict(i); | 3024 CPDF_Dictionary* pField = pFields->GetDict(i); |
3053 » » » if (pField == NULL) continue; | 3025 if (pField == NULL) continue; |
3054 » » » CFX_WideString name; | 3026 CFX_WideString name; |
3055 » » » name = pField->GetUnicodeText("T"); | 3027 name = pField->GetUnicodeText("T"); |
3056 » » » CFX_ByteString name_b = CFX_ByteString::FromUnicode(name
); | 3028 CFX_ByteString name_b = CFX_ByteString::FromUnicode(name); |
3057 » » » CFX_ByteString csBValue = pField->GetString("V"); | 3029 CFX_ByteString csBValue = pField->GetString("V"); |
3058 » » » CFX_WideString csWValue = PDF_DecodeText(csBValue); | 3030 CFX_WideString csWValue = PDF_DecodeText(csBValue); |
3059 » » » CFX_ByteString csValue_b = CFX_ByteString::FromUnicode(c
sWValue); | 3031 CFX_ByteString csValue_b = CFX_ByteString::FromUnicode(csWValue); |
3060 | 3032 |
3061 » » » fdfEncodedData = fdfEncodedData<<name_b.GetBuffer(name_b
.GetLength()); | 3033 fdfEncodedData = fdfEncodedData<<name_b.GetBuffer(name_b.GetLength()
); |
3062 » » » name_b.ReleaseBuffer(); | 3034 name_b.ReleaseBuffer(); |
3063 » » » fdfEncodedData = fdfEncodedData<<"="; | 3035 fdfEncodedData = fdfEncodedData<<"="; |
3064 » » » fdfEncodedData = fdfEncodedData<<csValue_b.GetBuffer(csV
alue_b.GetLength()); | 3036 fdfEncodedData = fdfEncodedData<<csValue_b.GetBuffer(csValue_b.GetLe
ngth()); |
3065 » » » csValue_b.ReleaseBuffer(); | 3037 csValue_b.ReleaseBuffer(); |
3066 » » » if(i != pFields->GetCount()-1) | 3038 if(i != pFields->GetCount()-1) |
3067 » » » » fdfEncodedData = fdfEncodedData<<"&"; | 3039 fdfEncodedData = fdfEncodedData<<"&"; |
3068 » » } | 3040 } |
3069 | 3041 |
3070 » » nBufSize = fdfEncodedData.GetLength(); | 3042 nBufSize = fdfEncodedData.GetLength(); |
3071 » » pBuf = FX_Alloc(uint8_t, nBufSize); | 3043 pBuf = FX_Alloc(uint8_t, nBufSize); |
3072 » » FXSYS_memcpy(pBuf, fdfEncodedData.GetBuffer(), nBufSize); | 3044 FXSYS_memcpy(pBuf, fdfEncodedData.GetBuffer(), nBufSize); |
3073 » } | 3045 } |
3074 » return TRUE; | 3046 return TRUE; |
3075 } | 3047 } |
3076 | 3048 |
3077 FX_BOOL CPDFSDK_InterForm::ExportFieldsToFDFTextBuf(const CFX_PtrArray& fields,F
X_BOOL bIncludeOrExclude, CFX_ByteTextBuf& textBuf) | 3049 FX_BOOL CPDFSDK_InterForm::ExportFieldsToFDFTextBuf(const CFX_PtrArray& fields,F
X_BOOL bIncludeOrExclude, CFX_ByteTextBuf& textBuf) |
3078 { | 3050 { |
3079 » ASSERT(m_pDocument != NULL); | 3051 ASSERT(m_pDocument != NULL); |
3080 » ASSERT(m_pInterForm != NULL); | 3052 ASSERT(m_pInterForm != NULL); |
3081 | 3053 |
3082 » CFDF_Document* pFDF = m_pInterForm->ExportToFDF(m_pDocument->GetPath(),(
CFX_PtrArray&)fields, bIncludeOrExclude); | 3054 CFDF_Document* pFDF = m_pInterForm->ExportToFDF(m_pDocument->GetPath(),(CFX_
PtrArray&)fields, bIncludeOrExclude); |
3083 » if (!pFDF) return FALSE; | 3055 if (!pFDF) return FALSE; |
3084 » FX_BOOL bRet = pFDF->WriteBuf(textBuf); // = FALSE;// | 3056 FX_BOOL bRet = pFDF->WriteBuf(textBuf); // = FALSE;// |
3085 » delete pFDF; | 3057 delete pFDF; |
3086 | 3058 |
3087 » return bRet; | 3059 return bRet; |
3088 } | 3060 } |
3089 | 3061 |
3090 void CPDFSDK_InterForm::SynchronizeField(CPDF_FormField* pFormField, FX_BOOL bSy
nchronizeElse) | 3062 void CPDFSDK_InterForm::SynchronizeField(CPDF_FormField* pFormField, FX_BOOL bSy
nchronizeElse) |
3091 { | 3063 { |
3092 ASSERT(pFormField != NULL); | 3064 ASSERT(pFormField != NULL); |
3093 | 3065 |
3094 int x = 0; | 3066 int x = 0; |
3095 if (m_FieldSynchronizeMap.Lookup(pFormField, x)) | 3067 if (m_FieldSynchronizeMap.Lookup(pFormField, x)) |
3096 return; | 3068 return; |
3097 | 3069 |
3098 for (int i=0,sz=pFormField->CountControls(); i<sz; i++) | 3070 for (int i=0,sz=pFormField->CountControls(); i<sz; i++) |
3099 { | 3071 { |
3100 CPDF_FormControl* pFormCtrl = pFormField->GetControl(i); | 3072 CPDF_FormControl* pFormCtrl = pFormField->GetControl(i); |
3101 ASSERT(pFormCtrl != NULL); | 3073 ASSERT(pFormCtrl != NULL); |
3102 | 3074 |
3103 ASSERT(m_pInterForm != NULL); | 3075 ASSERT(m_pInterForm != NULL); |
3104 if (CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl)) | 3076 if (CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl)) |
3105 { | 3077 { |
3106 pWidget->Synchronize(bSynchronizeElse); | 3078 pWidget->Synchronize(bSynchronizeElse); |
3107 } | 3079 } |
3108 } | 3080 } |
3109 } | 3081 } |
3110 | 3082 |
3111 CFX_WideString CPDFSDK_InterForm::GetTemporaryFileName(const CFX_WideString& sFi
leExt) | 3083 CFX_WideString CPDFSDK_InterForm::GetTemporaryFileName(const CFX_WideString& sFi
leExt) |
3112 { | 3084 { |
3113 » CFX_WideString sFileName; | 3085 CFX_WideString sFileName; |
3114 » return L""; | 3086 return L""; |
3115 } | 3087 } |
3116 | 3088 |
3117 FX_BOOL CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination, FX_BOO
L bUrlEncoded) | 3089 FX_BOOL CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination, FX_BOO
L bUrlEncoded) |
3118 { | 3090 { |
3119 » if (sDestination.IsEmpty()) return FALSE; | 3091 if (sDestination.IsEmpty()) return FALSE; |
3120 | 3092 |
3121 » CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); | 3093 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); |
3122 » ASSERT(pEnv != NULL); | 3094 ASSERT(pEnv != NULL); |
3123 | 3095 |
3124 » if(NULL == m_pDocument) return FALSE; | 3096 if(NULL == m_pDocument) return FALSE; |
3125 » CFX_WideString wsPDFFilePath = m_pDocument->GetPath(); | 3097 CFX_WideString wsPDFFilePath = m_pDocument->GetPath(); |
3126 | 3098 |
3127 » if(NULL == m_pInterForm) return FALSE; | 3099 if(NULL == m_pInterForm) return FALSE; |
3128 » CFDF_Document* pFDFDoc = m_pInterForm->ExportToFDF(wsPDFFilePath); | 3100 CFDF_Document* pFDFDoc = m_pInterForm->ExportToFDF(wsPDFFilePath); |
3129 » if (NULL == pFDFDoc) return FALSE; | 3101 if (NULL == pFDFDoc) return FALSE; |
3130 | 3102 |
3131 » CFX_ByteTextBuf FdfBuffer; | 3103 CFX_ByteTextBuf FdfBuffer; |
3132 » FX_BOOL bRet = pFDFDoc->WriteBuf(FdfBuffer); | 3104 FX_BOOL bRet = pFDFDoc->WriteBuf(FdfBuffer); |
3133 » delete pFDFDoc; | 3105 delete pFDFDoc; |
3134 » if (!bRet) return FALSE; | 3106 if (!bRet) return FALSE; |
3135 | 3107 |
3136 » uint8_t* pBuffer = FdfBuffer.GetBuffer(); | 3108 uint8_t* pBuffer = FdfBuffer.GetBuffer(); |
3137 » FX_STRSIZE nBufSize = FdfBuffer.GetLength(); | 3109 FX_STRSIZE nBufSize = FdfBuffer.GetLength(); |
3138 | 3110 |
3139 » if (bUrlEncoded) | 3111 if (bUrlEncoded) |
3140 » { | 3112 { |
3141 » » if(!FDFToURLEncodedData(pBuffer, nBufSize)) | 3113 if(!FDFToURLEncodedData(pBuffer, nBufSize)) |
3142 » » » return FALSE; | 3114 return FALSE; |
3143 » } | 3115 } |
3144 | 3116 |
3145 » pEnv->JS_docSubmitForm(pBuffer, nBufSize, sDestination.c_str()); | 3117 pEnv->JS_docSubmitForm(pBuffer, nBufSize, sDestination.c_str()); |
3146 | 3118 |
3147 » if (bUrlEncoded && pBuffer) | 3119 if (bUrlEncoded && pBuffer) |
3148 » { | 3120 { |
3149 » » FX_Free(pBuffer); | 3121 FX_Free(pBuffer); |
3150 » » pBuffer = NULL; | 3122 pBuffer = NULL; |
3151 » } | 3123 } |
3152 | 3124 |
3153 » return TRUE; | 3125 return TRUE; |
3154 } | 3126 } |
3155 | 3127 |
3156 FX_BOOL CPDFSDK_InterForm::ExportFormToFDFTextBuf(CFX_ByteTextBuf& textBuf) | 3128 FX_BOOL CPDFSDK_InterForm::ExportFormToFDFTextBuf(CFX_ByteTextBuf& textBuf) |
3157 { | 3129 { |
3158 | 3130 |
3159 » ASSERT(m_pInterForm != NULL); | 3131 ASSERT(m_pInterForm != NULL); |
3160 » ASSERT(m_pDocument != NULL); | 3132 ASSERT(m_pDocument != NULL); |
3161 | 3133 |
3162 » CFDF_Document* pFDF = m_pInterForm->ExportToFDF(m_pDocument->GetPath()); | 3134 CFDF_Document* pFDF = m_pInterForm->ExportToFDF(m_pDocument->GetPath()); |
3163 » if (!pFDF) return FALSE; | 3135 if (!pFDF) return FALSE; |
3164 | 3136 |
3165 » FX_BOOL bRet = pFDF->WriteBuf(textBuf); | 3137 FX_BOOL bRet = pFDF->WriteBuf(textBuf); |
3166 » delete pFDF; | 3138 delete pFDF; |
3167 | 3139 |
3168 » return bRet; | 3140 return bRet; |
3169 } | 3141 } |
3170 | 3142 |
3171 | 3143 |
3172 FX_BOOL CPDFSDK_InterForm::DoAction_ResetForm(const CPDF_Action& action) | 3144 FX_BOOL CPDFSDK_InterForm::DoAction_ResetForm(const CPDF_Action& action) |
3173 { | 3145 { |
3174 » ASSERT(action); | 3146 ASSERT(action); |
3175 | 3147 |
3176 » CPDF_Dictionary* pActionDict = action.GetDict(); | 3148 CPDF_Dictionary* pActionDict = action.GetDict(); |
3177 » if (pActionDict->KeyExist("Fields")) | 3149 if (pActionDict->KeyExist("Fields")) |
3178 » { | 3150 { |
3179 » » CPDF_ActionFields af = action.GetWidgets(); | 3151 CPDF_ActionFields af = action.GetWidgets(); |
3180 » » FX_DWORD dwFlags = action.GetFlags(); | 3152 FX_DWORD dwFlags = action.GetFlags(); |
3181 | 3153 |
3182 » » CFX_PtrArray fieldObjects; | 3154 CFX_PtrArray fieldObjects; |
3183 » » af.GetAllFields(fieldObjects); | 3155 af.GetAllFields(fieldObjects); |
3184 » » CFX_PtrArray fields; | 3156 CFX_PtrArray fields; |
3185 » » GetFieldFromObjects(fieldObjects, fields); | 3157 GetFieldFromObjects(fieldObjects, fields); |
3186 » » return m_pInterForm->ResetForm(fields, !(dwFlags & 0x01), TRUE); | 3158 return m_pInterForm->ResetForm(fields, !(dwFlags & 0x01), TRUE); |
3187 » } | 3159 } |
3188 | 3160 |
3189 » return m_pInterForm->ResetForm(TRUE); | 3161 return m_pInterForm->ResetForm(TRUE); |
3190 } | 3162 } |
3191 | 3163 |
3192 FX_BOOL CPDFSDK_InterForm::DoAction_ImportData(const CPDF_Action& action) | 3164 FX_BOOL CPDFSDK_InterForm::DoAction_ImportData(const CPDF_Action& action) |
3193 { | 3165 { |
3194 » return FALSE; | 3166 return FALSE; |
3195 } | 3167 } |
3196 | 3168 |
3197 void CPDFSDK_InterForm::GetFieldFromObjects(const CFX_PtrArray& objects, CFX_Ptr
Array& fields) | 3169 void CPDFSDK_InterForm::GetFieldFromObjects(const CFX_PtrArray& objects, CFX_Ptr
Array& fields) |
3198 { | 3170 { |
3199 » ASSERT(m_pInterForm != NULL); | 3171 ASSERT(m_pInterForm != NULL); |
3200 | 3172 |
3201 » int iCount = objects.GetSize(); | 3173 int iCount = objects.GetSize(); |
3202 » for (int i = 0; i < iCount; i ++) | 3174 for (int i = 0; i < iCount; i ++) |
3203 » { | 3175 { |
3204 » » CPDF_Object* pObject = (CPDF_Object*)objects[i]; | 3176 CPDF_Object* pObject = (CPDF_Object*)objects[i]; |
3205 » » if (pObject == NULL) continue; | 3177 if (pObject == NULL) continue; |
3206 | 3178 |
3207 » » int iType = pObject->GetType(); | 3179 int iType = pObject->GetType(); |
3208 » » if (iType == PDFOBJ_STRING) | 3180 if (iType == PDFOBJ_STRING) |
3209 » » { | 3181 { |
3210 » » » CFX_WideString csName = pObject->GetUnicodeText(); | 3182 CFX_WideString csName = pObject->GetUnicodeText(); |
3211 » » » CPDF_FormField* pField = m_pInterForm->GetField(0, csNam
e); | 3183 CPDF_FormField* pField = m_pInterForm->GetField(0, csName); |
3212 » » » if (pField != NULL) | 3184 if (pField != NULL) |
3213 » » » » fields.Add(pField); | 3185 fields.Add(pField); |
3214 » » } | 3186 } |
3215 » » else if (iType == PDFOBJ_DICTIONARY) | 3187 else if (iType == PDFOBJ_DICTIONARY) |
3216 » » { | 3188 { |
3217 » » » if (m_pInterForm->IsValidFormField(pObject)) | 3189 if (m_pInterForm->IsValidFormField(pObject)) |
3218 » » » » fields.Add(pObject); | 3190 fields.Add(pObject); |
3219 » » } | 3191 } |
3220 » } | 3192 } |
3221 } | 3193 } |
3222 | 3194 |
3223 /* ----------------------------- CPDF_FormNotify ----------------------------- *
/ | 3195 /* ----------------------------- CPDF_FormNotify ----------------------------- *
/ |
3224 | 3196 |
3225 int» CPDFSDK_InterForm::BeforeValueChange(const CPDF_FormField* pField, CFX_W
ideString& csValue) | 3197 int CPDFSDK_InterForm::BeforeValueChange(const CPDF_FormField* pField, CFX_WideS
tring& csValue) |
3226 { | 3198 { |
3227 » ASSERT(pField != NULL); | 3199 CPDF_FormField* pFormField = (CPDF_FormField*)pField; |
3228 | 3200 int nType = pFormField->GetFieldType(); |
3229 » CPDF_FormField* pFormField = (CPDF_FormField*)pField; | 3201 if (nType == FIELDTYPE_COMBOBOX || nType == FIELDTYPE_TEXTFIELD) |
3230 | 3202 { |
3231 » int nType = pFormField->GetFieldType(); | 3203 FX_BOOL bRC = TRUE; |
3232 » if (nType == FIELDTYPE_COMBOBOX || nType == FIELDTYPE_TEXTFIELD) | 3204 OnKeyStrokeCommit(pFormField, csValue, bRC); |
3233 » { | 3205 if (bRC) |
3234 » » FX_BOOL bRC = TRUE; | 3206 { |
3235 » » OnKeyStrokeCommit(pFormField, csValue, bRC); | 3207 OnValidate(pFormField, csValue, bRC); |
3236 » » if (bRC) | 3208 return bRC ? 1 : -1; |
3237 » » { | 3209 } |
3238 » » » OnValidate(pFormField, csValue, bRC); | 3210 return -1; |
3239 » » » if (bRC) | 3211 } |
3240 » » » » return 1; | 3212 return 0; |
3241 » » » else | |
3242 » » » » return -1; | |
3243 » » } | |
3244 » » else | |
3245 » » » return -1; | |
3246 » } | |
3247 » else | |
3248 » » return 0; | |
3249 } | 3213 } |
3250 | 3214 |
3251 int CPDFSDK_InterForm::AfterValueChange(const CPDF_FormField* pField) | 3215 int CPDFSDK_InterForm::AfterValueChange(const CPDF_FormField* pField) |
3252 { | 3216 { |
3253 ASSERT(pField != NULL); | 3217 ASSERT(pField != NULL); |
3254 | 3218 |
3255 CPDF_FormField* pFormField = (CPDF_FormField*)pField; | 3219 CPDF_FormField* pFormField = (CPDF_FormField*)pField; |
3256 | 3220 |
3257 SynchronizeField(pFormField, FALSE); | 3221 SynchronizeField(pFormField, FALSE); |
3258 | 3222 |
3259 int nType = pFormField->GetFieldType(); | 3223 int nType = pFormField->GetFieldType(); |
3260 | 3224 |
3261 if (nType == FIELDTYPE_COMBOBOX || nType == FIELDTYPE_TEXTFIELD) | 3225 if (nType == FIELDTYPE_COMBOBOX || nType == FIELDTYPE_TEXTFIELD) |
3262 { | 3226 { |
3263 OnCalculate(pFormField); | 3227 OnCalculate(pFormField); |
3264 FX_BOOL bFormated = FALSE; | 3228 FX_BOOL bFormated = FALSE; |
3265 CFX_WideString sValue = OnFormat(pFormField, bFormated); | 3229 CFX_WideString sValue = OnFormat(pFormField, bFormated); |
3266 if (bFormated) | 3230 if (bFormated) |
3267 ResetFieldAppearance(pFormField, sValue.c_str(), TRUE); | 3231 ResetFieldAppearance(pFormField, sValue.c_str(), TRUE); |
3268 else | 3232 else |
3269 ResetFieldAppearance(pFormField, NULL, TRUE); | 3233 ResetFieldAppearance(pFormField, NULL, TRUE); |
3270 UpdateField(pFormField); | 3234 UpdateField(pFormField); |
3271 } | 3235 } |
3272 | 3236 |
3273 return 0; | 3237 return 0; |
3274 } | 3238 } |
3275 | 3239 |
3276 int» CPDFSDK_InterForm::BeforeSelectionChange(const CPDF_FormField* pField, C
FX_WideString& csValue) | 3240 int CPDFSDK_InterForm::BeforeSelectionChange(const CPDF_FormField* pField, CFX_W
ideString& csValue) |
3277 { | 3241 { |
3278 » ASSERT(pField != NULL); | 3242 CPDF_FormField* pFormField = (CPDF_FormField*)pField; |
| 3243 if (pFormField->GetFieldType() != FIELDTYPE_LISTBOX) |
| 3244 return 0; |
3279 | 3245 |
3280 » CPDF_FormField* pFormField = (CPDF_FormField*)pField; | 3246 FX_BOOL bRC = TRUE; |
| 3247 OnKeyStrokeCommit(pFormField, csValue, bRC); |
| 3248 if (!bRC) |
| 3249 return -1; |
3281 | 3250 |
3282 » int nType = pFormField->GetFieldType(); | 3251 OnValidate(pFormField, csValue, bRC); |
3283 » if (nType == FIELDTYPE_LISTBOX) | 3252 if (!bRC) |
3284 » { | 3253 return -1; |
3285 » » FX_BOOL bRC = TRUE; | 3254 |
3286 » » OnKeyStrokeCommit(pFormField, csValue, bRC); | 3255 return 1; |
3287 » » if (bRC) | |
3288 » » { | |
3289 » » » OnValidate(pFormField, csValue, bRC); | |
3290 » » » if (bRC) | |
3291 » » » » return 1; | |
3292 » » » else | |
3293 » » » » return -1; | |
3294 » » } | |
3295 » » else | |
3296 » » » return -1; | |
3297 » } | |
3298 » else | |
3299 » » return 0; | |
3300 } | 3256 } |
3301 | 3257 |
3302 int» CPDFSDK_InterForm::AfterSelectionChange(const CPDF_FormField* pField) | 3258 int CPDFSDK_InterForm::AfterSelectionChange(const CPDF_FormField* pField) |
3303 { | 3259 { |
3304 » ASSERT(pField != NULL); | 3260 CPDF_FormField* pFormField = (CPDF_FormField*)pField; |
3305 | 3261 if (pFormField->GetFieldType() == FIELDTYPE_LISTBOX) |
3306 » CPDF_FormField* pFormField = (CPDF_FormField*)pField; | 3262 { |
3307 » int nType = pFormField->GetFieldType(); | 3263 OnCalculate(pFormField); |
3308 | 3264 ResetFieldAppearance(pFormField, NULL, TRUE); |
3309 » if (nType == FIELDTYPE_LISTBOX) | 3265 UpdateField(pFormField); |
3310 » { | 3266 } |
3311 » » OnCalculate(pFormField); | 3267 return 0; |
3312 » » ResetFieldAppearance(pFormField, NULL, TRUE); | |
3313 » » UpdateField(pFormField); | |
3314 » } | |
3315 | |
3316 » return 0; | |
3317 } | 3268 } |
3318 | 3269 |
3319 int» CPDFSDK_InterForm::AfterCheckedStatusChange(const CPDF_FormField* pField
, const CFX_ByteArray& statusArray) | 3270 int CPDFSDK_InterForm::AfterCheckedStatusChange(const CPDF_FormField* pField, co
nst CFX_ByteArray& statusArray) |
3320 { | 3271 { |
3321 » ASSERT(pField != NULL); | 3272 CPDF_FormField* pFormField = (CPDF_FormField*)pField; |
3322 | 3273 int nType = pFormField->GetFieldType(); |
3323 » CPDF_FormField* pFormField = (CPDF_FormField*)pField; | 3274 if (nType == FIELDTYPE_CHECKBOX || nType == FIELDTYPE_RADIOBUTTON) |
3324 » int nType = pFormField->GetFieldType(); | 3275 { |
3325 | 3276 OnCalculate(pFormField); |
3326 » if (nType == FIELDTYPE_CHECKBOX || nType == FIELDTYPE_RADIOBUTTON) | 3277 UpdateField(pFormField); |
3327 » { | 3278 } |
3328 » » OnCalculate(pFormField); | 3279 return 0; |
3329 » » UpdateField(pFormField); | |
3330 » } | |
3331 | |
3332 » return 0; | |
3333 } | 3280 } |
3334 | 3281 |
3335 int» CPDFSDK_InterForm::BeforeFormReset(const CPDF_InterForm* pForm) | 3282 int CPDFSDK_InterForm::BeforeFormReset(const CPDF_InterForm* pForm) |
3336 { | 3283 { |
3337 » return 0; | 3284 return 0; |
3338 } | 3285 } |
3339 | 3286 |
3340 int» CPDFSDK_InterForm::AfterFormReset(const CPDF_InterForm* pForm) | 3287 int CPDFSDK_InterForm::AfterFormReset(const CPDF_InterForm* pForm) |
3341 { | 3288 { |
3342 OnCalculate(nullptr); | 3289 OnCalculate(nullptr); |
3343 return 0; | 3290 return 0; |
3344 } | 3291 } |
3345 | 3292 |
3346 int» CPDFSDK_InterForm::BeforeFormImportData(const CPDF_InterForm* pForm) | 3293 int CPDFSDK_InterForm::BeforeFormImportData(const CPDF_InterForm* pForm) |
3347 { | 3294 { |
3348 » return 0; | 3295 return 0; |
3349 } | 3296 } |
3350 | 3297 |
3351 int» CPDFSDK_InterForm::AfterFormImportData(const CPDF_InterForm* pForm) | 3298 int CPDFSDK_InterForm::AfterFormImportData(const CPDF_InterForm* pForm) |
3352 { | 3299 { |
3353 OnCalculate(nullptr); | 3300 OnCalculate(nullptr); |
3354 return 0; | 3301 return 0; |
3355 } | 3302 } |
3356 | 3303 |
3357 FX_BOOL CPDFSDK_InterForm::IsNeedHighLight(int nFieldType) | 3304 FX_BOOL CPDFSDK_InterForm::IsNeedHighLight(int nFieldType) |
3358 { | 3305 { |
3359 if(nFieldType <1 || nFieldType > 7) | 3306 if(nFieldType <1 || nFieldType > 7) |
3360 return FALSE; | 3307 return FALSE; |
3361 return m_bNeedHightlight[nFieldType-1]; | 3308 return m_bNeedHightlight[nFieldType-1]; |
(...skipping 22 matching lines...) Expand all Loading... |
3384 m_aHighlightColor[nFieldType-1] = clr; | 3331 m_aHighlightColor[nFieldType-1] = clr; |
3385 m_bNeedHightlight[nFieldType-1] = TRUE; | 3332 m_bNeedHightlight[nFieldType-1] = TRUE; |
3386 break; | 3333 break; |
3387 } | 3334 } |
3388 } | 3335 } |
3389 | 3336 |
3390 } | 3337 } |
3391 | 3338 |
3392 FX_COLORREF CPDFSDK_InterForm::GetHighlightColor(int nFieldType) | 3339 FX_COLORREF CPDFSDK_InterForm::GetHighlightColor(int nFieldType) |
3393 { | 3340 { |
3394 » if(nFieldType <0 || nFieldType >7) return FXSYS_RGB(255,255,255); | 3341 » if (nFieldType < 0 || nFieldType > 7) |
3395 » if(nFieldType == 0) | 3342 return FXSYS_RGB(255,255,255); |
| 3343 » if (nFieldType == 0) |
3396 return m_aHighlightColor[0]; | 3344 return m_aHighlightColor[0]; |
3397 » else | 3345 return m_aHighlightColor[nFieldType-1]; |
3398 » » return m_aHighlightColor[nFieldType-1]; | |
3399 } | 3346 } |
3400 | 3347 |
3401 /* ------------------------- CBA_AnnotIterator ------------------------- */ | 3348 /* ------------------------- CBA_AnnotIterator ------------------------- */ |
3402 | 3349 |
3403 CBA_AnnotIterator::CBA_AnnotIterator(CPDFSDK_PageView* pPageView, const CFX_Byte
String& sType, const CFX_ByteString& sSubType) | 3350 CBA_AnnotIterator::CBA_AnnotIterator(CPDFSDK_PageView* pPageView, const CFX_Byte
String& sType, const CFX_ByteString& sSubType) |
3404 » :m_pPageView(pPageView), | 3351 :m_pPageView(pPageView), |
3405 » m_sType(sType), | 3352 m_sType(sType), |
3406 » m_sSubType(sSubType), | 3353 m_sSubType(sSubType), |
3407 » m_nTabs(BAI_STRUCTURE) | 3354 m_nTabs(BAI_STRUCTURE) |
3408 { | 3355 { |
3409 » ASSERT(m_pPageView != NULL); | 3356 ASSERT(m_pPageView != NULL); |
3410 | 3357 |
3411 » CPDF_Page* pPDFPage = m_pPageView->GetPDFPage(); | 3358 CPDF_Page* pPDFPage = m_pPageView->GetPDFPage(); |
3412 » ASSERT(pPDFPage != NULL); | 3359 ASSERT(pPDFPage != NULL); |
3413 » ASSERT(pPDFPage->m_pFormDict != NULL); | 3360 ASSERT(pPDFPage->m_pFormDict != NULL); |
3414 | 3361 |
3415 » CFX_ByteString sTabs = pPDFPage->m_pFormDict->GetString("Tabs"); | 3362 CFX_ByteString sTabs = pPDFPage->m_pFormDict->GetString("Tabs"); |
3416 | 3363 |
3417 » if (sTabs == "R") | 3364 if (sTabs == "R") |
3418 » { | 3365 { |
3419 » » m_nTabs = BAI_ROW; | 3366 m_nTabs = BAI_ROW; |
3420 » } | 3367 } |
3421 » else if (sTabs == "C") | 3368 else if (sTabs == "C") |
3422 » { | 3369 { |
3423 » » m_nTabs = BAI_COLUMN; | 3370 m_nTabs = BAI_COLUMN; |
3424 » } | 3371 } |
3425 » else | 3372 else |
3426 » { | 3373 { |
3427 » » m_nTabs = BAI_STRUCTURE; | 3374 m_nTabs = BAI_STRUCTURE; |
3428 » } | 3375 } |
3429 | 3376 |
3430 » GenerateResults(); | 3377 GenerateResults(); |
3431 } | 3378 } |
3432 | 3379 |
3433 CBA_AnnotIterator::~CBA_AnnotIterator() | 3380 CBA_AnnotIterator::~CBA_AnnotIterator() |
3434 { | 3381 { |
3435 » m_Annots.RemoveAll(); | 3382 m_Annots.RemoveAll(); |
3436 } | 3383 } |
3437 | 3384 |
3438 CPDFSDK_Annot* CBA_AnnotIterator::GetFirstAnnot() | 3385 CPDFSDK_Annot* CBA_AnnotIterator::GetFirstAnnot() |
3439 { | 3386 { |
3440 » if (m_Annots.GetSize() > 0) | 3387 if (m_Annots.GetSize() > 0) |
3441 » » return m_Annots[0]; | 3388 return m_Annots[0]; |
3442 | 3389 |
3443 » return NULL; | 3390 return NULL; |
3444 } | 3391 } |
3445 | 3392 |
3446 CPDFSDK_Annot* CBA_AnnotIterator::GetLastAnnot() | 3393 CPDFSDK_Annot* CBA_AnnotIterator::GetLastAnnot() |
3447 { | 3394 { |
3448 » if (m_Annots.GetSize() > 0) | 3395 if (m_Annots.GetSize() > 0) |
3449 » » return m_Annots[m_Annots.GetSize() - 1]; | 3396 return m_Annots[m_Annots.GetSize() - 1]; |
3450 | 3397 |
3451 » return NULL; | 3398 return NULL; |
3452 } | 3399 } |
3453 | 3400 |
3454 CPDFSDK_Annot* CBA_AnnotIterator::GetNextAnnot(CPDFSDK_Annot* pAnnot) | 3401 CPDFSDK_Annot* CBA_AnnotIterator::GetNextAnnot(CPDFSDK_Annot* pAnnot) |
3455 { | 3402 { |
3456 » for (int i=0,sz=m_Annots.GetSize(); i<sz; i++) | 3403 for (int i = 0, sz = m_Annots.GetSize(); i < sz; ++i) { |
3457 » { | 3404 if (m_Annots[i] == pAnnot) |
3458 » » if (m_Annots[i] == pAnnot) | 3405 return (i + 1 < sz) ? m_Annots[i+1] : m_Annots[0]; |
3459 » » { | 3406 } |
3460 » » » if (i+1 < sz) | 3407 return NULL; |
3461 » » » » return m_Annots[i+1]; | |
3462 » » » else | |
3463 » » » » return m_Annots[0]; | |
3464 » » } | |
3465 » } | |
3466 | |
3467 » return NULL; | |
3468 } | 3408 } |
3469 | 3409 |
3470 CPDFSDK_Annot* CBA_AnnotIterator::GetPrevAnnot(CPDFSDK_Annot* pAnnot) | 3410 CPDFSDK_Annot* CBA_AnnotIterator::GetPrevAnnot(CPDFSDK_Annot* pAnnot) |
3471 { | 3411 { |
3472 » for (int i=0,sz=m_Annots.GetSize(); i<sz; i++) | 3412 for (int i = 0, sz = m_Annots.GetSize(); i < sz; ++i) { |
3473 » { | 3413 if (m_Annots[i] == pAnnot) |
3474 » » if (m_Annots[i] == pAnnot) | 3414 return (i - 1 >= 0) ? m_Annots[i-1] : m_Annots[sz-1]; |
3475 » » { | 3415 } |
3476 » » » if (i-1 >= 0) | 3416 return NULL; |
3477 » » » » return m_Annots[i-1]; | |
3478 » » » else | |
3479 » » » » return m_Annots[sz-1]; | |
3480 » » } | |
3481 » } | |
3482 | |
3483 » return NULL; | |
3484 } | 3417 } |
3485 | 3418 |
3486 int CBA_AnnotIterator::CompareByLeft(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2) | 3419 int CBA_AnnotIterator::CompareByLeft(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2) |
3487 { | 3420 { |
3488 » ASSERT(p1 != NULL); | 3421 ASSERT(p1); |
3489 » ASSERT(p2 != NULL); | 3422 ASSERT(p2); |
3490 | 3423 |
3491 » CPDF_Rect rcAnnot1 = GetAnnotRect(p1); | 3424 CPDF_Rect rcAnnot1 = GetAnnotRect(p1); |
3492 » CPDF_Rect rcAnnot2 = GetAnnotRect(p2); | 3425 CPDF_Rect rcAnnot2 = GetAnnotRect(p2); |
3493 | 3426 |
3494 » if (rcAnnot1.left < rcAnnot2.left) | 3427 if (rcAnnot1.left < rcAnnot2.left) |
3495 » » return -1; | 3428 return -1; |
3496 » if (rcAnnot1.left > rcAnnot2.left) | 3429 if (rcAnnot1.left > rcAnnot2.left) |
3497 » » return 1; | 3430 return 1; |
3498 » return 0; | 3431 return 0; |
3499 } | 3432 } |
3500 | 3433 |
3501 | 3434 |
3502 int CBA_AnnotIterator::CompareByTop(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2) | 3435 int CBA_AnnotIterator::CompareByTop(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2) |
3503 { | 3436 { |
3504 » ASSERT(p1 != NULL); | 3437 ASSERT(p1 != NULL); |
3505 » ASSERT(p2 != NULL); | 3438 ASSERT(p2 != NULL); |
3506 | 3439 |
3507 » CPDF_Rect rcAnnot1 = GetAnnotRect(p1); | 3440 CPDF_Rect rcAnnot1 = GetAnnotRect(p1); |
3508 » CPDF_Rect rcAnnot2 = GetAnnotRect(p2); | 3441 CPDF_Rect rcAnnot2 = GetAnnotRect(p2); |
3509 | 3442 |
3510 » if (rcAnnot1.top < rcAnnot2.top) | 3443 if (rcAnnot1.top < rcAnnot2.top) |
3511 » » return -1; | 3444 return -1; |
3512 » if (rcAnnot1.top > rcAnnot2.top) | 3445 if (rcAnnot1.top > rcAnnot2.top) |
3513 » » return 1; | 3446 return 1; |
3514 » return 0; | 3447 return 0; |
3515 } | 3448 } |
3516 | 3449 |
3517 void CBA_AnnotIterator::GenerateResults() | 3450 void CBA_AnnotIterator::GenerateResults() |
3518 { | 3451 { |
3519 ASSERT(m_pPageView != NULL); | 3452 ASSERT(m_pPageView != NULL); |
3520 | 3453 |
3521 switch (m_nTabs) | 3454 switch (m_nTabs) |
3522 { | 3455 { |
3523 case BAI_STRUCTURE: | 3456 case BAI_STRUCTURE: |
3524 { | 3457 { |
3525 for (int i=0,sz=m_pPageView->CountAnnots(); i<sz; i++) | 3458 for (int i=0,sz=m_pPageView->CountAnnots(); i<sz; i++) |
3526 { | 3459 { |
3527 CPDFSDK_Annot* pAnnot = m_pPageView->GetAnnot(i)
; | 3460 CPDFSDK_Annot* pAnnot = m_pPageView->GetAnnot(i); |
3528 ASSERT(pAnnot != NULL); | 3461 ASSERT(pAnnot != NULL); |
3529 | 3462 |
3530 if (pAnnot->GetType() == m_sType | 3463 if (pAnnot->GetType() == m_sType |
3531 && pAnnot->GetSubType() == m_sSubType) | 3464 && pAnnot->GetSubType() == m_sSubType) |
3532 m_Annots.Add(pAnnot); | 3465 m_Annots.Add(pAnnot); |
3533 } | 3466 } |
3534 } | 3467 } |
3535 break; | 3468 break; |
3536 case BAI_ROW: | 3469 case BAI_ROW: |
3537 { | 3470 { |
3538 CPDFSDK_SortAnnots sa; | 3471 CPDFSDK_SortAnnots sa; |
3539 | 3472 |
3540 { | 3473 { |
3541 | 3474 |
3542 for (int i=0,sz=m_pPageView->CountAnnots(); i<sz
; i++) | 3475 for (int i=0,sz=m_pPageView->CountAnnots(); i<sz; i++) |
3543 { | 3476 { |
3544 CPDFSDK_Annot* pAnnot = m_pPageView->Get
Annot(i); | 3477 CPDFSDK_Annot* pAnnot = m_pPageView->GetAnnot(i); |
3545 ASSERT(pAnnot != NULL); | 3478 ASSERT(pAnnot != NULL); |
3546 | 3479 |
3547 if (pAnnot->GetType() == m_sType | 3480 if (pAnnot->GetType() == m_sType |
3548 && pAnnot->GetSubType() == m_sSu
bType) | 3481 && pAnnot->GetSubType() == m_sSubType) |
3549 sa.Add(pAnnot); | 3482 sa.Add(pAnnot); |
3550 } | 3483 } |
3551 } | 3484 } |
3552 | 3485 |
3553 if (sa.GetSize() > 0) | 3486 if (sa.GetSize() > 0) |
3554 { | 3487 { |
3555 sa.Sort(CBA_AnnotIterator::CompareByLeft); | 3488 sa.Sort(CBA_AnnotIterator::CompareByLeft); |
3556 } | 3489 } |
3557 | 3490 |
3558 while (sa.GetSize() > 0) | 3491 while (sa.GetSize() > 0) |
3559 { | 3492 { |
3560 int nLeftTopIndex = -1; | 3493 int nLeftTopIndex = -1; |
3561 | 3494 |
3562 { | 3495 { |
3563 FX_FLOAT fTop = 0.0f; | 3496 FX_FLOAT fTop = 0.0f; |
3564 | 3497 |
3565 for (int i=sa.GetSize()-1; i>=0; i--) | 3498 for (int i=sa.GetSize()-1; i>=0; i--) |
3566 { | 3499 { |
3567 CPDFSDK_Annot* pAnnot = sa.GetAt
(i); | 3500 CPDFSDK_Annot* pAnnot = sa.GetAt(i); |
3568 ASSERT(pAnnot != NULL); | 3501 ASSERT(pAnnot != NULL); |
3569 | 3502 |
3570 CPDF_Rect rcAnnot = GetAnnotRect
(pAnnot); | 3503 CPDF_Rect rcAnnot = GetAnnotRect(pAnnot); |
3571 | 3504 |
3572 if (rcAnnot.top > fTop) | 3505 if (rcAnnot.top > fTop) |
3573 { | 3506 { |
3574 nLeftTopIndex = i; | 3507 nLeftTopIndex = i; |
3575 fTop = rcAnnot.top; | 3508 fTop = rcAnnot.top; |
3576 } | 3509 } |
3577 } | 3510 } |
3578 } | 3511 } |
3579 | 3512 |
3580 if (nLeftTopIndex >= 0) | 3513 if (nLeftTopIndex >= 0) |
3581 { | 3514 { |
3582 CPDFSDK_Annot* pLeftTopAnnot = sa.GetAt(
nLeftTopIndex); | 3515 CPDFSDK_Annot* pLeftTopAnnot = sa.GetAt(nLeftTopIndex); |
3583 ASSERT(pLeftTopAnnot != NULL); | 3516 ASSERT(pLeftTopAnnot != NULL); |
3584 | 3517 |
3585 CPDF_Rect rcLeftTop = GetAnnotRect(pLeft
TopAnnot); | 3518 CPDF_Rect rcLeftTop = GetAnnotRect(pLeftTopAnnot); |
3586 | 3519 |
3587 m_Annots.Add(pLeftTopAnnot); | 3520 m_Annots.Add(pLeftTopAnnot); |
3588 sa.RemoveAt(nLeftTopIndex); | 3521 sa.RemoveAt(nLeftTopIndex); |
3589 | 3522 |
3590 CFX_ArrayTemplate<int> aSelect; | 3523 CFX_ArrayTemplate<int> aSelect; |
3591 | 3524 |
3592 { | 3525 { |
3593 for (int i=0,sz=sa.GetSize(); i<
sz; i++) | 3526 for (int i=0,sz=sa.GetSize(); i<sz; i++) |
3594 { | 3527 { |
3595 CPDFSDK_Annot* pAnnot =
sa.GetAt(i); | 3528 CPDFSDK_Annot* pAnnot = sa.GetAt(i); |
3596 ASSERT(pAnnot != NULL); | 3529 ASSERT(pAnnot != NULL); |
3597 | 3530 |
3598 CPDF_Rect rcAnnot = GetA
nnotRect(pAnnot); | 3531 CPDF_Rect rcAnnot = GetAnnotRect(pAnnot); |
3599 | 3532 |
3600 FX_FLOAT fCenterY = (rcA
nnot.top + rcAnnot.bottom) / 2.0f; | 3533 FX_FLOAT fCenterY = (rcAnnot.top + rcAnnot.bottom) /
2.0f; |
3601 | 3534 |
3602 if (fCenterY > rcLeftTop
.bottom && fCenterY < rcLeftTop.top) | 3535 if (fCenterY > rcLeftTop.bottom && fCenterY < rcLeft
Top.top) |
3603 aSelect.Add(i); | 3536 aSelect.Add(i); |
3604 } | 3537 } |
3605 } | 3538 } |
3606 | 3539 |
3607 { | 3540 { |
3608 for (int i=0,sz=aSelect.GetSize(
); i<sz; i++) | 3541 for (int i=0,sz=aSelect.GetSize(); i<sz; i++) |
3609 { | 3542 { |
3610 m_Annots.Add(sa[aSelect[
i]]); | 3543 m_Annots.Add(sa[aSelect[i]]); |
3611 } | 3544 } |
3612 } | 3545 } |
3613 | 3546 |
3614 { | 3547 { |
3615 for (int i=aSelect.GetSize()-1;
i>=0; i--) | 3548 for (int i=aSelect.GetSize()-1; i>=0; i--) |
3616 { | 3549 { |
3617 sa.RemoveAt(aSelect[i]); | 3550 sa.RemoveAt(aSelect[i]); |
3618 } | 3551 } |
3619 } | 3552 } |
3620 | 3553 |
3621 aSelect.RemoveAll(); | 3554 aSelect.RemoveAll(); |
3622 } | 3555 } |
3623 } | 3556 } |
3624 sa.RemoveAll(); | 3557 sa.RemoveAll(); |
3625 } | 3558 } |
3626 break; | 3559 break; |
3627 case BAI_COLUMN: | 3560 case BAI_COLUMN: |
3628 { | 3561 { |
3629 CPDFSDK_SortAnnots sa; | 3562 CPDFSDK_SortAnnots sa; |
3630 | 3563 |
3631 { | 3564 { |
3632 for (int i=0,sz=m_pPageView->CountAnnots(); i<sz
; i++) | 3565 for (int i=0,sz=m_pPageView->CountAnnots(); i<sz; i++) |
3633 { | 3566 { |
3634 CPDFSDK_Annot* pAnnot = m_pPageView->Get
Annot(i); | 3567 CPDFSDK_Annot* pAnnot = m_pPageView->GetAnnot(i); |
3635 ASSERT(pAnnot != NULL); | 3568 ASSERT(pAnnot != NULL); |
3636 | 3569 |
3637 if (pAnnot->GetType() == m_sType | 3570 if (pAnnot->GetType() == m_sType |
3638 && pAnnot->GetSubType() == m_sSu
bType) | 3571 && pAnnot->GetSubType() == m_sSubType) |
3639 sa.Add(pAnnot); | 3572 sa.Add(pAnnot); |
3640 } | 3573 } |
3641 } | 3574 } |
3642 | 3575 |
3643 if (sa.GetSize() > 0) | 3576 if (sa.GetSize() > 0) |
3644 { | 3577 { |
3645 sa.Sort(CBA_AnnotIterator::CompareByTop, FALSE); | 3578 sa.Sort(CBA_AnnotIterator::CompareByTop, FALSE); |
3646 } | 3579 } |
3647 | 3580 |
3648 while (sa.GetSize() > 0) | 3581 while (sa.GetSize() > 0) |
3649 { | 3582 { |
3650 int nLeftTopIndex = -1; | 3583 int nLeftTopIndex = -1; |
3651 | 3584 |
3652 { | 3585 { |
3653 FX_FLOAT fLeft = -1.0f; | 3586 FX_FLOAT fLeft = -1.0f; |
3654 | 3587 |
3655 for (int i=sa.GetSize()-1; i>=0; i--) | 3588 for (int i=sa.GetSize()-1; i>=0; i--) |
3656 { | 3589 { |
3657 CPDFSDK_Annot* pAnnot = sa.GetAt
(i); | 3590 CPDFSDK_Annot* pAnnot = sa.GetAt(i); |
3658 ASSERT(pAnnot != NULL); | 3591 ASSERT(pAnnot != NULL); |
3659 | 3592 |
3660 CPDF_Rect rcAnnot = GetAnnotRect
(pAnnot); | 3593 CPDF_Rect rcAnnot = GetAnnotRect(pAnnot); |
3661 | 3594 |
3662 if (fLeft < 0) | 3595 if (fLeft < 0) |
3663 { | 3596 { |
3664 nLeftTopIndex = 0; | 3597 nLeftTopIndex = 0; |
3665 fLeft = rcAnnot.left; | 3598 fLeft = rcAnnot.left; |
3666 } | 3599 } |
3667 else if (rcAnnot.left < fLeft) | 3600 else if (rcAnnot.left < fLeft) |
3668 { | 3601 { |
3669 nLeftTopIndex = i; | 3602 nLeftTopIndex = i; |
3670 fLeft = rcAnnot.left; | 3603 fLeft = rcAnnot.left; |
3671 } | 3604 } |
3672 } | 3605 } |
3673 } | 3606 } |
3674 | 3607 |
3675 if (nLeftTopIndex >= 0) | 3608 if (nLeftTopIndex >= 0) |
3676 { | 3609 { |
3677 CPDFSDK_Annot* pLeftTopAnnot = sa.GetAt(
nLeftTopIndex); | 3610 CPDFSDK_Annot* pLeftTopAnnot = sa.GetAt(nLeftTopIndex); |
3678 ASSERT(pLeftTopAnnot != NULL); | 3611 ASSERT(pLeftTopAnnot != NULL); |
3679 | 3612 |
3680 CPDF_Rect rcLeftTop = GetAnnotRect(pLeft
TopAnnot); | 3613 CPDF_Rect rcLeftTop = GetAnnotRect(pLeftTopAnnot); |
3681 | 3614 |
3682 m_Annots.Add(pLeftTopAnnot); | 3615 m_Annots.Add(pLeftTopAnnot); |
3683 sa.RemoveAt(nLeftTopIndex); | 3616 sa.RemoveAt(nLeftTopIndex); |
3684 | 3617 |
3685 CFX_ArrayTemplate<int> aSelect; | 3618 CFX_ArrayTemplate<int> aSelect; |
3686 | 3619 |
3687 { | 3620 { |
3688 for (int i=0,sz=sa.GetSize(); i<
sz; i++) | 3621 for (int i=0,sz=sa.GetSize(); i<sz; i++) |
3689 { | 3622 { |
3690 CPDFSDK_Annot* pAnnot =
sa.GetAt(i); | 3623 CPDFSDK_Annot* pAnnot = sa.GetAt(i); |
3691 ASSERT(pAnnot != NULL); | 3624 ASSERT(pAnnot != NULL); |
3692 | 3625 |
3693 CPDF_Rect rcAnnot = GetA
nnotRect(pAnnot); | 3626 CPDF_Rect rcAnnot = GetAnnotRect(pAnnot); |
3694 | 3627 |
3695 FX_FLOAT fCenterX = (rcA
nnot.left + rcAnnot.right) / 2.0f; | 3628 FX_FLOAT fCenterX = (rcAnnot.left + rcAnnot.right) /
2.0f; |
3696 | 3629 |
3697 if (fCenterX > rcLeftTop
.left && fCenterX < rcLeftTop.right) | 3630 if (fCenterX > rcLeftTop.left && fCenterX < rcLeftTo
p.right) |
3698 aSelect.Add(i); | 3631 aSelect.Add(i); |
3699 } | 3632 } |
3700 } | 3633 } |
3701 | 3634 |
3702 { | 3635 { |
3703 for (int i=0,sz=aSelect.GetSize(
); i<sz; i++) | 3636 for (int i=0,sz=aSelect.GetSize(); i<sz; i++) |
3704 { | 3637 { |
3705 m_Annots.Add(sa[aSelect[
i]]); | 3638 m_Annots.Add(sa[aSelect[i]]); |
3706 } | 3639 } |
3707 } | 3640 } |
3708 | 3641 |
3709 { | 3642 { |
3710 for (int i=aSelect.GetSize()-1;
i>=0; i--) | 3643 for (int i=aSelect.GetSize()-1; i>=0; i--) |
3711 { | 3644 { |
3712 sa.RemoveAt(aSelect[i]); | 3645 sa.RemoveAt(aSelect[i]); |
3713 } | 3646 } |
3714 } | 3647 } |
3715 | 3648 |
3716 aSelect.RemoveAll(); | 3649 aSelect.RemoveAll(); |
3717 } | 3650 } |
3718 } | 3651 } |
3719 sa.RemoveAll(); | 3652 sa.RemoveAll(); |
3720 } | 3653 } |
3721 break; | 3654 break; |
3722 } | 3655 } |
3723 } | 3656 } |
3724 | 3657 |
3725 CPDF_Rect CBA_AnnotIterator::GetAnnotRect(CPDFSDK_Annot* pAnnot) | 3658 CPDF_Rect CBA_AnnotIterator::GetAnnotRect(CPDFSDK_Annot* pAnnot) |
3726 { | 3659 { |
3727 » ASSERT(pAnnot != NULL); | 3660 ASSERT(pAnnot != NULL); |
3728 | 3661 |
3729 » CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); | 3662 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); |
3730 » ASSERT(pPDFAnnot != NULL); | 3663 ASSERT(pPDFAnnot != NULL); |
3731 | 3664 |
3732 » CPDF_Rect rcAnnot; | 3665 CPDF_Rect rcAnnot; |
3733 » pPDFAnnot->GetRect(rcAnnot); | 3666 pPDFAnnot->GetRect(rcAnnot); |
3734 | 3667 |
3735 » return rcAnnot; | 3668 return rcAnnot; |
3736 } | 3669 } |
3737 | 3670 |
OLD | NEW |