diff options
author | Akash Shetye <shetyeakash@gmail.com> | 2013-08-13 06:30:52 +0530 |
---|---|---|
committer | Akash Shetye <shetyeakash@gmail.com> | 2013-08-13 06:30:52 +0530 |
commit | 77aaa44c9f4f207b9176c5ac63c875be5ed8e4a5 (patch) | |
tree | a07f7d6352eba87e44b8a0c3403a1fa04541f6f9 | |
parent | 4567c4ec4c16f139b6a6f5310b4acf2262f09cb1 (diff) |
Solves Dxf styles related to table formatting not being imported correctly.
Change-Id: Ifc0e27378b1e894e2ab4393100f295de101d009b
-rw-r--r-- | sc/source/filter/inc/stylesbuffer.hxx | 8 | ||||
-rw-r--r-- | sc/source/filter/oox/stylesbuffer.cxx | 30 |
2 files changed, 26 insertions, 12 deletions
diff --git a/sc/source/filter/inc/stylesbuffer.hxx b/sc/source/filter/inc/stylesbuffer.hxx index c3fa63eb4129..9654159d69e3 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 b058ce3330c6..82f9315b3548 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 ); + } } |