Commits

Anonymous committed 4360005

calcdatatables: API

Comments (0)

Files changed (21)

offapi/com/sun/star/sheet/DataTable.idl

+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2011 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __com_sun_star_sheet_DataTable_idl__
+#define __com_sun_star_sheet_DataTable_idl__
+
+#include <com/sun/star/sheet/XDataTable.idl>
+#include <com/sun/star/sheet/XCellRangeReferrer.idl>
+
+//=============================================================================
+
+ module com {  module sun {  module star {  module sheet {
+
+//=============================================================================
+
+/** represents a DataTable area in a spreadsheet document.
+
+    @see com::sun::star::sheet::DataTables
+
+    @since OOo3.5
+ */
+service DataTable
+{
+    /** Gives access to a spreadsheet's DataTable format. */
+    interface com::sun::star::sheet::XDataTable;
+
+    /** Allows direct access to the cells, without the need to get the 
+        document object first. */
+    interface com::sun::star::sheet::XCellRangeReferrer;
+
+};
+
+//=============================================================================
+
+}; }; }; };
+
+#endif

offapi/com/sun/star/sheet/DataTableDisplayFeatures.idl

+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2011 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __com_sun_star_sheet_DataTableDisplayFeatures_idl__
+#define __com_sun_star_sheet_DataTableDisplayFeatures_idl__
+
+#include <com/sun/star/sheet/DataTableStyleEnabled.idl>
+
+//=============================================================================
+
+module com {  module sun {  module star {  module sheet {
+
+//=============================================================================
+
+/** Display features of a spreadsheet's DataTable format.
+
+	@see <type>XDataTable</type>
+
+    @since OOo 3.5
+ */
+struct DataTableDisplayFeatures
+{
+    /** Whether banded rows 
+        (<const>DataTableStyleType::ROW_STRIPE1</const> and/or 
+        <const>DataTableStyleType::ROW_STRIPE_2</const>) are active or 
+        not.
+     */
+    boolean BandedRows;
+
+    /** Whether banded columns 
+        (<const>DataTableStyleType::COL_STRIPE_1</const> and/or 
+        <const>DataTableStyleType::COL_STRIPE_2</const>) are active or 
+        not.
+     */
+    boolean BandedColumns;
+
+    /** Number of rows the first row stripe 
+        (<const>DataTableStyleType::ROW_STRIPE_1</const>) 
+        uses, &gt;=1.
+     */
+    long    RowsStripe1;
+
+    /** Number of rows the second row stripe 
+        (<const>DataTableStyleType::ROW_STRIPE_2</const>) 
+        uses, &gt;=1.
+     */
+    long    RowsStripe2;
+
+    /** Number of columns the first column stripe 
+        (<const>DataTableStyleType::COLUMN_STRIPE_1</const>) 
+        uses, &gt;=1.
+     */
+    short   ColumnsStripe1;
+
+    /** Number of columns the second column stripe 
+        (<const>DataTableStyleType::COLUMN_STRIPE_2</const>) 
+        uses, &gt;=1.
+     */
+    short   ColumnsStripe2;
+
+    /** Sequence of style types that are enabled or not.
+
+        <p> When getting with 
+        <member>XDataTable::DisplayFeatures</member> a full set of 
+        <const>DataTableStyleType::STYLE_COUNT</member> elements is 
+        returned. When setting a sparse sequence may be used.
+     */
+    sequence< com::sun::star::sheet::DataTableStyleEnabled > StyleTypes;
+};
+
+//=============================================================================
+
+}; }; }; };
+
+#endif
+

offapi/com/sun/star/sheet/DataTableStyleEnabled.idl

+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2011 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __com_sun_star_sheet_DataTableStyleEnabled_idl__
+#define __com_sun_star_sheet_DataTableStyleEnabled_idl__
+
+#include <com/sun/star/sheet/DataTableStyleType.idl>
+
+//=============================================================================
+
+module com {  module sun {  module star {  module sheet {
+
+//=============================================================================
+
+/** Whether a DataTable's style type is enabled or not.
+
+	@see <type>DataTableDisplayFeatures</type>
+
+    @since OOo 3.5
+ */
+struct DataTableStyleEnabled
+{
+    /**
+     */
+    DataTableStyleType  StyleType;
+
+    /**
+     */
+    boolean             Enabled;
+};
+
+//=============================================================================
+
+}; }; }; };
+
+#endif
+

offapi/com/sun/star/sheet/DataTableStyleSheet.idl

+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2011 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __com_sun_star_sheet_DataTableStyleSheet_idl__
+#define __com_sun_star_sheet_DataTableStyleSheet_idl__
+
+#include <com/sun/star/sheet/DataTableStyleType.idl>
+
+//=============================================================================
+
+module com {  module sun {  module star {  module sheet {
+
+//=============================================================================
+
+/** Style sheet names of a DataTable format.
+
+	@see <type>XDataTable</type>
+
+    @since OOo 3.5
+ */
+struct DataTableStyleSheet
+{
+    /**
+     */
+    DataTableStyleType  StyleType;
+
+    /**
+     */
+    string              Name;
+};
+
+//=============================================================================
+
+}; }; }; };
+
+#endif
+

offapi/com/sun/star/sheet/DataTableStyleType.idl

+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2011 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __com_sun_star_sheet_DataTableStyleType_idl__
+#define __com_sun_star_sheet_DataTableStyleType_idl__
+
+//=============================================================================
+
+module com {  module sun {  module star {  module sheet {
+
+//=============================================================================
+
+/** Style types used in a spreadsheet's DataTable.
+
+    @since OOo 3.5
+ */
+enum DataTableStyleType
+{
+    /** Whole table, effective when none of the other style types is 
+        applicable or a specific style is not enabled for a position 
+        within the DataTable.
+
+        Direct or indirect parent of all other styles within a DataTable.
+     */
+    WHOLE_TABLE,
+
+    /** Column stripe 1, used with banded columns if activated.
+     */
+    COL_STRIPE_1,
+
+    /** Column stripe 2, used with banded columns if activated.
+     */
+    COL_STRIPE_2,
+
+    /** Row stripe 1, used with banded rows if activated.
+     */
+    ROW_STRIPE_1,
+
+    /** Row stripe 2, used with banded rows if activated.
+     */
+    ROW_STRIPE_2,
+
+    /** First column, if activated.
+     */
+    FIRST_COL,
+
+    /** Last column, if activated.
+     */
+    LAST_COL,
+
+    /** Header row, if activated.
+
+        Parent for <member>FIRST_HEADER_CELL</member> and 
+        <member>LAST_HEADER_CELL</member>.
+     */
+    HEADER_ROW,
+
+    /** First header cell, top left, if header row is activated.
+     */
+    FIRST_HEADER_CELL,
+
+    /** Last header cell, top right, if header row is activated.
+     */
+    LAST_HEADER_CELL,
+
+    /** Total row, if activated.
+
+        Parent for <member>FIRST_TOTAL_CELL</member> and 
+        <member>LAST_TOTAL_CELL</member>.
+     */
+    TOTAL_ROW,
+
+    /** First total cell, bottom left, if total row is activated.
+     */
+    FIRST_TOTAL_CELL,
+
+    /** Last total cell, bottom right, if total row is activated.
+     */
+    LAST_TOTAL_CELL,
+
+    /** Number of style types.
+     */
+    STYLE_COUNT
+
+};
+
+//=============================================================================
+
+}; }; }; };
+
+#endif
+

offapi/com/sun/star/sheet/DataTables.idl

+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2011 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __com_sun_star_sheet_DataTables_idl__
+#define __com_sun_star_sheet_DataTables_idl__
+
+#include <com/sun/star/sheet/XDataTables.idl>
+#include <com/sun/star/container/XEnumerationAccess.idl>
+#include <com/sun/star/container/XIndexAccess.idl>
+
+//=============================================================================
+
+module com {  module sun {  module star {  module sheet {
+
+//=============================================================================
+
+/** represents a collection of DataTable areas in a spreadsheet 
+    document.
+
+    @see com::sun::star::sheet::SpreadsheetDocument
+ */
+service DataTables
+{
+    //-------------------------------------------------------------------------
+
+    /** provides access to the DataTable areas.
+     */
+    interface com::sun::star::sheet::XDataTables;
+
+    //-------------------------------------------------------------------------
+
+    /** creates an enumeration of all DataTable areas.
+
+        @see com::sun::star::sheet::DataTablesEnumeration
+     */
+    interface com::sun::star::container::XEnumerationAccess;
+
+    //-------------------------------------------------------------------------
+
+    /** provides access to the DataTable area in the collection via 
+        index.
+
+        @see com::sun::star::sheet::DataTable
+     */
+    interface com::sun::star::container::XIndexAccess;
+
+};
+
+//=============================================================================
+
+}; }; }; };
+
+#endif
+

