summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2019-11-25 14:15:48 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-11-26 21:49:01 +0100
commit508dce40f8fda55767b9f78251725e225db2bd2f (patch)
tree002993a13640f5b1c27ac33cd4836b0cced66501 /sw
parentc8afb4000f178badaf63c2f38fd3fbc12ec832f3 (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 'sw')
-rw-r--r--sw/source/filter/xml/xmlimpit.cxx2
-rw-r--r--sw/source/filter/xml/xmltbli.cxx2
2 files changed, 2 insertions, 2 deletions
diff --git a/sw/source/filter/xml/xmlimpit.cxx b/sw/source/filter/xml/xmlimpit.cxx
index 1da664861205..4db664b1c84c 100644
--- a/sw/source/filter/xml/xmlimpit.cxx
+++ b/sw/source/filter/xml/xmlimpit.cxx
@@ -150,7 +150,7 @@ void SvXMLImportItemMapper::importXML( SfxItemSet& rSet,
rNamespaceMap );
}
}
- else if( USHRT_MAX != nUnknownWhich )
+ else if (USHRT_MAX != nUnknownWhich && !aLocalName.isEmpty())
{
if( !pUnknownItem )
{
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index db95b73a328b..5873e9a6bf19 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -491,7 +491,7 @@ SwXMLTableCellContext_Impl::SwXMLTableCellContext_Impl(
{
OUString sTmp;
const sal_uInt16 nPrefix2 = GetImport().GetNamespaceMap().
- GetKeyByAttrName_( rValue, &sTmp );
+ GetKeyByAttrValueQName(rValue, &sTmp);
m_sFormula = XML_NAMESPACE_OOOW == nPrefix2 ? sTmp : rValue;
}
break;