diff options
author | Matúš Kukan <matus.kukan@collabora.com> | 2014-09-22 11:59:14 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2014-10-14 15:27:47 +0200 |
commit | 83897a8291dc4023dbdf02558a9725efea4c668b (patch) | |
tree | d28d10b39e2f7c55957fb3836e7a6ef63295f3d9 /oox | |
parent | 7c03c89a4a5544c3849af99caacb54de366d6fee (diff) |
bnc#897769: OOXML import: Import border lines using reference too.
Do not ignore 'lnRef' element.
Also fix typo to apply 'seCell' properties to the right cell (southeast).
Change-Id: Ia45f7016f358b70e6db06a232c569335ce9d7051
(cherry picked from commit 18898e13fda25fe6dc85318dd0711355c7b2cc26)
Reviewed-on: https://gerrit.libreoffice.org/11652
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/drawingml/table/tablecell.cxx | 55 |
1 files changed, 33 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, |