sw/qa/core/layout/flycnt.cxx                                |    2 
 sw/qa/extras/uiwriter/uiwriter9.cxx                         |    3 
 sw/source/core/access/accfrmobj.cxx                         |    2 
 sw/source/core/access/accmap.cxx                            |    2 
 sw/source/core/doc/docdraw.cxx                              |    8 +-
 sw/source/core/doc/docfly.cxx                               |    2 
 sw/source/core/doc/doclay.cxx                               |    2 
 sw/source/core/draw/dcontact.cxx                            |    8 +-
 sw/source/core/draw/dpage.cxx                               |    2 
 sw/source/core/draw/dview.cxx                               |   10 +-
 sw/source/core/frmedt/fecopy.cxx                            |    8 +-
 sw/source/core/frmedt/fefly1.cxx                            |   16 ++--
 sw/source/core/frmedt/feshview.cxx                          |   44 ++++++------
 sw/source/core/frmedt/fews.cxx                              |    4 -
 sw/source/core/inc/dflyobj.hxx                              |    2 
 sw/source/core/layout/flylay.cxx                            |    2 
 sw/source/core/layout/frmtool.cxx                           |   10 +-
 sw/source/core/layout/layact.cxx                            |    2 
 sw/source/core/layout/paintfrm.cxx                          |    4 -
 sw/source/core/objectpositioning/anchoredobjectposition.cxx |    4 -
 sw/source/core/text/txtfly.cxx                              |    2 
 sw/source/core/unocore/unodraw.cxx                          |    2 
 sw/source/core/view/vdraw.cxx                               |    2 
 23 files changed, 73 insertions(+), 70 deletions(-)

New commits:
commit 3d3326a8ff11ace588467b6d76ea826353b6d1e2
Author:     Noel Grandin <[email protected]>
AuthorDate: Wed Feb 4 16:20:10 2026 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Mon Feb 9 15:26:38 2026 +0100

    make more use of DynCastSwVirtFlyDrawObj
    
    we have it, might as well use it
    
    Change-Id: I68ffd56710880a4397f33dd22c78dbc567727078
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198905
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/sw/qa/core/layout/flycnt.cxx b/sw/qa/core/layout/flycnt.cxx
index 0eb297393502..7e871fde386b 100644
--- a/sw/qa/core/layout/flycnt.cxx
+++ b/sw/qa/core/layout/flycnt.cxx
@@ -722,7 +722,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSplitFly2ndRowSelect)
     // Then make sure the first row is selected:
     const SdrMarkList& rMarkList = 
pWrtShell->GetDrawView()->GetMarkedObjectList();
     SdrObject* pSelectedObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
-    auto pSelectedVirtObj = dynamic_cast<SwVirtFlyDrawObj*>(pSelectedObj);
+    auto pSelectedVirtObj = DynCastSwVirtFlyDrawObj(pSelectedObj);
     auto pSelected = 
static_cast<SwFlyAtContentFrame*>(pSelectedVirtObj->GetFlyFrame());
     // Without the accompanying fix in place, this test would have failed with:
     // - Expected: 5
