diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-07-23 14:54:06 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-07-23 22:09:21 +0200 |
commit | 7cfd8b201beeb356ee4cc58385664d5b37dd4e35 (patch) | |
tree | 403263b07ba781c6e3033cdfcae0a57e2f8e37a1 /toolkit | |
parent | 2157185ce15d99f7a234abe46c50f3c6f83a2651 (diff) |
access via NumericFormatter instead of NumericField
Change-Id: I4f3c2e9f7249b77fbc509031f4eb5f170eac5b90
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99318
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'toolkit')
-rw-r--r-- | toolkit/source/awt/vclxwindows.cxx | 66 |
1 files changed, 38 insertions, 28 deletions
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index 8baa6433e29a..0986a3a77cce 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -5547,19 +5547,19 @@ void VCLXNumericField::setFirst( double Value ) { SolarMutexGuard aGuard; - VclPtr< NumericField > pNumericField = GetAs< NumericField >(); - if ( pNumericField ) - pNumericField->SetFirst( - static_cast<long>(ImplCalcLongValue( Value, pNumericField->GetDecimalDigits() )) ); + NumericFormatter* pNumericFormatter = static_cast<NumericFormatter*>(GetFormatter()); + if ( pNumericFormatter ) + pNumericFormatter->SetFirst( + static_cast<long>(ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() )) ); } double VCLXNumericField::getFirst() { SolarMutexGuard aGuard; - VclPtr< NumericField > pNumericField = GetAs< NumericField >(); - return pNumericField - ? ImplCalcDoubleValue( static_cast<double>(pNumericField->GetFirst()), pNumericField->GetDecimalDigits() ) + NumericFormatter* pNumericFormatter = static_cast<NumericFormatter*>(GetFormatter()); + return pNumericFormatter + ? ImplCalcDoubleValue( static_cast<double>(pNumericFormatter->GetFirst()), pNumericFormatter->GetDecimalDigits() ) : 0; } @@ -5567,19 +5567,19 @@ void VCLXNumericField::setLast( double Value ) { SolarMutexGuard aGuard; - VclPtr< NumericField > pNumericField = GetAs< NumericField >(); - if ( pNumericField ) - pNumericField->SetLast( - static_cast<long>(ImplCalcLongValue( Value, pNumericField->GetDecimalDigits() )) ); + NumericFormatter* pNumericFormatter = static_cast<NumericFormatter*>(GetFormatter()); + if ( pNumericFormatter ) + pNumericFormatter->SetLast( + static_cast<long>(ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() )) ); } double VCLXNumericField::getLast() { SolarMutexGuard aGuard; - VclPtr< NumericField > pNumericField = GetAs< NumericField >(); - return pNumericField - ? ImplCalcDoubleValue( static_cast<double>(pNumericField->GetLast()), pNumericField->GetDecimalDigits() ) + NumericFormatter* pNumericFormatter = static_cast<NumericFormatter*>(GetFormatter()); + return pNumericFormatter + ? ImplCalcDoubleValue( static_cast<double>(pNumericFormatter->GetLast()), pNumericFormatter->GetDecimalDigits() ) : 0; } @@ -5593,24 +5593,23 @@ sal_Bool VCLXNumericField::isStrictFormat() return VCLXFormattedSpinField::isStrictFormat(); } - void VCLXNumericField::setSpinSize( double Value ) { SolarMutexGuard aGuard; - VclPtr< NumericField > pNumericField = GetAs< NumericField >(); - if ( pNumericField ) - pNumericField->SetSpinSize( - static_cast<long>(ImplCalcLongValue( Value, pNumericField->GetDecimalDigits() )) ); + NumericFormatter* pNumericFormatter = static_cast<NumericFormatter*>(GetFormatter()); + if ( pNumericFormatter ) + pNumericFormatter->SetSpinSize( + static_cast<long>(ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() )) ); } double VCLXNumericField::getSpinSize() { SolarMutexGuard aGuard; - VclPtr< NumericField > pNumericField = GetAs< NumericField >(); - return pNumericField - ? ImplCalcDoubleValue( static_cast<double>(pNumericField->GetSpinSize()), pNumericField->GetDecimalDigits() ) + NumericFormatter* pNumericFormatter = static_cast<NumericFormatter*>(GetFormatter()); + return pNumericFormatter + ? ImplCalcDoubleValue( static_cast<double>(pNumericFormatter->GetSpinSize()), pNumericFormatter->GetDecimalDigits() ) : 0; } @@ -5650,8 +5649,9 @@ void VCLXNumericField::setProperty( const OUString& PropertyName, const css::uno { if ( bVoid ) { - GetAs< NumericField >()->EnableEmptyFieldValue( true ); - GetAs< NumericField >()->SetEmptyFieldValue(); + NumericFormatter* pNumericFormatter = static_cast<NumericFormatter*>(GetFormatter()); + pNumericFormatter->EnableEmptyFieldValue( true ); + pNumericFormatter->SetEmptyFieldValue(); } else { @@ -5693,7 +5693,10 @@ void VCLXNumericField::setProperty( const OUString& PropertyName, const css::uno { bool b = bool(); if ( Value >>= b ) - GetAs< NumericField >()->SetUseThousandSep( b ); + { + NumericFormatter* pNumericFormatter = static_cast<NumericFormatter*>(GetFormatter()); + pNumericFormatter->SetUseThousandSep( b ); + } } break; default: @@ -5737,7 +5740,8 @@ css::uno::Any VCLXNumericField::getProperty( const OUString& PropertyName ) break; case BASEPROPERTY_NUMSHOWTHOUSANDSEP: { - aProp <<= GetAs< NumericField >()->IsUseThousandSep(); + NumericFormatter* pNumericFormatter = static_cast<NumericFormatter*>(GetFormatter()); + aProp <<= pNumericFormatter->IsUseThousandSep(); } break; default: @@ -5948,7 +5952,10 @@ void VCLXMetricField::setProperty( const OUString& PropertyName, const css::uno: { bool b = false; if ( Value >>= b ) - GetAs< NumericField >()->SetUseThousandSep( b ); + { + NumericFormatter* pNumericFormatter = static_cast<NumericFormatter*>(GetFormatter()); + pNumericFormatter->SetUseThousandSep( b ); + } } break; case BASEPROPERTY_UNIT: @@ -5986,8 +5993,11 @@ css::uno::Any VCLXMetricField::getProperty( const OUString& PropertyName ) switch ( nPropType ) { case BASEPROPERTY_NUMSHOWTHOUSANDSEP: - aProp <<= GetAs< NumericField >()->IsUseThousandSep(); + { + NumericFormatter* pNumericFormatter = static_cast<NumericFormatter*>(GetFormatter()); + aProp <<= pNumericFormatter->IsUseThousandSep(); break; + } case BASEPROPERTY_UNIT: aProp <<= static_cast<sal_uInt16>(GetAs< MetricField >()->GetUnit()); break; |