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 
25 #include <oox/token/namespaces.hxx>
26 #include <oox/token/tokens.hxx>
27 #include <addressconverter.hxx>
28 #include <biffhelper.hxx>
29 #include <formulaparser.hxx>
30 #include <richstringcontext.hxx>
31 #include <sal/log.hxx>
32 
33 namespace oox::xls {
34 
35 using ::oox::core::ContextHandlerRef;
36 
37 namespace {
38 
39 // record constants -----------------------------------------------------------
40 
41 const sal_uInt32 BIFF12_CELL_SHOWPHONETIC = 0x01000000;
42 
43 const sal_uInt8 BIFF12_DATATABLE_ROW = 0x01;
44 const sal_uInt8 BIFF12_DATATABLE_2D = 0x02;
45 const sal_uInt8 BIFF12_DATATABLE_REF1DEL = 0x04;
46 const sal_uInt8 BIFF12_DATATABLE_REF2DEL = 0x08;
47 
48 const sal_uInt16 BIFF12_ROW_THICKTOP = 0x0001;
49 const sal_uInt16 BIFF12_ROW_THICKBOTTOM = 0x0002;
50 const sal_uInt16 BIFF12_ROW_COLLAPSED = 0x0800;
51 const sal_uInt16 BIFF12_ROW_HIDDEN = 0x1000;
52 const sal_uInt16 BIFF12_ROW_CUSTOMHEIGHT = 0x2000;
53 const sal_uInt16 BIFF12_ROW_CUSTOMFORMAT = 0x4000;
54 const sal_uInt8 BIFF12_ROW_SHOWPHONETIC = 0x01;
55 
56 } // namespace
57 
59  WorksheetContextBase( rFragment ),
60  mrAddressConv( rFragment.getAddressConverter() ),
61  mrSheetData( rFragment.getSheetData() ),
62  mnSheet( rFragment.getSheetIndex() ),
63  mbHasFormula( false ),
64  mbValidRange( false ),
65  mnRow( -1 ),
66  mnCol( -1 )
67 {
68  SAL_INFO( "sc.filter", "start safe sheet data context - unlock" );
69  mxFormulaParser.reset(rFragment.createFormulaParser());
70 }
71 
73 {
74  SAL_INFO( "sc.filter", "end safe sheet data context - relock" );
75 }
76 
78 {
79  switch( getCurrentElement() )
80  {
81  case XLS_TOKEN( sheetData ):
82  if( nElement == XLS_TOKEN( row ) ) { importRow( rAttribs ); return this; }
83  break;
84 
85  case XLS_TOKEN( row ):
86  // do not process cell elements with invalid (out-of-range) address
87  if( nElement == XLS_TOKEN( c ) && importCell( rAttribs ) )
88  return this;
89  break;
90 
91  case XLS_TOKEN( c ):
92  switch( nElement )
93  {
94  case XLS_TOKEN( is ):
95  mxInlineStr = std::make_shared<RichString>( *this );
96  return new RichStringContext( *this, mxInlineStr );
97  case XLS_TOKEN( v ):
98  return this; // characters contain cell value
99  case XLS_TOKEN( f ):
100  importFormula( rAttribs );
101  return this; // characters contain formula string
102  }
103  break;
104  }
105  return nullptr;
106 }
107 
108 void SheetDataContext::onCharacters( const OUString& rChars )
109 {
110  switch( getCurrentElement() )
111  {
112  case XLS_TOKEN( v ):
113  maCellValue = rChars;
114  break;
115  case XLS_TOKEN( f ):
117  {
118  maFormulaStr = rChars;
119  }
120  break;
121  }
122 }
123 
125 {
126  if( getCurrentElement() != XLS_TOKEN( c ) )
127  return;
128 
129  // try to create a formula cell
130  if( mbHasFormula ) switch( maFmlaData.mnFormulaType )
131  {
132  // will buffer formulas but need to
133  // a) need to set format first
134  // :/
135  case XML_normal:
138 
139  // If a number cell has some preloaded value, stick it into the buffer
140  // but do this only for real cell formulas (not array, shared etc.)
141  if (!maCellValue.isEmpty())
143  break;
144 
145  case XML_shared:
146  if( maFmlaData.mnSharedId >= 0 )
147  {
150 
153  }
154  else
155  // no success, set plain cell value and formatting below
156  mbHasFormula = false;
157  break;
158  case XML_array:
160  {
162  }
163  // set cell formatting, but do not set result as cell value
165  break;
166  case XML_dataTable:
167  if( mbValidRange )
169  // set cell formatting, but do not set result as cell value
171  break;
172  default:
173  OSL_ENSURE( maFmlaData.mnFormulaType == XML_TOKEN_INVALID, "SheetDataContext::onEndElement - unknown formula type" );
174  mbHasFormula = false;
175  }
176 
177  if( mbHasFormula )
178  return;
179 
180  // no formula created: try to set the cell value
181  if( !maCellValue.isEmpty() ) switch( maCellData.mnCellType )
182  {
183  case XML_n:
185  break;
186  case XML_b:
187  mrSheetData.setBooleanCell( maCellData, maCellValue.toDouble() != 0.0 );
188  break;
189  case XML_e:
191  break;
192  case XML_str:
194  break;
195  case XML_s:
197  break;
198  case XML_d:
200  break;
201  }
202  else if( (maCellData.mnCellType == XML_inlineStr) && mxInlineStr )
203  {
204  mxInlineStr->finalizeImport();
206  }
207  else
208  {
209  // empty cell, update cell type
212  }
213 }
214 
216 {
217  switch( getCurrentElement() )
218  {
219  case BIFF12_ID_SHEETDATA:
220  if( nRecId == BIFF12_ID_ROW ) { importRow( rStrm ); return this; }
221  break;
222 
223  case BIFF12_ID_ROW:
224  switch( nRecId )
225  {
226  case BIFF12_ID_ARRAY: importArray( rStrm ); break;
227  case BIFF12_ID_CELL_BOOL: importCellBool( rStrm, CELLTYPE_VALUE ); break;
228  case BIFF12_ID_CELL_BLANK: importCellBlank( rStrm, CELLTYPE_VALUE ); break;
230  case BIFF12_ID_CELL_ERROR: importCellError( rStrm, CELLTYPE_VALUE ); break;
231  case BIFF12_ID_CELL_RK: importCellRk( rStrm, CELLTYPE_VALUE ); break;
233  case BIFF12_ID_CELL_SI: importCellSi( rStrm, CELLTYPE_VALUE ); break;
235  case BIFF12_ID_DATATABLE: importDataTable( rStrm ); break;
244  case BIFF12_ID_MULTCELL_RK: importCellRk( rStrm, CELLTYPE_MULTI ); break;
246  case BIFF12_ID_MULTCELL_SI: importCellSi( rStrm, CELLTYPE_MULTI ); break;
248  case BIFF12_ID_SHAREDFMLA: importSharedFmla( rStrm ); break;
249  }
250  break;
251  }
252  return nullptr;
253 }
254 
255 // private --------------------------------------------------------------------
256 
258 {
259  RowModel aModel;
260  sal_Int32 nRow = rAttribs.getInteger( XML_r, -1 ); // 1-based row index
261  if(nRow != -1)
262  {
263  aModel.mnRow = nRow;
264  mnRow = nRow-1; // to 0-based row index.
265  }
266  else
267  aModel.mnRow = (++mnRow + 1); // increment 0-based row index, to 1-based model row
268  mrAddressConv.checkRow( mnRow, true);
269  mnCol = -1;
270 
271  aModel.mfHeight = rAttribs.getDouble( XML_ht, -1.0 );
272  aModel.mnXfId = rAttribs.getInteger( XML_s, -1 );
273  aModel.mnLevel = rAttribs.getInteger( XML_outlineLevel, 0 );
274  aModel.mbCustomHeight = rAttribs.getBool( XML_customHeight, false );
275  aModel.mbCustomFormat = rAttribs.getBool( XML_customFormat, false );
276  aModel.mbShowPhonetic = rAttribs.getBool( XML_ph, false );
277  aModel.mbHidden = rAttribs.getBool( XML_hidden, false );
278  aModel.mbCollapsed = rAttribs.getBool( XML_collapsed, false );
279  aModel.mbThickTop = rAttribs.getBool( XML_thickTop, false );
280  aModel.mbThickBottom = rAttribs.getBool( XML_thickBot, false );
281 
282  if (aModel.mfHeight > 0 && getFilter().isMSODocument())
283  {
284  aModel.mfHeight -= fmod(aModel.mfHeight, 0.75); //round down to 0.75pt
285  }
286 
287  // decode the column spans (space-separated list of colon-separated integer pairs)
288  OUString aColSpansText = rAttribs.getString( XML_spans, OUString() );
289  sal_Int32 nMaxCol = mrAddressConv.getMaxApiAddress().Col();
290  sal_Int32 nIndex = 0;
291  while( nIndex >= 0 )
292  {
293  OUString aColSpanToken = aColSpansText.getToken( 0, ' ', nIndex );
294  sal_Int32 nSepPos = aColSpanToken.indexOf( ':' );
295  if( (0 < nSepPos) && (nSepPos + 1 < aColSpanToken.getLength()) )
296  {
297  // OOXML uses 1-based integer column indexes, row model expects 0-based colspans
298  const sal_Int32 nCol1 = aColSpanToken.copy( 0, nSepPos ).toInt32() - 1;
299  const bool bValid1 = mrAddressConv.checkCol( nCol1, true);
300  if (bValid1)
301  {
302  const sal_Int32 nCol2 = aColSpanToken.copy( nSepPos + 1 ).toInt32() - 1;
303  mrAddressConv.checkCol( nCol2, true);
304  aModel.insertColSpan( ValueRange( nCol1, ::std::min( nCol2, nMaxCol )));
305  }
306  }
307  }
308 
309  // set row properties in the current sheet
310  setRowModel( aModel );
311 }
312 
314 {
315  bool bValid = true;
316  const char* p = rAttribs.getChar(XML_r);
317 
318  if (!p)
319  {
320  ++mnCol;
321  ScAddress aAddress( mnCol, mnRow, mnSheet );
322  bValid = mrAddressConv.checkCellAddress( aAddress, true );
323  maCellData.maCellAddr = aAddress;
324  }
325  else
326  {
329  }
330 
331  if( bValid )
332  {
333  maCellData.mnCellType = rAttribs.getToken( XML_t, XML_n );
334  maCellData.mnXfId = rAttribs.getInteger( XML_s, -1 );
335  maCellData.mbShowPhonetic = rAttribs.getBool( XML_ph, false );
336 
337  // reset cell value, formula settings, and inline string
338  maCellValue.clear();
339  mxInlineStr.reset();
340  mbHasFormula = false;
341 
342  // update used area of the sheet
344  }
345  return bValid;
346 }
347 
349 {
350  mbHasFormula = true;
351  mbValidRange = mrAddressConv.convertToCellRange( maFmlaData.maFormulaRef, rAttribs.getString( XML_ref, OUString() ), mnSheet, true, true );
352 
353  maFmlaData.mnFormulaType = rAttribs.getToken( XML_t, XML_normal );
354  maFmlaData.mnSharedId = rAttribs.getInteger( XML_si, -1 );
355 
356  if( maFmlaData.mnFormulaType == XML_dataTable )
357  {
358  maTableData.maRef1 = rAttribs.getString( XML_r1, OUString() );
359  maTableData.maRef2 = rAttribs.getString( XML_r2, OUString() );
360  maTableData.mb2dTable = rAttribs.getBool( XML_dt2D, false );
361  maTableData.mbRowTable = rAttribs.getBool( XML_dtr, false );
362  maTableData.mbRef1Deleted = rAttribs.getBool( XML_del1, false );
363  maTableData.mbRef2Deleted = rAttribs.getBool( XML_del2, false );
364  }
365 
366  maFormulaStr.clear();
367 }
368 
370 {
371  RowModel aModel;
372  sal_Int32 nSpanCount;
373  sal_uInt16 nHeight, nFlags1;
374  sal_uInt8 nFlags2;
375  maCurrPos.mnRow = rStrm.readInt32();
376  aModel.mnXfId = rStrm.readInt32();
377  nHeight = rStrm.readuInt16();
378  nFlags1 = rStrm.readuInt16();
379  nFlags2 = rStrm.readuChar();
380  nSpanCount = rStrm.readInt32();
381  maCurrPos.mnCol = 0;
382 
384  // row index is 0-based in BIFF12, but RowModel expects 1-based
385  aModel.mnRow = maCurrPos.mnRow + 1;
386  // row height is in twips in BIFF12, convert to points
387  aModel.mfHeight = nHeight / 20.0;
388  aModel.mnLevel = extractValue< sal_Int32 >( nFlags1, 8, 3 );
389  aModel.mbCustomHeight = getFlag( nFlags1, BIFF12_ROW_CUSTOMHEIGHT );
390  aModel.mbCustomFormat = getFlag( nFlags1, BIFF12_ROW_CUSTOMFORMAT );
391  aModel.mbShowPhonetic = getFlag( nFlags2, BIFF12_ROW_SHOWPHONETIC );
392  aModel.mbHidden = getFlag( nFlags1, BIFF12_ROW_HIDDEN );
393  aModel.mbCollapsed = getFlag( nFlags1, BIFF12_ROW_COLLAPSED );
394  aModel.mbThickTop = getFlag( nFlags1, BIFF12_ROW_THICKTOP );
395  aModel.mbThickBottom = getFlag( nFlags1, BIFF12_ROW_THICKBOTTOM );
396 
397  // read the column spans
398  sal_Int32 nMaxCol = mrAddressConv.getMaxApiAddress().Col();
399  for( sal_Int32 nSpanIdx = 0; (nSpanIdx < nSpanCount) && !rStrm.isEof(); ++nSpanIdx )
400  {
401  sal_Int32 nFirstCol, nLastCol;
402  nFirstCol = rStrm.readInt32();
403  const bool bValid1 = mrAddressConv.checkCol( nFirstCol, true);
404  nLastCol = rStrm.readInt32();
405  mrAddressConv.checkCol( nLastCol, true);
406  if (bValid1)
407  aModel.insertColSpan( ValueRange( nFirstCol, ::std::min( nLastCol, nMaxCol ) ) );
408  }
409 
410  // set row properties in the current sheet
411  setRowModel( aModel );
412 }
413 
415 {
416  switch( eCellType )
417  {
418  case CELLTYPE_VALUE:
419  case CELLTYPE_FORMULA: maCurrPos.mnCol = rStrm.readInt32(); break;
420  case CELLTYPE_MULTI: ++maCurrPos.mnCol; break;
421  }
422 
423  sal_uInt32 nXfId = rStrm.readuInt32();
424 
426  maCellData.mnXfId = extractValue< sal_Int32 >( nXfId, 0, 24 );
427  maCellData.mbShowPhonetic = getFlag( nXfId, BIFF12_CELL_SHOWPHONETIC );
428 
429  // update used area of the sheet
430  if( bValidAddr )
432  return bValidAddr;
433 }
434 
436 {
437  rStrm.skip( 2 );
438  return mxFormulaParser->importFormula( maCellData.maCellAddr, FormulaType::Cell, rStrm );
439 }
440 
442 {
443  BinRange aRange;
444  rStrm >> aRange;
445  return mrAddressConv.convertToCellRange( maFmlaData.maFormulaRef, aRange, mnSheet, true, true );
446 }
447 
449 {
450  if( readCellHeader( rStrm, eCellType ) )
451  {
452  maCellData.mnCellType = XML_b;
453  bool bValue = rStrm.readuInt8() != 0;
454  if( eCellType == CELLTYPE_FORMULA )
456  else
458  }
459 }
460 
462 {
463  OSL_ENSURE( eCellType != CELLTYPE_FORMULA, "SheetDataContext::importCellBlank - no formula cells supported" );
464  if( readCellHeader( rStrm, eCellType ) )
466 }
467 
469 {
470  if( readCellHeader( rStrm, eCellType ) )
471  {
472  maCellData.mnCellType = XML_n;
473  double fValue = rStrm.readDouble();
474  if( eCellType == CELLTYPE_FORMULA )
476  else
478  }
479 }
480 
482 {
483  if( readCellHeader( rStrm, eCellType ) )
484  {
485  maCellData.mnCellType = XML_e;
486  sal_uInt8 nErrorCode = rStrm.readuInt8();
487  if( eCellType == CELLTYPE_FORMULA )
489  else
490  mrSheetData.setErrorCell( maCellData, nErrorCode );
491  }
492 }
493 
495 {
496  OSL_ENSURE( eCellType != CELLTYPE_FORMULA, "SheetDataContext::importCellRk - no formula cells supported" );
497  if( readCellHeader( rStrm, eCellType ) )
498  {
499  maCellData.mnCellType = XML_n;
501  }
502 }
503 
505 {
506  OSL_ENSURE( eCellType != CELLTYPE_FORMULA, "SheetDataContext::importCellRString - no formula cells supported" );
507  if( readCellHeader( rStrm, eCellType ) )
508  {
509  maCellData.mnCellType = XML_inlineStr;
510  RichStringRef xString = std::make_shared<RichString>( *this );
511  xString->importString( rStrm, true );
512  xString->finalizeImport();
514  }
515 }
516 
518 {
519  OSL_ENSURE( eCellType != CELLTYPE_FORMULA, "SheetDataContext::importCellSi - no formula cells supported" );
520  if( readCellHeader( rStrm, eCellType ) )
521  {
522  maCellData.mnCellType = XML_s;
524  }
525 }
526 
528 {
529  if( readCellHeader( rStrm, eCellType ) )
530  {
531  maCellData.mnCellType = XML_inlineStr;
532  // always import the string, stream will point to formula afterwards, if existing
533  RichStringRef xString = std::make_shared<RichString>( *this );
534  xString->importString( rStrm, false );
535  xString->finalizeImport();
536  if( eCellType == CELLTYPE_FORMULA )
538  else
540  }
541 }
542 
544 {
546  {
547  rStrm.skip( 1 );
548  ApiTokenSequence aTokens = mxFormulaParser->importFormula( maCellData.maCellAddr, FormulaType::Array, rStrm );
550  }
551 }
552 
554 {
555  if( !readFormulaRef( rStrm ) )
556  return;
557 
558  BinAddress aRef1, aRef2;
559  sal_uInt8 nFlags;
560  rStrm >> aRef1 >> aRef2;
561  nFlags = rStrm.readuChar();
564  maTableData.mbRowTable = getFlag( nFlags, BIFF12_DATATABLE_ROW );
565  maTableData.mb2dTable = getFlag( nFlags, BIFF12_DATATABLE_2D );
566  maTableData.mbRef1Deleted = getFlag( nFlags, BIFF12_DATATABLE_REF1DEL );
567  maTableData.mbRef2Deleted = getFlag( nFlags, BIFF12_DATATABLE_REF2DEL );
569 }
570 
572 {
574  {
577  }
578 }
579 
580 } // namespace oox
581 
582 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OUString maFormulaStr
Inline rich string (OOXML only).
const sal_Int32 BIFF12_ID_MULTCELL_ERROR
Definition: biffhelper.hxx:142
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:141
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:47
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:125
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:44
sal_uInt16 readuInt16()
std::shared_ptr< RichString > RichStringRef
Definition: richstring.hxx:260
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:43
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:145
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.
XML_TOKEN_INVALID
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:40
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:126
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:215
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:213
const sal_Int32 BIFF12_ID_CELL_RK
Definition: biffhelper.hxx:45
void insertColSpan(const ValueRange &rColSpan)
Inserts the passed column span into the row model.
const sal_Int32 BIFF12_ID_MULTCELL_BOOL
Definition: biffhelper.hxx:140
const char * getChar(sal_Int32 nAttrToken) const
const sal_Int32 BIFF12_ID_MULTCELL_BLANK
Definition: biffhelper.hxx:139
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:146
const sal_Int32 BIFF12_ID_FORMULA_STRING
Definition: biffhelper.hxx:124
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:266
sal_Int32 mnXfId
Row height in points.
const sal_Int32 BIFF12_ID_MULTCELL_RSTRING
Definition: biffhelper.hxx:144
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:31
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:48
#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.
XmlFilterBase & getFilter() const
const sal_Int32 BIFF12_ID_CELL_BOOL
Definition: biffhelper.hxx:42
sal_Int16 mnSheet
Settings for a cell formula.
void * p
const sal_Int32 BIFF12_ID_ROW
Definition: biffhelper.hxx:208
const sal_Int32 BIFF12_ID_FORMULA_ERROR
Definition: biffhelper.hxx:127
bool mbRef2Deleted
True = first reference cell deleted.
bool mbShowPhonetic
XF (cell formatting) identifier.
const sal_Int32 BIFF12_ID_DATATABLE
Definition: biffhelper.hxx:85
const sal_Int32 BIFF12_ID_MULTCELL_RK
Definition: biffhelper.hxx:143
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:41
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:46
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