[Libreoffice-commits] core.git: xmloff/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Sat Nov 21 12:54:33 UTC 2020


 xmloff/source/text/XMLChangeInfoContext.cxx |   37 +++++++++++++---------------
 xmloff/source/text/XMLChangeInfoContext.hxx |    7 ++---
 2 files changed, 21 insertions(+), 23 deletions(-)

New commits:
commit 4486ab59348ddbfa4b050195477c2842c0a7de0a
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Fri Nov 20 17:22:09 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Nov 21 13:53:46 2020 +0100

    fastparser in XMLChangeInfoContext
    
    Change-Id: I8e3e2bfc94f59b19b99299a7696b435f8d39b290
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106279
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

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;
 


More information about the Libreoffice-commits mailing list