diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-28 16:16:34 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-29 19:35:52 +0200 |
commit | 3e9bef4b6ef2e1b467b46f5579b5fce201015d83 (patch) | |
tree | bb48254079b2277a108e4ba44428ab1c56248208 /xmloff | |
parent | ab846145bbd56f4308c8657df8b1354a403edd74 (diff) |
simplify handling of comparing XML_NAMESPACE values
Change-Id: I18bbf1ee206285842250891ce556d523489855b1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93075
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/draw/animationimport.cxx | 12 | ||||
-rw-r--r-- | xmloff/source/draw/ximppage.cxx | 2 | ||||
-rw-r--r-- | xmloff/source/meta/xmlmetai.cxx | 2 | ||||
-rw-r--r-- | xmloff/source/script/xmlbasicscript.cxx | 6 |
4 files changed, 11 insertions, 11 deletions
diff --git a/xmloff/source/draw/animationimport.cxx b/xmloff/source/draw/animationimport.cxx index cfbfee630261..ebccff3d1a22 100644 --- a/xmloff/source/draw/animationimport.cxx +++ b/xmloff/source/draw/animationimport.cxx @@ -562,7 +562,8 @@ void AnimationNodeContext::init_node( const css::uno::Reference< css::xml::sax: for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList )) { OUString rValue = aIter.toString(); - switch( aIter.getToken() ) + auto nToken = aIter.getToken(); + switch( nToken ) { case XML_ELEMENT(SMIL, XML_BEGIN): case XML_ELEMENT(SMIL_COMPAT, XML_BEGIN): @@ -1077,12 +1078,11 @@ void AnimationNodeContext::init_node( const css::uno::Reference< css::xml::sax: default: { - auto nNamespace = (aIter.getToken() & NMSP_MASK); // push all unknown attributes within the presentation namespace as user data - if (nNamespace == NAMESPACE_TOKEN(XML_NAMESPACE_PRESENTATION) - || nNamespace == NAMESPACE_TOKEN(XML_NAMESPACE_PRESENTATION_SO52) - || nNamespace == NAMESPACE_TOKEN(XML_NAMESPACE_PRESENTATION_OASIS) - || nNamespace == NAMESPACE_TOKEN(XML_NAMESPACE_PRESENTATION_OOO)) + if (IsTokenInNamespace(nToken, XML_NAMESPACE_PRESENTATION) + || IsTokenInNamespace(nToken, XML_NAMESPACE_PRESENTATION_SO52) + || IsTokenInNamespace(nToken, XML_NAMESPACE_PRESENTATION_OASIS) + || IsTokenInNamespace(nToken, XML_NAMESPACE_PRESENTATION_OOO)) { aUserData.emplace_back( SvXMLImport::getNameFromToken(aIter.getToken()), makeAny( rValue ) ); } diff --git a/xmloff/source/draw/ximppage.cxx b/xmloff/source/draw/ximppage.cxx index 23a89e943f2d..e803eda3a8f5 100644 --- a/xmloff/source/draw/ximppage.cxx +++ b/xmloff/source/draw/ximppage.cxx @@ -144,7 +144,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > DrawAnnotationContext: { if( mxAnnotation.is() ) { - if ((nElement & NMSP_MASK) == NAMESPACE_TOKEN(XML_NAMESPACE_DC)) + if (IsTokenInNamespace(nElement, XML_NAMESPACE_DC)) { if( (nElement & TOKEN_MASK) == XML_CREATOR ) return new XMLStringBufferImportContext(GetImport(), maAuthorBuffer); diff --git a/xmloff/source/meta/xmlmetai.cxx b/xmloff/source/meta/xmlmetai.cxx index 715bd0ba052b..20fcfb38cdf9 100644 --- a/xmloff/source/meta/xmlmetai.cxx +++ b/xmloff/source/meta/xmlmetai.cxx @@ -216,7 +216,7 @@ void SAL_CALL SvXMLMetaDocumentContext::characters( const OUString& /*rChars*/ ) uno::Reference< xml::sax::XFastContextHandler > SAL_CALL SvXMLMetaDocumentContext::createFastChildContext( sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList ) { - if ( nElement == ( NAMESPACE_TOKEN( XML_NAMESPACE_OFFICE ) | XML_META ) ) + if ( nElement == XML_ELEMENT(OFFICE, XML_META) ) return new XMLDocumentBuilderContext( GetImport(), nElement, xAttrList, mxDocBuilder); return nullptr; diff --git a/xmloff/source/script/xmlbasicscript.cxx b/xmloff/source/script/xmlbasicscript.cxx index 3c1ea97dbccb..efc655eca682 100644 --- a/xmloff/source/script/xmlbasicscript.cxx +++ b/xmloff/source/script/xmlbasicscript.cxx @@ -109,7 +109,7 @@ Reference<XFastContextHandler> BasicLibrariesElement::createFastChildContext(sal_Int32 nElement, const Reference<XFastAttributeList>& xAttributes) { - if ((nElement & NMSP_MASK) != NAMESPACE_TOKEN(XML_NAMESPACE_OOO)) + if (!IsTokenInNamespace(nElement, XML_NAMESPACE_OOO)) { throw xml::sax::SAXException("illegal namespace!", Reference<XInterface>(), Any()); } @@ -211,7 +211,7 @@ BasicEmbeddedLibraryElement::BasicEmbeddedLibraryElement( Reference<XFastContextHandler> BasicEmbeddedLibraryElement::createFastChildContext( sal_Int32 nElement, const Reference<XFastAttributeList>& xAttributes) { - if ((nElement & NMSP_MASK) != NAMESPACE_TOKEN(XML_NAMESPACE_OOO)) + if (!IsTokenInNamespace(nElement, XML_NAMESPACE_OOO)) { throw xml::sax::SAXException("illegal namespace!", Reference<XInterface>(), Any()); } @@ -253,7 +253,7 @@ BasicModuleElement::createFastChildContext(sal_Int32 nElement, { // TODO: <byte-code> - if ((nElement & NMSP_MASK) != NAMESPACE_TOKEN(XML_NAMESPACE_OOO)) + if (!IsTokenInNamespace(nElement, XML_NAMESPACE_OOO)) { throw xml::sax::SAXException("illegal namespace!", Reference<XInterface>(), Any()); } |