sw/source/uibase/inc/uivwimp.hxx     |    5 +++--
 sw/source/uibase/inc/unodispatch.hxx |    6 ------
 sw/source/uibase/uiview/uivwimp.cxx  |   11 ++++-------
 sw/source/uibase/uno/unodispatch.cxx |   12 ------------
 4 files changed, 7 insertions(+), 27 deletions(-)

New commits:
commit b228565546176b459eb610e11c026d9493771280
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Fri Jan 20 10:51:44 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sun Jan 22 06:50:49 2023 +0000

    avoid some casting in SwView_Impl
    
    by just storing the underlying type
    
    Change-Id: I5d811b64145003fd3df349a6375b7f44cf125623
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145928
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/source/uibase/inc/uivwimp.hxx b/sw/source/uibase/inc/uivwimp.hxx
index 0d401d92f78d..cbdfb18c7fc9 100644
--- a/sw/source/uibase/inc/uivwimp.hxx
+++ b/sw/source/uibase/inc/uivwimp.hxx
@@ -87,7 +87,7 @@ class SwXDispatchProviderInterceptor;
 class SwView_Impl
 {
     rtl::Reference< SwXDispatchProviderInterceptor > 
m_xDispatchProviderInterceptor;
-    css::uno::Reference< css::view::XSelectionSupplier >              
mxXTextView;       // UNO object
+    rtl::Reference< SwXTextView > mxXTextView;       // UNO object
     std::vector< unotools::WeakReference< SwTransferable > > mxTransferables;
 
     // temporary document for printing text of selection / multi selection
diff --git a/sw/source/uibase/uiview/uivwimp.cxx 
b/sw/source/uibase/uiview/uivwimp.cxx
index f5dc49330f83..86b545db8d68 100644
--- a/sw/source/uibase/uiview/uivwimp.cxx
+++ b/sw/source/uibase/uiview/uivwimp.cxx
@@ -63,8 +63,7 @@ SwView_Impl::~SwView_Impl()
 {
     if(m_xDispatchProviderInterceptor)
         m_xDispatchProviderInterceptor->Invalidate();
-    view::XSelectionSupplier* pTextView = mxXTextView.get();
-    static_cast<SwXTextView*>(pTextView)->Invalidate();
+    mxXTextView->Invalidate();
     mxXTextView.clear();
     if( mxScanEvtLstnr.is() )
            mxScanEvtLstnr->ViewDestroyed();
@@ -92,8 +91,7 @@ view::XSelectionSupplier*   SwView_Impl::GetUNOObject()
 
 SwXTextView*    SwView_Impl::GetUNOObject_Impl()
 {
-    view::XSelectionSupplier* pTextView = mxXTextView.get();
-    return static_cast<SwXTextView*>(pTextView);
+    return mxXTextView.get();
 }
 
 void SwView_Impl::ExecuteScan( SfxRequest& rReq )
commit 8aaa1778bb7b65b6e498c26fb03fd8757a3329ae
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Fri Jan 20 10:49:33 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sun Jan 22 06:50:35 2023 +0000

    XUnoTunnel->dynamic_cast in SwXDispatchProviderInterceptor
    
    just store the underlying type, elides the need for dynamic_cast
    
    Change-Id: I974bf72f71a37b8dae25750c8f29648bb67adc09
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145927
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/source/uibase/inc/uivwimp.hxx b/sw/source/uibase/inc/uivwimp.hxx
index 352469f33401..0d401d92f78d 100644
--- a/sw/source/uibase/inc/uivwimp.hxx
+++ b/sw/source/uibase/inc/uivwimp.hxx
@@ -82,10 +82,11 @@ public:
 };
 
 class SwMailMergeConfigItem;
+class SwXDispatchProviderInterceptor;
 
 class SwView_Impl
 {
-    css::uno::Reference< css::frame::XDispatchProviderInterceptor >   
m_xDispatchProviderInterceptor;
+    rtl::Reference< SwXDispatchProviderInterceptor > 
m_xDispatchProviderInterceptor;
     css::uno::Reference< css::view::XSelectionSupplier >              
mxXTextView;       // UNO object
     std::vector< unotools::WeakReference< SwTransferable > > mxTransferables;
 
diff --git a/sw/source/uibase/inc/unodispatch.hxx 
b/sw/source/uibase/inc/unodispatch.hxx
index b748d5a1052d..961637788f5a 100644
--- a/sw/source/uibase/inc/unodispatch.hxx
+++ b/sw/source/uibase/inc/unodispatch.hxx
@@ -22,7 +22,6 @@
 #include <com/sun/star/frame/XDispatchProviderInterception.hpp>
 #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
 #include <com/sun/star/view/XSelectionChangeListener.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
 #include <com/sun/star/frame/XDispatch.hpp>
 #include <com/sun/star/frame/XInterceptorInfo.hpp>
 #include <cppuhelper/implbase.hxx>
@@ -35,7 +34,6 @@ class SwXDispatchProviderInterceptor final : public 
cppu::WeakImplHelper
 <
     css::frame::XDispatchProviderInterceptor,
     css::lang::XEventListener,
-    css::lang::XUnoTunnel,
     css::frame::XInterceptorInfo
 >
 {
@@ -79,10 +77,6 @@ public:
     // XEventListener
     virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) 
override;
 
-    //XUnoTunnel
-    static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId();
-    virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< 
sal_Int8 >& aIdentifier ) override;
-
     // XInterceptorInfo
     virtual css::uno::Sequence<OUString> SAL_CALL getInterceptedURLs() 
override;
 
diff --git a/sw/source/uibase/uiview/uivwimp.cxx 
b/sw/source/uibase/uiview/uivwimp.cxx
index ee9693bd8c3b..f5dc49330f83 100644
--- a/sw/source/uibase/uiview/uivwimp.cxx
+++ b/sw/source/uibase/uiview/uivwimp.cxx
@@ -61,9 +61,8 @@ SwView_Impl::SwView_Impl(SwView* pShell)
 
 SwView_Impl::~SwView_Impl()
 {
-    auto pInterceptor = 
comphelper::getFromUnoTunnel<SwXDispatchProviderInterceptor>(m_xDispatchProviderInterceptor);
-    if(pInterceptor)
-        pInterceptor->Invalidate();
+    if(m_xDispatchProviderInterceptor)
+        m_xDispatchProviderInterceptor->Invalidate();
     view::XSelectionSupplier* pTextView = mxXTextView.get();
     static_cast<SwXTextView*>(pTextView)->Invalidate();
     mxXTextView.clear();
diff --git a/sw/source/uibase/uno/unodispatch.cxx 
b/sw/source/uibase/uno/unodispatch.cxx
index 0c7f465806d9..8e65ff58bc9f 100644
--- a/sw/source/uibase/uno/unodispatch.cxx
+++ b/sw/source/uibase/uno/unodispatch.cxx
@@ -151,18 +151,6 @@ void SwXDispatchProviderInterceptor::disposing( const 
lang::EventObject& )
     m_xIntercepted = nullptr;
 }
 
-const uno::Sequence< sal_Int8 > & 
SwXDispatchProviderInterceptor::getUnoTunnelId()
-{
-    static const comphelper::UnoIdInit 
theSwXDispatchProviderInterceptorUnoTunnelId;
-    return theSwXDispatchProviderInterceptorUnoTunnelId.getSeq();
-}
-
-sal_Int64 SwXDispatchProviderInterceptor::getSomething(
-    const uno::Sequence< sal_Int8 >& aIdentifier )
-{
-    return comphelper::getSomethingImpl(aIdentifier, this);
-}
-
 void    SwXDispatchProviderInterceptor::Invalidate()
 {
     DispatchMutexLock_Impl aLock;

Reply via email to