From 93ab6a682d19bc1cc1b4e5913b6fc16f054ef2d8 Mon Sep 17 00:00:00 2001 From: Noel Date: Mon, 30 Nov 2020 14:58:19 +0200 Subject: fastparser in SchXMLDataLabelContext Change-Id: I373f8cc91e4e8eea470cd81b439de2ef66d8a3b4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106864 Tested-by: Jenkins Reviewed-by: Noel Grandin --- xmloff/source/chart/SchXMLPlotAreaContext.cxx | 34 +++++++++++++-------------- xmloff/source/chart/SchXMLPlotAreaContext.hxx | 4 +++- 2 files changed, 19 insertions(+), 19 deletions(-) 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& 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& rLabels, DataRowPointStyle& rDataLabel); - virtual void StartElement(const css::uno::Reference& 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, -- cgit v1.2.3