bool CPDF_TextPage::IsSameAsPreTextObject( CPDF_TextObject* pTextObj, const CPDF_PageObjectList* pObjList, CPDF_PageObjectList::const_iterator iter) { int i = 0; while (i < 5 && iter != pObjList->begin()) { --iter; CPDF_PageObject* pOtherObj = iter->get(); if (pOtherObj == pTextObj || !pOtherObj->IsText()) continue; if (IsSameTextObject(pOtherObj->AsText(), pTextObj)) return true; ++i; } return false; }
void CPDF_TextPage::ProcessFormObject(CPDF_FormObject* pFormObj, const CFX_Matrix& formMatrix) { const CPDF_PageObjectList* pObjectList = pFormObj->form()->GetPageObjectList(); if (pObjectList->empty()) return; CFX_Matrix curFormMatrix = pFormObj->form_matrix() * formMatrix; for (auto it = pObjectList->begin(); it != pObjectList->end(); ++it) { CPDF_PageObject* pPageObj = it->get(); if (!pPageObj) continue; if (pPageObj->IsText()) ProcessTextObject(pPageObj->AsText(), curFormMatrix, pObjectList, it); else if (pPageObj->IsForm()) ProcessFormObject(pPageObj->AsForm(), curFormMatrix); } }
void CPDF_TextPage::ProcessObject() { if (m_pPage->GetPageObjectList()->empty()) return; m_TextlineDir = FindTextlineFlowOrientation(); const CPDF_PageObjectList* pObjList = m_pPage->GetPageObjectList(); for (auto it = pObjList->begin(); it != pObjList->end(); ++it) { CPDF_PageObject* pObj = it->get(); if (!pObj) continue; CFX_Matrix matrix; if (pObj->IsText()) ProcessTextObject(pObj->AsText(), matrix, pObjList, it); else if (pObj->IsForm()) ProcessFormObject(pObj->AsForm(), matrix); } for (const auto& obj : m_LineObj) ProcessTextObject(obj); m_LineObj.clear(); CloseTempLine(); }