[Libreoffice-commits] core.git: xmloff/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Sat Dec 5 16:14:03 UTC 2020


 xmloff/source/text/XMLTextFrameContext.cxx |   69 +++++++++++++++++++++--------
 xmloff/source/text/XMLTextFrameContext.hxx |    2 
 2 files changed, 53 insertions(+), 18 deletions(-)

New commits:
commit 4400f3c46ce838d8ba304205f1d710dd4f9001dc
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Fri Dec 4 20:50:35 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Dec 5 17:13:29 2020 +0100

    fastparser in XMLTextFrameContext
    
    Change-Id: I1d0038546d47b850aecee9e3a675a44ce6c7c5fa
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107248
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

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;


More information about the Libreoffice-commits mailing list