LibreOffice Module sc (master) 1
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
XclImpStream Class Reference

This class is used to import record oriented streams. More...

#include <xistream.hxx>

Collaboration diagram for XclImpStream:
[legend]

Public Member Functions

 XclImpStream (SvStream &rInStrm, const XclImpRoot &rRoot)
 Constructs the Excel record import stream using a TOOLS stream object. More...
 
 ~XclImpStream ()
 
const XclImpRootGetRoot () const
 Returns the filter root data. More...
 
bool StartNextRecord ()
 Sets stream pointer to the start of the next record content. More...
 
bool StartNextRecord (std::size_t nNextRecPos)
 Sets stream pointer to the start of the record content for the record at the passed absolute stream position. More...
 
void ResetRecord (bool bContLookup, sal_uInt16 nAltContId=EXC_ID_UNKNOWN)
 Sets stream pointer to begin of record content. More...
 
void RewindRecord ()
 Sets stream pointer before current record and invalidates stream. More...
 
void SetDecrypter (XclImpDecrypterRef const &xDecrypter)
 Enables decryption of record contents for the rest of the stream. More...
 
void CopyDecrypterFrom (const XclImpStream &rStrm)
 Sets decrypter from another stream. More...
 
void EnableDecryption (bool bEnable=true)
 Switches usage of current decryption algorithm on/off. More...
 
void DisableDecryption ()
 Switches usage of current decryption algorithm off. More...
 
void PushPosition ()
 Pushes current position on user position stack. More...
 
void PopPosition ()
 Seeks to last position from user position stack. More...
 
void StoreGlobalPosition ()
 Stores current position. More...
 
void SeekGlobalPosition ()
 Seeks to the stored global user position. More...
 
bool IsValid () const
 Returns record reading state: false = record overread. More...
 
sal_uInt16 GetRecId () const
 Returns the current record ID. More...
 
std::size_t GetRecPos () const
 Returns the position inside of the whole record content. More...
 
std::size_t GetRecSize ()
 Returns the data size of the whole record without record headers. More...
 
std::size_t GetRecLeft ()
 Returns remaining data size of the whole record without record headers. More...
 
sal_uInt16 GetNextRecId ()
 Returns the record ID of the following record. More...
 
sal_uInt16 PeekRecId (std::size_t nPos)
 
sal_uInt8 ReaduInt8 ()
 
sal_Int16 ReadInt16 ()
 
sal_uInt16 ReaduInt16 ()
 
sal_Int32 ReadInt32 ()
 
sal_uInt32 ReaduInt32 ()
 
double ReadDouble ()
 
std::size_t Read (void *pData, std::size_t nBytes)
 Reads nBytes bytes to the existing(!) buffer pData. More...
 
std::size_t CopyToStream (SvStream &rOutStrm, std::size_t nBytes)
 Copies nBytes bytes to rOutStrm. More...
 
void CopyRecordToStream (SvStream &rOutStrm)
 Copies the entire record to rOutStrm. More...
 
void Seek (std::size_t nPos)
 Seeks absolute in record content to the specified position. More...
 
void Ignore (std::size_t nBytes)
 Seeks forward inside the current record. More...
 
std::size_t ReadUniStringExtHeader (bool &rb16Bit, bool &rbRich, bool &rbFareast, sal_uInt16 &rnFormatRuns, sal_uInt32 &rnExtInf, sal_uInt8 nFlags)
 Reads ext. More...
 
std::size_t ReadUniStringExtHeader (bool &rb16Bit, sal_uInt8 nFlags)
 Seeks to begin of character array, detects 8/16 bit mode. More...
 
void SetNulSubstChar (sal_Unicode cNulSubst='?')
 Sets a replacement character for NUL characters. More...
 
OUString ReadRawUniString (sal_uInt16 nChars, bool b16Bit)
 Reads nChars characters and returns the string. More...
 
OUString ReadUniString (sal_uInt16 nChars, sal_uInt8 nFlags)
 Reads ext. More...
 
OUString ReadUniString (sal_uInt16 nChars)
 Reads 8 bit flags, ext. More...
 
OUString ReadUniString ()
 Reads 16 bit character count, 8 bit flags, ext. More...
 
void IgnoreRawUniString (sal_uInt16 nChars, bool b16Bit)
 Ignores nChars characters. More...
 
void IgnoreUniString (sal_uInt16 nChars, sal_uInt8 nFlags)
 Ignores ext. More...
 
void IgnoreUniString (sal_uInt16 nChars)
 Ignores 8 bit flags, ext. More...
 
OUString ReadRawByteString (sal_uInt16 nChars)
 Reads nChar byte characters and returns the string. More...
 
OUString ReadByteString (bool b16BitLen)
 Reads 8/16 bit string length, character array and returns the string. More...
 
std::size_t GetSvStreamPos () const
 Returns the absolute stream position. More...
 
std::size_t GetSvStreamSize () const
 Returns the stream size. More...
 
void StorePosition (XclImpStreamPos &rPos)
 Stores current stream position into rPos. More...
 
void RestorePosition (const XclImpStreamPos &rPos)
 Restores stream position contained in rPos. More...
 
void SetSvStreamError (const ErrCode &rErrCode)
 Set an SVSTREAM_..._ERROR. More...
 

Static Public Member Functions

