[Libreoffice-commits] core.git: include/unotools include/xmloff sc/source xmloff/source

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Fri May 8 19:30:11 UTC 2020


 include/unotools/saveopt.hxx               |    1 
 include/xmloff/maptype.hxx                 |    4 +-
 include/xmloff/xmlprmap.hxx                |    5 ++
 sc/source/filter/xml/xmlstyle.cxx          |    4 +-
 xmloff/source/chart/PropertyMap.hxx        |    4 +-
 xmloff/source/draw/sdpropls.cxx            |   34 +++++++++---------
 xmloff/source/style/PageMasterStyleMap.cxx |    4 +-
 xmloff/source/style/xmlexppr.cxx           |   53 ++++++++++++++++++++++++++++-
 xmloff/source/text/txtprmap.cxx            |   16 ++++----
 9 files changed, 91 insertions(+), 34 deletions(-)

New commits:
commit f1dbaac9e4b68941d845a5f0ab7b204e12de14de
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Apr 24 13:02:17 2020 +0200
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Fri May 8 21:29:29 2020 +0200

    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 at cib.de>
    Tested-by: Jenkins

diff --git a/include/unotools/saveopt.hxx b/include/unotools/saveopt.hxx
index 029ab6f0b1cb..2f0460e21fbc 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 ac6033e6dfe1..b09d48b31e6b 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 2b53f2e83d53..19e9ab80c0c4 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
diff --git a/sc/source/filter/xml/xmlstyle.cxx b/sc/source/filter/xml/xmlstyle.cxx
index 7f38d5217042..ff38c1cbdaaf 100644
--- a/sc/source/filter/xml/xmlstyle.cxx
+++ b/sc/source/filter/xml/xmlstyle.cxx
@@ -52,9 +52,9 @@ using namespace ::formula;
 
 #define MAP(name,prefix,token,type,context)  { name, sizeof(name)-1, prefix, token, type, context, SvtSaveOptions::ODFSVER_010, false }
 // 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 MAP_END()   { nullptr, 0, 0, XML_TOKEN_INVALID, 0, 0, SvtSaveOptions::ODFSVER_010, false }
 
 const XMLPropertyMapEntry aXMLScCellStylesProperties[] =
diff --git a/xmloff/source/chart/PropertyMap.hxx b/xmloff/source/chart/PropertyMap.hxx
index 66d39392e1c4..6d3c008e9fd4 100644
--- a/xmloff/source/chart/PropertyMap.hxx
+++ b/xmloff/source/chart/PropertyMap.hxx
@@ -87,8 +87,8 @@
 #define MAP_FULL( ApiName, NameSpace, XMLTokenName, XMLType, ContextId, EarliestODFVersionForExport ) { ApiName, sizeof(ApiName)-1, XML_NAMESPACE_##NameSpace, xmloff::token::XMLTokenName, XMLType|XML_TYPE_PROP_CHART, ContextId, EarliestODFVersionForExport, false }
 #define MAP_ENTRY( a, ns, nm, t )            { a, sizeof(a)-1, XML_NAMESPACE_##ns, xmloff::token::nm, t|XML_TYPE_PROP_CHART, 0, SvtSaveOptions::ODFSVER_010, false }
 #define MAP_ENTRY_ODF12( a, ns, nm, t )      { a, sizeof(a)-1, XML_NAMESPACE_##ns, xmloff::token::nm, t|XML_TYPE_PROP_CHART, 0, SvtSaveOptions::ODFSVER_012, false }
