chart2/source/view/charttypes/BarChart.cxx |    7 +--
 chart2/source/view/diagram/VDiagram.cxx    |    2 -
 include/svx/svdobj.hxx                     |    5 ++
 sd/source/ui/func/fudraw.cxx               |    4 +-
 sd/source/ui/func/fusel.cxx                |    2 -
 sd/source/ui/view/drviewsj.cxx             |    4 +-
 svx/source/engine3d/obj3d.cxx              |    5 --
 svx/source/engine3d/scene3d.cxx            |    2 -
 svx/source/engine3d/view3d.cxx             |   10 ++---
 svx/source/engine3d/view3d1.cxx            |    2 -
 svx/source/svdraw/clonelist.cxx            |    4 +-
 svx/source/svdraw/svdcrtv.cxx              |    4 +-
 svx/source/svdraw/svdedtv.cxx              |    6 +--
 svx/source/svdraw/svdmark.cxx              |    2 -
 svx/source/svdraw/svdmrkv.cxx              |   52 +++++++++++++----------------
 svx/source/svdraw/svdobj.cxx               |    9 ++++-
 svx/source/svdraw/svdundo.cxx              |    8 ++--
 svx/source/unodraw/unoshap3.cxx            |    2 -
 sw/source/core/unocore/unodraw.cxx         |    2 -
 19 files changed, 68 insertions(+), 64 deletions(-)

