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 "fpdfsdk/include/fsdk_annothandler.h" | 7 #include "fpdfsdk/include/fsdk_annothandler.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <vector> | 10 #include <vector> |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 if (IPDFSDK_AnnotHandler* pAnnotHandler = | 70 if (IPDFSDK_AnnotHandler* pAnnotHandler = |
71 GetAnnotHandler(pAnnot->GetSubType())) { | 71 GetAnnotHandler(pAnnot->GetSubType())) { |
72 return pAnnotHandler->NewAnnot(pAnnot, pPageView); | 72 return pAnnotHandler->NewAnnot(pAnnot, pPageView); |
73 } | 73 } |
74 | 74 |
75 return new CPDFSDK_BAAnnot(pAnnot, pPageView); | 75 return new CPDFSDK_BAAnnot(pAnnot, pPageView); |
76 } | 76 } |
77 | 77 |
78 #ifdef PDF_ENABLE_XFA | 78 #ifdef PDF_ENABLE_XFA |
79 CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(IXFA_Widget* pAnnot, | 79 CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(CXFA_FFWidget* pAnnot, |
80 CPDFSDK_PageView* pPageView) { | 80 CPDFSDK_PageView* pPageView) { |
81 ASSERT(pAnnot); | 81 ASSERT(pAnnot); |
82 ASSERT(pPageView); | 82 ASSERT(pPageView); |
83 | 83 |
84 if (IPDFSDK_AnnotHandler* pAnnotHandler = | 84 if (IPDFSDK_AnnotHandler* pAnnotHandler = |
85 GetAnnotHandler(FSDK_XFAWIDGET_TYPENAME)) { | 85 GetAnnotHandler(FSDK_XFAWIDGET_TYPENAME)) { |
86 return pAnnotHandler->NewAnnot(pAnnot, pPageView); | 86 return pAnnotHandler->NewAnnot(pAnnot, pPageView); |
87 } | 87 } |
88 | 88 |
89 return NULL; | 89 return NULL; |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 // for xfa annots | 376 // for xfa annots |
377 IXFA_WidgetIterator* pWidgetIterator = | 377 IXFA_WidgetIterator* pWidgetIterator = |
378 pPage->GetXFAPageView()->CreateWidgetIterator( | 378 pPage->GetXFAPageView()->CreateWidgetIterator( |
379 XFA_TRAVERSEWAY_Tranvalse, XFA_WIDGETFILTER_Visible | | 379 XFA_TRAVERSEWAY_Tranvalse, XFA_WIDGETFILTER_Visible | |
380 XFA_WIDGETFILTER_Viewable | | 380 XFA_WIDGETFILTER_Viewable | |
381 XFA_WIDGETFILTER_Field); | 381 XFA_WIDGETFILTER_Field); |
382 if (pWidgetIterator == NULL) | 382 if (pWidgetIterator == NULL) |
383 return NULL; | 383 return NULL; |
384 if (pWidgetIterator->GetCurrentWidget() != pSDKAnnot->GetXFAWidget()) | 384 if (pWidgetIterator->GetCurrentWidget() != pSDKAnnot->GetXFAWidget()) |
385 pWidgetIterator->SetCurrentWidget(pSDKAnnot->GetXFAWidget()); | 385 pWidgetIterator->SetCurrentWidget(pSDKAnnot->GetXFAWidget()); |
386 IXFA_Widget* hNextFocus = NULL; | 386 CXFA_FFWidget* hNextFocus = NULL; |
387 hNextFocus = | 387 hNextFocus = |
388 bNext ? pWidgetIterator->MoveToNext() : pWidgetIterator->MoveToPrevious(); | 388 bNext ? pWidgetIterator->MoveToNext() : pWidgetIterator->MoveToPrevious(); |
389 if (!hNextFocus && pSDKAnnot) | 389 if (!hNextFocus && pSDKAnnot) |
390 hNextFocus = pWidgetIterator->MoveToFirst(); | 390 hNextFocus = pWidgetIterator->MoveToFirst(); |
391 | 391 |
392 pWidgetIterator->Release(); | 392 pWidgetIterator->Release(); |
393 return pPageView->GetAnnotByXFAWidget(hNextFocus); | 393 return pPageView->GetAnnotByXFAWidget(hNextFocus); |
394 #else // PDF_ENABLE_XFA | 394 #else // PDF_ENABLE_XFA |
395 CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), "Widget", ""); | 395 CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), "Widget", ""); |
396 return bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot); | 396 return bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 CPDFSDK_Widget* pWidget = new CPDFSDK_Widget(pAnnot, pPage, pInterForm); | 432 CPDFSDK_Widget* pWidget = new CPDFSDK_Widget(pAnnot, pPage, pInterForm); |
433 pInterForm->AddMap(pCtrl, pWidget); | 433 pInterForm->AddMap(pCtrl, pWidget); |
434 CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm(); | 434 CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm(); |
435 if (pPDFInterForm && pPDFInterForm->NeedConstructAP()) | 435 if (pPDFInterForm && pPDFInterForm->NeedConstructAP()) |
436 pWidget->ResetAppearance(nullptr, FALSE); | 436 pWidget->ResetAppearance(nullptr, FALSE); |
437 | 437 |
438 return pWidget; | 438 return pWidget; |
439 } | 439 } |
440 | 440 |
441 #ifdef PDF_ENABLE_XFA | 441 #ifdef PDF_ENABLE_XFA |
442 CPDFSDK_Annot* CPDFSDK_BFAnnotHandler::NewAnnot(IXFA_Widget* hWidget, | 442 CPDFSDK_Annot* CPDFSDK_BFAnnotHandler::NewAnnot(CXFA_FFWidget* hWidget, |
443 CPDFSDK_PageView* pPage) { | 443 CPDFSDK_PageView* pPage) { |
444 return NULL; | 444 return NULL; |
445 } | 445 } |
446 #endif // PDF_ENABLE_XFA | 446 #endif // PDF_ENABLE_XFA |
447 | 447 |
448 void CPDFSDK_BFAnnotHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) { | 448 void CPDFSDK_BFAnnotHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) { |
449 ASSERT(pAnnot); | 449 ASSERT(pAnnot); |
450 | 450 |
451 if (m_pFormFiller) | 451 if (m_pFormFiller) |
452 m_pFormFiller->OnDelete(pAnnot); | 452 m_pFormFiller->OnDelete(pAnnot); |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 #define FWL_WGTHITTEST_Titlebar 11 // caption | 727 #define FWL_WGTHITTEST_Titlebar 11 // caption |
728 #define FWL_WGTHITTEST_HScrollBar 15 | 728 #define FWL_WGTHITTEST_HScrollBar 15 |
729 #define FWL_WGTHITTEST_VScrollBar 16 | 729 #define FWL_WGTHITTEST_VScrollBar 16 |
730 #define FWL_WGTHITTEST_Border 17 | 730 #define FWL_WGTHITTEST_Border 17 |
731 #define FWL_WGTHITTEST_Edit 19 | 731 #define FWL_WGTHITTEST_Edit 19 |
732 #define FWL_WGTHITTEST_HyperLink 20 | 732 #define FWL_WGTHITTEST_HyperLink 20 |
733 | 733 |
734 CPDFSDK_XFAAnnotHandler::CPDFSDK_XFAAnnotHandler(CPDFDoc_Environment* pApp) | 734 CPDFSDK_XFAAnnotHandler::CPDFSDK_XFAAnnotHandler(CPDFDoc_Environment* pApp) |
735 : m_pApp(pApp) {} | 735 : m_pApp(pApp) {} |
736 | 736 |
737 CPDFSDK_Annot* CPDFSDK_XFAAnnotHandler::NewAnnot(IXFA_Widget* pAnnot, | 737 CPDFSDK_Annot* CPDFSDK_XFAAnnotHandler::NewAnnot(CXFA_FFWidget* pAnnot, |
738 CPDFSDK_PageView* pPage) { | 738 CPDFSDK_PageView* pPage) { |
739 CPDFSDK_Document* pSDKDoc = m_pApp->GetSDKDocument(); | 739 CPDFSDK_Document* pSDKDoc = m_pApp->GetSDKDocument(); |
740 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pSDKDoc->GetInterForm(); | 740 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pSDKDoc->GetInterForm(); |
741 CPDFSDK_XFAWidget* pWidget = new CPDFSDK_XFAWidget(pAnnot, pPage, pInterForm); | 741 CPDFSDK_XFAWidget* pWidget = new CPDFSDK_XFAWidget(pAnnot, pPage, pInterForm); |
742 pInterForm->AddXFAMap(pAnnot, pWidget); | 742 pInterForm->AddXFAMap(pAnnot, pWidget); |
743 return pWidget; | 743 return pWidget; |
744 } | 744 } |
745 | 745 |
746 FX_BOOL CPDFSDK_XFAAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) { | 746 FX_BOOL CPDFSDK_XFAAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) { |
747 return pAnnot->GetXFAWidget() != NULL; | 747 return pAnnot->GetXFAWidget() != NULL; |
748 } | 748 } |
749 | 749 |
750 void CPDFSDK_XFAAnnotHandler::OnDraw(CPDFSDK_PageView* pPageView, | 750 void CPDFSDK_XFAAnnotHandler::OnDraw(CPDFSDK_PageView* pPageView, |
751 CPDFSDK_Annot* pAnnot, | 751 CPDFSDK_Annot* pAnnot, |
752 CFX_RenderDevice* pDevice, | 752 CFX_RenderDevice* pDevice, |
753 CFX_Matrix* pUser2Device, | 753 CFX_Matrix* pUser2Device, |
754 uint32_t dwFlags) { | 754 uint32_t dwFlags) { |
755 ASSERT(pPageView != NULL); | 755 ASSERT(pPageView != NULL); |
756 ASSERT(pAnnot != NULL); | 756 ASSERT(pAnnot != NULL); |
757 | 757 |
758 CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument(); | 758 CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument(); |
759 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 759 CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
760 | 760 |
761 CFX_Graphics gs; | 761 CFX_Graphics gs; |
762 gs.Create(pDevice); | 762 gs.Create(pDevice); |
763 | 763 |
764 CFX_Matrix mt; | 764 CFX_Matrix mt; |
765 mt = *(CFX_Matrix*)pUser2Device; | 765 mt = *(CFX_Matrix*)pUser2Device; |
766 | 766 |
767 FX_BOOL bIsHighlight = FALSE; | 767 FX_BOOL bIsHighlight = FALSE; |
768 if (pSDKDoc->GetFocusAnnot() != pAnnot) | 768 if (pSDKDoc->GetFocusAnnot() != pAnnot) |
769 bIsHighlight = TRUE; | 769 bIsHighlight = TRUE; |
770 | 770 |
771 pWidgetHandler->RenderWidget(pAnnot->GetXFAWidget(), &gs, &mt, bIsHighlight); | 771 pWidgetHandler->RenderWidget(pAnnot->GetXFAWidget(), &gs, &mt, bIsHighlight); |
772 | 772 |
773 // to do highlight and shadow | 773 // to do highlight and shadow |
774 } | 774 } |
775 | 775 |
776 void CPDFSDK_XFAAnnotHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) { | 776 void CPDFSDK_XFAAnnotHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) { |
777 CPDFSDK_XFAWidget* pWidget = (CPDFSDK_XFAWidget*)pAnnot; | 777 CPDFSDK_XFAWidget* pWidget = (CPDFSDK_XFAWidget*)pAnnot; |
778 CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm(); | 778 CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm(); |
779 pInterForm->RemoveXFAMap(pWidget->GetXFAWidget()); | 779 pInterForm->RemoveXFAMap(pWidget->GetXFAWidget()); |
780 | 780 |
781 delete pWidget; | 781 delete pWidget; |
782 } | 782 } |
783 | 783 |
784 CFX_FloatRect CPDFSDK_XFAAnnotHandler::GetViewBBox(CPDFSDK_PageView* pPageView, | 784 CFX_FloatRect CPDFSDK_XFAAnnotHandler::GetViewBBox(CPDFSDK_PageView* pPageView, |
785 CPDFSDK_Annot* pAnnot) { | 785 CPDFSDK_Annot* pAnnot) { |
786 ASSERT(pAnnot); | 786 ASSERT(pAnnot); |
787 | 787 |
788 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 788 CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
789 CFX_RectF rcBBox; | 789 CFX_RectF rcBBox; |
790 XFA_ELEMENT eType = | 790 XFA_ELEMENT eType = |
791 pWidgetHandler->GetDataAcc(pAnnot->GetXFAWidget())->GetUIType(); | 791 pWidgetHandler->GetDataAcc(pAnnot->GetXFAWidget())->GetUIType(); |
792 if (eType == XFA_ELEMENT_Signature) | 792 if (eType == XFA_ELEMENT_Signature) |
793 pWidgetHandler->GetBBox(pAnnot->GetXFAWidget(), rcBBox, | 793 pWidgetHandler->GetBBox(pAnnot->GetXFAWidget(), rcBBox, |
794 XFA_WIDGETSTATUS_Visible, TRUE); | 794 XFA_WIDGETSTATUS_Visible, TRUE); |
795 else | 795 else |
796 pWidgetHandler->GetBBox(pAnnot->GetXFAWidget(), rcBBox, 0); | 796 pWidgetHandler->GetBBox(pAnnot->GetXFAWidget(), rcBBox, 0); |
797 | 797 |
798 CFX_FloatRect rcWidget(rcBBox.left, rcBBox.top, rcBBox.left + rcBBox.width, | 798 CFX_FloatRect rcWidget(rcBBox.left, rcBBox.top, rcBBox.left + rcBBox.width, |
(...skipping 13 matching lines...) Expand all Loading... |
812 return FALSE; | 812 return FALSE; |
813 | 813 |
814 CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument(); | 814 CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument(); |
815 if (!pSDKDoc) | 815 if (!pSDKDoc) |
816 return FALSE; | 816 return FALSE; |
817 | 817 |
818 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument(); | 818 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument(); |
819 if (!pDoc) | 819 if (!pDoc) |
820 return FALSE; | 820 return FALSE; |
821 | 821 |
822 IXFA_DocView* pDocView = pDoc->GetXFADocView(); | 822 CXFA_FFDocView* pDocView = pDoc->GetXFADocView(); |
823 if (!pDocView) | 823 if (!pDocView) |
824 return FALSE; | 824 return FALSE; |
825 | 825 |
826 IXFA_WidgetHandler* pWidgetHandler = pDocView->GetWidgetHandler(); | 826 CXFA_FFWidgetHandler* pWidgetHandler = pDocView->GetWidgetHandler(); |
827 if (!pWidgetHandler) | 827 if (!pWidgetHandler) |
828 return FALSE; | 828 return FALSE; |
829 | 829 |
830 uint32_t dwHitTest = | 830 uint32_t dwHitTest = |
831 pWidgetHandler->OnHitTest(pAnnot->GetXFAWidget(), point.x, point.y); | 831 pWidgetHandler->OnHitTest(pAnnot->GetXFAWidget(), point.x, point.y); |
832 return (dwHitTest != FWL_WGTHITTEST_Unknown); | 832 return (dwHitTest != FWL_WGTHITTEST_Unknown); |
833 } | 833 } |
834 | 834 |
835 void CPDFSDK_XFAAnnotHandler::OnMouseEnter(CPDFSDK_PageView* pPageView, | 835 void CPDFSDK_XFAAnnotHandler::OnMouseEnter(CPDFSDK_PageView* pPageView, |
836 CPDFSDK_Annot* pAnnot, | 836 CPDFSDK_Annot* pAnnot, |
837 uint32_t nFlag) { | 837 uint32_t nFlag) { |
838 if (!pPageView || !pAnnot) | 838 if (!pPageView || !pAnnot) |
839 return; | 839 return; |
840 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 840 CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
841 pWidgetHandler->OnMouseEnter(pAnnot->GetXFAWidget()); | 841 pWidgetHandler->OnMouseEnter(pAnnot->GetXFAWidget()); |
842 } | 842 } |
843 | 843 |
844 void CPDFSDK_XFAAnnotHandler::OnMouseExit(CPDFSDK_PageView* pPageView, | 844 void CPDFSDK_XFAAnnotHandler::OnMouseExit(CPDFSDK_PageView* pPageView, |
845 CPDFSDK_Annot* pAnnot, | 845 CPDFSDK_Annot* pAnnot, |
846 uint32_t nFlag) { | 846 uint32_t nFlag) { |
847 if (!pPageView || !pAnnot) | 847 if (!pPageView || !pAnnot) |
848 return; | 848 return; |
849 | 849 |
850 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 850 CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
851 pWidgetHandler->OnMouseExit(pAnnot->GetXFAWidget()); | 851 pWidgetHandler->OnMouseExit(pAnnot->GetXFAWidget()); |
852 } | 852 } |
853 | 853 |
854 FX_BOOL CPDFSDK_XFAAnnotHandler::OnLButtonDown(CPDFSDK_PageView* pPageView, | 854 FX_BOOL CPDFSDK_XFAAnnotHandler::OnLButtonDown(CPDFSDK_PageView* pPageView, |
855 CPDFSDK_Annot* pAnnot, | 855 CPDFSDK_Annot* pAnnot, |
856 uint32_t nFlags, | 856 uint32_t nFlags, |
857 const CFX_FloatPoint& point) { | 857 const CFX_FloatPoint& point) { |
858 if (!pPageView || !pAnnot) | 858 if (!pPageView || !pAnnot) |
859 return FALSE; | 859 return FALSE; |
860 | 860 |
861 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 861 CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
862 return pWidgetHandler->OnLButtonDown(pAnnot->GetXFAWidget(), | 862 return pWidgetHandler->OnLButtonDown(pAnnot->GetXFAWidget(), |
863 GetFWLFlags(nFlags), point.x, point.y); | 863 GetFWLFlags(nFlags), point.x, point.y); |
864 } | 864 } |
865 | 865 |
866 FX_BOOL CPDFSDK_XFAAnnotHandler::OnLButtonUp(CPDFSDK_PageView* pPageView, | 866 FX_BOOL CPDFSDK_XFAAnnotHandler::OnLButtonUp(CPDFSDK_PageView* pPageView, |
867 CPDFSDK_Annot* pAnnot, | 867 CPDFSDK_Annot* pAnnot, |
868 uint32_t nFlags, | 868 uint32_t nFlags, |
869 const CFX_FloatPoint& point) { | 869 const CFX_FloatPoint& point) { |
870 if (!pPageView || !pAnnot) | 870 if (!pPageView || !pAnnot) |
871 return FALSE; | 871 return FALSE; |
872 | 872 |
873 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 873 CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
874 return pWidgetHandler->OnLButtonUp(pAnnot->GetXFAWidget(), | 874 return pWidgetHandler->OnLButtonUp(pAnnot->GetXFAWidget(), |
875 GetFWLFlags(nFlags), point.x, point.y); | 875 GetFWLFlags(nFlags), point.x, point.y); |
876 } | 876 } |
877 | 877 |
878 FX_BOOL CPDFSDK_XFAAnnotHandler::OnLButtonDblClk(CPDFSDK_PageView* pPageView, | 878 FX_BOOL CPDFSDK_XFAAnnotHandler::OnLButtonDblClk(CPDFSDK_PageView* pPageView, |
879 CPDFSDK_Annot* pAnnot, | 879 CPDFSDK_Annot* pAnnot, |
880 uint32_t nFlags, | 880 uint32_t nFlags, |
881 const CFX_FloatPoint& point) { | 881 const CFX_FloatPoint& point) { |
882 if (!pPageView || !pAnnot) | 882 if (!pPageView || !pAnnot) |
883 return FALSE; | 883 return FALSE; |
884 | 884 |
885 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 885 CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
886 return pWidgetHandler->OnLButtonDblClk(pAnnot->GetXFAWidget(), | 886 return pWidgetHandler->OnLButtonDblClk(pAnnot->GetXFAWidget(), |
887 GetFWLFlags(nFlags), point.x, point.y); | 887 GetFWLFlags(nFlags), point.x, point.y); |
888 } | 888 } |
889 | 889 |
890 FX_BOOL CPDFSDK_XFAAnnotHandler::OnMouseMove(CPDFSDK_PageView* pPageView, | 890 FX_BOOL CPDFSDK_XFAAnnotHandler::OnMouseMove(CPDFSDK_PageView* pPageView, |
891 CPDFSDK_Annot* pAnnot, | 891 CPDFSDK_Annot* pAnnot, |
892 uint32_t nFlags, | 892 uint32_t nFlags, |
893 const CFX_FloatPoint& point) { | 893 const CFX_FloatPoint& point) { |
894 if (!pPageView || !pAnnot) | 894 if (!pPageView || !pAnnot) |
895 return FALSE; | 895 return FALSE; |
896 | 896 |
897 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 897 CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
898 return pWidgetHandler->OnMouseMove(pAnnot->GetXFAWidget(), | 898 return pWidgetHandler->OnMouseMove(pAnnot->GetXFAWidget(), |
899 GetFWLFlags(nFlags), point.x, point.y); | 899 GetFWLFlags(nFlags), point.x, point.y); |
900 } | 900 } |
901 | 901 |
902 FX_BOOL CPDFSDK_XFAAnnotHandler::OnMouseWheel(CPDFSDK_PageView* pPageView, | 902 FX_BOOL CPDFSDK_XFAAnnotHandler::OnMouseWheel(CPDFSDK_PageView* pPageView, |
903 CPDFSDK_Annot* pAnnot, | 903 CPDFSDK_Annot* pAnnot, |
904 uint32_t nFlags, | 904 uint32_t nFlags, |
905 short zDelta, | 905 short zDelta, |
906 const CFX_FloatPoint& point) { | 906 const CFX_FloatPoint& point) { |
907 if (!pPageView || !pAnnot) | 907 if (!pPageView || !pAnnot) |
908 return FALSE; | 908 return FALSE; |
909 | 909 |
910 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 910 CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
911 return pWidgetHandler->OnMouseWheel( | 911 return pWidgetHandler->OnMouseWheel( |
912 pAnnot->GetXFAWidget(), GetFWLFlags(nFlags), zDelta, point.x, point.y); | 912 pAnnot->GetXFAWidget(), GetFWLFlags(nFlags), zDelta, point.x, point.y); |
913 } | 913 } |
914 | 914 |
915 FX_BOOL CPDFSDK_XFAAnnotHandler::OnRButtonDown(CPDFSDK_PageView* pPageView, | 915 FX_BOOL CPDFSDK_XFAAnnotHandler::OnRButtonDown(CPDFSDK_PageView* pPageView, |
916 CPDFSDK_Annot* pAnnot, | 916 CPDFSDK_Annot* pAnnot, |
917 uint32_t nFlags, | 917 uint32_t nFlags, |
918 const CFX_FloatPoint& point) { | 918 const CFX_FloatPoint& point) { |
919 if (!pPageView || !pAnnot) | 919 if (!pPageView || !pAnnot) |
920 return FALSE; | 920 return FALSE; |
921 | 921 |
922 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 922 CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
923 return pWidgetHandler->OnRButtonDown(pAnnot->GetXFAWidget(), | 923 return pWidgetHandler->OnRButtonDown(pAnnot->GetXFAWidget(), |
924 GetFWLFlags(nFlags), point.x, point.y); | 924 GetFWLFlags(nFlags), point.x, point.y); |
925 } | 925 } |
926 | 926 |
927 FX_BOOL CPDFSDK_XFAAnnotHandler::OnRButtonUp(CPDFSDK_PageView* pPageView, | 927 FX_BOOL CPDFSDK_XFAAnnotHandler::OnRButtonUp(CPDFSDK_PageView* pPageView, |
928 CPDFSDK_Annot* pAnnot, | 928 CPDFSDK_Annot* pAnnot, |
929 uint32_t nFlags, | 929 uint32_t nFlags, |
930 const CFX_FloatPoint& point) { | 930 const CFX_FloatPoint& point) { |
931 if (!pPageView || !pAnnot) | 931 if (!pPageView || !pAnnot) |
932 return FALSE; | 932 return FALSE; |
933 | 933 |
934 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 934 CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
935 return pWidgetHandler->OnRButtonUp(pAnnot->GetXFAWidget(), | 935 return pWidgetHandler->OnRButtonUp(pAnnot->GetXFAWidget(), |
936 GetFWLFlags(nFlags), point.x, point.y); | 936 GetFWLFlags(nFlags), point.x, point.y); |
937 } | 937 } |
938 | 938 |
939 FX_BOOL CPDFSDK_XFAAnnotHandler::OnRButtonDblClk(CPDFSDK_PageView* pPageView, | 939 FX_BOOL CPDFSDK_XFAAnnotHandler::OnRButtonDblClk(CPDFSDK_PageView* pPageView, |
940 CPDFSDK_Annot* pAnnot, | 940 CPDFSDK_Annot* pAnnot, |
941 uint32_t nFlags, | 941 uint32_t nFlags, |
942 const CFX_FloatPoint& point) { | 942 const CFX_FloatPoint& point) { |
943 if (!pPageView || !pAnnot) | 943 if (!pPageView || !pAnnot) |
944 return FALSE; | 944 return FALSE; |
945 | 945 |
946 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 946 CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
947 return pWidgetHandler->OnRButtonDblClk(pAnnot->GetXFAWidget(), | 947 return pWidgetHandler->OnRButtonDblClk(pAnnot->GetXFAWidget(), |
948 GetFWLFlags(nFlags), point.x, point.y); | 948 GetFWLFlags(nFlags), point.x, point.y); |
949 } | 949 } |
950 | 950 |
951 FX_BOOL CPDFSDK_XFAAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot, | 951 FX_BOOL CPDFSDK_XFAAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot, |
952 uint32_t nChar, | 952 uint32_t nChar, |
953 uint32_t nFlags) { | 953 uint32_t nFlags) { |
954 if (!pAnnot) | 954 if (!pAnnot) |
955 return FALSE; | 955 return FALSE; |
956 | 956 |
957 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 957 CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
958 return pWidgetHandler->OnChar(pAnnot->GetXFAWidget(), nChar, | 958 return pWidgetHandler->OnChar(pAnnot->GetXFAWidget(), nChar, |
959 GetFWLFlags(nFlags)); | 959 GetFWLFlags(nFlags)); |
960 } | 960 } |
961 | 961 |
962 FX_BOOL CPDFSDK_XFAAnnotHandler::OnKeyDown(CPDFSDK_Annot* pAnnot, | 962 FX_BOOL CPDFSDK_XFAAnnotHandler::OnKeyDown(CPDFSDK_Annot* pAnnot, |
963 int nKeyCode, | 963 int nKeyCode, |
964 int nFlag) { | 964 int nFlag) { |
965 if (!pAnnot) | 965 if (!pAnnot) |
966 return FALSE; | 966 return FALSE; |
967 | 967 |
968 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 968 CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
969 return pWidgetHandler->OnKeyDown(pAnnot->GetXFAWidget(), nKeyCode, | 969 return pWidgetHandler->OnKeyDown(pAnnot->GetXFAWidget(), nKeyCode, |
970 GetFWLFlags(nFlag)); | 970 GetFWLFlags(nFlag)); |
971 } | 971 } |
972 | 972 |
973 FX_BOOL CPDFSDK_XFAAnnotHandler::OnKeyUp(CPDFSDK_Annot* pAnnot, | 973 FX_BOOL CPDFSDK_XFAAnnotHandler::OnKeyUp(CPDFSDK_Annot* pAnnot, |
974 int nKeyCode, | 974 int nKeyCode, |
975 int nFlag) { | 975 int nFlag) { |
976 if (!pAnnot) | 976 if (!pAnnot) |
977 return FALSE; | 977 return FALSE; |
978 | 978 |
979 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 979 CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
980 return pWidgetHandler->OnKeyUp(pAnnot->GetXFAWidget(), nKeyCode, | 980 return pWidgetHandler->OnKeyUp(pAnnot->GetXFAWidget(), nKeyCode, |
981 GetFWLFlags(nFlag)); | 981 GetFWLFlags(nFlag)); |
982 } | 982 } |
983 | 983 |
984 FX_BOOL CPDFSDK_XFAAnnotHandler::OnSetFocus(CPDFSDK_Annot* pAnnot, | 984 FX_BOOL CPDFSDK_XFAAnnotHandler::OnSetFocus(CPDFSDK_Annot* pAnnot, |
985 uint32_t nFlag) { | 985 uint32_t nFlag) { |
986 return TRUE; | 986 return TRUE; |
987 } | 987 } |
988 | 988 |
989 FX_BOOL CPDFSDK_XFAAnnotHandler::OnKillFocus(CPDFSDK_Annot* pAnnot, | 989 FX_BOOL CPDFSDK_XFAAnnotHandler::OnKillFocus(CPDFSDK_Annot* pAnnot, |
990 uint32_t nFlag) { | 990 uint32_t nFlag) { |
991 return TRUE; | 991 return TRUE; |
992 } | 992 } |
993 | 993 |
994 FX_BOOL CPDFSDK_XFAAnnotHandler::OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot, | 994 FX_BOOL CPDFSDK_XFAAnnotHandler::OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot, |
995 CPDFSDK_Annot* pNewAnnot) { | 995 CPDFSDK_Annot* pNewAnnot) { |
996 IXFA_WidgetHandler* pWidgetHandler = NULL; | 996 CXFA_FFWidgetHandler* pWidgetHandler = NULL; |
997 | 997 |
998 if (pOldAnnot) | 998 if (pOldAnnot) |
999 pWidgetHandler = GetXFAWidgetHandler(pOldAnnot); | 999 pWidgetHandler = GetXFAWidgetHandler(pOldAnnot); |
1000 else if (pNewAnnot) | 1000 else if (pNewAnnot) |
1001 pWidgetHandler = GetXFAWidgetHandler(pNewAnnot); | 1001 pWidgetHandler = GetXFAWidgetHandler(pNewAnnot); |
1002 | 1002 |
1003 if (pWidgetHandler) { | 1003 if (pWidgetHandler) { |
1004 FX_BOOL bRet = TRUE; | 1004 FX_BOOL bRet = TRUE; |
1005 IXFA_Widget* hWidget = pNewAnnot ? pNewAnnot->GetXFAWidget() : NULL; | 1005 CXFA_FFWidget* hWidget = pNewAnnot ? pNewAnnot->GetXFAWidget() : NULL; |
1006 if (hWidget) { | 1006 if (hWidget) { |
1007 IXFA_PageView* pXFAPageView = pWidgetHandler->GetPageView(hWidget); | 1007 CXFA_FFPageView* pXFAPageView = pWidgetHandler->GetPageView(hWidget); |
1008 if (pXFAPageView) { | 1008 if (pXFAPageView) { |
1009 bRet = pXFAPageView->GetDocView()->SetFocus(hWidget); | 1009 bRet = pXFAPageView->GetDocView()->SetFocus(hWidget); |
1010 if (pXFAPageView->GetDocView()->GetFocusWidget() == hWidget) | 1010 if (pXFAPageView->GetDocView()->GetFocusWidget() == hWidget) |
1011 bRet = TRUE; | 1011 bRet = TRUE; |
1012 } | 1012 } |
1013 } | 1013 } |
1014 return bRet; | 1014 return bRet; |
1015 } | 1015 } |
1016 | 1016 |
1017 return TRUE; | 1017 return TRUE; |
1018 } | 1018 } |
1019 | 1019 |
1020 IXFA_WidgetHandler* CPDFSDK_XFAAnnotHandler::GetXFAWidgetHandler( | 1020 CXFA_FFWidgetHandler* CPDFSDK_XFAAnnotHandler::GetXFAWidgetHandler( |
1021 CPDFSDK_Annot* pAnnot) { | 1021 CPDFSDK_Annot* pAnnot) { |
1022 if (!pAnnot) | 1022 if (!pAnnot) |
1023 return NULL; | 1023 return NULL; |
1024 | 1024 |
1025 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); | 1025 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); |
1026 if (!pPageView) | 1026 if (!pPageView) |
1027 return NULL; | 1027 return NULL; |
1028 | 1028 |
1029 CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument(); | 1029 CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument(); |
1030 if (!pSDKDoc) | 1030 if (!pSDKDoc) |
1031 return NULL; | 1031 return NULL; |
1032 | 1032 |
1033 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument(); | 1033 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument(); |
1034 if (!pDoc) | 1034 if (!pDoc) |
1035 return NULL; | 1035 return NULL; |
1036 | 1036 |
1037 IXFA_DocView* pDocView = pDoc->GetXFADocView(); | 1037 CXFA_FFDocView* pDocView = pDoc->GetXFADocView(); |
1038 if (!pDocView) | 1038 if (!pDocView) |
1039 return NULL; | 1039 return NULL; |
1040 | 1040 |
1041 return pDocView->GetWidgetHandler(); | 1041 return pDocView->GetWidgetHandler(); |
1042 } | 1042 } |
1043 | 1043 |
1044 #define FWL_KEYFLAG_Ctrl (1 << 0) | 1044 #define FWL_KEYFLAG_Ctrl (1 << 0) |
1045 #define FWL_KEYFLAG_Alt (1 << 1) | 1045 #define FWL_KEYFLAG_Alt (1 << 1) |
1046 #define FWL_KEYFLAG_Shift (1 << 2) | 1046 #define FWL_KEYFLAG_Shift (1 << 2) |
1047 #define FWL_KEYFLAG_LButton (1 << 3) | 1047 #define FWL_KEYFLAG_LButton (1 << 3) |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1102 | 1102 |
1103 CPDFSDK_Annot* CPDFSDK_AnnotIterator::PrevAnnot() { | 1103 CPDFSDK_Annot* CPDFSDK_AnnotIterator::PrevAnnot() { |
1104 if (m_pos < m_iteratorAnnotList.size()) | 1104 if (m_pos < m_iteratorAnnotList.size()) |
1105 return m_iteratorAnnotList[m_iteratorAnnotList.size() - ++m_pos]; | 1105 return m_iteratorAnnotList[m_iteratorAnnotList.size() - ++m_pos]; |
1106 return nullptr; | 1106 return nullptr; |
1107 } | 1107 } |
1108 | 1108 |
1109 CPDFSDK_Annot* CPDFSDK_AnnotIterator::Next() { | 1109 CPDFSDK_Annot* CPDFSDK_AnnotIterator::Next() { |
1110 return m_bReverse ? PrevAnnot() : NextAnnot(); | 1110 return m_bReverse ? PrevAnnot() : NextAnnot(); |
1111 } | 1111 } |
OLD | NEW |