View | Details | Raw Unified | Return to issue 108885
Collapse All | Expand All

(-)./old/sc/source/ui/vba/vbawsfunction.cxx (-1 / +38 lines)
Lines 2-8 Link Here
2
 *
2
 *
3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
 * 
4
 * 
5
 * Copyright 2008 by Sun Microsystems, Inc.
5
 * Copyright 2008, 2010 by Sun Microsystems, Inc.
6
 *
6
 *
7
 * OpenOffice.org - a multi-platform office productivity suite
7
 * OpenOffice.org - a multi-platform office productivity suite
8
 *
8
 *
Lines 47-52 Link Here
47
using namespace com::sun::star;
47
using namespace com::sun::star;
48
using namespace ooo::vba;
48
using namespace ooo::vba;
49
49
50
////Convert the result of executing formula to expected value.
51
void lcl_ConvertResult( const OpCode& eOp, uno::Any& aRet )
52
{
53
	// FIXME, we need to handle the result for ALL formula here.
54
	switch( eOp )
55
	{
56
		case ocIsString:
57
		case ocIsNonString:
58
		case ocIsValue:
59
		{
60
			double fVal = 0.0;
61
			uno::Sequence< uno::Sequence< uno::Any > > aSequence;
62
			if ( !( aRet >>= fVal ) )
63
			{
64
				if ( ( aRet >>= aSequence ) && aSequence.getLength() > 0 && aSequence[0].getLength() > 0 )
65
				{
66
					aSequence[0][0] >>= fVal;
67
				}
68
			}
69
			if ( fVal != 0.0 )
70
			{
71
				aRet <<= sal_True;
72
			}
73
			else
74
			{
75
				aRet <<= sal_False;
76
			}
77
			break;
78
		}
79
		default: break;
80
	}
81
}
82
50
ScVbaWSFunction::ScVbaWSFunction( const uno::Reference< XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext): ScVbaWSFunction_BASE( xParent, xContext )
83
ScVbaWSFunction::ScVbaWSFunction( const uno::Reference< XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext): ScVbaWSFunction_BASE( xParent, xContext )
51
{
84
{
52
}
85
}
Lines 150-155 Link Here
150
				throw uno::RuntimeException();
183
				throw uno::RuntimeException();
151
		aRet <<= fVal;
184
		aRet <<= fVal;
152
	}
185
	}
186
	else
187
	{
188
		lcl_ConvertResult( eOp, aRet );
189
	}
153
	return aRet;
190
	return aRet;
154
}
191
}
155
192

Return to issue 108885