fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sc / source / filter / inc / sheetdatacontext.hxx
blob206d36500f65f22e983b5dc3859c79ddb6658ea5
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SC_SOURCE_FILTER_INC_SHEETDATACONTEXT_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_SHEETDATACONTEXT_HXX
23 #include "excelhandlers.hxx"
24 #include "richstring.hxx"
25 #include "sheetdatabuffer.hxx"
26 #include <vcl/svapp.hxx>
28 #define MULTI_THREAD_SHEET_PARSING 1
30 namespace oox {
31 namespace xls {
33 /** Used as base for sheet data context classes. Provides fast access to often
34 used converter objects and sheet index, to improve performance.
36 struct SheetDataContextBase
38 AddressConverter& mrAddressConv; /// The address converter.
39 std::unique_ptr<FormulaParser> mxFormulaParser; /// The formula parser, different one for each SheetDataContext
40 SheetDataBuffer& mrSheetData; /// The sheet data buffer for cell content and formatting.
41 CellModel maCellData; /// Position, contents, formatting of current imported cell.
42 CellFormulaModel maFmlaData; /// Settings for a cell formula.
43 sal_Int16 mnSheet; /// Index of the current sheet.
45 explicit SheetDataContextBase( const WorksheetHelper& rHelper );
46 virtual ~SheetDataContextBase();
49 /** This class implements importing the sheetData element.
51 The sheetData element contains all row settings and all cells in a single
52 sheet of a spreadsheet document.
54 class SheetDataContext : public WorksheetContextBase, private SheetDataContextBase
56 // If we are doing threaded parsing, this SheetDataContext
57 // forms the inner loop for bulk data parsing, and for the
58 // duration of this we can drop the solar mutex.
59 #if MULTI_THREAD_SHEET_PARSING
60 SolarMutexReleaser aReleaser;
61 #endif
63 public:
64 explicit SheetDataContext( WorksheetFragmentBase& rFragment );
65 virtual ~SheetDataContext();
67 protected:
68 virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) SAL_OVERRIDE;
69 virtual void onCharacters( const OUString& rChars ) SAL_OVERRIDE;
70 virtual void onEndElement() SAL_OVERRIDE;
72 virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ) SAL_OVERRIDE;
74 private:
75 /** Different types of cell records. */
76 enum CellType { CELLTYPE_VALUE, CELLTYPE_MULTI, CELLTYPE_FORMULA };
78 /** Imports row settings from a row element. */
79 void importRow( const AttributeList& rAttribs );
80 /** Imports cell settings from a c element. */
81 bool importCell( const AttributeList& rAttribs );
82 /** Imports cell settings from an f element. */
83 void importFormula( const AttributeList& rAttribs );
85 /** Imports row settings from a ROW record. */
86 void importRow( SequenceInputStream& rStrm );
88 /** Reads a cell address and the following XF identifier. */
89 bool readCellHeader( SequenceInputStream& rStrm, CellType eCellType );
90 /** Reads a cell formula for the current cell. */
91 ApiTokenSequence readCellFormula( SequenceInputStream& rStrm );
92 /** Reads the formula range used by shared formulas, arrays, and data tables. */
93 bool readFormulaRef( SequenceInputStream& rStrm );
95 /** Imports an empty cell from a CELL_BLANK or MULTCELL_BLANK record. */
96 void importCellBlank( SequenceInputStream& rStrm, CellType eCellType );
97 /** Imports a boolean cell from a CELL_BOOL, MULTCELL_BOOL, or FORMULA_BOOL record. */
98 void importCellBool( SequenceInputStream& rStrm, CellType eCellType );
99 /** Imports a numeric cell from a CELL_DOUBLE, MULTCELL_DOUBLE, or FORMULA_DOUBLE record. */
100 void importCellDouble( SequenceInputStream& rStrm, CellType eCellType );
101 /** Imports an error code cell from a CELL_ERROR, MULTCELL_ERROR, or FORMULA_ERROR record. */
102 void importCellError( SequenceInputStream& rStrm, CellType eCellType );
103 /** Imports an encoded numeric cell from a CELL_RK or MULTCELL_RK record. */
104 void importCellRk( SequenceInputStream& rStrm, CellType eCellType );
105 /** Imports a rich-string cell from a CELL_RSTRING or MULTCELL_RSTRING record. */
106 void importCellRString( SequenceInputStream& rStrm, CellType eCellType );
107 /** Imports a string cell from a CELL_SI or MULTCELL_SI record. */
108 void importCellSi( SequenceInputStream& rStrm, CellType eCellType );
109 /** Imports a string cell from a CELL_STRING, MULTCELL_STRING, or FORMULA_STRING record. */
110 void importCellString( SequenceInputStream& rStrm, CellType eCellType );
112 /** Imports an array formula from an ARRAY record. */
113 void importArray( SequenceInputStream& rStrm );
114 /** Imports table operation from a DATATABLE record. */
115 void importDataTable( SequenceInputStream& rStrm );
116 /** Imports a shared formula from a SHAREDFORMULA record. */
117 void importSharedFmla( SequenceInputStream& rStrm );
119 private:
120 OUString maCellValue; /// Cell value string (OOXML only).
121 RichStringRef mxInlineStr; /// Inline rich string (OOXML only).
122 OUString maFormulaStr;
123 DataTableModel maTableData; /// Settings for table operations.
124 BinAddress maCurrPos; /// Current cell position (BIFF12 only).
125 bool mbHasFormula; /// True = current cell has formula data (OOXML only).
126 bool mbValidRange; /// True = maFmlaData.maFormulaRef is valid (OOXML only).
128 sal_Int32 mnRow; /// row index (0-based)
129 sal_Int32 mnCol; /// column index (0-based)
132 } // namespace xls
133 } // namespace oox
135 #endif
137 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */