summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfdoc/cpdf_formfield.cpp5
-rw-r--r--core/fpdfdoc/cpdf_formfield.h1
-rw-r--r--fpdfsdk/pwl/cpwl_edit.cpp40
-rw-r--r--fpdfsdk/pwl/cpwl_edit_impl.cpp10
4 files changed, 6 insertions, 50 deletions
diff --git a/core/fpdfdoc/cpdf_formfield.cpp b/core/fpdfdoc/cpdf_formfield.cpp
index 540e1c9ae0..ae10b9e39d 100644
--- a/core/fpdfdoc/cpdf_formfield.cpp
+++ b/core/fpdfdoc/cpdf_formfield.cpp
@@ -289,11 +289,6 @@ ByteString CPDF_FormField::GetDefaultStyle() const {
return pObj ? pObj->GetString() : "";
}
-WideString CPDF_FormField::GetRichTextString() const {
- CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict.Get(), "RV");
- return pObj ? pObj->GetUnicodeText() : L"";
-}
-
WideString CPDF_FormField::GetValue(bool bDefault) const {
if (GetType() == CheckBox || GetType() == RadioButton)
return GetCheckValue(bDefault);
diff --git a/core/fpdfdoc/cpdf_formfield.h b/core/fpdfdoc/cpdf_formfield.h
index 4f25465b43..b79e430dee 100644
--- a/core/fpdfdoc/cpdf_formfield.h
+++ b/core/fpdfdoc/cpdf_formfield.h
@@ -129,7 +129,6 @@ class CPDF_FormField {
uint32_t GetFieldFlags() const;
ByteString GetDefaultStyle() const;
- WideString GetRichTextString() const;
WideString GetValue() const;
WideString GetDefaultValue() const;
diff --git a/fpdfsdk/pwl/cpwl_edit.cpp b/fpdfsdk/pwl/cpwl_edit.cpp
index 6c867ca456..41f2517a0a 100644
--- a/fpdfsdk/pwl/cpwl_edit.cpp
+++ b/fpdfsdk/pwl/cpwl_edit.cpp
@@ -14,8 +14,6 @@
#include "core/fpdfapi/font/cpdf_font.h"
#include "core/fpdfdoc/cpvt_word.h"
#include "core/fxcrt/fx_safe_types.h"
-#include "core/fxcrt/xml/cxml_content.h"
-#include "core/fxcrt/xml/cxml_element.h"
#include "core/fxge/cfx_graphstatedata.h"
#include "core/fxge/cfx_pathdata.h"
#include "core/fxge/cfx_renderdevice.h"
@@ -40,43 +38,7 @@ ByteString CPWL_Edit::GetClassName() const {
}
void CPWL_Edit::SetText(const WideString& csText) {
- WideString swText = csText;
- if (!HasFlag(PES_RICH)) {
- m_pEdit->SetText(swText);
- return;
- }
-
- ByteString sValue = ByteString::FromUnicode(swText);
- std::unique_ptr<CXML_Element> pXML(
- CXML_Element::Parse(sValue.c_str(), sValue.GetLength()));
- if (!pXML) {
- m_pEdit->SetText(swText);
- return;
- }
- swText.clear();
-
- bool bFirst = true;
- size_t nCount = pXML->CountChildren();
- for (size_t i = 0; i < nCount; ++i) {
- CXML_Element* pSubElement = ToElement(pXML->GetChild(i));
- if (!pSubElement || !pSubElement->GetTagName().EqualNoCase("p"))
- continue;
-
- WideString swSection;
- size_t nSubChild = pSubElement->CountChildren();
- for (size_t j = 0; j < nSubChild; ++j) {
- CXML_Content* pSubContent = ToContent(pSubElement->GetChild(j));
- if (pSubContent)
- swSection += pSubContent->m_Content;
- }
- if (bFirst)
- bFirst = false;
- else
- swText += FWL_VKEY_Return;
- swText += swSection;
- }
-
- m_pEdit->SetText(swText);
+ m_pEdit->SetText(csText);
}
bool CPWL_Edit::RePosChildWnd() {
diff --git a/fpdfsdk/pwl/cpwl_edit_impl.cpp b/fpdfsdk/pwl/cpwl_edit_impl.cpp
index cb774e5ef9..6d9fd20445 100644
--- a/fpdfsdk/pwl/cpwl_edit_impl.cpp
+++ b/fpdfsdk/pwl/cpwl_edit_impl.cpp
@@ -1808,16 +1808,16 @@ CPVT_WordPlace CPWL_EditImpl::DoInsertText(const CPVT_WordPlace& place,
for (int32_t i = 0, sz = sText.GetLength(); i < sz; i++) {
uint16_t word = sText[i];
switch (word) {
- case 0x0D:
+ case '\r':
wp = m_pVT->InsertSection(wp);
- if (i + 1 < sz && sText[i + 1] == 0x0A)
+ if (i + 1 < sz && sText[i + 1] == '\n')
i++;
break;
- case 0x0A:
+ case '\n':
wp = m_pVT->InsertSection(wp);
break;
- case 0x09:
- word = 0x20;
+ case '\t':
+ word = ' ';
FX_FALLTHROUGH;
default:
wp =