summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-06-10 18:54:33 +0200
committerStephan Bergmann <sbergman@redhat.com>2016-06-10 18:54:33 +0200
commite8470e703e569ed895055e0fb6c0f37843f84e3e (patch)
tree4f258507d9758fe4717230bc217eb7c54e50c893 /svx
parent80c35d97b9b3b60a091aae77de0ffef38cbf531a (diff)
Clean up uses of Any::getValue() in svx
Change-Id: Ie0b253227df8ea4bd24643aa2622afadabf4eb54
Diffstat (limited to 'svx')
-rw-r--r--svx/source/dialog/rubydialog.cxx5
-rw-r--r--svx/source/items/customshapeitem.cxx63
-rw-r--r--svx/source/table/cell.cxx8
-rw-r--r--svx/source/unodraw/XPropertyTable.cxx5
-rw-r--r--svx/source/unodraw/unoshap2.cxx25
-rw-r--r--svx/source/unodraw/unoshape.cxx9
-rw-r--r--svx/source/xoutdev/xattr.cxx25
7 files changed, 66 insertions, 74 deletions
diff --git a/svx/source/dialog/rubydialog.cxx b/svx/source/dialog/rubydialog.cxx
index 076e447553ad..3335316bfa21 100644
--- a/svx/source/dialog/rubydialog.cxx
+++ b/svx/source/dialog/rubydialog.cxx
@@ -17,6 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <o3tl/any.hxx>
#include <svx/rubydialog.hxx>
#include <svx/dialmgr.hxx>
#include <svx/dialogs.hrc>
@@ -485,7 +488,7 @@ void SvxRubyDialog::Update()
}
if (nPosition > -2 && pProps[nProp].Name == cRubyIsAbove)
{
- bool bTmp = *static_cast<sal_Bool const *>(pProps[nProp].Value.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(pProps[nProp].Value);
if (!nRuby)
nPosition = bTmp ? 0 : 1;
else if ((!nPosition && !bTmp) || (nPosition == 1 && bTmp))
diff --git a/svx/source/items/customshapeitem.cxx b/svx/source/items/customshapeitem.cxx
index ae492779761b..de80bebb8cb7 100644
--- a/svx/source/items/customshapeitem.cxx
+++ b/svx/source/items/customshapeitem.cxx
@@ -17,6 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <o3tl/any.hxx>
#include <svx/sdasitm.hxx>
#include <svx/svdattr.hxx>
@@ -45,12 +48,12 @@ SdrCustomShapeGeometryItem::SdrCustomShapeGeometryItem( const uno::Sequence< bea
throw uno::RuntimeException(
"CustomShapeGeometry has duplicate property " + rPropVal.Name);
}
- if ( rPropVal.Value.getValueType() == cppu::UnoType<css::uno::Sequence < beans::PropertyValue >>::get() )
+ if (auto rPropSeq = o3tl::tryAccess<uno::Sequence<beans::PropertyValue>>(
+ rPropVal.Value))
{
- uno::Sequence< beans::PropertyValue > const & rPropSeq = *static_cast<uno::Sequence< beans::PropertyValue > const *>(rPropVal.Value.getValue());
- for ( j = 0; j < rPropSeq.getLength(); j++ )
+ for ( j = 0; j < rPropSeq->getLength(); j++ )
{
- beans::PropertyValue const & rPropVal2 = rPropSeq[ j ];
+ beans::PropertyValue const & rPropVal2 = (*rPropSeq)[ j ];
aPropPairHashMap[ PropertyPair( rPropVal.Name, rPropVal2.Name ) ] = j;
}
}
@@ -81,14 +84,12 @@ css::uno::Any* SdrCustomShapeGeometryItem::GetPropertyValueByName( const OUStrin
css::uno::Any* pSeqAny = GetPropertyValueByName( rSequenceName );
if ( pSeqAny )
{
- if ( pSeqAny->getValueType() == cppu::UnoType<css::uno::Sequence < beans::PropertyValue >>::get() )
+ if ( auto rSecSequence = o3tl::tryAccess<css::uno::Sequence<beans::PropertyValue>>(*pSeqAny) )
{
PropertyPairHashMap::iterator aHashIter( aPropPairHashMap.find( PropertyPair( rSequenceName, rPropName ) ) );
if ( aHashIter != aPropPairHashMap.end() )
{
- css::uno::Sequence < beans::PropertyValue > const & rSecSequence =
- *static_cast<css::uno::Sequence < beans::PropertyValue > const *>(pSeqAny->getValue());
- pRet = const_cast<css::uno::Any *>(&rSecSequence[ (*aHashIter).second ].Value);
+ pRet = const_cast<css::uno::Any *>(&(*rSecSequence)[ (*aHashIter).second ].Value);
}
}
}
@@ -101,14 +102,12 @@ const css::uno::Any* SdrCustomShapeGeometryItem::GetPropertyValueByName( const O
const css::uno::Any* pSeqAny = GetPropertyValueByName( rSequenceName );
if ( pSeqAny )
{
- if ( pSeqAny->getValueType() == cppu::UnoType<css::uno::Sequence < beans::PropertyValue >>::get() )
+ if ( auto rSecSequence = o3tl::tryAccess<css::uno::Sequence<beans::PropertyValue>>(*pSeqAny) )
{
PropertyPairHashMap::const_iterator aHashIter( aPropPairHashMap.find( PropertyPair( rSequenceName, rPropName ) ) );
if ( aHashIter != aPropPairHashMap.end() )
{
- css::uno::Sequence < beans::PropertyValue > const & rSecSequence =
- *static_cast<css::uno::Sequence < beans::PropertyValue > const *>(pSeqAny->getValue());
- pRet = &rSecSequence[ (*aHashIter).second ].Value;
+ pRet = &(*rSecSequence)[ (*aHashIter).second ].Value;
}
}
}
@@ -121,25 +120,21 @@ void SdrCustomShapeGeometryItem::SetPropertyValue( const css::beans::PropertyVal
if ( pAny )
{ // property is already available
sal_Int32 i;
- if ( pAny->getValueType() == cppu::UnoType<css::uno::Sequence < beans::PropertyValue >>::get() )
+ if ( auto rSecSequence = o3tl::tryAccess<css::uno::Sequence<beans::PropertyValue>>(*pAny) )
{ // old property is a sequence->each entry has to be removed from the HashPairMap
- css::uno::Sequence < beans::PropertyValue > const & rSecSequence =
- *static_cast<css::uno::Sequence < beans::PropertyValue > const *>(pAny->getValue());
- for ( i = 0; i < rSecSequence.getLength(); i++ )
+ for ( i = 0; i < rSecSequence->getLength(); i++ )
{
- PropertyPairHashMap::iterator aHashIter( aPropPairHashMap.find( PropertyPair( rPropVal.Name, rSecSequence[ i ].Name ) ) );
+ PropertyPairHashMap::iterator aHashIter( aPropPairHashMap.find( PropertyPair( rPropVal.Name, (*rSecSequence)[ i ].Name ) ) );
if ( aHashIter != aPropPairHashMap.end() )
aPropPairHashMap.erase( aHashIter );
}
}
*pAny = rPropVal.Value;
- if ( rPropVal.Value.getValueType() == cppu::UnoType<css::uno::Sequence < beans::PropertyValue >>::get() )
+ if ( auto rSecSequence = o3tl::tryAccess<css::uno::Sequence<beans::PropertyValue>>(*pAny) )
{ // the new property is a sequence->each entry has to be inserted into the HashPairMap
- css::uno::Sequence < beans::PropertyValue > const & rSecSequence =
- *static_cast<css::uno::Sequence < beans::PropertyValue > const *>(pAny->getValue());
- for ( i = 0; i < rSecSequence.getLength(); i++ )
+ for ( i = 0; i < rSecSequence->getLength(); i++ )
{
- beans::PropertyValue const & rPropVal2 = rSecSequence[ i ];
+ beans::PropertyValue const & rPropVal2 = (*rSecSequence)[ i ];
aPropPairHashMap[ PropertyPair( rPropVal.Name, rPropVal2.Name ) ] = i;
}
}
@@ -187,23 +182,18 @@ void SdrCustomShapeGeometryItem::SetPropertyValue( const OUString& rSequenceName
if( pSeqAny )
{
- if ( pSeqAny->getValueType() == cppu::UnoType<css::uno::Sequence < beans::PropertyValue >>::get() )
+ if ( auto rSecSequence = o3tl::tryAccess<css::uno::Sequence<beans::PropertyValue>>(*pSeqAny) )
{
PropertyPairHashMap::iterator aHashIter( aPropPairHashMap.find( PropertyPair( rSequenceName, rPropVal.Name ) ) );
if ( aHashIter != aPropPairHashMap.end() )
{
- css::uno::Sequence < beans::PropertyValue > const & rSecSequence =
- *static_cast<css::uno::Sequence < beans::PropertyValue > const *>(pSeqAny->getValue());
- const_cast<css::uno::Sequence<css::beans::PropertyValue> &>(rSecSequence)[ (*aHashIter).second ].Value = rPropVal.Value;
+ const_cast<css::uno::Sequence<css::beans::PropertyValue> &>(*rSecSequence)[ (*aHashIter).second ].Value = rPropVal.Value;
}
else
{
- css::uno::Sequence < beans::PropertyValue > const & rSecSequence =
- *static_cast<css::uno::Sequence < beans::PropertyValue > const *>(pSeqAny->getValue());
-
- sal_Int32 nCount = rSecSequence.getLength();
- const_cast<css::uno::Sequence<css::beans::PropertyValue> &>(rSecSequence).realloc( nCount + 1 );
- const_cast<css::uno::Sequence<css::beans::PropertyValue> &>(rSecSequence)[ nCount ] = rPropVal;
+ sal_Int32 nCount = rSecSequence->getLength();
+ const_cast<css::uno::Sequence<css::beans::PropertyValue> &>(*rSecSequence).realloc( nCount + 1 );
+ const_cast<css::uno::Sequence<css::beans::PropertyValue> &>(*rSecSequence)[ nCount ] = rPropVal;
aPropPairHashMap[ PropertyPair( rSequenceName, rPropVal.Name ) ] = nCount;
}
@@ -222,15 +212,12 @@ void SdrCustomShapeGeometryItem::ClearPropertyValue( const OUString& rPropName )
css::uno::Any* pSeqAny = &aPropSeq[ (*aHashIter).second ].Value;
if ( pSeqAny )
{
- if ( pSeqAny->getValueType() == cppu::UnoType<css::uno::Sequence < beans::PropertyValue >>::get() )
+ if ( auto rSecSequence = o3tl::tryAccess<css::uno::Sequence<beans::PropertyValue>>(*pSeqAny) )
{
- css::uno::Sequence < beans::PropertyValue > const & rSecSequence =
- *static_cast<css::uno::Sequence < beans::PropertyValue > const *>(pSeqAny->getValue());
-
sal_Int32 i;
- for ( i = 0; i < rSecSequence.getLength(); i++ )
+ for ( i = 0; i < rSecSequence->getLength(); i++ )
{
- PropertyPairHashMap::iterator _aHashIter( aPropPairHashMap.find( PropertyPair( rPropName, rSecSequence[ i ].Name ) ) );
+ PropertyPairHashMap::iterator _aHashIter( aPropPairHashMap.find( PropertyPair( rPropName, (*rSecSequence)[ i ].Name ) ) );
if ( _aHashIter != aPropPairHashMap.end() )
aPropPairHashMap.erase( _aHashIter ); // removing property from pair hashmap
}
diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx
index fc270351059c..a7f1933c2237 100644
--- a/svx/source/table/cell.cxx
+++ b/svx/source/table/cell.cxx
@@ -28,6 +28,7 @@
#include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/typeprovider.hxx>
+#include <o3tl/any.hxx>
#include <svl/style.hxx>
#include <svl/itemset.hxx>
@@ -1011,11 +1012,8 @@ void SAL_CALL Cell::setPropertyValue( const OUString& rPropertyName, const Any&
}
case OWN_ATTR_TABLEBORDER:
{
- if(rValue.getValueType() != cppu::UnoType<TableBorder>::get())
- break;
-
- const TableBorder* pBorder = static_cast<const TableBorder*>(rValue.getValue());
- if( pBorder == nullptr )
+ auto pBorder = o3tl::tryAccess<TableBorder>(rValue);
+ if(!pBorder)
break;
SvxBoxItem aBox( SDRATTR_TABLE_BORDER );
diff --git a/svx/source/unodraw/XPropertyTable.cxx b/svx/source/unodraw/XPropertyTable.cxx
index dc036a1546c5..d1016614b92b 100644
--- a/svx/source/unodraw/XPropertyTable.cxx
+++ b/svx/source/unodraw/XPropertyTable.cxx
@@ -25,6 +25,7 @@
#include <com/sun/star/drawing/Hatch.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
+#include <o3tl/any.hxx>
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
@@ -334,11 +335,11 @@ uno::Any SvxUnoXLineEndTable::getAny( const XPropertyEntry* pEntry ) const throw
XPropertyEntry* SvxUnoXLineEndTable::getEntry( const OUString& rName, const uno::Any& rAny ) const throw(lang::IllegalArgumentException)
{
- if( !rAny.getValue() || rAny.getValueType() != cppu::UnoType<drawing::PolyPolygonBezierCoords>::get())
+ auto pCoords = o3tl::tryAccess<drawing::PolyPolygonBezierCoords>(rAny);
+ if( !pCoords )
return nullptr;
basegfx::B2DPolyPolygon aPolyPolygon;
- drawing::PolyPolygonBezierCoords const * pCoords = static_cast<drawing::PolyPolygonBezierCoords const *>(rAny.getValue());
if( pCoords->Coordinates.getLength() > 0 )
aPolyPolygon = basegfx::unotools::polyPolygonBezierToB2DPolyPolygon( *pCoords );
diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx
index a77b34725b33..0d3eccb18f97 100644
--- a/svx/source/unodraw/unoshap2.cxx
+++ b/svx/source/unodraw/unoshap2.cxx
@@ -27,6 +27,7 @@
#include <com/sun/star/drawing/PointSequenceSequence.hpp>
#include <com/sun/star/drawing/PointSequence.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
+#include <o3tl/any.hxx>
#include <tools/urlobj.hxx>
#include <vcl/svapp.hxx>
#include <osl/file.hxx>
@@ -1057,9 +1058,9 @@ bool SvxShapePolyPolygon::setPropertyValueImpl( const OUString& rName, const Sfx
{
case OWN_ATTR_VALUE_POLYPOLYGON:
{
- if( rValue.getValue() && (rValue.getValueType() == cppu::UnoType<drawing::PointSequenceSequence>::get() ) )
+ if( auto s = o3tl::tryAccess<drawing::PointSequenceSequence>(rValue) )
{
- basegfx::B2DPolyPolygon aNewPolyPolygon(ImplSvxPointSequenceSequenceToB2DPolyPolygon( static_cast<drawing::PointSequenceSequence const *>(rValue.getValue())));
+ basegfx::B2DPolyPolygon aNewPolyPolygon(ImplSvxPointSequenceSequenceToB2DPolyPolygon(s));
SetPolygon(aNewPolyPolygon);
return true;
}
@@ -1067,7 +1068,7 @@ bool SvxShapePolyPolygon::setPropertyValueImpl( const OUString& rName, const Sfx
}
case OWN_ATTR_BASE_GEOMETRY:
{
- if( rValue.getValue() && (rValue.getValueType() == cppu::UnoType<drawing::PointSequenceSequence>::get()))
+ if( auto s = o3tl::tryAccess<drawing::PointSequenceSequence>(rValue) )
{
if( mpObj.is() )
{
@@ -1075,7 +1076,7 @@ bool SvxShapePolyPolygon::setPropertyValueImpl( const OUString& rName, const Sfx
basegfx::B2DHomMatrix aNewHomogenMatrix;
mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
- aNewPolyPolygon = ImplSvxPointSequenceSequenceToB2DPolyPolygon(static_cast<drawing::PointSequenceSequence const *>(rValue.getValue()));
+ aNewPolyPolygon = ImplSvxPointSequenceSequenceToB2DPolyPolygon(s);
mpObj->TRSetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
}
return true;
@@ -1084,10 +1085,8 @@ bool SvxShapePolyPolygon::setPropertyValueImpl( const OUString& rName, const Sfx
}
case OWN_ATTR_VALUE_POLYGON:
{
- if( rValue.getValue() && (rValue.getValueType() == cppu::UnoType<drawing::PointSequence>::get() ))
+ if( auto pSequence = o3tl::tryAccess<drawing::PointSequence>(rValue) )
{
- drawing::PointSequence const * pSequence = static_cast<drawing::PointSequence const *>(rValue.getValue());
-
// prepare new polygon
basegfx::B2DPolygon aNewPolygon;
@@ -1284,11 +1283,10 @@ bool SvxShapePolyPolygonBezier::setPropertyValueImpl( const OUString& rName, con
{
case OWN_ATTR_VALUE_POLYPOLYGONBEZIER:
{
- if( rValue.getValue() && (rValue.getValueType() == cppu::UnoType<drawing::PolyPolygonBezierCoords>::get()) )
+ if( auto s = o3tl::tryAccess<drawing::PolyPolygonBezierCoords>(rValue) )
{
basegfx::B2DPolyPolygon aNewPolyPolygon(
- basegfx::unotools::polyPolygonBezierToB2DPolyPolygon(
- *static_cast<drawing::PolyPolygonBezierCoords const *>(rValue.getValue())));
+ basegfx::unotools::polyPolygonBezierToB2DPolyPolygon(*s));
SetPolygon(aNewPolyPolygon);
return true;
}
@@ -1296,7 +1294,7 @@ bool SvxShapePolyPolygonBezier::setPropertyValueImpl( const OUString& rName, con
}
case OWN_ATTR_BASE_GEOMETRY:
{
- if( rValue.getValue() && (rValue.getValueType() == cppu::UnoType<drawing::PolyPolygonBezierCoords>::get()) )
+ if( auto s = o3tl::tryAccess<drawing::PolyPolygonBezierCoords>(rValue) )
{
if( mpObj.is() )
{
@@ -1305,7 +1303,7 @@ bool SvxShapePolyPolygonBezier::setPropertyValueImpl( const OUString& rName, con
mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
aNewPolyPolygon = basegfx::unotools::polyPolygonBezierToB2DPolyPolygon(
- *static_cast<drawing::PolyPolygonBezierCoords const *>(rValue.getValue()));
+ *s);
mpObj->TRSetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
}
return true;
@@ -1414,9 +1412,8 @@ bool SvxGraphicObject::setPropertyValueImpl( const OUString& rName, const SfxIte
{
case OWN_ATTR_VALUE_FILLBITMAP:
{
- if( rValue.getValueType() == cppu::UnoType<uno::Sequence< sal_Int8 >>::get() )
+ if( auto pSeq = o3tl::tryAccess<uno::Sequence<sal_Int8>>(rValue) )
{
- uno::Sequence<sal_Int8> const * pSeq( static_cast<uno::Sequence<sal_Int8> const *>(rValue.getValue()) );
SvMemoryStream aMemStm;
Graphic aGraphic;
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index 72a010dcd2ee..8f04d60ed142 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -26,6 +26,7 @@
#include <vcl/svapp.hxx>
#include <svl/itemprop.hxx>
#include <vcl/fltcall.hxx>
+#include <o3tl/any.hxx>
#include <osl/mutex.hxx>
#include <editeng/unotext.hxx>
#include <svx/svdobj.hxx>
@@ -2247,17 +2248,17 @@ bool SvxShape::setPropertyValueImpl( const OUString&, const SfxItemPropertySimpl
basegfx::B2DPolyPolygon aNewPolyPolygon;
// #123616# be a little bit more flexible regarding the data type used
- if( rValue.getValueType() == cppu::UnoType<drawing::PointSequenceSequence>::get())
+ if( auto s = o3tl::tryAccess<drawing::PointSequenceSequence>(rValue) )
{
// get polygpon data from PointSequenceSequence
aNewPolyPolygon = basegfx::tools::UnoPointSequenceSequenceToB2DPolyPolygon(
- *static_cast<const drawing::PointSequenceSequence*>(rValue.getValue()));
+ *s);
}
- else if( rValue.getValueType() == cppu::UnoType<drawing::PolyPolygonBezierCoords>::get())
+ else if( auto cs = o3tl::tryAccess<drawing::PolyPolygonBezierCoords>(rValue) )
{
// get polygpon data from PolyPolygonBezierCoords
aNewPolyPolygon = basegfx::tools::UnoPolyPolygonBezierCoordsToB2DPolyPolygon(
- *static_cast<const drawing::PolyPolygonBezierCoords*>(rValue.getValue()));
+ *cs);
}
if(aNewPolyPolygon.count())
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
index bd44214921a5..d0c445b348c3 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -28,6 +28,7 @@
#include <com/sun/star/awt/Gradient.hpp>
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
+#include <o3tl/any.hxx>
#include <svl/itempool.hxx>
#include <editeng/memberids.hrc>
#include <tools/stream.hxx>
@@ -1321,12 +1322,13 @@ bool XLineStartItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId )
{
maPolyPolygon.clear();
- if( rVal.hasValue() && rVal.getValue() )
+ if( rVal.hasValue() )
{
- if( rVal.getValueType() != cppu::UnoType<css::drawing::PolyPolygonBezierCoords>::get())
+ auto pCoords = o3tl::tryAccess<css::drawing::PolyPolygonBezierCoords>(
+ rVal);
+ if( !pCoords )
return false;
- css::drawing::PolyPolygonBezierCoords const * pCoords = static_cast<css::drawing::PolyPolygonBezierCoords const *>(rVal.getValue());
if( pCoords->Coordinates.getLength() > 0 )
{
maPolyPolygon = basegfx::unotools::polyPolygonBezierToB2DPolyPolygon( *pCoords );
@@ -1883,12 +1885,13 @@ bool XLineEndItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId )
{
maPolyPolygon.clear();
- if( rVal.hasValue() && rVal.getValue() )
+ if( rVal.hasValue() )
{
- if( rVal.getValueType() != cppu::UnoType<css::drawing::PolyPolygonBezierCoords>::get())
+ auto pCoords = o3tl::tryAccess<css::drawing::PolyPolygonBezierCoords>(
+ rVal);
+ if( !pCoords )
return false;
- css::drawing::PolyPolygonBezierCoords const * pCoords = static_cast<css::drawing::PolyPolygonBezierCoords const *>(rVal.getValue());
if( pCoords->Coordinates.getLength() > 0 )
{
maPolyPolygon = basegfx::unotools::polyPolygonBezierToB2DPolyPolygon( *pCoords );
@@ -2045,10 +2048,11 @@ bool XLineStartCenterItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberI
bool XLineStartCenterItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
{
- if( !rVal.hasValue() || rVal.getValueType() != cppu::UnoType<bool>::get() )
+ auto b = o3tl::tryAccess<bool>(rVal);
+ if( !b )
return false;
- SetValue( *static_cast<sal_Bool const *>(rVal.getValue()) );
+ SetValue( *b );
return true;
}
@@ -2096,10 +2100,11 @@ bool XLineEndCenterItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*
bool XLineEndCenterItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
{
- if( !rVal.hasValue() || rVal.getValueType() != cppu::UnoType<bool>::get() )
+ auto b = o3tl::tryAccess<bool>(rVal);
+ if( !b )
return false;
- SetValue( *static_cast<sal_Bool const *>(rVal.getValue()) );
+ SetValue( *b );
return true;
}