[Libreoffice-commits] core.git: Branch 'feature/gsoc-calc-enhanced-db-range' - sc/source

Akash Shetye shetyeakash at gmail.com
Wed Jun 26 12:28:49 PDT 2013


 sc/source/filter/inc/tablebuffer.hxx   |    6 ++++++
 sc/source/filter/oox/tablebuffer.cxx   |   19 +++++++++++++++++++
 sc/source/filter/oox/tablefragment.cxx |    4 ++++
 3 files changed, 29 insertions(+)

New commits:
commit 13b1f5fd621af1f44899b4996bbdc21f91b51f2d
Author: Akash Shetye <shetyeakash at gmail.com>
Date:   Thu Jun 27 00:55:56 2013 +0530

    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

diff --git a/sc/source/filter/inc/tablebuffer.hxx b/sc/source/filter/inc/tablebuffer.hxx
index 9d4a2c7..de14de4 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 672e11c..c4580c6 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 334f29c..d9398b4 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;


More information about the Libreoffice-commits mailing list