include/vcl/settings.hxx                            |    1 +
 svx/source/sidebar/possize/PosSizePropertyPanel.cxx |    5 ++++-
 vcl/source/app/settings.cxx                         |   10 ++++++++++
 vcl/source/control/field.cxx                        |    4 ++++
 4 files changed, 19 insertions(+), 1 deletion(-)

New commits:
commit 863de3f7c4031f3d583debeebe0fdd8ef1ac3911
Author:     Henry Castro <[email protected]>
AuthorDate: Thu Apr 16 22:24:23 2020 -0400
Commit:     Henry Castro <[email protected]>
CommitDate: Sat May 9 14:24:24 2020 +0200

    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 <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93069
    Tested-by: Jenkins

diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx
index 6adda0d66fa2..fedb39ccaa09 100644
--- a/include/vcl/settings.hxx
+++ b/include/vcl/settings.hxx
@@ -707,6 +707,7 @@ public:
     static bool                             GetMathLayoutRTL();   // returns 
true if UI language requires right-to-left Math Layout
     const LocaleDataWrapper&                GetLocaleDataWrapper() const;
     const LocaleDataWrapper&                GetUILocaleDataWrapper() const;
+    const LocaleDataWrapper&                GetNeutroLocaleDataWrapper() const;
     const vcl::I18nHelper&                  GetLocaleI18nHelper() const;
     const vcl::I18nHelper&                  GetUILocaleI18nHelper() const;
 
diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx 
b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
index 24737369d2db..38d49e88ec67 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
@@ -34,6 +34,7 @@
 #include <svx/dialcontrol.hxx>
 #include <svx/rectenum.hxx>
 #include <unotools/viewoptions.hxx>
+#include <unotools/localedatawrapper.hxx>
 #include <vcl/canvastools.hxx>
 #include <vcl/fieldvalues.hxx>
 #include <svl/intitem.hxx>
@@ -800,7 +801,9 @@ void PosSizePropertyPanel::GetControlState(const sal_uInt16 
nSID, boost::propert
 
     if (pControl && !pControl->get_text().isEmpty())
     {
-        rState.put(pControl->get_buildable_name().getStr(), 
pControl->get_text().toUtf8().getStr());
+        OUString sValue = 
Application::GetSettings().GetNeutroLocaleDataWrapper().
+            getNum(pControl->get_value(pControl->get_unit()), 
pControl->get_digits(), false, false);
+        rState.put(pControl->get_buildable_name().getStr(), 
sValue.toUtf8().getStr());
     }
 }
 
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index 8db54992b80f..9044867bae3d 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -238,6 +238,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;
@@ -2755,6 +2756,7 @@ ImplAllSettingsData::~ImplAllSettingsData()
 {
     mpLocaleDataWrapper.reset();
     mpUILocaleDataWrapper.reset();
+    mpNeutroLocaleDataWrapper.reset();
     mpI18nHelper.reset();
     mpUII18nHelper.reset();
 }
@@ -2991,6 +2993,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 dc4e98c440f0..e6a4e96598ed 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -1694,6 +1694,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;
 }
 
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to