tdf#162686: Adapt to ODF 1.4

Change-Id: I47f29a88eb0e98dc0fd312a3895d3a578fa04d46
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172768
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
Xisco Fauli
2024-09-02 17:50:50 +02:00
parent a36e806c21
commit 34c4a18d78
2 changed files with 9 additions and 6 deletions

View File

@@ -555,16 +555,15 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionMetalTypeStrict)
{ {
loadFromFile(u"tdf145700_3D_metal_type_MSCompatible.doc"); loadFromFile(u"tdf145700_3D_metal_type_MSCompatible.doc");
// save ODF 1.3 strict and test, that new attribute is not written. Adapt when attribute is // save ODF 1.4 strict and test that new attribute is written.
// added to ODF.
const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion(GetODFDefaultVersion()); const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion(GetODFDefaultVersion());
SetODFDefaultVersion(SvtSaveOptions::ODFVER_013); SetODFDefaultVersion(SvtSaveOptions::ODFVER_014);
save(u"writer8"_ustr); save(u"writer8"_ustr);
// assert XML. // assert XML.
xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr);
assertXPath(pXmlDoc, "//draw:enhanced-geometry"_ostr, "extrusion-metal"_ostr, u"true"_ustr); assertXPath(pXmlDoc, "//draw:enhanced-geometry"_ostr, "extrusion-metal"_ostr, u"true"_ustr);
assertXPath(pXmlDoc, "//draw:enhanced-geometry[@loext:extrusion-metal-type]"_ostr, 0); assertXPath(pXmlDoc, "//draw:enhanced-geometry[@draw:extrusion-metal-type]"_ostr, 1);
SetODFDefaultVersion(nCurrentODFVersion); SetODFDefaultVersion(nCurrentODFVersion);
} }

View File

@@ -4604,8 +4604,12 @@ static void ImpExportEnhancedGeometry( SvXMLExport& rExport, const uno::Referenc
if (rProp.Value >>= eMetalType) if (rProp.Value >>= eMetalType)
{ {
SvtSaveOptions::ODFSaneDefaultVersion eVersion = rExport.getSaneDefaultVersion(); SvtSaveOptions::ODFSaneDefaultVersion eVersion = rExport.getSaneDefaultVersion();
if (eVersion > SvtSaveOptions::ODFSVER_013 if (eVersion >= SvtSaveOptions::ODFSVER_014)
&& (eVersion & SvtSaveOptions::ODFSVER_EXTENDED)) {
aStr = "draw:MetalODF";
rExport.AddAttribute(XML_NAMESPACE_DRAW, XML_EXTRUSION_METAL_TYPE, aStr);
}
else if (eVersion & SvtSaveOptions::ODFSVER_EXTENDED)
{ {
if (eMetalType == drawing::EnhancedCustomShapeMetalType::MetalMSCompatible) if (eMetalType == drawing::EnhancedCustomShapeMetalType::MetalMSCompatible)
aStr = "loext:MetalMSCompatible"; aStr = "loext:MetalMSCompatible";