diff options
author | Noel <noelgrandin@gmail.com> | 2020-12-01 10:19:34 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-12-01 12:19:27 +0100 |
commit | 3b594e1e50bdc2ad374321fa3da304596bb15ffa (patch) | |
tree | b92793779c433ad86e652006a2b16d3d3ed4b371 | |
parent | 4bb80a6d97b9ab4f2017c6033f18f806f3d4828a (diff) |
fastparser in XMLIndexBibliographyEntryContext
Change-Id: I6398abaa7de7d97c51674ea34331421ed3f0756d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106933
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | xmloff/source/text/XMLIndexBibliographyEntryContext.cxx | 29 | ||||
-rw-r--r-- | xmloff/source/text/XMLIndexBibliographyEntryContext.hxx | 5 |
2 files changed, 17 insertions, 17 deletions
diff --git a/xmloff/source/text/XMLIndexBibliographyEntryContext.cxx b/xmloff/source/text/XMLIndexBibliographyEntryContext.cxx index af5886fe559d..c9bd4eabbce3 100644 --- a/xmloff/source/text/XMLIndexBibliographyEntryContext.cxx +++ b/xmloff/source/text/XMLIndexBibliographyEntryContext.cxx @@ -27,6 +27,7 @@ #include <xmloff/xmluconv.hxx> #include <xmloff/xmlement.hxx> #include <com/sun/star/text/BibliographyDataField.hpp> +#include <sal/log.hxx> using namespace ::com::sun::star::text; @@ -91,35 +92,33 @@ const SvXMLEnumMapEntry<sal_uInt16> aBibliographyDataFieldMap[] = { XML_TOKEN_INVALID, 0 } }; -void XMLIndexBibliographyEntryContext::StartElement( - const Reference<XAttributeList> & xAttrList) +void XMLIndexBibliographyEntryContext::startFastElement( + sal_Int32 /*nElement*/, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) { // handle both, style name and bibliography info - 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 ); - if (XML_NAMESPACE_TEXT == nPrefix) + switch(aIter.getToken()) { - if ( IsXMLToken( sLocalName, XML_STYLE_NAME ) ) + case XML_ELEMENT(TEXT, XML_STYLE_NAME): { - m_sCharStyleName = xAttrList->getValueByIndex(nAttr); + m_sCharStyleName = aIter.toString(); m_bCharStyleNameOK = true; + break; } - else if ( IsXMLToken( sLocalName, XML_BIBLIOGRAPHY_DATA_FIELD ) ) + case XML_ELEMENT(TEXT, XML_BIBLIOGRAPHY_DATA_FIELD): { sal_uInt16 nTmp; - if (SvXMLUnitConverter::convertEnum( - nTmp, xAttrList->getValueByIndex(nAttr), - aBibliographyDataFieldMap)) + if (SvXMLUnitConverter::convertEnum(nTmp, aIter.toString(), aBibliographyDataFieldMap)) { nBibliographyInfo = nTmp; bBibliographyInfoOK = true; } + break; } + default: + XMLOFF_WARN_UNKNOWN("xmloff", aIter); } } diff --git a/xmloff/source/text/XMLIndexBibliographyEntryContext.hxx b/xmloff/source/text/XMLIndexBibliographyEntryContext.hxx index 97546c0759dd..0314dc899b7f 100644 --- a/xmloff/source/text/XMLIndexBibliographyEntryContext.hxx +++ b/xmloff/source/text/XMLIndexBibliographyEntryContext.hxx @@ -55,8 +55,9 @@ public: protected: /** process parameters */ - 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; /** call FillPropertyValues and insert into template */ virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; |