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:
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user