[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - extensions/source vcl/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Sat Aug 15 05:38:33 UTC 2020
extensions/source/propctrlr/standardcontrol.cxx | 8 ++++++--
vcl/source/window/builder.cxx | 7 ++++++-
2 files changed, 12 insertions(+), 3 deletions(-)
New commits:
commit 4acf7b7b03ed62cbea2b738c9dcfe3a8bdb36288
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Aug 14 10:29:30 2020 +0100
Commit: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
CommitDate: Sat Aug 15 07:38:00 2020 +0200
tdf#135526 ranges overflowing to become negative
the properties panel uses huge min/maxes which can overflow
when the number of digits changes
Change-Id: Idbb998a065ce8f2b918fceea2076b794cbde3368
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100696
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx
index dc1891eab122..a9b422440932 100644
--- a/extensions/source/propctrlr/standardcontrol.cxx
+++ b/extensions/source/propctrlr/standardcontrol.cxx
@@ -327,9 +327,13 @@ namespace pcr
return getTypedControlWindow()->get_digits();
}
- void SAL_CALL ONumericControl::setDecimalDigits( ::sal_Int16 _decimaldigits )
+ void SAL_CALL ONumericControl::setDecimalDigits( ::sal_Int16 decimaldigits )
{
- getTypedControlWindow()->set_digits( _decimaldigits );
+ weld::MetricSpinButton* pControlWindow = getTypedControlWindow();
+ int min, max;
+ pControlWindow->get_range(min, max, FieldUnit::NONE);
+ pControlWindow->set_digits(decimaldigits);
+ pControlWindow->set_range(min, max, FieldUnit::NONE);
}
Optional< double > SAL_CALL ONumericControl::getMinValue()
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index d15d3e668937..14d6cdeed6ce 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -321,7 +321,12 @@ namespace weld
int MetricSpinButton::ConvertValue(int nValue, FieldUnit eInUnit, FieldUnit eOutUnit) const
{
- return vcl::ConvertValue(nValue, 0, m_xSpinButton->get_digits(), eInUnit, eOutUnit);
+ auto nRet = vcl::ConvertValue(nValue, 0, m_xSpinButton->get_digits(), eInUnit, eOutUnit);
+ if (nRet > SAL_MAX_INT32)
+ nRet = SAL_MAX_INT32;
+ else if (nRet < SAL_MIN_INT32)
+ nRet = SAL_MIN_INT32;
+ return nRet;
}
IMPL_LINK(MetricSpinButton, spin_button_input, int*, result, bool)
More information about the Libreoffice-commits
mailing list