FX_BOOL CPDFSDK_BFAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) { ASSERT(pAnnot->GetType() == "Widget"); if (pAnnot->GetSubType() == BFFT_SIGNATURE) return FALSE; CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; if (!pWidget->IsVisible()) return FALSE; int nFieldFlags = pWidget->GetFieldFlags(); if ((nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY) return FALSE; if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON) return TRUE; CPDF_Page* pPage = pWidget->GetPDFPage(); CPDF_Document* pDocument = pPage->m_pDocument; FX_DWORD dwPermissions = pDocument->GetUserPermissions(); return (dwPermissions & FPDFPERM_FILL_FORM) || (dwPermissions & FPDFPERM_ANNOT_FORM); }
FX_BOOL CPDFSDK_WidgetHandler::CanAnswer(CPDFSDK_Annot* pAnnot) { ASSERT(pAnnot->GetAnnotSubtype() == CPDF_Annot::Subtype::WIDGET); if (pAnnot->IsSignatureWidget()) return FALSE; CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot); if (!pWidget->IsVisible()) return FALSE; int nFieldFlags = pWidget->GetFieldFlags(); if ((nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY) return FALSE; if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON) return TRUE; CPDF_Page* pPage = pWidget->GetPDFPage(); CPDF_Document* pDocument = pPage->m_pDocument; uint32_t dwPermissions = pDocument->GetUserPermissions(); return (dwPermissions & FPDFPERM_FILL_FORM) || (dwPermissions & FPDFPERM_ANNOT_FORM); }