diff options
author | Noel <noelgrandin@gmail.com> | 2020-11-27 14:56:19 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-11-28 06:53:45 +0100 |
commit | 818be5ed71d6c4eb515c907add4179100eed6072 (patch) | |
tree | 04de37bbdb3feb3996310e37c9033f5d1262de29 /xmloff/source/text/XMLFootnoteImportContext.cxx | |
parent | 32fdb8eb3506bc8dcf013cc713fe8e5debceb940 (diff) |
fastparser in XMLFootnoteBodyImportContext
Change-Id: Id822765b23c7251f89f2c3f24136cf5f14762449
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106769
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff/source/text/XMLFootnoteImportContext.cxx')
-rw-r--r-- | xmloff/source/text/XMLFootnoteImportContext.cxx | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/xmloff/source/text/XMLFootnoteImportContext.cxx b/xmloff/source/text/XMLFootnoteImportContext.cxx index 645e910c8a36..95a30097675e 100644 --- a/xmloff/source/text/XMLFootnoteImportContext.cxx +++ b/xmloff/source/text/XMLFootnoteImportContext.cxx @@ -34,6 +34,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/text/XFootnote.hpp> +#include <sal/log.hxx> using namespace ::com::sun::star::uno; @@ -164,49 +165,38 @@ void XMLFootnoteImportContext::endFastElement(sal_Int32 ) } } -SvXMLImportContextRef XMLFootnoteImportContext::CreateChildContext( - sal_uInt16 p_nPrefix, - const OUString& rLocalName, - const Reference<XAttributeList> & xAttrList ) +css::uno::Reference< css::xml::sax::XFastContextHandler > XMLFootnoteImportContext::createFastChildContext( + sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) { SvXMLImportContextRef xContext; - static const SvXMLTokenMap aTokenMap(aFootnoteChildTokenMap); - - switch(aTokenMap.Get(p_nPrefix, rLocalName)) + switch(nElement) { - case XML_TOK_FTN_NOTE_CITATION: + case XML_ELEMENT(TEXT, XML_NOTE_CITATION): { // little hack: we only care for one attribute of the citation // element. We handle that here, and then return a // default context. - 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 ( (nPrefix == XML_NAMESPACE_TEXT) && - IsXMLToken( sLocalName, XML_LABEL ) ) - { - xFootnote->setLabel(xAttrList->getValueByIndex(nAttr)); - } + if ( aIter.getToken() == XML_ELEMENT(TEXT, XML_LABEL) ) + xFootnote->setLabel(aIter.toString()); } // ignore content: return default context break; } - case XML_TOK_FTN_NOTE_BODY: + case XML_ELEMENT(TEXT, XML_NOTE_BODY): // return footnote body - xContext = new XMLFootnoteBodyImportContext(GetImport(), - p_nPrefix, rLocalName); + xContext = new XMLFootnoteBodyImportContext(GetImport()); break; + + default: + XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement); } - return xContext; + return xContext.get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |