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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Tue Dec 1 06:59:09 UTC 2020


 xmloff/source/text/XMLTrackedChangesImportContext.cxx |   24 ++++++------------
 xmloff/source/text/XMLTrackedChangesImportContext.hxx |    6 +---
 2 files changed, 10 insertions(+), 20 deletions(-)

New commits:
commit 7f9215bb187f796537660e43ca6273c4fa5e28fa
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Mon Nov 30 20:17:34 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Dec 1 07:58:28 2020 +0100

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

diff --git a/xmloff/source/text/XMLTrackedChangesImportContext.cxx b/xmloff/source/text/XMLTrackedChangesImportContext.cxx
index fa29ed331d84..b08743a1d57f 100644
--- a/xmloff/source/text/XMLTrackedChangesImportContext.cxx
+++ b/xmloff/source/text/XMLTrackedChangesImportContext.cxx
@@ -45,30 +45,22 @@ XMLTrackedChangesImportContext::~XMLTrackedChangesImportContext()
 {
 }
 
-void XMLTrackedChangesImportContext::StartElement(
-    const Reference<XAttributeList> & xAttrList )
+void XMLTrackedChangesImportContext::startFastElement( sal_Int32 /*nElement*/,
+    const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
 {
     bool bTrackChanges = true;
 
     // scan for text:track-changes and text:protection-key attributes
-    sal_Int16 nLength = xAttrList->getLength();
-    for( sal_Int16 i = 0; i < nLength; i++ )
+    for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
     {
-        OUString sLocalName;
-        sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
-            GetKeyByAttrName( xAttrList->getNameByIndex(i), &sLocalName );
-
-        if ( XML_NAMESPACE_TEXT == nPrefix )
+        if (aIter.getToken() == XML_ELEMENT(TEXT, XML_TRACK_CHANGES) )
         {
-            if ( IsXMLToken( sLocalName, XML_TRACK_CHANGES ) )
+            bool bTmp(false);
+            if (::sax::Converter::convertBool(bTmp, aIter.toString()))
             {
-                bool bTmp(false);
-                if (::sax::Converter::convertBool(
-                    bTmp, xAttrList->getValueByIndex(i)) )
-                {
-                    bTrackChanges = bTmp;
-                }
+                bTrackChanges = bTmp;
             }
+            break;
         }
     }
 
diff --git a/xmloff/source/text/XMLTrackedChangesImportContext.hxx b/xmloff/source/text/XMLTrackedChangesImportContext.hxx
index 8a07d788cbed..cbef26c59cbf 100644
--- a/xmloff/source/text/XMLTrackedChangesImportContext.hxx
+++ b/xmloff/source/text/XMLTrackedChangesImportContext.hxx
@@ -24,7 +24,6 @@
 #include <xmloff/xmlictxt.hxx>
 #include <com/sun/star/uno/Reference.h>
 
-
 namespace com::sun::star {
     namespace xml::sax {
         class XAttributeList;
@@ -35,7 +34,6 @@ class XMLTrackedChangesImportContext : public SvXMLImportContext
 {
 public:
 
-
     XMLTrackedChangesImportContext(
         SvXMLImport& rImport,
         sal_uInt16 nPrefix,
@@ -43,8 +41,8 @@ public:
 
     virtual ~XMLTrackedChangesImportContext() override;
 
-    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 css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
         sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;


More information about the Libreoffice-commits mailing list