From 855f52ead7fa361b6a73105d1f0086559a8ed5b6 Mon Sep 17 00:00:00 2001 From: Arkadiy Illarionov Date: Wed, 1 May 2019 00:53:03 +0300 Subject: Use hasElements to check Sequence emptiness in [v-x]* Similar to clang-tidy readability-container-size-empty Change-Id: I71e7af4ac3043d8d40922e99f8a4798f0993294c Reviewed-on: https://gerrit.libreoffice.org/71603 Tested-by: Jenkins Reviewed-by: Noel Grandin --- vbahelper/source/msforms/vbacombobox.cxx | 4 ++-- vbahelper/source/msforms/vbacontrol.cxx | 2 +- vbahelper/source/msforms/vbalistbox.cxx | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'vbahelper/source') diff --git a/vbahelper/source/msforms/vbacombobox.cxx b/vbahelper/source/msforms/vbacombobox.cxx index 78ceafb5ea88..851cee0a4098 100644 --- a/vbahelper/source/msforms/vbacombobox.cxx +++ b/vbahelper/source/msforms/vbacombobox.cxx @@ -93,7 +93,7 @@ ScVbaComboBox::getListIndex() m_xProps->getPropertyValue( "StringItemList" ) >>= sItems; // should really return the item that has focus regardless of // it been selected - if ( sItems.getLength() > 0 ) + if ( sItems.hasElements() ) { OUString sText = getText(); sal_Int32 nLen = sItems.getLength(); @@ -106,7 +106,7 @@ ScVbaComboBox::getListIndex() } } - } + } SAL_INFO("vbahelper", "getListIndex returning -1" ); return uno::makeAny( sal_Int32( -1 ) ); } diff --git a/vbahelper/source/msforms/vbacontrol.cxx b/vbahelper/source/msforms/vbacontrol.cxx index 99c6b41fea33..d33916f8d5af 100644 --- a/vbahelper/source/msforms/vbacontrol.cxx +++ b/vbahelper/source/msforms/vbacontrol.cxx @@ -538,7 +538,7 @@ void SAL_CALL ScVbaControl::fireEvent( const script::ScriptEvent& rEvt ) uno::Reference< uno::XInterface > xIf( xControlShape->getControl(), uno::UNO_QUERY_THROW ); evt.ScriptCode = xNameQuery->getCodeNameForObject( xIf ); // handle if we passed in our own arguments - if ( !rEvt.Arguments.getLength() ) + if ( !rEvt.Arguments.hasElements() ) evt.Arguments[ 0 ] <<= aEvt; xScriptListener->firing( evt ); } diff --git a/vbahelper/source/msforms/vbalistbox.cxx b/vbahelper/source/msforms/vbalistbox.cxx index da919b42dad1..13c878440193 100644 --- a/vbahelper/source/msforms/vbalistbox.cxx +++ b/vbahelper/source/msforms/vbalistbox.cxx @@ -47,7 +47,7 @@ ScVbaListBox::getListIndex() { uno::Sequence< sal_Int16 > sSelection; m_xProps->getPropertyValue( "SelectedItems" ) >>= sSelection; - if ( sSelection.getLength() == 0 ) + if ( !sSelection.hasElements() ) return uno::Any( sal_Int32( -1 ) ); return uno::Any( sSelection[ 0 ] ); } @@ -62,7 +62,7 @@ ScVbaListBox::getValue() if( getMultiSelect() ) throw uno::RuntimeException( "Attribute use invalid." ); uno::Any aRet; - if ( sSelection.getLength() ) + if ( sSelection.hasElements() ) aRet <<= sItems[ sSelection[ 0 ] ]; return aRet; } -- cgit