diff options
Diffstat (limited to 'fpdfsdk/formfiller/cffl_interactiveformfiller.cpp')
-rw-r--r-- | fpdfsdk/formfiller/cffl_interactiveformfiller.cpp | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp index 3db7aa9ab9..d73aaf93b3 100644 --- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp +++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp @@ -118,7 +118,7 @@ void CFFL_InteractiveFormFiller::OnMouseEnter( uint32_t nFlag) { ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); if (!m_bNotifying) { - CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); + CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get()); if (pWidget->GetAAction(CPDF_AAction::CursorEnter).GetDict()) { m_bNotifying = true; @@ -151,7 +151,7 @@ void CFFL_InteractiveFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, uint32_t nFlag) { ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); if (!m_bNotifying) { - CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); + CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get()); if (pWidget->GetAAction(CPDF_AAction::CursorExit).GetDict()) { m_bNotifying = true; @@ -186,7 +186,7 @@ bool CFFL_InteractiveFormFiller::OnLButtonDown( const CFX_PointF& point) { ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); if (!m_bNotifying) { - CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); + CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get()); if (Annot_HitTest(pPageView, pAnnot->Get(), point) && pWidget->GetAAction(CPDF_AAction::ButtonDown).GetDict()) { m_bNotifying = true; @@ -224,7 +224,7 @@ bool CFFL_InteractiveFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, uint32_t nFlags, const CFX_PointF& point) { ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); - CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); + CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get()); bool bSetFocus; switch (pWidget->GetFieldType()) { @@ -263,7 +263,7 @@ bool CFFL_InteractiveFormFiller::OnButtonUp(CPDFSDK_Annot::ObservedPtr* pAnnot, if (m_bNotifying) return false; - CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); + CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get()); if (!pWidget->GetAAction(CPDF_AAction::ButtonUp).GetDict()) return false; @@ -371,7 +371,7 @@ bool CFFL_InteractiveFormFiller::OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); if (!m_bNotifying) { - CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); + CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get()); if (pWidget->GetAAction(CPDF_AAction::GetFocus).GetDict()) { m_bNotifying = true; @@ -426,7 +426,7 @@ bool CFFL_InteractiveFormFiller::OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, if (m_bNotifying) return true; - CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); + CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get()); if (!pWidget->GetAAction(CPDF_AAction::LoseFocus).GetDict()) return true; @@ -475,8 +475,7 @@ CFFL_FormFiller* CFFL_InteractiveFormFiller::GetFormFiller( if (!bRegister) return nullptr; - // TODO(thestig): How do we know |pAnnot| is a CPDFSDK_Widget? - CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot); + CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot); FormFieldType fieldType = pWidget->GetFieldType(); CFFL_FormFiller* pFormFiller; switch (fieldType) { @@ -633,7 +632,7 @@ bool CFFL_InteractiveFormFiller::OnKeyStrokeCommit( if (m_bNotifying) return true; - CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); + CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get()); if (!pWidget->GetAAction(CPDF_AAction::KeyStroke).GetDict()) return true; @@ -665,7 +664,7 @@ bool CFFL_InteractiveFormFiller::OnValidate(CPDFSDK_Annot::ObservedPtr* pAnnot, if (m_bNotifying) return true; - CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); + CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get()); if (!pWidget->GetAAction(CPDF_AAction::Validate).GetDict()) return true; @@ -696,7 +695,7 @@ void CFFL_InteractiveFormFiller::OnCalculate(CPDFSDK_Annot::ObservedPtr* pAnnot, if (m_bNotifying) return; - CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); + CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get()); if (pWidget) { CPDFSDK_InterForm* pInterForm = pPageView->GetFormFillEnv()->GetInterForm(); pInterForm->OnCalculate(pWidget->GetFormField()); @@ -710,7 +709,7 @@ void CFFL_InteractiveFormFiller::OnFormat(CPDFSDK_Annot::ObservedPtr* pAnnot, if (m_bNotifying) return; - CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); + CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get()); ASSERT(pWidget); CPDFSDK_InterForm* pInterForm = pPageView->GetFormFillEnv()->GetInterForm(); @@ -734,7 +733,7 @@ bool CFFL_InteractiveFormFiller::OnClick(CPDFSDK_Annot::ObservedPtr* pAnnot, if (m_bNotifying) return false; - CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); + CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get()); if (!pWidget->HasXFAAAction(PDFSDK_XFA_Click)) return false; @@ -764,7 +763,7 @@ bool CFFL_InteractiveFormFiller::OnFull(CPDFSDK_Annot::ObservedPtr* pAnnot, if (m_bNotifying) return false; - CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); + CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get()); if (!pWidget->HasXFAAAction(PDFSDK_XFA_Full)) return false; @@ -817,7 +816,7 @@ bool CFFL_InteractiveFormFiller::OnPreOpen(CPDFSDK_Annot::ObservedPtr* pAnnot, if (m_bNotifying) return false; - CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); + CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get()); if (!pWidget->HasXFAAAction(PDFSDK_XFA_PreOpen)) return false; @@ -848,7 +847,7 @@ bool CFFL_InteractiveFormFiller::OnPostOpen(CPDFSDK_Annot::ObservedPtr* pAnnot, if (m_bNotifying) return false; - CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); + CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get()); if (!pWidget->HasXFAAAction(PDFSDK_XFA_PostOpen)) return false; |