static XclBiff DetectBiffVersion (SvStream &rStrm)
 Detects the BIFF version of the passed workbook stream. More...
 

Private Member Functions

bool ReadNextRawRecHeader ()
 Seeks to next raw record header and reads record ID and size. More...
 
void SetupDecrypter ()
 Initializes the decrypter to read a new record. More...
 
void SetupRawRecord ()
 Initializes all members after base stream has been sought to new raw record. More...
 
void SetupRecord ()
 Initializes all members after base stream has been sought to new record. More...
 
bool IsContinueId (sal_uInt16 nRecId) const
 Returns true, if the passed ID is real or alternative continuation record ID. More...
 
bool JumpToNextContinue ()
 Goes to start of the next CONTINUE record. More...
 
bool JumpToNextStringContinue (bool &rb16Bit)
 Goes to start of the next CONTINUE record while reading strings. More...
 
bool EnsureRawReadSize (sal_uInt16 nBytes)
 Ensures that reading nBytes bytes is possible with next stream access. More...
 
sal_uInt16 GetMaxRawReadSize (std::size_t nBytes) const
 Returns the maximum size of raw data possible to read in one block. More...
 
sal_uInt16 ReadRawData (void *pData, sal_uInt16 nBytes)
 Reads and decrypts nBytes bytes to the existing(!) buffer pData. More...
 

Private Attributes

SvStreammrStrm
 
const XclImpRootmrRoot
 Reference to the system input stream. More...
 
XclImpDecrypterRef mxDecrypter
 Filter root data. More...
 
XclImpStreamPos maFirstRec
 Provides methods to decrypt data. More...
 
std::vector< XclImpStreamPosmaPosStack
 Start position of current record. More...
 
XclImpStreamPos maGlobPos
 Stack for record positions. More...
 
sal_uInt16 mnGlobRecId
 User defined position elsewhere in stream. More...
 
bool mbGlobValidRec
 Record ID for user defined position. More...
 
bool mbHasGlobPos
 Was user position a valid record? More...
 
std::size_t mnStreamSize
 Is user position defined? More...
 
std::size_t mnNextRecPos
 Size of system stream. More...
 
std::size_t mnCurrRecSize
 Start of next record header. More...
 
std::size_t mnComplRecSize
 Helper for record position. More...
 
bool mbHasComplRec
 Size of complete record data (with CONTINUEs). More...
 
sal_uInt16 mnRecId
 true = mnComplRecSize is valid. More...
 
sal_uInt16 mnAltContId
 Current record ID (not the CONTINUE ID). More...
 
sal_uInt16 mnRawRecId
 Alternative record ID for content continuation. More...
 
sal_uInt16 mnRawRecSize
 Current raw record ID (including CONTINUEs). More...
 
sal_uInt16 mnRawRecLeft
 Current raw record size (without following CONTINUEs). More...
 
sal_Unicode mcNulSubst
 Bytes left in current raw record (without following CONTINUEs). More...
 
bool mbCont
 Replacement for NUL characters. More...
 
bool mbUseDecr
 Automatic CONTINUE lookup on/off. More...
 
bool mbValidRec
 Usage of decryption. More...
 
bool mbValid
 false = No more records to read. More...
 

Detailed Description

This class is used to import record oriented streams.

@descr An instance is constructed with an SvStream. The SvStream stream is reset to its start while constructing this stream.

To start reading a record call StartNextRecord(). Now it is possible to read all contents of the record using operator>>() or any of the Read***() functions. If some data exceeds the record size limit, the stream looks for a following CONTINUE record and jumps automatically to it. It is NOT allowed that an atomic data type is split into two records (i.e. 4 bytes of a double in one record and the other 4 bytes in a following CONTINUE).

Trying to read over the record limits results in a stream error. The IsValid() function indicates that with returning false. From now on it is undefined what data the read functions will return. The error state will be reset, if the record is reset (with the method ResetRecord()) or if the next record is started.

To switch off the automatic lookup of CONTINUE records, use ResetRecord() with false parameter. This is useful i.e. on import of Escher objects, where sometimes solely CONTINUE records will occur. The automatic lookup keeps switched off until the method ResetRecord() is called with parameter true. All other settings done on the stream (i.e. alternative CONTINUE record identifier, enabled decryption, NUL substitution character) will be reset to default values, if a new record is started.

The import stream supports decrypting the stream data. The contents of a record (not the record header) will be encrypted by Excel if the file has been stored with password protection. The functions SetDecrypter(), EnableDecryption(), and DisableDecryption() control the usage of the decryption algorithms. SetDecrypter() sets a new decryption algorithm and initially enables it. DisableDecryption() may be used to stop the usage of the decryption temporarily (sometimes record contents are never encrypted, i.e. all BOF records or the stream position in BOUNDSHEET). Decryption will be re-enabled automatically, if a new record is started with the function StartNextRecord().

It is possible to store several stream positions inside a record (including its CONTINUE records). The positions are stored on a stack, which can be controlled with the functions PushPosition(), PopPosition() and RejectPosition(). The stack will be cleared whenever a new record is started with the function StartNextRecord().

Additionally a single global stream position can be stored which keeps valid during the whole import process (methods StoreGlobalPosition(), SeekGlobalPosition() and DeleteGlobalPosition()). This is the only way to jump back to a previous record (that is a real jump without return).

