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 CPDF_AnnotList::DisplayPass(const CPDF_Page* pPage, CFX_RenderDevice* pDevice, CPDF_RenderContext* pContext, FX_BOOL bPrinting, CFX_AffineMatrix* pMatrix, FX_BOOL bWidgetPass, CPDF_RenderOptions* pOptions, FX_RECT* clip_rect) { for (int i = 0; i < m_AnnotList.GetSize(); i ++) { CPDF_Annot* pAnnot = (CPDF_Annot*)m_AnnotList[i]; FX_BOOL bWidget = pAnnot->GetSubType() == "Widget"; if ((bWidgetPass && !bWidget) || (!bWidgetPass && bWidget)) { continue; } FX_DWORD annot_flags = pAnnot->GetFlags(); if (annot_flags & ANNOTFLAG_HIDDEN) { continue; } if (bPrinting && (annot_flags & ANNOTFLAG_PRINT) == 0) { continue; } if (!bPrinting && (annot_flags & ANNOTFLAG_NOVIEW)) { continue; } if (pOptions != NULL) { IPDF_OCContext* pOCContext = pOptions->m_pOCContext; CPDF_Dictionary* pAnnotDict = pAnnot->m_pAnnotDict; if (pOCContext != NULL && pAnnotDict != NULL && !pOCContext->CheckOCGVisible(pAnnotDict->GetDict(FX_BSTRC("OC")))) { continue; } } CPDF_Rect annot_rect_f; pAnnot->GetRect(annot_rect_f); CFX_Matrix matrix; matrix = *pMatrix; if (clip_rect) { annot_rect_f.Transform(&matrix); FX_RECT annot_rect = annot_rect_f.GetOutterRect(); annot_rect.Intersect(*clip_rect); if (annot_rect.IsEmpty()) { continue; } } if (pContext) { pAnnot->DrawInContext(pPage, pContext, &matrix, CPDF_Annot::Normal); } else if (!pAnnot->DrawAppearance(pPage, pDevice, &matrix, CPDF_Annot::Normal, pOptions)) { pAnnot->DrawBorder(pDevice, &matrix, pOptions); } } }
CPDF_Annot* CPDFSDK_PageView::GetPDFWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY) { int nCount = m_pAnnotList->Count(); for(int i = 0 ; i<nCount; i++) { CPDF_Annot* pAnnot = m_pAnnotList->GetAt(i); if(pAnnot->GetSubType() == "Widget") { CFX_FloatRect annotRect; pAnnot->GetRect(annotRect); if(annotRect.Contains(pageX, pageY)) return pAnnot; } } return NULL; }