summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2021-07-05 14:24:27 +0200
committerEike Rathke <erack@redhat.com>2021-07-05 23:40:33 +0200
commite8b1f2197776a08ac0b3d7e9a754c3e92327345a (patch)
treedd6f7e60a33e7bfc3dc95419086448930b0d5a61 /vcl/source
parent3d98d35cfab126764ae5a35cee0a4da56baab648 (diff)
Pass Formatter::StaticFormatter also from weld:DateFormatter, tdf#125035
Change-Id: I8e6b0e581b9522fb04225fc945e579406a4be208 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118438 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins (cherry picked from commit 0335a319c5662f0b849a2231e48338dfeb6aa845) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118427
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/control/field2.cxx35
1 files changed, 14 insertions, 21 deletions
diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx
index 603415672f38..6ed04e3a16ee 100644
--- a/vcl/source/control/field2.cxx
+++ b/vcl/source/control/field2.cxx
@@ -1388,8 +1388,8 @@ namespace
}
OUString DateFormatter::FormatDate(const Date& rDate, ExtDateFieldFormat eExtFormat,
- const LocaleDataWrapper& rLocaleData, CalendarWrapper& rCalendarWrapper,
- const Formatter::StaticFormatter* pStaticFormatter)
+ const LocaleDataWrapper& rLocaleData,
+ const Formatter::StaticFormatter& rStaticFormatter)
{
bool bShowCentury = false;
switch (eExtFormat)
@@ -1439,22 +1439,16 @@ OUString DateFormatter::FormatDate(const Date& rDate, ExtDateFieldFormat eExtFor
{
case ExtDateFieldFormat::SystemLong:
{
- /* TODO: adapt all callers to pass a StaticFormatter. */
- if (!pStaticFormatter)
- return rLocaleData.getLongDate( rDate, rCalendarWrapper, !bShowCentury );
- else
- {
- SvNumberFormatter* pFormatter = *pStaticFormatter;
- const LanguageTag aFormatterLang( pFormatter->GetLanguageTag());
- const sal_uInt32 nIndex = pFormatter->GetFormatIndex( NF_DATE_SYSTEM_LONG,
- rLocaleData.getLanguageTag().getLanguageType(false));
- OUString aStr;
- const Color* pCol;
- pFormatter->GetOutputString( rDate - pFormatter->GetNullDate(), nIndex, aStr, &pCol);
- // Reset to what other uses may expect.
- pFormatter->ChangeIntl( aFormatterLang.getLanguageType(false));
- return aStr;
- }
+ SvNumberFormatter* pFormatter = rStaticFormatter;
+ const LanguageTag aFormatterLang( pFormatter->GetLanguageTag());
+ const sal_uInt32 nIndex = pFormatter->GetFormatIndex( NF_DATE_SYSTEM_LONG,
+ rLocaleData.getLanguageTag().getLanguageType(false));
+ OUString aStr;
+ const Color* pCol;
+ pFormatter->GetOutputString( rDate - pFormatter->GetNullDate(), nIndex, aStr, &pCol);
+ // Reset to what other uses may expect.
+ pFormatter->ChangeIntl( aFormatterLang.getLanguageType(false));
+ return aStr;
}
case ExtDateFieldFormat::ShortDDMMYY:
case ExtDateFieldFormat::ShortDDMMYYYY:
@@ -1499,8 +1493,7 @@ OUString DateFormatter::FormatDate(const Date& rDate, ExtDateFieldFormat eExtFor
OUString DateFormatter::ImplGetDateAsText( const Date& rDate ) const
{
- return DateFormatter::FormatDate(rDate, GetExtDateFormat(), ImplGetLocaleDataWrapper(),
- GetCalendarWrapper(), &maStaticFormatter);
+ return DateFormatter::FormatDate(rDate, GetExtDateFormat(), ImplGetLocaleDataWrapper(), maStaticFormatter);
}
static void ImplDateIncrementDay( Date& rDate, bool bUp )
@@ -2219,7 +2212,7 @@ namespace weld
OUString DateFormatter::FormatNumber(int nValue) const
{
const LocaleDataWrapper& rLocaleData = Application::GetSettings().GetLocaleDataWrapper();
- return ::DateFormatter::FormatDate(Date(nValue), m_eFormat, rLocaleData, GetCalendarWrapper());
+ return ::DateFormatter::FormatDate(Date(nValue), m_eFormat, rLocaleData, m_aStaticFormatter);
}
IMPL_LINK_NOARG(DateFormatter, FormatOutputHdl, LinkParamNone*, bool)