diff options
author | Noel <noelgrandin@gmail.com> | 2020-12-01 10:24:14 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-12-01 16:30:21 +0100 |
commit | 380e3fdc8a0ca86429ab44669820f09dad1a6fb8 (patch) | |
tree | 284c0a2dcf980962e90c0df2aff07c51baffd306 /xmloff | |
parent | 9dc284bb68d2648be6c1846df313519056a5b894 (diff) |
fastparser in XMLChangedRegionImportContext
Change-Id: I71d31fc2f21d1f261b1e5d8d923269ae0531ccb9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106966
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/text/XMLChangedRegionImportContext.cxx | 31 | ||||
-rw-r--r-- | xmloff/source/text/XMLChangedRegionImportContext.hxx | 5 |
2 files changed, 17 insertions, 19 deletions
diff --git a/xmloff/source/text/XMLChangedRegionImportContext.cxx b/xmloff/source/text/XMLChangedRegionImportContext.cxx index aa257bf50ef8..a0f11b97d3ff 100644 --- a/xmloff/source/text/XMLChangedRegionImportContext.cxx +++ b/xmloff/source/text/XMLChangedRegionImportContext.cxx @@ -50,42 +50,39 @@ XMLChangedRegionImportContext::~XMLChangedRegionImportContext() { } -void XMLChangedRegionImportContext::StartElement( - const Reference<XAttributeList> & xAttrList) +void XMLChangedRegionImportContext::startFastElement( + sal_Int32 /*nElement*/, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) { // process attributes: id bool bHaveXmlId( false ); - 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 ); - - const OUString sValue = xAttrList->getValueByIndex(nAttr); - if (XML_NAMESPACE_XML == nPrefix) + const OUString sValue = aIter.toString(); + switch(aIter.getToken()) { - if (IsXMLToken(sLocalName, XML_ID)) + case XML_ELEMENT(XML, XML_ID): { sID = sValue; bHaveXmlId = true; + break; } - } - else if (XML_NAMESPACE_TEXT == nPrefix) - { - if (IsXMLToken(sLocalName, XML_ID)) + case XML_ELEMENT(TEXT, XML_ID): { if (!bHaveXmlId) { sID = sValue; } + break; } - else if( IsXMLToken( sLocalName, XML_MERGE_LAST_PARAGRAPH ) ) + case XML_ELEMENT(TEXT, XML_MERGE_LAST_PARAGRAPH): { bool bTmp(false); if (::sax::Converter::convertBool(bTmp, sValue)) { bMergeLastPara = bTmp; } + break; } + default: + XMLOFF_WARN_UNKNOWN("xmloff", aIter); } } } diff --git a/xmloff/source/text/XMLChangedRegionImportContext.hxx b/xmloff/source/text/XMLChangedRegionImportContext.hxx index 2964790f8fcc..97c545cbb58c 100644 --- a/xmloff/source/text/XMLChangedRegionImportContext.hxx +++ b/xmloff/source/text/XMLChangedRegionImportContext.hxx @@ -57,8 +57,9 @@ public: virtual ~XMLChangedRegionImportContext() override; - 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, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; |