XUnoTunnel->dynamic_cast in StyleMap

Change-Id: Ib4070fbff0c919cdc2be12f5a2bed1b1ac9e03c3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145505
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2023-01-13 09:29:04 +02:00
parent 68c6133e4d
commit e5e40c0bf5
3 changed files with 3 additions and 10 deletions

View File

@ -19,7 +19,6 @@
#pragma once #pragma once
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <comphelper/servicehelper.hxx> #include <comphelper/servicehelper.hxx>
#include <cppuhelper/implbase.hxx> #include <cppuhelper/implbase.hxx>
#include <o3tl/hash_combine.hxx> #include <o3tl/hash_combine.hxx>
@ -64,7 +63,7 @@ inline bool StyleNameHash_Impl::operator()(
} }
class StyleMap final : class StyleMap final :
public ::cppu::WeakImplHelper< css::lang::XUnoTunnel>, public ::cppu::WeakImplHelper<>,
public std::unordered_map< StyleNameKey_Impl, OUString, public std::unordered_map< StyleNameKey_Impl, OUString,
StyleNameHash_Impl, StyleNameHash_Impl > StyleNameHash_Impl, StyleNameHash_Impl >
{ {
@ -73,9 +72,6 @@ public:
StyleMap(); StyleMap();
virtual ~StyleMap() override; virtual ~StyleMap() override;
// XUnoTunnel
UNO3_GETIMPLEMENTATION_DECL(StyleMap)
}; };
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -982,7 +982,7 @@ void SAL_CALL SvXMLImport::initialize( const uno::Sequence< uno::Any >& aArgumen
uno::Any aAny = mxImportInfo->getPropertyValue(sPropName); uno::Any aAny = mxImportInfo->getPropertyValue(sPropName);
aAny >>= xIfc; aAny >>= xIfc;
StyleMap *pSMap = comphelper::getFromUnoTunnel<StyleMap>( xIfc ); StyleMap *pSMap = dynamic_cast<StyleMap*>( xIfc.get() );
if( pSMap ) if( pSMap )
{ {
mpStyleMap = pSMap; mpStyleMap = pSMap;
@ -1393,7 +1393,7 @@ void SvXMLImport::AddStyleDisplayName( XmlStyleFamily nFamily,
xPropertySetInfo->hasPropertyByName(sPrivateData) ) xPropertySetInfo->hasPropertyByName(sPrivateData) )
{ {
Reference < XInterface > xIfc( Reference < XInterface > xIfc(
static_cast< css::lang::XUnoTunnel *>( mpStyleMap.get() ) ); static_cast< css::lang::XTypeProvider *>( mpStyleMap.get() ) );
mxImportInfo->setPropertyValue( sPrivateData, Any(xIfc) ); mxImportInfo->setPropertyValue( sPrivateData, Any(xIfc) );
} }
} }

View File

@ -26,7 +26,4 @@ StyleMap::StyleMap() {}
StyleMap::~StyleMap() {} StyleMap::~StyleMap() {}
// XUnoTunnel & co
UNO3_GETIMPLEMENTATION_IMPL(StyleMap);
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */