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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Sat Nov 14 19:16:20 UTC 2020


 xmloff/source/draw/XMLImageMapContext.cxx |   47 ++++++++++++++----------------
 1 file changed, 22 insertions(+), 25 deletions(-)

New commits:
commit 4cc03d53ff5e72739f3cfb6fd3d713e4bb263f31
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sat Nov 14 18:04:18 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Nov 14 20:15:30 2020 +0100

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

diff --git a/xmloff/source/draw/XMLImageMapContext.cxx b/xmloff/source/draw/XMLImageMapContext.cxx
index 0585bd60407f..4852fbc19af4 100644
--- a/xmloff/source/draw/XMLImageMapContext.cxx
+++ b/xmloff/source/draw/XMLImageMapContext.cxx
@@ -127,10 +127,9 @@ public:
 
     virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
 
-    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 >& AttrList ) override;
 
 protected:
 
@@ -207,30 +206,28 @@ void XMLImageMapObjectContext::endFastElement(sal_Int32 )
     // else: not valid -> don't create and insert
 }
 
-SvXMLImportContextRef XMLImageMapObjectContext::CreateChildContext(
-    sal_uInt16 nPrefix,
-    const OUString& rLocalName,
-    const Reference<XAttributeList> & /*xAttrList*/ )
+css::uno::Reference< css::xml::sax::XFastContextHandler > XMLImageMapObjectContext::createFastChildContext(
+    sal_Int32 nElement,
+    const css::uno::Reference< css::xml::sax::XFastAttributeList >&  )
 {
-    if ( (XML_NAMESPACE_OFFICE == nPrefix) &&
-         IsXMLToken(rLocalName, XML_EVENT_LISTENERS) )
-    {
-        Reference<XEventsSupplier> xEvents( xMapEntry, UNO_QUERY );
-        return new XMLEventsImportContext(
-            GetImport(), nPrefix, rLocalName, xEvents);
-    }
-    else if ( (XML_NAMESPACE_SVG == nPrefix) &&
-              IsXMLToken(rLocalName, XML_TITLE) )
-    {
-        return new XMLStringBufferImportContext(
-            GetImport(), nPrefix, rLocalName, sTitleBuffer);
-    }
-    else if ( (XML_NAMESPACE_SVG == nPrefix) &&
-              IsXMLToken(rLocalName, XML_DESC) )
+    switch (nElement)
     {
-        return new XMLStringBufferImportContext(
-            GetImport(), nPrefix, rLocalName, sDescriptionBuffer);
+        case XML_ELEMENT(OFFICE, XML_EVENT_LISTENERS):
+        {
+            Reference<XEventsSupplier> xEvents( xMapEntry, UNO_QUERY );
+            return new XMLEventsImportContext(
+                GetImport(), xEvents);
+        }
+        case XML_ELEMENT(SVG, XML_TITLE):
+        case XML_ELEMENT(SVG_COMPAT, XML_TITLE):
+            return new XMLStringBufferImportContext(
+                GetImport(), sTitleBuffer);
+        case XML_ELEMENT(SVG, XML_DESC):
+        case XML_ELEMENT(SVG_COMPAT, XML_DESC):
+            return new XMLStringBufferImportContext(
+                GetImport(), sDescriptionBuffer);
     }
+    XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
     return nullptr;
 }
 


More information about the Libreoffice-commits mailing list