diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx index ea328276bf3c..f41bdedaf2d1 100644 --- a/toolkit/source/controls/unocontrols.cxx +++ b/toolkit/source/controls/unocontrols.cxx @@ -3995,11 +3995,13 @@ void UnoNumericFieldControl::createPeer( const uno::Reference< awt::XToolkit > & xField->setLast( mnLast ); } - void UnoNumericFieldControl::textChanged( const awt::TextEvent& e ) { - uno::Reference < awt::XNumericField > xField( getPeer(), uno::UNO_QUERY ); - ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUE_DOUBLE ), uno::Any(xField->getValue()), false ); + uno::Reference xPeer(getPeer(), UNO_QUERY); + const OUString& sPropertyName = GetPropertyName(BASEPROPERTY_VALUE_DOUBLE); + // tdf#168788 for consistency with UnoFormattedFieldControl, use getProperty + // instead of getValue so an empty string can be represented as empty Any + ImplSetPropertyValue(sPropertyName, xPeer->getProperty(sPropertyName), false); if ( GetTextListeners().getLength() ) GetTextListeners().textChanged( e ); @@ -4217,8 +4219,11 @@ void UnoCurrencyFieldControl::createPeer( const uno::Reference< awt::XToolkit > void UnoCurrencyFieldControl::textChanged( const awt::TextEvent& e ) { - uno::Reference < awt::XCurrencyField > xField( getPeer(), uno::UNO_QUERY ); - ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUE_DOUBLE ), uno::Any(xField->getValue()), false ); + uno::Reference xPeer(getPeer(), UNO_QUERY); + const OUString& sPropertyName = GetPropertyName(BASEPROPERTY_VALUE_DOUBLE); + // tdf#168788 for consistency with UnoFormattedFieldControl, use getProperty + // instead of getValue so an empty string can be represented as empty Any + ImplSetPropertyValue(sPropertyName, xPeer->getProperty(sPropertyName), false); if ( GetTextListeners().getLength() ) GetTextListeners().textChanged( e );