summaryrefslogtreecommitdiff
path: root/xfa/fwl/core/cfwl_combobox.cpp
diff options
context:
space:
mode:
authordan sinclair <dsinclair@chromium.org>2016-11-24 10:45:29 -0500
committerChromium commit bot <commit-bot@chromium.org>2016-11-24 16:34:32 +0000
commit0354ccf37f05f25b1bf64fd60bb3b48efab4d7d0 (patch)
tree378745e450e4f02128ab6766d6ca71bd0b27f4ab /xfa/fwl/core/cfwl_combobox.cpp
parent41ba08e5552c2eccad0c34024dc680feb3f2b251 (diff)
downloadpdfium-0354ccf37f05f25b1bf64fd60bb3b48efab4d7d0.tar.xz
Change TxtEdtEngine to return CFX_WideStringchromium/2935chromium/2934chromium/2933chromium/2932
This Cl updates the TxtEdtEngine and TxtEdtBuf to return CFX_WideStrings on a Get instead of taking an out param. The change is propagated out through the various Get methods that call into the edit engine. Change-Id: Iccf10a8ee06678ae3b59f3afd6e65308dacd16bd Reviewed-on: https://pdfium-review.googlesource.com/2070 Commit-Queue: ooo 11-24 -- 12-05 (dsinclair) <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'xfa/fwl/core/cfwl_combobox.cpp')
-rw-r--r--xfa/fwl/core/cfwl_combobox.cpp45
1 files changed, 16 insertions, 29 deletions
diff --git a/xfa/fwl/core/cfwl_combobox.cpp b/xfa/fwl/core/cfwl_combobox.cpp
index b7be67d1bd..5996af9c41 100644
--- a/xfa/fwl/core/cfwl_combobox.cpp
+++ b/xfa/fwl/core/cfwl_combobox.cpp
@@ -211,9 +211,8 @@ void CFWL_ComboBox::DrawWidget(CFX_Graphics* pGraphics,
if (!m_pListBox)
return;
- CFX_WideString wsText;
CFWL_ListItem* hItem = m_pListBox->GetItem(this, m_iCurSel);
- m_pListBox->GetDataProviderItemText(hItem, wsText);
+ CFX_WideString wsText = m_pListBox->GetDataProviderItemText(hItem);
CFWL_ThemeText theme_text;
theme_text.m_pWidget = this;
@@ -270,9 +269,8 @@ void CFWL_ComboBox::SetCurSel(int32_t iSel) {
if (bClearSel) {
m_pEdit->SetText(CFX_WideString());
} else {
- CFX_WideString wsText;
CFWL_ListItem* hItem = m_pListBox->GetItem(this, iSel);
- m_pListBox->GetDataProviderItemText(hItem, wsText);
+ CFX_WideString wsText = m_pListBox->GetDataProviderItemText(hItem);
m_pEdit->SetText(wsText);
}
m_pEdit->Update();
@@ -296,18 +294,16 @@ void CFWL_ComboBox::SetEditText(const CFX_WideString& wsText) {
m_pEdit->Update();
}
-void CFWL_ComboBox::GetEditText(CFX_WideString& wsText,
- int32_t nStart,
- int32_t nCount) const {
+CFX_WideString CFWL_ComboBox::GetEditText(int32_t nStart,
+ int32_t nCount) const {
if (m_pEdit) {
- m_pEdit->GetText(wsText, nStart, nCount);
- return;
+ return m_pEdit->GetText(nStart, nCount);
}
if (!m_pListBox)
- return;
+ return L"";
CFWL_ListItem* hItem = m_pListBox->GetItem(this, m_iCurSel);
- m_pListBox->GetDataProviderItemText(hItem, wsText);
+ return m_pListBox->GetDataProviderItemText(hItem);
}
void CFWL_ComboBox::OpenDropDownList(bool bActivate) {
@@ -414,8 +410,7 @@ void CFWL_ComboBox::ShowDropList(bool bActivate) {
}
void CFWL_ComboBox::MatchEditText() {
- CFX_WideString wsText;
- m_pEdit->GetText(wsText);
+ CFX_WideString wsText = m_pEdit->GetText();
int32_t iMatch = m_pListBox->MatchItem(wsText);
if (iMatch != m_iCurSel) {
m_pListBox->ChangeSelected(iMatch);
@@ -428,9 +423,8 @@ void CFWL_ComboBox::MatchEditText() {
}
void CFWL_ComboBox::SyncEditText(int32_t iListItem) {
- CFX_WideString wsText;
CFWL_ListItem* hItem = m_pListBox->GetItem(this, iListItem);
- m_pListBox->GetDataProviderItemText(hItem, wsText);
+ CFX_WideString wsText = m_pListBox->GetDataProviderItemText(hItem);
m_pEdit->SetText(wsText);
m_pEdit->Update();
m_pEdit->SetSelected();
@@ -458,9 +452,8 @@ void CFWL_ComboBox::Layout() {
m_pEdit->SetWidgetRect(rtEdit);
if (m_iCurSel >= 0) {
- CFX_WideString wsText;
CFWL_ListItem* hItem = m_pListBox->GetItem(this, m_iCurSel);
- m_pListBox->GetDataProviderItemText(hItem, wsText);
+ CFX_WideString wsText = m_pListBox->GetDataProviderItemText(hItem);
m_pEdit->LockUpdate();
m_pEdit->SetText(wsText);
m_pEdit->UnlockUpdate();
@@ -553,8 +546,7 @@ void CFWL_ComboBox::ProcessSelChanged(bool bLButtonUp) {
if (!hItem)
return;
- CFX_WideString wsText;
- m_pListBox->GetItemText(this, hItem, wsText);
+ CFX_WideString wsText = m_pListBox->GetItemText(this, hItem);
if (m_pEdit) {
m_pEdit->SetText(wsText);
m_pEdit->Update();
@@ -785,9 +777,8 @@ void CFWL_ComboBox::DisForm_Layout() {
m_pEdit->SetWidgetRect(rtEdit);
if (m_iCurSel >= 0) {
- CFX_WideString wsText;
CFWL_ListItem* hItem = m_pListBox->GetItem(this, m_iCurSel);
- m_pListBox->GetDataProviderItemText(hItem, wsText);
+ CFX_WideString wsText = m_pListBox->GetDataProviderItemText(hItem);
m_pEdit->LockUpdate();
m_pEdit->SetText(wsText);
m_pEdit->UnlockUpdate();
@@ -964,13 +955,11 @@ void CFWL_ComboBox::DoSubCtrlKey(CFWL_MsgKey* pMsg) {
int32_t iCurSel = m_iCurSel;
bool bDropDown = IsDropDownStyle();
if (bDropDown && m_pEdit) {
- CFX_WideString wsText;
- m_pEdit->GetText(wsText);
+ CFX_WideString wsText = m_pEdit->GetText();
iCurSel = m_pListBox->MatchItem(wsText);
if (iCurSel >= 0) {
- CFX_WideString wsTemp;
CFWL_ListItem* hItem = m_pListBox->GetItem(this, iCurSel);
- m_pListBox->GetDataProviderItemText(hItem, wsTemp);
+ CFX_WideString wsTemp = m_pListBox->GetDataProviderItemText(hItem);
bMatchEqual = wsText == wsTemp;
}
}
@@ -1100,13 +1089,11 @@ void CFWL_ComboBox::DisForm_OnKey(CFWL_MsgKey* pMsg) {
bool bMatchEqual = false;
int32_t iCurSel = m_iCurSel;
if (m_pEdit) {
- CFX_WideString wsText;
- m_pEdit->GetText(wsText);
+ CFX_WideString wsText = m_pEdit->GetText();
iCurSel = pComboList->MatchItem(wsText);
if (iCurSel >= 0) {
- CFX_WideString wsTemp;
CFWL_ListItem* item = m_pListBox->GetSelItem(iCurSel);
- m_pListBox->GetDataProviderItemText(item, wsTemp);
+ CFX_WideString wsTemp = m_pListBox->GetDataProviderItemText(item);
bMatchEqual = wsText == wsTemp;
}
}