include/xmloff/xmlimp.hxx               |    6 ------
 starmath/inc/mathml/import.hxx          |    4 ----
 starmath/inc/mathml/mathmlimport.hxx    |    4 ----
 starmath/source/mathml/import.cxx       |   16 ++--------------
 starmath/source/mathml/mathmlimport.cxx |   14 +-------------
 sw/source/filter/xml/xmlimp.cxx         |   12 ------------
 sw/source/filter/xml/xmlimp.hxx         |    4 ----
 xmloff/source/core/xmlimp.cxx           |   15 ++-------------
 8 files changed, 5 insertions(+), 70 deletions(-)

New commits:
commit e07d4c03ac08bc1139420210214e69115cf08586
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Thu Jan 12 16:45:39 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sat Jan 14 07:21:10 2023 +0000

    XUnoTunnel->dynamic_cast in SvXMLImport
    
    Change-Id: I070bc1a8136e5b492c0ea56774a274b9a3d2ec2d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145494
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx
index 26873175268d..3e1d8966b47b 100644
--- a/include/xmloff/xmlimp.hxx
+++ b/include/xmloff/xmlimp.hxx
@@ -31,7 +31,6 @@
 #include <sal/types.h>
 #include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
 #include <com/sun/star/xml/sax/XFastParser.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
 #include <com/sun/star/lang/XInitialization.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/document/XImporter.hpp>
@@ -182,7 +181,6 @@ class XMLOFF_DLLPUBLIC SAL_LOPLUGIN_ANNOTATE("crosscast") 
SvXMLImport : public c
              css::lang::XInitialization,
              css::document::XImporter,
              css::document::XFilter,
-             css::lang::XUnoTunnel,
              css::xml::sax::XFastParser>
 {
     friend class SvXMLImportContext;
@@ -354,10 +352,6 @@ public:
     // XInitialization
     virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any 
>& aArguments ) override;
 
-    // XUnoTunnel
-    static const css::uno::Sequence<sal_Int8>& getUnoTunnelId() noexcept;
-    virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< 
sal_Int8 >& aIdentifier ) override;
-
     // XServiceInfo
     virtual OUString SAL_CALL getImplementationName(  ) final override;
     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) 
final override;
diff --git a/starmath/inc/mathml/import.hxx b/starmath/inc/mathml/import.hxx
index 56f7fe68814b..312768e43f22 100644
--- a/starmath/inc/mathml/import.hxx
+++ b/starmath/inc/mathml/import.hxx
@@ -115,10 +115,6 @@ public:
     virtual ~SmMLImport() noexcept override { cleanup(); };
 
 public:
-    // XUnoTunnel
-    sal_Int64 SAL_CALL getSomething(const css::uno::Sequence<sal_Int8>& rId) 
override;
-    static const css::uno::Sequence<sal_Int8>& getUnoTunnelId() noexcept;
-
     /** End the document
     */
     void SAL_CALL endDocument() override;
diff --git a/starmath/inc/mathml/mathmlimport.hxx 
b/starmath/inc/mathml/mathmlimport.hxx
index 03a78b92a76d..c18b587f20b5 100644
--- a/starmath/inc/mathml/mathmlimport.hxx
+++ b/starmath/inc/mathml/mathmlimport.hxx
@@ -84,10 +84,6 @@ public:
                 OUString const& implementationName, SvXMLImportFlags 
nImportFlags);
     virtual ~SmXMLImport() noexcept override;
 
-    // XUnoTunnel
-    sal_Int64 SAL_CALL getSomething(const css::uno::Sequence<sal_Int8>& rId) 
override;
-    static const css::uno::Sequence<sal_Int8>& getUnoTunnelId() noexcept;
-
     void SAL_CALL endDocument() override;
 
     SvXMLImportContext* CreateFastContext(
diff --git a/starmath/source/mathml/import.cxx 
b/starmath/source/mathml/import.cxx
index 90469abaa0d1..62cd455ad069 100644
--- a/starmath/source/mathml/import.cxx
+++ b/starmath/source/mathml/import.cxx
@@ -429,7 +429,7 @@ ErrCode SmMLImportWrapper::ReadThroughComponentIS(
 
         if (nSyntaxVersion == 5)
         {
-            SmXMLImport* pXMlImport = 
comphelper::getFromUnoTunnel<SmXMLImport>(xFilter);
+            SmXMLImport* pXMlImport = 
dynamic_cast<SmXMLImport*>(xFilter.get());
             if (pXMlImport != nullptr && pXMlImport->GetSuccess())
                 return ERRCODE_NONE;
             else
@@ -442,7 +442,7 @@ ErrCode SmMLImportWrapper::ReadThroughComponentIS(
             }
         }
 
-        m_pMlImport = comphelper::getFromUnoTunnel<SmMLImport>(xFilter);
+        m_pMlImport = dynamic_cast<SmMLImport*>(xFilter.get());
         if (m_pMlImport != nullptr && m_pMlImport->getSuccess())
             return ERRCODE_NONE;
         else
@@ -1203,18 +1203,6 @@ void SmMLImportContext::endFastElement(sal_Int32) { 
inheritStyleEnd(); }
 // SmMLImport
 
/*************************************************************************************************/
 
-const uno::Sequence<sal_Int8>& SmMLImport::getUnoTunnelId() noexcept
-{
-    static const comphelper::UnoIdInit theSmMLImportUnoTunnelId;
-    return theSmMLImportUnoTunnelId.getSeq();
-}
-
-sal_Int64 SAL_CALL SmMLImport::getSomething(const uno::Sequence<sal_Int8>& rId)
-{
-    return comphelper::getSomethingImpl(rId, this,
-                                        
comphelper::FallbackToGetSomethingOf<SvXMLImport>{});
-}
-
 SvXMLImportContext*
 SmMLImport::CreateFastContext(sal_Int32 nElement,
                               const 
uno::Reference<xml::sax::XFastAttributeList>& /*xAttrList*/)
diff --git a/starmath/source/mathml/mathmlimport.cxx 
b/starmath/source/mathml/mathmlimport.cxx
index e37c604ae150..f31383d076ea 100644
--- a/starmath/source/mathml/mathmlimport.cxx
+++ b/starmath/source/mathml/mathmlimport.cxx
@@ -294,7 +294,7 @@ ErrCode SmXMLImportWrapper::ReadThroughComponent(const 
Reference<io::XInputStrea
             xParser->parseStream(aParserInput);
         }
 
-        auto pFilter = comphelper::getFromUnoTunnel<SmXMLImport>(xFilter);
+        auto pFilter = dynamic_cast<SmXMLImport*>(xFilter.get());
         if (pFilter && pFilter->GetSuccess())
             nError = ERRCODE_NONE;
     }
@@ -404,12 +404,6 @@ SmXMLImport::SmXMLImport(const 
css::uno::Reference<css::uno::XComponentContext>&
 {
 }
 
-const uno::Sequence<sal_Int8>& SmXMLImport::getUnoTunnelId() noexcept
-{
-    static const comphelper::UnoIdInit theSmXMLImportUnoTunnelId;
-    return theSmXMLImportUnoTunnelId.getSeq();
-}
-
 extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
 Math_XMLImporter_get_implementation(uno::XComponentContext* pCtx,
                                     uno::Sequence<uno::Any> const& /*rSeq*/)
@@ -434,12 +428,6 @@ 
Math_XMLOasisSettingsImporter_get_implementation(uno::XComponentContext* pCtx,
                                          SvXMLImportFlags::SETTINGS));
 }
 
