summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf116436_rowFill.odtbin0 -> 10835 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport11.cxx9
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport5.cxx7
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx27
4 files changed, 42 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf116436_rowFill.odt b/sw/qa/extras/ooxmlexport/data/tdf116436_rowFill.odt
new file mode 100644
index 000000000000..45f4a1c54b02
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf116436_rowFill.odt
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index a34efcdd9e2f..df780afde73e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -50,6 +50,15 @@ DECLARE_OOXMLEXPORT_TEST(testTdf92524_autoColor, "tdf92524_autoColor.doc")
CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(getProperty<sal_uInt32>(getParagraph(1), "ParaBackColor")));
}
+DECLARE_OOXMLEXPORT_TEST(testTdf116436_rowFill, "tdf116436_rowFill.odt")
+{
+ 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");
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0xF8DF7C), getProperty<sal_Int32>(xCell, "BackColor"));
+}
+
DECLARE_OOXMLEXPORT_TEST(testTdf46938_clearTabStop, "tdf46938_clearTabStop.docx")
{
// Number of tabstops should be zero, overriding the one in the style
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index 762eae1bbc28..0f8e562a0f8a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -1014,6 +1014,13 @@ DECLARE_OOXMLEXPORT_TEST(testOO47778_2, "ooo47778-4.odt")
{
if (xmlDocPtr pXmlDoc = parseExport("word/document.xml"))
assertXPathContent(pXmlDoc, "(//w:t)[4]", "c");
+
+ // tdf116436: The problem was that the table background was undefined, not white.
+ 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");
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0xffffff), getProperty<sal_Int32>(xCell, "BackColor"));
}
DECLARE_OOXMLEXPORT_TEST(testOO67471, "ooo67471-2.odt")
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index c22ff5cdec4c..8529a06ad0bf 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3752,6 +3752,18 @@ void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t
FSNS( XML_w, XML_val ), pJcVal,
FSEND );
+ // Output the table background color (although cell value still needs to be specified)
+ const SvxBrushItem *pColorProp = pTableFormat->GetAttrSet().GetItem<SvxBrushItem>(RES_BACKGROUND);
+ Color aColor = pColorProp ? pColorProp->GetColor() : COL_AUTO;
+ if ( aColor != COL_AUTO )
+ {
+ OString sColor = msfilter::util::ConvertColor( aColor );
+ m_pSerializer->singleElementNS( XML_w, XML_shd,
+ FSNS( XML_w, XML_fill ), sColor.getStr( ),
+ FSNS( XML_w, XML_val ), "clear",
+ FSEND );
+ }
+
// Output the table borders
TableDefaultBorders( pTableTextNodeInfoInner );
@@ -3814,12 +3826,25 @@ void DocxAttributeOutput::TableDefaultCellMargins( ww8::WW8TableNodeInfoInner::P
void DocxAttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
{
+ const SwTable *pTable = pTableTextNodeInfoInner->getTable();
const SwTableBox *pTableBox = pTableTextNodeInfoInner->getTableBox( );
+ const SwTableLine *pTableRow = pTableBox->GetUpper();
const SwFrameFormat *pFormat = pTableBox->GetFrameFormat( );
const SvxBrushItem *pColorProp = pFormat->GetAttrSet().GetItem<SvxBrushItem>(RES_BACKGROUND);
Color aColor = pColorProp ? pColorProp->GetColor() : COL_AUTO;
- OString sColor = msfilter::util::ConvertColor( aColor );
+
+ const SwFrameFormat *pRowFormat = pTableRow->GetFrameFormat( );
+ const SvxBrushItem *pRowColorProp = pRowFormat->GetAttrSet().GetItem<SvxBrushItem>(RES_BACKGROUND);
+ if ( pRowColorProp && aColor == COL_AUTO)
+ aColor = pRowColorProp->GetColor();
+
+ const SwFrameFormat *pTableFormat = pTable->GetFrameFormat( );
+ const SvxBrushItem *pTableColorProp = pTableFormat->GetAttrSet().GetItem<SvxBrushItem>(RES_BACKGROUND);
+ if ( pTableColorProp && aColor == COL_AUTO )
+ aColor = pTableColorProp->GetColor();
+
+ const OString sColor = msfilter::util::ConvertColor( aColor );
std::map<OUString, css::uno::Any> aGrabBag =
pFormat->GetAttrSet().GetItem<SfxGrabBagItem>(RES_FRMATR_GRABBAG)->GetGrabBag();