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 <caolan.mcnamara@collabora.com>
This commit is contained in:
Caolán McNamara
2025-11-09 11:29:33 +01:00
parent 83a030d305
commit e1f30355de
+10 -5
View File
@@ -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 );