LibreOffice Module sc (master)  1
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
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 .
18  */
23 #include <memory>
24 #include "addressconverter.hxx"
25 #include "excelhandlers.hxx"
26 #include "richstring.hxx"
27 #include "sheetdatabuffer.hxx"
28 #include <vcl/svapp.hxx>
32 namespace oox::xls {
40 {
42  std::unique_ptr<FormulaParser> mxFormulaParser;
46  sal_Int16 mnSheet;
47  // If we are doing threaded parsing, this SheetDataContext
48  // forms the inner loop for bulk data parsing, and for the
49  // duration of this we can drop the solar mutex.
52 #endif
54 public:
55  explicit SheetDataContext( WorksheetFragmentBase& rFragment );
56  virtual ~SheetDataContext() override;
58 protected:
59  virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
60  virtual void onCharacters( const OUString& rChars ) override;
61  virtual void onEndElement() override;
63  virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ) override;
65 private:
70  void importRow( const AttributeList& rAttribs );
72  bool importCell( const AttributeList& rAttribs );
74  void importFormula( const AttributeList& rAttribs );
77  void importRow( SequenceInputStream& rStrm );
80  bool readCellHeader( SequenceInputStream& rStrm, CellType eCellType );
84  bool readFormulaRef( SequenceInputStream& rStrm );
87  void importCellBlank( SequenceInputStream& rStrm, CellType eCellType );
89  void importCellBool( SequenceInputStream& rStrm, CellType eCellType );
91  void importCellDouble( SequenceInputStream& rStrm, CellType eCellType );
93  void importCellError( SequenceInputStream& rStrm, CellType eCellType );
95  void importCellRk( SequenceInputStream& rStrm, CellType eCellType );
97  void importCellRString( SequenceInputStream& rStrm, CellType eCellType );
99  void importCellSi( SequenceInputStream& rStrm, CellType eCellType );
101  void importCellString( SequenceInputStream& rStrm, CellType eCellType );
104  void importArray( SequenceInputStream& rStrm );
106  void importDataTable( SequenceInputStream& rStrm );
108  void importSharedFmla( SequenceInputStream& rStrm );
110 private:
111  OUString maCellValue;
113  OUString maFormulaStr;
119  sal_Int32 mnRow;
120  sal_Int32 mnCol;
121 };
123 } // namespace oox::xls
125 #endif
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OUString maFormulaStr
Inline rich string (OOXML only).
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
void importCellError(SequenceInputStream &rStrm, CellType eCellType)
Imports an error code cell from a CELL_ERROR, MULTCELL_ERROR, or FORMULA_ERROR record.
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.
Different types of cell records.
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.
void importFormula(const AttributeList &rAttribs)
Imports cell settings from an f element.
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.
std::shared_ptr< RichString > RichStringRef
Definition: richstring.hxx:261
SheetDataContext(WorksheetFragmentBase &rFragment)
void importRow(const AttributeList &rAttribs)
Imports row settings from a row element.
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.
std::unique_ptr< FormulaParser > mxFormulaParser
The address converter.
bool mbHasFormula
Current cell position (BIFF12 only).
SheetDataBuffer & mrSheetData
The formula parser, different one for each SheetDataContext.
void importCellRk(SequenceInputStream &rStrm, CellType eCellType)
Imports an encoded numeric cell from a CELL_RK or MULTCELL_RK record.
Stores basic data about cell values and formatting.
This class implements importing the sheetData element.
BinAddress maCurrPos
Settings for table operations.
sal_Int32 mnRow
True = maFmlaData.maFormulaRef is valid (OOXML only).
void importCellBool(SequenceInputStream &rStrm, CellType eCellType)
Imports a boolean cell from a CELL_BOOL, MULTCELL_BOOL, or FORMULA_BOOL record.
bool importCell(const AttributeList &rAttribs)
Imports cell settings from a c element.
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.
Converter for cell addresses and cell ranges for OOXML and BIFF filters.
Context handler derived from the WorksheetHelper helper class.
Definition: global.hxx:283
SolarMutexReleaser aReleaser
Index of the current sheet.
sal_Int16 mnSheet
Settings for a cell formula.
Stores data about cell formulas.
bool readCellHeader(SequenceInputStream &rStrm, CellType eCellType)
Reads a cell address and the following XF identifier.
sal_Int32 mnCol
row index (0-based)
virtual ::oox::core::ContextHandlerRef onCreateRecordContext(sal_Int32 nRecId, SequenceInputStream &rStrm) override
RichStringRef mxInlineStr
Cell value string (OOXML only).
CellFormulaModel maFmlaData
Position, contents, formatting of current imported cell.
virtual ~SheetDataContext() override
Stores data about table operations.
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).
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.
Manages the cell contents and cell formatting of a sheet.