Kaydet (Commit) 89e1382e authored tarafından Noel Power's avatar Noel Power

handle bool value for checkbox, radiobutton, togglebutton consistently

Change-Id: I1f9057e58fe3625e0b76a09d79c7c56e1838d98a
üst c058341b
...@@ -65,17 +65,16 @@ ScVbaCheckbox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeExcept ...@@ -65,17 +65,16 @@ ScVbaCheckbox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeExcept
sal_Int16 nValue = 0; sal_Int16 nValue = 0;
sal_Int16 nOldValue = 0; sal_Int16 nOldValue = 0;
m_xProps->getPropertyValue( STATE ) >>= nOldValue; m_xProps->getPropertyValue( STATE ) >>= nOldValue;
sal_Bool bValue = false; if( !( _value >>= nValue ) )
if( _value >>= nValue )
{
if( nValue == -1)
nValue = 1;
}
else if ( _value >>= bValue )
{ {
sal_Bool bValue = false;
_value >>= bValue;
if ( bValue ) if ( bValue )
nValue = 1; nValue = -1;
} }
if( nValue == -1)
nValue = 1;
m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) ); m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) );
if ( nValue != nOldValue ) if ( nValue != nOldValue )
fireClickEvent(); fireClickEvent();
......
...@@ -66,17 +66,16 @@ ScVbaRadioButton::setValue( const uno::Any& _value ) throw (uno::RuntimeExceptio ...@@ -66,17 +66,16 @@ ScVbaRadioButton::setValue( const uno::Any& _value ) throw (uno::RuntimeExceptio
sal_Int16 nOldValue = 0; sal_Int16 nOldValue = 0;
m_xProps->getPropertyValue( STATE ) >>= nOldValue; m_xProps->getPropertyValue( STATE ) >>= nOldValue;
sal_Bool bValue = sal_False; if( !( _value >>= nValue ) )
if( _value >>= nValue )
{
if( nValue == -1)
nValue = 1;
}
else if ( _value >>= bValue )
{ {
sal_Bool bValue = sal_False;
_value >>= bValue;
if ( bValue ) if ( bValue )
nValue = 1; nValue = -1;
} }
if( nValue == -1)
nValue = 1;
m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) ); m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) );
if ( nValue != nOldValue ) if ( nValue != nOldValue )
{ {
......
...@@ -66,11 +66,17 @@ void SAL_CALL ...@@ -66,11 +66,17 @@ void SAL_CALL
ScVbaToggleButton::setValue( const uno::Any& _value ) throw (uno::RuntimeException) ScVbaToggleButton::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
{ {
sal_Int16 nState = 0; sal_Int16 nState = 0;
_value >>= nState; if ( ! ( _value >>= nState ) )
{
sal_Bool bState = false;
_value >>= bState;
if ( bState )
nState = -1;
}
SAL_INFO("vbahelper", "nState - " << nState ); SAL_INFO("vbahelper", "nState - " << nState );
nState = ( nState == -1 ) ? 1 : 0; nState = ( nState == -1 ) ? 1 : 0;
SAL_INFO("vbahelper", "nState - " << nState ); SAL_INFO("vbahelper", "nState - " << nState );
m_xProps->setPropertyValue( STATE, uno::makeAny( nState ) ); m_xProps->setPropertyValue( STATE, uno::makeAny( nState ) );
} }
sal_Bool SAL_CALL ScVbaToggleButton::getAutoSize() throw (uno::RuntimeException) sal_Bool SAL_CALL ScVbaToggleButton::getAutoSize() throw (uno::RuntimeException)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment