sd/source/ui/framework/factories/BasicPaneFactory.cxx    |    3 +--
 sd/source/ui/framework/factories/BasicViewFactory.cxx    |    3 +--
 sd/source/ui/framework/factories/PresentationFactory.cxx |    2 +-
 sd/source/ui/framework/module/CenterViewFocusModule.cxx  |   12 +++++-------
 sd/source/ui/framework/module/CenterViewFocusModule.hxx  |    5 +++--
 sd/source/ui/framework/module/DrawModule.cxx             |    3 ++-
 sd/source/ui/framework/module/ImpressModule.cxx          |    3 ++-
 sd/source/ui/framework/module/PresentationModule.cxx     |    2 +-
 sd/source/ui/framework/module/ShellStackGuard.cxx        |   11 ++++-------
 sd/source/ui/framework/module/ShellStackGuard.hxx        |    4 +++-
 sd/source/ui/framework/module/ToolBarModule.cxx          |   12 +++++-------
 sd/source/ui/framework/module/ToolBarModule.hxx          |    4 +++-
 sd/source/ui/inc/DrawController.hxx                      |   10 +---------
 sd/source/ui/inc/framework/DrawModule.hxx                |    7 ++++++-
 sd/source/ui/inc/framework/ImpressModule.hxx             |    7 ++++++-
 sd/source/ui/inc/framework/PresentationModule.hxx        |    7 ++++++-
 sd/source/ui/sidebar/PanelFactory.cxx                    |    2 +-
 sd/source/ui/slidesorter/shell/SlideSorterService.cxx    |    3 +--
 sd/source/ui/unoidl/DrawController.cxx                   |   13 -------------
 sd/source/ui/view/GraphicViewShellBase.cxx               |    3 ++-
 sd/source/ui/view/ImpressViewShellBase.cxx               |    5 +++--
 sd/source/ui/view/PresentationViewShellBase.cxx          |    4 ++--
 sd/source/ui/view/ViewTabBar.cxx                         |    6 ++----
 23 files changed, 61 insertions(+), 70 deletions(-)

New commits:
commit 5355f52b14d7237ba0f9fdd910eca579292242bd
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Mon Jan 16 15:55:28 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Jan 17 12:40:28 2023 +0000

    XUnoTunnel->dynamic_cast in sd::DrawController
    
    Just past the concrete type down through a couple of layers, rather than
    using a generic type and then casting
    
    Change-Id: I7ba6c83463f3db7176b72cb7e764d3659706ae78
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145638
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sd/source/ui/framework/factories/BasicPaneFactory.cxx 
b/sd/source/ui/framework/factories/BasicPaneFactory.cxx
index c01d315a3d9c..64cec425ad54 100644
--- a/sd/source/ui/framework/factories/BasicPaneFactory.cxx
+++ b/sd/source/ui/framework/factories/BasicPaneFactory.cxx
@@ -132,8 +132,7 @@ void SAL_CALL BasicPaneFactory::initialize (const 
Sequence<Any>& aArguments)
         // Tunnel through the controller to obtain access to the ViewShellBase.
         try
         {
-            Reference<lang::XUnoTunnel> xTunnel (xController, UNO_QUERY_THROW);
-            if (auto pController = 
comphelper::getFromUnoTunnel<DrawController>(xTunnel))
+            if (auto pController = 
dynamic_cast<DrawController*>(xController.get()))
                 mpViewShellBase = pController->GetViewShellBase();
         }
         catch(RuntimeException&)
diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx 
b/sd/source/ui/framework/factories/BasicViewFactory.cxx
index 5e862c6aebc2..6a6b8065e180 100644
--- a/sd/source/ui/framework/factories/BasicViewFactory.cxx
+++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx
@@ -237,8 +237,7 @@ void SAL_CALL BasicViewFactory::initialize (const 
Sequence<Any>& aArguments)
         Reference<frame::XController> xController (aArguments[0], 
UNO_QUERY_THROW);
 
         // Tunnel through the controller to obtain a ViewShellBase.
