[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - include/vcl svx/source vcl/source
Henry Castro (via logerrit)
logerrit at kemper.freedesktop.org
Wed May 20 22:43:03 UTC 2020
include/vcl/settings.hxx | 1 +
svx/source/sidebar/possize/PosSizePropertyPanel.cxx | 17 ++++++++++-------
vcl/source/app/settings.cxx | 10 ++++++++++
vcl/source/control/field.cxx | 4 ++++
4 files changed, 25 insertions(+), 7 deletions(-)
New commits:
commit 45ce9bf4413cf1fc65da01c758f7f9bed9b8df99
Author: Henry Castro <hcastro at collabora.com>
AuthorDate: Thu Apr 16 22:24:23 2020 -0400
Commit: Henry Castro <hcastro at collabora.com>
CommitDate: Thu May 21 00:42:29 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 <hcastro at collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at 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 at collabora.com>
diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx
index 75894432f05d..b604efdea769 100644
--- a/include/vcl/settings.hxx
+++ b/include/vcl/settings.hxx
@@ -682,6 +682,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 8965f38b56cf..69b4739ede2c 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
@@ -35,6 +35,7 @@
#include <unotools/localedatawrapper.hxx>
#include <unotools/viewoptions.hxx>
#include <vcl/button.hxx>
+#include <unotools/localedatawrapper.hxx>
#include <vcl/canvastools.hxx>
#include <vcl/virdev.hxx>
#include <vcl/svapp.hxx>
@@ -819,26 +820,28 @@ void PosSizePropertyPanel::NotifyItemUpdate(
void PosSizePropertyPanel::GetControlState(const sal_uInt16 nSID, boost::property_tree::ptree& rState)
{
- weld::MetricSpinButton* pControl = nullptr;
+ VclPtr<MetricField> pControl = nullptr;
switch (nSID)
{
case SID_ATTR_TRANSFORM_POS_X:
- pControl = mxMtrPosX.get();
+ pControl = mpMtrPosX;
break;
case SID_ATTR_TRANSFORM_POS_Y:
- pControl = mxMtrPosY.get();
+ pControl = mpMtrPosY;
break;
case SID_ATTR_TRANSFORM_WIDTH:
- pControl = mxMtrWidth.get();
+ pControl = mpMtrWidth;
break;
case SID_ATTR_TRANSFORM_HEIGHT:
- pControl = mxMtrHeight.get();
+ pControl = mpMtrHeight;
break;
}
- if (pControl && !pControl->get_text().isEmpty())
+ if (pControl && !pControl->GetText().isEmpty())
{
- rState.put(pControl->get_buildable_name().getStr(), pControl->get_text().toUtf8().getStr());
+ OUString sValue = Application::GetSettings().GetNeutralLocaleDataWrapper().
+ getNum(pControl->GetValue(pControl->GetUnit()), pControl->GetDecimalDigits(), false, false);
+ rState.put(pControl->get_id().toUtf8().getStr(), sValue.toUtf8().getStr());
}
}
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;
}
More information about the Libreoffice-commits
mailing list