Index: fpdfsdk/src/formfiller/FFL_IFormFiller.cpp |
diff --git a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp b/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp |
index b820d7fa0d0cd2b33f60032b12b846890e11014c..3257faae681cac63cf29b8ab317fb16c6a0d1b1a 100644 |
--- a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp |
+++ b/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp |
@@ -277,6 +277,12 @@ FX_BOOL CFFL_IFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, |
OnButtonUp(pWidget, pPageView, bReset, bExit, nFlags); |
if (bExit) |
return TRUE; |
+#ifdef PDF_ENABLE_XFA |
+ |
+ OnClick(pWidget, pPageView, bReset, bExit, nFlags); |
+ if (bExit) |
+ return TRUE; |
+#endif |
} |
return bRet; |
} |
@@ -792,6 +798,190 @@ void CFFL_IFormFiller::OnFormat(CPDFSDK_Widget* pWidget, |
} |
} |
+#ifdef PDF_ENABLE_XFA |
+void CFFL_IFormFiller::OnClick(CPDFSDK_Widget* pWidget, |
+ CPDFSDK_PageView* pPageView, |
+ FX_BOOL& bReset, |
+ FX_BOOL& bExit, |
+ FX_UINT nFlag) { |
+ ASSERT(pWidget != NULL); |
+ |
+ if (!m_bNotifying) { |
+ if (pWidget->HasXFAAAction(PDFSDK_XFA_Click)) { |
+ m_bNotifying = TRUE; |
+ int nAge = pWidget->GetAppearanceAge(); |
+ int nValueAge = pWidget->GetValueAge(); |
+ |
+ PDFSDK_FieldAction fa; |
+ fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
+ fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
+ |
+ pWidget->OnXFAAAction(PDFSDK_XFA_Click, fa, pPageView); |
+ m_bNotifying = FALSE; |
+ |
+ if (!IsValidAnnot(pPageView, pWidget)) { |
+ bExit = TRUE; |
+ return; |
+ } |
+ |
+ if (nAge != pWidget->GetAppearanceAge()) { |
+ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { |
+ pFormFiller->ResetPDFWindow(pPageView, |
+ nValueAge == pWidget->GetValueAge()); |
+ } |
+ |
+ bReset = TRUE; |
+ } |
+ } |
+ } |
+} |
+ |
+void CFFL_IFormFiller::OnFull(CPDFSDK_Widget* pWidget, |
+ CPDFSDK_PageView* pPageView, |
+ FX_BOOL& bReset, |
+ FX_BOOL& bExit, |
+ FX_UINT nFlag) { |
+ ASSERT(pWidget != NULL); |
+ |
+ if (!m_bNotifying) { |
+ if (pWidget->HasXFAAAction(PDFSDK_XFA_Full)) { |
+ m_bNotifying = TRUE; |
+ int nAge = pWidget->GetAppearanceAge(); |
+ int nValueAge = pWidget->GetValueAge(); |
+ |
+ PDFSDK_FieldAction fa; |
+ fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
+ fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
+ |
+ pWidget->OnXFAAAction(PDFSDK_XFA_Full, fa, pPageView); |
+ m_bNotifying = FALSE; |
+ |
+ if (!IsValidAnnot(pPageView, pWidget)) { |
+ bExit = TRUE; |
+ return; |
+ } |
+ |
+ if (nAge != pWidget->GetAppearanceAge()) { |
+ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { |
+ pFormFiller->ResetPDFWindow(pPageView, |
+ nValueAge == pWidget->GetValueAge()); |
+ } |
+ |
+ bReset = TRUE; |
+ } |
+ } |
+ } |
+} |
+ |
+void CFFL_IFormFiller::OnPopupPreOpen(void* pPrivateData, |
+ FX_BOOL& bExit, |
+ FX_DWORD nFlag) { |
+ ASSERT(pPrivateData != NULL); |
+ CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; |
+ ASSERT(pData->pWidget != NULL); |
+ |
+ FX_BOOL bTempReset = FALSE; |
+ FX_BOOL bTempExit = FALSE; |
+ this->OnPreOpen(pData->pWidget, pData->pPageView, bTempReset, bTempExit, |
+ nFlag); |
+ |
+ if (bTempReset || bTempExit) { |
+ bExit = TRUE; |
+ } |
+} |
+ |
+void CFFL_IFormFiller::OnPopupPostOpen(void* pPrivateData, |
+ FX_BOOL& bExit, |
+ FX_DWORD nFlag) { |
+ ASSERT(pPrivateData != NULL); |
+ CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; |
+ ASSERT(pData->pWidget != NULL); |
+ |
+ FX_BOOL bTempReset = FALSE; |
+ FX_BOOL bTempExit = FALSE; |
+ this->OnPostOpen(pData->pWidget, pData->pPageView, bTempReset, bTempExit, |
+ nFlag); |
+ |
+ if (bTempReset || bTempExit) { |
+ bExit = TRUE; |
+ } |
+} |
+ |
+void CFFL_IFormFiller::OnPreOpen(CPDFSDK_Widget* pWidget, |
+ CPDFSDK_PageView* pPageView, |
+ FX_BOOL& bReset, |
+ FX_BOOL& bExit, |
+ FX_UINT nFlag) { |
+ ASSERT(pWidget != NULL); |
+ |
+ if (!m_bNotifying) { |
+ if (pWidget->HasXFAAAction(PDFSDK_XFA_PreOpen)) { |
+ m_bNotifying = TRUE; |
+ int nAge = pWidget->GetAppearanceAge(); |
+ int nValueAge = pWidget->GetValueAge(); |
+ |
+ PDFSDK_FieldAction fa; |
+ fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
+ fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
+ |
+ pWidget->OnXFAAAction(PDFSDK_XFA_PreOpen, fa, pPageView); |
+ m_bNotifying = FALSE; |
+ |
+ if (!IsValidAnnot(pPageView, pWidget)) { |
+ bExit = TRUE; |
+ return; |
+ } |
+ |
+ if (nAge != pWidget->GetAppearanceAge()) { |
+ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { |
+ pFormFiller->ResetPDFWindow(pPageView, |
+ nValueAge == pWidget->GetValueAge()); |
+ } |
+ |
+ bReset = TRUE; |
+ } |
+ } |
+ } |
+} |
+ |
+void CFFL_IFormFiller::OnPostOpen(CPDFSDK_Widget* pWidget, |
+ CPDFSDK_PageView* pPageView, |
+ FX_BOOL& bReset, |
+ FX_BOOL& bExit, |
+ FX_UINT nFlag) { |
+ ASSERT(pWidget != NULL); |
+ |
+ if (!m_bNotifying) { |
+ if (pWidget->HasXFAAAction(PDFSDK_XFA_PostOpen)) { |
+ m_bNotifying = TRUE; |
+ int nAge = pWidget->GetAppearanceAge(); |
+ int nValueAge = pWidget->GetValueAge(); |
+ |
+ PDFSDK_FieldAction fa; |
+ fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
+ fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
+ |
+ pWidget->OnXFAAAction(PDFSDK_XFA_PostOpen, fa, pPageView); |
+ m_bNotifying = FALSE; |
+ |
+ if (!IsValidAnnot(pPageView, pWidget)) { |
+ bExit = TRUE; |
+ return; |
+ } |
+ |
+ if (nAge != pWidget->GetAppearanceAge()) { |
+ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { |
+ pFormFiller->ResetPDFWindow(pPageView, |
+ nValueAge == pWidget->GetValueAge()); |
+ } |
+ |
+ bReset = TRUE; |
+ } |
+ } |
+ } |
+} |
+ |
+#endif |
FX_BOOL CFFL_IFormFiller::IsValidAnnot(CPDFSDK_PageView* pPageView, |
CPDFSDK_Annot* pAnnot) { |
if (pPageView) |
@@ -816,6 +1006,19 @@ void CFFL_IFormFiller::OnBeforeKeyStroke(void* pPrivateData, |
CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); |
ASSERT(pFormFiller != NULL); |
+#ifdef PDF_ENABLE_XFA |
+ if (pFormFiller->IsFieldFull(pData->pPageView)) { |
+ FX_BOOL bFullExit = FALSE; |
+ FX_BOOL bFullReset = FALSE; |
+ OnFull(pData->pWidget, pData->pPageView, bFullReset, bFullExit, nFlag); |
+ |
+ if (bFullReset || bFullExit) { |
+ bExit = TRUE; |
+ return; |
+ } |
+ } |
+ |
+#endif |
if (!m_bNotifying) { |
if (pData->pWidget->GetAAction(CPDF_AAction::KeyStroke)) { |
m_bNotifying = TRUE; |