sw/qa/extras/uiwriter/data/tdf91292_paraBackground.docx |binary
 sw/qa/extras/uiwriter/uiwriter.cxx                      |   19 ++++++++++++++++
 sw/source/filter/ww8/docxattributeoutput.cxx            |    4 +++
 3 files changed, 23 insertions(+)

New commits:
commit 29d57a3f0c60afc1bd3a79a01e18e99bf4e8edcb
Author: Justin Luth <justin_l...@sil.org>
Date:   Sat Oct 28 21:50:04 2017 +0300

    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 <c...@libreoffice.org>
    Reviewed-by: Justin Luth <justin_l...@sil.org>
    Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk>

diff --git a/sw/qa/extras/uiwriter/data/tdf91292_paraBackground.docx 
b/sw/qa/extras/uiwriter/data/tdf91292_paraBackground.docx
new file mode 100644
index 000000000000..bd512eb3f025
Binary files /dev/null and 
b/sw/qa/extras/uiwriter/data/tdf91292_paraBackground.docx differ
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 )
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to