diff options
author | Justin Luth <justin.luth@collabora.com> | 2019-11-09 07:27:21 +0300 |
---|---|---|
committer | Justin Luth <justin_luth@sil.org> | 2019-11-09 11:27:18 +0100 |
commit | 5f0844077d289a257b914f0aad9fd93788f34511 (patch) | |
tree | 52af4a5a3e17de0206118ad74e6ddc859d28f5fa | |
parent | d628258f279d003ba4e11f1f7e2e69273acd008c (diff) |
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_luth@sil.org>
-rw-r--r-- | sw/qa/extras/ww8export/data/tdf128608_tableParaBackColor.doc | bin | 0 -> 113152 bytes | |||
-rw-r--r-- | sw/qa/extras/ww8export/ww8export3.cxx | 16 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par6.cxx | 18 |
3 files changed, 30 insertions, 4 deletions
diff --git a/sw/qa/extras/ww8export/data/tdf128608_tableParaBackColor.doc b/sw/qa/extras/ww8export/data/tdf128608_tableParaBackColor.doc Binary files differnew file mode 100644 index 000000000000..d9b16ca53a30 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf128608_tableParaBackColor.doc diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx index 7a4dc17d4ede..95520e563155 100644 --- a/sw/qa/extras/ww8export/ww8export3.cxx +++ b/sw/qa/extras/ww8export/ww8export3.cxx @@ -226,6 +226,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 d83995198272..72e5f77db274 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -4896,8 +4896,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 { @@ -4905,8 +4910,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)) ); + } } } |