offapi/com/sun/star/sheet/DataTablesEnumeration.idl

+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2011 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __com_sun_star_sheet_DataTablesEnumeration_idl__
+#define __com_sun_star_sheet_DataTablesEnumeration_idl__
+
+#include <com/sun/star/container/XEnumeration.idl>
+
+//=============================================================================
+
+module com {  module sun {  module star {  module sheet {
+
+//=============================================================================
+
+/** represents an enumeration of DataTable areas.
+
+    @see com::sun::star::sheet::DataTable
+ */
+service DataTablesEnumeration
+{
+    //-------------------------------------------------------------------------
+
+    /** provides methods to access the DataTable areas in the 
+        enumeration.
+
+        @see com::sun::star::sheet::DataTable
+     */
+    interface com::sun::star::container::XEnumeration;
+
+};
+
+//=============================================================================
+
+}; }; }; };
+
+#endif
+

offapi/com/sun/star/sheet/XDataTable.idl

+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2011 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __com_sun_star_sheet_XDataTable_idl__
+#define __com_sun_star_sheet_XDataTable_idl__
+
+#include <com/sun/star/table/CellRangeAddress.idl>
+#include <com/sun/star/sheet/DataTableDisplayFeatures.idl>
+#include <com/sun/star/sheet/DataTableStyleSheet.idl>
+#include <com/sun/star/container/NoSuchElementException.idl>
+
+//=============================================================================
+
+module com {  module sun {  module star {  module sheet {
+
+//=============================================================================
+
+/** Gives access to a spreadsheet's DataTable format.
+
+    @since OOo 3.5
+ */
+
+interface XDataTable
+{
+    /** The table area. */
+    [attribute, readonly] com::sun::star::table::CellRangeAddress TableArea {
+        get raises ( ::com::sun::star::container::NoSuchElementException );
+    };
+
+    /** Whether the table area has a header row or not. */
+    // TODO: this may need not be readonly once we can handle switching 
+    // the header row on/off.
+    [attribute, readonly] boolean HeaderRowFlag {
+        get raises ( ::com::sun::star::container::NoSuchElementException );
+    };
+
+    /** Whether the table area has a total row or not. */
+    // TODO: this may need not be readonly once we can handle switching 
+    // the total row on/off.
+    [attribute, readonly] boolean TotalRowFlag {
+        get raises ( ::com::sun::star::container::NoSuchElementException );
+    };
+
+    /** Display features.
+
+        <p> The getter method fills the 
+        <type>DataTableStyleEnabled</type> sequence for all 
+        <type>DataTableStyleType</type>.
+
+        <p> The setter method accepts a sparse 
+        <type>DataTableStyleEnabled</type> sequence.
+
+        <p> Calling the setter method also creates and assigns the 
+        necessary style sheets according to the features set.
+     */
+    [attribute] DataTableDisplayFeatures DisplayFeatures {
+        set raises ( ::com::sun::star::container::NoSuchElementException );
+        get raises ( ::com::sun::star::container::NoSuchElementException );
+    };
+
+    /** The style sheet names assigned to style types.
+
+        <p> The getter method fills the sequence for all 
+        <type>DataTableStyleType</type>. An empty string indicates no 
+        style sheet is assigned for that particular style type.
+
+        <p> The setter method accepts a sparse sequence, if an element is 
+        present and the name is an empty string, an existing style sheet 
+        assignment is removed.
+     */
+    [attribute] sequence< com::sun::star::sheet::DataTableStyleSheet > StyleSheetNames {
+        set raises ( ::com::sun::star::container::NoSuchElementException );
+        get raises ( ::com::sun::star::container::NoSuchElementException );
+    };
+    
+};
+
+//=============================================================================
+
+}; }; }; };
+
+#endif
+

offapi/com/sun/star/sheet/XDataTables.idl

+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2011 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __com_sun_star_sheet_XDataTables_idl__
+#define __com_sun_star_sheet_XDataTables_idl__
+
+#include <com/sun/star/sheet/XDataTable.idl>
+#include <com/sun/star/table/CellAddress.idl>
+#include <com/sun/star/lang/IndexOutOfBoundsException.idl>
+#include <com/sun/star/container/NoSuchElementException.idl>
+
+//=============================================================================
+
+module com {  module sun {  module star {  module sheet {
+
+//=============================================================================
+
+/** provides functions to access a DataTable
+
+    @see com::sun::star::sheet::DataTables
+ */
+interface XDataTables
+{
+    //-------------------------------------------------------------------------
+
+    /** gets a DataTable by cell position.
+
+        @throws <type scope="com::sun::star::lang">IndexOutOfBoundsException</type>
+                if the position passed is out of bounds.
+
+        @throws <type scope="com::sun::star::container">NoSuchElementException</type>
+                if there is no DataTable at the specified position.
+     */
+    com::sun::star::sheet::XDataTable getDataTableByPosition(
+            [in] com::sun::star::table::CellAddress aPosition )
+            raises( com::sun::star::lang::IndexOutOfBoundsException,
+                    com::sun::star::container::NoSuchElementException );
+
+    //-------------------------------------------------------------------------
+
+    /** gets a DataTable associated with a database range.
+
+        @throws <type scope="com::sun::star::container">NoSuchElementException</type>
+                if there is no DataTable associated with the database 
+                range or a database range with name <b>aName</b> does 
+                not exist.
+     */
+    com::sun::star::sheet::XDataTable getDataTableByDatabaseRangeName( [in] string aName )
+            raises( com::sun::star::lang::IndexOutOfBoundsException,
+                    com::sun::star::container::NoSuchElementException );
+
+};
+
+//=============================================================================
+
+}; }; }; };
+
+#endif
+

offapi/com/sun/star/sheet/makefile.mk

 	DDELinkMode.idl\
 	DDELinks.idl\
 	DDELinksEnumeration.idl\
+	DataTableDisplayFeatures.idl\
+	DataTableStyleEnabled.idl\
+	DataTableStyleSheet.idl\
+	DataTableStyleType.idl\
+	DataTable.idl\
+	DataTables.idl\
+	DataTablesEnumeration.idl\
 	DataImportMode.idl\
 	DataPilotDescriptor.idl\
 	DataPilotField.idl\
 	XDataPilotTable2.idl\
 	XDataPilotTables.idl\
 	XDataPilotTablesSupplier.idl\
+	XDataTable.idl\
+	XDataTables.idl\
 	XDatabaseRange.idl\
 	XDatabaseRanges.idl\
 	XDimensionsSupplier.idl\

sc/inc/datatablestyle.hxx

 #include <tools/string.hxx>
 #include <svl/svarray.hxx>
 
+#include <com/sun/star/sheet/DataTableStyleType.hpp>
+#include <com/sun/star/sheet/DataTableDisplayFeatures.hpp>
+#include <com/sun/star/sheet/DataTableStyleSheet.hpp>
+
 #include "datatablemap.hxx"
 #include "scdllapi.h"
 #include "address.hxx"
 class ScStyleSheet;
 class ScRangeList;
 
+using ::com::sun::star::sheet::DataTableStyleType;
+using ::com::sun::star::sheet::DataTableDisplayFeatures;
+using ::com::sun::star::sheet::DataTableStyleSheet;
+
 
 /** DataTable formats, very similar to ScConditionalFormat, but with much less 
     overhead, all the conditional entries and their formula related members are 
 class SC_DLLPUBLIC ScDataTableFormat
 {
     public:
-        enum StyleType
-        {
-            WHOLE_TABLE = 0,    // base style unless a specific style matches
-            COL_STRIPE_1,
-            COL_STRIPE_2,
-            ROW_STRIPE_1,
-            ROW_STRIPE_2,
-            FIRST_COL,
-            LAST_COL,
-            HEADER_ROW,
-            FIRST_HEADER_CELL,
-            LAST_HEADER_CELL,
-            TOTAL_ROW,
-            FIRST_TOTAL_CELL,
-            LAST_TOTAL_CELL,
-            OUTSIDE,
-            STYLE_COUNT
-        };
 
         ScDataTableFormat( sal_uInt32 nNewKey, const ScDocument* pDoc );
 
 
         ~ScDataTableFormat();
 
+        DataTableStyleType          GetStyleType( const ScAddress& rPos ) const;
+
         /** Set style name for the style type. To clear a style type pass an 
             empty rStyleName string.
-            @param nStripeSize
-                   matters only with COL_STRIPE_1, COL_STRIPE_2, ROW_STRIPE_1 or ROW_STRIPE_2
          */
