summaryrefslogtreecommitdiff
path: root/sd
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
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')
-rw-r--r--sd/source/core/sdpage.cxx10
-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
-rw-r--r--sd/source/ui/sidebar/PanelFactory.cxx12
6 files changed, 27 insertions, 53 deletions
diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index 0ffc10889adc..667fb7ed57d7 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -2675,13 +2675,9 @@ SdPage* SdPage::getImplementation( const css::uno::Reference< css::drawing::XDra
{
try
{
- css::uno::Reference< css::lang::XUnoTunnel > xUnoTunnel( xPage, css::uno::UNO_QUERY );
- if( xUnoTunnel.is() )
- {
- SvxDrawPage* pUnoPage = reinterpret_cast<SvxDrawPage*>(sal::static_int_cast<sal_uIntPtr>(xUnoTunnel->getSomething( SvxDrawPage::getUnoTunnelId()) ) );
- if( pUnoPage )
- return static_cast< SdPage* >( pUnoPage->GetSdrPage() );
- }
+ auto pUnoPage = comphelper::getUnoTunnelImplementation<SvxDrawPage>(xPage);
+ if( pUnoPage )
+ return static_cast< SdPage* >( pUnoPage->GetSdrPage() );
}
catch( css::uno::Exception& )
{
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())
diff --git a/sd/source/ui/sidebar/PanelFactory.cxx b/sd/source/ui/sidebar/PanelFactory.cxx
index 226e820d15e5..e3489acb97b4 100644
--- a/sd/source/ui/sidebar/PanelFactory.cxx
+++ b/sd/source/ui/sidebar/PanelFactory.cxx
@@ -33,6 +33,7 @@
#include <sfx2/sidebar/SidebarPanelBase.hxx>
#include <comphelper/namedvaluecollection.hxx>
+#include <comphelper/servicehelper.hxx>
#include <vcl/window.hxx>
#include <toolkit/helper/vclunohelper.hxx>
@@ -82,14 +83,9 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement (
// Tunnel through the controller to obtain a ViewShellBase.
ViewShellBase* pBase = nullptr;
- Reference<lang::XUnoTunnel> xTunnel (xFrame->getController(), UNO_QUERY);
- if (xTunnel.is())
- {
- ::sd::DrawController* pController = reinterpret_cast<sd::DrawController*>(
- xTunnel->getSomething(sd::DrawController::getUnoTunnelId()));
- if (pController != nullptr)
- pBase = pController->GetViewShellBase();
- }
+ auto pController = comphelper::getUnoTunnelImplementation<sd::DrawController>(xFrame->getController());
+ if (pController != nullptr)
+ pBase = pController->GetViewShellBase();
if (pBase == nullptr)
throw RuntimeException("can not get ViewShellBase for frame");