Definition at line 277 of file xistream.hxx.

Constructor & Destructor Documentation

◆ XclImpStream()

XclImpStream::XclImpStream ( SvStream rInStrm,
const XclImpRoot rRoot 
)
explicit

Constructs the Excel record import stream using a TOOLS stream object.

Parameters
rInStrmThe system input stream. Will be set to its start position. Must exist as long as this object exists

Definition at line 427 of file xistream.cxx.

References mnStreamSize, mrStrm, SvStream::Seek(), STREAM_SEEK_TO_BEGIN, and SvStream::TellEnd().

◆ ~XclImpStream()

XclImpStream::~XclImpStream ( )

Definition at line 452 of file xistream.cxx.

Member Function Documentation

◆ CopyDecrypterFrom()

void XclImpStream::CopyDecrypterFrom ( const XclImpStream rStrm)

Sets decrypter from another stream.

Definition at line 514 of file xistream.cxx.

References rStrm, and SetDecrypter().

Referenced by XclImpPivotCache::ReadPivotCacheStream().

◆ CopyRecordToStream()

void XclImpStream::CopyRecordToStream ( SvStream rOutStrm)

Copies the entire record to rOutStrm.

The current record position keeps unchanged.

Definition at line 770 of file xistream.cxx.

References CopyToStream(), GetRecSize(), maFirstRec, mbValidRec, PopPosition(), PushPosition(), and RestorePosition().

◆ CopyToStream()

std::size_t XclImpStream::CopyToStream ( SvStream rOutStrm,
std::size_t  nBytes 
)

Copies nBytes bytes to rOutStrm.

Returns
Count of bytes really written.

Definition at line 746 of file xistream.cxx.

References aBuffer, mbValid, Read(), SAL_WARN_IF, o3tl::sanitizing_min(), and SvStream::WriteBytes().

Referenced by CopyRecordToStream().

◆ DetectBiffVersion()

XclBiff XclImpStream::DetectBiffVersion ( SvStream rStrm)
static

◆ DisableDecryption()

void XclImpStream::DisableDecryption ( )
inline

Switches usage of current decryption algorithm off.

@descr This is a record-local setting. The function StartNextRecord() always enables decryption.

Definition at line 334 of file xistream.hxx.

References EnableDecryption().

Referenced by ImportExcel::Bof2(), ImportExcel::Bof3(), ImportExcel::Bof4(), ImportExcel::Bof5(), ImportExcel8::Boundsheet(), and ImportExcel::Boundsheet().

◆ EnableDecryption()

void XclImpStream::EnableDecryption ( bool  bEnable = true)

Switches usage of current decryption algorithm on/off.

@descr Encryption is re-enabled automatically, if a new record is started using the function StartNextRecord().

Definition at line 522 of file xistream.cxx.

References mbUseDecr, and mxDecrypter.

Referenced by ImportExcel8::Boundsheet(), ImportExcel::Boundsheet(), DisableDecryption(), ResetRecord(), SetDecrypter(), and SetupRecord().

◆ EnsureRawReadSize()

bool XclImpStream::EnsureRawReadSize ( sal_uInt16  nBytes)
private

Ensures that reading nBytes bytes is possible with next stream access.

@descr Stream must be located at the end of a raw record, and handling of CONTINUE records must be enabled.

Returns
Copy of mbValid.

Definition at line 1056 of file xistream.cxx.

References JumpToNextContinue(), mbValid, and mnRawRecLeft.

Referenced by ReadDouble(), ReadInt16(), ReadInt32(), ReaduInt16(), ReaduInt32(), and ReaduInt8().

◆ GetMaxRawReadSize()

sal_uInt16 XclImpStream::GetMaxRawReadSize ( std::size_t  nBytes) const
private

Returns the maximum size of raw data possible to read in one block.

Definition at line 1067 of file xistream.cxx.

References mnRawRecLeft.

Referenced by Ignore(), IgnoreRawUniString(), Read(), ReadRawByteString(), and ReadRawUniString().

◆ GetNextRecId()

sal_uInt16 XclImpStream::GetNextRecId ( )

Returns the record ID of the following record.

Definition at line 587 of file xistream.cxx.

References EXC_ID_UNKNOWN, JumpToNextContinue(), mbValidRec, mnNextRecPos, mnStreamSize, mrStrm, PopPosition(), PushPosition(), SvStream::ReadUInt16(), and SvStream::Seek().

Referenced by ImportExcel8::Read().

◆ GetRecId()

sal_uInt16 XclImpStream::GetRecId ( ) const
inline

◆ GetRecLeft()

std::size_t XclImpStream::GetRecLeft ( )

Returns remaining data size of the whole record without record headers.

Definition at line 582 of file xistream.cxx.

References GetRecPos(), GetRecSize(), and mbValid.

Referenced by ImportExcel::Cellmerging(), ImportExcel::Columndefault(), JumpToNextStringContinue(), ImportExcel::Mulblank(), ImportExcel::Mulrk(), and ExcelToSc::ReadExtensionArray().

◆ GetRecPos()

std::size_t XclImpStream::GetRecPos ( ) const

Returns the position inside of the whole record content.

Definition at line 564 of file xistream.cxx.

References EXC_REC_SEEK_TO_END, mbValid, mnCurrRecSize, and mnRawRecLeft.

