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

Noel (via logerrit) logerrit at kemper.freedesktop.org
Tue Dec 1 17:01:25 UTC 2020


 xmloff/source/text/XMLIndexTOCStylesContext.cxx |   18 +++++++-----------
 xmloff/source/text/XMLIndexTOCStylesContext.hxx |    5 +++--
 2 files changed, 10 insertions(+), 13 deletions(-)

New commits:
commit 22382bd480d40338207d5cb02787a37a72b95299
Author:     Noel <noelgrandin at gmail.com>
AuthorDate: Tue Dec 1 10:30:06 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Dec 1 18:00:29 2020 +0100

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

diff --git a/xmloff/source/text/XMLIndexTOCStylesContext.cxx b/xmloff/source/text/XMLIndexTOCStylesContext.cxx
index d761027b57af..830369240e7c 100644
--- a/xmloff/source/text/XMLIndexTOCStylesContext.cxx
+++ b/xmloff/source/text/XMLIndexTOCStylesContext.cxx
@@ -54,29 +54,25 @@ XMLIndexTOCStylesContext::~XMLIndexTOCStylesContext()
 {
 }
 
-void XMLIndexTOCStylesContext::StartElement(
-    const Reference<XAttributeList> & xAttrList )
+void XMLIndexTOCStylesContext::startFastElement(
+    sal_Int32 /*nElement*/,
+    const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
 {
     // find text:outline-level attribute
-    sal_Int16 nCount = xAttrList->getLength();
-    for(sal_Int16 nAttr = 0; nAttr < nCount; 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) &&
-             (IsXMLToken(sLocalName, XML_OUTLINE_LEVEL)) )
+        if ( aIter.getToken() == XML_ELEMENT(TEXT, XML_OUTLINE_LEVEL) )
         {
             sal_Int32 nTmp;
             if (::sax::Converter::convertNumber(
-                    nTmp, xAttrList->getValueByIndex(nAttr), 1,
+                    nTmp, aIter.toString(), 1,
                     GetImport().GetTextImport()->GetChapterNumbering()->
                                                                 getCount()))
             {
                 // API numbers 0..9, we number 1..10
                 nOutlineLevel = nTmp-1;
             }
+            break;
         }
     }
 }
diff --git a/xmloff/source/text/XMLIndexTOCStylesContext.hxx b/xmloff/source/text/XMLIndexTOCStylesContext.hxx
index bf18d7e64d71..fe588b933112 100644
--- a/xmloff/source/text/XMLIndexTOCStylesContext.hxx
+++ b/xmloff/source/text/XMLIndexTOCStylesContext.hxx
@@ -60,8 +60,9 @@ public:
 
 protected:
 
-    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;
 
     virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
 


More information about the Libreoffice-commits mailing list