xmloff/source/chart/SchXMLCalculationSettingsContext.cxx |   29 ++++++---------
 xmloff/source/chart/SchXMLCalculationSettingsContext.hxx |   10 ++---
 xmloff/source/chart/contexts.cxx                         |   19 ++++-----
 xmloff/source/chart/contexts.hxx                         |    7 +--
 4 files changed, 28 insertions(+), 37 deletions(-)

New commits:
commit f493abe7edd7dc44855bec4b3a17a2cc32a597fe
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Tue Nov 17 20:23:04 2020 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Nov 18 07:25:07 2020 +0100

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

diff --git a/xmloff/source/chart/SchXMLCalculationSettingsContext.cxx 
b/xmloff/source/chart/SchXMLCalculationSettingsContext.cxx
index 63896ea0a576..f013a53b5128 100644
--- a/xmloff/source/chart/SchXMLCalculationSettingsContext.cxx
+++ b/xmloff/source/chart/SchXMLCalculationSettingsContext.cxx
@@ -36,32 +36,27 @@ using namespace ::com::sun::star;
 using namespace ::xmloff::token;
 
 SchXMLCalculationSettingsContext::SchXMLCalculationSettingsContext( 
SvXMLImport& rImport,
-                                    sal_uInt16 p_nPrefix,
-                                    const OUString& rLocalName,
-                                    const css::uno::Reference< 
css::xml::sax::XAttributeList >& xAttrList )
-: SvXMLImportContext ( rImport, p_nPrefix, rLocalName )
+                                    const css::uno::Reference< 
css::xml::sax::XFastAttributeList >& xAttrList )
+: SvXMLImportContext ( rImport )
 {
-    const SvXMLNamespaceMap& rMap = GetImport().GetNamespaceMap();
-    const 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 sAttrName = xAttrList->getNameByIndex( i );
-        OUString aLocalName;
-        const sal_uInt16 nPrefix = rMap.GetKeyByAttrName(sAttrName, 
&aLocalName );
-        if ( nPrefix == XML_NAMESPACE_TABLE && IsXMLToken( aLocalName, 
XML_DATE_VALUE ) )
+        if ( aIter.getToken() == XML_ELEMENT(TABLE, XML_DATE_VALUE) )
         {
             util::DateTime aNullDate;
-            const OUString sValue = xAttrList->getValueByIndex( i );
-            ::sax::Converter::parseDateTime(aNullDate, sValue);
+            ::sax::Converter::parseDateTime(aNullDate, aIter.toString());
             m_aNullDate <<= aNullDate;
         }
+        else
+            XMLOFF_WARN_UNKNOWN("xmloff", aIter);
     }
 }
-SvXMLImportContextRef SchXMLCalculationSettingsContext::CreateChildContext( 
sal_uInt16 nPrefix,
-                                   const OUString& rLocalName,
-                                   const css::uno::Reference< 
css::xml::sax::XAttributeList >& xAttrList )
+
+css::uno::Reference< css::xml::sax::XFastContextHandler > 
SchXMLCalculationSettingsContext::createFastChildContext(
+    sal_Int32 /*nElement*/,
+    const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
 {
-    return new 
SchXMLCalculationSettingsContext(GetImport(),nPrefix,rLocalName,xAttrList);
+    return new SchXMLCalculationSettingsContext(GetImport(),xAttrList);
 }
 
 void SchXMLCalculationSettingsContext::endFastElement(sal_Int32 )
diff --git a/xmloff/source/chart/SchXMLCalculationSettingsContext.hxx 
b/xmloff/source/chart/SchXMLCalculationSettingsContext.hxx
index a50f0d275314..559358c0afbe 100644
--- a/xmloff/source/chart/SchXMLCalculationSettingsContext.hxx
+++ b/xmloff/source/chart/SchXMLCalculationSettingsContext.hxx
@@ -27,13 +27,11 @@ class SchXMLCalculationSettingsContext : public 
SvXMLImportContext
     css::uno::Any m_aNullDate;
 public:
     SchXMLCalculationSettingsContext( SvXMLImport& rImport,
-                                    sal_uInt16 nPrefix,
-                                    const OUString& rLocalName,
-                                    const css::uno::Reference< 
css::xml::sax::XAttributeList >& xAttrList );
+                                    const css::uno::Reference< 
css::xml::sax::XFastAttributeList >& xAttrList );
 
-    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 >& 
AttrList ) override;
 
     virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
 };
diff --git a/xmloff/source/chart/contexts.cxx b/xmloff/source/chart/contexts.cxx
index af016b4bfde2..c6056915382a 100644
--- a/xmloff/source/chart/contexts.cxx
+++ b/xmloff/source/chart/contexts.cxx
@@ -159,25 +159,24 @@ SchXMLBodyContext::SchXMLBodyContext( SchXMLImportHelper& 
rImpHelper,
 SchXMLBodyContext::~SchXMLBodyContext()
 {}
 
-SvXMLImportContextRef SchXMLBodyContext::CreateChildContext(
-    sal_uInt16 nPrefix,
-    const OUString& rLocalName,
-    const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+css::uno::Reference< css::xml::sax::XFastContextHandler > 
SchXMLBodyContext::createFastChildContext(
+    sal_Int32 nElement,
+    const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
 {
-    SvXMLImportContextRef xContext;
+    css::uno::Reference< css::xml::sax::XFastContextHandler > xContext;
 
     // <chart:chart> element
-    if( nPrefix == XML_NAMESPACE_CHART &&
-        IsXMLToken( rLocalName, XML_CHART ) )
+    if( nElement == XML_ELEMENT(CHART, XML_CHART) )
     {
         xContext = mrImportHelper.CreateChartContext( GetImport(), 
GetImport().GetModel() );
     }
-    else if(nPrefix == XML_NAMESPACE_TABLE &&
-            IsXMLToken( rLocalName, XML_CALCULATION_SETTINGS ))
+    else if(nElement == XML_ELEMENT(TABLE, XML_CALCULATION_SETTINGS ))
     {
         // i99104 handle null date correctly
-        xContext = new SchXMLCalculationSettingsContext ( GetImport(), 
nPrefix, rLocalName, xAttrList);
+        xContext = new SchXMLCalculationSettingsContext ( GetImport(), 
xAttrList);
     }
+    else
+        XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
 
     return xContext;
 }
diff --git a/xmloff/source/chart/contexts.hxx b/xmloff/source/chart/contexts.hxx
index d8fe78be1a9d..81f5e6318239 100644
--- a/xmloff/source/chart/contexts.hxx
+++ b/xmloff/source/chart/contexts.hxx
@@ -83,10 +83,9 @@ public:
         sal_Int32 nElement );
     virtual ~SchXMLBodyContext() 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 >& 
AttrList ) override;
 };
 
 #endif // INCLUDED_XMLOFF_SOURCE_CHART_CONTEXTS_HXX
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to