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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Thu Oct 22 09:34:27 UTC 2020


 include/xmloff/xmlimp.hxx     |   19 +++++------------
 xmloff/Library_xof.mk         |    1 
 xmloff/source/core/xmlimp.cxx |   46 +++++++++++++++---------------------------
 3 files changed, 24 insertions(+), 42 deletions(-)

New commits:
commit fe2b4e7dc6533535736a8f08496f316427386179
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Tue Oct 6 18:27:27 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Oct 22 11:33:45 2020 +0200

    make SvXMLImport fast-parser only
    
    so I can simplify its logic and convert the rest of
    the context classes.
    
    Change-Id: I671ba63724a153a5c715153a8149bdd045040193
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104038
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx
index 3e3a9cf89ad1..edb437b8fa94 100644
--- a/include/xmloff/xmlimp.hxx
+++ b/include/xmloff/xmlimp.hxx
@@ -173,7 +173,6 @@ public:
 };
 
 class XMLOFF_DLLPUBLIC SvXMLImport : public cppu::WeakImplHelper<
-             css::xml::sax::XExtendedDocumentHandler,
              css::xml::sax::XFastDocumentHandler,
              css::lang::XServiceInfo,
              css::lang::XInitialization,
@@ -302,14 +301,15 @@ public:
 
     virtual ~SvXMLImport() throw() override;
 
-    // css::xml::sax::XDocumentHandler
+    virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& _rType ) override;
+
+    void startElement(const OUString& aName,
+        const css::uno::Reference< css::xml::sax::XAttributeList > & xAttribs);
+    void endElement(const OUString& aName);
+
     virtual void SAL_CALL startDocument() override;
     virtual void SAL_CALL endDocument() override;
-    virtual void SAL_CALL startElement(const OUString& aName,
-        const css::uno::Reference< css::xml::sax::XAttributeList > & xAttribs) override;
-    virtual void SAL_CALL endElement(const OUString& aName) override;
     virtual void SAL_CALL characters(const OUString& aChars) override;
-    virtual void SAL_CALL ignorableWhitespace(const OUString& aWhitespaces) override;
     virtual void SAL_CALL processingInstruction(const OUString& aTarget,
                                                 const OUString& aData) override;
     virtual void SAL_CALL setDocumentLocator(const css::uno::Reference< css::xml::sax::XLocator > & xLocator) override;
@@ -330,13 +330,6 @@ public:
     createUnknownChildContext(const OUString & Namespace, const OUString & Name,
         const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
 
-    // css::xml::sax::XExtendedDocumentHandler
-    virtual void SAL_CALL startCDATA() override;
-    virtual void SAL_CALL endCDATA() override;
-    virtual void SAL_CALL comment(const OUString& sComment) override;
-    virtual void SAL_CALL allowLineBreak() override;
-    virtual void SAL_CALL unknown(const OUString& sString) override;
-
     // XFastParser
     virtual void SAL_CALL parseStream( const css::xml::sax::InputSource& aInputSource ) override;
     virtual void SAL_CALL setFastDocumentHandler( const css::uno::Reference< css::xml::sax::XFastDocumentHandler >& Handler ) override;
diff --git a/xmloff/Library_xof.mk b/xmloff/Library_xof.mk
index 557935a6efc6..350f2cf0910a 100644
--- a/xmloff/Library_xof.mk
+++ b/xmloff/Library_xof.mk
@@ -42,6 +42,7 @@ $(eval $(call gb_Library_use_libraries,xof,\
     cppuhelper \
     sal \
     salhelper \
+    tl \
 	sax \
     xo \
 ))
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index 5cddf60205e9..40d947bb87cf 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -715,7 +715,7 @@ std::unique_ptr<SvXMLNamespaceMap> SvXMLImport::processNSAttributes(
     return pRewindMap;
 }
 
-void SAL_CALL SvXMLImport::startElement( const OUString& rName,
+void SvXMLImport::startElement( const OUString& rName,
                                          const uno::Reference< xml::sax::XAttributeList >& xAttrList )
 {
     //    SAL_INFO("svg", "startElement " << rName);
@@ -763,7 +763,7 @@ void SAL_CALL SvXMLImport::startElement( const OUString& rName,
     maContexts.push(xContext);
 }
 
-void SAL_CALL SvXMLImport::endElement( const OUString&
+void SvXMLImport::endElement( const OUString&
 #ifdef DBG_UTIL
 rName
 #endif
@@ -830,10 +830,6 @@ void SvXMLImport::Characters( const OUString& rChars )
     }
 }
 
-void SAL_CALL SvXMLImport::ignorableWhitespace( const OUString& )
-{
-}
-
 void SAL_CALL SvXMLImport::processingInstruction( const OUString&,
                                        const OUString& )
 {
@@ -959,27 +955,6 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
     return this;
 }
 
-// XExtendedDocumentHandler
-void SAL_CALL SvXMLImport::startCDATA()
-{
-}
-
-void SAL_CALL SvXMLImport::endCDATA()
-{
-}
-
-void SAL_CALL SvXMLImport::comment( const OUString& )
-{
-}
-
-void SAL_CALL SvXMLImport::allowLineBreak()
-{
-}
-
-void SAL_CALL SvXMLImport::unknown( const OUString& )
-{
-}
-
 void SvXMLImport::SetStatistics(const uno::Sequence< beans::NamedValue> &)
 {
     GetProgressBarHelper()->SetRepeat(false);
@@ -2187,6 +2162,20 @@ void SvXMLImport::NotifyMacroEventRead()
     mbNotifyMacroEventRead = true;
 }
 
+css::uno::Any SvXMLImport::queryInterface(css::uno::Type const & aType)
+{
+    assert( aType != cppu::UnoType<css::xml::sax::XDocumentHandler>::get() );
+    assert( aType != cppu::UnoType<css::xml::sax::XExtendedDocumentHandler>::get() );
+    return  cppu::WeakImplHelper<
+             css::xml::sax::XFastDocumentHandler,
+             css::lang::XServiceInfo,
+             css::lang::XInitialization,
+             css::document::XImporter,
+             css::document::XFilter,
+             css::lang::XUnoTunnel,
+             css::xml::sax::XFastParser>::queryInterface(aType);
+}
+
 SvXMLImportFastNamespaceHandler::SvXMLImportFastNamespaceHandler()
 {
 }
@@ -2327,9 +2316,8 @@ void SAL_CALL SvXMLLegacyToFastDocHandler::characters( const OUString& aChars )
     mrImport->characters( aChars );
 }
 
-void SAL_CALL SvXMLLegacyToFastDocHandler::ignorableWhitespace( const OUString& aWhitespaces )
+void SAL_CALL SvXMLLegacyToFastDocHandler::ignorableWhitespace( const OUString& )
 {
-    mrImport->ignorableWhitespace( aWhitespaces );
 }
 
 void SAL_CALL SvXMLLegacyToFastDocHandler::processingInstruction( const OUString& aTarget,


More information about the Libreoffice-commits mailing list