-        void                        SetStyleName( StyleType eType, const String& rStyleName, SCCOLROW nStripeSize = 1 );
-        StyleType                   GetStyleType( const ScAddress& rPos ) const;
-        const String&               GetStyleName( StyleType eType ) const;
-        SfxStyleSheetBase*          GetStyleSheet( StyleType eType ) const;
+        void                        SetStyleSheetName( DataTableStyleType eType, const String& rStyleName );
+        const String&               GetStyleSheetName( DataTableStyleType eType ) const;
+        SfxStyleSheetBase*          GetStyleSheet( DataTableStyleType eType ) const;
 
         /** Create all necessary styles if they aren't set already and don't 
             exist already and set them.
             @param rPrefix
                    Prefix to be used for style names to form "Prefix_...".
 
-            @returns Vector of newly created style names with offsets == StyleType.
+            @returns Vector of newly created style names with offsets == DataTableStyleType.
          */
         ::std::vector<String>       CreateAndSetStyles( const String& rPrefix );
 
         void                        SetHeaderRowFlag( bool bVal )   { mbHeaderRow = bVal; }
         void                        SetTotalRowFlag( bool bVal )    { mbTotalRow = bVal; }
         void                        SetBandedRowsFlag( bool bVal )  { mbBandedRows = bVal; }
-        void                        SetFirstColFlag( bool bVal )    { mbFirstCol = bVal; }
-        void                        SetLastColFlag( bool bVal )     { mbLastCol = bVal; }
         void                        SetBandedColsFlag( bool bVal )  { mbBandedCols = bVal; }
 
+        void                        SetRowsStripe1( SCROW nRows )
+                                        { mnRowsStripe1 = (nRows >= 1 ? nRows : 1); }
+        void                        SetRowsStripe2( SCROW nRows )
+                                        { mnRowsStripe2 = (nRows >= 1 ? nRows : 1); }
+        void                        SetColsStripe1( SCCOL nCols )
+                                        { mnColsStripe1 = (nCols >= 1 ? nCols : 1); }
+        void                        SetColsStripe2( SCCOL nCols )
+                                        { mnColsStripe2 = (nCols >= 1 ? nCols : 1); }
+
         /** Enable/disable use of style sheet.
 
             Also sets the corresponding flag, e.g. if ROW_STRIPE_1 or ROW_STRIPE_2 
 
             WHOLE_TABLE can not be disabled.
          */
-        void                        SetStyleSheetEnabled( StyleType eType, bool bVal );
-        bool                        IsStyleSheetEnabled( StyleType eType ) const;
+        void                        SetStyleTypeEnabled( DataTableStyleType eType, bool bVal );
+        bool                        IsStyleTypeEnabled( DataTableStyleType eType ) const;
+
+        /** Set display features.
+
+            Mainly intended for API use. Also calls CreateAndSetStyles().
+         */
+        void                        SetDisplayFeatures( const DataTableDisplayFeatures & rFeatures );
+        DataTableDisplayFeatures    GetDisplayFeatures() const;
+
+        /** Set style sheet names.
+
+            Mainly intended for API use.
+         */
+        void                        SetStyleSheetNames( const ::com::sun::star::uno::Sequence< DataTableStyleSheet > & rNames );
+        ::com::sun::star::uno::Sequence< DataTableStyleSheet >  GetStyleSheetNames() const;
 
         const ScRange&              GetTableRange() const     { return maRange; }
         bool                        GetHeaderRowFlag() const  { return mbHeaderRow; }
         bool                        GetTotalRowFlag() const   { return mbTotalRow; }
         bool                        GetBandedRowsFlag() const { return mbBandedRows; }
-        bool                        GetFirstColFlag() const   { return mbFirstCol; }
-        bool                        GetLastColFlag() const    { return mbLastCol; }
         bool                        GetBandedColsFlag() const { return mbBandedCols; }
 
         SCROW                       GetFirstDataRow() const
         BOOL operator < ( const ScDataTableFormat& r ) const    { return mnKey <  r.mnKey; }
 
     private:
+
+        // Leave room for OUTSIDE in arrays.
+        // sal_Int32 instead of size_t because UNO enums are implemented as such and to avoid casting.
+        static const sal_Int32 INTERNAL_OUTSIDE = ::com::sun::star::sheet::DataTableStyleType_STYLE_COUNT;
+        static const sal_Int32 INTERNAL_STYLE_COUNT = INTERNAL_OUTSIDE + 1;
+
         sal_uInt32                       mnKey;
         const ScDocument                *mpDoc;
         ScRange                          maRange;
-        bool                             mbStyleEnabled[STYLE_COUNT];
-        String                           maStyleName[STYLE_COUNT];
-        mutable const SfxStyleSheetBase *mpStyleSheet[STYLE_COUNT];     // cached pointers to style sheets
+        bool                             mbStyleEnabled[INTERNAL_STYLE_COUNT];
+        String                           maStyleName[INTERNAL_STYLE_COUNT];
+        mutable const SfxStyleSheetBase *mpStyleSheet[INTERNAL_STYLE_COUNT];    // cached pointers to style sheets
+        String                           maStyleSheetNamePrefix;
         SCCOL                            mnColsStripe1;
         SCCOL                            mnColsStripe2;
         SCROW                            mnRowsStripe1;
         bool                             mbHeaderRow                :1;
         bool                             mbTotalRow                 :1;
         bool                             mbBandedRows               :1;
-        bool                             mbFirstCol                 :1;
-        bool                             mbLastCol                  :1;
         bool                             mbBandedCols               :1;
 
         // not implemented, prevent usage
         /** Check if style sheet is enabled and name assigned.
             Does not check eType for bounds!
          */
-        bool                        IsActive( StyleType eType ) const
+        bool                        IsActive( DataTableStyleType eType ) const
                                         { return mbStyleEnabled[eType] && maStyleName[eType].Len(); }
 
 };

sc/inc/datatableuno.hxx

