diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2020-04-24 13:02:17 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2021-01-07 16:32:52 +0100 |
commit | 551204ac0fd9170fa9b096094c76faf705b75cd7 (patch) | |
tree | 149130093df787df05a10dc4dd6315ed369382f8 /include | |
parent | 684418cb58e785773148f760191459bea1200bf4 (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 'include')
-rw-r--r-- | include/unotools/saveopt.hxx | 1 | ||||
-rw-r--r-- | include/xmloff/maptype.hxx | 4 | ||||
-rw-r--r-- | include/xmloff/xmlprmap.hxx | 5 |
3 files changed, 8 insertions, 2 deletions
diff --git a/include/unotools/saveopt.hxx b/include/unotools/saveopt.hxx index d97cd505aaf1..ca5cfcf8b05f 100644 --- a/include/unotools/saveopt.hxx +++ b/include/unotools/saveopt.hxx @@ -79,6 +79,7 @@ public: ODFSVER_012_EXTENDED = 11, ///< ODF 1.2 extended ODFSVER_013 = 12, ///< ODF 1.3 ODFSVER_013_EXTENDED = 13, ///< ODF 1.3 extended + ODFSVER_FUTURE_EXTENDED = 1000 | ODFSVER_EXTENDED, ///< current extension, unknown future ODF version // The latest defined standard. Adapt when a new one is published. ODFSVER_LATEST = ODFSVER_012, ///< @internal DO NOT USE in comparisons diff --git a/include/xmloff/maptype.hxx b/include/xmloff/maptype.hxx index 561f806048a9..790a4427ab60 100644 --- a/include/xmloff/maptype.hxx +++ b/include/xmloff/maptype.hxx @@ -86,7 +86,9 @@ struct XMLPropertyMapEntry sal_uInt32 mnType; sal_Int16 mnContextId; /// User defined id for context filtering - /// no export when the used ODF version is lower than this + /** no export to standard namespace when the used ODF version is lower than this; + no export to extension namespace when the used ODF version is at least this + */ SvtSaveOptions::ODFSaneDefaultVersion mnEarliestODFVersionForExport; /** Flag to specify whether entry is only used during import. diff --git a/include/xmloff/xmlprmap.hxx b/include/xmloff/xmlprmap.hxx index 5f460474b99b..65997847041c 100644 --- a/include/xmloff/xmlprmap.hxx +++ b/include/xmloff/xmlprmap.hxx @@ -81,7 +81,10 @@ public: /** returns the entry context id. -1 is a valid index here. */ sal_Int16 GetEntryContextId( sal_Int32 nIndex ) const; - /** returns the earliest odf version for which this property should be exported. */ + /** returns the earliest ODF version for which this property should be + exported as standard ODF element, which is the earliest ODF version + for which the property should not be exported as extension element. + */ SvtSaveOptions::ODFSaneDefaultVersion GetEarliestODFVersionForExport(sal_Int32 nIndex) const; /** Returns the index of an entry with the given XML-name and namespace |