summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2019-11-11 07:27:43 +0300
committerMiklos Vajna <vmiklos@collabora.com>2019-11-20 09:29:43 +0100
commited58057107df3b6f440d2f05303ea7a9f68b0ac7 (patch)
treeb1bfac8b1b09abfa7e07f254fdba0527ecfe3166 /sw
parent02c056b071f95257bd09b7fdfa479bff97bc33dc (diff)
tdf#128608 ww8import: COL_AUTO == NO FILL, not solid
This fixes problems in the patches for tdf#116071. Tables have nothing to do with this bug. It just is the most common place to have a background colour, and then to have direct formatting that reverts back to COL_AUTO. I created a unit test using the page background (black), default style paragraph background (blue), and direct formatting COL_AUTO. COL_AUTO was turned into WHITE if the fillstyle was set to SOLID. Change-Id: I8197c040cec5adbdf16f379a88fab5e534ac0c6e Reviewed-on: https://gerrit.libreoffice.org/82412 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Xisco FaulĂ­ <xiscofauli@libreoffice.org> (cherry picked from commit b926a068a067e7aff6c8f11ed1098a76c39bf5e8) Reviewed-on: https://gerrit.libreoffice.org/83221 (cherry picked from commit b58225718f1915762d6c74de2ba9865250933c18) Reviewed-on: https://gerrit.libreoffice.org/83243 Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ww8export/data/tdf128608_fillStyleNoneB.odtbin0 -> 11105 bytes
-rw-r--r--sw/qa/extras/ww8export/ww8export3.cxx9
-rw-r--r--sw/source/filter/ww8/ww8par6.cxx18
3 files changed, 14 insertions, 13 deletions
diff --git a/sw/qa/extras/ww8export/data/tdf128608_fillStyleNoneB.odt b/sw/qa/extras/ww8export/data/tdf128608_fillStyleNoneB.odt
new file mode 100644
index 000000000000..917dc96d40ba
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf128608_fillStyleNoneB.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx
index 30e75563a783..fbece65a85b1 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -188,7 +188,14 @@ DECLARE_WW8EXPORT_TEST(testTdf121111_fillStyleNone, "tdf121111_fillStyleNone.doc
uno::Reference<text::XTextRange> xText(getParagraph(12));
CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(getProperty<sal_uInt32>(xText, "ParaBackColor")));
- CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, getProperty<drawing::FillStyle>(xText, "FillStyle"));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("No fill", drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(xText, "FillStyle"));
+}
+
+DECLARE_WW8EXPORT_TEST(testTdf128608_fillStyleNoneB, "tdf128608_fillStyleNoneB.odt")
+{
+ uno::Reference<text::XTextRange> xText(getParagraph(1));
+ CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(getProperty<sal_uInt32>(xText, "ParaBackColor")));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("No fill", drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(xText, "FillStyle"));
}
DECLARE_WW8EXPORT_TEST(testTdf112618_textbox_no_bg, "tdf112618_textbox_no_bg.doc")
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 69a6900220d2..3603f42df6a1 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -4886,13 +4886,8 @@ void SwWW8ImplReader::Read_ParaBackColor(sal_uInt16, const sal_uInt8* pData, sho
if (nLen <= 0)
{
// end of attribute
- 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 );
- }
+ m_xCtrlStck->SetAttr( *m_pPaM->GetPoint(), XATTR_FILLSTYLE );
+ m_xCtrlStck->SetAttr( *m_pPaM->GetPoint(), XATTR_FILLCOLOR );
}
else
{
@@ -4900,13 +4895,12 @@ void SwWW8ImplReader::Read_ParaBackColor(sal_uInt16, const sal_uInt8* pData, sho
if (nLen != 10)
return;
- if ( m_nInTable )
- NewAttr( SvxBrushItem(ExtractColour(pData, m_bVer67), RES_BACKGROUND) );
+ const Color aColor = ExtractColour(pData, m_bVer67);
+ NewAttr( XFillColorItem(OUString(), aColor) );
+ if ( aColor == COL_AUTO )
+ NewAttr( XFillStyleItem(drawing::FillStyle_NONE) );
else
- {
NewAttr( XFillStyleItem(drawing::FillStyle_SOLID) );
- NewAttr( XFillColorItem(OUString(), ExtractColour(pData, m_bVer67)) );
- }
}
}