+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2011 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SC_DATATABLEUNO_HXX
+#define SC_DATATABLEUNO_HXX
+
+#include <datatablestyle.hxx>
+#include <com/sun/star/sheet/XDataTable.hpp>
+#include <com/sun/star/sheet/XCellRangeReferrer.hpp>
+#include <com/sun/star/sheet/XDataTables.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/implbase3.hxx>
+#include <cppuhelper/implbase4.hxx>
+#include <svl/lstner.hxx>
+
+class ScDataTableObj : public cppu::WeakImplHelper3<
+                           com::sun::star::sheet::XDataTable,
+                           com::sun::star::sheet::XCellRangeReferrer,
+                           com::sun::star::lang::XServiceInfo >,
+                       public SfxListener
+{
+public:
+
+                explicit    ScDataTableObj( ScDocShell* pDocShell, sal_uInt32 nKey );
+    virtual                 ~ScDataTableObj();
+
+    virtual void            Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+    // XDataTable
+    virtual ::com::sun::star::table::CellRangeAddress SAL_CALL getTableArea() throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::container::NoSuchElementException);
+    virtual ::sal_Bool SAL_CALL getHeaderRowFlag() throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::container::NoSuchElementException);
+    virtual ::sal_Bool SAL_CALL getTotalRowFlag() throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::container::NoSuchElementException);
+    virtual ::com::sun::star::sheet::DataTableDisplayFeatures SAL_CALL getDisplayFeatures() throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::container::NoSuchElementException);
+    virtual void SAL_CALL setDisplayFeatures( const ::com::sun::star::sheet::DataTableDisplayFeatures& _displayfeatures ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::container::NoSuchElementException);
+    virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::DataTableStyleSheet > SAL_CALL getStyleSheetNames() throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::container::NoSuchElementException);
+    virtual void SAL_CALL setStyleSheetNames( const ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::DataTableStyleSheet >& _stylesheetnames ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::container::NoSuchElementException);
+
+    // XCellRangeReferrer
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL getReferredCells(  ) throw (::com::sun::star::uno::RuntimeException);
+
+    // XServiceInfo
+    virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw (::com::sun::star::uno::RuntimeException);
+
+private:
+    ScDocShell *mpDocShell;
+    sal_uInt32  mnKey;
+
+    ScDataTableFormat*  GetDataTableFormat() const throw( ::com::sun::star::uno::RuntimeException, ::com::sun::star::container::NoSuchElementException );
+
+};
+
+
+class ScDataTablesObj : public cppu::WeakImplHelper4<
+                           com::sun::star::sheet::XDataTables,
+                           com::sun::star::container::XEnumerationAccess,
+                           com::sun::star::container::XIndexAccess,
+                           com::sun::star::lang::XServiceInfo >,
+                       public SfxListener
+{
+public:
+                explicit    ScDataTablesObj( ScDocShell* pDocShell );
+    virtual                 ~ScDataTablesObj();
+
+    virtual void            Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+    // XDataTables
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDataTable > SAL_CALL getDataTableByPosition( const ::com::sun::star::table::CellAddress& aPosition ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDataTable > SAL_CALL getDataTableByDatabaseRangeName( const ::rtl::OUString& aName ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
+
+    // XEnumerationAccess
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration(  ) throw (::com::sun::star::uno::RuntimeException);
+
+    // XIndexAccess
+    virtual ::sal_Int32 SAL_CALL getCount(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+    // XElementAccess
+    virtual ::com::sun::star::uno::Type SAL_CALL getElementType(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::sal_Bool SAL_CALL hasElements(  ) throw (::com::sun::star::uno::RuntimeException);
+
+    // XServiceInfo
+    virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw (::com::sun::star::uno::RuntimeException);
+
+private:
+    ScDocShell  *mpDocShell;
+
+};
+
+#endif
+

sc/inc/document.hxx

                                         @returns the actual key used. */
     sal_uInt32                      AddDataTableFormat( const ScDataTableFormat& rNew, sal_uInt32 nTryKey = 0 );
     const ScDataTableFormat*        GetDataTableFormat( sal_uInt32 nKey ) const;
+          ScDataTableFormat*        GetDataTableFormatNonConst( sal_uInt32 nKey ) const;
     void                            DeleteDataTableFormats( const ScDataTableMap& rDataTables );
     void                            DeleteDataTableFormatsOnTab( SCTAB nTab );
     SC_DLLPUBLIC const SfxItemSet*  GetDataTableItemSet( SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt32 nKey = 0 ) const;

sc/inc/unonames.hxx

 #define SC_UNO_SHEETLINKS			"SheetLinks"
 #define SC_UNO_FORBIDDEN			"ForbiddenCharacters"
 #define SC_UNO_HASDRAWPAGES			"HasDrawPages"
+#define SC_UNO_DATATABLES			"DataTables"
 
 //	CharacterProperties
 #define SC_UNONAME_CCOLOR			"CharColor"

sc/source/core/data/datatablestyle.cxx

 
 #include <string.h>
 
+using namespace ::com::sun::star::sheet;
+using namespace ::com::sun::star;
+
 SV_IMPL_OP_PTRARR_SORT( ScDataTableFormats_Impl, ScDataTableFormatPtr );
 
 
         mbHeaderRow( false),
         mbTotalRow( false),
         mbBandedRows( false),
-        mbFirstCol( false),
-        mbLastCol( false),
         mbBandedCols( false)
 {
     memset( mbStyleEnabled, 0, sizeof( mbStyleEnabled));
-    mbStyleEnabled[WHOLE_TABLE] = true;     // always
+    mbStyleEnabled[DataTableStyleType_WHOLE_TABLE] = true;     // always
     InvalidateStyleSheetPointers();
 }
 
         mbHeaderRow( r.mbHeaderRow),
         mbTotalRow( r.mbTotalRow),
         mbBandedRows( r.mbBandedRows),
-        mbFirstCol( r.mbFirstCol),
-        mbLastCol( r.mbLastCol),
         mbBandedCols( r.mbBandedCols)
 {
     InvalidateStyleSheetPointers();
-    for (size_t i=0; i < STYLE_COUNT; ++i)
+    for (sal_Int32 i=0; i < INTERNAL_STYLE_COUNT; ++i)
     {
         mbStyleEnabled[i] = r.mbStyleEnabled[i];
         maStyleName[i] = r.maStyleName[i];
 {
     if (maRange != r.maRange)
         return false;
-    for (size_t i=0; i < STYLE_COUNT; ++i)
+    for (sal_Int32 i=0; i < INTERNAL_STYLE_COUNT; ++i)
     {
         if (mbStyleEnabled[i] != r.mbStyleEnabled[i])
             return false;
         mbHeaderRow == r.mbHeaderRow &&
         mbTotalRow == r.mbTotalRow &&
         mbBandedRows == r.mbBandedRows &&
-        mbFirstCol == r.mbFirstCol &&
-        mbLastCol == r.mbLastCol &&
         mbBandedCols == r.mbBandedCols;
 }
 
 
-void ScDataTableFormat::SetStyleName( StyleType eType, const String& rStyleName, SCCOLROW nStripeSize )
+void ScDataTableFormat::SetStyleSheetName( DataTableStyleType eType, const String& rStyleName )
 {
-    if (0 <= eType && eType < STYLE_COUNT)
+    if (0 <= eType && eType < INTERNAL_STYLE_COUNT)
     {
-        maStyleName[eType] = rStyleName;
-        mpStyleSheet[eType] = NULL;
-        switch (eType)
+        if (rStyleName != maStyleName[eType])
         {
-            case COL_STRIPE_1:
-                mnColsStripe1 = static_cast<SCCOL>(nStripeSize);
-                if (mnColsStripe1 < 1)
-                    mnColsStripe1 = 1;
-                break;
-            case COL_STRIPE_2:
-                mnColsStripe2 = static_cast<SCCOL>(nStripeSize);
-                if (mnColsStripe2 < 1)
-                    mnColsStripe2 = 1;
-                break;
-            case ROW_STRIPE_1:
-                mnRowsStripe1 = static_cast<SCROW>(nStripeSize);
-                if (mnRowsStripe1 < 1)
-                    mnRowsStripe1 = 1;
-                break;
-            case ROW_STRIPE_2:
-                mnRowsStripe2 = static_cast<SCROW>(nStripeSize);
-                if (mnRowsStripe2 < 1)
-                    mnRowsStripe2 = 1;
-                break;
-            default:
-                ;   // nothing
+            maStyleName[eType] = rStyleName;
+            mpStyleSheet[eType] = NULL;
         }
     }
 }
 
 
-ScDataTableFormat::StyleType ScDataTableFormat::GetStyleType( const ScAddress& rPos ) const
+DataTableStyleType ScDataTableFormat::GetStyleType( const ScAddress& rPos ) const
 {
     if (!maRange.In( rPos))
-        return OUTSIDE;
+        return static_cast<DataTableStyleType>(INTERNAL_OUTSIDE);
 
     if (mbHeaderRow && rPos.Row() == maRange.aStart.Row())
     {
         // 3. first/last column
         // 4. whole table
         // NO banded rows or columns
-        const StyleType eRow = (IsActive( HEADER_ROW) ? HEADER_ROW : WHOLE_TABLE);
+        const DataTableStyleType eRow = (IsActive( DataTableStyleType_HEADER_ROW) ? 
+                DataTableStyleType_HEADER_ROW : 
+                DataTableStyleType_WHOLE_TABLE);
         if (rPos.Col() == maRange.aStart.Col())
         {
-            if (IsActive( FIRST_HEADER_CELL))
-                return FIRST_HEADER_CELL;
-            if (eRow == WHOLE_TABLE && mbFirstCol && IsActive( FIRST_COL))
-                return FIRST_COL;
+            if (IsActive( DataTableStyleType_FIRST_HEADER_CELL))
+                return DataTableStyleType_FIRST_HEADER_CELL;
+            if (eRow == DataTableStyleType_WHOLE_TABLE && IsActive( DataTableStyleType_FIRST_COL))
+                return DataTableStyleType_FIRST_COL;
         }
         else if (rPos.Col() == maRange.aEnd.Col())
         {
-            if (IsActive( LAST_HEADER_CELL))
-                return LAST_HEADER_CELL;
-            if (eRow == WHOLE_TABLE && mbLastCol && IsActive( LAST_COL))
-                return FIRST_COL;
+            if (IsActive( DataTableStyleType_LAST_HEADER_CELL))
+                return DataTableStyleType_LAST_HEADER_CELL;
+            if (eRow == DataTableStyleType_WHOLE_TABLE && IsActive( DataTableStyleType_LAST_COL))
+                return DataTableStyleType_FIRST_COL;
         }
         return eRow;
     }
         // 3. first/last column
         // 4. whole table
         // NO banded rows or columns
-        const StyleType eRow = (IsActive( TOTAL_ROW) ? TOTAL_ROW : WHOLE_TABLE);
+        const DataTableStyleType eRow = (IsActive( DataTableStyleType_TOTAL_ROW) ? 
+                DataTableStyleType_TOTAL_ROW : DataTableStyleType_WHOLE_TABLE);
         if (rPos.Col() == maRange.aStart.Col())
         {
-            if (IsActive( FIRST_TOTAL_CELL))
-                return FIRST_TOTAL_CELL;
-            if (eRow == WHOLE_TABLE && mbFirstCol && IsActive( FIRST_COL))
-                return FIRST_COL;
+            if (IsActive( DataTableStyleType_FIRST_TOTAL_CELL))
+                return DataTableStyleType_FIRST_TOTAL_CELL;
+            if (eRow == DataTableStyleType_WHOLE_TABLE && IsActive( DataTableStyleType_FIRST_COL))
+                return DataTableStyleType_FIRST_COL;
         }
         else if (rPos.Col() == maRange.aEnd.Col())
         {
-            if (IsActive( LAST_TOTAL_CELL))
-                return LAST_TOTAL_CELL;
-            if (eRow == WHOLE_TABLE && mbLastCol && IsActive( LAST_COL))
-                return LAST_COL;
+            if (IsActive( DataTableStyleType_LAST_TOTAL_CELL))
+                return DataTableStyleType_LAST_TOTAL_CELL;
+            if (eRow == DataTableStyleType_WHOLE_TABLE && IsActive( DataTableStyleType_LAST_COL))
+                return DataTableStyleType_LAST_COL;
         }
         return eRow;
     }
-    if (mbFirstCol && rPos.Col() == maRange.aStart.Col() && IsActive( FIRST_COL))
-        return FIRST_COL;
-    if (mbLastCol && rPos.Col() == maRange.aEnd.Col() && IsActive( LAST_COL))
-        return LAST_COL;
+    if (rPos.Col() == maRange.aStart.Col() && IsActive( DataTableStyleType_FIRST_COL))
+        return DataTableStyleType_FIRST_COL;
+    if (rPos.Col() == maRange.aEnd.Col() && IsActive( DataTableStyleType_LAST_COL))
+        return DataTableStyleType_LAST_COL;
     // If row stripes are set they take precedence over column stripes.
     if (mbBandedRows)
     {
         SCROW nOff = (nRow - nStartRow) % (mnRowsStripe1 + mnRowsStripe2);
         if (nOff < mnRowsStripe1)
         {
-            if (IsActive( ROW_STRIPE_1))
-                return ROW_STRIPE_1;
+            if (IsActive( DataTableStyleType_ROW_STRIPE_1))
+                return DataTableStyleType_ROW_STRIPE_1;
         }
         else
         {
-            if (IsActive( ROW_STRIPE_2))
-                return ROW_STRIPE_2;
+            if (IsActive( DataTableStyleType_ROW_STRIPE_2))
+                return DataTableStyleType_ROW_STRIPE_2;
         }
     }
     if (mbBandedCols)
         SCCOL nOff = (nCol - nStartCol) % (mnColsStripe1 + mnColsStripe2);
         if (nOff < mnColsStripe1)
         {
-            if (IsActive( COL_STRIPE_1))
-                return COL_STRIPE_1;
+            if (IsActive( DataTableStyleType_COL_STRIPE_1))
+                return DataTableStyleType_COL_STRIPE_1;
         }
         else
         {
-            if (IsActive( COL_STRIPE_2))
-                return COL_STRIPE_2;
+            if (IsActive( DataTableStyleType_COL_STRIPE_2))
+                return DataTableStyleType_COL_STRIPE_2;
         }
     }
-    return WHOLE_TABLE;
+    return DataTableStyleType_WHOLE_TABLE;
 }
 
 
-const String& ScDataTableFormat::GetStyleName( StyleType eType ) const
+const String& ScDataTableFormat::GetStyleSheetName( DataTableStyleType eType ) const
 {
-    if (0 <= eType && eType < STYLE_COUNT)
+    if (0 <= eType && eType < INTERNAL_STYLE_COUNT)
         return maStyleName[eType];
     else
         return EMPTY_STRING;
 }
 
 
-SfxStyleSheetBase* ScDataTableFormat::GetStyleSheet( StyleType eType ) const
+SfxStyleSheetBase* ScDataTableFormat::GetStyleSheet( DataTableStyleType eType ) const
 {
-    if (0 <= eType && eType < STYLE_COUNT)
+    if (0 <= eType && eType < INTERNAL_STYLE_COUNT)
     {
         if (!mpStyleSheet[eType] && maStyleName[eType].Len())
-            mpStyleSheet[eType] = mpDoc->GetStyleSheetPool()->Find( maStyleName[eType], SFX_STYLE_FAMILY_PARA);
-        if (!mpStyleSheet[eType] && !mpStyleSheet[WHOLE_TABLE] && maStyleName[WHOLE_TABLE].Len())
-            mpStyleSheet[WHOLE_TABLE] = mpDoc->GetStyleSheetPool()->Find( maStyleName[WHOLE_TABLE], SFX_STYLE_FAMILY_PARA);
+            mpStyleSheet[eType] = mpDoc->GetStyleSheetPool()->Find( 
+                    maStyleName[eType], SFX_STYLE_FAMILY_PARA);
+        if (!mpStyleSheet[eType] && !mpStyleSheet[DataTableStyleType_WHOLE_TABLE] && 
+                maStyleName[DataTableStyleType_WHOLE_TABLE].Len())
+            mpStyleSheet[DataTableStyleType_WHOLE_TABLE] = mpDoc->GetStyleSheetPool()->Find( 
+                    maStyleName[DataTableStyleType_WHOLE_TABLE], SFX_STYLE_FAMILY_PARA);
         // Because there is no  SfxStyleSheetBase::GetItemSet() const  or some 
         // such we always return a non-const.
-        return const_cast<SfxStyleSheetBase*>(mpStyleSheet[eType] ? mpStyleSheet[eType] : mpStyleSheet[WHOLE_TABLE]);
+        return const_cast<SfxStyleSheetBase*>(mpStyleSheet[eType] ? mpStyleSheet[eType] : 
+                mpStyleSheet[DataTableStyleType_WHOLE_TABLE]);
     }
     else
         return NULL;
     if (!rOld.Len())
         return;
 
-    for (size_t i=0; i < STYLE_COUNT; ++i)
+    for (sal_Int32 i=0; i < INTERNAL_STYLE_COUNT; ++i)
     {
         if (maStyleName[i] == rOld)
         {
 
 void ScDataTableFormat::InvalidateStyleSheet( const SfxStyleSheetBase* pStyleSheet, const String& rName )
 {
-    for (size_t i=0; i < STYLE_COUNT; ++i)
+    for (sal_Int32 i=0; i < INTERNAL_STYLE_COUNT; ++i)
     {
         if (mpStyleSheet[i] == pStyleSheet)
             mpStyleSheet[i] = NULL;
 bool ScDataTableFormat::IsStyleSheetUsed( const ScStyleSheet& rStyle, bool bGatherAllStyles ) const
 {
     bool bUsed = false;
-    for (size_t i=0; i < STYLE_COUNT; ++i)
+    for (sal_Int32 i=0; i < INTERNAL_STYLE_COUNT; ++i)
     {
         // Pointer may not have been cached.
         if (!mpStyleSheet[i] && maStyleName[i].Len())
 
 ::std::vector<String> ScDataTableFormat::CreateAndSetStyles( const String& rPrefix )
 {
-    ::std::vector<String> aNames( STYLE_COUNT);
+    if (!maStyleSheetNamePrefix.Len())
+    {
+        DBG_ASSERT( rPrefix.Len(), "ScDataTableFormat::CreateAndSetStyles: no prefix");
+        maStyleSheetNamePrefix = rPrefix;
+    }
+
+    ::std::vector<String> aNames( INTERNAL_STYLE_COUNT);
     ScStyleSheetPool* pStyleSheetPool = mpDoc->GetStyleSheetPool();
-    for (size_t i=0; i < STYLE_COUNT; ++i)
+    for (sal_Int32 i=0; i < INTERNAL_STYLE_COUNT; ++i)
     {
         if (maStyleName[i].Len())
             continue;
 
-        String aStyleName( rPrefix);
-        aStyleName += '_';
-        if (i <= 9)
-            aStyleName += '0';
-        aStyleName += String::CreateFromInt32(i);
-        aStyleName += '_';
         String aName;
         switch (i)
         {
             /* FIXME: obtain names from localizable resource strings. */
-            case WHOLE_TABLE:
+            case DataTableStyleType_WHOLE_TABLE:
                 // Always create, it is THE parent.
                 aName = String( RTL_CONSTASCII_USTRINGPARAM( "whole_table"));
                 break;
-            case COL_STRIPE_1:
-                if (mbStyleEnabled[COL_STRIPE_1])
+            case DataTableStyleType_COL_STRIPE_1:
+                if (mbStyleEnabled[DataTableStyleType_COL_STRIPE_1])
                     aName = String( RTL_CONSTASCII_USTRINGPARAM( "col_stripe_1"));
                 break;
-            case COL_STRIPE_2:
-                if (mbStyleEnabled[COL_STRIPE_2])
+            case DataTableStyleType_COL_STRIPE_2:
+                if (mbStyleEnabled[DataTableStyleType_COL_STRIPE_2])
                     aName = String( RTL_CONSTASCII_USTRINGPARAM( "col_stripe_2"));
                 break;
-            case ROW_STRIPE_1:
-                if (mbStyleEnabled[ROW_STRIPE_1])
+            case DataTableStyleType_ROW_STRIPE_1:
+                if (mbStyleEnabled[DataTableStyleType_ROW_STRIPE_1])
                     aName = String( RTL_CONSTASCII_USTRINGPARAM( "row_stripe_1"));
                 break;
-            case ROW_STRIPE_2:
-                if (mbStyleEnabled[ROW_STRIPE_2])
+            case DataTableStyleType_ROW_STRIPE_2:
+                if (mbStyleEnabled[DataTableStyleType_ROW_STRIPE_2])
                     aName = String( RTL_CONSTASCII_USTRINGPARAM( "row_stripe_2"));
                 break;
-            case FIRST_COL:
-                if (mbStyleEnabled[FIRST_COL])
+            case DataTableStyleType_FIRST_COL:
+                if (mbStyleEnabled[DataTableStyleType_FIRST_COL])
                     aName = String( RTL_CONSTASCII_USTRINGPARAM( "first_col"));
                 break;
-            case LAST_COL:
-                if (mbStyleEnabled[LAST_COL])
+            case DataTableStyleType_LAST_COL:
+                if (mbStyleEnabled[DataTableStyleType_LAST_COL])
                     aName = String( RTL_CONSTASCII_USTRINGPARAM( "last_col"));
                 break;
-            case HEADER_ROW:
-                // HEADER_ROW is parent of FIRST_HEADER_CELL and 
-                // LAST_HEADER_CELL, so create if any of them is enabled.
-                if ((mbStyleEnabled[HEADER_ROW] || 
-                            mbStyleEnabled[FIRST_HEADER_CELL] || 
-                            mbStyleEnabled[LAST_HEADER_CELL]))
+            case DataTableStyleType_HEADER_ROW:
+                // DataTableStyleType_HEADER_ROW is parent of 
+                // DataTableStyleType_FIRST_HEADER_CELL and 
+                // DataTableStyleType_LAST_HEADER_CELL, so create if any of 
+                // them is enabled.
+                if ((mbStyleEnabled[DataTableStyleType_HEADER_ROW] || 
+                            mbStyleEnabled[DataTableStyleType_FIRST_HEADER_CELL] || 
+                            mbStyleEnabled[DataTableStyleType_LAST_HEADER_CELL]))
                     aName = String( RTL_CONSTASCII_USTRINGPARAM( "header_row"));
                 break;
-            case FIRST_HEADER_CELL:
-                if (mbStyleEnabled[FIRST_HEADER_CELL])
+            case DataTableStyleType_FIRST_HEADER_CELL:
+                if (mbStyleEnabled[DataTableStyleType_FIRST_HEADER_CELL])
                     aName = String( RTL_CONSTASCII_USTRINGPARAM( "first_header_cell"));
                 break;
-            case LAST_HEADER_CELL:
-                if (mbStyleEnabled[LAST_HEADER_CELL])
+            case DataTableStyleType_LAST_HEADER_CELL:
+                if (mbStyleEnabled[DataTableStyleType_LAST_HEADER_CELL])
                     aName = String( RTL_CONSTASCII_USTRINGPARAM( "last_header_cell"));
                 break;
-            case TOTAL_ROW:
-                // TOTAL_ROW is parent of FIRST_TOTAL_CELL and LAST_TOTAL_CELL, 
-                // so create if any of them is enabled.
-                if ((mbStyleEnabled[TOTAL_ROW] || 
-                            mbStyleEnabled[FIRST_TOTAL_CELL] || 
-                            mbStyleEnabled[LAST_TOTAL_CELL]))
+            case DataTableStyleType_TOTAL_ROW:
+                // DataTableStyleType_TOTAL_ROW is parent of 
+                // DataTableStyleType_FIRST_TOTAL_CELL and 
+                // DataTableStyleType_LAST_TOTAL_CELL, so create if any of them 
+                // is enabled.
+                if ((mbStyleEnabled[DataTableStyleType_TOTAL_ROW] || 
+                            mbStyleEnabled[DataTableStyleType_FIRST_TOTAL_CELL] || 
+                            mbStyleEnabled[DataTableStyleType_LAST_TOTAL_CELL]))
                     aName = String( RTL_CONSTASCII_USTRINGPARAM( "total_row"));
                 break;
-            case FIRST_TOTAL_CELL:
-                if (mbStyleEnabled[FIRST_TOTAL_CELL])
+            case DataTableStyleType_FIRST_TOTAL_CELL:
+                if (mbStyleEnabled[DataTableStyleType_FIRST_TOTAL_CELL])
                     aName = String( RTL_CONSTASCII_USTRINGPARAM( "first_total_cell"));
                 break;
-            case LAST_TOTAL_CELL:
-                if (mbStyleEnabled[LAST_TOTAL_CELL])
+            case DataTableStyleType_LAST_TOTAL_CELL:
+                if (mbStyleEnabled[DataTableStyleType_LAST_TOTAL_CELL])
                     aName = String( RTL_CONSTASCII_USTRINGPARAM( "last_total_cell"));
                 break;
-            case OUTSIDE:
+            case INTERNAL_OUTSIDE:
 #if OSL_DEBUG_LEVEL > 1
                 // Outside style can be used to visualize invalid attribution 
                 // during cut/copy/paste/insert/delete/..., e.g. set to grey 
         }
         if (aName.Len())
         {
+            String aStyleName( maStyleSheetNamePrefix);
+            aStyleName += '_';
+            if (i <= 9)
+                aStyleName += '0';
+            aStyleName += String::CreateFromInt32(i);
+            aStyleName += '_';
             aStyleName += aName;
-            SetStyleName( static_cast<StyleType>(i), aStyleName);
+            SetStyleSheetName( static_cast<DataTableStyleType>(i), aStyleName);
             ScStyleSheet* pStyle = static_cast<ScStyleSheet*>( 
                     pStyleSheetPool->Find( aStyleName, SFX_STYLE_FAMILY_PARA));
             if (!pStyle)
                 pStyle = &static_cast<ScStyleSheet&>( pStyleSheetPool->Make( 
                             aStyleName, SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_USERDEF));
                 //! Setting parents depends on order of enums!
-                switch (static_cast<StyleType>(i))
+                switch (static_cast<DataTableStyleType>(i))
                 {
-                    case WHOLE_TABLE:
+                    case DataTableStyleType_WHOLE_TABLE:
                         pStyle->SetParent( ScGlobal::GetRscString( STR_STYLENAME_STANDARD));
                         break;
-                    case COL_STRIPE_1:
-                    case COL_STRIPE_2:
-                    case ROW_STRIPE_1:
-                    case ROW_STRIPE_2:
-                    case FIRST_COL:
-                    case LAST_COL:
-                    case HEADER_ROW:
-                    case TOTAL_ROW:
-                        pStyle->SetParent( maStyleName[WHOLE_TABLE]);
+                    case DataTableStyleType_COL_STRIPE_1:
+                    case DataTableStyleType_COL_STRIPE_2:
+                    case DataTableStyleType_ROW_STRIPE_1:
+                    case DataTableStyleType_ROW_STRIPE_2:
+                    case DataTableStyleType_FIRST_COL:
+                    case DataTableStyleType_LAST_COL:
+                    case DataTableStyleType_HEADER_ROW:
+                    case DataTableStyleType_TOTAL_ROW:
+                        pStyle->SetParent( maStyleName[DataTableStyleType_WHOLE_TABLE]);
                         break;
-                    case FIRST_HEADER_CELL:
-                    case LAST_HEADER_CELL:
-                        pStyle->SetParent( maStyleName[HEADER_ROW]);
+                    case DataTableStyleType_FIRST_HEADER_CELL:
+                    case DataTableStyleType_LAST_HEADER_CELL:
+                        pStyle->SetParent( maStyleName[DataTableStyleType_HEADER_ROW]);
                         break;
-                    case FIRST_TOTAL_CELL:
-                    case LAST_TOTAL_CELL:
-                        pStyle->SetParent( maStyleName[TOTAL_ROW]);
+                    case DataTableStyleType_FIRST_TOTAL_CELL:
+                    case DataTableStyleType_LAST_TOTAL_CELL:
+                        pStyle->SetParent( maStyleName[DataTableStyleType_TOTAL_ROW]);
                         break;
-                    case OUTSIDE:
+                    case INTERNAL_OUTSIDE:
                         pStyle->SetParent( ScGlobal::GetRscString( STR_STYLENAME_STANDARD));
                         break;
-                    case STYLE_COUNT:
+                    case DataTableStyleType_MAKE_FIXED_SIZE:
                         break;  // nothing, handle to satisfy compiler
                 }
             }
 
 void ScDataTableFormat::InitStyles( const ::std::vector<String> & rStyleNames )
 {
+    DBG_ASSERT( rStyleNames.size() == static_cast<size_t>(INTERNAL_STYLE_COUNT), "ScDataTableFormat::InitStyles: bad vector length");
+
     /* TODO DataTable: Derive the presets from themes or templates. These 
      * presets are for banded rows (stripe 1) with header row. See also 
      * InitDisplayFeatures() */
     ScStyleSheetPool* pPool = mpDoc->GetStyleSheetPool();
     Color aColorWhite( COL_WHITE);
 
-    const String* pName = &rStyleNames[WHOLE_TABLE];
+    const String* pName = &rStyleNames[DataTableStyleType_WHOLE_TABLE];
     if (pName->Len())
     {
         SfxStyleSheetBase* pStyleSheet = pPool->Find( *pName, SFX_STYLE_FAMILY_PARA);
             // pale blue
             rItemSet.Put( SvxBrushItem( Color( 0xdb, 0xe5, 0xf1), ATTR_BACKGROUND));
 
-            // White border around all cells. Note that WHOLE_TABLE is direct 
-            // or indirect parent of all other style sheets.
+            // White border around all cells. Note that 
+            // DataTableStyleType_WHOLE_TABLE is direct or indirect parent of 
+            // all other style sheets.
             SvxBoxItem aBorderItem( ATTR_BORDER);
             SvxBorderLine aBorderLine;
             aBorderLine.SetColor( aColorWhite);
         }
     }
 
-    pName = &rStyleNames[ROW_STRIPE_1];
+    pName = &rStyleNames[DataTableStyleType_ROW_STRIPE_1];
     if (pName->Len())
     {
         SfxStyleSheetBase* pStyleSheet = pPool->Find( *pName, SFX_STYLE_FAMILY_PARA);
         }
     }
 
-    pName = &rStyleNames[HEADER_ROW];
+    pName = &rStyleNames[DataTableStyleType_HEADER_ROW];
     if (pName->Len())
     {
         SfxStyleSheetBase* pStyleSheet = pPool->Find( *pName, SFX_STYLE_FAMILY_PARA);
     }
 
 #if OSL_DEBUG_LEVEL > 1
-    pName = &rStyleNames[OUTSIDE];
+    pName = &rStyleNames[INTERNAL_OUTSIDE];
     if (pName->Len())
     {
         SfxStyleSheetBase* pStyleSheet = pPool->Find( *pName, SFX_STYLE_FAMILY_PARA);
 void ScDataTableFormat::InitDisplayFeatures( const String& rPrefix )
 {
     /* TODO DataTable: parameters for feature appearance */
-    SetStyleSheetEnabled( WHOLE_TABLE, true);
+    SetStyleTypeEnabled( DataTableStyleType_WHOLE_TABLE, true);
     if (mbHeaderRow)
     {
-        SetStyleSheetEnabled( HEADER_ROW, true);
-        SetStyleSheetEnabled( FIRST_HEADER_CELL, true);
-        SetStyleSheetEnabled( LAST_HEADER_CELL, true);
+        SetStyleTypeEnabled( DataTableStyleType_HEADER_ROW, true);
+        SetStyleTypeEnabled( DataTableStyleType_FIRST_HEADER_CELL, true);
+        SetStyleTypeEnabled( DataTableStyleType_LAST_HEADER_CELL, true);
     }
-    SetStyleSheetEnabled( ROW_STRIPE_1, true);
+    SetStyleTypeEnabled( DataTableStyleType_ROW_STRIPE_1, true);
     ::std::vector<String> aStyleNames( CreateAndSetStyles( rPrefix));
-    // The vector contains only names of newly created styles, 
-    // else empty strings. Preset style sheets with sensible 
-    // values.
+    // The vector contains only names of newly created styles. Preset style 
+    // sheets with sensible values.
     InitStyles( aStyleNames);
 }
 
 
-void ScDataTableFormat::SetStyleSheetEnabled( StyleType eType, bool bVal )
+void ScDataTableFormat::SetStyleTypeEnabled( DataTableStyleType eType, bool bVal )
 {
     switch (eType)
     {
-        case WHOLE_TABLE:
+        case DataTableStyleType_WHOLE_TABLE:
             break;  // never
-        case COL_STRIPE_1:
+        case DataTableStyleType_COL_STRIPE_1:
             mbStyleEnabled[eType] = bVal;
             if (bVal)
                 mbBandedCols = true;
-            else if (!mbStyleEnabled[COL_STRIPE_2])
+            else if (!mbStyleEnabled[DataTableStyleType_COL_STRIPE_2])
                 mbBandedCols = false;
             break;
-        case COL_STRIPE_2:
+        case DataTableStyleType_COL_STRIPE_2:
             mbStyleEnabled[eType] = bVal;
             if (bVal)
                 mbBandedCols = true;
-            else if (!mbStyleEnabled[COL_STRIPE_1])
+            else if (!mbStyleEnabled[DataTableStyleType_COL_STRIPE_1])
                 mbBandedCols = false;
             break;
-        case ROW_STRIPE_1:
+        case DataTableStyleType_ROW_STRIPE_1:
             mbStyleEnabled[eType] = bVal;
             if (bVal)
                 mbBandedRows = true;
-            else if (!mbStyleEnabled[ROW_STRIPE_2])
+            else if (!mbStyleEnabled[DataTableStyleType_ROW_STRIPE_2])
                 mbBandedRows = false;
             break;
-        case ROW_STRIPE_2:
+        case DataTableStyleType_ROW_STRIPE_2:
             mbStyleEnabled[eType] = bVal;
             if (bVal)
                 mbBandedRows = true;
-            else if (!mbStyleEnabled[ROW_STRIPE_1])
+            else if (!mbStyleEnabled[DataTableStyleType_ROW_STRIPE_1])
                 mbBandedRows = false;
             break;
-        case FIRST_COL:
-            mbStyleEnabled[eType] = bVal;
-            mbFirstCol = bVal;
-            break;
-        case LAST_COL:
-            mbStyleEnabled[eType] = bVal;
-            mbLastCol = bVal;
-            break;
-        case HEADER_ROW:
-        case TOTAL_ROW:
-        case FIRST_HEADER_CELL:
-        case LAST_HEADER_CELL:
-        case FIRST_TOTAL_CELL:
-        case LAST_TOTAL_CELL:
+        case DataTableStyleType_FIRST_COL:
+        case DataTableStyleType_LAST_COL:
+        case DataTableStyleType_HEADER_ROW:
+        case DataTableStyleType_TOTAL_ROW:
+        case DataTableStyleType_FIRST_HEADER_CELL:
+        case DataTableStyleType_LAST_HEADER_CELL:
+        case DataTableStyleType_FIRST_TOTAL_CELL:
+        case DataTableStyleType_LAST_TOTAL_CELL:
             mbStyleEnabled[eType] = bVal;
             break;
-        case OUTSIDE:
+        case INTERNAL_OUTSIDE:
             break;  // never
-        case STYLE_COUNT:
+        case DataTableStyleType_MAKE_FIXED_SIZE:
             break;  // nothing, handle to satisfy compiler
     }
 }
 
 
-bool ScDataTableFormat::IsStyleSheetEnabled( StyleType eType ) const
+bool ScDataTableFormat::IsStyleTypeEnabled( DataTableStyleType eType ) const
 {
-    if (0 <= eType && eType < STYLE_COUNT)
+    if (0 <= eType && eType < INTERNAL_STYLE_COUNT)
         return mbStyleEnabled[eType];
     else
         return false;
 }
 
 
+void ScDataTableFormat::SetDisplayFeatures( const DataTableDisplayFeatures & rFeatures )
+{
+    const DataTableStyleEnabled* pArr = rFeatures.StyleTypes.getConstArray();
+    const DataTableStyleEnabled* const pStop = pArr + rFeatures.StyleTypes.getLength();
+    for ( ; pArr < pStop; ++pArr)
+        SetStyleTypeEnabled( pArr->StyleType, pArr->Enabled);
+
+    // Disabled banded rows and columns may override a set style.
+    SetBandedRowsFlag( rFeatures.BandedRows);
+    SetBandedColsFlag( rFeatures.BandedColumns);
+    SetRowsStripe1( rFeatures.RowsStripe1);
+    SetRowsStripe2( rFeatures.RowsStripe2);
+    SetColsStripe1( rFeatures.ColumnsStripe1);
+    SetColsStripe2( rFeatures.ColumnsStripe2);
+
+    CreateAndSetStyles( String());  // uses remembered prefix
+}
+
+
+DataTableDisplayFeatures ScDataTableFormat::GetDisplayFeatures() const
+{
+    DataTableDisplayFeatures aFeatures;
+    aFeatures.StyleTypes.realloc( DataTableStyleType_STYLE_COUNT);
+
+    DataTableStyleEnabled* const pArr = aFeatures.StyleTypes.getArray();
+    const sal_Int32 nLen = aFeatures.StyleTypes.getLength();
+    for (sal_Int32 i=0; i < nLen; ++i)
+    {
+        DataTableStyleType eType = static_cast<DataTableStyleType>(i);
+        pArr[i].StyleType = eType;
+        pArr[i].Enabled = IsStyleTypeEnabled( eType);
+    }
+
+    aFeatures.BandedRows     = mbBandedRows;
+    aFeatures.BandedColumns  = mbBandedCols;
+    aFeatures.RowsStripe1    = mnRowsStripe1;
+    aFeatures.RowsStripe2    = mnRowsStripe2;
+    aFeatures.ColumnsStripe1 = mnColsStripe1;
+    aFeatures.ColumnsStripe2 = mnColsStripe2;
+
+    return aFeatures;
+}
+
+
+
+void ScDataTableFormat::SetStyleSheetNames( const uno::Sequence< DataTableStyleSheet > & rNames )
+{
+    const DataTableStyleSheet* pArr = rNames.getConstArray();
+    const DataTableStyleSheet* const pStop = pArr + rNames.getLength();
+    for ( ; pArr < pStop; ++pArr)
+        SetStyleSheetName( pArr->StyleType, pArr->Name);
+}
+
+
+uno::Sequence< DataTableStyleSheet > ScDataTableFormat::GetStyleSheetNames() const
+{
+    uno::Sequence< DataTableStyleSheet > aStyles( DataTableStyleType_STYLE_COUNT);
+    DataTableStyleSheet* const pArr = aStyles.getArray();
+    const sal_Int32 nLen = aStyles.getLength();
+    for (sal_Int32 i=0; i < nLen; ++i)
+    {
+        DataTableStyleType eType = static_cast<DataTableStyleType>(i);
+        pArr[i].StyleType = eType;
+        pArr[i].Name = GetStyleSheetName( eType);
+    }
+    return aStyles;
+}
+
+
 // === ScDataTableFormatList =================================================
 
 ScDataTableFormatList::ScDataTableFormatList( const ScDataTableFormatList& rList )

sc/source/core/data/documen4.cxx

 }
 
 
+ScDataTableFormat* ScDocument::GetDataTableFormatNonConst( sal_uInt32 nKey ) const
+{
+    return const_cast<ScDataTableFormat*>(GetDataTableFormat( nKey));
+}
+
+
 void ScDocument::DeleteDataTableFormats( const ScDataTableMap& rDataTables )
 {
     if (pDataTableFormatList)
                 const ScDataTableFormat* pDTab = pDataTableFormatList->GetFormat( nIndex );
                 if ( pDTab )
                 {
-                    ScDataTableFormat::StyleType eType = pDTab->GetStyleType( ScAddress( nCol, nRow, nTab));
+                    DataTableStyleType eType = pDTab->GetStyleType( ScAddress( nCol, nRow, nTab));
                     SfxStyleSheetBase* pStyleSheet = pDTab->GetStyleSheet( eType);
                     if ( pStyleSheet && pStyleSheet->GetItemSet().GetItemState(
                                 nWhich, TRUE, &pItem ) == SFX_ITEM_SET )
             pDataTableFormatList->GetFormat( nKey) : GetDataTableFormat( nCol, nRow, nTab ));
     if ( pDTab )
     {
-        ScDataTableFormat::StyleType eType = pDTab->GetStyleType( ScAddress( nCol, nRow, nTab));
+        DataTableStyleType eType = pDTab->GetStyleType( ScAddress( nCol, nRow, nTab));
         SfxStyleSheetBase* pStyleSheet = pDTab->GetStyleSheet( eType);
         if ( pStyleSheet )
             return &pStyleSheet->GetItemSet();

sc/source/core/data/fillinfo.cxx

 
                                 if ( pDataTableForm )
                                 {
-                                    ScDataTableFormat::StyleType eType = pDataTableForm->GetStyleType(
+                                    DataTableStyleType eType = pDataTableForm->GetStyleType(
                                             ScAddress( nX, nCurRow, nTab ) );
                                     SfxStyleSheetBase* pStyleSheet = pDataTableForm->GetStyleSheet( eType);
                                     if ( pStyleSheet )

sc/source/core/data/patattr.cxx

                                 ScStyleSheetPool* pSrcSPool = pSrcDoc->GetStyleSheetPool();
                                 ScStyleSheetPool* pDestSPool = pDestDoc->GetStyleSheetPool();
                                 const SvNumberFormatterIndexTable* pFormatExchangeList = pDestDoc->GetFormatExchangeList();
-                                for (USHORT i=0; i < ScDataTableFormat::STYLE_COUNT; i++)
+                                for (sal_Int32 i=0; i < ::com::sun::star::sheet::DataTableStyleType_STYLE_COUNT; i++)
                                 {
-                                    String aName = pOldData->GetStyleName( 
-                                            static_cast<ScDataTableFormat::StyleType>(i));
+                                    String aName = pOldData->GetStyleSheetName( static_cast<DataTableStyleType>(i));
                                     if (aName.Len())
                                     {
                                         SfxStyleSheetBase* pSrcStl =

sc/source/ui/unoobj/datatableuno.cxx

+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2011 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+
+#include "datatableuno.hxx"
+#include "unoguard.hxx"
+#include "docsh.hxx"
+#include "dbcolect.hxx"
+#include "miscuno.hxx"
+#include "cellsuno.hxx"
+
+using namespace com::sun::star;
+
+// === ScDataTableObj ========================================================
+
+ScDataTableObj::ScDataTableObj( ScDocShell* pDocSh, sal_uInt32 nKey ) :
+    mpDocShell( pDocSh ),
+    mnKey( nKey )
+{
+    mpDocShell->GetDocument()->AddUnoObject(*this);
+}
+
+
+ScDataTableObj::~ScDataTableObj()
+{
+    if (mpDocShell)
+        mpDocShell->GetDocument()->RemoveUnoObject(*this);
+}
+
+
+void ScDataTableObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
+{
+    if ( rHint.ISA( SfxSimpleHint ) && ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING )
+        mpDocShell = NULL;      // invalidated
+}
+
+
+ScDataTableFormat* ScDataTableObj::GetDataTableFormat() const
+throw( ::com::sun::star::uno::RuntimeException, ::com::sun::star::container::NoSuchElementException )
+{
+    if (!mpDocShell)
+        throw uno::RuntimeException();
+    const ScDocument* pDoc = mpDocShell->GetDocument();
+    ScDataTableFormat* pDTab = pDoc->GetDataTableFormatNonConst( mnKey);
+    if (!pDTab)
+        throw container::NoSuchElementException();
+    return pDTab;
+}
+
+
+static void lcl_PostPaint( ScDocShell* pDocShell, USHORT& rExtFlags, const ScRange& rPaintRange )
+{
+    pDocShell->UpdatePaintExt( rExtFlags, rPaintRange);
+    if (!pDocShell->AdjustRowHeight( rPaintRange.aStart.Row(), rPaintRange.aEnd.Row(), rPaintRange.aStart.Tab()))
+        pDocShell->PostPaint( rPaintRange, PAINT_GRID, rExtFlags);
+    else if (rExtFlags & SC_PF_LINES)
+        pDocShell->PostPaintAbove( rPaintRange);    // for lines above
+}
+
+// --- XDataTable ------------------------------------------------------------
+
+::com::sun::star::table::CellRangeAddress SAL_CALL 
+ScDataTableObj::getTableArea()
+throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::container::NoSuchElementException)
+{
+    ScUnoGuard aGuard;
+    const ScDataTableFormat* pDTab = GetDataTableFormat();
+    const ScRange& rRange = pDTab->GetTableRange();
+    table::CellRangeAddress aArea;
+    aArea.Sheet = rRange.aStart.Tab();
+    aArea.StartColumn = rRange.aStart.Col();
+    aArea.StartRow = rRange.aStart.Row();
+    aArea.EndColumn = rRange.aEnd.Col();
+    aArea.EndRow = rRange.aEnd.Row();
+    return aArea;
+}
+
+
+::sal_Bool SAL_CALL ScDataTableObj::getHeaderRowFlag()
+throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::container::NoSuchElementException)
+{
+    ScUnoGuard aGuard;
+    const ScDataTableFormat* pDTab = GetDataTableFormat();
+    return pDTab->GetHeaderRowFlag();
+}
+
+
+::sal_Bool SAL_CALL ScDataTableObj::getTotalRowFlag()
+throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::container::NoSuchElementException)
+{
+    ScUnoGuard aGuard;
+    const ScDataTableFormat* pDTab = GetDataTableFormat();
+    return pDTab->GetTotalRowFlag();
+}
+
+
+::com::sun::star::sheet::DataTableDisplayFeatures SAL_CALL 
+ScDataTableObj::getDisplayFeatures()
+throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::container::NoSuchElementException)
+{
+    ScUnoGuard aGuard;
+    const ScDataTableFormat* pDTab = GetDataTableFormat();
+    return pDTab->GetDisplayFeatures();
+}
+