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

Noel (via logerrit) logerrit at kemper.freedesktop.org
Thu Nov 5 16:21:13 UTC 2020


 sw/source/filter/xml/xmltbli.cxx |   60 ++++++++++++++++-----------------------
 1 file changed, 26 insertions(+), 34 deletions(-)

New commits:
commit d65f06223249b366e73108379bd80c902390bd7f
Author:     Noel <noelgrandin at gmail.com>
AuthorDate: Thu Nov 5 13:57:47 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Nov 5 17:20:33 2020 +0100

    StartElement->startFastElement in sw
    
    Change-Id: I6a916011fa7c89c1187fa593b7bfe0081b2a6690
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105342
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index 26a2602ee1d8..560e568c5f8e 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -1034,8 +1034,9 @@ public:
     SwXMLDDETableContext_Impl(
         SwXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName);
 
-    virtual void StartElement(
-        const Reference<xml::sax::XAttributeList> & xAttrList) override;
+    virtual void SAL_CALL startFastElement(
+        sal_Int32 nElement,
+        const Reference<xml::sax::XFastAttributeList> & xAttrList) override;
 
     OUString& GetConnectionName()   { return sConnectionName; }
     OUString& GetDDEApplication()   { return sDDEApplication; }
@@ -1056,47 +1057,38 @@ SwXMLDDETableContext_Impl::SwXMLDDETableContext_Impl(
 {
 }
 
-void SwXMLDDETableContext_Impl::StartElement(
-    const Reference<xml::sax::XAttributeList> & xAttrList)
+void SwXMLDDETableContext_Impl::startFastElement(
+    sal_Int32 /*nElement*/,
+    const Reference<xml::sax::XFastAttributeList> & xAttrList)
 {
-    sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
-    for( sal_Int16 i = 0; i < nAttrCount; i++ )
+    for( auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ) )
     {
-        const OUString& rAttrName = xAttrList->getNameByIndex( i );
-
-        OUString aLocalName;
-        const sal_uInt16 nPrefix =
-            GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
-                                                            &aLocalName );
-        const OUString& rValue = xAttrList->getValueByIndex( i );
-
-        if (XML_NAMESPACE_OFFICE == nPrefix)
+        OUString aValue = aIter.toString();
+        switch (aIter.getToken())
         {
-            if ( IsXMLToken( aLocalName, XML_DDE_APPLICATION ) )
-            {
-                sDDEApplication = rValue;
-            }
-            else if ( IsXMLToken( aLocalName, XML_DDE_TOPIC ) )
-            {
-                sDDETopic = rValue;
-            }
-            else if ( IsXMLToken( aLocalName, XML_DDE_ITEM ) )
-            {
-                sDDEItem = rValue;
-            }
-            else if ( IsXMLToken( aLocalName, XML_NAME ) )
-            {
-                sConnectionName = rValue;
-            }
-            else if ( IsXMLToken( aLocalName, XML_AUTOMATIC_UPDATE ) )
+            case XML_ELEMENT(OFFICE, XML_DDE_APPLICATION):
+                sDDEApplication = aValue;
+                break;
+            case XML_ELEMENT(OFFICE, XML_DDE_TOPIC):
+                sDDETopic = aValue;
+                break;
+            case XML_ELEMENT(OFFICE, XML_DDE_ITEM):
+                sDDEItem = aValue;
+                break;
+            case XML_ELEMENT(OFFICE, XML_NAME):
+                sConnectionName = aValue;
+                break;
+            case XML_ELEMENT(OFFICE, XML_AUTOMATIC_UPDATE):
             {
                 bool bTmp(false);
-                if (::sax::Converter::convertBool(bTmp, rValue))
+                if (::sax::Converter::convertBool(bTmp, aValue))
                 {
                     bIsAutomaticUpdate = bTmp;
                 }
+                break;
             }
-            // else: unknown attribute
+            default:
+                XMLOFF_WARN_UNKNOWN("sw", aIter);
         }
         // else: unknown attribute namespace
     }


More information about the Libreoffice-commits mailing list