diff options
author | Noel <noel.grandin@collabora.co.uk> | 2021-02-02 09:41:52 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-02-02 12:24:00 +0100 |
commit | 068d4108e5ae41ca5bc2bcf22277e6235c6bdd0b (patch) | |
tree | 4139d3418c7c72d5126f64e59e192cac3e74c7ee /svx/source | |
parent | e763e13873adfe3c6abfa4c2dfd3ac3847e2d494 (diff) |
loplugin:redundantcast catch more dynamic_cast
Change-Id: Ia28e58217cefa306567b53688d851fa210b7821c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110287
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source')
-rw-r--r-- | svx/source/engine3d/scene3d.cxx | 1 | ||||
-rw-r--r-- | svx/source/sdr/properties/attributeproperties.cxx | 8 | ||||
-rw-r--r-- | svx/source/svdraw/svdedxv.cxx | 5 | ||||
-rw-r--r-- | svx/source/svdraw/svditer.cxx | 4 | ||||
-rw-r--r-- | svx/source/svdraw/svdmodel.cxx | 2 | ||||
-rw-r--r-- | svx/source/table/svdotable.cxx | 4 |
6 files changed, 11 insertions, 13 deletions
diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx index 0b6632a56a8a..788763536c81 100644 --- a/svx/source/engine3d/scene3d.cxx +++ b/svx/source/engine3d/scene3d.cxx @@ -679,7 +679,6 @@ bool E3dScene::IsBreakObjPossible() while ( a3DIterator.IsMore() ) { E3dObject* pObj = static_cast<E3dObject*>(a3DIterator.Next()); - DBG_ASSERT(dynamic_cast< const E3dObject*>(pObj), "only 3D objects are allowed in scenes!"); if(!pObj->IsBreakObjPossible()) return false; } diff --git a/svx/source/sdr/properties/attributeproperties.cxx b/svx/source/sdr/properties/attributeproperties.cxx index 55dbf646210e..5ed41b9c4c99 100644 --- a/svx/source/sdr/properties/attributeproperties.cxx +++ b/svx/source/sdr/properties/attributeproperties.cxx @@ -99,7 +99,7 @@ namespace sdr::properties void AttributeProperties::ImpRemoveStyleSheet() { // Check type since it is destroyed when the type is deleted - if(GetStyleSheet() && dynamic_cast<const SfxStyleSheet *>(mpStyleSheet) != nullptr) + if(GetStyleSheet() && mpStyleSheet) { EndListening(*mpStyleSheet); if (auto const pool = mpStyleSheet->GetPool()) { // TTTT @@ -378,7 +378,7 @@ namespace sdr::properties void AttributeProperties::ForceStyleToHardAttributes() { - if(!GetStyleSheet() || dynamic_cast<const SfxStyleSheet *>(mpStyleSheet) == nullptr) + if(!GetStyleSheet() || mpStyleSheet == nullptr) return; // guarantee SfxItemSet existence @@ -457,10 +457,10 @@ namespace sdr::properties // to register as listener to that new StyleSheet. if(!rObj.IsInDestruction()) { - if(dynamic_cast<const SfxStyleSheet *>(GetStyleSheet()) != nullptr) + if(SfxStyleSheet* pStyleSheet = GetStyleSheet()) { pNewStSh = static_cast<SfxStyleSheet*>(rModel.GetStyleSheetPool()->Find( - GetStyleSheet()->GetParent(), GetStyleSheet()->GetFamily())); + pStyleSheet->GetParent(), pStyleSheet->GetFamily())); } if(!pNewStSh) diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index a2fd9a692472..75190e09072c 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -1528,8 +1528,7 @@ SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool bDontDeleteReally) pTEObj->EndTextEdit(*pTEOutliner); - if ((pTEObj->GetRotateAngle() != 0_deg100) - || (dynamic_cast<const SdrTextObj*>(pTEObj) != nullptr && pTEObj->IsFontwork())) + if ((pTEObj->GetRotateAngle() != 0_deg100) || (pTEObj && pTEObj->IsFontwork())) { pTEObj->ActionChanged(); } @@ -1591,7 +1590,7 @@ SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool bDontDeleteReally) EndUndo(); // EndUndo after Remove, in case UndoStack is deleted immediately // Switch on any TextAnimation again after TextEdit - if (dynamic_cast<const SdrTextObj*>(pTEObj) != nullptr) + if (pTEObj) { pTEObj->SetTextAnimationAllowed(true); } diff --git a/svx/source/svdraw/svditer.cxx b/svx/source/svdraw/svditer.cxx index 629438ac9842..8a7f5637517a 100644 --- a/svx/source/svdraw/svditer.cxx +++ b/svx/source/svdraw/svditer.cxx @@ -72,8 +72,8 @@ SdrObjListIter::SdrObjListIter(const SdrPage* pSdrPage, SdrIterMode eMode, bool mbReverse(bReverse), mbUseZOrder(true) { - if (const SdrObjList* pList = dynamic_cast<const SdrObjList*>(pSdrPage)) - ImpProcessObjectList(*pList, eMode); + if (pSdrPage) + ImpProcessObjectList(*pSdrPage, eMode); Reset(); } diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index 1e95644654aa..f6f2f8797d72 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -249,7 +249,7 @@ SdrModel::~SdrModel() // the DrawingEngine may need it in its destructor if( mxStyleSheetPool.is() ) { - Reference< XComponent > xComponent( dynamic_cast< cppu::OWeakObject* >( mxStyleSheetPool.get() ), UNO_QUERY ); + Reference< XComponent > xComponent( static_cast< cppu::OWeakObject* >( mxStyleSheetPool.get() ), UNO_QUERY ); if( xComponent.is() ) try { xComponent->dispose(); diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx index 53e6133ac6de..23b3ab802859 100644 --- a/svx/source/table/svdotable.cxx +++ b/svx/source/table/svdotable.cxx @@ -1309,7 +1309,7 @@ const Reference< XIndexAccess >& SdrTableObj::getTableStyle() const /** returns the currently active text. */ SdrText* SdrTableObj::getActiveText() const { - return dynamic_cast< SdrText* >( getActiveCell().get() ); + return getActiveCell().get(); } @@ -1324,7 +1324,7 @@ SdrText* SdrTableObj::getText( sal_Int32 nIndex ) const CellPos aPos( nIndex % nColCount, nIndex / nColCount ); CellRef xCell( mpImpl->getCell( aPos ) ); - return dynamic_cast< SdrText* >( xCell.get() ); + return xCell.get(); } } return nullptr; |