summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Power <noel.power@suse.com>2013-04-23 17:07:02 +0100
committerNoel Power <noel.power@suse.com>2013-05-07 09:56:24 +0100
commit4521936868c596e72caffb338e4a7b62dce360f7 (patch)
tree49c55f61d8ec3ebdd890f29b94c5a6a0e5ec7115
parent0544c565204e59182e14f04a3d4214442131d108 (diff)
handle non int32 values for Field in Range.AutoFilter
Change-Id: I7288371ab32abd02b858c538f50a68eff66ecced
-rw-r--r--sc/source/ui/vba/vbarange.cxx18
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(