summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2022-06-14 10:35:04 +0200
committerThorsten Behrens <thorsten.behrens@allotropia.de>2022-07-06 16:48:59 +0200
commit4a23c2d9f6083be8806d6c73b8b134bd600258c1 (patch)
treeab021a8beac0555bb4bde603adf165f69abeb391
parenttdf#128150 Implement/add SlideBackgroundFill visualization (diff)
downloadcore-4a23c2d9f6083be8806d6c73b8b134bd600258c1.tar.gz
core-4a23c2d9f6083be8806d6c73b8b134bd600258c1.zip
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>
-rw-r--r--include/xmloff/xmltoken.hxx2
-rw-r--r--schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng6
-rw-r--r--sd/qa/unit/import-tests2.cxx32
-rw-r--r--xmloff/source/core/xmltoken.cxx1
-rw-r--r--xmloff/source/draw/sdpropls.cxx1
-rw-r--r--xmloff/source/token/tokens.txt1
6 files changed, 35 insertions, 8 deletions
diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 69a495687da6..58b6329ec71a 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 293e40d9601c..9d84b4ee2343 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 7f4cd9180ce9..33bbcca615b7 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 efdd8a912cf8..a996c4e9fb54 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 343436f71960..5e68aa17599d 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 aaf1442d1dc6..849802878614 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