Index: fpdfsdk/include/fsdk_annothandler.h |
diff --git a/fpdfsdk/include/fsdk_annothandler.h b/fpdfsdk/include/fsdk_annothandler.h |
index 53efa63fc5db90aa477935009b92aa366536507a..d43bc7b7e922ca5637fb7d0e681c920447af9897 100644 |
--- a/fpdfsdk/include/fsdk_annothandler.h |
+++ b/fpdfsdk/include/fsdk_annothandler.h |
@@ -12,6 +12,10 @@ |
#include "core/include/fxcrt/fx_basic.h" |
+#ifdef PDF_ENABLE_XFA |
+#define FSDK_XFAWIDGET_TYPENAME "XFAWidget" |
+ |
+#endif |
class CFFL_IFormFiller; |
class CFX_RenderDevice; |
class CPDFDoc_Environment; |
@@ -35,6 +39,11 @@ class IPDFSDK_AnnotHandler { |
virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, |
CPDFSDK_PageView* pPage) = 0; |
+#ifdef PDF_ENABLE_XFA |
+ virtual CPDFSDK_Annot* NewAnnot(IXFA_Widget* hWidget, |
+ CPDFSDK_PageView* pPage) = 0; |
+ |
+#endif |
virtual void ReleaseAnnot(CPDFSDK_Annot* pAnnot) = 0; |
virtual void DeleteAnnot(CPDFSDK_Annot* pAnnot) = 0; |
@@ -119,6 +128,10 @@ class IPDFSDK_AnnotHandler { |
virtual FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) = 0; |
virtual FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) = 0; |
+#ifdef PDF_ENABLE_XFA |
+ virtual FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot, |
+ CPDFSDK_Annot* pNewAnnot) = 0; |
+#endif |
}; |
class CPDFSDK_BFAnnotHandler : public IPDFSDK_AnnotHandler { |
@@ -132,6 +145,10 @@ class CPDFSDK_BFAnnotHandler : public IPDFSDK_AnnotHandler { |
CFX_ByteString GetName() override { return CFX_ByteString("WidgetHandler"); } |
FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) override; |
CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) override; |
+#ifdef PDF_ENABLE_XFA |
+ CPDFSDK_Annot* NewAnnot(IXFA_Widget* hWidget, |
+ CPDFSDK_PageView* pPage) override; |
+#endif |
void ReleaseAnnot(CPDFSDK_Annot* pAnnot) override; |
void DeleteAnnot(CPDFSDK_Annot* pAnnot) override {} |
CPDF_Rect GetViewBBox(CPDFSDK_PageView* pPageView, |
@@ -204,6 +221,12 @@ class CPDFSDK_BFAnnotHandler : public IPDFSDK_AnnotHandler { |
void OnSelected(CPDFSDK_Annot* pAnnot) override {} |
FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) override; |
FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) override; |
+#ifdef PDF_ENABLE_XFA |
+ FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot, |
+ CPDFSDK_Annot* pNewAnnot) override { |
+ return TRUE; |
+ } |
+#endif |
void SetFormFiller(CFFL_IFormFiller* pFiller) { m_pFormFiller = pFiller; } |
CFFL_IFormFiller* GetFormFiller() { return m_pFormFiller; } |
@@ -213,6 +236,121 @@ class CPDFSDK_BFAnnotHandler : public IPDFSDK_AnnotHandler { |
CFFL_IFormFiller* m_pFormFiller; |
}; |
+#ifdef PDF_ENABLE_XFA |
+class CPDFSDK_XFAAnnotHandler : public IPDFSDK_AnnotHandler { |
+ public: |
+ explicit CPDFSDK_XFAAnnotHandler(CPDFDoc_Environment* pApp); |
+ ~CPDFSDK_XFAAnnotHandler() {} |
+ |
+ public: |
+ virtual CFX_ByteString GetType() { return FSDK_XFAWIDGET_TYPENAME; } |
+ |
+ virtual CFX_ByteString GetName() { return "XFAWidgetHandler"; } |
+ |
+ virtual FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot); |
+ |
+ virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) { |
+ return NULL; |
+ } |
+ |
+ virtual CPDFSDK_Annot* NewAnnot(IXFA_Widget* pAnnot, CPDFSDK_PageView* pPage); |
+ |
+ virtual void ReleaseAnnot(CPDFSDK_Annot* pAnnot); |
+ |
+ virtual void DeleteAnnot(CPDFSDK_Annot* pAnnot) {} |
+ |
+ virtual CPDF_Rect GetViewBBox(CPDFSDK_PageView* pPageView, |
+ CPDFSDK_Annot* pAnnot); |
+ |
+ virtual FX_BOOL HitTest(CPDFSDK_PageView* pPageView, |
+ CPDFSDK_Annot* pAnnot, |
+ const CPDF_Point& point); |
+ |
+ virtual void OnDraw(CPDFSDK_PageView* pPageView, |
+ CPDFSDK_Annot* pAnnot, |
+ CFX_RenderDevice* pDevice, |
+ CPDF_Matrix* pUser2Device, |
+ FX_DWORD dwFlags); |
+ |
+ virtual void OnDrawSleep(CPDFSDK_PageView* pPageView, |
+ CPDFSDK_Annot* pAnnot, |
+ CFX_RenderDevice* pDevice, |
+ CPDF_Matrix* pUser2Device, |
+ const CPDF_Rect& rcWindow, |
+ FX_DWORD dwFlags) {} |
+ |
+ virtual void OnCreate(CPDFSDK_Annot* pAnnot) {} |
+ |
+ virtual void OnLoad(CPDFSDK_Annot* pAnnot) {} |
+ |
+ virtual void OnDelete(CPDFSDK_Annot* pAnnot) {} |
+ |
+ virtual void OnRelease(CPDFSDK_Annot* pAnnot) {} |
+ |
+ virtual void OnMouseEnter(CPDFSDK_PageView* pPageView, |
+ CPDFSDK_Annot* pAnnot, |
+ FX_DWORD nFlag); |
+ virtual void OnMouseExit(CPDFSDK_PageView* pPageView, |
+ CPDFSDK_Annot* pAnnot, |
+ FX_DWORD nFlag); |
+ |
+ virtual FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView, |
+ CPDFSDK_Annot* pAnnot, |
+ FX_DWORD nFlags, |
+ const CPDF_Point& point); |
+ virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView, |
+ CPDFSDK_Annot* pAnnot, |
+ FX_DWORD nFlags, |
+ const CPDF_Point& point); |
+ virtual FX_BOOL OnLButtonDblClk(CPDFSDK_PageView* pPageView, |
+ CPDFSDK_Annot* pAnnot, |
+ FX_DWORD nFlags, |
+ const CPDF_Point& point); |
+ virtual FX_BOOL OnMouseMove(CPDFSDK_PageView* pPageView, |
+ CPDFSDK_Annot* pAnnot, |
+ FX_DWORD nFlags, |
+ const CPDF_Point& point); |
+ virtual FX_BOOL OnMouseWheel(CPDFSDK_PageView* pPageView, |
+ CPDFSDK_Annot* pAnnot, |
+ FX_DWORD nFlags, |
+ short zDelta, |
+ const CPDF_Point& point); |
+ virtual FX_BOOL OnRButtonDown(CPDFSDK_PageView* pPageView, |
+ CPDFSDK_Annot* pAnnot, |
+ FX_DWORD nFlags, |
+ const CPDF_Point& point); |
+ virtual FX_BOOL OnRButtonUp(CPDFSDK_PageView* pPageView, |
+ CPDFSDK_Annot* pAnnot, |
+ FX_DWORD nFlags, |
+ const CPDF_Point& point); |
+ virtual FX_BOOL OnRButtonDblClk(CPDFSDK_PageView* pPageView, |
+ CPDFSDK_Annot* pAnnot, |
+ FX_DWORD nFlags, |
+ const CPDF_Point& point); |
+ // by wjm. |
+ virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, |
+ FX_DWORD nChar, |
+ FX_DWORD nFlags); |
+ virtual FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag); |
+ virtual FX_BOOL OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag); |
+ |
+ virtual void OnDeSelected(CPDFSDK_Annot* pAnnot) {} |
+ virtual void OnSelected(CPDFSDK_Annot* pAnnot) {} |
+ |
+ virtual FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag); |
+ virtual FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag); |
+ virtual FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot, |
+ CPDFSDK_Annot* pNewAnnot); |
+ |
+ private: |
+ IXFA_WidgetHandler* GetXFAWidgetHandler(CPDFSDK_Annot* pAnnot); |
+ FX_DWORD GetFWLFlags(FX_DWORD dwFlag); |
+ |
+ private: |
+ CPDFDoc_Environment* m_pApp; |
+}; |
+ |
+#endif |
#define CBA_AnnotHandlerArray CFX_ArrayTemplate<IPDFSDK_AnnotHandler*> |
class CPDFSDK_AnnotHandlerMgr { |
public: |
@@ -226,6 +364,10 @@ class CPDFSDK_AnnotHandlerMgr { |
virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, |
CPDFSDK_PageView* pPageView); |
+#ifdef PDF_ENABLE_XFA |
+ virtual CPDFSDK_Annot* NewAnnot(IXFA_Widget* pAnnot, |
+ CPDFSDK_PageView* pPageView); |
+#endif |
virtual void ReleaseAnnot(CPDFSDK_Annot* pAnnot); |
virtual void Annot_OnCreate(CPDFSDK_Annot* pAnnot); |
@@ -287,6 +429,10 @@ class CPDFSDK_AnnotHandlerMgr { |
virtual FX_BOOL Annot_OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag); |
virtual FX_BOOL Annot_OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag); |
+#ifdef PDF_ENABLE_XFA |
+ virtual FX_BOOL Annot_OnChangeFocus(CPDFSDK_Annot* pSetAnnot, |
+ CPDFSDK_Annot* pKillAnnot); |
+#endif |
virtual CPDF_Rect Annot_OnGetViewBBox(CPDFSDK_PageView* pPageView, |
CPDFSDK_Annot* pAnnot); |