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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Nov 25 07:57:40 UTC 2020


 xmloff/source/text/XMLIndexTOCStylesContext.cxx |   23 ++++++++---------------
 xmloff/source/text/XMLIndexTOCStylesContext.hxx |    7 +++----
 2 files changed, 11 insertions(+), 19 deletions(-)

New commits:
commit dba2a0435fb8aa1c5a312261fc10959e824230c6
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Tue Nov 24 20:27:03 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Nov 25 08:56:57 2020 +0100

    fastparser in XMLIndexTOCStylesContext
    
    Change-Id: I59f6a044da134fe1ce6ffe415df518dce9272b53
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106549
    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 36621df0770e..d761027b57af 100644
--- a/xmloff/source/text/XMLIndexTOCStylesContext.cxx
+++ b/xmloff/source/text/XMLIndexTOCStylesContext.cxx
@@ -106,27 +106,20 @@ void XMLIndexTOCStylesContext::endFastElement(sal_Int32 )
     xIndexReplace->replaceByIndex(nOutlineLevel, Any(aStyleNamesSequence));
 }
 
-SvXMLImportContextRef XMLIndexTOCStylesContext::CreateChildContext(
-    sal_uInt16 p_nPrefix,
-    const OUString& rLocalName,
-    const Reference<XAttributeList> & xAttrList )
+css::uno::Reference< css::xml::sax::XFastContextHandler > XMLIndexTOCStylesContext::createFastChildContext(
+    sal_Int32 nElement,
+    const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
 {
     // check for index-source-style
-    if ( (XML_NAMESPACE_TEXT == p_nPrefix) &&
-         IsXMLToken( rLocalName, XML_INDEX_SOURCE_STYLE ) )
+    if ( nElement == XML_ELEMENT(TEXT, XML_INDEX_SOURCE_STYLE) )
     {
         // find text:style-name attribute and record in aStyleNames
-        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_STYLE_NAME ) )
+            if ( aIter.getToken() == XML_ELEMENT(TEXT, XML_STYLE_NAME) )
             {
-                aStyleNames.push_back(xAttrList->getValueByIndex(nAttr));
+                aStyleNames.push_back(aIter.toString());
+                break;
             }
         }
     }
diff --git a/xmloff/source/text/XMLIndexTOCStylesContext.hxx b/xmloff/source/text/XMLIndexTOCStylesContext.hxx
index 6714c828709c..bf18d7e64d71 100644
--- a/xmloff/source/text/XMLIndexTOCStylesContext.hxx
+++ b/xmloff/source/text/XMLIndexTOCStylesContext.hxx
@@ -65,10 +65,9 @@ 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 >& xAttrList ) override;
 };
 
 #endif


More information about the Libreoffice-commits mailing list