diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2019-11-25 14:15:48 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-11-26 21:49:01 +0100 |
commit | 508dce40f8fda55767b9f78251725e225db2bd2f (patch) | |
tree | 002993a13640f5b1c27ac33cd4836b0cced66501 /include/xmloff | |
parent | c8afb4000f178badaf63c2f38fd3fbc12ec832f3 (diff) |
xmloff,sw: fix handling of invalid attribute with multiple ':'
ooo53770-1.odt contains an invalid attribute
style:style:use-optimal-row-height, which was round-tripped as an
unknown attribute, triggering the assert in CheckValidName().
This reveals a confusing mess of SvXMLNamespaceMap::GetKeyByAttrName
functions.
The bCache flag for one of them was accidentally inverted in commit
78f0d15893c56d7368ddd7ded4e70f2a3bb9d2f4 "loplugin:constantparam in xmloff/"
There are basically 2 use cases for this:
* XML element and attribute names, which are XML QName and contain at
most 1 ':'
* XML attribute values, which are namespace-prefixed and may contain
any number of ':' in the "local" part of the value
Because caching is explicitly disabled for Calc formulas, just resolve
the inconsistent bCache by always caching element and attribute names,
and never caching attribute values, so we need just 1 flag.
Change-Id: I363ea2229d0bf5c7199d61b0fee0d9f168911bfa
Reviewed-on: https://gerrit.libreoffice.org/83619
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'include/xmloff')
-rw-r--r-- | include/xmloff/nmspmap.hxx | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/include/xmloff/nmspmap.hxx b/include/xmloff/nmspmap.hxx index 140dacdbb446..668bfd22745c 100644 --- a/include/xmloff/nmspmap.hxx +++ b/include/xmloff/nmspmap.hxx @@ -104,15 +104,14 @@ public: OUString GetAttrNameByKey( sal_uInt16 nKey ) const; - /* This will replace the version with the unused 5th default parameter */ - sal_uInt16 GetKeyByAttrName_( const OUString& rAttrName, + enum class QNameMode { AttrNameCached, AttrValue }; + sal_uInt16 GetKeyByQName(const OUString& rQName, OUString *pPrefix, OUString *pLocalName, - OUString *pNamespace = nullptr, - bool bCache = true) const; + OUString *pNamespace, + QNameMode eMode) const; - /* This will replace the version with the unused 3rd default parameter */ - sal_uInt16 GetKeyByAttrName_( const OUString& rAttrName, + sal_uInt16 GetKeyByAttrValueQName(const OUString& rAttrName, OUString *pLocalName) const; sal_uInt16 GetFirstKey() const; @@ -138,7 +137,7 @@ public: /* deprecated */ OUString GetAttrNameByIndex( sal_uInt16 nIdx ) const; /* deprecated */ OUString GetQNameByIndex( sal_uInt16 nIdx, const OUString& rLocalName ) const; -/* deprecated */ sal_uInt16 GetKeyByAttrName( const OUString& rAttrName, + sal_uInt16 GetKeyByAttrName( const OUString& rAttrName, OUString *pPrefix, OUString *pLocalName, OUString *pNamespace ) const; |