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

Akash Shetye shetyeakash at gmail.com
Mon Aug 12 18:02:51 PDT 2013


 sc/source/filter/inc/stylesbuffer.hxx |    8 ++++++++
 sc/source/filter/oox/stylesbuffer.cxx |   30 ++++++++++++++++++------------
 2 files changed, 26 insertions(+), 12 deletions(-)

New commits:
commit 77aaa44c9f4f207b9176c5ac63c875be5ed8e4a5
Author: Akash Shetye <shetyeakash at gmail.com>
Date:   Tue Aug 13 06:30:52 2013 +0530

    Solves Dxf styles related to table formatting not being imported correctly.
    
    Change-Id: Ifc0e27378b1e894e2ab4393100f295de101d009b

diff --git a/sc/source/filter/inc/stylesbuffer.hxx b/sc/source/filter/inc/stylesbuffer.hxx
index c3fa63e..9654159 100644
--- a/sc/source/filter/inc/stylesbuffer.hxx
+++ b/sc/source/filter/inc/stylesbuffer.hxx
@@ -26,6 +26,7 @@
 #include <com/sun/star/table/CellVertJustify2.hpp>
 #include <com/sun/star/table/BorderLine2.hpp>
 #include <com/sun/star/util/CellProtection.hpp>
+#include <boost/ptr_container/ptr_vector.hpp>
 #include "oox/drawingml/color.hxx"
 #include "oox/helper/graphichelper.hxx"
 #include "oox/helper/refmap.hxx"
@@ -786,6 +787,11 @@ typedef ::boost::shared_ptr< Dxf > DxfRef;
 
 // ============================================================================
 
+struct TableStyleElementModel{
+    int maDxfId;
+    OUString maStyleElementType;
+};
+
 /* Contains attributes for table styles from the <tableStyle> element */
 class TableStyle : public WorkbookHelper
 {
@@ -797,7 +803,9 @@ public:
     ScDBDataFormatting& getTableFormatting(); //not const since it will be edited and put in ScDBData objects
 private:
     typedef ::boost::shared_ptr< ::ScDBDataFormatting > TableFormattingRef;
+    typedef std::vector< TableStyleElementModel > TableStyleElementModelVector;
 
+    TableStyleElementModelVector maStyleElementVector;
     TableFormattingRef mxTableFormatting;
 };
 
diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx
index b058ce3..82f9315 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -2646,18 +2646,10 @@ void TableStyle::importTableStyleElement( const AttributeList& rAttribs )
     //Extract the Dxf Id and create such a style
     sal_Int32 aDxfId = static_cast< sal_Int32 >( rAttribs.getInteger( XML_dxfId, -1 ) );
     SAL_WARN_IF( (aDxfId == -1) ,"sc", "TableStyle::importTableStyleElement - DxfId not defined for table style element" );
-    //Should I stop on finding this missing feild or keep going?
-    OUString aDxfStyleName = getStyles().createDxfStyle( aDxfId );
-    if( aStyleElementType.equals("firstColumnStripe") )
-        mxTableFormatting->SetFirstColStripeStyle( aDxfStyleName );
-    else if( aStyleElementType.equals("secondColumnStripe") )
-        mxTableFormatting->SetSecondColStripeStyle( aDxfStyleName );
-    else if( aStyleElementType.equals("firstRowStripe") )
-        mxTableFormatting->SetFirstRowStripeStyle( aDxfStyleName );
-    else if( aStyleElementType.equals("secondRowStripe") )
-        mxTableFormatting->SetSecondRowStripeStyle( aDxfStyleName );
-    //Though the Dxf styles are being imported, the bsckground color etc
-    //is not showing up.
+    TableStyleElementModel aTableStyleElementModel;
+    aTableStyleElementModel.maDxfId = aDxfId;
+    aTableStyleElementModel.maStyleElementType = aStyleElementType;
+    maStyleElementVector.push_back( aTableStyleElementModel );
 }
 
 const OUString& TableStyle::getTableStyleName() const
@@ -2672,6 +2664,20 @@ ScDBDataFormatting& TableStyle::getTableFormatting()
 
 void TableStyle::finalizeImport()
 {
+    //Iterate through each of the elements in maStyleElementVector
+    for( TableStyleElementModelVector::iterator itr = maStyleElementVector.begin(); itr!=maStyleElementVector.end(); ++itr)
+    {
+        //Should I stop on finding this missing feild or keep going?
+        OUString aDxfStyleName = getStyles().createDxfStyle( itr->maDxfId );
+        if( itr->maStyleElementType.equals("firstColumnStripe") )
+            mxTableFormatting->SetFirstColStripeStyle( aDxfStyleName );
+        else if( itr->maStyleElementType.equals("secondColumnStripe") )
+            mxTableFormatting->SetSecondColStripeStyle( aDxfStyleName );
+        else if( itr->maStyleElementType.equals("firstRowStripe") )
+            mxTableFormatting->SetFirstRowStripeStyle( aDxfStyleName );
+        else if( itr->maStyleElementType.equals("secondRowStripe") )
+            mxTableFormatting->SetSecondRowStripeStyle( aDxfStyleName );
+    }
 }
 
 


More information about the Libreoffice-commits mailing list