summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-10-14 09:38:01 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-10-14 10:59:43 +0100
commit0aca6eb71c148f1c3a72df9c2f6da6d4364106b8 (patch)
treed8bd52b9f279e7fcacfbe3e894fdf415ed1d1aaa /svx
parente7515cdae07369ced5eca5b5845bd3679bee10b6 (diff)
coverity#1326208 Unchecked dynamic_cast
and coverity#1326207 Unchecked dynamic_cast Change-Id: Icaf60592f1be2aeea1d010241965df7f9e76f2c7
Diffstat (limited to 'svx')
-rw-r--r--svx/source/unodraw/unoshape.cxx35
1 files changed, 15 insertions, 20 deletions
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index 516181847697..dfa2bbf4c2a7 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -3780,10 +3780,8 @@ uno::Reference< container::XIndexContainer > SAL_CALL SvxShape::getGluePoints()
return xGluePoints;
}
-
-
// XChild
-uno::Reference< uno::XInterface > SAL_CALL SvxShape::getParent( )
+uno::Reference<uno::XInterface> SAL_CALL SvxShape::getParent()
throw(uno::RuntimeException, std::exception)
{
::SolarMutexGuard aGuard;
@@ -3792,29 +3790,26 @@ uno::Reference< uno::XInterface > SAL_CALL SvxShape::getParent( )
{
SdrObjList* pObjList = mpObj->GetObjList();
- switch( pObjList->GetListKind() )
+ switch (pObjList->GetListKind())
{
- case SDROBJLIST_GROUPOBJ:
- if(dynamic_cast<const SdrObjGroup*>( pObjList->GetOwnerObj()) != nullptr )
- return dynamic_cast<SdrObjGroup*>( pObjList->GetOwnerObj())->getUnoShape( );
- else if( dynamic_cast<const E3dScene* >(pObjList->GetOwnerObj() ) != nullptr)
- return dynamic_cast< E3dScene* >(pObjList->GetOwnerObj())->getUnoShape();
- break;
- case SDROBJLIST_DRAWPAGE:
- case SDROBJLIST_MASTERPAGE:
- return dynamic_cast<SdrPage*>( pObjList )->getUnoPage( );
- default:
- OSL_FAIL( "SvxShape::getParent( ): unexpected SdrObjListKind" );
- break;
+ case SDROBJLIST_GROUPOBJ:
+ if (SdrObjGroup *pGroup = dynamic_cast<SdrObjGroup*>(pObjList->GetOwnerObj()))
+ return pGroup->getUnoShape();
+ else if (E3dScene *pScene = dynamic_cast<E3dScene*>(pObjList->GetOwnerObj()))
+ return pScene->getUnoShape();
+ break;
+ case SDROBJLIST_DRAWPAGE:
+ case SDROBJLIST_MASTERPAGE:
+ return dynamic_cast<SdrPage&>(*pObjList).getUnoPage();
+ default:
+ OSL_FAIL( "SvxShape::getParent( ): unexpected SdrObjListKind" );
+ break;
}
}
- uno::Reference< uno::XInterface > xParent;
- return xParent;
+ return uno::Reference<uno::XInterface>();
}
-
-
void SAL_CALL SvxShape::setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& )
throw(lang::NoSupportException, uno::RuntimeException, std::exception)
{