-#define MAP_ENTRY_ODF_EXT( a, ns, nm, t )    { a, sizeof(a)-1, XML_NAMESPACE_##ns, xmloff::token::nm, t|XML_TYPE_PROP_CHART, 0, SvtSaveOptions::ODFSVER_012_EXT_COMPAT, false }
-#define MAP_ENTRY_ODF_EXT_IMPORT( a, ns, nm, t )    { a, sizeof(a)-1, XML_NAMESPACE_##ns, xmloff::token::nm, t|XML_TYPE_PROP_CHART, 0, SvtSaveOptions::ODFSVER_012_EXT_COMPAT, true }
+#define MAP_ENTRY_ODF_EXT( a, ns, nm, t )    { a, sizeof(a)-1, XML_NAMESPACE_##ns, xmloff::token::nm, t|XML_TYPE_PROP_CHART, 0, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED, false }
+#define MAP_ENTRY_ODF_EXT_IMPORT( a, ns, nm, t )    { a, sizeof(a)-1, XML_NAMESPACE_##ns, xmloff::token::nm, t|XML_TYPE_PROP_CHART, 0, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED, true }
 #define MAP_CONTEXT( a, ns, nm, t, c )       { a, sizeof(a)-1, XML_NAMESPACE_##ns, xmloff::token::nm, t|XML_TYPE_PROP_CHART, c, SvtSaveOptions::ODFSVER_010, false }
 #define MAP_SPECIAL( a, ns, nm, t, c )       { a, sizeof(a)-1, XML_NAMESPACE_##ns, xmloff::token::nm, t|XML_TYPE_PROP_CHART | MID_FLAG_SPECIAL_ITEM, c, SvtSaveOptions::ODFSVER_010, false }
 #define MAP_SPECIAL_ODF12( a, ns, nm, t, c ) { a, sizeof(a)-1, XML_NAMESPACE_##ns, xmloff::token::nm, t|XML_TYPE_PROP_CHART | MID_FLAG_SPECIAL_ITEM, c, SvtSaveOptions::ODFSVER_012, false }
diff --git a/xmloff/source/draw/sdpropls.cxx b/xmloff/source/draw/sdpropls.cxx
index e2b4c5e91a2d..8011d423d319 100644
--- a/xmloff/source/draw/sdpropls.cxx
+++ b/xmloff/source/draw/sdpropls.cxx
@@ -153,10 +153,10 @@ const XMLPropertyMapEntry aXMLSDProperties[] =
     GMAP( "ShadowTransparence",             XML_NAMESPACE_DRAW, XML_SHADOW_OPACITY, XML_TYPE_NEG_PERCENT, 0 ),
 
     // glow attributes
-    GMAPV( "GlowEffect",                       XML_NAMESPACE_LO_EXT, XML_GLOW,                 XML_SD_TYPE_GLOW  , 0, SvtSaveOptions::ODFSVER_012_EXT_COMPAT ),
-    GMAPV( "GlowEffectRad",                    XML_NAMESPACE_LO_EXT, XML_GLOW_RADIUS,          XML_TYPE_MEASURE  , 0, SvtSaveOptions::ODFSVER_012_EXT_COMPAT ),
-    GMAPV( "GlowEffectColor",                  XML_NAMESPACE_LO_EXT, XML_GLOW_COLOR,           XML_TYPE_COLOR    , 0, SvtSaveOptions::ODFSVER_012_EXT_COMPAT ),
-    GMAPV( "GlowEffectTransparency",           XML_NAMESPACE_LO_EXT, XML_GLOW_TRANSPARENCY,    XML_TYPE_PERCENT16, 0, SvtSaveOptions::ODFSVER_012_EXT_COMPAT),
+    GMAPV( "GlowEffect",                       XML_NAMESPACE_LO_EXT, XML_GLOW,                 XML_SD_TYPE_GLOW  , 0, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED),
+    GMAPV( "GlowEffectRad",                    XML_NAMESPACE_LO_EXT, XML_GLOW_RADIUS,          XML_TYPE_MEASURE  , 0, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED),
+    GMAPV( "GlowEffectColor",                  XML_NAMESPACE_LO_EXT, XML_GLOW_COLOR,           XML_TYPE_COLOR    , 0, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED),
+    GMAPV( "GlowEffectTransparency",           XML_NAMESPACE_LO_EXT, XML_GLOW_TRANSPARENCY,    XML_TYPE_PERCENT16, 0, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED),
 
     // graphic attributes
     GMAP( "GraphicColorMode",               XML_NAMESPACE_DRAW, XML_COLOR_MODE,             XML_TYPE_COLOR_MODE, 0 ), // exists in SW, too, with same property name
@@ -250,19 +250,19 @@ const XMLPropertyMapEntry aXMLSDProperties[] =
     GMAP( "FontWorkShadowTransparence",     XML_NAMESPACE_DRAW, XML_FONTWORK_SHADOW_TRANSPARENCE,   XML_TYPE_PERCENT | MID_FLAG_ELEMENT_ITEM_EXPORT,           CTF_FONTWORK_SHADOWTRANSPARENCE ),
 
     // #FontWork# attributes
