22#include <com/sun/star/beans/XPropertySet.hpp>
23#include <com/sun/star/sheet/XDatabaseRange.hpp>
24#include <com/sun/star/sheet/XDatabaseRanges.hpp>
25#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
26#include <osl/diagnose.h>
31#include <oox/token/properties.hxx>
32#include <oox/token/tokens.hxx>
51 maAutoFilters( rHelper ),
52 maTableColumns( rHelper ),
98 Reference< XDatabaseRange > xDatabaseRange(
100 ::css::table::CellRangeAddress aAddressRange = xDatabaseRange->getDataArea();
101 maDestRange =
ScRange( aAddressRange.StartColumn, aAddressRange.StartRow, aAddressRange.Sheet,
102 aAddressRange.EndColumn, aAddressRange.EndRow, aAddressRange.Sheet );
128 OSL_FAIL(
"Table::finalizeImport - cannot create database range" );
141 Reference< XDatabaseRanges > xDatabaseRanges( aDocProps.
getAnyProperty( PROP_DatabaseRanges ), UNO_QUERY_THROW );
142 Reference< XDatabaseRange > xDatabaseRange( xDatabaseRanges->getByName(
maDBRangeName ), UNO_QUERY );
147 OSL_FAIL(
"Table::applyAutofilters - cannot create filter" );
171 for(
const auto& rxTable :
maTables )
201 sal_Int32 nTableId = rxTable->getTableId();
202 const OUString& rDispName = rxTable->getDisplayName();
203 if( (nTableId > 0) && !rDispName.isEmpty() )
205 OSL_ENSURE( !
maIdTables.has( nTableId ),
"TableBuffer::insertTableToMaps - multiple table identifier" );
207 OSL_ENSURE( !
maNameTables.has( rDispName ),
"TableBuffer::insertTableToMaps - multiple table name" );
std::optional< OUString > getXString(sal_Int32 nAttrToken) const
std::optional< sal_Int32 > getInteger(sal_Int32 nAttrToken) const
std::optional< OUString > getString(sal_Int32 nAttrToken) const
std::optional< sal_Int32 > getToken(sal_Int32 nAttrToken) const
css::uno::Any getAnyProperty(sal_Int32 nPropId) const
bool getProperty(Type &orValue, sal_Int32 nPropId) const
bool setProperty(sal_Int32 nPropId, const Type &rValue)
container_type::value_type value_type
static bool convertToCellRangeUnchecked(ScRange &orRange, std::u16string_view aString, sal_Int16 nSheet)
Converts the passed string to a cell range address, without checking any sheet limits.
void finalizeImport(sal_Int16 nSheet)
Applies filter settings to a new database range object (used for sheet autofilter or advanced filter ...
Table & createTable()
Creates a new empty table.
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.
void finalizeImport(ScDBData *pDBData)
Applies the table columns to the passed database range.
TableColumnsBuffer maTableColumns
Filter settings for this table.
sal_Int32 mnTokenIndex
Validated range of the table in the worksheet.
void finalizeImport()
Creates a database range from this tables.
OUString maDBRangeName
Column names of this table.
void importTable(const AttributeList &rAttribs, sal_Int16 nSheet)
Imports a table definition from the passed attributes.
ScRange maDestRange
Name of the database range in the Calc document.
AutoFilterBuffer maAutoFilters
Table(const WorkbookHelper &rHelper)
Helper class to provide access to global workbook data.
css::uno::Reference< css::sheet::XDatabaseRange > createDatabaseRangeObject(OUString &orName, const ScRange &rRangeAddr) const
Creates and returns a database range on-the-fly in the Calc document.
ScDBData * findDatabaseRangeByIndex(sal_uInt16 nIndex) const
Finds the (already existing) database range of the given formula token index.
const css::uno::Reference< css::sheet::XSpreadsheetDocument > & getDocument() const
Returns a reference to the source/target spreadsheet document model.
#define STATIC_ARRAY_SELECT(array, index, def)
#define SAL_WARN_IF(condition, area, stream)
std::shared_ptr< Table > TableRef
A 2D cell range address struct for binary filters.
sal_Int32 mnType
Unique table identifier.
OUString maDisplayName
Programmatical name.
OUString maProgName
Original (unchecked) range of the table.
sal_Int32 mnId
Display name.
TableModel()
Number of totals rows.
sal_Int32 mnTotalsRows
Number of header rows.
sal_Int32 mnHeaderRows
Table type (worksheet, query, etc.).