From 851d6112c1e3b09ebeae211b6b997bffad6461e3 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Mon, 28 Mar 2011 12:43:38 +0200 Subject: calcvba: try to extract different types as numeric index --- vbahelper/source/vbahelper/collectionbase.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'vbahelper/source') diff --git a/vbahelper/source/vbahelper/collectionbase.cxx b/vbahelper/source/vbahelper/collectionbase.cxx index 7a99aabecdf8..16fc673f54d5 100755 --- a/vbahelper/source/vbahelper/collectionbase.cxx +++ b/vbahelper/source/vbahelper/collectionbase.cxx @@ -314,11 +314,10 @@ uno::Any CollectionBase::getAnyItemOrThis( const uno::Any& rIndex ) throw (uno:: { if( !rIndex.hasValue() ) return uno::Any( uno::Reference< XCollectionBase >( this ) ); - if( rIndex.has< sal_Int32 >() ) - return getItemByIndex( rIndex.get< sal_Int32 >() ); if( rIndex.has< ::rtl::OUString >() ) return getItemByName( rIndex.get< ::rtl::OUString >() ); - throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Invalid item index." ) ), 0 ); + // extractIntFromAny() throws if no index can be extracted + return getItemByIndex( extractIntFromAny( rIndex ) ); } // protected ------------------------------------------------------------------ -- cgit