include/xmloff/XMLBase64ImportContext.hxx | 9 ++++++++- xmloff/source/core/XMLBase64ImportContext.cxx | 18 ++++++++++++++++++ xmloff/source/style/FillStyleContext.cxx | 13 ++++++------- xmloff/source/style/FillStyleContext.hxx | 6 ++---- 4 files changed, 34 insertions(+), 12 deletions(-)
New commits: commit 4d6aeea85c87c7b4ea3227d03982988d6e4c87c4 Author: Noel Grandin <[email protected]> AuthorDate: Fri Aug 21 13:31:02 2020 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Sat Aug 22 22:18:20 2020 +0200 use fastparser in XMLBitmapStyleContext Change-Id: Ic5764083c10a30b5d31c197a92bcfb7a4333aa42 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101172 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/include/xmloff/XMLBase64ImportContext.hxx b/include/xmloff/XMLBase64ImportContext.hxx index 298158db1329..6777ce10c296 100644 --- a/include/xmloff/XMLBase64ImportContext.hxx +++ b/include/xmloff/XMLBase64ImportContext.hxx @@ -40,10 +40,17 @@ public: const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList, const css::uno::Reference< css::io::XOutputStream >& rOut ); + XMLBase64ImportContext( SvXMLImport& rImport, + const css::uno::Reference< css::io::XOutputStream >& rOut ); + virtual ~XMLBase64ImportContext() override; - virtual void EndElement() override; + virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {} + virtual void SAL_CALL endFastElement(sal_Int32) override; + virtual void SAL_CALL characters( const OUString& rChars ) override; + virtual void EndElement() override; virtual void Characters( const OUString& rChars ) override; }; 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,11 +38,24 @@ 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() ) @@ -55,6 +68,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 {} _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
