diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2022-05-04 20:23:16 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2022-05-05 08:07:49 +0200 |
commit | 0c13e4768c3c7937c2fd71675c86ff8a0ca3fe50 (patch) | |
tree | 6aa75104a6644dac7354156c2dc0beff68013aaa /xmloff | |
parent | 574018db41b9be7619bddda098c6068efdc2886a (diff) |
sd theme: add ODP import/export for shape fill color effects
Map a themed color with effects to:
<style:graphic-properties draw:fill-color="..." loext:fill-theme-color="..." loext:fill-color-lum-mod="..." loext:fill-color-lum-off="...">
Change-Id: I18d8ddf8d6050ef468a8d67a9e797a576f682e85
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133843
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/qa/unit/data/refer-to-theme.odp | bin | 17899 -> 20677 bytes | |||
-rw-r--r-- | xmloff/qa/unit/draw.cxx | 19 | ||||
-rw-r--r-- | xmloff/source/core/xmltoken.cxx | 2 | ||||
-rw-r--r-- | xmloff/source/draw/sdpropls.cxx | 2 | ||||
-rw-r--r-- | xmloff/source/token/tokens.txt | 2 |
5 files changed, 25 insertions, 0 deletions
diff --git a/xmloff/qa/unit/data/refer-to-theme.odp b/xmloff/qa/unit/data/refer-to-theme.odp Binary files differindex 5fe9832d3eee..2c413ef766f9 100644 --- a/xmloff/qa/unit/data/refer-to-theme.odp +++ b/xmloff/qa/unit/data/refer-to-theme.odp diff --git a/xmloff/qa/unit/draw.cxx b/xmloff/qa/unit/draw.cxx index e45f5bbb444b..3c6d7c707be9 100644 --- a/xmloff/qa/unit/draw.cxx +++ b/xmloff/qa/unit/draw.cxx @@ -242,6 +242,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_TEST_FIXTURE(XmloffDrawTest, testTableInShape) diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index b84451538ebd..d1485460f83a 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -3489,6 +3489,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 accdd853e9e1..2acc44abf3f7 100644 --- a/xmloff/source/token/tokens.txt +++ b/xmloff/source/token/tokens.txt @@ -3233,6 +3233,8 @@ hlink folHlink color-lum-mod color-lum-off +fill-color-lum-mod +fill-color-lum-off content-control showing-place-holder checked-state |