Referenced by ExcelToSc::Convert(), ExcelToSc8::Convert(), ExcelToSc8::GetAbsRefs(), GetRecLeft(), and Seek().

◆ GetRecSize()

std::size_t XclImpStream::GetRecSize ( )

Returns the data size of the whole record without record headers.

Definition at line 569 of file xistream.cxx.

References JumpToNextContinue(), mbHasComplRec, mnComplRecSize, mnCurrRecSize, PopPosition(), and PushPosition().

Referenced by CopyRecordToStream(), XclImpFmlaCompImpl::CreateFormula(), XclImpFmlaCompImpl::CreateRangeList(), and GetRecLeft().

◆ GetRoot()

const XclImpRoot & XclImpStream::GetRoot ( ) const
inline

Returns the filter root data.

Definition at line 293 of file xistream.hxx.

References mrRoot.

◆ GetSvStreamPos()

std::size_t XclImpStream::GetSvStreamPos ( ) const
inline

Returns the absolute stream position.

Definition at line 459 of file xistream.hxx.

References mrStrm, and SvStream::Tell().

Referenced by ImportExcel::Read(), and ImportExcel8::Read().

◆ GetSvStreamSize()

std::size_t XclImpStream::GetSvStreamSize ( ) const
inline

Returns the stream size.

Definition at line 461 of file xistream.hxx.

References mnStreamSize.

Referenced by ImportExcel::Read(), and ImportExcel8::Read().

◆ Ignore()

void XclImpStream::Ignore ( std::size_t  nBytes)

◆ IgnoreRawUniString()

void XclImpStream::IgnoreRawUniString ( sal_uInt16  nChars,
bool  b16Bit 
)

Ignores nChars characters.

Definition at line 910 of file xistream.cxx.

References GetMaxRawReadSize(), Ignore(), IsValid(), JumpToNextStringContinue(), and mnRawRecLeft.

Referenced by IgnoreUniString().

◆ IgnoreUniString() [1/2]

void XclImpStream::IgnoreUniString ( sal_uInt16  nChars)

Ignores 8 bit flags, ext.

header, nChar characters, ext. data.

Definition at line 944 of file xistream.cxx.

References IgnoreUniString(), and ReaduInt8().

◆ IgnoreUniString() [2/2]

void XclImpStream::IgnoreUniString ( sal_uInt16  nChars,
sal_uInt8  nFlags 
)

Ignores ext.

header, nChar characters, ext. data.

Definition at line 936 of file xistream.cxx.

References Ignore(), IgnoreRawUniString(), and ReadUniStringExtHeader().

Referenced by ExcelToSc8::Convert(), ExcelToSc8::GetAbsRefs(), and IgnoreUniString().

◆ IsContinueId()

bool XclImpStream::IsContinueId ( sal_uInt16  nRecId) const
private

Returns true, if the passed ID is real or alternative continuation record ID.

Definition at line 1017 of file xistream.cxx.

References EXC_ID_CONT, and mnAltContId.

Referenced by JumpToNextContinue(), and StartNextRecord().

◆ IsValid()

bool XclImpStream::IsValid ( ) const
inline

Returns record reading state: false = record overread.

Definition at line 351 of file xistream.hxx.

References mbValid.

Referenced by ExcelToSc::Convert(), ExcelToSc8::Convert(), ExcelToSc8::GetAbsRefs(), IgnoreRawUniString(), ImportExcel::Read(), ImportExcel8::Read(), and ReadRawUniString().

◆ JumpToNextContinue()

bool XclImpStream::JumpToNextContinue ( )
private

Goes to start of the next CONTINUE record.

@descr Stream must be located at the end of a raw record, and handling of CONTINUE records must be enabled.

Returns
Copy of mbValid.

Definition at line 1022 of file xistream.cxx.

References IsContinueId(), mbCont, mbValid, mnRawRecId, ReadNextRawRecHeader(), and SetupRawRecord().

Referenced by EnsureRawReadSize(), GetNextRecId(), GetRecSize(), Ignore(), JumpToNextStringContinue(), and Read().

◆ JumpToNextStringContinue()

bool XclImpStream::JumpToNextStringContinue ( bool &  rb16Bit)
private

Goes to start of the next CONTINUE record while reading strings.

@descr Stream must be located at the end of a raw record. If reading has been started in a CONTINUE record, jumps to an existing following CONTINUE record, even if handling of CONTINUE records is disabled (This is a special handling for TXO string data). Reads additional Unicode flag byte at start of the new raw record and sets or resets rb16Bit.

Returns
Copy of mbValid.

Definition at line 1030 of file xistream.cxx.

References EXC_ID_CONT, EXC_STRF_16BIT, get_flag(), GetRecLeft(), JumpToNextContinue(), mbCont, mbValid, mbValidRec, mnRawRecId, mnRawRecLeft, mnRawRecSize, mnRecId, ReadNextRawRecHeader(), ReaduInt8(), and SetupRecord().

Referenced by IgnoreRawUniString(), and ReadRawUniString().

◆ PeekRecId()

sal_uInt16 XclImpStream::PeekRecId ( std::size_t  nPos)

◆ PopPosition()

void XclImpStream::PopPosition ( )

Seeks to last position from user position stack.

@descr This position will be removed from the stack.

Definition at line 533 of file xistream.cxx.

References maPosStack, and RestorePosition().