-    GMAP( "FontWorkStyle",                  XML_NAMESPACE_DRAW_EXT, XML_FONTWORK_STYLE,                 XML_SD_TYPE_FONTWORK_STYLE, CTF_FONTWORK_STYLE  ),
-    GMAP( "FontWorkAdjust",                 XML_NAMESPACE_DRAW_EXT, XML_FONTWORK_ADJUST,                XML_SD_TYPE_FONTWORK_ADJUST,CTF_FONTWORK_ADJUST ),
-    GMAP( "FontWorkDistance",               XML_NAMESPACE_DRAW_EXT, XML_FONTWORK_DISTANCE,              XML_TYPE_MEASURE,           CTF_FONTWORK_DISTANCE   ),
-    GMAP( "FontWorkStart",                  XML_NAMESPACE_DRAW_EXT, XML_FONTWORK_START,                 XML_TYPE_MEASURE,           CTF_FONTWORK_START  ),
-    GMAP( "FontWorkMirror",                 XML_NAMESPACE_DRAW_EXT, XML_FONTWORK_MIRROR,                XML_TYPE_BOOL,              CTF_FONTWORK_MIRROR ),
-    GMAP( "FontWorkOutline",                XML_NAMESPACE_DRAW_EXT, XML_FONTWORK_OUTLINE,               XML_TYPE_BOOL,              CTF_FONTWORK_OUTLINE    ),
-    GMAP( "FontWorkShadow",                 XML_NAMESPACE_DRAW_EXT, XML_FONTWORK_SHADOW,                XML_SD_TYPE_FONTWORK_SHADOW,CTF_FONTWORK_SHADOW ),
-    GMAP( "FontWorkShadowColor",            XML_NAMESPACE_DRAW_EXT, XML_FONTWORK_SHADOW_COLOR,          XML_TYPE_COLOR,             CTF_FONTWORK_SHADOWCOLOR    ),
-    GMAP( "FontWorkShadowOffsetX",          XML_NAMESPACE_DRAW_EXT, XML_FONTWORK_SHADOW_OFFSET_X,       XML_TYPE_MEASURE,           CTF_FONTWORK_SHADOWOFFSETX  ),
-    GMAP( "FontWorkShadowOffsetY",          XML_NAMESPACE_DRAW_EXT, XML_FONTWORK_SHADOW_OFFSET_Y,       XML_TYPE_MEASURE,           CTF_FONTWORK_SHADOWOFFSETY  ),
-    GMAP( "FontWorkForm",                   XML_NAMESPACE_DRAW_EXT, XML_FONTWORK_FORM,                  XML_SD_TYPE_FONTWORK_FORM,  CTF_FONTWORK_FORM   ),
-    GMAP( "FontWorkHideForm",               XML_NAMESPACE_DRAW_EXT, XML_FONTWORK_HIDE_FORM,             XML_TYPE_BOOL,              CTF_FONTWORK_HIDEFORM   ),
-    GMAP( "FontWorkShadowTransparence",     XML_NAMESPACE_DRAW_EXT, XML_FONTWORK_SHADOW_TRANSPARENCE,   XML_TYPE_PERCENT,           CTF_FONTWORK_SHADOWTRANSPARENCE ),
+    GMAPV("FontWorkStyle",              XML_NAMESPACE_DRAW_EXT, XML_FONTWORK_STYLE,                 XML_SD_TYPE_FONTWORK_STYLE, CTF_FONTWORK_STYLE,         SvtSaveOptions::ODFSVER_FUTURE_EXTENDED),
+    GMAPV("FontWorkAdjust",             XML_NAMESPACE_DRAW_EXT, XML_FONTWORK_ADJUST,                XML_SD_TYPE_FONTWORK_ADJUST,CTF_FONTWORK_ADJUST,        SvtSaveOptions::ODFSVER_FUTURE_EXTENDED),
+    GMAPV("FontWorkDistance",           XML_NAMESPACE_DRAW_EXT, XML_FONTWORK_DISTANCE,              XML_TYPE_MEASURE,           CTF_FONTWORK_DISTANCE,      SvtSaveOptions::ODFSVER_FUTURE_EXTENDED),
+    GMAPV("FontWorkStart",              XML_NAMESPACE_DRAW_EXT, XML_FONTWORK_START,                 XML_TYPE_MEASURE,           CTF_FONTWORK_START,         SvtSaveOptions::ODFSVER_FUTURE_EXTENDED),
+    GMAPV("FontWorkMirror",             XML_NAMESPACE_DRAW_EXT, XML_FONTWORK_MIRROR,                XML_TYPE_BOOL,              CTF_FONTWORK_MIRROR,        SvtSaveOptions::ODFSVER_FUTURE_EXTENDED),
+    GMAPV("FontWorkOutline",            XML_NAMESPACE_DRAW_EXT, XML_FONTWORK_OUTLINE,               XML_TYPE_BOOL,              CTF_FONTWORK_OUTLINE,       SvtSaveOptions::ODFSVER_FUTURE_EXTENDED),
+    GMAPV("FontWorkShadow",             XML_NAMESPACE_DRAW_EXT, XML_FONTWORK_SHADOW,                XML_SD_TYPE_FONTWORK_SHADOW,CTF_FONTWORK_SHADOW,        SvtSaveOptions::ODFSVER_FUTURE_EXTENDED),
+    GMAPV("FontWorkShadowColor",        XML_NAMESPACE_DRAW_EXT, XML_FONTWORK_SHADOW_COLOR,          XML_TYPE_COLOR,             CTF_FONTWORK_SHADOWCOLOR,   SvtSaveOptions::ODFSVER_FUTURE_EXTENDED),
+    GMAPV("FontWorkShadowOffsetX",      XML_NAMESPACE_DRAW_EXT, XML_FONTWORK_SHADOW_OFFSET_X,       XML_TYPE_MEASURE,           CTF_FONTWORK_SHADOWOFFSETX, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED),
+    GMAPV("FontWorkShadowOffsetY",      XML_NAMESPACE_DRAW_EXT, XML_FONTWORK_SHADOW_OFFSET_Y,       XML_TYPE_MEASURE,           CTF_FONTWORK_SHADOWOFFSETY, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED),
+    GMAPV("FontWorkForm",               XML_NAMESPACE_DRAW_EXT, XML_FONTWORK_FORM,                  XML_SD_TYPE_FONTWORK_FORM,  CTF_FONTWORK_FORM,          SvtSaveOptions::ODFSVER_FUTURE_EXTENDED),
+    GMAPV("FontWorkHideForm",           XML_NAMESPACE_DRAW_EXT, XML_FONTWORK_HIDE_FORM,             XML_TYPE_BOOL,              CTF_FONTWORK_HIDEFORM,      SvtSaveOptions::ODFSVER_FUTURE_EXTENDED),
+    GMAPV("FontWorkShadowTransparence", XML_NAMESPACE_DRAW_EXT, XML_FONTWORK_SHADOW_TRANSPARENCE,   XML_TYPE_PERCENT,           CTF_FONTWORK_SHADOWTRANSPARENCE, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED),
 
     // control attributes (border exists one more time for the text additions of shapes)
     GMAP( "ControlSymbolColor",             XML_NAMESPACE_DRAW, XML_SYMBOL_COLOR,           XML_TYPE_COLOR, 0 ),
