From ff0eb613d8379e68eaf1754273b314afd28e0b00 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 4 May 2022 20:23:16 +0200 Subject: sd theme: add ODP import/export for shape fill color effects Map a themed color with effects to: (cherry picked from commit 0c13e4768c3c7937c2fd71675c86ff8a0ca3fe50) Change-Id: I18d8ddf8d6050ef468a8d67a9e797a576f682e85 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136730 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna --- xmloff/qa/unit/data/refer-to-theme.odp | Bin 17899 -> 20677 bytes xmloff/qa/unit/draw.cxx | 19 +++++++++++++++++++ xmloff/source/core/xmltoken.cxx | 2 ++ xmloff/source/draw/sdpropls.cxx | 2 ++ xmloff/source/token/tokens.txt | 2 ++ 5 files changed, 25 insertions(+) (limited to 'xmloff') diff --git a/xmloff/qa/unit/data/refer-to-theme.odp b/xmloff/qa/unit/data/refer-to-theme.odp index 5fe9832d3eee..2c413ef766f9 100644 Binary files a/xmloff/qa/unit/data/refer-to-theme.odp and b/xmloff/qa/unit/data/refer-to-theme.odp differ diff --git a/xmloff/qa/unit/draw.cxx b/xmloff/qa/unit/draw.cxx index 4e05b3f7f788..0b7c93c89073 100644 --- a/xmloff/qa/unit/draw.cxx +++ b/xmloff/qa/unit/draw.cxx @@ -224,6 +224,25 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testReferToTheme) // i.e. only the direct color was written, but not the theme reference. assertXPath(pXmlDoc, "//style:style[@style:name='gr2']/style:graphic-properties", "fill-theme-color", "accent1"); + + // Shape fill, 60% lighter. + assertXPath(pXmlDoc, "//style:style[@style:name='gr3']/style:graphic-properties", + "fill-theme-color", "accent1"); + // Without the accompanying fix in place, this test would have failed with: + // - XPath '//style:style[@style:name='gr3']/style:graphic-properties' no attribute 'fill-color-lum-mod' exist + // i.e. the themed color was fine, but its effects were lost. + assertXPath(pXmlDoc, "//style:style[@style:name='gr3']/style:graphic-properties", + "fill-color-lum-mod", "40%"); + assertXPath(pXmlDoc, "//style:style[@style:name='gr3']/style:graphic-properties", + "fill-color-lum-off", "60%"); + + // Shape fill, 25% darker. + assertXPath(pXmlDoc, "//style:style[@style:name='gr4']/style:graphic-properties", + "fill-theme-color", "accent1"); + assertXPath(pXmlDoc, "//style:style[@style:name='gr4']/style:graphic-properties", + "fill-color-lum-mod", "75%"); + assertXPathNoAttribute(pXmlDoc, "//style:style[@style:name='gr4']/style:graphic-properties", + "fill-color-lum-off"); } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index 1b0adb6d210d..10727ffb2928 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -3487,6 +3487,8 @@ namespace xmloff::token { TOKEN("folHlink", XML_FOLHLINK ), TOKEN("color-lum-mod", XML_COLOR_LUM_MOD ), TOKEN("color-lum-off", XML_COLOR_LUM_OFF ), + TOKEN("fill-color-lum-mod", XML_FILL_COLOR_LUM_MOD ), + TOKEN("fill-color-lum-off", XML_FILL_COLOR_LUM_OFF ), TOKEN("content-control", XML_CONTENT_CONTROL ), TOKEN("showing-place-holder", XML_SHOWING_PLACE_HOLDER ), diff --git a/xmloff/source/draw/sdpropls.cxx b/xmloff/source/draw/sdpropls.cxx index 49ed30583814..343436f71960 100644 --- a/xmloff/source/draw/sdpropls.cxx +++ b/xmloff/source/draw/sdpropls.cxx @@ -107,6 +107,8 @@ const XMLPropertyMapEntry aXMLSDProperties[] = GMAP_D("FillColor", XML_NAMESPACE_DRAW, XML_FILL_COLOR, XML_TYPE_COLOR, CTF_FILLCOLOR ), GMAP_D("FillColor2", XML_NAMESPACE_DRAW, XML_SECONDARY_FILL_COLOR, XML_TYPE_COLOR, 0), GMAPV("FillColorTheme", XML_NAMESPACE_LO_EXT, XML_FILL_THEME_COLOR, XML_TYPE_THEME_COLOR, 0, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED), + GMAPV("FillColorLumMod", XML_NAMESPACE_LO_EXT, XML_FILL_COLOR_LUM_MOD, XML_TYPE_PERCENT100, 0, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED), + GMAPV("FillColorLumOff", XML_NAMESPACE_LO_EXT, XML_FILL_COLOR_LUM_OFF, XML_TYPE_PERCENT100, 0, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED), GMAP( "FillGradientName", XML_NAMESPACE_DRAW, XML_FILL_GRADIENT_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLGRADIENTNAME ), 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 ), diff --git a/xmloff/source/token/tokens.txt b/xmloff/source/token/tokens.txt index 1183988d9eae..44d71eb8d9fe 100644 --- a/xmloff/source/token/tokens.txt +++ b/xmloff/source/token/tokens.txt @@ -3231,6 +3231,8 @@ hlink folHlink color-lum-mod color-lum-off +fill-color-lum-mod +fill-color-lum-off content-control showing-place-holder checked-state -- cgit