[Libreoffice-commits] core.git: sw/qa sw/source
Justin Luth (via logerrit)
logerrit at kemper.freedesktop.org
Sat Nov 9 10:28:30 UTC 2019
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 5f0844077d289a257b914f0aad9fd93788f34511
Author: Justin Luth <justin.luth at collabora.com>
AuthorDate: Sat Nov 9 07:27:21 2019 +0300
Commit: Justin Luth <justin_luth at sil.org>
CommitDate: Sat Nov 9 11:27:18 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_luth at sil.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 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)) );
+ }
}
}
More information about the Libreoffice-commits
mailing list