diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-28 15:25:40 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-29 15:28:22 +0200 |
commit | 9814c1f2edf56ecc0f31001db9234ef335488879 (patch) | |
tree | 5087cafe5763b87d6a7775d3e8b396af39dd3513 /sc/source/filter/xml/xmlstyli.cxx | |
parent | fee0404b00e1e97f429ae1eaa38458873385355f (diff) |
use fastparser in SvXMLPropertySetContext subclasses
Change-Id: I977f1cf198652d3c73e5a0f473794975a5647617
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101564
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/filter/xml/xmlstyli.cxx')
-rw-r--r-- | sc/source/filter/xml/xmlstyli.cxx | 45 |
1 files changed, 19 insertions, 26 deletions
diff --git a/sc/source/filter/xml/xmlstyli.cxx b/sc/source/filter/xml/xmlstyli.cxx index 364b212cd393..191e8a6323d7 100644 --- a/sc/source/filter/xml/xmlstyli.cxx +++ b/sc/source/filter/xml/xmlstyli.cxx @@ -273,11 +273,12 @@ class XMLTableCellPropsContext : public SvXMLPropertySetContext ::std::vector< XMLPropertyState > &rProps, const rtl::Reference < SvXMLImportPropertyMapper > &rMap); - virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix, - const OUString& rLocalName, - const uno::Reference< xml::sax::XAttributeList >& xAttrList, - ::std::vector< XMLPropertyState > &rProperties, - const XMLPropertyState& rProp ) override; + using SvXMLPropertySetContext::createFastChildContext; + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > createFastChildContext( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList, + ::std::vector< XMLPropertyState > &rProperties, + const XMLPropertyState& rProp ) override; }; } @@ -293,33 +294,25 @@ XMLTableCellPropsContext::XMLTableCellPropsContext( { } -SvXMLImportContextRef XMLTableCellPropsContext::CreateChildContext( sal_uInt16 nPrefix, - const OUString& rLocalName, - const uno::Reference< xml::sax::XAttributeList >& xAttrList, - ::std::vector< XMLPropertyState > &rProperties, - const XMLPropertyState& rProp ) +css::uno::Reference< css::xml::sax::XFastContextHandler > XMLTableCellPropsContext::createFastChildContext( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList, + ::std::vector< XMLPropertyState > &rProperties, + const XMLPropertyState& rProp ) { // no need for a custom context or indeed a SvXMLTokenMap to grab just the // single attribute ( href ) that we are interested in. // still though, we will check namespaces etc. - if ((XML_NAMESPACE_STYLE == nPrefix || XML_NAMESPACE_LO_EXT == nPrefix) - && IsXMLToken(rLocalName, XML_HYPERLINK)) + if (nElement == XML_ELEMENT(STYLE, XML_HYPERLINK) || + nElement == XML_ELEMENT(LO_EXT, XML_HYPERLINK) ) { OUString sURL; - for ( int i=0; i<xAttrList->getLength(); ++i ) + for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList )) { - OUString aLocalName; - OUString sName = xAttrList->getNameByIndex(i); - sal_uInt16 nPrfx = GetImport().GetNamespaceMap().GetKeyByAttrName( sName, - &aLocalName ); - if ( nPrfx == XML_NAMESPACE_XLINK ) - { - if ( IsXMLToken( aLocalName, XML_HREF ) ) - { - sURL = xAttrList->getValueByIndex(i); - break; - } - } + if ( aIter.getToken() == XML_ELEMENT(XLINK, XML_HREF) ) + sURL = aIter.toString(); + else + SAL_WARN("sc", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << aIter.toString()); } if ( !sURL.isEmpty() ) { @@ -328,7 +321,7 @@ SvXMLImportContextRef XMLTableCellPropsContext::CreateChildContext( sal_uInt16 n rProperties.push_back( aProp ); } } - return SvXMLPropertySetContext::CreateChildContext( nPrefix, rLocalName, xAttrList, rProperties, rProp ); + return SvXMLPropertySetContext::createFastChildContext( nElement, xAttrList, rProperties, rProp ); } namespace { |