FX_BOOL CPDF_VariableText::Iterator::NextLine() { if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) { if (m_CurPos.nLineIndex < pSection->m_LineArray.GetSize() - 1) { m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex, m_CurPos.nLineIndex + 1, -1); return TRUE; } if (m_CurPos.nSecIndex < m_pVT->m_SectionArray.GetSize() - 1) { m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex + 1, 0, -1); return TRUE; } } return FALSE; }
FX_BOOL CPDF_VariableText::Iterator::NextSection() { if (m_CurPos.nSecIndex < m_pVT->m_SectionArray.GetSize() - 1) { m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex + 1, 0, -1); return TRUE; } return FALSE; }
void CSection::ResetLinePlace() { for (int32_t i = 0, sz = m_LineArray.GetSize(); i < sz; i++) { if (CLine* pLine = m_LineArray.GetAt(i)) { pLine->LinePlace = CPVT_WordPlace(SecPlace.nSecIndex, i, -1); } } }
FX_BOOL CPDF_VariableText::Iterator::PrevSection() { ASSERT(m_pVT); if (m_CurPos.nSecIndex > 0) { m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex - 1, 0, -1); return TRUE; } return FALSE; }
FX_BOOL CPDF_VariableText::Iterator::PrevLine() { if (m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) { if (m_CurPos.nLineIndex > 0) { m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex, m_CurPos.nLineIndex - 1, -1); return TRUE; } if (m_CurPos.nSecIndex > 0) { if (CSection* pLastSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex - 1)) { m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex - 1, pLastSection->m_LineArray.GetSize() - 1, -1); return TRUE; } } } return FALSE; }
FX_BOOL CPDF_VariableText::Iterator::GetSection(CPVT_Section& section) const { section.secplace = CPVT_WordPlace(m_CurPos.nSecIndex, 0, -1); if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) { section.rcSection = m_pVT->InToOut(pSection->m_SecInfo.rcSection); if (pSection->m_SecInfo.pSecProps) section.SecProps = *pSection->m_SecInfo.pSecProps; if (pSection->m_SecInfo.pWordProps) section.WordProps = *pSection->m_SecInfo.pWordProps; return TRUE; } return FALSE; }
FX_BOOL CPDF_VariableText::Iterator::GetLine(CPVT_Line& line) const { ASSERT(m_pVT); line.lineplace = CPVT_WordPlace(m_CurPos.nSecIndex, m_CurPos.nLineIndex, -1); if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) { if (CLine* pLine = pSection->m_LineArray.GetAt(m_CurPos.nLineIndex)) { line.ptLine = m_pVT->InToOut(CFX_FloatPoint( pLine->m_LineInfo.fLineX + pSection->m_SecInfo.rcSection.left, pLine->m_LineInfo.fLineY + pSection->m_SecInfo.rcSection.top)); line.fLineWidth = pLine->m_LineInfo.fLineWidth; line.fLineAscent = pLine->m_LineInfo.fLineAscent; line.fLineDescent = pLine->m_LineInfo.fLineDescent; line.lineEnd = pLine->GetEndWordPlace(); return TRUE; } } return FALSE; }
CPVT_WordPlace CSection::GetPrevWordPlace(const CPVT_WordPlace& place) const { if (place.nLineIndex < 0) { return GetBeginWordPlace(); } if (place.nLineIndex >= m_LineArray.GetSize()) { return GetEndWordPlace(); } if (CLine* pLine = m_LineArray.GetAt(place.nLineIndex)) { if (place.nWordIndex == pLine->m_LineInfo.nBeginWordIndex) { return CPVT_WordPlace(place.nSecIndex, place.nLineIndex, -1); } if (place.nWordIndex < pLine->m_LineInfo.nBeginWordIndex) { if (CLine* pPrevLine = m_LineArray.GetAt(place.nLineIndex - 1)) { return pPrevLine->GetEndWordPlace(); } } else { return pLine->GetPrevWordPlace(place); } } return place; }
CPVT_WordPlace CPDF_VariableText::GetSectionBeginPlace( const CPVT_WordPlace& place) const { return CPVT_WordPlace(place.nSecIndex, 0, -1); }
CPVT_WordPlace CPDF_VariableText::GetLineBeginPlace( const CPVT_WordPlace& place) const { return CPVT_WordPlace(place.nSecIndex, place.nLineIndex, -1); }
CPVT_WordPlace CPDF_VariableText::GetEndWordPlace() const { if (CSection* pSection = m_SectionArray.GetAt(m_SectionArray.GetSize() - 1)) return pSection->GetEndWordPlace(); return CPVT_WordPlace(); }
CPVT_WordPlace CPDF_VariableText::GetBeginWordPlace() const { return m_bInitial ? CPVT_WordPlace(0, 0, -1) : CPVT_WordPlace(); }
CPVT_WordPlace CSection::AddLine(const CPVT_LineInfo& lineinfo) { return CPVT_WordPlace(SecPlace.nSecIndex, m_LineArray.Add(lineinfo), -1); }