diff --git a/sw/source/core/access/accfrmobj.cxx 
b/sw/source/core/access/accfrmobj.cxx
index 4eff43150329..cb02298bb0e9 100644
--- a/sw/source/core/access/accfrmobj.cxx
+++ b/sw/source/core/access/accfrmobj.cxx
@@ -98,7 +98,7 @@ SwAccessibleChild::~SwAccessibleChild() = default;
 void SwAccessibleChild::Init( const SdrObject* pDrawObj )
 {
     mpDrawObj = pDrawObj;
-    const SwVirtFlyDrawObj* pFlyDrawObj = dynamic_cast<const 
SwVirtFlyDrawObj*>(mpDrawObj);
+    const SwVirtFlyDrawObj* pFlyDrawObj = DynCastSwVirtFlyDrawObj(mpDrawObj);
     mpFrame = pFlyDrawObj ? pFlyDrawObj->GetFlyFrame() : nullptr;
     mpWindow = nullptr;
 }
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 19c3e9d40421..86feef20b84d 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -168,7 +168,7 @@ void SwDrawModellListener_Impl::Notify( SfxBroadcaster& 
/*rBC*/,
     const SdrObject* pObj = pSdrHint->GetObject();
     if (pObj &&
            ( dynamic_cast< const SwFlyDrawObj* >(pObj) ||
-             dynamic_cast< const SwVirtFlyDrawObj* >(pObj) ||
+             DynCastSwVirtFlyDrawObj(pObj) ||
              pObj->GetObjIdentifier() == SdrObjKind::NewFrame ) )
     {
         return;
diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx
index 45eb8d73d97f..c62dbbbb117e 100644
--- a/sw/source/core/doc/docdraw.cxx
+++ b/sw/source/core/doc/docdraw.cxx
@@ -460,7 +460,7 @@ bool SwDoc::DeleteSelection( SwDrawView& rDrawView )
         if( 1 == rMrkList.GetMarkCount() )
         {
             SdrObject *pObj = rMrkList.GetMark( 0 )->GetMarkedSdrObj();
-            if( auto pDrawObj = dynamic_cast<SwVirtFlyDrawObj*>( pObj) )
+            if( auto pDrawObj = DynCastSwVirtFlyDrawObj( pObj) )
             {
                 SwFlyFrameFormat* pFrameFormat = 
pDrawObj->GetFlyFrame()->GetFormat();
                 if( pFrameFormat )
@@ -474,7 +474,7 @@ bool SwDoc::DeleteSelection( SwDrawView& rDrawView )
         for( size_t i = 0; i < rMrkList.GetMarkCount(); ++i )
         {
             SdrObject *pObj = rMrkList.GetMark( i )->GetMarkedSdrObj();
-            if( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) ==  nullptr )
+            if( DynCastSwVirtFlyDrawObj( pObj) ==  nullptr )
             {
                 if (SwDrawContact* pC = 
static_cast<SwDrawContact*>(GetUserCall(pObj)))
                 {
@@ -638,7 +638,7 @@ namespace docfunc
             while( aIter.IsMore() )
             {
                 SdrObject* pObj( aIter.Next() );
-                if ( !dynamic_cast<SwVirtFlyDrawObj*>(pObj) &&
+                if ( !DynCastSwVirtFlyDrawObj(pObj) &&
                      !dynamic_cast<SwFlyDrawObj*>(pObj) )
                 {
                     bExistsDrawObjs = true;
@@ -663,7 +663,7 @@ namespace docfunc
             while( aIter.IsMore() )
             {
                 SdrObject* pObj( aIter.Next() );
-                if ( !dynamic_cast<SwVirtFlyDrawObj*>(pObj) &&
+                if ( !DynCastSwVirtFlyDrawObj(pObj) &&
                      !dynamic_cast<SwFlyDrawObj*>(pObj) )
                 {
                     SwDrawContact* pDrawContact =
diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx
index fdd7d866628b..a1efb32d4e03 100644
--- a/sw/source/core/doc/docfly.cxx
+++ b/sw/source/core/doc/docfly.cxx
@@ -755,7 +755,7 @@ bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList,
     for ( size_t i = 0; i < _rMrkList.GetMarkCount(); ++i )
     {
         SdrObject* pObj = _rMrkList.GetMark( i )->GetMarkedSdrObj();
-        if ( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) ==  nullptr )
+        if ( DynCastSwVirtFlyDrawObj( pObj) ==  nullptr )
         {
             SwDrawContact* pContact = 
static_cast<SwDrawContact*>(GetUserCall(pObj));
 
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index 1bc83202a7c4..88819ccc4307 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -140,7 +140,7 @@ rtl::Reference<SdrObject> SwDoc::CloneSdrObj( const 
SdrObject& rObj, bool bMoveW
     // For drawing objects: set layer of cloned object to invisible layer
     SdrLayerID nLayerIdForClone = rObj.GetLayer();
     if ( dynamic_cast<const SwFlyDrawObj*>( pObj.get() ) ==  nullptr &&
-         dynamic_cast<const SwVirtFlyDrawObj*>( pObj.get() ) ==  nullptr &&
+         DynCastSwVirtFlyDrawObj( pObj.get() ) ==  nullptr &&
          pObj->GetObjIdentifier() != SdrObjKind::NewFrame )
     {
         if ( getIDocumentDrawModelAccess().IsVisibleLayerId( nLayerIdForClone 
) )
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index 129e6e1b12b2..0c12c5fac771 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -120,7 +120,7 @@ void setContextWritingMode(SdrObject* pObj, SwFrame const * 
pAnchor)
 */
 SwFrameFormat *FindFrameFormat( SdrObject *pObj )
 {
-    if (SwVirtFlyDrawObj* pFlyDrawObj = dynamic_cast<SwVirtFlyDrawObj*>(pObj))
+    if (SwVirtFlyDrawObj* pFlyDrawObj = DynCastSwVirtFlyDrawObj(pObj))
        return pFlyDrawObj->GetFormat();
 
     if (SwContact* pContact = GetUserCall(pObj))
@@ -559,7 +559,7 @@ SwVirtFlyDrawObj* 
SwFlyDrawContact::CreateNewRef(SwFlyFrame* pFly,
 const SwAnchoredObject* SwFlyDrawContact::GetAnchoredObj(const SdrObject* 
pSdrObj) const
 {
     assert(pSdrObj);
-    assert(dynamic_cast<const SwVirtFlyDrawObj*>(pSdrObj) != nullptr);
+    assert(DynCastSwVirtFlyDrawObj(pSdrObj) != nullptr);
     assert(GetUserCall(pSdrObj) == this &&
         "<SwFlyDrawContact::GetAnchoredObj(..)> - provided object doesn't 
belong to this contact");
 
@@ -586,7 +586,7 @@ SdrObject* SwFlyDrawContact::GetMaster()
  */
 void SwFlyDrawContact::MoveObjToVisibleLayer( SdrObject* _pDrawObj )
 {
-    assert(dynamic_cast<const SwVirtFlyDrawObj*>(_pDrawObj) != nullptr);
+    assert(DynCastSwVirtFlyDrawObj(_pDrawObj) != nullptr);
 
     if ( GetFormat()->getIDocumentDrawModelAccess().IsVisibleLayerId( 
_pDrawObj->GetLayer() ) )
     {
@@ -626,7 +626,7 @@ void SwFlyDrawContact::MoveObjToVisibleLayer( SdrObject* 
_pDrawObj )
  */
 void SwFlyDrawContact::MoveObjToInvisibleLayer( SdrObject* _pDrawObj )
 {
-    assert(dynamic_cast<const SwVirtFlyDrawObj*>(_pDrawObj) != nullptr);
+    assert(DynCastSwVirtFlyDrawObj(_pDrawObj) != nullptr);
 
     if ( !GetFormat()->getIDocumentDrawModelAccess().IsVisibleLayerId( 
_pDrawObj->GetLayer() ) )
     {
diff --git a/sw/source/core/draw/dpage.cxx b/sw/source/core/draw/dpage.cxx
index c7ef072eb127..ac18b1623a17 100644
--- a/sw/source/core/draw/dpage.cxx
+++ b/sw/source/core/draw/dpage.cxx
@@ -158,7 +158,7 @@ bool SwDPage::RequestHelp( vcl::Window* pWindow, SdrView 
const * pView,
 
         SdrPageView* pPV;
         SdrObject* pObj = pView->PickObj(aPos, 0, pPV, 
SdrSearchOptions::PICKMACRO);
-        SwVirtFlyDrawObj* pDrawObj = dynamic_cast<SwVirtFlyDrawObj*>(pObj);
+        SwVirtFlyDrawObj* pDrawObj = DynCastSwVirtFlyDrawObj(pObj);
         OUString sText;
         tools::Rectangle aPixRect;
         bool bTooltip = false;
diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx
index 6f132c88d888..b4bff760f17c 100644
--- a/sw/source/core/draw/dview.cxx
+++ b/sw/source/core/draw/dview.cxx
@@ -84,7 +84,7 @@ bool SwSdrHdl::IsFocusHdl() const
 
 static const SwFrame *lcl_FindAnchor( const SdrObject *pObj, bool bAll )
 {
-    const SwVirtFlyDrawObj *pVirt = dynamic_cast< const SwVirtFlyDrawObj *>( 
pObj );
+    const SwVirtFlyDrawObj *pVirt = DynCastSwVirtFlyDrawObj( pObj );
     if ( pVirt )
     {
         if ( bAll || !pVirt->GetFlyFrame()->IsFlyInContentFrame() )
@@ -149,7 +149,7 @@ static SdrObject* impLocalHitCorrection(SdrObject* pRetval, 
const Point& rPnt, s
         // detect if object is selected) are no longer valid.
         // The standard primitive hit-test for SwVirtFlyDrawObj now is the 
outer bound. The old
         // implementation reduced this excluding the inner bound when the 
object was not selected.
-        SwVirtFlyDrawObj* pSwVirtFlyDrawObj = dynamic_cast< SwVirtFlyDrawObj* 
>(pRetval);
+        SwVirtFlyDrawObj* pSwVirtFlyDrawObj = DynCastSwVirtFlyDrawObj(pRetval);
 
         if(pSwVirtFlyDrawObj)
         {
@@ -646,7 +646,7 @@ void SwDrawView::ObjOrderChanged( SdrObject* pObj, size_t 
nOldPos,
                 aMovedChildObjs.push_back( pTmpObj );
                 // adjustments for accessibility API
 #if !ENABLE_WASM_STRIP_ACCESSIBILITY
-                if ( auto pFlyDrawObj = dynamic_cast<SwVirtFlyDrawObj *>( 
pTmpObj ) )
+                if ( auto pFlyDrawObj = DynCastSwVirtFlyDrawObj( pTmpObj ) )
                 {
                     const SwFlyFrame *pTmpFlyFrame = 
pFlyDrawObj->GetFlyFrame();
                     m_rImp.DisposeAccessibleFrame( pTmpFlyFrame );
@@ -713,7 +713,7 @@ const SwFrame* SwDrawView::CalcAnchor()
     //current anchor. Search only if we currently drag.
     const SwFrame* pAnch = nullptr;
     tools::Rectangle aMyRect;
-    auto pFlyDrawObj = dynamic_cast<SwVirtFlyDrawObj *>( pObj );
+    auto pFlyDrawObj = DynCastSwVirtFlyDrawObj( pObj );
     if ( pFlyDrawObj )
     {
         pAnch = pFlyDrawObj->GetFlyFrame()->GetAnchorFrame();
@@ -862,7 +862,7 @@ void SwDrawView::CheckPossibilities()
     {
         const SdrObject *pObj = rMrkList.GetMark( i )->GetMarkedSdrObj();
         const SwFrame *pFrame = nullptr;
-        if ( auto pVirtFlyDrawObj = dynamic_cast< const SwVirtFlyDrawObj *>( 
pObj ) )
+        if ( auto pVirtFlyDrawObj = DynCastSwVirtFlyDrawObj( pObj ) )
         {
             const SwFlyFrame *pFly = pVirtFlyDrawObj->GetFlyFrame();
             if ( pFly  )
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index 9f725eb5537f..44853eb1bb3f 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -1274,7 +1274,7 @@ bool SwFEShell::GetDrawObjGraphic( SotClipboardFormatId 
nFormat, Graphic& rGrf )
     if( rMrkList.GetMarkCount() )
     {
         if( rMrkList.GetMarkCount() == 1 &&
-            dynamic_cast< const SwVirtFlyDrawObj* >(rMrkList.GetMark( 0 
)->GetMarkedSdrObj()) != nullptr )
+            DynCastSwVirtFlyDrawObj(rMrkList.GetMark( 0 )->GetMarkedSdrObj()) 
!= nullptr )
         {
             // select frame
             if( CNT_GRF == GetCntType() )
@@ -1424,7 +1424,7 @@ SwPasteSdr SwFEShell::PasteStream(SvStream & rStrm, 
SwPasteSdr nAction, const Po
         SdrObject* pOldObj = pView->GetMarkedObjectList().GetMark( 0 
)->GetMarkedSdrObj();
         assert(pOldObj);
 
-        if( SwPasteSdr::SetAttr == nAction && dynamic_cast<const 
SwVirtFlyDrawObj*>( pOldObj) !=  nullptr )
+        if( SwPasteSdr::SetAttr == nAction && DynCastSwVirtFlyDrawObj( 
pOldObj) !=  nullptr )
             nAction = SwPasteSdr::Replace;
 
         switch( nAction )
@@ -1433,7 +1433,7 @@ SwPasteSdr SwFEShell::PasteStream(SvStream & rStrm, 
SwPasteSdr nAction, const Po
             {
                 const SwFrameFormat* pFormat(nullptr);
                 const SwFrame* pAnchor(nullptr);
-                if( dynamic_cast<const SwVirtFlyDrawObj*>( pOldObj) !=  
nullptr )
+                if( DynCastSwVirtFlyDrawObj( pOldObj) !=  nullptr )
                 {
                     pFormat = FindFrameFormat( pOldObj );
 
@@ -1470,7 +1470,7 @@ SwPasteSdr SwFEShell::PasteStream(SvStream & rStrm, 
SwPasteSdr nAction, const Po
                 else
                     pNewObj->SetLayer( pOldObj->GetLayer() );
 
-                if( dynamic_cast<const SwVirtFlyDrawObj*>( pOldObj) !=  
nullptr )
+                if( DynCastSwVirtFlyDrawObj( pOldObj) !=  nullptr )
                 {
                     // store attributes, then set SdrObject
                     SfxItemSetFixed<RES_SURROUND, RES_ANCHOR> aFrameSet( 
mxDoc->GetAttrPool() );
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index 74799c796731..15130cba6849 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -404,7 +404,7 @@ SwFlyFrame* SwFEShell::GetSelectedFlyFrame() const
 
         SdrObject *pO = rMrkList.GetMark( 0 )->GetMarkedSdrObj();
 
-        SwVirtFlyDrawObj *pFlyObj = dynamic_cast<SwVirtFlyDrawObj*>(pO);
+        SwVirtFlyDrawObj *pFlyObj = DynCastSwVirtFlyDrawObj(pO);
 
         return pFlyObj ? pFlyObj->GetFlyFrame() : nullptr;
     }
@@ -455,7 +455,7 @@ const SwFrameFormat* SwFEShell::IsFlyInFly()
     if( pFormat && RndStdIds::FLY_AT_FLY == pFormat->GetAnchor().GetAnchorId() 
)
     {
         const SwFrame* pFly;
-        if (SwVirtFlyDrawObj* pFlyObj = dynamic_cast<SwVirtFlyDrawObj *>(pObj))
+        if (SwVirtFlyDrawObj* pFlyObj = DynCastSwVirtFlyDrawObj(pObj))
         {
             pFly = pFlyObj->GetFlyFrame()->GetAnchorFrame();
         }
@@ -568,7 +568,7 @@ Point SwFEShell::FindAnchorPos( const Point& rAbsPos, bool 
bMoveIt )
     if ( RndStdIds::FLY_AS_CHAR == nAnchorId )
         return aRet;
 
-    bool bFlyFrame = dynamic_cast<SwVirtFlyDrawObj *>(pObj) != nullptr;
+    bool bFlyFrame = DynCastSwVirtFlyDrawObj(pObj) != nullptr;
 
     bool bTextBox = false;
     if (pFormat->Which() == RES_DRAWFRMFMT)
@@ -1690,7 +1690,7 @@ const SwFrameFormat* SwFEShell::IsURLGrfAtPos( const 
Point& rPt, OUString* pURL,
     pDView->SetHitTolerancePixel( 2 );
 
     SdrObject* pObj = pDView->PickObj(rPt, pDView->getHitTolLog(), pPV, 
SdrSearchOptions::PICKMACRO);
-    SwVirtFlyDrawObj* pFlyObj = dynamic_cast<SwVirtFlyDrawObj*>(pObj);
+    SwVirtFlyDrawObj* pFlyObj = DynCastSwVirtFlyDrawObj(pObj);
     if (pFlyObj)
     {
         SwFlyFrame *pFly = pFlyObj->GetFlyFrame();
@@ -1758,7 +1758,7 @@ const Graphic *SwFEShell::GetGrfAtPos( const Point &rPt,
     SwDrawView *pDView = const_cast<SwDrawView*>(Imp()->GetDrawView());
 
     SdrObject* pObj = pDView->PickObj(rPt, pDView->getHitTolLog(), pPV);
-    SwVirtFlyDrawObj* pFlyObj = dynamic_cast<SwVirtFlyDrawObj*>(pObj);
+    SwVirtFlyDrawObj* pFlyObj = DynCastSwVirtFlyDrawObj(pObj);
     if (pFlyObj)
     {
         SwFlyFrame *pFly = pFlyObj->GetFlyFrame();
@@ -1805,7 +1805,7 @@ const SwFrameFormat* SwFEShell::GetFormatFromObj( const 
Point& rPt, SwRect** pRe
         if (pObj)
         {
            // first check it:
-            if (SwVirtFlyDrawObj* pFlyObj = 
dynamic_cast<SwVirtFlyDrawObj*>(pObj))
+            if (SwVirtFlyDrawObj* pFlyObj = DynCastSwVirtFlyDrawObj(pObj))
                 pRet = pFlyObj->GetFormat();
             else if ( pObj->GetUserCall() ) //not for group objects
                 pRet = 
static_cast<SwDrawContact*>(pObj->GetUserCall())->GetFormat();
@@ -1870,7 +1870,7 @@ ObjCntType SwFEShell::GetObjCntType( const SdrObject& 
rObj )
             }
         }
     }
-    else if (const SwVirtFlyDrawObj *pFlyObj = dynamic_cast<const 
SwVirtFlyDrawObj*>(pInvestigatedObj))
+    else if (const SwVirtFlyDrawObj *pFlyObj = 
DynCastSwVirtFlyDrawObj(pInvestigatedObj))
     {
         const SwFlyFrame *pFly = pFlyObj->GetFlyFrame();
         const SwFrame* pLower = pFly->Lower();
@@ -1984,7 +1984,7 @@ void SwFEShell::ReplaceSdrObj( const OUString& rGrfName, 
const Graphic* pGrf )
     aFrameSet.Set( pFormat->GetAttrSet() );
 
     // set size and position?
-    if( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) == nullptr )
+    if( DynCastSwVirtFlyDrawObj( pObj) == nullptr )
     {
         // then let's do it:
         const tools::Rectangle &rBound = pObj->GetSnapRect();
diff --git a/sw/source/core/frmedt/feshview.cxx 
b/sw/source/core/frmedt/feshview.cxx
index 06a4f6aa3c4d..067efc4020d1 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -117,7 +117,7 @@ SwFlyFrame *GetFlyFromMarked( const SdrMarkList *pLst, 
SwViewShell *pSh )
     if ( pLst && pLst->GetMarkCount() == 1 )
     {
         SdrObject *pO = pLst->GetMark( 0 )->GetMarkedSdrObj();
-        if (SwVirtFlyDrawObj* pVirtO = dynamic_cast<SwVirtFlyDrawObj*>(pO))
+        if (SwVirtFlyDrawObj* pVirtO = DynCastSwVirtFlyDrawObj(pO))
             return pVirtO->GetFlyFrame();
     }
     return nullptr;
@@ -308,7 +308,7 @@ bool SwFEShell::SelectObj( const Point& rPt, sal_uInt8 
nFlag, SdrObject *pObj )
         for ( size_t i = 0; i < rMrkList.GetMarkCount(); ++i )
         {
             SdrObject *pTmpObj = rMrkList.GetMark( i )->GetMarkedSdrObj();
-            bool bForget = dynamic_cast<const SwVirtFlyDrawObj*>( pTmpObj) !=  
nullptr;
+            bool bForget = DynCastSwVirtFlyDrawObj( pTmpObj) !=  nullptr;
             if( bForget )
             {
                 pDView->UnmarkAll();
@@ -441,7 +441,7 @@ bool SwFEShell::MoveAnchor( SwMove nDir )
 
     SwFrame* pOld;
     SwFlyFrame* pFly = nullptr;
-    if (SwVirtFlyDrawObj* pVirtO = dynamic_cast<SwVirtFlyDrawObj*>(pObj))
+    if (SwVirtFlyDrawObj* pVirtO = DynCastSwVirtFlyDrawObj(pObj))
     {
         pFly = pVirtO->GetFlyFrame();
         pOld = pFly->AnchorFrame();
@@ -771,7 +771,7 @@ void SwFEShell::StartCropImage()
         for ( size_t i = 0; i < rMarkList.GetMarkCount(); ++i )
         {
             SdrObject *pTmpObj = rMarkList.GetMark( i )->GetMarkedSdrObj();
-            bool bForget = dynamic_cast<const SwVirtFlyDrawObj*>( pTmpObj) !=  
nullptr;
+            bool bForget = DynCastSwVirtFlyDrawObj( pTmpObj) !=  nullptr;
             if( bForget )
             {
                 pView->UnmarkAll();
@@ -916,7 +916,7 @@ static void lcl_NotifyNeighbours( const SdrMarkList *pLst )
         sal_Int16 aHori = text::HoriOrientation::NONE;
         SwRect aRect;
         SdrObject *pO = pLst->GetMark( j )->GetMarkedSdrObj();
-        if (SwVirtFlyDrawObj* pVirtO = dynamic_cast<SwVirtFlyDrawObj*>(pO))
+        if (SwVirtFlyDrawObj* pVirtO = DynCastSwVirtFlyDrawObj(pO))
         {
             SwFlyFrame *pFly = pVirtO->GetFlyFrame();
 
@@ -1165,7 +1165,7 @@ void SwFEShell::ChangeOpaque( SdrLayerID nLayerId )
         {
             pObj->SetLayer( nLayerId );
             InvalidateWindows( SwRect( pObj->GetCurrentBoundRect() ) );
-            if (SwVirtFlyDrawObj* pVirtO = 
dynamic_cast<SwVirtFlyDrawObj*>(pObj))
+            if (SwVirtFlyDrawObj* pVirtO = DynCastSwVirtFlyDrawObj(pObj))
             {
                 SwFormat *pFormat = pVirtO->GetFlyFrame()->GetFormat();
                 SvxOpaqueItem aOpa( pFormat->GetOpaque() );
@@ -1226,7 +1226,7 @@ bool SwFEShell::IsRotationOfSwGrfNodePossible() const
 
         if(1 == rList.GetMarkCount())
         {
-            const SwVirtFlyDrawObj* pVirtFlyDraw(dynamic_cast< const 
SwVirtFlyDrawObj* >(rList.GetMark(0)->GetMarkedSdrObj()));
+            const SwVirtFlyDrawObj* 
pVirtFlyDraw(DynCastSwVirtFlyDrawObj(rList.GetMark(0)->GetMarkedSdrObj()));
 
             if(nullptr != pVirtFlyDraw)
             {
@@ -1454,7 +1454,7 @@ bool SwFEShell::ShouldObjectBeSelected(const Point& rPt, 
bool *pSelectFrameInste
                 {
                     SdrObject *pCandidate = it->get();
 
-                    SwVirtFlyDrawObj* pDrawObj = 
dynamic_cast<SwVirtFlyDrawObj*>(pCandidate);
+                    SwVirtFlyDrawObj* pDrawObj = 
DynCastSwVirtFlyDrawObj(pCandidate);
                     if (pDrawObj && 
pDrawObj->GetCurrentBoundRect().Contains(rPt))
                     {
                         bRet = false;
@@ -1591,7 +1591,7 @@ const SdrObject* SwFEShell::GetBestObject(bool bNext, 
GotoObjFlags eType, bool b
         if ( rMrkList.GetMarkCount() )
         {
             const SdrObject* pStartObj = 
rMrkList.GetMark(0)->GetMarkedSdrObj();
-            if( auto pVirtFlyDrawObj = dynamic_cast<const SwVirtFlyDrawObj*>( 
pStartObj) )
+            if( auto pVirtFlyDrawObj = DynCastSwVirtFlyDrawObj( pStartObj) )
                 aPos = pVirtFlyDrawObj->GetFlyFrame()->getFrameArea().Pos();
             else
                 aPos = pStartObj->GetSnapRect().TopLeft();
@@ -1625,7 +1625,7 @@ const SdrObject* SwFEShell::GetBestObject(bool bNext, 
GotoObjFlags eType, bool b
         while ( aObjIter.IsMore() )
         {
             SdrObject* pObj = aObjIter.Next();
-            SwVirtFlyDrawObj *pVirtO = dynamic_cast<SwVirtFlyDrawObj*>(pObj);
+            SwVirtFlyDrawObj *pVirtO = DynCastSwVirtFlyDrawObj(pObj);
             if( ( bNoFly && pVirtO ) ||
                 ( bNoDraw && !pVirtO ) ||
                 // Ignore TextBoxes of draw shapes here, so that
@@ -1678,7 +1678,7 @@ const SdrObject* SwFEShell::GetBestObject(bool bNext, 
GotoObjFlags eType, bool b
                 while ( aTmpIter.IsMore() )
                 {
                     SdrObject* pTmpObj = aTmpIter.Next();
-                    pVirtO = dynamic_cast<SwVirtFlyDrawObj*>(pTmpObj);
+                    pVirtO = DynCastSwVirtFlyDrawObj(pTmpObj);
                     if( ( bNoFly && pVirtO ) || ( bNoDraw && !pVirtO ) )
                         continue;
                     if (pVirtO)
@@ -1751,7 +1751,7 @@ bool SwFEShell::GotoObj( bool bNext, GotoObjFlags eType )
         return false;
     }
 
-    const SwVirtFlyDrawObj *pVirtO = dynamic_cast<const 
SwVirtFlyDrawObj*>(pBest);
+    const SwVirtFlyDrawObj *pVirtO = DynCastSwVirtFlyDrawObj(pBest);
     if (pVirtO)
     {
         const SwRect& rFrame = pVirtO->GetFlyFrame()->getFrameArea();
@@ -2284,7 +2284,7 @@ bool SwFEShell::EndMark()
                 while (i < rMrkList.GetMarkCount())
                 {
                     SdrObject *pObj = rMrkList.GetMark( i )->GetMarkedSdrObj();
-                    if( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) !=  
nullptr )
+                    if( DynCastSwVirtFlyDrawObj( pObj) !=  nullptr )
                     {
                         if ( !bShowHdl )
                         {
@@ -2330,7 +2330,7 @@ RndStdIds SwFEShell::GetAnchorId() const
         for ( size_t i = 0; i < rMrkList.GetMarkCount(); ++i )
         {
             SdrObject *pObj = rMrkList.GetMark( i )->GetMarkedSdrObj();
-            if ( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) != nullptr )
+            if ( DynCastSwVirtFlyDrawObj( pObj) != nullptr )
             {
                 nRet = RndStdIds::UNKNOWN;
                 break;
@@ -2512,7 +2512,7 @@ bool SwFEShell::IsGroupAllowed() const
             if ( bIsGroupAllowed )
             {
                 const SwFrame* pAnchorFrame = nullptr;
-                if ( auto pVirtFlyDrawObj = dynamic_cast<const 
SwVirtFlyDrawObj*>( pObj) )
+                if ( auto pVirtFlyDrawObj = DynCastSwVirtFlyDrawObj( pObj) )
                 {
                     const SwFlyFrame* pFlyFrame = 
pVirtFlyDrawObj->GetFlyFrame();
                     if ( pFlyFrame )
@@ -2710,7 +2710,7 @@ FlyProtectFlags SwFEShell::IsSelObjProtected( 
FlyProtectFlags eType ) const
                 nChk |= ( pObj->IsMoveProtect() ? FlyProtectFlags::Pos : 
FlyProtectFlags::NONE ) |
                         ( pObj->IsResizeProtect()? FlyProtectFlags::Size : 
FlyProtectFlags::NONE );
 
-                if (SwVirtFlyDrawObj* pVirtO = 
dynamic_cast<SwVirtFlyDrawObj*>(pObj))
+                if (SwVirtFlyDrawObj* pVirtO = DynCastSwVirtFlyDrawObj(pObj))
                 {
                     SwFlyFrame *pFly = pVirtO->GetFlyFrame();
                     if ( (FlyProtectFlags::Content & eType) && 
pFly->GetFormat()->GetProtect().IsContentProtected() )
@@ -2744,7 +2744,7 @@ FlyProtectFlags SwFEShell::IsSelObjProtected( 
FlyProtectFlags eType ) const
                     return eType;
             }
             const SwFrame* pAnch;
-            if (SwVirtFlyDrawObj* pVirtO = 
dynamic_cast<SwVirtFlyDrawObj*>(pObj))
+            if (SwVirtFlyDrawObj* pVirtO = DynCastSwVirtFlyDrawObj(pObj))
                 pAnch = pVirtO->GetFlyFrame()->GetAnchorFrame();
             else
             {
@@ -2890,7 +2890,7 @@ SwChainRet SwFEShell::Chainable( SwRect &rRect, const 
SwFrameFormat &rSource,
         const auto nOld = pDView->GetHitTolerancePixel();
         pDView->SetHitTolerancePixel( 0 );
         SdrObject* pObj = pDView->PickObj(rPt, pDView->getHitTolLog(), pPView, 
SdrSearchOptions::PICKMARKABLE);
-        SwVirtFlyDrawObj* pDrawObj = dynamic_cast<SwVirtFlyDrawObj*>(pObj);
+        SwVirtFlyDrawObj* pDrawObj = DynCastSwVirtFlyDrawObj(pObj);
         if (pDrawObj)
         {
             SwFlyFrame *pFly = pDrawObj->GetFlyFrame();
@@ -3259,8 +3259,8 @@ Color SwFEShell::GetShapeBackground() const
             // get selected object
             const SdrObject *pSdrObj = pMrkList->GetMark( 0 
)->GetMarkedSdrObj();
             // check, if selected object is a shape (drawing object)
-            OSL_ENSURE( dynamic_cast<const SwVirtFlyDrawObj*>( pSdrObj) ==  
nullptr, "wrong usage of SwFEShell::GetShapeBackground - selected object is not 
a drawing object!");
-            if ( dynamic_cast<const SwVirtFlyDrawObj*>( pSdrObj) ==  nullptr )
+            OSL_ENSURE( DynCastSwVirtFlyDrawObj( pSdrObj) ==  nullptr, "wrong 
usage of SwFEShell::GetShapeBackground - selected object is not a drawing 
object!");
+            if ( DynCastSwVirtFlyDrawObj( pSdrObj) ==  nullptr )
             {
                 if (SwDrawContact* pDrawContact = 
static_cast<SwDrawContact*>(GetUserCall(pSdrObj)))
                 {
@@ -3311,8 +3311,8 @@ bool SwFEShell::IsShapeDefaultHoriTextDirR2L() const
     const SdrObject *pSdrObj = rMrkList.GetMark(0)->GetMarkedSdrObj();
 
     // check, if selected object is a shape (drawing object)
-    OSL_ENSURE(dynamic_cast<const SwVirtFlyDrawObj*>(pSdrObj) == nullptr, 
"wrong usage of SwFEShell::GetShapeBackground - selected object is not a 
drawing object!");
-    if (dynamic_cast<const SwVirtFlyDrawObj*>(pSdrObj) != nullptr)
+    OSL_ENSURE(DynCastSwVirtFlyDrawObj(pSdrObj) == nullptr, "wrong usage of 
SwFEShell::GetShapeBackground - selected object is not a drawing object!");
+    if (DynCastSwVirtFlyDrawObj(pSdrObj) != nullptr)
         return false;
 
     // determine page frame of the frame the shape is anchored.
diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx
index 20e6bd14b9b4..c8de82c9aef1 100644
--- a/sw/source/core/frmedt/fews.cxx
+++ b/sw/source/core/frmedt/fews.cxx
@@ -503,7 +503,7 @@ void SwFEShell::InsertLabel( const SwLabelType eType, const 
OUString &rText, con
             {
                 SdrObject* pDrawObj = aDrawObjs.back();
                 assert(pDrawObj);
-                if ( dynamic_cast<const SwVirtFlyDrawObj*>( pDrawObj) ==  
nullptr &&
+                if ( DynCastSwVirtFlyDrawObj( pDrawObj) ==  nullptr &&
                      dynamic_cast<const SwFlyDrawObj*>( pDrawObj) ==  nullptr )
                 {
                     SwFlyFrameFormat *pFormat =
@@ -1338,7 +1338,7 @@ bool SwFEShell::IsFrameVertical(const bool bEnvironment, 
bool& bRTL, bool& bVert
         }
 
         if ( !bEnvironment )
-            if ( auto pVirtFly = dynamic_cast<const SwVirtFlyDrawObj*>( pObj) )
+            if ( auto pVirtFly = DynCastSwVirtFlyDrawObj( pObj) )
                 pRef = pVirtFly->GetFlyFrame();
 
         bVert = pRef->IsVertical();
diff --git a/sw/source/core/inc/dflyobj.hxx b/sw/source/core/inc/dflyobj.hxx
index 7cc9ac472821..21578b248e96 100644
--- a/sw/source/core/inc/dflyobj.hxx
+++ b/sw/source/core/inc/dflyobj.hxx
@@ -153,7 +153,7 @@ public:
 };
 
 // this serves a similar function to the DynCast* functions in 
include/svx/svdobj.hxx
-SwVirtFlyDrawObj* DynCastSwVirtFlyDrawObj(SdrObject*);
+SW_DLLPUBLIC SwVirtFlyDrawObj* DynCastSwVirtFlyDrawObj(SdrObject*);
 inline const SwVirtFlyDrawObj* DynCastSwVirtFlyDrawObj(const SdrObject* p) { 
return DynCastSwVirtFlyDrawObj(const_cast<SdrObject*>(p)); }
 
 #endif
diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx
index ea565f766a9c..138298f1be68 100644
--- a/sw/source/core/layout/flylay.cxx
+++ b/sw/source/core/layout/flylay.cxx
@@ -1219,7 +1219,7 @@ void SwPageFrame::PlaceFly( SwFlyFrame* pFly, 
SwFlyFrameFormat* pFormat )
 bool CalcClipRect( const SdrObject *pSdrObj, SwRect &rRect, bool bMove )
 {
     bool bRet = true;
-    if ( auto pVirtFlyDrawObj = dynamic_cast<const SwVirtFlyDrawObj*>(pSdrObj) 
)
+    if ( auto pVirtFlyDrawObj = DynCastSwVirtFlyDrawObj(pSdrObj) )
     {
         const SwFlyFrame* pFly = pVirtFlyDrawObj->GetFlyFrame();
         const bool bFollowTextFlow = 
pFly->GetFormat()->GetFollowTextFlow().GetValue();
diff --git a/sw/source/core/layout/frmtool.cxx 
b/sw/source/core/layout/frmtool.cxx
index aa3bcb017633..6620cc63bc97 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -2740,7 +2740,7 @@ void SwOrderIter::Top()
     for (SwAnchoredObject* i : *pObjs)
     {
         const SdrObject* pObj = i->GetDrawObj();
-        if ( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) ==  nullptr )
+        if ( DynCastSwVirtFlyDrawObj( pObj) ==  nullptr )
             continue;
         sal_uInt32 nTmp = pObj->GetOrdNumDirect();
         if ( nTmp >= nTopOrd )
@@ -2764,7 +2764,7 @@ const SdrObject *SwOrderIter::Bottom()
             for (SwAnchoredObject* i : *pObjs)
             {
                 const SdrObject* pObj = i->GetDrawObj();
-                if ( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) ==  nullptr )
+                if ( DynCastSwVirtFlyDrawObj( pObj) ==  nullptr )
                     continue;
                 sal_uInt32 nTmp = pObj->GetOrdNumDirect();
                 if ( nTmp < nBotOrd )
@@ -2822,7 +2822,7 @@ void SwOrderIter::Prev()
     for (SwAnchoredObject* i : *pObjs)
     {
         const SdrObject* pObj = i->GetDrawObj();
-        if ( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) ==  nullptr )
+        if ( DynCastSwVirtFlyDrawObj( pObj) ==  nullptr )
             continue;
         sal_uInt32 nTmp = pObj->GetOrdNumDirect();
         if ( nTmp < nCurOrd && nTmp >= nOrd )
@@ -3443,7 +3443,7 @@ void Notify_Background( const SdrObject* pObj,
     SwLayoutFrame* pArea;
     SwFlyFrame *pFlyFrame = nullptr;
     SwFrame* pAnchor;
-    if( auto pVirtFlyDrawObj = dynamic_cast<const SwVirtFlyDrawObj*>( pObj) )
+    if( auto pVirtFlyDrawObj = DynCastSwVirtFlyDrawObj( pObj) )
     {
         pFlyFrame = 
const_cast<SwVirtFlyDrawObj*>(pVirtFlyDrawObj)->GetFlyFrame();
         pAnchor = pFlyFrame->AnchorFrame();
@@ -3647,7 +3647,7 @@ bool Is_Lower_Of(const SwFrame *pCurrFrame, const 
SdrObject* pObj)
 {
     Point aPos;
     const SwFrame* pFrame;
-    if (const SwVirtFlyDrawObj *pFlyDrawObj = dynamic_cast<const 
SwVirtFlyDrawObj*>(pObj))
+    if (const SwVirtFlyDrawObj *pFlyDrawObj = DynCastSwVirtFlyDrawObj(pObj))
     {
         const SwFlyFrame* pFly = pFlyDrawObj->GetFlyFrame();
         pFrame = pFly->GetAnchorFrame();
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index db88c12ddbef..92500b7b1ff9 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -119,7 +119,7 @@ bool SwLayAction::PaintWithoutFlys( const SwRect &rRect, 
const SwContentFrame *p
 
     for ( size_t i = 0; i < rObjs.size() && !aTmp.empty(); ++i )
     {
-        SwVirtFlyDrawObj *pVirtFly = 
dynamic_cast<SwVirtFlyDrawObj*>(rObjs[i]->DrawObj());
+        SwVirtFlyDrawObj *pVirtFly = 
DynCastSwVirtFlyDrawObj(rObjs[i]->DrawObj());
         if ( !pVirtFly )
             continue;
 
diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 8560f507c53e..cb09dca89c42 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -4112,7 +4112,7 @@ bool SwFlyFrame::IsPaint(SdrObject *pObj, const 
SwViewShell& rSh)
 
     if ( (!rSh.GetViewOptions()->IsDraw()
              && (dynamic_cast<SdrUnoObj*>(pObj) || 
dynamic_cast<SdrAttrObj*>(pObj) || dynamic_cast<SwFlyDrawObj*>(pObj)))
-        || (!rSh.GetViewOptions()->IsGraphic() && 
dynamic_cast<SwVirtFlyDrawObj*>(pObj)) )
+        || (!rSh.GetViewOptions()->IsGraphic() && 
DynCastSwVirtFlyDrawObj(pObj)) )
     {
         SwRect rBoundRect = GetBoundRectOfAnchoredObj( pObj );
         lcl_PaintReplacement(rBoundRect, rSh);
@@ -4134,7 +4134,7 @@ bool SwFlyFrame::IsPaint(SdrObject *pObj, const 
SwViewShell& rSh)
         {
             bPaint = false;
         }
-        if ( auto pFlyDraw = dynamic_cast<SwVirtFlyDrawObj *>( pObj ) )
+        if ( auto pFlyDraw = DynCastSwVirtFlyDrawObj( pObj ) )
         {
             SwFlyFrame *pFly = pFlyDraw->GetFlyFrame();
             if ( gProp.pSFlyOnlyDraw && gProp.pSFlyOnlyDraw == pFly )
diff --git a/sw/source/core/objectpositioning/anchoredobjectposition.cxx 
b/sw/source/core/objectpositioning/anchoredobjectposition.cxx
index f3a25eb390c7..04a14f42626a 100644
--- a/sw/source/core/objectpositioning/anchoredobjectposition.cxx
+++ b/sw/source/core/objectpositioning/anchoredobjectposition.cxx
@@ -60,7 +60,7 @@ SwAnchoredObjectPosition::SwAnchoredObjectPosition( 
SdrObject& _rDrawObj )
 #if OSL_DEBUG_LEVEL > 0
     // assert, if object isn't of expected type
     const bool bObjOfExceptedType =
-            dynamic_cast<const SwVirtFlyDrawObj*>( &mrDrawObj) !=  nullptr || 
// object representing fly frame
+            DynCastSwVirtFlyDrawObj( &mrDrawObj) !=  nullptr || // object 
representing fly frame
             dynamic_cast<const SwDrawVirtObj*>( &mrDrawObj) !=  nullptr    || 
// 'virtual' drawing object
             ( dynamic_cast<const SdrVirtObj*>( &mrDrawObj) ==  nullptr &&    
// 'master' drawing object
               dynamic_cast<const SwFlyDrawObj*>( &mrDrawObj) ==  nullptr );  
// - indirectly checked
@@ -80,7 +80,7 @@ void SwAnchoredObjectPosition::GetInfoAboutObj()
 {
     // determine, if object represents a fly frame
     {
-        mbIsObjFly = dynamic_cast<const SwVirtFlyDrawObj*>( &mrDrawObj) !=  
nullptr;
+        mbIsObjFly = DynCastSwVirtFlyDrawObj( &mrDrawObj) !=  nullptr;
     }
 
     // determine contact object
diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx
index 45df77b30b25..fba5e1b06120 100644
--- a/sw/source/core/text/txtfly.cxx
+++ b/sw/source/core/text/txtfly.cxx
@@ -222,7 +222,7 @@ SwRect SwContourCache::ContourRect( const SwFormat* pFormat,
         ::basegfx::B2DPolyPolygon aPolyPolygon;
         std::optional<::basegfx::B2DPolyPolygon> pPolyPolygon;
 
-        if ( auto pVirtFlyDrawObj = dynamic_cast< const SwVirtFlyDrawObj *>( 
pObj ) )
+        if ( auto pVirtFlyDrawObj = DynCastSwVirtFlyDrawObj( pObj ) )
         {
             // GetContour() causes the graphic to be loaded, which may cause
             // the graphic to change its size, call ClrObject()
diff --git a/sw/source/core/unocore/unodraw.cxx 
b/sw/source/core/unocore/unodraw.cxx
index fecc1edc2281..ef086201e33a 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -318,7 +318,7 @@ uno::Reference< drawing::XShape > 
SwFmDrawPage::CreateShape( SdrObject *pObj ) c
 {
     assert(pObj);
     uno::Reference< drawing::XShape >  xRet;
-    if(dynamic_cast<const SwVirtFlyDrawObj*>( pObj) !=  nullptr || 
pObj->GetObjInventor() == SdrInventor::Swg)
+    if(DynCastSwVirtFlyDrawObj( pObj) !=  nullptr || pObj->GetObjInventor() == 
SdrInventor::Swg)
     {
         SwFlyDrawContact* pFlyContact = 
static_cast<SwFlyDrawContact*>(pObj->GetUserCall());
         if(pFlyContact)
diff --git a/sw/source/core/view/vdraw.cxx b/sw/source/core/view/vdraw.cxx
index c217029ad4b0..9477b51f768d 100644
--- a/sw/source/core/view/vdraw.cxx
+++ b/sw/source/core/view/vdraw.cxx
@@ -208,7 +208,7 @@ void SwViewShellImp::NotifySizeChg( const Size &rNewSz )
     std::vector<SdrObject*> aCandidatesToMove;
     for (const rtl::Reference<SdrObject>& pObj : *pPage)
     {
-        if( dynamic_cast<const SwVirtFlyDrawObj*>( pObj.get()) ==  nullptr )
+        if( DynCastSwVirtFlyDrawObj( pObj.get()) ==  nullptr )
         {
             // Objects not anchored to the frame, do not need to be adjusted
             const SwContact *pCont = GetUserCall(pObj.get());
commit 5ef1e41cf49cd1c16db7fa74e318ec4a61fb187d
Author:     Noel Grandin <[email protected]>
AuthorDate: Mon Feb 9 11:40:43 2026 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Mon Feb 9 15:26:29 2026 +0100

    fix --disable-pdfimport build
    
    Change-Id: I7a7719c07375d766123ec0054ae1c40a6f5820bf
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198965
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/sw/qa/extras/uiwriter/uiwriter9.cxx 
b/sw/qa/extras/uiwriter/uiwriter9.cxx
index 45328ada1f0d..8363ee9c9e38 100644
--- a/sw/qa/extras/uiwriter/uiwriter9.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter9.cxx
@@ -7,6 +7,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include <config_poppler.h>
 #include <swmodeltestbase.hxx>
 #include <officecfg/Office/Common.hxx>
 #include <officecfg/Office/Writer.hxx>
@@ -756,6 +757,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf111969B)
     //CPPUNIT_ASSERT(!pWrtShell->GetCurField(true));
 }
 
+#if ENABLE_PDFIMPORT
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testPDFExportCrash)
 {
     createSwDoc("section-table-section.fodt");
@@ -771,6 +773,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testPDFExportCrash)
     std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
     CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
 }
+#endif
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf159049)
 {

Reply via email to