summaryrefslogtreecommitdiff
path: root/sd/source/ui/framework
diff options
context:
space:
mode:
authorArkadiy Illarionov <qarkai@gmail.com>2019-09-22 18:20:39 +0300
committerArkadiy Illarionov <qarkai@gmail.com>2019-09-23 15:47:12 +0200
commit1d398fb983d8f8b53a78e7c47b588fc1f1e7f748 (patch)
tree89e11384ea13d73b3c1dc198c5fee8675036abbe /sd/source/ui/framework
parentcd6780aae1392d4c1af0b15b311a4966834a9602 (diff)
tdf#39593 use getUnoTunnelImplementation
Change-Id: I78eb67913a568c610e38e5002f914773c4906dfd Reviewed-on: https://gerrit.libreoffice.org/79350 Tested-by: Jenkins Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com>
Diffstat (limited to 'sd/source/ui/framework')
-rw-r--r--sd/source/ui/framework/factories/PresentationFactory.cxx16
-rw-r--r--sd/source/ui/framework/module/CenterViewFocusModule.cxx18
-rw-r--r--sd/source/ui/framework/module/ShellStackGuard.cxx12
-rw-r--r--sd/source/ui/framework/module/ToolBarModule.cxx12
4 files changed, 20 insertions, 38 deletions
diff --git a/sd/source/ui/framework/factories/PresentationFactory.cxx b/sd/source/ui/framework/factories/PresentationFactory.cxx
index 42df2c979b6a..7647a35e47f9 100644
--- a/sd/source/ui/framework/factories/PresentationFactory.cxx
+++ b/sd/source/ui/framework/factories/PresentationFactory.cxx
@@ -22,6 +22,7 @@
#include <DrawController.hxx>
#include <com/sun/star/drawing/framework/XControllerManager.hpp>
#include <com/sun/star/drawing/framework/XView.hpp>
+#include <comphelper/servicehelper.hxx>
#include <cppuhelper/compbase.hxx>
#include <tools/diagnose_ex.h>
#include <slideshow.hxx>
@@ -121,17 +122,12 @@ void SAL_CALL PresentationFactory::releaseResource (
{
ThrowIfDisposed();
- Reference<lang::XUnoTunnel> xTunnel (mxController, UNO_QUERY);
- if (xTunnel.is())
+ auto pController = comphelper::getUnoTunnelImplementation<sd::DrawController>(mxController);
+ if (pController != nullptr)
{
- ::sd::DrawController* pController = reinterpret_cast<sd::DrawController*>(
- xTunnel->getSomething(sd::DrawController::getUnoTunnelId()));
- if (pController != nullptr)
- {
- ViewShellBase* pBase = pController->GetViewShellBase();
- if (pBase != nullptr)
- SlideShow::Stop( *pBase );
- }
+ ViewShellBase* pBase = pController->GetViewShellBase();
+ if (pBase != nullptr)
+ SlideShow::Stop( *pBase );
}
}
diff --git a/sd/source/ui/framework/module/CenterViewFocusModule.cxx b/sd/source/ui/framework/module/CenterViewFocusModule.cxx
index d462489339a7..3db156d62ff8 100644
--- a/sd/source/ui/framework/module/CenterViewFocusModule.cxx
+++ b/sd/source/ui/framework/module/CenterViewFocusModule.cxx
@@ -27,6 +27,7 @@
#include <ViewShellManager.hxx>
#include <com/sun/star/drawing/framework/XControllerManager.hpp>
#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
+#include <comphelper/servicehelper.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -51,14 +52,9 @@ CenterViewFocusModule::CenterViewFocusModule (Reference<frame::XController> cons
mxConfigurationController = xControllerManager->getConfigurationController();
// Tunnel through the controller to obtain a ViewShellBase.
- Reference<lang::XUnoTunnel> xTunnel (rxController, UNO_QUERY);
- if (xTunnel.is())
- {
- ::sd::DrawController* pController = reinterpret_cast<sd::DrawController*>(
- xTunnel->getSomething(sd::DrawController::getUnoTunnelId()));
- if (pController != nullptr)
- mpBase = pController->GetViewShellBase();
- }
+ auto pController = comphelper::getUnoTunnelImplementation<sd::DrawController>(rxController);
+ if (pController != nullptr)
+ mpBase = pController->GetViewShellBase();
// Check, if all required objects do exist.
if (mxConfigurationController.is() && mpBase!=nullptr)
@@ -128,11 +124,9 @@ void CenterViewFocusModule::HandleNewView (
Reference<XView> xView;
if (xViewIds.hasElements())
xView.set( mxConfigurationController->getResource(xViewIds[0]),UNO_QUERY);
- Reference<lang::XUnoTunnel> xTunnel (xView, UNO_QUERY);
- if (xTunnel.is() && mpBase!=nullptr)
+ if (mpBase!=nullptr)
{
- ViewShellWrapper* pViewShellWrapper = reinterpret_cast<ViewShellWrapper*>(
- xTunnel->getSomething(ViewShellWrapper::getUnoTunnelId()));
+ auto pViewShellWrapper = comphelper::getUnoTunnelImplementation<ViewShellWrapper>(xView);
if (pViewShellWrapper != nullptr)
{
std::shared_ptr<ViewShell> pViewShell = pViewShellWrapper->GetViewShell();
diff --git a/sd/source/ui/framework/module/ShellStackGuard.cxx b/sd/source/ui/framework/module/ShellStackGuard.cxx
index 877a66f1a5de..0340b850f263 100644
--- a/sd/source/ui/framework/module/ShellStackGuard.cxx
+++ b/sd/source/ui/framework/module/ShellStackGuard.cxx
@@ -27,6 +27,7 @@
#include <sfx2/printer.hxx>
#include <com/sun/star/drawing/framework/XControllerManager.hpp>
#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
+#include <comphelper/servicehelper.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -51,14 +52,9 @@ ShellStackGuard::ShellStackGuard (Reference<frame::XController> const & rxContro
mxConfigurationController = xControllerManager->getConfigurationController();
// Tunnel through the controller to obtain a ViewShellBase.
- Reference<lang::XUnoTunnel> xTunnel (rxController, UNO_QUERY);
- if (xTunnel.is())
- {
- ::sd::DrawController* pController = reinterpret_cast<sd::DrawController*>(
- xTunnel->getSomething(sd::DrawController::getUnoTunnelId()));
- if (pController != nullptr)
- mpBase = pController->GetViewShellBase();
- }
+ auto pController = comphelper::getUnoTunnelImplementation<sd::DrawController>(rxController);
+ if (pController != nullptr)
+ mpBase = pController->GetViewShellBase();
}
if (mxConfigurationController.is())
diff --git a/sd/source/ui/framework/module/ToolBarModule.cxx b/sd/source/ui/framework/module/ToolBarModule.cxx
index d4f3932a2f9c..a14bac5206a5 100644
--- a/sd/source/ui/framework/module/ToolBarModule.cxx
+++ b/sd/source/ui/framework/module/ToolBarModule.cxx
@@ -20,6 +20,7 @@
#include "ToolBarModule.hxx"
#include <ViewShellBase.hxx>
#include <DrawController.hxx>
+#include <comphelper/servicehelper.hxx>
#include <framework/FrameworkHelper.hxx>
using namespace ::com::sun::star;
@@ -48,14 +49,9 @@ ToolBarModule::ToolBarModule (
mbMainViewSwitchUpdatePending(false)
{
// Tunnel through the controller to obtain a ViewShellBase.
- Reference<lang::XUnoTunnel> xTunnel (rxController, UNO_QUERY);
- if (xTunnel.is())
- {
- ::sd::DrawController* pController = reinterpret_cast<sd::DrawController*>(
- xTunnel->getSomething(sd::DrawController::getUnoTunnelId()));
- if (pController != nullptr)
- mpBase = pController->GetViewShellBase();
- }
+ auto pController = comphelper::getUnoTunnelImplementation<sd::DrawController>(rxController);
+ if (pController != nullptr)
+ mpBase = pController->GetViewShellBase();
Reference<XControllerManager> xControllerManager (rxController, UNO_QUERY);
if (!xControllerManager.is())