diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-11-18 20:57:18 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-11-19 14:05:45 +0100 |
commit | 890849a9fc6344e4cea1428e529faf45389e777b (patch) | |
tree | 4031ec9b06d196870d696f362d2f13cb94695961 /xmloff | |
parent | 85c02385564f42dcaad270e8123fc3109b9ebbba (diff) |
fastparser in SchXMLTextListContext
Change-Id: I27c4bcdc9c2e6131b651332301e01ead3393025d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106077
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/chart/SchXMLTextListContext.cxx | 39 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLTextListContext.hxx | 7 |
2 files changed, 25 insertions, 21 deletions
diff --git a/xmloff/source/chart/SchXMLTextListContext.cxx b/xmloff/source/chart/SchXMLTextListContext.cxx index 29c2321e1196..33aaa5028b8f 100644 --- a/xmloff/source/chart/SchXMLTextListContext.cxx +++ b/xmloff/source/chart/SchXMLTextListContext.cxx @@ -22,6 +22,9 @@ #include <xmloff/xmlnamespace.hxx> #include <xmloff/xmltoken.hxx> +#include <xmloff/xmlimp.hxx> +#include <xmloff/xmlictxt.hxx> +#include <sal/log.hxx> using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Reference; @@ -33,12 +36,11 @@ namespace { class SchXMLListItemContext : public SvXMLImportContext { public: - SchXMLListItemContext( SvXMLImport& rImport, const OUString& rLocalName, OUString& rText ); + SchXMLListItemContext( SvXMLImport& rImport, OUString& rText ); - virtual SvXMLImportContextRef CreateChildContext( - sal_uInt16 nPrefix, - const OUString& rLocalName, - const css::uno::Reference< css::xml::sax::XAttributeList >& 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; private: OUString& m_rText; @@ -48,21 +50,22 @@ private: SchXMLListItemContext::SchXMLListItemContext( SvXMLImport& rImport - , const OUString& rLocalName , OUString& rText ) - : SvXMLImportContext( rImport, XML_NAMESPACE_TEXT, rLocalName ) + : SvXMLImportContext( rImport ) , m_rText( rText ) { } -SvXMLImportContextRef SchXMLListItemContext::CreateChildContext( - sal_uInt16 nPrefix, const OUString& rLocalName, - const uno::Reference< xml::sax::XAttributeList >& ) +css::uno::Reference< css::xml::sax::XFastContextHandler > SchXMLListItemContext::createFastChildContext( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) { SvXMLImportContext* pContext = nullptr; - if( (nPrefix == XML_NAMESPACE_TEXT || - nPrefix == XML_NAMESPACE_LO_EXT) && IsXMLToken( rLocalName, XML_P ) ) + if( nElement == XML_ELEMENT(TEXT, XML_P) || + nElement == XML_ELEMENT(LO_EXT, XML_P) ) pContext = new SchXMLParagraphContext( GetImport(), m_rText ); + else + XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement); return pContext; } @@ -87,16 +90,18 @@ void SchXMLTextListContext::endFastElement(sal_Int32 ) m_rTextList[nN]=m_aTextVector[nN]; } -SvXMLImportContextRef SchXMLTextListContext::CreateChildContext( - sal_uInt16 nPrefix, const OUString& rLocalName, - const uno::Reference< xml::sax::XAttributeList >& ) +css::uno::Reference< css::xml::sax::XFastContextHandler > SchXMLTextListContext::createFastChildContext( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) { SvXMLImportContext* pContext = nullptr; - if( nPrefix == XML_NAMESPACE_TEXT && IsXMLToken( rLocalName, XML_LIST_ITEM ) ) + if( nElement == XML_ELEMENT(TEXT, XML_LIST_ITEM) ) { m_aTextVector.emplace_back( ); - pContext = new SchXMLListItemContext( GetImport(), rLocalName, m_aTextVector.back() ); + pContext = new SchXMLListItemContext( GetImport(), m_aTextVector.back() ); } + else + XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement); return pContext; } diff --git a/xmloff/source/chart/SchXMLTextListContext.hxx b/xmloff/source/chart/SchXMLTextListContext.hxx index 90ebd17bb9cc..068bfd95beb7 100644 --- a/xmloff/source/chart/SchXMLTextListContext.hxx +++ b/xmloff/source/chart/SchXMLTextListContext.hxx @@ -35,10 +35,9 @@ public: virtual ~SchXMLTextListContext() override; virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; - virtual SvXMLImportContextRef CreateChildContext( - sal_uInt16 nPrefix, - const OUString& rLocalName, - const css::uno::Reference< css::xml::sax::XAttributeList >& 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; private: css::uno::Sequence< OUString>& m_rTextList; |