22#include <osl/diagnose.h>
31const sal_Int32 BIFF_RK_100FLAG = 0x00000001;
32const sal_Int32 BIFF_RK_INTFLAG = 0x00000002;
33const sal_Int32 BIFF_RK_VALUEMASK = 0xFFFFFFFC;
41 sal_math_Double aMathDouble{};
42 if(
getFlag( nRkValue, BIFF_RK_INTFLAG ) )
44 sal_Int32 nTemp = nRkValue >> 2;
45 setFlag< sal_Int32 >( nTemp, 0xE0000000, nRkValue < 0 );
46 aMathDouble.value = nTemp;
50 aMathDouble.w32_parts.msw =
static_cast< sal_uInt32
>( nRkValue & BIFF_RK_VALUEMASK );
52 if(
getFlag( nRkValue, BIFF_RK_100FLAG ) )
53 aMathDouble.value /= 100.0;
55 return aMathDouble.value;
59 sal_uInt16 nApiError = 0x7FFF;
69 default: OSL_FAIL(
"BiffHelper::calcDoubleFromError - unknown error code" );
71 sal_math_Double aMathDouble;
72 aMathDouble.value = std::numeric_limits<double>::quiet_NaN();
73 aMathDouble.nan_parts.fraction_lo = nApiError;
74 return aMathDouble.value;
84 sal_Int32 nCharCount = b32BitLen ?
rStrm.readValue< sal_Int32 >() :
rStrm.readValue< sal_Int16 >();
86 OSL_ENSURE( !
rStrm.isEof() && (nCharCount >= -1),
"BiffHelper::readString - invalid string length" );
87 if( !
rStrm.isEof() && (nCharCount > 0) )
90 nCharCount = ::std::min( nCharCount,
static_cast< sal_Int32
>(
rStrm.getRemaining() / 2 ) );
91 aString =
rStrm.readUnicodeArray( nCharCount );
static double calcDoubleFromError(sal_uInt8 nErrorCode)
Converts the passed BIFF error to a double containing the respective Calc error code.
static OUString readString(SequenceInputStream &rStrm, bool b32BitLen=true)
Reads a BIFF12 string with leading 16-bit or 32-bit length field.
static double calcDoubleFromRk(sal_Int32 nRkValue)
Converts the passed packed number to a double.
const sal_uInt8 BIFF_ERR_DIV0
const sal_uInt8 BIFF_ERR_NUM
const sal_uInt8 BIFF_ERR_NA
const sal_uInt8 BIFF_ERR_NULL
Common object settings.
const sal_uInt8 BIFF_ERR_VALUE
const sal_uInt8 BIFF_ERR_NAME
const sal_uInt8 BIFF_ERR_REF
bool getFlag(Type nBitField, Type nMask)