summaryrefslogtreecommitdiff
path: root/xfa/fxfa/cxfa_fftextedit.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-04-17 15:12:58 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-17 15:12:58 +0000
commita4c7ac479d291fc3373b9c2f8f25302ecd53b0d5 (patch)
tree6403f92adcae02ef51897ad932ffc585c2422655 /xfa/fxfa/cxfa_fftextedit.cpp
parent3900ddb64f30f36fd6696bd2927cf8f151e6ede9 (diff)
downloadpdfium-a4c7ac479d291fc3373b9c2f8f25302ecd53b0d5.tar.xz
Implement FORM_GetFocusedText() API.
If there is a focused form field, get its text. BUG=chromium:753216 Change-Id: I05294f14d05c1c86769055f6c9eaf9177787d9fd Reviewed-on: https://pdfium-review.googlesource.com/12072 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/cxfa_fftextedit.cpp')
-rw-r--r--xfa/fxfa/cxfa_fftextedit.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/xfa/fxfa/cxfa_fftextedit.cpp b/xfa/fxfa/cxfa_fftextedit.cpp
index fd2cfb76cc..d8de8a028f 100644
--- a/xfa/fxfa/cxfa_fftextedit.cpp
+++ b/xfa/fxfa/cxfa_fftextedit.cpp
@@ -63,7 +63,7 @@ bool CXFA_FFTextEdit::LoadWidget() {
}
void CXFA_FFTextEdit::UpdateWidgetProperty() {
- CFWL_Edit* pWidget = static_cast<CFWL_Edit*>(m_pNormalWidget.get());
+ CFWL_Edit* pWidget = ToEdit(m_pNormalWidget.get());
if (!pWidget)
return;
@@ -185,7 +185,7 @@ bool CXFA_FFTextEdit::OnKillFocus(CXFA_FFWidget* pNewWidget) {
}
bool CXFA_FFTextEdit::CommitData() {
- WideString wsText = static_cast<CFWL_Edit*>(m_pNormalWidget.get())->GetText();
+ WideString wsText = ToEdit(m_pNormalWidget.get())->GetText();
if (m_pNode->SetValue(XFA_VALUEPICTURE_Edit, wsText)) {
m_pNode->UpdateUIDisplay(GetDoc()->GetDocView(), this);
return true;
@@ -255,7 +255,7 @@ bool CXFA_FFTextEdit::UpdateFWLData() {
if (!m_pNormalWidget)
return false;
- CFWL_Edit* pEdit = static_cast<CFWL_Edit*>(m_pNormalWidget.get());
+ CFWL_Edit* pEdit = ToEdit(m_pNormalWidget.get());
XFA_VALUEPICTURE eType = XFA_VALUEPICTURE_Display;
if (IsFocused())
eType = XFA_VALUEPICTURE_Edit;
@@ -305,7 +305,7 @@ void CXFA_FFTextEdit::OnTextChanged(CFWL_Widget* pWidget,
eParam.m_wsChange = wsChanged;
eParam.m_pTarget = m_pNode.Get();
eParam.m_wsPrevText = wsPrevText;
- CFWL_Edit* pEdit = static_cast<CFWL_Edit*>(m_pNormalWidget.get());
+ CFWL_Edit* pEdit = ToEdit(m_pNormalWidget.get());
if (m_pNode->GetFFWidgetType() == XFA_FFWidgetType::kDateTimeEdit) {
CFWL_DateTimePicker* pDateTime = (CFWL_DateTimePicker*)pEdit;
eParam.m_wsNewText = pDateTime->GetEditText();
@@ -417,6 +417,10 @@ void CXFA_FFTextEdit::DeSelect() {
ToEdit(m_pNormalWidget.get())->ClearSelection();
}
+WideString CXFA_FFTextEdit::GetText() {
+ return ToEdit(m_pNormalWidget.get())->GetText();
+}
+
FormFieldType CXFA_FFTextEdit::GetFormFieldType() {
return FormFieldType::kXFA_TextField;
}