20#include <document.hxx>
50 bool TryStartNextRecord(
XclImpStream& rIn, std::size_t nProgressBasePos)
100 STATE eCurrent = Z_BiffNull, ePrev = Z_BiffNull;
104 sal_uInt16 nBofLevel = 0;
111 std::size_t nProgressBasePos = 0;
112 std::size_t nProgressBaseSize = 0;
116 if( eCurrent == Z_Biff5E )
124 bool bValid = TryStartNextRecord(
aIn, nProgressBasePos);
158 if( eCurrent == Z_End )
161 if( eCurrent != Z_Biff5TPre && eCurrent != Z_Biff5WPre )
162 pProgress->ProgressAbs( nProgressBaseSize +
aIn.
GetSvStreamPos() - nProgressBasePos );
209 eCurrent = Z_Biff5WPre;
219 eCurrent = Z_Biff5TPre;
251 case 0x08:
Row25();
break;
287 case 0x44:
Ixfe();
break;
350 case 0x0208:
Row34();
break;
423 case 0x0208:
Row34();
break;
534 case 0x0208:
Row34();
break;
627 else if( (nOpcode == 0x000A) && nBofLevel )
629 else if( !nBofLevel )
635 case 0x08:
Row25();
break;
651 case 0x81:
Wsbool();
break;
654 case 0x0208:
Row34();
break;
683 case 0x0A:
Eof(); eCurrent = Z_Biff5E;
break;
706 case 0xBD:
Mulrk();
break;
730 eCurrent = Z_Biff5TPre;
746 "+ImportExcel::Read(): Doppel-Whopper-Workbook!" );
767 OSL_FAIL(
"*ImportExcel::Read(): Not possible state!" );
769 default: OSL_FAIL(
"-ImportExcel::Read(): state forgotten!" );
798#ifdef EXC_INCL_DUMPER
801 if( aDumper.Dump(
aIn ) )
825 bool bInUserView =
false;
829 EXC_STATE_BEFORE_GLOBALS,
830 EXC_STATE_GLOBALS_PRE,
832 EXC_STATE_BEFORE_SHEET,
838 XclImpReadState eCurrent = EXC_STATE_BEFORE_GLOBALS;
847 std::size_t nProgressBasePos = 0;
848 std::size_t nProgressBaseSize = 0;
850 bool bSheetHasCodeName =
false;
852 std::vector<OUString> aCodeNames;
853 std::vector < SCTAB > nTabsWithNoCodeName;
855 sal_uInt16 nRecId = 0;
857 for (; eCurrent != EXC_STATE_END;
mnLastRecId = nRecId)
859 if( eCurrent == EXC_STATE_BEFORE_SHEET )
867 bool bValid = TryStartNextRecord(
aIn, nProgressBasePos);
871 eCurrent = EXC_STATE_END;
881 eCurrent = EXC_STATE_END;
897 eCurrent = EXC_STATE_SHEET_PRE;
908 OSL_FAIL(
"ImportExcel8::Read - double workbook globals" );
920 eCurrent = EXC_STATE_END;
930 case EXC_STATE_SHEET_PRE:
931 eCurrent = EXC_STATE_SHEET;
934 case EXC_STATE_SHEET:
936 eCurrent = EXC_STATE_END;
939 eCurrent = EXC_STATE_END;
943 if( eCurrent == EXC_STATE_END )
946 if( eCurrent != EXC_STATE_SHEET_PRE && eCurrent != EXC_STATE_GLOBALS_PRE )
947 pProgress->ProgressAbs( nProgressBaseSize +
aIn.
GetSvStreamPos() - nProgressBasePos );
958 OSL_ENSURE( !bInUserView,
"ImportExcel8::Read - nested user view settings" );
962 OSL_ENSURE( bInUserView,
"ImportExcel8::Read - not in user view settings" );
967 if( !bInUserView )
switch( eCurrent )
971 case EXC_STATE_BEFORE_GLOBALS:
975 OSL_ENSURE(
GetBiff() ==
EXC_BIFF8,
"ImportExcel8::Read - wrong BIFF version" );
979 eCurrent = EXC_STATE_GLOBALS_PRE;
987 eCurrent = EXC_STATE_SHEET_PRE;
988 bSheetHasCodeName =
false;
996 case EXC_STATE_GLOBALS_PRE:
1011 eCurrent = EXC_STATE_GLOBALS;
1021 eCurrent = EXC_STATE_END;
1036 case EXC_STATE_GLOBALS:
1055 eCurrent = EXC_STATE_BEFORE_SHEET;
1095 case EXC_STATE_SHEET_PRE:
1117 eCurrent = EXC_STATE_SHEET;
1120 if ( !bSheetHasCodeName )
1128 aCodeNames.push_back( sCodeName );
1131 bSheetHasCodeName =
false;
1141 case 0x81:
Wsbool();
break;
1147 case 0x0208:
Row34();
break;
1151 case 0x0867:
FeatHdr();
break;
1152 case 0x0868:
Feat();
break;
1158 case EXC_STATE_SHEET:
1168 case EXC_ID_EOF:
Eof(); eCurrent = EXC_STATE_BEFORE_SHEET;
break;
1186 case 0x0010:
Delta();
break;
1189 case 0x00AE:
Scenman();
break;
1191 case 0x00BD:
Mulrk();
break;
1193 case 0x00D6:
Rstring();
break;
1196 case 0x0236:
TableOp();
break;
1256 for (
const auto& rTab : nTabsWithNoCodeName )
1261 OUString sTmpName =
"Sheet" + OUString::number(
static_cast<sal_Int32
>(nTab++));
1263 if ( std::find(aCodeNames.begin(), aCodeNames.end(), sTmpName) == aCodeNames.end() )
1268 aCodeNames.push_back(sTmpName);
virtual void PostDocLoad() override
virtual ErrCode Read() override
sal_uInt16 mnLastRecId
Current XF identifier from IXFE record.
ScfUInt32Vec maSheetOffsets
std::unique_ptr< ExcelToSc > pFormConv
Visible range if embedded.
virtual void PostDocLoad()
Accessor class to ScDocument.
bool IsAdjustHeightLocked() const
SC_DLLPUBLIC void CalcAfterLoad(bool bStartListening=true)
void SetCodeName(const OUString &r)
const OUString & GetCodeName() const
SC_DLLPUBLIC bool GetName(SCTAB nTab, OUString &rName) const
SC_DLLPUBLIC void SetVisible(SCTAB nTab, bool bVisible)
A simplified progress bar with only one segment.
bool IsRowTruncated() const
Returns whether the "some rows have been cut" warning box should be shown.
bool IsColTruncated() const
Returns whether the "some columns have been cut" warning box should be shown.
void CheckScTab(SCTAB nScTab)
Checks if the passed sheet index is valid.
bool IsTabTruncated() const
Returns whether the "some sheets have been cut" warning box should be shown.
Provides functions to convert Excel cell addresses to Calc cell addresses.
static const ErrCode & ReadFilepass(XclImpStream &rStrm)
Reads the FILEPASS record, queries a password and sets decryption algorithm.
void ReadObj(XclImpStream &rStrm)
Reads a plain OBJ record (without leading DFF data).
void ReadMsoDrawing(XclImpStream &rStrm)
Reads the MSODRAWING or MSODRAWINGSELECTION record.
Stores the data of all fonts occurred in an Excel file.
void ReadFont(XclImpStream &rStrm)
Reads a FONT record.
void ReadEfont(XclImpStream &rStrm)
Reads an EFONT record (BIFF2 font color).
static void ReadHlink(XclImpStream &rStrm)
Reads a HLINK record and inserts it into the document.
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 ReadSupbook(XclImpStream &rStrm)
Reads a SUPBOOK record.
void ReadExternname(XclImpStream &rStrm, ExcelToSc *pFormulaConv)
Reads an EXTERNNAME record and appends it to the current SUPBOOK.
void ReadXct(XclImpStream &rStrm)
Reads an XCT record and appends it to the current SUPBOOK.
void ReadCrn(XclImpStream &rStrm)
Reads a CRN record and appends it to the current SUPBOOK.
void ReadExternsheet(XclImpStream &rStrm)
Reads the EXTERNSHEET record.
This buffer contains all internal defined names of the document.
void ReadName(XclImpStream &rStrm)
Reads a NAME record and creates an entry in this buffer.
Stores all user defined number formats occurred in the file.
void CreateScFormats()
Creates the number formats in the Calc document.
void ReadFormat(XclImpStream &rStrm)
Reads a FORMAT record.
Stores all drawing and OLE objects and additional data related to these objects.
void ReadMsoDrawingGroup(XclImpStream &rStrm)
Reads the MSODRAWINGGROUP record.
Contains all page (print) settings for a single sheet.
void ReadPrintHeaders(XclImpStream &rStrm)
Reads a PRINTHEADERS record.
void ReadSetup(XclImpStream &rStrm)
Reads a SETUP record and inserts contained data.
void ReadCenter(XclImpStream &rStrm)
Reads a HCENTER or VCENTER record.
void ReadPrintGridLines(XclImpStream &rStrm)
Reads a PRINTGRIDLINES record.
void ReadMargin(XclImpStream &rStrm)
Reads a ***MARGIN record (reads all 4 margin records).
void ReadImgData(XclImpStream &rStrm)
Reads an IMGDATA record and creates the SvxBrushItem.
void ReadPageBreaks(XclImpStream &rStrm)
Reads a HORIZONTALPAGEBREAKS or VERTICALPAGEBREAKS record.
void ReadHeaderFooter(XclImpStream &rStrm)
Reads a HEADER or FOOTER record.
Stores the default colors for the current BIFF version and the contents of a PALETTE record.
void ReadPalette(XclImpStream &rStrm)
Reads a PALETTE record.
The main class for pivot table import.
void ReadSxvdex(XclImpStream &rStrm)
Reads an SXVDEX record describing extended options of a field.
void ReadSxvi(XclImpStream &rStrm)
Reads an SXVI record describing a new item of the current field.
void ReadSxpi(XclImpStream &rStrm)
Reads an SXPI record containing page field data.
void ReadSxViewEx9(XclImpStream &rStrm)
Reads an SXVIEWEX9 record that specifies the pivot tables autoformat.
void ReadPivotCaches(const XclImpStream &rStrm)
Reads all used pivot caches and creates additional sheets for external data sources.
void ReadSxview(XclImpStream &rStrm)
Reads an SXVIEW record describing a new pivot table.
void ReadDconref(XclImpStream &rStrm)
Reads a DCONREF record containing the source range of a pivot cache.
void ReadSxivd(XclImpStream &rStrm)
Reads an SXIVD record containing the row field or column field order.
void ReadSxdi(XclImpStream &rStrm)
Reads an SXDI record containing data field data.
void MaybeRefreshPivotTables()
void ReadSxidstm(XclImpStream &rStrm)
Reads an SXIDSTM record containing a pivot cache stream identifier and the pivot cache.
void ReadSxAddl(XclImpStream &rStrm)
Reads an SXADDL record that specifies additional info for pivot table.
void ReadSxvd(XclImpStream &rStrm)
Reads an SXVD record describing a new field.
void ReadDConName(XclImpStream &rStrm)
void ConvertPivotTables()
Inserts all pivot tables into the Calc document.
void ReadSxex(XclImpStream &rStrm)
Reads an SXEX record containing additional settings for a pivot table.
void ReadSxvs(XclImpStream &rStrm)
Reads an SXVS record containing the source type of a pivot cache.
XclImpAddressConverter & GetAddressConverter() const
Returns the address converter.
XclImpXFBuffer & GetXFBuffer() const
Returns the cell formatting attributes buffer.
XclImpWebQueryBuffer & GetWebQueryBuffer() const
Returns the web query buffer.
void ReadCodeName(XclImpStream &rStrm, bool bGlobals)
Reads the CODENAME record and inserts the codename into the document.
XclImpLinkManager & GetLinkManager() const
Returns the link manager.
ScDocumentImport & GetDocImport()
XclImpCondFormatManager & GetCondFormatManager() const
Returns the conditional formatting manager.
XclImpFontBuffer & GetFontBuffer() const
Returns the font buffer.
XclImpNameManager & GetNameManager() const
Returns the buffer that contains internal defined names.
XclImpValidationManager & GetValidationManager() const
void SetHasBasic()
Called to indicate that the document contains a VB project.
XclImpPalette & GetPalette() const
Returns the color buffer.
XclImpSst & GetSst() const
Returns the shared string table.
const XclImpRoot & GetRoot() const
Returns this root instance - for code readability in derived classes.
XclImpPageSettings & GetPageSettings() const
Returns the page settings of the current sheet.
XclImpSheetDrawing & GetCurrSheetDrawing() const
Returns the drawing container of the current sheet.
XclImpTabInfo & GetTabInfo() const
Returns the buffer that contains the sheet creation order.
XclImpObjectManager & GetObjectManager() const
Returns the drawing object manager.
XclImpTabViewSettings & GetTabViewSettings() const
Returns the view settings of the current sheet.
XclImpPivotTableManager & GetPivotTableManager() const
Returns the pivot table manager.
XclImpNumFmtBuffer & GetNumFmtBuffer() const
Returns the number format buffer.
void ReadNote(XclImpStream &rStrm)
Reads the NOTE record.
void ReadTabChart(XclImpStream &rStrm)
Inserts a new chart object and reads the chart substream (BOF/EOF block).
The SST (shared string table) contains all strings used in a BIFF8 file.
void ReadSst(XclImpStream &rStrm)
Reads the entire SST record.
This class is used to import record oriented streams.
bool IsValid() const
Returns record reading state: false = record overread.
std::size_t GetSvStreamSize() const
Returns the stream size.
sal_uInt16 GetNextRecId()
Returns the record ID of the following record.
sal_uInt16 GetRecId() const
Returns the current record ID.
void StoreGlobalPosition()
Stores current position.
void SeekGlobalPosition()
Seeks to the stored global user position.
std::size_t GetSvStreamPos() const
Returns the absolute stream position.
sal_uInt16 PeekRecId(std::size_t nPos)
bool StartNextRecord()
Sets stream pointer to the start of the next record content.
A buffer containing information about names and creation order of sheets.
void ReadTabid(XclImpStream &rStrm)
Reads the TABID record.
Contains all view settings for a single sheet.
void ReadSelection(XclImpStream &rStrm)
Reads a SELECTION record.
void ReadWindow2(XclImpStream &rStrm, bool bChart)
Reads a WINDOW2 record.
void ReadScl(XclImpStream &rStrm)
Reads an SCL record.
void ReadPane(XclImpStream &rStrm)
Reads a PANE record.
void ReadTabBgColor(XclImpStream &rStrm, const XclImpPalette &rPal)
Reads a SHEETEXT record (Tab Color).
static void ReadDval(XclImpStream &rStrm)
Reads a DVAL record and sets marks the dropdown arrow control to be ignored.
void ReadDV(XclImpStream &rStrm)
Reads a DV record and inserts validation data into the document.
void ReadWqsettings(XclImpStream &rStrm)
Reads a WEBQRYSETTINGS record and sets refresh rate to the current web query.
void ReadWqtables(XclImpStream &rStrm)
Reads a WEBQRYTABLES record and sets source range list to the current web query.
void ReadWqstring(XclImpStream &rStrm)
Reads a WQSTRING record and sets URL to the current web query.
void ReadQsi(XclImpStream &rStrm)
Reads the QSI record and creates a new web query in the buffer.
void ReadParamqry(XclImpStream &rStrm)
Reads a PARAMQRY record and sets data to the current web query.
Contains all XF records occurred in the file.
void ReadStyle(XclImpStream &rStrm)
Reads a STYLE record.
void CreateUserStyles()
Creates all user defined style sheets.
void ReadXF(XclImpStream &rStrm)
Reads an XF record.
SfxObjectShell * GetDocShell() const
Returns the object shell of the Calc document.
const ScAddress & GetScMaxPos() const
Returns the highest possible cell address in a Calc document.
XclTracer & GetTracer() const
Returns the filter tracer.
SCTAB GetCurrScTab() const
Returns the current Calc sheet index.
XclBiff GetBiff() const
Returns the current BIFF version of the importer/exporter.
void IncCurrScTab()
Increases the current Calc sheet index by 1.
ScDocument & GetDoc() const
Returns reference to the destination document (import) or source document (export).
void TraceChartOnlySheet()
#define SCWARN_IMPORT_ROW_OVERFLOW
#define SCWARN_IMPORT_COLUMN_OVERFLOW
#define SCWARN_IMPORT_SHEET_OVERFLOW
const sal_uInt16 EXC_ID2_BOF
Text rotation: vertically stacked.
const sal_uInt16 EXC_ID_AUTOFILTER
const sal_uInt16 EXC_ID_AUTOFILTERINFO
const sal_uInt16 EXC_ID_USERSVIEWEND
const sal_uInt16 EXC_ID_USESELFS
const sal_uInt16 EXC_ID4_BOF
@ EXC_BIFF8
MS Excel 5.0, MS Excel 7.0 (95)
const sal_uInt16 EXC_ID_CODENAME
const sal_uInt16 EXC_ID_USERSVIEWBEGIN
const sal_uInt16 EXC_ID5_BOF
const sal_uInt16 EXC_ID3_BOF
const sal_uInt16 EXC_ID_EOF
Internal use only.
const sal_uInt16 EXC_ID_DV
const sal_uInt16 EXC_ID_LABELRANGES
const sal_uInt16 EXC_ID_CF
const sal_uInt16 EXC_ID_FILESHARING
const sal_uInt16 EXC_ID_QSI
All tables.
const sal_uInt16 EXC_ID_WQSTRING
const sal_uInt16 EXC_ID_HLINK
const sal_uInt16 EXC_ID_SST
const sal_uInt16 EXC_ID_WQTABLES
const sal_uInt16 EXC_ID_EXTSST
const sal_uInt16 EXC_ID_PQRY
const sal_uInt16 EXC_ID_CONDFMT
const sal_uInt16 EXC_ID_DVAL
Font escapement type modified?
const sal_uInt16 EXC_ID_WQSETT
const sal_uInt16 EXC_ID8_IMGDATA
const sal_uInt16 EXC_ID_OBJ
const sal_uInt16 EXC_ID_MSODRAWING
const sal_uInt16 EXC_ID_NOTE
const sal_uInt16 EXC_ID_MSODRAWINGGROUP
const sal_uInt16 EXC_ID_EXTERNNAME
const sal_uInt16 EXC_ID_TABID
const sal_uInt16 EXC_ID_EXTERNSHEET
const sal_uInt16 EXC_ID_XCT
for export
const sal_uInt16 EXC_ID_SUPBOOK
const sal_uInt16 EXC_ID_CRN
const sal_uInt16 EXC_ID_NAME
const sal_uInt16 EXC_ID_FOOTER
const sal_uInt16 EXC_ID_PRINTHEADERS
Left/right footer default margin in 1/100mm.
const sal_uInt16 EXC_ID_VCENTER
const sal_uInt16 EXC_ID_RIGHTMARGIN
const sal_uInt16 EXC_ID_LEFTMARGIN
const sal_uInt16 EXC_ID_SETUP
const sal_uInt16 EXC_ID_TOPMARGIN
const sal_uInt16 EXC_ID_HEADER
const sal_uInt16 EXC_ID_HORPAGEBREAKS
const sal_uInt16 EXC_ID_VERPAGEBREAKS
const sal_uInt16 EXC_ID_PRINTGRIDLINES
const sal_uInt16 EXC_ID_BOTTOMMARGIN
const sal_uInt16 EXC_ID_HCENTER
const sal_uInt16 EXC_ID_DCONNAME
const sal_uInt16 EXC_ID_SXPI
const sal_uInt16 EXC_ID_SXIVD
const sal_uInt16 EXC_ID_SXVS
const sal_uInt16 EXC_ID_SXEX
const sal_uInt16 EXC_ID_SXVDEX
const sal_uInt16 EXC_ID_SXADDL
const sal_uInt16 EXC_ID_SXIDSTM
const sal_uInt16 EXC_ID_SXVD
const sal_uInt16 EXC_ID_SXVI
const sal_uInt16 EXC_ID_DCONREF
const sal_uInt16 EXC_ID_SXVIEWEX9
const sal_uInt16 EXC_ID_SXDI
const sal_uInt16 EXC_ID_SXVIEW
const sal_uInt16 EXC_ID4_FORMAT
const sal_uInt16 EXC_ID2_FONT
const sal_uInt16 EXC_ID_PALETTE
const sal_uInt16 EXC_ID_EFONT
Both.
const sal_uInt16 EXC_ID_STYLE
Font auto color (system window text color).
const sal_uInt16 EXC_ID5_XF
const sal_uInt16 EXC_ID3_LABEL
const sal_uInt16 EXC_ID3_DIMENSIONS
const sal_uInt16 EXC_ID3_NUMBER
const sal_uInt16 EXC_ID2_LABEL
const sal_uInt16 EXC_ID4_FORMULA
const sal_uInt16 EXC_ID_SHRFMLA
const sal_uInt16 EXC_ID3_ARRAY
const sal_uInt16 EXC_ID2_FORMULA
const sal_uInt16 EXC_ID_RK
const sal_uInt16 EXC_ID3_BOOLERR
const sal_uInt16 EXC_ID2_DIMENSIONS
const sal_uInt16 EXC_ID3_BLANK
const sal_uInt16 EXC_ID3_FORMULA
const sal_uInt16 EXC_ID2_NUMBER
const sal_uInt16 EXC_ID2_ARRAY
const sal_uInt16 EXC_ID2_BOOLERR
const sal_uInt16 EXC_ID2_INTEGER
const sal_uInt16 EXC_ID2_BLANK
const sal_uInt16 EXC_ID_SCL
Single, top, left, or top-left pane.
const sal_uInt16 EXC_ID_WINDOW2
const sal_uInt16 EXC_ID_PANE
Default zoom for pagebreak preview.
const sal_uInt16 EXC_ID_SELECTION
const sal_uInt16 EXC_ID_SHEETEXT