diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-12-04 20:50:35 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-12-05 17:13:29 +0100 |
commit | 4400f3c46ce838d8ba304205f1d710dd4f9001dc (patch) | |
tree | fae9c027be4e260312dc51368f0ff7a1585a81fb /xmloff | |
parent | ffb1a9f3d570a4769d901709658b4e6bb2db5db2 (diff) |
fastparser in XMLTextFrameContext
Change-Id: I1d0038546d47b850aecee9e3a675a44ce6c7c5fa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107248
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/text/XMLTextFrameContext.cxx | 69 | ||||
-rw-r--r-- | xmloff/source/text/XMLTextFrameContext.hxx | 2 |
2 files changed, 53 insertions, 18 deletions
diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx index 0cf2d1832736..b764d59ca4f6 100644 --- a/xmloff/source/text/XMLTextFrameContext.cxx +++ b/xmloff/source/text/XMLTextFrameContext.cxx @@ -1432,6 +1432,57 @@ void XMLTextFrameContext::endFastElement(sal_Int32 ) GetImport().GetTextImport()->StoreLastImportedFrameName(pImpl->GetOrigName()); } +css::uno::Reference< css::xml::sax::XFastContextHandler > XMLTextFrameContext::createFastChildContext( + sal_Int32 nElement, + const uno::Reference< xml::sax::XFastAttributeList>& xAttrList ) +{ + SvXMLImportContextRef xContext; + if( !m_xImplContext.is() ) + { + } + else if(getSupportsMultipleContents() && nElement == XML_ELEMENT(DRAW, XML_IMAGE)) + { + } + else if( m_bSupportsReplacement && !m_xReplImplContext.is() && + nElement == XML_ELEMENT(DRAW, XML_IMAGE) ) + { + } + else if( nullptr != dynamic_cast< const XMLTextFrameContext_Impl*>( m_xImplContext.get() )) + { + } + // #i68101# + else if( nElement == XML_ELEMENT(SVG, XML_TITLE) || nElement == XML_ELEMENT(SVG, XML_DESC ) || + nElement == XML_ELEMENT(SVG_COMPAT, XML_TITLE) || nElement == XML_ELEMENT(SVG_COMPAT, XML_DESC ) ) + { + if (getSupportsMultipleContents()) + { // tdf#103567 ensure props are set on surviving shape + // note: no more draw:image can be added once we get here + m_xImplContext = solveMultipleImages(); + } + xContext = &dynamic_cast<SvXMLImportContext&>(*m_xImplContext->createFastChildContextFallback( nElement, xAttrList )); + } + else if (nElement == XML_ELEMENT(LO_EXT, XML_SIGNATURELINE)) + { + if (getSupportsMultipleContents()) + { // tdf#103567 ensure props are set on surviving shape + // note: no more draw:image can be added once we get here + m_xImplContext = solveMultipleImages(); + } + xContext = &dynamic_cast<SvXMLImportContext&>(*m_xImplContext->createFastChildContextFallback(nElement, xAttrList)); + } + else if (nElement == XML_ELEMENT(LO_EXT, XML_QRCODE)) + { + if (getSupportsMultipleContents()) + { // tdf#103567 ensure props are set on surviving shape + // note: no more draw:image can be added once we get here + m_xImplContext = solveMultipleImages(); + } + xContext = &dynamic_cast<SvXMLImportContext&>(*m_xImplContext->createFastChildContextFallback(nElement, xAttrList)); + } + + return xContext.get(); +} + SvXMLImportContextRef XMLTextFrameContext::CreateChildContext( sal_uInt16 p_nPrefix, const OUString& rLocalName, @@ -1648,30 +1699,12 @@ SvXMLImportContextRef XMLTextFrameContext::CreateChildContext( else if( p_nPrefix == XML_NAMESPACE_SVG && // #i68101# (IsXMLToken( rLocalName, XML_TITLE ) || IsXMLToken( rLocalName, XML_DESC ) ) ) { - if (getSupportsMultipleContents()) - { // tdf#103567 ensure props are set on surviving shape - // note: no more draw:image can be added once we get here - m_xImplContext = solveMultipleImages(); - } - xContext = m_xImplContext->CreateChildContext( p_nPrefix, rLocalName, xAttrList ); } else if (p_nPrefix == XML_NAMESPACE_LO_EXT && (IsXMLToken(rLocalName, XML_SIGNATURELINE))) { - if (getSupportsMultipleContents()) - { // tdf#103567 ensure props are set on surviving shape - // note: no more draw:image can be added once we get here - m_xImplContext = solveMultipleImages(); - } - xContext = m_xImplContext->CreateChildContext(p_nPrefix, rLocalName, xAttrList); } else if (p_nPrefix == XML_NAMESPACE_LO_EXT && (IsXMLToken(rLocalName, XML_QRCODE))) { - if (getSupportsMultipleContents()) - { // tdf#103567 ensure props are set on surviving shape - // note: no more draw:image can be added once we get here - m_xImplContext = solveMultipleImages(); - } - xContext = m_xImplContext->CreateChildContext(p_nPrefix, rLocalName, xAttrList); } else { diff --git a/xmloff/source/text/XMLTextFrameContext.hxx b/xmloff/source/text/XMLTextFrameContext.hxx index 0989364a6bba..76cd68fe982a 100644 --- a/xmloff/source/text/XMLTextFrameContext.hxx +++ b/xmloff/source/text/XMLTextFrameContext.hxx @@ -75,6 +75,8 @@ public: virtual void SAL_CALL endFastElement(sal_Int32 nElement) 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; SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList ) override; |