summaryrefslogtreecommitdiff
path: root/xfa/fxfa/cxfa_ffcombobox.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-23 17:02:23 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-23 17:02:23 +0000
commit6aec70bc09cb65b169fe6ca1af65e8929aeea43a (patch)
tree34d55cf15cba0fe71e87a896184ecdc891d4752f /xfa/fxfa/cxfa_ffcombobox.cpp
parentd49254bc9323883deba14d27026ec2bb9af096fa (diff)
downloadpdfium-6aec70bc09cb65b169fe6ca1af65e8929aeea43a.tar.xz
Cleanup CXFA_WidgetDatachromium/3277
This CL cleans up return values, out-params and changes simple methods to boolean checks where possible in CXFA_WidgetData. Change-Id: I29daa67993730f3e9d61cb6fdf918a886cc9120e Reviewed-on: https://pdfium-review.googlesource.com/19230 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/cxfa_ffcombobox.cpp')
-rw-r--r--xfa/fxfa/cxfa_ffcombobox.cpp32
1 files changed, 11 insertions, 21 deletions
diff --git a/xfa/fxfa/cxfa_ffcombobox.cpp b/xfa/fxfa/cxfa_ffcombobox.cpp
index 87e14d205f..f96ccb8b32 100644
--- a/xfa/fxfa/cxfa_ffcombobox.cpp
+++ b/xfa/fxfa/cxfa_ffcombobox.cpp
@@ -55,13 +55,10 @@ bool CXFA_FFComboBox::LoadWidget() {
pComboBox->AddString(label.AsStringView());
std::vector<int32_t> iSelArray = m_pDataAcc->GetSelectedItems();
- if (!iSelArray.empty()) {
+ if (iSelArray.empty())
+ pComboBox->SetEditText(m_pDataAcc->GetValue(XFA_VALUEPICTURE_Raw));
+ else
pComboBox->SetCurSel(iSelArray.front());
- } else {
- WideString wsText;
- m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Raw);
- pComboBox->SetEditText(wsText);
- }
UpdateWidgetProperty();
m_pNormalWidget->UnlockUpdate();
@@ -88,7 +85,7 @@ void CXFA_FFComboBox::UpdateWidgetProperty() {
dwExtendedStyle |= GetAlignment();
m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF);
- if (m_pDataAcc->GetHorizontalScrollPolicy() != XFA_ATTRIBUTEENUM_Off)
+ if (!m_pDataAcc->IsHorizontalScrollPolicyOff())
dwEditStyles |= FWL_STYLEEXT_EDT_AutoHScroll;
pComboBox->EditModifyStylesEx(dwEditStyles, 0xFFFFFFFF);
@@ -115,7 +112,7 @@ void CXFA_FFComboBox::OpenDropDownList() {
}
bool CXFA_FFComboBox::CommitData() {
- return m_pDataAcc->SetValue(m_wsNewValue, XFA_VALUEPICTURE_Raw);
+ return m_pDataAcc->SetValue(XFA_VALUEPICTURE_Raw, m_wsNewValue);
}
bool CXFA_FFComboBox::IsDataChanged() {
@@ -125,12 +122,9 @@ bool CXFA_FFComboBox::IsDataChanged() {
if (iCursel >= 0) {
WideString wsSel = pFWLcombobox->GetTextByIndex(iCursel);
if (wsSel == wsText)
- m_pDataAcc->GetChoiceListItem(wsText, iCursel, true);
+ wsText = m_pDataAcc->GetChoiceListItem(iCursel, true).value_or(L"");
}
-
- WideString wsOldValue;
- m_pDataAcc->GetValue(wsOldValue, XFA_VALUEPICTURE_Raw);
- if (wsOldValue == wsText)
+ if (m_pDataAcc->GetValue(XFA_VALUEPICTURE_Raw) == wsText)
return false;
m_wsNewValue = wsText;
@@ -193,10 +187,8 @@ bool CXFA_FFComboBox::UpdateFWLData() {
if (!iSelArray.empty()) {
pComboBox->SetCurSel(iSelArray.front());
} else {
- WideString wsText;
pComboBox->SetCurSel(-1);
- m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Raw);
- pComboBox->SetEditText(wsText);
+ pComboBox->SetEditText(m_pDataAcc->GetValue(XFA_VALUEPICTURE_Raw));
}
pComboBox->Update();
return true;
@@ -292,19 +284,17 @@ void CXFA_FFComboBox::DeleteItem(int32_t nIndex) {
void CXFA_FFComboBox::OnTextChanged(CFWL_Widget* pWidget,
const WideString& wsChanged) {
CXFA_EventParam eParam;
- m_pDataAcc->GetValue(eParam.m_wsPrevText, XFA_VALUEPICTURE_Raw);
+ eParam.m_wsPrevText = m_pDataAcc->GetValue(XFA_VALUEPICTURE_Raw);
eParam.m_wsChange = wsChanged;
FWLEventSelChange(&eParam);
}
void CXFA_FFComboBox::OnSelectChanged(CFWL_Widget* pWidget, bool bLButtonUp) {
CXFA_EventParam eParam;
- m_pDataAcc->GetValue(eParam.m_wsPrevText, XFA_VALUEPICTURE_Raw);
+ eParam.m_wsPrevText = m_pDataAcc->GetValue(XFA_VALUEPICTURE_Raw);
FWLEventSelChange(&eParam);
- if (m_pDataAcc->GetChoiceListCommitOn() == XFA_ATTRIBUTEENUM_Select &&
- bLButtonUp) {
+ if (m_pDataAcc->IsChoiceListCommitOnSelect() && bLButtonUp)
m_pDocView->SetFocusWidgetAcc(nullptr);
- }
}
void CXFA_FFComboBox::OnPreOpen(CFWL_Widget* pWidget) {