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 -*- */
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 */
20#pragma once
22#include "autofilterbuffer.hxx"
24#include "workbookhelper.hxx"
26namespace oox::xls {
31 OUString maProgName;
32 OUString maDisplayName;
33 sal_Int32 mnId;
34 sal_Int32 mnType;
35 sal_Int32 mnHeaderRows;
36 sal_Int32 mnTotalsRows;
38 explicit TableModel();
41class Table : public WorkbookHelper
44 explicit Table( const WorkbookHelper& rHelper );
47 void importTable( const AttributeList& rAttribs, sal_Int16 nSheet );
49 void importTable( SequenceInputStream& rStrm, sal_Int16 nSheet );
56 void finalizeImport();
57 void applyAutoFilters();
58 void applyTableColumns();
61 sal_Int32 getTableId() const { return maModel.mnId; }
63 sal_Int32 getTokenIndex() const { return mnTokenIndex; }
65 const OUString& getDisplayName() const { return maModel.maDisplayName; }
68 const ScRange& getOriginalRange() const { return maModel.maRange; }
70 const ScRange& getRange() const { return maDestRange; }
72 SCCOL getWidth() const { return maDestRange.aEnd.Col() - maDestRange.aStart.Col() + 1; }
74 SCROW getHeight() const { return maDestRange.aEnd.Row() - maDestRange.aStart.Row() + 1; }
76 sal_Int32 getHeaderRows() const { return maModel.mnHeaderRows; }
78 sal_Int32 getTotalsRows() const { return maModel.mnTotalsRows; }
84 OUString maDBRangeName;
86 sal_Int32 mnTokenIndex;
89typedef std::shared_ptr< Table > TableRef;
94 explicit TableBuffer( const WorkbookHelper& rHelper );
100 void finalizeImport();
102 void applyAutoFilters();
104 void applyTableColumns();
106 TableRef getTable( sal_Int32 nTableId ) const;
108 TableRef getTable( const OUString& rDispName ) const;
112 void insertTableToMaps( const TableRef& rxTable );
122} // namespace oox::xls
124/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SCROW Row() const
Definition: address.hxx:274
SCCOL Col() const
Definition: address.hxx:279
ScAddress aEnd
Definition: address.hxx:498
ScAddress aStart
Definition: address.hxx:497
AutoFilter & createAutoFilter()
Creates a new auto filter and stores it internally.
Table & createTable()
Creates a new empty table.
RefVector< Table > TableVector
TableRef getTable(sal_Int32 nTableId) const
Returns a table by its identifier.
void applyTableColumns()
Applies columns names from created database range ( requires finalizeImport to have run before being ...
void applyAutoFilters()
Applies autofilters from created database range ( requires finalizeImport to have run before being ca...
TableBuffer(const WorkbookHelper &rHelper)
RefMap< OUString, Table > maNameTables
void insertTableToMaps(const TableRef &rxTable)
Inserts the passed table into the maps according to its identifier and name.
RefMap< sal_Int32, Table > maIdTables
void finalizeImport()
Creates database ranges from all imported tables.
TableColumns & createTableColumns()
Creates a new table columns object and stores it internally.
SCCOL getWidth() const
Returns the number of columns of this table.
Definition: tablebuffer.hxx:72
void applyAutoFilters()
TableModel maModel
Definition: tablebuffer.hxx:81
TableColumnsBuffer maTableColumns
Filter settings for this table.
Definition: tablebuffer.hxx:83
sal_Int32 mnTokenIndex
Validated range of the table in the worksheet.
Definition: tablebuffer.hxx:86
sal_Int32 getTokenIndex() const
Returns the token index used in API token arrays (
Definition: tablebuffer.hxx:63
sal_Int32 getHeaderRows() const
Returns the number of header rows in the table range.
Definition: tablebuffer.hxx:76
void applyTableColumns()
void finalizeImport()
Creates a database range from this tables.
Definition: tablebuffer.cxx:85
OUString maDBRangeName
Column names of this table.
Definition: tablebuffer.hxx:84
const ScRange & getOriginalRange() const
Returns the original (unchecked) total range of the table.
Definition: tablebuffer.hxx:68
sal_Int32 getTotalsRows() const
Returns the number of totals rows in the table range.
Definition: tablebuffer.hxx:78
void importTable(const AttributeList &rAttribs, sal_Int16 nSheet)
Imports a table definition from the passed attributes.
Definition: tablebuffer.cxx:57
const OUString & getDisplayName() const
Returns the original display name of the table.
Definition: tablebuffer.hxx:65
TableColumns & createTableColumns()
Creates a new tableColumns handler and stores it internally.
Definition: tablebuffer.hxx:53
const ScRange & getRange() const
Returns the cell range of this table.
Definition: tablebuffer.hxx:70
ScRange maDestRange
Name of the database range in the Calc document.
Definition: tablebuffer.hxx:85
sal_Int32 getTableId() const
Returns the unique table identifier.
Definition: tablebuffer.hxx:61
SCROW getHeight() const
Returns the number of rows of this table.
Definition: tablebuffer.hxx:74
AutoFilter & createAutoFilter()
Creates a new auto filter and stores it internally.
Definition: tablebuffer.hxx:51
AutoFilterBuffer maAutoFilters
Definition: tablebuffer.hxx:82
Table(const WorkbookHelper &rHelper)
Definition: tablebuffer.cxx:49
Helper class to provide access to global workbook data.
void SvStream & rStrm
std::shared_ptr< Table > TableRef
Definition: tablebuffer.hxx:89
sal_Int32 mnType
Unique table identifier.
Definition: tablebuffer.hxx:34
OUString maDisplayName
Programmatical name.
Definition: tablebuffer.hxx:32
OUString maProgName
Original (unchecked) range of the table.
Definition: tablebuffer.hxx:31
sal_Int32 mnId
Display name.
Definition: tablebuffer.hxx:33
Number of totals rows.
Definition: tablebuffer.cxx:41
sal_Int32 mnTotalsRows
Number of header rows.
Definition: tablebuffer.hxx:36
sal_Int32 mnHeaderRows
Table type (worksheet, query, etc.).
Definition: tablebuffer.hxx:35
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17