XUnoTunnel->dynamic_cast in SvUnoAttributeContainer

Change-Id: Ief76f12dd98e3455667b70d09605c82c0cedc4b9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145485
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2023-01-12 16:33:01 +02:00
parent 9ca22b6021
commit f2918ed9ad
3 changed files with 4 additions and 20 deletions

View File

@ -76,8 +76,8 @@ bool SvXMLAttrContainerItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMembe
bool SvXMLAttrContainerItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
{
Reference<XUnoTunnel> xTunnel(rVal, UNO_QUERY);
if (auto pContainer = comphelper::getFromUnoTunnel<SvUnoAttributeContainer>(xTunnel))
Reference<XInterface> xTunnel(rVal, UNO_QUERY);
if (auto pContainer = dynamic_cast<SvUnoAttributeContainer*>(xTunnel.get()))
{
maContainerData = *pContainer->GetContainerImpl();
}

View File

@ -28,18 +28,16 @@
#include <sal/types.h>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <xmloff/xmlcnimp.hxx>
#include <cppuhelper/implbase3.hxx>
#include <cppuhelper/implbase2.hxx>
extern css::uno::Reference< css::uno::XInterface > SvUnoAttributeContainer_CreateInstance();
class XMLOFF_DLLPUBLIC SvUnoAttributeContainer final :
public ::cppu::WeakAggImplHelper3<
public ::cppu::WeakAggImplHelper2<
css::lang::XServiceInfo,
css::lang::XUnoTunnel,
css::container::XNameContainer >
{
private:
@ -52,9 +50,6 @@ public:
SvUnoAttributeContainer( std::unique_ptr<SvXMLAttrContainerData> pContainer = nullptr );
SvXMLAttrContainerData* GetContainerImpl() const { return mpContainer.get(); }
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId() noexcept;
virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
// css::container::XElementAccess
virtual css::uno::Type SAL_CALL getElementType() override;
virtual sal_Bool SAL_CALL hasElements() override;

View File

@ -86,17 +86,6 @@ sal_uInt16 SvUnoAttributeContainer::getIndexByName(std::u16string_view aName ) c
return USHRT_MAX;
}
const css::uno::Sequence< sal_Int8 > & SvUnoAttributeContainer::getUnoTunnelId() noexcept
{
static const comphelper::UnoIdInit theSvUnoAttributeContainerUnoTunnelId;
return theSvUnoAttributeContainerUnoTunnelId.getSeq();
}
sal_Int64 SAL_CALL SvUnoAttributeContainer::getSomething( const css::uno::Sequence< sal_Int8 >& rId )
{
return comphelper::getSomethingImpl(rId, this);
}
// container::XNameAccess
uno::Any SAL_CALL SvUnoAttributeContainer::getByName(const OUString& aName)
{