diff options
author | Bo Xu <bo_xu@foxitsoftware.com> | 2014-10-28 23:03:33 -0700 |
---|---|---|
committer | Bo Xu <bo_xu@foxitsoftware.com> | 2014-11-03 11:10:11 -0800 |
commit | fdc00a7042d912aafaabddae4d9c84199921ef23 (patch) | |
tree | 32ab8ac91cc68d2cd15b9168782a71b3f3f5e7b9 /fpdfsdk/src/formfiller | |
parent | e9b38fa38de2c95d8260be31c57d9272c4d127ed (diff) | |
download | pdfium-fdc00a7042d912aafaabddae4d9c84199921ef23.tar.xz |
Merge XFA to PDFium master at 4dc95e7 on 10/28/2014
Diffstat (limited to 'fpdfsdk/src/formfiller')
-rw-r--r-- | fpdfsdk/src/formfiller/FFL_ComboBox.cpp | 13 | ||||
-rw-r--r-- | fpdfsdk/src/formfiller/FFL_FormFiller.cpp | 11 | ||||
-rw-r--r-- | fpdfsdk/src/formfiller/FFL_IFormFiller.cpp | 202 | ||||
-rw-r--r-- | fpdfsdk/src/formfiller/FFL_TextField.cpp | 12 |
4 files changed, 233 insertions, 5 deletions
diff --git a/fpdfsdk/src/formfiller/FFL_ComboBox.cpp b/fpdfsdk/src/formfiller/FFL_ComboBox.cpp index ee6b7bd83a..1c5b49812e 100644 --- a/fpdfsdk/src/formfiller/FFL_ComboBox.cpp +++ b/fpdfsdk/src/formfiller/FFL_ComboBox.cpp @@ -348,6 +348,19 @@ void CFFL_ComboBox::OnKeyStroke(FX_BOOL bKeyDown, FX_UINT nFlag) } } +FX_BOOL CFFL_ComboBox::IsFieldFull(CPDFSDK_PageView* pPageView) +{ + if (CPWL_ComboBox* pComboBox = (CPWL_ComboBox*)GetPDFWindow(pPageView, FALSE)) + { + if (CPWL_Edit* pEdit = (CPWL_Edit*)*pComboBox) + { + return pEdit->IsTextFull(); + } + } + + return FALSE; +} + void CFFL_ComboBox::OnSetFocus(CPWL_Wnd* pWnd) { ASSERT(m_pApp != NULL); diff --git a/fpdfsdk/src/formfiller/FFL_FormFiller.cpp b/fpdfsdk/src/formfiller/FFL_FormFiller.cpp index 530b80ce6f..c9dd6681d2 100644 --- a/fpdfsdk/src/formfiller/FFL_FormFiller.cpp +++ b/fpdfsdk/src/formfiller/FFL_FormFiller.cpp @@ -292,7 +292,7 @@ FX_BOOL CFFL_FormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) { CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; - CPDF_Page * pPage = pWidget->GetPDFPage(); + CPDFXFA_Page * pPage = pWidget->GetPDFXFAPage(); CPDFSDK_Document * pDoc = m_pApp->GetCurrentDoc(); CPDFSDK_PageView* pPageView = pDoc->GetPageView(pPage); ASSERT(pPageView != NULL); @@ -567,7 +567,7 @@ CPDF_Rect CFFL_FormFiller::GetPDFWindowRect() const CPDFSDK_PageView* CFFL_FormFiller::GetCurPageView() { - CPDF_Page* pPage = m_pAnnot->GetPDFPage(); + CPDFXFA_Page* pPage = m_pAnnot->GetPDFXFAPage(); CPDFSDK_Document* pSDKDoc = m_pApp->GetCurrentDoc(); if(pSDKDoc) { @@ -713,6 +713,11 @@ void CFFL_FormFiller::GetKeyStrokeData(CPDFSDK_PageView* pPageView, FFL_KeyStrok { } +FX_BOOL CFFL_FormFiller::IsFieldFull(CPDFSDK_PageView* pPageView) +{ + return FALSE; +} + void CFFL_FormFiller::SetChangeMark() { m_pApp->FFI_OnChange(); @@ -803,7 +808,7 @@ void CFFL_FormFiller::DoPaste(CPDFSDK_Document* pDocument) void CFFL_FormFiller::InvalidateRect(double left, double top, double right, double bottom) { - CPDF_Page * pPage = m_pWidget->GetPDFPage(); + CPDFXFA_Page * pPage = m_pWidget->GetPDFXFAPage(); m_pApp->FFI_Invalidate(pPage, left, top, right, bottom); } diff --git a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp b/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp index 2b21e13cfc..61cb55f66d 100644 --- a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp +++ b/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp @@ -335,6 +335,9 @@ FX_BOOL CFFL_IFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot FX_BOOL bReset = FALSE; OnButtonUp(pWidget, pPageView, bReset, bExit,nFlags); if (bExit) return TRUE; + + OnClick(pWidget, pPageView, bReset, bExit, nFlags); + if (bExit) return TRUE; } return bRet; } @@ -830,7 +833,7 @@ void CFFL_IFormFiller::OnSetWindowRect(void* pPrivateData, const CPDF_Rect & rcW unRect.right = (FX_FLOAT)(unRect.right + 0.5); unRect.top = (FX_FLOAT)(unRect.top + 0.5); unRect.bottom = (FX_FLOAT)(unRect.bottom -0.5); - m_pApp->FFI_Invalidate(pData->pWidget->GetPDFPage(), unRect.left, unRect.top, unRect.right, unRect.bottom); + m_pApp->FFI_Invalidate(pData->pWidget->GetPDFXFAPage(), unRect.left, unRect.top, unRect.right, unRect.bottom); } } @@ -1037,6 +1040,190 @@ FX_BOOL CFFL_IFormFiller::GetKeyDown() // return msg.message == WM_KEYDOWN || msg.message == WM_CHAR; } +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; + } + } + } +} + FX_BOOL CFFL_IFormFiller::IsValidAnnot(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot) { @@ -1109,6 +1296,19 @@ void CFFL_IFormFiller::OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); ASSERT(pFormFiller != NULL); + 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; + } + } + if (!m_bNotifying) { if (pData->pWidget->GetAAction(CPDF_AAction::KeyStroke)) diff --git a/fpdfsdk/src/formfiller/FFL_TextField.cpp b/fpdfsdk/src/formfiller/FFL_TextField.cpp index 45c716280c..f9c93914a5 100644 --- a/fpdfsdk/src/formfiller/FFL_TextField.cpp +++ b/fpdfsdk/src/formfiller/FFL_TextField.cpp @@ -176,7 +176,7 @@ FX_BOOL CFFL_TextField::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFl ASSERT(pPageView != NULL); m_bValid = !m_bValid; CPDF_Rect rcAnnot = pAnnot->GetRect(); - m_pApp->FFI_Invalidate(pAnnot->GetPDFPage(), rcAnnot.left, rcAnnot.top, rcAnnot.right, rcAnnot.bottom); + m_pApp->FFI_Invalidate(pAnnot->GetPDFXFAPage(), rcAnnot.left, rcAnnot.top, rcAnnot.right, rcAnnot.bottom); if (m_bValid) { @@ -348,6 +348,16 @@ CPWL_Wnd* CFFL_TextField::ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bR return pRet; } +FX_BOOL CFFL_TextField::IsFieldFull(CPDFSDK_PageView* pPageView) +{ + if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) + { + return pWnd->IsTextFull(); + } + + return FALSE; +} + void CFFL_TextField::OnSetFocus(CPWL_Wnd* pWnd) { ASSERT(m_pApp != NULL); |