Kaydet (Commit) 59d48c53 authored tarafından Caolán McNamara's avatar Caolán McNamara

Resolves: tdf#120988 mismatch of in/out locale formatting

Change-Id: I9def43c111adc877aeec9f1990f5dd76fabdbf8f
Reviewed-on: https://gerrit.libreoffice.org/62485
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst a73f696b
...@@ -217,18 +217,18 @@ namespace weld ...@@ -217,18 +217,18 @@ namespace weld
{ {
OUString aStr; OUString aStr;
const LocaleDataWrapper& rLocaleData = Application::GetSettings().GetUILocaleDataWrapper();
unsigned int nDecimalDigits = m_xSpinButton->get_digits(); unsigned int nDecimalDigits = m_xSpinButton->get_digits();
//pawn percent off to icu to decide whether percent is separated from its number for this locale //pawn percent off to icu to decide whether percent is separated from its number for this locale
if (m_eSrcUnit == FUNIT_PERCENT) if (m_eSrcUnit == FUNIT_PERCENT)
{ {
double fValue = nValue; double fValue = nValue;
fValue /= SpinButton::Power10(nDecimalDigits); fValue /= SpinButton::Power10(nDecimalDigits);
aStr = unicode::formatPercent(fValue, Application::GetSettings().GetUILanguageTag()); aStr = unicode::formatPercent(fValue, rLocaleData.getLanguageTag());
} }
else else
{ {
const SvtSysLocale aSysLocale;
const LocaleDataWrapper& rLocaleData = aSysLocale.GetLocaleData();
aStr = rLocaleData.getNum(nValue, nDecimalDigits, true, true); aStr = rLocaleData.getNum(nValue, nDecimalDigits, true, true);
if (m_eSrcUnit != FUNIT_NONE && m_eSrcUnit != FUNIT_DEGREE) if (m_eSrcUnit != FUNIT_NONE && m_eSrcUnit != FUNIT_DEGREE)
aStr += " "; aStr += " ";
...@@ -246,8 +246,7 @@ namespace weld ...@@ -246,8 +246,7 @@ namespace weld
IMPL_LINK(MetricSpinButton, spin_button_input, int*, result, bool) IMPL_LINK(MetricSpinButton, spin_button_input, int*, result, bool)
{ {
const SvtSysLocale aSysLocale; const LocaleDataWrapper& rLocaleData = Application::GetSettings().GetUILocaleDataWrapper();
const LocaleDataWrapper& rLocaleData = aSysLocale.GetLocaleData();
double fResult(0.0); double fResult(0.0);
bool bRet = MetricFormatter::TextToValue(get_text(), fResult, 0, m_xSpinButton->get_digits(), rLocaleData, m_eSrcUnit); bool bRet = MetricFormatter::TextToValue(get_text(), fResult, 0, m_xSpinButton->get_digits(), rLocaleData, m_eSrcUnit);
if (bRet) if (bRet)
...@@ -260,8 +259,7 @@ namespace weld ...@@ -260,8 +259,7 @@ namespace weld
int nStartPos, nEndPos; int nStartPos, nEndPos;
m_xSpinButton->get_selection_bounds(nStartPos, nEndPos); m_xSpinButton->get_selection_bounds(nStartPos, nEndPos);
const SvtSysLocale aSysLocale; const LocaleDataWrapper& rLocaleData = Application::GetSettings().GetUILocaleDataWrapper();
const LocaleDataWrapper& rLocaleData = aSysLocale.GetLocaleData();
const int nTimeArea = TimeFormatter::GetTimeArea(m_eFormat, m_xSpinButton->get_text(), nEndPos, const int nTimeArea = TimeFormatter::GetTimeArea(m_eFormat, m_xSpinButton->get_text(), nEndPos,
rLocaleData); rLocaleData);
...@@ -295,8 +293,7 @@ namespace weld ...@@ -295,8 +293,7 @@ namespace weld
int nStartPos, nEndPos; int nStartPos, nEndPos;
m_xSpinButton->get_selection_bounds(nStartPos, nEndPos); m_xSpinButton->get_selection_bounds(nStartPos, nEndPos);
const SvtSysLocale aSysLocale; const LocaleDataWrapper& rLocaleData = Application::GetSettings().GetUILocaleDataWrapper();
const LocaleDataWrapper& rLocaleData = aSysLocale.GetLocaleData();
tools::Time aResult(0); tools::Time aResult(0);
bool bRet = TimeFormatter::TextToTime(m_xSpinButton->get_text(), aResult, m_eFormat, true, rLocaleData); bool bRet = TimeFormatter::TextToTime(m_xSpinButton->get_text(), aResult, m_eFormat, true, rLocaleData);
if (bRet) if (bRet)
...@@ -328,8 +325,7 @@ namespace weld ...@@ -328,8 +325,7 @@ namespace weld
OUString TimeSpinButton::format_number(int nValue) const OUString TimeSpinButton::format_number(int nValue) const
{ {
const SvtSysLocale aSysLocale; const LocaleDataWrapper& rLocaleData = Application::GetSettings().GetUILocaleDataWrapper();
const LocaleDataWrapper& rLocaleData = aSysLocale.GetLocaleData();
return TimeFormatter::FormatTime(ConvertValue(nValue), m_eFormat, TimeFormat::Hour24, true, rLocaleData); return TimeFormatter::FormatTime(ConvertValue(nValue), m_eFormat, TimeFormat::Hour24, true, rLocaleData);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment