loplugin:unocast (framework::Desktop)
(See the upcoming commit introducing that loplugin:unocast on why such dynamic_casts from UNO types are dangerous.) Change-Id: Ifcf713b0543e78a124f613bcbda496069a280dab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144762 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
@@ -50,6 +50,7 @@
|
||||
#include <comphelper/numberedcollection.hxx>
|
||||
#include <comphelper/sequence.hxx>
|
||||
#include <comphelper/lok.hxx>
|
||||
#include <comphelper/servicehelper.hxx>
|
||||
#include <cppuhelper/supportsservice.hxx>
|
||||
#include <utility>
|
||||
#include <vcl/svapp.hxx>
|
||||
@@ -335,6 +336,15 @@ void Desktop::shutdown()
|
||||
xSfxTerminator->notifyTermination(aEvent);
|
||||
}
|
||||
|
||||
sal_Int64 Desktop::getSomething(css::uno::Sequence<sal_Int8> const & aIdentifier) {
|
||||
return comphelper::getSomethingImpl(aIdentifier, this);
|
||||
}
|
||||
|
||||
css::uno::Sequence<sal_Int8> const & Desktop::getUnoTunnelId() {
|
||||
static comphelper::UnoIdInit const id;
|
||||
return id.getSeq();
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
class QuickstartSuppressor
|
||||
|
@@ -23,6 +23,7 @@
|
||||
#include <framework/desktop.hxx>
|
||||
|
||||
#include <comphelper/diagnose_ex.hxx>
|
||||
#include <comphelper/servicehelper.hxx>
|
||||
#include <com/sun/star/beans/NamedValue.hpp>
|
||||
#include <com/sun/star/beans/PropertyValue.hpp>
|
||||
#include <com/sun/star/frame/theAutoRecovery.hpp>
|
||||
@@ -342,7 +343,7 @@ void SAL_CALL SessionListener::approveInteraction( sal_Bool bInteractionGranted
|
||||
css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( m_xContext );
|
||||
// honestly: how many implementations of XDesktop will we ever have?
|
||||
// so casting this directly to the implementation
|
||||
Desktop* pDesktop(dynamic_cast<Desktop*>(xDesktop.get()));
|
||||
Desktop* pDesktop(comphelper::getFromUnoTunnel<Desktop>(xDesktop));
|
||||
if(pDesktop)
|
||||
{
|
||||
SAL_INFO("fwk.session", " XDesktop is a framework::Desktop -- good.");
|
||||
|
@@ -36,6 +36,7 @@
|
||||
#include <com/sun/star/frame/XFramesSupplier.hpp>
|
||||
#include <com/sun/star/frame/XFrames.hpp>
|
||||
#include <com/sun/star/lang/XServiceInfo.hpp>
|
||||
#include <com/sun/star/lang/XUnoTunnel.hpp>
|
||||
#include <com/sun/star/frame/XDispatchProvider.hpp>
|
||||
#include <com/sun/star/frame/XTasksSupplier.hpp>
|
||||
#include <com/sun/star/container/XEnumerationAccess.hpp>
|
||||
@@ -94,7 +95,8 @@ typedef cppu::WeakComponentImplHelper<
|
||||
css::frame::XTasksSupplier ,
|
||||
css::frame::XDispatchResultListener , // => XEventListener
|
||||
css::task::XInteractionHandler ,
|
||||
css::frame::XUntitledNumbers > Desktop_BASE;
|
||||
css::frame::XUntitledNumbers,
|
||||
css::lang::XUnoTunnel > Desktop_BASE;
|
||||
|
||||
class FWK_DLLPUBLIC Desktop final : private cppu::BaseMutex,
|
||||
public Desktop_BASE,
|
||||
@@ -287,6 +289,9 @@ class FWK_DLLPUBLIC Desktop final : private cppu::BaseMutex,
|
||||
|
||||
void shutdown();
|
||||
|
||||
sal_Int64 SAL_CALL getSomething(css::uno::Sequence<sal_Int8> const & aIdentifier) override;
|
||||
static css::uno::Sequence<sal_Int8> const & getUnoTunnelId();
|
||||
|
||||
private:
|
||||
// OPropertySetHelper
|
||||
virtual sal_Bool SAL_CALL convertFastPropertyValue ( css::uno::Any& aConvertedValue ,
|
||||
|
Reference in New Issue
Block a user