summaryrefslogtreecommitdiff
path: root/vbahelper
diff options
context:
space:
mode:
authorNoel Power <noel.power@suse.com>2013-04-18 16:35:08 +0100
committerNoel Power <noel.power@suse.com>2013-05-09 14:11:13 +0100
commit89e1382ebfb4d6d868bf4baee37fe31c6fec0bc8 (patch)
tree9dfa87ae8d1b8323b2e193535bf44d9666be6118 /vbahelper
parentc058341b6de3730b404f44347bea408243416379 (diff)
handle bool value for checkbox, radiobutton, togglebutton consistently
Change-Id: I1f9057e58fe3625e0b76a09d79c7c56e1838d98a
Diffstat (limited to 'vbahelper')
-rw-r--r--vbahelper/source/msforms/vbacheckbox.cxx15
-rw-r--r--vbahelper/source/msforms/vbaradiobutton.cxx15
-rw-r--r--vbahelper/source/msforms/vbatogglebutton.cxx10
3 files changed, 22 insertions, 18 deletions
diff --git a/vbahelper/source/msforms/vbacheckbox.cxx b/vbahelper/source/msforms/vbacheckbox.cxx
index de32e34abe5d..63ee9fdd5cf6 100644
--- a/vbahelper/source/msforms/vbacheckbox.cxx
+++ b/vbahelper/source/msforms/vbacheckbox.cxx
@@ -65,17 +65,16 @@ ScVbaCheckbox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeExcept
sal_Int16 nValue = 0;
sal_Int16 nOldValue = 0;
m_xProps->getPropertyValue( STATE ) >>= nOldValue;
- sal_Bool bValue = false;
- if( _value >>= nValue )
- {
- if( nValue == -1)
- nValue = 1;
- }
- else if ( _value >>= bValue )
+ if( !( _value >>= nValue ) )
{
+ sal_Bool bValue = false;
+ _value >>= bValue;
if ( bValue )
- nValue = 1;
+ nValue = -1;
}
+
+ if( nValue == -1)
+ nValue = 1;
m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) );
if ( nValue != nOldValue )
fireClickEvent();
diff --git a/vbahelper/source/msforms/vbaradiobutton.cxx b/vbahelper/source/msforms/vbaradiobutton.cxx
index 10dabf8c8abe..f15d8175d3d1 100644
--- a/vbahelper/source/msforms/vbaradiobutton.cxx
+++ b/vbahelper/source/msforms/vbaradiobutton.cxx
@@ -66,17 +66,16 @@ ScVbaRadioButton::setValue( const uno::Any& _value ) throw (uno::RuntimeExceptio
sal_Int16 nOldValue = 0;
m_xProps->getPropertyValue( STATE ) >>= nOldValue;
- sal_Bool bValue = sal_False;
- if( _value >>= nValue )
- {
- if( nValue == -1)
- nValue = 1;
- }
- else if ( _value >>= bValue )
+ if( !( _value >>= nValue ) )
{
+ sal_Bool bValue = sal_False;
+ _value >>= bValue;
if ( bValue )
- nValue = 1;
+ nValue = -1;
}
+
+ if( nValue == -1)
+ nValue = 1;
m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) );
if ( nValue != nOldValue )
{
diff --git a/vbahelper/source/msforms/vbatogglebutton.cxx b/vbahelper/source/msforms/vbatogglebutton.cxx
index 93073bc3739a..ce9c007ea5ad 100644
--- a/vbahelper/source/msforms/vbatogglebutton.cxx
+++ b/vbahelper/source/msforms/vbatogglebutton.cxx
@@ -66,11 +66,17 @@ void SAL_CALL
ScVbaToggleButton::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
{
sal_Int16 nState = 0;
- _value >>= nState;
+ if ( ! ( _value >>= nState ) )
+ {
+ sal_Bool bState = false;
+ _value >>= bState;
+ if ( bState )
+ nState = -1;
+ }
SAL_INFO("vbahelper", "nState - " << nState );
nState = ( nState == -1 ) ? 1 : 0;
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)