summaryrefslogtreecommitdiff
path: root/svx/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-11-07 13:55:06 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-11-09 07:31:24 +0100
commit5ba447bdcd13ba3d7c27c8609f207910227e4ab6 (patch)
tree9a59e7058ef40be90867518590e35abb6c0615f5 /svx/source
parentea4a47d7d442d5d897cfa3a6e9f09ce3f1f233c5 (diff)
new loplugin simplifydynamiccast
simplify dynamic_cast followed by static_cast Change-Id: I965afcf05d1675094cfde53d3590a0fd00f26279 Reviewed-on: https://gerrit.libreoffice.org/44460 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source')
-rw-r--r--svx/source/customshapes/EnhancedCustomShape3d.cxx4
-rw-r--r--svx/source/customshapes/EnhancedCustomShapeEngine.cxx4
-rw-r--r--svx/source/engine3d/view3d.cxx8
-rw-r--r--svx/source/stbctrls/pszctrl.cxx12
-rw-r--r--svx/source/stbctrls/xmlsecctrl.cxx4
-rw-r--r--svx/source/stbctrls/zoomctrl.cxx7
-rw-r--r--svx/source/svdraw/svdpagv.cxx4
7 files changed, 21 insertions, 22 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShape3d.cxx b/svx/source/customshapes/EnhancedCustomShape3d.cxx
index 6d65bcc0ff63..9a048049c370 100644
--- a/svx/source/customshapes/EnhancedCustomShape3d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape3d.cxx
@@ -377,7 +377,7 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con
SfxItemSet aLocalSet(aSet);
drawing::FillStyle aLocalFillStyle(eFillStyle);
- if ( dynamic_cast<const SdrPathObj*>( pNext) != nullptr )
+ if ( auto pPathObj = dynamic_cast<const SdrPathObj*>(pNext) )
{
const SfxItemSet& rSet = pNext->GetMergedItemSet();
bool bNeedToConvertToContour(false);
@@ -453,7 +453,7 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con
}
else
{
- aPolyPoly = static_cast<const SdrPathObj*>(pNext)->GetPathPoly();
+ aPolyPoly = pPathObj->GetPathPoly();
}
}
else
diff --git a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
index d4a6fc657fea..00100d8afad9 100644
--- a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
@@ -415,9 +415,9 @@ drawing::PolyPolygonBezierCoords SAL_CALL EnhancedCustomShapeEngine::getLineGeom
basegfx::B2DPolyPolygon aPP;
const SdrObject* pNext = aIter.Next();
- if ( dynamic_cast<const SdrPathObj*>( pNext) != nullptr )
+ if ( auto pPathObj = dynamic_cast<const SdrPathObj*>(pNext) )
{
- aPP = static_cast<const SdrPathObj*>(pNext)->GetPathPoly();
+ aPP = pPathObj->GetPathPoly();
}
else
{
diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx
index d7edf4da5655..dd4396c91a56 100644
--- a/svx/source/engine3d/view3d.cxx
+++ b/svx/source/engine3d/view3d.cxx
@@ -418,9 +418,9 @@ SdrModel* E3dView::GetMarkedObjModel() const
{
const SdrObject* pSrcOb=pSrcPg->GetObj(nOb);
- if(dynamic_cast< const E3dScene* >( pSrcOb) != nullptr)
+ if(auto p3dscene = dynamic_cast< const E3dScene* >( pSrcOb))
{
- pScene = const_cast<E3dScene*>(static_cast<const E3dScene*>(pSrcOb));
+ pScene = const_cast<E3dScene*>(p3dscene);
// delete all not intentionally cloned 3d objects
pScene->removeAllNonSelectedObjects();
@@ -476,9 +476,9 @@ bool E3dView::Paste(
for(size_t nOb = 0; nOb < nObjCount; ++nOb)
{
const SdrObject* pSrcOb = pSrcPg->GetObj(nOb);
- if(dynamic_cast< const E3dScene* >(pSrcOb) != nullptr)
+ if(auto p3dscene = dynamic_cast< const E3dScene* >(pSrcOb))
{
- E3dScene* pSrcScene = const_cast<E3dScene*>(static_cast<const E3dScene*>(pSrcOb));
+ E3dScene* pSrcScene = const_cast<E3dScene*>(p3dscene);
ImpCloneAll3DObjectsToDestScene(pSrcScene, pDstScene, aDist);
}
}
diff --git a/svx/source/stbctrls/pszctrl.cxx b/svx/source/stbctrls/pszctrl.cxx
index 1ad57366f88a..334670aabb11 100644
--- a/svx/source/stbctrls/pszctrl.cxx
+++ b/svx/source/stbctrls/pszctrl.cxx
@@ -299,24 +299,24 @@ void SvxPosSizeStatusBarControl::StateChanged( sal_uInt16 nSID, SfxItemState eSt
SAL_WARN( "svx.stbcrtls","unknown slot id");
}
}
- else if ( dynamic_cast<const SfxPointItem*>( pState) != nullptr )
+ else if ( auto pPointItem = dynamic_cast<const SfxPointItem*>( pState) )
{
// show position
- pImpl->aPos = static_cast<const SfxPointItem*>(pState)->GetValue();
+ pImpl->aPos = pPointItem->GetValue();
pImpl->bPos = true;
pImpl->bTable = false;
}
- else if ( dynamic_cast<const SvxSizeItem*>( pState) != nullptr )
+ else if ( auto pSizeItem = dynamic_cast<const SvxSizeItem*>( pState) )
{
// show size
- pImpl->aSize = static_cast<const SvxSizeItem*>(pState)->GetSize();
+ pImpl->aSize = pSizeItem->GetSize();
pImpl->bSize = true;
pImpl->bTable = false;
}
- else if ( dynamic_cast<const SfxStringItem*>( pState) != nullptr )
+ else if ( auto pStringItem = dynamic_cast<const SfxStringItem*>( pState) )
{
// show string (table cel or different)
- pImpl->aStr = static_cast<const SfxStringItem*>(pState)->GetValue();
+ pImpl->aStr = pStringItem->GetValue();
pImpl->bTable = true;
pImpl->bPos = false;
pImpl->bSize = false;
diff --git a/svx/source/stbctrls/xmlsecctrl.cxx b/svx/source/stbctrls/xmlsecctrl.cxx
index 90e8b55fbe36..ae43e64dc405 100644
--- a/svx/source/stbctrls/xmlsecctrl.cxx
+++ b/svx/source/stbctrls/xmlsecctrl.cxx
@@ -71,9 +71,9 @@ void XmlSecStatusBarControl::StateChanged( sal_uInt16, SfxItemState eState, cons
{
mpImpl->mnState = SignatureState::UNKNOWN;
}
- else if( dynamic_cast< const SfxUInt16Item* >(pState) != nullptr )
+ else if( auto pUint16Item = dynamic_cast< const SfxUInt16Item* >(pState) )
{
- mpImpl->mnState = static_cast<SignatureState>(static_cast<const SfxUInt16Item*>(pState)->GetValue());
+ mpImpl->mnState = static_cast<SignatureState>(pUint16Item->GetValue());
}
else
{
diff --git a/svx/source/stbctrls/zoomctrl.cxx b/svx/source/stbctrls/zoomctrl.cxx
index cf9b42cbc833..ed92af23be34 100644
--- a/svx/source/stbctrls/zoomctrl.cxx
+++ b/svx/source/stbctrls/zoomctrl.cxx
@@ -116,17 +116,16 @@ void SvxZoomStatusBarControl::StateChanged( sal_uInt16, SfxItemState eState,
GetStatusBar().SetItemText( GetId(), "" );
nValueSet = SvxZoomEnableFlags::NONE;
}
- else if ( dynamic_cast< const SfxUInt16Item* >(pState) != nullptr )
+ else if ( auto pItem = dynamic_cast< const SfxUInt16Item* >(pState) )
{
- const SfxUInt16Item* pItem = static_cast<const SfxUInt16Item*>(pState);
nZoom = pItem->GetValue();
OUString aStr(unicode::formatPercent(nZoom, Application::GetSettings().GetUILanguageTag()));
GetStatusBar().SetItemText( GetId(), aStr );
- if ( dynamic_cast<const SvxZoomItem*>( pState) != nullptr )
+ if ( auto pZoomItem = dynamic_cast<const SvxZoomItem*>(pState) )
{
- nValueSet = static_cast<const SvxZoomItem*>(pState)->GetValueSet();
+ nValueSet = pZoomItem->GetValueSet();
}
else
{
diff --git a/svx/source/svdraw/svdpagv.cxx b/svx/source/svdraw/svdpagv.cxx
index 5f502bf1ed0d..ab837a7c58e6 100644
--- a/svx/source/svdraw/svdpagv.cxx
+++ b/svx/source/svdraw/svdpagv.cxx
@@ -642,11 +642,11 @@ bool SdrPageView::IsObjMarkable(SdrObject const * pObj) const
return false; // only visible are selectable
if (!pObj->IsInserted())
return false; // Obj deleted?
- if (dynamic_cast<const SdrObjGroup*>(pObj) != nullptr)
+ if (auto pObjGroup = dynamic_cast<const SdrObjGroup*>(pObj))
{
// If object is a Group object, visibility may depend on
// multiple layers. If one object is markable, Group is markable.
- SdrObjList* pObjList = static_cast<SdrObjGroup const *>(pObj)->GetSubList();
+ SdrObjList* pObjList = pObjGroup->GetSubList();
if (pObjList && pObjList->GetObjCount())
{