sc/Library_scfilt.mk | 1 sc/source/filter/inc/addressconverter.hxx | 2 sc/source/filter/inc/biffhelper.hxx | 7 sc/source/filter/inc/biffinputstream.hxx | 250 ---------------- sc/source/filter/inc/excelhandlers.hxx | 17 - sc/source/filter/inc/pivotcachebuffer.hxx | 25 - sc/source/filter/oox/addressconverter.cxx | 2 sc/source/filter/oox/autofilterbuffer.cxx | 2 sc/source/filter/oox/autofiltercontext.cxx | 1 sc/source/filter/oox/biffcodec.cxx | 1 sc/source/filter/oox/biffhelper.cxx | 13 sc/source/filter/oox/biffinputstream.cxx | 386 -------------------------- sc/source/filter/oox/chartsheetfragment.cxx | 1 sc/source/filter/oox/commentsbuffer.cxx | 1 sc/source/filter/oox/condformatbuffer.cxx | 2 sc/source/filter/oox/connectionsbuffer.cxx | 2 sc/source/filter/oox/defnamesbuffer.cxx | 2 sc/source/filter/oox/excelfilter.cxx | 1 sc/source/filter/oox/excelhandlers.cxx | 6 sc/source/filter/oox/externallinkbuffer.cxx | 1 sc/source/filter/oox/externallinkfragment.cxx | 1 sc/source/filter/oox/formulabase.cxx | 2 sc/source/filter/oox/formulaparser.cxx | 2 sc/source/filter/oox/numberformatsbuffer.cxx | 2 sc/source/filter/oox/pagesettings.cxx | 1 sc/source/filter/oox/pivotcachebuffer.cxx | 141 --------- sc/source/filter/oox/pivotcachefragment.cxx | 1 sc/source/filter/oox/pivottablebuffer.cxx | 2 sc/source/filter/oox/pivottablefragment.cxx | 2 sc/source/filter/oox/querytablebuffer.cxx | 2 sc/source/filter/oox/querytablefragment.cxx | 2 sc/source/filter/oox/richstring.cxx | 2 sc/source/filter/oox/scenariobuffer.cxx | 2 sc/source/filter/oox/sharedstringsbuffer.cxx | 2 sc/source/filter/oox/sheetdatabuffer.cxx | 1 sc/source/filter/oox/sheetdatacontext.cxx | 1 sc/source/filter/oox/stylesbuffer.cxx | 1 sc/source/filter/oox/tablecolumnsbuffer.cxx | 1 sc/source/filter/oox/tablecolumnscontext.cxx | 1 sc/source/filter/oox/viewsettings.cxx | 2 sc/source/filter/oox/workbookfragment.cxx | 1 sc/source/filter/oox/workbookhelper.cxx | 1 sc/source/filter/oox/workbooksettings.cxx | 3 sc/source/filter/oox/worksheetbuffer.cxx | 1 sc/source/filter/oox/worksheetfragment.cxx | 1 sc/source/filter/oox/worksheetsettings.cxx | 3 46 files changed, 18 insertions(+), 886 deletions(-)
New commits: commit 58b662141a955375c24614c7dd0aeac7c96e7366 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Wed Nov 2 14:44:14 2016 +0200 remove unused BiffInputStream Change-Id: If34bc1d5ea0e0153991d4891b88550e471b4ec07 Reviewed-on: https://gerrit.libreoffice.org/30489 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sc/Library_scfilt.mk b/sc/Library_scfilt.mk index 98445c8..467a2d6 100644 --- a/sc/Library_scfilt.mk +++ b/sc/Library_scfilt.mk @@ -166,7 +166,6 @@ $(eval $(call gb_Library_add_exception_objects,scfilt,\ sc/source/filter/oox/autofiltercontext \ sc/source/filter/oox/biffcodec \ sc/source/filter/oox/biffhelper \ - sc/source/filter/oox/biffinputstream \ sc/source/filter/oox/chartsheetfragment \ sc/source/filter/oox/commentsbuffer \ sc/source/filter/oox/commentsfragment \ diff --git a/sc/source/filter/inc/addressconverter.hxx b/sc/source/filter/inc/addressconverter.hxx index 2eafdb5..add5401 100644 --- a/sc/source/filter/inc/addressconverter.hxx +++ b/sc/source/filter/inc/addressconverter.hxx @@ -28,8 +28,6 @@ namespace oox { namespace xls { -class BiffInputStream; - /** A vector of com.sun.star.table.CellRangeAddress elements and additional functionality. */ class ApiCellRangeList diff --git a/sc/source/filter/inc/biffhelper.hxx b/sc/source/filter/inc/biffhelper.hxx index 834b327..c0d95907 100644 --- a/sc/source/filter/inc/biffhelper.hxx +++ b/sc/source/filter/inc/biffhelper.hxx @@ -27,8 +27,6 @@ namespace oox { class SequenceInputStream; } namespace oox { namespace xls { -class BiffInputStream; - // BIFF12 record identifiers ================================================== const sal_Int32 BIFF12_ID_ARRAY = 0x01AA; @@ -609,11 +607,6 @@ public: /** Reads a BIFF12 string with leading 16-bit or 32-bit length field. */ static OUString readString( SequenceInputStream& rStrm, bool b32BitLen = true, bool bAllowNulChars = false ); - // BIFF2-BIFF8 import ----------------------------------------------------- - - /** Returns true, if the current record of the stream is a BOF record. */ - static bool isBofRecord( BiffInputStream& rStrm ); - private: BiffHelper() = delete; ~BiffHelper() = delete; diff --git a/sc/source/filter/inc/biffinputstream.hxx b/sc/source/filter/inc/biffinputstream.hxx deleted file mode 100644 index 565426a..0000000 --- a/sc/source/filter/inc/biffinputstream.hxx +++ /dev/null @@ -1,250 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_SC_SOURCE_FILTER_INC_BIFFINPUTSTREAM_HXX -#define INCLUDED_SC_SOURCE_FILTER_INC_BIFFINPUTSTREAM_HXX - -#include <vector> -#include <oox/helper/binaryinputstream.hxx> -#include "biffhelper.hxx" -#include "biffcodec.hxx" - -namespace oox { -namespace xls { - -namespace prv { - -/** Buffers the contents of a raw record and encapsulates stream decoding. */ -class BiffInputRecordBuffer -{ -public: - explicit BiffInputRecordBuffer( BinaryInputStream& rInStrm ); - - /** Sets a decoder object and decrypts buffered record data. */ - void setDecoder( const BiffDecoderRef& rxDecoder ); - /** Enables/disables usage of current decoder. */ - void enableDecoder( bool bEnable ); - - /** Restarts the stream at the passed position. Buffer is invalid until the - next call of startRecord() or startNextRecord(). */ - void restartAt( sal_Int64 nPos ); - - /** Reads the record header at the passed position. */ - bool startRecord( sal_Int64 nHeaderPos ); - /** Reads the next record header from the stream. */ - bool startNextRecord(); - /** Returns the start position of the record header in the core stream. */ - sal_uInt16 getNextRecId(); - - /** Returns the start position of the record header in the core stream. */ - inline sal_Int64 getRecHeaderPos() const { return mnHeaderPos; } - /** Returns the current record identifier. */ - inline sal_uInt16 getRecId() const { return mnRecId; } - /** Returns the current record size. */ - inline sal_uInt16 getRecSize() const { return mnRecSize; } - /** Returns the number of remaining bytes in the current record body. */ - inline sal_uInt16 getRecLeft() const { return mnRecSize - mnRecPos; } - - /** Reads nBytes bytes to the existing buffer opData. Must NOT overread the source buffer. */ - void read( void* opData, sal_uInt16 nBytes ); - /** Ignores nBytes bytes. Must NOT overread the buffer. */ - void skip( sal_uInt16 nBytes ); - -private: - /** Updates data buffer from stream, if needed. */ - void updateBuffer(); - /** Updates decoded data from original data. */ - void updateDecoded(); - -private: - typedef ::std::vector< sal_uInt8 > DataBuffer; - - BinaryInputStream& mrInStrm; /// Core input stream. - DataBuffer maOriginalData; /// Original data read from stream. - DataBuffer maDecodedData; /// Decoded data. - DataBuffer* mpCurrentData; /// Points to data buffer currently in use. - BiffDecoderRef mxDecoder; /// Decoder object. - sal_Int64 mnHeaderPos; /// Stream start position of current record header. - sal_Int64 mnBodyPos; /// Stream start position of current record body. - sal_Int64 mnBufferBodyPos; /// Stream start position of buffered data. - sal_Int64 mnNextHeaderPos; /// Stream start position of next record header. - sal_uInt16 mnRecId; /// Current record identifier. - sal_uInt16 mnRecSize; /// Current record size. - sal_uInt16 mnRecPos; /// Current position in record body. - bool mbValidHeader; /// True = valid record header. -}; - -} // namespace prv - -/** This class is used to read BIFF record streams. - - An instance is constructed with a BinaryInputStream object. The passed - 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 (e.g. 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 by returning false. From now on the data - returned by the read functions is undefined. The error state will be reset, - if the next 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 setDecoder() and - enableDecoder() control the usage of the decryption algorithms. - setDecoder() sets a new decryption algorithm and initially enables it. - enableDecoder( false ) may be used to stop the usage of the decryption - temporarily (sometimes record contents are never encrypted, e.g. all BOF - records or the stream position in SHEET records). Decryption will be - reenabled automatically, if a new record is started with the function - startNextRecord(). -*/ -class BiffInputStream : public BinaryInputStream -{ -public: - /** Constructs the BIFF record stream using the passed binary stream. - - @param rInStream - The base input stream. Must be seekable. Will be sought to its - start position. - */ - explicit BiffInputStream( - BinaryInputStream& rInStream ); - - // record control --------------------------------------------------------- - - /** Sets stream pointer to the start of the next record content. - - Ignores all CONTINUE records of the current record, if automatic - CONTINUE usage is switched on. - - @return False = no record found (end of stream). - */ - bool startNextRecord(); - - /** Sets stream pointer before current record and invalidates stream. - - 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). - */ - void rewindRecord(); - - // decoder ---------------------------------------------------------------- - - /** Enables/disables usage of current decoder. - - Decryption is reenabled automatically, if a new record is started using - the function startNextRecord(). - */ - void enableDecoder(); - - // stream/record state and info ------------------------------------------- - - /** Returns the current record identifier. */ - inline sal_uInt16 getRecId() const { return mnRecId; } - /** Returns the record identifier of the following record. */ - sal_uInt16 getNextRecId(); - - /** Returns a unique handle for the current record that can be used with - the function startRecordByHandle(). */ - inline sal_Int64 getRecHandle() const { return mnRecHandle; } - - // BinaryStreamBase interface (seeking) ----------------------------------- - - /** Returns the data size of the whole record without record headers. */ - virtual sal_Int64 size() const override; - /** Returns the position inside of the whole record content. */ - virtual sal_Int64 tell() const override; - /** Seeks in record content to the specified position. */ - virtual void seek( sal_Int64 nRecPos ) override; - /** Closes the input stream but not the wrapped stream. */ - virtual void close() override; - - // BinaryInputStream interface (stream read access) ----------------------- - - /** Reads nBytes bytes to the passed sequence. - @return Number of bytes really read. */ - virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize = 1 ) override; - /** Reads nBytes bytes and copies them to the passed buffer opMem. - @return Number of bytes really read. */ - virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize = 1 ) override; - /** Seeks forward inside the current record. */ - virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 ) override; - - /** Stream operator for integral and floating-point types. */ - template< typename Type > - inline BiffInputStream& operator>>( Type& ornValue ) { ornValue = readValue<Type>(); return *this; } - - // byte strings ----------------------------------------------------------- - - /** Reads 16 bit string length and character array, and returns a Unicode string. - NUL characters are replaced by question marks (default). - @param eTextEnc The text encoding used to create the Unicode string. - */ - OUString readByteStringUC( rtl_TextEncoding eTextEnc ); - -private: - /** Initializes all members after base stream has been sought to new record. */ - void setupRecord(); - /** Restarts the current record from the beginning. */ - void restartRecord(); - /** Sets stream pointer before specified record and invalidates stream. */ - void rewindToRecord( sal_Int64 nRecHandle ); - /** Returns true, if stream was able to start a valid record. */ - inline bool isInRecord() const { return mnRecHandle >= 0; } - - /** Returns true, if the passed ID is real or alternative continuation record ID. */ - static bool isContinueId( sal_uInt16 nRecId ); - /** 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. - @return True if next CONTINUE record has been found and initialized. */ - bool jumpToNextContinue(); - /** Calculates the complete length of the current record including CONTINUE - records, stores the length in mnComplRecSize. */ - void calcRecordLength(); - - /** Returns the maximum size of raw data possible to read in one block. */ - sal_uInt16 getMaxRawReadSize( sal_Int32 nBytes, size_t nAtomSize ) const; - -private: - prv::BiffInputRecordBuffer maRecBuffer; /// Raw record data buffer. - - sal_Int64 mnRecHandle; /// Handle of current record. - sal_uInt16 mnRecId; /// Identifier of current record (not the CONTINUE ID). - - sal_Int64 mnCurrRecSize; /// Helper for record size and position. - sal_Int64 mnComplRecSize; /// Size of complete record data (with CONTINUEs). - bool mbHasComplRec; /// True = mnComplRecSize is valid. -}; - -} // namespace xls -} // namespace oox - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/filter/inc/excelhandlers.hxx b/sc/source/filter/inc/excelhandlers.hxx index 780da03..8d53918 100644 --- a/sc/source/filter/inc/excelhandlers.hxx +++ b/sc/source/filter/inc/excelhandlers.hxx @@ -76,23 +76,6 @@ public: }; -/** Context handler derived from the WorksheetHelper helper class. - Base class for all BIFF context handlers. - - Used to import contexts in sheet fragments. - */ -class BiffWorksheetContextBase : public WorksheetHelper -{ -protected: - explicit BiffWorksheetContextBase( const WorksheetHelper& rHelper ); -public: - /* - Derived handlers have to implement the importRecord() function that has to - import the record the passed BIFF input stream currently points to. - */ - virtual void importRecord( BiffInputStream& rStrm ) = 0; -}; - } // namespace xls } // namespace oox diff --git a/sc/source/filter/inc/pivotcachebuffer.hxx b/sc/source/filter/inc/pivotcachebuffer.hxx index 771c53f..a45e09c 100644 --- a/sc/source/filter/inc/pivotcachebuffer.hxx +++ b/sc/source/filter/inc/pivotcachebuffer.hxx @@ -72,19 +72,6 @@ public: /** Reads the index of a shared item. */ void readIndex( SequenceInputStream& rStrm ); - /** Reads the string value from a pivot cache item. */ - void readString( BiffInputStream& rStrm, const WorkbookHelper& rHelper ); - /** Reads the double value from a pivot cache item. */ - void readDouble( BiffInputStream& rStrm ); - /** Reads the integer value from a pivot cache item. */ - void readInteger( BiffInputStream& rStrm ); - /** Reads the date/time value from a pivot cache item. */ - void readDate( BiffInputStream& rStrm ); - /** Reads the boolean value from a pivot cache item. */ - void readBool( BiffInputStream& rStrm ); - /** Reads the error code value from a pivot cache item. */ - void readError( BiffInputStream& rStrm ); - /** Returns the type of the item. */ inline sal_Int32 getType() const { return mnType; } /** Returns the value of the item. */ @@ -112,8 +99,6 @@ public: void importItem( sal_Int32 nElement, const AttributeList& rAttribs ); /** Imports the item from the passed stream and record. */ void importItem( sal_Int32 nRecId, SequenceInputStream& rStrm ); - /** Imports a complete item list from the passed stream. */ - void importItemList( BiffInputStream& rStrm, sal_uInt16 nCount ); /** Returns true, if this item list is empty. */ inline bool empty() const { return maItems.empty(); } @@ -241,10 +226,6 @@ public: /** Imports one or more group items from the passed record. */ void importPCDFGroupItem( sal_Int32 nRecId, SequenceInputStream& rStrm ); - /** Imports numeric grouping settings from the PCDFRANGEPR record. */ - void importPCDFRangePr( BiffInputStream& rStrm ); - /** Imports the mapping between group items and base items from the PCDFDISCRETEPR record. */ - void importPCDFDiscretePr( BiffInputStream& rStrm ); /** Apply user Captions to imported group data */ void applyItemCaptions( const IdCaptionPairList& vCaptions ); @@ -303,9 +284,6 @@ public: /** Reads an item from the PCRECORD record and writes it to the passed sheet. */ void importPCRecordItem( SequenceInputStream& rStrm, WorksheetHelper& rSheetHelper, sal_Int32 nCol, sal_Int32 nRow ) const; - /** Reads an item index from the PCITEM_INDEXLIST record and writes the item to the passed sheet. */ - void importPCItemIndex( BiffInputStream& rStrm, - WorksheetHelper& rSheetHelper, sal_Int32 nCol, sal_Int32 nRow ) const; private: /** Tries to write the passed value to the passed sheet position. */ @@ -419,9 +397,6 @@ public: /** Reads a PCRECORD record and writes all item values to the passed sheet. */ void importPCRecord( SequenceInputStream& rStrm, WorksheetHelper& rSheetHelper, sal_Int32 nRowIdx ) const; - /** Reads a PCITEM_INDEXLIST record and writes all item values to the passed sheet. */ - void importPCItemIndexList( BiffInputStream& rStrm, - WorksheetHelper& rSheetHelper, sal_Int32 nRowIdx ) const; private: diff --git a/sc/source/filter/oox/addressconverter.cxx b/sc/source/filter/oox/addressconverter.cxx index 6d8c867..60fdb33 100644 --- a/sc/source/filter/oox/addressconverter.cxx +++ b/sc/source/filter/oox/addressconverter.cxx @@ -27,7 +27,7 @@ #include <rtl/ustrbuf.hxx> #include <oox/core/filterbase.hxx> #include <oox/helper/containerhelper.hxx> -#include "biffinputstream.hxx" +#include <oox/helper/binaryinputstream.hxx> namespace oox { namespace xls { diff --git a/sc/source/filter/oox/autofilterbuffer.cxx b/sc/source/filter/oox/autofilterbuffer.cxx index bc1687e..1aba425 100644 --- a/sc/source/filter/oox/autofilterbuffer.cxx +++ b/sc/source/filter/oox/autofilterbuffer.cxx @@ -31,11 +31,11 @@ #include <oox/helper/attributelist.hxx> #include <oox/helper/containerhelper.hxx> #include <oox/helper/propertyset.hxx> +#include <oox/helper/binaryinputstream.hxx> #include <oox/token/namespaces.hxx> #include <oox/token/properties.hxx> #include <oox/token/tokens.hxx> #include "addressconverter.hxx" -#include "biffinputstream.hxx" #include "defnamesbuffer.hxx" namespace oox { diff --git a/sc/source/filter/oox/autofiltercontext.cxx b/sc/source/filter/oox/autofiltercontext.cxx index 6f85055..db3eefd 100644 --- a/sc/source/filter/oox/autofiltercontext.cxx +++ b/sc/source/filter/oox/autofiltercontext.cxx @@ -20,7 +20,6 @@ #include "autofiltercontext.hxx" #include "autofilterbuffer.hxx" -#include "biffinputstream.hxx" #include <oox/token/namespaces.hxx> #include <oox/token/tokens.hxx> diff --git a/sc/source/filter/oox/biffcodec.cxx b/sc/source/filter/oox/biffcodec.cxx index 94a372a..55e1b5c 100644 --- a/sc/source/filter/oox/biffcodec.cxx +++ b/sc/source/filter/oox/biffcodec.cxx @@ -22,7 +22,6 @@ #include <osl/thread.h> #include <oox/helper/attributelist.hxx> #include <string.h> -#include "biffinputstream.hxx" namespace oox { namespace xls { diff --git a/sc/source/filter/oox/biffhelper.cxx b/sc/source/filter/oox/biffhelper.cxx index 1c86026..e253ca0 100644 --- a/sc/source/filter/oox/biffhelper.cxx +++ b/sc/source/filter/oox/biffhelper.cxx @@ -22,9 +22,9 @@ #include <rtl/math.hxx> #include <rtl/tencinfo.h> #include <osl/diagnose.h> -#include "biffinputstream.hxx" #include "worksheethelper.hxx" #include <oox/helper/binaryoutputstream.hxx> +#include <oox/helper/binaryinputstream.hxx> namespace oox { namespace xls { @@ -108,17 +108,6 @@ union DecodedDouble return aString; } -// BIFF2-BIFF8 import --------------------------------------------------------- - -/*static*/ bool BiffHelper::isBofRecord( BiffInputStream& rStrm ) -{ - return - (rStrm.getRecId() == BIFF2_ID_BOF) || - (rStrm.getRecId() == BIFF3_ID_BOF) || - (rStrm.getRecId() == BIFF4_ID_BOF) || - (rStrm.getRecId() == BIFF5_ID_BOF); -} - } // namespace xls } // namespace oox diff --git a/sc/source/filter/oox/biffinputstream.cxx b/sc/source/filter/oox/biffinputstream.cxx deleted file mode 100644 index 48e3518..0000000 --- a/sc/source/filter/oox/biffinputstream.cxx +++ /dev/null @@ -1,386 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "biffinputstream.hxx" - -#include <algorithm> -#include <rtl/ustrbuf.hxx> -#include <osl/diagnose.h> - -namespace oox { -namespace xls { - -namespace prv { - -BiffInputRecordBuffer::BiffInputRecordBuffer( BinaryInputStream& rInStrm ) : - mrInStrm( rInStrm ), - mpCurrentData( nullptr ), - mnHeaderPos( -1 ), - mnBodyPos( 0 ), - mnBufferBodyPos( 0 ), - mnNextHeaderPos( 0 ), - mnRecId( BIFF_ID_UNKNOWN ), - mnRecSize( 0 ), - mnRecPos( 0 ), - mbValidHeader( false ) -{ - OSL_ENSURE( mrInStrm.isSeekable(), "BiffInputRecordBuffer::BiffInputRecordBuffer - stream must be seekable" ); - mrInStrm.seekToStart(); - maOriginalData.reserve( SAL_MAX_UINT16 ); - maDecodedData.reserve( SAL_MAX_UINT16 ); - enableDecoder( false ); // updates mpCurrentData -} - -void BiffInputRecordBuffer::restartAt( sal_Int64 nPos ) -{ - mnHeaderPos = -1; - mnBodyPos = mnBufferBodyPos = 0; - mnNextHeaderPos = nPos; - mnRecId = BIFF_ID_UNKNOWN; - mnRecSize = mnRecPos = 0; - mbValidHeader = false; -} - -void BiffInputRecordBuffer::setDecoder( const BiffDecoderRef& rxDecoder ) -{ - mxDecoder = rxDecoder; - enableDecoder( true ); - updateDecoded(); -} - -void BiffInputRecordBuffer::enableDecoder( bool bEnable ) -{ - mpCurrentData = (bEnable && mxDecoder.get() && mxDecoder->isValid()) ? &maDecodedData : &maOriginalData; -} - -bool BiffInputRecordBuffer::startRecord( sal_Int64 nHeaderPos ) -{ - mbValidHeader = (0 <= nHeaderPos) && (nHeaderPos + 4 <= mrInStrm.size()); - if( mbValidHeader ) - { - mnHeaderPos = nHeaderPos; - mrInStrm.seek( nHeaderPos ); - mnRecId = mrInStrm.readuInt16(); - mnRecSize = mrInStrm.readuInt16(); - mnBodyPos = mrInStrm.tell(); - mnNextHeaderPos = mnBodyPos + mnRecSize; - mbValidHeader = !mrInStrm.isEof() && (mnNextHeaderPos <= mrInStrm.size()); - } - if( !mbValidHeader ) - { - mnHeaderPos = mnBodyPos = -1; - mnNextHeaderPos = 0; - mnRecId = BIFF_ID_UNKNOWN; - mnRecSize = 0; - } - mnRecPos = 0; - return mbValidHeader; -} - -bool BiffInputRecordBuffer::startNextRecord() -{ - return startRecord( mnNextHeaderPos ); -} - -sal_uInt16 BiffInputRecordBuffer::getNextRecId() -{ - sal_uInt16 nRecId = BIFF_ID_UNKNOWN; - if( mbValidHeader && (mnNextHeaderPos + 4 <= mrInStrm.size()) ) - { - mrInStrm.seek( mnNextHeaderPos ); - nRecId = mrInStrm.readuInt16(); - } - return nRecId; -} - -void BiffInputRecordBuffer::read( void* opData, sal_uInt16 nBytes ) -{ - updateBuffer(); - OSL_ENSURE( nBytes > 0, "BiffInputRecordBuffer::read - nothing to read" ); - OSL_ENSURE( nBytes <= getRecLeft(), "BiffInputRecordBuffer::read - buffer overflow" ); - memcpy( opData, &(*mpCurrentData)[ mnRecPos ], nBytes ); - mnRecPos = mnRecPos + nBytes; -} - -void BiffInputRecordBuffer::skip( sal_uInt16 nBytes ) -{ - OSL_ENSURE( nBytes > 0, "BiffInputRecordBuffer::skip - nothing to skip" ); - OSL_ENSURE( nBytes <= getRecLeft(), "BiffInputRecordBuffer::skip - buffer overflow" ); - mnRecPos = mnRecPos + nBytes; -} - -void BiffInputRecordBuffer::updateBuffer() -{ - OSL_ENSURE( mbValidHeader, "BiffInputRecordBuffer::updateBuffer - invalid access" ); - if( mnBodyPos != mnBufferBodyPos ) - { - mrInStrm.seek( mnBodyPos ); - maOriginalData.resize( mnRecSize ); - if( mnRecSize > 0 ) - mrInStrm.readMemory( &maOriginalData.front(), static_cast< sal_Int32 >( mnRecSize ) ); - mnBufferBodyPos = mnBodyPos; - updateDecoded(); - } -} - -void BiffInputRecordBuffer::updateDecoded() -{ - if( mxDecoder.get() && mxDecoder->isValid() ) - { - maDecodedData.resize( mnRecSize ); - if( mnRecSize > 0 ) - mxDecoder->decode( &maDecodedData.front(), &maOriginalData.front(), mnBodyPos, mnRecSize ); - } -} - -} // namespace prv - -BiffInputStream::BiffInputStream( BinaryInputStream& rInStream ) : - BinaryStreamBase( true ), - maRecBuffer( rInStream ), - mnRecHandle( -1 ), - mnRecId( BIFF_ID_UNKNOWN ), - mnCurrRecSize( 0 ), - mnComplRecSize( 0 ), - mbHasComplRec( false ) -{ - mbEof = true; // EOF will be true if stream is not inside a record -} - -// record control ------------------------------------------------------------- - -bool BiffInputStream::startNextRecord() -{ - bool bValidRec = false; - /* #i4266# ignore zero records (id==len==0) (e.g. the application - "Crystal Report" writes zero records between other records) */ - bool bIsZeroRec = false; - do - { - // record header is never encrypted - maRecBuffer.enableDecoder( false ); - // read header of next raw record, returns false at end of stream - bValidRec = maRecBuffer.startNextRecord(); - // ignore record, if identifier and size are zero - bIsZeroRec = (maRecBuffer.getRecId() == 0) && (maRecBuffer.getRecSize() == 0); - } - while( bValidRec && (isContinueId( maRecBuffer.getRecId()) || bIsZeroRec) ); - - // setup other class members - setupRecord(); - return isInRecord(); -} - -void BiffInputStream::rewindRecord() -{ - rewindToRecord( mnRecHandle ); -} - -// decoder -------------------------------------------------------------------- - -void BiffInputStream::enableDecoder() -{ - maRecBuffer.enableDecoder( true ); -} - -// stream/record state and info ----------------------------------------------- - -sal_uInt16 BiffInputStream::getNextRecId() -{ - sal_uInt16 nRecId = BIFF_ID_UNKNOWN; - if( isInRecord() ) - { - sal_Int64 nCurrPos = tell(); // save current position in record - while( jumpToNextContinue() ) {} // skip following CONTINUE records - if( maRecBuffer.startNextRecord() ) // read header of next record - nRecId = maRecBuffer.getRecId(); - seek( nCurrPos ); // restore position, seek() resets old mbValid state - } - return nRecId; -} - -// BinaryStreamBase interface (seeking) --------------------------------------- - -sal_Int64 BiffInputStream::size() const -{ - if( !mbHasComplRec ) - const_cast< BiffInputStream* >( this )->calcRecordLength(); - return mnComplRecSize; -} - -sal_Int64 BiffInputStream::tell() const -{ - return mbEof ? -1 : (mnCurrRecSize - maRecBuffer.getRecLeft()); -} - -void BiffInputStream::seek( sal_Int64 nRecPos ) -{ - if( isInRecord() ) - { - if( mbEof || (nRecPos < tell()) ) - restartRecord(); - if( !mbEof && (nRecPos > tell()) ) - skip( static_cast< sal_Int32 >( nRecPos - tell() ) ); - } -} - -void BiffInputStream::close() -{ -} - -// BinaryInputStream interface (stream read access) --------------------------- - -sal_Int32 BiffInputStream::readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize ) -{ - sal_Int32 nRet = 0; - if( !mbEof ) - { - orData.realloc( ::std::max< sal_Int32 >( nBytes, 0 ) ); - if( nBytes > 0 ) - nRet = readMemory( orData.getArray(), nBytes, nAtomSize ); - } - return nRet; -} - -sal_Int32 BiffInputStream::readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize ) -{ - sal_Int32 nRet = 0; - if( !mbEof && opMem && (nBytes > 0) ) - { - sal_uInt8* pnBuffer = static_cast< sal_uInt8* >( opMem ); - sal_Int32 nBytesLeft = nBytes; - - while( !mbEof && (nBytesLeft > 0) ) - { - sal_uInt16 nReadSize = getMaxRawReadSize( nBytesLeft, nAtomSize ); - // check nReadSize, stream may already be located at end of a raw record - if( nReadSize > 0 ) - { - maRecBuffer.read( pnBuffer, nReadSize ); - nRet += nReadSize; - pnBuffer += nReadSize; - nBytesLeft -= nReadSize; - } - if( nBytesLeft > 0 ) - jumpToNextContinue(); - OSL_ENSURE( !mbEof, "BiffInputStream::readMemory - record overread" ); - } - } - return nRet; -} - -void BiffInputStream::skip( sal_Int32 nBytes, size_t nAtomSize ) -{ - sal_Int32 nBytesLeft = nBytes; - while( !mbEof && (nBytesLeft > 0) ) - { - sal_uInt16 nSkipSize = getMaxRawReadSize( nBytesLeft, nAtomSize ); - // check nSkipSize, stream may already be located at end of a raw record - if( nSkipSize > 0 ) - { - maRecBuffer.skip( nSkipSize ); - nBytesLeft -= nSkipSize; - } - if( nBytesLeft > 0 ) - jumpToNextContinue(); - OSL_ENSURE( !mbEof, "BiffInputStream::skip - record overread" ); - } -} - -// byte strings --------------------------------------------------------------- - -OUString BiffInputStream::readByteStringUC( rtl_TextEncoding eTextEnc ) -{ - sal_Int32 nStrLen = readuInt16(); - return readCharArrayUC( nStrLen, eTextEnc ); -} - -// private -------------------------------------------------------------------- - -void BiffInputStream::setupRecord() -{ - // initialize class members - mnRecHandle = maRecBuffer.getRecHeaderPos(); - mnRecId = maRecBuffer.getRecId(); - mnCurrRecSize = mnComplRecSize = maRecBuffer.getRecSize(); - mbHasComplRec = false; - mbEof = !isInRecord(); - // enable decoder in new record - enableDecoder(); -} - -void BiffInputStream::restartRecord() -{ - if( isInRecord() ) - { - maRecBuffer.startRecord( getRecHandle() ); - mnCurrRecSize = maRecBuffer.getRecSize(); - mbEof = false; - } -} - -void BiffInputStream::rewindToRecord( sal_Int64 nRecHandle ) -{ - if( nRecHandle >= 0 ) - { - maRecBuffer.restartAt( nRecHandle ); - mnRecHandle = -1; - mbEof = true; // as long as the record is not started - } -} - -bool BiffInputStream::isContinueId( sal_uInt16 nRecId ) -{ - return (nRecId == BIFF_ID_CONT) || (nRecId == BIFF_ID_UNKNOWN); -} - -bool BiffInputStream::jumpToNextContinue() -{ - mbEof = mbEof || !isContinueId( maRecBuffer.getNextRecId() ) || !maRecBuffer.startNextRecord(); - if( !mbEof ) - mnCurrRecSize += maRecBuffer.getRecSize(); - return !mbEof; -} - -void BiffInputStream::calcRecordLength() -{ - sal_Int64 nCurrPos = tell(); // save current position in record - while( jumpToNextContinue() ) {} // jumpToNextContinue() adds up mnCurrRecSize - mnComplRecSize = mnCurrRecSize; - mbHasComplRec = true; - seek( nCurrPos ); // restore position, seek() resets old mbValid state -} - -sal_uInt16 BiffInputStream::getMaxRawReadSize( sal_Int32 nBytes, size_t nAtomSize ) const -{ - sal_uInt16 nMaxSize = getLimitedValue< sal_uInt16, sal_Int32 >( nBytes, 0, maRecBuffer.getRecLeft() ); - if( (0 < nMaxSize) && (nMaxSize < nBytes) && (nAtomSize > 1) ) - { - // check that remaining data in record buffer is a multiple of the passed atom size - sal_uInt16 nPadding = static_cast< sal_uInt16 >( nMaxSize % nAtomSize ); - OSL_ENSURE( nPadding == 0, "BiffInputStream::getMaxRawReadSize - alignment error" ); - nMaxSize = nMaxSize - nPadding; - } - return nMaxSize; -} - -} // namespace xls -} // namespace oox - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/filter/oox/chartsheetfragment.cxx b/sc/source/filter/oox/chartsheetfragment.cxx index c75c0dc..97e6a1c 100644 --- a/sc/source/filter/oox/chartsheetfragment.cxx +++ b/sc/source/filter/oox/chartsheetfragment.cxx @@ -22,7 +22,6 @@ #include <oox/helper/attributelist.hxx> #include <oox/token/namespaces.hxx> #include <oox/token/tokens.hxx> -#include "biffinputstream.hxx" #include "pagesettings.hxx" #include "viewsettings.hxx" #include "workbooksettings.hxx" diff --git a/sc/source/filter/oox/commentsbuffer.cxx b/sc/source/filter/oox/commentsbuffer.cxx index 098f72c..faea93f 100644 --- a/sc/source/filter/oox/commentsbuffer.cxx +++ b/sc/source/filter/oox/commentsbuffer.cxx @@ -31,7 +31,6 @@ #include <oox/helper/attributelist.hxx> #include <oox/vml/vmlshape.hxx> #include "addressconverter.hxx" -#include "biffinputstream.hxx" #include "drawingfragment.hxx" #include <svx/sdtaitm.hxx> #include "unitconverter.hxx" diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx index 8481d1e5..f08f8b6 100644 --- a/sc/source/filter/oox/condformatbuffer.cxx +++ b/sc/source/filter/oox/condformatbuffer.cxx @@ -27,13 +27,13 @@ #include <svl/intitem.hxx> #include <svl/sharedstringpool.hxx> #include <oox/core/filterbase.hxx> +#include <oox/helper/binaryinputstream.hxx> #include <oox/helper/attributelist.hxx> #include <oox/helper/containerhelper.hxx> #include <oox/helper/propertyset.hxx> #include <oox/token/properties.hxx> #include <oox/token/tokens.hxx> #include "addressconverter.hxx" -#include "biffinputstream.hxx" #include "stylesbuffer.hxx" #include "themebuffer.hxx" diff --git a/sc/source/filter/oox/connectionsbuffer.cxx b/sc/source/filter/oox/connectionsbuffer.cxx index 511575a..81e3497 100644 --- a/sc/source/filter/oox/connectionsbuffer.cxx +++ b/sc/source/filter/oox/connectionsbuffer.cxx @@ -23,7 +23,7 @@ #include <oox/helper/attributelist.hxx> #include <oox/token/namespaces.hxx> #include <oox/token/tokens.hxx> -#include "biffinputstream.hxx" +#include <oox/helper/binaryinputstream.hxx> namespace oox { namespace xls { diff --git a/sc/source/filter/oox/defnamesbuffer.cxx b/sc/source/filter/oox/defnamesbuffer.cxx index b03d78b..18c0aeb 100644 --- a/sc/source/filter/oox/defnamesbuffer.cxx +++ b/sc/source/filter/oox/defnamesbuffer.cxx @@ -28,11 +28,11 @@ #include <com/sun/star/sheet/XPrintAreas.hpp> #include <osl/diagnose.h> #include <rtl/ustrbuf.hxx> +#include <oox/helper/binaryinputstream.hxx> #include <oox/helper/attributelist.hxx> #include <oox/helper/propertyset.hxx> #include <oox/token/tokens.hxx> #include "addressconverter.hxx" -#include "biffinputstream.hxx" #include "externallinkbuffer.hxx" #include "formulaparser.hxx" #include "worksheetbuffer.hxx" diff --git a/sc/source/filter/oox/excelfilter.cxx b/sc/source/filter/oox/excelfilter.cxx index 5edaadf..36c3757 100644 --- a/sc/source/filter/oox/excelfilter.cxx +++ b/sc/source/filter/oox/excelfilter.cxx @@ -23,7 +23,6 @@ #include <osl/diagnose.h> #include <oox/helper/binaryinputstream.hxx> -#include "biffinputstream.hxx" #include "excelchartconverter.hxx" #include "excelvbaproject.hxx" #include "stylesbuffer.hxx" diff --git a/sc/source/filter/oox/excelhandlers.cxx b/sc/source/filter/oox/excelhandlers.cxx index 3dbb965..034779c 100644 --- a/sc/source/filter/oox/excelhandlers.cxx +++ b/sc/source/filter/oox/excelhandlers.cxx @@ -20,7 +20,6 @@ #include "excelhandlers.hxx" #include <oox/core/filterbase.hxx> -#include "biffinputstream.hxx" namespace oox { namespace xls { @@ -42,11 +41,6 @@ WorksheetFragmentBase::WorksheetFragmentBase( { } -BiffWorksheetContextBase::BiffWorksheetContextBase( const WorksheetHelper& rHelper ) : - WorksheetHelper( rHelper ) -{ -} - } // namespace xls } // namespace oox diff --git a/sc/source/filter/oox/externallinkbuffer.cxx b/sc/source/filter/oox/externallinkbuffer.cxx index 0530a7b..b16d58f 100644 --- a/sc/source/filter/oox/externallinkbuffer.cxx +++ b/sc/source/filter/oox/externallinkbuffer.cxx @@ -39,7 +39,6 @@ #include <oox/token/properties.hxx> #include <oox/token/tokens.hxx> #include "addressconverter.hxx" -#include "biffinputstream.hxx" #include "excelhandlers.hxx" #include "formulaparser.hxx" #include "worksheetbuffer.hxx" diff --git a/sc/source/filter/oox/externallinkfragment.cxx b/sc/source/filter/oox/externallinkfragment.cxx index 8246bec..d3f0bda 100644 --- a/sc/source/filter/oox/externallinkfragment.cxx +++ b/sc/source/filter/oox/externallinkfragment.cxx @@ -23,7 +23,6 @@ #include <oox/helper/attributelist.hxx> #include <oox/token/namespaces.hxx> #include <oox/token/tokens.hxx> -#include "biffinputstream.hxx" #include "defnamesbuffer.hxx" #include "sheetdatacontext.hxx" #include "unitconverter.hxx" diff --git a/sc/source/filter/oox/formulabase.cxx b/sc/source/filter/oox/formulabase.cxx index fcd792b..6247aaf 100644 --- a/sc/source/filter/oox/formulabase.cxx +++ b/sc/source/filter/oox/formulabase.cxx @@ -38,8 +38,8 @@ #include <sal/log.hxx> #include <oox/core/filterbase.hxx> #include <oox/helper/containerhelper.hxx> +#include <oox/helper/binaryinputstream.hxx> #include <oox/token/properties.hxx> -#include "biffinputstream.hxx" namespace oox { namespace xls { diff --git a/sc/source/filter/oox/formulaparser.cxx b/sc/source/filter/oox/formulaparser.cxx index 9c0cffb..3600fbf 100644 --- a/sc/source/filter/oox/formulaparser.cxx +++ b/sc/source/filter/oox/formulaparser.cxx @@ -29,8 +29,8 @@ #include <osl/diagnose.h> #include <oox/core/filterbase.hxx> #include <oox/token/properties.hxx> +#include <oox/helper/binaryinputstream.hxx> #include "addressconverter.hxx" -#include "biffinputstream.hxx" #include "defnamesbuffer.hxx" #include "externallinkbuffer.hxx" #include "tablebuffer.hxx" diff --git a/sc/source/filter/oox/numberformatsbuffer.cxx b/sc/source/filter/oox/numberformatsbuffer.cxx index f614767..31b2e24 100644 --- a/sc/source/filter/oox/numberformatsbuffer.cxx +++ b/sc/source/filter/oox/numberformatsbuffer.cxx @@ -34,11 +34,11 @@ #include <rtl/ustrbuf.hxx> #include <svl/intitem.hxx> #include <oox/core/filterbase.hxx> +#include <oox/helper/binaryinputstream.hxx> #include <oox/helper/attributelist.hxx> #include <oox/helper/propertymap.hxx> #include <oox/token/properties.hxx> #include <oox/token/tokens.hxx> -#include "biffinputstream.hxx" #include "scitems.hxx" #include "document.hxx" #include "ftools.hxx" diff --git a/sc/source/filter/oox/pagesettings.cxx b/sc/source/filter/oox/pagesettings.cxx index cfa29c1..ee4cf26 100644 --- a/sc/source/filter/oox/pagesettings.cxx +++ b/sc/source/filter/oox/pagesettings.cxx @@ -41,7 +41,6 @@ #include <oox/token/namespaces.hxx> #include <oox/token/properties.hxx> #include <oox/token/tokens.hxx> -#include "biffinputstream.hxx" #include "excelhandlers.hxx" #include "stylesbuffer.hxx" #include "unitconverter.hxx" diff --git a/sc/source/filter/oox/pivotcachebuffer.cxx b/sc/source/filter/oox/pivotcachebuffer.cxx index 9ea4b85..8c2397f 100644 --- a/sc/source/filter/oox/pivotcachebuffer.cxx +++ b/sc/source/filter/oox/pivotcachebuffer.cxx @@ -36,7 +36,6 @@ #include <oox/token/namespaces.hxx> #include <oox/token/properties.hxx> #include <oox/token/tokens.hxx> -#include "biffinputstream.hxx" #include "defnamesbuffer.hxx" #include "excelhandlers.hxx" #include "pivotcachefragment.hxx" @@ -102,9 +101,6 @@ const sal_uInt8 BIFF12_PCDEFINITION_SUPPORTDRILL = 0x08; const sal_uInt8 BIFF12_PCDWBSOURCE_HASRELID = 0x01; const sal_uInt8 BIFF12_PCDWBSOURCE_HASSHEET = 0x02; -const sal_uInt16 BIFF_PCDFRANGEPR_AUTOSTART = 0x0001; -const sal_uInt16 BIFF_PCDFRANGEPR_AUTOEND = 0x0002; - /** Adjusts the weird date format read from binary streams. @@ -214,50 +210,6 @@ void PivotCacheItem::readIndex( SequenceInputStream& rStrm ) mnType = XML_x; } -void PivotCacheItem::readString( BiffInputStream& rStrm, const WorkbookHelper& rHelper ) -{ - maValue <<= rStrm.readByteStringUC( rHelper.getTextEncoding() ); - mnType = XML_s; -} - -void PivotCacheItem::readDouble( BiffInputStream& rStrm ) -{ - maValue <<= rStrm.readDouble(); - mnType = XML_n; -} - -void PivotCacheItem::readInteger( BiffInputStream& rStrm ) -{ - maValue <<= rStrm.readInt16(); - mnType = XML_i; // fake, used for BIFF only -} - -void PivotCacheItem::readDate( BiffInputStream& rStrm ) -{ - css::util::DateTime aDateTime; - aDateTime.Year = rStrm.readuInt16(); - aDateTime.Month = rStrm.readuInt16(); - aDateTime.Day = rStrm.readuInt8(); - aDateTime.Hours = rStrm.readuInt8(); - aDateTime.Minutes = rStrm.readuInt8(); - aDateTime.Seconds = rStrm.readuInt8(); - lclAdjustBinDateTime( aDateTime ); - maValue <<= aDateTime; - mnType = XML_d; -} - -void PivotCacheItem::readBool( BiffInputStream& rStrm ) -{ - maValue <<= (rStrm.readuInt8() != 0); - mnType = XML_b; -} - -void PivotCacheItem::readError( BiffInputStream& rStrm ) -{ - maValue <<= static_cast< sal_Int32 >( rStrm.readuInt8() ); - mnType = XML_e; -} - void PivotCacheItem::setStringValue( const OUString& sString ) { mnType = XML_s; @@ -327,27 +279,6 @@ void PivotCacheItemList::importItem( sal_Int32 nRecId, SequenceInputStream& rStr } } -void PivotCacheItemList::importItemList( BiffInputStream& rStrm, sal_uInt16 nCount ) -{ - bool bLoop = true; - for( sal_uInt16 nItemIdx = 0; bLoop && (nItemIdx < nCount); ++nItemIdx ) - { - bLoop = rStrm.startNextRecord(); - if( bLoop ) switch( rStrm.getRecId() ) - { - case BIFF_ID_PCITEM_MISSING: createItem(); break; - case BIFF_ID_PCITEM_STRING: createItem().readString( rStrm, *this ); break; - case BIFF_ID_PCITEM_DOUBLE: createItem().readDouble( rStrm ); break; - case BIFF_ID_PCITEM_INTEGER: createItem().readInteger( rStrm ); break; - case BIFF_ID_PCITEM_DATE: createItem().readDate( rStrm ); break; - case BIFF_ID_PCITEM_BOOL: createItem().readBool( rStrm ); break; - case BIFF_ID_PCITEM_ERROR: createItem().readError( rStrm ); break; - default: rStrm.rewindRecord(); bLoop = false; - } - } - OSL_ENSURE( bLoop, "PivotCacheItemList::importItemList - could not read all cache item records" ); -} - const PivotCacheItem* PivotCacheItemList::getCacheItem( sal_Int32 nItemIdx ) const { return ContainerHelper::getVectorElement( maItems, nItemIdx ); @@ -606,60 +537,6 @@ void PivotCacheField::importPCDFGroupItem( sal_Int32 nRecId, SequenceInputStream maGroupItems.importItem( nRecId, rStrm ); } -void PivotCacheField::importPCDFRangePr( BiffInputStream& rStrm ) -{ - sal_uInt16 nFlags; - rStrm >> nFlags; - maFieldGroupModel.setBiffGroupBy( extractValue< sal_uInt8 >( nFlags, 2, 3 ) ); - maFieldGroupModel.mbRangeGroup = true; - maFieldGroupModel.mbDateGroup = maFieldGroupModel.mnGroupBy != XML_range; - maFieldGroupModel.mbAutoStart = getFlag( nFlags, BIFF_PCDFRANGEPR_AUTOSTART ); - maFieldGroupModel.mbAutoEnd = getFlag( nFlags, BIFF_PCDFRANGEPR_AUTOEND ); - - /* Start, end, and interval are stored in 3 separate item records. Type of - the items is dependent on numeric/date mode. Numeric groups expect - three PCITEM_DOUBLE records, date groups expect two PCITEM_DATE records - and one PCITEM_INT record. */ - PivotCacheItemList aLimits( *this ); - aLimits.importItemList( rStrm, 3 ); - OSL_ENSURE( aLimits.size() == 3, "PivotCacheField::importPCDFRangePr - missing grouping records" ); - const PivotCacheItem* pStartValue = aLimits.getCacheItem( 0 ); - const PivotCacheItem* pEndValue = aLimits.getCacheItem( 1 ); - const PivotCacheItem* pInterval = aLimits.getCacheItem( 2 ); - if( pStartValue && pEndValue && pInterval ) - { - if( maFieldGroupModel.mbDateGroup ) - { - bool bHasTypes = (pStartValue->getType() == XML_d) && (pEndValue->getType() == XML_d) && (pInterval->getType() == XML_i); - OSL_ENSURE( bHasTypes, "PivotCacheField::importPCDFRangePr - wrong data types in grouping items" ); - if( bHasTypes ) - { - maFieldGroupModel.maStartDate = pStartValue->getValue().get< css::util::DateTime >(); - maFieldGroupModel.maEndDate = pEndValue->getValue().get< css::util::DateTime >(); - maFieldGroupModel.mfInterval = pInterval->getValue().get< sal_Int16 >(); - } - } - else - { - bool bHasTypes = (pStartValue->getType() == XML_n) && (pEndValue->getType() == XML_n) && (pInterval->getType() == XML_n); - OSL_ENSURE( bHasTypes, "PivotCacheField::importPCDFRangePr - wrong data types in grouping items" ); - if( bHasTypes ) - { - maFieldGroupModel.mfStartValue = pStartValue->getValue().get< double >(); - maFieldGroupModel.mfEndValue = pEndValue->getValue().get< double >(); - maFieldGroupModel.mfInterval = pInterval->getValue().get< double >(); - } - } - } -} - -void PivotCacheField::importPCDFDiscretePr( BiffInputStream& rStrm ) -{ - sal_Int32 nCount = static_cast< sal_Int32 >( rStrm.size() / 2 ); - for( sal_Int32 nIndex = 0; !rStrm.isEof() && (nIndex < nCount); ++nIndex ) - maDiscreteItems.push_back( rStrm.readuInt16() ); -} - const PivotCacheItem* PivotCacheField::getCacheItem( sal_Int32 nItemIdx ) const { if( hasGroupItems() ) @@ -914,13 +791,6 @@ void PivotCacheField::importPCRecordItem( SequenceInputStream& rStrm, WorksheetH } } -void PivotCacheField::importPCItemIndex( BiffInputStream& rStrm, WorksheetHelper& rSheetHelper, sal_Int32 nCol, sal_Int32 nRow ) const -{ - OSL_ENSURE( hasSharedItems(), "PivotCacheField::importPCItemIndex - invalid call, no shared items found" ); - sal_Int32 nIndex = rStrm.readuInt8(); - writeSharedItemToSourceDataCell( rSheetHelper, nCol, nRow, nIndex ); -} - // private -------------------------------------------------------------------- void PivotCacheField::writeItemToSourceDataCell( WorksheetHelper& rSheetHelper, @@ -1197,17 +1067,6 @@ void PivotCache::importPCRecord( SequenceInputStream& rStrm, WorksheetHelper& rS (*aIt)->importPCRecordItem( rStrm, rSheetHelper, nCol, nRow ); } -void PivotCache::importPCItemIndexList( BiffInputStream& rStrm, WorksheetHelper& rSheetHelper, sal_Int32 nRowIdx ) const -{ - sal_Int32 nRow = maSheetSrcModel.maRange.StartRow + nRowIdx; - OSL_ENSURE( (maSheetSrcModel.maRange.StartRow < nRow) && (nRow <= maSheetSrcModel.maRange.EndRow), "PivotCache::importPCItemIndexList - invalid row index" ); - sal_Int32 nCol = maSheetSrcModel.maRange.StartColumn; - sal_Int32 nMaxCol = getAddressConverter().getMaxApiAddress().Col(); - for( PivotCacheFieldVector::const_iterator aIt = maDatabaseFields.begin(), aEnd = maDatabaseFields.end(); !rStrm.isEof() && (aIt != aEnd) && (nCol <= nMaxCol); ++aIt, ++nCol ) - if( (*aIt)->hasSharedItems() ) - (*aIt)->importPCItemIndex( rStrm, rSheetHelper, nCol, nRow ); -} - // private -------------------------------------------------------------------- void PivotCache::finalizeInternalSheetSource() diff --git a/sc/source/filter/oox/pivotcachefragment.cxx b/sc/source/filter/oox/pivotcachefragment.cxx index 5a3a784..4f9c7a3 100644 --- a/sc/source/filter/oox/pivotcachefragment.cxx +++ b/sc/source/filter/oox/pivotcachefragment.cxx @@ -24,7 +24,6 @@ #include <oox/token/namespaces.hxx> #include <oox/token/tokens.hxx> #include "addressconverter.hxx" -#include "biffinputstream.hxx" #include "formulabuffer.hxx" #include "pivotcachebuffer.hxx" #include "worksheetbuffer.hxx" diff --git a/sc/source/filter/oox/pivottablebuffer.cxx b/sc/source/filter/oox/pivottablebuffer.cxx index 04a432a..987cdc1 100644 --- a/sc/source/filter/oox/pivottablebuffer.cxx +++ b/sc/source/filter/oox/pivottablebuffer.cxx @@ -38,13 +38,13 @@ #include <com/sun/star/sheet/XDataPilotField.hpp> #include <com/sun/star/sheet/XDataPilotTablesSupplier.hpp> #include <com/sun/star/sheet/XSheetOperation.hpp> +#include <oox/helper/binaryinputstream.hxx> #include <oox/helper/attributelist.hxx> #include <oox/helper/containerhelper.hxx> #include <oox/helper/propertyset.hxx> #include <oox/token/properties.hxx> #include <oox/token/tokens.hxx> #include "addressconverter.hxx" -#include "biffinputstream.hxx" #include "dapiuno.hxx" #include "dpobject.hxx" diff --git a/sc/source/filter/oox/pivottablefragment.cxx b/sc/source/filter/oox/pivottablefragment.cxx index 7cb858b..4d65813 100644 --- a/sc/source/filter/oox/pivottablefragment.cxx +++ b/sc/source/filter/oox/pivottablefragment.cxx @@ -18,8 +18,6 @@ */ #include "pivottablefragment.hxx" - -#include "biffinputstream.hxx" #include "pivottablebuffer.hxx" #include <oox/token/namespaces.hxx> #include <oox/token/tokens.hxx> diff --git a/sc/source/filter/oox/querytablebuffer.cxx b/sc/source/filter/oox/querytablebuffer.cxx index bc09a62..ee432a9 100644 --- a/sc/source/filter/oox/querytablebuffer.cxx +++ b/sc/source/filter/oox/querytablebuffer.cxx @@ -25,11 +25,11 @@ #include <com/sun/star/sheet/XAreaLinks.hpp> #include <osl/diagnose.h> #include <oox/core/filterbase.hxx> +#include <oox/helper/binaryinputstream.hxx> #include <oox/helper/attributelist.hxx> #include <oox/token/properties.hxx> #include <oox/token/tokens.hxx> #include "addressconverter.hxx" -#include "biffinputstream.hxx" #include "connectionsbuffer.hxx" #include "defnamesbuffer.hxx" diff --git a/sc/source/filter/oox/querytablefragment.cxx b/sc/source/filter/oox/querytablefragment.cxx index e8643a7..85475f2 100644 --- a/sc/source/filter/oox/querytablefragment.cxx +++ b/sc/source/filter/oox/querytablefragment.cxx @@ -18,8 +18,6 @@ */ #include "querytablefragment.hxx" - -#include "biffinputstream.hxx" #include "querytablebuffer.hxx" #include <oox/token/namespaces.hxx> #include <oox/token/tokens.hxx> diff --git a/sc/source/filter/oox/richstring.cxx b/sc/source/filter/oox/richstring.cxx index 4573e74..c4e5f18 100644 --- a/sc/source/filter/oox/richstring.cxx +++ b/sc/source/filter/oox/richstring.cxx @@ -23,10 +23,10 @@ #include <com/sun/star/text/XText.hpp> #include <rtl/ustrbuf.hxx> #include <editeng/editobj.hxx> +#include <oox/helper/binaryinputstream.hxx> #include <oox/helper/attributelist.hxx> #include <oox/helper/propertyset.hxx> #include <oox/token/tokens.hxx> -#include "biffinputstream.hxx" #include "editutil.hxx" #include <vcl/svapp.hxx> diff --git a/sc/source/filter/oox/scenariobuffer.cxx b/sc/source/filter/oox/scenariobuffer.cxx index cde1f47..0060adf 100644 --- a/sc/source/filter/oox/scenariobuffer.cxx +++ b/sc/source/filter/oox/scenariobuffer.cxx @@ -26,13 +26,13 @@ #include <com/sun/star/sheet/XScenariosSupplier.hpp> #include <com/sun/star/sheet/XSpreadsheet.hpp> #include <com/sun/star/sheet/XSpreadsheetDocument.hpp> +#include <oox/helper/binaryinputstream.hxx> #include <oox/helper/attributelist.hxx> #include <oox/helper/containerhelper.hxx> #include <oox/helper/propertyset.hxx> #include <oox/token/properties.hxx> #include <oox/token/tokens.hxx> #include "addressconverter.hxx" -#include "biffinputstream.hxx" namespace oox { namespace xls { diff --git a/sc/source/filter/oox/sharedstringsbuffer.cxx b/sc/source/filter/oox/sharedstringsbuffer.cxx index 3d90c5a..c01c257 100644 --- a/sc/source/filter/oox/sharedstringsbuffer.cxx +++ b/sc/source/filter/oox/sharedstringsbuffer.cxx @@ -19,8 +19,6 @@ #include "sharedstringsbuffer.hxx" -#include "biffinputstream.hxx" - namespace oox { namespace xls { diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx b/sc/source/filter/oox/sheetdatabuffer.cxx index 1ebf76c..ba0ff4b 100644 --- a/sc/source/filter/oox/sheetdatabuffer.cxx +++ b/sc/source/filter/oox/sheetdatabuffer.cxx @@ -41,7 +41,6 @@ #include <oox/token/properties.hxx> #include <oox/token/tokens.hxx> #include "addressconverter.hxx" -#include "biffinputstream.hxx" #include "formulaparser.hxx" #include "sharedstringsbuffer.hxx" #include "unitconverter.hxx" diff --git a/sc/source/filter/oox/sheetdatacontext.cxx b/sc/source/filter/oox/sheetdatacontext.cxx index df763c1..9c47da5 100644 --- a/sc/source/filter/oox/sheetdatacontext.cxx +++ b/sc/source/filter/oox/sheetdatacontext.cxx @@ -28,7 +28,6 @@ #include <oox/token/namespaces.hxx> #include <oox/token/tokens.hxx> #include "addressconverter.hxx" -#include "biffinputstream.hxx" #include "formulaparser.hxx" #include "richstringcontext.hxx" #include "unitconverter.hxx" diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx index ea98677..c29ee10 100644 --- a/sc/source/filter/oox/stylesbuffer.cxx +++ b/sc/source/filter/oox/stylesbuffer.cxx @@ -67,7 +67,6 @@ #include <oox/token/namespaces.hxx> #include <oox/token/properties.hxx> #include <oox/token/tokens.hxx> -#include "biffinputstream.hxx" #include "condformatbuffer.hxx" #include "excelhandlers.hxx" #include "themebuffer.hxx" diff --git a/sc/source/filter/oox/tablecolumnsbuffer.cxx b/sc/source/filter/oox/tablecolumnsbuffer.cxx index 1cbb502..1ea875c 100644 --- a/sc/source/filter/oox/tablecolumnsbuffer.cxx +++ b/sc/source/filter/oox/tablecolumnsbuffer.cxx @@ -28,7 +28,6 @@ #include <oox/token/properties.hxx> #include <oox/token/tokens.hxx> #include "addressconverter.hxx" -#include "biffinputstream.hxx" #include "defnamesbuffer.hxx" #include "dbdata.hxx" diff --git a/sc/source/filter/oox/tablecolumnscontext.cxx b/sc/source/filter/oox/tablecolumnscontext.cxx index 4225f83..afecd1d 100644 --- a/sc/source/filter/oox/tablecolumnscontext.cxx +++ b/sc/source/filter/oox/tablecolumnscontext.cxx @@ -20,7 +20,6 @@ #include "tablecolumnscontext.hxx" #include "tablecolumnsbuffer.hxx" -#include "biffinputstream.hxx" #include <oox/token/namespaces.hxx> #include <oox/token/tokens.hxx> diff --git a/sc/source/filter/oox/viewsettings.cxx b/sc/source/filter/oox/viewsettings.cxx index c8d183f..b8d7cdb 100644 --- a/sc/source/filter/oox/viewsettings.cxx +++ b/sc/source/filter/oox/viewsettings.cxx @@ -31,6 +31,7 @@ #include <osl/diagnose.h> #include <unotools/mediadescriptor.hxx> #include <oox/core/filterbase.hxx> +#include <oox/helper/binaryinputstream.hxx> #include <oox/helper/attributelist.hxx> #include <oox/helper/containerhelper.hxx> #include <oox/helper/propertymap.hxx> @@ -38,7 +39,6 @@ #include <oox/token/properties.hxx> #include <oox/token/tokens.hxx> #include "addressconverter.hxx" -#include "biffinputstream.hxx" #include "unitconverter.hxx" #include "workbooksettings.hxx" #include "worksheetbuffer.hxx" diff --git a/sc/source/filter/oox/workbookfragment.cxx b/sc/source/filter/oox/workbookfragment.cxx index 18d2075..78b7686 100644 --- a/sc/source/filter/oox/workbookfragment.cxx +++ b/sc/source/filter/oox/workbookfragment.cxx @@ -30,7 +30,6 @@ #include <oox/token/namespaces.hxx> #include <oox/token/tokens.hxx> -#include "biffinputstream.hxx" #include "chartsheetfragment.hxx" #include "connectionsfragment.hxx" #include "externallinkbuffer.hxx" diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx index 096e695..580b430 100644 --- a/sc/source/filter/oox/workbookhelper.cxx +++ b/sc/source/filter/oox/workbookhelper.cxx @@ -41,7 +41,6 @@ #include <oox/token/properties.hxx> #include <vcl/msgbox.hxx> #include "addressconverter.hxx" -#include "biffinputstream.hxx" #include "biffcodec.hxx" #include "connectionsbuffer.hxx" #include "defnamesbuffer.hxx" diff --git a/sc/source/filter/oox/workbooksettings.cxx b/sc/source/filter/oox/workbooksettings.cxx index c8cc6bd..d52ceb4 100644 --- a/sc/source/filter/oox/workbooksettings.cxx +++ b/sc/source/filter/oox/workbooksettings.cxx @@ -25,12 +25,13 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <unotools/mediadescriptor.hxx> #include <oox/core/filterbase.hxx> +#include <oox/helper/binaryinputstream.hxx> #include <oox/helper/attributelist.hxx> #include <oox/helper/propertyset.hxx> #include <oox/core/xmlfilterbase.hxx> #include <oox/token/properties.hxx> #include <oox/token/tokens.hxx> -#include "biffinputstream.hxx" +#include "biffcodec.hxx" #include "unitconverter.hxx" namespace oox { diff --git a/sc/source/filter/oox/worksheetbuffer.cxx b/sc/source/filter/oox/worksheetbuffer.cxx index dfbd097..608657d 100644 --- a/sc/source/filter/oox/worksheetbuffer.cxx +++ b/sc/source/filter/oox/worksheetbuffer.cxx @@ -34,7 +34,6 @@ #include <oox/token/namespaces.hxx> #include <oox/token/properties.hxx> #include <oox/token/tokens.hxx> -#include "biffinputstream.hxx" #include "excelhandlers.hxx" #include "document.hxx" diff --git a/sc/source/filter/oox/worksheetfragment.cxx b/sc/source/filter/oox/worksheetfragment.cxx index c0998c1..c8aa6c6 100644 --- a/sc/source/filter/oox/worksheetfragment.cxx +++ b/sc/source/filter/oox/worksheetfragment.cxx @@ -27,7 +27,6 @@ #include "addressconverter.hxx" #include "autofilterbuffer.hxx" #include "autofiltercontext.hxx" -#include "biffinputstream.hxx" #include "commentsfragment.hxx" #include "condformatcontext.hxx" #include "drawingfragment.hxx" diff --git a/sc/source/filter/oox/worksheetsettings.cxx b/sc/source/filter/oox/worksheetsettings.cxx index a2eb396..1bbc7a8 100644 --- a/sc/source/filter/oox/worksheetsettings.cxx +++ b/sc/source/filter/oox/worksheetsettings.cxx @@ -21,10 +21,11 @@ #include <com/sun/star/util/XProtectable.hpp> #include <oox/core/filterbase.hxx> +#include <oox/helper/binaryinputstream.hxx> #include <oox/helper/attributelist.hxx> #include <oox/token/properties.hxx> #include <oox/token/tokens.hxx> -#include "biffinputstream.hxx" +#include "biffcodec.hxx" #include "pagesettings.hxx" #include "workbooksettings.hxx" #include "tabprotection.hxx" _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits