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

Noel (via logerrit) logerrit at kemper.freedesktop.org
Mon Nov 30 16:19:54 UTC 2020


 xmloff/source/chart/SchXMLPlotAreaContext.cxx |   34 ++++++++++++--------------
 xmloff/source/chart/SchXMLPlotAreaContext.hxx |    4 ++-
 2 files changed, 19 insertions(+), 19 deletions(-)

New commits:
commit 93ab6a682d19bc1cc1b4e5913b6fc16f054ef2d8
Author:     Noel <noelgrandin at gmail.com>
AuthorDate: Mon Nov 30 14:58:19 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Nov 30 17:19:14 2020 +0100

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

diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
index 2fe188eab45f..d43e6e2fef91 100644
--- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx
+++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
@@ -633,38 +633,36 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > SchXMLDataLabelContext
     return nullptr;
 }
 
-void SchXMLDataLabelContext::StartElement(const uno::Reference<xml::sax::XAttributeList>& xAttrList)
+void SchXMLDataLabelContext::startFastElement(
+    sal_Int32 /*nElement*/,
+    const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
 {
-    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& rAttrName = xAttrList->getNameByIndex(i);
-        OUString aLocalName;
-        sal_uInt16 nPrefix = rMap.GetKeyByAttrName(rAttrName, &aLocalName);
-        const OUString sValue(xAttrList->getValueByIndex(i));
-
-        if (nPrefix == XML_NAMESPACE_SVG)
+        OUString sValue = aIter.toString();
+        switch(aIter.getToken())
         {
-            if (IsXMLToken(aLocalName, XML_X))
+            case XML_ELEMENT(SVG, XML_X):
+            case XML_ELEMENT(SVG_COMPAT, XML_X):
             {
                 sal_Int32 nResultValue;
                 GetImport().GetMM100UnitConverter().convertMeasureToCore(nResultValue, sValue);
                 mrDataLabelStyle.mo_nLabelAbsolutePosX = nResultValue;
+                break;
             }
-            else if (IsXMLToken(aLocalName, XML_Y))
+            case XML_ELEMENT(SVG, XML_Y):
+            case XML_ELEMENT(SVG_COMPAT, XML_Y):
             {
                 sal_Int32 nResultValue;
                 GetImport().GetMM100UnitConverter().convertMeasureToCore(nResultValue, sValue);
                 mrDataLabelStyle.mo_nLabelAbsolutePosY = nResultValue;
+                break;
             }
-        }
-        else if (nPrefix == XML_NAMESPACE_CHART)
-        {
-            if (IsXMLToken(aLocalName, XML_STYLE_NAME))
-            {
+            case XML_ELEMENT(CHART, XML_STYLE_NAME):
                 mrDataLabelStyle.msStyleName = sValue;
-            }
+                break;
+            default:
+                XMLOFF_WARN_UNKNOWN("xmloff", aIter);
         }
     }
 }
diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.hxx b/xmloff/source/chart/SchXMLPlotAreaContext.hxx
index ef5f840cc1a2..aeda126bd33d 100644
--- a/xmloff/source/chart/SchXMLPlotAreaContext.hxx
+++ b/xmloff/source/chart/SchXMLPlotAreaContext.hxx
@@ -171,7 +171,9 @@ public:
     SchXMLDataLabelContext(SvXMLImport& rImport,
                             ::std::vector<OUString>& rLabels, DataRowPointStyle& rDataLabel);
 
-    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,


More information about the Libreoffice-commits mailing list