From 58926cc60c7868785c8db126fc199f6731269b86 Mon Sep 17 00:00:00 2001 From: Regina Henschel Date: Sat, 20 May 2023 19:26:26 +0200 Subject: tdf#155412 ooxml export typeface attribute is mandatory The attribute 'typeface' is required for , and elements, see CT_TextFont in ISO/IEC 29500-1:2016. Its value may be the empty string. Change-Id: I7c9316fa40ad6d1aabccb4191fee11be553c453b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152024 Tested-by: Jenkins Reviewed-by: Regina Henschel --- oox/qa/unit/data/tdf155412_typeface.pptx | Bin 0 -> 23138 bytes oox/qa/unit/export.cxx | 16 ++++++++++++++++ oox/source/export/ThemeExport.cxx | 3 +++ 3 files changed, 19 insertions(+) create mode 100644 oox/qa/unit/data/tdf155412_typeface.pptx (limited to 'oox') diff --git a/oox/qa/unit/data/tdf155412_typeface.pptx b/oox/qa/unit/data/tdf155412_typeface.pptx new file mode 100644 index 000000000000..30a486e70fff Binary files /dev/null and b/oox/qa/unit/data/tdf155412_typeface.pptx differ diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx index 6992f6378a76..8a17f352716b 100644 --- a/oox/qa/unit/export.cxx +++ b/oox/qa/unit/export.cxx @@ -1316,6 +1316,22 @@ CPPUNIT_TEST_FIXTURE(Test, testThemeColorTransparency) assertXPath(pXmlDoc, sElement + "a:solidFill/a:schemeClr/a:lumMod", "val", "75000"); assertXPath(pXmlDoc, sElement + "a:solidFill/a:schemeClr/a:alpha", "val", "20000"); } + +CPPUNIT_TEST_FIXTURE(Test, testThemeFontTypeface) +{ + // Saving the document had produced a file which PowerPoint wants to repair. The mandatory + // attribute 'typeface' was missing in the elements. + + loadFromURL(u"tdf155412_typeface.pptx"); + + save("Impress Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("ppt/theme/theme1.xml"); + + // Make sure typeface is written. + OString sElement = "/a:theme/a:themeElements/a:fontScheme/"; + assertXPath(pXmlDoc, sElement + "a:majorFont/a:ea", "typeface", ""); + assertXPath(pXmlDoc, sElement + "a:minorFont/a:ea", "typeface", ""); +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/oox/source/export/ThemeExport.cxx b/oox/source/export/ThemeExport.cxx index 511647ee1fc3..f09f9012e246 100644 --- a/oox/source/export/ThemeExport.cxx +++ b/oox/source/export/ThemeExport.cxx @@ -81,7 +81,10 @@ void fillAttrList(rtl::Reference const& pAttr model::ThemeFont const& rThemeFont) { if (rThemeFont.maTypeface.isEmpty()) + { + pAttrList->add(XML_typeface, ""); // 'typeface' attribute is mandatory return; + } pAttrList->add(XML_typeface, rThemeFont.maTypeface); -- cgit