summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorRegina Henschel <rb.henschel@t-online.de>2023-05-20 19:26:26 +0200
committerAron Budea <aron.budea@collabora.com>2023-06-16 22:51:57 +0200
commitcfdf2c54f422bbd74642015443d07fe3e775b2da (patch)
treec8b3c1dccd8ce78e3e9fa671a89ee65b56aa39a8 /oox
parentf95b5d12c59e612ee4643b385389fc791e31f76d (diff)
tdf#155412 ooxml export typeface attribute is mandatory
The attribute 'typeface' is required for <a:ea>, <a:cs> and <a:latin> elements, see CT_TextFont in ISO/IEC 29500-1:2016. Its value may be the empty string. (cherry picked from commit 58926cc60c7868785c8db126fc199f6731269b86) Conflicts: oox/qa/unit/export.cxx Change-Id: I7c9316fa40ad6d1aabccb4191fee11be553c453b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152024 Tested-by: Jenkins Reviewed-by: Regina Henschel <rb.henschel@t-online.de> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153183 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Aron Budea <aron.budea@collabora.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/qa/unit/data/tdf155412_typeface.pptxbin0 -> 23138 bytes
-rw-r--r--oox/qa/unit/export.cxx16
-rw-r--r--oox/source/export/ThemeExport.cxx3
3 files changed, 19 insertions, 0 deletions
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
--- /dev/null
+++ b/oox/qa/unit/data/tdf155412_typeface.pptx
Binary files differ
diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx
index e1da11eb5436..d20169f92993 100644
--- a/oox/qa/unit/export.cxx
+++ b/oox/qa/unit/export.cxx
@@ -768,6 +768,22 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf151008VertAnchor)
assertXPath(pXmlDoc, "//p:spTree/p:sp[6]/p:txBody/a:bodyPr", "anchor", "b");
assertXPath(pXmlDoc, "//p:spTree/p:sp[6]/p:txBody/a:bodyPr", "anchorCtr", "1");
}
+
+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 <a:ea> 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<sax_fastparser::FastAttributeList> 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);