uint16_t CFX_ListItem::GetFirstChar() const { CPVT_Word word; CFX_Edit_Iterator* pIterator = GetIterator(); pIterator->SetAt(1); pIterator->GetWord(word); return word.Word; }
CFX_PointF CPWL_Edit::GetWordRightBottomPoint(const CPVT_WordPlace& wpWord) { CFX_Edit_Iterator* pIterator = m_pEdit->GetIterator(); CPVT_WordPlace wpOld = pIterator->GetAt(); pIterator->SetAt(wpWord); CFX_PointF pt; CPVT_Word word; if (pIterator->GetWord(word)) { pt = CFX_PointF(word.ptWord.x + word.fWidth, word.ptWord.y + word.fDescent); } pIterator->SetAt(wpOld); return pt; }
FX_FLOAT CPWL_EditCtrl::GetCaretFontSize() const { FX_FLOAT fFontSize = GetFontSize(); CFX_Edit_Iterator* pIterator = m_pEdit->GetIterator(); pIterator->SetAt(m_pEdit->GetCaret()); CPVT_Word word; CPVT_Section section; if (pIterator->GetWord(word)) { fFontSize = word.fFontSize; } else if (HasFlag(PES_RICH)) { if (pIterator->GetSection(section)) { fFontSize = section.WordProps.fFontSize; } } return fFontSize; }
void CPWL_EditCtrl::GetCaretInfo(CFX_FloatPoint& ptHead, CFX_FloatPoint& ptFoot) const { CFX_Edit_Iterator* pIterator = m_pEdit->GetIterator(); pIterator->SetAt(m_pEdit->GetCaret()); CPVT_Word word; CPVT_Line line; if (pIterator->GetWord(word)) { ptHead.x = word.ptWord.x + word.fWidth; ptHead.y = word.ptWord.y + word.fAscent; ptFoot.x = word.ptWord.x + word.fWidth; ptFoot.y = word.ptWord.y + word.fDescent; } else if (pIterator->GetLine(line)) { ptHead.x = line.ptLine.x; ptHead.y = line.ptLine.y + line.fLineAscent; ptFoot.x = line.ptLine.x; ptFoot.y = line.ptLine.y + line.fLineDescent; } }
CPDF_Font* CPWL_EditCtrl::GetCaretFont() const { int32_t nFontIndex = 0; CFX_Edit_Iterator* pIterator = m_pEdit->GetIterator(); pIterator->SetAt(m_pEdit->GetCaret()); CPVT_Word word; CPVT_Section section; if (pIterator->GetWord(word)) { nFontIndex = word.nFontIndex; } else if (HasFlag(PES_RICH)) { if (pIterator->GetSection(section)) { nFontIndex = section.WordProps.nFontIndex; } } if (IPVT_FontMap* pFontMap = GetFontMap()) return pFontMap->GetPDFFont(nFontIndex); return nullptr; }
CPVT_WordRange CPWL_Edit::GetSameWordsRange(const CPVT_WordPlace& place, bool bLatin, bool bArabic) const { CPVT_WordRange range; CFX_Edit_Iterator* pIterator = m_pEdit->GetIterator(); CPVT_Word wordinfo; CPVT_WordPlace wpStart(place), wpEnd(place); pIterator->SetAt(place); if (bLatin) { while (pIterator->NextWord()) { if (!pIterator->GetWord(wordinfo) || !FX_EDIT_ISLATINWORD(wordinfo.Word)) { break; } wpEnd = pIterator->GetAt(); } } else if (bArabic) { while (pIterator->NextWord()) { if (!pIterator->GetWord(wordinfo) || !PWL_ISARABICWORD(wordinfo.Word)) break; wpEnd = pIterator->GetAt(); } } pIterator->SetAt(place); if (bLatin) { do { if (!pIterator->GetWord(wordinfo) || !FX_EDIT_ISLATINWORD(wordinfo.Word)) { break; } wpStart = pIterator->GetAt(); } while (pIterator->PrevWord()); } else if (bArabic) { do { if (!pIterator->GetWord(wordinfo) || !PWL_ISARABICWORD(wordinfo.Word)) break; wpStart = pIterator->GetAt(); } while (pIterator->PrevWord()); } range.Set(wpStart, wpEnd); return range; }