summaryrefslogtreecommitdiff
path: root/sc/source/ui/unoobj
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2018-08-09 16:30:41 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-08-10 08:21:32 +0200
commit76dd6bb9cc6dff0f59cdfce87b61210be6476965 (patch)
tree6ac05017f888f89115d8fdc3cd3b977f83cf1d70 /sc/source/ui/unoobj
parent4e63c00f4dd5f8ac6496481e687c59209f9aee07 (diff)
unnecessary null check before dynamic_cast, in sc
Change-Id: I442dee456ccb419642e6cedee7c3ca99ce214de6 Reviewed-on: https://gerrit.libreoffice.org/58773 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/ui/unoobj')
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx4
-rw-r--r--sc/source/ui/unoobj/shapeuno.cxx21
2 files changed, 8 insertions, 17 deletions
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 9273ed844c47..682d201556a4 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -4697,8 +4697,8 @@ uno::Sequence<OUString> SAL_CALL ScCellRangesObj::getSupportedServiceNames()
uno::Reference<table::XCellRange> ScCellRangeObj::CreateRangeFromDoc( const ScDocument* pDoc, const ScRange& rR )
{
SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
- if ( pObjSh && dynamic_cast<const ScDocShell*>( pObjSh) != nullptr )
- return new ScCellRangeObj( static_cast<ScDocShell*>(pObjSh), rR );
+ if ( auto pDocShell = dynamic_cast<ScDocShell*>( pObjSh) )
+ return new ScCellRangeObj( pDocShell, rR );
return nullptr;
}
diff --git a/sc/source/ui/unoobj/shapeuno.cxx b/sc/source/ui/unoobj/shapeuno.cxx
index 04ef95a81e9f..bf0d87d60038 100644
--- a/sc/source/ui/unoobj/shapeuno.cxx
+++ b/sc/source/ui/unoobj/shapeuno.cxx
@@ -343,10 +343,8 @@ void SAL_CALL ScShapeObj::setPropertyValue(const OUString& aPropertyName, const
if ( pDoc )
{
SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
- if ( pObjSh && dynamic_cast<const ScDocShell*>( pObjSh) != nullptr )
+ if ( auto pDocSh = dynamic_cast<ScDocShell*>( pObjSh) )
{
- ScDocShell* pDocSh = static_cast<ScDocShell*>(pObjSh);
-
SCTAB nTab = 0;
if ( lcl_GetPageNum( pPage, rModel, nTab ) )
{
@@ -477,9 +475,8 @@ void SAL_CALL ScShapeObj::setPropertyValue(const OUString& aPropertyName, const
if ( pDoc )
{
SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
- if ( pObjSh && dynamic_cast<const ScDocShell*>( pObjSh) != nullptr )
+ if ( auto pDocSh = dynamic_cast<ScDocShell*>( pObjSh) )
{
- ScDocShell* pDocSh = static_cast<ScDocShell*>(pObjSh);
uno::Reference<drawing::XShape> xShape( mxShapeAgg, uno::UNO_QUERY );
if (xShape.is())
{
@@ -576,9 +573,8 @@ void SAL_CALL ScShapeObj::setPropertyValue(const OUString& aPropertyName, const
if ( pDoc )
{
SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
- if ( pObjSh && dynamic_cast<const ScDocShell*>( pObjSh) != nullptr )
+ if ( auto pDocSh = dynamic_cast<ScDocShell*>( pObjSh) )
{
- ScDocShell* pDocSh = static_cast<ScDocShell*>(pObjSh);
uno::Reference<drawing::XShape> xShape( mxShapeAgg, uno::UNO_QUERY );
if (xShape.is())
{
@@ -673,9 +669,8 @@ uno::Any SAL_CALL ScShapeObj::getPropertyValue( const OUString& aPropertyName )
if ( lcl_GetPageNum( pPage, rModel, nTab ) )
{
SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
- if ( pObjSh && dynamic_cast<const ScDocShell*>( pObjSh) != nullptr )
+ if ( auto pDocSh = dynamic_cast<ScDocShell*>( pObjSh) )
{
- ScDocShell* pDocSh = static_cast<ScDocShell*>(pObjSh);
uno::Reference< uno::XInterface > xAnchor;
if (ScDrawObjData *pAnchor = ScDrawLayer::GetObjDataTab(pObj, nTab))
xAnchor.set(static_cast<cppu::OWeakObject*>(new ScCellObj( pDocSh, pAnchor->maStart)));
@@ -1011,10 +1006,8 @@ uno::Reference<text::XTextRange> SAL_CALL ScShapeObj::getAnchor()
if ( pPage && pDoc )
{
SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
- if ( pObjSh && dynamic_cast<const ScDocShell*>( pObjSh) != nullptr )
+ if ( auto pDocSh = dynamic_cast<ScDocShell*>( pObjSh) )
{
- ScDocShell* pDocSh = static_cast<ScDocShell*>(pObjSh);
-
SCTAB nTab = 0;
if ( lcl_GetPageNum( pPage, rModel, nTab ) )
{
@@ -1254,10 +1247,8 @@ uno::Reference< uno::XInterface > SAL_CALL ScShapeObj::getParent()
if ( pPage && pDoc )
{
SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
- if ( pObjSh && dynamic_cast<const ScDocShell*>( pObjSh) != nullptr )
+ if ( auto pDocSh = dynamic_cast<ScDocShell*>( pObjSh) )
{
- ScDocShell* pDocSh = static_cast<ScDocShell*>(pObjSh);
-
SCTAB nTab = 0;
if ( lcl_GetPageNum( pPage, rModel, nTab ) )
{