XUnoTunnel->dynamic_cast in ScStyleObj

Change-Id: I1021cddc87546635b147bbdf5f48948565815873
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145983
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/sc/inc/styleuno.hxx b/sc/inc/styleuno.hxx
index b09a95b..d19feed 100644
--- a/sc/inc/styleuno.hxx
+++ b/sc/inc/styleuno.hxx
@@ -30,7 +30,6 @@
#include <com/sun/star/beans/XMultiPropertySet.hpp>
#include <com/sun/star/beans/XPropertyState.hpp>
#include <com/sun/star/beans/XMultiPropertyStates.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <comphelper/servicehelper.hxx>
#include <cppuhelper/implbase.hxx>

@@ -161,7 +160,6 @@ class ScStyleObj final : public ::cppu::WeakImplHelper<
                    css::beans::XMultiPropertySet,
                    css::beans::XPropertyState,
                    css::beans::XMultiPropertyStates,
                    css::lang::XUnoTunnel,
                    css::lang::XServiceInfo >,
                public SfxListener
{
@@ -262,9 +260,6 @@ public:
    virtual OUString SAL_CALL getImplementationName() override;
    virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
    virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;

                            // XUnoTunnel
    UNO3_GETIMPLEMENTATION_DECL(ScStyleObj)
};

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx
index 4e60223..cddff8c 100644
--- a/sc/source/ui/unoobj/styleuno.cxx
+++ b/sc/source/ui/unoobj/styleuno.cxx
@@ -677,7 +677,7 @@ void SAL_CALL ScStyleFamilyObj::insertByName( const OUString& aName, const uno::
    uno::Reference< uno::XInterface > xInterface(aElement, uno::UNO_QUERY);
    if ( xInterface.is() )
    {
        ScStyleObj* pStyleObj = comphelper::getFromUnoTunnel<ScStyleObj>( xInterface );
        ScStyleObj* pStyleObj = dynamic_cast<ScStyleObj*>( xInterface.get() );
        if ( pStyleObj && pStyleObj->GetFamily() == eFamily &&
                !pStyleObj->IsInserted() )  // not yet inserted?
        {
@@ -962,10 +962,6 @@ ScStyleObj::~ScStyleObj()
        pDocShell->GetDocument().RemoveUnoObject(*this);
}

// XUnoTunnel

UNO3_GETIMPLEMENTATION_IMPL(ScStyleObj);

void ScStyleObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
{
    //  reference update does not matter here