Referenced by CopyRecordToStream(), GetNextRecId(), and GetRecSize().

◆ PushPosition()

void XclImpStream::PushPosition ( )

Pushes current position on user position stack.

@descr This stack is emptied when starting a new record with StartNextRecord(). The decryption state (enabled/disabled) is not pushed onto the stack.

Definition at line 527 of file xistream.cxx.

References maPosStack, and StorePosition().

Referenced by CopyRecordToStream(), GetNextRecId(), and GetRecSize().

◆ Read()

std::size_t XclImpStream::Read ( void *  pData,
std::size_t  nBytes 
)

Reads nBytes bytes to the existing(!) buffer pData.

Returns
Count of bytes really read.

Definition at line 721 of file xistream.cxx.

References GetMaxRawReadSize(), JumpToNextContinue(), mbValid, pData, and ReadRawData().

Referenced by CopyToStream(), and ImportExcel8::Feat().

◆ ReadByteString()

OUString XclImpStream::ReadByteString ( bool  b16BitLen)

Reads 8/16 bit string length, character array and returns the string.

Definition at line 959 of file xistream.cxx.

References ReadRawByteString(), ReaduInt16(), and ReaduInt8().

Referenced by ImportExcel::Boundsheet(), ImportExcel::Externname25(), and ImportExcel::Externsheet().

◆ ReadDouble()

double XclImpStream::ReadDouble ( )

◆ ReadInt16()

sal_Int16 XclImpStream::ReadInt16 ( )

◆ ReadInt32()

sal_Int32 XclImpStream::ReadInt32 ( )

◆ ReadNextRawRecHeader()

bool XclImpStream::ReadNextRawRecHeader ( )
private

Seeks to next raw record header and reads record ID and size.

@descr This is a "raw" function, means that stream members are inconsistent after return. Does only change mnRawRecId, mnRawRecSize, and the base stream position, but no other members.

Returns
false = No record header found (end of stream).

Definition at line 977 of file xistream.cxx.

References checkSeek(), SvStream::good(), mnNextRecPos, mnRawRecId, mnRawRecSize, mnStreamSize, mrStrm, and SvStream::ReadUInt16().

Referenced by JumpToNextContinue(), JumpToNextStringContinue(), and StartNextRecord().

◆ ReadRawByteString()

OUString XclImpStream::ReadRawByteString ( sal_uInt16  nChars)

Reads nChar byte characters and returns the string.

Definition at line 949 of file xistream.cxx.

References GetMaxRawReadSize(), XclRoot::GetTextEncoding(), mrRoot, and ReadRawData().

Referenced by ExcelToSc::Convert(), ReadByteString(), and ExcelToSc::ReadExtensionArray().

◆ ReadRawData()

sal_uInt16 XclImpStream::ReadRawData ( void *  pData,
sal_uInt16  nBytes 
)
private

Reads and decrypts nBytes bytes to the existing(!) buffer pData.

Returns
Count of bytes really read.

Definition at line 1072 of file xistream.cxx.

References mbUseDecr, mnRawRecLeft, mrStrm, mxDecrypter, pData, and SvStream::ReadBytes().

Referenced by Read(), and ReadRawByteString().

◆ ReadRawUniString()

OUString XclImpStream::ReadRawUniString ( sal_uInt16  nChars,
bool  b16Bit 
)

Reads nChars characters and returns the string.

Definition at line 837 of file xistream.cxx.

References EXC_NUL, EXC_NUL_C, GetMaxRawReadSize(), IsValid(), JumpToNextStringContinue(), mcNulSubst, mnRawRecLeft, ReaduInt16(), and ReaduInt8().

Referenced by ReadUniString().

◆ ReaduInt16()

sal_uInt16 XclImpStream::ReaduInt16 ( )

Definition at line 649 of file xistream.cxx.

References EnsureRawReadSize(), mbUseDecr, mnRawRecLeft, mrStrm, mxDecrypter, nValue, and SvStream::ReadUInt16().

Referenced by ImportExcel::Array25(), ImportExcel::Array34(), ImportExcel::Bof2(), ImportExcel::Bof3(), ImportExcel::Bof4(), ImportExcel::Bof5(), ImportExcel8::Boundsheet(), ImportExcel::Boundsheet(), ImportExcel8::Calccount(), ImportExcel::Cellmerging(), ImportExcel::Codepage(), ImportExcel::Colinfo(), ImportExcel::Columndefault(), ImportExcel::Colwidth(), ExcelToSc::Convert(), ExcelToSc8::Convert(), ImportExcel::Country(), ImportExcel::DefColWidth(), ImportExcel::Defrowheight2(), ImportExcel::Defrowheight345(), ExcScenario::ExcScenario(), ImportExcel::Externname25(), ImportExcel8::Feat(), ImportExcel8::FeatHdr(), ImportExcel::Formula25(), ImportExcel::Formula4(), ExcelToSc8::GetAbsRefs(), ImportExcel::Hideobj(), ImportExcel8::Iteration(), ImportExcel::Ixfe(), ImportExcel8::Labelsst(), ImportExcel::Mulblank(), ImportExcel::Mulrk(), ImportExcel8::Precision(), ReadByteString(), ImportExcel::ReadDimensions(), ExcelToSc::ReadExtensionArray(), ExcelToSc::ReadExtensionMemArea(), ImportExcel::ReadFileSharing(), ImportExcel::ReadInteger(), XclImpPivotCache::ReadPivotCacheStream(), ReadRawUniString(), ReadUniString(), ReadUniStringExtHeader(), ImportExcel::ReadUsesElfs(), ImportExcel::ReadXFIndex(), ImportExcel::Rec1904(), ImportExcel::Row25(), ImportExcel::Row34(), ImportExcel::Rstring(), ImportExcel8::Scenman(), ImportExcel::Shrfmla(), ImportExcel::Standardwidth(), ImportExcel::TableOp(), and ImportExcel::Wsbool().

