diff options
-rw-r--r-- | xfa/fwl/cfwl_datetimepicker.cpp | 23 | ||||
-rw-r--r-- | xfa/fwl/cfwl_datetimepicker.h | 5 |
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(¶m); } -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); |