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 /sw | |
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 'sw')
-rw-r--r-- | sw/source/filter/xml/xmlfmt.cxx | 30 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlimp.cxx | 32 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlimp.hxx | 9 |
3 files changed, 24 insertions, 47 deletions
diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx index 0150700d17a2..cb97973995ee 100644 --- a/sw/source/filter/xml/xmlfmt.cxx +++ b/sw/source/filter/xml/xmlfmt.cxx @@ -704,8 +704,6 @@ public: SwXMLStylesContext_Impl( SwXMLImport& rImport, - const OUString& rLName , - const uno::Reference< xml::sax::XAttributeList > & xAttrList, bool bAuto ); virtual bool InsertStyleFamily( sal_uInt16 nFamily ) const override; @@ -805,10 +803,9 @@ SvXMLStyleContext *SwXMLStylesContext_Impl::CreateDefaultStyleStyleChildContext( } SwXMLStylesContext_Impl::SwXMLStylesContext_Impl( - SwXMLImport& rImport, const OUString& rLName, - const uno::Reference< xml::sax::XAttributeList > & xAttrList, + SwXMLImport& rImport, bool bAuto ) : - SvXMLStylesContext( rImport, XML_NAMESPACE_OFFICE, rLName, xAttrList, bAuto ) + SvXMLStylesContext( rImport, bAuto ) { } @@ -910,10 +907,7 @@ protected: public: - SwXMLMasterStylesContext_Impl( - SwXMLImport& rImport, - const OUString& rLName , - const uno::Reference< xml::sax::XAttributeList > & xAttrList ); + SwXMLMasterStylesContext_Impl( SwXMLImport& rImport ); virtual void EndElement() override; }; @@ -921,10 +915,8 @@ public: } SwXMLMasterStylesContext_Impl::SwXMLMasterStylesContext_Impl( - SwXMLImport& rImport, - const OUString& rLName , - const uno::Reference< xml::sax::XAttributeList > & xAttrList ) : - XMLTextMasterStylesContext( rImport, XML_NAMESPACE_OFFICE, rLName, xAttrList ) + SwXMLImport& rImport ) : + XMLTextMasterStylesContext( rImport ) { } @@ -949,13 +941,9 @@ void SwXMLMasterStylesContext_Impl::EndElement() } SvXMLImportContext *SwXMLImport::CreateStylesContext( - const OUString& rLocalName, - const uno::Reference< xml::sax::XAttributeList > & xAttrList, bool bAuto ) { - SvXMLStylesContext *pContext = - new SwXMLStylesContext_Impl( *this, rLocalName, - xAttrList, bAuto ); + SvXMLStylesContext *pContext = new SwXMLStylesContext_Impl( *this, bAuto ); if( bAuto ) SetAutoStyles( pContext ); else @@ -964,12 +952,10 @@ SvXMLImportContext *SwXMLImport::CreateStylesContext( return pContext; } -SvXMLImportContext *SwXMLImport::CreateMasterStylesContext( - const OUString& rLocalName, - const uno::Reference< xml::sax::XAttributeList > & xAttrList ) +SvXMLImportContext *SwXMLImport::CreateMasterStylesContext() { SvXMLStylesContext *pContext = - new SwXMLMasterStylesContext_Impl( *this, rLocalName, xAttrList ); + new SwXMLMasterStylesContext_Impl( *this ); SetMasterStyles( pContext ); return pContext; diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index 29035b03829d..1735a9716140 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -221,6 +221,20 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL SwXMLDocContext_Impl::c case XML_ELEMENT(OFFICE, XML_SETTINGS): return new XMLDocumentSettingsContext( GetImport() ); break; + case XML_ELEMENT(OFFICE, XML_STYLES): + GetSwImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP ); + return GetSwImport().CreateStylesContext( false ); + break; + case XML_ELEMENT(OFFICE, XML_AUTOMATIC_STYLES): + // don't use the autostyles from the styles-document for the progress + if ( !IsPrefixFilledIn() || ! IsXMLToken( GetLocalName(), XML_DOCUMENT_STYLES ) ) + GetSwImport().GetProgressBarHelper()->Increment + ( PROGRESS_BAR_STEP ); + return GetSwImport().CreateStylesContext( true ); + break; + case XML_ELEMENT(OFFICE, XML_MASTER_STYLES): + return GetSwImport().CreateMasterStylesContext(); + break; } return nullptr; } @@ -239,24 +253,6 @@ SvXMLImportContextRef SwXMLDocContext_Impl::CreateChildContext( pContext = GetSwImport().CreateFontDeclsContext( rLocalName, xAttrList ); break; - case XML_TOK_DOC_STYLES: - GetSwImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP ); - pContext = GetSwImport().CreateStylesContext( rLocalName, xAttrList, - false ); - break; - case XML_TOK_DOC_AUTOSTYLES: - // don't use the autostyles from the styles-document for the progress - if ( !IsPrefixFilledIn() || ! IsXMLToken( GetLocalName(), XML_DOCUMENT_STYLES ) ) - GetSwImport().GetProgressBarHelper()->Increment - ( PROGRESS_BAR_STEP ); - pContext = GetSwImport().CreateStylesContext( rLocalName, xAttrList, - true ); - break; - - case XML_TOK_DOC_MASTERSTYLES: - pContext = GetSwImport().CreateMasterStylesContext( rLocalName, - xAttrList ); - break; case XML_TOK_DOC_META: OSL_FAIL("XML_TOK_DOC_META: should not have come here, maybe document is invalid?"); break; diff --git a/sw/source/filter/xml/xmlimp.hxx b/sw/source/filter/xml/xmlimp.hxx index b8357b88eaec..10c064b7846c 100644 --- a/sw/source/filter/xml/xmlimp.hxx +++ b/sw/source/filter/xml/xmlimp.hxx @@ -135,13 +135,8 @@ public: // the root element (i.e. office:document-meta) SvXMLImportContext *CreateMetaContext( const sal_Int32 nElement ); SvXMLImportContext *CreateScriptContext(); - SvXMLImportContext *CreateStylesContext( - const OUString& rLocalName, - const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList, - bool bAuto ); - SvXMLImportContext *CreateMasterStylesContext( - const OUString& rLocalName, - const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList ); + SvXMLImportContext *CreateStylesContext( bool bAuto ); + SvXMLImportContext *CreateMasterStylesContext(); SvXMLImportContext *CreateFontDeclsContext( const OUString& rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList ); |