summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfdoc/include/cpdf_variabletext.h2
-rw-r--r--fpdfsdk/fsdk_baseform.cpp16
-rw-r--r--fpdfsdk/fxedit/fxet_edit.cpp200
-rw-r--r--fpdfsdk/fxedit/fxet_list.cpp2
-rw-r--r--fpdfsdk/fxedit/include/fxet_edit.h82
-rw-r--r--fpdfsdk/pdfwindow/PWL_Edit.cpp19
-rw-r--r--fpdfsdk/pdfwindow/PWL_Edit.h5
-rw-r--r--fpdfsdk/pdfwindow/PWL_EditCtrl.cpp2
-rw-r--r--fpdfsdk/pdfwindow/PWL_Utils.cpp20
9 files changed, 102 insertions, 246 deletions
diff --git a/core/fpdfdoc/include/cpdf_variabletext.h b/core/fpdfdoc/include/cpdf_variabletext.h
index 86a30289db..7725612f89 100644
--- a/core/fpdfdoc/include/cpdf_variabletext.h
+++ b/core/fpdfdoc/include/cpdf_variabletext.h
@@ -96,13 +96,11 @@ class CPDF_VariableText : private CPDF_EditContainer {
void SetPasswordChar(uint16_t wSubWord = '*') { m_wSubWord = wSubWord; }
void SetLimitChar(int32_t nLimitChar = 0) { m_nLimitChar = nLimitChar; }
void SetCharSpace(FX_FLOAT fCharSpace = 0.0f) { m_fCharSpace = fCharSpace; }
- void SetHorzScale(int32_t nHorzScale = 100) { m_nHorzScale = nHorzScale; }
void SetMultiLine(FX_BOOL bMultiLine = TRUE) { m_bMultiLine = bMultiLine; }
void SetAutoReturn(FX_BOOL bAuto = TRUE) { m_bLimitWidth = bAuto; }
void SetFontSize(FX_FLOAT fFontSize) { m_fFontSize = fFontSize; }
void SetCharArray(int32_t nCharArray = 0) { m_nCharArray = nCharArray; }
void SetAutoFontSize(FX_BOOL bAuto = TRUE) { m_bAutoFontSize = bAuto; }
- void SetLineLeading(FX_FLOAT fLineLeading) { m_fLineLeading = fLineLeading; }
void Initialize();
FX_BOOL IsValid() const { return m_bInitial; }
diff --git a/fpdfsdk/fsdk_baseform.cpp b/fpdfsdk/fsdk_baseform.cpp
index 2994981b6c..05b4dd06a5 100644
--- a/fpdfsdk/fsdk_baseform.cpp
+++ b/fpdfsdk/fsdk_baseform.cpp
@@ -1376,11 +1376,11 @@ void CPDFSDK_Widget::ResetAppearance_ComboBox(const FX_WCHAR* sValue) {
rcEdit.Normalize();
pEdit->SetPlateRect(rcEdit);
- pEdit->SetAlignmentV(1);
+ pEdit->SetAlignmentV(1, TRUE);
FX_FLOAT fFontSize = GetFontSize();
if (IsFloatZero(fFontSize))
- pEdit->SetAutoFontSize(TRUE);
+ pEdit->SetAutoFontSize(TRUE, TRUE);
else
pEdit->SetFontSize(fFontSize);
@@ -1528,22 +1528,22 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const FX_WCHAR* sValue) {
CFX_FloatRect rcClient = GetClientRect();
pEdit->SetPlateRect(rcClient);
- pEdit->SetAlignmentH(pControl->GetControlAlignment());
+ pEdit->SetAlignmentH(pControl->GetControlAlignment(), TRUE);
uint32_t dwFieldFlags = pField->GetFieldFlags();
FX_BOOL bMultiLine = (dwFieldFlags >> 12) & 1;
if (bMultiLine) {
- pEdit->SetMultiLine(TRUE);
- pEdit->SetAutoReturn(TRUE);
+ pEdit->SetMultiLine(TRUE, TRUE);
+ pEdit->SetAutoReturn(TRUE, TRUE);
} else {
- pEdit->SetAlignmentV(1);
+ pEdit->SetAlignmentV(1, TRUE);
}
uint16_t subWord = 0;
if ((dwFieldFlags >> 13) & 1) {
subWord = '*';
- pEdit->SetPasswordChar(subWord);
+ pEdit->SetPasswordChar(subWord, TRUE);
}
int nMaxLen = pField->GetMaxLen();
@@ -1574,7 +1574,7 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const FX_WCHAR* sValue) {
}
if (IsFloatZero(fFontSize))
- pEdit->SetAutoFontSize(TRUE);
+ pEdit->SetAutoFontSize(TRUE, TRUE);
else
pEdit->SetFontSize(fFontSize);
diff --git a/fpdfsdk/fxedit/fxet_edit.cpp b/fpdfsdk/fxedit/fxet_edit.cpp
index 603c459cf7..123106b8a2 100644
--- a/fpdfsdk/fxedit/fxet_edit.cpp
+++ b/fpdfsdk/fxedit/fxet_edit.cpp
@@ -702,8 +702,7 @@ void CFXEU_Clear::Undo() {
if (m_pEdit) {
m_pEdit->SelectNone();
m_pEdit->SetCaret(m_wrSel.BeginPos);
- m_pEdit->InsertText(m_swText.c_str(), DEFAULT_CHARSET, nullptr, nullptr,
- FALSE, TRUE);
+ m_pEdit->InsertText(m_swText.c_str(), DEFAULT_CHARSET, FALSE, TRUE);
m_pEdit->SetSel(m_wrSel.BeginPos, m_wrSel.EndPos);
}
}
@@ -712,21 +711,12 @@ CFXEU_InsertText::CFXEU_InsertText(CFX_Edit* pEdit,
const CPVT_WordPlace& wpOldPlace,
const CPVT_WordPlace& wpNewPlace,
const CFX_WideString& swText,
- int32_t charset,
- const CPVT_SecProps* pSecProps,
- const CPVT_WordProps* pWordProps)
+ int32_t charset)
: m_pEdit(pEdit),
m_wpOld(wpOldPlace),
m_wpNew(wpNewPlace),
m_swText(swText),
- m_nCharset(charset),
- m_SecProps(),
- m_WordProps() {
- if (pSecProps)
- m_SecProps = *pSecProps;
- if (pWordProps)
- m_WordProps = *pWordProps;
-}
+ m_nCharset(charset) {}
CFXEU_InsertText::~CFXEU_InsertText() {}
@@ -734,8 +724,7 @@ void CFXEU_InsertText::Redo() {
if (m_pEdit && IsLast()) {
m_pEdit->SelectNone();
m_pEdit->SetCaret(m_wpOld);
- m_pEdit->InsertText(m_swText.c_str(), m_nCharset, &m_SecProps, &m_WordProps,
- FALSE, TRUE);
+ m_pEdit->InsertText(m_swText.c_str(), m_nCharset, FALSE, TRUE);
}
}
@@ -1436,11 +1425,10 @@ IPVT_FontMap* CFX_Edit::GetFontMap() {
return m_pVTProvider ? m_pVTProvider->GetFontMap() : nullptr;
}
-void CFX_Edit::SetPlateRect(const CFX_FloatRect& rect, FX_BOOL bPaint) {
+void CFX_Edit::SetPlateRect(const CFX_FloatRect& rect) {
m_pVT->SetPlateRect(rect);
m_ptScrollPos = CFX_FloatPoint(rect.left, rect.top);
- if (bPaint)
- Paint();
+ Paint();
}
void CFX_Edit::SetAlignmentH(int32_t nFormat, FX_BOOL bPaint) {
@@ -1461,28 +1449,19 @@ void CFX_Edit::SetPasswordChar(uint16_t wSubWord, FX_BOOL bPaint) {
Paint();
}
-void CFX_Edit::SetLimitChar(int32_t nLimitChar, FX_BOOL bPaint) {
+void CFX_Edit::SetLimitChar(int32_t nLimitChar) {
m_pVT->SetLimitChar(nLimitChar);
- if (bPaint)
- Paint();
+ Paint();
}
-void CFX_Edit::SetCharArray(int32_t nCharArray, FX_BOOL bPaint) {
+void CFX_Edit::SetCharArray(int32_t nCharArray) {
m_pVT->SetCharArray(nCharArray);
- if (bPaint)
- Paint();
+ Paint();
}
-void CFX_Edit::SetCharSpace(FX_FLOAT fCharSpace, FX_BOOL bPaint) {
+void CFX_Edit::SetCharSpace(FX_FLOAT fCharSpace) {
m_pVT->SetCharSpace(fCharSpace);
- if (bPaint)
- Paint();
-}
-
-void CFX_Edit::SetHorzScale(int32_t nHorzScale, FX_BOOL bPaint) {
- m_pVT->SetHorzScale(nHorzScale);
- if (bPaint)
- Paint();
+ Paint();
}
void CFX_Edit::SetMultiLine(FX_BOOL bMultiLine, FX_BOOL bPaint) {
@@ -1497,22 +1476,15 @@ void CFX_Edit::SetAutoReturn(FX_BOOL bAuto, FX_BOOL bPaint) {
Paint();
}
-void CFX_Edit::SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint) {
- m_pVT->SetLineLeading(fLineLeading);
- if (bPaint)
- Paint();
-}
-
void CFX_Edit::SetAutoFontSize(FX_BOOL bAuto, FX_BOOL bPaint) {
m_pVT->SetAutoFontSize(bAuto);
if (bPaint)
Paint();
}
-void CFX_Edit::SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint) {
+void CFX_Edit::SetFontSize(FX_FLOAT fFontSize) {
m_pVT->SetFontSize(fFontSize);
- if (bPaint)
- Paint();
+ Paint();
}
void CFX_Edit::SetAutoScroll(FX_BOOL bAuto, FX_BOOL bPaint) {
@@ -1555,8 +1527,7 @@ void CFX_Edit::SetSel(const CPVT_WordPlace& begin, const CPVT_WordPlace& end) {
if (m_SelState.IsExist()) {
ScrollToCaret();
- CPVT_WordRange wr(m_SelState.BeginPos, m_SelState.EndPos);
- Refresh(RP_OPTIONAL, &wr);
+ Refresh();
SetCaretInfo();
} else {
ScrollToCaret();
@@ -1695,22 +1666,18 @@ CPVT_WordRange CFX_Edit::CombineWordRange(const CPVT_WordRange& wr1,
return wrRet;
}
-void CFX_Edit::SetText(const FX_WCHAR* text,
- int32_t charset,
- const CPVT_SecProps* pSecProps,
- const CPVT_WordProps* pWordProps) {
- SetText(text, charset, pSecProps, pWordProps, TRUE, TRUE);
+void CFX_Edit::SetText(const FX_WCHAR* text) {
+ Empty();
+ DoInsertText(CPVT_WordPlace(0, 0, -1), text, DEFAULT_CHARSET);
+ Paint();
}
-FX_BOOL CFX_Edit::InsertWord(uint16_t word,
- int32_t charset,
- const CPVT_WordProps* pWordProps) {
- return InsertWord(word, charset, pWordProps, TRUE, TRUE);
+FX_BOOL CFX_Edit::InsertWord(uint16_t word, int32_t charset) {
+ return InsertWord(word, charset, nullptr, TRUE, TRUE);
}
-FX_BOOL CFX_Edit::InsertReturn(const CPVT_SecProps* pSecProps,
- const CPVT_WordProps* pWordProps) {
- return InsertReturn(pSecProps, pWordProps, TRUE, TRUE);
+FX_BOOL CFX_Edit::InsertReturn() {
+ return InsertReturn(nullptr, nullptr, TRUE, TRUE);
}
FX_BOOL CFX_Edit::Backspace() {
@@ -1725,11 +1692,8 @@ FX_BOOL CFX_Edit::Clear() {
return Clear(TRUE, TRUE);
}
-FX_BOOL CFX_Edit::InsertText(const FX_WCHAR* text,
- int32_t charset,
- const CPVT_SecProps* pSecProps,
- const CPVT_WordProps* pWordProps) {
- return InsertText(text, charset, pSecProps, pWordProps, TRUE, TRUE);
+FX_BOOL CFX_Edit::InsertText(const FX_WCHAR* text, int32_t charset) {
+ return InsertText(text, charset, TRUE, TRUE);
}
FX_FLOAT CFX_Edit::GetFontSize() const {
@@ -1797,7 +1761,7 @@ void CFX_Edit::Paint() {
if (m_pVT->IsValid()) {
RearrangeAll();
ScrollToCaret();
- Refresh(RP_NOANALYSE);
+ Refresh();
SetCaretOrigin();
SetCaretInfo();
}
@@ -1844,8 +1808,7 @@ void CFX_Edit::SelectAll() {
SetCaret(m_SelState.EndPos);
ScrollToCaret();
- CPVT_WordRange wrVisible = GetVisibleWordRange();
- Refresh(RP_OPTIONAL, &wrVisible);
+ Refresh();
SetCaretInfo();
}
}
@@ -1853,9 +1816,8 @@ void CFX_Edit::SelectAll() {
void CFX_Edit::SelectNone() {
if (m_pVT->IsValid()) {
if (m_SelState.IsExist()) {
- CPVT_WordRange wrTemp = m_SelState.ConvertToWordRange();
m_SelState.Default();
- Refresh(RP_OPTIONAL, &wrTemp);
+ Refresh();
}
}
}
@@ -1948,7 +1910,7 @@ void CFX_Edit::SetScrollPosX(FX_FLOAT fx) {
if (m_pVT->IsValid()) {
if (!FX_EDIT_IsFloatEqual(m_ptScrollPos.x, fx)) {
m_ptScrollPos.x = fx;
- Refresh(RP_NOANALYSE);
+ Refresh();
}
}
}
@@ -1960,7 +1922,7 @@ void CFX_Edit::SetScrollPosY(FX_FLOAT fy) {
if (m_pVT->IsValid()) {
if (!FX_EDIT_IsFloatEqual(m_ptScrollPos.y, fy)) {
m_ptScrollPos.y = fy;
- Refresh(RP_NOANALYSE);
+ Refresh();
if (m_pNotify) {
if (!m_bNotifyFlag) {
@@ -2067,9 +2029,7 @@ void CFX_Edit::ScrollToCaret() {
}
}
-void CFX_Edit::Refresh(REFRESH_PLAN_E ePlan,
- const CPVT_WordRange* pRange1,
- const CPVT_WordRange* pRange2) {
+void CFX_Edit::Refresh() {
if (m_bEnableRefresh && m_pVT->IsValid()) {
m_Refresh.BeginRefresh();
RefreshPushLineRects(GetVisibleWordRange());
@@ -2289,8 +2249,7 @@ void CFX_Edit::OnMouseMove(const CFX_FloatPoint& point,
m_SelState.SetEndPos(m_wpCaret);
ScrollToCaret();
- CPVT_WordRange wr(m_wpOldCaret, m_wpCaret);
- Refresh(RP_OPTIONAL, &wr);
+ Refresh();
SetCaretOrigin();
SetCaretInfo();
}
@@ -2309,8 +2268,7 @@ void CFX_Edit::OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl) {
if (m_wpOldCaret != m_wpCaret) {
ScrollToCaret();
- CPVT_WordRange wr(m_wpOldCaret, m_wpCaret);
- Refresh(RP_OPTIONAL, &wr);
+ Refresh();
SetCaretInfo();
}
} else {
@@ -2334,8 +2292,7 @@ void CFX_Edit::OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl) {
if (m_wpOldCaret != m_wpCaret) {
ScrollToCaret();
- CPVT_WordRange wr(m_wpOldCaret, m_wpCaret);
- Refresh(RP_OPTIONAL, &wr);
+ Refresh();
SetCaretInfo();
}
} else {
@@ -2363,8 +2320,7 @@ void CFX_Edit::OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl) {
if (m_wpOldCaret != m_wpCaret) {
ScrollToCaret();
- CPVT_WordRange wr(m_wpOldCaret, m_wpCaret);
- Refresh(RP_OPTIONAL, &wr);
+ Refresh();
SetCaretInfo();
}
} else {
@@ -2408,8 +2364,7 @@ void CFX_Edit::OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl) {
if (m_wpOldCaret != m_wpCaret) {
ScrollToCaret();
- CPVT_WordRange wr(m_wpOldCaret, m_wpCaret);
- Refresh(RP_OPTIONAL, &wr);
+ Refresh();
SetCaretInfo();
}
} else {
@@ -2451,8 +2406,7 @@ void CFX_Edit::OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl) {
m_SelState.Set(m_wpOldCaret, m_wpCaret);
ScrollToCaret();
- CPVT_WordRange wr(m_wpOldCaret, m_wpCaret);
- Refresh(RP_OPTIONAL, &wr);
+ Refresh();
SetCaretInfo();
} else {
if (m_SelState.IsExist()) {
@@ -2492,8 +2446,7 @@ void CFX_Edit::OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl) {
m_SelState.Set(m_wpOldCaret, m_wpCaret);
ScrollToCaret();
- CPVT_WordRange wr(m_wpOldCaret, m_wpCaret);
- Refresh(RP_OPTIONAL, &wr);
+ Refresh();
SetCaretInfo();
} else {
if (m_SelState.IsExist()) {
@@ -2519,18 +2472,6 @@ void CFX_Edit::OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl) {
}
}
-void CFX_Edit::SetText(const FX_WCHAR* text,
- int32_t charset,
- const CPVT_SecProps* pSecProps,
- const CPVT_WordProps* pWordProps,
- FX_BOOL bAddUndo,
- FX_BOOL bPaint) {
- Empty();
- DoInsertText(CPVT_WordPlace(0, 0, -1), text, charset, pSecProps, pWordProps);
- if (bPaint)
- Paint();
-}
-
FX_BOOL CFX_Edit::InsertWord(uint16_t word,
int32_t charset,
const CPVT_WordProps* pWordProps,
@@ -2586,8 +2527,7 @@ FX_BOOL CFX_Edit::InsertReturn(const CPVT_SecProps* pSecProps,
if (bPaint) {
RearrangePart(CPVT_WordRange(m_wpOldCaret, m_wpCaret));
ScrollToCaret();
- CPVT_WordRange wr(m_wpOldCaret, GetVisibleWordRange().EndPos);
- Refresh(RP_ANALYSE, &wr);
+ Refresh();
SetCaretOrigin();
SetCaretInfo();
}
@@ -2636,20 +2576,7 @@ FX_BOOL CFX_Edit::Backspace(FX_BOOL bAddUndo, FX_BOOL bPaint) {
if (bPaint) {
RearrangePart(CPVT_WordRange(m_wpCaret, m_wpOldCaret));
ScrollToCaret();
-
- CPVT_WordRange wr;
- if (m_wpCaret.SecCmp(m_wpOldCaret) != 0)
- wr = CPVT_WordRange(m_pVT->GetPrevWordPlace(m_wpCaret),
- GetVisibleWordRange().EndPos);
- else if (m_wpCaret.LineCmp(m_wpOldCaret) != 0)
- wr = CPVT_WordRange(m_pVT->GetLineBeginPlace(m_wpCaret),
- m_pVT->GetSectionEndPlace(m_wpCaret));
- else
- wr = CPVT_WordRange(m_pVT->GetPrevWordPlace(m_wpCaret),
- m_pVT->GetSectionEndPlace(m_wpCaret));
-
- Refresh(RP_ANALYSE, &wr);
-
+ Refresh();
SetCaretOrigin();
SetCaretInfo();
}
@@ -2699,20 +2626,7 @@ FX_BOOL CFX_Edit::Delete(FX_BOOL bAddUndo, FX_BOOL bPaint) {
if (bPaint) {
RearrangePart(CPVT_WordRange(m_wpOldCaret, m_wpCaret));
ScrollToCaret();
-
- CPVT_WordRange wr;
- if (bSecEnd)
- wr = CPVT_WordRange(m_pVT->GetPrevWordPlace(m_wpOldCaret),
- GetVisibleWordRange().EndPos);
- else if (m_wpCaret.LineCmp(m_wpOldCaret) != 0)
- wr = CPVT_WordRange(m_pVT->GetLineBeginPlace(m_wpCaret),
- m_pVT->GetSectionEndPlace(m_wpCaret));
- else
- wr = CPVT_WordRange(m_pVT->GetPrevWordPlace(m_wpOldCaret),
- m_pVT->GetSectionEndPlace(m_wpCaret));
-
- Refresh(RP_ANALYSE, &wr);
-
+ Refresh();
SetCaretOrigin();
SetCaretInfo();
}
@@ -2756,10 +2670,7 @@ FX_BOOL CFX_Edit::Clear(FX_BOOL bAddUndo, FX_BOOL bPaint) {
if (bPaint) {
RearrangePart(range);
ScrollToCaret();
-
- CPVT_WordRange wr(m_wpOldCaret, GetVisibleWordRange().EndPos);
- Refresh(RP_ANALYSE, &wr);
-
+ Refresh();
SetCaretOrigin();
SetCaretInfo();
}
@@ -2772,21 +2683,19 @@ FX_BOOL CFX_Edit::Clear(FX_BOOL bAddUndo, FX_BOOL bPaint) {
FX_BOOL CFX_Edit::InsertText(const FX_WCHAR* text,
int32_t charset,
- const CPVT_SecProps* pSecProps,
- const CPVT_WordProps* pWordProps,
FX_BOOL bAddUndo,
FX_BOOL bPaint) {
if (IsTextOverflow())
return FALSE;
m_pVT->UpdateWordPlace(m_wpCaret);
- SetCaret(DoInsertText(m_wpCaret, text, charset, pSecProps, pWordProps));
+ SetCaret(DoInsertText(m_wpCaret, text, charset));
m_SelState.Set(m_wpCaret, m_wpCaret);
if (m_wpCaret != m_wpOldCaret) {
if (bAddUndo && m_bEnableUndo) {
- AddEditUndoItem(new CFXEU_InsertText(this, m_wpOldCaret, m_wpCaret, text,
- charset, pSecProps, pWordProps));
+ AddEditUndoItem(
+ new CFXEU_InsertText(this, m_wpOldCaret, m_wpCaret, text, charset));
}
if (bPaint)
@@ -2805,14 +2714,7 @@ void CFX_Edit::PaintInsertText(const CPVT_WordPlace& wpOld,
if (m_pVT->IsValid()) {
RearrangePart(CPVT_WordRange(wpOld, wpNew));
ScrollToCaret();
-
- CPVT_WordRange wr;
- if (m_wpCaret.LineCmp(wpOld) != 0)
- wr = CPVT_WordRange(m_pVT->GetLineBeginPlace(wpOld),
- m_pVT->GetSectionEndPlace(wpNew));
- else
- wr = CPVT_WordRange(wpOld, m_pVT->GetSectionEndPlace(wpNew));
- Refresh(RP_ANALYSE, &wr);
+ Refresh();
SetCaretOrigin();
SetCaretInfo();
}
@@ -2978,9 +2880,7 @@ FX_FLOAT CFX_Edit::GetLineBottom(const CPVT_WordPlace& place) const {
CPVT_WordPlace CFX_Edit::DoInsertText(const CPVT_WordPlace& place,
const FX_WCHAR* text,
- int32_t charset,
- const CPVT_SecProps* pSecProps,
- const CPVT_WordProps* pWordProps) {
+ int32_t charset) {
CPVT_WordPlace wp = place;
if (m_pVT->IsValid()) {
@@ -2990,12 +2890,12 @@ CPVT_WordPlace CFX_Edit::DoInsertText(const CPVT_WordPlace& place,
uint16_t word = sText[i];
switch (word) {
case 0x0D:
- wp = m_pVT->InsertSection(wp, pSecProps, pWordProps);
+ wp = m_pVT->InsertSection(wp, nullptr, nullptr);
if (sText[i + 1] == 0x0A)
i++;
break;
case 0x0A:
- wp = m_pVT->InsertSection(wp, pSecProps, pWordProps);
+ wp = m_pVT->InsertSection(wp, nullptr, nullptr);
if (sText[i + 1] == 0x0D)
i++;
break;
@@ -3003,7 +2903,7 @@ CPVT_WordPlace CFX_Edit::DoInsertText(const CPVT_WordPlace& place,
word = 0x20;
default:
wp = m_pVT->InsertWord(wp, word, GetCharSetFromUnicode(word, charset),
- pWordProps);
+ nullptr);
break;
}
}
diff --git a/fpdfsdk/fxedit/fxet_list.cpp b/fpdfsdk/fxedit/fxet_list.cpp
index b4d5473f6c..77484e6a8a 100644
--- a/fpdfsdk/fxedit/fxet_list.cpp
+++ b/fpdfsdk/fxedit/fxet_list.cpp
@@ -14,7 +14,7 @@ CFX_ListItem::CFX_ListItem()
: m_pEdit(new CFX_Edit),
m_bSelected(FALSE),
m_rcListItem(0.0f, 0.0f, 0.0f, 0.0f) {
- m_pEdit->SetAlignmentV(1);
+ m_pEdit->SetAlignmentV(1, TRUE);
m_pEdit->Initialize();
}
diff --git a/fpdfsdk/fxedit/include/fxet_edit.h b/fpdfsdk/fxedit/include/fxet_edit.h
index e6253cb345..bf8828696b 100644
--- a/fpdfsdk/fxedit/include/fxet_edit.h
+++ b/fpdfsdk/fxedit/include/fxet_edit.h
@@ -30,8 +30,6 @@ class IFX_Edit_UndoItem;
#define FX_EDIT_IsFloatSmaller(fa, fb) \
(fa < fb && !FX_EDIT_IsFloatEqual(fa, fb))
-enum REFRESH_PLAN_E { RP_ANALYSE, RP_NOANALYSE, RP_OPTIONAL };
-
enum EDIT_PROPS_E {
EP_LINELEADING,
EP_LINEINDENT,
@@ -352,9 +350,7 @@ class CFXEU_InsertText : public CFX_Edit_UndoItem {
const CPVT_WordPlace& wpOldPlace,
const CPVT_WordPlace& wpNewPlace,
const CFX_WideString& swText,
- int32_t charset,
- const CPVT_SecProps* pSecProps,
- const CPVT_WordProps* pWordProps);
+ int32_t charset);
~CFXEU_InsertText() override;
// CFX_Edit_UndoItem
@@ -368,22 +364,19 @@ class CFXEU_InsertText : public CFX_Edit_UndoItem {
CPVT_WordPlace m_wpNew;
CFX_WideString m_swText;
int32_t m_nCharset;
- CPVT_SecProps m_SecProps;
- CPVT_WordProps m_WordProps;
};
class CFX_Edit {
public:
- static CFX_ByteString GetEditAppearanceStream(
- CFX_Edit* pEdit,
- const CFX_FloatPoint& ptOffset,
- const CPVT_WordRange* pRange = nullptr,
- FX_BOOL bContinuous = TRUE,
- uint16_t SubWord = 0);
+ static CFX_ByteString GetEditAppearanceStream(CFX_Edit* pEdit,
+ const CFX_FloatPoint& ptOffset,
+ const CPVT_WordRange* pRange,
+ FX_BOOL bContinuous,
+ uint16_t SubWord);
static CFX_ByteString GetSelectAppearanceStream(
CFX_Edit* pEdit,
const CFX_FloatPoint& ptOffset,
- const CPVT_WordRange* pRange = nullptr);
+ const CPVT_WordRange* pRange);
static void DrawEdit(CFX_RenderDevice* pDevice,
CFX_Matrix* pUser2Device,
CFX_Edit* pEdit,
@@ -440,29 +433,27 @@ class CFX_Edit {
void Initialize();
// Set the bounding box of the text area.
- void SetPlateRect(const CFX_FloatRect& rect, FX_BOOL bPaint = TRUE);
+ void SetPlateRect(const CFX_FloatRect& rect);
void SetScrollPos(const CFX_FloatPoint& point);
// Set the horizontal text alignment. (nFormat [0:left, 1:middle, 2:right])
- void SetAlignmentH(int32_t nFormat = 0, FX_BOOL bPaint = TRUE);
+ void SetAlignmentH(int32_t nFormat, FX_BOOL bPaint);
// Set the vertical text alignment. (nFormat [0:left, 1:middle, 2:right])
- void SetAlignmentV(int32_t nFormat = 0, FX_BOOL bPaint = TRUE);
+ void SetAlignmentV(int32_t nFormat, FX_BOOL bPaint);
// Set the substitution character for hidden text.
- void SetPasswordChar(uint16_t wSubWord = '*', FX_BOOL bPaint = TRUE);
+ void SetPasswordChar(uint16_t wSubWord, FX_BOOL bPaint);
// Set the maximum number of words in the text.
- void SetLimitChar(int32_t nLimitChar = 0, FX_BOOL bPaint = TRUE);
- void SetCharArray(int32_t nCharArray = 0, FX_BOOL bPaint = TRUE);
- void SetCharSpace(FX_FLOAT fCharSpace = 0.0f, FX_BOOL bPaint = TRUE);
- void SetHorzScale(int32_t nHorzScale = 100, FX_BOOL bPaint = TRUE);
- void SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE);
- void SetMultiLine(FX_BOOL bMultiLine = TRUE, FX_BOOL bPaint = TRUE);
- void SetAutoReturn(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE);
- void SetAutoFontSize(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE);
- void SetAutoScroll(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE);
- void SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint = TRUE);
- void SetTextOverflow(FX_BOOL bAllowed = FALSE, FX_BOOL bPaint = TRUE);
+ void SetLimitChar(int32_t nLimitChar);
+ void SetCharArray(int32_t nCharArray);
+ void SetCharSpace(FX_FLOAT fCharSpace);
+ void SetMultiLine(FX_BOOL bMultiLine, FX_BOOL bPaint);
+ void SetAutoReturn(FX_BOOL bAuto, FX_BOOL bPaint);
+ void SetAutoFontSize(FX_BOOL bAuto, FX_BOOL bPaint);
+ void SetAutoScroll(FX_BOOL bAuto, FX_BOOL bPaint);
+ void SetFontSize(FX_FLOAT fFontSize);
+ void SetTextOverflow(FX_BOOL bAllowed, FX_BOOL bPaint);
FX_BOOL IsRichText() const;
void SetRichText(FX_BOOL bRichText = TRUE, FX_BOOL bPaint = TRUE);
FX_BOOL SetRichFontSize(FX_FLOAT fFontSize);
@@ -486,22 +477,13 @@ class CFX_Edit {
void OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl);
void OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl);
void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl);
- void SetText(const FX_WCHAR* text,
- int32_t charset = DEFAULT_CHARSET,
- const CPVT_SecProps* pSecProps = nullptr,
- const CPVT_WordProps* pWordProps = nullptr);
- FX_BOOL InsertWord(uint16_t word,
- int32_t charset = DEFAULT_CHARSET,
- const CPVT_WordProps* pWordProps = nullptr);
- FX_BOOL InsertReturn(const CPVT_SecProps* pSecProps = nullptr,
- const CPVT_WordProps* pWordProps = nullptr);
+ void SetText(const FX_WCHAR* text);
+ FX_BOOL InsertWord(uint16_t word, int32_t charset);
+ FX_BOOL InsertReturn();
FX_BOOL Backspace();
FX_BOOL Delete();
FX_BOOL Clear();
- FX_BOOL InsertText(const FX_WCHAR* text,
- int32_t charset = DEFAULT_CHARSET,
- const CPVT_SecProps* pSecProps = nullptr,
- const CPVT_WordProps* pWordProps = nullptr);
+ FX_BOOL InsertText(const FX_WCHAR* text, int32_t charset);
FX_BOOL Redo();
FX_BOOL Undo();
int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const;
@@ -551,9 +533,7 @@ class CFX_Edit {
CPVT_WordPlace DoInsertText(const CPVT_WordPlace& place,
const FX_WCHAR* text,
- int32_t charset,
- const CPVT_SecProps* pSecProps,
- const CPVT_WordProps* pWordProps);
+ int32_t charset);
int32_t GetCharSetFromUnicode(uint16_t word, int32_t nOldCharset);
int32_t GetTotalLines() const;
@@ -578,12 +558,6 @@ class CFX_Edit {
void SetScrollLimit();
void SetContentChanged();
- void SetText(const FX_WCHAR* text,
- int32_t charset,
- const CPVT_SecProps* pSecProps,
- const CPVT_WordProps* pWordProps,
- FX_BOOL bAddUndo,
- FX_BOOL bPaint);
FX_BOOL InsertWord(uint16_t word,
int32_t charset,
const CPVT_WordProps* pWordProps,
@@ -598,8 +572,6 @@ class CFX_Edit {
FX_BOOL Clear(FX_BOOL bAddUndo, FX_BOOL bPaint);
FX_BOOL InsertText(const FX_WCHAR* text,
int32_t charset,
- const CPVT_SecProps* pSecProps,
- const CPVT_WordProps* pWordProps,
FX_BOOL bAddUndo,
FX_BOOL bPaint);
void PaintInsertText(const CPVT_WordPlace& wpOld,
@@ -610,9 +582,7 @@ class CFX_Edit {
inline CFX_FloatRect VTToEdit(const CFX_FloatRect& rect) const;
inline CFX_FloatRect EditToVT(const CFX_FloatRect& rect) const;
- void Refresh(REFRESH_PLAN_E ePlan,
- const CPVT_WordRange* pRange1 = nullptr,
- const CPVT_WordRange* pRange2 = nullptr);
+ void Refresh();
void RefreshPushLineRects(const CPVT_WordRange& wr);
void RefreshPushRandomRects(const CPVT_WordRange& wr);
diff --git a/fpdfsdk/pdfwindow/PWL_Edit.cpp b/fpdfsdk/pdfwindow/PWL_Edit.cpp
index 39ea822ea2..5d20dd46a3 100644
--- a/fpdfsdk/pdfwindow/PWL_Edit.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Edit.cpp
@@ -463,17 +463,8 @@ void CPWL_Edit::OnKillFocus() {
m_bFocus = FALSE;
}
-void CPWL_Edit::SetHorzScale(int32_t nHorzScale, FX_BOOL bPaint /* = TRUE*/) {
- m_pEdit->SetHorzScale(nHorzScale, bPaint);
-}
-
-void CPWL_Edit::SetCharSpace(FX_FLOAT fCharSpace, FX_BOOL bPaint /* = TRUE*/) {
- m_pEdit->SetCharSpace(fCharSpace, bPaint);
-}
-
-void CPWL_Edit::SetLineLeading(FX_FLOAT fLineLeading,
- FX_BOOL bPaint /* = TRUE*/) {
- m_pEdit->SetLineLeading(fLineLeading, bPaint);
+void CPWL_Edit::SetCharSpace(FX_FLOAT fCharSpace) {
+ m_pEdit->SetCharSpace(fCharSpace);
}
CFX_ByteString CPWL_Edit::GetSelectAppearanceStream(
@@ -559,14 +550,14 @@ FX_FLOAT CPWL_Edit::GetCharArrayAutoFontSize(CPDF_Font* pFont,
void CPWL_Edit::SetCharArray(int32_t nCharArray) {
if (HasFlag(PES_CHARARRAY) && nCharArray > 0) {
m_pEdit->SetCharArray(nCharArray);
- m_pEdit->SetTextOverflow(TRUE);
+ m_pEdit->SetTextOverflow(TRUE, TRUE);
if (HasFlag(PWS_AUTOFONTSIZE)) {
if (IPVT_FontMap* pFontMap = GetFontMap()) {
FX_FLOAT fFontSize = GetCharArrayAutoFontSize(
pFontMap->GetPDFFont(0), GetClientRect(), nCharArray);
if (fFontSize > 0.0f) {
- m_pEdit->SetAutoFontSize(FALSE);
+ m_pEdit->SetAutoFontSize(FALSE, TRUE);
m_pEdit->SetFontSize(fFontSize);
}
}
@@ -580,7 +571,7 @@ void CPWL_Edit::SetLimitChar(int32_t nLimitChar) {
void CPWL_Edit::ReplaceSel(const FX_WCHAR* csText) {
m_pEdit->Clear();
- m_pEdit->InsertText(csText);
+ m_pEdit->InsertText(csText, DEFAULT_CHARSET);
}
CFX_FloatRect CPWL_Edit::GetFocusRect() const {
diff --git a/fpdfsdk/pdfwindow/PWL_Edit.h b/fpdfsdk/pdfwindow/PWL_Edit.h
index 008e1fd4a5..df69ebf5d7 100644
--- a/fpdfsdk/pdfwindow/PWL_Edit.h
+++ b/fpdfsdk/pdfwindow/PWL_Edit.h
@@ -76,10 +76,7 @@ class CPWL_Edit : public CPWL_EditCtrl {
void SetCharArray(int32_t nCharArray);
void SetLimitChar(int32_t nLimitChar);
- void SetHorzScale(int32_t nHorzScale, FX_BOOL bPaint = TRUE);
- void SetCharSpace(FX_FLOAT fCharSpace, FX_BOOL bPaint = TRUE);
-
- void SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE);
+ void SetCharSpace(FX_FLOAT fCharSpace);
FX_BOOL CanSelectAll() const;
FX_BOOL CanClear() const;
diff --git a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp
index 1bb17db6de..ee3df36a71 100644
--- a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp
+++ b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp
@@ -483,7 +483,7 @@ void CPWL_EditCtrl::ShowVScrollBar(FX_BOOL bShow) {}
void CPWL_EditCtrl::InsertText(const FX_WCHAR* csText) {
if (!IsReadOnly())
- m_pEdit->InsertText(csText);
+ m_pEdit->InsertText(csText, DEFAULT_CHARSET);
}
void CPWL_EditCtrl::InsertWord(uint16_t word, int32_t nCharset) {
diff --git a/fpdfsdk/pdfwindow/PWL_Utils.cpp b/fpdfsdk/pdfwindow/PWL_Utils.cpp
index c8b2239a36..a9698860fe 100644
--- a/fpdfsdk/pdfwindow/PWL_Utils.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Utils.cpp
@@ -441,12 +441,12 @@ CFX_ByteString CPWL_Utils::GetTextAppStream(const CFX_FloatRect& rcBBox,
std::unique_ptr<CFX_Edit> pEdit(new CFX_Edit);
pEdit->SetFontMap(pFontMap);
pEdit->SetPlateRect(rcBBox);
- pEdit->SetAlignmentH(nAlignmentH);
- pEdit->SetAlignmentV(nAlignmentV);
- pEdit->SetMultiLine(bMultiLine);
- pEdit->SetAutoReturn(bAutoReturn);
+ pEdit->SetAlignmentH(nAlignmentH, TRUE);
+ pEdit->SetAlignmentV(nAlignmentV, TRUE);
+ pEdit->SetMultiLine(bMultiLine, TRUE);
+ pEdit->SetAutoReturn(bAutoReturn, TRUE);
if (IsFloatZero(fFontSize))
- pEdit->SetAutoFontSize(TRUE);
+ pEdit->SetAutoFontSize(TRUE, TRUE);
else
pEdit->SetFontSize(fFontSize);
@@ -473,12 +473,12 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox,
std::unique_ptr<CFX_Edit> pEdit(new CFX_Edit);
pEdit->SetFontMap(pFontMap);
- pEdit->SetAlignmentH(1);
- pEdit->SetAlignmentV(1);
- pEdit->SetMultiLine(FALSE);
- pEdit->SetAutoReturn(FALSE);
+ pEdit->SetAlignmentH(1, TRUE);
+ pEdit->SetAlignmentV(1, TRUE);
+ pEdit->SetMultiLine(FALSE, TRUE);
+ pEdit->SetAutoReturn(FALSE, TRUE);
if (IsFloatZero(fFontSize))
- pEdit->SetAutoFontSize(TRUE);
+ pEdit->SetAutoFontSize(TRUE, TRUE);
else
pEdit->SetFontSize(fFontSize);