summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2020-04-16 22:24:23 -0400
committerHenry Castro <hcastro@collabora.com>2020-04-28 03:12:25 +0200
commit5d6c71151e8c3ae710e4f57dccebf5f1073a399c (patch)
tree7f017c2df8162f20501177af970065ad97261c07 /vcl
parent51d192a3bfa24dc979f7ad6178803d3262290b46 (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>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/app/settings.cxx10
-rw-r--r--vcl/source/control/field.cxx6
2 files changed, 15 insertions, 1 deletions
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index 7e15ab5bb4b8..a072d02e272b 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -233,6 +233,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;
@@ -2639,6 +2640,7 @@ ImplAllSettingsData::~ImplAllSettingsData()
{
mpLocaleDataWrapper.reset();
mpUILocaleDataWrapper.reset();
+ mpNeutroLocaleDataWrapper.reset();
mpI18nHelper.reset();
mpUII18nHelper.reset();
}
@@ -2875,6 +2877,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 3e82d4f7d398..e75a55b52c5c 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -22,7 +22,7 @@
#include <osl/diagnose.h>
#include <comphelper/string.hxx>
-
+#include <comphelper/lok.hxx>
#include <vcl/dialog.hxx>
#include <vcl/field.hxx>
@@ -1708,6 +1708,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;
}