diff options
author | Daniel Rentz [dr] <daniel.rentz@oracle.com> | 2010-11-09 10:52:14 +0100 |
---|---|---|
committer | Daniel Rentz [dr] <daniel.rentz@oracle.com> | 2010-11-09 10:52:14 +0100 |
commit | 32bb320ed0e4c52a7adf84d13a8066877adceb54 (patch) | |
tree | 4b191cf382c6603b1dfb3a71e12622b7b3e8b562 /oox/source/xls/biffhelper.cxx | |
parent | bf9cd246dc431e20181cfec8107e3b7c59866281 (diff) |
dr77: more cleanup: remove RecordInputStream, cleanup ContainerHelper
Diffstat (limited to 'oox/source/xls/biffhelper.cxx')
-rw-r--r-- | oox/source/xls/biffhelper.cxx | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/oox/source/xls/biffhelper.cxx b/oox/source/xls/biffhelper.cxx index 5989777456e0..55839043865e 100644 --- a/oox/source/xls/biffhelper.cxx +++ b/oox/source/xls/biffhelper.cxx @@ -189,6 +189,8 @@ void lclImportImgDataDib( StreamDataSequence& orDataSeq, BiffInputStream& rStrm, // ============================================================================ +// conversion ----------------------------------------------------------------- + /*static*/ double BiffHelper::calcDoubleFromRk( sal_Int32 nRkValue ) { DecodedDouble aDecDbl( 0.0 ); @@ -265,6 +267,35 @@ void lclImportImgDataDib( StreamDataSequence& orDataSeq, BiffInputStream& rStrm, return static_cast< sal_uInt16 >( (nCodePage == 0) ? 1252 : nCodePage ); } +// BIFF12 import -------------------------------------------------------------- + +/*static*/ OUString BiffHelper::readString( SequenceInputStream& rStrm, bool b32BitLen ) +{ + OUString aString; + if( !rStrm.isEof() ) + { + sal_Int32 nCharCount = b32BitLen ? rStrm.readValue< sal_Int32 >() : rStrm.readValue< sal_Int16 >(); + // string length -1 is often used to indicate a missing string + OSL_ENSURE( !rStrm.isEof() && (nCharCount >= -1), "BiffHelper::readString - invalid string length" ); + if( !rStrm.isEof() && (nCharCount > 0) ) + { + ::std::vector< sal_Unicode > aBuffer; + aBuffer.reserve( getLimitedValue< size_t, sal_Int32 >( nCharCount + 1, 0, 0xFFFF ) ); + for( sal_Int32 nCharIdx = 0; !rStrm.isEof() && (nCharIdx < nCharCount); ++nCharIdx ) + { + sal_uInt16 nChar; + rStrm.readValue( nChar ); + aBuffer.push_back( static_cast< sal_Unicode >( nChar ) ); + } + aBuffer.push_back( 0 ); + aString = OUString( &aBuffer.front() ); + } + } + return aString; +} + +// BIFF2-BIFF8 import --------------------------------------------------------- + /*static*/ bool BiffHelper::isBofRecord( BiffInputStream& rStrm ) { return |