diff --git a/xmloff/source/style/PageMasterStyleMap.cxx b/xmloff/source/style/PageMasterStyleMap.cxx
index 826fd64973cc..ff897d7804d9 100644
--- a/xmloff/source/style/PageMasterStyleMap.cxx
+++ b/xmloff/source/style/PageMasterStyleMap.cxx
@@ -30,9 +30,9 @@ using namespace ::xmloff::token;
 #define PLMAP_12(name,prefix,token,type,context) \
         MAP(name, prefix, token, type|XML_TYPE_PROP_PAGE_LAYOUT, context, SvtSaveOptions::ODFSVER_012)
 #define PLMAP_EXT(name,prefix,token,type,context) \
-        MAP(name, prefix, token, type|XML_TYPE_PROP_PAGE_LAYOUT, context, SvtSaveOptions::ODFSVER_012_EXT_COMPAT)
+        MAP(name, prefix, token, type|XML_TYPE_PROP_PAGE_LAYOUT, context, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED)
 #define PLMAP_EXT_IMPORT(name,prefix,token,type,context) \
-        MAP_IMPORT(name, prefix,token, type|XML_TYPE_PROP_PAGE_LAYOUT, context, SvtSaveOptions::ODFSVER_012_EXT_COMPAT)
+        MAP_IMPORT(name, prefix,token, type|XML_TYPE_PROP_PAGE_LAYOUT, context, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED)
 #define HFMAP(name,prefix,token,type,context) \
         MAP(name, prefix, token, type|XML_TYPE_PROP_HEADER_FOOTER, context, SvtSaveOptions::ODFSVER_010)
 
