summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-06-28 17:21:36 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-06-28 17:21:36 +0200
commit25ad5cbb5bdd7815593f347e2e9a4a5f5b20302f (patch)
tree71207b782f8c0fa43d2fe0784a77474b5d5230dc
parenta1830e46e8d2f4011329f7cdfe50b648beef50aa (diff)
import data table model part
Change-Id: I652c303a00bd74f18f2f221f0b57b37245419f54
-rw-r--r--sc/Library_sc.mk1
-rw-r--r--sc/Library_scfilt.mk4
-rw-r--r--sc/inc/tabledata.hxx71
-rw-r--r--sc/source/core/data/tabledata.cxx27
-rw-r--r--sc/source/filter/inc/stylesfragment.hxx14
-rw-r--r--sc/source/filter/inc/tablebuffer.hxx127
-rw-r--r--sc/source/filter/inc/tablefragment.hxx52
-rw-r--r--sc/source/filter/inc/worksheetfragment.hxx2
-rw-r--r--sc/source/filter/inc/worksheethelper.hxx5
-rw-r--r--sc/source/filter/oox/datatablebuffer.cxx25
-rw-r--r--sc/source/filter/oox/datatablebuffer.hxx33
-rw-r--r--sc/source/filter/oox/datatablefragment.cxx115
-rw-r--r--sc/source/filter/oox/datatablefragment.hxx60
-rw-r--r--sc/source/filter/oox/formulaparser.cxx128
-rw-r--r--sc/source/filter/oox/pivotcachebuffer.cxx3
-rw-r--r--sc/source/filter/oox/stylesfragment.cxx7
-rw-r--r--sc/source/filter/oox/tablebuffer.cxx173
-rw-r--r--sc/source/filter/oox/tablefragment.cxx92
-rw-r--r--sc/source/filter/oox/workbookfragment.cxx2
-rw-r--r--sc/source/filter/oox/workbookhelper.cxx2
-rw-r--r--sc/source/filter/oox/worksheetfragment.cxx23
-rw-r--r--sc/source/filter/oox/worksheethelper.cxx13
22 files changed, 389 insertions, 590 deletions
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 9b55aa4380b3..cea6b475e588 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -185,6 +185,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/core/data/table5 \
sc/source/core/data/table6 \
sc/source/core/data/table7 \
+ sc/source/core/data/tabledata \
sc/source/core/data/tabprotection \
sc/source/core/data/types \
sc/source/core/data/userdat \
diff --git a/sc/Library_scfilt.mk b/sc/Library_scfilt.mk
index d5ca53319b48..4a6772f2643e 100644
--- a/sc/Library_scfilt.mk
+++ b/sc/Library_scfilt.mk
@@ -177,10 +177,12 @@ $(eval $(call gb_Library_add_exception_objects,scfilt,\
sc/source/filter/oox/condformatcontext \
sc/source/filter/oox/connectionsbuffer \
sc/source/filter/oox/connectionsfragment \
+ sc/source/filter/oox/datatablefragment \
sc/source/filter/oox/defnamesbuffer \
sc/source/filter/oox/drawingbase \
sc/source/filter/oox/drawingfragment \
sc/source/filter/oox/drawingmanager \
+ sc/source/filter/oox/datatablebuffer \
sc/source/filter/oox/excelchartconverter \
sc/source/filter/oox/excelhandlers \
sc/source/filter/oox/excelvbaproject \
@@ -209,8 +211,6 @@ $(eval $(call gb_Library_add_exception_objects,scfilt,\
sc/source/filter/oox/sheetdatacontext \
sc/source/filter/oox/stylesbuffer \
sc/source/filter/oox/stylesfragment \
- sc/source/filter/oox/tablebuffer \
- sc/source/filter/oox/tablefragment \
sc/source/filter/oox/themebuffer \
sc/source/filter/oox/threadpool \
sc/source/filter/oox/unitconverter \
diff --git a/sc/inc/tabledata.hxx b/sc/inc/tabledata.hxx
new file mode 100644
index 000000000000..ec9a95fb625e
--- /dev/null
+++ b/sc/inc/tabledata.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SC_TABLEDATA_HXX
+#define INCLUDED_SC_TABLEDATA_HXX
+
+#include <rtl/ustring.hxx>
+#include "scdllapi.h"
+
+#include "address.hxx"
+
+#include <vector>
+
+struct SC_DLLPUBLIC ScTableDataColumn
+{
+ OUString maName;
+ size_t mnId;
+
+ ScTableDataColumn();
+};
+
+struct SC_DLLPUBLIC ScTableData
+{
+ bool mbHeaderRow;
+ bool mbTotalRow;
+ bool mbBandedRows;
+ bool mbBandedColumns;
+ bool mbFirstColumn;
+ bool mbLastColumn;
+
+ OUString maStyleName;
+ OUString maName;
+
+ ScRange maRange;
+
+ std::vector<ScTableDataColumn> maColumnData;
+
+ ScTableData();
+};
+
+struct SC_DLLPUBLIC ScTableStyle
+{
+ OUString maWholeTable;
+ OUString maFirstColumnStripe;
+ OUString maSecondColumnStripe;
+ OUString maFirstRowStripe;
+ OUString maSecondRowStripe;
+ OUString maFirstColumn;
+ OUString maLastColumn;
+ OUString maHeaderRow;
+ OUString maTotalRow;
+ OUString maFirstHeaderCell;
+ OUString maLastHeaderCell;
+ OUString maFirstTotalCell;
+ OUString maLastTotalCell;
+
+ size_t mnFirstRowStripSize;
+ size_t mnSecondRowStripeSize;
+ size_t mnFirstColumnStripeSize;
+ size_t mnSecondColumnStripeSize;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/tabledata.cxx b/sc/source/core/data/tabledata.cxx
new file mode 100644
index 000000000000..5b323747434e
--- /dev/null
+++ b/sc/source/core/data/tabledata.cxx
@@ -0,0 +1,27 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "tabledata.hxx"
+
+ScTableDataColumn::ScTableDataColumn():
+ mnId(0)
+{
+}
+
+ScTableData::ScTableData():
+ mbHeaderRow(false),
+ mbTotalRow(false),
+ mbBandedRows(false),
+ mbBandedColumns(false),
+ mbFirstColumn(false),
+ mbLastColumn(false)
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/inc/stylesfragment.hxx b/sc/source/filter/inc/stylesfragment.hxx
index 9c1836d976db..24523d66c4df 100644
--- a/sc/source/filter/inc/stylesfragment.hxx
+++ b/sc/source/filter/inc/stylesfragment.hxx
@@ -110,6 +110,20 @@ private:
DxfRef mxDxf;
};
+class TableStylesContext : public WorkbookContextBase
+{
+public:
+ template< typename ParentType >
+ inline explicit TableStylesContext( ParentType& rParent, const StylesBuffer& rStylesBuffer ) :
+ WorkbookContextBase( rParent ) {}
+
+protected:
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) SAL_OVERRIDE;
+
+
+private:
+};
+
class StylesFragment : public WorkbookFragmentBase
{
public:
diff --git a/sc/source/filter/inc/tablebuffer.hxx b/sc/source/filter/inc/tablebuffer.hxx
deleted file mode 100644
index 6202acbca2f6..000000000000
--- a/sc/source/filter/inc/tablebuffer.hxx
+++ /dev/null
@@ -1,127 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_SC_SOURCE_FILTER_INC_TABLEBUFFER_HXX
-#define INCLUDED_SC_SOURCE_FILTER_INC_TABLEBUFFER_HXX
-
-#include <com/sun/star/table/CellRangeAddress.hpp>
-#include "autofilterbuffer.hxx"
-#include "workbookhelper.hxx"
-
-namespace oox {
-namespace xls {
-
-struct TableModel
-{
- ::com::sun::star::table::CellRangeAddress
- maRange; /// Original (unchecked) range of the table.
- OUString maProgName; /// Programmatical name.
- OUString maDisplayName; /// Display name.
- sal_Int32 mnId; /// Unique table identifier.
- sal_Int32 mnType; /// Table type (worksheet, query, etc.).
- sal_Int32 mnHeaderRows; /// Number of header rows.
- sal_Int32 mnTotalsRows; /// Number of totals rows.
-
- explicit TableModel();
-};
-
-class Table : public WorkbookHelper
-{
-public:
- explicit Table( const WorkbookHelper& rHelper );
-
- /** Imports a table definition from the passed attributes. */
- void importTable( const AttributeList& rAttribs, sal_Int16 nSheet );
- /** Imports a table definition from a TABLE record. */
- void importTable( SequenceInputStream& rStrm, sal_Int16 nSheet );
- /** Creates a new auto filter and stores it internally. */
- inline AutoFilter& createAutoFilter() { return maAutoFilters.createAutoFilter(); }
-
- /** Creates a database range from this tables. */
- void finalizeImport();
- void applyAutoFilters();
-
- /** Returns the unique table identifier. */
- inline sal_Int32 getTableId() const { return maModel.mnId; }
- /** Returns the token index used in API token arrays (com.sun.star.sheet.FormulaToken). */
- inline sal_Int32 getTokenIndex() const { return mnTokenIndex; }
- /** Returns the original display name of the table. */
- inline const OUString& getDisplayName() const { return maModel.maDisplayName; }
-
- /** Returns the original (unchecked) total range of the table. */
- inline const ::com::sun::star::table::CellRangeAddress& getOriginalRange() const { return maModel.maRange; }
- /** Returns the cell range of this table. */
- inline const ::com::sun::star::table::CellRangeAddress& getRange() const { return maDestRange; }
- /** Returns the number of columns of this table. */
- inline sal_Int32 getWidth() const { return maDestRange.EndColumn - maDestRange.StartColumn + 1; }
- /** Returns the number of rows of this table. */
- inline sal_Int32 getHeight() const { return maDestRange.EndRow - maDestRange.StartRow + 1; }
- /** Returns the number of header rows in the table range. */
- inline sal_Int32 getHeaderRows() const { return maModel.mnHeaderRows; }
- /** Returns the number of totals rows in the table range. */
- inline sal_Int32 getTotalsRows() const { return maModel.mnTotalsRows; }
-
-private:
- TableModel maModel;
- AutoFilterBuffer maAutoFilters; /// Filter settings for this table.
- OUString maDBRangeName; /// Name of the databae range in the Calc document.
- ::com::sun::star::table::CellRangeAddress
- maDestRange; /// Validated range of the table in the worksheet.
- sal_Int32 mnTokenIndex; /// Token index used in API token array.
-};
-
-typedef ::boost::shared_ptr< Table > TableRef;
-
-class TableBuffer : public WorkbookHelper
-{
-public:
- explicit TableBuffer( const WorkbookHelper& rHelper );
-
- /** Creates a new empty table. */
- Table& createTable();
-
- /** Creates database ranges from all imported tables. */
- void finalizeImport();
- /** Applies autofilters from created database range ( requires finalizeImport to have run before being called */
- void applyAutoFilters();
- /** Returns a table by its identifier. */
- TableRef getTable( sal_Int32 nTableId ) const;
- /** Returns a table by its display name. */
- TableRef getTable( const OUString& rDispName ) const;
-
-private:
- /** Inserts the passed table into the maps according to its identifier and name. */
- void insertTableToMaps( const TableRef& rxTable );
-
-private:
- typedef RefVector< Table > TableVector;
- typedef RefMap< sal_Int32, Table > TableIdMap;
- typedef RefMap< OUString, Table > TableNameMap;
-
- TableVector maTables;
- TableIdMap maIdTables;
- TableNameMap maNameTables;
-};
-
-} // namespace xls
-} // namespace oox
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/inc/tablefragment.hxx b/sc/source/filter/inc/tablefragment.hxx
deleted file mode 100644
index 43fe8c5923f0..000000000000
--- a/sc/source/filter/inc/tablefragment.hxx
+++ /dev/null
@@ -1,52 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_SC_SOURCE_FILTER_INC_TABLEFRAGMENT_HXX
-#define INCLUDED_SC_SOURCE_FILTER_INC_TABLEFRAGMENT_HXX
-
-#include "excelhandlers.hxx"
-
-namespace oox {
-namespace xls {
-
-class Table;
-
-class TableFragment : public WorksheetFragmentBase
-{
-public:
- explicit TableFragment(
- const WorksheetHelper& rHelper,
- const OUString& rFragmentPath );
-
-protected:
- virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) SAL_OVERRIDE;
- virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ) SAL_OVERRIDE;
-
- virtual const ::oox::core::RecordInfo* getRecordInfos() const SAL_OVERRIDE;
-
-private:
- Table& mrTable;
-};
-
-} // namespace xls
-} // namespace oox
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/inc/worksheetfragment.hxx b/sc/source/filter/inc/worksheetfragment.hxx
index 1f37603f4133..59f723525658 100644
--- a/sc/source/filter/inc/worksheetfragment.hxx
+++ b/sc/source/filter/inc/worksheetfragment.hxx
@@ -111,6 +111,8 @@ private:
/** Imports the binary data of an embedded OLE object from the fragment with the passed ID. */
void importEmbeddedOleData( StreamDataSequence& orEmbeddedData, const OUString& rRelId );
+
+ void importDataTable(const AttributeList& rAttribs);
};
} // namespace xls
diff --git a/sc/source/filter/inc/worksheethelper.hxx b/sc/source/filter/inc/worksheethelper.hxx
index 37179bb5b62d..1662d7b937e6 100644
--- a/sc/source/filter/inc/worksheethelper.hxx
+++ b/sc/source/filter/inc/worksheethelper.hxx
@@ -25,6 +25,8 @@
#include <oox/ole/olehelper.hxx>
#include "addressconverter.hxx"
#include "formulabase.hxx"
+#include "tabledata.hxx"
+#include "datatablebuffer.hxx"
namespace com { namespace sun { namespace star {
namespace awt { struct Point; }
@@ -56,6 +58,7 @@ class SheetDataBuffer;
class SheetViewSettings;
class VmlDrawing;
class WorksheetSettings;
+class TableDataBuffer;
typedef ::std::map< OUString, void* > ExtLst;
@@ -233,6 +236,8 @@ public:
/** Returns the VML drawing page for this sheet (OOXML/BIFF12 only). */
VmlDrawing& getVmlDrawing() const;
+ TableDataBuffer& getTableDataBuffer();
+
ExtLst& getExtLst() const;
/** Sets a column or row page break described in the passed struct. */
diff --git a/sc/source/filter/oox/datatablebuffer.cxx b/sc/source/filter/oox/datatablebuffer.cxx
new file mode 100644
index 000000000000..843fb4488613
--- /dev/null
+++ b/sc/source/filter/oox/datatablebuffer.cxx
@@ -0,0 +1,25 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "datatablebuffer.hxx"
+
+namespace oox {
+namespace xls {
+
+ScTableData& TableDataBuffer::createDataTable(const OUString& rId)
+{
+ std::pair<std::map<OUString, ScTableData>::iterator, bool> aData =
+ maTableData.insert(std::pair<OUString, ScTableData>(rId, ScTableData()));
+ return aData.first->second;
+}
+
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/oox/datatablebuffer.hxx b/sc/source/filter/oox/datatablebuffer.hxx
new file mode 100644
index 000000000000..59bac7a0937b
--- /dev/null
+++ b/sc/source/filter/oox/datatablebuffer.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef DEFINED_SC_OOX_DATATABLEBUFFER_HXX
+#define DEFINED_SC_OOX_DATATABLEBUFFER_HXX
+
+#include "tabledata.hxx"
+
+#include <map>
+
+namespace oox {
+namespace xls {
+
+class TableDataBuffer
+{
+public:
+ ScTableData& createDataTable(const OUString& rId);
+private:
+ std::map<OUString, ScTableData> maTableData;
+};
+
+}
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/oox/datatablefragment.cxx b/sc/source/filter/oox/datatablefragment.cxx
new file mode 100644
index 000000000000..60ed63cea288
--- /dev/null
+++ b/sc/source/filter/oox/datatablefragment.cxx
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "datatablefragment.hxx"
+#include "datatablebuffer.hxx"
+
+namespace oox {
+namespace xls {
+
+DataTableContext::DataTableContext(WorksheetFragmentBase& rFragment,
+ ScTableData& rDataTable):
+ WorksheetContextBase(rFragment),
+ mrDataTable(rDataTable)
+{
+}
+
+oox::core::ContextHandlerRef DataTableContext::onCreateContext(sal_Int32 , const AttributeList& )
+{
+ return this;
+}
+
+void DataTableContext::importTableStyleInfo(const AttributeList& rAttribs)
+{
+ mrDataTable.mbFirstColumn = rAttribs.getBool(XML_showFirstColumn, false);
+ mrDataTable.mbLastColumn = rAttribs.getBool(XML_showLastColumn, false);
+ mrDataTable.mbBandedRows = rAttribs.getBool(XML_showRowStripes, false);
+ mrDataTable.mbBandedColumns = rAttribs.getBool(XML_showColumnStripes, false);
+ mrDataTable.maStyleName = rAttribs.getXString(XML_name, OUString());
+}
+
+void DataTableContext::importTable(const AttributeList& rAttribs)
+{
+ mrDataTable.maName = rAttribs.getXString(XML_name, OUString());
+ mrDataTable.maRange.Parse(rAttribs.getXString(XML_ref, OUString()));
+}
+
+void DataTableContext::importTableColumn(const AttributeList& rAttribs)
+{
+ ScTableDataColumn aColumn;
+ aColumn.maName = rAttribs.getXString(XML_name, OUString());
+ aColumn.mnId = rAttribs.getInteger(XML_id, 0);
+ mrDataTable.maColumnData.push_back(aColumn);
+}
+
+void DataTableContext::onStartElement(const AttributeList& rAttribs)
+{
+ switch(getCurrentElement())
+ {
+ case XLS_TOKEN(autoFilter):
+ break;
+ case XLS_TOKEN(tableColumns):
+ break;
+ case XLS_TOKEN(tableColumn):
+ importTableColumn(rAttribs);
+ break;
+ case XLS_TOKEN(tableStyleInfo):
+ importTableStyleInfo(rAttribs);
+ break;
+ case XLS_TOKEN(table):
+ importTable(rAttribs);
+ break;
+ default:
+ SAL_WARN("sc.oox", "unsupported table element");
+ }
+}
+
+oox::core::ContextHandlerRef DataTableContext::onCreateRecordContext(sal_Int32 , SequenceInputStream& )
+{
+ return 0;
+}
+
+void DataTableContext::onStartRecord(SequenceInputStream& )
+{
+}
+
+DataTableFragment::DataTableFragment(const WorksheetHelper& rHelper,
+ const OUString& rFragmentPath, const OUString& rId):
+ WorksheetFragmentBase(rHelper, rFragmentPath),
+ mrDataTable(getTableDataBuffer().createDataTable(rId))
+{
+}
+
+oox::core::ContextHandlerRef DataTableFragment::onCreateContext(sal_Int32 nElement, const AttributeList& )
+{
+ switch(getCurrentElement())
+ {
+ case oox::core::XML_ROOT_CONTEXT:
+ if(nElement == XLS_TOKEN(table))
+ return new DataTableContext(*this, mrDataTable);
+ break;
+ }
+
+ return 0;
+}
+
+oox::core::ContextHandlerRef DataTableFragment::onCreateRecordContext(sal_Int32 , SequenceInputStream& )
+{
+ return 0;
+}
+
+const oox::core::RecordInfo* DataTableFragment::getRecordInfos() const
+{
+ return 0;
+}
+
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/oox/datatablefragment.hxx b/sc/source/filter/oox/datatablefragment.hxx
new file mode 100644
index 000000000000..7cf31b89d684
--- /dev/null
+++ b/sc/source/filter/oox/datatablefragment.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SC_OOX_DATATABLEFRAGMENT_HXX
+#define INCLUDED_SC_OOX_DATATABLEFRAGMENT_HXX
+
+#include "excelhandlers.hxx"
+#include "worksheethelper.hxx"
+#include "tabledata.hxx"
+
+namespace oox {
+namespace xls {
+
+class DataTableContext : public WorksheetContextBase
+{
+public:
+ explicit DataTableContext(WorksheetFragmentBase& rFragment, ScTableData& rDataTable);
+
+protected:
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) SAL_OVERRIDE;
+ virtual void onStartElement( const AttributeList& rAttribs ) SAL_OVERRIDE;
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ) SAL_OVERRIDE;
+ virtual void onStartRecord( SequenceInputStream& rStrm ) SAL_OVERRIDE;
+
+private:
+ ScTableData& mrDataTable;
+
+ void importTableStyleInfo(const AttributeList& rAttribs);
+ void importTable(const AttributeList& rAttribs);
+ void importTableColumn(const AttributeList& rAttribs);
+};
+
+class DataTableFragment : public WorksheetFragmentBase
+{
+public:
+ explicit DataTableFragment(const WorksheetHelper& rHelper,
+ const OUString& rFragmentPath, const OUString& rId);
+
+protected:
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) SAL_OVERRIDE;
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ) SAL_OVERRIDE;
+ virtual const ::oox::core::RecordInfo* getRecordInfos() const SAL_OVERRIDE;
+
+private:
+
+ ScTableData& mrDataTable;
+};
+
+}
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/oox/formulaparser.cxx b/sc/source/filter/oox/formulaparser.cxx
index 41331fb55d82..bffc228977b7 100644
--- a/sc/source/filter/oox/formulaparser.cxx
+++ b/sc/source/filter/oox/formulaparser.cxx
@@ -32,7 +32,6 @@
#include "biffinputstream.hxx"
#include "defnamesbuffer.hxx"
#include "externallinkbuffer.hxx"
-#include "tablebuffer.hxx"
#include "worksheethelper.hxx"
namespace oox {
@@ -1249,7 +1248,6 @@ private:
bool importAttrToken( SequenceInputStream& rStrm );
bool importSpaceToken( SequenceInputStream& rStrm );
- bool importTableToken( SequenceInputStream& rStrm );
bool importArrayToken( SequenceInputStream& rStrm );
bool importRefToken( SequenceInputStream& rStrm, bool bDeleted, bool bRelativeAsOffset );
bool importAreaToken( SequenceInputStream& rStrm, bool bDeleted, bool bRelativeAsOffset );
@@ -1350,7 +1348,6 @@ ApiTokenSequence OoxFormulaParserImpl::importBiff12Formula( const CellAddress& r
case BIFF_TOKID_PAREN: bOk = pushParenthesesOperator(); break;
case BIFF_TOKID_MISSARG: bOk = pushOperand( OPCODE_MISSING ); break;
case BIFF_TOKID_STR: bOk = pushValueOperand( BiffHelper::readString( rStrm, false ) ); break;
- case BIFF_TOKID_NLR: bOk = importTableToken( rStrm ); break;
case BIFF_TOKID_ATTR: bOk = importAttrToken( rStrm ); break;
case BIFF_TOKID_ERR: bOk = pushBiffErrorOperand( rStrm.readuInt8() ); break;
case BIFF_TOKID_BOOL: bOk = pushBiffBoolOperand( rStrm.readuInt8() ); break;
@@ -1467,131 +1464,6 @@ bool OoxFormulaParserImpl::importSpaceToken( SequenceInputStream& rStrm )
return true;
}
-bool OoxFormulaParserImpl::importTableToken( SequenceInputStream& rStrm )
-{
- sal_uInt16 nFlags, nTableId, nCol1, nCol2;
- rStrm.skip( 3 );
- rStrm >> nFlags >> nTableId;
- rStrm.skip( 2 );
- rStrm >> nCol1 >> nCol2;
- TableRef xTable = getTables().getTable( nTableId );
- sal_Int32 nTokenIndex = xTable.get() ? xTable->getTokenIndex() : -1;
- if( nTokenIndex >= 0 )
- {
- sal_Int32 nWidth = xTable->getWidth();
- sal_Int32 nHeight = xTable->getHeight();
- sal_Int32 nStartCol = 0;
- sal_Int32 nEndCol = nWidth - 1;
- sal_Int32 nStartRow = 0;
- sal_Int32 nEndRow = nHeight - 1;
- bool bFixedStartRow = true;
- bool bFixedHeight = false;
-
- bool bSingleCol = getFlag( nFlags, BIFF12_TOK_TABLE_COLUMN );
- bool bColRange = getFlag( nFlags, BIFF12_TOK_TABLE_COLRANGE );
- bool bValidRef = !bSingleCol || !bColRange;
- OSL_ENSURE( bValidRef, "OoxFormulaParserImpl::importTableToken - illegal combination of single column and column range" );
- if( bValidRef )
- {
- if( bSingleCol )
- nStartCol = nEndCol = nCol1;
- else if( bColRange )
- { nStartCol = nCol1; nEndCol = nCol2; }
- bValidRef = (nStartCol <= nEndCol) && (nEndCol < nWidth);
- OSL_ENSURE( bValidRef, "OoxFormulaParserImpl::importTableToken - invalid column range" );
- }
-
- if( bValidRef )
- {
- bool bAllRows = getFlag( nFlags, BIFF12_TOK_TABLE_ALL );
- bool bHeaderRows = getFlag( nFlags, BIFF12_TOK_TABLE_HEADERS );
- bool bDataRows = getFlag( nFlags, BIFF12_TOK_TABLE_DATA );
- bool bTotalsRows = getFlag( nFlags, BIFF12_TOK_TABLE_TOTALS );
- bool bThisRow = getFlag( nFlags, BIFF12_TOK_TABLE_THISROW );
-
- sal_Int32 nStartDataRow = xTable->getHeaderRows();
- sal_Int32 nEndDataRow = nEndRow - xTable->getTotalsRows();
- bValidRef = (nStartRow <= nStartDataRow) && (nStartDataRow <= nEndDataRow) && (nEndDataRow <= nEndRow);
- OSL_ENSURE( bValidRef, "OoxFormulaParserImpl::importTableToken - invalid data row range" );
- if( bValidRef )
- {
- if( bAllRows )
- {
- bValidRef = !bHeaderRows && !bDataRows && !bTotalsRows && !bThisRow;
- OSL_ENSURE( bValidRef, "OoxFormulaParserImpl::importTableToken - unexpected flags in [#All] table token" );
- }
- else if( bHeaderRows )
- {
- bValidRef = !bTotalsRows && !bThisRow;
- OSL_ENSURE( bValidRef, "OoxFormulaParserImpl::importTableToken - unexpected flags in [#Headers] table token" );
- nEndRow = bDataRows ? nEndDataRow : (nStartDataRow - 1);
- bFixedHeight = !bDataRows;
- }
- else if( bDataRows )
- {
- bValidRef = !bThisRow;
- OSL_ENSURE( bValidRef, "OoxFormulaParserImpl::importTableToken - unexpected flags in [#Data] table token" );
- nStartRow = nStartDataRow;
- if( !bTotalsRows ) nEndRow = nEndDataRow;
- }
- else if( bTotalsRows )
- {
- bValidRef = !bThisRow;
- OSL_ENSURE( bValidRef, "OoxFormulaParserImpl::importTableToken - unexpected flags in [#Totals] table token" );
- nStartRow = nEndDataRow + 1;
- bFixedStartRow = false;
- bFixedHeight = !bDataRows;
- }
- else if( bThisRow )
- {
- nStartRow = nEndRow = maBaseAddr.Row - xTable->getRange().StartRow;
- bFixedHeight = true;
- }
- else
- {
- // nothing is the same as [#Data]
- nStartRow = nStartDataRow;
- nEndRow = nEndDataRow;
- }
- }
- if( bValidRef )
- bValidRef = (0 <= nStartRow) && (nStartRow <= nEndRow) && (nEndRow < nHeight);
- }
- if( bValidRef )
- {
- // push single database area token, if table token refers to entire table
- if( (nStartCol == 0) && (nEndCol + 1 == nWidth) && (nStartRow == 0) && (nEndRow + 1 == nHeight) )
- return pushValueOperand( nTokenIndex, OPCODE_DBAREA );
- // create an OFFSET function call to refer to a subrange of the table
- const FunctionInfo* pRowsInfo = getFuncInfoFromBiff12FuncId( BIFF_FUNC_ROWS );
- const FunctionInfo* pColumnsInfo = getFuncInfoFromBiff12FuncId( BIFF_FUNC_COLUMNS );
- return
- pRowsInfo && pColumnsInfo &&
- pushValueOperandToken( nTokenIndex, OPCODE_DBAREA ) &&
- (bFixedStartRow ?
- pushValueOperandToken< double >( nStartRow ) :
- (pushValueOperandToken( nTokenIndex, OPCODE_DBAREA ) &&
- pushFunctionOperatorToken( *pRowsInfo, 1 ) &&
- pushValueOperandToken< double >( nHeight - nStartRow ) &&
- pushBinaryOperatorToken( OPCODE_SUB ))) &&
- pushValueOperandToken< double >( nStartCol ) &&
- (bFixedHeight ?
- pushValueOperandToken< double >( nEndRow - nStartRow + 1 ) :
- (pushValueOperandToken( nTokenIndex, OPCODE_DBAREA ) &&
- pushFunctionOperatorToken( *pRowsInfo, 1 ) &&
- (((nStartRow == 0) && (nEndRow + 1 == nHeight)) ||
- (pushValueOperandToken< double >( nHeight - (nEndRow - nStartRow + 1) ) &&
- pushBinaryOperatorToken( OPCODE_SUB ))))) &&
- (((nStartCol == 0) && (nEndCol + 1 == nWidth)) ?
- (pushValueOperandToken( nTokenIndex, OPCODE_DBAREA ) &&
- pushFunctionOperatorToken( *pColumnsInfo, 1 )) :
- pushValueOperandToken< double >( nEndCol - nStartCol + 1 )) &&
- pushBiff12Function( BIFF_FUNC_OFFSET, 5 );
- }
- }
- return pushBiffErrorOperand( BIFF_ERR_REF );
-}
-
bool OoxFormulaParserImpl::importArrayToken( SequenceInputStream& rStrm )
{
rStrm.skip( 14 );
diff --git a/sc/source/filter/oox/pivotcachebuffer.cxx b/sc/source/filter/oox/pivotcachebuffer.cxx
index b9a491f3d21a..afed8ad5a7cb 100644
--- a/sc/source/filter/oox/pivotcachebuffer.cxx
+++ b/sc/source/filter/oox/pivotcachebuffer.cxx
@@ -37,7 +37,6 @@
#include "excelhandlers.hxx"
#include "pivotcachefragment.hxx"
#include "sheetdatabuffer.hxx"
-#include "tablebuffer.hxx"
#include "unitconverter.hxx"
#include "worksheetbuffer.hxx"
@@ -1300,6 +1299,7 @@ void PivotCache::finalizeInternalSheetSource()
{
mbValidSource = pDefName->getAbsoluteRange( maSheetSrcModel.maRange );
}
+ /*
// table
else if( const Table* pTable = getTables().getTable( maSheetSrcModel.maDefName ).get() )
{
@@ -1309,6 +1309,7 @@ void PivotCache::finalizeInternalSheetSource()
if( mbValidSource )
maSheetSrcModel.maRange.EndRow -= pTable->getTotalsRows();
}
+ */
}
// else try the cell range (if the sheet exists)
else if( nSheet >= 0 )
diff --git a/sc/source/filter/oox/stylesfragment.cxx b/sc/source/filter/oox/stylesfragment.cxx
index 99d87d994f48..8c0d84c1a1ea 100644
--- a/sc/source/filter/oox/stylesfragment.cxx
+++ b/sc/source/filter/oox/stylesfragment.cxx
@@ -179,6 +179,7 @@ ContextHandlerRef StylesFragment::onCreateContext( sal_Int32 nElement, const Att
case XLS_TOKEN( borders ):
case XLS_TOKEN( fills ):
case XLS_TOKEN( cellXfs ):
+ case XLS_TOKEN( tableStyles ):
case XLS_TOKEN( cellStyleXfs ):
case XLS_TOKEN( dxfs ):
case XLS_TOKEN( cellStyles ): return this;
@@ -212,6 +213,12 @@ ContextHandlerRef StylesFragment::onCreateContext( sal_Int32 nElement, const Att
case XLS_TOKEN( cellStyles ):
if( nElement == XLS_TOKEN( cellStyle ) ) getStyles().importCellStyle( rAttribs );
break;
+ /*
+ case XLS_TOKEN( tableStyles ):
+ if(nElement == XLS_TOKEN(tableStyle))
+ return new TableStylesContext(*this, getStyles());
+ break;
+ */
}
return 0;
}
diff --git a/sc/source/filter/oox/tablebuffer.cxx b/sc/source/filter/oox/tablebuffer.cxx
deleted file mode 100644
index 4e59dbf53525..000000000000
--- a/sc/source/filter/oox/tablebuffer.cxx
+++ /dev/null
@@ -1,173 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include "tablebuffer.hxx"
-
-#include <com/sun/star/sheet/XDatabaseRange.hpp>
-#include <com/sun/star/sheet/XDatabaseRanges.hpp>
-#include <oox/helper/attributelist.hxx>
-#include <oox/helper/binaryinputstream.hxx>
-#include <oox/helper/propertyset.hxx>
-#include <oox/token/properties.hxx>
-#include "addressconverter.hxx"
-
-namespace oox {
-namespace xls {
-
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::sheet;
-using namespace ::com::sun::star::uno;
-
-TableModel::TableModel() :
- mnId( -1 ),
- mnType( XML_worksheet ),
- mnHeaderRows( 1 ),
- mnTotalsRows( 0 )
-{
-}
-
-Table::Table( const WorkbookHelper& rHelper ) :
- WorkbookHelper( rHelper ),
- maAutoFilters( rHelper ),
- mnTokenIndex( -1 )
-{
-}
-
-void Table::importTable( const AttributeList& rAttribs, sal_Int16 nSheet )
-{
- getAddressConverter().convertToCellRangeUnchecked( maModel.maRange, rAttribs.getString( XML_ref, OUString() ), nSheet );
- maModel.maProgName = rAttribs.getXString( XML_name, OUString() );
- maModel.maDisplayName = rAttribs.getXString( XML_displayName, OUString() );
- maModel.mnId = rAttribs.getInteger( XML_id, -1 );
- maModel.mnType = rAttribs.getToken( XML_tableType, XML_worksheet );
- maModel.mnHeaderRows = rAttribs.getInteger( XML_headerRowCount, 1 );
- maModel.mnTotalsRows = rAttribs.getInteger( XML_totalsRowCount, 0 );
-}
-
-void Table::importTable( SequenceInputStream& rStrm, sal_Int16 nSheet )
-{
- BinRange aBinRange;
- sal_Int32 nType;
- rStrm >> aBinRange >> nType >> maModel.mnId >> maModel.mnHeaderRows >> maModel.mnTotalsRows;
- rStrm.skip( 32 );
- rStrm >> maModel.maProgName >> maModel.maDisplayName;
-
- getAddressConverter().convertToCellRangeUnchecked( maModel.maRange, aBinRange, nSheet );
- static const sal_Int32 spnTypes[] = { XML_worksheet, XML_TOKEN_INVALID, XML_TOKEN_INVALID, XML_queryTable };
- maModel.mnType = STATIC_ARRAY_SELECT( spnTypes, nType, XML_TOKEN_INVALID );
-}
-
-void Table::finalizeImport()
-{
- // Create database range. Note that Excel 2007 and later names database
- // ranges (or tables in their terminology) as Table1, Table2 etc. We need
- // to import them as named db ranges because they may be referenced by
- // name in formula expressions.
- if( (maModel.mnId > 0) && !maModel.maDisplayName.isEmpty() ) try
- {
- maDBRangeName = maModel.maDisplayName;
- Reference< XDatabaseRange > xDatabaseRange(
- createDatabaseRangeObject( maDBRangeName, maModel.maRange ), UNO_SET_THROW);
- maDestRange = xDatabaseRange->getDataArea();
-
- // get formula token index of the database range
- PropertySet aPropSet( xDatabaseRange );
- if( !aPropSet.getProperty( mnTokenIndex, PROP_TokenIndex ) )
- mnTokenIndex = -1;
- }
- catch( Exception& )
- {
- OSL_FAIL( "Table::finalizeImport - cannot create database range" );
- }
-}
-
-void Table::applyAutoFilters()
-{
- if( !maDBRangeName.isEmpty() )
- {
- try
- {
- // get the range ( maybe we should cache the xDatabaseRange from finalizeImport )
- PropertySet aDocProps( getDocument() );
- Reference< XDatabaseRanges > xDatabaseRanges( aDocProps.getAnyProperty( PROP_DatabaseRanges ), UNO_QUERY_THROW );
- Reference< XDatabaseRange > xDatabaseRange( xDatabaseRanges->getByName( maDBRangeName ), UNO_QUERY );
- maAutoFilters.finalizeImport( xDatabaseRange );
- }
- catch( Exception& )
- {
- OSL_FAIL( "Table::applyAutofilters - cannot create filter" );
- }
- }
-}
-
-TableBuffer::TableBuffer( const WorkbookHelper& rHelper ) :
- WorkbookHelper( rHelper )
-{
-}
-
-Table& TableBuffer::createTable()
-{
- TableVector::value_type xTable( new Table( *this ) );
- maTables.push_back( xTable );
- return *xTable;
-}
-
-void TableBuffer::finalizeImport()
-{
- // map all tables by identifier and display name
- for( TableVector::iterator aIt = maTables.begin(), aEnd = maTables.end(); aIt != aEnd; ++aIt )
- insertTableToMaps( *aIt );
- // finalize all valid tables
- maIdTables.forEachMem( &Table::finalizeImport );
-}
-
-void TableBuffer::applyAutoFilters()
-{
- maIdTables.forEachMem( &Table::applyAutoFilters );
-}
-
-TableRef TableBuffer::getTable( sal_Int32 nTableId ) const
-{
- return maIdTables.get( nTableId );
-}
-
-TableRef TableBuffer::getTable( const OUString& rDispName ) const
-{
- return maNameTables.get( rDispName );
-}
-
-// private --------------------------------------------------------------------
-
-void TableBuffer::insertTableToMaps( const TableRef& rxTable )
-{
- sal_Int32 nTableId = rxTable->getTableId();
- const OUString& rDispName = rxTable->getDisplayName();
- if( (nTableId > 0) && !rDispName.isEmpty() )
- {
- OSL_ENSURE( !maIdTables.has( nTableId ), "TableBuffer::insertTableToMaps - multiple table identifier" );
- maIdTables[ nTableId ] = rxTable;
- OSL_ENSURE( !maNameTables.has( rDispName ), "TableBuffer::insertTableToMaps - multiple table name" );
- maNameTables[ rDispName ] = rxTable;
- }
-}
-
-} // namespace xls
-} // namespace oox
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/oox/tablefragment.cxx b/sc/source/filter/oox/tablefragment.cxx
deleted file mode 100644
index 52039c716a74..000000000000
--- a/sc/source/filter/oox/tablefragment.cxx
+++ /dev/null
@@ -1,92 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include "tablefragment.hxx"
-
-#include "autofilterbuffer.hxx"
-#include "autofiltercontext.hxx"
-#include "tablebuffer.hxx"
-
-namespace oox {
-namespace xls {
-
-using namespace ::oox::core;
-
-TableFragment::TableFragment( const WorksheetHelper& rHelper, const OUString& rFragmentPath ) :
- WorksheetFragmentBase( rHelper, rFragmentPath ),
- mrTable( getTables().createTable() )
-{
-}
-
-ContextHandlerRef TableFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
-{
- switch( getCurrentElement() )
- {
- case XML_ROOT_CONTEXT:
- if( nElement == XLS_TOKEN( table ) )
- {
- mrTable.importTable( rAttribs, getSheetIndex() );
- return this;
- }
- break;
- case XLS_TOKEN( table ):
- if( nElement == XLS_TOKEN( autoFilter ) )
- return new AutoFilterContext( *this, mrTable.createAutoFilter() );
- break;
- }
- return 0;
-}
-
-ContextHandlerRef TableFragment::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm )
-{
- switch( getCurrentElement() )
- {
- case XML_ROOT_CONTEXT:
- if( nRecId == BIFF12_ID_TABLE )
- {
- mrTable.importTable( rStrm, getSheetIndex() );
- return this;
- }
- break;
- case BIFF12_ID_TABLE:
- if( nRecId == BIFF12_ID_AUTOFILTER )
- return new AutoFilterContext( *this, mrTable.createAutoFilter() );
- break;
- }
- return 0;
-}
-
-const RecordInfo* TableFragment::getRecordInfos() const
-{
- static const RecordInfo spRecInfos[] =
- {
- { BIFF12_ID_AUTOFILTER, BIFF12_ID_AUTOFILTER + 1 },
- { BIFF12_ID_CUSTOMFILTERS, BIFF12_ID_CUSTOMFILTERS + 1 },
- { BIFF12_ID_DISCRETEFILTERS, BIFF12_ID_DISCRETEFILTERS + 1 },
- { BIFF12_ID_FILTERCOLUMN, BIFF12_ID_FILTERCOLUMN + 1 },
- { BIFF12_ID_TABLE, BIFF12_ID_TABLE + 1 },
- { -1, -1 }
- };
- return spRecInfos;
-}
-
-} // namespace xls
-} // namespace oox
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/oox/workbookfragment.cxx b/sc/source/filter/oox/workbookfragment.cxx
index 088cebc54910..296cfacce5b1 100644
--- a/sc/source/filter/oox/workbookfragment.cxx
+++ b/sc/source/filter/oox/workbookfragment.cxx
@@ -37,7 +37,6 @@
#include "sharedstringsbuffer.hxx"
#include "sharedstringsfragment.hxx"
#include "stylesfragment.hxx"
-#include "tablebuffer.hxx"
#include "themebuffer.hxx"
#include "viewsettings.hxx"
#include "workbooksettings.hxx"
@@ -459,7 +458,6 @@ void WorkbookFragment::finalizeImport()
// create all defined names and database ranges
getDefinedNames().finalizeImport();
- getTables().finalizeImport();
// open the VBA project storage
OUString aVbaFragmentPath = getFragmentPathFromFirstType( CREATE_MSOFFICE_RELATION_TYPE( "vbaProject" ) );
if( !aVbaFragmentPath.isEmpty() )
diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx
index 3ebf7024802b..88024366f2ac 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -55,7 +55,6 @@
#include "scenariobuffer.hxx"
#include "sharedstringsbuffer.hxx"
#include "stylesbuffer.hxx"
-#include "tablebuffer.hxx"
#include "themebuffer.hxx"
#include "unitconverter.hxx"
#include "viewsettings.hxx"
@@ -559,7 +558,6 @@ void WorkbookGlobals::initialize( bool bWorkbookFile )
mxSharedStrings.reset( new SharedStringsBuffer( *this ) );
mxExtLinks.reset( new ExternalLinkBuffer( *this ) );
mxDefNames.reset( new DefinedNamesBuffer( *this ) );
- mxTables.reset( new TableBuffer( *this ) );
mxScenarios.reset( new ScenarioBuffer( *this ) );
mxConnections.reset( new ConnectionsBuffer( *this ) );
mxPivotCaches.reset( new PivotCacheBuffer( *this ) );
diff --git a/sc/source/filter/oox/worksheetfragment.cxx b/sc/source/filter/oox/worksheetfragment.cxx
index f93d56ee629b..51e401337e53 100644
--- a/sc/source/filter/oox/worksheetfragment.cxx
+++ b/sc/source/filter/oox/worksheetfragment.cxx
@@ -38,11 +38,11 @@
#include "scenariocontext.hxx"
#include "sheetdatabuffer.hxx"
#include "sheetdatacontext.hxx"
-#include "tablefragment.hxx"
#include "extlstcontext.hxx"
#include "viewsettings.hxx"
#include "workbooksettings.hxx"
#include "worksheetsettings.hxx"
+#include "datatablefragment.hxx"
namespace oox {
namespace xls {
@@ -192,11 +192,6 @@ void DataValidationsContext::importDataValidation( SequenceInputStream& rStrm )
WorksheetFragment::WorksheetFragment( const WorksheetHelper& rHelper, const OUString& rFragmentPath ) :
WorksheetFragmentBase( rHelper, rFragmentPath )
{
- // import data tables related to this worksheet
- RelationsRef xTableRels = getRelations().getRelationsFromTypeFromOfficeDoc( "table" );
- for( Relations::const_iterator aIt = xTableRels->begin(), aEnd = xTableRels->end(); aIt != aEnd; ++aIt )
- importOoxFragment( new TableFragment( *this, getFragmentPathFromRelation( aIt->second ) ) );
-
// import comments related to this worksheet
OUString aCommentsFragmentPath = getFragmentPathFromFirstTypeFromOfficeDoc( "comments" );
if( !aCommentsFragmentPath.isEmpty() )
@@ -237,6 +232,7 @@ ContextHandlerRef WorksheetFragment::onCreateContext( sal_Int32 nElement, const
case XLS_TOKEN( rowBreaks ):
case XLS_TOKEN( colBreaks ):
case XLS_TOKEN( oleObjects ):
+ case XLS_TOKEN(tableParts):
case XLS_TOKEN( controls ): return this;
case XLS_TOKEN( sheetPr ): getWorksheetSettings().importSheetPr( rAttribs ); return this;
@@ -333,6 +329,10 @@ ContextHandlerRef WorksheetFragment::onCreateContext( sal_Int32 nElement, const
}
}
break;
+ case XLS_TOKEN(tableParts):
+ if(nElement == XLS_TOKEN(tablePart))
+ importDataTable(rAttribs);
+ break;
}
return 0;
}
@@ -479,6 +479,11 @@ void WorksheetFragment::initializeImport()
RelationsRef xPivotRels = getRelations().getRelationsFromTypeFromOfficeDoc( "pivotTable" );
for( Relations::const_iterator aIt = xPivotRels->begin(), aEnd = xPivotRels->end(); aIt != aEnd; ++aIt )
importOoxFragment( new PivotTableFragment( *this, getFragmentPathFromRelation( aIt->second ) ) );
+
+ // import data table fragments related to this worksheet
+ RelationsRef xTableRels = getRelations().getRelationsFromTypeFromOfficeDoc("table");
+ for( Relations::const_iterator aIt = xTableRels->begin(), aEnd = xTableRels->end(); aIt != aEnd; ++aIt )
+ importOoxFragment( new DataTableFragment( *this, getFragmentPathFromRelation( aIt->second ), aIt->first ) );
}
void WorksheetFragment::finalizeImport()
@@ -509,6 +514,12 @@ void WorksheetFragment::importDimension( const AttributeList& rAttribs )
}
}
+void WorksheetFragment::importDataTable(const AttributeList& rAttribs)
+{
+ OUString aId = rAttribs.getXString(R_TOKEN(id), OUString());
+ SAL_INFO("sc.oox", aId);
+}
+
void WorksheetFragment::importSheetFormatPr( const AttributeList& rAttribs )
{
// default column settings
diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx
index 4417bbe6cb34..ea91d6492b40 100644
--- a/sc/source/filter/oox/worksheethelper.cxx
+++ b/sc/source/filter/oox/worksheethelper.cxx
@@ -68,7 +68,6 @@
#include "scitems.hxx"
#include "editutil.hxx"
#include "tokenarray.hxx"
-#include "tablebuffer.hxx"
#include "documentimport.hxx"
#include "stlsheet.hxx"
#include "stlpool.hxx"
@@ -269,6 +268,8 @@ public:
/** returns the ExtLst entries that need to be filled */
inline ExtLst& getExtLst() { return maExtLst; }
+ TableDataBuffer& getTableDataBuffer() { return maTableData; }
+
/** Returns the BIFF drawing page for this sheet (BIFF2-BIFF8 only). */
inline BiffSheetDrawing& getBiffDrawing() const { return *mxBiffDrawing; }
@@ -392,6 +393,7 @@ private:
SheetViewSettings maSheetViewSett; /// View settings for this sheet.
VmlDrawingPtr mxVmlDrawing; /// Collection of all VML shapes.
ExtLst maExtLst; /// List of extended elements
+ TableDataBuffer maTableData; /// List of data tables
BiffSheetDrawingPtr mxBiffDrawing; /// Collection of all BIFF/DFF shapes.
OUString maDrawingPath; /// Path to DrawingML fragment.
OUString maVmlDrawingPath; /// Path to legacy VML drawing fragment.
@@ -933,10 +935,6 @@ void WorksheetGlobals::finalizeWorksheetImport()
{
lclUpdateProgressBar( mxRowProgress, 1.0 );
maSheetData.finalizeImport();
- // assumes getTables().finalizeImport ( which creates the DatabaseRanges )
- // has been called already
- getTables().applyAutoFilters();
-
getCondFormats().finalizeImport();
lclUpdateProgressBar( mxFinalProgress, 0.25 );
finalizeHyperlinkRanges();
@@ -1470,6 +1468,11 @@ ExtLst& WorksheetHelper::getExtLst() const
return mrSheetGlob.getExtLst();
}
+TableDataBuffer& WorksheetHelper::getTableDataBuffer()
+{
+ return mrSheetGlob.getTableDataBuffer();
+}
+
void WorksheetHelper::setPageBreak( const PageBreakModel& rModel, bool bRowBreak )
{
mrSheetGlob.setPageBreak( rModel, bRowBreak );