◆ ReaduInt32()

sal_uInt32 XclImpStream::ReaduInt32 ( )

◆ ReaduInt8()

sal_uInt8 XclImpStream::ReaduInt8 ( )

◆ ReadUniString() [1/3]

OUString XclImpStream::ReadUniString ( )

Reads 16 bit character count, 8 bit flags, ext.

header, character array, ext. data and returns the string.

Definition at line 905 of file xistream.cxx.

References ReaduInt16(), and ReadUniString().

Referenced by ReadUniString().

◆ ReadUniString() [2/3]

OUString XclImpStream::ReadUniString ( sal_uInt16  nChars)

Reads 8 bit flags, ext.

header, nChar characters, ext. data and returns the string.

Definition at line 900 of file xistream.cxx.

References ReaduInt8(), and ReadUniString().

◆ ReadUniString() [3/3]

OUString XclImpStream::ReadUniString ( sal_uInt16  nChars,
sal_uInt8  nFlags 
)

Reads ext.

header, nChar characters, ext. data and returns the string.

Definition at line 891 of file xistream.cxx.

References Ignore(), ReadRawUniString(), and ReadUniStringExtHeader().

Referenced by ImportExcel8::Boundsheet(), ExcelToSc8::Convert(), ExcScenario::ExcScenario(), ImportExcel8::Feat(), and ExcelToSc::ReadExtensionArray().

◆ ReadUniStringExtHeader() [1/2]

std::size_t XclImpStream::ReadUniStringExtHeader ( bool &  rb16Bit,
bool &  rbRich,
bool &  rbFareast,
sal_uInt16 &  rnFormatRuns,
sal_uInt32 &  rnExtInf,
sal_uInt8  nFlags 
)

Reads ext.

header, detects 8/16 bit mode, sets all ext. info.

Returns
Total size of ext. data.

Definition at line 816 of file xistream.cxx.

References EXC_STRF_16BIT, EXC_STRF_FAREAST, EXC_STRF_RICH, EXC_STRF_UNKNOWN, get_flag(), ReaduInt16(), and ReaduInt32().

Referenced by IgnoreUniString(), ReadUniString(), and ReadUniStringExtHeader().

◆ ReadUniStringExtHeader() [2/2]

std::size_t XclImpStream::ReadUniStringExtHeader ( bool &  rb16Bit,
sal_uInt8  nFlags 
)

Seeks to begin of character array, detects 8/16 bit mode.

Returns
Total size of ext. data.

Definition at line 829 of file xistream.cxx.

References ReadUniStringExtHeader().

◆ ResetRecord()

void XclImpStream::ResetRecord ( bool  bContLookup,
sal_uInt16  nAltContId = EXC_ID_UNKNOWN 
)

Sets stream pointer to begin of record content.

Parameters
bContLookupAutomatic CONTINUE lookup on/off. In difference to other stream settings, this setting is persistent until next call of this function (because it is wanted to receive the next CONTINUE records separately).
nAltContIdSets an alternative record ID for content continuation. This value is reset automatically when a new record is started with StartNextRecord().

Definition at line 487 of file xistream.cxx.

References EnableDecryption(), maFirstRec, maPosStack, mbCont, mbHasComplRec, mbValidRec, mnAltContId, mnComplRecSize, mnCurrRecSize, mnRawRecSize, and RestorePosition().

◆ RestorePosition()

void XclImpStream::RestorePosition ( const XclImpStreamPos rPos)

Restores stream position contained in rPos.

Definition at line 971 of file xistream.cxx.

References XclImpStreamPos::Get(), mbValid, mnCurrRecSize, mnNextRecPos, mnRawRecId, mnRawRecLeft, mnRawRecSize, mrStrm, and SetupDecrypter().

Referenced by CopyRecordToStream(), PopPosition(), ResetRecord(), Seek(), and SeekGlobalPosition().

◆ RewindRecord()

void XclImpStream::RewindRecord ( )

Sets stream pointer before current record and invalidates stream.

@descr The next call to StartNextRecord() will start again the current record. This can be used in situations where a loop or a function leaves on a specific record, but the parent context expects to start this record by itself. The stream is invalid as long as the first record has not been started (it is not allowed to call any other stream operation then).

Definition at line 501 of file xistream.cxx.

References XclImpStreamPos::GetPos(), maFirstRec, mbValid, mbValidRec, and mnNextRecPos.

◆ Seek()

void XclImpStream::Seek ( std::size_t  nPos)

Seeks absolute in record content to the specified position.

@descr The value 0 means start of record, independent from physical stream position.

Definition at line 781 of file xistream.cxx.

References GetRecPos(), Ignore(), maFirstRec, mbValid, mbValidRec, nPos, and RestorePosition().

