sw/qa/extras/ww8export/data/tdf128608_tableParaBackColor.doc |binary sw/qa/extras/ww8export/ww8export3.cxx | 16 +++++++++ sw/source/filter/ww8/ww8par6.cxx | 18 ++++++++--- 3 files changed, 30 insertions(+), 4 deletions(-)
New commits: commit bf7894c4af3023f77a53427d756d8ccba2f0ac6e Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Sat Nov 9 07:27:21 2019 +0300 Commit: Xisco FaulĂ <xiscofa...@libreoffice.org> CommitDate: Sat Nov 9 15:58:16 2019 +0100 partial revert tdf#116071 import to XATTR_FILL not RES_BACKGROUND caused by commit 3539a1efb41a787237e4333ebc715db96ffacb5b which fixes table-related regression bug report tdf#128608. I was not able to create a unit test for this from scratch. In fact, if I use MSWord2003 to roundtrip the file, then LO opens it without problems. A real fix (to move LO away from RES_BACKGROUND in tables) should be subject to lots of testing time, so just reverting for now. Change-Id: I328741947b7ed319ff8df0ba169618f6ad0d2c75 Reviewed-on: https://gerrit.libreoffice.org/82339 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_l...@sil.org> (cherry picked from commit 5f0844077d289a257b914f0aad9fd93788f34511) Reviewed-on: https://gerrit.libreoffice.org/82349 Reviewed-by: Xisco FaulĂ <xiscofa...@libreoffice.org> diff --git a/sw/qa/extras/ww8export/data/tdf128608_tableParaBackColor.doc b/sw/qa/extras/ww8export/data/tdf128608_tableParaBackColor.doc new file mode 100644 index 000000000000..d9b16ca53a30 Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf128608_tableParaBackColor.doc differ diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx index 3b7dbd968bb3..30e75563a783 100644 --- a/sw/qa/extras/ww8export/ww8export3.cxx +++ b/sw/qa/extras/ww8export/ww8export3.cxx @@ -221,6 +221,22 @@ DECLARE_WW8EXPORT_TEST(testTdf127862_pageFillStyle, "tdf127862_pageFillStyle.odt CPPUNIT_ASSERT(drawing::FillStyle_NONE != getProperty<drawing::FillStyle>(xStyle, "FillStyle")); } +DECLARE_WW8EXPORT_TEST(testTdf128608_tableParaBackColor, "tdf128608_tableParaBackColor.doc") +{ + 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<text::XTextRange> xCell(xTable->getCellByName("A4"), uno::UNO_QUERY); + + uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xCell->getText(), uno::UNO_QUERY); + uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration(); + uno::Reference<text::XTextRange> xPara(xParaEnum->nextElement(), uno::UNO_QUERY); + // ParaBackColor doesn't seem to be used in this case, but keep it here to make sure it stays as AUTO. + CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(getProperty<sal_uInt32>(xPara, "ParaBackColor"))); + // No paragraph background colour/fill. (The cell background colour should be used.) + CPPUNIT_ASSERT_EQUAL_MESSAGE("No fillstyle", drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(xPara, "FillStyle")); +} + DECLARE_WW8EXPORT_TEST(testTdf94009_zeroPgMargin, "tdf94009_zeroPgMargin.odt") { uno::Reference<beans::XPropertySet> defaultStyle(getStyles("PageStyles")->getByName("Standard"), diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index e7308ac7e60e..69a6900220d2 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -4886,8 +4886,13 @@ void SwWW8ImplReader::Read_ParaBackColor(sal_uInt16, const sal_uInt8* pData, sho if (nLen <= 0) { // end of attribute - m_xCtrlStck->SetAttr( *m_pPaM->GetPoint(), XATTR_FILLSTYLE ); - m_xCtrlStck->SetAttr( *m_pPaM->GetPoint(), XATTR_FILLCOLOR ); + if ( m_nInTable ) + m_xCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_BACKGROUND ); + else + { + m_xCtrlStck->SetAttr( *m_pPaM->GetPoint(), XATTR_FILLSTYLE ); + m_xCtrlStck->SetAttr( *m_pPaM->GetPoint(), XATTR_FILLCOLOR ); + } } else { @@ -4895,8 +4900,13 @@ void SwWW8ImplReader::Read_ParaBackColor(sal_uInt16, const sal_uInt8* pData, sho if (nLen != 10) return; - NewAttr( XFillStyleItem(drawing::FillStyle_SOLID) ); - NewAttr( XFillColorItem(OUString(), ExtractColour(pData, m_bVer67)) ); + if ( m_nInTable ) + NewAttr( SvxBrushItem(ExtractColour(pData, m_bVer67), RES_BACKGROUND) ); + else + { + NewAttr( XFillStyleItem(drawing::FillStyle_SOLID) ); + NewAttr( XFillColorItem(OUString(), ExtractColour(pData, m_bVer67)) ); + } } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits