From 508dce40f8fda55767b9f78251725e225db2bd2f Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 25 Nov 2019 14:15:48 +0100 Subject: xmloff,sw: fix handling of invalid attribute with multiple ':' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Tested-by: Caolán McNamara --- include/xmloff/nmspmap.hxx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'include') 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; -- cgit v1.2.3