void CPDFSDK_BFAnnotHandler::OnLoad(CPDFSDK_Annot* pAnnot) { if (pAnnot->GetSubType() == BFFT_SIGNATURE) return; CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; if (!pWidget->IsAppearanceValid()) pWidget->ResetAppearance(NULL, FALSE); int nFieldType = pWidget->GetFieldType(); if (nFieldType == FIELDTYPE_TEXTFIELD || nFieldType == FIELDTYPE_COMBOBOX) { FX_BOOL bFormated = FALSE; CFX_WideString sValue = pWidget->OnFormat(bFormated); if (bFormated && nFieldType == FIELDTYPE_COMBOBOX) { pWidget->ResetAppearance(sValue.c_str(), FALSE); } } #ifdef PDF_ENABLE_XFA CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument(); CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument(); if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) { if (!pWidget->IsAppearanceValid() && !pWidget->GetValue().IsEmpty()) pWidget->ResetAppearance(FALSE); } #endif // PDF_ENABLE_XFA if (m_pFormFiller) m_pFormFiller->OnLoad(pAnnot); }
void CPDFSDK_WidgetHandler::OnLoad(CPDFSDK_Annot* pAnnot) { if (pAnnot->IsSignatureWidget()) return; CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot); if (!pWidget->IsAppearanceValid()) pWidget->ResetAppearance(nullptr, FALSE); int nFieldType = pWidget->GetFieldType(); if (nFieldType == FIELDTYPE_TEXTFIELD || nFieldType == FIELDTYPE_COMBOBOX) { FX_BOOL bFormatted = FALSE; CFX_WideString sValue = pWidget->OnFormat(bFormatted); if (bFormatted && nFieldType == FIELDTYPE_COMBOBOX) pWidget->ResetAppearance(&sValue, FALSE); } #ifdef PDF_ENABLE_XFA CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument(); CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument(); if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) { if (!pWidget->IsAppearanceValid() && !pWidget->GetValue().IsEmpty()) pWidget->ResetAppearance(FALSE); } #endif // PDF_ENABLE_XFA if (m_pFormFiller) m_pFormFiller->OnLoad(pAnnot); }
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; }
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; }
IXFA_WidgetHandler* CPDFSDK_XFAAnnotHandler::GetXFAWidgetHandler( CPDFSDK_Annot* pAnnot) { if (!pAnnot) return NULL; CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); if (!pPageView) return NULL; CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument(); if (!pSDKDoc) return NULL; CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument(); if (!pDoc) return NULL; IXFA_DocView* pDocView = pDoc->GetXFADocView(); if (!pDocView) return NULL; return pDocView->GetWidgetHandler(); }