diff options
-rw-r--r-- | oox/source/drawingml/table/tablecell.cxx | 55 | ||||
-rw-r--r-- | sd/qa/unit/import-tests.cxx | 12 |
2 files changed, 45 insertions, 22 deletions
diff --git a/oox/source/drawingml/table/tablecell.cxx b/oox/source/drawingml/table/tablecell.cxx index 2c1fa3c4a9ce..1b336591a51a 100644 --- a/oox/source/drawingml/table/tablecell.cxx +++ b/oox/source/drawingml/table/tablecell.cxx @@ -84,15 +84,26 @@ void applyLineAttributes( const ::oox::core::XmlFilterBase& rFilterBase, aPropSet.setProperty( nPropId, aBorderLine ); } -void applyBorder( TableStylePart& rTableStylePart, sal_Int32 nLineType, oox::drawingml::LineProperties& rLineProperties ) +void applyBorder( const ::oox::core::XmlFilterBase& rFilterBase, TableStylePart& rTableStylePart, sal_Int32 nLineType, oox::drawingml::LineProperties& rLineProperties ) { std::map < sal_Int32, ::oox::drawingml::LinePropertiesPtr >& rPartLineBorders( rTableStylePart.getLineBorders() ); + ::oox::drawingml::ShapeStyleRef& rLineStyleRef = rTableStylePart.getStyleRefs()[ nLineType ]; std::map < sal_Int32, ::oox::drawingml::LinePropertiesPtr >::const_iterator aIter( rPartLineBorders.find( nLineType ) ); if ( ( aIter != rPartLineBorders.end() ) && aIter->second.get() ) rLineProperties.assignUsed( *aIter->second ); + else if (rLineStyleRef.mnThemedIdx != 0) + { + if (const Theme* pTheme = rFilterBase.getCurrentTheme()) + { + rLineProperties.assignUsed( *pTheme->getLineStyle(rLineStyleRef.mnThemedIdx) ); + sal_Int32 nPhClr = rLineStyleRef.maPhClr.getColor( rFilterBase.getGraphicHelper() ); + rLineProperties.maLineFill.maFillColor.setSrgbClr( nPhClr ); + } + } } -void applyTableStylePart( oox::drawingml::FillProperties& rFillProperties, +void applyTableStylePart( const ::oox::core::XmlFilterBase& rFilterBase, + oox::drawingml::FillProperties& rFillProperties, TextCharacterProperties& aTextCharProps, oox::drawingml::LineProperties& rLeftBorder, oox::drawingml::LineProperties& rRightBorder, @@ -106,12 +117,12 @@ void applyTableStylePart( oox::drawingml::FillProperties& rFillProperties, if ( rPartFillPropertiesPtr.get() ) rFillProperties.assignUsed( *rPartFillPropertiesPtr ); - applyBorder( rTableStylePart, XML_left, rLeftBorder ); - applyBorder( rTableStylePart, XML_right, rRightBorder ); - applyBorder( rTableStylePart, XML_top, rTopBorder ); - applyBorder( rTableStylePart, XML_bottom, rBottomBorder ); - applyBorder( rTableStylePart, XML_tl2br, rTopLeftToBottomRightBorder ); - applyBorder( rTableStylePart, XML_tr2bl, rBottomLeftToTopRightBorder ); + applyBorder( rFilterBase, rTableStylePart, XML_left, rLeftBorder ); + applyBorder( rFilterBase, rTableStylePart, XML_right, rRightBorder ); + applyBorder( rFilterBase, rTableStylePart, XML_top, rTopBorder ); + applyBorder( rFilterBase, rTableStylePart, XML_bottom, rBottomBorder ); + applyBorder( rFilterBase, rTableStylePart, XML_tl2br, rTopLeftToBottomRightBorder ); + applyBorder( rFilterBase, rTableStylePart, XML_tr2bl, rBottomLeftToTopRightBorder ); aTextCharProps.maLatinFont = rTableStylePart.getLatinFont(); aTextCharProps.maAsianFont = rTableStylePart.getAsianFont(); @@ -171,7 +182,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo oox::drawingml::LineProperties aLinePropertiesTopLeftToBottomRight; oox::drawingml::LineProperties aLinePropertiesBottomLeftToTopRight; - applyTableStylePart( aFillProperties, aTextStyleProps, + applyTableStylePart( rFilterBase, aFillProperties, aTextStyleProps, aLinePropertiesLeft, aLinePropertiesRight, aLinePropertiesTop, @@ -182,7 +193,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo if ( rProperties.isFirstRow() && ( nRow == 0 ) ) { - applyTableStylePart( aFillProperties, aTextStyleProps, + applyTableStylePart( rFilterBase, aFillProperties, aTextStyleProps, aLinePropertiesLeft, aLinePropertiesRight, aLinePropertiesTop, @@ -193,7 +204,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo } if ( rProperties.isLastRow() && ( nRow == nMaxRow ) ) { - applyTableStylePart( aFillProperties, aTextStyleProps, + applyTableStylePart( rFilterBase, aFillProperties, aTextStyleProps, aLinePropertiesLeft, aLinePropertiesRight, aLinePropertiesTop, @@ -204,7 +215,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo } if ( rProperties.isFirstCol() && ( nColumn == 0 ) ) { - applyTableStylePart( aFillProperties, aTextStyleProps, + applyTableStylePart( rFilterBase, aFillProperties, aTextStyleProps, aLinePropertiesLeft, aLinePropertiesRight, aLinePropertiesTop, @@ -215,7 +226,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo } if ( rProperties.isLastCol() && ( nColumn == nMaxColumn ) ) { - applyTableStylePart( aFillProperties, aTextStyleProps, + applyTableStylePart( rFilterBase, aFillProperties, aTextStyleProps, aLinePropertiesLeft, aLinePropertiesRight, aLinePropertiesTop, @@ -236,7 +247,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo nBand++; if ( nBand & 1 ) { - applyTableStylePart( aFillProperties, aTextStyleProps, + applyTableStylePart( rFilterBase, aFillProperties, aTextStyleProps, aLinePropertiesLeft, aLinePropertiesRight, aLinePropertiesTop, @@ -247,7 +258,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo } else { - applyTableStylePart( aFillProperties, aTextStyleProps, + applyTableStylePart( rFilterBase, aFillProperties, aTextStyleProps, aLinePropertiesLeft, aLinePropertiesRight, aLinePropertiesTop, @@ -260,7 +271,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo } if ( ( nRow == 0 ) && ( nColumn == 0 ) ) { - applyTableStylePart( aFillProperties, aTextStyleProps, + applyTableStylePart( rFilterBase, aFillProperties, aTextStyleProps, aLinePropertiesLeft, aLinePropertiesRight, aLinePropertiesTop, @@ -271,7 +282,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo } if ( ( nRow == nMaxRow ) && ( nColumn == 0 ) ) { - applyTableStylePart( aFillProperties, aTextStyleProps, + applyTableStylePart( rFilterBase, aFillProperties, aTextStyleProps, aLinePropertiesLeft, aLinePropertiesRight, aLinePropertiesTop, @@ -282,7 +293,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo } if ( ( nRow == 0 ) && ( nColumn == nMaxColumn ) ) { - applyTableStylePart( aFillProperties, aTextStyleProps, + applyTableStylePart( rFilterBase, aFillProperties, aTextStyleProps, aLinePropertiesLeft, aLinePropertiesRight, aLinePropertiesTop, @@ -291,9 +302,9 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo aLinePropertiesBottomLeftToTopRight, rTable.getNeCell() ); } - if ( ( nRow == nMaxColumn ) && ( nColumn == nMaxColumn ) ) + if ( ( nRow == nMaxRow ) && ( nColumn == nMaxColumn ) ) { - applyTableStylePart( aFillProperties, aTextStyleProps, + applyTableStylePart( rFilterBase, aFillProperties, aTextStyleProps, aLinePropertiesLeft, aLinePropertiesRight, aLinePropertiesTop, @@ -314,7 +325,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo nBand++; if ( nBand & 1 ) { - applyTableStylePart( aFillProperties, aTextStyleProps, + applyTableStylePart( rFilterBase, aFillProperties, aTextStyleProps, aLinePropertiesLeft, aLinePropertiesRight, aLinePropertiesTop, @@ -325,7 +336,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo } else { - applyTableStylePart( aFillProperties, aTextStyleProps, + applyTableStylePart( rFilterBase, aFillProperties, aTextStyleProps, aLinePropertiesLeft, aLinePropertiesRight, aLinePropertiesTop, diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index ecd29b9a5c29..f9fc0dde5b7a 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -49,6 +49,7 @@ #include <com/sun/star/chart2/data/XLabeledDataSequence.hpp> #include <com/sun/star/chart2/data/XDataSequence.hpp> #include <com/sun/star/chart2/data/XNumericalDataSequence.hpp> +#include <com/sun/star/table/BorderLine2.hpp> #include <config_features.h> @@ -1024,6 +1025,7 @@ void SdFiltersTest::testBnc480256() uno::Reference< table::XCellRange > xTable; uno::Reference< beans::XPropertySet > xCell; sal_Int32 nColor; + table::BorderLine2 aBorderLine; pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(0)); CPPUNIT_ASSERT( pTableObj ); @@ -1032,10 +1034,14 @@ void SdFiltersTest::testBnc480256() xCell.set(xTable->getCellByPosition(0, 0), uno::UNO_QUERY_THROW); xCell->getPropertyValue("FillColor") >>= nColor; CPPUNIT_ASSERT_EQUAL(sal_Int32(10208238), nColor); + xCell->getPropertyValue("LeftBorder") >>= aBorderLine; + CPPUNIT_ASSERT_EQUAL(util::Color(5609427), aBorderLine.Color); xCell.set(xTable->getCellByPosition(0, 1), uno::UNO_QUERY_THROW); xCell->getPropertyValue("FillColor") >>= nColor; CPPUNIT_ASSERT_EQUAL(sal_Int32(13032959), nColor); + xCell->getPropertyValue("TopBorder") >>= aBorderLine; + CPPUNIT_ASSERT_EQUAL(util::Color(5609427), aBorderLine.Color); pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(1)); CPPUNIT_ASSERT( pTableObj ); @@ -1044,11 +1050,17 @@ void SdFiltersTest::testBnc480256() xCell.set(xTable->getCellByPosition(0, 0), uno::UNO_QUERY_THROW); xCell->getPropertyValue("FillColor") >>= nColor; CPPUNIT_ASSERT_EQUAL(sal_Int32(7056614), nColor); + xCell->getPropertyValue("LeftBorder") >>= aBorderLine; + CPPUNIT_ASSERT_EQUAL(util::Color(12505062), aBorderLine.Color); xCell.set(xTable->getCellByPosition(0, 1), uno::UNO_QUERY_THROW); xCell->getPropertyValue("FillColor") >>= nColor; CPPUNIT_ASSERT_EQUAL(sal_Int32(4626400), nColor); + xCell.set(xTable->getCellByPosition(1, 0), uno::UNO_QUERY_THROW); + xCell->getPropertyValue("BottomBorder") >>= aBorderLine; + CPPUNIT_ASSERT_EQUAL(util::Color(0), aBorderLine.Color); + xDocShRef->DoClose(); } |