diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2020-04-24 13:02:17 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@cib.de> | 2020-05-08 21:29:29 +0200 |
commit | f1dbaac9e4b68941d845a5f0ab7b204e12de14de (patch) | |
tree | 201a3224ef03b938a96fc6be5a6272a9347dea89 /xmloff/source/text/txtprmap.cxx | |
parent | d840c7e15402dc3a133b400b113e28c0c78702c5 (diff) |
xmloff: ODF export: rework version checks in SvXMLExportPropertyMapper
There's some issues with the version checks here:
* The requirement is to retain support for ODF 1.2 extended,
but some attributes are in ODF 1.3, while others require ODF 1.3
extended, so a single version number can't be used to compare
* A recurring problem is that new extension attributes are erroneously
exported to standard namespaces;
there is the pre-existing buggy case of style:hyperlink to consider...
* Currently it's possible to distinguish multiple extended version but
the only minimum version that's actually used is the minimum one
ODFSVER_012_EXT_COMPAT
Rework this to use a different check, by:
* distinguishing extension attributes from standard attributes via
their namespace, to avoid such bugs by construction
* interpreting the version number always as a standard ODF version number:
if the attribute is in extension namespace:
if the minimum standard version is met, ignore
else:
if the minimum standard version is met, export
* adapting all XMLPropertyMapEntry to use ODFSVER_FUTURE_EXTENDED for
extension attributes (TODO: check which of these should be ODFSVER_013)
This should have an effect on the drawext:fontwork* attributes, which
need ODFSVER_FUTURE_EXTENDED to be exported now.
Change-Id: I986c8064e578a61d69ed5fdb261f23e7582a7d75
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92856
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Tested-by: Jenkins
Diffstat (limited to 'xmloff/source/text/txtprmap.cxx')
-rw-r--r-- | xmloff/source/text/txtprmap.cxx | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx index 55d9f208306d..60ec65b66026 100644 --- a/xmloff/source/text/txtprmap.cxx +++ b/xmloff/source/text/txtprmap.cxx @@ -75,9 +75,9 @@ using namespace ::xmloff::token; M_E_( a, p, l, (t|XML_TYPE_PROP_TABLE_CELL), c ) // extensions import/export -#define MAP_EXT(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, type, context, SvtSaveOptions::ODFSVER_012_EXT_COMPAT, false } +#define MAP_EXT(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, type, context, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED, false } // extensions import only -#define MAP_EXT_I(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, type, context, SvtSaveOptions::ODFSVER_012_EXT_COMPAT, true } +#define MAP_EXT_I(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, type, context, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED, true } #define M_END() \ { nullptr, 0, 0, XML_TOKEN_INVALID, 0, 0, SvtSaveOptions::ODFSVER_010, false } @@ -179,9 +179,9 @@ XMLPropertyMapEntry const aXMLParaPropMap[] = // RES_CHRATR_WEIGHT MT_E( "CharWeight", FO, FONT_WEIGHT, XML_TYPE_TEXT_WEIGHT, 0 ), // RES_CHRATR_RSID - { "Rsid", sizeof("Rsid")-1, XML_NAMESPACE_OFFICE_EXT, XML_RSID, XML_TYPE_HEX|XML_TYPE_PROP_TEXT, 0, SvtSaveOptions::ODFSVER_012_EXT_COMPAT, false }, + { "Rsid", sizeof("Rsid")-1, XML_NAMESPACE_OFFICE_EXT, XML_RSID, XML_TYPE_HEX|XML_TYPE_PROP_TEXT, 0, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED, false }, // RES_PARATR_RSID - { "ParRsid", sizeof("ParRsid")-1, XML_NAMESPACE_OFFICE_EXT, XML_PARRSID, XML_TYPE_HEX|XML_TYPE_PROP_TEXT, 0, SvtSaveOptions::ODFSVER_012_EXT_COMPAT, false }, + { "ParRsid", sizeof("ParRsid")-1, XML_NAMESPACE_OFFICE_EXT, XML_PARRSID, XML_TYPE_HEX|XML_TYPE_PROP_TEXT, 0, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED, false }, // RES_CHRATR_WORDLINEMODE MT_E( "CharWordMode", STYLE, TEXT_UNDERLINE_MODE, XML_TYPE_TEXT_LINE_MODE|MID_FLAG_MERGE_PROPERTY, 0 ), MT_E( "CharWordMode", STYLE, TEXT_OVERLINE_MODE, XML_TYPE_TEXT_LINE_MODE|MID_FLAG_MERGE_PROPERTY, 0 ), @@ -523,9 +523,9 @@ XMLPropertyMapEntry const aXMLTextPropMap[] = // RES_CHRATR_WEIGHT MT_E( "CharWeight", FO, FONT_WEIGHT, XML_TYPE_TEXT_WEIGHT, 0 ), // RES_CHRATR_RSID - { "Rsid", sizeof("Rsid")-1, XML_NAMESPACE_OFFICE_EXT, XML_RSID, XML_TYPE_HEX|XML_TYPE_PROP_TEXT, 0, SvtSaveOptions::ODFSVER_012_EXT_COMPAT, false }, + { "Rsid", sizeof("Rsid")-1, XML_NAMESPACE_OFFICE_EXT, XML_RSID, XML_TYPE_HEX|XML_TYPE_PROP_TEXT, 0, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED, false }, // RES_PARATR_RSID - { "ParRsid", sizeof("ParRsid")-1, XML_NAMESPACE_OFFICE_EXT, XML_PARRSID, XML_TYPE_HEX|XML_TYPE_PROP_TEXT, 0, SvtSaveOptions::ODFSVER_012_EXT_COMPAT, false }, + { "ParRsid", sizeof("ParRsid")-1, XML_NAMESPACE_OFFICE_EXT, XML_PARRSID, XML_TYPE_HEX|XML_TYPE_PROP_TEXT, 0, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED, false }, // RES_CHRATR_WORDLINEMODE MT_E( "CharWordMode", STYLE, TEXT_UNDERLINE_MODE, XML_TYPE_TEXT_LINE_MODE|MID_FLAG_MERGE_PROPERTY, 0 ), MT_E( "CharWordMode", STYLE, TEXT_OVERLINE_MODE, XML_TYPE_TEXT_LINE_MODE|MID_FLAG_MERGE_PROPERTY, 0 ), @@ -540,7 +540,7 @@ XMLPropertyMapEntry const aXMLTextPropMap[] = // RES_CHRATR_BACKGROUND MT_E( "CharBackColor", FO, BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY, CTF_CHAR_BACKGROUND ), MT_E( "CharBackTransparent", FO, BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT|MID_FLAG_MERGE_ATTRIBUTE, CTF_CHAR_BACKGROUND_TRANSPARENCY), - { "CharShadingValue", sizeof("CharShadingValue")-1, XML_NAMESPACE_LO_EXT, XML_CHAR_SHADING_VALUE, XML_TYPE_NUMBER|XML_TYPE_PROP_TEXT, 0, SvtSaveOptions::ODFSVER_012_EXT_COMPAT, false }, + { "CharShadingValue", sizeof("CharShadingValue")-1, XML_NAMESPACE_LO_EXT, XML_CHAR_SHADING_VALUE, XML_TYPE_NUMBER|XML_TYPE_PROP_TEXT, 0, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED, false }, MT_E( "CharBackColor", FO, TEXT_BACKGROUND_COLOR, XML_TYPE_COLOR|MID_FLAG_SPECIAL_ITEM_EXPORT, CTF_OLDTEXTBACKGROUND ), // RES_CHRATR_CJK_FONT MT_ED( "CharFontNameAsian", STYLE, FONT_NAME_ASIAN, XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_FONTNAME_CJK ), @@ -983,7 +983,7 @@ XMLPropertyMapEntry const aXMLRubyPropMap[] = { MR_E( "RubyAdjust", STYLE, RUBY_ALIGN, XML_TYPE_TEXT_RUBY_ADJUST, 0 ), MR_E( "RubyIsAbove", STYLE, RUBY_POSITION, XML_TYPE_TEXT_RUBY_IS_ABOVE, 0 ), - MR_EV( "RubyPosition", LO_EXT, RUBY_POSITION, XML_TYPE_TEXT_RUBY_POSITION, 0, SvtSaveOptions::ODFSVER_012_EXT_COMPAT), + MR_EV( "RubyPosition", LO_EXT, RUBY_POSITION, XML_TYPE_TEXT_RUBY_POSITION, 0, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED), M_END() }; |