diff options
author | Noel <noelgrandin@gmail.com> | 2020-12-04 11:35:32 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-12-04 11:58:33 +0100 |
commit | 15c5da78ec773b7b59a092f84dca02de5931e634 (patch) | |
tree | 9226248afc3fe2e48075cca002e5fd5c59e3bd2a /reportdesign | |
parent | 44a3a3a53db57398efa2ec4db026e4ebda086dde (diff) |
fastparser in CreateGroupChildContext
Change-Id: I3e3e6785fdedb27353e4d97a9a2bea71c6f2b24a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107189
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'reportdesign')
-rw-r--r-- | reportdesign/source/filter/xml/xmlCell.cxx | 40 | ||||
-rw-r--r-- | reportdesign/source/filter/xml/xmlCell.hxx | 4 | ||||
-rw-r--r-- | reportdesign/source/filter/xml/xmlSubDocument.cxx | 44 | ||||
-rw-r--r-- | reportdesign/source/filter/xml/xmlSubDocument.hxx | 4 |
4 files changed, 30 insertions, 62 deletions
diff --git a/reportdesign/source/filter/xml/xmlCell.cxx b/reportdesign/source/filter/xml/xmlCell.cxx index 1ce789210df1..51dc70c75ffb 100644 --- a/reportdesign/source/filter/xml/xmlCell.cxx +++ b/reportdesign/source/filter/xml/xmlCell.cxx @@ -86,32 +86,6 @@ OXMLCell::~OXMLCell() { } -SvXMLImportContextRef OXMLCell::CreateChildContext( - sal_uInt16 _nPrefix, - const OUString& _rLocalName, - const Reference< XAttributeList > & xAttrList ) -{ - SvXMLImportContext *pContext = nullptr; - ORptFilter& rImport = GetOwnImport(); - const SvXMLTokenMap& rTokenMap = rImport.GetCellElemTokenMap(); - const sal_uInt16 nToken = rTokenMap.Get( _nPrefix, _rLocalName ); - switch( nToken ) - { - case XML_TOK_CUSTOM_SHAPE: - case XML_TOK_FRAME: - { - if ( !m_bContainsShape ) - m_nCurrentCount = m_pContainer->getSection()->getCount(); - rtl::Reference< XMLShapeImportHelper > xShapeImportHelper = rImport.GetShapeImport(); - uno::Reference< drawing::XShapes > xShapes = m_pContainer->getSection().get(); - pContext = xShapeImportHelper->CreateGroupChildContext(rImport,_nPrefix,_rLocalName,xAttrList,xShapes); - m_bContainsShape = true; - } - break; - } - return pContext; -} - css::uno::Reference< css::xml::sax::XFastContextHandler > OXMLCell::createFastChildContext( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) @@ -172,8 +146,20 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > OXMLCell::createFastCh case XML_ELEMENT(TEXT, XML_P): xContext = new OXMLCell( rImport,xAttrList ,m_pContainer,this); break; - default: + + case XML_ELEMENT(DRAW, XML_CUSTOM_SHAPE): + case XML_ELEMENT(DRAW, XML_FRAME): + { + if ( !m_bContainsShape ) + m_nCurrentCount = m_pContainer->getSection()->getCount(); + uno::Reference< drawing::XShapes > xShapes = m_pContainer->getSection().get(); + xContext = GetImport().GetShapeImport()->CreateGroupChildContext(rImport,nElement,xAttrList,xShapes); + m_bContainsShape = true; + } break; + + default: + SAL_WARN("reportdesign", "unknown element " << SvXMLImport::getPrefixAndNameFromToken(nElement)); } if ( m_xComponent.is() ) diff --git a/reportdesign/source/filter/xml/xmlCell.hxx b/reportdesign/source/filter/xml/xmlCell.hxx index d11826af3170..065af60d7c58 100644 --- a/reportdesign/source/filter/xml/xmlCell.hxx +++ b/reportdesign/source/filter/xml/xmlCell.hxx @@ -47,10 +47,6 @@ namespace rptxml ,OXMLCell* _pCell = nullptr); virtual ~OXMLCell() 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 >& xAttrList ) override; diff --git a/reportdesign/source/filter/xml/xmlSubDocument.cxx b/reportdesign/source/filter/xml/xmlSubDocument.cxx index fed6eaf13aba..ec10ba195e86 100644 --- a/reportdesign/source/filter/xml/xmlSubDocument.cxx +++ b/reportdesign/source/filter/xml/xmlSubDocument.cxx @@ -27,6 +27,7 @@ #include "xmlTable.hxx" #include <comphelper/property.hxx> #include <com/sun/star/report/XReportControlModel.hpp> +#include <sal/log.hxx> #include <osl/diagnose.h> namespace rptxml @@ -53,33 +54,6 @@ OXMLSubDocument::~OXMLSubDocument() { } -SvXMLImportContextRef OXMLSubDocument::CreateChildContext( sal_uInt16 nPrefix, - const OUString& rLocalName, - const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList ) -{ - SvXMLImportContextRef xContext; - const SvXMLTokenMap& rTokenMap = static_cast<ORptFilter&>(GetImport()).GetReportElemTokenMap(); - switch( rTokenMap.Get( nPrefix, rLocalName ) ) - { - case XML_TOK_SUB_FRAME: - { - if ( !m_bContainsShape ) - m_nCurrentCount = m_pContainer->getSection()->getCount(); - rtl::Reference< XMLShapeImportHelper > xShapeImportHelper = GetImport().GetShapeImport(); - uno::Reference< drawing::XShapes > xShapes = m_pContainer->getSection().get(); - xContext = xShapeImportHelper->CreateGroupChildContext(GetImport(),nPrefix,rLocalName,xAttrList,xShapes); - m_bContainsShape = true; - if (m_pCellParent) - { - // #i94115 say to the parent Cell it contains shapes - m_pCellParent->setContainsShape(true); - } - } - break; - } - return xContext; -} - css::uno::Reference< css::xml::sax::XFastContextHandler > OXMLSubDocument::createFastChildContext( sal_Int32 nElement, const Reference< XFastAttributeList > & xAttrList ) @@ -102,7 +76,23 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > OXMLSubDocument::creat case XML_ELEMENT(OFFICE, XML_BODY): xContext = new RptXMLDocumentBodyContext(GetImport()); break; + + case XML_ELEMENT(DRAW, XML_FRAME): + { + if ( !m_bContainsShape ) + m_nCurrentCount = m_pContainer->getSection()->getCount(); + uno::Reference< drawing::XShapes > xShapes = m_pContainer->getSection().get(); + xContext = GetImport().GetShapeImport()->CreateGroupChildContext(GetImport(),nElement,xAttrList,xShapes); + m_bContainsShape = true; + if (m_pCellParent) + { + // #i94115 say to the parent Cell it contains shapes + m_pCellParent->setContainsShape(true); + } + } + break; default: + SAL_WARN("reportdesign", "unknown element " << SvXMLImport::getPrefixAndNameFromToken(nElement)); break; } diff --git a/reportdesign/source/filter/xml/xmlSubDocument.hxx b/reportdesign/source/filter/xml/xmlSubDocument.hxx index 14f7fffdcf42..f4cbf9848be5 100644 --- a/reportdesign/source/filter/xml/xmlSubDocument.hxx +++ b/reportdesign/source/filter/xml/xmlSubDocument.hxx @@ -51,10 +51,6 @@ namespace rptxml sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override; - virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix, - const OUString& rLocalName, - const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList ) override; - virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; virtual void addMasterDetailPair(const ::std::pair< OUString,OUString >& _aPair) override; }; |