diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-21 13:31:02 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-22 22:18:20 +0200 |
commit | 4d6aeea85c87c7b4ea3227d03982988d6e4c87c4 (patch) | |
tree | 2d3b1b0eb67c526c6bd3f2ac3ecede1c7568fb55 /xmloff | |
parent | 215b37dfb6d6384c0aff3336df1fbe137148c317 (diff) |
use fastparser in XMLBitmapStyleContext
Change-Id: Ic5764083c10a30b5d31c197a92bcfb7a4333aa42
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101172
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/core/XMLBase64ImportContext.cxx | 18 | ||||
-rw-r--r-- | xmloff/source/style/FillStyleContext.cxx | 13 | ||||
-rw-r--r-- | xmloff/source/style/FillStyleContext.hxx | 6 |
3 files changed, 26 insertions, 11 deletions
diff --git a/xmloff/source/core/XMLBase64ImportContext.cxx b/xmloff/source/core/XMLBase64ImportContext.cxx index 4e46b81811b0..b9049e577d1c 100644 --- a/xmloff/source/core/XMLBase64ImportContext.cxx +++ b/xmloff/source/core/XMLBase64ImportContext.cxx @@ -38,12 +38,25 @@ XMLBase64ImportContext::XMLBase64ImportContext( { } +XMLBase64ImportContext::XMLBase64ImportContext( + SvXMLImport& rImport, + const Reference< XOutputStream >& rOut ) : + SvXMLImportContext( rImport ), + xOut( rOut ) +{ +} + XMLBase64ImportContext::~XMLBase64ImportContext() { } void XMLBase64ImportContext::EndElement() { + endFastElement(0); +} + +void XMLBase64ImportContext::endFastElement(sal_Int32 ) +{ OUString sChars = maCharBuffer.makeStringAndClear().trim(); if( !sChars.isEmpty() ) { @@ -56,6 +69,11 @@ void XMLBase64ImportContext::EndElement() void XMLBase64ImportContext::Characters( const OUString& rChars ) { + characters(rChars); +} + +void XMLBase64ImportContext::characters( const OUString& rChars ) +{ maCharBuffer.append(rChars); } diff --git a/xmloff/source/style/FillStyleContext.cxx b/xmloff/source/style/FillStyleContext.cxx index 58ae6cd6786a..1d219083d5af 100644 --- a/xmloff/source/style/FillStyleContext.cxx +++ b/xmloff/source/style/FillStyleContext.cxx @@ -128,10 +128,11 @@ XMLBitmapStyleContext::~XMLBitmapStyleContext() { } -SvXMLImportContextRef XMLBitmapStyleContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList ) +css::uno::Reference< css::xml::sax::XFastContextHandler > XMLBitmapStyleContext::createFastChildContext( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) { - SvXMLImportContext *pContext = nullptr; - if( (XML_NAMESPACE_OFFICE == nPrefix) && xmloff::token::IsXMLToken( rLocalName, xmloff::token::XML_BINARY_DATA ) ) + if( nElement == XML_ELEMENT(OFFICE, xmloff::token::XML_BINARY_DATA) ) { OUString sURL; maAny >>= sURL; @@ -139,13 +140,11 @@ SvXMLImportContextRef XMLBitmapStyleContext::CreateChildContext( sal_uInt16 nPre { mxBase64Stream = GetImport().GetStreamForGraphicObjectURLFromBase64(); if( mxBase64Stream.is() ) - pContext = new XMLBase64ImportContext( GetImport(), nPrefix, - rLocalName, xAttrList, - mxBase64Stream ); + return new XMLBase64ImportContext( GetImport(), mxBase64Stream ); } } - return pContext; + return nullptr; } void XMLBitmapStyleContext::endFastElement(sal_Int32 ) diff --git a/xmloff/source/style/FillStyleContext.hxx b/xmloff/source/style/FillStyleContext.hxx index 51e751075be4..026754ac6402 100644 --- a/xmloff/source/style/FillStyleContext.hxx +++ b/xmloff/source/style/FillStyleContext.hxx @@ -81,10 +81,8 @@ public: const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ); virtual ~XMLBitmapStyleContext() 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; virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/, const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {} |