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