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

Noel (via logerrit) logerrit at kemper.freedesktop.org
Tue Dec 1 05:59:07 UTC 2020


 xmloff/source/text/XMLAutoMarkFileContext.cxx |   34 +++++++++++++-------------
 xmloff/source/text/XMLAutoMarkFileContext.hxx |    5 ++-
 2 files changed, 21 insertions(+), 18 deletions(-)

New commits:
commit 6b95a41ef585803aa1c242ddfbcc50302a10b198
Author:     Noel <noelgrandin at gmail.com>
AuthorDate: Mon Nov 30 15:21:00 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Dec 1 06:58:26 2020 +0100

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

diff --git a/xmloff/source/text/XMLAutoMarkFileContext.cxx b/xmloff/source/text/XMLAutoMarkFileContext.cxx
index 7cd58f4fe01b..f5968308b339 100644
--- a/xmloff/source/text/XMLAutoMarkFileContext.cxx
+++ b/xmloff/source/text/XMLAutoMarkFileContext.cxx
@@ -27,6 +27,7 @@
 #include <com/sun/star/uno/Reference.hxx>
 #include <com/sun/star/xml/sax/XAttributeList.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
+#include <sal/log.hxx>
 
 
 using ::com::sun::star::uno::Any;
@@ -52,30 +53,31 @@ XMLAutoMarkFileContext::~XMLAutoMarkFileContext()
 }
 
 
-void XMLAutoMarkFileContext::StartElement(
-    const Reference<XAttributeList> & xAttrList)
+void XMLAutoMarkFileContext::startFastElement(
+    sal_Int32 /*nElement*/,
+    const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
 {
     // scan for text:alphabetical-index-auto-mark-file attribute, and if
     // found set value with the document
 
-    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_XLINK == nPrefix ) &&
-             IsXMLToken(sLocalName, XML_HREF) )
+        switch(aIter.getToken())
         {
-            Any aAny;
-            aAny <<= GetImport().GetAbsoluteReference( xAttrList->getValueByIndex(i) );
-            Reference<XPropertySet> xPropertySet(
-                GetImport().GetModel(), UNO_QUERY );
-            if (xPropertySet.is())
+            case XML_ELEMENT(XLINK, XML_HREF):
             {
-                xPropertySet->setPropertyValue( "IndexAutoMarkFileURL", aAny );
+                Any aAny;
+                aAny <<= GetImport().GetAbsoluteReference( aIter.toString() );
+                Reference<XPropertySet> xPropertySet(
+                    GetImport().GetModel(), UNO_QUERY );
+                if (xPropertySet.is())
+                {
+                    xPropertySet->setPropertyValue( "IndexAutoMarkFileURL", aAny );
+                }
+                break;
             }
+            default:
+                XMLOFF_WARN_UNKNOWN("xmloff", aIter);
         }
     }
 }
diff --git a/xmloff/source/text/XMLAutoMarkFileContext.hxx b/xmloff/source/text/XMLAutoMarkFileContext.hxx
index 0bb621d59bfb..0165e04b7122 100644
--- a/xmloff/source/text/XMLAutoMarkFileContext.hxx
+++ b/xmloff/source/text/XMLAutoMarkFileContext.hxx
@@ -43,8 +43,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;
 };
 
 #endif


More information about the Libreoffice-commits mailing list