summaryrefslogtreecommitdiff
path: root/editeng/source/items/xmlcnitm.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'editeng/source/items/xmlcnitm.cxx')
-rw-r--r--editeng/source/items/xmlcnitm.cxx18
1 files changed, 7 insertions, 11 deletions
diff --git a/editeng/source/items/xmlcnitm.cxx b/editeng/source/items/xmlcnitm.cxx
index f83289064695..96cbd49166cc 100644
--- a/editeng/source/items/xmlcnitm.cxx
+++ b/editeng/source/items/xmlcnitm.cxx
@@ -19,6 +19,7 @@
#include <com/sun/star/xml/AttributeData.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <o3tl/any.hxx>
#include <xmloff/xmlcnimp.hxx>
#include <xmloff/unoatrcn.hxx>
#include <editeng/xmlcnitm.hxx>
@@ -80,16 +81,11 @@ bool SvXMLAttrContainerItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMembe
bool SvXMLAttrContainerItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
{
- Reference<XInterface> xRef;
SvUnoAttributeContainer* pContainer = nullptr;
- if( rVal.getValue() != nullptr && rVal.getValueType().getTypeClass() == TypeClass_INTERFACE )
- {
- xRef = *static_cast<Reference<XInterface> const *>(rVal.getValue());
- Reference<XUnoTunnel> xTunnel(xRef, UNO_QUERY);
- if( xTunnel.is() )
- pContainer = reinterpret_cast<SvUnoAttributeContainer*>((sal_uLong)xTunnel->getSomething(SvUnoAttributeContainer::getUnoTunnelId()));
- }
+ Reference<XUnoTunnel> xTunnel(rVal, UNO_QUERY);
+ if( xTunnel.is() )
+ pContainer = reinterpret_cast<SvUnoAttributeContainer*>((sal_uLong)xTunnel->getSomething(SvUnoAttributeContainer::getUnoTunnelId()));
if( pContainer )
{
@@ -101,7 +97,7 @@ bool SvXMLAttrContainerItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nM
try
{
- Reference<XNameContainer> xContainer( xRef, UNO_QUERY );
+ Reference<XNameContainer> xContainer( rVal, UNO_QUERY );
if( !xContainer.is() )
return false;
@@ -116,10 +112,10 @@ bool SvXMLAttrContainerItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nM
const OUString aName( *pNames++ );
aAny = xContainer->getByName( aName );
- if( aAny.getValue() == nullptr || aAny.getValueType() != cppu::UnoType<AttributeData>::get() )
+ auto pData = o3tl::tryAccess<AttributeData>(aAny);
+ if( !pData )
return false;
- AttributeData const * pData = static_cast<AttributeData const *>(aAny.getValue());
sal_Int32 pos = aName.indexOf( ':' );
if( pos != -1 )
{