diff options
author | Kurt Zenker <kz@openoffice.org> | 2008-06-25 11:05:35 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2008-06-25 11:05:35 +0000 |
commit | 6d598efdffc13781ea67570871fc7affec19159d (patch) | |
tree | 755942c3e5708df8841da9ede7649f225ec4558f /forms/source | |
parent | edec362f01961a740fe8cde029e965dc19c9fb86 (diff) |
INTEGRATION: CWS dba30d (1.10.18); FILE MERGED
2008/05/27 12:28:03 fs 1.10.18.1: #i89657# refactoring, so that our binding's getValue is only called when our mutex is not locked
Diffstat (limited to 'forms/source')
-rw-r--r-- | forms/source/component/scrollbar.cxx | 49 | ||||
-rw-r--r-- | forms/source/component/spinbutton.cxx | 16 |
2 files changed, 26 insertions, 39 deletions
diff --git a/forms/source/component/scrollbar.cxx b/forms/source/component/scrollbar.cxx index 52e906bd3ec3..3495d2a35792 100644 --- a/forms/source/component/scrollbar.cxx +++ b/forms/source/component/scrollbar.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: scrollbar.cxx,v $ - * $Revision: 1.10 $ + * $Revision: 1.11 $ * * This file is part of OpenOffice.org. * @@ -60,38 +60,33 @@ namespace frm //==================================================================== //-------------------------------------------------------------------- Any translateExternalDoubleToControlIntValue( - const Reference< XValueBinding >& _rxBinding, const Reference< XPropertySet >& _rxProperties, + const Any& _rExternalValue, const Reference< XPropertySet >& _rxProperties, const ::rtl::OUString& _rMinValueName, const ::rtl::OUString& _rMaxValueName ) { - OSL_PRECOND( _rxBinding.is(), "translateExternalDoubleToControlIntValue: no external binding!" ); OSL_ENSURE( _rxProperties.is(), "translateExternalDoubleToControlIntValue: no aggregate!?" ); sal_Int32 nControlValue( 0 ); - if ( _rxBinding.is() ) + double nExternalValue = 0; + if ( _rExternalValue >>= nExternalValue ) { - Any aExternalValue = _rxBinding->getValue( ::getCppuType( static_cast< double* >( NULL ) ) ); - double nExternalValue = 0; - if ( aExternalValue >>= nExternalValue ) + if ( ::rtl::math::isInf( nExternalValue ) ) { - if ( ::rtl::math::isInf( nExternalValue ) ) - { - // set the minimum or maximum of the scroll values - ::rtl::OUString sLimitPropertyName = ::rtl::math::isSignBitSet( nExternalValue ) - ? _rMinValueName : _rMaxValueName; - if ( _rxProperties.is() ) - _rxProperties->getPropertyValue( sLimitPropertyName ) >>= nControlValue; - } - else - { - nControlValue = (sal_Int32)::rtl::math::round( nExternalValue ); - } + // set the minimum or maximum of the scroll values + ::rtl::OUString sLimitPropertyName = ::rtl::math::isSignBitSet( nExternalValue ) + ? _rMinValueName : _rMaxValueName; + if ( _rxProperties.is() ) + _rxProperties->getPropertyValue( sLimitPropertyName ) >>= nControlValue; } else { - if ( _rxProperties.is() ) - _rxProperties->getPropertyValue( _rMinValueName ) >>= nControlValue; + nControlValue = (sal_Int32)::rtl::math::round( nExternalValue ); } } + else + { + if ( _rxProperties.is() ) + _rxProperties->getPropertyValue( _rMinValueName ) >>= nControlValue; + } return makeAny( nControlValue ); } @@ -302,9 +297,9 @@ namespace frm } //-------------------------------------------------------------------- - Any OScrollBarModel::translateExternalValueToControlValue( ) const + Any OScrollBarModel::translateExternalValueToControlValue( const Any& _rExternalValue ) const { - return translateExternalDoubleToControlIntValue( getExternalValueBinding(), m_xAggregateSet, + return translateExternalDoubleToControlIntValue( _rExternalValue, m_xAggregateSet, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ScrollValueMin" ) ), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ScrollValueMax" ) ) ); } @@ -317,13 +312,9 @@ namespace frm } //-------------------------------------------------------------------- - sal_Bool OScrollBarModel::approveValueBinding( const Reference< XValueBinding >& _rxBinding ) + Sequence< Type > OScrollBarModel::getSupportedBindingTypes() { - OSL_PRECOND( _rxBinding.is(), "OScrollBarModel::approveValueBinding: invalid binding!" ); - - // only strings are accepted for simplicity - return _rxBinding.is() - && _rxBinding->supportsType( ::getCppuType( static_cast< double* >( NULL ) ) ); + return Sequence< Type >( &::getCppuType( static_cast< double* >( NULL ) ), 1 ); } //........................................................................ diff --git a/forms/source/component/spinbutton.cxx b/forms/source/component/spinbutton.cxx index 46d7d4ad51cd..829b7ce4a0e2 100644 --- a/forms/source/component/spinbutton.cxx +++ b/forms/source/component/spinbutton.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: spinbutton.cxx,v $ - * $Revision: 1.10 $ + * $Revision: 1.11 $ * * This file is part of OpenOffice.org. * @@ -59,7 +59,7 @@ namespace frm //==================================================================== // implemented elsewhere Any translateExternalDoubleToControlIntValue( - const Reference< XValueBinding >& _rxBinding, const Reference< XPropertySet >& _rxProperties, + const Any& _rExternalValue, const Reference< XPropertySet >& _rxProperties, const ::rtl::OUString& _rMinValueName, const ::rtl::OUString& _rMaxValueName ); Any translateControlIntToExternalDoubleValue( const Any& _rControlIntValue ); @@ -253,9 +253,9 @@ namespace frm } //-------------------------------------------------------------------- - Any OSpinButtonModel::translateExternalValueToControlValue( ) const + Any OSpinButtonModel::translateExternalValueToControlValue( const Any& _rExternalValue ) const { - return translateExternalDoubleToControlIntValue( getExternalValueBinding(), m_xAggregateSet, + return translateExternalDoubleToControlIntValue( _rExternalValue, m_xAggregateSet, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SpinValueMin" ) ), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SpinValueMax" ) ) ); } @@ -268,13 +268,9 @@ namespace frm } //-------------------------------------------------------------------- - sal_Bool OSpinButtonModel::approveValueBinding( const Reference< XValueBinding >& _rxBinding ) + Sequence< Type > OSpinButtonModel::getSupportedBindingTypes() { - OSL_PRECOND( _rxBinding.is(), "OSpinButtonModel::approveValueBinding: invalid binding!" ); - - // only strings are accepted for simplicity - return _rxBinding.is() - && _rxBinding->supportsType( ::getCppuType( static_cast< double* >( NULL ) ) ); + return Sequence< Type >( &::getCppuType( static_cast< double* >( NULL ) ), 1 ); } //........................................................................ |