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

Noel (via logerrit) logerrit at kemper.freedesktop.org
Tue Dec 1 11:20:06 UTC 2020


 xmloff/source/text/XMLIndexBibliographyEntryContext.cxx |   29 +++++++---------
 xmloff/source/text/XMLIndexBibliographyEntryContext.hxx |    5 +-
 2 files changed, 17 insertions(+), 17 deletions(-)

New commits:
commit 3b594e1e50bdc2ad374321fa3da304596bb15ffa
Author:     Noel <noelgrandin at gmail.com>
AuthorDate: Tue Dec 1 10:19:34 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Dec 1 12:19:27 2020 +0100

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

diff --git a/xmloff/source/text/XMLIndexBibliographyEntryContext.cxx b/xmloff/source/text/XMLIndexBibliographyEntryContext.cxx
index af5886fe559d..c9bd4eabbce3 100644
--- a/xmloff/source/text/XMLIndexBibliographyEntryContext.cxx
+++ b/xmloff/source/text/XMLIndexBibliographyEntryContext.cxx
@@ -27,6 +27,7 @@
 #include <xmloff/xmluconv.hxx>
 #include <xmloff/xmlement.hxx>
 #include <com/sun/star/text/BibliographyDataField.hpp>
+#include <sal/log.hxx>
 
 
 using namespace ::com::sun::star::text;
@@ -91,35 +92,33 @@ const SvXMLEnumMapEntry<sal_uInt16> aBibliographyDataFieldMap[] =
     { XML_TOKEN_INVALID, 0 }
 };
 
-void XMLIndexBibliographyEntryContext::StartElement(
-    const Reference<XAttributeList> & xAttrList)
+void XMLIndexBibliographyEntryContext::startFastElement(
+    sal_Int32 /*nElement*/,
+    const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
 {
     // handle both, style name and bibliography info
-    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 (XML_NAMESPACE_TEXT == nPrefix)
+        switch(aIter.getToken())
         {
-            if ( IsXMLToken( sLocalName, XML_STYLE_NAME ) )
+            case XML_ELEMENT(TEXT, XML_STYLE_NAME):
             {
-                m_sCharStyleName = xAttrList->getValueByIndex(nAttr);
+                m_sCharStyleName = aIter.toString();
                 m_bCharStyleNameOK = true;
+                break;
             }
-            else if ( IsXMLToken( sLocalName, XML_BIBLIOGRAPHY_DATA_FIELD ) )
+            case XML_ELEMENT(TEXT, XML_BIBLIOGRAPHY_DATA_FIELD):
             {
                 sal_uInt16 nTmp;
-                if (SvXMLUnitConverter::convertEnum(
-                    nTmp, xAttrList->getValueByIndex(nAttr),
-                    aBibliographyDataFieldMap))
+                if (SvXMLUnitConverter::convertEnum(nTmp, aIter.toString(), aBibliographyDataFieldMap))
                 {
                     nBibliographyInfo = nTmp;
                     bBibliographyInfoOK = true;
                 }
+                break;
             }
+            default:
+                XMLOFF_WARN_UNKNOWN("xmloff", aIter);
         }
     }
 
diff --git a/xmloff/source/text/XMLIndexBibliographyEntryContext.hxx b/xmloff/source/text/XMLIndexBibliographyEntryContext.hxx
index 97546c0759dd..0314dc899b7f 100644
--- a/xmloff/source/text/XMLIndexBibliographyEntryContext.hxx
+++ b/xmloff/source/text/XMLIndexBibliographyEntryContext.hxx
@@ -55,8 +55,9 @@ public:
 protected:
 
     /** process parameters */
-    virtual void StartElement(
-        const css::uno::Reference<css::xml::sax::XAttributeList> & xAttrList) override;
+    virtual void SAL_CALL startFastElement(
+        sal_Int32 nElement,
+        const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
 
     /** call FillPropertyValues and insert into template */
     virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;


More information about the Libreoffice-commits mailing list