xmloff/source/text/XMLIndexTitleTemplateContext.cxx |   20 +++++++++-----------
 xmloff/source/text/XMLIndexTitleTemplateContext.hxx |    5 +++--
 2 files changed, 12 insertions(+), 13 deletions(-)

New commits:
commit a4a15dc18c4be7fdb840b5d478c39cb1e8206b1a
Author:     Noel <noelgran...@gmail.com>
AuthorDate: Tue Dec 1 08:19:41 2020 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Dec 1 11:00:55 2020 +0100

    fastparser in XMLIndexTitleTemplateContext
    
    Change-Id: I40231fdd13410f1c69f2d6f71458aff43a462df5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106920
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/xmloff/source/text/XMLIndexTitleTemplateContext.cxx 
b/xmloff/source/text/XMLIndexTitleTemplateContext.cxx
index 14b4608d8877..e5c690f09d49 100644
--- a/xmloff/source/text/XMLIndexTitleTemplateContext.cxx
+++ b/xmloff/source/text/XMLIndexTitleTemplateContext.cxx
@@ -23,6 +23,7 @@
 #include <xmloff/namespacemap.hxx>
 #include <xmloff/xmlnamespace.hxx>
 #include <xmloff/xmltoken.hxx>
+#include <sal/log.hxx>
 
 #include <com/sun/star/container/XNameContainer.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
@@ -50,27 +51,24 @@ 
XMLIndexTitleTemplateContext::~XMLIndexTitleTemplateContext()
 {
 }
 
-void XMLIndexTitleTemplateContext::StartElement(
-    const Reference<XAttributeList> & xAttrList)
+void XMLIndexTitleTemplateContext::startFastElement(
+    sal_Int32 /*nElement*/,
+    const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
 {
     // there's only one attribute: style-name
-    sal_Int16 nLength = xAttrList->getLength();
-    for(sal_Int16 nAttr = 0; nAttr < nLength; 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) )
         {
-            sStyleName = xAttrList->getValueByIndex(nAttr);
+            sStyleName = aIter.toString();
             OUString sDisplayStyleName = GetImport().GetStyleDisplayName(
                 XmlStyleFamily::TEXT_PARAGRAPH, sStyleName );
             const Reference < css::container::XNameContainer >&
                 rStyles = GetImport().GetTextImport()->GetParaStyles();
             bStyleNameOK = rStyles.is() && rStyles->hasByName( 
sDisplayStyleName );
         }
+        else
+            XMLOFF_WARN_UNKNOWN("xmloff", aIter);
     }
 }
 
diff --git a/xmloff/source/text/XMLIndexTitleTemplateContext.hxx 
b/xmloff/source/text/XMLIndexTitleTemplateContext.hxx
index a5b698242e68..b517ab9e8015 100644
--- a/xmloff/source/text/XMLIndexTitleTemplateContext.hxx
+++ b/xmloff/source/text/XMLIndexTitleTemplateContext.hxx
@@ -58,8 +58,9 @@ public:
 protected:
 
     /** process parameters */
-    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;
 
     /** set values */
     virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to