From 0354ccf37f05f25b1bf64fd60bb3b48efab4d7d0 Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Thu, 24 Nov 2016 10:45:29 -0500 Subject: Change TxtEdtEngine to return CFX_WideString MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) Reviewed-by: Nicolás Peña --- xfa/fwl/core/cfwl_listbox.cpp | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'xfa/fwl/core/cfwl_listbox.cpp') 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(¶m); } - 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(pItem)->m_wsText; +CFX_WideString CFWL_ListBox::GetItemText(CFWL_Widget* pWidget, + CFWL_ListItem* pItem) { + return pItem ? static_cast(pItem)->m_wsText : L""; } int32_t CFWL_ListBox::CountItems(const CFWL_Widget* pWidget) const { -- cgit v1.2.3