diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2012-04-09 13:34:35 +0200 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2012-04-09 13:35:24 +0200 |
commit | 26398f9dbf7134f79993f2f8258613124ac2483b (patch) | |
tree | 68270308f34c1abdaa71336fd06f4d70455d74ae /sc/source | |
parent | 238ad07d7aa56231ff1a6f812656f89f1c193d73 (diff) |
cleaning in oox part
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/filter/inc/biffinputstream.hxx | 3 | ||||
-rw-r--r-- | sc/source/filter/inc/excelhandlers.hxx | 12 | ||||
-rw-r--r-- | sc/source/filter/inc/pivottablefragment.hxx | 15 | ||||
-rw-r--r-- | sc/source/filter/inc/querytablefragment.hxx | 14 | ||||
-rw-r--r-- | sc/source/filter/inc/sheetdatacontext.hxx | 57 | ||||
-rw-r--r-- | sc/source/filter/inc/workbookhelper.hxx | 2 | ||||
-rw-r--r-- | sc/source/filter/oox/biffinputstream.cxx | 5 | ||||
-rw-r--r-- | sc/source/filter/oox/excelhandlers.cxx | 6 | ||||
-rw-r--r-- | sc/source/filter/oox/pivottablefragment.cxx | 22 | ||||
-rw-r--r-- | sc/source/filter/oox/querytablefragment.cxx | 17 | ||||
-rw-r--r-- | sc/source/filter/oox/sheetdatacontext.cxx | 429 | ||||
-rw-r--r-- | sc/source/filter/oox/workbookhelper.cxx | 59 |
12 files changed, 0 insertions, 641 deletions
diff --git a/sc/source/filter/inc/biffinputstream.hxx b/sc/source/filter/inc/biffinputstream.hxx index 47ee2b0d4637..dd931dd8839f 100644 --- a/sc/source/filter/inc/biffinputstream.hxx +++ b/sc/source/filter/inc/biffinputstream.hxx @@ -227,9 +227,6 @@ public: /** Closes the input stream but not the wrapped stream. */ virtual void close(); - /** Returns the absolute position in the wrapped binary stream. */ - sal_Int64 tellBase() const; - // BinaryInputStream interface (stream read access) ----------------------- /** Reads nBytes bytes to the passed sequence. diff --git a/sc/source/filter/inc/excelhandlers.hxx b/sc/source/filter/inc/excelhandlers.hxx index 2051a558b4b1..56e47fddcf64 100644 --- a/sc/source/filter/inc/excelhandlers.hxx +++ b/sc/source/filter/inc/excelhandlers.hxx @@ -205,18 +205,6 @@ protected: // ---------------------------------------------------------------------------- -/** Fragment handler derived from the WorksheetHelper helper class. - - Used to import sheet fragments. - */ -class BiffWorksheetFragmentBase : public BiffFragmentHandler, public WorksheetHelper -{ -protected: - explicit BiffWorksheetFragmentBase( - const WorksheetHelper& rHelper, - const BiffWorkbookFragmentBase& rParent ); -}; - } // namespace xls } // namespace oox diff --git a/sc/source/filter/inc/pivottablefragment.hxx b/sc/source/filter/inc/pivottablefragment.hxx index 5053c726ccb1..6e09312129ee 100644 --- a/sc/source/filter/inc/pivottablefragment.hxx +++ b/sc/source/filter/inc/pivottablefragment.hxx @@ -96,21 +96,6 @@ private: }; // ============================================================================ -// ============================================================================ - -class BiffPivotTableContext : public BiffWorksheetContextBase -{ -public: - explicit BiffPivotTableContext( const WorksheetHelper& rHelper ); - - /** Imports all records related to the current pivot table. */ - virtual void importRecord( BiffInputStream& rStrm ); - -private: - PivotTable& mrPivotTable; -}; - -// ============================================================================ } // namespace xls } // namespace oox diff --git a/sc/source/filter/inc/querytablefragment.hxx b/sc/source/filter/inc/querytablefragment.hxx index 5609eb0d065c..5a01a040fc9f 100644 --- a/sc/source/filter/inc/querytablefragment.hxx +++ b/sc/source/filter/inc/querytablefragment.hxx @@ -57,20 +57,6 @@ private: // ============================================================================ -class BiffQueryTableContext : public BiffWorksheetContextBase -{ -public: - explicit BiffQueryTableContext( const WorksheetHelper& rHelper ); - - /** Imports all records related to the current query table. */ - virtual void importRecord( BiffInputStream& rStrm ); - -private: - QueryTable& mrQueryTable; -}; - -// ============================================================================ - } // namespace xls } // namespace oox diff --git a/sc/source/filter/inc/sheetdatacontext.hxx b/sc/source/filter/inc/sheetdatacontext.hxx index 324b12a1837c..05c876865c77 100644 --- a/sc/source/filter/inc/sheetdatacontext.hxx +++ b/sc/source/filter/inc/sheetdatacontext.hxx @@ -130,63 +130,6 @@ private: // ============================================================================ -/** This class implements importing row settings and all cells of a sheet. - */ -class BiffSheetDataContext : public BiffWorksheetContextBase, private SheetDataContextBase -{ -public: - explicit BiffSheetDataContext( const WorksheetHelper& rHelper ); - - /** Tries to import a sheet data record. */ - virtual void importRecord( BiffInputStream& rStrm ); - -private: - /** Imports row settings from a ROW record. */ - void importRow( BiffInputStream& rStrm ); - - /** Reads an XF identifier and initializes a new cell. */ - bool readCellXfId( BiffInputStream& rStrm, const BinAddress& rAddr, bool bBiff2 ); - /** Reads a BIFF cell address and the following XF identifier. */ - bool readCellHeader( BiffInputStream& rStrm, bool bBiff2 ); - /** Reads the formula range used by shared formulas, arrays, and data tables. */ - bool readFormulaRef( BiffInputStream& rStrm ); - - /** Imports a BLANK record describing a blank but formatted cell. */ - void importBlank( BiffInputStream& rStrm ); - /** Imports a BOOLERR record describing a boolean or error code cell. */ - void importBoolErr( BiffInputStream& rStrm ); - /** Imports a FORMULA record describing a formula cell. */ - void importFormula( BiffInputStream& rStrm ); - /** Imports an INTEGER record describing a BIFF2 integer cell. */ - void importInteger( BiffInputStream& rStrm ); - /** Imports a LABEL record describing an unformatted string cell. */ - void importLabel( BiffInputStream& rStrm ); - /** Imports a LABELSST record describing a string cell using the shared string list. */ - void importLabelSst( BiffInputStream& rStrm ); - /** Imports a MULTBLANK record describing a range of blank but formatted cells. */ - void importMultBlank( BiffInputStream& rStrm ); - /** Imports a MULTRK record describing a range of numeric cells. */ - void importMultRk( BiffInputStream& rStrm ); - /** Imports a NUMBER record describing a floating-point cell. */ - void importNumber( BiffInputStream& rStrm ); - /** Imports an RK record describing a numeric cell. */ - void importRk( BiffInputStream& rStrm ); - - /** Imports an ARRAY record describing an array formula of a cell range. */ - void importArray( BiffInputStream& rStrm ); - /** Imports table operation from a DATATABLE or DATATABLE2 record. */ - void importDataTable( BiffInputStream& rStrm ); - /** Imports a SHAREDFMLA record describing a shared formula in a cell range. */ - void importSharedFmla( BiffInputStream& rStrm ); - -private: - sal_uInt32 mnFormulaSkipSize; /// Number of bytes to be ignored in FORMULA record. - sal_uInt32 mnArraySkipSize; /// Number of bytes to be ignored in ARRAY record. - sal_uInt16 mnBiff2XfId; /// Current XF identifier from IXFE record. - OptValue< bool > mobBiff2HasXfs; /// Select XF formatting or direct formatting in BIFF2. -}; - -// ============================================================================ } // namespace xls } // namespace oox diff --git a/sc/source/filter/inc/workbookhelper.hxx b/sc/source/filter/inc/workbookhelper.hxx index e1f00ae91299..10a903ecd892 100644 --- a/sc/source/filter/inc/workbookhelper.hxx +++ b/sc/source/filter/inc/workbookhelper.hxx @@ -280,8 +280,6 @@ public: /** Returns the text encoding used to import/export byte strings. */ rtl_TextEncoding getTextEncoding() const; - /** Sets text encoding from the default application font, if CODEPAGE record is missing. */ - void setAppFontEncoding( rtl_TextEncoding eAppFontEnc ); /** Returns the codec helper that stores the encoder/decoder object. */ BiffCodecHelper& getCodecHelper() const; diff --git a/sc/source/filter/oox/biffinputstream.cxx b/sc/source/filter/oox/biffinputstream.cxx index 535359bf8e17..30a24d9dd9ef 100644 --- a/sc/source/filter/oox/biffinputstream.cxx +++ b/sc/source/filter/oox/biffinputstream.cxx @@ -275,11 +275,6 @@ void BiffInputStream::close() { } -sal_Int64 BiffInputStream::tellBase() const -{ - return maRecBuffer.getBaseStream().tell(); -} - // BinaryInputStream interface (stream read access) --------------------------- sal_Int32 BiffInputStream::readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize ) diff --git a/sc/source/filter/oox/excelhandlers.cxx b/sc/source/filter/oox/excelhandlers.cxx index 5d05dacf7197..83701776d888 100644 --- a/sc/source/filter/oox/excelhandlers.cxx +++ b/sc/source/filter/oox/excelhandlers.cxx @@ -127,12 +127,6 @@ BiffWorkbookFragmentBase::BiffWorkbookFragmentBase( const WorkbookHelper& rHelpe // ---------------------------------------------------------------------------- -BiffWorksheetFragmentBase::BiffWorksheetFragmentBase( const WorksheetHelper& rHelper, const BiffWorkbookFragmentBase& rParent ) : - BiffFragmentHandler( rParent ), - WorksheetHelper( rHelper ) -{ -} - } // namespace xls } // namespace oox diff --git a/sc/source/filter/oox/pivottablefragment.cxx b/sc/source/filter/oox/pivottablefragment.cxx index 76310bfb2a3d..85c10f9d7aa1 100644 --- a/sc/source/filter/oox/pivottablefragment.cxx +++ b/sc/source/filter/oox/pivottablefragment.cxx @@ -293,28 +293,6 @@ const RecordInfo* PivotTableFragment::getRecordInfos() const } // ============================================================================ -// ============================================================================ - -BiffPivotTableContext::BiffPivotTableContext( const WorksheetHelper& rHelper ) : - BiffWorksheetContextBase( rHelper ), - mrPivotTable( getPivotTables().createPivotTable() ) -{ -} - -void BiffPivotTableContext::importRecord( BiffInputStream& rStrm ) -{ - switch( rStrm.getRecId() ) - { - case BIFF_ID_PTDEFINITION: mrPivotTable.importPTDefinition( rStrm, getSheetIndex() ); break; - case BIFF_ID_PTDEFINITION2: mrPivotTable.importPTDefinition2( rStrm ); break; - case BIFF_ID_PTFIELD: mrPivotTable.createTableField().importPTField( rStrm ); break; - case BIFF_ID_PTROWCOLFIELDS: mrPivotTable.importPTRowColFields( rStrm ); break; - case BIFF_ID_PTPAGEFIELDS: mrPivotTable.importPTPageFields( rStrm ); break; - case BIFF_ID_PTDATAFIELD: mrPivotTable.importPTDataField( rStrm ); break; - } -} - -// ============================================================================ } // namespace xls } // namespace oox diff --git a/sc/source/filter/oox/querytablefragment.cxx b/sc/source/filter/oox/querytablefragment.cxx index ad4ca130f062..247630dbf064 100644 --- a/sc/source/filter/oox/querytablefragment.cxx +++ b/sc/source/filter/oox/querytablefragment.cxx @@ -85,23 +85,6 @@ const RecordInfo* QueryTableFragment::getRecordInfos() const // ============================================================================ -BiffQueryTableContext::BiffQueryTableContext( const WorksheetHelper& rHelper ) : - BiffWorksheetContextBase( rHelper ), - mrQueryTable( getQueryTables().createQueryTable() ) -{ -} - -void BiffQueryTableContext::importRecord( BiffInputStream& rStrm ) -{ - switch( rStrm.getRecId() ) - { - case BIFF_ID_QUERYTABLE: mrQueryTable.importQueryTable( rStrm ); break; - case BIFF_ID_QUERYTABLEREFRESH: mrQueryTable.importQueryTableRefresh( rStrm ); break; - case BIFF_ID_QUERYTABLESETTINGS: mrQueryTable.importQueryTableSettings( rStrm ); break; - } -} - -// ============================================================================ } // namespace xls } // namespace oox diff --git a/sc/source/filter/oox/sheetdatacontext.cxx b/sc/source/filter/oox/sheetdatacontext.cxx index c087418c7371..266eb470c5ee 100644 --- a/sc/source/filter/oox/sheetdatacontext.cxx +++ b/sc/source/filter/oox/sheetdatacontext.cxx @@ -574,435 +574,6 @@ void SheetDataContext::importSharedFmla( SequenceInputStream& rStrm ) // ============================================================================ -BiffSheetDataContext::BiffSheetDataContext( const WorksheetHelper& rHelper ) : - BiffWorksheetContextBase( rHelper ), - SheetDataContextBase( rHelper ), - mnBiff2XfId( 0 ) -{ - switch( getBiff() ) - { - case BIFF2: - mnFormulaSkipSize = 9; // double formula result, 1 byte flags - mnArraySkipSize = 1; // recalc-always flag - break; - case BIFF3: - case BIFF4: - mnFormulaSkipSize = 10; // double formula result, 2 byte flags - mnArraySkipSize = 2; // 2 byte flags - break; - case BIFF5: - case BIFF8: - mnFormulaSkipSize = 14; // double formula result, 2 byte flags, 4 bytes nothing - mnArraySkipSize = 6; // 2 byte flags, 4 bytes nothing - break; - case BIFF_UNKNOWN: - break; - } -} - -void BiffSheetDataContext::importRecord( BiffInputStream& rStrm ) -{ - sal_uInt16 nRecId = rStrm.getRecId(); - switch( nRecId ) - { - // records in all BIFF versions - case BIFF2_ID_ARRAY: // #i72713# - case BIFF3_ID_ARRAY: importArray( rStrm ); break; - case BIFF2_ID_BLANK: - case BIFF3_ID_BLANK: importBlank( rStrm ); break; - case BIFF2_ID_BOOLERR: - case BIFF3_ID_BOOLERR: importBoolErr( rStrm ); break; - case BIFF2_ID_INTEGER: importInteger( rStrm ); break; - case BIFF_ID_IXFE: rStrm >> mnBiff2XfId; break; - case BIFF2_ID_LABEL: - case BIFF3_ID_LABEL: importLabel( rStrm ); break; - case BIFF2_ID_NUMBER: - case BIFF3_ID_NUMBER: importNumber( rStrm ); break; - case BIFF_ID_RK: importRk( rStrm ); break; - - // BIFF specific records - default: switch( getBiff() ) - { - case BIFF2: switch( nRecId ) - { - case BIFF2_ID_DATATABLE: importDataTable( rStrm ); break; - case BIFF2_ID_DATATABLE2: importDataTable( rStrm ); break; - case BIFF2_ID_FORMULA: importFormula( rStrm ); break; - case BIFF2_ID_ROW: importRow( rStrm ); break; - } - break; - - case BIFF3: switch( nRecId ) - { - case BIFF3_ID_DATATABLE: importDataTable( rStrm ); break; - case BIFF3_ID_FORMULA: importFormula( rStrm ); break; - case BIFF3_ID_ROW: importRow( rStrm ); break; - } - break; - - case BIFF4: switch( nRecId ) - { - case BIFF3_ID_DATATABLE: importDataTable( rStrm ); break; - case BIFF4_ID_FORMULA: importFormula( rStrm ); break; - case BIFF3_ID_ROW: importRow( rStrm ); break; - } - break; - - case BIFF5: switch( nRecId ) - { - case BIFF3_ID_DATATABLE: importDataTable( rStrm ); break; - case BIFF3_ID_FORMULA: - case BIFF4_ID_FORMULA: - case BIFF5_ID_FORMULA: importFormula( rStrm ); break; - case BIFF_ID_MULTBLANK: importMultBlank( rStrm ); break; - case BIFF_ID_MULTRK: importMultRk( rStrm ); break; - case BIFF3_ID_ROW: importRow( rStrm ); break; - case BIFF_ID_RSTRING: importLabel( rStrm ); break; - case BIFF_ID_SHAREDFMLA: importSharedFmla( rStrm ); break; - } - break; - - case BIFF8: switch( nRecId ) - { - case BIFF3_ID_DATATABLE: importDataTable( rStrm ); break; - case BIFF3_ID_FORMULA: - case BIFF4_ID_FORMULA: - case BIFF5_ID_FORMULA: importFormula( rStrm ); break; - case BIFF_ID_LABELSST: importLabelSst( rStrm ); break; - case BIFF_ID_MULTBLANK: importMultBlank( rStrm ); break; - case BIFF_ID_MULTRK: importMultRk( rStrm ); break; - case BIFF3_ID_ROW: importRow( rStrm ); break; - case BIFF_ID_RSTRING: importLabel( rStrm ); break; - case BIFF_ID_SHAREDFMLA: importSharedFmla( rStrm ); break; - } - break; - - case BIFF_UNKNOWN: - break; - } - } -} - -// private -------------------------------------------------------------------- - -void BiffSheetDataContext::importRow( BiffInputStream& rStrm ) -{ - RowModel aModel; - sal_uInt16 nRow, nFirstUsedCol, nFirstFreeCol, nHeight; - rStrm >> nRow >> nFirstUsedCol >> nFirstFreeCol >> nHeight; - if( getBiff() == BIFF2 ) - { - rStrm.skip( 2 ); - aModel.mbCustomFormat = rStrm.readuInt8() == BIFF2_ROW_CUSTOMFORMAT; - if( aModel.mbCustomFormat ) - { - rStrm.skip( 5 ); - aModel.mnXfId = rStrm.readuInt16(); - } - } - else - { - rStrm.skip( 4 ); - sal_uInt32 nFlags = rStrm.readuInt32(); - aModel.mnXfId = extractValue< sal_Int32 >( nFlags, 16, 12 ); - aModel.mnLevel = extractValue< sal_Int32 >( nFlags, 0, 3 ); - aModel.mbCustomFormat = getFlag( nFlags, BIFF_ROW_CUSTOMFORMAT ); - aModel.mbCustomHeight = getFlag( nFlags, BIFF_ROW_CUSTOMHEIGHT ); - aModel.mbShowPhonetic = getFlag( nFlags, BIFF_ROW_SHOWPHONETIC ); - aModel.mbHidden = getFlag( nFlags, BIFF_ROW_HIDDEN ); - aModel.mbCollapsed = getFlag( nFlags, BIFF_ROW_COLLAPSED ); - aModel.mbThickTop = getFlag( nFlags, BIFF_ROW_THICKTOP ); - aModel.mbThickBottom = getFlag( nFlags, BIFF_ROW_THICKBOTTOM ); - } - - // row index is 0-based in BIFF, but RowModel expects 1-based - aModel.mnRow = static_cast< sal_Int32 >( nRow ) + 1; - // row height is in twips in BIFF, convert to points - aModel.mfHeight = (nHeight & BIFF_ROW_HEIGHTMASK) / 20.0; - // set column spans - if( nFirstUsedCol < nFirstFreeCol ) - { - sal_Int32 nLastCol = ::std::min< sal_Int32 >( nFirstFreeCol - 1, mrAddressConv.getMaxApiAddress().Column ); - aModel.insertColSpan( ValueRange( nFirstUsedCol, nLastCol ) ); - } - - // set row properties in the current sheet - setRowModel( aModel ); -} - -bool BiffSheetDataContext::readCellXfId( BiffInputStream& rStrm, const BinAddress& rAddr, bool bBiff2 ) -{ - bool bValidAddr = mrAddressConv.convertToCellAddress( maCellData.maCellAddr, rAddr, mnSheet, true ); - if( bValidAddr ) - { - // update used area of the sheet - extendUsedArea( maCellData.maCellAddr ); - - // load the XF identifier according to current BIFF version - if( bBiff2 ) - { - /* #i71453# On first call, check if the file contains XF records - (by trying to access the first XF with index 0). If there are - no XFs, the explicit formatting information contained in each - cell record will be used instead. */ - if( !mobBiff2HasXfs ) - mobBiff2HasXfs = getStyles().getCellXf( 0 ).get() != 0; - // read formatting information (includes the XF identifier) - sal_uInt8 nFlags1, nFlags2, nFlags3; - rStrm >> nFlags1 >> nFlags2 >> nFlags3; - /* If the file contains XFs, extract and set the XF identifier, - otherwise get the explicit formatting. */ - if( mobBiff2HasXfs.get() ) - { - maCellData.mnXfId = extractValue< sal_Int32 >( nFlags1, 0, 6 ); - /* If the identifier is equal to 63, then the real identifier - is contained in the preceding IXFE record (stored in the - class member mnBiff2XfId). */ - if( maCellData.mnXfId == BIFF2_CELL_USEIXFE ) - maCellData.mnXfId = mnBiff2XfId; - } - else - { - /* Let the Xf class do the API conversion. Keeping the member - maCellData.mnXfId untouched will prevent to trigger the - usual XF formatting conversion later on. */ - PropertySet aPropSet( getCell( maCellData.maCellAddr ) ); - Xf::writeBiff2CellFormatToPropertySet( *this, aPropSet, nFlags1, nFlags2, nFlags3 ); - } - } - else - { - // BIFF3-BIFF8: 16-bit XF identifier - maCellData.mnXfId = rStrm.readuInt16(); - } - } - return bValidAddr; -} - -bool BiffSheetDataContext::readCellHeader( BiffInputStream& rStrm, bool bBiff2 ) -{ - BinAddress aAddr; - rStrm >> aAddr; - return readCellXfId( rStrm, aAddr, bBiff2 ); -} - -bool BiffSheetDataContext::readFormulaRef( BiffInputStream& rStrm ) -{ - BinRange aRange; - aRange.read( rStrm, false ); // columns always 8-bit - return mrAddressConv.convertToCellRange( maFmlaData.maFormulaRef, aRange, mnSheet, true, true ); -} - -void BiffSheetDataContext::importBlank( BiffInputStream& rStrm ) -{ - if( readCellHeader( rStrm, rStrm.getRecId() == BIFF2_ID_BLANK ) ) - mrSheetData.setBlankCell( maCellData ); -} - -void BiffSheetDataContext::importBoolErr( BiffInputStream& rStrm ) -{ - if( readCellHeader( rStrm, rStrm.getRecId() == BIFF2_ID_BOOLERR ) ) - { - sal_uInt8 nValue, nType; - rStrm >> nValue >> nType; - switch( nType ) - { - case BIFF_BOOLERR_BOOL: - maCellData.mnCellType = XML_b; - mrSheetData.setBooleanCell( maCellData, nValue != 0 ); - break; - case BIFF_BOOLERR_ERROR: - maCellData.mnCellType = XML_e; - mrSheetData.setErrorCell( maCellData, nValue ); - break; - default: - OSL_FAIL( "BiffSheetDataContext::importBoolErr - unknown cell type" ); - maCellData.mnCellType = XML_TOKEN_INVALID; - mrSheetData.setBlankCell( maCellData ); - break; - } - } -} - -void BiffSheetDataContext::importFormula( BiffInputStream& rStrm ) -{ - if( readCellHeader( rStrm, getBiff() == BIFF2 ) ) - { - maCellData.mnCellType = XML_n; - rStrm.skip( mnFormulaSkipSize ); - ApiTokenSequence aTokens = mrFormulaParser.importFormula( maCellData.maCellAddr, FORMULATYPE_CELL, rStrm ); - mrSheetData.setFormulaCell( maCellData, aTokens ); - } -} - -void BiffSheetDataContext::importInteger( BiffInputStream& rStrm ) -{ - if( readCellHeader( rStrm, true ) ) - { - maCellData.mnCellType = XML_n; - mrSheetData.setValueCell( maCellData, rStrm.readuInt16() ); - } -} - -void BiffSheetDataContext::importLabel( BiffInputStream& rStrm ) -{ - /* the deep secrets of BIFF type and record identifier... - record id BIFF -> XF type String type - 0x0004 2-7 -> 3 byte 8-bit length, byte string - 0x0004 8 -> 3 byte 16-bit length, unicode string - 0x0204 2-7 -> 2 byte 16-bit length, byte string - 0x0204 8 -> 2 byte 16-bit length, unicode string - */ - bool bBiff2Xf = rStrm.getRecId() == BIFF2_ID_LABEL; - if( readCellHeader( rStrm, bBiff2Xf ) ) - { - maCellData.mnCellType = XML_inlineStr; - if( getBiff() == BIFF8 ) - { - // string may contain rich-text formatting - RichStringRef xString( new RichString( *this ) ); - xString->importUniString( rStrm ); - xString->finalizeImport(); - mrSheetData.setStringCell( maCellData, xString ); - } - else - { - // #i63105# use text encoding from FONT record - rtl_TextEncoding eTextEnc = getTextEncoding(); - if( const Font* pFont = getStyles().getFontFromCellXf( maCellData.mnXfId ).get() ) - eTextEnc = pFont->getFontEncoding(); - // RSTRING record contains rich-text formatting - if( rStrm.getRecId() == BIFF_ID_RSTRING ) - { - BiffStringFlags nFlags = BIFF_STR_EXTRAFONTS; - // BIFF2 record identifier: 8-bit string length (see above) - setFlag( nFlags, BIFF_STR_8BITLENGTH, bBiff2Xf ); - RichStringRef xString( new RichString( *this ) ); - xString->importByteString( rStrm, eTextEnc, nFlags ); - xString->finalizeImport(); - mrSheetData.setStringCell( maCellData, xString ); - } - else - { - // BIFF2 record identifier: 8-bit string length (see above) - OUString aText = rStrm.readByteStringUC( !bBiff2Xf, eTextEnc ); - mrSheetData.setStringCell( maCellData, aText ); - } - } - } -} - -void BiffSheetDataContext::importLabelSst( BiffInputStream& rStrm ) -{ - if( readCellHeader( rStrm, false ) ) - { - maCellData.mnCellType = XML_s; - mrSheetData.setStringCell( maCellData, rStrm.readInt32() ); - } -} - -void BiffSheetDataContext::importMultBlank( BiffInputStream& rStrm ) -{ - BinAddress aAddr; - bool bValidAddr = true; - for( rStrm >> aAddr; bValidAddr && (rStrm.getRemaining() > 2); ++aAddr.mnCol ) - if( (bValidAddr = readCellXfId( rStrm, aAddr, false )) == true ) - mrSheetData.setBlankCell( maCellData ); -} - -void BiffSheetDataContext::importMultRk( BiffInputStream& rStrm ) -{ - BinAddress aAddr; - bool bValidAddr = true; - for( rStrm >> aAddr; bValidAddr && (rStrm.getRemaining() > 2); ++aAddr.mnCol ) - { - if( (bValidAddr = readCellXfId( rStrm, aAddr, false )) == true ) - { - maCellData.mnCellType = XML_n; - sal_Int32 nRkValue = rStrm.readInt32(); - mrSheetData.setValueCell( maCellData, BiffHelper::calcDoubleFromRk( nRkValue ) ); - } - } -} - -void BiffSheetDataContext::importNumber( BiffInputStream& rStrm ) -{ - if( readCellHeader( rStrm, rStrm.getRecId() == BIFF2_ID_NUMBER ) ) - { - maCellData.mnCellType = XML_n; - mrSheetData.setValueCell( maCellData, rStrm.readDouble() ); - } -} - -void BiffSheetDataContext::importRk( BiffInputStream& rStrm ) -{ - if( readCellHeader( rStrm, false ) ) - { - maCellData.mnCellType = XML_n; - mrSheetData.setValueCell( maCellData, BiffHelper::calcDoubleFromRk( rStrm.readInt32() ) ); - } -} - -void BiffSheetDataContext::importArray( BiffInputStream& rStrm ) -{ - if( readFormulaRef( rStrm ) && maFmlaData.isValidArrayRef( maCellData.maCellAddr ) ) - { - rStrm.skip( mnArraySkipSize ); - ApiTokenSequence aTokens = mrFormulaParser.importFormula( maCellData.maCellAddr, FORMULATYPE_ARRAY, rStrm ); - mrSheetData.createArrayFormula( maFmlaData.maFormulaRef, aTokens ); - } -} - -void BiffSheetDataContext::importDataTable( BiffInputStream& rStrm ) -{ - if( readFormulaRef( rStrm ) ) - { - DataTableModel aModel; - BinAddress aRef1, aRef2; - switch( rStrm.getRecId() ) - { - case BIFF2_ID_DATATABLE: - rStrm.skip( 1 ); - aModel.mbRowTable = rStrm.readuInt8() != 0; - aModel.mb2dTable = false; - rStrm >> aRef1; - break; - case BIFF2_ID_DATATABLE2: - rStrm.skip( 2 ); - aModel.mb2dTable = true; - rStrm >> aRef1 >> aRef2; - break; - case BIFF3_ID_DATATABLE: - { - sal_uInt16 nFlags; - rStrm >> nFlags >> aRef1 >> aRef2; - aModel.mbRowTable = getFlag( nFlags, BIFF_DATATABLE_ROW ); - aModel.mb2dTable = getFlag( nFlags, BIFF_DATATABLE_2D ); - aModel.mbRef1Deleted = getFlag( nFlags, BIFF_DATATABLE_REF1DEL ); - aModel.mbRef2Deleted = getFlag( nFlags, BIFF_DATATABLE_REF2DEL ); - } - break; - default: - OSL_FAIL( "BiffSheetDataContext::importDataTable - unknown record id" ); - } - aModel.maRef1 = FormulaProcessorBase::generateAddress2dString( aRef1, false ); - aModel.maRef2 = FormulaProcessorBase::generateAddress2dString( aRef2, false ); - mrSheetData.createTableOperation( maFmlaData.maFormulaRef, aModel ); - } -} - -void BiffSheetDataContext::importSharedFmla( BiffInputStream& rStrm ) -{ - if( readFormulaRef( rStrm ) && maFmlaData.isValidSharedRef( maCellData.maCellAddr ) ) - { - rStrm.skip( 2 ); // flags - ApiTokenSequence aTokens = mrFormulaParser.importFormula( maCellData.maCellAddr, FORMULATYPE_SHAREDFORMULA, rStrm ); - mrSheetData.createSharedFormula( maCellData.maCellAddr, aTokens ); - } -} - -// ============================================================================ - } // namespace xls } // namespace oox diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx index 5958d7bee067..736c5bd7510a 100644 --- a/sc/source/filter/oox/workbookhelper.cxx +++ b/sc/source/filter/oox/workbookhelper.cxx @@ -233,14 +233,8 @@ public: inline rtl_TextEncoding getTextEncoding() const { return meTextEnc; } /** Sets the text encoding to import/export byte strings. */ void setTextEncoding( rtl_TextEncoding eTextEnc ); - /** Sets code page read from a CODEPAGE record for byte string import. */ - void setCodePage( sal_uInt16 nCodePage ); /** Sets text encoding from the default application font, if CODEPAGE record is missing. */ void setAppFontEncoding( rtl_TextEncoding eAppFontEnc ); - /** Enables workbook file mode, used for BIFF4 workspace files. */ - void setIsWorkbookFile(); - /** Recreates global buffers that are used per sheet in specific BIFF versions. */ - void createBuffersPerSheet( sal_Int16 nSheet ); /** Returns the codec helper that stores the encoder/decoder object. */ inline BiffCodecHelper& getCodecHelper() { return *mxCodecHelper; } @@ -517,60 +511,12 @@ void WorkbookGlobals::setTextEncoding( rtl_TextEncoding eTextEnc ) meTextEnc = eTextEnc; } -void WorkbookGlobals::setCodePage( sal_uInt16 nCodePage ) -{ - setTextEncoding( BiffHelper::calcTextEncodingFromCodePage( nCodePage ) ); - mbHasCodePage = true; -} - void WorkbookGlobals::setAppFontEncoding( rtl_TextEncoding eAppFontEnc ) { if( !mbHasCodePage ) setTextEncoding( eAppFontEnc ); } -void WorkbookGlobals::setIsWorkbookFile() -{ - OSL_ENSURE( meBiff == BIFF4, "WorkbookGlobals::setIsWorkbookFile - invalid call" ); - mbWorkbook = true; -} - -void WorkbookGlobals::createBuffersPerSheet( sal_Int16 nSheet ) -{ - switch( meBiff ) - { - case BIFF2: - case BIFF3: - OSL_ENSURE( nSheet == 0, "WorkbookGlobals::createBuffersPerSheet - unexpected sheet index" ); - mxDefNames->setLocalCalcSheet( nSheet ); - break; - - case BIFF4: - OSL_ENSURE( mbWorkbook || (nSheet == 0), "WorkbookGlobals::createBuffersPerSheet - unexpected sheet index" ); - // #i11183# sheets in BIFF4W files have own styles and names - if( nSheet > 0 ) - { - mxStyles.reset( new StylesBuffer( *this ) ); - mxDefNames.reset( new DefinedNamesBuffer( *this ) ); - mxExtLinks.reset( new ExternalLinkBuffer( *this ) ); - } - mxDefNames->setLocalCalcSheet( nSheet ); - break; - - case BIFF5: - // BIFF5 stores external references per sheet - if( nSheet > 0 ) - mxExtLinks.reset( new ExternalLinkBuffer( *this ) ); - break; - - case BIFF8: - break; - - case BIFF_UNKNOWN: - break; - } -} - // private -------------------------------------------------------------------- void WorkbookGlobals::initialize( bool bWorkbookFile ) @@ -962,11 +908,6 @@ rtl_TextEncoding WorkbookHelper::getTextEncoding() const return mrBookGlob.getTextEncoding(); } -void WorkbookHelper::setAppFontEncoding( rtl_TextEncoding eAppFontEnc ) -{ - mrBookGlob.setAppFontEncoding( eAppFontEnc ); -} - BiffCodecHelper& WorkbookHelper::getCodecHelper() const { return mrBookGlob.getCodecHelper(); |