-        Reference<lang::XUnoTunnel> xTunnel (xController, UNO_QUERY_THROW);
-        ::sd::DrawController* pController = 
comphelper::getFromUnoTunnel<sd::DrawController>(xTunnel);
+        ::sd::DrawController* pController = 
dynamic_cast<sd::DrawController*>(xController.get());
         if (pController != nullptr)
             mpBase = pController->GetViewShellBase();
 
diff --git a/sd/source/ui/framework/factories/PresentationFactory.cxx 
b/sd/source/ui/framework/factories/PresentationFactory.cxx
index c1d408856187..73c2d4bdb732 100644
--- a/sd/source/ui/framework/factories/PresentationFactory.cxx
+++ b/sd/source/ui/framework/factories/PresentationFactory.cxx
@@ -113,7 +113,7 @@ void SAL_CALL PresentationFactory::releaseResource (
 {
     ThrowIfDisposed();
 
-    auto pController = 
comphelper::getFromUnoTunnel<sd::DrawController>(mxController);
+    auto pController = dynamic_cast<sd::DrawController*>(mxController.get());
     if (pController != nullptr)
     {
         ViewShellBase* pBase = pController->GetViewShellBase();
diff --git a/sd/source/ui/framework/module/CenterViewFocusModule.cxx 
b/sd/source/ui/framework/module/CenterViewFocusModule.cxx
index f5de61ca65d6..2c799e04bbb1 100644
--- a/sd/source/ui/framework/module/CenterViewFocusModule.cxx
+++ b/sd/source/ui/framework/module/CenterViewFocusModule.cxx
@@ -39,20 +39,18 @@ namespace sd::framework {
 
 //===== CenterViewFocusModule 
====================================================
 
-CenterViewFocusModule::CenterViewFocusModule (Reference<frame::XController> 
const & rxController)
+CenterViewFocusModule::CenterViewFocusModule 
(rtl::Reference<sd::DrawController> const & rxController)
     : mbValid(false),
       mpBase(nullptr),
       mbNewViewCreated(false)
 {
-    Reference<XControllerManager> xControllerManager (rxController, UNO_QUERY);
-    if (xControllerManager.is())
+    if (rxController.is())
     {
-        mxConfigurationController = 
xControllerManager->getConfigurationController();
+        mxConfigurationController = rxController->getConfigurationController();
 
         // Tunnel through the controller to obtain a ViewShellBase.
-        auto pController = 
comphelper::getFromUnoTunnel<sd::DrawController>(rxController);
-        if (pController != nullptr)
-            mpBase = pController->GetViewShellBase();
+        if (rxController != nullptr)
+            mpBase = rxController->GetViewShellBase();
 
         // Check, if all required objects do exist.
         if (mxConfigurationController.is() && mpBase!=nullptr)
diff --git a/sd/source/ui/framework/module/CenterViewFocusModule.hxx 
b/sd/source/ui/framework/module/CenterViewFocusModule.hxx
index c6d5d348e3b2..e721562db029 100644
--- a/sd/source/ui/framework/module/CenterViewFocusModule.hxx
+++ b/sd/source/ui/framework/module/CenterViewFocusModule.hxx
@@ -21,6 +21,7 @@
 
 #include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp>
 #include <comphelper/compbase.hxx>
+#include <rtl/ref.hxx>
 
 namespace com::sun::star::drawing::framework
 {
@@ -33,6 +34,7 @@ class XController;
 
 namespace sd
 {
+class DrawController;
 class ViewShellBase;
 }
 
@@ -49,8 +51,7 @@ typedef 
comphelper::WeakComponentImplHelper<css::drawing::framework::XConfigurat
 class CenterViewFocusModule final : public CenterViewFocusModuleInterfaceBase
 {
 public:
-    explicit CenterViewFocusModule(
-        css::uno::Reference<css::frame::XController> const& rxController);
+    explicit CenterViewFocusModule(rtl::Reference<sd::DrawController> const& 
rxController);
     virtual ~CenterViewFocusModule() override;
 
     virtual void disposing(std::unique_lock<std::mutex>&) override;
diff --git a/sd/source/ui/framework/module/DrawModule.cxx 
b/sd/source/ui/framework/module/DrawModule.cxx
index 17f4671fcb7f..aaa2d90bb38a 100644
--- a/sd/source/ui/framework/module/DrawModule.cxx
+++ b/sd/source/ui/framework/module/DrawModule.cxx
@@ -23,13 +23,14 @@
 #include "CenterViewFocusModule.hxx"
 #include "SlideSorterModule.hxx"
 #include "ToolBarModule.hxx"
+#include <DrawController.hxx>
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 
 namespace sd::framework
 {
-void DrawModule::Initialize(Reference<frame::XController> const& rxController)
+void DrawModule::Initialize(rtl::Reference<sd::DrawController> const& 
rxController)
 {
     new sd::framework::CenterViewFocusModule(rxController);
     new sd::framework::SlideSorterModule(rxController, 
FrameworkHelper::msLeftDrawPaneURL);
diff --git a/sd/source/ui/framework/module/ImpressModule.cxx 
b/sd/source/ui/framework/module/ImpressModule.cxx
index 139b250fd002..f89212e4a0a8 100644
--- a/sd/source/ui/framework/module/ImpressModule.cxx
+++ b/sd/source/ui/framework/module/ImpressModule.cxx
@@ -25,13 +25,14 @@
 #include "SlideSorterModule.hxx"
 #include "ToolBarModule.hxx"
 #include "ShellStackGuard.hxx"
+#include <DrawController.hxx>
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 
 namespace sd::framework {
 
-void ImpressModule::Initialize (Reference<frame::XController> const & 
rxController)
+void ImpressModule::Initialize (rtl::Reference<sd::DrawController> const & 
rxController)
 {
     new CenterViewFocusModule(rxController);
     new ViewTabBarModule(
diff --git a/sd/source/ui/framework/module/PresentationModule.cxx 
b/sd/source/ui/framework/module/PresentationModule.cxx
index fb0ac0558d80..c1ff16159d68 100644
--- a/sd/source/ui/framework/module/PresentationModule.cxx
+++ b/sd/source/ui/framework/module/PresentationModule.cxx
@@ -26,7 +26,7 @@ using namespace ::com::sun::star::uno;
 
 namespace sd::framework
 {
-void PresentationModule::Initialize(Reference<frame::XController> const& 
rxController)
+void PresentationModule::Initialize(rtl::Reference<sd::DrawController> const& 
rxController)
 {
     new sd::framework::CenterViewFocusModule(rxController);
 }
diff --git a/sd/source/ui/framework/module/ShellStackGuard.cxx 
b/sd/source/ui/framework/module/ShellStackGuard.cxx
index 83d73b055a54..d7dcfb0f2923 100644
--- a/sd/source/ui/framework/module/ShellStackGuard.cxx
+++ b/sd/source/ui/framework/module/ShellStackGuard.cxx
@@ -38,19 +38,16 @@ namespace sd::framework {
 
 //===== CenterViewFocusModule 
====================================================
 
-ShellStackGuard::ShellStackGuard (Reference<frame::XController> const & 
rxController)
+ShellStackGuard::ShellStackGuard (rtl::Reference<sd::DrawController> const & 
rxController)
     : mpBase(nullptr),
       maPrinterPollingIdle("sd ShellStackGuard PrinterPollingIdle")
 {
-    Reference<XControllerManager> xControllerManager (rxController, UNO_QUERY);
-    if (xControllerManager.is())
+    if (rxController.is())
     {
-        mxConfigurationController = 
xControllerManager->getConfigurationController();
+        mxConfigurationController = rxController->getConfigurationController();
 
         // Tunnel through the controller to obtain a ViewShellBase.
-        auto pController = 
comphelper::getFromUnoTunnel<sd::DrawController>(rxController);
-        if (pController != nullptr)
-            mpBase = pController->GetViewShellBase();
+        mpBase = rxController->GetViewShellBase();
     }
 
     if (mxConfigurationController.is())
diff --git a/sd/source/ui/framework/module/ShellStackGuard.hxx 
b/sd/source/ui/framework/module/ShellStackGuard.hxx
index 72b7ed2c6603..fe94037816f9 100644
--- a/sd/source/ui/framework/module/ShellStackGuard.hxx
+++ b/sd/source/ui/framework/module/ShellStackGuard.hxx
@@ -23,6 +23,7 @@
 
 #include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp>
 
+#include <rtl/ref.hxx>
 #include <vcl/idle.hxx>
 #include <comphelper/compbase.hxx>
 #include <memory>
@@ -38,6 +39,7 @@ class XController;
 
 namespace sd
 {
+class DrawController;
 class ViewShellBase;
 }
 
@@ -59,7 +61,7 @@ typedef 
comphelper::WeakComponentImplHelper<css::drawing::framework::XConfigurat
 class ShellStackGuard : public ShellStackGuardInterfaceBase
 {
 public:
-    explicit ShellStackGuard(css::uno::Reference<css::frame::XController> 
const& rxController);
+    explicit ShellStackGuard(rtl::Reference<sd::DrawController> const& 
rxController);
     virtual ~ShellStackGuard() override;
 
     virtual void disposing(std::unique_lock<std::mutex>&) override;
diff --git a/sd/source/ui/framework/module/ToolBarModule.cxx 
b/sd/source/ui/framework/module/ToolBarModule.cxx
index 3cecf7b031f0..de7f3e583126 100644
--- a/sd/source/ui/framework/module/ToolBarModule.cxx
+++ b/sd/source/ui/framework/module/ToolBarModule.cxx
@@ -41,20 +41,18 @@ namespace sd::framework {
 //===== ToolBarModule =========================================================
 
 ToolBarModule::ToolBarModule (
-    const Reference<frame::XController>& rxController)
+    const rtl::Reference<sd::DrawController>& rxController)
     : mpBase(nullptr),
       mbMainViewSwitchUpdatePending(false)
 {
     // Tunnel through the controller to obtain a ViewShellBase.
-    auto pController = 
comphelper::getFromUnoTunnel<sd::DrawController>(rxController);
-    if (pController != nullptr)
-        mpBase = pController->GetViewShellBase();
+    if (rxController != nullptr)
+        mpBase = rxController->GetViewShellBase();
 
-    Reference<XControllerManager> xControllerManager (rxController, UNO_QUERY);
-    if (!xControllerManager.is())
+    if (!rxController.is())
         return;
 
-    mxConfigurationController = 
xControllerManager->getConfigurationController();
+    mxConfigurationController = rxController->getConfigurationController();
     if (!mxConfigurationController.is())
         return;
 
diff --git a/sd/source/ui/framework/module/ToolBarModule.hxx 
b/sd/source/ui/framework/module/ToolBarModule.hxx
index f9189657de04..bf0c017ef981 100644
--- a/sd/source/ui/framework/module/ToolBarModule.hxx
+++ b/sd/source/ui/framework/module/ToolBarModule.hxx
@@ -23,12 +23,14 @@
 #include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp>
 #include <comphelper/compbase.hxx>
 #include <o3tl/deleter.hxx>
+#include <rtl/ref.hxx>
 #include <memory>
 
 namespace com::sun::star::drawing::framework { class XConfigurationController; 
}
 namespace com::sun::star::frame { class XController; }
 
 namespace sd {
+class DrawController;
 class ViewShellBase;
 }
 
@@ -50,7 +52,7 @@ public:
             This is the access point to the drawing framework.
     */
     explicit ToolBarModule (
-        const css::uno::Reference<css::frame::XController>& rxController);
+        const rtl::Reference<sd::DrawController>& rxController);
     virtual ~ToolBarModule() override;
 
     virtual void disposing(std::unique_lock<std::mutex>&) override;
diff --git a/sd/source/ui/inc/DrawController.hxx 
b/sd/source/ui/inc/DrawController.hxx
index 2c15e26eb601..c2f4f7be215d 100644
--- a/sd/source/ui/inc/DrawController.hxx
+++ b/sd/source/ui/inc/DrawController.hxx
@@ -26,7 +26,6 @@
 #include <com/sun/star/drawing/XDrawView.hpp>
 #include <com/sun/star/drawing/framework/XControllerManager.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
 #include <comphelper/uno3.hxx>
 #include <cppuhelper/implbase.hxx>
 #include <unotools/weakref.hxx>
@@ -51,8 +50,7 @@ typedef ::cppu::ImplInheritanceHelper <
     css::drawing::XDrawView,
     css::view::XSelectionChangeListener,
     css::view::XFormLayerAccess,
-    css::drawing::framework::XControllerManager,
-    css::lang::XUnoTunnel
+    css::drawing::framework::XControllerManager
     > DrawControllerInterfaceBase;
 
 class BroadcastHelperOwner
@@ -159,8 +157,6 @@ public:
     */
     void ReleaseViewShellBase();
 
-    static const css::uno::Sequence<sal_Int8>& getUnoTunnelId();
-
     DECLARE_XINTERFACE()
     DECLARE_XTYPEPROVIDER()
 
@@ -220,10 +216,6 @@ public:
     virtual css::uno::Reference<css::drawing::framework::XModuleController> 
SAL_CALL
         getModuleController() override;
 
-    // XUnoTunnel
-
-    virtual sal_Int64 SAL_CALL getSomething (const 
css::uno::Sequence<sal_Int8>& rId) override;
-
 private:
     /** This method must return the name to index table. This table
         contains all property names and types of this object.
diff --git a/sd/source/ui/inc/framework/DrawModule.hxx 
b/sd/source/ui/inc/framework/DrawModule.hxx
index 79a59b4f9030..819091998687 100644
--- a/sd/source/ui/inc/framework/DrawModule.hxx
+++ b/sd/source/ui/inc/framework/DrawModule.hxx
@@ -20,6 +20,7 @@
 #pragma once
 
 #include <sal/types.h>
+#include <rtl/ref.hxx>
 
 namespace com::sun::star::frame
 {
@@ -29,6 +30,10 @@ namespace com::sun::star::uno
 {
 template <typename> class Reference;
 }
+namespace sd
+{
+class DrawController;
+}
 
 namespace sd::framework
 {
@@ -38,7 +43,7 @@ namespace sd::framework
 class DrawModule
 {
 public:
-    static void Initialize(css::uno::Reference<css::frame::XController> const& 
rxController);
+    static void Initialize(rtl::Reference<sd::DrawController> const& 
rxController);
 };
 
 } // end of namespace sd::framework
diff --git a/sd/source/ui/inc/framework/ImpressModule.hxx 
b/sd/source/ui/inc/framework/ImpressModule.hxx
index da7ede9d9952..fc4e2b83978d 100644
--- a/sd/source/ui/inc/framework/ImpressModule.hxx
+++ b/sd/source/ui/inc/framework/ImpressModule.hxx
@@ -20,6 +20,7 @@
 #pragma once
 
 #include <sal/types.h>
+#include <rtl/ref.hxx>
 
 namespace com::sun::star::frame
 {
@@ -29,6 +30,10 @@ namespace com::sun::star::uno
 {
 template <class interface_type> class Reference;
 }
+namespace sd
+{
+class DrawController;
+}
 
 namespace sd::framework
 {
@@ -38,7 +43,7 @@ namespace sd::framework
 class ImpressModule
 {
 public:
-    static void Initialize(css::uno::Reference<css::frame::XController> const& 
rxController);
+    static void Initialize(rtl::Reference<sd::DrawController> const& 
rxController);
 };
 
 } // end of namespace sd::framework
diff --git a/sd/source/ui/inc/framework/PresentationModule.hxx 
b/sd/source/ui/inc/framework/PresentationModule.hxx
index f6dcfbc695da..437534f707f9 100644
--- a/sd/source/ui/inc/framework/PresentationModule.hxx
+++ b/sd/source/ui/inc/framework/PresentationModule.hxx
@@ -20,6 +20,7 @@
 #pragma once
 
 #include <sal/types.h>
+#include <rtl/ref.hxx>
 
 namespace com::sun::star::frame
 {
@@ -29,6 +30,10 @@ namespace com::sun::star::uno
 {
 template <class interface_type> class Reference;
 }
+namespace sd
+{
+class DrawController;
+}
 
 namespace sd::framework
 {
@@ -38,7 +43,7 @@ namespace sd::framework
 class PresentationModule
 {
 public:
-    static void Initialize(css::uno::Reference<css::frame::XController> const& 
rxController);
+    static void Initialize(rtl::Reference<sd::DrawController> const& 
rxController);
 };
 
 } // end of namespace sd::framework
diff --git a/sd/source/ui/sidebar/PanelFactory.cxx 
b/sd/source/ui/sidebar/PanelFactory.cxx
index c7ca8c25c4c8..752f3db7f1ac 100644
--- a/sd/source/ui/sidebar/PanelFactory.cxx
+++ b/sd/source/ui/sidebar/PanelFactory.cxx
@@ -79,7 +79,7 @@ Reference<ui::XUIElement> SAL_CALL 
PanelFactory::createUIElement (
 
     // Tunnel through the controller to obtain a ViewShellBase.
     ViewShellBase* pBase = nullptr;
-    auto pController = 
comphelper::getFromUnoTunnel<sd::DrawController>(xFrame->getController());
+    rtl::Reference<sd::DrawController> pController = 
dynamic_cast<sd::DrawController*>(xFrame->getController().get());
     if (pController != nullptr)
         pBase = pController->GetViewShellBase();
     if (pBase == nullptr)
diff --git a/sd/source/ui/slidesorter/shell/SlideSorterService.cxx 
b/sd/source/ui/slidesorter/shell/SlideSorterService.cxx
index a086f3b9e209..fa65cba421b4 100644
--- a/sd/source/ui/slidesorter/shell/SlideSorterService.cxx
+++ b/sd/source/ui/slidesorter/shell/SlideSorterService.cxx
@@ -78,8 +78,7 @@ void SAL_CALL SlideSorterService::initialize (const 
Sequence<Any>& rArguments)
 
     // Tunnel through the controller to obtain a ViewShellBase.
     ViewShellBase* pBase = nullptr;
-    Reference<lang::XUnoTunnel> xTunnel (xController, UNO_QUERY_THROW);
-    ::sd::DrawController* pController = 
comphelper::getFromUnoTunnel<sd::DrawController>(xTunnel);
+    ::sd::DrawController* pController = 
dynamic_cast<sd::DrawController*>(xController.get());
     if (pController != nullptr)
         pBase = pController->GetViewShellBase();
 
diff --git a/sd/source/ui/unoidl/DrawController.cxx 
b/sd/source/ui/unoidl/DrawController.cxx
index 41c30e23e45d..f33e9038131f 100644
--- a/sd/source/ui/unoidl/DrawController.cxx
+++ b/sd/source/ui/unoidl/DrawController.cxx
@@ -551,19 +551,6 @@ Reference<XModuleController> SAL_CALL
     return mxModuleController;
 }
 
-//===== XUnoTunnel ============================================================
-
-const Sequence<sal_Int8>& DrawController::getUnoTunnelId()
-{
-    static const comphelper::UnoIdInit theDrawControllerUnoTunnelId;
-    return theDrawControllerUnoTunnelId.getSeq();
-}
-
-sal_Int64 SAL_CALL DrawController::getSomething (const Sequence<sal_Int8>& rId)
-{
-    return comphelper::getSomethingImpl(rId, this);
-}
-
 //===== Properties ============================================================
 
 void DrawController::FillPropertyTable (
diff --git a/sd/source/ui/view/GraphicViewShellBase.cxx 
b/sd/source/ui/view/GraphicViewShellBase.cxx
index d58c8a0d2479..573c9fc2a058 100644
--- a/sd/source/ui/view/GraphicViewShellBase.cxx
+++ b/sd/source/ui/view/GraphicViewShellBase.cxx
@@ -20,6 +20,7 @@
 #include <GraphicViewShellBase.hxx>
 
 #include <GraphicDocShell.hxx>
+#include <DrawController.hxx>
 #include <app.hrc>
 #include <framework/DrawModule.hxx>
 #include <framework/FrameworkHelper.hxx>
@@ -84,7 +85,7 @@ void GraphicViewShellBase::Execute(SfxRequest& rRequest)
 
 void GraphicViewShellBase::InitializeFramework()
 {
-    css::uno::Reference<css::frame::XController> xController(GetController());
+    rtl::Reference<sd::DrawController> xController(&GetDrawController());
     sd::framework::DrawModule::Initialize(xController);
 }
 
diff --git a/sd/source/ui/view/ImpressViewShellBase.cxx 
b/sd/source/ui/view/ImpressViewShellBase.cxx
index 96b0b5aa9154..9b28213970ec 100644
--- a/sd/source/ui/view/ImpressViewShellBase.cxx
+++ b/sd/source/ui/view/ImpressViewShellBase.cxx
@@ -20,6 +20,7 @@
 #include <ImpressViewShellBase.hxx>
 
 #include <DrawDocShell.hxx>
+#include <DrawController.hxx>
 #include <app.hrc>
 #include <framework/FrameworkHelper.hxx>
 #include <framework/ImpressModule.hxx>
@@ -87,8 +88,8 @@ void ImpressViewShellBase::Execute (SfxRequest& rRequest)
 
 void ImpressViewShellBase::InitializeFramework()
 {
-    css::uno::Reference<css::frame::XController>
-        xController (GetController());
+    rtl::Reference<sd::DrawController>
+        xController (&GetDrawController());
     sd::framework::ImpressModule::Initialize(xController);
 }
 
diff --git a/sd/source/ui/view/PresentationViewShellBase.cxx 
b/sd/source/ui/view/PresentationViewShellBase.cxx
index 789afbbdde86..9c1faff02713 100644
--- a/sd/source/ui/view/PresentationViewShellBase.cxx
+++ b/sd/source/ui/view/PresentationViewShellBase.cxx
@@ -19,6 +19,7 @@
 
 #include <PresentationViewShellBase.hxx>
 #include <DrawDocShell.hxx>
+#include <DrawController.hxx>
 #include <framework/FrameworkHelper.hxx>
 #include <framework/PresentationModule.hxx>
 
@@ -84,8 +85,7 @@ PresentationViewShellBase::~PresentationViewShellBase()
 
 void PresentationViewShellBase::InitializeFramework()
 {
-    css::uno::Reference<css::frame::XController>
-        xController (GetController());
+    rtl::Reference<sd::DrawController> xController (&GetDrawController());
     sd::framework::PresentationModule::Initialize(xController);
 }
 
diff --git a/sd/source/ui/view/ViewTabBar.cxx b/sd/source/ui/view/ViewTabBar.cxx
index d9fdd2addfdf..6e9f23e3b674 100644
--- a/sd/source/ui/view/ViewTabBar.cxx
+++ b/sd/source/ui/view/ViewTabBar.cxx
@@ -70,8 +70,7 @@ ViewTabBar::ViewTabBar (
     // view frame.
     try
     {
-        Reference<lang::XUnoTunnel> xTunnel (mxController, UNO_QUERY_THROW);
-        if (auto pController = 
comphelper::getFromUnoTunnel<DrawController>(xTunnel))
+        if (auto pController = 
dynamic_cast<DrawController*>(mxController.get()))
             mpViewShellBase = pController->GetViewShellBase();
     }
     catch (const RuntimeException&)
@@ -149,8 +148,7 @@ vcl::Window* ViewTabBar::GetAnchorWindow(
     // view frame.
     try
     {
-        Reference<lang::XUnoTunnel> xTunnel (rxController, UNO_QUERY_THROW);
-        if (auto pController = 
comphelper::getFromUnoTunnel<DrawController>(xTunnel))
+        if (auto pController = 
dynamic_cast<DrawController*>(rxController.get()))
             pBase = pController->GetViewShellBase();
     }
     catch (const RuntimeException&)

Reply via email to