diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2022-03-17 20:37:39 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2022-03-18 08:07:02 +0100 |
commit | 1868dea877b0c956ee34e92afad59920e66cad3f (patch) | |
tree | 1de6e3485125f09e6d3436c6a2d6b9f1e1bc0b06 /xmloff | |
parent | 778bbcede813dd51e11ee61583247db1199eda63 (diff) |
sd theme: add ODP import/export for shape fill color
Refer to the 12 pre-defined colors by name + don't write the attribute
for the case when there is no theme.
Change-Id: I37c984b3371ec878a0d733977f5c937dce27c440
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131717
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/inc/enummaps.hxx | 1 | ||||
-rw-r--r-- | xmloff/qa/unit/data/refer-to-theme.odp | bin | 14547 -> 17899 bytes | |||
-rw-r--r-- | xmloff/qa/unit/draw.cxx | 6 | ||||
-rw-r--r-- | xmloff/source/core/xmltoken.cxx | 1 | ||||
-rw-r--r-- | xmloff/source/draw/sdpropls.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/token/tokens.txt | 1 |
6 files changed, 13 insertions, 0 deletions
diff --git a/xmloff/inc/enummaps.hxx b/xmloff/inc/enummaps.hxx index ae61adc3433a..a170559af996 100644 --- a/xmloff/inc/enummaps.hxx +++ b/xmloff/inc/enummaps.hxx @@ -19,5 +19,6 @@ template <typename EnumT> struct SvXMLEnumMapEntry; extern SvXMLEnumMapEntry<css::drawing::FillStyle> const aXML_FillStyle_EnumMap[]; extern SvXMLEnumMapEntry<css::drawing::RectanglePoint> const aXML_RefPoint_EnumMap[]; extern SvXMLEnumMapEntry<css::drawing::BitmapMode> const aXML_BitmapMode_EnumMap[]; +extern SvXMLEnumMapEntry<sal_uInt16> const pXML_ThemeColor_Enum[]; /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/xmloff/qa/unit/data/refer-to-theme.odp b/xmloff/qa/unit/data/refer-to-theme.odp Binary files differindex cba4bfda1538..5fe9832d3eee 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 ac0801dce72b..481561ff062a 100644 --- a/xmloff/qa/unit/draw.cxx +++ b/xmloff/qa/unit/draw.cxx @@ -234,6 +234,12 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testReferToTheme) "75%"); assertXPathNoAttribute(pXmlDoc, "//style:style[@style:name='T3']/style:text-properties", "color-lum-off"); + + // Without the accompanying fix in place, this test would have failed with: + // - XPath '//style:style[@style:name='gr2']/style:graphic-properties' no attribute 'fill-theme-color' exist + // 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"); } CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTableInShape) diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index d1827fcd2915..0b8f36badf13 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -3448,6 +3448,7 @@ namespace xmloff::token { TOKEN("theme", XML_THEME ), TOKEN("theme-color", XML_THEME_COLOR ), + TOKEN("fill-theme-color", XML_FILL_THEME_COLOR ), TOKEN("dk1", XML_DK1 ), TOKEN("lt1", XML_LT1 ), TOKEN("dk2", XML_DK2 ), diff --git a/xmloff/source/draw/sdpropls.cxx b/xmloff/source/draw/sdpropls.cxx index c554b2411f6e..49ed30583814 100644 --- a/xmloff/source/draw/sdpropls.cxx +++ b/xmloff/source/draw/sdpropls.cxx @@ -106,6 +106,7 @@ const XMLPropertyMapEntry aXMLSDProperties[] = GMAP( "FillStyle", XML_NAMESPACE_DRAW, XML_FILL, XML_SD_TYPE_FILLSTYLE, CTF_FILLSTYLE ), 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), 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 ), @@ -1281,6 +1282,9 @@ const XMLPropertyHandler* XMLSdPropHdlFactory::GetPropertyHandler( sal_Int32 nTy case XML_TYPE_TEXT_COLUMNS: pHdl = new XMLTextColumnsPropertyHandler; break; + case XML_TYPE_THEME_COLOR: + pHdl = new XMLConstantsPropertyHandler(pXML_ThemeColor_Enum, XML_TOKEN_INVALID); + break; } if(pHdl) diff --git a/xmloff/source/token/tokens.txt b/xmloff/source/token/tokens.txt index a5c981a7ce6c..86390065d09b 100644 --- a/xmloff/source/token/tokens.txt +++ b/xmloff/source/token/tokens.txt @@ -3192,6 +3192,7 @@ symmetric linked-style-name theme theme-color +fill-theme-color dk1 lt1 dk2 |