toolkit/source/controls/unocontrols.cxx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
New commits: commit 75853a9a9e560a4a4a29e568d8240f6888d8a519 Author: Caolán McNamara <[email protected]> AuthorDate: Sat Nov 8 21:07:20 2025 +0000 Commit: Xisco Fauli <[email protected]> CommitDate: Mon Nov 10 11:22:36 2025 +0100 tdf#168788 return empty any for empty string for Numeric/Currency Controls which is what Formatted Controls do Change-Id: I7991a3e404bc2bef04bca62f52aa1ca8388b1f44 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193635 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> (cherry picked from commit e1f30355de2251bf6ac2e069b1fd231bf9fd84aa) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193720 Reviewed-by: Xisco Fauli <[email protected]> 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<awt::XVclWindowPeer> 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<awt::XVclWindowPeer> 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 );
