diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-02-03 19:59:25 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-02-04 11:21:00 +0100 |
commit | ea771e85b2302829394df545bb82c02bff2750c2 (patch) | |
tree | 8ff097ea232a02968ee5e1312fb24b3d11507065 /extensions/source | |
parent | f2d62b11cd7d47925fd098b3947726313d6b296e (diff) |
Resolves: tdf#146997 use sal_Int64 instead of sal_Int32 for spinbutton values
for these cases where draw wants to massively scale the units
the underlying "metric conversion" are already using sal_Int64 anyway
Change-Id: I94e120d72644319548f75b2f68cfe60d4829a2e8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129356
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'extensions/source')
-rw-r--r-- | extensions/source/propctrlr/standardcontrol.cxx | 26 | ||||
-rw-r--r-- | extensions/source/propctrlr/standardcontrol.hxx | 4 |
2 files changed, 15 insertions, 15 deletions
diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx index 8c33d0598711..4aec523f9614 100644 --- a/extensions/source/propctrlr/standardcontrol.cxx +++ b/extensions/source/propctrlr/standardcontrol.cxx @@ -229,16 +229,16 @@ namespace pcr notifyModifiedValue(); } - static int ImplCalcLongValue( double nValue, sal_uInt16 nDigits ) + static sal_Int64 ImplCalcLongValue( double nValue, sal_uInt16 nDigits ) { double n = nValue; for ( sal_uInt16 d = 0; d < nDigits; ++d ) n *= 10; - return o3tl::saturating_cast<int>(n); + return o3tl::saturating_cast<sal_Int64>(n); } - static double ImplCalcDoubleValue( int nValue, sal_uInt16 nDigits ) + static double ImplCalcDoubleValue(sal_Int64 nValue, sal_uInt16 nDigits ) { double n = nValue; for ( sal_uInt16 d = 0; d < nDigits; ++d ) @@ -376,7 +376,7 @@ namespace pcr void SAL_CALL ONumericControl::setDecimalDigits( ::sal_Int16 decimaldigits ) { weld::MetricSpinButton* pControlWindow = getTypedControlWindow(); - int min, max; + sal_Int64 min, max; pControlWindow->get_range(min, max, FieldUnit::NONE); pControlWindow->set_digits(decimaldigits); pControlWindow->set_range(min, max, FieldUnit::NONE); @@ -386,8 +386,8 @@ namespace pcr { Optional< double > aReturn( true, 0 ); - int minValue = getTypedControlWindow()->get_min(FieldUnit::NONE); - if ( minValue == std::numeric_limits<int>::min() ) + sal_Int64 minValue = getTypedControlWindow()->get_min(FieldUnit::NONE); + if ( minValue == std::numeric_limits<sal_Int64>::min() ) aReturn.IsPresent = false; else aReturn.Value = static_cast<double>(minValue); @@ -398,7 +398,7 @@ namespace pcr void SAL_CALL ONumericControl::setMinValue( const Optional< double >& _minvalue ) { if ( !_minvalue.IsPresent ) - getTypedControlWindow()->set_min( std::numeric_limits<int>::min(), FieldUnit::NONE ); + getTypedControlWindow()->set_min( std::numeric_limits<sal_Int64>::min(), FieldUnit::NONE ); else getTypedControlWindow()->set_min( impl_apiValueToFieldValue_nothrow( _minvalue.Value ) , m_eValueUnit); } @@ -407,8 +407,8 @@ namespace pcr { Optional< double > aReturn( true, 0 ); - int maxValue = getTypedControlWindow()->get_max(FieldUnit::NONE); - if ( maxValue == std::numeric_limits<int>::max() ) + sal_Int64 maxValue = getTypedControlWindow()->get_max(FieldUnit::NONE); + if ( maxValue == std::numeric_limits<sal_Int64>::max() ) aReturn.IsPresent = false; else aReturn.Value = static_cast<double>(maxValue); @@ -419,7 +419,7 @@ namespace pcr void SAL_CALL ONumericControl::setMaxValue( const Optional< double >& _maxvalue ) { if ( !_maxvalue.IsPresent ) - getTypedControlWindow()->set_max( std::numeric_limits<int>::max(), FieldUnit::NONE ); + getTypedControlWindow()->set_max( std::numeric_limits<sal_Int64>::max(), FieldUnit::NONE ); else getTypedControlWindow()->set_max( impl_apiValueToFieldValue_nothrow( _maxvalue.Value ), m_eValueUnit ); } @@ -478,14 +478,14 @@ namespace pcr } } - int ONumericControl::impl_apiValueToFieldValue_nothrow( double _nApiValue ) const + sal_Int64 ONumericControl::impl_apiValueToFieldValue_nothrow( double _nApiValue ) const { - int nControlValue = ImplCalcLongValue( _nApiValue, getTypedControlWindow()->get_digits() ); + sal_Int64 nControlValue = ImplCalcLongValue( _nApiValue, getTypedControlWindow()->get_digits() ); nControlValue /= m_nFieldToUNOValueFactor; return nControlValue; } - double ONumericControl::impl_fieldValueToApiValue_nothrow( int nFieldValue ) const + double ONumericControl::impl_fieldValueToApiValue_nothrow(sal_Int64 nFieldValue) const { double nApiValue = ImplCalcDoubleValue( nFieldValue, getTypedControlWindow()->get_digits() ); nApiValue *= m_nFieldToUNOValueFactor; diff --git a/extensions/source/propctrlr/standardcontrol.hxx b/extensions/source/propctrlr/standardcontrol.hxx index 7a0c585b775c..fcd194886a1a 100644 --- a/extensions/source/propctrlr/standardcontrol.hxx +++ b/extensions/source/propctrlr/standardcontrol.hxx @@ -246,12 +246,12 @@ namespace pcr The conversion respects our decimal digits as well as our value factor (<member>m_nFieldToUNOValueFactor</member>). */ - int impl_apiValueToFieldValue_nothrow( double nApiValue ) const; + sal_Int64 impl_apiValueToFieldValue_nothrow( double nApiValue ) const; /** converts a control value, as obtained from our Numeric field, into a value which can passed to outer callers via our UNO API. */ - double impl_fieldValueToApiValue_nothrow( int nFieldValue ) const; + double impl_fieldValueToApiValue_nothrow(sal_Int64 nFieldValue) const; }; //= OColorControl |