LibreOffice Module sc (master) 1
xistream.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#pragma once
21
23#include <com/sun/star/beans/NamedValue.hpp>
25#include <tools/stream.hxx>
26#include <memory>
27#include "xlstream.hxx"
28#include "xlconst.hxx"
29
30class XclImpRoot;
31
32/* ============================================================================
33Input stream class for Excel import
34- CONTINUE record handling
35- Decryption
36============================================================================ */
37
38// Decryption
39
40class XclImpDecrypter;
41typedef std::shared_ptr< XclImpDecrypter > XclImpDecrypterRef;
42
45{
46public:
47 explicit XclImpDecrypter();
48 virtual ~XclImpDecrypter() override;
49
51 const ErrCode& GetError() const { return mnError; }
53 bool IsValid() const { return mnError == ERRCODE_NONE; }
54
57
59 virtual ::comphelper::DocPasswordVerifierResult verifyPassword( const OUString& rPassword, css::uno::Sequence< css::beans::NamedValue >& o_rEncryptionData ) override;
60 virtual ::comphelper::DocPasswordVerifierResult verifyEncryptionData( const css::uno::Sequence< css::beans::NamedValue >& rEncryptionData ) override;
61
63 void Update( const SvStream& rStrm, sal_uInt16 nRecSize );
66 sal_uInt16 Read( SvStream& rStrm, void* pData, sal_uInt16 nBytes );
67
68protected:
70 explicit XclImpDecrypter( const XclImpDecrypter& rSrc );
71
72private:
74 virtual XclImpDecrypter* OnClone() const = 0;
77 virtual css::uno::Sequence< css::beans::NamedValue >
78 OnVerifyPassword( const OUString& rPassword ) = 0;
79 virtual bool OnVerifyEncryptionData( const css::uno::Sequence< css::beans::NamedValue >& rEncryptionData ) = 0;
80
82 virtual void OnUpdate( std::size_t nOldStrmPos, std::size_t nNewStrmPos, sal_uInt16 nRecSize ) = 0;
84 virtual sal_uInt16 OnRead( SvStream& rStrm, sal_uInt8* pnData, sal_uInt16 nBytes ) = 0;
85
86private:
88 sal_uInt64 mnOldPos;
89 sal_uInt16 mnRecSize;
90};
91
94{
95public:
96 explicit XclImpBiff5Decrypter( sal_uInt16 nKey, sal_uInt16 nHash );
97
98private:
100 explicit XclImpBiff5Decrypter( const XclImpBiff5Decrypter& rSrc );
101
103 virtual XclImpBiff5Decrypter* OnClone() const override;
105 virtual css::uno::Sequence< css::beans::NamedValue >
106 OnVerifyPassword( const OUString& rPassword ) override;
107 virtual bool OnVerifyEncryptionData( const css::uno::Sequence< css::beans::NamedValue >& rEncryptionData ) override;
109 virtual void OnUpdate( std::size_t nOldStrmPos, std::size_t nNewStrmPos, sal_uInt16 nRecSize ) override;
111 virtual sal_uInt16 OnRead( SvStream& rStrm, sal_uInt8* pnData, sal_uInt16 nBytes ) override;
112
113private:
115 css::uno::Sequence< css::beans::NamedValue > maEncryptionData;
116 sal_uInt16 mnKey;
117 sal_uInt16 mnHash;
118};
119
122{
123private:
125 virtual css::uno::Sequence< css::beans::NamedValue >
126 OnVerifyPassword( const OUString& rPassword ) override;
127 virtual bool OnVerifyEncryptionData( const css::uno::Sequence< css::beans::NamedValue >& rEncryptionData ) override;
129 virtual void OnUpdate( std::size_t nOldStrmPos, std::size_t nNewStrmPos, sal_uInt16 nRecSize ) override;
131 virtual sal_uInt16 OnRead( SvStream& rStrm, sal_uInt8* pnData, sal_uInt16 nBytes ) override;
132
134 static sal_uInt32 GetBlock( std::size_t nStrmPos );
136 static sal_uInt16 GetOffset( std::size_t nStrmPos );
137
138protected:
139 explicit XclImpBiff8Decrypter( std::vector<sal_uInt8>&& rSalt,
140 std::vector<sal_uInt8>&& rVerifier,
141 std::vector<sal_uInt8>&& rVerifierHash);
142
143 explicit XclImpBiff8Decrypter(const XclImpBiff8Decrypter& rSrc);
144
145 css::uno::Sequence< css::beans::NamedValue > maEncryptionData;
146 std::vector< sal_uInt8 > maSalt;
147 std::vector< sal_uInt8 > maVerifier;
148 std::vector< sal_uInt8 > maVerifierHash;
150};
151
153{
154public:
155 explicit XclImpBiff8StdDecrypter( std::vector<sal_uInt8>&& rSalt,
156 std::vector<sal_uInt8>&& rVerifier,
157 std::vector<sal_uInt8>&& rVerifierHash)
158 : XclImpBiff8Decrypter(std::move(rSalt), std::move(rVerifier), std::move(rVerifierHash))
159 {
160 mpCodec = &maCodec;
161 }
162
163private:
166
168 virtual XclImpBiff8StdDecrypter* OnClone() const override;
169
170private:
172};
173
175{
176public:
177 explicit XclImpBiff8CryptoAPIDecrypter( std::vector<sal_uInt8>&& rSalt,
178 std::vector<sal_uInt8>&& rVerifier,
179 std::vector<sal_uInt8>&& rVerifierHash)
180 : XclImpBiff8Decrypter(std::move(rSalt), std::move(rVerifier), std::move(rVerifierHash))
181 {
182 mpCodec = &maCodec;
183 }
184
185private:
188
190 virtual XclImpBiff8CryptoAPIDecrypter* OnClone() const override;
191
192private:
194};
195
196// Stream
197
202{
203public:
205 explicit XclImpStreamPos();
206
208 void Set( const SvStream& rStrm, std::size_t nNextPos, std::size_t nCurrSize,
209 sal_uInt16 nRawRecId, sal_uInt16 nRawRecSize, sal_uInt16 nRawRecLeft,
210 bool bValid );
211
213 void Get( SvStream& rStrm, std::size_t& rnNextPos, std::size_t& rnCurrSize,
214 sal_uInt16& rnRawRecId, sal_uInt16& rnRawRecSize, sal_uInt16& rnRawRecLeft,
215 bool& rbValid ) const;
216
218 std::size_t GetPos() const { return mnPos; }
219
220private:
221 std::size_t mnPos;
222 std::size_t mnNextPos;
223 std::size_t mnCurrSize;
224 sal_uInt16 mnRawRecId;
225 sal_uInt16 mnRawRecSize;
226 sal_uInt16 mnRawRecLeft;
227 bool mbValid;
228};
229
278{
279public:
282
286 explicit XclImpStream(
287 SvStream& rInStrm,
288 const XclImpRoot& rRoot );
289
291
293 const XclImpRoot& GetRoot() const { return mrRoot; }
294
299 bool StartNextRecord();
303 bool StartNextRecord( std::size_t nNextRecPos );
312 void ResetRecord( bool bContLookup,
313 sal_uInt16 nAltContId = EXC_ID_UNKNOWN );
321 void RewindRecord();
322
324 void SetDecrypter( XclImpDecrypterRef const & xDecrypter );
326 void CopyDecrypterFrom( const XclImpStream& rStrm );
330 void EnableDecryption( bool bEnable = true );
335
340 void PushPosition();
343 void PopPosition();
344
346 void StoreGlobalPosition();
348 void SeekGlobalPosition();
349
351 bool IsValid() const { return mbValid; }
353 sal_uInt16 GetRecId() const { return mnRecId; }
355 std::size_t GetRecPos() const;
357 std::size_t GetRecSize();
359 std::size_t GetRecLeft();
361 sal_uInt16 GetNextRecId();
362
363 sal_uInt16 PeekRecId( std::size_t nPos );
364
365 [[nodiscard]]
367 [[nodiscard]]
368 sal_Int16 ReadInt16();
369 [[nodiscard]]
370 sal_uInt16 ReaduInt16();
371 [[nodiscard]]
372 sal_Int32 ReadInt32();
373 [[nodiscard]]
374 sal_uInt32 ReaduInt32();
375 [[nodiscard]]
376 double ReadDouble();
377
380 std::size_t Read( void* pData, std::size_t nBytes );
383 std::size_t CopyToStream( SvStream& rOutStrm, std::size_t nBytes );
384
386 void CopyRecordToStream( SvStream& rOutStrm );
387
390 void Seek( std::size_t nPos );
392 void Ignore( std::size_t nBytes );
393
394 // *** special string functions *** ---------------------------------------
395
396 // *** read/ignore unicode strings *** ------------------------------------
397 /* - look for CONTINUE records even if CONTINUE handling disabled
398 (only if inside of a CONTINUE record - for TXO import)
399 - no overread assertions (for Applix wrong string length export bug)
400
401 structure of an Excel unicode string:
402 (1) 2 byte character count
403 (2) 1 byte flags (16-bit-characters, rich string, far east string)
404 (3) [2 byte rich string format run count]
405 (4) [4 byte far east data size]
406 (5) character array
407 (6) [4 * (rich string format run count) byte]
408 (7) [(far east data size) byte]
409 header = (1), (2)
410 ext. header = (3), (4)
411 ext. data = (6), (7)
412 */
413
416 std::size_t ReadUniStringExtHeader(
417 bool& rb16Bit, bool& rbRich, bool& rbFareast,
418 sal_uInt16& rnFormatRuns, sal_uInt32& rnExtInf, sal_uInt8 nFlags );
421 std::size_t ReadUniStringExtHeader( bool& rb16Bit, sal_uInt8 nFlags );
422
430 void SetNulSubstChar( sal_Unicode cNulSubst = '?' ) { mcNulSubst = cNulSubst; }
431
433 OUString ReadRawUniString( sal_uInt16 nChars, bool b16Bit );
435 OUString ReadUniString( sal_uInt16 nChars, sal_uInt8 nFlags );
437 OUString ReadUniString( sal_uInt16 nChars );
440 OUString ReadUniString();
441
443 void IgnoreRawUniString( sal_uInt16 nChars, bool b16Bit );
445 void IgnoreUniString( sal_uInt16 nChars, sal_uInt8 nFlags );
447 void IgnoreUniString( sal_uInt16 nChars );
448
449 // *** read/ignore 8-bit-strings, store in String *** ---------------------
450
452 OUString ReadRawByteString( sal_uInt16 nChars );
454 OUString ReadByteString( bool b16BitLen );
455
456 // *** SvStream functions *** ---------------------------------------------
457
459 std::size_t GetSvStreamPos() const { return mrStrm.Tell(); }
461 std::size_t GetSvStreamSize() const { return mnStreamSize; }
462
464 void StorePosition( XclImpStreamPos& rPos );
466 void RestorePosition( const XclImpStreamPos& rPos );
467
469 void SetSvStreamError( const ErrCode& rErrCode )
470 { mrStrm.SetError( rErrCode ); }
471
472private:
479
481 void SetupDecrypter();
483 void SetupRawRecord();
485 void SetupRecord();
486
488 bool IsContinueId( sal_uInt16 nRecId ) const;
489
494 bool JumpToNextContinue();
502 bool JumpToNextStringContinue( bool& rb16Bit );
503
508 bool EnsureRawReadSize( sal_uInt16 nBytes );
510 sal_uInt16 GetMaxRawReadSize( std::size_t nBytes ) const;
511
514 sal_uInt16 ReadRawData( void* pData, sal_uInt16 nBytes );
515
516private:
519
521
523 std::vector< XclImpStreamPos >
525
527 sal_uInt16 mnGlobRecId;
530
531 std::size_t mnStreamSize;
532 std::size_t mnNextRecPos;
533 std::size_t mnCurrRecSize;
534 std::size_t mnComplRecSize;
536
537 sal_uInt16 mnRecId;
538 sal_uInt16 mnAltContId;
539
540 sal_uInt16 mnRawRecId;
541 sal_uInt16 mnRawRecSize;
542 sal_uInt16 mnRawRecLeft;
543
545
546 bool mbCont;
549 bool mbValid;
550};
551
552/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt64 Tell() const
void SetError(ErrCode nErrorCode)
Decrypts BIFF5 stream contents.
Definition: xistream.hxx:94
virtual XclImpBiff5Decrypter * OnClone() const override
Implementation of cloning this object.
Definition: xistream.cxx:126
XclImpBiff5Decrypter(sal_uInt16 nKey, sal_uInt16 nHash)
Definition: xistream.cxx:110
virtual void OnUpdate(std::size_t nOldStrmPos, std::size_t nNewStrmPos, sal_uInt16 nRecSize) override
Implementation of updating the decrypter.
Definition: xistream.cxx:189
virtual sal_uInt16 OnRead(SvStream &rStrm, sal_uInt8 *pnData, sal_uInt16 nBytes) override
Implementation of the decryption.
Definition: xistream.cxx:195
::msfilter::MSCodec_XorXLS95 maCodec
Definition: xistream.hxx:114
css::uno::Sequence< css::beans::NamedValue > maEncryptionData
Crypto algorithm implementation.
Definition: xistream.hxx:115
virtual bool OnVerifyEncryptionData(const css::uno::Sequence< css::beans::NamedValue > &rEncryptionData) override
Definition: xistream.cxx:173
virtual css::uno::Sequence< css::beans::NamedValue > OnVerifyPassword(const OUString &rPassword) override
Implements password verification and initialization of the decoder.
Definition: xistream.cxx:131
virtual XclImpBiff8CryptoAPIDecrypter * OnClone() const override
Implementation of cloning this object.
Definition: xistream.cxx:243
::msfilter::MSCodec_CryptoAPI maCodec
Definition: xistream.hxx:193
XclImpBiff8CryptoAPIDecrypter(std::vector< sal_uInt8 > &&rSalt, std::vector< sal_uInt8 > &&rVerifier, std::vector< sal_uInt8 > &&rVerifierHash)
Definition: xistream.hxx:177
Decrypts BIFF8 stream contents using the given document identifier.
Definition: xistream.hxx:122
virtual void OnUpdate(std::size_t nOldStrmPos, std::size_t nNewStrmPos, sal_uInt16 nRecSize) override
Implementation of updating the decrypter.
Definition: xistream.cxx:289
std::vector< sal_uInt8 > maVerifier
Definition: xistream.hxx:147
std::vector< sal_uInt8 > maSalt
Definition: xistream.hxx:146
static sal_uInt32 GetBlock(std::size_t nStrmPos)
Returns the block number corresponding to the passed stream position.
Definition: xistream.cxx:337
static sal_uInt16 GetOffset(std::size_t nStrmPos)
Returns the block offset corresponding to the passed stream position.
Definition: xistream.cxx:342
virtual css::uno::Sequence< css::beans::NamedValue > OnVerifyPassword(const OUString &rPassword) override
Implements password verification and initialization of the decoder.
Definition: xistream.cxx:248
msfilter::MSCodec97 * mpCodec
Definition: xistream.hxx:149
virtual bool OnVerifyEncryptionData(const css::uno::Sequence< css::beans::NamedValue > &rEncryptionData) override
Definition: xistream.cxx:273
virtual sal_uInt16 OnRead(SvStream &rStrm, sal_uInt8 *pnData, sal_uInt16 nBytes) override
Implementation of the decryption.
Definition: xistream.cxx:312
css::uno::Sequence< css::beans::NamedValue > maEncryptionData
Definition: xistream.hxx:145
XclImpBiff8Decrypter(std::vector< sal_uInt8 > &&rSalt, std::vector< sal_uInt8 > &&rVerifier, std::vector< sal_uInt8 > &&rVerifierHash)
Definition: xistream.cxx:202
std::vector< sal_uInt8 > maVerifierHash
Definition: xistream.hxx:148
::msfilter::MSCodec_Std97 maCodec
Definition: xistream.hxx:171
XclImpBiff8StdDecrypter(std::vector< sal_uInt8 > &&rSalt, std::vector< sal_uInt8 > &&rVerifier, std::vector< sal_uInt8 > &&rVerifierHash)
Definition: xistream.hxx:155
virtual XclImpBiff8StdDecrypter * OnClone() const override
Implementation of cloning this object.
Definition: xistream.cxx:230
Base class for BIFF stream decryption.
Definition: xistream.hxx:45
XclImpDecrypterRef Clone() const
Creates a (ref-counted) copy of this decrypter object.
Definition: xistream.cxx:57
virtual bool OnVerifyEncryptionData(const css::uno::Sequence< css::beans::NamedValue > &rEncryptionData)=0
virtual ~XclImpDecrypter() override
Definition: xistream.cxx:53
virtual ::comphelper::DocPasswordVerifierResult verifyEncryptionData(const css::uno::Sequence< css::beans::NamedValue > &rEncryptionData) override
Definition: xistream.cxx:72
sal_uInt16 Read(SvStream &rStrm, void *pData, sal_uInt16 nBytes)
Reads and decrypts nBytes bytes and stores data into the existing(!) buffer pData.
Definition: xistream.cxx:93
void Update(const SvStream &rStrm, sal_uInt16 nRecSize)
Updates the decrypter on start of a new record or after seeking stream.
Definition: xistream.cxx:79
virtual sal_uInt16 OnRead(SvStream &rStrm, sal_uInt8 *pnData, sal_uInt16 nBytes)=0
Implementation of the decryption.
virtual void OnUpdate(std::size_t nOldStrmPos, std::size_t nNewStrmPos, sal_uInt16 nRecSize)=0
Implementation of updating the decrypter.
bool IsValid() const
Returns true, if the decoder has been initialized correctly.
Definition: xistream.hxx:53
sal_uInt64 mnOldPos
Decrypter error code.
Definition: xistream.hxx:88
virtual css::uno::Sequence< css::beans::NamedValue > OnVerifyPassword(const OUString &rPassword)=0
Derived classes implement password verification and initialization of the decoder.
virtual ::comphelper::DocPasswordVerifierResult verifyPassword(const OUString &rPassword, css::uno::Sequence< css::beans::NamedValue > &o_rEncryptionData) override
Implementation of the comphelper::IDocPasswordVerifier interface.
Definition: xistream.cxx:65
virtual XclImpDecrypter * OnClone() const =0
Implementation of cloning this object.
const ErrCode & GetError() const
Returns the current error code of the decrypter.
Definition: xistream.hxx:51
ErrCode mnError
Definition: xistream.hxx:87
sal_uInt16 mnRecSize
Last known stream position.
Definition: xistream.hxx:89
Access to global data from other classes.
Definition: xiroot.hxx:129
This class represents an Excel stream position.
Definition: xistream.hxx:202
std::size_t GetPos() const
Returns the stored stream position.
Definition: xistream.hxx:218
XclImpStreamPos()
Constructs an invalid stream position data object.
Definition: xistream.cxx:348
void Get(SvStream &rStrm, std::size_t &rnNextPos, std::size_t &rnCurrSize, sal_uInt16 &rnRawRecId, sal_uInt16 &rnRawRecSize, sal_uInt16 &rnRawRecLeft, bool &rbValid) const
Writes the contained stream position data to the given variables.
Definition: xistream.cxx:373
sal_uInt16 mnRawRecSize
Current raw record ID (including CONTINUEs).
Definition: xistream.hxx:225
bool mbValid
Bytes left in current raw record (without following CONTINUEs).
Definition: xistream.hxx:227
void Set(const SvStream &rStrm, std::size_t nNextPos, std::size_t nCurrSize, sal_uInt16 nRawRecId, sal_uInt16 nRawRecSize, sal_uInt16 nRawRecLeft, bool bValid)
Sets the stream position data to the passed values.
Definition: xistream.cxx:359
sal_uInt16 mnRawRecLeft
Current raw record size (without following CONTINUEs).
Definition: xistream.hxx:226
sal_uInt16 mnRawRecId
Current calculated size of the record.
Definition: xistream.hxx:224
std::size_t mnPos
Definition: xistream.hxx:221
std::size_t mnCurrSize
Absolute position of next record.
Definition: xistream.hxx:223
std::size_t mnNextPos
Absolute position of the stream.
Definition: xistream.hxx:222
This class is used to import record oriented streams.
Definition: xistream.hxx:278
bool IsValid() const
Returns record reading state: false = record overread.
Definition: xistream.hxx:351
std::size_t mnNextRecPos
Size of system stream.
Definition: xistream.hxx:532
std::size_t ReadUniStringExtHeader(bool &rb16Bit, bool &rbRich, bool &rbFareast, sal_uInt16 &rnFormatRuns, sal_uInt32 &rnExtInf, sal_uInt8 nFlags)
Reads ext.
Definition: xistream.cxx:816
bool ReadNextRawRecHeader()
Seeks to next raw record header and reads record ID and size.
Definition: xistream.cxx:977
std::size_t GetSvStreamSize() const
Returns the stream size.
Definition: xistream.hxx:461
std::vector< XclImpStreamPos > maPosStack
Start position of current record.
Definition: xistream.hxx:524
sal_Int16 ReadInt16()
Definition: xistream.cxx:631
sal_uInt16 GetNextRecId()
Returns the record ID of the following record.
Definition: xistream.cxx:587
sal_uInt16 GetRecId() const
Returns the current record ID.
Definition: xistream.hxx:353
std::size_t GetRecPos() const
Returns the position inside of the whole record content.
Definition: xistream.cxx:564
bool JumpToNextContinue()
Goes to start of the next CONTINUE record.
Definition: xistream.cxx:1022
SvStream & mrStrm
Definition: xistream.hxx:517
sal_uInt16 mnRecId
true = mnComplRecSize is valid.
Definition: xistream.hxx:537
static XclBiff DetectBiffVersion(SvStream &rStrm)
Detects the BIFF version of the passed workbook stream.
Definition: xistream.cxx:387
void ResetRecord(bool bContLookup, sal_uInt16 nAltContId=EXC_ID_UNKNOWN)
Sets stream pointer to begin of record content.
Definition: xistream.cxx:487
void EnableDecryption(bool bEnable=true)
Switches usage of current decryption algorithm on/off.
Definition: xistream.cxx:522
XclImpStreamPos maGlobPos
Stack for record positions.
Definition: xistream.hxx:526
bool mbCont
Replacement for NUL characters.
Definition: xistream.hxx:546
void SetupDecrypter()
Initializes the decrypter to read a new record.
Definition: xistream.cxx:988
void StoreGlobalPosition()
Stores current position.
Definition: xistream.cxx:543
std::size_t CopyToStream(SvStream &rOutStrm, std::size_t nBytes)
Copies nBytes bytes to rOutStrm.
Definition: xistream.cxx:746
void Seek(std::size_t nPos)
Seeks absolute in record content to the specified position.
Definition: xistream.cxx:781
void SeekGlobalPosition()
Seeks to the stored global user position.
Definition: xistream.cxx:551
void DisableDecryption()
Switches usage of current decryption algorithm off.
Definition: xistream.hxx:334
void RestorePosition(const XclImpStreamPos &rPos)
Restores stream position contained in rPos.
Definition: xistream.cxx:971
bool mbValidRec
Usage of decryption.
Definition: xistream.hxx:548
std::size_t GetSvStreamPos() const
Returns the absolute stream position.
Definition: xistream.hxx:459
sal_uInt16 mnRawRecId
Alternative record ID for content continuation.
Definition: xistream.hxx:540
std::size_t GetRecLeft()
Returns remaining data size of the whole record without record headers.
Definition: xistream.cxx:582
void StorePosition(XclImpStreamPos &rPos)
Stores current stream position into rPos.
Definition: xistream.cxx:966
XclImpStreamPos maFirstRec
Provides methods to decrypt data.
Definition: xistream.hxx:522
sal_uInt8 ReaduInt8()
Definition: xistream.cxx:617
sal_uInt16 PeekRecId(std::size_t nPos)
Definition: xistream.cxx:604
const XclImpRoot & mrRoot
Reference to the system input stream.
Definition: xistream.hxx:518
bool mbHasGlobPos
Was user position a valid record?
Definition: xistream.hxx:529
sal_uInt32 ReaduInt32()
Definition: xistream.cxx:685
bool mbGlobValidRec
Record ID for user defined position.
Definition: xistream.hxx:528
std::size_t Read(void *pData, std::size_t nBytes)
Reads nBytes bytes to the existing(!) buffer pData.
Definition: xistream.cxx:721
void SetNulSubstChar(sal_Unicode cNulSubst='?')
Sets a replacement character for NUL characters.
Definition: xistream.hxx:430
void SetupRecord()
Initializes all members after base stream has been sought to new record.
Definition: xistream.cxx:1004
void SetSvStreamError(const ErrCode &rErrCode)
Set an SVSTREAM_..._ERROR.
Definition: xistream.hxx:469
sal_uInt16 ReadRawData(void *pData, sal_uInt16 nBytes)
Reads and decrypts nBytes bytes to the existing(!) buffer pData.
Definition: xistream.cxx:1072
bool JumpToNextStringContinue(bool &rb16Bit)
Goes to start of the next CONTINUE record while reading strings.
Definition: xistream.cxx:1030
void Ignore(std::size_t nBytes)
Seeks forward inside the current record.
Definition: xistream.cxx:798
bool EnsureRawReadSize(sal_uInt16 nBytes)
Ensures that reading nBytes bytes is possible with next stream access.
Definition: xistream.cxx:1056
std::size_t mnCurrRecSize
Start of next record header.
Definition: xistream.hxx:533
bool mbHasComplRec
Size of complete record data (with CONTINUEs).
Definition: xistream.hxx:535
sal_uInt16 mnAltContId
Current record ID (not the CONTINUE ID).
Definition: xistream.hxx:538
void PushPosition()
Pushes current position on user position stack.
Definition: xistream.cxx:527
sal_Unicode mcNulSubst
Bytes left in current raw record (without following CONTINUEs).
Definition: xistream.hxx:544
std::size_t mnComplRecSize
Helper for record position.
Definition: xistream.hxx:534
OUString ReadRawUniString(sal_uInt16 nChars, bool b16Bit)
Reads nChars characters and returns the string.
Definition: xistream.cxx:837
void IgnoreRawUniString(sal_uInt16 nChars, bool b16Bit)
Ignores nChars characters.
Definition: xistream.cxx:910
sal_uInt16 GetMaxRawReadSize(std::size_t nBytes) const
Returns the maximum size of raw data possible to read in one block.
Definition: xistream.cxx:1067
sal_uInt16 mnGlobRecId
User defined position elsewhere in stream.
Definition: xistream.hxx:527
bool IsContinueId(sal_uInt16 nRecId) const
Returns true, if the passed ID is real or alternative continuation record ID.
Definition: xistream.cxx:1017
sal_uInt16 mnRawRecSize
Current raw record ID (including CONTINUEs).
Definition: xistream.hxx:541
sal_uInt16 ReaduInt16()
Definition: xistream.cxx:649
void SetupRawRecord()
Initializes all members after base stream has been sought to new raw record.
Definition: xistream.cxx:994
void CopyRecordToStream(SvStream &rOutStrm)
Copies the entire record to rOutStrm.
Definition: xistream.cxx:770
void IgnoreUniString(sal_uInt16 nChars, sal_uInt8 nFlags)
Ignores ext.
Definition: xistream.cxx:936
void PopPosition()
Seeks to last position from user position stack.
Definition: xistream.cxx:533
bool StartNextRecord()
Sets stream pointer to the start of the next record content.
Definition: xistream.cxx:456
bool mbValid
false = No more records to read.
Definition: xistream.hxx:549
std::size_t mnStreamSize
Is user position defined?
Definition: xistream.hxx:531
void SetDecrypter(XclImpDecrypterRef const &xDecrypter)
Enables decryption of record contents for the rest of the stream.
Definition: xistream.cxx:507
OUString ReadUniString()
Reads 16 bit character count, 8 bit flags, ext.
Definition: xistream.cxx:905
XclImpDecrypterRef mxDecrypter
Filter root data.
Definition: xistream.hxx:520
bool mbUseDecr
Automatic CONTINUE lookup on/off.
Definition: xistream.hxx:547
void CopyDecrypterFrom(const XclImpStream &rStrm)
Sets decrypter from another stream.
Definition: xistream.cxx:514
XclImpStream(SvStream &rInStrm, const XclImpRoot &rRoot)
Constructs the Excel record import stream using a TOOLS stream object.
Definition: xistream.cxx:427
sal_Int32 ReadInt32()
Definition: xistream.cxx:667
OUString ReadRawByteString(sal_uInt16 nChars)
Reads nChar byte characters and returns the string.
Definition: xistream.cxx:949
OUString ReadByteString(bool b16BitLen)
Reads 8/16 bit string length, character array and returns the string.
Definition: xistream.cxx:959
void RewindRecord()
Sets stream pointer before current record and invalidates stream.
Definition: xistream.cxx:501
std::size_t GetRecSize()
Returns the data size of the whole record without record headers.
Definition: xistream.cxx:569
double ReadDouble()
Definition: xistream.cxx:703
sal_uInt16 mnRawRecLeft
Current raw record size (without following CONTINUEs).
Definition: xistream.hxx:542
const XclImpRoot & GetRoot() const
Returns the filter root data.
Definition: xistream.hxx:293
#define ERRCODE_NONE
void SvStream & rStrm
unsigned char sal_uInt8
sal_uInt16 sal_Unicode
std::shared_ptr< XclImpDecrypter > XclImpDecrypterRef
Definition: xistream.hxx:40
XclBiff
An enumeration for all Excel file format types (BIFF types).
Definition: xlconst.hxx:30
const sal_uInt16 EXC_ID_UNKNOWN
Definition: xlstream.hxx:35