summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2018-01-05 10:31:04 -0500
committerChromium commit bot <commit-bot@chromium.org>2018-01-05 15:43:37 +0000
commit1f04e6111013673880767e98834fa9bb649c7aac (patch)
tree39f837ebae18a5d5a12cc208fb43495ee79c4ef9
parenta63f992c043bc64a11c1eee5c8e7c9af1860650e (diff)
downloadpdfium-1f04e6111013673880767e98834fa9bb649c7aac.tar.xz
Convert CFWL_DateTimePicker::FormatDateString to return WideString
Change-Id: I2141cfb5d2bcb61b1a4f637fe30efc91776039b2 Reviewed-on: https://pdfium-review.googlesource.com/22263 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
-rw-r--r--xfa/fwl/cfwl_datetimepicker.cpp23
-rw-r--r--xfa/fwl/cfwl_datetimepicker.h5
2 files changed, 13 insertions, 15 deletions
diff --git a/xfa/fwl/cfwl_datetimepicker.cpp b/xfa/fwl/cfwl_datetimepicker.cpp
index 8dcdf887f7..f3da454354 100644
--- a/xfa/fwl/cfwl_datetimepicker.cpp
+++ b/xfa/fwl/cfwl_datetimepicker.cpp
@@ -208,18 +208,20 @@ void CFWL_DateTimePicker::DrawDropDownButton(CXFA_Graphics* pGraphics,
pTheme->DrawBackground(&param);
}
-void CFWL_DateTimePicker::FormatDateString(int32_t iYear,
- int32_t iMonth,
- int32_t iDay,
- WideString& wsText) {
+WideString CFWL_DateTimePicker::FormatDateString(int32_t iYear,
+ int32_t iMonth,
+ int32_t iDay) {
if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_DTP_ShortDateFormat) ==
FWL_STYLEEXT_DTP_ShortDateFormat) {
- wsText = WideString::Format(L"%d-%d-%d", iYear, iMonth, iDay);
- } else if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_DTP_LongDateFormat) ==
- FWL_STYLEEXT_DTP_LongDateFormat) {
- wsText =
- WideString::Format(L"%d Year %d Month %d Day", iYear, iMonth, iDay);
+ return WideString::Format(L"%d-%d-%d", iYear, iMonth, iDay);
}
+
+ if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_DTP_LongDateFormat) ==
+ FWL_STYLEEXT_DTP_LongDateFormat) {
+ return WideString::Format(L"%d Year %d Month %d Day", iYear, iMonth, iDay);
+ }
+
+ return WideString();
}
void CFWL_DateTimePicker::ShowMonthCalendar(bool bActivate) {
@@ -308,8 +310,7 @@ void CFWL_DateTimePicker::ProcessSelChanged(int32_t iYear,
m_iMonth = iMonth;
m_iDay = iDay;
- WideString wsText;
- FormatDateString(m_iYear, m_iMonth, m_iDay, wsText);
+ WideString wsText = FormatDateString(m_iYear, m_iMonth, m_iDay);
m_pEdit->SetText(wsText);
m_pEdit->Update();
RepaintRect(m_rtClient);
diff --git a/xfa/fwl/cfwl_datetimepicker.h b/xfa/fwl/cfwl_datetimepicker.h
index 97c5cd196e..6d536016dd 100644
--- a/xfa/fwl/cfwl_datetimepicker.h
+++ b/xfa/fwl/cfwl_datetimepicker.h
@@ -72,10 +72,7 @@ class CFWL_DateTimePicker : public CFWL_Widget {
void DrawDropDownButton(CXFA_Graphics* pGraphics,
IFWL_ThemeProvider* pTheme,
const CFX_Matrix* pMatrix);
- void FormatDateString(int32_t iYear,
- int32_t iMonth,
- int32_t iDay,
- WideString& wsText);
+ WideString FormatDateString(int32_t iYear, int32_t iMonth, int32_t iDay);
void ResetEditAlignment();
void InitProxyForm();
void OnFocusChanged(CFWL_Message* pMsg, bool bSet);