tdf#127862 ww8import: page style - import XATTR if defined

...which fixes losing the background color of the page. That was
broken by LO63 commit cc899c6967238877f0094bcf00627145e484ffec
since an obsolete RES_BACKGROUND was not necessarily created.

Change-Id: I944a1b3f3df1468c283f93a49ffacfbd223fb392
Reviewed-on: https://gerrit.libreoffice.org/79912
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index a2b2cf4..f2ce3fb 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -749,6 +749,10 @@ DECLARE_OOXMLEXPORT_TEST(testTdf38778, "tdf38778_properties_in_run_for_field.doc
    // w:fldCharType="end"
    assertXPath(pXmlDoc,        "/w:document/w:body/w:p[1]/w:r[7]/w:rPr/w:sz",   "val", psz);
    assertXPath(pXmlDoc,        "/w:document/w:body/w:p[1]/w:r[7]/w:rPr/w:szCs", "val", pszCs);

    // tdf#127862: page fill color (in this case white) was lost
    uno::Reference<beans::XPropertySet> xStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY);
    CPPUNIT_ASSERT(drawing::FillStyle_NONE != getProperty<drawing::FillStyle>(xStyle, "FillStyle"));
}

DECLARE_OOXMLEXPORT_TEST(testFDO76312, "FDO76312.docx")
diff --git a/sw/qa/extras/ww8export/data/tdf127862_pageFillStyle.odt b/sw/qa/extras/ww8export/data/tdf127862_pageFillStyle.odt
new file mode 100644
index 0000000..c382c9a
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf127862_pageFillStyle.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx
index 801e77e..4680216 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -45,7 +45,11 @@ DECLARE_WW8EXPORT_TEST(testTdf37778_readonlySection, "tdf37778_readonlySection.d
    // The problem was that section protection was being enabled in addition to being read-only.
    // This created an explicit section with protection. There should be just the default, non-explicit section.
    CPPUNIT_ASSERT_EQUAL_MESSAGE("Number of Sections", sal_Int32(0), xSections->getCount());
    }

    // tdf#127862: page fill color (in this case white) was lost
    uno::Reference<beans::XPropertySet> xStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY);
    CPPUNIT_ASSERT(drawing::FillStyle_NONE != getProperty<drawing::FillStyle>(xStyle, "FillStyle"));
}

DECLARE_WW8EXPORT_TEST(testTdf122429_header, "tdf122429_header.doc")
{
@@ -212,6 +216,12 @@ DECLARE_WW8EXPORT_TEST(testTdf123433_fillStyleStop, "tdf123433_fillStyleStop.doc
    CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(getProperty<sal_uInt32>(xText, "ParaBackColor")));
}

DECLARE_WW8EXPORT_TEST(testTdf127862_pageFillStyle, "tdf127862_pageFillStyle.odt")
{
    uno::Reference<beans::XPropertySet> xStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY);
    CPPUNIT_ASSERT(drawing::FillStyle_NONE != getProperty<drawing::FillStyle>(xStyle, "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/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index a525b2a..ad5f7ef 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -4359,10 +4359,14 @@ void wwSectionManager::SetSegmentToPageDesc(const wwSection &rSection,
            // Only handle shape if it is a background shape
            if (aData.begin()->get()->nFlags & ShapeFlag::Background)
            {
                SfxItemSet aSet(rFormat.GetAttrSet());
                SfxItemSet aSet(rFormat.GetDoc()->GetAttrPool(),
                                svl::Items<RES_BACKGROUND, RES_BACKGROUND,XATTR_START, XATTR_END>{});
                mrReader.MatchSdrItemsIntoFlySet(pObject, aSet, mso_lineSimple,
                                                 mso_lineSolid, mso_sptRectangle, aRect);
                rFormat.SetFormatAttr(aSet.Get(RES_BACKGROUND));
                if ( aSet.HasItem(RES_BACKGROUND) )
                    rFormat.SetFormatAttr(aSet.Get(RES_BACKGROUND));
                else
                    rFormat.SetFormatAttr(aSet);
            }
        }
        SdrObject::Free(pObject);