summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authornd101 <Fong@nd.com.cn>2019-09-02 10:29:12 +0800
committerMiklos Vajna <vmiklos@collabora.com>2019-12-06 15:01:48 +0100
commit4c2254cbebca53c34fa48a1dd90cebe434f24274 (patch)
tree31c6f5ac3449dad0ff90a31c0582e5727c866ad8 /oox
parent77b57d8f341c7a5323bbb6ab2f2af97ac140afbc (diff)
tdf#127237 fix table background color in Impress import
When the background color is set at the table level in PPTX, instead of at cell level, the background color fails to show up in Impress. Change-Id: I2838e5b56e4a2414494ee99c0f8975b7256ac6dc Reviewed-on: https://gerrit.libreoffice.org/78377 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/inc/drawingml/table/tableproperties.hxx2
-rw-r--r--oox/source/drawingml/table/tablecell.cxx6
-rw-r--r--oox/source/drawingml/table/tablecontext.cxx2
-rw-r--r--oox/source/drawingml/table/tableproperties.cxx1
4 files changed, 11 insertions, 0 deletions
diff --git a/oox/inc/drawingml/table/tableproperties.hxx b/oox/inc/drawingml/table/tableproperties.hxx
index dd50cd7a694d..010fc67df416 100644
--- a/oox/inc/drawingml/table/tableproperties.hxx
+++ b/oox/inc/drawingml/table/tableproperties.hxx
@@ -54,6 +54,7 @@ public:
void setBandRow(bool b) { mbBandRow = b; };
bool isBandCol() const { return mbBandCol; };
void setBandCol(bool b) { mbBandCol = b; };
+ Color& getBgColor(){ return maBgColor; };
void pushToPropSet( const ::oox::core::XmlFilterBase& rFilterBase,
const css::uno::Reference < css::beans::XPropertySet > & xPropSet,
@@ -70,6 +71,7 @@ private:
std::shared_ptr< TableStyle > mpTableStyle; // or the complete TableStyle
std::vector< sal_Int32 > mvTableGrid;
std::vector< TableRow > mvTableRows;
+ Color maBgColor;
bool mbFirstRow;
bool mbFirstCol;
diff --git a/oox/source/drawingml/table/tablecell.cxx b/oox/source/drawingml/table/tablecell.cxx
index 48f73b269e6a..24e1a5f89c1c 100644
--- a/oox/source/drawingml/table/tablecell.cxx
+++ b/oox/source/drawingml/table/tablecell.cxx
@@ -424,6 +424,12 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons
applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesTopLeftToBottomRight, PROP_DiagonalTLBR );
applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesBottomLeftToTopRight, PROP_DiagonalBLTR );
+ if (rProperties.getBgColor().isUsed() && !maFillProperties.maFillColor.isUsed() && maFillProperties.moFillType.get() == XML_noFill)
+ {
+ maFillProperties.moFillType = XML_solidFill;
+ maFillProperties.maFillColor = rProperties.getBgColor();
+ }
+
aFillProperties.assignUsed( maFillProperties );
ShapePropertyMap aPropMap( rFilterBase.getModelObjectHelper() );
diff --git a/oox/source/drawingml/table/tablecontext.cxx b/oox/source/drawingml/table/tablecontext.cxx
index 3371e105f691..90191f615d4d 100644
--- a/oox/source/drawingml/table/tablecontext.cxx
+++ b/oox/source/drawingml/table/tablecontext.cxx
@@ -57,6 +57,8 @@ TableContext::onCreateContext( ::sal_Int32 aElementToken, const AttributeList& r
mrTableProperties.setBandCol( rAttribs.getBool( XML_bandCol, false ) );
}
break;
+ case A_TOKEN(solidFill):
+ return new ColorContext(*this, mrTableProperties.getBgColor());
case A_TOKEN( tableStyle ): // CT_TableStyle
{
std::shared_ptr< TableStyle >& rTableStyle = mrTableProperties.getTableStyle();
diff --git a/oox/source/drawingml/table/tableproperties.cxx b/oox/source/drawingml/table/tableproperties.cxx
index b6d8bf378127..b58439e5d714 100644
--- a/oox/source/drawingml/table/tableproperties.cxx
+++ b/oox/source/drawingml/table/tableproperties.cxx
@@ -49,6 +49,7 @@ TableProperties::TableProperties()
, mbBandRow( false )
, mbBandCol( false )
{
+ maBgColor.setUnused();
}
static void CreateTableRows( const uno::Reference< XTableRows >& xTableRows, const std::vector< TableRow >& rvTableRows )