diff options
author | Noel <noelgrandin@gmail.com> | 2020-11-30 15:21:00 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-12-01 06:58:26 +0100 |
commit | 6b95a41ef585803aa1c242ddfbcc50302a10b198 (patch) | |
tree | 26498d958b346866aea353267cf5a6158e7e0ef4 /xmloff/source | |
parent | 4e63ec27b69fa01ff610c894c9fbf05c377a6179 (diff) |
fastparser in XMLAutoMarkFileContext
Change-Id: I6ede5fb202d1667cbfbe1b200509e1b6e4b0d4c2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106868
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff/source')
-rw-r--r-- | xmloff/source/text/XMLAutoMarkFileContext.cxx | 34 | ||||
-rw-r--r-- | xmloff/source/text/XMLAutoMarkFileContext.hxx | 5 |
2 files changed, 21 insertions, 18 deletions
diff --git a/xmloff/source/text/XMLAutoMarkFileContext.cxx b/xmloff/source/text/XMLAutoMarkFileContext.cxx index 7cd58f4fe01b..f5968308b339 100644 --- a/xmloff/source/text/XMLAutoMarkFileContext.cxx +++ b/xmloff/source/text/XMLAutoMarkFileContext.cxx @@ -27,6 +27,7 @@ #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/xml/sax/XAttributeList.hpp> #include <com/sun/star/beans/XPropertySet.hpp> +#include <sal/log.hxx> using ::com::sun::star::uno::Any; @@ -52,30 +53,31 @@ XMLAutoMarkFileContext::~XMLAutoMarkFileContext() } -void XMLAutoMarkFileContext::StartElement( - const Reference<XAttributeList> & xAttrList) +void XMLAutoMarkFileContext::startFastElement( + sal_Int32 /*nElement*/, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) { // scan for text:alphabetical-index-auto-mark-file attribute, and if // found set value with the document - sal_Int16 nLength = xAttrList->getLength(); - for( sal_Int16 i = 0; i < nLength; i++ ) + for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) ) { - OUString sLocalName; - sal_uInt16 nPrefix = GetImport().GetNamespaceMap(). - GetKeyByAttrName( xAttrList->getNameByIndex(i), &sLocalName ); - - if ( ( XML_NAMESPACE_XLINK == nPrefix ) && - IsXMLToken(sLocalName, XML_HREF) ) + switch(aIter.getToken()) { - Any aAny; - aAny <<= GetImport().GetAbsoluteReference( xAttrList->getValueByIndex(i) ); - Reference<XPropertySet> xPropertySet( - GetImport().GetModel(), UNO_QUERY ); - if (xPropertySet.is()) + case XML_ELEMENT(XLINK, XML_HREF): { - xPropertySet->setPropertyValue( "IndexAutoMarkFileURL", aAny ); + Any aAny; + aAny <<= GetImport().GetAbsoluteReference( aIter.toString() ); + Reference<XPropertySet> xPropertySet( + GetImport().GetModel(), UNO_QUERY ); + if (xPropertySet.is()) + { + xPropertySet->setPropertyValue( "IndexAutoMarkFileURL", aAny ); + } + break; } + default: + XMLOFF_WARN_UNKNOWN("xmloff", aIter); } } } diff --git a/xmloff/source/text/XMLAutoMarkFileContext.hxx b/xmloff/source/text/XMLAutoMarkFileContext.hxx index 0bb621d59bfb..0165e04b7122 100644 --- a/xmloff/source/text/XMLAutoMarkFileContext.hxx +++ b/xmloff/source/text/XMLAutoMarkFileContext.hxx @@ -43,8 +43,9 @@ public: protected: - 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; }; #endif |