toolkit/source/awt/vclxwindows.cxx | 66 +++++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 28 deletions(-)
New commits: commit 7cfd8b201beeb356ee4cc58385664d5b37dd4e35 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Thu Jul 23 14:54:06 2020 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Thu Jul 23 22:09:21 2020 +0200 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 <caol...@redhat.com> 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; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits