diff options
author | Justin Luth <justin_luth@sil.org> | 2017-10-28 21:50:04 +0300 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-01-11 11:00:56 +0100 |
commit | 29d57a3f0c60afc1bd3a79a01e18e99bf4e8edcb (patch) | |
tree | 38fb10a3a5c18a5a8f600403051af7270c25e858 | |
parent | aa957dffaa40a7d4f34ec90ea50779532bdc9540 (diff) |
tdf#91292 ooxmlexport: cleared fill != use grabbag info
A while back the way that backgrounds are handled changed.
This was one spot where the changes didn't sync up. When
the background is cleared, then the imported grabbag
attributes should be tossed, not re-applied during save.
Change-Id: I9759def6321697a634bcbd66ecdc9d73693ce1a3
Reviewed-on: https://gerrit.libreoffice.org/44040
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r-- | sw/qa/extras/uiwriter/data/tdf91292_paraBackground.docx | bin | 0 -> 4262 bytes | |||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 19 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 4 |
3 files changed, 23 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/data/tdf91292_paraBackground.docx b/sw/qa/extras/uiwriter/data/tdf91292_paraBackground.docx Binary files differnew file mode 100644 index 000000000000..bd512eb3f025 --- /dev/null +++ b/sw/qa/extras/uiwriter/data/tdf91292_paraBackground.docx diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 858bf691db23..995f905fd7b9 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -240,6 +240,7 @@ public: void testTableStyleUndo(); void testRedlineParam(); void testRedlineViewAuthor(); + void testTdf91292(); void testTdf78727(); void testRedlineTimestamp(); void testCursorWindows(); @@ -411,6 +412,7 @@ public: CPPUNIT_TEST(testTableStyleUndo); CPPUNIT_TEST(testRedlineParam); CPPUNIT_TEST(testRedlineViewAuthor); + CPPUNIT_TEST(testTdf91292); CPPUNIT_TEST(testTdf78727); CPPUNIT_TEST(testRedlineTimestamp); CPPUNIT_TEST(testCursorWindows); @@ -4789,6 +4791,23 @@ void SwUiWriterTest::testRedlineViewAuthor() CPPUNIT_ASSERT_EQUAL(aAuthor, xField->getPropertyValue("Author").get<OUString>()); } +void SwUiWriterTest::testTdf91292() +{ + createDoc("tdf91292_paraBackground.docx"); + uno::Reference<beans::XPropertySet> xPropertySet(getParagraph(1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Solid background color", drawing::FillStyle_SOLID, getProperty<drawing::FillStyle>(xPropertySet, "FillStyle")); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Background Color", static_cast<sal_Int32>(0x5C2D91), getProperty<sal_Int32>(xPropertySet, "FillColor")); + + // remove background color + xPropertySet->setPropertyValue("FillStyle", uno::makeAny( drawing::FillStyle_NONE)); + + // Save it and load it back. + reload("Office Open XML Text", "tdf91292_paraBackground.docx"); + + xPropertySet.set( getParagraph(1), uno::UNO_QUERY ); + CPPUNIT_ASSERT_EQUAL_MESSAGE("No background color", drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(xPropertySet, "FillStyle")); +} + void SwUiWriterTest::testTdf78727() { SwDoc* pDoc = createDoc("tdf78727.docx"); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index fbcc5e634f2d..2a1dc9c68bdb 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -8325,6 +8325,10 @@ void DocxAttributeOutput::FormatFillStyle( const XFillStyleItem& rFillStyle ) m_oFillStyle.reset(rFillStyle.GetValue()); else m_bIgnoreNextFill = false; + + // Don't round-trip grabbag OriginalBackground if the background has been cleared. + if ( m_pBackgroundAttrList.is() && rFillStyle.GetValue() == drawing::FillStyle_NONE ) + m_pBackgroundAttrList.clear(); } void DocxAttributeOutput::FormatFillGradient( const XFillGradientItem& rFillGradient ) |