diff options
author | Henry Castro <hcastro@collabora.com> | 2020-04-16 22:24:23 -0400 |
---|---|---|
committer | Henry Castro <hcastro@collabora.com> | 2020-05-21 00:42:29 +0200 |
commit | 45ce9bf4413cf1fc65da01c758f7f9bed9b8df99 (patch) | |
tree | 43d0c6b017b33b93ada03563393e0ce9e6062d56 /vcl | |
parent | 400fc54e4288bfef1e3020f338df74fb5ae55e5b (diff) |
lok: fix wrong metric conversion of the metric input control
The client side does not work well if the browser has different locale,
and the input element conversion fails or change to a different value,
so the value is converted to a neutral locale.
Change-Id: I89f96844603a8552609d486590c7de752cb5a95c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92395
Reviewed-by: Henry Castro <hcastro@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93069
Tested-by: Jenkins
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94519
Tested-by: Henry Castro <hcastro@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/app/settings.cxx | 10 | ||||
-rw-r--r-- | vcl/source/control/field.cxx | 4 |
2 files changed, 14 insertions, 0 deletions
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index 66195762b6e1..43ed776e0af7 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -229,6 +229,7 @@ struct ImplAllSettingsData LanguageTag maUILocale; std::unique_ptr<LocaleDataWrapper> mpLocaleDataWrapper; std::unique_ptr<LocaleDataWrapper> mpUILocaleDataWrapper; + std::unique_ptr<LocaleDataWrapper> mpNeutroLocaleDataWrapper; std::unique_ptr<vcl::I18nHelper> mpI18nHelper; std::unique_ptr<vcl::I18nHelper> mpUII18nHelper; SvtSysLocale maSysLocale; @@ -2604,6 +2605,7 @@ ImplAllSettingsData::~ImplAllSettingsData() { mpLocaleDataWrapper.reset(); mpUILocaleDataWrapper.reset(); + mpNeutroLocaleDataWrapper.reset(); mpI18nHelper.reset(); mpUII18nHelper.reset(); } @@ -2835,6 +2837,14 @@ const LocaleDataWrapper& AllSettings::GetUILocaleDataWrapper() const return *mxData->mpUILocaleDataWrapper; } +const LocaleDataWrapper& AllSettings::GetNeutroLocaleDataWrapper() const +{ + if ( !mxData->mpNeutroLocaleDataWrapper ) + const_cast<AllSettings*>(this)->mxData->mpNeutroLocaleDataWrapper.reset( new LocaleDataWrapper( + comphelper::getProcessComponentContext(), LanguageTag("en_US") ) ); + return *mxData->mpNeutroLocaleDataWrapper; +} + const vcl::I18nHelper& AllSettings::GetLocaleI18nHelper() const { if ( !mxData->mpI18nHelper ) { diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx index 6d518486fe84..d534309ac090 100644 --- a/vcl/source/control/field.cxx +++ b/vcl/source/control/field.cxx @@ -1773,6 +1773,10 @@ boost::property_tree::ptree MetricField::DumpAsPropertyTree() aTree.put("min", GetMin()); aTree.put("max", GetMax()); aTree.put("unit", FieldUnitToString(GetUnit())); + OUString sValue = Application::GetSettings().GetNeutroLocaleDataWrapper(). + getNum(GetValue(), GetDecimalDigits(), false, false); + aTree.put("value", sValue.toUtf8().getStr()); + return aTree; } |