sw/source/core/inc/unocontentcontrol.hxx     |   12 +++---------
 sw/source/core/inc/unofield.hxx              |    7 -------
 sw/source/core/unocore/unocontentcontrol.cxx |   12 ------------
 sw/source/core/unocore/unofield.cxx          |   17 +----------------
 sw/source/core/unocore/unotext.cxx           |    2 +-
 5 files changed, 5 insertions(+), 45 deletions(-)

New commits:
commit 54d12f7b1fef71ca47682fc7dc2764512bd23946
Author:     Noel Grandin <[email protected]>
AuthorDate: Thu Jan 19 10:16:12 2023 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Fri Jan 20 08:45:58 2023 +0000

    XUnoTunnel->dynamic_cast in SwXFieldMaster
    
    Change-Id: I85f4ffab71b8321cc592e3b70fec63111bbd78ef
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145860
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/sw/source/core/inc/unofield.hxx b/sw/source/core/inc/unofield.hxx
index 7ec3d45b9ff9..0de0e886df6b 100644
--- a/sw/source/core/inc/unofield.hxx
+++ b/sw/source/core/inc/unofield.hxx
@@ -39,7 +39,6 @@ class SwSetExpField;
 typedef ::cppu::WeakImplHelper
 <   css::beans::XPropertySet
 ,   css::lang::XServiceInfo
-,   css::lang::XUnoTunnel
 ,   css::lang::XComponent
 > SwXFieldMaster_Base;
 
@@ -69,12 +68,6 @@ public:
 
     SwFieldType* GetFieldType(bool bDontCreate = false) const;
 
-    static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId();
-
-    // XUnoTunnel
-    virtual sal_Int64 SAL_CALL getSomething(
-            const css::uno::Sequence< sal_Int8 >& rIdentifier) override;
-
     // XServiceInfo
     virtual OUString SAL_CALL getImplementationName() override;
     virtual sal_Bool SAL_CALL supportsService(
diff --git a/sw/source/core/unocore/unofield.cxx 
b/sw/source/core/unocore/unofield.cxx
index ffb0fa8bd9f8..7dffffa18e20 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -457,18 +457,6 @@ protected:
     virtual void Notify(const SfxHint& rHint) override;
 };
 
