xmloff/source/text/XMLFootnoteBodyImportContext.cxx |    7 +--
 xmloff/source/text/XMLFootnoteBodyImportContext.hxx |    6 ---
 xmloff/source/text/XMLFootnoteImportContext.cxx     |   38 +++++++-------------
 xmloff/source/text/XMLFootnoteImportContext.hxx     |    6 +--
 4 files changed, 19 insertions(+), 38 deletions(-)

New commits:
commit 818be5ed71d6c4eb515c907add4179100eed6072
Author:     Noel <noelgran...@gmail.com>
AuthorDate: Fri Nov 27 14:56:19 2020 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sat Nov 28 06:53:45 2020 +0100

    fastparser in XMLFootnoteBodyImportContext
    
    Change-Id: Id822765b23c7251f89f2c3f24136cf5f14762449
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106769
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/xmloff/source/text/XMLFootnoteBodyImportContext.cxx 
b/xmloff/source/text/XMLFootnoteBodyImportContext.cxx
index dc560f624c10..8b0268318355 100644
--- a/xmloff/source/text/XMLFootnoteBodyImportContext.cxx
+++ b/xmloff/source/text/XMLFootnoteBodyImportContext.cxx
@@ -28,11 +28,8 @@ using ::com::sun::star::uno::Reference;
 using ::com::sun::star::xml::sax::XAttributeList;
 
 
-XMLFootnoteBodyImportContext::XMLFootnoteBodyImportContext(
-    SvXMLImport& rImport,
-    sal_uInt16 nPrfx,
-    const OUString& rLocalName ) :
-        SvXMLImportContext(rImport, nPrfx, rLocalName)
+XMLFootnoteBodyImportContext::XMLFootnoteBodyImportContext( SvXMLImport& 
rImport ) :
+        SvXMLImportContext(rImport)
 {
 }
 
diff --git a/xmloff/source/text/XMLFootnoteBodyImportContext.hxx 
b/xmloff/source/text/XMLFootnoteBodyImportContext.hxx
index 647867a5cdcf..19007558899e 100644
--- a/xmloff/source/text/XMLFootnoteBodyImportContext.hxx
+++ b/xmloff/source/text/XMLFootnoteBodyImportContext.hxx
@@ -37,11 +37,7 @@ class XMLFootnoteBodyImportContext : public 
SvXMLImportContext
 
 public:
 
-
-    XMLFootnoteBodyImportContext(
-        SvXMLImport& rImport,
-        sal_uInt16 nPrfx,
-        const OUString& rLocalName );
+    XMLFootnoteBodyImportContext( SvXMLImport& rImport );
 
 protected:
 
diff --git a/xmloff/source/text/XMLFootnoteImportContext.cxx 
b/xmloff/source/text/XMLFootnoteImportContext.cxx
index 645e910c8a36..95a30097675e 100644
--- a/xmloff/source/text/XMLFootnoteImportContext.cxx
+++ b/xmloff/source/text/XMLFootnoteImportContext.cxx
@@ -34,6 +34,7 @@
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/text/XFootnote.hpp>
+#include <sal/log.hxx>
 
 
 using namespace ::com::sun::star::uno;
@@ -164,49 +165,38 @@ void XMLFootnoteImportContext::endFastElement(sal_Int32 )
     }
 }
 
-SvXMLImportContextRef XMLFootnoteImportContext::CreateChildContext(
-    sal_uInt16 p_nPrefix,
-    const OUString& rLocalName,
-    const Reference<XAttributeList> & xAttrList )
+css::uno::Reference< css::xml::sax::XFastContextHandler > 
XMLFootnoteImportContext::createFastChildContext(
+    sal_Int32 nElement, const css::uno::Reference< 
css::xml::sax::XFastAttributeList >& xAttrList )
 {
     SvXMLImportContextRef xContext;
 
-    static const SvXMLTokenMap aTokenMap(aFootnoteChildTokenMap);
-
-    switch(aTokenMap.Get(p_nPrefix, rLocalName))
+    switch(nElement)
     {
-        case XML_TOK_FTN_NOTE_CITATION:
+        case XML_ELEMENT(TEXT, XML_NOTE_CITATION):
         {
             // little hack: we only care for one attribute of the citation
             //              element. We handle that here, and then return a
             //              default context.
-            sal_Int16 nLength = xAttrList->getLength();
-            for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++)
+            for( auto& aIter : 
sax_fastparser::castToFastAttributeList(xAttrList) )
             {
-                OUString sLocalName;
-                sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
-                    GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
-                                      &sLocalName );
-
-                if ( (nPrefix == XML_NAMESPACE_TEXT) &&
-                     IsXMLToken( sLocalName, XML_LABEL ) )
-                {
-                    xFootnote->setLabel(xAttrList->getValueByIndex(nAttr));
-                }
+                if ( aIter.getToken() == XML_ELEMENT(TEXT, XML_LABEL) )
+                    xFootnote->setLabel(aIter.toString());
             }
 
             // ignore content: return default context
             break;
         }
 
-        case XML_TOK_FTN_NOTE_BODY:
+        case XML_ELEMENT(TEXT, XML_NOTE_BODY):
             // return footnote body
-            xContext = new XMLFootnoteBodyImportContext(GetImport(),
-                                                        p_nPrefix, rLocalName);
+            xContext = new XMLFootnoteBodyImportContext(GetImport());
             break;
+
+        default:
+            XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
     }
 
-    return xContext;
+    return xContext.get();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLFootnoteImportContext.hxx 
b/xmloff/source/text/XMLFootnoteImportContext.hxx
index 72ad330c876a..ff2acc296988 100644
--- a/xmloff/source/text/XMLFootnoteImportContext.hxx
+++ b/xmloff/source/text/XMLFootnoteImportContext.hxx
@@ -66,10 +66,8 @@ protected:
 
     virtual void SAL_CALL endFastElement(sal_Int32 nElement) 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 >& AttrList ) override;
 
 };
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to