20 #include <document.hxx>
23 #include <globstr.hrc>
50 bool TryStartNextRecord(
XclImpStream& rIn, std::size_t nProgressBasePos)
103 STATE eCurrent = Z_BiffNull, ePrev = Z_BiffNull;
106 sal_uInt16 nBofLevel = 0;
113 std::size_t nProgressBasePos = 0;
114 std::size_t nProgressBaseSize = 0;
118 if( eCurrent == Z_Biff5E )
126 bool bValid = TryStartNextRecord(
aIn, nProgressBasePos);
160 if( eCurrent == Z_End )
163 if( eCurrent != Z_Biff5TPre && eCurrent != Z_Biff5WPre )
164 pProgress->ProgressAbs( nProgressBaseSize +
aIn.
GetSvStreamPos() - nProgressBasePos );
211 eCurrent = Z_Biff5WPre;
221 eCurrent = Z_Biff5TPre;
253 case 0x08:
Row25();
break;
289 case 0x44:
Ixfe();
break;
352 case 0x0208:
Row34();
break;
425 case 0x0208:
Row34();
break;
536 case 0x0208:
Row34();
break;
629 else if( (nOpcode == 0x000A) && nBofLevel )
631 else if( !nBofLevel )
637 case 0x08:
Row25();
break;
653 case 0x81:
Wsbool();
break;
656 case 0x0208:
Row34();
break;
685 case 0x0A:
Eof(); eCurrent = Z_Biff5E;
break;
708 case 0xBD:
Mulrk();
break;
732 eCurrent = Z_Biff5TPre;
748 "+ImportExcel::Read(): Doppel-Whopper-Workbook!" );
769 OSL_FAIL(
"*ImportExcel::Read(): Not possible state!" );
771 default: OSL_FAIL(
"-ImportExcel::Read(): state forgotten!" );
805 #ifdef EXC_INCL_DUMPER
808 if( aDumper.Dump(
aIn ) )
832 bool bInUserView =
false;
836 EXC_STATE_BEFORE_GLOBALS,
837 EXC_STATE_GLOBALS_PRE,
839 EXC_STATE_BEFORE_SHEET,
845 XclImpReadState eCurrent = EXC_STATE_BEFORE_GLOBALS;
854 std::size_t nProgressBasePos = 0;
855 std::size_t nProgressBaseSize = 0;
857 bool bSheetHasCodeName =
false;
859 std::vector<OUString> aCodeNames;
860 std::vector < SCTAB > nTabsWithNoCodeName;
864 sal_uInt16 nRecId = 0;
866 for (; eCurrent != EXC_STATE_END;
mnLastRecId = nRecId)
868 if( eCurrent == EXC_STATE_BEFORE_SHEET )
876 bool bValid = TryStartNextRecord(
aIn, nProgressBasePos);
880 eCurrent = EXC_STATE_END;
890 eCurrent = EXC_STATE_END;
906 eCurrent = EXC_STATE_SHEET_PRE;
917 OSL_FAIL(
"ImportExcel8::Read - double workbook globals" );
929 eCurrent = EXC_STATE_END;
939 case EXC_STATE_SHEET_PRE:
940 eCurrent = EXC_STATE_SHEET;
943 case EXC_STATE_SHEET:
945 eCurrent = EXC_STATE_END;
948 eCurrent = EXC_STATE_END;
952 if( eCurrent == EXC_STATE_END )
955 if( eCurrent != EXC_STATE_SHEET_PRE && eCurrent != EXC_STATE_GLOBALS_PRE )
956 pProgress->ProgressAbs( nProgressBaseSize +
aIn.
GetSvStreamPos() - nProgressBasePos );
967 OSL_ENSURE( !bInUserView,
"ImportExcel8::Read - nested user view settings" );
971 OSL_ENSURE( bInUserView,
"ImportExcel8::Read - not in user view settings" );
976 if( !bInUserView )
switch( eCurrent )
980 case EXC_STATE_BEFORE_GLOBALS:
984 OSL_ENSURE(
GetBiff() ==
EXC_BIFF8,
"ImportExcel8::Read - wrong BIFF version" );
988 eCurrent = EXC_STATE_GLOBALS_PRE;
996 eCurrent = EXC_STATE_SHEET_PRE;
997 bSheetHasCodeName =
false;
1005 case EXC_STATE_GLOBALS_PRE:
1020 eCurrent = EXC_STATE_GLOBALS;
1030 eCurrent = EXC_STATE_END;
1045 case EXC_STATE_GLOBALS:
1064 eCurrent = EXC_STATE_BEFORE_SHEET;
1104 case EXC_STATE_SHEET_PRE:
1126 eCurrent = EXC_STATE_SHEET;
1129 if ( !bSheetHasCodeName )
1137 aCodeNames.push_back( sCodeName );
1140 bSheetHasCodeName =
false;
1150 case 0x81:
Wsbool();
break;
1156 case 0x0208:
Row34();
break;
1160 case 0x0867:
FeatHdr();
break;
1161 case 0x0868:
Feat();
break;
1167 case EXC_STATE_SHEET:
1177 case EXC_ID_EOF:
Eof(); eCurrent = EXC_STATE_BEFORE_SHEET;
break;
1195 case 0x0010:
Delta();
break;
1198 case 0x00AE:
Scenman();
break;
1200 case 0x00BD:
Mulrk();
break;
1202 case 0x00D6:
Rstring();
break;
1205 case 0x0236:
TableOp();
break;
1271 for (
const auto& rTab : nTabsWithNoCodeName )
1276 OUStringBuffer
aBuf;
1277 aBuf.append(
"Sheet");
1278 aBuf.append(static_cast<sal_Int32>(nTab++));
1279 OUString sTmpName = aBuf.makeStringAndClear();
1281 if ( std::find(aCodeNames.begin(), aCodeNames.end(), sTmpName) == aCodeNames.end() )
1286 aCodeNames.push_back(sTmpName);
const sal_uInt16 EXC_ID_WQSETT
void ReadDV(XclImpStream &rStrm)
Reads a DV record and inserts validation data into the document.
XclImpValidationManager & GetValidationManager() const
void ReadCodeName(XclImpStream &rStrm, bool bGlobals)
Reads the CODENAME record and inserts the codename into the document.
const sal_uInt16 EXC_ID_SXPI
void ReadXF(XclImpStream &rStrm)
Reads an XF record.
const sal_uInt16 EXC_ID3_FORMULA
const sal_uInt16 EXC_ID2_DIMENSIONS
void ReadWindow2(XclImpStream &rStrm, bool bChart)
Reads a WINDOW2 record.
const sal_uInt16 EXC_ID_CONDFMT
const sal_uInt16 EXC_ID_LABELRANGES
void ReadPageBreaks(XclImpStream &rStrm)
Reads a HORIZONTALPAGEBREAKS or VERTICALPAGEBREAKS record.
sal_uInt16 GetNextRecId()
Returns the record ID of the following record.
ScDocumentImport & GetDocImport()
void ReadCenter(XclImpStream &rStrm)
Reads a HCENTER or VCENTER record.
void ReadExternsheet(XclImpStream &rStrm)
Reads the EXTERNSHEET record.
Contains all view settings for a single sheet.
Contains all XF records occurred in the file.
XclImpTabViewSettings & GetTabViewSettings() const
Returns the view settings of the current sheet.
void ReadSxvi(XclImpStream &rStrm)
Reads an SXVI record describing a new item of the current field.
const sal_uInt16 EXC_ID_SXIVD
XclImpNumFmtBuffer & GetNumFmtBuffer() const
Returns the number format buffer.
XclImpPivotTableManager & GetPivotTableManager() const
Returns the pivot table manager.
void ReadSxpi(XclImpStream &rStrm)
Reads an SXPI record containing page field data.
void ReadQsi(XclImpStream &rStrm)
Reads the QSI record and creates a new web query in the buffer.
void ReadName(XclImpStream &rStrm)
Reads a NAME record and creates an entry in this buffer.
sal_uInt16 GetRecId() const
Returns the current record ID.
Stores all drawing and OLE objects and additional data related to these objects.
const sal_uInt16 EXC_ID_PQRY
const sal_uInt16 EXC_ID2_LABEL
const sal_uInt16 EXC_ID_NOTE
const sal_uInt16 EXC_ID_EXTSST
const sal_uInt16 EXC_ID_SXVS
void ReadSxidstm(XclImpStream &rStrm)
Reads an SXIDSTM record containing a pivot cache stream identifier and the pivot cache.
virtual ErrCode Read() override
const sal_uInt16 EXC_ID_NAME
This buffer contains all internal defined names of the document.
const sal_uInt16 EXC_ID2_FORMULA
A simplified progress bar with only one segment.
const sal_uInt16 EXC_ID_MSODRAWINGGROUP
bool IsValid() const
Returns record reading state: false = record overread.
const sal_uInt16 EXC_ID_SELECTION
const sal_uInt16 EXC_ID3_BOOLERR
const sal_uInt16 EXC_ID8_IMGDATA
void ReadSxAddl(XclImpStream &rStrm)
Reads an SXADDL record that specifies additional info for pivot table.
const sal_uInt16 EXC_ID_USERSVIEWEND
XclImpObjectManager & GetObjectManager() const
Returns the drawing object manager.
ScDocument & GetDoc() const
Returns reference to the destination document (import) or source document (export).
Accessor class to ScDocument.
const sal_uInt16 EXC_ID5_BOF
ScfUInt32Vec maSheetOffsets
void CheckScTab(SCTAB nScTab)
Checks if the passed sheet index is valid.
const sal_uInt16 EXC_ID_CODENAME
void CreateScFormats()
Creates the number formats in the Calc document.
const sal_uInt16 EXC_ID_DCONNAME
const sal_uInt16 EXC_ID2_INTEGER
void ReadStyle(XclImpStream &rStrm)
Reads a STYLE record.
SC_DLLPUBLIC void SetVisible(SCTAB nTab, bool bVisible)
const sal_uInt16 EXC_ID_PRINTHEADERS
Left/right footer default margin in 1/100mm.
const XclImpRoot & GetRoot() const
Returns this root instance - for code readability in derived classes.
const sal_uInt16 EXC_ID_VCENTER
bool IsAdjustHeightLocked() const
void ReadSxvs(XclImpStream &rStrm)
Reads an SXVS record containing the source type of a pivot cache.
const sal_uInt16 EXC_ID_SCL
Single, top, left, or top-left pane.
const sal_uInt16 EXC_ID3_DIMENSIONS
const sal_uInt16 EXC_ID_DV
const sal_uInt16 EXC_ID_HEADER
virtual void PostDocLoad() override
XclImpPageSettings & GetPageSettings() const
Returns the page settings of the current sheet.
void ReadObj(XclImpStream &rStrm)
Reads a plain OBJ record (without leading DFF data).
Provides functions to convert Excel cell addresses to Calc cell addresses.
void ReadTabid(XclImpStream &rStrm)
Reads the TABID record.
void SeekGlobalPosition()
Seeks to the stored global user position.
XclImpPalette & GetPalette() const
Returns the color buffer.
void ReadDconref(XclImpStream &rStrm)
Reads a DCONREF record containing the source range of a pivot cache.
void ReadExternname(XclImpStream &rStrm, ExcelToSc *pFormulaConv)
Reads an EXTERNNAME record and appends it to the current SUPBOOK.
void SetCodeName(const OUString &r)
void ReadScl(XclImpStream &rStrm)
Reads an SCL record.
bool IsTabTruncated() const
Returns whether the "some sheets have been cut" warning box should be shown.
XclImpSst & GetSst() const
Returns the shared string table.
void ReadXct(XclImpStream &rStrm)
Reads an XCT record and appends it to the current SUPBOOK.
const sal_uInt16 EXC_ID_PANE
Default zoom for pagebreak preview.
const sal_uInt16 EXC_ID_WQTABLES
void SetHasBasic()
Called to indicate that the document contains a VB project.
virtual void PostDocLoad()
bool StartNextRecord()
Sets stream pointer to the start of the next record content.
XclImpXFBuffer & GetXFBuffer() const
Returns the cell formatting attributes buffer.
std::size_t GetSvStreamSize() const
Returns the stream size.
const sal_uInt16 EXC_ID_XCT
for export
void ReadWqtables(XclImpStream &rStrm)
Reads a WEBQRYTABLES record and sets source range list to the current web query.
const sal_uInt16 EXC_ID_SETUP
void ReadSxex(XclImpStream &rStrm)
Reads an SXEX record containing additional settings for a pivot table.
const sal_uInt16 EXC_ID_EXTERNSHEET
void ReadWqsettings(XclImpStream &rStrm)
Reads a WEBQRYSETTINGS record and sets refresh rate to the current web query.
const sal_uInt16 EXC_ID3_BLANK
const sal_uInt16 EXC_ID_EFONT
Both.
const sal_uInt16 EXC_ID_DVAL
Font escapement type modified?
const sal_uInt16 EXC_ID_EXTERNNAME
const sal_uInt16 EXC_ID3_NUMBER
const sal_uInt16 EXC_ID_AUTOFILTERINFO
const sal_uInt16 EXC_ID_TOPMARGIN
void ReadDConName(XclImpStream &rStrm)
void ReadSxViewEx9(XclImpStream &rStrm)
Reads an SXVIEWEX9 record that specifies the pivot tables autoformat.
static const ErrCode & ReadFilepass(XclImpStream &rStrm)
Reads the FILEPASS record, queries a password and sets decryption algorithm.
MS Excel 5.0, MS Excel 7.0 (95)
const sal_uInt16 EXC_ID_MSODRAWING
bool IsColTruncated() const
Returns whether the "some columns have been cut" warning box should be shown.
void ReadMargin(XclImpStream &rStrm)
Reads a ***MARGIN record (reads all 4 margin records).
void ReadNote(XclImpStream &rStrm)
Reads the NOTE record.
A buffer containing information about names and creation order of sheets.
XclImpTabInfo & GetTabInfo() const
Returns the buffer that contains the sheet creation order.
const sal_uInt16 EXC_ID4_BOF
void TraceChartOnlySheet()
void CreateUserStyles()
Creates all user defined style sheets.
std::unique_ptr< ExcelToSc > pFormConv
Visible range if embedded.
const sal_uInt16 EXC_ID_SXVI
bool IsRowTruncated() const
Returns whether the "some rows have been cut" warning box should be shown.
void ConvertPivotTables()
Inserts all pivot tables into the Calc document.
const sal_uInt16 EXC_ID_VERPAGEBREAKS
const sal_uInt16 EXC_ID_HCENTER
XclImpAddressConverter & GetAddressConverter() const
Returns the address converter.
void ReadSst(XclImpStream &rStrm)
Reads the entire SST record.
Contains all page (print) settings for a single sheet.
Stores all user defined number formats occurred in the file.
const sal_uInt16 EXC_ID_USESELFS
void ReadTabBgColor(XclImpStream &rStrm, const XclImpPalette &rPal)
Reads a SHEETEXT record (Tab Color).
const sal_uInt16 EXC_ID_OBJ
static void ReadDval(XclImpStream &rStrm)
Reads a DVAL record and sets marks the dropdown arrow control to be ignored.
const sal_uInt16 EXC_ID_STYLE
Font auto color (system window text color).
void ReadSelection(XclImpStream &rStrm)
Reads a SELECTION record.
void ReadHeaderFooter(XclImpStream &rStrm)
Reads a HEADER or FOOTER record.
const sal_uInt16 EXC_ID4_FORMULA
void ReadWqstring(XclImpStream &rStrm)
Reads a WQSTRING record and sets URL to the current web query.
void ReadEfont(XclImpStream &rStrm)
Reads an EFONT record (BIFF2 font color).
XclImpNameManager & GetNameManager() const
Returns the buffer that contains internal defined names.
const sal_uInt16 EXC_ID_SXIDSTM
static void ReadHlink(XclImpStream &rStrm)
Reads a HLINK record and inserts it into the document.
void ReadSxvdex(XclImpStream &rStrm)
Reads an SXVDEX record describing extended options of a field.
void ReadPalette(XclImpStream &rStrm)
Reads a PALETTE record.
void ReadTabChart(XclImpStream &rStrm)
Inserts a new chart object and reads the chart substream (BOF/EOF block).
const sal_uInt16 EXC_ID_TABID
const sal_uInt16 EXC_ID_DCONREF
const sal_uInt16 EXC_ID4_FORMAT
XclTracer & GetTracer() const
Returns the filter tracer.
SCTAB GetCurrScTab() const
Returns the current Calc sheet index.
const sal_uInt16 EXC_ID_WINDOW2
SC_DLLPUBLIC void CalcAfterLoad(bool bStartListening=true)
const sal_uInt16 EXC_ID_SST
const sal_uInt16 EXC_ID_BOTTOMMARGIN
void ReadPrintHeaders(XclImpStream &rStrm)
Reads a PRINTHEADERS record.
XclImpSheetDrawing & GetCurrSheetDrawing() const
Returns the drawing container of the current sheet.
const sal_uInt16 EXC_ID_SXDI
const sal_uInt16 EXC_ID_FOOTER
const sal_uInt16 EXC_ID_SXVD
void ReadImgData(XclImpStream &rStrm)
Reads an IMGDATA record and creates the SvxBrushItem.
XclImpLinkManager & GetLinkManager() const
Returns the link manager.
const sal_uInt16 EXC_ID_SXVIEW
const sal_uInt16 EXC_ID_USERSVIEWBEGIN
XclImpWebQueryBuffer & GetWebQueryBuffer() const
Returns the web query buffer.
const sal_uInt16 EXC_ID2_BLANK
void ReadFormat(XclImpStream &rStrm)
Reads a FORMAT record.
const sal_uInt16 EXC_ID_PALETTE
void ReadSxview(XclImpStream &rStrm)
Reads an SXVIEW record describing a new pivot table.
void ReadFont(XclImpStream &rStrm)
Reads a FONT record.
void ReadMsoDrawingGroup(XclImpStream &rStrm)
Reads the MSODRAWINGGROUP record.
void ReadSupbook(XclImpStream &rStrm)
Reads a SUPBOOK record.
const sal_uInt16 EXC_ID_HORPAGEBREAKS
const sal_uInt16 EXC_ID_FILESHARING
#define SCWARN_IMPORT_SHEET_OVERFLOW
void IncCurrScTab()
Increases the current Calc sheet index by 1.
const sal_uInt16 EXC_ID2_BOOLERR
#define SCWARN_IMPORT_ROW_OVERFLOW
const sal_uInt16 EXC_ID_QSI
All tables.
const sal_uInt16 EXC_ID_PRINTGRIDLINES
XclImpFontBuffer & GetFontBuffer() const
Returns the font buffer.
The main class for pivot table import.
Stores the data of all fonts occurred in an Excel file.
const sal_uInt16 EXC_ID_RK
void ReadPrintGridLines(XclImpStream &rStrm)
Reads a PRINTGRIDLINES record.
XclBiff GetBiff() const
Returns the current BIFF version of the importer/exporter.
const sal_uInt16 EXC_ID_SXEX
const sal_uInt16 EXC_ID_HLINK
void ReadSxivd(XclImpStream &rStrm)
Reads an SXIVD record containing the row field or column field order.
#define SCWARN_IMPORT_COLUMN_OVERFLOW
void ReadPane(XclImpStream &rStrm)
Reads a PANE record.
void MaybeRefreshPivotTables()
const sal_uInt16 EXC_ID3_ARRAY
const sal_uInt16 EXC_ID2_FONT
const ScAddress & GetScMaxPos() const
Returns the highest possible cell address in a Calc document.
The SST (shared string table) contains all strings used in a BIFF8 file.
const sal_uInt16 EXC_ID_AUTOFILTER
Stores the default colors for the current BIFF version and the contents of a PALETTE record...
void StoreGlobalPosition()
Stores current position.
const sal_uInt16 EXC_ID_SXADDL
const sal_uInt16 EXC_ID_WQSTRING
#define SAL_WARN(area, stream)
XclImpCondFormatManager & GetCondFormatManager() const
Returns the conditional formatting manager.
const sal_uInt16 EXC_ID3_BOF
const OUString & GetCodeName() const
const sal_uInt16 EXC_ID5_XF
const sal_uInt16 EXC_ID_SHRFMLA
SfxObjectShell * GetDocShell() const
Returns the object shell of the Calc document.
const sal_uInt16 EXC_ID_CF
This class is used to import record oriented streams.
sal_uInt16 mnLastRecId
Current XF identifier from IXFE record.
const sal_uInt16 EXC_ID_SXVDEX
void ReadSxvd(XclImpStream &rStrm)
Reads an SXVD record describing a new field.
const sal_uInt16 EXC_ID2_ARRAY
void ReadPivotCaches(const XclImpStream &rStrm)
Reads all used pivot caches and creates additional sheets for external data sources.
const sal_uInt16 EXC_ID_RIGHTMARGIN
void ReadSetup(XclImpStream &rStrm)
Reads a SETUP record and inserts contained data.
std::size_t GetSvStreamPos() const
Returns the absolute stream position.
const sal_uInt16 EXC_ID_SUPBOOK
const sal_uInt16 EXC_ID_CRN
const sal_uInt16 EXC_ID2_BOF
Text rotation: vertically stacked.
const sal_uInt16 EXC_ID_SXVIEWEX9
void ReadSxdi(XclImpStream &rStrm)
Reads an SXDI record containing data field data.
SC_DLLPUBLIC bool GetName(SCTAB nTab, OUString &rName) const
const sal_uInt16 EXC_ID_SHEETEXT
void ReadParamqry(XclImpStream &rStrm)
Reads a PARAMQRY record and sets data to the current web query.
sal_uInt16 PeekRecId(std::size_t nPos)
const sal_uInt16 EXC_ID_LEFTMARGIN
void ReadMsoDrawing(XclImpStream &rStrm)
Reads the MSODRAWING or MSODRAWINGSELECTION record.
static void ReadLabelranges(XclImpStream &rStrm)
Reads a LABELRANGES record and inserts the label ranges into the document.
This is the central class for the import of all internal/external links.
void ReadCrn(XclImpStream &rStrm)
Reads a CRN record and appends it to the current SUPBOOK.
const sal_uInt16 EXC_ID3_LABEL
#define ERRCODE_IO_CANTREAD
const sal_uInt16 EXC_ID2_NUMBER
const sal_uInt16 EXC_ID_EOF
Internal use only.