diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-01-21 16:59:30 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-01-21 17:56:56 +0100 |
commit | 998308c363dfad03143591aa18256d2669b4da11 (patch) | |
tree | 1eec3bb9ab79fa54d3bfc37c6bc969349ab24909 /dbaccess | |
parent | 63b7e282a598ff5dc9d665127f567b20adc56f24 (diff) |
use more FastParser in SvXMLStylesContext
Change-Id: I05c7314739246a864b16723c13bd8fbb4ef725e7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87146
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/filter/xml/xmlStyleImport.cxx | 7 | ||||
-rw-r--r-- | dbaccess/source/filter/xml/xmlStyleImport.hxx | 5 | ||||
-rw-r--r-- | dbaccess/source/filter/xml/xmlfilter.cxx | 59 | ||||
-rw-r--r-- | dbaccess/source/filter/xml/xmlfilter.hxx | 3 |
4 files changed, 21 insertions, 53 deletions
diff --git a/dbaccess/source/filter/xml/xmlStyleImport.cxx b/dbaccess/source/filter/xml/xmlStyleImport.cxx index e94d8e43e609..50a1bbedcdd7 100644 --- a/dbaccess/source/filter/xml/xmlStyleImport.cxx +++ b/dbaccess/source/filter/xml/xmlStyleImport.cxx @@ -134,11 +134,8 @@ ODBFilter& OTableStyleContext::GetOwnImport() OTableStylesContext::OTableStylesContext( SvXMLImport& rImport, - sal_uInt16 nPrfx , - const OUString& rLName , - const Reference< XAttributeList > & xAttrList, - const bool bTempAutoStyles ) - : SvXMLStylesContext( rImport, nPrfx, rLName, xAttrList ) + bool bTempAutoStyles ) + : SvXMLStylesContext( rImport ) , m_nNumberFormatIndex(-1) , m_nMasterPageNameIndex(-1) , bAutoStyles(bTempAutoStyles) diff --git a/dbaccess/source/filter/xml/xmlStyleImport.hxx b/dbaccess/source/filter/xml/xmlStyleImport.hxx index 6d8b72069f39..4d36a34eb82b 100644 --- a/dbaccess/source/filter/xml/xmlStyleImport.hxx +++ b/dbaccess/source/filter/xml/xmlStyleImport.hxx @@ -93,10 +93,7 @@ namespace dbaxml public: - OTableStylesContext( SvXMLImport& rImport, sal_uInt16 nPrfx , - const OUString& rLName , - const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList, - const bool bAutoStyles ); + OTableStylesContext( SvXMLImport& rImport, bool bAutoStyles ); virtual ~OTableStylesContext() override; virtual void EndElement() override; diff --git a/dbaccess/source/filter/xml/xmlfilter.cxx b/dbaccess/source/filter/xml/xmlfilter.cxx index 5b250b9f881c..97dd78c21c01 100644 --- a/dbaccess/source/filter/xml/xmlfilter.cxx +++ b/dbaccess/source/filter/xml/xmlfilter.cxx @@ -426,33 +426,23 @@ public: { } - virtual SvXMLImportContextRef CreateChildContext(sal_uInt16 const nPrefix, - const OUString& rLocalName, - const uno::Reference<xml::sax::XAttributeList> & xAttrList) override + virtual uno::Reference< xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( + sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ ) override { - SvXMLImportContext *pContext = nullptr; - ODBFilter & rImport(static_cast<ODBFilter&>(GetImport())); - const SvXMLTokenMap& rTokenMap = rImport.GetDocContentElemTokenMap(); - switch (rTokenMap.Get(nPrefix, rLocalName)) + switch (nElement) { - case XML_TOK_CONTENT_STYLES: + case XML_ELEMENT(OFFICE, XML_STYLES): + case XML_ELEMENT(OOO, XML_STYLES): rImport.GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP ); - pContext = rImport.CreateStylesContext(nPrefix, rLocalName, xAttrList, false); + return rImport.CreateStylesContext(false); break; - case XML_TOK_CONTENT_AUTOSTYLES: + case XML_ELEMENT(OFFICE, XML_AUTOMATIC_STYLES): + case XML_ELEMENT(OOO, XML_AUTOMATIC_STYLES): rImport.GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP ); - pContext = rImport.CreateStylesContext(nPrefix, rLocalName, xAttrList, true); - break; - default: + return rImport.CreateStylesContext(true); break; } - - return pContext; - } - virtual uno::Reference< xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( - sal_Int32 /*nElement*/, const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ ) override - { return nullptr; } }; @@ -492,28 +482,9 @@ public: { } - virtual SvXMLImportContextRef CreateChildContext(sal_uInt16 const nPrefix, - const OUString& rLocalName, - const uno::Reference<xml::sax::XAttributeList> & xAttrList) override - { - SvXMLImportContext *pContext = nullptr; - - ODBFilter & rImport(static_cast<ODBFilter&>(GetImport())); - const SvXMLTokenMap& rTokenMap = rImport.GetDocContentElemTokenMap(); - switch (rTokenMap.Get(nPrefix, rLocalName)) - { - case XML_TOK_CONTENT_AUTOSTYLES: - rImport.GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP ); - pContext = rImport.CreateStylesContext(nPrefix, rLocalName, xAttrList, true); - break; - default: - break; - } - - return pContext; - } virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/, const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {} + virtual uno::Reference< xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ ) override { @@ -527,6 +498,11 @@ public: case XML_ELEMENT(OFFICE, XML_SCRIPTS): return new XMLScriptContext(GetImport(), rImport.GetModel()); break; + case XML_ELEMENT(OFFICE, XML_AUTOMATIC_STYLES): + case XML_ELEMENT(OOO, XML_AUTOMATIC_STYLES): + rImport.GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP ); + return rImport.CreateStylesContext(true); + break; default: break; } return nullptr; @@ -634,10 +610,9 @@ const SvXMLTokenMap& ODBFilter::GetDocContentElemTokenMap() const -SvXMLImportContext* ODBFilter::CreateStylesContext(sal_uInt16 _nPrefix,const OUString& rLocalName, - const uno::Reference< XAttributeList>& xAttrList, bool bIsAutoStyle ) +SvXMLImportContext* ODBFilter::CreateStylesContext( bool bIsAutoStyle ) { - SvXMLImportContext *pContext = new OTableStylesContext(*this, _nPrefix, rLocalName, xAttrList, bIsAutoStyle); + SvXMLImportContext *pContext = new OTableStylesContext(*this, bIsAutoStyle); if (bIsAutoStyle) SetAutoStyles(static_cast<SvXMLStylesContext*>(pContext)); else diff --git a/dbaccess/source/filter/xml/xmlfilter.hxx b/dbaccess/source/filter/xml/xmlfilter.hxx index d722821baf29..16e4b2c557cf 100644 --- a/dbaccess/source/filter/xml/xmlfilter.hxx +++ b/dbaccess/source/filter/xml/xmlfilter.hxx @@ -83,8 +83,7 @@ private: static void fillPropertyMap(const Any& _rValue,TPropertyNameMap& _rMap); public: - SvXMLImportContext* CreateStylesContext(sal_uInt16 nPrefix,const OUString& rLocalName, - const Reference< XAttributeList>& xAttrList, bool bIsAutoStyle ); + SvXMLImportContext* CreateStylesContext( bool bIsAutoStyle ); protected: // SvXMLImport |