tdf#128150 xmloff: ODF import/export of fill-use-slide-background

This would be better as a value of draw:fill, but we can't add values as
an extension.

Change-Id: I05db879a8cb5018e0261f049ae91a5b9aaa760b6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135814
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 69a4956..58b6329 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -3501,6 +3501,8 @@ namespace xmloff::token {
        XML_DATE_FORMAT,
        XML_DATE_RFC_LANGUAGE_TAG,

        XML_FILL_USE_SLIDE_BACKGROUND,

        XML_TOKEN_END
    };

diff --git a/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng b/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
index 293e40d..9d84b4ee 100644
--- a/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
+++ b/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
@@ -1757,6 +1757,12 @@ xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.
            </rng:choice>
          </rng:attribute>
        </rng:optional>
        <!-- TODO no proposal for fill-use-slide-background - should perhaps be added as draw:fill value -->
        <rng:optional>
          <rng:attribute name="loext:fill-use-slide-background">
            <rng:ref name="boolean"/>
          </rng:attribute>
        </rng:optional>
        <rng:optional>
          <rng:attribute name="draw:fill-color">
            <rng:ref name="color"/>
diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx
index 8ada9e6..7bf052c 100644
--- a/sd/qa/unit/import-tests2.cxx
+++ b/sd/qa/unit/import-tests2.cxx
@@ -1737,14 +1737,30 @@ void SdImportTest2::testTdf127964()
{
    sd::DrawDocShellRef xDocShRef
        = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf127964.pptx"), PPTX);
    const SdrPage* pPage = GetPage(1, xDocShRef);
    const SdrObject* pObj = pPage->GetObj(0);
    auto& rFillStyleItem
        = dynamic_cast<const XFillStyleItem&>(pObj->GetMergedItem(XATTR_FILLSTYLE));
    CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, rFillStyleItem.GetValue());
    auto& rFillBackgroundItem = dynamic_cast<const XFillUseSlideBackgroundItem&>(
        pObj->GetMergedItem(XATTR_FILLUSESLIDEBACKGROUND));
    CPPUNIT_ASSERT_EQUAL(true, rFillBackgroundItem.GetValue());
    {
        const SdrPage* pPage = GetPage(1, xDocShRef);
        const SdrObject* pObj = pPage->GetObj(0);
        auto& rFillStyleItem
            = dynamic_cast<const XFillStyleItem&>(pObj->GetMergedItem(XATTR_FILLSTYLE));
        CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, rFillStyleItem.GetValue());
        auto& rFillBackgroundItem = dynamic_cast<const XFillUseSlideBackgroundItem&>(
            pObj->GetMergedItem(XATTR_FILLUSESLIDEBACKGROUND));
        CPPUNIT_ASSERT_EQUAL(true, rFillBackgroundItem.GetValue());
    }

    xDocShRef = saveAndReload(xDocShRef.get(), ODP);

    {
        const SdrPage* pPage = GetPage(1, xDocShRef);
        const SdrObject* pObj = pPage->GetObj(0);
        auto& rFillStyleItem
            = dynamic_cast<const XFillStyleItem&>(pObj->GetMergedItem(XATTR_FILLSTYLE));
        CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, rFillStyleItem.GetValue());
        auto& rFillBackgroundItem = dynamic_cast<const XFillUseSlideBackgroundItem&>(
            pObj->GetMergedItem(XATTR_FILLUSESLIDEBACKGROUND));
        CPPUNIT_ASSERT_EQUAL(true, rFillBackgroundItem.GetValue());
    }

    xDocShRef->DoClose();
}

diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index efdd8a9..a996c4e 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -3504,6 +3504,7 @@ namespace xmloff::token {
        TOKEN("date-format", XML_DATE_FORMAT),
        TOKEN("date-rfc-language-tag", XML_DATE_RFC_LANGUAGE_TAG),

        TOKEN("fill-use-slide-background", XML_FILL_USE_SLIDE_BACKGROUND),

#if OSL_DEBUG_LEVEL > 0
        { 0, nullptr, std::nullopt,               XML_TOKEN_END }
diff --git a/xmloff/source/draw/sdpropls.cxx b/xmloff/source/draw/sdpropls.cxx
index 343436f..5e68aa1 100644
--- a/xmloff/source/draw/sdpropls.cxx
+++ b/xmloff/source/draw/sdpropls.cxx
@@ -113,6 +113,7 @@ const XMLPropertyMapEntry aXMLSDProperties[] =
    GMAP( "FillGradientStepCount",          XML_NAMESPACE_DRAW, XML_GRADIENT_STEP_COUNT,    XML_TYPE_NUMBER16, 0 ),
    GMAP( "FillHatchName",                  XML_NAMESPACE_DRAW, XML_FILL_HATCH_NAME,        XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLHATCHNAME ),
    GMAP( "FillBackground",                 XML_NAMESPACE_DRAW, XML_FILL_HATCH_SOLID,       XML_TYPE_BOOL, 0 ),
    GMAPV( "FillUseSlideBackground",        XML_NAMESPACE_LO_EXT, XML_FILL_USE_SLIDE_BACKGROUND, XML_TYPE_BOOL, 0, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED),
    GMAP( "FillBitmapName",                 XML_NAMESPACE_DRAW, XML_FILL_IMAGE_NAME,        XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLBITMAPNAME ),
    GMAP( "FillTransparence",               XML_NAMESPACE_DRAW, XML_OPACITY,                XML_TYPE_NEG_PERCENT16|MID_FLAG_MULTI_PROPERTY, 0 ),    // exists in SW, too
    GMAP( "FillTransparenceGradientName",   XML_NAMESPACE_DRAW, XML_OPACITY_NAME,           XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLTRANSNAME ),
diff --git a/xmloff/source/token/tokens.txt b/xmloff/source/token/tokens.txt
index aaf1442..8498028 100644
--- a/xmloff/source/token/tokens.txt
+++ b/xmloff/source/token/tokens.txt
@@ -3246,4 +3246,5 @@ display-text
picture
date-format
date-rfc-language-tag
fill-use-slide-background
TOKEN_END_DUMMY