summaryrefslogtreecommitdiff
path: root/xfa/fwl/core
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fwl/core')
-rw-r--r--xfa/fwl/core/cfwl_barcode.cpp3
-rw-r--r--xfa/fwl/core/cfwl_combobox.cpp45
-rw-r--r--xfa/fwl/core/cfwl_combobox.h4
-rw-r--r--xfa/fwl/core/cfwl_combolist.cpp3
-rw-r--r--xfa/fwl/core/cfwl_datetimepicker.cpp8
-rw-r--r--xfa/fwl/core/cfwl_datetimepicker.h4
-rw-r--r--xfa/fwl/core/cfwl_edit.cpp19
-rw-r--r--xfa/fwl/core/cfwl_edit.h4
-rw-r--r--xfa/fwl/core/cfwl_listbox.cpp21
-rw-r--r--xfa/fwl/core/cfwl_listbox.h6
10 files changed, 41 insertions, 76 deletions
diff --git a/xfa/fwl/core/cfwl_barcode.cpp b/xfa/fwl/core/cfwl_barcode.cpp
index 18cf71ebba..6ddcdf3920 100644
--- a/xfa/fwl/core/cfwl_barcode.cpp
+++ b/xfa/fwl/core/cfwl_barcode.cpp
@@ -165,8 +165,7 @@ void CFWL_Barcode::GenerateBarcodeImageCache() {
if (!m_pBarcodeEngine)
return;
- CFX_WideString wsText;
- GetText(wsText);
+ CFX_WideString wsText = GetText();
CFWL_ThemePart part;
part.m_pWidget = this;
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;
}
}
diff --git a/xfa/fwl/core/cfwl_combobox.h b/xfa/fwl/core/cfwl_combobox.h
index a4545198b4..b9f4897586 100644
--- a/xfa/fwl/core/cfwl_combobox.h
+++ b/xfa/fwl/core/cfwl_combobox.h
@@ -77,9 +77,7 @@ class CFWL_ComboBox : public CFWL_Widget {
void RemoveAll();
void SetEditText(const CFX_WideString& wsText);
- void GetEditText(CFX_WideString& wsText,
- int32_t nStart = 0,
- int32_t nCount = -1) const;
+ CFX_WideString GetEditText(int32_t nStart = 0, int32_t nCount = -1) const;
void OpenDropDownList(bool bActivate);
diff --git a/xfa/fwl/core/cfwl_combolist.cpp b/xfa/fwl/core/cfwl_combolist.cpp
index 0476498388..e333cda18a 100644
--- a/xfa/fwl/core/cfwl_combolist.cpp
+++ b/xfa/fwl/core/cfwl_combolist.cpp
@@ -32,8 +32,7 @@ int32_t CFWL_ComboList::MatchItem(const CFX_WideString& wsMatch) {
int32_t iCount = CountItems(this);
for (int32_t i = 0; i < iCount; i++) {
CFWL_ListItem* hItem = GetItem(this, i);
- CFX_WideString wsText;
- GetItemText(this, hItem, wsText);
+ CFX_WideString wsText = GetItemText(this, hItem);
FX_STRSIZE pos = wsText.Find(wsMatch.c_str());
if (!pos)
return i;
diff --git a/xfa/fwl/core/cfwl_datetimepicker.cpp b/xfa/fwl/core/cfwl_datetimepicker.cpp
index 142daf5fe4..35b038d6ce 100644
--- a/xfa/fwl/core/cfwl_datetimepicker.cpp
+++ b/xfa/fwl/core/cfwl_datetimepicker.cpp
@@ -196,11 +196,9 @@ void CFWL_DateTimePicker::SetEditText(const CFX_WideString& wsText) {
DispatchEvent(&ev);
}
-void CFWL_DateTimePicker::GetEditText(CFX_WideString& wsText,
- int32_t nStart,
- int32_t nCount) const {
- if (m_pEdit)
- m_pEdit->GetText(wsText, nStart, nCount);
+CFX_WideString CFWL_DateTimePicker::GetEditText(int32_t nStart,
+ int32_t nCount) const {
+ return m_pEdit ? m_pEdit->GetText(nStart, nCount) : L"";
}
void CFWL_DateTimePicker::GetBBox(CFX_RectF& rect) const {
diff --git a/xfa/fwl/core/cfwl_datetimepicker.h b/xfa/fwl/core/cfwl_datetimepicker.h
index c5dd0ae45c..69e4ef3122 100644
--- a/xfa/fwl/core/cfwl_datetimepicker.h
+++ b/xfa/fwl/core/cfwl_datetimepicker.h
@@ -56,9 +56,7 @@ class CFWL_DateTimePicker : public CFWL_Widget {
void SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay);
void SetEditText(const CFX_WideString& wsText);
- void GetEditText(CFX_WideString& wsText,
- int32_t nStart = 0,
- int32_t nCount = -1) const;
+ CFX_WideString GetEditText(int32_t nStart = 0, int32_t nCount = -1) const;
int32_t CountSelRanges() const { return m_pEdit->CountSelRanges(); }
int32_t GetSelRange(int32_t nIndex, int32_t& nStart) const {
diff --git a/xfa/fwl/core/cfwl_edit.cpp b/xfa/fwl/core/cfwl_edit.cpp
index 99cac68d57..4544ebcb82 100644
--- a/xfa/fwl/core/cfwl_edit.cpp
+++ b/xfa/fwl/core/cfwl_edit.cpp
@@ -113,8 +113,7 @@ void CFWL_Edit::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) {
int32_t iTextLen = m_EdtEngine.GetTextLength();
if (iTextLen > 0) {
- CFX_WideString wsText;
- m_EdtEngine.GetText(wsText, 0);
+ CFX_WideString wsText = m_EdtEngine.GetText(0);
CFX_SizeF sz = CalcTextSize(
wsText, m_pProperties->m_pThemeProvider,
!!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_MultiLine));
@@ -212,8 +211,7 @@ void CFWL_Edit::DrawSpellCheck(CFX_Graphics* pGraphics,
FX_FLOAT fOffSetX = m_rtEngine.left - m_fScrollOffsetX;
FX_FLOAT fOffSetY = m_rtEngine.top - m_fScrollOffsetY + m_fVAlignOffset;
- CFX_WideString wsSpell;
- GetText(wsSpell);
+ CFX_WideString wsSpell = GetText();
int32_t nContentLen = wsSpell.GetLength();
for (int i = 0; i < nContentLen; i++) {
if (FX_EDIT_ISLATINWORD(wsSpell[i])) {
@@ -300,10 +298,8 @@ int32_t CFWL_Edit::GetTextLength() const {
return m_EdtEngine.GetTextLength();
}
-void CFWL_Edit::GetText(CFX_WideString& wsText,
- int32_t nStart,
- int32_t nCount) const {
- m_EdtEngine.GetText(wsText, nStart, nCount);
+CFX_WideString CFWL_Edit::GetText(int32_t nStart, int32_t nCount) const {
+ return m_EdtEngine.GetText(nStart, nCount);
}
void CFWL_Edit::ClearText() {
@@ -349,7 +345,7 @@ bool CFWL_Edit::Copy(CFX_WideString& wsCopy) {
int32_t nStart, nLength;
for (int32_t i = 0; i < nCount; i++) {
nLength = m_EdtEngine.GetSelRange(i, nStart);
- m_EdtEngine.GetText(wsTemp, nStart, nLength);
+ wsTemp = m_EdtEngine.GetText(nStart, nLength);
wsCopy += wsTemp;
wsTemp.clear();
}
@@ -366,7 +362,7 @@ bool CFWL_Edit::Cut(CFX_WideString& wsCut) {
int32_t nStart, nLength;
for (int32_t i = 0; i < nCount; i++) {
nLength = m_EdtEngine.GetSelRange(i, nStart);
- m_EdtEngine.GetText(wsTemp, nStart, nLength);
+ wsTemp = m_EdtEngine.GetText(nStart, nLength);
wsCut += wsTemp;
wsTemp.clear();
}
@@ -1232,8 +1228,7 @@ bool CFWL_Edit::ValidateNumberChar(FX_WCHAR cNum) {
if (!m_bSetRange)
return true;
- CFX_WideString wsOld, wsText;
- m_EdtEngine.GetText(wsText, 0);
+ CFX_WideString wsText = m_EdtEngine.GetText(0);
if (wsText.IsEmpty()) {
if (cNum == L'0')
return false;
diff --git a/xfa/fwl/core/cfwl_edit.h b/xfa/fwl/core/cfwl_edit.h
index 3c4c80759f..342c6dd4d2 100644
--- a/xfa/fwl/core/cfwl_edit.h
+++ b/xfa/fwl/core/cfwl_edit.h
@@ -80,9 +80,7 @@ class CFWL_Edit : public CFWL_Widget {
virtual void SetText(const CFX_WideString& wsText);
int32_t GetTextLength() const;
- void GetText(CFX_WideString& wsText,
- int32_t nStart = 0,
- int32_t nCount = -1) const;
+ CFX_WideString GetText(int32_t nStart = 0, int32_t nCount = -1) const;
void ClearText();
void AddSelRange(int32_t nStart, int32_t nCount = -1);
diff --git a/xfa/fwl/core/cfwl_listbox.cpp b/xfa/fwl/core/cfwl_listbox.cpp
index 1208ab34dc..dff981f283 100644
--- a/xfa/fwl/core/cfwl_listbox.cpp
+++ b/xfa/fwl/core/cfwl_listbox.cpp
@@ -202,11 +202,10 @@ void CFWL_ListBox::SetSelItem(CFWL_ListItem* pItem, bool bSelect) {
SetSelection(pItem, pItem, bSelect);
}
-void CFWL_ListBox::GetDataProviderItemText(CFWL_ListItem* pItem,
- CFX_WideString& wsText) {
+CFX_WideString CFWL_ListBox::GetDataProviderItemText(CFWL_ListItem* pItem) {
if (!pItem)
- return;
- GetItemText(this, pItem, wsText);
+ return L"";
+ return GetItemText(this, pItem);
}
CFWL_ListItem* CFWL_ListBox::GetListItem(CFWL_ListItem* pItem,
@@ -544,8 +543,7 @@ void CFWL_ListBox::DrawItem(CFX_Graphics* pGraphics,
pTheme->DrawBackground(&param);
}
- CFX_WideString wsText;
- GetItemText(this, pItem, wsText);
+ CFX_WideString wsText = GetItemText(this, pItem);
if (wsText.GetLength() <= 0)
return;
@@ -719,8 +717,7 @@ FX_FLOAT CFWL_ListBox::GetMaxTextWidth() {
if (!pItem)
continue;
- CFX_WideString wsText;
- GetItemText(this, pItem, wsText);
+ CFX_WideString wsText = GetItemText(this, pItem);
CFX_SizeF sz = CalcTextSize(wsText, m_pProperties->m_pThemeProvider);
fRet = std::max(fRet, sz.x);
}
@@ -1006,11 +1003,9 @@ bool CFWL_ListBox::OnScroll(CFWL_ScrollBar* pScrollBar,
return true;
}
-void CFWL_ListBox::GetItemText(CFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- CFX_WideString& wsText) {
- if (pItem)
- wsText = static_cast<CFWL_ListItem*>(pItem)->m_wsText;
+CFX_WideString CFWL_ListBox::GetItemText(CFWL_Widget* pWidget,
+ CFWL_ListItem* pItem) {
+ return pItem ? static_cast<CFWL_ListItem*>(pItem)->m_wsText : L"";
}
int32_t CFWL_ListBox::CountItems(const CFWL_Widget* pWidget) const {
diff --git a/xfa/fwl/core/cfwl_listbox.h b/xfa/fwl/core/cfwl_listbox.h
index a2dcdbaf7f..e30068b0b4 100644
--- a/xfa/fwl/core/cfwl_listbox.h
+++ b/xfa/fwl/core/cfwl_listbox.h
@@ -63,9 +63,7 @@ class CFWL_ListBox : public CFWL_Widget {
int32_t GetItemIndex(CFWL_Widget* pWidget, CFWL_ListItem* pItem);
uint32_t GetItemStyles(CFWL_Widget* pWidget, CFWL_ListItem* pItem);
uint32_t GetItemStates(CFWL_ListItem* pItem);
- void GetItemText(CFWL_Widget* pWidget,
- CFWL_ListItem* pItem,
- CFX_WideString& wsText);
+ CFX_WideString GetItemText(CFWL_Widget* pWidget, CFWL_ListItem* pItem);
void GetItemRect(CFWL_Widget* pWidget,
CFWL_ListItem* pItem,
CFX_RectF& rtItem);
@@ -96,7 +94,7 @@ class CFWL_ListBox : public CFWL_Widget {
CFWL_ListItem* GetSelItem(int32_t nIndexSel);
int32_t GetSelIndex(int32_t nIndex);
void SetSelItem(CFWL_ListItem* hItem, bool bSelect = true);
- void GetDataProviderItemText(CFWL_ListItem* hItem, CFX_WideString& wsText);
+ CFX_WideString GetDataProviderItemText(CFWL_ListItem* hItem);
FX_FLOAT GetItemHeight() const { return m_fItemHeight; }
FX_FLOAT CalcItemHeight();