diff options
author | Akash Shetye <shetyeakash@gmail.com> | 2013-06-27 00:55:56 +0530 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-08-05 14:30:20 -0400 |
commit | 13989c3d07d24f192dc12eb4c665905d8728a473 (patch) | |
tree | 37cfd1080c77a5d95b3c5a24698060baa6cbd33e | |
parent | 16aab2ee8a9f30a7cd9bcabf8b0947b0c0a897cf (diff) |
Code added for reading and processing <tableStyleInfo> tag.
All that remains is somehow getting an ScDBData object from the XDatabaseRange object to call SetTableFormatting on it.
Change-Id: I7ea0a01da4bb96141851e5a6bb0057ef95799536
-rw-r--r-- | sc/source/filter/inc/tablebuffer.hxx | 6 | ||||
-rw-r--r-- | sc/source/filter/oox/tablebuffer.cxx | 19 | ||||
-rw-r--r-- | sc/source/filter/oox/tablefragment.cxx | 4 |
3 files changed, 29 insertions, 0 deletions
diff --git a/sc/source/filter/inc/tablebuffer.hxx b/sc/source/filter/inc/tablebuffer.hxx index 9d4a2c7cd7ed..de14de4472b4 100644 --- a/sc/source/filter/inc/tablebuffer.hxx +++ b/sc/source/filter/inc/tablebuffer.hxx @@ -35,11 +35,15 @@ struct TableModel maRange; /// Original (unchecked) range of the table. OUString maProgName; /// Programmatical name. OUString maDisplayName; /// Display name. + OUString maTableStyleName; /// Name of associated table style 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. + bool mbShowRowStripes; /// <tableStyleInfo> data banded rows + bool mbShowColumnStripes;/// <tableStyleInfo> data banded columns + explicit TableModel(); }; @@ -52,6 +56,8 @@ public: /** Imports a table definition from the passed attributes. */ void importTable( const AttributeList& rAttribs, sal_Int16 nSheet ); + /**Imports the table style info from <tableStyleInfo> tag. */ + void importTableStyleInfo( const AttributeList& rAttribs ); /** Imports a table definition from a TABLE record. */ void importTable( SequenceInputStream& rStrm, sal_Int16 nSheet ); /** Creates a new auto filter and stores it internally. */ diff --git a/sc/source/filter/oox/tablebuffer.cxx b/sc/source/filter/oox/tablebuffer.cxx index 672e11cb358b..c4580c65e456 100644 --- a/sc/source/filter/oox/tablebuffer.cxx +++ b/sc/source/filter/oox/tablebuffer.cxx @@ -25,6 +25,8 @@ #include "oox/helper/propertyset.hxx" #include "oox/token/properties.hxx" #include "addressconverter.hxx" +#include "dbdataformatting.hxx" +#include "stylesbuffer.hxx" namespace oox { namespace xls { @@ -79,6 +81,13 @@ void Table::importTable( SequenceInputStream& rStrm, sal_Int16 nSheet ) maModel.mnType = STATIC_ARRAY_SELECT( spnTypes, nType, XML_TOKEN_INVALID ); } +void Table::importTableStyleInfo( const AttributeList& rAttribs ) +{ + maModel.maTableStyleName = rAttribs.getXString( XML_name, OUString() ); + maModel.mbShowRowStripes = rAttribs.getBool( XML_showRowStripes, false ); + maModel.mbShowColumnStripes = rAttribs.getBool( XML_showColumnStripes, false ); +} + void Table::finalizeImport() { // Create database range. Note that Excel 2007 and later names database @@ -99,6 +108,16 @@ void Table::finalizeImport() // filter settings maAutoFilters.finalizeImport( xDatabaseRange ); + + //Setting the ScDBDataFormatting (Table style) attribute. + ScDBDataFormatting aTableFormatting = getStyles().getTableStyle( maModel.maTableStyleName )->getTableFormatting(); //May fail in cases of malformed corrupt table/table#.xml where the maTableStyleName is messed up + aTableFormatting.SetBandedRows( maModel.mbShowRowStripes ); + aTableFormatting.SetBandedColumns( maModel.mbShowColumnStripes ); + //Add this table formatting information to the ScDBData instance. + //xDatabaseRange->SetTableFormatting( aTableFormatting ); + //Still figuring how to have an ScDBData object out of this + //xDatabaseRange of type XDatabaseRange... all that needs to be + //done is call the SetTableFormatting on that ScDBData object } catch( Exception& ) { diff --git a/sc/source/filter/oox/tablefragment.cxx b/sc/source/filter/oox/tablefragment.cxx index 334f29c13ff8..d9398b4b6da7 100644 --- a/sc/source/filter/oox/tablefragment.cxx +++ b/sc/source/filter/oox/tablefragment.cxx @@ -53,6 +53,10 @@ ContextHandlerRef TableFragment::onCreateContext( sal_Int32 nElement, const Attr case XLS_TOKEN( table ): if( nElement == XLS_TOKEN( autoFilter ) ) return new AutoFilterContext( *this, mrTable.createAutoFilter() ); + if( nElement == XLS_TOKEN( tableStyleInfo ) ) + { + mrTable.importTableStyleInfo( rAttribs ); + } break; } return 0; |