24 #include <oox/token/namespaces.hxx>
25 #include <oox/token/tokens.hxx>
34 using ::oox::core::ContextHandlerRef;
40 const sal_uInt32 BIFF12_CELL_SHOWPHONETIC = 0x01000000;
42 const sal_uInt8 BIFF12_DATATABLE_ROW = 0x01;
43 const sal_uInt8 BIFF12_DATATABLE_2D = 0x02;
44 const sal_uInt8 BIFF12_DATATABLE_REF1DEL = 0x04;
45 const sal_uInt8 BIFF12_DATATABLE_REF2DEL = 0x08;
47 const sal_uInt16 BIFF12_ROW_THICKTOP = 0x0001;
48 const sal_uInt16 BIFF12_ROW_THICKBOTTOM = 0x0002;
49 const sal_uInt16 BIFF12_ROW_COLLAPSED = 0x0800;
50 const sal_uInt16 BIFF12_ROW_HIDDEN = 0x1000;
51 const sal_uInt16 BIFF12_ROW_CUSTOMHEIGHT = 0x2000;
52 const sal_uInt16 BIFF12_ROW_CUSTOMFORMAT = 0x4000;
53 const sal_uInt8 BIFF12_ROW_SHOWPHONETIC = 0x01;
59 mrAddressConv( rFragment.getAddressConverter() ),
60 mrSheetData( rFragment.getSheetData() ),
61 mnSheet( rFragment.getSheetIndex() ),
62 mbHasFormula( false ),
63 mbValidRange( false ),
67 SAL_INFO(
"sc.filter",
"start safe sheet data context - unlock" );
73 SAL_INFO(
"sc.filter",
"end safe sheet data context - relock" );
80 case XLS_TOKEN( sheetData ):
81 if( nElement == XLS_TOKEN( row ) ) {
importRow( rAttribs );
return this; }
84 case XLS_TOKEN( row ):
86 if( nElement == XLS_TOKEN( c ) &&
importCell( rAttribs ) )
94 mxInlineStr = std::make_shared<RichString>( *this );
259 sal_Int32 nRow = rAttribs.
getInteger( XML_r, -1 );
282 OUString aColSpansText = rAttribs.
getString( XML_spans, OUString() );
287 OUString aColSpanToken = aColSpansText.getToken( 0,
' ', nIndex );
288 sal_Int32 nSepPos = aColSpanToken.indexOf(
':' );
289 if( (0 < nSepPos) && (nSepPos + 1 < aColSpanToken.getLength()) )
292 const sal_Int32 nCol1 = aColSpanToken.copy( 0, nSepPos ).toInt32() - 1;
296 const sal_Int32 nCol2 = aColSpanToken.copy( nSepPos + 1 ).toInt32() - 1;
310 const char*
p = rAttribs.
getChar(XML_r);
366 sal_Int32 nSpanCount;
367 sal_uInt16 nHeight, nFlags1;
382 aModel.
mnLevel = extractValue< sal_Int32 >( nFlags1, 8, 3 );
393 for( sal_Int32 nSpanIdx = 0; (nSpanIdx < nSpanCount) && !rStrm.
isEof(); ++nSpanIdx )
395 sal_Int32 nFirstCol, nLastCol;
457 OSL_ENSURE( eCellType !=
CELLTYPE_FORMULA,
"SheetDataContext::importCellBlank - no formula cells supported" );
490 OSL_ENSURE( eCellType !=
CELLTYPE_FORMULA,
"SheetDataContext::importCellRk - no formula cells supported" );
500 OSL_ENSURE( eCellType !=
CELLTYPE_FORMULA,
"SheetDataContext::importCellRString - no formula cells supported" );
504 RichStringRef xString = std::make_shared<RichString>( *this );
505 xString->importString( rStrm,
true );
506 xString->finalizeImport();
513 OSL_ENSURE( eCellType !=
CELLTYPE_FORMULA,
"SheetDataContext::importCellSi - no formula cells supported" );
527 RichStringRef xString = std::make_shared<RichString>( *this );
528 xString->importString( rStrm,
false );
529 xString->finalizeImport();
554 rStrm >> aRef1 >> aRef2;
OUString maFormulaStr
Inline rich string (OOXML only).
const sal_Int32 BIFF12_ID_MULTCELL_ERROR
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
const sal_Int32 BIFF12_ID_MULTCELL_DOUBLE
bool checkCellAddress(const ScAddress &rAddress, bool bTrackOverflow)
Checks the passed cell address if it fits into the spreadsheet limits.
void importCellError(SequenceInputStream &rStrm, CellType eCellType)
Imports an error code cell from a CELL_ERROR, MULTCELL_ERROR, or FORMULA_ERROR record.
OptValue< bool > getBool(sal_Int32 nAttrToken) const
bool checkCol(sal_Int32 nCol, bool bTrackOverflow)
Checks if the passed column index is valid.
bool mbThickTop
True = row outline is collapsed.
AddressConverter & mrAddressConv
A 2D cell address struct for binary filters.
void importCellDouble(SequenceInputStream &rStrm, CellType eCellType)
Imports a numeric cell from a CELL_DOUBLE, MULTCELL_DOUBLE, or FORMULA_DOUBLE record.
void createSharedFormulaMapEntry(const ScAddress &rAddress, sal_Int32 nSharedId, const OUString &rTokens)
Simple cell formula, or reference to a shared formula name.
OptValue< sal_Int32 > getInteger(sal_Int32 nAttrToken) const
A 2D cell range address struct for binary filters.
CellType
Different types of cell records.
const sal_Int32 BIFF12_ID_CELL_SI
sal_Int32 mnCellType
The address of the current cell.
const ScAddress & getMaxApiAddress() const
Returns the biggest valid cell address in the own Calc document.
bool mbCustomFormat
True = row has custom height.
bool readFormulaRef(SequenceInputStream &rStrm)
Reads the formula range used by shared formulas, arrays, and data tables.
ApiTokenSequence readCellFormula(SequenceInputStream &rStrm)
Reads a cell formula for the current cell.
OptValue< double > getDouble(sal_Int32 nAttrToken) const
void importFormula(const AttributeList &rAttribs)
Imports cell settings from an f element.
OptValue< OUString > getString(sal_Int32 nAttrToken) const
void importSharedFmla(SequenceInputStream &rStrm)
Imports a shared formula from a SHAREDFORMULA record.
void importCellRString(SequenceInputStream &rStrm, CellType eCellType)
Imports a rich-string cell from a CELL_RSTRING or MULTCELL_RSTRING record.
const sal_Int32 BIFF12_ID_FORMULA_DOUBLE
bool mbRowTable
True = 2-dimensional data table.
bool mbShowPhonetic
True = cells in row have explicit formatting.
const sal_Int32 BIFF12_ID_CELL_ERROR
std::shared_ptr< RichString > RichStringRef
bool mbRef1Deleted
True = row oriented data table.
const sal_Int32 BIFF12_ID_CELL_DOUBLE
SheetDataContext(WorksheetFragmentBase &rFragment)
bool mbCustomHeight
Row outline level.
void setBooleanCell(const CellModel &rModel, bool bValue)
Inserts a boolean cell into the sheet and adjusts number format.
bool mbCollapsed
True = row is hidden.
void importRow(const AttributeList &rAttribs)
Imports row settings from a row element.
void setCellArrayFormula(const ScRange &rRangeAddress, const ScAddress &rTokenAddress, const OUString &rTokenStr)
const sal_Int32 BIFF12_ID_MULTCELL_SI
void importCellSi(SequenceInputStream &rStrm, CellType eCellType)
Imports a string cell from a CELL_SI or MULTCELL_SI record.
void importDataTable(SequenceInputStream &rStrm)
Imports table operation from a DATATABLE record.
double mfHeight
0-based (!) column ranges of used cells.
sal_Int32 mnXfId
Data type of the cell value.
std::unique_ptr< FormulaParser > mxFormulaParser
The address converter.
void setValueCell(const CellModel &rModel, double fValue)
Inserts a value cell into the sheet.
void setCellFormulaValue(const ScAddress &rAddress, const OUString &rValueStr, sal_Int32 nCellType)
static double calcDoubleFromRk(sal_Int32 nRkValue)
Converts the passed packed number to a double.
Stores settings and formatting data about a sheet row.
bool getFlag(Type nBitField, Type nMask)
const sal_Int32 BIFF12_ID_FORMULA_BOOL
bool convertToCellAddress(ScAddress &orAddress, const OUString &rString, sal_Int16 nSheet, bool bTrackOverflow)
Tries to convert the passed string to a single cell address.
bool mbHasFormula
Current cell position (BIFF12 only).
SheetDataBuffer & mrSheetData
The formula parser, different one for each SheetDataContext.
bool mbHidden
True = cells in row show phonetic settings.
void setCellFormula(const ScAddress &rTokenAddress, const OUString &)
void setDateCell(const CellModel &rModel, const OUString &rDateString)
Inserts an ISO 8601 date cell into the sheet.
void importCellRk(SequenceInputStream &rStrm, CellType eCellType)
Imports an encoded numeric cell from a CELL_RK or MULTCELL_RK record.
BinAddress maCurrPos
Settings for table operations.
void createTableOperation(const ScRange &rRange, const DataTableModel &rModel)
Sets a multiple table operation to the passed range.
sal_Int32 mnRow
True = maFmlaData.maFormulaRef is valid (OOXML only).
const sal_Int32 BIFF12_ID_SHEETDATA
FormulaParser * createFormulaParser() const
Returns an unshared import formula parser (import filter only!).
bool checkRow(sal_Int32 nRow, bool bTrackOverflow)
Checks if the passed row index is valid.
sal_Int32 getCurrentElement() const
const sal_Int32 BIFF12_ID_SHAREDFMLA
const sal_Int32 BIFF12_ID_CELL_RK
void insertColSpan(const ValueRange &rColSpan)
Inserts the passed column span into the row model.
const sal_Int32 BIFF12_ID_MULTCELL_BOOL
const char * getChar(sal_Int32 nAttrToken) const
const sal_Int32 BIFF12_ID_MULTCELL_BLANK
DataTableModel maTableData
void setErrorCell(const CellModel &rModel, const OUString &rErrorCode)
Inserts an error cell from the passed error code into the sheet.
const sal_Int32 BIFF12_ID_MULTCELL_STRING
const sal_Int32 BIFF12_ID_FORMULA_STRING
void importCellBool(SequenceInputStream &rStrm, CellType eCellType)
Imports a boolean cell from a CELL_BOOL, MULTCELL_BOOL, or FORMULA_BOOL record.
bool convertToCellRange(ScRange &orRange, const OUString &rString, sal_Int16 nSheet, bool bAllowOverflow, bool bTrackOverflow)
Tries to convert the passed string to a cell range address.
bool importCell(const AttributeList &rAttribs)
Imports cell settings from a c element.
sal_Int32 mnXfId
Row height in points.
const sal_Int32 BIFF12_ID_MULTCELL_RSTRING
css::uno::Sequence< ApiToken > ApiTokenSequence
virtual void onCharacters(const OUString &rChars) override
Fragment handler derived from the WorksheetHelper helper class.
virtual void onEndElement() override
CellModel maCellData
The sheet data buffer for cell content and formatting.
void extendUsedArea(const ScAddress &rAddress)
Extends the used area of this sheet by the passed cell position.
const sal_Int32 BIFF12_ID_ARRAY
void setBlankCell(const CellModel &rModel)
Inserts a blank cell (with formatting) into the sheet.
void setCellFormat(const CellModel &rModel)
Processes the cell formatting data of the passed cell.
Context handler derived from the WorksheetHelper helper class.
const sal_Int32 BIFF12_ID_CELL_STRING
#define SAL_INFO(area, stream)
const sal_Int32 BIFF12_ID_CELL_BOOL
sal_Int16 mnSheet
Settings for a cell formula.
const sal_Int32 BIFF12_ID_ROW
const sal_Int32 BIFF12_ID_FORMULA_ERROR
bool mbRef2Deleted
True = first reference cell deleted.
bool mbShowPhonetic
XF (cell formatting) identifier.
const sal_Int32 BIFF12_ID_DATATABLE
const sal_Int32 BIFF12_ID_MULTCELL_RK
bool readCellHeader(SequenceInputStream &rStrm, CellType eCellType)
Reads a cell address and the following XF identifier.
void createArrayFormula(const ScRange &rRange, const ApiTokenSequence &rTokens)
Inserts the passed token array as array formula.
sal_Int32 mnCol
row index (0-based)
virtual ::oox::core::ContextHandlerRef onCreateRecordContext(sal_Int32 nRecId, SequenceInputStream &rStrm) override
void(* f)(TrueTypeTable *)
RichStringRef mxInlineStr
Cell value string (OOXML only).
OUString maRef2
First reference cell for table operations.
void createSharedFormula(const ScAddress &rRange, const ApiTokenSequence &rTokens)
CellFormulaModel maFmlaData
Position, contents, formatting of current imported cell.
sal_Int32 mnLevel
Row default formatting (see mbIsFormatted).
bool mb2dTable
Second reference cell for table operations.
virtual ~SheetDataContext() override
void setFormulaCell(const CellModel &rModel, const ApiTokenSequence &rTokens)
Inserts a formula cell into the sheet.
void importCellString(SequenceInputStream &rStrm, CellType eCellType)
Imports a string cell from a CELL_STRING, MULTCELL_STRING, or FORMULA_STRING record.
bool mbValidRange
True = current cell has formula data (OOXML only).
const sal_Int32 BIFF12_ID_CELL_BLANK
void setStringCell(const CellModel &rModel, const OUString &rText)
Inserts a simple string cell into the sheet.
void importArray(SequenceInputStream &rStrm)
Imports an array formula from an ARRAY record.
void importCellBlank(SequenceInputStream &rStrm, CellType eCellType)
Imports an empty cell from a CELL_BLANK or MULTCELL_BLANK record.
const sal_Int32 BIFF12_ID_CELL_RSTRING
bool mbThickBottom
True = row has extra space above text.
void setRowModel(const RowModel &rModel)
Sets row settings for a specific range of rows.
OptValue< sal_Int32 > getToken(sal_Int32 nAttrToken) const