summaryrefslogtreecommitdiff
path: root/fpdfsdk/pdfwindow
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/pdfwindow')
-rw-r--r--fpdfsdk/pdfwindow/PWL_Edit.cpp87
-rw-r--r--fpdfsdk/pdfwindow/PWL_EditCtrl.cpp67
2 files changed, 74 insertions, 80 deletions
diff --git a/fpdfsdk/pdfwindow/PWL_Edit.cpp b/fpdfsdk/pdfwindow/PWL_Edit.cpp
index dffc62a02f..80aa629a06 100644
--- a/fpdfsdk/pdfwindow/PWL_Edit.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Edit.cpp
@@ -524,18 +524,17 @@ CFX_FloatPoint CPWL_Edit::GetWordRightBottomPoint(
const CPVT_WordPlace& wpWord) {
CFX_FloatPoint pt(0.0f, 0.0f);
- if (IFX_Edit_Iterator* pIterator = m_pEdit->GetIterator()) {
- CPVT_WordPlace wpOld = pIterator->GetAt();
- pIterator->SetAt(wpWord);
- CPVT_Word word;
- if (pIterator->GetWord(word)) {
- pt = CFX_FloatPoint(word.ptWord.x + word.fWidth,
- word.ptWord.y + word.fDescent);
- }
-
- pIterator->SetAt(wpOld);
+ IFX_Edit_Iterator* pIterator = m_pEdit->GetIterator();
+ CPVT_WordPlace wpOld = pIterator->GetAt();
+ pIterator->SetAt(wpWord);
+ CPVT_Word word;
+ if (pIterator->GetWord(word)) {
+ pt = CFX_FloatPoint(word.ptWord.x + word.fWidth,
+ word.ptWord.y + word.fDescent);
}
+ pIterator->SetAt(wpOld);
+
return pt;
}
@@ -879,52 +878,50 @@ CPVT_WordRange CPWL_Edit::GetSameWordsRange(const CPVT_WordPlace& place,
FX_BOOL bArabic) const {
CPVT_WordRange range;
- if (IFX_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;
- }
+ IFX_Edit_Iterator* pIterator = m_pEdit->GetIterator();
+ CPVT_Word wordinfo;
+ CPVT_WordPlace wpStart(place), wpEnd(place);
+ pIterator->SetAt(place);
- wpEnd = pIterator->GetAt();
+ if (bLatin) {
+ while (pIterator->NextWord()) {
+ if (!pIterator->GetWord(wordinfo) ||
+ !FX_EDIT_ISLATINWORD(wordinfo.Word)) {
+ break;
}
- } else if (bArabic) {
- while (pIterator->NextWord()) {
- if (!pIterator->GetWord(wordinfo) || !PWL_ISARABICWORD(wordinfo.Word))
- break;
- wpEnd = pIterator->GetAt();
- }
+ wpEnd = pIterator->GetAt();
}
+ } else if (bArabic) {
+ while (pIterator->NextWord()) {
+ if (!pIterator->GetWord(wordinfo) || !PWL_ISARABICWORD(wordinfo.Word))
+ break;
- pIterator->SetAt(place);
+ wpEnd = pIterator->GetAt();
+ }
+ }
- if (bLatin) {
- do {
- if (!pIterator->GetWord(wordinfo) ||
- !FX_EDIT_ISLATINWORD(wordinfo.Word)) {
- break;
- }
+ pIterator->SetAt(place);
- wpStart = pIterator->GetAt();
- } while (pIterator->PrevWord());
- } else if (bArabic) {
- do {
- if (!pIterator->GetWord(wordinfo) || !PWL_ISARABICWORD(wordinfo.Word))
- break;
+ if (bLatin) {
+ do {
+ if (!pIterator->GetWord(wordinfo) ||
+ !FX_EDIT_ISLATINWORD(wordinfo.Word)) {
+ break;
+ }
- wpStart = pIterator->GetAt();
- } while (pIterator->PrevWord());
- }
+ wpStart = pIterator->GetAt();
+ } while (pIterator->PrevWord());
+ } else if (bArabic) {
+ do {
+ if (!pIterator->GetWord(wordinfo) || !PWL_ISARABICWORD(wordinfo.Word))
+ break;
- range.Set(wpStart, wpEnd);
+ wpStart = pIterator->GetAt();
+ } while (pIterator->PrevWord());
}
+ range.Set(wpStart, wpEnd);
return range;
}
diff --git a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp
index 23349b46bc..07ac4af781 100644
--- a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp
+++ b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp
@@ -351,21 +351,20 @@ void CPWL_EditCtrl::SetEditCaret(FX_BOOL bVisible) {
void CPWL_EditCtrl::GetCaretInfo(CFX_FloatPoint& ptHead,
CFX_FloatPoint& ptFoot) const {
- if (IFX_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;
- }
+ IFX_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;
}
}
@@ -453,16 +452,15 @@ CFX_FloatPoint CPWL_EditCtrl::GetScrollPos() const {
CPDF_Font* CPWL_EditCtrl::GetCaretFont() const {
int32_t nFontIndex = 0;
- if (IFX_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;
- }
+ IFX_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;
}
}
@@ -475,16 +473,15 @@ CPDF_Font* CPWL_EditCtrl::GetCaretFont() const {
FX_FLOAT CPWL_EditCtrl::GetCaretFontSize() const {
FX_FLOAT fFontSize = GetFontSize();
- if (IFX_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;
- }
+ IFX_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;
}
}