From 6d598efdffc13781ea67570871fc7affec19159d Mon Sep 17 00:00:00 2001 From: Kurt Zenker Date: Wed, 25 Jun 2008 11:05:35 +0000 Subject: 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 --- forms/source/component/scrollbar.cxx | 49 +++++++++++++++--------------------- 1 file changed, 20 insertions(+), 29 deletions(-) (limited to 'forms/source/component/scrollbar.cxx') 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 ); } //........................................................................ -- cgit