diff options
author | Noel Power <noel.power@suse.com> | 2013-04-23 17:07:02 +0100 |
---|---|---|
committer | Noel Power <noel.power@suse.com> | 2013-05-09 14:11:18 +0100 |
commit | 3fb03cc873280c49e04c59062c1ad21b53c7f5df (patch) | |
tree | a788ec9a52990f050c6d11a242cb5941a139361d /sc | |
parent | 92c8becf8b1111fa98231258990d34ae771c0d1e (diff) |
handle non int32 values for Field in Range.AutoFilter
Change-Id: I7288371ab32abd02b858c538f50a68eff66ecced
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/vba/vbarange.cxx | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index 332212219d2f..276cba88ccc7 100644 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -4295,7 +4295,7 @@ static void lcl_setTableFieldsFromCriteria( OUString& sCriteria1, uno::Reference } void SAL_CALL -ScVbaRange::AutoFilter( const uno::Any& Field, const uno::Any& Criteria1, const uno::Any& Operator, const uno::Any& Criteria2, const uno::Any& VisibleDropDown ) throw (uno::RuntimeException) +ScVbaRange::AutoFilter( const uno::Any& aField, const uno::Any& Criteria1, const uno::Any& Operator, const uno::Any& Criteria2, const uno::Any& VisibleDropDown ) throw (uno::RuntimeException) { // Is there an existing autofilter RangeHelper thisRange( mxRange ); @@ -4391,12 +4391,24 @@ ScVbaRange::AutoFilter( const uno::Any& Field, const uno::Any& Criteria1, const if ( bHasCritValue ) bCritHasNumericValue = ( Criteria1 >>= nCriteria1 ); - if ( !Field.hasValue() && ( Criteria1.hasValue() || Operator.hasValue() || Criteria2.hasValue() ) ) + if ( !aField.hasValue() && ( Criteria1.hasValue() || Operator.hasValue() || Criteria2.hasValue() ) ) throw uno::RuntimeException(); + bool bAll = false; + uno::Any Field( aField ); + if ( !( Field >>= nField ) ) + { + uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( mxContext ); + try + { + Field = xConverter->convertTo( aField, getCppuType( (sal_Int32*)0 ) ); + } + catch( uno::Exception& ) + { + } + } // Use the normal uno api, sometimes e.g. when you want to use ALL as the filter // we can't use refresh as the uno interface doesn't have a concept of ALL // in this case we just call the core calc functionality - - bool bAll = false; if ( ( Field >>= nField ) ) { uno::Reference< sheet::XSheetFilterDescriptor2 > xDesc( |