Referenced by ExcelToSc::Convert(), ExcelToSc8::Convert(), and ExcelToSc8::GetAbsRefs().

◆ SeekGlobalPosition()

void XclImpStream::SeekGlobalPosition ( )

Seeks to the stored global user position.

Definition at line 551 of file xistream.cxx.

References maGlobPos, mbCont, mbGlobValidRec, mbHasComplRec, mbHasGlobPos, mbValidRec, mnComplRecSize, mnCurrRecSize, mnGlobRecId, mnRecId, and RestorePosition().

Referenced by ImportExcel::Read(), and ImportExcel8::Read().

◆ SetDecrypter()

void XclImpStream::SetDecrypter ( XclImpDecrypterRef const &  xDecrypter)

Enables decryption of record contents for the rest of the stream.

Definition at line 507 of file xistream.cxx.

References EnableDecryption(), mxDecrypter, and SetupDecrypter().

Referenced by CopyDecrypterFrom().

◆ SetNulSubstChar()

void XclImpStream::SetNulSubstChar ( sal_Unicode  cNulSubst = '?')
inline

Sets a replacement character for NUL characters.

@descr NUL characters must be replaced, because Tools strings cannot handle them. The substitution character is reset to '?' automatically, if a new record is started using the function StartNextRecord().

Parameters
cNulSubstThe character to use for NUL replacement. It is possible to specify NUL here. in this case strings are terminated when the first NUL occurs during string import.

Definition at line 430 of file xistream.hxx.

References mcNulSubst.

Referenced by SetupRecord().

◆ SetSvStreamError()

void XclImpStream::SetSvStreamError ( const ErrCode rErrCode)
inline

Set an SVSTREAM_..._ERROR.

Definition at line 469 of file xistream.hxx.

References mrStrm, and SvStream::SetError().

◆ SetupDecrypter()

void XclImpStream::SetupDecrypter ( )
private

Initializes the decrypter to read a new record.

Definition at line 988 of file xistream.cxx.

References mnRawRecSize, mrStrm, and mxDecrypter.

Referenced by RestorePosition(), SetDecrypter(), and SetupRawRecord().

◆ SetupRawRecord()

void XclImpStream::SetupRawRecord ( )
private

Initializes all members after base stream has been sought to new raw record.

Definition at line 994 of file xistream.cxx.

References mnCurrRecSize, mnNextRecPos, mnRawRecLeft, mnRawRecSize, mrStrm, SetupDecrypter(), and SvStream::Tell().

Referenced by JumpToNextContinue(), and SetupRecord().

◆ SetupRecord()

void XclImpStream::SetupRecord ( )
private

Initializes all members after base stream has been sought to new record.

Definition at line 1004 of file xistream.cxx.

References EnableDecryption(), EXC_ID_UNKNOWN, maFirstRec, mbCont, mbHasComplRec, mnAltContId, mnComplRecSize, mnCurrRecSize, mnRawRecId, mnRawRecSize, mnRecId, SetNulSubstChar(), SetupRawRecord(), and StorePosition().

Referenced by JumpToNextStringContinue(), and StartNextRecord().

◆ StartNextRecord() [1/2]

bool XclImpStream::StartNextRecord ( )

Sets stream pointer to the start of the next record content.

@descr Ignores all CONTINUE records of the current record, if automatic CONTINUE usage is switched on.

Returns
false = no record found (end of stream).

Definition at line 456 of file xistream.cxx.

References IsContinueId(), maPosStack, mbCont, mbValid, mbValidRec, mnNextRecPos, mnRawRecId, mnRawRecSize, mrStrm, ReadNextRawRecHeader(), SetupRecord(), and SvStream::Tell().

Referenced by XclImpFmlaCompImpl::CreateFormula(), XclImpFmlaCompImpl::CreateRangeList(), ImportExcel::Read(), ImportExcel8::Read(), XclImpChangeTrack::ReadFormula(), XclImpDffConverter::ReadHlinkProperty(), XclImpPivotCache::ReadPivotCacheStream(), and StartNextRecord().

◆ StartNextRecord() [2/2]

bool XclImpStream::StartNextRecord ( std::size_t  nNextRecPos)

Sets stream pointer to the start of the record content for the record at the passed absolute stream position.

Returns
false = no record found (end of stream).

Definition at line 481 of file xistream.cxx.

References mnNextRecPos, and StartNextRecord().

◆ StoreGlobalPosition()

void XclImpStream::StoreGlobalPosition ( )

Stores current position.

This position keeps valid in all records.

Definition at line 543 of file xistream.cxx.

References maGlobPos, mbGlobValidRec, mbHasGlobPos, mbValidRec, mnGlobRecId, mnRecId, and StorePosition().

Referenced by ImportExcel::Read(), and ImportExcel8::Read().

◆ StorePosition()

void XclImpStream::StorePosition ( XclImpStreamPos rPos)

Stores current stream position into rPos.

Definition at line 966 of file xistream.cxx.

References mbValid, mnCurrRecSize, mnNextRecPos, mnRawRecId, mnRawRecLeft, mnRawRecSize, mrStrm, and XclImpStreamPos::Set().

Referenced by PushPosition(), SetupRecord(), and StoreGlobalPosition().

Member Data Documentation

◆ maFirstRec