-sal_Int64 SAL_CALL SmXMLImport::getSomething(const uno::Sequence<sal_Int8>& 
rId)
-{
-    return comphelper::getSomethingImpl(rId, this,
-                                        
comphelper::FallbackToGetSomethingOf<SvXMLImport>{});
-}
-
 void SmXMLImport::endDocument()
 {
     //Set the resulted tree into the SmDocShell where it belongs
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index 2cb58cf2aa47..03c30542efa3 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -361,18 +361,6 @@ void SwXMLImport::setStyleInsertMode( SfxStyleFamily 
nFamilies,
     m_bLoadDoc = false;
 }
 
-const Sequence< sal_Int8 > & SwXMLImport::getUnoTunnelId() noexcept
-{
-    static const comphelper::UnoIdInit theSwXMLImportUnoTunnelId;
-    return theSwXMLImportUnoTunnelId.getSeq();
-}
-
-sal_Int64 SAL_CALL SwXMLImport::getSomething( const Sequence< sal_Int8 >& rId )
-{
-    return comphelper::getSomethingImpl(rId, this,
-                                        
comphelper::FallbackToGetSomethingOf<SvXMLImport>{});
-}
-
 static OTextCursorHelper *lcl_xml_GetSwXTextCursor( const Reference < 
XTextCursor >& rTextCursor )
 {
     OTextCursorHelper* pTextCursor = 
comphelper::getFromUnoTunnel<OTextCursorHelper>(rTextCursor);
diff --git a/sw/source/filter/xml/xmlimp.hxx b/sw/source/filter/xml/xmlimp.hxx
index 22f012c4dbfc..e23c7399d5ea 100644
--- a/sw/source/filter/xml/xmlimp.hxx
+++ b/sw/source/filter/xml/xmlimp.hxx
@@ -113,10 +113,6 @@ public:
     virtual void SAL_CALL startDocument() override;
     virtual void SAL_CALL endDocument() override;
 
-    // XUnoTunnel
-    static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId() noexcept;
-    virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< 
sal_Int8 >& aIdentifier ) override;
-
     // XInitialization
     virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any 
>& aArguments ) override;
 
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index e8b4ae2e0f97..4f33a1ab6607 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -46,6 +46,7 @@
 #include <xmloff/xmlerror.hxx>
 #include <com/sun/star/container/XNameContainer.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
 #include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
 #include <com/sun/star/io/XOutputStream.hpp>
 #include <com/sun/star/util/MeasureUnit.hpp>
@@ -473,18 +474,6 @@ bool SvXMLImport::addEmbeddedFont(const 
css::uno::Reference< css::io::XInputStre
     return mxEmbeddedFontHelper->addEmbeddedFont(stream, fontName, extra, key, 
eot);
 }
 
-const css::uno::Sequence<sal_Int8>& SvXMLImport::getUnoTunnelId() noexcept
-{
-    static const comphelper::UnoIdInit theSvXMLImportUnoTunnelId;
-    return theSvXMLImportUnoTunnelId.getSeq();
-}
-
-// XUnoTunnel
-sal_Int64 SAL_CALL SvXMLImport::getSomething( const uno::Sequence< sal_Int8 >& 
rId )
-{
-    return comphelper::getSomethingImpl(rId, this);
-}
-
 namespace
 {
     class setFastDocumentHandlerGuard
@@ -1404,7 +1393,7 @@ void SvXMLImport::AddStyleDisplayName( XmlStyleFamily 
nFamily,
                 xPropertySetInfo->hasPropertyByName(sPrivateData) )
             {
                 Reference < XInterface > xIfc(
-                        static_cast< XUnoTunnel *>( mpStyleMap.get() ) );
+                        static_cast< css::lang::XUnoTunnel *>( 
mpStyleMap.get() ) );
                 mxImportInfo->setPropertyValue( sPrivateData, Any(xIfc) );
             }
         }

Reply via email to