diff options
Diffstat (limited to 'xfa')
-rw-r--r-- | xfa/fxfa/cxfa_ffcombobox.cpp | 25 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffcombobox.h | 3 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_fftextedit.cpp | 12 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_fftextedit.h | 1 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffwidget.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffwidget.h | 1 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffwidgethandler.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffwidgethandler.h | 1 |
8 files changed, 39 insertions, 12 deletions
diff --git a/xfa/fxfa/cxfa_ffcombobox.cpp b/xfa/fxfa/cxfa_ffcombobox.cpp index 268d1da2b4..e4de85c517 100644 --- a/xfa/fxfa/cxfa_ffcombobox.cpp +++ b/xfa/fxfa/cxfa_ffcombobox.cpp @@ -116,14 +116,7 @@ bool CXFA_FFComboBox::CommitData() { } bool CXFA_FFComboBox::IsDataChanged() { - auto* pFWLcombobox = ToComboBox(m_pNormalWidget.get()); - WideString wsText = pFWLcombobox->GetEditText(); - int32_t iCursel = pFWLcombobox->GetCurSel(); - if (iCursel >= 0) { - WideString wsSel = pFWLcombobox->GetTextByIndex(iCursel); - if (wsSel == wsText) - wsText = m_pNode->GetChoiceListItem(iCursel, true).value_or(L""); - } + WideString wsText = GetCurrentText(); if (m_pNode->GetValue(XFA_VALUEPICTURE_Raw) == wsText) return false; @@ -138,6 +131,18 @@ void CXFA_FFComboBox::FWLEventSelChange(CXFA_EventParam* pParam) { m_pNode->ProcessEvent(GetDocView(), XFA_AttributeEnum::Change, pParam); } +WideString CXFA_FFComboBox::GetCurrentText() const { + auto* pFWLcombobox = ToComboBox(m_pNormalWidget.get()); + WideString wsText = pFWLcombobox->GetEditText(); + int32_t iCursel = pFWLcombobox->GetCurSel(); + if (iCursel >= 0) { + WideString wsSel = pFWLcombobox->GetTextByIndex(iCursel); + if (wsSel == wsText) + wsText = m_pNode->GetChoiceListItem(iCursel, true).value_or(L""); + } + return wsText; +} + uint32_t CXFA_FFComboBox::GetAlignment() { CXFA_Para* para = m_pNode->GetParaIfExists(); if (!para) @@ -259,6 +264,10 @@ void CXFA_FFComboBox::DeSelect() { ToComboBox(m_pNormalWidget.get())->EditDeSelect(); } +WideString CXFA_FFComboBox::GetText() { + return GetCurrentText(); +} + FormFieldType CXFA_FFComboBox::GetFormFieldType() { return FormFieldType::kXFA_ComboBox; } diff --git a/xfa/fxfa/cxfa_ffcombobox.h b/xfa/fxfa/cxfa_ffcombobox.h index 5daab781a6..66f92b2557 100644 --- a/xfa/fxfa/cxfa_ffcombobox.h +++ b/xfa/fxfa/cxfa_ffcombobox.h @@ -37,6 +37,7 @@ class CXFA_FFComboBox : public CXFA_FFDropDown { void SelectAll() override; void Delete() override; void DeSelect() override; + WideString GetText() override; FormFieldType GetFormFieldType() override; // IFWL_WidgetDelegate @@ -67,6 +68,8 @@ class CXFA_FFComboBox : public CXFA_FFDropDown { uint32_t GetAlignment(); void FWLEventSelChange(CXFA_EventParam* pParam); + WideString GetCurrentText() const; + WideString m_wsNewValue; IFWL_WidgetDelegate* m_pOldDelegate; }; 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; } diff --git a/xfa/fxfa/cxfa_fftextedit.h b/xfa/fxfa/cxfa_fftextedit.h index 36251e152a..7c19444ae6 100644 --- a/xfa/fxfa/cxfa_fftextedit.h +++ b/xfa/fxfa/cxfa_fftextedit.h @@ -58,6 +58,7 @@ class CXFA_FFTextEdit : public CXFA_FFField { void SelectAll() override; void Delete() override; void DeSelect() override; + WideString GetText() override; FormFieldType GetFormFieldType() override; protected: diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp index f9a4807099..553612ea87 100644 --- a/xfa/fxfa/cxfa_ffwidget.cpp +++ b/xfa/fxfa/cxfa_ffwidget.cpp @@ -499,6 +499,10 @@ void CXFA_FFWidget::Delete() {} void CXFA_FFWidget::DeSelect() {} +WideString CXFA_FFWidget::GetText() { + return WideString(); +} + FormFieldType CXFA_FFWidget::GetFormFieldType() { return FormFieldType::kXFA; } diff --git a/xfa/fxfa/cxfa_ffwidget.h b/xfa/fxfa/cxfa_ffwidget.h index a16b27a88f..0381a0c913 100644 --- a/xfa/fxfa/cxfa_ffwidget.h +++ b/xfa/fxfa/cxfa_ffwidget.h @@ -140,6 +140,7 @@ class CXFA_FFWidget : public CXFA_ContentLayoutItem { virtual void SelectAll(); virtual void Delete(); virtual void DeSelect(); + virtual WideString GetText(); virtual FormFieldType GetFormFieldType(); diff --git a/xfa/fxfa/cxfa_ffwidgethandler.cpp b/xfa/fxfa/cxfa_ffwidgethandler.cpp index f2bce57ea4..c3efd60b1d 100644 --- a/xfa/fxfa/cxfa_ffwidgethandler.cpp +++ b/xfa/fxfa/cxfa_ffwidgethandler.cpp @@ -147,6 +147,10 @@ bool CXFA_FFWidgetHandler::OnChar(CXFA_FFWidget* hWidget, return bRet; } +WideString CXFA_FFWidgetHandler::GetText(CXFA_FFWidget* widget) { + return widget->GetText(); +} + WideString CXFA_FFWidgetHandler::GetSelectedText(CXFA_FFWidget* widget) { if (!widget->CanCopy()) return WideString(); diff --git a/xfa/fxfa/cxfa_ffwidgethandler.h b/xfa/fxfa/cxfa_ffwidgethandler.h index 378a442409..ba6a5a26ca 100644 --- a/xfa/fxfa/cxfa_ffwidgethandler.h +++ b/xfa/fxfa/cxfa_ffwidgethandler.h @@ -54,6 +54,7 @@ class CXFA_FFWidgetHandler { uint32_t dwFlags, const CFX_PointF& point); + WideString GetText(CXFA_FFWidget* widget); WideString GetSelectedText(CXFA_FFWidget* widget); void PasteText(CXFA_FFWidget* widget, const WideString& text); |