diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-11-20 17:22:09 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-11-21 13:53:46 +0100 |
commit | 4486ab59348ddbfa4b050195477c2842c0a7de0a (patch) | |
tree | c43bc38aadddfd45a454300eaaa9331e6e0bab90 /xmloff | |
parent | 8cbb22c4679f0922ea2b28372678357e77b55b42 (diff) |
fastparser in XMLChangeInfoContext
Change-Id: I8e3e2bfc94f59b19b99299a7696b435f8d39b290
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106279
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/text/XMLChangeInfoContext.cxx | 37 | ||||
-rw-r--r-- | xmloff/source/text/XMLChangeInfoContext.hxx | 7 |
2 files changed, 21 insertions, 23 deletions
diff --git a/xmloff/source/text/XMLChangeInfoContext.cxx b/xmloff/source/text/XMLChangeInfoContext.cxx index e50d9fbeff5e..fd51c12f55d5 100644 --- a/xmloff/source/text/XMLChangeInfoContext.cxx +++ b/xmloff/source/text/XMLChangeInfoContext.cxx @@ -24,6 +24,7 @@ #include <xmloff/xmlnamespace.hxx> #include <xmloff/xmltoken.hxx> #include <xmloff/xmlimp.hxx> +#include <sal/log.hxx> using namespace ::xmloff::token; @@ -48,31 +49,29 @@ XMLChangeInfoContext::~XMLChangeInfoContext() { } -SvXMLImportContextRef XMLChangeInfoContext::CreateChildContext( - sal_uInt16 nPrefix, - const OUString& rLocalName, - const Reference<XAttributeList >& /*xAttrList*/ ) +css::uno::Reference< css::xml::sax::XFastContextHandler > XMLChangeInfoContext::createFastChildContext( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) { SvXMLImportContextRef xContext; - if( XML_NAMESPACE_DC == nPrefix ) - { - if( IsXMLToken( rLocalName, XML_CREATOR ) ) - xContext = new XMLStringBufferImportContext(GetImport(), nPrefix, - rLocalName, sAuthorBuffer); - else if( IsXMLToken( rLocalName, XML_DATE ) ) - xContext = new XMLStringBufferImportContext(GetImport(), nPrefix, - rLocalName, sDateTimeBuffer); - } - else if ( ( XML_NAMESPACE_TEXT == nPrefix || - XML_NAMESPACE_LO_EXT == nPrefix ) && - IsXMLToken( rLocalName, XML_P ) ) + switch (nElement) { - xContext = new XMLStringBufferImportContext(GetImport(), nPrefix, - rLocalName, sCommentBuffer); + case XML_ELEMENT(DC, XML_CREATOR): + xContext = new XMLStringBufferImportContext(GetImport(), sAuthorBuffer); + break; + case XML_ELEMENT(DC, XML_DATE): + xContext = new XMLStringBufferImportContext(GetImport(), sDateTimeBuffer); + break; + case XML_ELEMENT(TEXT, XML_P): + case XML_ELEMENT(LO_EXT, XML_P): + xContext = new XMLStringBufferImportContext(GetImport(), sCommentBuffer); + break; + default: + XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement); } - return xContext; + return xContext.get(); } void XMLChangeInfoContext::endFastElement(sal_Int32 ) diff --git a/xmloff/source/text/XMLChangeInfoContext.hxx b/xmloff/source/text/XMLChangeInfoContext.hxx index 2c7bb3fd7c56..1c2d9356c284 100644 --- a/xmloff/source/text/XMLChangeInfoContext.hxx +++ b/xmloff/source/text/XMLChangeInfoContext.hxx @@ -60,10 +60,9 @@ public: virtual ~XMLChangeInfoContext() override; - virtual SvXMLImportContextRef CreateChildContext( - sal_uInt16 nPrefix, - const OUString& rLocalName, - const css::uno::Reference<css::xml::sax::XAttributeList >& xAttrList ) override; + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override; virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; |