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-04-19 19:31:01 +0100
commit1e2442a9f145bfc2d234cb09212bc3abd5e668d0 (patch)
tree0736c461848d4352ea0b92e7a402843ad05a48cb /vbahelper
parentdbd84f33def04f555fb7b61c0f78f9d312bba633 (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 6bf65c1e6d01..9c2fc650cfcd 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;
+ }
OSL_TRACE( "nState - %d", nState );
nState = ( nState == -1 ) ? 1 : 0;
OSL_TRACE( "nState - %d", nState );
- m_xProps->setPropertyValue( STATE, uno::makeAny( nState ) );
+ m_xProps->setPropertyValue( STATE, uno::makeAny( nState ) );
}
sal_Bool SAL_CALL ScVbaToggleButton::getAutoSize() throw (uno::RuntimeException)