From 8c5ffecf1dbd3f93128910433da11d5315661680 Mon Sep 17 00:00:00 2001 From: Noel Date: Fri, 23 Oct 2020 15:12:22 +0200 Subject: make SvXMLImport capable of mixing fast- and slow- contexts adhoc so I can convert even *ImportContext subclasses in the middle of a context stack, and thus break the cyclic dependency nature of the writer import. and adjust the xmlimport loplugin for the new rules. As a consequence of the loplugin:xmlimport's checking, we remove a bunch of now unnecessary overrides of startFastElement. Change-Id: I97464522ede8ec5e345e928cdafa4b18364b1b80 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104730 Tested-by: Jenkins Reviewed-by: Noel Grandin --- .../filter/xml/XMLTableHeaderFooterContext.hxx | 5 --- sc/source/filter/xml/XMLTableSourceContext.cxx | 6 --- sc/source/filter/xml/XMLTableSourceContext.hxx | 3 -- sc/source/filter/xml/celltextparacontext.cxx | 6 --- sc/source/filter/xml/celltextparacontext.hxx | 2 - sc/source/filter/xml/importcontext.cxx | 18 --------- sc/source/filter/xml/importcontext.hxx | 11 ------ sc/source/filter/xml/xmlcoli.cxx | 6 --- sc/source/filter/xml/xmlcoli.hxx | 3 -- sc/source/filter/xml/xmlconti.cxx | 5 --- sc/source/filter/xml/xmlconti.hxx | 2 - sc/source/filter/xml/xmlimprt.cxx | 43 ---------------------- sc/source/filter/xml/xmlstyli.cxx | 6 +-- sc/source/filter/xml/xmltabi.cxx | 6 --- sc/source/filter/xml/xmltabi.hxx | 3 -- 15 files changed, 1 insertion(+), 124 deletions(-) (limited to 'sc/source/filter') diff --git a/sc/source/filter/xml/XMLTableHeaderFooterContext.hxx b/sc/source/filter/xml/XMLTableHeaderFooterContext.hxx index f9088ebe8f38..2b2138ec0988 100644 --- a/sc/source/filter/xml/XMLTableHeaderFooterContext.hxx +++ b/sc/source/filter/xml/XMLTableHeaderFooterContext.hxx @@ -55,9 +55,6 @@ public: const OUString& rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList ) override; - virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) 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; @@ -82,8 +79,6 @@ public: const OUString& rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList ) override; - virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {} virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; }; diff --git a/sc/source/filter/xml/XMLTableSourceContext.cxx b/sc/source/filter/xml/XMLTableSourceContext.cxx index 38bb4c3bee86..c64fd897087e 100644 --- a/sc/source/filter/xml/XMLTableSourceContext.cxx +++ b/sc/source/filter/xml/XMLTableSourceContext.cxx @@ -77,12 +77,6 @@ ScXMLTableSourceContext::~ScXMLTableSourceContext() { } -uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLTableSourceContext::createFastChildContext( - sal_Int32 /*nElement*/, const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ ) -{ - return nullptr; -} - void SAL_CALL ScXMLTableSourceContext::endFastElement( sal_Int32 /*nElement*/ ) { if (sLink.isEmpty()) diff --git a/sc/source/filter/xml/XMLTableSourceContext.hxx b/sc/source/filter/xml/XMLTableSourceContext.hxx index 23c62ba6da5e..523c28bfc2fb 100644 --- a/sc/source/filter/xml/XMLTableSourceContext.hxx +++ b/sc/source/filter/xml/XMLTableSourceContext.hxx @@ -40,9 +40,6 @@ public: virtual ~ScXMLTableSourceContext() 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; - virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override; }; diff --git a/sc/source/filter/xml/celltextparacontext.cxx b/sc/source/filter/xml/celltextparacontext.cxx index d4feaafead94..8a54d38c2b32 100644 --- a/sc/source/filter/xml/celltextparacontext.cxx +++ b/sc/source/filter/xml/celltextparacontext.cxx @@ -189,12 +189,6 @@ void ScXMLCellFieldSheetNameContext::SetStyleName(const OUString& rStyleName) maStyleName = rStyleName; } -void SAL_CALL ScXMLCellFieldSheetNameContext::startFastElement( sal_Int32 /*nElement*/, - const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ ) -{ - // has no attributes (that I'm aware of). -} - void SAL_CALL ScXMLCellFieldSheetNameContext::endFastElement( sal_Int32 /*nElement*/ ) { mrParentCxt.PushFieldSheetName(maStyleName); diff --git a/sc/source/filter/xml/celltextparacontext.hxx b/sc/source/filter/xml/celltextparacontext.hxx index 3d62077c329e..35a553ce7f9c 100644 --- a/sc/source/filter/xml/celltextparacontext.hxx +++ b/sc/source/filter/xml/celltextparacontext.hxx @@ -68,8 +68,6 @@ public: void SetStyleName(const OUString& rStyleName); - virtual void SAL_CALL startFastElement( sal_Int32 nElement, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override; virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override; }; diff --git a/sc/source/filter/xml/importcontext.cxx b/sc/source/filter/xml/importcontext.cxx index df219df61679..611c704c75c8 100644 --- a/sc/source/filter/xml/importcontext.cxx +++ b/sc/source/filter/xml/importcontext.cxx @@ -30,22 +30,4 @@ const ScXMLImport& ScXMLImportContext::GetScImport() const return static_cast(GetImport()); } -void SAL_CALL ScXMLImportContext::startFastElement(sal_Int32 /*nElement*/, const css::uno::Reference< css::xml::sax::XFastAttributeList > & /*xAttrList*/) -{ -} - -void SAL_CALL ScXMLImportContext::endFastElement(sal_Int32 /*nElement*/) -{ -} - -void SAL_CALL ScXMLImportContext::characters(const OUString &) -{ -} - -css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL ScXMLImportContext::createFastChildContext( - sal_Int32/* nElement */, const css::uno::Reference< css::xml::sax::XFastAttributeList >&/* xAttrList */ ) -{ - return nullptr; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/filter/xml/importcontext.hxx b/sc/source/filter/xml/importcontext.hxx index 90a7a2d0e053..c762469d2360 100644 --- a/sc/source/filter/xml/importcontext.hxx +++ b/sc/source/filter/xml/importcontext.hxx @@ -25,17 +25,6 @@ public: ScXMLImportContext( SvXMLImport& rImport ); - virtual void SAL_CALL startFastElement (sal_Int32 nElement, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList) override; - - virtual void SAL_CALL characters(const OUString & aChars) override; - - 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 >& Attribs ) override; - - protected: ScXMLImport& GetScImport(); const ScXMLImport& GetScImport() const; diff --git a/sc/source/filter/xml/xmlcoli.cxx b/sc/source/filter/xml/xmlcoli.cxx index 47e523f83a0b..8bec39546541 100644 --- a/sc/source/filter/xml/xmlcoli.cxx +++ b/sc/source/filter/xml/xmlcoli.cxx @@ -79,12 +79,6 @@ ScXMLTableColContext::~ScXMLTableColContext() { } -uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLTableColContext::createFastChildContext( - sal_Int32 /*nElement*/, const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ ) -{ - return nullptr; -} - void SAL_CALL ScXMLTableColContext::endFastElement( sal_Int32 /*nElement*/ ) { ScXMLImport& rXMLImport = GetScImport(); diff --git a/sc/source/filter/xml/xmlcoli.hxx b/sc/source/filter/xml/xmlcoli.hxx index bc401698eee6..fe90136e61a3 100644 --- a/sc/source/filter/xml/xmlcoli.hxx +++ b/sc/source/filter/xml/xmlcoli.hxx @@ -37,9 +37,6 @@ public: virtual ~ScXMLTableColContext() 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; - virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override; }; diff --git a/sc/source/filter/xml/xmlconti.cxx b/sc/source/filter/xml/xmlconti.cxx index 2e357163f82b..1c5d55292fdc 100644 --- a/sc/source/filter/xml/xmlconti.cxx +++ b/sc/source/filter/xml/xmlconti.cxx @@ -95,11 +95,6 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > ScXMLContentContext::c return new SvXMLImportContext( GetImport() ); } -void ScXMLContentContext::Characters( const OUString& rChars ) -{ - sValue.append(rChars); -} - void ScXMLContentContext::characters( const OUString& rChars ) { sValue.append(rChars); diff --git a/sc/source/filter/xml/xmlconti.hxx b/sc/source/filter/xml/xmlconti.hxx index 1aabd9f49b5c..7fd2cb0274db 100644 --- a/sc/source/filter/xml/xmlconti.hxx +++ b/sc/source/filter/xml/xmlconti.hxx @@ -40,8 +40,6 @@ public: const OUString& rLocalName, const css::uno::Reference& xAttrList ) override; - virtual void Characters( const OUString& rChars ) 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/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index 84b50188b7b6..e30a54366912 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -215,13 +215,6 @@ public: virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 nElement, const css::uno::Reference& xAttrList ) override; - - virtual void SAL_CALL startFastElement (sal_Int32 nElement, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList) override; - - virtual void SAL_CALL characters(const OUString & aChars) override; - - virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; }; } @@ -242,13 +235,6 @@ public: ScXMLFlatDocContext_Impl( ScXMLImport& i_rImport, const uno::Reference& i_xDocProps); - virtual void SAL_CALL startFastElement (sal_Int32 nElement, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList) override; - - virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; - - virtual void SAL_CALL characters( const OUString& aChars ) override; - virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 nElement, const css::uno::Reference& xAttrList ) override; @@ -274,22 +260,6 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL return ScXMLDocContext_Impl::createFastChildContext( nElement, xAttrList ); } -void SAL_CALL ScXMLFlatDocContext_Impl::startFastElement(sal_Int32 nElement, - const uno::Reference< xml::sax::XFastAttributeList > & xAttrList) -{ - SvXMLMetaDocumentContext::startFastElement( nElement, xAttrList ); -} - -void SAL_CALL ScXMLFlatDocContext_Impl::endFastElement(sal_Int32 nElement) -{ - SvXMLMetaDocumentContext::endFastElement( nElement ); -} - -void SAL_CALL ScXMLFlatDocContext_Impl::characters(const OUString& rChars) -{ - SvXMLMetaDocumentContext::characters(rChars); -} - namespace { class ScXMLBodyContext_Impl : public ScXMLImportContext @@ -362,19 +332,6 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL return pContext; } -void SAL_CALL ScXMLDocContext_Impl::startFastElement(sal_Int32 /*nElement*/, - const uno::Reference< xml::sax::XFastAttributeList > & /*xAttrList*/) -{ -} - -void SAL_CALL ScXMLDocContext_Impl::endFastElement(sal_Int32 /*nElement*/) -{ -} - -void SAL_CALL ScXMLDocContext_Impl::characters(const OUString &) -{ -} - const SvXMLTokenMap& ScXMLImport::GetTableElemTokenMap() { if( !pTableElemTokenMap ) diff --git a/sc/source/filter/xml/xmlstyli.cxx b/sc/source/filter/xml/xmlstyli.cxx index 8712531e526c..3a6df40abfe7 100644 --- a/sc/source/filter/xml/xmlstyli.cxx +++ b/sc/source/filter/xml/xmlstyli.cxx @@ -339,9 +339,6 @@ public: SvXMLImport& rImport, sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList > & xAttrList ); - virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {} - ScCondFormatEntry* CreateConditionEntry(); }; @@ -677,9 +674,8 @@ XMLTableStylesContext::~XMLTableStylesContext() { } -void XMLTableStylesContext::endFastElement(sal_Int32 nElement) +void XMLTableStylesContext::endFastElement(sal_Int32 ) { - SvXMLStylesContext::endFastElement(nElement); if (bAutoStyles) GetImport().GetTextImport()->SetAutoStyles( this ); else diff --git a/sc/source/filter/xml/xmltabi.cxx b/sc/source/filter/xml/xmltabi.cxx index f27ab0ca238d..3784b9d54455 100644 --- a/sc/source/filter/xml/xmltabi.cxx +++ b/sc/source/filter/xml/xmltabi.cxx @@ -480,10 +480,4 @@ ScXMLTableProtectionContext::~ScXMLTableProtectionContext() { } -uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLTableProtectionContext::createFastChildContext( - sal_Int32 /*nElement*/, const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ ) -{ - return nullptr; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/filter/xml/xmltabi.hxx b/sc/source/filter/xml/xmltabi.hxx index 2b194d172d16..a20959a58e01 100644 --- a/sc/source/filter/xml/xmltabi.hxx +++ b/sc/source/filter/xml/xmltabi.hxx @@ -71,9 +71,6 @@ public: const rtl::Reference& rAttrList ); virtual ~ScXMLTableProtectionContext() 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; }; #endif -- cgit