diff --git a/xmloff/source/style/xmlexppr.cxx b/xmloff/source/style/xmlexppr.cxx
index e94f6744b12d..d2843f71441d 100644
--- a/xmloff/source/style/xmlexppr.cxx
+++ b/xmloff/source/style/xmlexppr.cxx
@@ -588,7 +588,58 @@ vector<XMLPropertyState> SvXMLExportPropertyMapper::Filter_(
             {
                 const SvtSaveOptions::ODFSaneDefaultVersion nEarliestODFVersionForExport(
                         mpImpl->mxPropMapper->GetEarliestODFVersionForExport(i));
-                if (nEarliestODFVersionForExport <= nCurrentVersion)
+                // note: only standard ODF versions are allowed here,
+                // only exception is the unknown future
+                assert((nEarliestODFVersionForExport & SvtSaveOptions::ODFSVER_EXTENDED) == 0
+                    || nEarliestODFVersionForExport == SvtSaveOptions::ODFSVER_FUTURE_EXTENDED);
+                static_assert(SvtSaveOptions::ODFSVER_LATEST_EXTENDED < SvtSaveOptions::ODFSVER_FUTURE_EXTENDED);
+                /// standard ODF namespaces for elements and attributes
+                static sal_uInt16 s_OdfNs[] = {
+                    XML_NAMESPACE_OFFICE,
+                    XML_NAMESPACE_STYLE,
+                    XML_NAMESPACE_TEXT,
+                    XML_NAMESPACE_TABLE,
+                    XML_NAMESPACE_DRAW,
+                    XML_NAMESPACE_FO,
+                    XML_NAMESPACE_XLINK,
+                    XML_NAMESPACE_DC,
+                    XML_NAMESPACE_META,
+                    XML_NAMESPACE_NUMBER,
+                    XML_NAMESPACE_PRESENTATION,
+                    XML_NAMESPACE_SVG,
+                    XML_NAMESPACE_CHART,
+                    XML_NAMESPACE_DR3D,
+                    XML_NAMESPACE_MATH,
+                    XML_NAMESPACE_FORM,
+                    XML_NAMESPACE_SCRIPT,
+                    XML_NAMESPACE_CONFIG,
+                    XML_NAMESPACE_DB,
+                    XML_NAMESPACE_XFORMS,
+                    XML_NAMESPACE_SMIL,
+                    XML_NAMESPACE_ANIMATION,
+                    XML_NAMESPACE_XML,
+                    XML_NAMESPACE_XHTML,
+                    XML_NAMESPACE_GRDDL,
+                };
+                static bool s_Assert(false);
+                if (!s_Assert)
+                {
+                    assert(std::is_sorted(std::begin(s_OdfNs), std::end(s_OdfNs)));
+                    s_Assert = true;
+                }
+                //static_assert(std::is_sorted(std::begin(s_OdfNs), std::end(s_OdfNs)));
+                auto const ns(mpImpl->mxPropMapper->GetEntryNameSpace(i));
+                auto const iter(std::lower_bound(std::begin(s_OdfNs), std::end(s_OdfNs),
+                            ns));
+                bool const isExtension(iter == std::end(s_OdfNs) || *iter != ns
+                        // FIXME: very special hack to suppress style:hyperlink
+                        || (ns == XML_NAMESPACE_STYLE
+                            && mpImpl->mxPropMapper->GetEntryXMLName(i) == GetXMLToken(XML_HYPERLINK)));
+                if (isExtension
+                    ? ((nCurrentVersion & SvtSaveOptions::ODFSVER_EXTENDED)
+                        // if it's in standard ODF, don't export extension
+                        && (nCurrentVersion < nEarliestODFVersionForExport))
+                    : (nEarliestODFVersionForExport <= nCurrentVersion))
                 {
                     pFilterInfo->AddProperty(rAPIName, i);
                 }
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()
 };
 


More information about the Libreoffice-commits mailing list