-const uno::Sequence< sal_Int8 > & SwXFieldMaster::getUnoTunnelId()
-{
-    static const comphelper::UnoIdInit theSwXFieldMasterUnoTunnelId;
-    return theSwXFieldMasterUnoTunnelId.getSeq();
-}
-
-sal_Int64 SAL_CALL
-SwXFieldMaster::getSomething(const uno::Sequence< sal_Int8 >& rId)
-{
-    return comphelper::getSomethingImpl<SwXFieldMaster>(rId, this);
-}
-
 OUString SAL_CALL
 SwXFieldMaster::getImplementationName()
 {
@@ -1306,10 +1294,7 @@ void SAL_CALL SwXTextField::attachTextFieldMaster(
 
     if (!m_pImpl->IsDescriptor())
         throw uno::RuntimeException();
-    uno::Reference< lang::XUnoTunnel > xMasterTunnel(xFieldMaster, 
uno::UNO_QUERY);
-    if (!xMasterTunnel.is())
-        throw lang::IllegalArgumentException();
-    SwXFieldMaster* pMaster = 
comphelper::getFromUnoTunnel<SwXFieldMaster>(xMasterTunnel);
+    SwXFieldMaster* pMaster = 
dynamic_cast<SwXFieldMaster*>(xFieldMaster.get());
 
     SwFieldType* pFieldType = pMaster ? pMaster->GetFieldType() : nullptr;
     if (!pFieldType ||
commit 080b78ea0c27659468ae084c0416017d91e4392d
Author:     Noel Grandin <[email protected]>
AuthorDate: Thu Jan 19 10:14:16 2023 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Fri Jan 20 08:45:50 2023 +0000

    XUnoTunnel->dynamic_cast in SwXContentControl
    
    Change-Id: I4513cc38b31062327a773afd91dd3b4ee98c1bcb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145859
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/sw/source/core/inc/unocontentcontrol.hxx 
b/sw/source/core/inc/unocontentcontrol.hxx
index 409564d5bb0e..6f3d903d9d1b 100644
--- a/sw/source/core/inc/unocontentcontrol.hxx
+++ b/sw/source/core/inc/unocontentcontrol.hxx
@@ -23,7 +23,6 @@
 #include <deque>
 
 #include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/container/XChild.hpp>
 #include <com/sun/star/container/XEnumerationAccess.hpp>
@@ -48,9 +47,9 @@ class SwContentControl;
  * service.
  */
 class SwXContentControl
-    : public cppu::WeakImplHelper<css::lang::XUnoTunnel, 
css::lang::XServiceInfo,
-                                  css::container::XEnumerationAccess, 
css::text::XTextContent,
-                                  css::text::XText, css::beans::XPropertySet>
+    : public cppu::WeakImplHelper<css::lang::XServiceInfo, 
css::container::XEnumerationAccess,
+                                  css::text::XTextContent, css::text::XText,
+                                  css::beans::XPropertySet>
 {
     class Impl;
     sw::UnoImplPtr<Impl> m_pImpl;
@@ -83,11 +82,6 @@ public:
     bool SetContentRange(SwTextNode*& rpNode, sal_Int32& rStart, sal_Int32& 
rEnd) const;
     const css::uno::Reference<css::text::XText>& GetParentText() const;
 
-    static const css::uno::Sequence<sal_Int8>& getUnoTunnelId();
-
-    // XUnoTunnel
-    sal_Int64 SAL_CALL getSomething(const css::uno::Sequence<sal_Int8>& 
Identifier) override;
-
     // XServiceInfo
     OUString SAL_CALL getImplementationName() override;
     sal_Bool SAL_CALL supportsService(const OUString& rServiceName) override;
diff --git a/sw/source/core/unocore/unocontentcontrol.cxx 
b/sw/source/core/unocore/unocontentcontrol.cxx
index ceb7a2933dd5..12fd86341603 100644
--- a/sw/source/core/unocore/unocontentcontrol.cxx
+++ b/sw/source/core/unocore/unocontentcontrol.cxx
@@ -346,18 +346,6 @@ bool SwXContentControl::SetContentRange(SwTextNode*& 
rpNode, sal_Int32& rStart,
     return false;
 }
 
-const uno::Sequence<sal_Int8>& SwXContentControl::getUnoTunnelId()
-{
-    static const comphelper::UnoIdInit theSwXContentControlUnoTunnelId;
-    return theSwXContentControlUnoTunnelId.getSeq();
-}
-
-// XUnoTunnel
-sal_Int64 SAL_CALL SwXContentControl::getSomething(const 
uno::Sequence<sal_Int8>& rId)
-{
-    return comphelper::getSomethingImpl<SwXContentControl>(rId, this);
-}
-
 // XServiceInfo
 OUString SAL_CALL SwXContentControl::getImplementationName() { return 
"SwXContentControl"; }
 
diff --git a/sw/source/core/unocore/unotext.cxx 
b/sw/source/core/unocore/unotext.cxx
index 81f731ba3026..f6f9abf50ffb 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -578,7 +578,7 @@ SwXText::insertTextContent(
         comphelper::getFromUnoTunnel<SwXReferenceMark>(xContentTunnel);
     SwXMeta *const pMeta =
         comphelper::getFromUnoTunnel<SwXMeta>(xContentTunnel);
-    auto* pContentControl = 
comphelper::getFromUnoTunnel<SwXContentControl>(xContentTunnel);
+    auto* pContentControl = dynamic_cast<SwXContentControl*>(xContent.get());
     SwXTextField* pTextField =
         comphelper::getFromUnoTunnel<SwXTextField>(xContentTunnel);
     if (pTextField && pTextField->GetServiceId() != 
SwServiceType::FieldTypeAnnotation)

Reply via email to