IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler( CPDFSDK_Annot* pAnnot) const { CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); if (pPDFAnnot) return GetAnnotHandler(pPDFAnnot->GetSubType()); #ifdef PDF_ENABLE_XFA if (pAnnot->GetXFAWidget()) return GetAnnotHandler(FSDK_XFAWIDGET_TYPENAME); #endif // PDF_ENABLE_XFA return nullptr; }
void CPDFSDK_AnnotHandlerMgr::Annot_OnLoad(CPDFSDK_Annot* pAnnot) { ASSERT(pAnnot); if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { pAnnotHandler->OnLoad(pAnnot); } }
void CPDFSDK_AnnotHandlerMgr::RegisterAnnotHandler( IPDFSDK_AnnotHandler* pAnnotHandler) { ASSERT(!GetAnnotHandler(pAnnotHandler->GetType())); m_Handlers.Add(pAnnotHandler); m_mapType2Handler[pAnnotHandler->GetType()] = pAnnotHandler; }
void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseExit( CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag) { ASSERT(pAnnot->HasObservable()); GetAnnotHandler(pAnnot->Get())->OnMouseExit(pPageView, pAnnot, nFlag); }
void CPDFSDK_AnnotHandlerMgr::ReleaseAnnot(CPDFSDK_Annot* pAnnot) { if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { pAnnotHandler->OnRelease(pAnnot); pAnnotHandler->ReleaseAnnot(pAnnot); } else { delete pAnnot; } }
CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(CXFA_FFWidget* pAnnot, CPDFSDK_PageView* pPageView) { ASSERT(pAnnot); ASSERT(pPageView); return GetAnnotHandler(CPDF_Annot::Subtype::XFAWIDGET) ->NewAnnot(pAnnot, pPageView); }
FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) { ASSERT(pAnnot); if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) return pAnnotHandler->OnKillFocus(pAnnot, nFlag); return FALSE; }
FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnChar(CPDFSDK_Annot* pAnnot, FX_DWORD nChar, FX_DWORD nFlags) { if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { return pAnnotHandler->OnChar(pAnnot, nChar, nFlags); } return FALSE; }
void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseEnter(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlag) { ASSERT(pAnnot); if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) pAnnotHandler->OnMouseEnter(pPageView, pAnnot, nFlag); }
void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) { ASSERT(pAnnot); if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) pAnnotHandler->OnMouseExit(pPageView, pAnnot, nFlag); }
CPDF_Rect CPDFSDK_AnnotHandlerMgr::Annot_OnGetViewBBox( CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot) { ASSERT(pAnnot); if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) return pAnnotHandler->GetViewBBox(pPageView, pAnnot); return pAnnot->GetRect(); }
void CPDFSDK_AnnotHandlerMgr::Annot_OnDraw(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, const CFX_Matrix& mtUser2Device, bool bDrawAnnots) { ASSERT(pAnnot); GetAnnotHandler(pAnnot)->OnDraw(pPageView, pAnnot, pDevice, mtUser2Device, bDrawAnnots); }
bool CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonUp( CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, const CFX_PointF& point) { ASSERT(pAnnot->HasObservable()); return GetAnnotHandler(pAnnot->Get()) ->OnRButtonUp(pPageView, pAnnot, nFlags, point); }
FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnHitTest(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, const CPDF_Point& point) { ASSERT(pAnnot); if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { if (pAnnotHandler->CanAnswer(pAnnot)) return pAnnotHandler->HitTest(pPageView, pAnnot, point); } return FALSE; }
bool CPDFSDK_AnnotHandlerMgr::Annot_OnMouseWheel( CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, short zDelta, const CFX_PointF& point) { ASSERT(pAnnot->HasObservable()); return GetAnnotHandler(pAnnot->Get()) ->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, point); }
bool CPDFSDK_AnnotHandlerMgr::Annot_OnHitTest(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, const CFX_PointF& point) { ASSERT(pAnnot); IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot); if (pAnnotHandler->CanAnswer(pAnnot)) return pAnnotHandler->HitTest(pPageView, pAnnot, point); return false; }
void CPDFSDK_AnnotHandlerMgr::ReleaseAnnot(CPDFSDK_Annot* pAnnot) { pAnnot->GetPDFPage(); if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { pAnnotHandler->OnRelease(pAnnot); pAnnotHandler->ReleaseAnnot(pAnnot); } else { delete (CPDFSDK_Annot*)pAnnot; } }
void CPDFSDK_AnnotHandlerMgr::Annot_OnCreate(CPDFSDK_Annot* pAnnot) { CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); CPDFSDK_DateTime curTime; pPDFAnnot->GetAnnotDict()->SetAtString("M", curTime.ToPDFDateTimeString()); pPDFAnnot->GetAnnotDict()->SetAtNumber("F", 0); if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { pAnnotHandler->OnCreate(pAnnot); } }
FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) { ASSERT(pAnnot); if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { return pAnnotHandler->OnRButtonUp(pPageView, pAnnot, nFlags, point); } return FALSE; }
CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPageView) { ASSERT(pPageView); if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot->GetSubType())) { return pAnnotHandler->NewAnnot(pAnnot, pPageView); } return new CPDFSDK_BAAnnot(pAnnot, pPageView); }
CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(CXFA_FFWidget* pAnnot, CPDFSDK_PageView* pPageView) { ASSERT(pAnnot); ASSERT(pPageView); if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(FSDK_XFAWIDGET_TYPENAME)) { return pAnnotHandler->NewAnnot(pAnnot, pPageView); } return nullptr; }
bool CPDFSDK_AnnotHandlerMgr::Annot_OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) { if (CPDFSDK_FormFillEnvironment::IsCTRLKeyDown(nFlag) || CPDFSDK_FormFillEnvironment::IsALTKeyDown(nFlag)) { return GetAnnotHandler(pAnnot)->OnKeyDown(pAnnot, nKeyCode, nFlag); } CPDFSDK_PageView* pPage = pAnnot->GetPageView(); CPDFSDK_Annot* pFocusAnnot = pPage->GetFocusAnnot(); if (pFocusAnnot && (nKeyCode == FWL_VKEY_Tab)) { CPDFSDK_Annot::ObservedPtr pNext(GetNextAnnot( pFocusAnnot, !CPDFSDK_FormFillEnvironment::IsSHIFTKeyDown(nFlag))); if (pNext && pNext.Get() != pFocusAnnot) { pPage->GetFormFillEnv()->SetFocusAnnot(&pNext); return true; } } return GetAnnotHandler(pAnnot)->OnKeyDown(pAnnot, nKeyCode, nFlag); }
FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonDown( CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, const CFX_FloatPoint& point) { ASSERT(pAnnot); if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { return pAnnotHandler->OnRButtonDown(pPageView, pAnnot, nFlags, point); } return FALSE; }
CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(IXFA_Widget* pAnnot, CPDFSDK_PageView* pPageView) { ASSERT(pAnnot != NULL); ASSERT(pPageView != NULL); if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(FSDK_XFAWIDGET_TYPENAME)) { return pAnnotHandler->NewAnnot(pAnnot, pPageView); } return NULL; }
FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseWheel(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, short zDelta, const CPDF_Point& point) { ASSERT(pAnnot); if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { return pAnnotHandler->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, point); } return FALSE; }
FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) { ASSERT(pAnnot); if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { if (pAnnotHandler->OnSetFocus(pAnnot, nFlag)) { CPDFSDK_PageView* pPage = pAnnot->GetPageView(); pPage->GetSDKDocument(); return TRUE; } } return FALSE; }
bool CPDFSDK_AnnotHandlerMgr::Annot_OnChangeFocus( CPDFSDK_Annot::ObservedPtr* pSetAnnot, CPDFSDK_Annot::ObservedPtr* pKillAnnot) { bool bXFA = (*pSetAnnot && (*pSetAnnot)->GetXFAWidget()) || (*pKillAnnot && (*pKillAnnot)->GetXFAWidget()); if (bXFA) { if (IPDFSDK_AnnotHandler* pXFAAnnotHandler = GetAnnotHandler(CPDF_Annot::Subtype::XFAWIDGET)) return pXFAAnnotHandler->OnXFAChangedFocus(pKillAnnot, pSetAnnot); } return true; }
FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnChangeFocus( CPDFSDK_Annot* pSetAnnot, CPDFSDK_Annot* pKillAnnot) { FX_BOOL bXFA = (pSetAnnot && pSetAnnot->GetXFAWidget()) || (pKillAnnot && pKillAnnot->GetXFAWidget()); if (bXFA) { if (IPDFSDK_AnnotHandler* pXFAAnnotHandler = GetAnnotHandler(FSDK_XFAWIDGET_TYPENAME)) return pXFAAnnotHandler->OnXFAChangedFocus(pKillAnnot, pSetAnnot); } return TRUE; }
void CPDFSDK_AnnotHandlerMgr::Annot_OnDraw(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, FX_DWORD dwFlags) { ASSERT(pAnnot); if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { pAnnotHandler->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); } else { #ifdef PDF_ENABLE_XFA if (pAnnot->IsXFAField()) return; #endif // PDF_ENABLE_XFA static_cast<CPDFSDK_BAAnnot*>(pAnnot) ->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr); } }
FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) { if (!m_pApp->FFI_IsCTRLKeyDown(nFlag) && !m_pApp->FFI_IsALTKeyDown(nFlag)) { CPDFSDK_PageView* pPage = pAnnot->GetPageView(); CPDFSDK_Annot* pFocusAnnot = pPage->GetFocusAnnot(); if (pFocusAnnot && (nKeyCode == FWL_VKEY_Tab)) { CPDFSDK_Annot* pNext = GetNextAnnot(pFocusAnnot, !m_pApp->FFI_IsSHIFTKeyDown(nFlag)); if (pNext && pNext != pFocusAnnot) { CPDFSDK_Document* pDocument = pPage->GetSDKDocument(); pDocument->SetFocusAnnot(pNext); return TRUE; } } } if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { return pAnnotHandler->OnKeyDown(pAnnot, nKeyCode, nFlag); } return FALSE; }