New commits:
commit 4e24efb563cbe6fec4185b4f7ec3755b2fc05b6b
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Tue Nov 1 18:38:10 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Nov 1 19:53:23 2022 +0100

    tdf#54857 elide more dynamic_cast
    
    add a helper, following the same style as the ones in sw/
    
    Change-Id: I13c673bba5ff47df6beef9d90c200e5801030cf0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142119
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/chart2/source/view/charttypes/BarChart.cxx 
b/chart2/source/view/charttypes/BarChart.cxx
index 8516fae2ece1..d265f9aa3dd1 100644
--- a/chart2/source/view/charttypes/BarChart.cxx
+++ b/chart2/source/view/charttypes/BarChart.cxx
@@ -449,8 +449,7 @@ void BarChart::createShapes()
 
         for (rtl::Reference<SvxShape> const & rShape : aShapeSet)
         {
-            E3dScene* pScene = dynamic_cast<E3dScene*>(rShape->GetSdrObject());
-            if(nullptr != pScene)
+            if(E3dScene* pScene = DynCastE3dScene(rShape->GetSdrObject()))
             {
                 aSceneSet.insert(pScene->getRootE3dSceneFromE3dObject());
             }
@@ -690,10 +689,10 @@ void BarChart::doXSlot(
         aShapeSet.insert(xSeriesGroupShape_Shapes);
         aShapeSet.insert(xSeriesBackgroundShape_Shapes);
         // Suspend setting rects dirty for the duration of this call
-        E3dScene* pScene = 
dynamic_cast<E3dScene*>(xSeriesGroupShape_Shapes->GetSdrObject());
+        E3dScene* pScene = 
DynCastE3dScene(xSeriesGroupShape_Shapes->GetSdrObject());
         if (pScene)
             pScene->SuspendReportingDirtyRects();
-        pScene = 
dynamic_cast<E3dScene*>(xSeriesBackgroundShape_Shapes->GetSdrObject());
+        pScene = 
DynCastE3dScene(xSeriesBackgroundShape_Shapes->GetSdrObject());
         if (pScene)
             pScene->SuspendReportingDirtyRects();
 
diff --git a/chart2/source/view/diagram/VDiagram.cxx 
b/chart2/source/view/diagram/VDiagram.cxx
index 3ffb75b07f05..bb52e968f804 100644
--- a/chart2/source/view/diagram/VDiagram.cxx
+++ b/chart2/source/view/diagram/VDiagram.cxx
@@ -183,7 +183,7 @@ void VDiagram::createShapes_2d()
 
 static E3dScene* lcl_getE3dScene( const rtl::Reference<SvxShapeGroupAnyD>& 
xShape )
 {
-    return dynamic_cast< E3dScene* >(xShape->GetSdrObject());
+    return DynCastE3dScene(xShape->GetSdrObject());
 }
 
 static void lcl_setLightSources(
diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx
index 8ca06a36006c..0f53f15ab5f6 100644
--- a/include/svx/svdobj.hxx
+++ b/include/svx/svdobj.hxx
@@ -41,6 +41,7 @@
 
 class SfxBroadcaster;
 class AutoTimer;
+class E3dScene;
 class OutlinerParaObject;
 class Outliner;
 class SdrOutliner;
@@ -996,6 +997,10 @@ private:
     SdrObject( const SdrObject& ) = delete;
 };
 
+SVXCORE_DLLPUBLIC E3dScene* DynCastE3dScene(SdrObject*);
+inline const E3dScene* DynCastE3dScene(const SdrObject* p) { return 
DynCastE3dScene(const_cast<SdrObject*>(p)); }
+
+
 struct SdrObjCreatorParams
 {
     SdrInventor nInventor;
diff --git a/sd/source/ui/func/fudraw.cxx b/sd/source/ui/func/fudraw.cxx
index 8beb753f6387..9b09a98a39e5 100644
--- a/sd/source/ui/func/fudraw.cxx
+++ b/sd/source/ui/func/fudraw.cxx
@@ -556,7 +556,7 @@ void FuDraw::ForcePointer(const MouseEvent* pMEvt)
 
                 if (bDefPointer
                     && (dynamic_cast<const SdrObjGroup*>(pObj) != nullptr
-                        || dynamic_cast<const E3dScene*>(pObj) != nullptr))
+                        || DynCastE3dScene(pObj)))
                 {
                     // take a glance into the group
                     pObj = mpView->PickObj(aPnt, mpView->getHitTolLog(), pPV,
@@ -698,7 +698,7 @@ bool FuDraw::RequestHelp(const HelpEvent& rHEvt)
 
             bReturn = SetHelpText(pObj, aPosPixel, aVEvt);
 
-            if (!bReturn && (dynamic_cast< const SdrObjGroup *>( pObj ) != 
nullptr || dynamic_cast< const E3dScene* >(pObj) != nullptr))
+            if (!bReturn && (dynamic_cast< const SdrObjGroup *>( pObj ) != 
nullptr || DynCastE3dScene(pObj)))
             {
                 // take a glance into the group
                 SdrPageView* pPV = nullptr;
diff --git a/sd/source/ui/func/fusel.cxx b/sd/source/ui/func/fusel.cxx
index ed7efc851414..0a7bb5e90801 100644
--- a/sd/source/ui/func/fusel.cxx
+++ b/sd/source/ui/func/fusel.cxx
@@ -327,7 +327,7 @@ bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
 
                     if (!bReturn
                         && (dynamic_cast<const SdrObjGroup*>(pObj) != nullptr
-                            || dynamic_cast<const E3dScene*>(pObj) != nullptr))
+                            || DynCastE3dScene(pObj)))
                     {
                         if (rMEvt.GetClicks() == 1)
                         {
diff --git a/sd/source/ui/view/drviewsj.cxx b/sd/source/ui/view/drviewsj.cxx
index a1a7d899f4b3..55103bf67573 100644
--- a/sd/source/ui/view/drviewsj.cxx
+++ b/sd/source/ui/view/drviewsj.cxx
@@ -136,7 +136,7 @@ void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet )
             const auto* pSdrObjGroup = dynamic_cast<const SdrObjGroup*>(pObj);
 
             if( !( ( pSdrObjGroup != nullptr && nInv == SdrInventor::Default ) 
||
-                   ( dynamic_cast< const E3dScene* >(pObj) != nullptr ) ) )
+                   DynCastE3dScene(pObj) ) )
             {
                 rSet.DisableItem( SID_ENTER_GROUP );
             }
@@ -382,7 +382,7 @@ void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet )
                 }
                 else if (nInv == SdrInventor::E3d)
                 {
-                    if(dynamic_cast< const E3dScene *>( pObj ) !=  nullptr)
+                    if(DynCastE3dScene(pObj))
                         b3dObj = true;
                     else if(dynamic_cast< const E3dCompoundObject* >(pObj) !=  
nullptr)
                         bE3dCompoundObject = true;
diff --git a/svx/source/engine3d/obj3d.cxx b/svx/source/engine3d/obj3d.cxx
index 4d8ad7add1de..1acf0b2a93f7 100644
--- a/svx/source/engine3d/obj3d.cxx
+++ b/svx/source/engine3d/obj3d.cxx
@@ -264,10 +264,7 @@ void E3dObject::StructureChanged()
 
 E3dScene* E3dObject::getParentE3dSceneFromE3dObject() const
 {
-    SdrObject* pParent = getParentSdrObjectFromSdrObject();
-    if( pParent && pParent->GetObjIdentifier() == SdrObjKind::E3D_Scene )
-        return static_cast<E3dScene* >(pParent);
-    return nullptr;
+    return DynCastE3dScene(getParentSdrObjectFromSdrObject());
 }
 
 // Determine the top-level scene object
diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx
index cea87b316552..f07fa7e170d9 100644
--- a/svx/source/engine3d/scene3d.cxx
+++ b/svx/source/engine3d/scene3d.cxx
@@ -408,7 +408,7 @@ void E3dScene::removeAllNonSelectedObjects()
         {
             bool bRemoveObject(false);
 
-            if(auto pScene = dynamic_cast<E3dScene*>(pObj))
+            if(E3dScene* pScene = DynCastE3dScene(pObj))
             {
                 // iterate over this sub-scene
                 pScene->removeAllNonSelectedObjects();
diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx
index 7b9e81bf06e5..a7bd239352be 100644
--- a/svx/source/engine3d/view3d.cxx
+++ b/svx/source/engine3d/view3d.cxx
@@ -403,7 +403,7 @@ std::unique_ptr<SdrModel> E3dView::CreateMarkedObjModel() 
const
             {
                 const SdrObject* pSrcOb=pSrcPg->GetObj(nOb);
 
-                if(auto p3dscene = dynamic_cast< const E3dScene* >( pSrcOb))
+                if(const E3dScene* p3dscene = DynCastE3dScene( pSrcOb))
                 {
                     pScene = const_cast<E3dScene*>(p3dscene);
 
@@ -441,7 +441,7 @@ bool E3dView::Paste(
         return false;
 
     // Get owner of the list
-    E3dScene* pDstScene(dynamic_cast< E3dScene* 
>(pDstList->getSdrObjectFromSdrObjList()));
+    E3dScene* 
pDstScene(DynCastE3dScene(pDstList->getSdrObjectFromSdrObjList()));
 
     if(nullptr != pDstScene)
     {
@@ -461,7 +461,7 @@ bool E3dView::Paste(
             for(size_t nOb = 0; nOb < nObjCount; ++nOb)
             {
                 const SdrObject* pSrcOb = pSrcPg->GetObj(nOb);
-                if(auto p3dscene = dynamic_cast< const E3dScene* >(pSrcOb))
+                if(const E3dScene* p3dscene = DynCastE3dScene(pSrcOb))
                 {
                     E3dScene* pSrcScene = const_cast<E3dScene*>(p3dscene);
                     ImpCloneAll3DObjectsToDestScene(pSrcScene, pDstScene, 
aDist);
@@ -1172,7 +1172,7 @@ bool E3dView::BegDragObj(const Point& rPnt, OutputDevice* 
pOut,
                 SdrObject *pObj = GetMarkedObjectByIndex(nObjs);
                 if(pObj)
                 {
-                    if( auto pScene = dynamic_cast< const E3dScene* >(pObj) )
+                    if( const E3dScene* pScene = DynCastE3dScene(pObj) )
                         if( pScene->getRootE3dSceneFromE3dObject() == pObj )
                             bThereAreRootScenes = true;
 
@@ -1520,7 +1520,7 @@ void E3dView::Break3DObj()
 
 void E3dView::BreakSingle3DObj(E3dObject* pObj)
 {
-    if(dynamic_cast< const E3dScene* >(pObj) !=  nullptr)
+    if(DynCastE3dScene(pObj))
     {
         SdrObjList* pSubList = pObj->GetSubList();
         SdrObjListIter aIter(pSubList, SdrIterMode::Flat);
diff --git a/svx/source/engine3d/view3d1.cxx b/svx/source/engine3d/view3d1.cxx
index 46830afda95a..e647fe11625c 100644
--- a/svx/source/engine3d/view3d1.cxx
+++ b/svx/source/engine3d/view3d1.cxx
@@ -42,7 +42,7 @@ void E3dView::ConvertMarkedToPolyObj()
 
         if (pObj)
         {
-            auto pScene = dynamic_cast< const E3dScene* >(pObj);
+            const E3dScene* pScene = DynCastE3dScene(pObj);
             if (pScene)
             {
                 pNewObj = pScene->ConvertToPolyObj(false/*bBezier*/, 
false/*bLineToArea*/);
diff --git a/svx/source/svdraw/clonelist.cxx b/svx/source/svdraw/clonelist.cxx
index 12f395ac1d4b..840ea3358135 100644
--- a/svx/source/svdraw/clonelist.cxx
+++ b/svx/source/svdraw/clonelist.cxx
@@ -34,10 +34,10 @@ void CloneList::AddPair(const SdrObject* pOriginal, 
SdrObject* pClone)
     bool bOriginalIsGroup(pOriginal->IsGroupObject());
     bool bCloneIsGroup(pClone->IsGroupObject());
 
-    if(bOriginalIsGroup && dynamic_cast<const E3dObject* >(pOriginal) != 
nullptr && dynamic_cast<const E3dScene* >(pOriginal) == nullptr )
+    if(bOriginalIsGroup && dynamic_cast<const E3dObject* >(pOriginal) != 
nullptr && DynCastE3dScene(pOriginal) == nullptr )
         bOriginalIsGroup = false;
 
-    if(bCloneIsGroup && dynamic_cast<const E3dObject* >(pClone) != nullptr && 
dynamic_cast<const E3dScene* >(pClone) == nullptr)
+    if(bCloneIsGroup && dynamic_cast<const E3dObject* >(pClone) != nullptr && 
DynCastE3dScene(pClone) == nullptr)
         bCloneIsGroup = false;
 
     if(!(bOriginalIsGroup && bCloneIsGroup))
diff --git a/svx/source/svdraw/svdcrtv.cxx b/svx/source/svdraw/svdcrtv.cxx
index 1aa9d1d2d54e..7e025cf044e1 100644
--- a/svx/source/svdraw/svdcrtv.cxx
+++ b/svx/source/svdraw/svdcrtv.cxx
@@ -618,8 +618,8 @@ bool SdrCreateView::EndCreateObj(SdrCreateCmd eCmd)
                 // recognize creation of a new 3D object inside a 3D scene
                 bool bSceneIntoScene(false);
 
-                E3dScene* pObjScene = dynamic_cast<E3dScene*>(pObjCreated);
-                E3dScene* pCurrentScene = pObjScene ? 
dynamic_cast<E3dScene*>(mpCreatePV->GetCurrentGroup()) : nullptr;
+                E3dScene* pObjScene = DynCastE3dScene(pObjCreated);
+                E3dScene* pCurrentScene = pObjScene ? 
DynCastE3dScene(mpCreatePV->GetCurrentGroup()) : nullptr;
                 if (pCurrentScene)
                 {
                     bool bDidInsert = 
static_cast<E3dView*>(this)->ImpCloneAll3DObjectsToDestScene(
diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx
index 8dbdaa85b885..68026d943c9b 100644
--- a/svx/source/svdraw/svdedtv.cxx
+++ b/svx/source/svdraw/svdedtv.cxx
@@ -150,7 +150,7 @@ bool SdrEditView::ImpDelLayerCheck(SdrObjList const * pOL, 
SdrLayerID nDelID) co
         SdrObjList* pSubOL = pObj->GetSubList();
 
         // explicitly test for group objects and 3d scenes
-        if(pSubOL && (dynamic_cast<const SdrObjGroup*>(pObj) != nullptr || 
dynamic_cast< const E3dScene* >(pObj) !=  nullptr))
+        if(pSubOL && (dynamic_cast<const SdrObjGroup*>(pObj) != nullptr || 
DynCastE3dScene(pObj)))
         {
             if(!ImpDelLayerCheck(pSubOL, nDelID))
             {
@@ -185,7 +185,7 @@ void SdrEditView::ImpDelLayerDelObjs(SdrObjList* pOL, 
SdrLayerID nDelID)
 
 
         // explicitly test for group objects and 3d scenes
-        if(pSubOL && (dynamic_cast<const SdrObjGroup*>( pObj) != nullptr || 
dynamic_cast<const E3dScene* >(pObj) !=  nullptr))
+        if(pSubOL && (dynamic_cast<const SdrObjGroup*>( pObj) != nullptr || 
DynCastE3dScene(pObj)))
         {
             if(ImpDelLayerCheck(pSubOL, nDelID))
             {
@@ -249,7 +249,7 @@ void SdrEditView::DeleteLayer(const OUString& rName)
                 SdrObjList* pSubOL = pObj->GetSubList();
 
                 // explicitly test for group objects and 3d scenes
-                if(pSubOL && (dynamic_cast<const SdrObjGroup*>(pObj) != 
nullptr || dynamic_cast<const E3dScene* >(pObj) !=  nullptr))
+                if(pSubOL && (dynamic_cast<const SdrObjGroup*>(pObj) != 
nullptr || DynCastE3dScene(pObj)))
                 {
                     if(ImpDelLayerCheck(pSubOL, nDelID))
                     {
diff --git a/svx/source/svdraw/svdmark.cxx b/svx/source/svdraw/svdmark.cxx
index e3c77bda1e74..ff556ee9f6bb 100644
--- a/svx/source/svdraw/svdmark.cxx
+++ b/svx/source/svdraw/svdmark.cxx
@@ -700,7 +700,7 @@ namespace sdr
 
         bool bIsGroup(pObj->IsGroupObject());
 
-        if(bIsGroup && dynamic_cast< const E3dObject* >(pObj) != nullptr && 
dynamic_cast< const E3dScene* >(pObj) == nullptr)
+        if(bIsGroup && dynamic_cast< const E3dObject* >(pObj) != nullptr && 
DynCastE3dScene(pObj) == nullptr)
         {
             bIsGroup = false;
         }
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index 3e4383c89137..90ebb72a7cc9 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -2052,7 +2052,7 @@ bool SdrMarkView::MarkNextObj(const Point& rPnt, short 
nTol, bool bPrev)
         nullptr != dynamic_cast< const E3dCompoundObject* >(pObjHit);
     if (bRemap)
     {
-        pScene = dynamic_cast< E3dScene* 
>(pObjHit->getParentSdrObjectFromSdrObject());
+        pScene = DynCastE3dScene(pObjHit->getParentSdrObjectFromSdrObject());
         bRemap = nullptr != pScene;
     }
 
@@ -2381,41 +2381,37 @@ SdrObject* SdrMarkView::CheckSingleSdrObjectHit(const 
Point& rPnt, sal_uInt16 nT
 {
     SdrObject* pRet=nullptr;
     rpRootObj=nullptr;
-    if (pOL!=nullptr)
+    if (!pOL)
+        return nullptr;
+    const E3dScene* pRemapScene = 
DynCastE3dScene(pOL->getSdrObjectFromSdrObjList());
+    const size_t nObjCount(pOL->GetObjCount());
+    size_t nObjNum(nObjCount);
+
+    while (pRet==nullptr && nObjNum>0)
     {
-        const bool bRemap(
-            nullptr != pOL->getSdrObjectFromSdrObjList()
-            && nullptr != dynamic_cast< const E3dScene* 
>(pOL->getSdrObjectFromSdrObjList()));
-        const E3dScene* pRemapScene(bRemap ? static_cast< E3dScene* 
>(pOL->getSdrObjectFromSdrObjList()) : nullptr);
-        const size_t nObjCount(pOL->GetObjCount());
-        size_t nObjNum(nObjCount);
+        nObjNum--;
+        SdrObject* pObj;
 
-        while (pRet==nullptr && nObjNum>0)
+        if(pRemapScene)
         {
-            nObjNum--;
-            SdrObject* pObj;
-
-            if(bRemap)
-            {
-                pObj = pOL->GetObj(pRemapScene->RemapOrdNum(nObjNum));
-            }
-            else
-            {
-                pObj = pOL->GetObj(nObjNum);
-            }
-            if (nOptions & SdrSearchOptions::BEFOREMARK)
+            pObj = pOL->GetObj(pRemapScene->RemapOrdNum(nObjNum));
+        }
+        else
+        {
+            pObj = pOL->GetObj(nObjNum);
+        }
+        if (nOptions & SdrSearchOptions::BEFOREMARK)
+        {
+            if (pMarkList!=nullptr)
             {
-                if (pMarkList!=nullptr)
+                if ((*pMarkList).FindObject(pObj)!=SAL_MAX_SIZE)
                 {
-                    if ((*pMarkList).FindObject(pObj)!=SAL_MAX_SIZE)
-                    {
-                        return nullptr;
-                    }
+                    return nullptr;
                 }
             }
-            pRet=CheckSingleSdrObjectHit(rPnt,nTol,pObj,pPV,nOptions,pMVisLay);
-            if (pRet!=nullptr) rpRootObj=pObj;
         }
+        pRet=CheckSingleSdrObjectHit(rPnt,nTol,pObj,pPV,nOptions,pMVisLay);
+        if (pRet!=nullptr) rpRootObj=pObj;
     }
     return pRet;
 }
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index 2840854237f1..cd59bbe5b15f 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -3094,7 +3094,7 @@ void SdrObject::MakeNameUnique()
 {
     if (GetName().isEmpty())
     {
-        if (const E3dScene* pE3dObj = dynamic_cast<const E3dScene*>(this))
+        if (const E3dScene* pE3dObj = DynCastE3dScene(this))
         {
             SdrObjList* pObjList = pE3dObj->GetSubList();
             if (pObjList)
@@ -3195,6 +3195,13 @@ void SdrObject::moveOutRectangle(sal_Int32 nXDelta, 
sal_Int32 nYDelta)
     m_aOutRect.Move(nXDelta, nYDelta);
 }
 
+E3dScene* DynCastE3dScene(SdrObject* pObj)
+{
+    if( pObj && pObj->GetObjInventor() == SdrInventor::E3d && 
pObj->GetObjIdentifier() == SdrObjKind::E3D_Scene )
+        return static_cast<E3dScene*>(pObj);
+    return nullptr;
+}
+
 rtl::Reference<SdrObject> SdrObjFactory::CreateObjectFromFactory(SdrModel& 
rSdrModel, SdrInventor nInventor, SdrObjKind nObjIdentifier)
 {
     SdrObjCreatorParams aParams { nInventor, nObjIdentifier, rSdrModel };
diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx
index 7fe649ea6648..0df375d266a6 100644
--- a/svx/source/svdraw/svdundo.cxx
+++ b/svx/source/svdraw/svdundo.cxx
@@ -257,7 +257,7 @@ SdrUndoAttrObj::SdrUndoAttrObj(SdrObject& rNewObj, bool 
bStyleSheet1, bool bSave
 
     SdrObjList* pOL = rNewObj.GetSubList();
     bool bIsGroup(pOL!=nullptr && pOL->GetObjCount());
-    bool bIs3DScene(bIsGroup && dynamic_cast< E3dScene* >(mxObj.get()) !=  
nullptr);
+    bool bIs3DScene(bIsGroup && DynCastE3dScene(mxObj.get()));
 
     if(bIsGroup)
     {
@@ -300,7 +300,7 @@ SdrUndoAttrObj::~SdrUndoAttrObj()
 void SdrUndoAttrObj::Undo()
 {
     E3DModifySceneSnapRectUpdater aUpdater(mxObj.get());
-    bool bIs3DScene(dynamic_cast< E3dScene* >(mxObj.get()) !=  nullptr);
+    bool bIs3DScene(DynCastE3dScene(mxObj.get()));
 
     // Trigger PageChangeCall
     ImpShowPageOfThisObject();
@@ -409,7 +409,7 @@ void SdrUndoAttrObj::Undo()
 void SdrUndoAttrObj::Redo()
 {
     E3DModifySceneSnapRectUpdater aUpdater(mxObj.get());
-    bool bIs3DScene(dynamic_cast< E3dScene* >(mxObj.get()) !=  nullptr);
+    bool bIs3DScene(DynCastE3dScene(mxObj.get()));
 
     if(!pUndoGroup || bIs3DScene)
     {
@@ -560,7 +560,7 @@ SdrUndoGeoObj::SdrUndoGeoObj(SdrObject& rNewObj)
      , mbSkipChangeLayout(false)
 {
     SdrObjList* pOL=rNewObj.GetSubList();
-    if (pOL!=nullptr && pOL->GetObjCount() && dynamic_cast<const E3dScene* >( 
&rNewObj) ==  nullptr)
+    if (pOL!=nullptr && pOL->GetObjCount() && DynCastE3dScene(&rNewObj))
     {
         // this is a group object!
         // If this were 3D scene, we'd only add an Undo for the scene itself
diff --git a/svx/source/unodraw/unoshap3.cxx b/svx/source/unodraw/unoshap3.cxx
index 8176451eb0ea..18f050d5c4af 100644
--- a/svx/source/unodraw/unoshap3.cxx
+++ b/svx/source/unodraw/unoshap3.cxx
@@ -191,7 +191,7 @@ sal_Int32 SAL_CALL Svx3DSceneObject::getCount()
 
     sal_Int32 nRetval = 0;
 
-    if(HasSdrObject() && dynamic_cast<const E3dScene* >(GetSdrObject()) != 
nullptr && GetSdrObject()->GetSubList())
+    if(HasSdrObject() && DynCastE3dScene(GetSdrObject()) && 
GetSdrObject()->GetSubList())
         nRetval = GetSdrObject()->GetSubList()->GetObjCount();
     return nRetval;
 }
diff --git a/sw/source/core/unocore/unodraw.cxx 
b/sw/source/core/unocore/unodraw.cxx
index fe4c2d762f84..bb93566a271a 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -367,7 +367,7 @@ uno::Reference< drawing::XShape > 
SwFmDrawPage::CreateShape( SdrObject *pObj ) c
             xShapeTunnel = nullptr;
             uno::Reference< uno::XInterface > xCreate(xRet, uno::UNO_QUERY);
             xRet = nullptr;
-            if ( pObj->IsGroupObject() && (!pObj->Is3DObj() || 
(dynamic_cast<const E3dScene*>( pObj) !=  nullptr)) )
+            if ( pObj->IsGroupObject() && (!pObj->Is3DObj() || 
DynCastE3dScene(pObj)) )
                 pShape = new SwXGroupShape(xCreate, nullptr);
             else
                 pShape = new SwXShape(xCreate, nullptr);

Reply via email to