LibreOffice Module sc (master)  1
sheetdatacontext.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <sheetdatacontext.hxx>
21 
24 #include <oox/token/namespaces.hxx>
25 #include <oox/token/tokens.hxx>
26 #include <addressconverter.hxx>
27 #include <biffhelper.hxx>
28 #include <formulaparser.hxx>
29 #include <richstringcontext.hxx>
30 #include <sal/log.hxx>
31 
32 namespace oox::xls {
33 
34 using ::oox::core::ContextHandlerRef;
35 
36 namespace {
37 
38 // record constants -----------------------------------------------------------
39 
40 const sal_uInt32 BIFF12_CELL_SHOWPHONETIC = 0x01000000;
41 
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;
46 
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;
54 
55 } // namespace
56 
58  WorksheetContextBase( rFragment ),
59  mrAddressConv( rFragment.getAddressConverter() ),
60  mrSheetData( rFragment.getSheetData() ),
61  mnSheet( rFragment.getSheetIndex() ),
62  mbHasFormula( false ),
63  mbValidRange( false ),
64  mnRow( -1 ),
65  mnCol( -1 )
66 {
67  SAL_INFO( "sc.filter", "start safe sheet data context - unlock" );
68  mxFormulaParser.reset(rFragment.createFormulaParser());
69 }
70 
72 {
73  SAL_INFO( "sc.filter", "end safe sheet data context - relock" );
74 }
75 
77 {
78  switch( getCurrentElement() )
79  {
80  case XLS_TOKEN( sheetData ):
81  if( nElement == XLS_TOKEN( row ) ) { importRow( rAttribs ); return this; }
82  break;
83 
84  case XLS_TOKEN( row ):
85  // do not process cell elements with invalid (out-of-range) address
86  if( nElement == XLS_TOKEN( c ) && importCell( rAttribs ) )
87  return this;
88  break;
89 
90  case XLS_TOKEN( c ):
91  switch( nElement )
92  {
93  case XLS_TOKEN( is ):
94  mxInlineStr = std::make_shared<RichString>( *this );
95  return new RichStringContext( *this, mxInlineStr );
96  case XLS_TOKEN( v ):
97  return this; // characters contain cell value
98  case XLS_TOKEN( f ):
99  importFormula( rAttribs );
100  return this; // characters contain formula string
101  }
102  break;
103  }
104  return nullptr;
105 }
106 
107 void SheetDataContext::onCharacters( const OUString& rChars )
108 {
109  switch( getCurrentElement() )
110  {
111  case XLS_TOKEN( v ):
112  maCellValue = rChars;
113  break;
114  case XLS_TOKEN( f ):
116  {
117  maFormulaStr = rChars;
118  }
119  break;
120  }
121 }
122 
124 {
125  if( getCurrentElement() == XLS_TOKEN( c ) )
126  {
127  // try to create a formula cell
128  if( mbHasFormula ) switch( maFmlaData.mnFormulaType )
129  {
130  // will buffer formulas but need to
131  // a) need to set format first
132  // :/
133  case XML_normal:
136 
137  // If a number cell has some preloaded value, stick it into the buffer
138  // but do this only for real cell formulas (not array, shared etc.)
139  if (!maCellValue.isEmpty())
141  break;
142 
143  case XML_shared:
144  if( maFmlaData.mnSharedId >= 0 )
145  {
148 
151  }
152  else
153  // no success, set plain cell value and formatting below
154  mbHasFormula = false;
155  break;
156  case XML_array:
158  {
160  }
161  // set cell formatting, but do not set result as cell value
163  break;
164  case XML_dataTable:
165  if( mbValidRange )
167  // set cell formatting, but do not set result as cell value
169  break;
170  default:
171  OSL_ENSURE( maFmlaData.mnFormulaType == XML_TOKEN_INVALID, "SheetDataContext::onEndElement - unknown formula type" );
172  mbHasFormula = false;
173  }
174 
175  if( !mbHasFormula )
176  {
177  // no formula created: try to set the cell value
178  if( !maCellValue.isEmpty() ) switch( maCellData.mnCellType )
179  {
180  case XML_n:
182  break;
183  case XML_b:
184  mrSheetData.setBooleanCell( maCellData, maCellValue.toDouble() != 0.0 );
185  break;
186  case XML_e:
188  break;
189  case XML_str:
191  break;
192  case XML_s:
194  break;
195  case XML_d:
197  break;
198  }
199  else if( (maCellData.mnCellType == XML_inlineStr) && mxInlineStr )
200  {
201  mxInlineStr->finalizeImport();
203  }
204  else
205  {
206  // empty cell, update cell type
209  }
210  }
211  }
212 }
213 
215 {
216  switch( getCurrentElement() )
217  {
218  case BIFF12_ID_SHEETDATA:
219  if( nRecId == BIFF12_ID_ROW ) { importRow( rStrm ); return this; }
220  break;
221 
222  case BIFF12_ID_ROW:
223  switch( nRecId )
224  {
225  case BIFF12_ID_ARRAY: importArray( rStrm ); break;
226  case BIFF12_ID_CELL_BOOL: importCellBool( rStrm, CELLTYPE_VALUE ); break;
227  case BIFF12_ID_CELL_BLANK: importCellBlank( rStrm, CELLTYPE_VALUE ); break;
229  case BIFF12_ID_CELL_ERROR: importCellError( rStrm, CELLTYPE_VALUE ); break;
230  case BIFF12_ID_CELL_RK: importCellRk( rStrm, CELLTYPE_VALUE ); break;
232  case BIFF12_ID_CELL_SI: importCellSi( rStrm, CELLTYPE_VALUE ); break;
234  case BIFF12_ID_DATATABLE: importDataTable( rStrm ); break;
243  case BIFF12_ID_MULTCELL_RK: importCellRk( rStrm, CELLTYPE_MULTI ); break;
245  case BIFF12_ID_MULTCELL_SI: importCellSi( rStrm, CELLTYPE_MULTI ); break;
247  case BIFF12_ID_SHAREDFMLA: importSharedFmla( rStrm ); break;
248  }
249  break;
250  }
251  return nullptr;
252 }
253 
254 // private --------------------------------------------------------------------
255 
257 {
258  RowModel aModel;
259  sal_Int32 nRow = rAttribs.getInteger( XML_r, -1 ); // 1-based row index
260  if(nRow != -1)
261  {
262  aModel.mnRow = nRow;
263  mnRow = nRow-1; // to 0-based row index.
264  }
265  else
266  aModel.mnRow = (++mnRow + 1); // increment 0-based row index, to 1-based model row
267  mrAddressConv.checkRow( mnRow, true);
268  mnCol = -1;
269 
270  aModel.mfHeight = rAttribs.getDouble( XML_ht, -1.0 );
271  aModel.mnXfId = rAttribs.getInteger( XML_s, -1 );
272  aModel.mnLevel = rAttribs.getInteger( XML_outlineLevel, 0 );
273  aModel.mbCustomHeight = rAttribs.getBool( XML_customHeight, false );
274  aModel.mbCustomFormat = rAttribs.getBool( XML_customFormat, false );
275  aModel.mbShowPhonetic = rAttribs.getBool( XML_ph, false );
276  aModel.mbHidden = rAttribs.getBool( XML_hidden, false );
277  aModel.mbCollapsed = rAttribs.getBool( XML_collapsed, false );
278  aModel.mbThickTop = rAttribs.getBool( XML_thickTop, false );
279  aModel.mbThickBottom = rAttribs.getBool( XML_thickBot, false );
280 
281  // decode the column spans (space-separated list of colon-separated integer pairs)
282  OUString aColSpansText = rAttribs.getString( XML_spans, OUString() );
283  sal_Int32 nMaxCol = mrAddressConv.getMaxApiAddress().Col();
284  sal_Int32 nIndex = 0;
285  while( nIndex >= 0 )
286  {
287  OUString aColSpanToken = aColSpansText.getToken( 0, ' ', nIndex );
288  sal_Int32 nSepPos = aColSpanToken.indexOf( ':' );
289  if( (0 < nSepPos) && (nSepPos + 1 < aColSpanToken.getLength()) )
290  {
291  // OOXML uses 1-based integer column indexes, row model expects 0-based colspans
292  const sal_Int32 nCol1 = aColSpanToken.copy( 0, nSepPos ).toInt32() - 1;
293  const bool bValid1 = mrAddressConv.checkCol( nCol1, true);
294  if (bValid1)
295  {
296  const sal_Int32 nCol2 = aColSpanToken.copy( nSepPos + 1 ).toInt32() - 1;
297  mrAddressConv.checkCol( nCol2, true);
298  aModel.insertColSpan( ValueRange( nCol1, ::std::min( nCol2, nMaxCol )));
299  }
300  }
301  }
302 
303  // set row properties in the current sheet
304  setRowModel( aModel );
305 }
306 
308 {
309  bool bValid = true;
310  const char* p = rAttribs.getChar(XML_r);
311 
312  if (!p)
313  {
314  ++mnCol;
315  ScAddress aAddress( mnCol, mnRow, mnSheet );
316  bValid = mrAddressConv.checkCellAddress( aAddress, true );
317  maCellData.maCellAddr = aAddress;
318  }
319  else
320  {
323  }
324 
325  if( bValid )
326  {
327  maCellData.mnCellType = rAttribs.getToken( XML_t, XML_n );
328  maCellData.mnXfId = rAttribs.getInteger( XML_s, -1 );
329  maCellData.mbShowPhonetic = rAttribs.getBool( XML_ph, false );
330 
331  // reset cell value, formula settings, and inline string
332  maCellValue.clear();
333  mxInlineStr.reset();
334  mbHasFormula = false;
335 
336  // update used area of the sheet
338  }
339  return bValid;
340 }
341 
343 {
344  mbHasFormula = true;
345  mbValidRange = mrAddressConv.convertToCellRange( maFmlaData.maFormulaRef, rAttribs.getString( XML_ref, OUString() ), mnSheet, true, true );
346 
347  maFmlaData.mnFormulaType = rAttribs.getToken( XML_t, XML_normal );
348  maFmlaData.mnSharedId = rAttribs.getInteger( XML_si, -1 );
349 
350  if( maFmlaData.mnFormulaType == XML_dataTable )
351  {
352  maTableData.maRef1 = rAttribs.getString( XML_r1, OUString() );
353  maTableData.maRef2 = rAttribs.getString( XML_r2, OUString() );
354  maTableData.mb2dTable = rAttribs.getBool( XML_dt2D, false );
355  maTableData.mbRowTable = rAttribs.getBool( XML_dtr, false );
356  maTableData.mbRef1Deleted = rAttribs.getBool( XML_del1, false );
357  maTableData.mbRef2Deleted = rAttribs.getBool( XML_del2, false );
358  }
359 
360  maFormulaStr.clear();
361 }
362 
364 {
365  RowModel aModel;
366  sal_Int32 nSpanCount;
367  sal_uInt16 nHeight, nFlags1;
368  sal_uInt8 nFlags2;
369  maCurrPos.mnRow = rStrm.readInt32();
370  aModel.mnXfId = rStrm.readInt32();
371  nHeight = rStrm.readuInt16();
372  nFlags1 = rStrm.readuInt16();
373  nFlags2 = rStrm.readuChar();
374  nSpanCount = rStrm.readInt32();
375  maCurrPos.mnCol = 0;
376 
378  // row index is 0-based in BIFF12, but RowModel expects 1-based
379  aModel.mnRow = maCurrPos.mnRow + 1;
380  // row height is in twips in BIFF12, convert to points
381  aModel.mfHeight = nHeight / 20.0;
382  aModel.mnLevel = extractValue< sal_Int32 >( nFlags1, 8, 3 );
383  aModel.mbCustomHeight = getFlag( nFlags1, BIFF12_ROW_CUSTOMHEIGHT );
384  aModel.mbCustomFormat = getFlag( nFlags1, BIFF12_ROW_CUSTOMFORMAT );
385  aModel.mbShowPhonetic = getFlag( nFlags2, BIFF12_ROW_SHOWPHONETIC );
386  aModel.mbHidden = getFlag( nFlags1, BIFF12_ROW_HIDDEN );
387  aModel.mbCollapsed = getFlag( nFlags1, BIFF12_ROW_COLLAPSED );
388  aModel.mbThickTop = getFlag( nFlags1, BIFF12_ROW_THICKTOP );
389  aModel.mbThickBottom = getFlag( nFlags1, BIFF12_ROW_THICKBOTTOM );
390 
391  // read the column spans
392  sal_Int32 nMaxCol = mrAddressConv.getMaxApiAddress().Col();
393  for( sal_Int32 nSpanIdx = 0; (nSpanIdx < nSpanCount) && !rStrm.isEof(); ++nSpanIdx )
394  {
395  sal_Int32 nFirstCol, nLastCol;
396  nFirstCol = rStrm.readInt32();
397  const bool bValid1 = mrAddressConv.checkCol( nFirstCol, true);
398  nLastCol = rStrm.readInt32();
399  mrAddressConv.checkCol( nLastCol, true);
400  if (bValid1)
401  aModel.insertColSpan( ValueRange( nFirstCol, ::std::min( nLastCol, nMaxCol ) ) );
402  }
403 
404  // set row properties in the current sheet
405  setRowModel( aModel );
406 }
407 
409 {
410  switch( eCellType )
411  {
412  case CELLTYPE_VALUE:
413  case CELLTYPE_FORMULA: maCurrPos.mnCol = rStrm.readInt32(); break;
414  case CELLTYPE_MULTI: ++maCurrPos.mnCol; break;
415  }
416 
417  sal_uInt32 nXfId = rStrm.readuInt32();
418 
420  maCellData.mnXfId = extractValue< sal_Int32 >( nXfId, 0, 24 );
421  maCellData.mbShowPhonetic = getFlag( nXfId, BIFF12_CELL_SHOWPHONETIC );
422 
423  // update used area of the sheet
424  if( bValidAddr )
426  return bValidAddr;
427 }
428 
430 {
431  rStrm.skip( 2 );
432  return mxFormulaParser->importFormula( maCellData.maCellAddr, FormulaType::Cell, rStrm );
433 }
434 
436 {
437  BinRange aRange;
438  rStrm >> aRange;
439  return mrAddressConv.convertToCellRange( maFmlaData.maFormulaRef, aRange, mnSheet, true, true );
440 }
441 
443 {
444  if( readCellHeader( rStrm, eCellType ) )
445  {
446  maCellData.mnCellType = XML_b;
447  bool bValue = rStrm.readuInt8() != 0;
448  if( eCellType == CELLTYPE_FORMULA )
450  else
452  }
453 }
454 
456 {
457  OSL_ENSURE( eCellType != CELLTYPE_FORMULA, "SheetDataContext::importCellBlank - no formula cells supported" );
458  if( readCellHeader( rStrm, eCellType ) )
460 }
461 
463 {
464  if( readCellHeader( rStrm, eCellType ) )
465  {
466  maCellData.mnCellType = XML_n;
467  double fValue = rStrm.readDouble();
468  if( eCellType == CELLTYPE_FORMULA )
470  else
472  }
473 }
474 
476 {
477  if( readCellHeader( rStrm, eCellType ) )
478  {
479  maCellData.mnCellType = XML_e;
480  sal_uInt8 nErrorCode = rStrm.readuInt8();
481  if( eCellType == CELLTYPE_FORMULA )
483  else
484  mrSheetData.setErrorCell( maCellData, nErrorCode );
485  }
486 }
487 
489 {
490  OSL_ENSURE( eCellType != CELLTYPE_FORMULA, "SheetDataContext::importCellRk - no formula cells supported" );
491  if( readCellHeader( rStrm, eCellType ) )
492  {
493  maCellData.mnCellType = XML_n;
495  }
496 }
497 
499 {
500  OSL_ENSURE( eCellType != CELLTYPE_FORMULA, "SheetDataContext::importCellRString - no formula cells supported" );
501  if( readCellHeader( rStrm, eCellType ) )
502  {
503  maCellData.mnCellType = XML_inlineStr;
504  RichStringRef xString = std::make_shared<RichString>( *this );
505  xString->importString( rStrm, true );
506  xString->finalizeImport();
508  }
509 }
510 
512 {
513  OSL_ENSURE( eCellType != CELLTYPE_FORMULA, "SheetDataContext::importCellSi - no formula cells supported" );
514  if( readCellHeader( rStrm, eCellType ) )
515  {
516  maCellData.mnCellType = XML_s;
518  }
519 }
520 
522 {
523  if( readCellHeader( rStrm, eCellType ) )
524  {
525  maCellData.mnCellType = XML_inlineStr;
526  // always import the string, stream will point to formula afterwards, if existing
527  RichStringRef xString = std::make_shared<RichString>( *this );
528  xString->importString( rStrm, false );
529  xString->finalizeImport();
530  if( eCellType == CELLTYPE_FORMULA )
532  else
534  }
535 }
536 
538 {
540  {
541  rStrm.skip( 1 );
542  ApiTokenSequence aTokens = mxFormulaParser->importFormula( maCellData.maCellAddr, FormulaType::Array, rStrm );
544  }
545 }
546 
548 {
549  if( readFormulaRef( rStrm ) )
550  {
551  BinAddress aRef1, aRef2;
552  sal_uInt8 nFlags;
553  rStrm >> aRef1 >> aRef2;
554  nFlags = rStrm.readuChar();
557  maTableData.mbRowTable = getFlag( nFlags, BIFF12_DATATABLE_ROW );
558  maTableData.mb2dTable = getFlag( nFlags, BIFF12_DATATABLE_2D );
559  maTableData.mbRef1Deleted = getFlag( nFlags, BIFF12_DATATABLE_REF1DEL );
560  maTableData.mbRef2Deleted = getFlag( nFlags, BIFF12_DATATABLE_REF2DEL );
562  }
563 }
564 
566 {
568  {
571  }
572 }
573 
574 } // namespace oox
575 
576 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OUString maFormulaStr
Inline rich string (OOXML only).
const sal_Int32 BIFF12_ID_MULTCELL_ERROR
Definition: biffhelper.hxx:143
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
sal_Int32 nIndex
const sal_Int32 BIFF12_ID_MULTCELL_DOUBLE
Definition: biffhelper.hxx:142
bool checkCellAddress(const ScAddress &rAddress, bool bTrackOverflow)
Checks the passed cell address if it fits into the spreadsheet limits.
virtual void skip(sal_Int32 nBytes, size_t nAtomSize=1) override
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
Definition: biffhelper.hxx:48
sal_Int32 mnCellType
The address of the current cell.
const ScAddress & getMaxApiAddress() const
Returns the biggest valid cell address in the own Calc document.
sal_Int32 mnCol
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.
sal_uInt32 readuInt32()
OptValue< OUString > getString(sal_Int32 nAttrToken) const
unsigned char readuChar()
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
Definition: biffhelper.hxx:126
bool mbRowTable
True = 2-dimensional data table.
bool mbShowPhonetic
True = cells in row have explicit formatting.
const sal_Int32 BIFF12_ID_CELL_ERROR
Definition: biffhelper.hxx:45
sal_uInt16 readuInt16()
std::shared_ptr< RichString > RichStringRef
Definition: richstring.hxx:261
sal_Int32 mnSharedId
Type of the formula (regular, array, shared, table).
bool mbRef1Deleted
True = row oriented data table.
const sal_Int32 BIFF12_ID_CELL_DOUBLE
Definition: biffhelper.hxx:44
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
Definition: biffhelper.hxx:146
void importCellSi(SequenceInputStream &rStrm, CellType eCellType)
Imports a string cell from a CELL_SI or MULTCELL_SI record.
bool isValidArrayRef(const ScAddress &rCellAddr)
Returns true, if the passed cell address is valid for an array formula.
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.
Definition: biffhelper.cxx:38
Stores settings and formatting data about a sheet row.
bool getFlag(Type nBitField, Type nMask)
const sal_Int32 BIFF12_ID_FORMULA_BOOL
Definition: biffhelper.hxx:127
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 &)
Array (matrix) formula.
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
Definition: biffhelper.hxx:216
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
bool isValidSharedRef(const ScAddress &rCellAddr)
Returns true, if the passed cell address is valid for a shared formula.
const sal_Int32 BIFF12_ID_SHAREDFMLA
Definition: biffhelper.hxx:214
const sal_Int32 BIFF12_ID_CELL_RK
Definition: biffhelper.hxx:46
void insertColSpan(const ValueRange &rColSpan)
Inserts the passed column span into the row model.
XML_TOKEN_INVALID
const sal_Int32 BIFF12_ID_MULTCELL_BOOL
Definition: biffhelper.hxx:141
const char * getChar(sal_Int32 nAttrToken) const
const sal_Int32 BIFF12_ID_MULTCELL_BLANK
Definition: biffhelper.hxx:140
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
Definition: biffhelper.hxx:147
const sal_Int32 BIFF12_ID_FORMULA_STRING
Definition: biffhelper.hxx:125
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.
SCCOL Col() const
Definition: address.hxx:267
sal_Int32 mnXfId
Row height in points.
const sal_Int32 BIFF12_ID_MULTCELL_RSTRING
Definition: biffhelper.hxx:145
css::uno::Sequence< ApiToken > ApiTokenSequence
virtual void onCharacters(const OUString &rChars) override
Fragment handler derived from the WorksheetHelper helper class.
virtual void onEndElement() override
float v
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
Definition: biffhelper.hxx:32
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.
unsigned char sal_uInt8
Context handler derived from the WorksheetHelper helper class.
sal_Int32 mnFormulaType
Formula range for array/shared formulas and data tables.
const sal_Int32 BIFF12_ID_CELL_STRING
Definition: biffhelper.hxx:49
#define SAL_INFO(area, stream)
static OUString generateAddress2dString(const ScAddress &rAddress, bool bAbsolute)
Generates a cell address string in A1 notation from the passed cell address.
const sal_Int32 BIFF12_ID_CELL_BOOL
Definition: biffhelper.hxx:43
sal_Int16 mnSheet
Settings for a cell formula.
void * p
const sal_Int32 BIFF12_ID_ROW
Definition: biffhelper.hxx:209
const sal_Int32 BIFF12_ID_FORMULA_ERROR
Definition: biffhelper.hxx:128
bool mbRef2Deleted
True = first reference cell deleted.
bool mbShowPhonetic
XF (cell formatting) identifier.
const sal_Int32 BIFF12_ID_DATATABLE
Definition: biffhelper.hxx:86
const sal_Int32 BIFF12_ID_MULTCELL_RK
Definition: biffhelper.hxx:144
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.
sal_Int32 mnRow
bool isEof() const
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
Definition: biffhelper.hxx:42
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
Definition: biffhelper.hxx:47
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