LibreOffice Module sc (master) 1
sheetdatacontext.hxx
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#pragma once
21
22#include <memory>
23#include "addressconverter.hxx"
24#include "excelhandlers.hxx"
25#include "richstring.hxx"
26#include "sheetdatabuffer.hxx"
27#include <vcl/svapp.hxx>
28
29#define MULTI_THREAD_SHEET_PARSING 1
30
31namespace oox::xls {
32
39{
41 std::unique_ptr<FormulaParser> mxFormulaParser;
45 sal_Int16 mnSheet;
46 // If we are doing threaded parsing, this SheetDataContext
47 // forms the inner loop for bulk data parsing, and for the
48 // duration of this we can drop the solar mutex.
49#if MULTI_THREAD_SHEET_PARSING
51#endif
52
53public:
54 explicit SheetDataContext( WorksheetFragmentBase& rFragment );
55 virtual ~SheetDataContext() override;
56
57protected:
58 virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
59 virtual void onCharacters( const OUString& rChars ) override;
60 virtual void onEndElement() override;
61
62 virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ) override;
63
64private:
67
69 void importRow( const AttributeList& rAttribs );
71 bool importCell( const AttributeList& rAttribs );
73 void importFormula( const AttributeList& rAttribs );
74
76 void importRow( SequenceInputStream& rStrm );
77
79 bool readCellHeader( SequenceInputStream& rStrm, CellType eCellType );
84
86 void importCellBlank( SequenceInputStream& rStrm, CellType eCellType );
88 void importCellBool( SequenceInputStream& rStrm, CellType eCellType );
90 void importCellDouble( SequenceInputStream& rStrm, CellType eCellType );
92 void importCellError( SequenceInputStream& rStrm, CellType eCellType );
94 void importCellRk( SequenceInputStream& rStrm, CellType eCellType );
96 void importCellRString( SequenceInputStream& rStrm, CellType eCellType );
98 void importCellSi( SequenceInputStream& rStrm, CellType eCellType );
100 void importCellString( SequenceInputStream& rStrm, CellType eCellType );
101
103 void importArray( SequenceInputStream& rStrm );
108
109private:
110 OUString maCellValue;
112 OUString maFormulaStr;
117
118 sal_Int32 mnRow;
119 sal_Int32 mnCol;
120};
121
122} // namespace oox::xls
123
124/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Converter for cell addresses and cell ranges for OOXML and BIFF filters.
Manages the cell contents and cell formatting of a sheet.
This class implements importing the sheetData element.
void importCellString(SequenceInputStream &rStrm, CellType eCellType)
Imports a string cell from a CELL_STRING, MULTCELL_STRING, or FORMULA_STRING record.
CellFormulaModel maFmlaData
Position, contents, formatting of current imported cell.
SheetDataContext(WorksheetFragmentBase &rFragment)
void importCellBool(SequenceInputStream &rStrm, CellType eCellType)
Imports a boolean cell from a CELL_BOOL, MULTCELL_BOOL, or FORMULA_BOOL record.
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.
bool readFormulaRef(SequenceInputStream &rStrm)
Reads the formula range used by shared formulas, arrays, and data tables.
RichStringRef mxInlineStr
Cell value string (OOXML only).
SheetDataBuffer & mrSheetData
The formula parser, different one for each SheetDataContext.
bool mbValidRange
True = current cell has formula data (OOXML only).
virtual void onCharacters(const OUString &rChars) override
void importCellDouble(SequenceInputStream &rStrm, CellType eCellType)
Imports a numeric cell from a CELL_DOUBLE, MULTCELL_DOUBLE, or FORMULA_DOUBLE record.
virtual ::oox::core::ContextHandlerRef onCreateRecordContext(sal_Int32 nRecId, SequenceInputStream &rStrm) override
sal_Int32 mnRow
True = maFmlaData.maFormulaRef is valid (OOXML only).
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
void importCellBlank(SequenceInputStream &rStrm, CellType eCellType)
Imports an empty cell from a CELL_BLANK or MULTCELL_BLANK record.
virtual ~SheetDataContext() override
BinAddress maCurrPos
Settings for table operations.
void importCellRk(SequenceInputStream &rStrm, CellType eCellType)
Imports an encoded numeric cell from a CELL_RK or MULTCELL_RK record.
void importDataTable(SequenceInputStream &rStrm)
Imports table operation from a DATATABLE record.
SolarMutexReleaser aReleaser
Index of the current sheet.
sal_Int16 mnSheet
Settings for a cell formula.
void importArray(SequenceInputStream &rStrm)
Imports an array formula from an ARRAY record.
void importCellError(SequenceInputStream &rStrm, CellType eCellType)
Imports an error code cell from a CELL_ERROR, MULTCELL_ERROR, or FORMULA_ERROR record.
bool importCell(const AttributeList &rAttribs)
Imports cell settings from a c element.
CellType
Different types of cell records.
virtual void onEndElement() override
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.
CellModel maCellData
The sheet data buffer for cell content and formatting.
std::unique_ptr< FormulaParser > mxFormulaParser
The address converter.
bool readCellHeader(SequenceInputStream &rStrm, CellType eCellType)
Reads a cell address and the following XF identifier.
bool mbHasFormula
Current cell position (BIFF12 only).
AddressConverter & mrAddressConv
void importFormula(const AttributeList &rAttribs)
Imports cell settings from an f element.
sal_Int32 mnCol
row index (0-based)
OUString maFormulaStr
Inline rich string (OOXML only).
ApiTokenSequence readCellFormula(SequenceInputStream &rStrm)
Reads a cell formula for the current cell.
Context handler derived from the WorksheetHelper helper class.
Fragment handler derived from the WorksheetHelper helper class.
CellType
Definition: global.hxx:271
css::uno::Sequence< ApiToken > ApiTokenSequence
std::shared_ptr< RichString > RichStringRef
Definition: richstring.hxx:258
A 2D cell address struct for binary filters.
Stores data about cell formulas.
Stores basic data about cell values and formatting.
Stores data about table operations.