XclImpStreamPos XclImpStream::maFirstRec
private

Provides methods to decrypt data.

Definition at line 522 of file xistream.hxx.

Referenced by CopyRecordToStream(), ResetRecord(), RewindRecord(), Seek(), and SetupRecord().

◆ maGlobPos

XclImpStreamPos XclImpStream::maGlobPos
private

Stack for record positions.

Definition at line 526 of file xistream.hxx.

Referenced by SeekGlobalPosition(), and StoreGlobalPosition().

◆ maPosStack

std::vector< XclImpStreamPos > XclImpStream::maPosStack
private

Start position of current record.

Definition at line 524 of file xistream.hxx.

Referenced by PopPosition(), PushPosition(), ResetRecord(), and StartNextRecord().

◆ mbCont

bool XclImpStream::mbCont
private

Replacement for NUL characters.

Definition at line 546 of file xistream.hxx.

Referenced by JumpToNextContinue(), JumpToNextStringContinue(), ResetRecord(), SeekGlobalPosition(), SetupRecord(), and StartNextRecord().

◆ mbGlobValidRec

bool XclImpStream::mbGlobValidRec
private

Record ID for user defined position.

Definition at line 528 of file xistream.hxx.

Referenced by SeekGlobalPosition(), and StoreGlobalPosition().

◆ mbHasComplRec

bool XclImpStream::mbHasComplRec
private

Size of complete record data (with CONTINUEs).

Definition at line 535 of file xistream.hxx.

Referenced by GetRecSize(), ResetRecord(), SeekGlobalPosition(), and SetupRecord().

◆ mbHasGlobPos

bool XclImpStream::mbHasGlobPos
private

Was user position a valid record?

Definition at line 529 of file xistream.hxx.

Referenced by SeekGlobalPosition(), and StoreGlobalPosition().

◆ mbUseDecr

bool XclImpStream::mbUseDecr
private

Automatic CONTINUE lookup on/off.

Definition at line 547 of file xistream.hxx.

Referenced by EnableDecryption(), ReadDouble(), ReadInt16(), ReadInt32(), ReadRawData(), ReaduInt16(), ReaduInt32(), and ReaduInt8().

◆ mbValid

bool XclImpStream::mbValid
private

◆ mbValidRec

bool XclImpStream::mbValidRec
private

◆ mcNulSubst

sal_Unicode XclImpStream::mcNulSubst
private

Bytes left in current raw record (without following CONTINUEs).

Definition at line 544 of file xistream.hxx.

Referenced by ReadRawUniString(), and SetNulSubstChar().

◆ mnAltContId

sal_uInt16 XclImpStream::mnAltContId
private

Current record ID (not the CONTINUE ID).

Definition at line 538 of file xistream.hxx.

Referenced by IsContinueId(), ResetRecord(), and SetupRecord().

◆ mnComplRecSize

std::size_t XclImpStream::mnComplRecSize
private

Helper for record position.

Definition at line 534 of file xistream.hxx.

Referenced by GetRecSize(), ResetRecord(), SeekGlobalPosition(), and SetupRecord().

◆ mnCurrRecSize

std::size_t XclImpStream::mnCurrRecSize
private

Start of next record header.

Definition at line 533 of file xistream.hxx.

Referenced by GetRecPos(), GetRecSize(), ResetRecord(), RestorePosition(), SeekGlobalPosition(), SetupRawRecord(), SetupRecord(), and StorePosition().

◆ mnGlobRecId

sal_uInt16 XclImpStream::mnGlobRecId
private

User defined position elsewhere in stream.

Definition at line 527 of file xistream.hxx.

Referenced by SeekGlobalPosition(), and StoreGlobalPosition().

◆ mnNextRecPos

std::size_t XclImpStream::mnNextRecPos
private

◆ mnRawRecId

sal_uInt16 XclImpStream::mnRawRecId
private

Alternative record ID for content continuation.

Definition at line 540 of file xistream.hxx.

Referenced by JumpToNextContinue(), JumpToNextStringContinue(), ReadNextRawRecHeader(), RestorePosition(), SetupRecord(), StartNextRecord(), and StorePosition().

◆ mnRawRecLeft

sal_uInt16 XclImpStream::mnRawRecLeft
private

◆ mnRawRecSize

sal_uInt16 XclImpStream::mnRawRecSize
private

◆ mnRecId

sal_uInt16 XclImpStream::mnRecId
private

true = mnComplRecSize is valid.

Definition at line 537 of file xistream.hxx.

Referenced by GetRecId(), JumpToNextStringContinue(), SeekGlobalPosition(), SetupRecord(), and StoreGlobalPosition().

◆ mnStreamSize

std::size_t XclImpStream::mnStreamSize
private

Is user position defined?

Definition at line 531 of file xistream.hxx.

Referenced by GetNextRecId(), GetSvStreamSize(), PeekRecId(), ReadNextRawRecHeader(), and XclImpStream().

◆ mrRoot

const XclImpRoot& XclImpStream::mrRoot
private

Reference to the system input stream.

Definition at line 518 of file xistream.hxx.

Referenced by GetRoot(), and ReadRawByteString().

◆ mrStrm

SvStream& XclImpStream::mrStrm
private

◆ mxDecrypter

XclImpDecrypterRef XclImpStream::mxDecrypter
private

The documentation for this class was generated from the following files: