FX_RECT CFFL_IFormFiller::GetViewBBox(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot) { if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { return pFormFiller->GetViewBBox(pPageView, pAnnot); } else { ASSERT(pPageView != NULL); ASSERT(pAnnot != NULL); CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); ASSERT(pPDFAnnot != NULL); CPDF_Rect rcAnnot; pPDFAnnot->GetRect(rcAnnot); // CRect rcWin; // pPageView->DocToWindow(rcAnnot, rcWin); CPDF_Rect rcWin = CPWL_Utils::InflateRect(rcAnnot,1); // rcWin.InflateRect(1, 1); return rcWin.GetOutterRect(); } }
DLLEXPORT void STDCALL FPDFPage_TransformAnnots(FPDF_PAGE page, double a, double b, double c, double d, double e, double f) { CPDF_Page* pPage = CPDFPageFromFPDFPage(page); if (!pPage) return; CPDF_AnnotList AnnotList(pPage); for (size_t i = 0; i < AnnotList.Count(); ++i) { CPDF_Annot* pAnnot = AnnotList.GetAt(i); // transformAnnots Rectangle CPDF_Rect rect; pAnnot->GetRect(rect); CFX_AffineMatrix matrix((FX_FLOAT)a, (FX_FLOAT)b, (FX_FLOAT)c, (FX_FLOAT)d, (FX_FLOAT)e, (FX_FLOAT)f); rect.Transform(&matrix); CPDF_Array* pRectArray = NULL; pRectArray = pAnnot->GetAnnotDict()->GetArray("Rect"); if (!pRectArray) pRectArray = CPDF_Array::Create(); pRectArray->SetAt(0, new CPDF_Number(rect.left)); pRectArray->SetAt(1, new CPDF_Number(rect.bottom)); pRectArray->SetAt(2, new CPDF_Number(rect.right)); pRectArray->SetAt(3, new CPDF_Number(rect.top)); pAnnot->GetAnnotDict()->SetAt("Rect", pRectArray); // Transform AP's rectangle // To Do } }
FX_RECT CFFL_IFormFiller::GetViewBBox(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot) { if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) return pFormFiller->GetViewBBox(pPageView, pAnnot); ASSERT(pPageView); CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); CFX_FloatRect rcWin = CPWL_Utils::InflateRect(pPDFAnnot->GetRect(), 1); return rcWin.GetOuterRect(); }
CPDF_Annot* CPDFSDK_PageView::GetPDFAnnotAtPoint(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); CFX_FloatRect annotRect; pAnnot->GetRect(annotRect); if(annotRect.Contains(pageX, pageY)) return pAnnot; } return NULL; }
FX_RECT CFFL_InteractiveFormFiller::GetViewBBox(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot) { if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false)) return pFormFiller->GetViewBBox(pPageView, pAnnot); ASSERT(pPageView); CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); CFX_FloatRect rcWin = pPDFAnnot->GetRect(); if (!rcWin.IsEmpty()) { rcWin.Inflate(1, 1); rcWin.Normalize(); } return rcWin.GetOuterRect(); }
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); } } }