void CPDF_FormControl::DrawControl(CFX_RenderDevice* pDevice, CFX_AffineMatrix* pMatrix, CPDF_Page* pPage, CPDF_Annot::AppearanceMode mode, const CPDF_RenderOptions* pOptions) { if (m_pWidgetDict->GetInteger("F") & ANNOTFLAG_HIDDEN) { return; } CPDF_Stream* pStream = FPDFDOC_GetAnnotAP(m_pWidgetDict, mode); if (pStream == NULL) { return; } CFX_FloatRect form_bbox = pStream->GetDict()->GetRect("BBox"); CFX_AffineMatrix form_matrix = pStream->GetDict()->GetMatrix("Matrix"); form_matrix.TransformRect(form_bbox); CFX_FloatRect arect = m_pWidgetDict->GetRect("Rect"); CFX_AffineMatrix matrix; matrix.MatchRect(arect, form_bbox); matrix.Concat(*pMatrix); CPDF_Form form(m_pField->m_pForm->m_pDocument, m_pField->m_pForm->m_pFormDict->GetDict("DR"), pStream); form.ParseContent(NULL, NULL, NULL, NULL); CPDF_RenderContext context; context.Create(pPage); context.DrawObjectList(pDevice, &form, &matrix, pOptions); }
void CPDF_FormControl::DrawControl(CFX_RenderDevice* pDevice, CFX_Matrix* pMatrix, CPDF_Page* pPage, CPDF_Annot::AppearanceMode mode, const CPDF_RenderOptions* pOptions) { if (m_pWidgetDict->GetIntegerBy("F") & ANNOTFLAG_HIDDEN) return; CPDF_Stream* pStream = FPDFDOC_GetAnnotAP(m_pWidgetDict, mode); if (!pStream) return; CFX_FloatRect form_bbox = pStream->GetDict()->GetRectBy("BBox"); CFX_Matrix form_matrix = pStream->GetDict()->GetMatrixBy("Matrix"); form_matrix.TransformRect(form_bbox); CFX_FloatRect arect = m_pWidgetDict->GetRectBy("Rect"); CFX_Matrix matrix; matrix.MatchRect(arect, form_bbox); matrix.Concat(*pMatrix); CPDF_Form form(m_pField->m_pForm->m_pDocument, m_pField->m_pForm->m_pFormDict->GetDictBy("DR"), pStream); form.ParseContent(nullptr, nullptr, nullptr); CPDF_RenderContext context(pPage); context.AppendLayer(&form, &matrix); context.Render(pDevice, pOptions, nullptr); }
CPDF_Form* CPDF_Annot::GetAPForm(const CPDF_Page* pPage, AppearanceMode mode) { CPDF_Stream* pStream = FPDFDOC_GetAnnotAP(m_pAnnotDict, mode); if (pStream == NULL) { return NULL; } CPDF_Form* pForm; if (m_APMap.Lookup(pStream, (void*&)pForm)) { return pForm; } pForm = new CPDF_Form(m_pList->m_pDocument, pPage->m_pResources, pStream); pForm->ParseContent(NULL, NULL, NULL, NULL); m_APMap.SetAt(pStream, pForm); return pForm; }
CPDF_Form* CPDF_Annot::GetAPForm(const CPDF_Page* pPage, AppearanceMode mode) { CPDF_Stream* pStream = FPDFDOC_GetAnnotAP(m_pAnnotDict, mode); if (!pStream) return nullptr; auto it = m_APMap.find(pStream); if (it != m_APMap.end()) return it->second.get(); CPDF_Form* pNewForm = new CPDF_Form(m_pDocument, pPage->m_pResources, pStream); pNewForm->ParseContent(nullptr, nullptr, nullptr); m_APMap[pStream] = WrapUnique(pNewForm); return pNewForm; }