DOCX import: handle <w:tcPr> directly under <w:style>
Change-Id: I10dfb947bbd9e792c98932608acb2f0987fd8605
diff --git a/sw/qa/extras/ooxmlexport/data/table-style-cell-back-color.docx b/sw/qa/extras/ooxmlexport/data/table-style-cell-back-color.docx
new file mode 100644
index 0000000..f622b9d
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/table-style-cell-back-color.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index c5cfe79..19ea3a1 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -367,6 +367,17 @@ DECLARE_OOXMLEXPORT_TEST(testWpsCharColor, "wps-char-color.docx")
CPPUNIT_ASSERT_EQUAL(sal_Int32(0xffffff), getProperty<sal_Int32>(xShape->getStart(), "CharColor"));
}
DECLARE_OOXMLEXPORT_TEST(testTableStyleCellBackColor, "table-style-cell-back-color.docx")
{
// The problem was that cell background was white, not green.
uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
uno::Reference<table::XCell> xCell = xTable->getCellByName("A1");
// This was 0xffffff.
CPPUNIT_ASSERT_EQUAL(sal_Int32(0x00ff00), getProperty<sal_Int32>(xCell, "BackColor"));
}
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx
index eb22ecf..6fee9e2 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -574,6 +574,9 @@ void StyleSheetTable::lcl_sprm(Sprm & rSprm)
StyleSheetEntry* pEntry = m_pImpl->m_pCurrentEntry.get();
TableStyleSheetEntry& rTableEntry = dynamic_cast<TableStyleSheetEntry&>(*pEntry);
rTableEntry.AppendInteropGrabBag(pTblStylePrHandler->getInteropGrabBag("tcPr"));
// This is a <w:tcPr> directly under <w:style>, so it affects the whole table.
rTableEntry.pProperties->InsertProps(pTblStylePrHandler->getProperties());
}
}
break;