diff options
Diffstat (limited to 'sw')
194 files changed, 728 insertions, 752 deletions
diff --git a/sw/inc/frmfmt.hxx b/sw/inc/frmfmt.hxx index 7e8d34877b15..4e0da75bbf40 100644 --- a/sw/inc/frmfmt.hxx +++ b/sw/inc/frmfmt.hxx @@ -69,7 +69,7 @@ public: TYPEINFO_OVERRIDE(); ///< Already in base class Client. virtual ~SwFrameFormat(); - /// Destroys all Frms in aDepend (Frms are identified via PTR_CAST). + /// Destroys all Frms in aDepend (Frms are identified via dynamic_cast). virtual void DelFrms(); /// Creates the views. diff --git a/sw/inc/section.hxx b/sw/inc/section.hxx index f37600f056d4..1649ffe5e978 100644 --- a/sw/inc/section.hxx +++ b/sw/inc/section.hxx @@ -296,7 +296,7 @@ public: TYPEINFO_OVERRIDE(); // Already contained in base class client. virtual ~SwSectionFormat(); - // Deletes all Frms in aDepend (Frms are recognized via PTR_CAST). + // Deletes all Frms in aDepend (Frms are recognized via dynamic_cast). virtual void DelFrms() SAL_OVERRIDE; // Creates views. @@ -368,7 +368,7 @@ inline SwSectionFormat* SwSectionFormat::GetParent() const { SwSectionFormat* pRet = 0; if( GetRegisteredIn() ) - pRet = const_cast<SwSectionFormat*>(PTR_CAST( SwSectionFormat, GetRegisteredIn() )); + pRet = const_cast<SwSectionFormat*>(dynamic_cast< const SwSectionFormat* >( GetRegisteredIn() )); return pRet; } diff --git a/sw/inc/unoframe.hxx b/sw/inc/unoframe.hxx index 730a93954c97..c2445b8d21eb 100644 --- a/sw/inc/unoframe.hxx +++ b/sw/inc/unoframe.hxx @@ -141,11 +141,11 @@ public: const SwFrameFormat* GetFrameFormat() const { - return PTR_CAST ( SwFrameFormat, GetRegisteredIn() ); + return dynamic_cast<const SwFrameFormat*>( GetRegisteredIn() ); } SwFrameFormat* GetFrameFormat() { - return PTR_CAST ( SwFrameFormat, GetRegisteredIn() ); + return dynamic_cast< SwFrameFormat*>( GetRegisteredIn() ); } FlyCntType GetFlyCntType()const {return eType;} diff --git a/sw/source/core/access/acccell.cxx b/sw/source/core/access/acccell.cxx index 4bab7aca9f32..294aaaae2cd8 100644 --- a/sw/source/core/access/acccell.cxx +++ b/sw/source/core/access/acccell.cxx @@ -60,7 +60,7 @@ bool SwAccessibleCell::IsSelected() assert(GetMap()); const SwViewShell *pVSh = GetMap()->GetShell(); assert(pVSh); - if( pVSh->ISA( SwCrsrShell ) ) + if( dynamic_cast<const SwCrsrShell*>( pVSh) != nullptr ) { const SwCrsrShell *pCSh = static_cast< const SwCrsrShell * >( pVSh ); if( pCSh->IsTableMode() ) @@ -84,7 +84,7 @@ void SwAccessibleCell::GetStates( ::utl::AccessibleStateSetHelper& rStateSet ) // SELECTABLE const SwViewShell *pVSh = GetMap()->GetShell(); assert(pVSh); - if( pVSh->ISA( SwCrsrShell ) ) + if( dynamic_cast<const SwCrsrShell*>( pVSh) != nullptr ) rStateSet.AddState( AccessibleStateType::SELECTABLE ); //Add resizable state to table cell. rStateSet.AddState( AccessibleStateType::RESIZABLE ); diff --git a/sw/source/core/access/acccontext.cxx b/sw/source/core/access/acccontext.cxx index 9bc92ad5e6d3..7dae7b639ddc 100644 --- a/sw/source/core/access/acccontext.cxx +++ b/sw/source/core/access/acccontext.cxx @@ -102,7 +102,7 @@ SwCrsrShell* SwAccessibleContext::GetCrsrShell() SwCrsrShell* pCrsrShell; SwViewShell* pViewShell = GetMap() ? GetMap()->GetShell() : 0; OSL_ENSURE( pViewShell, "no view shell" ); - if( pViewShell && pViewShell->ISA( SwCrsrShell ) ) + if( pViewShell && dynamic_cast<const SwCrsrShell*>( pViewShell) != nullptr ) pCrsrShell = static_cast<SwCrsrShell*>( pViewShell ); else pCrsrShell = NULL; @@ -116,7 +116,7 @@ const SwCrsrShell* SwAccessibleContext::GetCrsrShell() const const SwCrsrShell* pCrsrShell; const SwViewShell* pViewShell = GetMap() ? GetMap()->GetShell() : 0; OSL_ENSURE( pViewShell, "no view shell" ); - if( pViewShell && pViewShell->ISA( SwCrsrShell ) ) + if( pViewShell && dynamic_cast<const SwCrsrShell*>( pViewShell) != nullptr ) pCrsrShell = static_cast<const SwCrsrShell*>( pViewShell ); else pCrsrShell = NULL; @@ -1334,14 +1334,14 @@ bool SwAccessibleContext::Select( SwPaM *pPaM, SdrObject *pObj, if( !pCrsrShell ) return false; - SwFEShell* pFEShell = pCrsrShell->ISA( SwFEShell ) + SwFEShell* pFEShell = dynamic_cast<const SwFEShell*>( pCrsrShell) != nullptr ? static_cast<SwFEShell*>( pCrsrShell ) : 0; // Get rid of activated OLE object if( pFEShell ) pFEShell->FinishOLEObj(); - SwWrtShell* pWrtShell = pCrsrShell->ISA( SwWrtShell ) + SwWrtShell* pWrtShell = dynamic_cast<const SwWrtShell*>( pCrsrShell) != nullptr ? static_cast<SwWrtShell*>( pCrsrShell ) : 0; diff --git a/sw/source/core/access/accdoc.cxx b/sw/source/core/access/accdoc.cxx index fbfdde8fc2dc..d771d27be569 100644 --- a/sw/source/core/access/accdoc.cxx +++ b/sw/source/core/access/accdoc.cxx @@ -563,7 +563,7 @@ uno::Any SAL_CALL SwAccessibleDocument::getExtendedAttributes() if( !pCrsrShell ) return anyAtrribute; - SwFEShell* pFEShell = pCrsrShell->ISA( SwFEShell ) + SwFEShell* pFEShell = dynamic_cast<const SwFEShell*>( pCrsrShell) != nullptr ? static_cast<SwFEShell*>( pCrsrShell ) : 0; OUString sAttrName; diff --git a/sw/source/core/access/accframebase.cxx b/sw/source/core/access/accframebase.cxx index bfe07b467150..95dd95541f94 100644 --- a/sw/source/core/access/accframebase.cxx +++ b/sw/source/core/access/accframebase.cxx @@ -50,7 +50,7 @@ bool SwAccessibleFrameBase::IsSelected() assert(GetMap()); const SwViewShell *pVSh = GetMap()->GetShell(); assert(pVSh); - if( pVSh->ISA( SwFEShell ) ) + if( dynamic_cast<const SwFEShell*>( pVSh) != nullptr ) { const SwFEShell *pFESh = static_cast< const SwFEShell * >( pVSh ); const SwFrm *pFlyFrm = pFESh->GetSelectedFlyFrm(); @@ -68,7 +68,7 @@ void SwAccessibleFrameBase::GetStates( const SwViewShell *pVSh = GetMap()->GetShell(); assert(pVSh); - bool bSelectable = pVSh->ISA( SwFEShell ); + bool bSelectable = dynamic_cast<const SwFEShell*>( pVSh) != nullptr; // SELECTABLE if( bSelectable ) @@ -280,7 +280,7 @@ SwPaM* SwAccessibleFrameBase::GetCrsr() SwCrsrShell* pCrsrShell = GetCrsrShell(); if( pCrsrShell != NULL && !pCrsrShell->IsTableMode() ) { - SwFEShell *pFESh = pCrsrShell->ISA( SwFEShell ) + SwFEShell *pFESh = dynamic_cast<const SwFEShell*>( pCrsrShell) != nullptr ? static_cast< SwFEShell * >( pCrsrShell ) : 0; if( !pFESh || !(pFESh->IsFrmSelected() || pFESh->IsObjSelected() > 0) ) diff --git a/sw/source/core/access/accfrmobj.cxx b/sw/source/core/access/accfrmobj.cxx index a1bd0bfeb57c..0ccc5b73bcfd 100644 --- a/sw/source/core/access/accfrmobj.cxx +++ b/sw/source/core/access/accfrmobj.cxx @@ -98,7 +98,7 @@ SwAccessibleChild::SwAccessibleChild( const SwFrm* pFrm, void SwAccessibleChild::Init( const SdrObject* pDrawObj ) { mpDrawObj = pDrawObj; - mpFrm = mpDrawObj && mpDrawObj->ISA(SwVirtFlyDrawObj) + mpFrm = mpDrawObj && dynamic_cast<const SwVirtFlyDrawObj*>( mpDrawObj) != nullptr ? static_cast < const SwVirtFlyDrawObj * >( mpDrawObj )->GetFlyFrm() : 0; mpWindow = 0; diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index 6fc60b36d18e..2cfc34c37605 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -165,9 +165,9 @@ void SwDrawModellListener_Impl::Notify( SfxBroadcaster& /*rBC*/, const SdrHint *pSdrHint = dynamic_cast<const SdrHint*>( &rHint ); if ( !pSdrHint || ( pSdrHint->GetObject() && - ( pSdrHint->GetObject()->ISA(SwFlyDrawObj) || - pSdrHint->GetObject()->ISA(SwVirtFlyDrawObj) || - IS_TYPE(SdrObject,pSdrHint->GetObject()) ) ) ) + ( dynamic_cast< const SwFlyDrawObj* >(pSdrHint->GetObject()) != nullptr || + dynamic_cast< const SwVirtFlyDrawObj* >(pSdrHint->GetObject()) != nullptr || + typeid(SdrObject) == typeid(pSdrHint->GetObject()) ) ) ) { return; } @@ -1122,7 +1122,7 @@ void SwAccessibleMap::InvalidateShapeInParaSelection() size_t nShapes = 0; const SwViewShell *pVSh = GetShell(); - const SwFEShell *pFESh = pVSh->ISA( SwFEShell ) ? + const SwFEShell *pFESh = dynamic_cast<const SwFEShell*>( pVSh) != nullptr ? static_cast< const SwFEShell * >( pVSh ) : nullptr; SwPaM* pCrsr = pFESh ? pFESh->GetCrsr( false /* ??? */ ) : nullptr; @@ -1439,7 +1439,7 @@ void SwAccessibleMap::DoInvalidateShapeSelection(bool bInvalidateFocusMode /*=fa size_t nShapes = 0; const SwViewShell *pVSh = GetShell(); - const SwFEShell *pFESh = pVSh->ISA( SwFEShell ) ? + const SwFEShell *pFESh = dynamic_cast<const SwFEShell*>( pVSh) != nullptr ? static_cast< const SwFEShell * >( pVSh ) : nullptr; const size_t nSelShapes = pFESh ? pFESh->IsObjSelected() : 0; @@ -1607,7 +1607,7 @@ void SwAccessibleMap::DoInvalidateShapeSelection(bool bInvalidateFocusMode /*=fa void SwAccessibleMap::DoInvalidateShapeFocus() { const SwViewShell *pVSh = GetShell(); - const SwFEShell *pFESh = pVSh->ISA( SwFEShell ) ? + const SwFEShell *pFESh = dynamic_cast<const SwFEShell*>( pVSh) != nullptr ? static_cast< const SwFEShell * >( pVSh ) : nullptr; const size_t nSelShapes = pFESh ? pFESh->IsObjSelected() : 0; @@ -2586,7 +2586,7 @@ void SwAccessibleMap::InvalidateCursorPosition( const SwFrm *pFrm ) SwAccessibleChild aFrmOrObj( pFrm ); bool bShapeSelected = false; const SwViewShell *pVSh = GetShell(); - if( pVSh->ISA( SwCrsrShell ) ) + if( dynamic_cast<const SwCrsrShell*>( pVSh) != nullptr ) { const SwCrsrShell *pCSh = static_cast< const SwCrsrShell * >( pVSh ); if( pCSh->IsTableMode() ) @@ -2594,7 +2594,7 @@ void SwAccessibleMap::InvalidateCursorPosition( const SwFrm *pFrm ) while( aFrmOrObj.GetSwFrm() && !aFrmOrObj.GetSwFrm()->IsCellFrm() ) aFrmOrObj = aFrmOrObj.GetSwFrm()->GetUpper(); } - else if( pVSh->ISA( SwFEShell ) ) + else if( dynamic_cast<const SwFEShell*>( pVSh) != nullptr ) { const SwFEShell *pFESh = static_cast< const SwFEShell * >( pVSh ); const SwFrm *pFlyFrm = pFESh->GetSelectedFlyFrm(); diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index 51a830a8f1c7..c1fa81571a5e 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -162,7 +162,7 @@ sal_Int32 SwAccessibleParagraph::GetCaretPos() if(!GetPortionData().IsValidCorePosition( nIndex ) || ( GetPortionData().IsZeroCorePositionData() && nIndex== 0) ) { - const SwTextFrm *pTextFrm = PTR_CAST( SwTextFrm, GetFrm() ); + const SwTextFrm *pTextFrm = dynamic_cast<const SwTextFrm*>( GetFrm() ); bool bFormat = (pTextFrm && pTextFrm->HasPara()); if(bFormat) { @@ -331,7 +331,7 @@ SwPaM* SwAccessibleParagraph::GetCursor( const bool _bForSelection ) if ( pCrsrShell != NULL && ( _bForSelection || !pCrsrShell->IsTableMode() ) ) { - SwFEShell *pFESh = pCrsrShell->ISA( SwFEShell ) + SwFEShell *pFESh = dynamic_cast<const SwFEShell*>( pCrsrShell) != nullptr ? static_cast< SwFEShell * >( pCrsrShell ) : 0; if( !pFESh || !(pFESh->IsFrmSelected() || pFESh->IsObjSelected() > 0) ) @@ -945,7 +945,7 @@ lang::Locale SAL_CALL SwAccessibleParagraph::getLocale() { SolarMutexGuard aGuard; - const SwTextFrm *pTextFrm = PTR_CAST( SwTextFrm, GetFrm() ); + const SwTextFrm *pTextFrm = dynamic_cast<const SwTextFrm*>( GetFrm() ); if( !pTextFrm ) { THROW_RUNTIME_EXCEPTION( XAccessibleContext, "internal error (no text frame)" ); diff --git a/sw/source/core/access/accselectionhelper.cxx b/sw/source/core/access/accselectionhelper.cxx index 6e6c7b6efebe..aa068d8507c7 100644 --- a/sw/source/core/access/accselectionhelper.cxx +++ b/sw/source/core/access/accselectionhelper.cxx @@ -60,11 +60,7 @@ SwFEShell* SwAccessibleSelectionHelper::GetFEShell() OSL_ENSURE( pViewShell != NULL, "No view shell? Then what are you looking at?" ); - SwFEShell* pFEShell = NULL; - if( pViewShell->ISA( SwFEShell ) ) - { - pFEShell = static_cast<SwFEShell*>( pViewShell ); - } + SwFEShell* pFEShell = dynamic_cast<SwFEShell*>( pViewShell ); return pFEShell; } diff --git a/sw/source/core/attr/swatrset.cxx b/sw/source/core/attr/swatrset.cxx index 935f8fcb4199..1e8377214a65 100644 --- a/sw/source/core/attr/swatrset.cxx +++ b/sw/source/core/attr/swatrset.cxx @@ -302,8 +302,8 @@ bool SwAttrSet::SetModifyAtAttr( const SwModify* pModify ) void SwAttrSet::CopyToModify( SwModify& rMod ) const { // copy attributes across multiple documents if needed - SwContentNode* pCNd = PTR_CAST( SwContentNode, &rMod ); - SwFormat* pFormat = PTR_CAST( SwFormat, &rMod ); + SwContentNode* pCNd = dynamic_cast<SwContentNode*>( &rMod ); + SwFormat* pFormat = dynamic_cast<SwFormat*>( &rMod ); if( pCNd || pFormat ) { diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index fee18190fdaf..ffd4a823ba38 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -2584,7 +2584,7 @@ void SwCrsrShell::ParkCrsr( const SwNodeIndex &rIdx ) // take care of all shells for(SwViewShell& rTmp : GetRingContainer()) { - if( rTmp.IsA( TYPE( SwCrsrShell ))) + if( dynamic_cast<const SwCrsrShell *>(&rTmp) != nullptr) { SwCrsrShell* pSh = static_cast<SwCrsrShell*>(&rTmp); if( pSh->m_pCrsrStk ) @@ -3026,7 +3026,7 @@ void SwCrsrShell::SetReadOnlyAvailable( bool bFlag ) { // *never* switch in GlobalDoc if( (!GetDoc()->GetDocShell() || - !GetDoc()->GetDocShell()->IsA( SwGlobalDocShell::StaticType() )) && + dynamic_cast<const SwGlobalDocShell*>(GetDoc()->GetDocShell()) == nullptr ) && bFlag != m_bSetCrsrInReadOnly ) { // If the flag is switched off then all selections need to be diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index 675b35ee12fe..5760d5cc27c4 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -377,7 +377,7 @@ bool SwCrsrShell::GotoTOXMarkBase() for( SwTOXBase* pTOX = aIter.First(); pTOX; pTOX = aIter.Next() ) { - if( pTOX->ISA( SwTOXBaseSection ) && + if( dynamic_cast<const SwTOXBaseSection*>( pTOX) != nullptr && 0 != ( pSectFormat = static_cast<SwTOXBaseSection*>(pTOX)->GetFormat() ) && 0 != ( pSectNd = pSectFormat->GetSectionNode() )) { diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index 98a6237f8309..db5d75208bae 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -747,7 +747,7 @@ static sal_uLong lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurCrsr, SwPaM *pTmpCrsr = pCurCrsr, *pSaveCrsr = pCurCrsr; // only create progress bar for ShellCrsr - bool bIsUnoCrsr = 0 != dynamic_cast<SwUnoCrsr*>(pCurCrsr); + bool bIsUnoCrsr = dynamic_cast<SwUnoCrsr*>(pCurCrsr) != nullptr; _PercentHdl* pPHdl = 0; sal_uInt16 nCrsrCnt = 0; if( FND_IN_SEL & eFndRngs ) diff --git a/sw/source/core/crsr/trvltbl.cxx b/sw/source/core/crsr/trvltbl.cxx index 6c7ae407b910..9902b9c832f0 100644 --- a/sw/source/core/crsr/trvltbl.cxx +++ b/sw/source/core/crsr/trvltbl.cxx @@ -880,7 +880,7 @@ bool SwCrsrShell::EndAllTableBoxEdit() bool bRet = false; for(SwViewShell& rSh : GetRingContainer()) { - if( rSh.IsA( TYPE( SwCrsrShell ) ) ) + if( dynamic_cast<const SwCrsrShell *>(&rSh) != nullptr ) bRet |= static_cast<SwCrsrShell*>(&rSh)->CheckTableBoxContent( static_cast<SwCrsrShell*>(&rSh)->m_pCurCrsr->GetPoint() ); diff --git a/sw/source/core/doc/CntntIdxStore.cxx b/sw/source/core/doc/CntntIdxStore.cxx index 7b4e8a6d58f9..2251d4dc83a3 100644 --- a/sw/source/core/doc/CntntIdxStore.cxx +++ b/sw/source/core/doc/CntntIdxStore.cxx @@ -413,7 +413,7 @@ void ContentIdxStoreImpl::SaveShellCrsrs(SwDoc* pDoc, sal_uLong nNode, sal_Int32 return; for(SwViewShell& rCurShell : pShell->GetRingContainer()) { - if( rCurShell.IsA( TYPE( SwCrsrShell )) ) + if( dynamic_cast<const SwCrsrShell *>(&rCurShell) != nullptr ) { SwPaM *_pStkCrsr = static_cast<SwCrsrShell*>(&rCurShell)->GetStkCrsr(); if( _pStkCrsr ) diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 36e5b51d6749..21f852d44d8d 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -2741,7 +2741,7 @@ SwDrawFrameFormat* DocumentContentOperationsManager::InsertDrawObj( aAnch.SetAnchor( rRg.GetPoint() ); if ( eAnchorId == FLY_AT_PAGE ) { - eAnchorId = rDrawObj.ISA( SdrUnoObj ) ? FLY_AS_CHAR : FLY_AT_PARA; + eAnchorId = dynamic_cast<const SdrUnoObj*>( &rDrawObj) != nullptr ? FLY_AS_CHAR : FLY_AT_PARA; aAnch.SetType( eAnchorId ); } } diff --git a/sw/source/core/doc/DocumentDeviceManager.cxx b/sw/source/core/doc/DocumentDeviceManager.cxx index a0e60adaf8b6..927b5a959804 100644 --- a/sw/source/core/doc/DocumentDeviceManager.cxx +++ b/sw/source/core/doc/DocumentDeviceManager.cxx @@ -237,7 +237,7 @@ const SwPrintData & DocumentDeviceManager::getPrintData() const // is also derived from SwPrintData const SwDocShell *pDocSh = m_rDoc.GetDocShell(); OSL_ENSURE( pDocSh, "pDocSh is 0, can't determine if this is a WebDoc or not" ); - bool bWeb = 0 != dynamic_cast< const SwWebDocShell * >(pDocSh); + bool bWeb = dynamic_cast< const SwWebDocShell * >(pDocSh) != nullptr; SwPrintOptions aPrintOptions( bWeb ); *pThis->mpPrtData = aPrintOptions; } diff --git a/sw/source/core/doc/DocumentLayoutManager.cxx b/sw/source/core/doc/DocumentLayoutManager.cxx index 04638b8751dc..fe7313af3b9a 100644 --- a/sw/source/core/doc/DocumentLayoutManager.cxx +++ b/sw/source/core/doc/DocumentLayoutManager.cxx @@ -458,8 +458,8 @@ SwFrameFormat *DocumentLayoutManager::CopyLayoutFormat( // #i49730# - notify draw frame format that position attributes are // already set, if the position attributes are already set at the // source draw frame format. - if ( pDest->ISA(SwDrawFrameFormat) && - rSource.ISA(SwDrawFrameFormat) && + if ( dynamic_cast<const SwDrawFrameFormat*>( pDest) != nullptr && + dynamic_cast<const SwDrawFrameFormat*>( &rSource) != nullptr && static_cast<const SwDrawFrameFormat&>(rSource).IsPosAttrSet() ) { static_cast<SwDrawFrameFormat*>(pDest)->PosAttrSet(); diff --git a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx index 7ded4a6e8cbd..302fb3ecaad0 100644 --- a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx +++ b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx @@ -70,7 +70,7 @@ namespace if( pLnk && ( OBJECT_CLIENT_GRF == pLnk->GetObjType() || OBJECT_CLIENT_FILE == pLnk->GetObjType() ) && - pLnk->ISA( SwBaseLink ) ) + dynamic_cast<const SwBaseLink*>( pLnk) != nullptr ) { ::sfx2::SvBaseLinkRef xLink = pLnk; diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index df4a5f6dad6b..b78dfe75d829 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1629,7 +1629,7 @@ void SwDoc::ChgTOX(SwTOXBase & rTOX, const SwTOXBase & rNew) rTOX = rNew; - if (rTOX.ISA(SwTOXBaseSection)) + if (dynamic_cast<const SwTOXBaseSection*>( &rTOX) != nullptr) { static_cast<SwTOXBaseSection &>(rTOX).Update(); static_cast<SwTOXBaseSection &>(rTOX).UpdatePageNum(); diff --git a/sw/source/core/doc/doccorr.cxx b/sw/source/core/doc/doccorr.cxx index 1bd077ba2453..26b1371304e9 100644 --- a/sw/source/core/doc/doccorr.cxx +++ b/sw/source/core/doc/doccorr.cxx @@ -101,7 +101,7 @@ void PaMCorrAbs( const SwPaM& rRange, { for(const SwViewShell& rShell : pShell->GetRingContainer()) { - if(!rShell.IsA( TYPE( SwCrsrShell ))) + if(dynamic_cast<const SwCrsrShell *>(&rShell) == nullptr) continue; const SwCrsrShell* pCrsrShell = static_cast<const SwCrsrShell*>(&rShell); SwPaM *_pStkCrsr = pCrsrShell->GetStkCrsr(); @@ -254,7 +254,7 @@ void PaMCorrRel( const SwNodeIndex &rOldNode, { for(const SwViewShell& rShell : pShell->GetRingContainer()) { - if(!rShell.IsA( TYPE( SwCrsrShell ))) + if(dynamic_cast<const SwCrsrShell *>(&rShell) == nullptr) continue; SwCrsrShell* pCrsrShell = const_cast<SwCrsrShell*>(static_cast<const SwCrsrShell*>(&rShell)); SwPaM *_pStkCrsr = pCrsrShell->GetStkCrsr(); @@ -330,7 +330,7 @@ SwEditShell const * SwDoc::GetEditShell() const for(const SwViewShell& rCurrentSh : pCurrentView->GetRingContainer()) { // look for an EditShell (if it exists) - if( rCurrentSh.IsA( TYPE( SwEditShell ) ) ) + if( dynamic_cast<const SwEditShell *>(&rCurrentSh) != nullptr ) { return static_cast<const SwEditShell*>(&rCurrentSh); } diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx index 747ff3de128c..97b0dc61967d 100644 --- a/sw/source/core/doc/docdesc.cxx +++ b/sw/source/core/doc/docdesc.cxx @@ -695,7 +695,7 @@ void SwDoc::PrtOLENotify( bool bAll ) { for(SwViewShell& rShell : pSh->GetRingContainer()) { - if(rShell.ISA(SwFEShell)) + if(dynamic_cast<const SwFEShell*>( &rShell) != nullptr) { pShell = static_cast<SwFEShell*>(&rShell); break; diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx index a396a542ad92..ae8aa932878b 100644 --- a/sw/source/core/doc/docdraw.cxx +++ b/sw/source/core/doc/docdraw.cxx @@ -5,7 +5,6 @@ * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more @@ -182,7 +181,7 @@ static void lcl_AdjustPositioningAttr( SwDrawFrameFormat* _pFrameFormat, // to adjust the positioning attributes - see <SwDrawContact::_Changed(..)>. { const SwAnchoredObject* pAnchoredObj = pContact->GetAnchoredObj( &_rSdrObj ); - if ( pAnchoredObj->ISA(SwAnchoredDrawObject) ) + if ( dynamic_cast<const SwAnchoredDrawObject*>( pAnchoredObj) != nullptr ) { const SwAnchoredDrawObject* pAnchoredDrawObj = static_cast<const SwAnchoredDrawObject*>(pAnchoredObj); @@ -322,7 +321,7 @@ void SwDoc::UnGroupSelection( SdrView& rDrawView ) for ( size_t i = 0; i < nMarkCount; ++i ) { SdrObject *pObj = rMrkList.GetMark( i )->GetMarkedSdrObj(); - if ( pObj->IsA( TYPE(SdrObjGroup) ) ) + if ( dynamic_cast<const SdrObjGroup*>(pObj) != nullptr ) { SwDrawContact *pContact = static_cast<SwDrawContact*>(GetUserCall(pObj)); SwFormatAnchor aAnch( pContact->GetFormat()->GetAnchor() ); @@ -397,7 +396,7 @@ bool SwDoc::DeleteSelection( SwDrawView& rDrawView ) if( 1 == rMrkList.GetMarkCount() ) { SdrObject *pObj = rMrkList.GetMark( 0 )->GetMarkedSdrObj(); - if( pObj->ISA(SwVirtFlyDrawObj) ) + if( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) != nullptr ) { SwFlyFrameFormat* pFrameFormat = static_cast<SwVirtFlyDrawObj*>(pObj)->GetFlyFrm()->GetFormat(); @@ -412,7 +411,7 @@ bool SwDoc::DeleteSelection( SwDrawView& rDrawView ) for( size_t i = 0; i < rMrkList.GetMarkCount(); ++i ) { SdrObject *pObj = rMrkList.GetMark( i )->GetMarkedSdrObj(); - if( !pObj->ISA(SwVirtFlyDrawObj) ) + if( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) == nullptr ) { SwDrawContact *pC = static_cast<SwDrawContact*>(GetUserCall(pObj)); SwDrawFrameFormat *pFrameFormat = static_cast<SwDrawFrameFormat*>(pC->GetFormat()); @@ -449,7 +448,7 @@ bool SwDoc::DeleteSelection( SwDrawView& rDrawView ) // <SwDrawVirtObj>-objects have to be replaced by its // reference objects. Thus, assert, if a // <SwDrawVirt>-object is found in the mark list. - if ( pObj->ISA(SwDrawVirtObj) ) + if ( dynamic_cast<const SwDrawVirtObj*>( pObj) != nullptr ) { OSL_FAIL( "<SwDrawVirtObj> is still marked for delete. application will crash!" ); } @@ -530,14 +529,14 @@ IMPL_LINK_TYPED(SwDoc, CalcFieldValueHdl, EditFieldInfo*, pInfo, void) const SvxFieldItem& rField = pInfo->GetField(); const SvxFieldData* pField = rField.GetField(); - if (pField && pField->ISA(SvxDateField)) + if (pField && dynamic_cast<const SvxDateField*>( pField) != nullptr) { // Date field pInfo->SetRepresentation( static_cast<const SvxDateField*>( pField)->GetFormatted( *GetNumberFormatter(), LANGUAGE_SYSTEM) ); } - else if (pField && pField->ISA(SvxURLField)) + else if (pField && dynamic_cast<const SvxURLField*>( pField) != nullptr) { // URL field switch ( static_cast<const SvxURLField*>( pField)->GetFormat() ) @@ -573,12 +572,12 @@ IMPL_LINK_TYPED(SwDoc, CalcFieldValueHdl, EditFieldInfo*, pInfo, void) pInfo->SetTextColor(aColor); } - else if (pField && pField->ISA(SdrMeasureField)) + else if (pField && dynamic_cast<const SdrMeasureField*>( pField) != nullptr) { // Measure field pInfo->ClearFieldColor(); } - else if ( pField && pField->ISA(SvxExtTimeField)) + else if ( pField && dynamic_cast<const SvxExtTimeField*>( pField) != nullptr) { // Time field pInfo->SetRepresentation( diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx index 380dbfcd666e..efd4175f1fed 100644 --- a/sw/source/core/doc/docfly.cxx +++ b/sw/source/core/doc/docfly.cxx @@ -698,7 +698,7 @@ bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, for ( size_t i = 0; i < _rMrkList.GetMarkCount(); ++i ) { SdrObject* pObj = _rMrkList.GetMark( i )->GetMarkedSdrObj(); - if ( !pObj->ISA(SwVirtFlyDrawObj) ) + if ( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) == nullptr ) { SwDrawContact* pContact = static_cast<SwDrawContact*>(GetUserCall(pObj)); @@ -710,7 +710,7 @@ bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, { #if OSL_DEBUG_LEVEL > 0 bool bNoUserCallExcepted = - pObj->ISA(SwDrawVirtObj) && + dynamic_cast<const SwDrawVirtObj*>( pObj) != nullptr && !static_cast<SwDrawVirtObj*>(pObj)->IsConnected(); OSL_ENSURE( bNoUserCallExcepted, "SwDoc::ChgAnchor(..) - no contact at selected drawing object" ); #endif @@ -879,7 +879,7 @@ bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, { // #i33313# - consider not connected 'virtual' drawing // objects - if ( pObj->ISA(SwDrawVirtObj) && + if ( dynamic_cast<const SwDrawVirtObj*>( pObj) != nullptr && !static_cast<SwDrawVirtObj*>(pObj)->IsConnected() ) { SwRect aNewObjRect( aObjRect ); diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index eaab5d83da47..545f8500d1f3 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -700,7 +700,7 @@ void SwDoc::DelCharFormat( SwCharFormat *pFormat, bool bBroadcast ) void SwDoc::DelFrameFormat( SwFrameFormat *pFormat, bool bBroadcast ) { - if( pFormat->ISA( SwTableBoxFormat ) || pFormat->ISA( SwTableLineFormat )) + if( dynamic_cast<const SwTableBoxFormat*>( pFormat) != nullptr || dynamic_cast<const SwTableLineFormat*>( pFormat) != nullptr ) { OSL_ENSURE( false, "Format is not in the DocArray any more, " "so it can be deleted with delete" ); diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index 9511b506b087..afbbff02b6f0 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -147,9 +147,9 @@ SdrObject* SwDoc::CloneSdrObj( const SdrObject& rObj, bool bMoveWithinDoc, // For drawing objects: set layer of cloned object to invisible layer SdrLayerID nLayerIdForClone = rObj.GetLayer(); - if ( !pObj->ISA(SwFlyDrawObj) && - !pObj->ISA(SwVirtFlyDrawObj) && - !IS_TYPE(SdrObject,pObj) ) + if ( dynamic_cast<const SwFlyDrawObj*>( pObj) == nullptr && + dynamic_cast<const SwVirtFlyDrawObj*>( pObj) == nullptr && + typeid(SdrObject) != typeid(pObj) ) { if ( getIDocumentDrawModelAccess().IsVisibleLayerId( nLayerIdForClone ) ) { @@ -551,7 +551,7 @@ SwPosFlyFrms SwDoc::GetAllFlyFormats( const SwPaM* pCmpRange, bool bDrawAlso, { SwAnchoredObject* pAnchoredObj = rObjs[i]; SwFrameFormat *pFly; - if ( pAnchoredObj->ISA(SwFlyFrm) ) + if ( dynamic_cast<const SwFlyFrm*>( pAnchoredObj) != nullptr ) pFly = &(pAnchoredObj->GetFrameFormat()); else if ( bDrawAlso ) pFly = &(pAnchoredObj->GetFrameFormat()); diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index 3effff722447..ae6318d2d531 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -419,7 +419,7 @@ SwTOXBase* SwDoc::GetCurTOX( const SwPosition& rPos ) SectionType eT = pSectNd->GetSection().GetType(); if( TOX_CONTENT_SECTION == eT ) { - OSL_ENSURE( pSectNd->GetSection().ISA( SwTOXBaseSection ), + OSL_ENSURE( dynamic_cast< const SwTOXBaseSection *>( &pSectNd->GetSection()) != nullptr, "no TOXBaseSection!" ); SwTOXBaseSection& rTOXSect = static_cast<SwTOXBaseSection&>( pSectNd->GetSection()); @@ -432,7 +432,7 @@ SwTOXBase* SwDoc::GetCurTOX( const SwPosition& rPos ) const SwAttrSet& SwDoc::GetTOXBaseAttrSet(const SwTOXBase& rTOXBase) { - OSL_ENSURE( rTOXBase.ISA( SwTOXBaseSection ), "no TOXBaseSection!" ); + OSL_ENSURE( dynamic_cast<const SwTOXBaseSection*>( &rTOXBase) != nullptr, "no TOXBaseSection!" ); const SwTOXBaseSection& rTOXSect = static_cast<const SwTOXBaseSection&>(rTOXBase); SwSectionFormat const * pFormat = rTOXSect.GetFormat(); OSL_ENSURE( pFormat, "invalid TOXBaseSection!" ); @@ -491,7 +491,7 @@ bool SwDoc::DeleteTOX( const SwTOXBase& rTOXBase, bool bDelNodes ) { // We only delete the TOX, not the Nodes bool bRet = false; - OSL_ENSURE( rTOXBase.ISA( SwTOXBaseSection ), "no TOXBaseSection!" ); + OSL_ENSURE( dynamic_cast<const SwTOXBaseSection*>( &rTOXBase) != nullptr, "no TOXBaseSection!" ); const SwTOXBaseSection& rTOXSect = static_cast<const SwTOXBaseSection&>(rTOXBase); SwSectionFormat const * pFormat = rTOXSect.GetFormat(); @@ -671,7 +671,7 @@ OUString SwDoc::GetUniqueTOXBaseName( const SwTOXType& rType, bool SwDoc::SetTOXBaseName(const SwTOXBase& rTOXBase, const OUString& rName) { - OSL_ENSURE( rTOXBase.ISA( SwTOXBaseSection ), + OSL_ENSURE( dynamic_cast<const SwTOXBaseSection*>( &rTOXBase) != nullptr, "no TOXBaseSection!" ); SwTOXBaseSection* pTOX = const_cast<SwTOXBaseSection*>(static_cast<const SwTOXBaseSection*>(&rTOXBase)); diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index 1b5381bd61f3..6e9609b13d95 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -1041,7 +1041,7 @@ void SwNoTextFrm::PaintPicture( vcl::RenderContext* pOut, const SwRect &rGrfArea ::svt::EmbeddedObjectRef::DrawPaintReplacement( Rectangle( aPosition, aSize ), pOLENd->GetOLEObj().GetCurrentPersistName(), pOut ); sal_Int64 nMiscStatus = pOLENd->GetOLEObj().GetOleRef()->getStatus( pOLENd->GetAspect() ); - if ( !bPrn && pShell->ISA( SwCrsrShell ) && ( + if ( !bPrn && dynamic_cast< const SwCrsrShell *>( pShell ) != nullptr && ( (nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) || pOLENd->GetOLEObj().GetObject().IsGLChart())) { diff --git a/sw/source/core/doc/swserv.cxx b/sw/source/core/doc/swserv.cxx index 5960c35af5c0..490c1dce6d58 100644 --- a/sw/source/core/doc/swserv.cxx +++ b/sw/source/core/doc/swserv.cxx @@ -232,7 +232,7 @@ bool SwServerObject::IsLinkInServer( const SwBaseLink* pChkLnk ) const { const ::sfx2::SvBaseLink* pLnk = &(*rLnks[ --n ]); if( pLnk && OBJECT_CLIENT_GRF != pLnk->GetObjType() && - pLnk->ISA( SwBaseLink ) && + dynamic_cast<const SwBaseLink*>( pLnk) != nullptr && !static_cast<const SwBaseLink*>(pLnk)->IsNoDataFlag() && static_cast<const SwBaseLink*>(pLnk)->IsInRange( nSttNd, nEndNd, nStt, nEnd )) { @@ -306,7 +306,7 @@ SwDataChanged::~SwDataChanged() { ::sfx2::SvLinkSourceRef refObj( *it ); // Any one else interested in the Object? - if( refObj->HasDataLinks() && refObj->ISA( SwServerObject )) + if( refObj->HasDataLinks() && dynamic_cast<const SwServerObject*>( refObj.get() ) != nullptr) { SwServerObject& rObj = *static_cast<SwServerObject*>(&refObj); if( pPos ) diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index d12e01297e87..6fa089dcce38 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -2099,7 +2099,7 @@ bool SwTable::MakeCopy( SwDoc* pInsDoc, const SwPosition& rPos, pNewTable->SetTableStyleName(pTableNd->GetTable().GetTableStyleName()); - if( IS_TYPE( SwDDETable, this )) + if( typeid( SwDDETable) == typeid(*this)) { // A DDE-Table is being copied // Does the new Document actually have it's FieldType? diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx index 57c64f107b26..2ccd934bb6ea 100644 --- a/sw/source/core/doc/textboxhelper.cxx +++ b/sw/source/core/doc/textboxhelper.cxx @@ -195,13 +195,13 @@ std::map<SwFrameFormat*, SwFrameFormat*> SwTextBoxHelper::findShapes(const SwDoc /// If the passed SdrObject is in fact a TextFrame, that is used as a TextBox. bool lcl_isTextBox(SdrObject* pSdrObject, std::set<const SwFrameFormat*>& rTextBoxes) { - SwVirtFlyDrawObj* pObject = PTR_CAST(SwVirtFlyDrawObj, pSdrObject); + SwVirtFlyDrawObj* pObject = dynamic_cast<SwVirtFlyDrawObj*>( pSdrObject ); return pObject && rTextBoxes.find(pObject->GetFormat()) != rTextBoxes.end(); } bool SwTextBoxHelper::isTextBox(const SdrObject* pObject) { - const SwVirtFlyDrawObj* pVirtFlyDrawObj = PTR_CAST(SwVirtFlyDrawObj, pObject); + const SwVirtFlyDrawObj* pVirtFlyDrawObj = dynamic_cast<const SwVirtFlyDrawObj*>( pObject ); if (!pVirtFlyDrawObj) return false; std::set<const SwFrameFormat*> aTextBoxes = findTextBoxes(pVirtFlyDrawObj->GetFormat()->GetDoc()); diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx index 571407cacbe6..e01d2f6e7e22 100644 --- a/sw/source/core/docnode/ndcopy.cxx +++ b/sw/source/core/docnode/ndcopy.cxx @@ -271,7 +271,7 @@ SwTableNode* SwTableNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const rTable.SetTableModel( GetTable().IsNewModel() ); SwDDEFieldType* pDDEType = 0; - if( IS_TYPE( SwDDETable, &GetTable() )) + if( typeid(SwDDETable) == typeid( &GetTable() )) { // We're copying a DDE table // Is the field type available in the new document? diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx index 85b6febcb232..9a02594bd361 100644 --- a/sw/source/core/docnode/ndsect.cxx +++ b/sw/source/core/docnode/ndsect.cxx @@ -1202,7 +1202,7 @@ SwSectionNode* SwSectionNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) c std::unique_ptr<SwTOXBase> pTOXBase; if (TOX_CONTENT_SECTION == GetSection().GetType()) { - OSL_ENSURE( GetSection().ISA( SwTOXBaseSection ), "no TOXBaseSection!" ); + OSL_ENSURE( dynamic_cast< const SwTOXBaseSection* >( &GetSection() ) != nullptr , "no TOXBaseSection!" ); SwTOXBaseSection const& rTBS( dynamic_cast<SwTOXBaseSection const&>(GetSection())); pTOXBase.reset( new SwTOXBase(rTBS, pDoc) ); diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 51e3fe1eb37b..5500e124de1d 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -1713,7 +1713,7 @@ bool SwDoc::InsertCol( const SwSelBoxes& rBoxes, sal_uInt16 nCnt, bool bBehind ) return false; SwTable& rTable = pTableNd->GetTable(); - if( rTable.ISA( SwDDETable )) + if( dynamic_cast<const SwDDETable*>( &rTable) != nullptr) return false; SwTableSortBoxes aTmpLst; @@ -1775,7 +1775,7 @@ bool SwDoc::InsertRow( const SwSelBoxes& rBoxes, sal_uInt16 nCnt, bool bBehind ) return false; SwTable& rTable = pTableNd->GetTable(); - if( rTable.ISA( SwDDETable )) + if( dynamic_cast<const SwDDETable*>( &rTable) != nullptr) return false; SwTableSortBoxes aTmpLst; @@ -1836,7 +1836,7 @@ bool SwDoc::DeleteRow( const SwCursor& rCursor ) { SwTableNode* pTableNd = rCursor.GetNode().FindTableNode(); - if( pTableNd->GetTable().ISA( SwDDETable )) + if(dynamic_cast<const SwDDETable*>( & pTableNd->GetTable()) != nullptr) return false; // Find all Boxes/Lines @@ -1959,7 +1959,7 @@ bool SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn ) if( !pTableNd ) return false; - if( pTableNd->GetTable().ISA( SwDDETable )) + if( dynamic_cast<const SwDDETable*>( &pTableNd->GetTable() ) != nullptr) return false; ::ClearFEShellTabCols(); @@ -2171,7 +2171,7 @@ bool SwDoc::SplitTable( const SwSelBoxes& rBoxes, bool bVert, sal_uInt16 nCnt, return false; SwTable& rTable = pTableNd->GetTable(); - if( rTable.ISA( SwDDETable )) + if( dynamic_cast<const SwDDETable*>( &rTable) != nullptr) return false; std::vector<sal_uLong> aNdsCnts; @@ -2240,7 +2240,7 @@ sal_uInt16 SwDoc::MergeTable( SwPaM& rPam ) if( !pTableNd ) return TBLMERGE_NOSELECTION; SwTable& rTable = pTableNd->GetTable(); - if( rTable.ISA(SwDDETable) ) + if( dynamic_cast<const SwDDETable*>( &rTable) != nullptr ) return TBLMERGE_NOSELECTION; sal_uInt16 nRet = TBLMERGE_NOSELECTION; if( !rTable.IsNewModel() ) @@ -3137,7 +3137,7 @@ bool SwDoc::SplitTable( const SwPosition& rPos, sal_uInt16 eHdlnMode, if( !pTNd || pNd->IsTableNode() ) return false; - if( pTNd->GetTable().ISA( SwDDETable )) + if( dynamic_cast<const SwDDETable*>( &pTNd->GetTable() ) != nullptr) return false; SwTable& rTable = pTNd->GetTable(); @@ -3505,8 +3505,8 @@ bool SwDoc::MergeTable( const SwPosition& rPos, bool bWithPrev, sal_uInt16 nMode if( !pDelTableNd ) return false; - if( pTableNd->GetTable().ISA( SwDDETable ) || - pDelTableNd->GetTable().ISA( SwDDETable )) + if( dynamic_cast<const SwDDETable*>( &pTableNd->GetTable() ) != nullptr || + dynamic_cast<const SwDDETable*>( &pDelTableNd->GetTable() ) != nullptr) return false; // Delete HTML Layout @@ -3982,7 +3982,7 @@ bool SwDoc::SetColRowWidthHeight( SwTableBox& rAktBox, sal_uInt16 eType, SwTableNode* pTableNd = const_cast<SwTableNode*>(rAktBox.GetSttNd()->FindTableNode()); SwUndo* pUndo = 0; - if( nsTableChgWidthHeightType::WH_FLAG_INSDEL & eType && pTableNd->GetTable().ISA( SwDDETable )) + if( nsTableChgWidthHeightType::WH_FLAG_INSDEL & eType && dynamic_cast<const SwDDETable*>( &pTableNd->GetTable()) != nullptr) return false; SwTableFormulaUpdate aMsgHint( &pTableNd->GetTable() ); diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index 64c7e59d9bae..e4f7d5a21de7 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -670,9 +670,9 @@ const SwPageDesc* SwNode::FindPageDesc( bool bCalcLay, static_cast<const SwFormatPageDesc*>(pItem)->GetDefinedIn() ) { const SwModify* pMod = static_cast<const SwFormatPageDesc*>(pItem)->GetDefinedIn(); - if( pMod->ISA( SwContentNode ) ) + if( dynamic_cast<const SwContentNode*>( pMod) != nullptr ) aInfo.CheckNode( *static_cast<const SwContentNode*>(pMod) ); - else if( pMod->ISA( SwFormat )) + else if( dynamic_cast<const SwFormat*>( pMod) != nullptr) static_cast<const SwFormat*>(pMod)->GetInfo( aInfo ); } } diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx index 6c7620e19aa2..20619399a78a 100644 --- a/sw/source/core/docnode/nodes.cxx +++ b/sw/source/core/docnode/nodes.cxx @@ -569,7 +569,7 @@ bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, } } - if( pTableNd->GetTable().IsA( TYPE( SwDDETable ) )) + if( dynamic_cast<const SwDDETable*>(&pTableNd->GetTable()) != nullptr ) { SwDDEFieldType* pTyp = static_cast<SwDDETable&>(pTableNd-> GetTable()).GetDDEFieldType(); diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index 360eded8a934..09ae5bc27107 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -605,7 +605,7 @@ void SwSection::MakeChildLinksVisible( const SwSectionNode& rSectNd ) { ::sfx2::SvBaseLink* pBLnk = &(*rLnks[ --n ]); if( pBLnk && !pBLnk->IsVisible() && - pBLnk->ISA( SwBaseLink ) && + dynamic_cast< const SwBaseLink *>( pBLnk ) != nullptr && 0 != ( pNd = static_cast<SwBaseLink*>(pBLnk)->GetAnchor() ) ) { pNd = pNd->StartOfSectionNode(); // If it's a SectionNode @@ -682,7 +682,7 @@ SwSection * SwSectionFormat::GetSection() const return SwIterator<SwSection,SwSectionFormat>( *this ).First(); } -// Do not destroy all Frms in aDepend (Frms are recognized with a PTR_CAST). +// Do not destroy all Frms in aDepend (Frms are recognized with a dynamic_cast). void SwSectionFormat::DelFrms() { SwSectionNode* pSectNd; @@ -825,7 +825,7 @@ void SwSectionFormat::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) case RES_FMT_CHG: if( !GetDoc()->IsInDtor() && static_cast<const SwFormatChg*>(pNew)->pChangedFormat == static_cast<void*>(GetRegisteredIn()) && - static_cast<const SwFormatChg*>(pNew)->pChangedFormat->IsA( TYPE( SwSectionFormat )) ) + dynamic_cast<const SwSectionFormat*>(static_cast<const SwFormatChg*>(pNew)->pChangedFormat) != nullptr ) { // My Parent will be changed, thus I need to update SwFrameFormat::Modify( pOld, pNew ); // Rewire first! @@ -953,7 +953,7 @@ void SwSectionFormat::UpdateParent() SwIterator<SwClient,SwSectionFormat> aIter(*this); for(SwClient* pLast = aIter.First(); pLast; pLast = aIter.Next()) { - if( pLast->IsA( TYPE(SwSectionFormat) ) ) + if( dynamic_cast<const SwSectionFormat*>(pLast) != nullptr ) { if( !pSection ) { @@ -998,7 +998,7 @@ void SwSectionFormat::UpdateParent() } } else if( !pSection && - pLast->IsA( TYPE(SwSection) ) ) + dynamic_cast<const SwSection*>(pLast) != nullptr ) { pSection = static_cast<SwSection*>(pLast); if( GetRegisteredIn() ) @@ -1155,7 +1155,7 @@ static void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd ) ::sfx2::SvBaseLink* pLnk = &(*rLnks[ --n ]); if( pLnk && pLnk != &rUpdLnk && OBJECT_CLIENT_FILE == pLnk->GetObjType() && - pLnk->ISA( SwBaseLink ) && + dynamic_cast< const SwBaseLink *>( pLnk ) != nullptr && ( pBLink = static_cast<SwBaseLink*>(pLnk) )->IsInRange( rSectNd.GetIndex(), rSectNd.EndOfSectionIndex() ) ) { diff --git a/sw/source/core/docnode/swbaslnk.cxx b/sw/source/core/docnode/swbaslnk.cxx index a00c8f966c1c..ff47a8261f1e 100644 --- a/sw/source/core/docnode/swbaslnk.cxx +++ b/sw/source/core/docnode/swbaslnk.cxx @@ -68,7 +68,7 @@ static void lcl_CallModify( SwGrfNode& rGrfNd, SfxPoolItem& rItem ) { SwIterator<SwClient,SwGrfNode> aIter(rGrfNd); for(SwClient* pLast = aIter.First(); pLast; pLast = aIter.Next()) - if(!pLast->ISA(SwContentFrm)) + if(dynamic_cast<const SwContentFrm*>( pLast) == nullptr) pLast->ModifyNotification(&rItem, &rItem); } { @@ -230,7 +230,7 @@ static void lcl_CallModify( SwGrfNode& rGrfNd, SfxPoolItem& rItem ) { ::sfx2::SvBaseLink* pLnk = &(*rLnks[ --n ]); if( pLnk && OBJECT_CLIENT_GRF == pLnk->GetObjType() && - pLnk->ISA( SwBaseLink ) && pLnk->GetObj() == GetObj() ) + dynamic_cast<const SwBaseLink*>( pLnk) != nullptr && pLnk->GetObj() == GetObj() ) { SwBaseLink* pBLink = static_cast<SwBaseLink*>(pLnk); SwGrfNode* pGrfNd = static_cast<SwGrfNode*>(pBLink->pContentNode); diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index 09058916e8d9..f26d2b30afee 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -102,7 +102,7 @@ SwFrameFormat *FindFrameFormat( SdrObject *pObj ) { SwFrameFormat* pRetval = 0L; - if ( pObj->ISA(SwVirtFlyDrawObj) ) + if ( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) != nullptr ) { pRetval = static_cast<SwVirtFlyDrawObj*>(pObj)->GetFormat(); } @@ -154,7 +154,7 @@ SwContact* GetUserCall( const SdrObject* pObj ) SdrObject *pTmp; while ( !pObj->GetUserCall() && 0 != (pTmp = pObj->GetUpGroup()) ) pObj = pTmp; - OSL_ENSURE( !pObj->GetUserCall() || pObj->GetUserCall()->ISA(SwContact), + OSL_ENSURE( !pObj->GetUserCall() || 0 != dynamic_cast< const SwContact*> (pObj->GetUserCall()), "<::GetUserCall(..)> - wrong type of found object user call." ); return static_cast<SwContact*>(pObj->GetUserCall()); } @@ -275,7 +275,7 @@ void SwContact::_MoveObjToLayer( const bool _bToVisible, SdrLayerID nFromControlLayerId = _bToVisible ? rIDDMA.GetInvisibleControlsId() : rIDDMA.GetControlsId(); - if ( _pDrawObj->ISA( SdrObjGroup ) ) + if ( dynamic_cast<const SdrObjGroup*>( _pDrawObj) != nullptr ) { // determine layer for group object { @@ -411,14 +411,14 @@ const SwAnchoredObject* SwFlyDrawContact::GetAnchoredObj( const SdrObject* _pSdr { OSL_ENSURE( _pSdrObj, "<SwFlyDrawContact::GetAnchoredObj(..)> - no object provided" ); - OSL_ENSURE( _pSdrObj->ISA(SwVirtFlyDrawObj), + OSL_ENSURE( dynamic_cast<const SwVirtFlyDrawObj*>( _pSdrObj) != nullptr, "<SwFlyDrawContact::GetAnchoredObj(..)> - wrong object type object provided" ); OSL_ENSURE( GetUserCall( _pSdrObj ) == this, "<SwFlyDrawContact::GetAnchoredObj(..)> - provided object doesn't belongs to this contact" ); const SwAnchoredObject* pRetAnchoredObj = 0L; - if ( _pSdrObj && _pSdrObj->ISA(SwVirtFlyDrawObj) ) + if ( _pSdrObj && dynamic_cast<const SwVirtFlyDrawObj*>( _pSdrObj) != nullptr ) { pRetAnchoredObj = static_cast<const SwVirtFlyDrawObj*>(_pSdrObj)->GetFlyFrm(); } @@ -430,14 +430,14 @@ SwAnchoredObject* SwFlyDrawContact::GetAnchoredObj( SdrObject* _pSdrObj ) { OSL_ENSURE( _pSdrObj, "<SwFlyDrawContact::GetAnchoredObj(..)> - no object provided" ); - OSL_ENSURE( _pSdrObj->ISA(SwVirtFlyDrawObj), + OSL_ENSURE( dynamic_cast<const SwVirtFlyDrawObj*>( _pSdrObj) != nullptr, "<SwFlyDrawContact::GetAnchoredObj(..)> - wrong object type provided" ); OSL_ENSURE( GetUserCall( _pSdrObj ) == this, "<SwFlyDrawContact::GetAnchoredObj(..)> - provided object doesn't belongs to this contact" ); SwAnchoredObject* pRetAnchoredObj = 0L; - if ( _pSdrObj && _pSdrObj->ISA(SwVirtFlyDrawObj) ) + if ( _pSdrObj && dynamic_cast<const SwVirtFlyDrawObj*>( _pSdrObj) != nullptr ) { pRetAnchoredObj = static_cast<SwVirtFlyDrawObj*>(_pSdrObj)->GetFlyFrm(); } @@ -457,7 +457,7 @@ SdrObject* SwFlyDrawContact::GetMaster() void SwFlyDrawContact::SetMaster( SdrObject* _pNewMaster ) { - OSL_ENSURE( _pNewMaster->ISA(SwFlyDrawObj), + OSL_ENSURE( dynamic_cast<const SwFlyDrawObj*>( _pNewMaster) != nullptr, "<SwFlyDrawContact::SetMaster(..)> - wrong type of new master object" ); mpMasterObj = static_cast<SwFlyDrawObj *>(_pNewMaster); } @@ -473,7 +473,7 @@ void SwFlyDrawContact::Modify( const SfxPoolItem*, const SfxPoolItem * ) */ void SwFlyDrawContact::MoveObjToVisibleLayer( SdrObject* _pDrawObj ) { - OSL_ENSURE( _pDrawObj->ISA(SwVirtFlyDrawObj), + OSL_ENSURE( dynamic_cast<const SwVirtFlyDrawObj*>( _pDrawObj) != nullptr, "<SwFlyDrawContact::MoveObjToVisibleLayer(..)> - wrong SdrObject type -> crash" ); if ( GetFormat()->getIDocumentDrawModelAccess().IsVisibleLayerId( _pDrawObj->GetLayer() ) ) @@ -514,7 +514,7 @@ void SwFlyDrawContact::MoveObjToVisibleLayer( SdrObject* _pDrawObj ) */ void SwFlyDrawContact::MoveObjToInvisibleLayer( SdrObject* _pDrawObj ) { - OSL_ENSURE( _pDrawObj->ISA(SwVirtFlyDrawObj), + OSL_ENSURE( dynamic_cast<const SwVirtFlyDrawObj*>( _pDrawObj) != nullptr, "<SwFlyDrawContact::MoveObjToInvisibleLayer(..)> - wrong SdrObject type -> crash" ); if ( !GetFormat()->getIDocumentDrawModelAccess().IsVisibleLayerId( _pDrawObj->GetLayer() ) ) @@ -555,7 +555,7 @@ bool CheckControlLayer( const SdrObject *pObj ) { if ( FmFormInventor == pObj->GetObjInventor() ) return true; - if ( pObj->ISA( SdrObjGroup ) ) + if ( dynamic_cast<const SdrObjGroup*>( pObj) != nullptr ) { const SdrObjList *pLst = static_cast<const SdrObjGroup*>(pObj)->GetSubList(); for ( size_t i = 0; i < pLst->GetObjCount(); ++i ) @@ -632,7 +632,7 @@ void SwDrawContact::GetTextObjectsFromFormat( std::list<SdrTextObj*>& rTextObjec for( sal_Int32 n=0; n<(sal_Int32)pDoc->GetSpzFrameFormats()->size(); n++ ) { const SwFrameFormat* pFly = (*pDoc->GetSpzFrameFormats())[n]; - if( pFly->IsA( TYPE(SwDrawFrameFormat) ) ) + if( dynamic_cast<const SwDrawFrameFormat*>( pFly ) != nullptr ) { SwDrawContact* pContact = SwIterator<SwDrawContact,SwFrameFormat>(*pFly).First(); if( pContact ) @@ -640,21 +640,21 @@ void SwDrawContact::GetTextObjectsFromFormat( std::list<SdrTextObj*>& rTextObjec SdrObject* pSdrO = pContact->GetMaster(); if ( pSdrO ) { - if ( pSdrO->IsA( TYPE(SdrObjGroup) ) ) + if ( dynamic_cast<const SdrObjGroup*>(pSdrO) != nullptr ) { SdrObjListIter aListIter( *pSdrO, IM_DEEPNOGROUPS ); //iterate inside of a grouped object while( aListIter.IsMore() ) { SdrObject* pSdrOElement = aListIter.Next(); - if( pSdrOElement && pSdrOElement->IsA( TYPE(SdrTextObj) ) && + if( pSdrOElement && dynamic_cast<const SdrTextObj*>(pSdrOElement) != nullptr && static_cast<SdrTextObj*>( pSdrOElement)->HasText() ) { rTextObjects.push_back(static_cast<SdrTextObj*>( pSdrOElement )); } } } - else if( pSdrO->IsA( TYPE(SdrTextObj) ) && + else if( dynamic_cast<const SdrTextObj*>(pSdrO) != nullptr && static_cast<SdrTextObj*>( pSdrO )->HasText() ) { rTextObjects.push_back(static_cast<SdrTextObj*>( pSdrO )); @@ -676,8 +676,8 @@ const SwAnchoredObject* SwDrawContact::GetAnchoredObj( const SdrObject* _pSdrObj OSL_ENSURE( _pSdrObj, "<SwDrawContact::GetAnchoredObj(..)> - no object provided" ); - OSL_ENSURE( _pSdrObj->ISA(SwDrawVirtObj) || - ( !_pSdrObj->ISA(SdrVirtObj) && !_pSdrObj->ISA(SwDrawVirtObj) ), + OSL_ENSURE( dynamic_cast<const SwDrawVirtObj*>( _pSdrObj) != nullptr || + ( dynamic_cast<const SdrVirtObj*>( _pSdrObj) == nullptr && dynamic_cast<const SwDrawVirtObj*>( _pSdrObj) == nullptr ), "<SwDrawContact::GetAnchoredObj(..)> - wrong object type object provided" ); OSL_ENSURE( GetUserCall( _pSdrObj ) == this || _pSdrObj == GetMaster(), @@ -687,11 +687,11 @@ const SwAnchoredObject* SwDrawContact::GetAnchoredObj( const SdrObject* _pSdrObj if ( _pSdrObj ) { - if ( _pSdrObj->ISA(SwDrawVirtObj) ) + if ( dynamic_cast<const SwDrawVirtObj*>( _pSdrObj) != nullptr ) { pRetAnchoredObj = &(static_cast<const SwDrawVirtObj*>(_pSdrObj)->GetAnchoredObj()); } - else if ( !_pSdrObj->ISA(SdrVirtObj) && !_pSdrObj->ISA(SwDrawVirtObj) ) + else if ( dynamic_cast<const SdrVirtObj*>( _pSdrObj) == nullptr && dynamic_cast<const SwDrawVirtObj*>( _pSdrObj) == nullptr) { pRetAnchoredObj = &maAnchoredDrawObj; } @@ -710,8 +710,8 @@ SwAnchoredObject* SwDrawContact::GetAnchoredObj( SdrObject* _pSdrObj ) OSL_ENSURE( _pSdrObj, "<SwDrawContact::GetAnchoredObj(..)> - no object provided" ); - OSL_ENSURE( _pSdrObj->ISA(SwDrawVirtObj) || - ( !_pSdrObj->ISA(SdrVirtObj) && !_pSdrObj->ISA(SwDrawVirtObj) ), + OSL_ENSURE( dynamic_cast<const SwDrawVirtObj*>( _pSdrObj) != nullptr || + ( dynamic_cast<const SdrVirtObj*>( _pSdrObj) == nullptr && dynamic_cast<const SwDrawVirtObj*>( _pSdrObj) == nullptr), "<SwDrawContact::GetAnchoredObj(..)> - wrong object type object provided" ); OSL_ENSURE( GetUserCall( _pSdrObj ) == this || _pSdrObj == GetMaster(), "<SwDrawContact::GetAnchoredObj(..)> - provided object doesn't belongs to this contact" ); @@ -720,11 +720,11 @@ SwAnchoredObject* SwDrawContact::GetAnchoredObj( SdrObject* _pSdrObj ) if ( _pSdrObj ) { - if ( _pSdrObj->ISA(SwDrawVirtObj) ) + if ( dynamic_cast<const SwDrawVirtObj*>( _pSdrObj) != nullptr ) { pRetAnchoredObj = &(static_cast<SwDrawVirtObj*>(_pSdrObj)->AnchoredObj()); } - else if ( !_pSdrObj->ISA(SdrVirtObj) && !_pSdrObj->ISA(SwDrawVirtObj) ) + else if ( dynamic_cast<const SdrVirtObj*>( _pSdrObj) == nullptr && dynamic_cast<const SwDrawVirtObj*>( _pSdrObj) == nullptr) { pRetAnchoredObj = &maAnchoredDrawObj; } @@ -776,7 +776,7 @@ const SwFrm* SwDrawContact::GetAnchorFrm( const SdrObject* _pDrawObj ) const { pAnchorFrm = maAnchoredDrawObj.GetAnchorFrm(); } - else if ( _pDrawObj->ISA(SwDrawVirtObj) ) + else if ( dynamic_cast<const SwDrawVirtObj*>( _pDrawObj) != nullptr ) { pAnchorFrm = static_cast<const SwDrawVirtObj*>(_pDrawObj)->GetAnchorFrm(); } @@ -799,7 +799,7 @@ SwFrm* SwDrawContact::GetAnchorFrm( SdrObject* _pDrawObj ) } else { - OSL_ENSURE( _pDrawObj->ISA(SwDrawVirtObj), + OSL_ENSURE( dynamic_cast<const SwDrawVirtObj*>( _pDrawObj) != nullptr, "<SwDrawContact::GetAnchorFrm(..)> - unknown drawing object." ); pAnchorFrm = static_cast<SwDrawVirtObj*>(_pDrawObj)->AnchorFrm(); } @@ -1661,7 +1661,7 @@ void SwDrawContact::RemoveMasterFromDrawPage() // also working. void SwDrawContact::DisconnectObjFromLayout( SdrObject* _pDrawObj ) { - if ( _pDrawObj->ISA(SwDrawVirtObj) ) + if ( dynamic_cast<const SwDrawVirtObj*>( _pDrawObj) != nullptr ) { SwDrawVirtObj* pDrawVirtObj = static_cast<SwDrawVirtObj*>(_pDrawObj); pDrawVirtObj->RemoveFromWriterLayout(); @@ -2104,7 +2104,7 @@ namespace sdr aOffsetMatrix.set(1, 2, aLocalOffset.Y()); } - if(rReferencedObject.ISA(SdrObjGroup)) + if(dynamic_cast<const SdrObjGroup*>( &rReferencedObject) != nullptr) { // group object. Since the VOC/OC/VC hierarchy does not represent the // hierarchy virtual objects when they have group objects diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx index 1f97a6d5de08..50b31ddcbeb2 100644 --- a/sw/source/core/draw/dflyobj.cxx +++ b/sw/source/core/draw/dflyobj.cxx @@ -293,7 +293,7 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence xRetval; const SdrObject& rReferencedObject = GetSwVirtFlyDrawObj().GetReferencedObj(); - if(rReferencedObject.ISA(SwFlyDrawObj)) + if(dynamic_cast<const SwFlyDrawObj*>( &rReferencedObject) != nullptr) { // create an own specialized primitive which is used as repaint callpoint and HitTest // for HitTest processor (see primitive implementation above) @@ -324,7 +324,7 @@ basegfx::B2DRange SwVirtFlyDrawObj::getOuterBound() const basegfx::B2DRange aOuterRange; const SdrObject& rReferencedObject = GetReferencedObj(); - if(rReferencedObject.ISA(SwFlyDrawObj)) + if(dynamic_cast<const SwFlyDrawObj*>( &rReferencedObject) != nullptr) { const SwFlyFrm* pFlyFrame = GetFlyFrm(); @@ -348,7 +348,7 @@ basegfx::B2DRange SwVirtFlyDrawObj::getInnerBound() const basegfx::B2DRange aInnerRange; const SdrObject& rReferencedObject = GetReferencedObj(); - if(rReferencedObject.ISA(SwFlyDrawObj)) + if(dynamic_cast<const SwFlyDrawObj*>( &rReferencedObject) != nullptr) { const SwFlyFrm* pFlyFrame = GetFlyFrm(); @@ -733,7 +733,7 @@ void SwVirtFlyDrawObj::NbcCrop(const Point& rRef, const Fraction& xFact, const F { // Get Wrt Shell SwWrtShell *pSh = dynamic_cast<SwWrtShell*>( GetFlyFrm()->getRootFrm()->GetCurrShell() ); - if (!pSh || !pSh->ISA(SwWrtShell)) + if (!pSh || dynamic_cast<const SwWrtShell*>( pSh) == nullptr) return; // Compute old and new rect. This will give us the deformation to apply to diff --git a/sw/source/core/draw/dpage.cxx b/sw/source/core/draw/dpage.cxx index db5707c3dcf7..1c83dd3d3a66 100644 --- a/sw/source/core/draw/dpage.cxx +++ b/sw/source/core/draw/dpage.cxx @@ -185,7 +185,7 @@ bool SwDPage::RequestHelp( vcl::Window* pWindow, SdrView* pView, SdrPageView* pPV; SdrObject* pObj; if( pView->PickObj( aPos, 0, pObj, pPV, SdrSearchOptions::PICKMACRO ) && - pObj->ISA(SwVirtFlyDrawObj) ) + dynamic_cast<const SwVirtFlyDrawObj*>( pObj) != nullptr ) { SwFlyFrm *pFly = static_cast<SwVirtFlyDrawObj*>(pObj)->GetFlyFrm(); const SwFormatURL &rURL = pFly->GetFormat()->GetURL(); diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx index c78c916f843a..55177134fa3a 100644 --- a/sw/source/core/draw/dview.cxx +++ b/sw/source/core/draw/dview.cxx @@ -76,7 +76,7 @@ bool SwSdrHdl::IsFocusHdl() const static const SwFrm *lcl_FindAnchor( const SdrObject *pObj, bool bAll ) { - const SwVirtFlyDrawObj *pVirt = pObj->ISA(SwVirtFlyDrawObj) ? + const SwVirtFlyDrawObj *pVirt = dynamic_cast< const SwVirtFlyDrawObj *>( pObj ) != nullptr ? static_cast<const SwVirtFlyDrawObj*>(pObj) : 0; if ( pVirt ) { @@ -366,7 +366,7 @@ void SwDrawView::_MoveRepeatedObjs( const SwAnchoredObject& _rMovedAnchoredObj, nNewPos ); pDrawPage->RecalcObjOrdNums(); // adjustments for accessibility API - if ( pAnchoredObj->ISA(SwFlyFrm) ) + if ( dynamic_cast< const SwFlyFrm *>( pAnchoredObj ) != nullptr ) { const SwFlyFrm *pTmpFlyFrm = static_cast<SwFlyFrm*>(pAnchoredObj); rImp.DisposeAccessibleFrm( pTmpFlyFrm ); @@ -402,7 +402,7 @@ void SwDrawView::_MoveRepeatedObjs( const SwAnchoredObject& _rMovedAnchoredObj, nTmpNewPos ); pDrawPage->RecalcObjOrdNums(); // adjustments for accessibility API - if ( pAnchoredObj->ISA(SwFlyFrm) ) + if ( dynamic_cast< const SwFlyFrm *>( pAnchoredObj ) != nullptr ) { const SwFlyFrm *pTmpFlyFrm = static_cast<SwFlyFrm*>(pAnchoredObj); rImp.DisposeAccessibleFrm( pTmpFlyFrm ); @@ -507,7 +507,7 @@ void SwDrawView::ObjOrderChanged( SdrObject* pObj, sal_uLong nOldPos, // On move forward, assure that object is moved before its own children. // Only Writer fly frames can have children. - if ( pMovedAnchoredObj->ISA(SwFlyFrm) && + if ( dynamic_cast< const SwFlyFrm *>( pMovedAnchoredObj ) != nullptr && bMovedForward && nNewPos < nObjCount - 1 ) { sal_uInt32 nMaxChildOrdNum = @@ -578,7 +578,7 @@ void SwDrawView::ObjOrderChanged( SdrObject* pObj, sal_uLong nOldPos, std::vector< SdrObject* > aMovedChildObjs; // move 'children' accordingly - if ( pMovedAnchoredObj->ISA(SwFlyFrm) ) + if ( dynamic_cast< const SwFlyFrm *>( pMovedAnchoredObj ) != nullptr ) { const SwFlyFrm* pFlyFrm = static_cast<SwFlyFrm*>(pMovedAnchoredObj); @@ -611,7 +611,7 @@ void SwDrawView::ObjOrderChanged( SdrObject* pObj, sal_uLong nOldPos, // collect 'child' object aMovedChildObjs.push_back( pTmpObj ); // adjustments for accessibility API - if ( pTmpObj->ISA(SwVirtFlyDrawObj) ) + if ( dynamic_cast< const SwVirtFlyDrawObj *>( pTmpObj ) != nullptr ) { const SwFlyFrm *pTmpFlyFrm = static_cast<SwVirtFlyDrawObj*>(pTmpObj)->GetFlyFrm(); @@ -676,7 +676,7 @@ const SwFrm* SwDrawView::CalcAnchor() //current anchor. Search only if we currently drag. const SwFrm* pAnch; Rectangle aMyRect; - const bool bFly = pObj->ISA(SwVirtFlyDrawObj); + const bool bFly = dynamic_cast< const SwVirtFlyDrawObj *>( pObj ) != nullptr; if ( bFly ) { pAnch = static_cast<SwVirtFlyDrawObj*>(pObj)->GetFlyFrm()->GetAnchorFrm(); @@ -819,7 +819,7 @@ void SwDrawView::CheckPossibilities() { const SdrObject *pObj = rMrkList.GetMark( i )->GetMarkedSdrObj(); const SwFrm *pFrm = NULL; - if ( pObj->ISA(SwVirtFlyDrawObj) ) + if ( dynamic_cast< const SwVirtFlyDrawObj *>( pObj ) != nullptr ) { const SwFlyFrm *pFly = static_cast<const SwVirtFlyDrawObj*>(pObj)->GetFlyFrm(); if ( pFly ) @@ -899,7 +899,7 @@ void SwDrawView::ReplaceMarkedDrawVirtObjs( SdrMarkView& _rMarkView ) while ( !aMarkedObjs.empty() ) { SdrObject* pMarkObj = aMarkedObjs.back(); - if ( pMarkObj->ISA(SwDrawVirtObj) ) + if ( dynamic_cast< const SwDrawVirtObj *>( pMarkObj ) != nullptr ) { SdrObject* pRefObj = &(static_cast<SwDrawVirtObj*>(pMarkObj)->ReferencedObj()); if ( !_rMarkView.IsObjMarked( pRefObj ) ) diff --git a/sw/source/core/edit/edglbldc.cxx b/sw/source/core/edit/edglbldc.cxx index a72240b29a46..58c1b0d82b1a 100644 --- a/sw/source/core/edit/edglbldc.cxx +++ b/sw/source/core/edit/edglbldc.cxx @@ -73,7 +73,7 @@ void SwEditShell::GetGlobalDocContent( SwGlblDocContents& rArr ) const case TOX_HEADER_SECTION: break; // ignore case TOX_CONTENT_SECTION: - OSL_ENSURE( pSect->ISA( SwTOXBaseSection ), "no TOXBaseSection!" ); + OSL_ENSURE( dynamic_cast<const SwTOXBaseSection*>( pSect) != nullptr, "no TOXBaseSection!" ); pNew = new SwGlblDocContent( static_cast<const SwTOXBaseSection*>(pSect) ); break; diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx index 02eb42df64a7..203235e3319d 100644 --- a/sw/source/core/edit/editsh.cxx +++ b/sw/source/core/edit/editsh.cxx @@ -118,7 +118,7 @@ void SwEditShell::Insert2(const OUString &rStr, const bool bForceExpandHints ) // calculate cursor bidi level SwCursor* pTmpCrsr = _GetCrsr(); const bool bDoNotSetBidiLevel = ! pTmpCrsr || - ( 0 != dynamic_cast<SwUnoCrsr*>(pTmpCrsr) ); + ( dynamic_cast<SwUnoCrsr*>(pTmpCrsr) != nullptr ); if ( ! bDoNotSetBidiLevel ) { diff --git a/sw/source/core/edit/edtab.cxx b/sw/source/core/edit/edtab.cxx index d6c8ec33d14c..029bab7ecdcb 100644 --- a/sw/source/core/edit/edtab.cxx +++ b/sw/source/core/edit/edtab.cxx @@ -471,14 +471,14 @@ bool SwEditShell::CanMergeTable( bool bWithPrev, bool* pChkNxtPrv ) const bool bRet = false; const SwPaM *pCrsr = GetCrsr(); const SwTableNode* pTableNd = pCrsr->GetNode().FindTableNode(); - if( pTableNd && !pTableNd->GetTable().ISA( SwDDETable )) + if( pTableNd && dynamic_cast< const SwDDETable* >(&pTableNd->GetTable()) == nullptr) { bool bNew = pTableNd->GetTable().IsNewModel(); const SwNodes& rNds = GetDoc()->GetNodes(); if( pChkNxtPrv ) { const SwTableNode* pChkNd = rNds[ pTableNd->GetIndex() - 1 ]->FindTableNode(); - if( pChkNd && !pChkNd->GetTable().ISA( SwDDETable ) && + if( pChkNd && dynamic_cast< const SwDDETable* >(&pChkNd->GetTable()) == nullptr && bNew == pChkNd->GetTable().IsNewModel() && // Consider table in table case pChkNd->EndOfSectionIndex() == pTableNd->GetIndex() - 1 ) @@ -486,7 +486,7 @@ bool SwEditShell::CanMergeTable( bool bWithPrev, bool* pChkNxtPrv ) const else { pChkNd = rNds[ pTableNd->EndOfSectionIndex() + 1 ]->GetTableNode(); - if( pChkNd && !pChkNd->GetTable().ISA( SwDDETable ) && + if( pChkNd && dynamic_cast< const SwDDETable* >(&pChkNd->GetTable()) == nullptr && bNew == pChkNd->GetTable().IsNewModel() ) *pChkNxtPrv = false, bRet = true; // using Next is possible } @@ -505,7 +505,7 @@ bool SwEditShell::CanMergeTable( bool bWithPrev, bool* pChkNxtPrv ) const else pTmpTableNd = rNds[ pTableNd->EndOfSectionIndex() + 1 ]->GetTableNode(); - bRet = pTmpTableNd && !pTmpTableNd->GetTable().ISA( SwDDETable ) && + bRet = pTmpTableNd && dynamic_cast< const SwDDETable* >(&pTmpTableNd->GetTable()) == nullptr && bNew == pTmpTableNd->GetTable().IsNewModel(); } } diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx index 16385174285c..579724103f35 100644 --- a/sw/source/core/edit/edtox.cxx +++ b/sw/source/core/edit/edtox.cxx @@ -97,14 +97,14 @@ sal_uInt16 SwEditShell::GetCurTOXMarks(SwTOXMarks& rMarks) const bool SwEditShell::IsTOXBaseReadonly(const SwTOXBase& rTOXBase) { - OSL_ENSURE( rTOXBase.ISA( SwTOXBaseSection ), "no TOXBaseSection!" ); + OSL_ENSURE( dynamic_cast<const SwTOXBaseSection*>( &rTOXBase) != nullptr, "no TOXBaseSection!" ); const SwTOXBaseSection& rTOXSect = static_cast<const SwTOXBaseSection&>(rTOXBase); return rTOXSect.IsProtect(); } void SwEditShell::SetTOXBaseReadonly(const SwTOXBase& rTOXBase, bool bReadonly) { - OSL_ENSURE( rTOXBase.ISA( SwTOXBaseSection ), "no TOXBaseSection!" ); + OSL_ENSURE( dynamic_cast<const SwTOXBaseSection*>( &rTOXBase) != nullptr, "no TOXBaseSection!" ); const SwTOXBaseSection& rTOXSect = static_cast<const SwTOXBaseSection&>(rTOXBase); const_cast<SwTOXBase&>(rTOXBase).SetProtected(bReadonly); OSL_ENSURE( rTOXSect.SwSection::GetType() == TOX_CONTENT_SECTION, "not a TOXContentSection" ); @@ -158,7 +158,7 @@ bool SwEditShell::UpdateTableOf( const SwTOXBase& rTOX, const SfxItemSet* pSet ) { bool bRet = false; - OSL_ENSURE( rTOX.ISA( SwTOXBaseSection ), "no TOXBaseSection!" ); + OSL_ENSURE( dynamic_cast<const SwTOXBaseSection*>( &rTOX) != nullptr, "no TOXBaseSection!" ); SwTOXBaseSection* pTOX = const_cast<SwTOXBaseSection*>(static_cast<const SwTOXBaseSection*>(&rTOX)); OSL_ENSURE(pTOX, "no current listing"); if( pTOX && 0 != pTOX->GetFormat()->GetSectionNode() ) @@ -246,7 +246,7 @@ const SwTOXBase* SwEditShell::GetTOX( sal_uInt16 nPos ) const pSect->GetFormat()->GetSectionNode() && nCnt++ == nPos ) { - OSL_ENSURE( pSect->ISA( SwTOXBaseSection ), "no TOXBaseSection!" ); + OSL_ENSURE( dynamic_cast<const SwTOXBaseSection*>( pSect) != nullptr, "no TOXBaseSection!" ); return static_cast<const SwTOXBaseSection*>(pSect); } } diff --git a/sw/source/core/edit/edundo.cxx b/sw/source/core/edit/edundo.cxx index 86a9c87c9200..473fd5a47397 100644 --- a/sw/source/core/edit/edundo.cxx +++ b/sw/source/core/edit/edundo.cxx @@ -232,7 +232,7 @@ static void lcl_SelectSdrMarkList( SwEditShell* pShell, OSL_ENSURE( pShell != NULL, "need shell!" ); OSL_ENSURE( pSdrMarkList != NULL, "need mark list" ); - if( pShell->ISA( SwFEShell ) ) + if( dynamic_cast<const SwFEShell*>( pShell) != nullptr ) { SwFEShell* pFEShell = static_cast<SwFEShell*>( pShell ); bool bFirst = true; diff --git a/sw/source/core/edit/edws.cxx b/sw/source/core/edit/edws.cxx index b87ec6f742d6..c222812dd4c9 100644 --- a/sw/source/core/edit/edws.cxx +++ b/sw/source/core/edit/edws.cxx @@ -72,7 +72,7 @@ void SwEditShell::StartAllAction() { for(SwViewShell& rCurrentShell : GetRingContainer()) { - if( rCurrentShell.IsA( TYPE( SwEditShell ) ) ) + if( dynamic_cast<const SwEditShell *>(&rCurrentShell) != nullptr ) static_cast<SwEditShell*>(&rCurrentShell)->StartAction(); else rCurrentShell.StartAction(); @@ -83,7 +83,7 @@ void SwEditShell::EndAllAction() { for(SwViewShell& rCurrentShell : GetRingContainer()) { - if( rCurrentShell.IsA( TYPE( SwEditShell ) ) ) + if( dynamic_cast<const SwEditShell *>(&rCurrentShell) != nullptr ) static_cast<SwEditShell*>(&rCurrentShell)->EndAction(); else rCurrentShell.EndAction(); diff --git a/sw/source/core/fields/ddefld.cxx b/sw/source/core/fields/ddefld.cxx index 34e6fa8123aa..66ed9bdaceec 100644 --- a/sw/source/core/fields/ddefld.cxx +++ b/sw/source/core/fields/ddefld.cxx @@ -110,7 +110,7 @@ public: for(SwClient* pLast = aIter.First(); pLast; pLast = aIter.Next()) { // a DDE table or a DDE field attribute in the text - if( !pLast->IsA( TYPE( SwFormatField ) ) || + if( dynamic_cast<const SwFormatField *>(pLast) == nullptr || static_cast<SwFormatField*>(pLast)->GetTextField() ) { if( !bCallModify ) @@ -173,7 +173,7 @@ const SwNode* SwIntrnlRefLink::GetAnchor() const for(SwClient* pLast = aIter.First(); pLast; pLast = aIter.Next()) { // a DDE table or a DDE field attribute in the text - if( !pLast->IsA( TYPE( SwFormatField ) )) + if( dynamic_cast<const SwFormatField *>(pLast) == nullptr) { SwDepend* pDep = static_cast<SwDepend*>(pLast); SwDDETable* pDDETable = static_cast<SwDDETable*>(pDep->GetToTell()); @@ -198,7 +198,7 @@ bool SwIntrnlRefLink::IsInRange( sal_uLong nSttNd, sal_uLong nEndNd, for(SwClient* pLast = aIter.First(); pLast; pLast = aIter.Next()) { // a DDE table or a DDE field attribute in the text - if( !pLast->IsA( TYPE( SwFormatField ) )) + if( dynamic_cast<const SwFormatField *>(pLast) == nullptr) { SwDepend* pDep = static_cast<SwDepend*>(pLast); SwDDETable* pDDETable = static_cast<SwDDETable*>(pDep->GetToTell()); diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index c53dc78f7aa9..14fa99da286a 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -156,13 +156,13 @@ void SwPageNumberFieldType::ChangeExpansion( SwDoc* pDoc, if( 0 != (pDesc = static_cast<const SwFormatPageDesc*>(rPool.GetItem2( RES_PAGEDESC, n )) ) && pDesc->GetNumOffset() && pDesc->GetDefinedIn() ) { - const SwContentNode* pNd = PTR_CAST( SwContentNode, pDesc->GetDefinedIn() ); + const SwContentNode* pNd = dynamic_cast<const SwContentNode*>( pDesc->GetDefinedIn() ); if( pNd ) { if ( SwIterator<SwFrm,SwContentNode>(*pNd).First() ) bVirtuell = true; } - else if( pDesc->GetDefinedIn()->ISA( SwFormat )) + else if( dynamic_cast< const SwFormat* >(pDesc->GetDefinedIn()) != nullptr) { SwAutoFormatGetDocNode aGetHt( &pDoc->GetNodes() ); bVirtuell = !pDesc->GetDefinedIn()->GetInfo( aGetHt ); diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index df8d85254f93..4083e31241e3 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -399,7 +399,7 @@ bool SwFEShell::CopyDrawSel( SwFEShell* pDestShell, const Point& rSttPt, pFormat->SetFormatAttr( SwFormatVertOrient( aPos.getY(), text::VertOrientation::NONE, text::RelOrientation::FRAME ) ); // #i47455# - notify draw frame format // that position attributes are already set. - if ( pFormat->ISA(SwDrawFrameFormat) ) + if ( dynamic_cast<const SwDrawFrameFormat*>( pFormat) != nullptr ) { static_cast<SwDrawFrameFormat*>(pFormat)->PosAttrSet(); } @@ -933,7 +933,7 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, bool bIncludingPageFrames ) SdrObject* pOwner = pList->GetOwnerObj(); if ( pOwner ) { - SdrObjGroup* pThisGroup = PTR_CAST(SdrObjGroup, pOwner); + SdrObjGroup* pThisGroup = dynamic_cast<SdrObjGroup*>( pOwner ); aGrpAnchor = pThisGroup->GetAnchorPos(); } } @@ -1011,7 +1011,7 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, bool bIncludingPageFrames ) pDV->MarkObj( pObj, pDV->GetSdrPageView() ); // #i47455# - notify draw frame format // that position attributes are already set. - if ( pNew->ISA(SwDrawFrameFormat) ) + if ( dynamic_cast<const SwDrawFrameFormat*>( pNew) != nullptr ) { static_cast<SwDrawFrameFormat*>(pNew)->PosAttrSet(); } @@ -1219,7 +1219,7 @@ bool SwFEShell::GetDrawObjGraphic( SotClipboardFormatId nFormat, Graphic& rGrf ) if( rMrkList.GetMarkCount() ) { if( rMrkList.GetMarkCount() == 1 && - rMrkList.GetMark( 0 )->GetMarkedSdrObj()->ISA(SwVirtFlyDrawObj) ) + dynamic_cast< const SwVirtFlyDrawObj* >(rMrkList.GetMark( 0 )->GetMarkedSdrObj()) != nullptr ) { // select frame if( CNT_GRF == GetCntType() ) @@ -1366,7 +1366,7 @@ void SwFEShell::Paste( SvStream& rStrm, SwPasteSdr nAction, const Point* pPt ) SdrObject* pClpObj = pModel->GetPage(0)->GetObj(0); SdrObject* pOldObj = pView->GetMarkedObjectList().GetMark( 0 )->GetMarkedSdrObj(); - if( SwPasteSdr::SetAttr == nAction && pOldObj->ISA(SwVirtFlyDrawObj) ) + if( SwPasteSdr::SetAttr == nAction && dynamic_cast<const SwVirtFlyDrawObj*>( pOldObj) != nullptr ) nAction = SwPasteSdr::Replace; switch( nAction ) @@ -1375,7 +1375,7 @@ void SwFEShell::Paste( SvStream& rStrm, SwPasteSdr nAction, const Point* pPt ) { const SwFrameFormat* pFormat(0); const SwFrm* pAnchor(0); - if( pOldObj->ISA(SwVirtFlyDrawObj) ) + if( dynamic_cast<const SwVirtFlyDrawObj*>( pOldObj) != nullptr ) { pFormat = FindFrameFormat( pOldObj ); @@ -1405,14 +1405,14 @@ void SwFEShell::Paste( SvStream& rStrm, SwPasteSdr nAction, const Point* pPt ) Point aVec = aOldObjRect.TopLeft() - aNewRect.TopLeft(); pNewObj->NbcMove(Size(aVec.getX(), aVec.getY())); - if( pNewObj->ISA( SdrUnoObj ) ) + if( dynamic_cast<const SdrUnoObj*>( pNewObj) != nullptr ) pNewObj->SetLayer( GetDoc()->getIDocumentDrawModelAccess().GetControlsId() ); - else if( pOldObj->ISA( SdrUnoObj ) ) + else if( dynamic_cast<const SdrUnoObj*>( pOldObj) != nullptr ) pNewObj->SetLayer( GetDoc()->getIDocumentDrawModelAccess().GetHeavenId() ); else pNewObj->SetLayer( pOldObj->GetLayer() ); - if( pOldObj->ISA(SwVirtFlyDrawObj) ) + if( dynamic_cast<const SwVirtFlyDrawObj*>( pOldObj) != nullptr ) { // store attributes, then set SdrObject SfxItemSet aFrmSet( mpDoc->GetAttrPool(), @@ -1429,7 +1429,7 @@ void SwFEShell::Paste( SvStream& rStrm, SwPasteSdr nAction, const Point* pPt ) } while( pTmp->IsFollow() ); pAnchor = pTmp; } - if( pOldObj->ISA( SdrCaptionObj )) + if( dynamic_cast<const SdrCaptionObj*>( pOldObj) != nullptr) aNullPt = static_cast<SdrCaptionObj*>(pOldObj)->GetTailPos(); else aNullPt = aOldObjRect.TopLeft(); @@ -1535,7 +1535,7 @@ void SwFEShell::Paste( SvStream& rStrm, SwPasteSdr nAction, const Point* pPt ) if ( nCnt > 1 ) pView->GroupMarked(); SdrObject *pObj = pView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(); - if( pObj->ISA( SdrUnoObj ) ) + if( dynamic_cast<const SdrUnoObj*>( pObj) != nullptr ) { pObj->SetLayer( GetDoc()->getIDocumentDrawModelAccess().GetControlsId() ); bDesignMode = true; @@ -1563,7 +1563,7 @@ bool SwFEShell::Paste(const Graphic &rGrf, const OUString& rURL) bool bRet = 1 == pView->GetMarkedObjectList().GetMarkCount() && (pObj = pView->GetMarkedObjectList().GetMark( 0 )->GetMarkedSdrObj())->IsClosedObj() && - !pObj->ISA( SdrOle2Obj ); + dynamic_cast<const SdrOle2Obj*>( pObj) == nullptr; if( bRet && pObj ) { diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index d1cda53630db..b36d65fe113c 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -265,7 +265,7 @@ SwFlyFrm* SwFEShell::GetSelectedFlyFrm() const return 0; SdrObject *pO = rMrkList.GetMark( 0 )->GetMarkedSdrObj(); - return ( pO && pO->ISA(SwVirtFlyDrawObj) ) ? static_cast<SwVirtFlyDrawObj*>(pO)->GetFlyFrm() : 0; + return ( pO && dynamic_cast<const SwVirtFlyDrawObj*>( pO ) != nullptr ) ? static_cast<SwVirtFlyDrawObj*>(pO)->GetFlyFrm() : 0; } return 0; } @@ -311,7 +311,7 @@ const SwFrameFormat* SwFEShell::IsFlyInFly() SwFrameFormat *pFormat = FindFrameFormat( pObj ); if( pFormat && FLY_AT_FLY == pFormat->GetAnchor().GetAnchorId() ) { - const SwFrm* pFly = pObj->ISA(SwVirtFlyDrawObj) ? + const SwFrm* pFly = nullptr ? static_cast<SwVirtFlyDrawObj*>(pObj)->GetFlyFrm()->GetAnchorFrm() : static_cast<SwDrawContact*>(GetUserCall(pObj))->GetAnchorFrm( pObj ); OSL_ENSURE( pFly, "IsFlyInFly: Where's my anchor?" ); @@ -394,7 +394,7 @@ Point SwFEShell::FindAnchorPos( const Point& rAbsPos, bool bMoveIt ) if ( FLY_AS_CHAR == nAnchorId ) return aRet; - bool bFlyFrame = pObj->ISA(SwVirtFlyDrawObj); + bool bFlyFrame = nullptr; SwFlyFrm* pFly = 0L; const SwFrm* pFooterOrHeader = NULL; @@ -1159,7 +1159,7 @@ void SwFEShell::SetFrameFormat( SwFrameFormat *pNewFormat, bool bKeepOrient, Poi { const SwFrameFormat* pFormat = GetFormatFromObj( *pDocPos ); - if(PTR_CAST(SwFlyFrameFormat, pFormat)) + if(dynamic_cast<const SwFlyFrameFormat*>( pFormat) ) pFly = static_cast<const SwFlyFrameFormat*>(pFormat)->GetFrm(); } else @@ -1456,7 +1456,7 @@ const SwFrameFormat* SwFEShell::IsURLGrfAtPos( const Point& rPt, OUString* pURL, pDView->SetHitTolerancePixel( 2 ); if( pDView->PickObj( rPt, pDView->getHitTolLog(), pObj, pPV,SdrSearchOptions::PICKMACRO ) && - pObj->ISA(SwVirtFlyDrawObj) ) + dynamic_cast<const SwVirtFlyDrawObj*>( pObj) != nullptr ) { SwFlyFrm *pFly = static_cast<SwVirtFlyDrawObj*>(pObj)->GetFlyFrm(); const SwFormatURL &rURL = pFly->GetFormat()->GetURL(); @@ -1523,7 +1523,7 @@ const Graphic *SwFEShell::GetGrfAtPos( const Point &rPt, SdrPageView* pPV; SwDrawView *pDView = const_cast<SwDrawView*>(Imp()->GetDrawView()); - if( pDView->PickObj( rPt, pDView->getHitTolLog(), pObj, pPV ) && pObj->ISA(SwVirtFlyDrawObj) ) + if( pDView->PickObj( rPt, pDView->getHitTolLog(), pObj, pPV ) && dynamic_cast<const SwVirtFlyDrawObj*>( pObj) != nullptr ) { SwFlyFrm *pFly = static_cast<SwVirtFlyDrawObj*>(pObj)->GetFlyFrm(); if ( pFly->Lower() && pFly->Lower()->IsNoTextFrm() ) @@ -1568,7 +1568,7 @@ const SwFrameFormat* SwFEShell::GetFormatFromObj( const Point& rPt, SwRect** pRe if( pDView->PickObj( rPt, pDView->getHitTolLog(), pObj, pPView, SdrSearchOptions::PICKMARKABLE ) ) { // first check it: - if ( pObj->ISA(SwVirtFlyDrawObj) ) + if ( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) != nullptr ) pRet = static_cast<SwVirtFlyDrawObj*>(pObj)->GetFormat(); else if ( pObj->GetUserCall() ) //not for group objects pRet = static_cast<SwDrawContact*>(pObj->GetUserCall())->GetFormat(); @@ -1603,7 +1603,7 @@ ObjCntType SwFEShell::GetObjCntType( const SdrObject& rObj ) const // investigate 'master' drawing object, if method // is called for a 'virtual' drawing object. const SdrObject* pInvestigatedObj; - if ( rObj.ISA(SwDrawVirtObj) ) + if ( dynamic_cast<const SwDrawVirtObj*>( &rObj) != nullptr ) { const SwDrawVirtObj* pDrawVirtObj = static_cast<const SwDrawVirtObj*>(&rObj); pInvestigatedObj = &(pDrawVirtObj->GetReferencedObj()); @@ -1634,7 +1634,7 @@ ObjCntType SwFEShell::GetObjCntType( const SdrObject& rObj ) const } } } - else if( pInvestigatedObj->ISA(SwVirtFlyDrawObj) ) + else if( dynamic_cast<const SwVirtFlyDrawObj*>( pInvestigatedObj) != nullptr ) { const SwFlyFrm *pFly = static_cast<const SwVirtFlyDrawObj&>(*pInvestigatedObj).GetFlyFrm(); if ( pFly->Lower() && pFly->Lower()->IsNoTextFrm() ) @@ -1647,7 +1647,7 @@ ObjCntType SwFEShell::GetObjCntType( const SdrObject& rObj ) const else eType = OBJCNT_FLY; } - else if ( pInvestigatedObj->ISA( SdrObjGroup ) ) + else if ( dynamic_cast<const SdrObjGroup*>( pInvestigatedObj) != nullptr ) { SwDrawContact* pDrawContact( dynamic_cast<SwDrawContact*>(GetUserCall( pInvestigatedObj ) ) ); if ( !pDrawContact ) @@ -1745,7 +1745,7 @@ bool SwFEShell::ReplaceSdrObj( const OUString& rGrfName, const OUString& rFltNam aFrmSet.Set( pFormat->GetAttrSet() ); // set size and position? - if( !pObj->ISA(SwVirtFlyDrawObj) ) + if( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) == nullptr ) { // then let's do it: const Rectangle &rBound = pObj->GetSnapRect(); diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index c321c74cb690..b18dcc2b096c 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -98,7 +98,7 @@ SwFlyFrm *GetFlyFromMarked( const SdrMarkList *pLst, SwViewShell *pSh ) if ( pLst && pLst->GetMarkCount() == 1 ) { SdrObject *pO = pLst->GetMark( 0 )->GetMarkedSdrObj(); - if ( pO && pO->ISA(SwVirtFlyDrawObj) ) + if ( pO && dynamic_cast<const SwVirtFlyDrawObj*>( pO) != nullptr ) return static_cast<SwVirtFlyDrawObj*>(pO)->GetFlyFrm(); } return 0; @@ -218,7 +218,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 = pTmpObj->ISA(SwVirtFlyDrawObj); + bool bForget = dynamic_cast<const SwVirtFlyDrawObj*>( pTmpObj) != nullptr; if( bForget ) { pDView->UnmarkAll(); @@ -300,7 +300,7 @@ bool SwFEShell::MoveAnchor( SwMove nDir ) SwFrm* pOld; SwFlyFrm* pFly = NULL; SdrObject *pObj = pMrkList->GetMark( 0 )->GetMarkedSdrObj(); - if( pObj->ISA(SwVirtFlyDrawObj) ) + if( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) != nullptr ) { pFly = static_cast<SwVirtFlyDrawObj*>(pObj)->GetFlyFrm(); pOld = pFly->AnchorFrm(); @@ -428,7 +428,7 @@ bool SwFEShell::MoveAnchor( SwMove nDir ) for( size_t i = 0; i<pPage->GetSortedObjs()->size(); ++i ) { SwAnchoredObject* pAnchObj = (*pPage->GetSortedObjs())[i]; - if( pAnchObj->ISA(SwFlyFrm) ) + if( dynamic_cast<const SwFlyFrm*>( pAnchObj) != nullptr ) { SwFlyFrm* pTmp = static_cast<SwFlyFrm*>(pAnchObj); if( pTmp == pOld ) @@ -638,7 +638,7 @@ void SwFEShell::StartCropImage() for ( size_t i = 0; i < rMarkList.GetMarkCount(); ++i ) { SdrObject *pTmpObj = rMarkList.GetMark( i )->GetMarkedSdrObj(); - bool bForget = pTmpObj->ISA(SwVirtFlyDrawObj); + bool bForget = dynamic_cast<const SwVirtFlyDrawObj*>( pTmpObj) != nullptr; if( bForget ) { pView->UnmarkAll(); @@ -714,7 +714,7 @@ long SwFEShell::EndDrag( const Point *, bool ) for(SwViewShell& rSh : GetRingContainer()) { rSh.EndAction(); - if( rSh.IsA( TYPE( SwCrsrShell ) ) ) + if( dynamic_cast<const SwCrsrShell *>(&rSh) != nullptr ) static_cast<SwCrsrShell*>(&rSh)->CallChgLnk(); } @@ -782,7 +782,7 @@ static void lcl_NotifyNeighbours( const SdrMarkList *pLst ) sal_Int16 aHori = text::HoriOrientation::NONE; SwRect aRect; SdrObject *pO = pLst->GetMark( j )->GetMarkedSdrObj(); - if ( pO->ISA(SwVirtFlyDrawObj) ) + if ( dynamic_cast<const SwVirtFlyDrawObj*>( pO) != nullptr ) { SwFlyFrm *pFly = static_cast<SwVirtFlyDrawObj*>(pO)->GetFlyFrm(); @@ -813,7 +813,7 @@ static void lcl_NotifyNeighbours( const SdrMarkList *pLst ) for ( size_t i = 0; i < nCount; ++i ) { SwAnchoredObject* pAnchoredObj = (*pPage->GetSortedObjs())[i]; - if ( !pAnchoredObj->ISA(SwFlyFrm) ) + if ( dynamic_cast<const SwFlyFrm*>( pAnchoredObj) == nullptr ) continue; SwFlyFrm* pAct = static_cast<SwFlyFrm*>(pAnchoredObj); @@ -941,7 +941,7 @@ void SwFEShell::ChangeOpaque( SdrLayerID nLayerId ) { pObj->SetLayer( nLayerId ); InvalidateWindows( SwRect( pObj->GetCurrentBoundRect() ) ); - if ( pObj->ISA(SwVirtFlyDrawObj) ) + if ( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) != nullptr ) { SwFormat *pFormat = static_cast<SwVirtFlyDrawObj*>(pObj)->GetFlyFrm()->GetFormat(); SvxOpaqueItem aOpa( pFormat->GetOpaque() ); @@ -1203,7 +1203,7 @@ bool SwFEShell::ShouldObjectBeSelected(const Point& rPt) { SdrObject *pCandidate = pPage->GetObj(a); - if (pCandidate->ISA(SwVirtFlyDrawObj) && + if (dynamic_cast<const SwVirtFlyDrawObj*>( pCandidate) != nullptr && static_cast<SwVirtFlyDrawObj*>(pCandidate)->GetCurrentBoundRect().IsInside(rPt) ) { bRet = false; @@ -1225,9 +1225,9 @@ bool SwFEShell::ShouldObjectBeSelected(const Point& rPt) static bool lcl_IsControlGroup( const SdrObject *pObj ) { bool bRet = false; - if(pObj->ISA(SdrUnoObj)) + if(dynamic_cast<const SdrUnoObj*>( pObj) != nullptr) bRet = true; - else if( pObj->ISA( SdrObjGroup ) ) + else if( dynamic_cast<const SdrObjGroup*>( pObj) != nullptr ) { bRet = true; const SdrObjList *pLst = static_cast<const SdrObjGroup*>(pObj)->GetSubList(); @@ -1294,7 +1294,7 @@ const SdrObject* SwFEShell::GetBestObject( bool bNext, GotoObjFlags eType, bool if ( rMrkList.GetMarkCount() ) { const SdrObject* pStartObj = rMrkList.GetMark(0)->GetMarkedSdrObj(); - if( pStartObj->ISA(SwVirtFlyDrawObj) ) + if( dynamic_cast<const SwVirtFlyDrawObj*>( pStartObj) != nullptr ) aPos = static_cast<const SwVirtFlyDrawObj*>(pStartObj)->GetFlyFrm()->Frm().Pos(); else aPos = pStartObj->GetSnapRect().TopLeft(); @@ -1310,7 +1310,7 @@ const SdrObject* SwFEShell::GetBestObject( bool bNext, GotoObjFlags eType, bool // In this case we want to iterate over the group members. aPos = GetCharRect().Center(); const SdrObject* pStartObj = pPV ? pPV->GetAktGroup() : 0; - if ( pStartObj && pStartObj->ISA( SdrObjGroup ) ) + if ( pStartObj && dynamic_cast<const SdrObjGroup*>( pStartObj) != nullptr ) pList = pStartObj->GetSubList(); } @@ -1328,7 +1328,7 @@ const SdrObject* SwFEShell::GetBestObject( bool bNext, GotoObjFlags eType, bool while ( aObjIter.IsMore() ) { SdrObject* pObj = aObjIter.Next(); - bool bFlyFrm = pObj->ISA(SwVirtFlyDrawObj); + bool bFlyFrm = dynamic_cast<const SwVirtFlyDrawObj*>( pObj) != nullptr; if( ( bNoFly && bFlyFrm ) || ( bNoDraw && !bFlyFrm ) || ( eType == GotoObjFlags::DrawSimple && lcl_IsControlGroup( pObj ) ) || @@ -1378,7 +1378,7 @@ const SdrObject* SwFEShell::GetBestObject( bool bNext, GotoObjFlags eType, bool while ( aTmpIter.IsMore() ) { SdrObject* pTmpObj = aTmpIter.Next(); - bFlyFrm = pTmpObj->ISA(SwVirtFlyDrawObj); + bFlyFrm = dynamic_cast<const SwVirtFlyDrawObj*>( pTmpObj) != nullptr; if( ( bNoFly && bFlyFrm ) || ( bNoDraw && !bFlyFrm ) ) continue; if( bFlyFrm ) @@ -1442,7 +1442,7 @@ bool SwFEShell::GotoObj( bool bNext, GotoObjFlags eType ) if ( !pBest ) return false; - bool bFlyFrm = pBest->ISA(SwVirtFlyDrawObj); + bool bFlyFrm = dynamic_cast<const SwVirtFlyDrawObj*>( pBest) != nullptr; if( bFlyFrm ) { const SwVirtFlyDrawObj *pO = static_cast<const SwVirtFlyDrawObj*>(pBest); @@ -1586,7 +1586,7 @@ bool SwFEShell::ImpEndCreate() SwFormatAnchor aAnch; const SwFrm *pAnch = 0; bool bCharBound = false; - if( rSdrObj.ISA( SdrUnoObj ) ) + if( dynamic_cast<const SdrUnoObj*>( &rSdrObj) != nullptr ) { SwPosition aPos( GetDoc()->GetNodes() ); SwCrsrMoveState aState( MV_SETONLYTEXT ); @@ -1957,7 +1957,7 @@ bool SwFEShell::EndMark() for ( size_t i = 0; i < rMrkList.GetMarkCount(); ++i ) { SdrObject *pObj = rMrkList.GetMark( i )->GetMarkedSdrObj(); - if( pObj->ISA(SwVirtFlyDrawObj) ) + if( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) != nullptr ) { if ( !bShowHdl ) { @@ -2007,7 +2007,7 @@ short SwFEShell::GetAnchorId() const for ( size_t i = 0; i < rMrkList.GetMarkCount(); ++i ) { SdrObject *pObj = rMrkList.GetMark( i )->GetMarkedSdrObj(); - if ( pObj->ISA(SwVirtFlyDrawObj) ) + if ( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) != nullptr ) { nRet = -1; break; @@ -2178,7 +2178,7 @@ bool SwFEShell::IsGroupAllowed() const if ( bIsGroupAllowed ) { const SwFrm* pAnchorFrm = 0L; - if ( pObj->ISA(SwVirtFlyDrawObj) ) + if ( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) != nullptr ) { const SwFlyFrm* pFlyFrm = static_cast<const SwVirtFlyDrawObj*>(pObj)->GetFlyFrm(); @@ -2361,7 +2361,7 @@ FlyProtectFlags SwFEShell::IsSelObjProtected( FlyProtectFlags eType ) const nChk |= ( pObj->IsMoveProtect() ? FlyProtectFlags::Pos : FlyProtectFlags::NONE ) | ( pObj->IsResizeProtect()? FlyProtectFlags::Size : FlyProtectFlags::NONE ); - if( pObj->ISA(SwVirtFlyDrawObj) ) + if( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) != nullptr ) { SwFlyFrm *pFly = static_cast<SwVirtFlyDrawObj*>(pObj)->GetFlyFrm(); if ( (FlyProtectFlags::Content & eType) && pFly->GetFormat()->GetProtect().IsContentProtected() ) @@ -2395,7 +2395,7 @@ FlyProtectFlags SwFEShell::IsSelObjProtected( FlyProtectFlags eType ) const return eType; } const SwFrm* pAnch; - if( pObj->ISA(SwVirtFlyDrawObj) ) + if( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) != nullptr ) pAnch = static_cast<SwVirtFlyDrawObj*>( pObj )->GetFlyFrm()->GetAnchorFrm(); else { @@ -2572,7 +2572,7 @@ SwChainRet SwFEShell::Chainable( SwRect &rRect, const SwFrameFormat &rSource, const auto nOld = pDView->GetHitTolerancePixel(); pDView->SetHitTolerancePixel( 0 ); if( pDView->PickObj( rPt, pDView->getHitTolLog(), pObj, pPView, SdrSearchOptions::PICKMARKABLE ) && - pObj->ISA(SwVirtFlyDrawObj) ) + dynamic_cast<const SwVirtFlyDrawObj*>( pObj) != nullptr ) { SwFlyFrm *pFly = static_cast<SwVirtFlyDrawObj*>(pObj)->GetFlyFrm(); rRect = pFly->Frm(); @@ -2736,14 +2736,14 @@ long SwFEShell::GetSectionWidth( SwFormat const & rFormat ) const } pObj->SetLogicRect(aRect); - if(pObj->ISA(SdrCircObj)) + if(dynamic_cast<const SdrCircObj*>( pObj) != nullptr) { SfxItemSet aAttr(pDrawModel->GetItemPool()); aAttr.Put(makeSdrCircStartAngleItem(9000)); aAttr.Put(makeSdrCircEndAngleItem(0)); pObj->SetMergedItemSet(aAttr); } - else if(pObj->ISA(SdrPathObj)) + else if(dynamic_cast<const SdrPathObj*>( pObj) != nullptr) { basegfx::B2DPolyPolygon aPoly; @@ -2833,7 +2833,7 @@ long SwFEShell::GetSectionWidth( SwFormat const & rFormat ) const static_cast<SdrPathObj*>(pObj)->SetPathPoly(aPoly); } - else if(pObj->ISA(SdrCaptionObj)) + else if(dynamic_cast<const SdrCaptionObj*>( pObj) != nullptr) { bool bVerticalText = ( SID_DRAW_TEXT_VERTICAL == nSlotId || SID_DRAW_CAPTION_VERTICAL == nSlotId ); @@ -2850,7 +2850,7 @@ long SwFEShell::GetSectionWidth( SwFormat const & rFormat ) const static_cast<SdrCaptionObj*>(pObj)->SetTailPos( aRect.TopLeft() - Point(aRect.GetWidth() / 2, aRect.GetHeight() / 2)); } - else if(pObj->ISA(SdrTextObj)) + else if(dynamic_cast<const SdrTextObj*>( pObj) != nullptr) { SdrTextObj* pText = static_cast<SdrTextObj*>(pObj); pText->SetLogicRect(aRect); @@ -2914,8 +2914,8 @@ const Color SwFEShell::GetShapeBackgrd() const // get selected object const SdrObject *pSdrObj = pMrkList->GetMark( 0 )->GetMarkedSdrObj(); // check, if selected object is a shape (drawing object) - OSL_ENSURE( !pSdrObj->ISA(SwVirtFlyDrawObj), "wrong usage of SwFEShell::GetShapeBackgrd - selected object is not a drawing object!"); - if ( !pSdrObj->ISA(SwVirtFlyDrawObj) ) + OSL_ENSURE( dynamic_cast<const SwVirtFlyDrawObj*>( pSdrObj) == nullptr, "wrong usage of SwFEShell::GetShapeBackgrd - selected object is not a drawing object!"); + if ( dynamic_cast<const SwVirtFlyDrawObj*>( pSdrObj) == nullptr ) { // determine page frame of the frame the shape is anchored. const SwFrm* pAnchorFrm = @@ -2962,8 +2962,8 @@ bool SwFEShell::IsShapeDefaultHoriTextDirR2L() const // get selected object const SdrObject *pSdrObj = pMrkList->GetMark( 0 )->GetMarkedSdrObj(); // check, if selected object is a shape (drawing object) - OSL_ENSURE( !pSdrObj->ISA(SwVirtFlyDrawObj), "wrong usage of SwFEShell::GetShapeBackgrd - selected object is not a drawing object!"); - if ( !pSdrObj->ISA(SwVirtFlyDrawObj) ) + OSL_ENSURE( dynamic_cast<const SwVirtFlyDrawObj*>( pSdrObj) == nullptr, "wrong usage of SwFEShell::GetShapeBackgrd - selected object is not a drawing object!"); + if ( dynamic_cast<const SwVirtFlyDrawObj*>( pSdrObj) == nullptr ) { // determine page frame of the frame the shape is anchored. const SwFrm* pAnchorFrm = diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx index 8fcd6b3e5bc3..8a72d73b335a 100644 --- a/sw/source/core/frmedt/fetab.cxx +++ b/sw/source/core/frmedt/fetab.cxx @@ -184,7 +184,7 @@ bool SwFEShell::InsertRow( sal_uInt16 nCnt, bool bBehind ) if( !pFrm || !pFrm->IsInTab() ) return false; - if( pFrm->ImplFindTabFrm()->GetTable()->ISA( SwDDETable )) + if( dynamic_cast< const SwDDETable* >(pFrm->ImplFindTabFrm()->GetTable()) != nullptr ) { ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR, ERRCODE_MSG_INFO | ERRCODE_BUTTON_DEF_OK ); @@ -225,7 +225,7 @@ bool SwFEShell::InsertCol( sal_uInt16 nCnt, bool bBehind ) if( !pFrm || !pFrm->IsInTab() ) return false; - if( pFrm->ImplFindTabFrm()->GetTable()->ISA( SwDDETable )) + if( dynamic_cast< const SwDDETable* >(pFrm->ImplFindTabFrm()->GetTable()) != nullptr ) { ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR, ERRCODE_MSG_INFO | ERRCODE_BUTTON_DEF_OK ); @@ -280,7 +280,7 @@ bool SwFEShell::DeleteCol() if( !pFrm || !pFrm->IsInTab() ) return false; - if( pFrm->ImplFindTabFrm()->GetTable()->ISA( SwDDETable )) + if( dynamic_cast< const SwDDETable* >(pFrm->ImplFindTabFrm()->GetTable()) != nullptr ) { ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR, ERRCODE_MSG_INFO | ERRCODE_BUTTON_DEF_OK ); @@ -331,7 +331,7 @@ bool SwFEShell::DeleteRow(bool bCompleteTable) if( !pFrm || !pFrm->IsInTab() ) return false; - if( pFrm->ImplFindTabFrm()->GetTable()->ISA( SwDDETable )) + if( dynamic_cast< const SwDDETable* >(pFrm->ImplFindTabFrm()->GetTable()) != nullptr ) { ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR, ERRCODE_MSG_INFO | ERRCODE_BUTTON_DEF_OK ); @@ -450,7 +450,7 @@ sal_uInt16 SwFEShell::MergeTab() { SwShellTableCrsr* pTableCrsr = GetTableCrsr(); const SwTableNode* pTableNd = pTableCrsr->GetNode().FindTableNode(); - if( pTableNd->GetTable().ISA( SwDDETable )) + if( dynamic_cast< const SwDDETable* >(&pTableNd->GetTable()) != nullptr ) { ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR, ERRCODE_MSG_INFO | ERRCODE_BUTTON_DEF_OK ); @@ -481,7 +481,7 @@ bool SwFEShell::SplitTab( bool bVert, sal_uInt16 nCnt, bool bSameHeight ) if( !pFrm || !pFrm->IsInTab() ) return false; - if( pFrm->ImplFindTabFrm()->GetTable()->ISA( SwDDETable )) + if( dynamic_cast< const SwDDETable* >(pFrm->ImplFindTabFrm()->GetTable()) != nullptr ) { ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR, ERRCODE_MSG_INFO | ERRCODE_BUTTON_DEF_OK ); @@ -1271,7 +1271,7 @@ bool SwFEShell::DeleteTableSel() if( !pFrm || !pFrm->IsInTab() ) return false; - if( pFrm->ImplFindTabFrm()->GetTable()->ISA( SwDDETable )) + if( dynamic_cast< const SwDDETable* >(pFrm->ImplFindTabFrm()->GetTable()) != nullptr ) { ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR, ERRCODE_MSG_INFO | ERRCODE_BUTTON_DEF_OK ); @@ -1617,7 +1617,7 @@ const SwFrm* SwFEShell::GetBox( const Point &rPt, bool* pbRow, bool* pbCol ) con for ( size_t i = 0; !pFrm && i < pPage->GetSortedObjs()->size(); ++i ) { SwAnchoredObject* pObj = (*pPage->GetSortedObjs())[i]; - if ( pObj->ISA(SwFlyFrm) ) + if ( dynamic_cast<const SwFlyFrm*>( pObj) != nullptr ) { pFrm = lcl_FindFrm( static_cast<SwFlyFrm*>(pObj), rPt, nFuzzy, pbRow, pbCol ); @@ -2133,7 +2133,7 @@ bool SwFEShell::SetColRowWidthHeight( sal_uInt16 eType, sal_uInt16 nDiff ) return false; if( nsTableChgWidthHeightType::WH_FLAG_INSDEL & eType && - pFrm->ImplFindTabFrm()->GetTable()->ISA( SwDDETable )) + dynamic_cast< const SwDDETable* >(pFrm->ImplFindTabFrm()->GetTable()) != nullptr ) { ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR, ERRCODE_MSG_INFO | ERRCODE_BUTTON_DEF_OK ); diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx index 96a42a98cde3..acb70a299b8d 100644 --- a/sw/source/core/frmedt/fews.cxx +++ b/sw/source/core/frmedt/fews.cxx @@ -58,7 +58,7 @@ void SwFEShell::EndAllActionAndCall() { for(SwViewShell& rCurrentShell : GetRingContainer()) { - if( rCurrentShell.IsA( TYPE(SwCrsrShell) ) ) + if( dynamic_cast<const SwCrsrShell*>( &rCurrentShell) != nullptr ) { static_cast<SwFEShell*>(&rCurrentShell)->EndAction(); static_cast<SwFEShell*>(&rCurrentShell)->CallChgLnk(); @@ -444,8 +444,8 @@ void SwFEShell::InsertLabel( const SwLabelType eType, const OUString &rText, con while ( !aDrawObjs.empty() ) { SdrObject* pDrawObj = aDrawObjs.back(); - if ( !pDrawObj->ISA(SwVirtFlyDrawObj) && - !pDrawObj->ISA(SwFlyDrawObj) ) + if ( dynamic_cast<const SwVirtFlyDrawObj*>( pDrawObj) == nullptr && + dynamic_cast<const SwFlyDrawObj*>( pDrawObj) == nullptr ) { SwFlyFrameFormat *pFormat = GetDoc()->InsertDrawLabel( rText, rSeparator, rNumberSeparator, nId, rCharacterStyle, *pDrawObj ); @@ -1264,7 +1264,7 @@ bool SwFEShell::IsFrmVertical(const bool bEnvironment, bool& bRTL, bool& bVertL2 return bVert; } - if ( pObj->ISA(SwVirtFlyDrawObj) && !bEnvironment ) + if ( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) != nullptr && !bEnvironment ) pRef = static_cast<const SwVirtFlyDrawObj*>(pObj)->GetFlyFrm(); bVert = pRef->IsVertical(); diff --git a/sw/source/core/graphic/grfatr.cxx b/sw/source/core/graphic/grfatr.cxx index 8f8a577e2f76..855e9b7a9d79 100644 --- a/sw/source/core/graphic/grfatr.cxx +++ b/sw/source/core/graphic/grfatr.cxx @@ -263,7 +263,7 @@ SfxPoolItem* SwTransparencyGrf::Clone( SfxItemPool * ) const bool SwTransparencyGrf::QueryValue( uno::Any& rVal, sal_uInt8 ) const { - OSL_ENSURE(ISA(SfxByteItem),"Put/QueryValue should be removed!"); + OSL_ENSURE(dynamic_cast<const SfxByteItem*>( this ) != nullptr,"Put/QueryValue should be removed!"); sal_Int16 nRet = GetValue(); OSL_ENSURE( 0 <= nRet && nRet <= 100, "value out of range" ); rVal <<= nRet; @@ -274,7 +274,7 @@ bool SwTransparencyGrf::PutValue( const uno::Any& rVal, sal_uInt8 ) { //temporary conversion until this is a SfxInt16Item! - OSL_ENSURE(ISA(SfxByteItem),"Put/QueryValue should be removed!"); + OSL_ENSURE(dynamic_cast<const SfxByteItem*>( this ) != nullptr,"Put/QueryValue should be removed!"); sal_Int16 nVal = 0; if(!(rVal >>= nVal) || nVal < -100 || nVal > 100) return false; diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx index fb64e79d76aa..26488f426c5a 100644 --- a/sw/source/core/graphic/ndgrf.cxx +++ b/sw/source/core/graphic/ndgrf.cxx @@ -1071,7 +1071,7 @@ bool SwGrfNode::IsSelected() const const SwNode* pN = this; for(const SwViewShell& rCurrentShell : pESh->GetRingContainer()) { - if( rCurrentShell.ISA( SwEditShell ) && pN == &static_cast<const SwCrsrShell*>(&rCurrentShell) + if( dynamic_cast<const SwEditShell*>( &rCurrentShell) != nullptr && pN == &static_cast<const SwCrsrShell*>(&rCurrentShell) ->GetCrsr()->GetPoint()->nNode.GetNode() ) { bRet = true; diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx index e32e3577a62a..661c17365000 100644 --- a/sw/source/core/layout/anchoreddrawobject.cxx +++ b/sw/source/core/layout/anchoreddrawobject.cxx @@ -283,7 +283,7 @@ void SwAnchoredDrawObject::MakeObjPos() // attributes only for 'master' drawing objects // #i44334#, #i44681# - check, if positioning // attributes already have been set. - if ( !GetDrawObj()->ISA(SwDrawVirtObj) && + if ( dynamic_cast< const SwDrawVirtObj* >(GetDrawObj()) == nullptr && !static_cast<SwDrawFrameFormat&>(GetFrameFormat()).IsPosAttrSet() ) { _SetPositioningAttr(); @@ -338,7 +338,7 @@ void SwAnchoredDrawObject::MakeObjPos() // Assure for 'master' drawing object, that it's registered at the correct page. // Perform check not for as-character anchored drawing objects and only if // the anchor frame is valid. - if ( !GetDrawObj()->ISA(SwDrawVirtObj) && + if ( dynamic_cast< const SwDrawVirtObj* >(GetDrawObj()) == nullptr && !pDrawContact->ObjAnchoredAsChar() && GetAnchorFrm()->IsValid() ) { @@ -567,7 +567,7 @@ void SwAnchoredDrawObject::InvalidateObjPos() // anchored object, because its positioned by the format of its anchor frame. // --> #i44559# - assure, that text hint is already // existing in the text frame - if ( GetAnchorFrm()->ISA(SwTextFrm) && + if ( dynamic_cast< const SwTextFrm* >(GetAnchorFrm()) != nullptr && (GetFrameFormat().GetAnchor().GetAnchorId() == FLY_AS_CHAR) ) { SwTextFrm* pAnchorTextFrm( static_cast<SwTextFrm*>(AnchorFrm()) ); @@ -626,7 +626,7 @@ const SwRect SwAnchoredDrawObject::GetObjRect() const // --> #i70122# const SwRect SwAnchoredDrawObject::GetObjBoundRect() const { - bool bGroupShape = PTR_CAST(SdrObjGroup, GetDrawObj()); + bool bGroupShape = dynamic_cast<const SdrObjGroup*>( GetDrawObj() ); // Resize objects with relative width or height if ( !bGroupShape && GetPageFrm( ) && ( GetDrawObj( )->GetRelativeWidth( ) || GetDrawObj()->GetRelativeHeight( ) ) ) { diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index fe5adb9cc310..f86f0e1f6421 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -121,7 +121,7 @@ void DelHFFormat( SwClient *pToRemove, SwFrameFormat *pFormat ) // It's suboptimal if the format is deleted beforehand. SwIterator<SwClient,SwFrameFormat> aIter(*pFormat); for(SwClient* pLast = aIter.First(); bDel && pLast; pLast = aIter.Next()) - if(!pLast->IsA(TYPE(SwFrm)) || !SwXHeadFootText::IsXHeadFootText(pLast)) + if(dynamic_cast<const SwFrm*>( pLast ) == nullptr || !SwXHeadFootText::IsXHeadFootText(pLast)) bDel = false; } @@ -641,9 +641,9 @@ void SwFormatPageDesc::SwClientNotify( const SwModify& rModify, const SfxHint& r const SwModify* pMod = GetDefinedIn(); if ( pMod ) { - if( pMod->ISA( SwContentNode ) ) + if( dynamic_cast<const SwContentNode*>( pMod) != nullptr ) const_cast<SwContentNode*>(static_cast<const SwContentNode*>(pMod))->SetAttr( aDfltDesc ); - else if( pMod->ISA( SwFormat )) + else if( dynamic_cast<const SwFormat*>( pMod) != nullptr) const_cast<SwFormat*>(static_cast<const SwFormat*>(pMod))->SetFormatAttr( aDfltDesc ); else { @@ -673,14 +673,14 @@ void SwFormatPageDesc::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew case RES_OBJECTDYING: //The Pagedesc where I'm registered dies, therefore I unregister //from that format. During this I get deleted! - if( IS_TYPE( SwFormat, pDefinedIn )) + if( typeid(SwFormat) == typeid( pDefinedIn )) { bool const bResult = static_cast<SwFormat*>(pDefinedIn)->ResetFormatAttr(RES_PAGEDESC); OSL_ENSURE( bResult, "FormatPageDesc not deleted" ); (void) bResult; // unused in non-debug } - else if( IS_TYPE( SwContentNode, pDefinedIn )) + else if( typeid(SwContentNode) == typeid( pDefinedIn )) { bool const bResult = static_cast<SwContentNode*>(pDefinedIn) ->ResetAttr(RES_PAGEDESC); @@ -2663,7 +2663,7 @@ SwRect SwFrameFormat::FindLayoutRect( const bool bPrtArea, const Point* pPoint, { SwRect aRet; SwFrm *pFrm = 0; - if( ISA( SwSectionFormat ) ) + if( dynamic_cast<const SwSectionFormat*>( this ) != nullptr ) { // get the Frame using Node2Layout const SwSectionNode* pSectNd = static_cast<const SwSectionFormat*>(this)->GetSectionNode(); @@ -3003,7 +3003,7 @@ void SwFlyFrameFormat::MakeFrms() // #i28701# - consider changed type of // <SwSortedObjs> entries. SwAnchoredObject* pObj = rObjs[i]; - if( pObj->ISA(SwFlyFrm) && + if( dynamic_cast<const SwFlyFrm*>( pObj) != nullptr && (&pObj->GetFrameFormat()) == this ) { bAdd = false; diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index 0d9bbd2be6a1..1ceaf5594a9d 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -617,7 +617,7 @@ static void lcl_CheckObjects( SwSortedObjs* pSortedObjs, SwFrm* pFrm, long& rBot // entries. SwAnchoredObject* pObj = (*pSortedObjs)[i]; long nTmp = 0; - if ( pObj->ISA(SwFlyFrm) ) + if ( dynamic_cast<const SwFlyFrm*>( pObj) != nullptr ) { SwFlyFrm *pFly = static_cast<SwFlyFrm*>(pObj); if( pFly->Frm().Top() != FAR_AWAY && @@ -940,7 +940,7 @@ bool SwContentFrm::MakePrtArea( const SwBorderAttrs &rAttrs ) // <SwSortedObjs> entries SwAnchoredObject* pObj = (*GetDrawObjs())[i]; const SwFrameFormat& rFormat = pObj->GetFrameFormat(); - const bool bFly = pObj->ISA(SwFlyFrm); + const bool bFly = dynamic_cast<const SwFlyFrm*>( pObj) != nullptr; if ((bFly && (FAR_AWAY == pObj->GetObjRect().Width())) || rFormat.GetFrmSize().GetWidthPercent()) { diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index 2c009176fe3f..92fb9c3f493a 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -302,7 +302,7 @@ sal_uInt8 SwFlowFrm::BwdMoveNecessary( const SwPageFrm *pPage, const SwRect &rRe if( m_rThis.IsLayoutFrm() && //Fly Lower of This? Is_Lower_Of( &m_rThis, pObj->GetDrawObj() ) ) continue; - if( pObj->ISA(SwFlyFrm) ) + if( dynamic_cast<const SwFlyFrm*>( pObj) != nullptr ) { const SwFlyFrm *pFly = static_cast<const SwFlyFrm*>(pObj); if ( pFly->IsAnLower( &m_rThis ) )//This Lower of Fly? @@ -2361,7 +2361,7 @@ bool SwFlowFrm::MoveBwd( bool &rbReformat ) } pIndNext = pIndNext->GetIndNext(); } - OSL_ENSURE( !pIndNext || pIndNext->ISA(SwTextFrm), + OSL_ENSURE( !pIndNext || dynamic_cast<const SwTextFrm*>( pIndNext) != nullptr, "<SwFlowFrm::MovedBwd(..)> - incorrect next found." ); if ( pIndNext && pIndNext->IsFlowFrm() && SwFlowFrm::CastFlowFrm(pIndNext)->IsJoinLocked() ) diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index 877e618aa582..87c275d7fed4 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -303,15 +303,15 @@ void SwFlyFrm::DeleteCnt() while ( pFrm->GetDrawObjs() && pFrm->GetDrawObjs()->size() ) { SwAnchoredObject *pAnchoredObj = (*pFrm->GetDrawObjs())[0]; - if ( pAnchoredObj->ISA(SwFlyFrm) ) + if ( dynamic_cast<const SwFlyFrm*>( pAnchoredObj) != nullptr ) { SwFrm::DestroyFrm(static_cast<SwFlyFrm*>(pAnchoredObj)); } - else if ( pAnchoredObj->ISA(SwAnchoredDrawObject) ) + else if ( dynamic_cast<const SwAnchoredDrawObject*>( pAnchoredObj) != nullptr ) { // OD 23.06.2003 #108784# - consider 'virtual' drawing objects SdrObject* pObj = pAnchoredObj->DrawObj(); - if ( pObj->ISA(SwDrawVirtObj) ) + if ( dynamic_cast<const SwDrawVirtObj*>( pObj) != nullptr ) { SwDrawVirtObj* pDrawVirtObj = static_cast<SwDrawVirtObj*>(pObj); pDrawVirtObj->RemoveFromWriterLayout(); @@ -1302,7 +1302,7 @@ void SwFlyFrm::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderAtt { // This fly is a textbox of a draw shape. SdrObject* pShape = aShapes[GetFormat()]->FindSdrObject(); - if (SdrObjCustomShape* pCustomShape = PTR_CAST(SdrObjCustomShape, pShape)) + if (SdrObjCustomShape* pCustomShape = dynamic_cast<SdrObjCustomShape*>( pShape) ) { // The shape is a customshape: then inform it about the calculated fly size. Size aSize((Frm().*fnRect->fnGetWidth)(), (Frm().*fnRect->fnGetHeight)()); @@ -2083,13 +2083,13 @@ void SwFrm::AppendDrawObj( SwAnchoredObject& _rNewObj ) { assert(!mpDrawObjs || mpDrawObjs->is_sorted()); - if ( !_rNewObj.ISA(SwAnchoredDrawObject) ) + if ( dynamic_cast<const SwAnchoredDrawObject*>( &_rNewObj) == nullptr ) { OSL_FAIL( "SwFrm::AppendDrawObj(..) - anchored object of unexpected type -> object not appended" ); return; } - if ( !_rNewObj.GetDrawObj()->ISA(SwDrawVirtObj) && + if ( dynamic_cast<const SwDrawVirtObj*>(_rNewObj.GetDrawObj()) == nullptr && _rNewObj.GetAnchorFrm() && _rNewObj.GetAnchorFrm() != this ) { assert(!mpDrawObjs || mpDrawObjs->is_sorted()); @@ -2232,7 +2232,7 @@ void SwFrm::InvalidateObjs( const bool _bInvaPosOnly, pAnchoredObj->SetClearedEnvironment( false ); } // distinguish between writer fly frames and drawing objects - if ( pAnchoredObj->ISA(SwFlyFrm) ) + if ( dynamic_cast<const SwFlyFrm*>( pAnchoredObj) != nullptr ) { SwFlyFrm* pFly = static_cast<SwFlyFrm*>(pAnchoredObj); pFly->_Invalidate(); @@ -2270,7 +2270,7 @@ void SwLayoutFrm::NotifyLowerObjs( const bool _bUnlockPosOfObjs ) // for at-character/as-character anchored objects the anchor character // text frame is taken. const SwFrm* pAnchorFrm = pObj->GetAnchorFrmContainingAnchPos(); - if ( pObj->ISA(SwFlyFrm) ) + if ( dynamic_cast<const SwFlyFrm*>( pObj) != nullptr ) { SwFlyFrm* pFly = static_cast<SwFlyFrm*>(pObj); @@ -2302,7 +2302,7 @@ void SwLayoutFrm::NotifyLowerObjs( const bool _bUnlockPosOfObjs ) } else { - OSL_ENSURE( pObj->ISA(SwAnchoredDrawObject), + OSL_ENSURE( dynamic_cast<const SwAnchoredDrawObject*>( pObj) != nullptr, "<SwLayoutFrm::NotifyFlys() - anchored object of unexpected type" ); // #i26945# - use <pAnchorFrm> to check, if // fly frame is lower of layout frame resp. if fly frame is @@ -2703,7 +2703,7 @@ SwTwips SwFlyFrm::CalcContentHeight(const SwBorderAttrs *pAttrs, const SwTwips n for ( size_t i = 0; i < nCnt; ++i ) { SwAnchoredObject* pAnchoredObj = (*GetDrawObjs())[i]; - if ( pAnchoredObj->ISA(SwFlyFrm) ) + if ( dynamic_cast<const SwFlyFrm*>( pAnchoredObj) != nullptr ) { SwFlyFrm* pFly = static_cast<SwFlyFrm*>(pAnchoredObj); // OD 06.11.2003 #i22305# - consider diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx index 7b6727d1f01b..45b6a22171fd 100644 --- a/sw/source/core/layout/flylay.cxx +++ b/sw/source/core/layout/flylay.cxx @@ -622,14 +622,14 @@ void SwPageFrm::AppendFlyToPage( SwFlyFrm *pNew ) for ( size_t i = 0; i < rObjs.size(); ++i ) { SwAnchoredObject* pTmpObj = rObjs[i]; - if ( pTmpObj->ISA(SwFlyFrm) ) + if ( dynamic_cast<const SwFlyFrm*>( pTmpObj) != nullptr ) { SwFlyFrm* pTmpFly = static_cast<SwFlyFrm*>(pTmpObj); // #i28701# - use new method <GetPageFrm()> if ( pTmpFly->IsFlyFreeFrm() && !pTmpFly->GetPageFrm() ) AppendFlyToPage( pTmpFly ); } - else if ( pTmpObj->ISA(SwAnchoredDrawObject) ) + else if ( dynamic_cast<const SwAnchoredDrawObject*>( pTmpObj) != nullptr ) { // #i87493# if ( pTmpObj->GetPageFrm() != this ) @@ -770,7 +770,7 @@ void SwPageFrm::MoveFly( SwFlyFrm *pToMove, SwPageFrm *pDest ) for ( size_t i = 0; i < rObjs.size(); ++i ) { SwAnchoredObject* pObj = rObjs[i]; - if ( pObj->ISA(SwFlyFrm) ) + if ( dynamic_cast<const SwFlyFrm*>( pObj) != nullptr ) { SwFlyFrm* pFly = static_cast<SwFlyFrm*>(pObj); if ( pFly->IsFlyFreeFrm() ) @@ -783,7 +783,7 @@ void SwPageFrm::MoveFly( SwFlyFrm *pToMove, SwPageFrm *pDest ) pDest->AppendFlyToPage( pFly ); } } - else if ( pObj->ISA(SwAnchoredDrawObject) ) + else if ( dynamic_cast<const SwAnchoredDrawObject*>( pObj) != nullptr ) { RemoveDrawObjFromPage( *pObj ); pDest->AppendDrawObjToPage( *pObj ); @@ -794,7 +794,7 @@ void SwPageFrm::MoveFly( SwFlyFrm *pToMove, SwPageFrm *pDest ) void SwPageFrm::AppendDrawObjToPage( SwAnchoredObject& _rNewObj ) { - if ( !_rNewObj.ISA(SwAnchoredDrawObject) ) + if ( dynamic_cast<const SwAnchoredDrawObject*>( &_rNewObj) == nullptr ) { OSL_FAIL( "SwPageFrm::AppendDrawObjToPage(..) - anchored object of unexpected type -> object not appended" ); return; @@ -843,7 +843,7 @@ void SwPageFrm::AppendDrawObjToPage( SwAnchoredObject& _rNewObj ) void SwPageFrm::RemoveDrawObjFromPage( SwAnchoredObject& _rToRemoveObj ) { - if ( !_rToRemoveObj.ISA(SwAnchoredDrawObject) ) + if ( dynamic_cast<const SwAnchoredDrawObject*>( &_rToRemoveObj) == nullptr ) { OSL_FAIL( "SwPageFrm::RemoveDrawObjFromPage(..) - anchored object of unexpected type -> object not removed" ); return; @@ -910,7 +910,7 @@ void SwPageFrm::PlaceFly( SwFlyFrm* pFly, SwFlyFrameFormat* pFormat ) bool CalcClipRect( const SdrObject *pSdrObj, SwRect &rRect, bool bMove ) { bool bRet = true; - if ( pSdrObj->ISA(SwVirtFlyDrawObj) ) + if ( dynamic_cast<const SwVirtFlyDrawObj*>( pSdrObj) != nullptr ) { const SwFlyFrm* pFly = static_cast<const SwVirtFlyDrawObj*>(pSdrObj)->GetFlyFrm(); const bool bFollowTextFlow = pFly->GetFormat()->GetFollowTextFlow().GetValue(); diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index 3a5def1fdc3b..69fe058ba771 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -280,7 +280,7 @@ SwFrmNotify::~SwFrmNotify() // registered at the correct page frame, if frame // position has changed. if ( bAbsP && pContact->ObjAnchoredAtFly() && - pObj->ISA(SwFlyFrm) ) + dynamic_cast<const SwFlyFrm*>( pObj) != nullptr ) { // determine to-fly anchored Writer fly frame SwFlyFrm* pFlyFrm = static_cast<SwFlyFrm*>(pObj); @@ -340,7 +340,7 @@ SwFrmNotify::~SwFrmNotify() // perform notification via the corresponding invalidations if ( bNotify ) { - if ( pObj->ISA(SwFlyFrm) ) + if ( dynamic_cast<const SwFlyFrm*>( pObj) != nullptr ) { SwFlyFrm* pFlyFrm = static_cast<SwFlyFrm*>(pObj); if ( bNotifySize ) @@ -353,7 +353,7 @@ SwFrmNotify::~SwFrmNotify() } pFlyFrm->_Invalidate(); } - else if ( pObj->ISA(SwAnchoredDrawObject) ) + else if ( dynamic_cast<const SwAnchoredDrawObject*>( pObj) != nullptr ) { // #115759# - no invalidation of // position for as-character anchored objects. @@ -405,7 +405,7 @@ SwFrmNotify::~SwFrmNotify() // #i50668#, #i50998# - invalidation of position // of as-character anchored fly frames not needed and can cause // layout loops - if ( !pFly->ISA(SwFlyInCntFrm) ) + if ( dynamic_cast<const SwFlyInCntFrm*>( pFly) == nullptr ) { pFly->InvalidatePos(); } @@ -703,7 +703,7 @@ SwFlyNotify::~SwFlyNotify() // #i45180# - no adjustment of layout process flags and // further notifications/invalidations, if format is called by grow/shrink if ( pFly->ConsiderObjWrapInfluenceOnObjPos() && - ( !pFly->ISA(SwFlyFreeFrm) || + ( dynamic_cast<const SwFlyFreeFrm*>( pFly) == nullptr || !static_cast<SwFlyFreeFrm*>(pFly)->IsNoMoveOnCheckClip() ) ) { // #i54138# - suppress restart of the layout process @@ -862,7 +862,7 @@ SwContentNotify::~SwContentNotify() svt::EmbeddedObjectRef& xObj = pNd->GetOLEObj().GetObject(); SwFEShell *pFESh = 0; for(SwViewShell& rCurrentShell : pSh->GetRingContainer()) - { if ( rCurrentShell.ISA( SwCrsrShell ) ) + { if ( dynamic_cast<const SwCrsrShell*>( &rCurrentShell) != nullptr ) { pFESh = static_cast<SwFEShell*>(&rCurrentShell); // #108369#: Here used to be the condition if (!bFirst). @@ -1925,7 +1925,7 @@ static bool lcl_hasTabFrm(const SwTextFrm* pTextFrm) if (pSortedObjs->size() > 0) { SwAnchoredObject* pObject = (*pSortedObjs)[0]; - if (pObject->IsA(TYPE(SwFlyFrm))) + if (dynamic_cast<const SwFlyFrm*>(pObject) != nullptr) { SwFlyFrm* pFly = static_cast<SwFlyFrm*>(pObject); if (pFly->Lower() && pFly->Lower()->IsTabFrm()) @@ -2246,7 +2246,7 @@ const SdrObject *SwOrderIter::Top() for ( size_t i = 0; i < pObjs->size(); ++i ) { const SdrObject* pObj = (*pObjs)[i]->GetDrawObj(); - if ( bFlysOnly && !pObj->ISA(SwVirtFlyDrawObj) ) + if ( bFlysOnly && dynamic_cast<const SwVirtFlyDrawObj*>( pObj) == nullptr ) continue; sal_uInt32 nTmp = pObj->GetOrdNumDirect(); if ( nTmp >= nTopOrd ) @@ -2273,7 +2273,7 @@ const SdrObject *SwOrderIter::Bottom() for ( size_t i = 0; i < pObjs->size(); ++i ) { const SdrObject* pObj = (*pObjs)[i]->GetDrawObj(); - if ( bFlysOnly && !pObj->ISA(SwVirtFlyDrawObj) ) + if ( bFlysOnly && dynamic_cast<const SwVirtFlyDrawObj*>( pObj) == nullptr ) continue; sal_uInt32 nTmp = pObj->GetOrdNumDirect(); if ( nTmp < nBotOrd ) @@ -2301,7 +2301,7 @@ const SdrObject *SwOrderIter::Next() for ( size_t i = 0; i < pObjs->size(); ++i ) { const SdrObject* pObj = (*pObjs)[i]->GetDrawObj(); - if ( bFlysOnly && !pObj->ISA(SwVirtFlyDrawObj) ) + if ( bFlysOnly && dynamic_cast<const SwVirtFlyDrawObj*>( pObj) == nullptr ) continue; sal_uInt32 nTmp = pObj->GetOrdNumDirect(); if ( nTmp > nCurOrd && nTmp < nOrd ) @@ -2329,7 +2329,7 @@ const SdrObject *SwOrderIter::Prev() for ( size_t i = 0; i < pObjs->size(); ++i ) { const SdrObject* pObj = (*pObjs)[i]->GetDrawObj(); - if ( bFlysOnly && !pObj->ISA(SwVirtFlyDrawObj) ) + if ( bFlysOnly && dynamic_cast<const SwVirtFlyDrawObj*>( pObj) == nullptr ) continue; sal_uInt32 nTmp = pObj->GetOrdNumDirect(); if ( nTmp < nCurOrd && nTmp >= nOrd ) @@ -2367,7 +2367,7 @@ static void lcl_RemoveObjsFromPage( SwFrm* _pFrm ) pObj->ResetLayoutProcessBools(); // #115759# - remove also lower objects of as-character // anchored Writer fly frames from page - if ( pObj->ISA(SwFlyFrm) ) + if ( dynamic_cast<const SwFlyFrm*>( pObj) != nullptr ) { SwFlyFrm* pFlyFrm = static_cast<SwFlyFrm*>(pObj); @@ -2392,7 +2392,7 @@ static void lcl_RemoveObjsFromPage( SwFrm* _pFrm ) } } // #115759# - remove also drawing objects from page - else if ( pObj->ISA(SwAnchoredDrawObject) ) + else if ( dynamic_cast<const SwAnchoredDrawObject*>( pObj) != nullptr ) { if (pObj->GetFrameFormat().GetAnchor().GetAnchorId() != FLY_AS_CHAR) { @@ -2529,10 +2529,10 @@ static void lcl_AddObjsToPage( SwFrm* _pFrm, SwPageFrm* _pPage ) pObj->UnlockPosition(); // #115759# - add also lower objects of as-character // anchored Writer fly frames from page - if ( pObj->ISA(SwFlyFrm) ) + if ( dynamic_cast<const SwFlyFrm*>( pObj) != nullptr ) { SwFlyFrm* pFlyFrm = static_cast<SwFlyFrm*>(pObj); - if ( pObj->ISA(SwFlyFreeFrm) ) + if ( dynamic_cast<const SwFlyFreeFrm*>( pObj) != nullptr ) { _pPage->AppendFlyToPage( pFlyFrm ); } @@ -2556,7 +2556,7 @@ static void lcl_AddObjsToPage( SwFrm* _pFrm, SwPageFrm* _pPage ) } } // #115759# - remove also drawing objects from page - else if ( pObj->ISA(SwAnchoredDrawObject) ) + else if ( dynamic_cast<const SwAnchoredDrawObject*>( pObj) != nullptr ) { if (pObj->GetFrameFormat().GetAnchor().GetAnchorId() != FLY_AS_CHAR) { @@ -2718,7 +2718,7 @@ static void lcl_Regist( SwPageFrm *pPage, const SwFrm *pAnch ) for ( size_t i = 0; i < pObjs->size(); ++i ) { SwAnchoredObject* pObj = (*pObjs)[i]; - if ( pObj->ISA(SwFlyFrm) ) + if ( dynamic_cast<const SwFlyFrm*>( pObj) != nullptr ) { SwFlyFrm *pFly = static_cast<SwFlyFrm*>(pObj); // register (not if already known) @@ -2892,7 +2892,7 @@ static void lcl_NotifyContent( const SdrObject *pThis, SwContentFrm *pCnt, for ( size_t i = 0; i < rObjs.size(); ++i ) { SwAnchoredObject* pObj = rObjs[i]; - if ( pObj->ISA(SwFlyFrm) ) + if ( dynamic_cast<const SwFlyFrm*>( pObj) != nullptr ) { SwFlyFrm *pFly = static_cast<SwFlyFrm*>(pObj); if ( pFly->IsFlyInCntFrm() ) @@ -2923,7 +2923,7 @@ void Notify_Background( const SdrObject* pObj, SwLayoutFrm* pArea; SwFlyFrm *pFlyFrm = 0; SwFrm* pAnchor; - if( pObj->ISA(SwVirtFlyDrawObj) ) + if( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) != nullptr ) { pFlyFrm = const_cast<SwVirtFlyDrawObj*>(static_cast<const SwVirtFlyDrawObj*>(pObj))->GetFlyFrm(); pAnchor = pFlyFrm->AnchorFrm(); @@ -3003,7 +3003,7 @@ void Notify_Background( const SdrObject* pObj, for ( size_t i = 0; i < rObjs.size(); ++i ) { SwAnchoredObject* pAnchoredObj = rObjs[i]; - if ( pAnchoredObj->ISA(SwFlyFrm) ) + if ( dynamic_cast<const SwFlyFrm*>( pAnchoredObj) != nullptr ) { if( pAnchoredObj->GetDrawObj() == pObj ) continue; @@ -3102,7 +3102,7 @@ bool Is_Lower_Of( const SwFrm *pCurrFrm, const SdrObject* pObj ) { Point aPos; const SwFrm* pFrm; - if( pObj->ISA(SwVirtFlyDrawObj) ) + if( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) != nullptr ) { const SwFlyFrm* pFly = static_cast<const SwVirtFlyDrawObj*>(pObj )->GetFlyFrm(); pFrm = pFly->GetAnchorFrm(); diff --git a/sw/source/core/layout/hffrm.cxx b/sw/source/core/layout/hffrm.cxx index 0929c1eef09a..a18923837023 100644 --- a/sw/source/core/layout/hffrm.cxx +++ b/sw/source/core/layout/hffrm.cxx @@ -649,7 +649,7 @@ void DelFlys( SwLayoutFrm *pFrm, SwPageFrm *pPage ) i < pPage->GetSortedObjs()->size() ) { SwAnchoredObject* pObj = (*pPage->GetSortedObjs())[i]; - if ( pObj->ISA(SwFlyFrm) ) + if ( dynamic_cast< const SwFlyFrm *>( pObj ) != nullptr ) { SwFlyFrm* pFlyFrm = static_cast<SwFlyFrm*>(pObj); if ( pFrm->IsAnLower( pFlyFrm ) ) diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index 8dfbcbcd3308..f1e81ccca369 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -120,7 +120,7 @@ bool SwLayAction::PaintWithoutFlys( const SwRect &rRect, const SwContentFrm *pCn for ( size_t i = 0; i < rObjs.size() && !aTmp.empty(); ++i ) { SdrObject *pO = rObjs[i]->DrawObj(); - if ( !pO->ISA(SwVirtFlyDrawObj) ) + if ( dynamic_cast< const SwVirtFlyDrawObj *>( pO ) == nullptr ) continue; // OD 2004-01-15 #110582# - do not consider invisible objects @@ -914,7 +914,7 @@ static const SwFrm *lcl_FindFirstInvaContent( const SwLayoutFrm *pLay, long nBot for ( size_t i = 0; i < rObjs.size(); ++i ) { const SwAnchoredObject* pObj = rObjs[i]; - if ( pObj->ISA(SwFlyFrm) ) + if ( dynamic_cast< const SwFlyFrm *>( pObj ) != nullptr ) { const SwFlyFrm* pFly = static_cast<const SwFlyFrm*>(pObj); if ( pFly->IsFlyInCntFrm() ) @@ -950,7 +950,7 @@ static const SwAnchoredObject* lcl_FindFirstInvaObj( const SwPageFrm* _pPage, for ( size_t i = 0; i < _pPage->GetSortedObjs()->size(); ++i ) { const SwAnchoredObject* pObj = (*_pPage->GetSortedObjs())[i]; - if ( pObj->ISA(SwFlyFrm) ) + if ( dynamic_cast< const SwFlyFrm *>( pObj ) != nullptr ) { const SwFlyFrm* pFly = static_cast<const SwFlyFrm*>(pObj); if ( pFly->Frm().Top() <= _nBottom ) @@ -964,7 +964,7 @@ static const SwAnchoredObject* lcl_FindFirstInvaObj( const SwPageFrm* _pPage, return pFly; } } - else if ( pObj->ISA(SwAnchoredDrawObject) ) + else if ( dynamic_cast< const SwAnchoredDrawObject *>( pObj ) != nullptr ) { if ( !static_cast<const SwAnchoredDrawObject*>(pObj)->IsValidPos() ) { @@ -1903,7 +1903,7 @@ bool SwLayIdle::_DoIdleJob( const SwContentFrm *pCnt, IdleJobType eJob ) if( COMPLETE_STRING == nTextPos ) { --nTextPos; - if( pSh->ISA(SwCrsrShell) && !static_cast<SwCrsrShell*>(pSh)->IsTableMode() ) + if( dynamic_cast< const SwCrsrShell *>( pSh ) != nullptr && !static_cast<SwCrsrShell*>(pSh)->IsTableMode() ) { SwPaM *pCrsr = static_cast<SwCrsrShell*>(pSh)->GetCrsr(); if( !pCrsr->HasMark() && !pCrsr->IsMultiSelection() ) @@ -1972,7 +1972,7 @@ bool SwLayIdle::_DoIdleJob( const SwContentFrm *pCnt, IdleJobType eJob ) for ( size_t i = 0; i < rObjs.size(); ++i ) { SwAnchoredObject* pObj = rObjs[i]; - if ( pObj->ISA(SwFlyFrm) ) + if ( dynamic_cast< const SwFlyFrm *>( pObj ) != nullptr ) { SwFlyFrm* pFly = static_cast<SwFlyFrm*>(pObj); if ( pFly->IsFlyInCntFrm() ) @@ -2051,7 +2051,7 @@ bool SwLayIdle::DoIdleJob( IdleJobType eJob, bool bVisAreaOnly ) i < pPage->GetSortedObjs()->size(); ++i ) { const SwAnchoredObject* pObj = (*pPage->GetSortedObjs())[i]; - if ( pObj->ISA(SwFlyFrm) ) + if ( dynamic_cast< const SwFlyFrm *>( pObj ) != nullptr ) { const SwFlyFrm *pFly = static_cast<const SwFlyFrm*>(pObj); const SwContentFrm *pC = pFly->ContainsContent(); @@ -2143,7 +2143,7 @@ SwLayIdle::SwLayIdle( SwRootFrm *pRt, SwViewShellImp *pI ) : { ++rSh.mnStartAction; bool bVis = false; - if ( rSh.ISA(SwCrsrShell) ) + if ( dynamic_cast<const SwCrsrShell*>( &rSh) != nullptr ) { bVis = static_cast<SwCrsrShell*>(&rSh)->GetCharRect().IsOver(rSh.VisArea()); } @@ -2182,7 +2182,7 @@ SwLayIdle::SwLayIdle( SwRootFrm *pRt, SwViewShellImp *pI ) : // aBools[ i ] is true, if the i-th shell is a cursor shell (!!!) // and the cursor is visible. bActions |= aTmp != rSh.VisArea(); - if ( aTmp == rSh.VisArea() && rSh.ISA(SwCrsrShell) ) + if ( aTmp == rSh.VisArea() && dynamic_cast<const SwCrsrShell*>( &rSh) != nullptr ) { bActions |= aBools[nBoolIdx] != static_cast<SwCrsrShell*>(&rSh)->GetCharRect().IsOver( rSh.VisArea() ); @@ -2200,7 +2200,7 @@ SwLayIdle::SwLayIdle( SwRootFrm *pRt, SwViewShellImp *pI ) : for(SwViewShell& rSh : pImp->GetShell()->GetRingContainer()) { SwCrsrShell* pCrsrShell = nullptr; - if(rSh.IsA( TYPE(SwCrsrShell) )) + if(dynamic_cast<const SwCrsrShell*>( &rSh) != nullptr) pCrsrShell = static_cast<SwCrsrShell*>(&rSh); if ( pCrsrShell ) diff --git a/sw/source/core/layout/laycache.cxx b/sw/source/core/layout/laycache.cxx index 889edfe798bd..acfdc0e475b7 100644 --- a/sw/source/core/layout/laycache.cxx +++ b/sw/source/core/layout/laycache.cxx @@ -278,7 +278,7 @@ void SwLayoutCache::Write( SvStream &rStream, const SwDoc& rDoc ) for ( size_t i = 0; i < rObjs.size(); ++i ) { SwAnchoredObject* pAnchoredObj = rObjs[i]; - if ( pAnchoredObj->ISA(SwFlyFrm) ) + if ( dynamic_cast< const SwFlyFrm *>( pAnchoredObj ) != nullptr ) { SwFlyFrm *pFly = static_cast<SwFlyFrm*>(pAnchoredObj); if( pFly->Frm().Left() != FAR_AWAY && @@ -943,7 +943,7 @@ void SwLayHelper::_CheckFlyCache( SwPageFrm* pPage ) for ( size_t i = 0; i < rObjs.size(); ++i ) { SwAnchoredObject* pAnchoredObj = rObjs[i]; - if ( pAnchoredObj->ISA(SwFlyFrm) ) // a text frame? + if ( dynamic_cast< const SwFlyFrm *>( pAnchoredObj ) != nullptr ) // a text frame? { SwFlyFrm *pFly = static_cast<SwFlyFrm*>(pAnchoredObj); if( pFly->GetAnchorFrm() && diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx index 8eee3606a721..5a703f9d6173 100644 --- a/sw/source/core/layout/newfrm.cxx +++ b/sw/source/core/layout/newfrm.cxx @@ -623,7 +623,7 @@ void SwRootFrm::RemoveMasterObjs( SdrPage *pPg ) for( size_t i = pPg ? pPg->GetObjCount() : 0; i; ) { SdrObject* pObj = pPg->GetObj( --i ); - if( pObj->ISA(SwFlyDrawObj ) ) + if( dynamic_cast< const SwFlyDrawObj *>( pObj ) != nullptr ) pPg->RemoveObject( i ); } } diff --git a/sw/source/core/layout/objectformatter.cxx b/sw/source/core/layout/objectformatter.cxx index a2d2fdeb880c..4419d40e031c 100644 --- a/sw/source/core/layout/objectformatter.cxx +++ b/sw/source/core/layout/objectformatter.cxx @@ -260,7 +260,7 @@ void SwObjectFormatter::_FormatLayout( SwLayoutFrm& _rLayoutFrm ) */ void SwObjectFormatter::_FormatObjContent( SwAnchoredObject& _rAnchoredObj ) { - if ( !_rAnchoredObj.ISA(SwFlyFrm) ) + if ( dynamic_cast<const SwFlyFrm*>( &_rAnchoredObj) == nullptr ) { // only Writer fly frames have content return; @@ -312,7 +312,7 @@ void SwObjectFormatter::_FormatObj( SwAnchoredObject& _rAnchoredObj ) mpPgNumAndTypeOfAnchors->Collect( _rAnchoredObj ); } - if ( _rAnchoredObj.ISA(SwFlyFrm) ) + if ( dynamic_cast<const SwFlyFrm*>( &_rAnchoredObj) != nullptr ) { SwFlyFrm& rFlyFrm = static_cast<SwFlyFrm&>(_rAnchoredObj); // --> #i34753# - reset flag, which prevents a positioning @@ -379,7 +379,7 @@ void SwObjectFormatter::_FormatObj( SwAnchoredObject& _rAnchoredObj ) !_rAnchoredObj.RestartLayoutProcess() && rFlyFrm.GetAnchorFrm() == &GetAnchorFrm() ); } - else if ( _rAnchoredObj.ISA(SwAnchoredDrawObject) ) + else if ( dynamic_cast<const SwAnchoredDrawObject*>( &_rAnchoredObj) != nullptr ) { _rAnchoredObj.MakeObjPos(); } diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index 993f2a6f2ea5..45196fd40632 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -401,7 +401,7 @@ static void lcl_MakeObjs( const SwFrameFormats &rTable, SwPageFrm *pPage ) // OD 23.06.2003 #108784# - consider 'virtual' drawing objects SwDrawContact *pContact = static_cast<SwDrawContact*>(::GetUserCall(pSdrObj)); - if ( pSdrObj->ISA(SwDrawVirtObj) ) + if ( dynamic_cast< const SwDrawVirtObj *>( pSdrObj ) != nullptr ) { SwDrawVirtObj* pDrawVirtObj = static_cast<SwDrawVirtObj*>(pSdrObj); if ( pContact ) @@ -812,7 +812,7 @@ void SwPageFrm::Cut() // #i28701# SwAnchoredObject* pAnchoredObj = (*GetSortedObjs())[i]; - if ( pAnchoredObj->ISA(SwFlyAtCntFrm) ) + if ( dynamic_cast< const SwFlyAtCntFrm *>( pAnchoredObj ) != nullptr ) { SwFlyFrm* pFly = static_cast<SwFlyAtCntFrm*>(pAnchoredObj); SwPageFrm *pAnchPage = pFly->GetAnchorFrm() ? @@ -910,7 +910,7 @@ static void lcl_PrepFlyInCntRegister( SwContentFrm *pFrm ) { // #i28701# SwAnchoredObject* pAnchoredObj = (*pFrm->GetDrawObjs())[i]; - if ( pAnchoredObj->ISA(SwFlyInCntFrm) ) + if ( dynamic_cast< const SwFlyInCntFrm *>( pAnchoredObj ) != nullptr ) { SwFlyFrm* pFly = static_cast<SwFlyInCntFrm*>(pAnchoredObj); SwContentFrm *pCnt = pFly->ContainsContent(); @@ -940,7 +940,7 @@ void SwPageFrm::PrepareRegisterChg() { // #i28701# SwAnchoredObject* pAnchoredObj = (*GetSortedObjs())[i]; - if ( pAnchoredObj->ISA(SwFlyFrm) ) + if ( dynamic_cast< const SwFlyFrm *>( pAnchoredObj ) != nullptr ) { SwFlyFrm *pFly = static_cast<SwFlyFrm*>(pAnchoredObj); pFrm = pFly->ContainsContent(); @@ -1611,7 +1611,7 @@ void SwRootFrm::ImplCalcBrowseWidth() // #i28701# SwAnchoredObject* pAnchoredObj = (*pFrm->GetDrawObjs())[i]; const SwFrameFormat& rFormat = pAnchoredObj->GetFrameFormat(); - const bool bFly = pAnchoredObj->ISA(SwFlyFrm); + const bool bFly = dynamic_cast< const SwFlyFrm *>( pAnchoredObj ) != nullptr; if ((bFly && (FAR_AWAY == pAnchoredObj->GetObjRect().Width())) || rFormat.GetFrmSize().GetWidthPercent()) { @@ -1671,7 +1671,7 @@ void SwRootFrm::StartAllAction() if ( GetCurrShell() ) for(SwViewShell& rSh : GetCurrShell()->GetRingContainer()) { - if ( rSh.ISA( SwCrsrShell ) ) + if ( dynamic_cast<const SwCrsrShell*>( &rSh) != nullptr ) static_cast<SwCrsrShell*>(&rSh)->StartAction(); else rSh.StartAction(); @@ -1685,11 +1685,11 @@ void SwRootFrm::EndAllAction( bool bVirDev ) { const bool bOldEndActionByVirDev = rSh.IsEndActionByVirDev(); rSh.SetEndActionByVirDev( bVirDev ); - if ( rSh.ISA( SwCrsrShell ) ) + if ( dynamic_cast<const SwCrsrShell*>( &rSh) != nullptr ) { static_cast<SwCrsrShell*>(&rSh)->EndAction(); static_cast<SwCrsrShell*>(&rSh)->CallChgLnk(); - if ( rSh.ISA( SwFEShell ) ) + if ( dynamic_cast<const SwFEShell*>( &rSh) != nullptr ) static_cast<SwFEShell*>(&rSh)->SetChainMarker(); } else @@ -1709,8 +1709,8 @@ void SwRootFrm::UnoRemoveAllActions() if ( !rSh.IsInEndAction() ) { OSL_ENSURE(!rSh.GetRestoreActions(), "Restore action count is already set!"); - bool bCrsr = rSh.ISA( SwCrsrShell ); - bool bFE = rSh.ISA( SwFEShell ); + bool bCrsr = dynamic_cast<const SwCrsrShell*>( &rSh) != nullptr; + bool bFE = dynamic_cast<const SwFEShell*>( &rSh) != nullptr; sal_uInt16 nRestore = 0; while( rSh.ActionCount() ) { @@ -1739,7 +1739,7 @@ void SwRootFrm::UnoRestoreAllActions() sal_uInt16 nActions = rSh.GetRestoreActions(); while( nActions-- ) { - if ( rSh.ISA( SwCrsrShell ) ) + if ( dynamic_cast<const SwCrsrShell*>( &rSh) != nullptr ) static_cast<SwCrsrShell*>(&rSh)->StartAction(); else rSh.StartAction(); @@ -1777,7 +1777,7 @@ static void lcl_MoveAllLowerObjs( SwFrm* pFrm, const Point& rOffset ) SwObjPositioningInProgress aPosInProgress( *pAnchoredObj ); - if ( pAnchoredObj->ISA(SwFlyFrm) ) + if ( dynamic_cast< const SwFlyFrm *>( pAnchoredObj ) != nullptr ) { SwFlyFrm* pFlyFrm( static_cast<SwFlyFrm*>(pAnchoredObj) ); lcl_MoveAllLowers( pFlyFrm, rOffset ); @@ -1810,7 +1810,7 @@ static void lcl_MoveAllLowerObjs( SwFrm* pFrm, const Point& rOffset ) } } } - else if ( pAnchoredObj->ISA(SwAnchoredDrawObject) ) + else if ( dynamic_cast< const SwAnchoredDrawObject *>( pAnchoredObj ) != nullptr ) { SwAnchoredDrawObject* pAnchoredDrawObj( static_cast<SwAnchoredDrawObject*>(pAnchoredObj) ); @@ -1860,7 +1860,7 @@ static void lcl_MoveAllLowers( SwFrm* pFrm, const Point& rOffset ) lcl_MoveAllLowerObjs( pFrm, rOffset ); // finally, for layout frames we have to call this function recursively: - if ( pFrm->ISA(SwLayoutFrm) ) + if ( dynamic_cast< const SwLayoutFrm *>( pFrm ) != nullptr ) { SwFrm* pLowerFrm = pFrm->GetLower(); while ( pLowerFrm ) diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index a85918a1a384..661709877981 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -1560,7 +1560,7 @@ static void lcl_SubtractFlys( const SwFrm *pFrm, const SwPageFrm *pPage, if (!pPage->GetFormat()->GetDoc()->getIDocumentDrawModelAccess().IsVisibleLayerId(pSdrObj->GetLayer())) continue; - if (!pAnchoredObj->ISA(SwFlyFrm)) + if (dynamic_cast< const SwFlyFrm *>( pAnchoredObj ) == nullptr) continue; const SwFlyFrm *pFly = static_cast<const SwFlyFrm*>(pAnchoredObj); @@ -4023,11 +4023,11 @@ bool SwFlyFrm::IsPaint( SdrObject *pObj, const SwViewShell *pSh ) { //The paint may be prevented by the superior Flys. SwFrm *pAnch = 0; - if ( pObj->ISA(SwFlyDrawObj) ) // i#117962# + if ( dynamic_cast< const SwFlyDrawObj *>( pObj ) != nullptr ) // i#117962# { bPaint = false; } - if ( pObj->ISA(SwVirtFlyDrawObj) ) + if ( dynamic_cast< const SwVirtFlyDrawObj *>( pObj ) != nullptr ) { SwFlyFrm *pFly = static_cast<SwVirtFlyDrawObj*>(pObj)->GetFlyFrm(); if ( gProp.pSFlyOnlyDraw && gProp.pSFlyOnlyDraw == pFly ) @@ -4070,7 +4070,7 @@ bool SwFlyFrm::IsPaint( SdrObject *pObj, const SwViewShell *pSh ) else { // OD 02.07.2003 #108784# - debug assert - if ( !pObj->ISA(SdrObjGroup) ) + if ( dynamic_cast< const SdrObjGroup *>( pObj ) == nullptr ) { OSL_FAIL( "<SwFlyFrm::IsPaint(..)> - paint of drawing object without anchor frame!?" ); } @@ -6765,7 +6765,7 @@ void SwLayoutFrm::RefreshLaySubsidiary( const SwPageFrm *pPage, const SwAnchoredObject* pAnchoredObj = rObjs[i]; if ( pPage->GetFormat()->GetDoc()->getIDocumentDrawModelAccess().IsVisibleLayerId( pAnchoredObj->GetDrawObj()->GetLayer() ) && - pAnchoredObj->ISA(SwFlyFrm) ) + dynamic_cast< const SwFlyFrm *>( pAnchoredObj ) != nullptr ) { const SwFlyFrm *pFly = static_cast<const SwFlyFrm*>(pAnchoredObj); @@ -7245,7 +7245,7 @@ void SwPageFrm::RefreshExtraData( const SwRect &rRect ) const for ( size_t i = 0; i < GetSortedObjs()->size(); ++i ) { const SwAnchoredObject* pAnchoredObj = (*GetSortedObjs())[i]; - if ( pAnchoredObj->ISA(SwFlyFrm) ) + if ( dynamic_cast< const SwFlyFrm *>( pAnchoredObj ) != nullptr ) { const SwFlyFrm *pFly = static_cast<const SwFlyFrm*>(pAnchoredObj); if ( pFly->Frm().Top() <= aRect.Bottom() && @@ -7280,7 +7280,7 @@ void SwLayoutFrm::RefreshExtraData( const SwRect &rRect ) const for ( size_t i = 0; i < pCnt->GetDrawObjs()->size(); ++i ) { const SwAnchoredObject* pAnchoredObj = (*pCnt->GetDrawObjs())[i]; - if ( pAnchoredObj->ISA(SwFlyFrm) ) + if ( dynamic_cast< const SwFlyFrm *>( pAnchoredObj ) != nullptr ) { const SwFlyFrm *pFly = static_cast<const SwFlyFrm*>(pAnchoredObj); if ( pFly->IsFlyInCntFrm() && diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx index 5f71d85f2806..0147d1be463b 100644 --- a/sw/source/core/layout/sectfrm.cxx +++ b/sw/source/core/layout/sectfrm.cxx @@ -759,7 +759,7 @@ const SwSectionFormat* SwSectionFrm::_GetEndSectFormat() const const SwSectionFormat *pFormat = pSection->GetFormat(); while( !pFormat->GetEndAtTextEnd().IsAtEnd() ) { - if( pFormat->GetRegisteredIn()->ISA( SwSectionFormat ) ) + if( dynamic_cast< const SwSectionFormat *>( pFormat->GetRegisteredIn()) != nullptr ) pFormat = static_cast<const SwSectionFormat*>(pFormat->GetRegisteredIn()); else return NULL; @@ -2208,7 +2208,7 @@ bool SwSectionFrm::IsDescendantFrom( const SwSectionFormat* pFormat ) const const SwSectionFormat *pMyFormat = pSection->GetFormat(); while( pFormat != pMyFormat ) { - if( pMyFormat->GetRegisteredIn()->ISA( SwSectionFormat ) ) + if( dynamic_cast< const SwSectionFormat *>( pMyFormat->GetRegisteredIn()) != nullptr ) pMyFormat = static_cast<const SwSectionFormat*>(pMyFormat->GetRegisteredIn()); else return false; @@ -2225,7 +2225,7 @@ void SwSectionFrm::CalcFootnoteAtEndFlag() FTNEND_ATTXTEND_OWNNUMANDFMT == nVal; while( !bFootnoteAtEnd && !bOwnFootnoteNum ) { - if( pFormat->GetRegisteredIn()->ISA( SwSectionFormat ) ) + if( dynamic_cast< const SwSectionFormat *>( pFormat->GetRegisteredIn()) != nullptr ) pFormat = static_cast<SwSectionFormat*>(pFormat->GetRegisteredIn()); else break; @@ -2250,7 +2250,7 @@ void SwSectionFrm::CalcEndAtEndFlag() bEndnAtEnd = pFormat->GetEndAtTextEnd( false ).IsAtEnd(); while( !bEndnAtEnd ) { - if( pFormat->GetRegisteredIn()->ISA( SwSectionFormat ) ) + if( dynamic_cast< const SwSectionFormat *>( pFormat->GetRegisteredIn()) != nullptr ) pFormat = static_cast<SwSectionFormat*>(pFormat->GetRegisteredIn()); else break; diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx index f7379a7b6fce..4f06a3824867 100644 --- a/sw/source/core/layout/ssfrm.cxx +++ b/sw/source/core/layout/ssfrm.cxx @@ -266,7 +266,7 @@ void SwFrm::CheckDirChange() for ( size_t i = 0; i < nCnt; ++i ) { SwAnchoredObject* pAnchoredObj = (*pObjs)[i]; - if( pAnchoredObj->ISA(SwFlyFrm) ) + if( dynamic_cast< const SwFlyFrm *>( pAnchoredObj ) != nullptr ) static_cast<SwFlyFrm*>(pAnchoredObj)->CheckDirChange(); else { @@ -349,7 +349,7 @@ void SwFrm::DestroyImpl() for ( size_t i = mpDrawObjs->size(); i; ) { SwAnchoredObject* pAnchoredObj = (*mpDrawObjs)[--i]; - if ( pAnchoredObj->ISA(SwFlyFrm) ) + if ( dynamic_cast< const SwFlyFrm *>( pAnchoredObj ) != nullptr ) { SwFrm::DestroyFrm(static_cast<SwFlyFrm*>(pAnchoredObj)); } @@ -422,7 +422,7 @@ SwContentFrm::SwContentFrm( SwContentNode * const pContent, SwFrm* pSib ) : void SwContentFrm::DestroyImpl() { const SwContentNode* pCNd; - if( 0 != ( pCNd = PTR_CAST( SwContentNode, GetRegisteredIn() )) && + if( 0 != ( pCNd = dynamic_cast<SwContentNode*>( GetRegisteredIn() ) ) && !pCNd->GetDoc()->IsInDtor() ) { //Unregister from root if I'm still in turbo there. @@ -472,7 +472,7 @@ void SwLayoutFrm::DestroyImpl() const size_t nCnt = pFrm->GetDrawObjs()->size(); // #i28701# SwAnchoredObject* pAnchoredObj = (*pFrm->GetDrawObjs())[0]; - if ( pAnchoredObj->ISA(SwFlyFrm) ) + if ( dynamic_cast< const SwFlyFrm *>( pAnchoredObj ) != nullptr ) { SwFrm::DestroyFrm(static_cast<SwFlyFrm*>(pAnchoredObj)); assert(!pFrm->GetDrawObjs() || nCnt > pFrm->GetDrawObjs()->size()); @@ -507,7 +507,7 @@ void SwLayoutFrm::DestroyImpl() // #i28701# SwAnchoredObject* pAnchoredObj = (*GetDrawObjs())[0]; - if ( pAnchoredObj->ISA(SwFlyFrm) ) + if ( dynamic_cast< const SwFlyFrm *>( pAnchoredObj ) != nullptr ) { SwFrm::DestroyFrm(static_cast<SwFlyFrm*>(pAnchoredObj)); assert(!GetDrawObjs() || nCnt > GetDrawObjs()->size()); diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 9d7e43e1a624..d25f54331502 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -304,7 +304,7 @@ static void lcl_InvalidateLowerObjs( SwLayoutFrm& _rLayoutFrm, ->Prepare( PREP_FLY_ATTR_CHG, &(pAnchoredObj->GetFrameFormat()) ); } - if ( pAnchoredObj->ISA(SwFlyFrm) ) + if ( dynamic_cast< const SwFlyFrm *>( pAnchoredObj ) != nullptr ) { SwFlyFrm *pFly = static_cast<SwFlyFrm*>(pAnchoredObj); pFly->GetVirtDrawObj()->SetRectsDirty(); @@ -313,7 +313,7 @@ static void lcl_InvalidateLowerObjs( SwLayoutFrm& _rLayoutFrm, } // If anchored object is a fly frame, invalidate its lower objects - if ( pAnchoredObj->ISA(SwFlyFrm) ) + if ( dynamic_cast< const SwFlyFrm *>( pAnchoredObj ) != nullptr ) { SwFlyFrm *pFly = static_cast<SwFlyFrm*>(pAnchoredObj); ::lcl_InvalidateLowerObjs( *pFly, _bMoveObjsOutOfRange, _pPageFrm ); @@ -2554,7 +2554,7 @@ bool SwTabFrm::CalcFlyOffsets( SwTwips& rUpper, for ( size_t i = 0; i < pPage->GetSortedObjs()->size(); ++i ) { SwAnchoredObject* pAnchoredObj = (*pPage->GetSortedObjs())[i]; - if ( pAnchoredObj->ISA(SwFlyFrm) ) + if ( dynamic_cast< const SwFlyFrm *>( pAnchoredObj ) != nullptr ) { SwFlyFrm *pFly = static_cast<SwFlyFrm*>(pAnchoredObj); const SwRect aFlyRect = pFly->GetObjRectWithSpaces(); @@ -4501,7 +4501,7 @@ static bool lcl_ArrangeLowers( SwLayoutFrm *pLay, long lYStart, bool bInva ) default: break; } } - if ( pAnchoredObj->ISA(SwFlyFrm) ) + if ( dynamic_cast< const SwFlyFrm *>( pAnchoredObj ) != nullptr ) { SwFlyFrm *pFly = static_cast<SwFlyFrm*>(pAnchoredObj); @@ -4584,7 +4584,7 @@ static bool lcl_ArrangeLowers( SwLayoutFrm *pLay, long lYStart, bool bInva ) pFly->SetCompletePaint(); } } - else if ( pAnchoredObj->ISA(SwAnchoredDrawObject) ) + else if ( dynamic_cast< const SwAnchoredDrawObject *>( pAnchoredObj ) != nullptr ) { // #i26945# const SwTabFrm* pTabFrm = pLay->FindTabFrm(); @@ -4856,7 +4856,7 @@ void SwCellFrm::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderAt if ( SURROUND_THROUGHT != rSur.GetSurround() ) { // frames, which the cell is a lower of, aren't relevant - if ( pAnchoredObj->ISA(SwFlyFrm) ) + if ( dynamic_cast< const SwFlyFrm *>( pAnchoredObj ) != nullptr ) { const SwFlyFrm *pFly = static_cast<const SwFlyFrm*>(pAnchoredObj); diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx index f71639eabfaa..1a606614a45a 100644 --- a/sw/source/core/layout/trvlfrm.cxx +++ b/sw/source/core/layout/trvlfrm.cxx @@ -382,7 +382,7 @@ bool SwPageFrm::FillSelection( SwSelectionList& rList, const SwRect& rRect ) con for ( size_t i = 0; i < rObjs.size(); ++i ) { const SwAnchoredObject* pAnchoredObj = rObjs[i]; - if( !pAnchoredObj->ISA(SwFlyFrm) ) + if( dynamic_cast< const SwFlyFrm *>( pAnchoredObj ) == nullptr ) continue; const SwFlyFrm* pFly = static_cast<const SwFlyFrm*>(pAnchoredObj); if( pFly->FillSelection( rList, rRect ) ) @@ -2579,7 +2579,7 @@ void SwRootFrm::CalcFrmRects(SwShellCrsr &rCrsr) for ( size_t i = 0; i < rObjs.size(); ++i ) { SwAnchoredObject* pAnchoredObj = rObjs[i]; - if ( !pAnchoredObj->ISA(SwFlyFrm) ) + if ( dynamic_cast< const SwFlyFrm *>( pAnchoredObj ) == nullptr ) continue; const SwFlyFrm* pFly = static_cast<const SwFlyFrm*>(pAnchoredObj); const SwVirtFlyDrawObj* pObj = pFly->GetVirtDrawObj(); @@ -2611,7 +2611,7 @@ void SwRootFrm::CalcFrmRects(SwShellCrsr &rCrsr) const sal_uInt32 nPos = pObj->GetOrdNum(); for ( size_t k = 0; bSub && k < aSortObjs.size(); ++k ) { - OSL_ENSURE( aSortObjs[k]->ISA(SwFlyFrm), + OSL_ENSURE( dynamic_cast< const SwFlyFrm *>( aSortObjs[k] ) != nullptr, "<SwRootFrm::CalcFrmRects(..)> - object in <aSortObjs> of unexpected type" ); const SwFlyFrm* pTmp = static_cast<SwFlyFrm*>(aSortObjs[k]); do diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index 2955846193a3..b767f8b19828 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -1518,7 +1518,7 @@ SwTwips SwFrm::AdjustNeighbourhood( SwTwips nDiff, bool bTst ) for ( size_t i = 0; i < rObjs.size(); ++i ) { SwAnchoredObject* pAnchoredObj = rObjs[i]; - if ( pAnchoredObj->ISA(SwFlyFrm) ) + if ( dynamic_cast< const SwFlyFrm *>( pAnchoredObj ) != nullptr ) { SwFlyFrm* pFly = static_cast<SwFlyFrm*>(pAnchoredObj); OSL_ENSURE( !pFly->IsFlyInCntFrm(), "FlyInCnt at Page?" ); @@ -1669,7 +1669,7 @@ void SwFrm::ValidateThisAndAllLowers( const sal_uInt16 nStage ) const bool bOnlyObject = 1 == nStage; const bool bIncludeObjects = 1 <= nStage; - if ( !bOnlyObject || ISA(SwFlyFrm) ) + if ( !bOnlyObject || dynamic_cast< const SwFlyFrm *>( this ) != nullptr ) { mbValidSize = true; mbValidPrtArea = true; @@ -1685,9 +1685,9 @@ void SwFrm::ValidateThisAndAllLowers( const sal_uInt16 nStage ) for ( size_t i = 0; i < nCnt; ++i ) { SwAnchoredObject* pAnchObj = (*pObjs)[i]; - if ( pAnchObj->ISA(SwFlyFrm) ) + if ( dynamic_cast< const SwFlyFrm *>( pAnchObj ) != nullptr ) static_cast<SwFlyFrm*>(pAnchObj)->ValidateThisAndAllLowers( 2 ); - else if ( pAnchObj->ISA(SwAnchoredDrawObject) ) + else if ( dynamic_cast< const SwAnchoredDrawObject *>( pAnchObj ) != nullptr ) static_cast<SwAnchoredDrawObject*>(pAnchObj)->ValidateThis(); } } @@ -3033,7 +3033,7 @@ static void InvaPercentFlys( SwFrm *pFrm, SwTwips nDiff ) for ( size_t i = 0; i < pFrm->GetDrawObjs()->size(); ++i ) { SwAnchoredObject* pAnchoredObj = (*pFrm->GetDrawObjs())[i]; - if ( pAnchoredObj->ISA(SwFlyFrm) ) + if ( dynamic_cast< const SwFlyFrm *>( pAnchoredObj ) != nullptr ) { SwFlyFrm *pFly = static_cast<SwFlyFrm*>(pAnchoredObj); const SwFormatFrmSize &rSz = pFly->GetFormat()->GetFrmSize(); @@ -3163,7 +3163,7 @@ static bool lcl_IsFlyHeightClipped( SwLayoutFrm *pLay ) for ( size_t i = 0; i < nCnt; ++i ) { SwAnchoredObject* pAnchoredObj = (*pFrm->GetDrawObjs())[i]; - if ( pAnchoredObj->ISA(SwFlyFrm) ) + if ( dynamic_cast< const SwFlyFrm *>( pAnchoredObj ) != nullptr ) { SwFlyFrm* pFly = static_cast<SwFlyFrm*>(pAnchoredObj); if ( pFly->IsHeightClipped() && @@ -3640,7 +3640,7 @@ static void lcl_InvalidateAllContent( SwContentFrm *pCnt, sal_uInt8 nInv ) for ( size_t i = 0; i < rObjs.size(); ++i ) { SwAnchoredObject* pAnchoredObj = rObjs[i]; - if ( pAnchoredObj->ISA(SwFlyFrm) ) + if ( dynamic_cast< const SwFlyFrm *>( pAnchoredObj ) != nullptr ) { SwFlyFrm *pFly = static_cast<SwFlyFrm*>(pAnchoredObj); if ( pFly->IsFlyInCntFrm() ) @@ -3672,7 +3672,7 @@ void SwRootFrm::InvalidateAllContent( sal_uInt8 nInv ) for ( size_t i = 0; i < rObjs.size(); ++i ) { SwAnchoredObject* pAnchoredObj = rObjs[i]; - if ( pAnchoredObj->ISA(SwFlyFrm) ) + if ( dynamic_cast< const SwFlyFrm *>( pAnchoredObj ) != nullptr ) { SwFlyFrm* pFly = static_cast<SwFlyFrm*>(pAnchoredObj); ::lcl_InvalidateContent( pFly->ContainsContent(), nInv ); diff --git a/sw/source/core/objectpositioning/anchoredobjectposition.cxx b/sw/source/core/objectpositioning/anchoredobjectposition.cxx index 4d5373084e59..19939199df34 100644 --- a/sw/source/core/objectpositioning/anchoredobjectposition.cxx +++ b/sw/source/core/objectpositioning/anchoredobjectposition.cxx @@ -54,10 +54,10 @@ SwAnchoredObjectPosition::SwAnchoredObjectPosition( SdrObject& _rDrawObj ) #if OSL_DEBUG_LEVEL > 0 // assert, if object isn't of excepted type const bool bObjOfExceptedType = - mrDrawObj.ISA(SwVirtFlyDrawObj) || // object representing fly frame - mrDrawObj.ISA(SwDrawVirtObj) || // 'virtual' drawing object - ( !mrDrawObj.ISA(SdrVirtObj) && // 'master' drawing object - !mrDrawObj.ISA(SwFlyDrawObj) ); // - indirectly checked + dynamic_cast<const SwVirtFlyDrawObj*>( &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 (void) bObjOfExceptedType; OSL_ENSURE( bObjOfExceptedType, "SwAnchoredObjectPosition(..) - object of unexpected type!" ); @@ -75,7 +75,7 @@ void SwAnchoredObjectPosition::_GetInfoAboutObj() { // determine, if object represents a fly frame { - mbIsObjFly = mrDrawObj.ISA(SwVirtFlyDrawObj); + mbIsObjFly = dynamic_cast<const SwVirtFlyDrawObj*>( &mrDrawObj) != nullptr; } // determine contact object @@ -842,7 +842,7 @@ SwTwips SwAnchoredObjectPosition::_CalcRelPosX( // it is horizontal positioned left or right, but not relative to character, // it has to be drawn aside another object, which have the same horizontal // position and lay below it. - if ( GetAnchoredObj().ISA(SwFlyFrm) && + if ( dynamic_cast<const SwFlyFrm*>( &GetAnchoredObj() ) != nullptr && ( GetContact().ObjAnchoredAtPara() || GetContact().ObjAnchoredAtChar() ) && ( eHoriOrient == text::HoriOrientation::LEFT || eHoriOrient == text::HoriOrientation::RIGHT ) && eRelOrient != text::RelOrientation::CHAR ) @@ -877,8 +877,8 @@ SwTwips SwAnchoredObjectPosition::_AdjustHoriRelPosForDrawAside( ) const { // #i26791# - if ( !GetAnchorFrm().ISA(SwTextFrm) || - !GetAnchoredObj().ISA(SwFlyAtCntFrm) ) + if ( dynamic_cast<const SwTextFrm*>( &GetAnchorFrm() ) == nullptr || + dynamic_cast<const SwFlyAtCntFrm*>( &GetAnchoredObj() ) == nullptr ) { OSL_FAIL( "<SwAnchoredObjectPosition::_AdjustHoriRelPosForDrawAside(..) - usage for wrong anchor type" ); return _nProposedRelPosX; diff --git a/sw/source/core/objectpositioning/ascharanchoredobjectposition.cxx b/sw/source/core/objectpositioning/ascharanchoredobjectposition.cxx index 8b5e8ef12358..6685a8a1d54e 100644 --- a/sw/source/core/objectpositioning/ascharanchoredobjectposition.cxx +++ b/sw/source/core/objectpositioning/ascharanchoredobjectposition.cxx @@ -63,7 +63,7 @@ SwAsCharAnchoredObjectPosition::~SwAsCharAnchoredObjectPosition() /** method to cast <SwAnchoredObjectPosition::GetAnchorFrm()> to needed type */ const SwTextFrm& SwAsCharAnchoredObjectPosition::GetAnchorTextFrm() const { - OSL_ENSURE( GetAnchorFrm().ISA(SwTextFrm), + OSL_ENSURE( dynamic_cast<const SwTextFrm*>( &GetAnchorFrm() ) != nullptr, "SwAsCharAnchoredObjectPosition::GetAnchorTextFrm() - wrong anchor frame type" ); return static_cast<const SwTextFrm&>(GetAnchorFrm()); @@ -266,7 +266,7 @@ void SwAsCharAnchoredObjectPosition::CalcPosition() rAnchorFrm.SwitchHorizontalToVertical( aAnchorPos ); // #i44347# - keep last object rectangle at anchored object - OSL_ENSURE( GetAnchoredObj().ISA(SwAnchoredDrawObject), + OSL_ENSURE( dynamic_cast<const SwAnchoredDrawObject*>( &GetAnchoredObj() ) != nullptr, "<SwAsCharAnchoredObjectPosition::CalcPosition()> - wrong type of anchored object." ); SwAnchoredDrawObject& rAnchoredDrawObj = static_cast<SwAnchoredDrawObject&>( GetAnchoredObj() ); @@ -293,7 +293,7 @@ void SwAsCharAnchoredObjectPosition::CalcPosition() aRelAttr = Point( 0, nRelPos ); // OD 2004-03-23 #i26791# - OSL_ENSURE( GetAnchoredObj().ISA(SwFlyInCntFrm), + OSL_ENSURE( dynamic_cast<const SwFlyInCntFrm*>( &GetAnchoredObj()) != nullptr, "<SwAsCharAnchoredObjectPosition::CalcPosition()> - wrong anchored object." ); const SwFlyInCntFrm& rFlyInCntFrm = static_cast<const SwFlyInCntFrm&>(GetAnchoredObj()); diff --git a/sw/source/core/objectpositioning/environmentofanchoredobject.cxx b/sw/source/core/objectpositioning/environmentofanchoredobject.cxx index 9d022c5dce13..46c4818f0319 100644 --- a/sw/source/core/objectpositioning/environmentofanchoredobject.cxx +++ b/sw/source/core/objectpositioning/environmentofanchoredobject.cxx @@ -56,7 +56,7 @@ const SwLayoutFrm& SwEnvironmentOfAnchoredObject::GetHoriEnvironmentLayoutFrm( } } - OSL_ENSURE( pHoriEnvironmentLayFrm->ISA(SwLayoutFrm), + OSL_ENSURE( dynamic_cast< const SwLayoutFrm *>( pHoriEnvironmentLayFrm ) != nullptr, "SwEnvironmentOfAnchoredObject::GetHoriEnvironmentLayoutFrm(..) - found frame isn't a layout frame" ); return static_cast<const SwLayoutFrm&>(*pHoriEnvironmentLayFrm); @@ -90,7 +90,7 @@ const SwLayoutFrm& SwEnvironmentOfAnchoredObject::GetVertEnvironmentLayoutFrm( } } - OSL_ENSURE( pVertEnvironmentLayFrm->ISA(SwLayoutFrm), + OSL_ENSURE( dynamic_cast< const SwLayoutFrm *>( pVertEnvironmentLayFrm ) != nullptr, "SwEnvironmentOfAnchoredObject::GetVertEnvironmentLayoutFrm(..) - found frame isn't a layout frame" ); return static_cast<const SwLayoutFrm&>(*pVertEnvironmentLayFrm); diff --git a/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx b/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx index 4d9de628f169..ef5f6e3090cf 100644 --- a/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx +++ b/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx @@ -83,7 +83,7 @@ SwTwips SwToContentAnchoredObjectPosition::ToCharTopOfLine() const SwTextFrm& SwToContentAnchoredObjectPosition::GetAnchorTextFrm() const { - OSL_ENSURE( GetAnchorFrm().ISA(SwTextFrm), + OSL_ENSURE( dynamic_cast<const SwTextFrm*>( &GetAnchorFrm()) != nullptr , "SwToContentAnchoredObjectPosition::GetAnchorTextFrm() - wrong anchor frame type" ); return static_cast<SwTextFrm&>(GetAnchorFrm()); diff --git a/sw/source/core/para/paratr.cxx b/sw/source/core/para/paratr.cxx index 1796f26d7447..bb893e039377 100644 --- a/sw/source/core/para/paratr.cxx +++ b/sw/source/core/para/paratr.cxx @@ -90,7 +90,7 @@ void SwFormatDrop::Modify( const SfxPoolItem*, const SfxPoolItem * ) { if( pDefinedIn ) { - if( !pDefinedIn->ISA( SwFormat )) + if( dynamic_cast< const SwFormat *>( pDefinedIn ) == nullptr) pDefinedIn->ModifyNotification( this, this ); else if( pDefinedIn->HasWriterListeners() && !pDefinedIn->IsModifyLocked() ) diff --git a/sw/source/core/sw3io/swacorr.cxx b/sw/source/core/sw3io/swacorr.cxx index 2ab8fdbd1faf..4b9aae4a5190 100644 --- a/sw/source/core/sw3io/swacorr.cxx +++ b/sw/source/core/sw3io/swacorr.cxx @@ -67,7 +67,7 @@ bool SwAutoCorrect::PutText( const uno::Reference < embed::XStorage >& rStg, const OUString& rFileName, const OUString& rShort, SfxObjectShell& rObjSh, OUString& rLong ) { - if( !rObjSh.IsA( TYPE(SwDocShell) ) ) + if( 0 == dynamic_cast<const SwDocShell*>( &rObjSh) ) return false; SwDocShell& rDShell = static_cast<SwDocShell&>(rObjSh); diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index 4b0d0155912d..e0f4f64ed316 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -271,7 +271,7 @@ SwTaggedPDFHelper::SwTaggedPDFHelper( const Num_Info* pNumInfo, mpPorInfo( pPorInfo ) { mpPDFExtOutDevData = - PTR_CAST( vcl::PDFExtOutDevData, rOut.GetExtOutDevData() ); + dynamic_cast< vcl::PDFExtOutDevData*>( rOut.GetExtOutDevData() ); if ( mpPDFExtOutDevData && mpPDFExtOutDevData->GetIsExportTaggedPDF() ) { @@ -1442,7 +1442,7 @@ void SwTaggedPDFHelper::BeginInlineStructureElements() bool SwTaggedPDFHelper::IsExportTaggedPDF( const OutputDevice& rOut ) { - vcl::PDFExtOutDevData* pPDFExtOutDevData = PTR_CAST( vcl::PDFExtOutDevData, rOut.GetExtOutDevData() ); + vcl::PDFExtOutDevData* pPDFExtOutDevData = dynamic_cast< vcl::PDFExtOutDevData*>( rOut.GetExtOutDevData() ); return pPDFExtOutDevData && pPDFExtOutDevData->GetIsExportTaggedPDF(); } @@ -1533,7 +1533,7 @@ Rectangle SwEnhancedPDFExportHelper::SwRectToPDFRect(const SwPageFrm* pCurrPage, void SwEnhancedPDFExportHelper::EnhancedPDFExport() { vcl::PDFExtOutDevData* pPDFExtOutDevData = - PTR_CAST( vcl::PDFExtOutDevData, mrOut.GetExtOutDevData() ); + dynamic_cast< vcl::PDFExtOutDevData*>( mrOut.GetExtOutDevData() ); if ( !pPDFExtOutDevData ) return; diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx index aa1d6aca1ec8..071acfe29d05 100644 --- a/sw/source/core/text/itrcrsr.cxx +++ b/sw/source/core/text/itrcrsr.cxx @@ -1876,7 +1876,7 @@ bool SwTextFrm::FillSelection( SwSelectionList& rSelList, const SwRect& rRect ) for ( size_t i = 0; i < rObjs.size(); ++i ) { const SwAnchoredObject* pAnchoredObj = rObjs[i]; - if( !pAnchoredObj->ISA(SwFlyFrm) ) + if( dynamic_cast< const SwFlyFrm *>( pAnchoredObj ) == nullptr ) continue; const SwFlyFrm* pFly = static_cast<const SwFlyFrm*>(pAnchoredObj); if( pFly->IsFlyInCntFrm() && pFly->FillSelection( rSelList, rRect ) ) diff --git a/sw/source/core/text/porfly.cxx b/sw/source/core/text/porfly.cxx index 065777d29275..5ae1943ffa51 100644 --- a/sw/source/core/text/porfly.cxx +++ b/sw/source/core/text/porfly.cxx @@ -163,12 +163,12 @@ void SwTextFrm::MoveFlyInCnt( SwTextFrm *pNew, sal_Int32 nStart, sal_Int32 nEnd const sal_Int32 nIdx = pPos->nContent.GetIndex(); if ( nIdx >= nStart && nEnd > nIdx ) { - if ( pAnchoredObj->ISA(SwFlyFrm) ) + if ( dynamic_cast< const SwFlyFrm *>( pAnchoredObj ) != nullptr ) { RemoveFly( static_cast<SwFlyFrm*>(pAnchoredObj) ); pNew->AppendFly( static_cast<SwFlyFrm*>(pAnchoredObj) ); } - else if ( pAnchoredObj->ISA(SwAnchoredDrawObject) ) + else if ( dynamic_cast< const SwAnchoredDrawObject *>( pAnchoredObj ) != nullptr ) { RemoveDrawObj( *pAnchoredObj ); pNew->AppendDrawObj( *pAnchoredObj ); diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx index c2b029ebc37a..5645b7365d05 100644 --- a/sw/source/core/text/porrst.cxx +++ b/sw/source/core/text/porrst.cxx @@ -207,7 +207,7 @@ SwTwips SwTextFrm::EmptyHeight() const { if (IsCollapse()) { SwViewShell *pSh = getRootFrm()->GetCurrShell(); - if ( pSh->IsA( TYPE(SwCrsrShell) ) ) { + if ( dynamic_cast<const SwCrsrShell*>( pSh ) != nullptr ) { SwCrsrShell *pCrSh = static_cast<SwCrsrShell*>(pSh); SwContentFrm *pCurrFrm=pCrSh->GetCurrFrm(); if (pCurrFrm==static_cast<SwContentFrm const *>(this)) { diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx index 796f4c91b486..da194ae75e94 100644 --- a/sw/source/core/text/txtfly.cxx +++ b/sw/source/core/text/txtfly.cxx @@ -179,7 +179,7 @@ const SwRect SwContourCache::CalcBoundRect( const SwAnchoredObject* pAnchoredObj SwRect aRet; const SwFrameFormat* pFormat = &(pAnchoredObj->GetFrameFormat()); if( pFormat->GetSurround().IsContour() && - ( !pAnchoredObj->ISA(SwFlyFrm) || + ( dynamic_cast< const SwFlyFrm *>( pAnchoredObj ) == nullptr || ( static_cast<const SwFlyFrm*>(pAnchoredObj)->Lower() && static_cast<const SwFlyFrm*>(pAnchoredObj)->Lower()->IsNoTextFrm() ) ) ) { @@ -221,7 +221,7 @@ const SwRect SwContourCache::ContourRect( const SwFormat* pFormat, ::basegfx::B2DPolyPolygon aPolyPolygon; ::basegfx::B2DPolyPolygon* pPolyPolygon = 0L; - if ( pObj->ISA(SwVirtFlyDrawObj) ) + if ( dynamic_cast< const SwVirtFlyDrawObj *>( pObj ) != nullptr ) { // GetContour() causes the graphic to be loaded, which may cause // the graphic to change its size, call ClrObject() @@ -234,7 +234,7 @@ const SwRect SwContourCache::ContourRect( const SwFormat* pFormat, } else { - if( !pObj->ISA( E3dObject ) ) + if( dynamic_cast< const E3dObject *>( pObj ) == nullptr ) { aPolyPolygon = pObj->TakeXorPoly(); } @@ -665,7 +665,7 @@ bool SwTextFly::GetTop( const SwAnchoredObject* _pAnchoredObj, // #i26945# const SdrObject* pNew = _pAnchoredObj->GetDrawObj(); // #102344# Ignore connectors which have one or more connections - if(pNew && pNew->ISA(SdrEdgeObj)) + if(pNew && dynamic_cast< const SdrEdgeObj *>( pNew ) != nullptr) { if(static_cast<const SdrEdgeObj*>(pNew)->GetConnectedNode(true) || static_cast<const SdrEdgeObj*>(pNew)->GetConnectedNode(false)) diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index e4488ec8f259..ed54b5a3d160 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -382,7 +382,7 @@ void SwTextFrm::DestroyImpl() ClearPara(); const SwContentNode* pCNd; - if( 0 != ( pCNd = PTR_CAST( SwContentNode, GetRegisteredIn() )) && + if( 0 != ( pCNd = dynamic_cast<SwContentNode*>( GetRegisteredIn() ) ) && !pCNd->GetDoc()->IsInDtor() && HasFootnote() ) { SwTextNode *pTextNd = static_cast<SwTextFrm*>(this)->GetTextNode(); @@ -1183,7 +1183,7 @@ void SwTextFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) for ( size_t i = 0; GetDrawObjs() && i < pObjs->size(); ++i ) { SwAnchoredObject* pAnchoredObj = (*pObjs)[i]; - if ( pAnchoredObj->ISA(SwFlyFrm) ) + if ( dynamic_cast< const SwFlyFrm *>( pAnchoredObj ) != nullptr ) { SwFlyFrm *pFly = static_cast<SwFlyFrm*>(pAnchoredObj); if( !pFly->IsFlyInCntFrm() ) diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx index 4cc60f316727..456c39b654f6 100644 --- a/sw/source/core/text/txtftn.cxx +++ b/sw/source/core/text/txtftn.cxx @@ -231,7 +231,7 @@ static SwTwips lcl_GetFootnoteLower( const SwTextFrm* pFrm, SwTwips nLower ) SwAnchoredObject* pAnchoredObj = rObjs[i]; SwRect aRect( pAnchoredObj->GetObjRect() ); - if ( !pAnchoredObj->ISA(SwFlyFrm) || + if ( dynamic_cast< const SwFlyFrm *>( pAnchoredObj ) == nullptr || static_cast<SwFlyFrm*>(pAnchoredObj)->IsValid() ) { const SwTwips nBottom = (aRect.*fnRect->fnGetBottom)(); diff --git a/sw/source/core/undo/SwUndoTOXChange.cxx b/sw/source/core/undo/SwUndoTOXChange.cxx index 7887b85e44ed..1deb5c19ee0a 100644 --- a/sw/source/core/undo/SwUndoTOXChange.cxx +++ b/sw/source/core/undo/SwUndoTOXChange.cxx @@ -32,7 +32,7 @@ SwUndoTOXChange::~SwUndoTOXChange() void SwUndoTOXChange::UpdateTOXBaseSection() { - if (pTOX->ISA(SwTOXBaseSection)) + if ( dynamic_cast< const SwTOXBaseSection *>( pTOX ) != nullptr ) { SwTOXBaseSection * pTOXBase = static_cast<SwTOXBaseSection *>(pTOX); pTOXBase->Update(); diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx index cde87b4fbf56..857725ffcb6b 100644 --- a/sw/source/core/undo/rolbck.cxx +++ b/sw/source/core/undo/rolbck.cxx @@ -1428,12 +1428,12 @@ void SwRegHistory::_MakeSetWhichIds() if( GetRegisteredIn() ) { const SfxItemSet* pSet = 0; - if( GetRegisteredIn()->ISA( SwContentNode ) ) + if( dynamic_cast< const SwContentNode *>( GetRegisteredIn() ) != nullptr ) { pSet = static_cast<SwContentNode*>( GetRegisteredIn())->GetpSwAttrSet(); } - else if ( GetRegisteredIn()->ISA( SwFormat ) ) + else if ( dynamic_cast< const SwFormat *>( GetRegisteredIn() ) != nullptr ) { pSet = &static_cast<SwFormat*>( GetRegisteredIn())->GetAttrSet(); diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx index 80d068cb5e0a..87e68c3a4870 100644 --- a/sw/source/core/undo/unattr.cxx +++ b/sw/source/core/undo/unattr.cxx @@ -142,7 +142,7 @@ void SwUndoFormatAttr::Init() } } else if ( pDoc->GetSections().Contains( m_pFormat )) { m_nNodeIndex = m_pFormat->GetContent().GetContentIdx()->GetIndex(); - } else if ( 0 != dynamic_cast< SwTableBoxFormat* >( m_pFormat ) ) { + } else if ( dynamic_cast< SwTableBoxFormat* >( m_pFormat ) != nullptr ) { SwTableBox * pTableBox = SwIterator<SwTableBox,SwFormat>( *m_pFormat ).First(); if ( pTableBox ) { m_nNodeIndex = pTableBox->GetSttIdx(); diff --git a/sw/source/core/undo/undraw.cxx b/sw/source/core/undo/undraw.cxx index a5dd2607298e..acb4b2669837 100644 --- a/sw/source/core/undo/undraw.cxx +++ b/sw/source/core/undo/undraw.cxx @@ -242,9 +242,9 @@ void SwUndoDrawGroup::UndoImpl(::sw::UndoRedoContext &) // #i45718# - follow-up of #i35635# move object to visible layer pContact->MoveObjToVisibleLayer( pObj ); // #i45952# - notify that position attributes are already set - OSL_ENSURE( rSave.pFormat->ISA(SwDrawFrameFormat), + OSL_ENSURE( dynamic_cast< const SwDrawFrameFormat *>( rSave.pFormat ) != nullptr, "<SwUndoDrawGroup::Undo(..)> - wrong type of frame format for drawing object" ); - if ( rSave.pFormat->ISA(SwDrawFrameFormat) ) + if ( dynamic_cast< const SwDrawFrameFormat *>( rSave.pFormat ) != nullptr ) { static_cast<SwDrawFrameFormat*>(rSave.pFormat)->PosAttrSet(); } @@ -289,9 +289,9 @@ void SwUndoDrawGroup::RedoImpl(::sw::UndoRedoContext &) // #i45718# - follow-up of #i35635# move object to visible layer pContact->MoveObjToVisibleLayer( pObjArr->pObj ); // #i45952# - notify that position attributes are already set - OSL_ENSURE( pObjArr->pFormat->ISA(SwDrawFrameFormat), + OSL_ENSURE( dynamic_cast< const SwDrawFrameFormat *>( pObjArr->pFormat ) != nullptr, "<SwUndoDrawGroup::Undo(..)> - wrong type of frame format for drawing object" ); - if ( pObjArr->pFormat->ISA(SwDrawFrameFormat) ) + if ( dynamic_cast< const SwDrawFrameFormat *>( pObjArr->pFormat ) != nullptr ) { static_cast<SwDrawFrameFormat*>(pObjArr->pFormat)->PosAttrSet(); } @@ -387,9 +387,9 @@ void SwUndoDrawUnGroup::UndoImpl(::sw::UndoRedoContext & rContext) // #i45718# - follow-up of #i35635# move object to visible layer pContact->MoveObjToVisibleLayer( pObjArr->pObj ); // #i45952# - notify that position attributes are already set - OSL_ENSURE( pObjArr->pFormat->ISA(SwDrawFrameFormat), + OSL_ENSURE( dynamic_cast< const SwDrawFrameFormat *>( pObjArr->pFormat ) != nullptr, "<SwUndoDrawGroup::Undo(..)> - wrong type of frame format for drawing object" ); - if ( pObjArr->pFormat->ISA(SwDrawFrameFormat) ) + if ( dynamic_cast< const SwDrawFrameFormat *>( pObjArr->pFormat ) != nullptr ) { static_cast<SwDrawFrameFormat*>(pObjArr->pFormat)->PosAttrSet(); } @@ -426,9 +426,9 @@ void SwUndoDrawUnGroup::RedoImpl(::sw::UndoRedoContext &) rFlyFormats.push_back( rSave.pFormat ); // #i45952# - notify that position attributes are already set - OSL_ENSURE( rSave.pFormat->ISA(SwDrawFrameFormat), + OSL_ENSURE( dynamic_cast< const SwDrawFrameFormat *>( rSave.pFormat ) != nullptr, "<SwUndoDrawGroup::Undo(..)> - wrong type of frame format for drawing object" ); - if ( rSave.pFormat->ISA(SwDrawFrameFormat) ) + if ( dynamic_cast< const SwDrawFrameFormat *>( rSave.pFormat ) != nullptr ) { static_cast<SwDrawFrameFormat*>(rSave.pFormat)->PosAttrSet(); } @@ -526,9 +526,9 @@ void SwUndoDrawDelete::UndoImpl(::sw::UndoRedoContext & rContext) // #i45718# - follow-up of #i35635# move object to visible layer pContact->MoveObjToVisibleLayer( pObj ); // #i45952# - notify that position attributes are already set - OSL_ENSURE( rSave.pFormat->ISA(SwDrawFrameFormat), + OSL_ENSURE( dynamic_cast< const SwDrawFrameFormat *>( rSave.pFormat ) != nullptr, "<SwUndoDrawGroup::Undo(..)> - wrong type of frame format for drawing object" ); - if ( rSave.pFormat->ISA(SwDrawFrameFormat) ) + if ( dynamic_cast< const SwDrawFrameFormat *>( rSave.pFormat ) != nullptr ) { static_cast<SwDrawFrameFormat*>(rSave.pFormat)->PosAttrSet(); } diff --git a/sw/source/core/undo/unsect.cxx b/sw/source/core/undo/unsect.cxx index 0e2b42607dd8..34465b55e212 100644 --- a/sw/source/core/undo/unsect.cxx +++ b/sw/source/core/undo/unsect.cxx @@ -302,7 +302,7 @@ SwUndoDelSection::SwUndoDelSection( SwNodeIndex const*const pIndex) : SwUndo( UNDO_DELSECTION ) , m_pSectionData( new SwSectionData(rSection) ) - , m_pTOXBase( rSection.ISA( SwTOXBaseSection ) + , m_pTOXBase( dynamic_cast<const SwTOXBaseSection*>( &rSection) != nullptr ? new SwTOXBase(static_cast<SwTOXBaseSection const&>(rSection)) : 0 ) , m_pAttrSet( ::lcl_GetAttrSet(rSection) ) diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index 9af9efe5f6a4..cb32a595a854 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -287,7 +287,7 @@ void SwUndoInsTable::UndoImpl(::sw::UndoRedoContext & rContext) } sTableNm = pTableNd->GetTable().GetFrameFormat()->GetName(); - if( pTableNd->GetTable().IsA( TYPE( SwDDETable )) ) + if( dynamic_cast<const SwDDETable *>(&pTableNd->GetTable()) != nullptr ) pDDEFieldType = static_cast<SwDDEFieldType*>(static_cast<SwDDETable&>(pTableNd->GetTable()). GetDDEFieldType()->Copy()); @@ -408,7 +408,7 @@ SwUndoTableToText::SwUndoTableToText( const SwTable& rTable, sal_Unicode cCh ) pTableSave = new _SaveTable( rTable ); pBoxSaves = new SwTableToTextSaves( (SwTableToTextSaves::size_type)rTable.GetTabSortBoxes().size() ); - if( rTable.IsA( TYPE( SwDDETable ) ) ) + if( dynamic_cast<const SwDDETable *>(&rTable) != nullptr ) pDDEFieldType = static_cast<SwDDEFieldType*>(static_cast<const SwDDETable&>(rTable).GetDDEFieldType()->Copy()); bCheckNumFormat = rTable.GetFrameFormat()->GetDoc()->IsInsTableFormatNum(); @@ -636,7 +636,7 @@ void SwUndoTableToText::RedoImpl(::sw::UndoRedoContext & rContext) SwTableNode* pTableNd = pPam->GetNode().GetTableNode(); OSL_ENSURE( pTableNd, "Could not find any TableNode" ); - if( pTableNd->GetTable().IsA( TYPE( SwDDETable )) ) + if( dynamic_cast<const SwDDETable *>(&pTableNd->GetTable()) != nullptr ) pDDEFieldType = static_cast<SwDDEFieldType*>(static_cast<SwDDETable&>(pTableNd->GetTable()). GetDDEFieldType()->Copy()); diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index d407c0de08ad..431487df0508 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -304,7 +304,7 @@ uno::Reference< drawing::XShape > SwFmDrawPage::_CreateShape( SdrObject *pObj ) throw (uno::RuntimeException, std::exception) { uno::Reference< drawing::XShape > xRet; - if(pObj->ISA(SwVirtFlyDrawObj) || pObj->GetObjInventor() == SWGInventor) + if(dynamic_cast<const SwVirtFlyDrawObj*>( pObj) != nullptr || pObj->GetObjInventor() == SWGInventor) { SwFlyDrawContact* pFlyContact = static_cast<SwFlyDrawContact*>(pObj->GetUserCall()); if(pFlyContact) @@ -360,7 +360,7 @@ uno::Reference< drawing::XShape > SwFmDrawPage::_CreateShape( SdrObject *pObj ) uno::Reference< uno::XInterface > xCreate(xRet, uno::UNO_QUERY); xRet = 0; uno::Reference< beans::XPropertySet > xPrSet; - if ( pObj->IsGroupObject() && (!pObj->Is3DObj() || (pObj->ISA(E3dScene))) ) + if ( pObj->IsGroupObject() && (!pObj->Is3DObj() || (dynamic_cast<const E3dScene*>( pObj) != nullptr)) ) xPrSet = new SwXGroupShape( xCreate ); else xPrSet = new SwXShape( xCreate ); @@ -2181,7 +2181,7 @@ void SwXShape::dispose() throw( uno::RuntimeException, std::exception ) // a 'virtual' drawing object. // correct assertion and refine it for safety reason. OSL_ENSURE( !pObj || - pObj->ISA(SwDrawVirtObj) || + dynamic_cast<const SwDrawVirtObj*>( pObj) != nullptr || pObj->GetUpGroup() || pObj == pFormat->FindSdrObject(), "<SwXShape::dispose(..) - different 'master' drawing objects!!" ); @@ -2190,7 +2190,7 @@ void SwXShape::dispose() throw( uno::RuntimeException, std::exception ) // no delete of draw format for members // of a group if ( pObj && - !pObj->ISA(SwDrawVirtObj) && + dynamic_cast<const SwDrawVirtObj*>( pObj) == nullptr && !pObj->GetUpGroup() && pObj->IsInserted() ) { @@ -2342,7 +2342,7 @@ void SAL_CALL SwXShape::setPosition( const awt::Point& aPosition ) { bApplyPosAtDrawObj = true; if ( pObj->GetUserCall() && - pObj->GetUserCall()->ISA(SwDrawContact) ) + dynamic_cast<const SwDrawContact*>( pObj->GetUserCall()) != nullptr ) { bNoAdjustOfPosProp = true; } diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 584fac7fa174..7a66ad842a97 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -1550,7 +1550,7 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno:: SwFlyFrm *pFly = 0; { const SwFrameFormat* pFormatXX = pFormat; - if (PTR_CAST(SwFlyFrameFormat, pFormatXX)) + if (dynamic_cast<const SwFlyFrameFormat*>( pFormatXX) ) pFly = static_cast<const SwFlyFrameFormat*>(pFormatXX)->GetFrm(); } if ( pFly ) @@ -1937,7 +1937,7 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno:: { // see SwFEShell::SetFlyFrmAttr( SfxItemSet& rSet ) SwFlyFrm *pFly = 0; - if (PTR_CAST(SwFlyFrameFormat, pFormat)) + if (dynamic_cast<SwFlyFrameFormat*>( pFormat) ) pFly = static_cast<SwFlyFrameFormat*>(pFormat)->GetFrm(); if (pFly) { diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx index 8bc2ccd96310..2751658d330b 100644 --- a/sw/source/core/unocore/unosect.cxx +++ b/sw/source/core/unocore/unosect.cxx @@ -1099,7 +1099,7 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException, pEnclosingSection = pEnclosingSection->GetParent(); } SwTOXBaseSection* const pTOXBaseSect = pEnclosingSection ? - PTR_CAST(SwTOXBaseSection, pEnclosingSection) : NULL; + dynamic_cast<SwTOXBaseSection*>( pEnclosingSection ) : NULL; if (pTOXBaseSect) { // convert section to TOXBase and get SwXDocumentIndex diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index 8b53738200d5..58ad2066761e 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -2630,7 +2630,7 @@ void SwXHeadFootText::Impl::Modify( const SfxPoolItem *pOld, const SfxPoolItem * bool SwXHeadFootText::IsXHeadFootText(SwClient *const pClient) { - return 0 != dynamic_cast<SwXHeadFootText::Impl*>(pClient); + return dynamic_cast<SwXHeadFootText::Impl*>(pClient) != nullptr; } uno::Reference< text::XText > diff --git a/sw/source/core/view/printdata.cxx b/sw/source/core/view/printdata.cxx index 665d26e133ac..93d52a94fd0b 100644 --- a/sw/source/core/view/printdata.cxx +++ b/sw/source/core/view/printdata.cxx @@ -120,8 +120,7 @@ void SwRenderData::MakeSwPrtOptions( SwPrintData & rOptions(*m_pPrtOptions); // get default print options - const TypeId aSwWebDocShellTypeId = TYPE(SwWebDocShell); - bool bWeb = pDocShell->IsA( aSwWebDocShellTypeId ); + bool bWeb = dynamic_cast<const SwWebDocShell*>( pDocShell) != nullptr; ::sw::InitPrintOptionsFromApplication(rOptions, bWeb); // get print options to use from provided properties diff --git a/sw/source/core/view/vdraw.cxx b/sw/source/core/view/vdraw.cxx index 3a233d98d4c5..2d70f0c88805 100644 --- a/sw/source/core/view/vdraw.cxx +++ b/sw/source/core/view/vdraw.cxx @@ -48,7 +48,7 @@ void SwViewShellImp::StartAction() if ( HasDrawView() ) { SET_CURR_SHELL( GetShell() ); - if ( m_pShell->ISA(SwFEShell) ) + if ( dynamic_cast<const SwFEShell*>( m_pShell) != nullptr ) static_cast<SwFEShell*>(m_pShell)->HideChainMarker(); // might have changed } } @@ -58,7 +58,7 @@ void SwViewShellImp::EndAction() if ( HasDrawView() ) { SET_CURR_SHELL( GetShell() ); - if ( m_pShell->ISA(SwFEShell) ) + if ( dynamic_cast<const SwFEShell*>(m_pShell) != nullptr ) static_cast<SwFEShell*>(m_pShell)->SetChainMarker(); // might have changed } } @@ -210,14 +210,14 @@ void SwViewShellImp::NotifySizeChg( const Size &rNewSz ) for( size_t nObj = 0; nObj < nObjs; ++nObj ) { SdrObject *pObj = pPage->GetObj( nObj ); - if( !pObj->ISA(SwVirtFlyDrawObj) ) + if( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) == nullptr ) { // Objects not anchored to the frame, do not need to be adjusted const SwContact *pCont = GetUserCall(pObj); // this function might be called by the InsertDocument, when // a PageDesc-Attribute is set on a node. Then the SdrObject // must not have an UserCall. - if( !pCont || !pCont->ISA(SwDrawContact) ) + if( !pCont || dynamic_cast<const SwDrawContact*>( pCont) == nullptr ) continue; const SwFrm *pAnchor = static_cast<const SwDrawContact*>(pCont)->GetAnchorFrm(); diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index 704e20d5d0fd..02935a84ace9 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -329,7 +329,7 @@ void SwViewShell::ImplEndAction( const bool bIdleEnd ) // e.g. additional mode, page half visible vertically, in the // middle a selection and with an other cursor jump to left // right border. Without ShowCrsr the selection disappears. - bool bShowCrsr = pRegion && IsA( TYPE(SwCrsrShell) ); + bool bShowCrsr = pRegion && dynamic_cast<const SwCrsrShell*>(this) != nullptr; if( bShowCrsr ) static_cast<SwCrsrShell*>(this)->HideCrsrs(); @@ -655,7 +655,7 @@ void SwViewShell::UpdateFields(bool bCloseDB) { SET_CURR_SHELL( this ); - bool bCrsr = ISA(SwCrsrShell); + bool bCrsr = dynamic_cast<const SwCrsrShell*>( this ) != nullptr; if ( bCrsr ) static_cast<SwCrsrShell*>(this)->StartAction(); else @@ -732,7 +732,7 @@ void SwViewShell::LayoutIdle() static void lcl_InvalidateAllContent( SwViewShell& rSh, sal_uInt8 nInv ) { - bool bCrsr = rSh.ISA(SwCrsrShell); + bool bCrsr = dynamic_cast<const SwCrsrShell*>( &rSh) != nullptr; if ( bCrsr ) static_cast<SwCrsrShell&>(rSh).StartAction(); else @@ -752,7 +752,7 @@ static void lcl_InvalidateAllContent( SwViewShell& rSh, sal_uInt8 nInv ) */ static void lcl_InvalidateAllObjPos( SwViewShell &_rSh ) { - const bool bIsCrsrShell = _rSh.ISA(SwCrsrShell); + const bool bIsCrsrShell = dynamic_cast<const SwCrsrShell*>( &_rSh) != nullptr; if ( bIsCrsrShell ) static_cast<SwCrsrShell&>(_rSh).StartAction(); else @@ -1012,7 +1012,7 @@ void SwViewShell::SizeChgNotify() { mbDocSizeChgd = true; - if ( !Imp()->IsCalcLayoutProgress() && ISA( SwCrsrShell ) ) + if ( !Imp()->IsCalcLayoutProgress() && dynamic_cast<const SwCrsrShell*>( this ) != nullptr ) { const SwFrm *pCnt = static_cast<SwCrsrShell*>(this)->GetCurrFrm( false ); const SwPageFrm *pPage; diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 3567ff0c663c..841ff6aba6ec 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -323,7 +323,7 @@ void SwViewShell::CalcPagesForPrint( sal_uInt16 nMax ) SwDoc * SwViewShell::FillPrtDoc( SwDoc *pPrtDoc, const SfxPrinter* pPrt) { - OSL_ENSURE( this->IsA( TYPE(SwFEShell) ),"SwViewShell::Prt for FEShell only"); + OSL_ENSURE( dynamic_cast<const SwFEShell*>( this) != nullptr,"SwViewShell::Prt for FEShell only"); SwFEShell* pFESh = static_cast<SwFEShell*>(this); pPrtDoc->getIDocumentFieldsAccess().LockExpFields(); diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx index f5dc13a5e8af..d5b36ef61088 100644 --- a/sw/source/filter/basflt/shellio.cxx +++ b/sw/source/filter/basflt/shellio.cxx @@ -91,7 +91,7 @@ sal_uLong SwReader::Read( const Reader& rOptions ) pDoc->SetOle2Link( Link<bool,void>() ); pDoc->SetInReading( true ); - pDoc->SetInXMLImport( 0 != dynamic_cast< XMLReader* >(po) ); + pDoc->SetInXMLImport( dynamic_cast< XMLReader* >(po) != nullptr ); SwPaM *pPam; if( pCrsr ) diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx index b45f8d1d6da0..9f413a48dbc1 100644 --- a/sw/source/filter/html/htmlform.cxx +++ b/sw/source/filter/html/htmlform.cxx @@ -688,7 +688,7 @@ void SwHTMLParser::SetControlSize( const uno::Reference< drawing::XShape >& rSha const SdrView* pDrawView = pVSh ? pVSh->GetDrawView() : 0; - const SdrUnoObj *pFormObj = PTR_CAST( SdrUnoObj, pObj ); + const SdrUnoObj *pFormObj = dynamic_cast<const SdrUnoObj*>( pObj ); uno::Reference< awt::XControl > xControl; if ( pDrawView && pVSh->GetWin() && pFormObj ) xControl = pFormObj->GetUnoControl( *pDrawView, *pVSh->GetWin() ); diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 23b80878cbe4..6312eab62776 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -763,7 +763,7 @@ if( pSttNdIdx->GetIndex()+1 == pPam->GetBound( false ).nNode.GetIndex() ) pCNd->EndOfSectionIndex() && !bHasFlysOrMarks ) { SwViewShell *pVSh = CheckActionViewShell(); - SwCrsrShell *pCrsrSh = pVSh && pVSh->ISA(SwCrsrShell) + SwCrsrShell *pCrsrSh = pVSh && dynamic_cast< const SwCrsrShell *>( pVSh ) != nullptr ? static_cast < SwCrsrShell * >( pVSh ) : 0; if( pCrsrSh && @@ -2554,7 +2554,7 @@ SwViewShell *SwHTMLParser::CallStartAction( SwViewShell *pVSh, bool bChkPtr ) if( pActionViewShell ) { - if( pActionViewShell->ISA( SwEditShell ) ) + if( dynamic_cast< const SwEditShell *>( pActionViewShell ) != nullptr ) static_cast<SwEditShell*>(pActionViewShell)->StartAction(); else pActionViewShell->StartAction(); @@ -2586,13 +2586,13 @@ SwViewShell *SwHTMLParser::CallEndAction( bool bChkAction, bool bChkPtr ) // set the cursor to the doc begin in all CrsrEditShells for(SwViewShell& rSh : pActionViewShell->GetRingContainer()) { - if( rSh.IsA( TYPE( SwCrsrShell ) ) ) + if( dynamic_cast<const SwCrsrShell *>(&rSh) != nullptr ) static_cast<SwCrsrShell*>(&rSh)->SttEndDoc(true); } bSetCrsr = false; } - if( pActionViewShell->ISA( SwEditShell ) ) + if( dynamic_cast< const SwEditShell *>( pActionViewShell ) != nullptr ) { //Schon gescrollt?, dann dafuer sorgen, dass die View sich nicht bewegt! const bool bOldLock = pActionViewShell->IsViewLocked(); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 2243e3d76af0..a0f8c04cdcaf 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -4516,7 +4516,7 @@ void DocxAttributeOutput::WritePostponedFormControl(const SdrObject* pObject) if (!pObject || pObject->GetObjInventor() != FmFormInventor) return; - SdrUnoObj *pFormObj = const_cast<SdrUnoObj*>(PTR_CAST(SdrUnoObj,pObject)); + SdrUnoObj *pFormObj = const_cast<SdrUnoObj*>(dynamic_cast< const SdrUnoObj*>(pObject)); if (!pFormObj) return; diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 3c9c5b508545..a4e37df1db4b 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -1957,7 +1957,7 @@ void RtfAttributeOutput::OutputFlyFrame_Impl(const sw::Frame& rFrame, const Poin if (pObject && pObject->GetObjInventor() == FmFormInventor) { - if (const SdrUnoObj* pFormObj = PTR_CAST(SdrUnoObj,pObject)) + if (const SdrUnoObj* pFormObj = dynamic_cast< const SdrUnoObj*>(pObject)) { uno::Reference< awt::XControlModel > xControlModel = pFormObj->GetUnoControlModel(); diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index 6ce03c93c922..06f82d931056 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -370,7 +370,7 @@ bool WW8Export::MiserableFormFieldExportHack(const SwFrameFormat& rFrameFormat) if (!pObject || pObject->GetObjInventor() != FmFormInventor) return false; - const SdrUnoObj *pFormObj = PTR_CAST(SdrUnoObj,pObject); + const SdrUnoObj *pFormObj = dynamic_cast< const SdrUnoObj* >(pObject); if (!pFormObj) return false; @@ -1160,7 +1160,7 @@ void MSWord_SdrAttrIter::OutEEField(const SfxPoolItem& rHt) { const SvxFieldItem &rField = static_cast<const SvxFieldItem &>(rHt); const SvxFieldData *pField = rField.GetField(); - if (pField && pField->ISA(SvxURLField)) + if (pField && dynamic_cast< const SvxURLField *>( pField ) != nullptr) { sal_uInt8 nOldTextTyp = m_rExport.m_nTextTyp; m_rExport.m_nTextTyp = mnTyp; diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index b1028182b46b..f3da84285504 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -1510,13 +1510,13 @@ short MSWordExportBase::GetDefaultFrameDirection( ) const { nDir = TrueFrameDirection( *static_cast< const SwFrameFormat * >(m_pOutFormatNode) ); } - else if ( m_pOutFormatNode->ISA( SwContentNode ) ) //pagagraph + else if ( dynamic_cast< const SwContentNode *>( m_pOutFormatNode ) != nullptr ) //pagagraph { const SwContentNode *pNd = static_cast<const SwContentNode *>(m_pOutFormatNode); SwPosition aPos( *pNd ); nDir = m_pDoc->GetTextDirection( aPos ); } - else if ( m_pOutFormatNode->ISA( SwTextFormatColl ) ) + else if ( dynamic_cast< const SwTextFormatColl *>( m_pOutFormatNode ) != nullptr ) { if ( MsLangId::isRightToLeft( static_cast<LanguageType>(GetAppLanguage())) ) nDir = FRMDIR_HORI_RIGHT_TOP; diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index da762b77a132..b102aea21134 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -2014,7 +2014,7 @@ bool WW8_WrPlcSubDoc::WriteGenericText( WW8Export& rWrt, sal_uInt8 nTTyp, rWrt.GetOCXExp().ExportControl(rWrt, dynamic_cast<const SdrUnoObj&>(rObj)); rWrt.m_nTextTyp = nOldTyp; } - else if( rObj.ISA( SdrTextObj ) ) + else if( dynamic_cast<const SdrTextObj*>( &rObj) != nullptr ) rWrt.WriteSdrTextObj(dynamic_cast<const SdrTextObj&>(rObj), nTTyp); else { @@ -2265,7 +2265,7 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( WW8Export& rWrt, sal_uInt8 nTTyp, // is it an writer or sdr - textbox? const SdrObject* pObj = static_cast<SdrObject const *>(aContent[ i ]); sal_Int32 nCnt = 1; - if (pObj && !pObj->ISA( SdrTextObj ) ) + if (pObj && dynamic_cast< const SdrTextObj *>( pObj ) == nullptr ) { // find the "highest" SdrObject of this const SwFrameFormat& rFormat = *::FindFrameFormat( pObj ); diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx index c929a977ab57..3ce1b180d9c3 100644 --- a/sw/source/filter/ww8/wrtww8gr.cxx +++ b/sw/source/filter/ww8/wrtww8gr.cxx @@ -417,7 +417,7 @@ void WW8Export::OutGrf(const sw::Frame &rFrame) bool bVert = false; //The default for word in vertical text mode is to center, //otherwise a sub/super script hack is employed - if (m_pOutFormatNode && m_pOutFormatNode->ISA(SwContentNode) ) + if (m_pOutFormatNode && dynamic_cast< const SwContentNode *>( m_pOutFormatNode ) != nullptr ) { const SwTextNode* pTextNd = static_cast<const SwTextNode*>(m_pOutFormatNode); SwPosition aPos(*pTextNd); diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index deb5d121c0ae..303f338b784f 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -2920,7 +2920,7 @@ void AttributeOutputBase::TextField( const SwFormatField& rField ) void AttributeOutputBase::TextFlyContent( const SwFormatFlyCnt& rFlyContent ) { - if ( GetExport().m_pOutFormatNode && GetExport().m_pOutFormatNode->ISA( SwContentNode ) ) + if ( GetExport().m_pOutFormatNode && dynamic_cast< const SwContentNode *>( GetExport().m_pOutFormatNode ) != nullptr ) { const SwTextNode* pTextNd = static_cast<const SwTextNode*>(GetExport().m_pOutFormatNode); @@ -3219,7 +3219,7 @@ void AttributeOutputBase::ParaNumRule( const SwNumRuleItem& rNumRule ) ++nNumId; if ( GetExport().m_pOutFormatNode ) { - if ( GetExport().m_pOutFormatNode->ISA( SwContentNode ) ) + if ( dynamic_cast< const SwContentNode *>( GetExport().m_pOutFormatNode ) != nullptr ) { pTextNd = static_cast<const SwTextNode*>(GetExport().m_pOutFormatNode); @@ -3252,7 +3252,7 @@ void AttributeOutputBase::ParaNumRule( const SwNumRuleItem& rNumRule ) nNumId = 0; } } - else if ( GetExport().m_pOutFormatNode->ISA( SwTextFormatColl ) ) + else if ( dynamic_cast< const SwTextFormatColl *>( GetExport().m_pOutFormatNode ) != nullptr ) { const SwTextFormatColl* pC = static_cast<const SwTextFormatColl*>(GetExport().m_pOutFormatNode); if ( pC && pC->IsAssignedToListLevelOfOutlineStyle() ) @@ -3421,7 +3421,7 @@ void WW8AttributeOutput::TableRowEnd(sal_uInt32 nDepth) void AttributeOutputBase::FormatPageDescription( const SwFormatPageDesc& rPageDesc ) { - if ( GetExport().m_bStyDef && GetExport().m_pOutFormatNode && GetExport().m_pOutFormatNode->ISA( SwTextFormatColl ) ) + if ( GetExport().m_bStyDef && GetExport().m_pOutFormatNode && dynamic_cast< const SwTextFormatColl *>( GetExport().m_pOutFormatNode ) != nullptr ) { const SwTextFormatColl* pC = static_cast<const SwTextFormatColl*>(GetExport().m_pOutFormatNode); if ( (SfxItemState::SET != pC->GetItemState( RES_BREAK, false ) ) && rPageDesc.KnowsPageDesc() ) @@ -4306,12 +4306,12 @@ void AttributeOutputBase::ParaLineSpacing( const SvxLineSpacingItem& rSpacing ) sal_uInt16 nScript = i18n::ScriptType::LATIN; const SwAttrSet *pSet = 0; - if ( GetExport().m_pOutFormatNode && GetExport().m_pOutFormatNode->ISA( SwFormat ) ) + if ( GetExport().m_pOutFormatNode && dynamic_cast< const SwFormat *>( GetExport().m_pOutFormatNode ) != nullptr ) { const SwFormat *pFormat = static_cast<const SwFormat*>( GetExport().m_pOutFormatNode ); pSet = &pFormat->GetAttrSet(); } - else if ( GetExport().m_pOutFormatNode && GetExport().m_pOutFormatNode->ISA( SwTextNode ) ) + else if ( GetExport().m_pOutFormatNode && dynamic_cast< const SwTextNode *>( GetExport().m_pOutFormatNode ) != nullptr ) { const SwTextNode* pNd = static_cast<const SwTextNode*>(GetExport().m_pOutFormatNode); pSet = &pNd->GetSwAttrSet(); @@ -4384,12 +4384,12 @@ void WW8AttributeOutput::ParaAdjust( const SvxAdjustItem& rAdjust ) if ( m_rWW8Export.m_pOutFormatNode ) { short nDirection = FRMDIR_HORI_LEFT_TOP; - if ( m_rWW8Export.m_pOutFormatNode->ISA( SwTextNode ) ) + if ( dynamic_cast< const SwTextNode *>( m_rWW8Export.m_pOutFormatNode ) != nullptr ) { SwPosition aPos(*static_cast<const SwContentNode*>(m_rWW8Export.m_pOutFormatNode)); nDirection = m_rWW8Export.m_pDoc->GetTextDirection(aPos); } - else if ( m_rWW8Export.m_pOutFormatNode->ISA( SwTextFormatColl ) ) + else if ( dynamic_cast< const SwTextFormatColl *>( m_rWW8Export.m_pOutFormatNode ) != nullptr ) { const SwTextFormatColl* pC = static_cast<const SwTextFormatColl*>(m_rWW8Export.m_pOutFormatNode); @@ -4428,14 +4428,14 @@ void WW8AttributeOutput::FormatFrameDirection( const SvxFrameDirectionItem& rDir nDir = m_rWW8Export.TrueFrameDirection( *static_cast<const SwFrameFormat*>(m_rWW8Export.m_pOutFormatNode) ); } - else if ( m_rWW8Export.m_pOutFormatNode->ISA( SwContentNode ) ) //pagagraph + else if ( dynamic_cast< const SwContentNode *>( m_rWW8Export.m_pOutFormatNode ) != nullptr ) //pagagraph { const SwContentNode* pNd = static_cast<const SwContentNode*>(m_rWW8Export.m_pOutFormatNode); SwPosition aPos( *pNd ); nDir = m_rWW8Export.m_pDoc->GetTextDirection( aPos ); } - else if ( m_rWW8Export.m_pOutFormatNode->ISA( SwTextFormatColl ) ) + else if ( dynamic_cast< const SwTextFormatColl *>( m_rWW8Export.m_pOutFormatNode ) != nullptr ) nDir = FRMDIR_HORI_LEFT_TOP; //what else can we do :-( } diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index fb4e1d052211..580dc9046353 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -1460,7 +1460,7 @@ void SwWW8ImplReader::ReadGrafLayer1( WW8PLCFspecial* pPF, long nGrafAnchorCp ) SwFrameFormat *pFrm = m_rDoc.getIDocumentContentOperations().InsertDrawObj( *m_pPaM, *pObject, aSet ); pObject->SetMergedItemSet(aSet); - if (pFrm->ISA(SwDrawFrameFormat)) + if (dynamic_cast< const SwDrawFrameFormat *>( pFrm ) != nullptr) { static_cast<SwDrawFrameFormat*>(pFrm)->PosAttrSet(); } @@ -2142,7 +2142,7 @@ SdrObject* SwWW8ImplReader::CreateContactObject(SwFrameFormat* pFlyFormat) SdrObject* pNewObject = m_bNewDoc ? 0 : pFlyFormat->FindRealSdrObject(); if (!pNewObject) pNewObject = pFlyFormat->FindSdrObject(); - if (!pNewObject && pFlyFormat->ISA(SwFlyFrameFormat)) + if (!pNewObject && dynamic_cast< const SwFlyFrameFormat *>( pFlyFormat ) != nullptr) { SwFlyDrawContact* pContactObject = new SwFlyDrawContact(static_cast<SwFlyFrameFormat*>(pFlyFormat), @@ -2745,7 +2745,7 @@ SwFrameFormat* SwWW8ImplReader::Read_GrafLayer( long nGrafAnchorCp ) } // #i44344#, #i44681# - positioning attributes already set - if ( pRetFrameFormat /*#i52825# */ && pRetFrameFormat->ISA(SwDrawFrameFormat) ) + if ( pRetFrameFormat /*#i52825# */ && dynamic_cast< const SwDrawFrameFormat *>( pRetFrameFormat ) != nullptr ) { static_cast<SwDrawFrameFormat*>(pRetFrameFormat)->PosAttrSet(); } @@ -2779,7 +2779,7 @@ SwFrameFormat* SwWW8ImplReader::MungeTextIntoDrawBox(SdrObject* pTrueObject, SdrTextObj* pSdrTextObj; // Pruefen, ob Gruppenobjekt (z.B. zwei Klammern) vorliegt - if (SdrObjGroup* pThisGroup = PTR_CAST(SdrObjGroup, pRecord->pObj)) + if (SdrObjGroup* pThisGroup = dynamic_cast<SdrObjGroup*>( pRecord->pObj) ) { // Gruppenobjekte haben keinen Text. Fuege ein Textobjekt in die // Gruppe ein, um den Text zu halten. @@ -2805,7 +2805,7 @@ SwFrameFormat* SwWW8ImplReader::MungeTextIntoDrawBox(SdrObject* pTrueObject, pThisGroup->GetSubList()->NbcInsertObject(pSdrTextObj); } else - pSdrTextObj = PTR_CAST(SdrTextObj, pRecord->pObj); + pSdrTextObj = dynamic_cast<SdrTextObj*>( pRecord->pObj ); if( pSdrTextObj ) { diff --git a/sw/source/filter/ww8/ww8graf2.cxx b/sw/source/filter/ww8/ww8graf2.cxx index 6af7d80b81c1..35e05fe8a241 100644 --- a/sw/source/filter/ww8/ww8graf2.cxx +++ b/sw/source/filter/ww8/ww8graf2.cxx @@ -648,7 +648,7 @@ SwFrameFormat* SwWW8ImplReader::ImportGraf(SdrTextObj* pTextObj, } else { - if (SdrGrafObj* pGraphObject = PTR_CAST(SdrGrafObj, pObject)) + if (SdrGrafObj* pGraphObject = dynamic_cast<SdrGrafObj*>( pObject) ) { // Now add the link or rather the graphic to the doc const Graphic& rGraph = pGraphObject->GetGraphic(); diff --git a/sw/source/filter/ww8/ww8par4.cxx b/sw/source/filter/ww8/ww8par4.cxx index 0a5d6bee7edf..ccf4e87c0957 100644 --- a/sw/source/filter/ww8/ww8par4.cxx +++ b/sw/source/filter/ww8/ww8par4.cxx @@ -286,7 +286,7 @@ SwFrameFormat* SwWW8ImplReader::ImportOle(const Graphic* pGrf, if (pRet) // OLE object was inserted { - if (pRet->ISA(SdrOle2Obj)) + if (dynamic_cast< const SdrOle2Obj *>( pRet ) != nullptr) { pFormat = InsertOle(*static_cast<SdrOle2Obj*>(pRet), *pFlySet, pGrfSet); SdrObject::Free( pRet ); // we don't need this anymore diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx index 413ace2629a4..fa980ab8b8a5 100644 --- a/sw/source/filter/xml/xmlexp.cxx +++ b/sw/source/filter/xml/xmlexp.cxx @@ -166,7 +166,7 @@ sal_uInt32 SwXMLExport::exportDoc( enum XMLTokenEnum eClass ) if( 0 != pItem ) { const SvXMLAttrContainerItem *pUnknown = - PTR_CAST( SvXMLAttrContainerItem, pItem ); + dynamic_cast<const SvXMLAttrContainerItem*>( pItem ); OSL_ENSURE( pUnknown, "illegal attribute container item" ); if( pUnknown && (pUnknown->GetAttrCount() > 0) ) { diff --git a/sw/source/filter/xml/xmlexpit.cxx b/sw/source/filter/xml/xmlexpit.cxx index 6a74e1b85d68..a7b65e0c037f 100644 --- a/sw/source/filter/xml/xmlexpit.cxx +++ b/sw/source/filter/xml/xmlexpit.cxx @@ -117,7 +117,7 @@ void SvXMLExportItemMapper::exportXML( const SvXMLExport& rExport, { if( 0 != (rEntry.nMemberId & MID_SW_FLAG_SPECIAL_ITEM_EXPORT) ) { - if( rItem.ISA( SwFormatRowSplit ) ) + if( dynamic_cast<const SwFormatRowSplit*>( &rItem) != nullptr ) { OUString aValue; bool bAddAttribute = true; @@ -134,7 +134,7 @@ void SvXMLExportItemMapper::exportXML( const SvXMLExport& rExport, else { OUStringBuffer aOut; - const SfxBoolItem* pSplit = PTR_CAST(SfxBoolItem, &rItem); + const SfxBoolItem* pSplit = dynamic_cast<const SfxBoolItem*>( &rItem ); assert(pSplit && "Wrong Which-ID"); const unsigned int eEnum = (pSplit && pSplit->GetValue()) ? 1 : 0; SvXMLUnitConverter::convertEnum( aOut, eEnum, aXML_KeepTogetherType ); @@ -147,13 +147,13 @@ void SvXMLExportItemMapper::exportXML( const SvXMLExport& rExport, rAttrList.AddAttribute( sName, aValue ); } } - if( rItem.ISA( SvXMLAttrContainerItem ) ) + if( dynamic_cast<const SvXMLAttrContainerItem*>( &rItem) != nullptr ) { SvXMLNamespaceMap *pNewNamespaceMap = 0; const SvXMLNamespaceMap *pNamespaceMap = &rNamespaceMap; const SvXMLAttrContainerItem *pUnknown = - PTR_CAST( SvXMLAttrContainerItem, &rItem ); + dynamic_cast<const SvXMLAttrContainerItem*>( &rItem ); const sal_uInt16 nCount = pUnknown ? pUnknown->GetAttrCount() : 0; for( sal_uInt16 i=0; i < nCount; i++ ) @@ -384,7 +384,7 @@ bool SvXMLExportItemMapper::QueryXMLValue( case RES_LR_SPACE: { - const SvxLRSpaceItem* pLRSpace = PTR_CAST(SvxLRSpaceItem, &rItem); + const SvxLRSpaceItem* pLRSpace = dynamic_cast<const SvxLRSpaceItem*>( &rItem ); OSL_ENSURE( pLRSpace != NULL, "Wrong Which-ID!" ); bOk = true; @@ -454,7 +454,7 @@ bool SvXMLExportItemMapper::QueryXMLValue( case RES_UL_SPACE: { - const SvxULSpaceItem* pULSpace = PTR_CAST(SvxULSpaceItem, &rItem); + const SvxULSpaceItem* pULSpace = dynamic_cast<const SvxULSpaceItem*>( &rItem ); OSL_ENSURE( pULSpace != NULL, "Wrong Which-ID!" ); switch( nMemberId ) @@ -495,7 +495,7 @@ bool SvXMLExportItemMapper::QueryXMLValue( case RES_SHADOW: { - const SvxShadowItem* pShadow = PTR_CAST(SvxShadowItem, &rItem); + const SvxShadowItem* pShadow = dynamic_cast<const SvxShadowItem*>( &rItem ); assert(pShadow && "Wrong Which-ID"); if (pShadow) { @@ -536,7 +536,7 @@ bool SvXMLExportItemMapper::QueryXMLValue( case RES_BOX: { - const SvxBoxItem* pBox = PTR_CAST(SvxBoxItem, &rItem); + const SvxBoxItem* pBox = dynamic_cast<const SvxBoxItem*>( &rItem ); assert(pBox && "Wrong Which-ID"); if (pBox) { @@ -839,7 +839,7 @@ bool SvXMLExportItemMapper::QueryXMLValue( case RES_BREAK: { - const SvxFormatBreakItem* pFormatBreak = PTR_CAST(SvxFormatBreakItem, &rItem); + const SvxFormatBreakItem* pFormatBreak = dynamic_cast<const SvxFormatBreakItem*>( &rItem ); OSL_ENSURE( pFormatBreak != NULL, "Wrong Which-ID" ); unsigned int eEnum = 0; @@ -886,7 +886,7 @@ bool SvXMLExportItemMapper::QueryXMLValue( case RES_KEEP: { - const SvxFormatKeepItem* pFormatKeep = PTR_CAST(SvxFormatKeepItem, &rItem); + const SvxFormatKeepItem* pFormatKeep = dynamic_cast<const SvxFormatKeepItem*>( &rItem ); assert(pFormatKeep && "Wrong Which-ID"); if (pFormatKeep) { @@ -900,7 +900,7 @@ bool SvXMLExportItemMapper::QueryXMLValue( case RES_BACKGROUND: { - const SvxBrushItem* pBrush = PTR_CAST(SvxBrushItem, &rItem); + const SvxBrushItem* pBrush = dynamic_cast<const SvxBrushItem*>( &rItem ); OSL_ENSURE( pBrush != NULL, "Wrong Which-ID" ); // note: the graphic is only exported if nMemberId equals @@ -1014,7 +1014,7 @@ bool SvXMLExportItemMapper::QueryXMLValue( case RES_PAGEDESC: { - const SwFormatPageDesc* pPageDesc = PTR_CAST(SwFormatPageDesc, &rItem); + const SwFormatPageDesc* pPageDesc = dynamic_cast<const SwFormatPageDesc*>( &rItem ); OSL_ENSURE( pPageDesc != NULL, "Wrong Which-ID" ); if( MID_PAGEDESC_PAGENUMOFFSET==nMemberId ) @@ -1038,7 +1038,7 @@ bool SvXMLExportItemMapper::QueryXMLValue( case RES_LAYOUT_SPLIT: case RES_ROW_SPLIT: { - const SfxBoolItem* pSplit = PTR_CAST(SfxBoolItem, &rItem); + const SfxBoolItem* pSplit = dynamic_cast<const SfxBoolItem*>( &rItem ); assert(pSplit && "Wrong Which-ID"); if (pSplit) { @@ -1050,7 +1050,7 @@ bool SvXMLExportItemMapper::QueryXMLValue( case RES_HORI_ORIENT: { - const SwFormatHoriOrient* pHoriOrient = PTR_CAST(SwFormatHoriOrient, &rItem); + const SwFormatHoriOrient* pHoriOrient = dynamic_cast<const SwFormatHoriOrient*>( &rItem ); assert(pHoriOrient && "Wrong Which-ID"); if (pHoriOrient) { @@ -1063,7 +1063,7 @@ bool SvXMLExportItemMapper::QueryXMLValue( case RES_VERT_ORIENT: { - const SwFormatVertOrient* pVertOrient = PTR_CAST(SwFormatVertOrient, &rItem); + const SwFormatVertOrient* pVertOrient = dynamic_cast<const SwFormatVertOrient*>( &rItem ); assert(pVertOrient && "Wrong Which-ID"); SvXMLUnitConverter::convertEnum( aOut, pVertOrient->GetVertOrient(), @@ -1074,7 +1074,7 @@ bool SvXMLExportItemMapper::QueryXMLValue( case RES_FRM_SIZE: { - const SwFormatFrmSize* pFrmSize = PTR_CAST(SwFormatFrmSize, &rItem); + const SwFormatFrmSize* pFrmSize = dynamic_cast<const SwFormatFrmSize*>( &rItem ); OSL_ENSURE( pFrmSize != NULL, "Wrong Which-ID" ); bool bOutHeight = false; @@ -1128,7 +1128,7 @@ bool SvXMLExportItemMapper::QueryXMLValue( case RES_COLLAPSING_BORDERS: { - const SfxBoolItem* pBorders = PTR_CAST(SfxBoolItem, &rItem); + const SfxBoolItem* pBorders = dynamic_cast<const SfxBoolItem*>( &rItem ); assert(pBorders && "Wrong RES-ID"); if (pBorders) { diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx index 7d4e8df63b9b..51f0869b020f 100644 --- a/sw/source/filter/xml/xmlfmt.cxx +++ b/sw/source/filter/xml/xmlfmt.cxx @@ -1044,7 +1044,7 @@ bool SwXMLImport::FindAutomaticStyle( SwXMLItemSetStyleContext_Impl *pStyle = 0; if( GetAutoStyles() ) { - pStyle = const_cast<SwXMLItemSetStyleContext_Impl*>(PTR_CAST( SwXMLItemSetStyleContext_Impl, + pStyle = const_cast<SwXMLItemSetStyleContext_Impl*>(dynamic_cast< const SwXMLItemSetStyleContext_Impl* >( GetAutoStyles()-> FindStyleChildContext( nFamily, rName, true ) ) ); diff --git a/sw/source/filter/xml/xmlimpit.cxx b/sw/source/filter/xml/xmlimpit.cxx index 50e1d3fd2340..58b5d27ddc33 100644 --- a/sw/source/filter/xml/xmlimpit.cxx +++ b/sw/source/filter/xml/xmlimpit.cxx @@ -159,7 +159,7 @@ void SvXMLImportItemMapper::importXML( SfxItemSet& rSet, &pItem ) ) { SfxPoolItem *pNew = pItem->Clone(); - pUnknownItem = PTR_CAST( SvXMLAttrContainerItem, pNew ); + pUnknownItem = dynamic_cast<SvXMLAttrContainerItem*>( pNew ); OSL_ENSURE( pUnknownItem, "SvXMLAttrContainerItem expected" ); if( !pUnknownItem ) @@ -263,7 +263,7 @@ bool SvXMLImportItemMapper::PutXMLValue( { case RES_LR_SPACE: { - SvxLRSpaceItem* pLRSpace = PTR_CAST(SvxLRSpaceItem, &rItem); + SvxLRSpaceItem* pLRSpace = dynamic_cast<SvxLRSpaceItem*>( &rItem ); OSL_ENSURE( pLRSpace != NULL, "Wrong Which-ID!" ); switch( nMemberId ) @@ -326,7 +326,7 @@ bool SvXMLImportItemMapper::PutXMLValue( case RES_UL_SPACE: { - SvxULSpaceItem* pULSpace = PTR_CAST(SvxULSpaceItem, &rItem); + SvxULSpaceItem* pULSpace = dynamic_cast<SvxULSpaceItem*>( &rItem ); OSL_ENSURE( pULSpace != NULL, "Wrong Which-ID!" ); sal_Int32 nProp = 100; @@ -353,7 +353,7 @@ bool SvXMLImportItemMapper::PutXMLValue( case RES_SHADOW: { - SvxShadowItem* pShadow = PTR_CAST(SvxShadowItem, &rItem); + SvxShadowItem* pShadow = dynamic_cast<SvxShadowItem*>( &rItem ); OSL_ENSURE( pShadow != NULL, "Wrong Which-ID" ); bool bColorFound = false; @@ -434,7 +434,7 @@ bool SvXMLImportItemMapper::PutXMLValue( case RES_BOX: { - SvxBoxItem* pBox = PTR_CAST(SvxBoxItem, &rItem); + SvxBoxItem* pBox = dynamic_cast<SvxBoxItem*>( &rItem ); OSL_ENSURE( pBox != NULL, "Wrong WHich-ID" ); // copy SvxBorderLines @@ -590,7 +590,7 @@ bool SvXMLImportItemMapper::PutXMLValue( case RES_BREAK: { - SvxFormatBreakItem* pFormatBreak = PTR_CAST(SvxFormatBreakItem, &rItem); + SvxFormatBreakItem* pFormatBreak = dynamic_cast<SvxFormatBreakItem*>( &rItem ); OSL_ENSURE( pFormatBreak != NULL, "Wrong Which-ID" ); sal_uInt16 eEnum; @@ -625,7 +625,7 @@ bool SvXMLImportItemMapper::PutXMLValue( case RES_KEEP: { - SvxFormatKeepItem* pFormatKeep = PTR_CAST(SvxFormatKeepItem, &rItem); + SvxFormatKeepItem* pFormatKeep = dynamic_cast<SvxFormatKeepItem*>( &rItem ); OSL_ENSURE( pFormatKeep != NULL, "Wrong Which-ID" ); if( IsXMLToken( rValue, XML_ALWAYS ) || @@ -645,7 +645,7 @@ bool SvXMLImportItemMapper::PutXMLValue( case RES_BACKGROUND: { - SvxBrushItem* pBrush = PTR_CAST(SvxBrushItem, &rItem); + SvxBrushItem* pBrush = dynamic_cast<SvxBrushItem*>( &rItem ); OSL_ENSURE( pBrush != NULL, "Wrong Which-ID" ); sal_Int32 nTempColor(0); @@ -788,7 +788,7 @@ bool SvXMLImportItemMapper::PutXMLValue( case RES_PAGEDESC: { - SwFormatPageDesc* pPageDesc = PTR_CAST(SwFormatPageDesc, &rItem); + SwFormatPageDesc* pPageDesc = dynamic_cast<SwFormatPageDesc*>( &rItem ); OSL_ENSURE( pPageDesc != NULL, "Wrong Which-ID" ); if( MID_PAGEDESC_PAGENUMOFFSET==nMemberId ) @@ -805,7 +805,7 @@ bool SvXMLImportItemMapper::PutXMLValue( case RES_LAYOUT_SPLIT: case RES_ROW_SPLIT: { - SfxBoolItem* pSplit = PTR_CAST(SfxBoolItem, &rItem); + SfxBoolItem* pSplit = dynamic_cast<SfxBoolItem*>( &rItem ); OSL_ENSURE( pSplit != NULL, "Wrong Which-ID" ); if( IsXMLToken( rValue, XML_AUTO ) || @@ -825,7 +825,7 @@ bool SvXMLImportItemMapper::PutXMLValue( case RES_HORI_ORIENT: { - SwFormatHoriOrient* pHoriOrient = PTR_CAST(SwFormatHoriOrient, &rItem); + SwFormatHoriOrient* pHoriOrient = dynamic_cast<SwFormatHoriOrient*>( &rItem ); OSL_ENSURE( pHoriOrient != NULL, "Wrong Which-ID" ); sal_uInt16 nValue; @@ -838,7 +838,7 @@ bool SvXMLImportItemMapper::PutXMLValue( case RES_VERT_ORIENT: { - SwFormatVertOrient* pVertOrient = PTR_CAST(SwFormatVertOrient, &rItem); + SwFormatVertOrient* pVertOrient = dynamic_cast<SwFormatVertOrient*>( &rItem ); OSL_ENSURE( pVertOrient != NULL, "Wrong Which-ID" ); sal_uInt16 nValue; @@ -857,7 +857,7 @@ bool SvXMLImportItemMapper::PutXMLValue( case RES_FRM_SIZE: { - SwFormatFrmSize* pFrmSize = PTR_CAST(SwFormatFrmSize, &rItem); + SwFormatFrmSize* pFrmSize = dynamic_cast<SwFormatFrmSize*>( &rItem ); OSL_ENSURE( pFrmSize != NULL, "Wrong Which-ID" ); bool bSetHeight = false; @@ -960,7 +960,7 @@ bool SvXMLImportItemMapper::PutXMLValue( case RES_COLLAPSING_BORDERS: { - SfxBoolItem* pBorders = PTR_CAST(SfxBoolItem, &rItem); + SfxBoolItem* pBorders = dynamic_cast<SfxBoolItem*>( &rItem ); OSL_ENSURE( pBorders != NULL, "Wrong Which-ID" ); if( IsXMLToken( rValue, XML_COLLAPSING ) ) diff --git a/sw/source/filter/xml/xmltble.cxx b/sw/source/filter/xml/xmltble.cxx index cf41302ba6b2..66b1388b377c 100644 --- a/sw/source/filter/xml/xmltble.cxx +++ b/sw/source/filter/xml/xmltble.cxx @@ -1078,7 +1078,7 @@ void SwXMLExport::ExportTable( const SwTableNode& rTableNd ) SvXMLElementExport aElem( *this, nPrefix, XML_TABLE, true, true ); // export DDE source (if this is a DDE table) - if ( rTable.ISA(SwDDETable) ) + if ( dynamic_cast<const SwDDETable*>( &rTable) != nullptr ) { // get DDE Field Type (contains the DDE connection) const SwDDEFieldType* pDDEFieldType = diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx index 4b672fb64f51..c4ec368b83d2 100644 --- a/sw/source/ui/config/optpage.cxx +++ b/sw/source/ui/config/optpage.cxx @@ -1947,13 +1947,12 @@ bool SwRedlineOptionsTabPage::FillItemSet( SfxItemSet* ) nOldMarkMode != pOpt->GetMarkAlignMode()) { // update all documents - TypeId aType(TYPE(SwDocShell)); - SwDocShell* pDocShell = static_cast<SwDocShell*>(SfxObjectShell::GetFirst(&aType)); + SwDocShell* pDocShell = static_cast<SwDocShell*>(SfxObjectShell::GetFirst(checkSfxObjectShell<SwDocShell>)); while( pDocShell ) { pDocShell->GetWrtShell()->UpdateRedlineAttr(); - pDocShell = static_cast<SwDocShell*>(SfxObjectShell::GetNext(*pDocShell, &aType)); + pDocShell = static_cast<SwDocShell*>(SfxObjectShell::GetNext(*pDocShell, checkSfxObjectShell<SwDocShell>)); } } diff --git a/sw/source/ui/dialog/docstdlg.cxx b/sw/source/ui/dialog/docstdlg.cxx index 1744d261c699..18adafa64d49 100644 --- a/sw/source/ui/dialog/docstdlg.cxx +++ b/sw/source/ui/dialog/docstdlg.cxx @@ -122,9 +122,9 @@ void SwDocStatPage::Update() { SfxViewShell *pVSh = SfxViewShell::Current(); SwViewShell *pSh = 0; - if ( pVSh->ISA(SwView) ) + if ( dynamic_cast< const SwView *>( pVSh ) != nullptr ) pSh = static_cast<SwView*>(pVSh)->GetWrtShellPtr(); - else if ( pVSh->ISA(SwPagePreview) ) + else if ( dynamic_cast< const SwPagePreview *>( pVSh ) != nullptr ) pSh = static_cast<SwPagePreview*>(pVSh)->GetViewShell(); OSL_ENSURE( pSh, "Shell not found" ); diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx index a03d382ce7ee..ab0a489f1d5a 100644 --- a/sw/source/ui/dialog/uiregionsw.cxx +++ b/sw/source/ui/dialog/uiregionsw.cxx @@ -340,7 +340,7 @@ SwEditRegionDlg::SwEditRegionDlg( vcl::Window* pParent, SwWrtShell& rWrtSh ) get(m_pDismiss, "remove"); get(m_pOK, "ok"); - bWeb = 0 != PTR_CAST( SwWebDocShell, rSh.GetView().GetDocShell() ); + bWeb = dynamic_cast<SwWebDocShell*>( rSh.GetView().GetDocShell() ) != nullptr; m_pTree->SetSelectHdl(LINK(this, SwEditRegionDlg, GetFirstEntryHdl)); m_pTree->SetDeselectHdl(LINK(this, SwEditRegionDlg, DeselectHdl)); @@ -1419,7 +1419,7 @@ SwInsertSectionTabDialog::SwInsertSectionTabDialog( SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get(); long nHtmlMode = rHtmlOpt.GetExportMode(); - bool bWeb = 0 != PTR_CAST( SwWebDocShell, rSh.GetView().GetDocShell() ); + bool bWeb = dynamic_cast<SwWebDocShell*>( rSh.GetView().GetDocShell() ) != nullptr ; if(bWeb) { RemoveTabPage(m_nNotePageId); @@ -1574,7 +1574,7 @@ void SwInsertSectionTabPage::SetWrtShell(SwWrtShell& rSh) { m_pWrtSh = &rSh; - bool bWeb = 0 != PTR_CAST(SwWebDocShell, m_pWrtSh->GetView().GetDocShell()); + bool bWeb = dynamic_cast<SwWebDocShell*>( m_pWrtSh->GetView().GetDocShell() )!= nullptr; if(bWeb) { m_pHideCB->Hide(); @@ -2099,7 +2099,7 @@ SwSectionPropertyTabDialog::SwSectionPropertyTabDialog( SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get(); long nHtmlMode = rHtmlOpt.GetExportMode(); - bool bWeb = 0 != PTR_CAST( SwWebDocShell, rSh.GetView().GetDocShell() ); + bool bWeb = dynamic_cast<SwWebDocShell*>( rSh.GetView().GetDocShell() ) != nullptr ; if(bWeb) { RemoveTabPage(m_nNotePageId); diff --git a/sw/source/ui/fldui/fldtdlg.cxx b/sw/source/ui/fldui/fldtdlg.cxx index 87d9b1cb2157..e0f3d9b94fe7 100644 --- a/sw/source/ui/fldui/fldtdlg.cxx +++ b/sw/source/ui/fldui/fldtdlg.cxx @@ -308,11 +308,10 @@ void SwFieldDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage) SfxViewFrame* pViewFrame = pDispatch ? pDispatch->GetFrame() : 0; if(pViewFrame) { - const TypeId aSwViewTypeId = TYPE(SwView); - SfxViewShell* pViewShell = SfxViewShell::GetFirst( &aSwViewTypeId ); + SfxViewShell* pViewShell = SfxViewShell::GetFirst( true, checkSfxViewShell<SwView> ); while(pViewShell && pViewShell->GetViewFrame() != pViewFrame) { - pViewShell = SfxViewShell::GetNext( *pViewShell, &aSwViewTypeId ); + pViewShell = SfxViewShell::GetNext( *pViewShell, true, checkSfxViewShell<SwView> ); } if(pViewShell) static_cast<SwFieldDBPage&>(rPage).SetWrtShell(static_cast<SwView*>(pViewShell)->GetWrtShell()); diff --git a/sw/source/ui/fmtui/tmpdlg.cxx b/sw/source/ui/fmtui/tmpdlg.cxx index d344cd8ca3b5..5463e135a3f8 100644 --- a/sw/source/ui/fmtui/tmpdlg.cxx +++ b/sw/source/ui/fmtui/tmpdlg.cxx @@ -538,14 +538,14 @@ void SwTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) aList.push_back( rCharFormatLB->GetEntry(j) ); aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ; - FieldUnit eMetric = ::GetDfltMetric(pDocShell->ISA(SwWebDocShell)); + FieldUnit eMetric = ::GetDfltMetric(dynamic_cast< const SwWebDocShell *>( pDocShell ) != nullptr); aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric))); rPage.PageCreated(aSet); } else if (nId == m_nNumPosId) { SwDocShell* pDocShell = ::GetActiveWrtShell()->GetView().GetDocShell(); - FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, pDocShell)); + FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebDocShell*>( pDocShell) != nullptr ); aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric))); rPage.PageCreated(aSet); diff --git a/sw/source/ui/misc/docfnote.cxx b/sw/source/ui/misc/docfnote.cxx index cdea464d6b50..589c55fa0ac3 100644 --- a/sw/source/ui/misc/docfnote.cxx +++ b/sw/source/ui/misc/docfnote.cxx @@ -149,7 +149,7 @@ void SwEndNoteOptionPage::Reset( const SfxItemSet* ) : new SwFootnoteInfo( pSh->GetFootnoteInfo() )); SfxObjectShell * pDocSh = SfxObjectShell::Current(); - if (PTR_CAST(SwWebDocShell, pDocSh)) + if (dynamic_cast<SwWebDocShell*>( pDocSh) ) m_pStylesContainer->Hide(); if ( bEndNote ) diff --git a/sw/source/ui/misc/num.cxx b/sw/source/ui/misc/num.cxx index 8636c8e2b144..6d7a370dd269 100644 --- a/sw/source/ui/misc/num.cxx +++ b/sw/source/ui/misc/num.cxx @@ -570,7 +570,7 @@ void SwNumPositionTabPage::SetWrtShell(SwWrtShell* pSh) const SwRect& rPrtRect = pWrtSh->GetAnyCurRect(RECT_PAGE); m_pPreviewWIN->SetPageWidth(rPrtRect.Width()); - FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &pWrtSh->GetView())); + FieldUnit eMetric = ::GetDfltMetric( dynamic_cast<SwWebView*>( &pWrtSh->GetView()) != nullptr ); if(eMetric == FUNIT_MM) { m_pDistBorderMF->SetDecimalDigits(1); @@ -1004,14 +1004,14 @@ void SwSvxNumBulletTabDialog::PageCreated(sal_uInt16 nPageId, SfxTabPage& rPage) aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ; - FieldUnit eMetric = ::GetDfltMetric(pDocShell->ISA(SwWebDocShell)); + FieldUnit eMetric = ::GetDfltMetric(dynamic_cast< const SwWebDocShell *>( pDocShell ) != nullptr); aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric) ) ); rPage.PageCreated(aSet); } else if (nPageId == m_nPositionPageId) { SwDocShell* pDocShell = rWrtSh.GetView().GetDocShell(); - FieldUnit eMetric = ::GetDfltMetric(pDocShell->ISA(SwWebDocShell)); + FieldUnit eMetric = ::GetDfltMetric(dynamic_cast< const SwWebDocShell *>( pDocShell ) != nullptr); SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric)) ); rPage.PageCreated(aSet); diff --git a/sw/source/ui/table/colwd.cxx b/sw/source/ui/table/colwd.cxx index 1ab303f1d9fd..bea63ffdec9f 100644 --- a/sw/source/ui/table/colwd.cxx +++ b/sw/source/ui/table/colwd.cxx @@ -48,8 +48,8 @@ SwTableWidthDlg::SwTableWidthDlg(vcl::Window *pParent, SwTableFUNC &rTableFnc ) get(m_pWidthMF, "width"); bool bIsWeb = rTableFnc.GetShell() - && (0 != PTR_CAST( SwWebDocShell, - rTableFnc.GetShell()->GetView().GetDocShell()) ); + && (dynamic_cast< const SwWebDocShell* >( + rTableFnc.GetShell()->GetView().GetDocShell()) != nullptr ); FieldUnit eFieldUnit = SW_MOD()->GetUsrPref( bIsWeb )->GetMetric(); ::SetFieldUnit(*m_pWidthMF, eFieldUnit); diff --git a/sw/source/ui/table/rowht.cxx b/sw/source/ui/table/rowht.cxx index 0dddb91636a0..8dbec1ddb59d 100644 --- a/sw/source/ui/table/rowht.cxx +++ b/sw/source/ui/table/rowht.cxx @@ -56,8 +56,8 @@ SwTableHeightDlg::SwTableHeightDlg(vcl::Window *pParent, SwWrtShell &rS) get(m_pHeightEdit, "heightmf"); get(m_pAutoHeightCB, "fit"); - FieldUnit eFieldUnit = SW_MOD()->GetUsrPref( 0 != PTR_CAST( SwWebDocShell, - rSh.GetView().GetDocShell() ) )->GetMetric(); + FieldUnit eFieldUnit = SW_MOD()->GetUsrPref( dynamic_cast< const SwWebDocShell*>( + rSh.GetView().GetDocShell() ) != nullptr )->GetMetric(); ::SetFieldUnit(*m_pHeightEdit, eFieldUnit); m_pHeightEdit->SetMin(MINLAY, FUNIT_TWIP); diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx index 1156673aeb30..bb6004ee0a2a 100644 --- a/sw/source/uibase/app/apphdl.cxx +++ b/sw/source/uibase/app/apphdl.cxx @@ -154,7 +154,7 @@ void SwModule::StateOther(SfxItemSet &rSet) sal_uInt16 nWhich = aIter.FirstWhich(); SwView* pActView = ::GetActiveView(); - bool bWebView = 0 != PTR_CAST(SwWebView, pActView); + bool bWebView = dynamic_cast<SwWebView*>( pActView ) != nullptr; while(nWhich) { @@ -166,7 +166,7 @@ void SwModule::StateOther(SfxItemSet &rSet) { bool bDisable = false; SfxViewShell* pCurrView = SfxViewShell::Current(); - if( !pCurrView || !pCurrView->ISA(SwView) ) + if( !pCurrView || dynamic_cast< const SwView *>( pCurrView ) == nullptr ) bDisable = true; SwDocShell *pDocSh = static_cast<SwDocShell*>( SfxObjectShell::Current()); if ( bDisable || @@ -234,9 +234,9 @@ SwView* lcl_LoadDoc(SwView* pView, const OUString& rURL) SfxViewShell* pViewShell = pShell->GetViewShell(); if(pViewShell) { - if( pViewShell->ISA(SwView) ) + if( 0!= dynamic_cast<SwView*>(pViewShell) ) { - pNewView = PTR_CAST(SwView,pViewShell); + pNewView = dynamic_cast< SwView* >(pViewShell); pNewView->GetViewFrame()->GetFrame().Appear(); } else @@ -254,7 +254,7 @@ SwView* lcl_LoadDoc(SwView* pView, const OUString& rURL) SfxCallMode::SYNCHRON, &aFactory, 0L)); SfxFrame* pFrm = pItem ? pItem->GetFrame() : 0; SfxViewFrame* pFrame = pFrm ? pFrm->GetCurrentViewFrame() : 0; - pNewView = pFrame ? PTR_CAST(SwView, pFrame->GetViewShell()) : 0; + pNewView = pFrame ? dynamic_cast<SwView*>( pFrame->GetViewShell() ) : 0; } return pNewView; @@ -652,7 +652,7 @@ void SwModule::ExecOther(SfxRequest& rReq) case FUNIT_POINT: { SwView* pActView = ::GetActiveView(); - bool bWebView = 0 != PTR_CAST(SwWebView, pActView); + bool bWebView = dynamic_cast<SwWebView*>( pActView ) != nullptr; ::SetDfltMetric(eUnit, bWebView); } break; @@ -663,7 +663,7 @@ void SwModule::ExecOther(SfxRequest& rReq) case FN_SET_MODOPT_TBLNUMFMT: { - bool bWebView = 0 != PTR_CAST(SwWebView, ::GetActiveView() ), + bool bWebView = dynamic_cast<SwWebView*>( ::GetActiveView() )!= nullptr , bSet; if( pArgs && SfxItemState::SET == pArgs->GetItemState( @@ -694,7 +694,7 @@ void SwModule::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) if( dynamic_cast<const SfxEventHint*>(&rHint) ) { const SfxEventHint& rEvHint = static_cast<const SfxEventHint&>( rHint); - SwDocShell* pDocSh = PTR_CAST( SwDocShell, rEvHint.GetObjShell() ); + SwDocShell* pDocSh = dynamic_cast<SwDocShell*>( rEvHint.GetObjShell() ); if( pDocSh ) { SwWrtShell* pWrtSh = pDocSh->GetWrtShell(); @@ -808,23 +808,20 @@ void SwModule::ConfigurationChanged( utl::ConfigurationBroadcaster* pBrdCst, sal bAccessibility = true; //invalidate all edit windows - const TypeId aSwViewTypeId = TYPE(SwView); - const TypeId aSwPreviewTypeId = TYPE(SwPagePreview); - const TypeId aSwSrcViewTypeId = TYPE(SwSrcView); SfxViewShell* pViewShell = SfxViewShell::GetFirst(); while(pViewShell) { if(pViewShell->GetWindow()) { - if((pViewShell->IsA(aSwViewTypeId) || - pViewShell->IsA(aSwPreviewTypeId) || - pViewShell->IsA(aSwSrcViewTypeId))) + if((dynamic_cast< const SwView *>( pViewShell ) != nullptr || + dynamic_cast< const SwPagePreview *>( pViewShell ) != nullptr || + dynamic_cast< const SwSrcView *>( pViewShell ) != nullptr)) { if(bAccessibility) { - if(pViewShell->IsA(aSwViewTypeId)) + if(dynamic_cast< const SwView *>( pViewShell ) != nullptr) static_cast<SwView*>(pViewShell)->ApplyAccessiblityOptions(*m_pAccessibilityOptions); - else if(pViewShell->IsA(aSwPreviewTypeId)) + else if(dynamic_cast< const SwPagePreview *>( pViewShell ) != nullptr) static_cast<SwPagePreview*>(pViewShell)->ApplyAccessiblityOptions(*m_pAccessibilityOptions); } pViewShell->GetWindow()->Invalidate(); @@ -838,7 +835,7 @@ void SwModule::ConfigurationChanged( utl::ConfigurationBroadcaster* pBrdCst, sal const SfxObjectShell* pObjSh = SfxObjectShell::GetFirst(); while( pObjSh ) { - if( pObjSh->IsA(TYPE(SwDocShell)) ) + if( dynamic_cast<const SwDocShell*>(pObjSh) != nullptr ) { SwDoc* pDoc = const_cast<SwDocShell*>(static_cast<const SwDocShell*>(pObjSh))->GetDoc(); SwViewShell* pVSh = pDoc->getIDocumentLayoutAccess().GetCurrentViewShell(); diff --git a/sw/source/uibase/app/appopt.cxx b/sw/source/uibase/app/appopt.cxx index d660c893b68c..7a302957c543 100644 --- a/sw/source/uibase/app/appopt.cxx +++ b/sw/source/uibase/app/appopt.cxx @@ -85,7 +85,7 @@ SfxItemSet* SwModule::CreateItemSet( sal_uInt16 nId ) if(pAppView) { // if Text then no WebView and vice versa - bool bWebView = 0 != PTR_CAST(SwWebView, pAppView); + bool bWebView = dynamic_cast<SwWebView*>( pAppView ) != nullptr; if( (bWebView && !bTextDialog) ||(!bWebView && bTextDialog)) { aViewOpt = *pAppView->GetWrtShell().GetViewOptions(); @@ -170,7 +170,7 @@ SfxItemSet* SwModule::CreateItemSet( sal_uInt16 nId ) } if(bTextDialog) pRet->Put(SwPtrItem(FN_PARAM_STDFONTS, GetStdFontConfig())); - if( PTR_CAST( SwPagePreview, SfxViewShell::Current())!=0) + if( dynamic_cast<SwPagePreview*>( SfxViewShell::Current())!=0 ) { SfxBoolItem aBool(SfxBoolItem(SID_PRINTPREVIEW, true)); pRet->Put(aBool); @@ -247,7 +247,7 @@ void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) if(pAppView) { // the text dialog mustn't apply data to the web view and vice versa - bool bWebView = 0 != PTR_CAST(SwWebView, pAppView); + bool bWebView = dynamic_cast<SwWebView*>( pAppView ) != nullptr; if(bWebView == bTextDialog) pAppView = 0; } @@ -471,7 +471,7 @@ VclPtr<SfxTabPage> SwModule::CreateTabPage( sal_uInt16 nId, vcl::Window* pParent if(pCurrView) { // if text then not WebView and vice versa - bool bWebView = 0 != PTR_CAST(SwWebView, pCurrView); + bool bWebView = dynamic_cast<SwWebView*>( pCurrView ) != nullptr; if( (bWebView && RID_SW_TP_HTML_OPTTABLE_PAGE == nId) || (!bWebView && RID_SW_TP_HTML_OPTTABLE_PAGE != nId) ) { diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx index 8b94f66b50f9..2c0505721897 100644 --- a/sw/source/uibase/app/docsh.cxx +++ b/sw/source/uibase/app/docsh.cxx @@ -250,7 +250,7 @@ bool SwDocShell::ConvertFrom( SfxMedium& rMedium ) SW_MOD()->SetEmbeddedLoadSave( SfxObjectCreateMode::EMBEDDED == GetCreateMode() ); - pRdr->GetDoc()->getIDocumentSettingAccess().set(DocumentSettingId::HTML_MODE, ISA(SwWebDocShell)); + pRdr->GetDoc()->getIDocumentSettingAccess().set(DocumentSettingId::HTML_MODE, dynamic_cast< const SwWebDocShell *>( this ) != nullptr); // Restore the pool default if reading a saved document. m_pDoc->RemoveAllFormatLanguageDependencies(); @@ -451,7 +451,7 @@ bool SwDocShell::SaveAs( SfxMedium& rMedium ) uno::Reference < embed::XStorage > xStor = rMedium.GetOutputStorage(); if( SfxObjectShell::SaveAs( rMedium ) ) { - if( GetDoc()->getIDocumentSettingAccess().get(DocumentSettingId::GLOBAL_DOCUMENT) && !ISA( SwGlobalDocShell ) ) + if( GetDoc()->getIDocumentSettingAccess().get(DocumentSettingId::GLOBAL_DOCUMENT) && dynamic_cast< const SwGlobalDocShell *>( this ) == nullptr ) { // This is to set the correct class id if SaveAs is // called from SwDoc::SplitDoc to save a normal doc as @@ -528,7 +528,7 @@ static SwSrcView* lcl_GetSourceView( SwDocShell* pSh ) // are we in SourceView? SfxViewFrame* pVFrame = SfxViewFrame::GetFirst( pSh ); SfxViewShell* pViewShell = pVFrame ? pVFrame->GetViewShell() : 0; - return PTR_CAST( SwSrcView, pViewShell); + return dynamic_cast<SwSrcView*>( pViewShell ); } bool SwDocShell::ConvertTo( SfxMedium& rMedium ) @@ -631,9 +631,9 @@ bool SwDocShell::ConvertTo( SfxMedium& rMedium ) { // determine the own Type sal_uInt8 nMyType = 0; - if( ISA( SwWebDocShell) ) + if( dynamic_cast< const SwWebDocShell *>( this ) != nullptr ) nMyType = 1; - else if( ISA( SwGlobalDocShell) ) + else if( dynamic_cast< const SwGlobalDocShell *>( this ) != nullptr ) nMyType = 2; // determine the desired Type @@ -829,7 +829,7 @@ void SwDocShell::Draw( OutputDevice* pDev, const JobSetup& rSetup, pDev->SetFillColor(); pDev->SetLineColor(); pDev->SetBackground(); - const bool bWeb = this->ISA(SwWebDocShell); + const bool bWeb = dynamic_cast< const SwWebDocShell *>( this ) != nullptr; SwPrintData aOpts; SwViewShell::PrtOle2(m_pDoc, SW_MOD()->GetUsrPref(bWeb), aOpts, *pDev, aRect); pDev->Pop(); @@ -956,7 +956,7 @@ void SwDocShell::GetState(SfxItemSet& rSet) SfxViewFrame *pTmpFrm = SfxViewFrame::GetFirst(this); while (pTmpFrm) // Look for Preview { - if ( PTR_CAST(SwView, pTmpFrm->GetViewShell()) && + if ( dynamic_cast<SwView*>( pTmpFrm->GetViewShell() ) && static_cast<SwView*>(pTmpFrm->GetViewShell())->GetWrtShell().GetViewOptions()->getBrowseMode() ) { bDisable = true; @@ -971,7 +971,7 @@ void SwDocShell::GetState(SfxItemSet& rSet) else { SfxBoolItem aBool( SID_PRINTPREVIEW, false ); - if( PTR_CAST( SwPagePreview, SfxViewShell::Current()) ) + if( dynamic_cast<SwPagePreview*>( SfxViewShell::Current()) ) aBool.SetValue( true ); rSet.Put( aBool ); } @@ -981,7 +981,7 @@ void SwDocShell::GetState(SfxItemSet& rSet) { SfxViewShell* pCurrView = GetView() ? static_cast<SfxViewShell*>(GetView()) : SfxViewShell::Current(); - bool bSourceView = 0 != PTR_CAST(SwSrcView, pCurrView); + bool bSourceView = dynamic_cast<SwSrcView*>( pCurrView ) != nullptr; rSet.Put(SfxBoolItem(SID_SOURCEVIEW, bSourceView)); } break; @@ -1015,17 +1015,17 @@ void SwDocShell::GetState(SfxItemSet& rSet) break; case FN_NEW_GLOBAL_DOC: - if ( ISA(SwGlobalDocShell) ) + if ( dynamic_cast< const SwGlobalDocShell *>( this ) != nullptr ) rSet.DisableItem( nWhich ); break; case FN_NEW_HTML_DOC: - if( ISA( SwWebDocShell ) ) + if( dynamic_cast< const SwWebDocShell *>( this ) != nullptr ) rSet.DisableItem( nWhich ); break; case FN_OPEN_FILE: - if( ISA( SwWebDocShell ) ) + if( dynamic_cast< const SwWebDocShell *>( this ) != nullptr ) rSet.DisableItem( nWhich ); break; @@ -1120,7 +1120,7 @@ void SwDocShell::LoadingFinished() if(pVFrame) { SfxViewShell* pShell = pVFrame->GetViewShell(); - if(PTR_CAST(SwSrcView, pShell)) + if(dynamic_cast<SwSrcView*>( pShell) ) static_cast<SwSrcView*>(pShell)->Load(this); } diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index d4fe645099cf..b6e0d127b7d2 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -145,7 +145,7 @@ VclPtr<SfxDocumentInfoDialog> SwDocShell::CreateDocumentInfoDialog( { //Not for SourceView. SfxViewShell *pVSh = SfxViewShell::Current(); - if ( pVSh && !pVSh->ISA(SwSrcView) ) + if ( pVSh && dynamic_cast< const SwSrcView *>( pVSh ) == nullptr ) { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); @@ -394,10 +394,9 @@ void SwDocShell::Execute(SfxRequest& rReq) { // call on all Docs the idle formatter to start // the collection of Words - TypeId aType = TYPE(SwDocShell); - for( SwDocShell *pDocSh = static_cast<SwDocShell*>(SfxObjectShell::GetFirst(&aType)); + for( SwDocShell *pDocSh = static_cast<SwDocShell*>(SfxObjectShell::GetFirst(checkSfxObjectShell<SwDocShell>)); pDocSh; - pDocSh = static_cast<SwDocShell*>(SfxObjectShell::GetNext( *pDocSh, &aType )) ) + pDocSh = static_cast<SwDocShell*>(SfxObjectShell::GetNext( *pDocSh, checkSfxObjectShell<SwDocShell> )) ) { SwDoc* pTmp = pDocSh->GetDoc(); if ( pTmp->getIDocumentLayoutAccess().GetCurrentViewShell() ) @@ -414,13 +413,13 @@ void SwDocShell::Execute(SfxRequest& rReq) SfxViewFrame *pTmpFrm = SfxViewFrame::GetFirst(this); SfxViewShell* pViewShell = SfxViewShell::Current(); SwView* pCurrView = dynamic_cast< SwView *> ( pViewShell ); - bool bCurrent = IS_TYPE( SwPagePreview, pViewShell ); + bool bCurrent = typeid(SwPagePreview) == typeid( pViewShell ); while( pTmpFrm ) // search Preview { - if( IS_TYPE( SwView, pTmpFrm->GetViewShell()) ) + if( typeid(SwView) == typeid( pTmpFrm->GetViewShell()) ) bOnly = false; - else if( IS_TYPE( SwPagePreview, pTmpFrm->GetViewShell())) + else if( typeid(SwPagePreview) == typeid( pTmpFrm->GetViewShell())) { pTmpFrm->GetFrame().Appear(); bFound = true; @@ -446,7 +445,7 @@ void SwDocShell::Execute(SfxRequest& rReq) { // PagePreview in the WebDocShell // is found under Id VIEWSHELL2. - if( ISA(SwWebDocShell) && SID_VIEWSHELL1 == nSlotId ) + if( dynamic_cast< const SwWebDocShell *>( this ) != nullptr && SID_VIEWSHELL1 == nSlotId ) nSlotId = SID_VIEWSHELL2; if( pCurrView && pCurrView->GetDocShell() == this ) @@ -525,7 +524,7 @@ void SwDocShell::Execute(SfxRequest& rReq) } pFlt = aIter.Next(); } - bool bWeb = 0 != dynamic_cast< SwWebDocShell *>( this ); + bool bWeb = dynamic_cast< SwWebDocShell *>( this ) != nullptr; const SfxFilter *pOwnFlt = SwDocShell::Factory().GetFilterContainer()-> GetFilter4FilterName(OUString("writer8")); @@ -1108,7 +1107,7 @@ void SwDocShell::Execute(SfxRequest& rReq) case SID_ATTR_YEAR2000: if ( pArgs && SfxItemState::SET == pArgs->GetItemState( nWhich , false, &pItem )) { - OSL_ENSURE(pItem->ISA(SfxUInt16Item), "wrong Item"); + OSL_ENSURE(dynamic_cast< const SfxUInt16Item *>( pItem ) != nullptr, "wrong Item"); sal_uInt16 nYear2K = static_cast<const SfxUInt16Item*>(pItem)->GetValue(); // iterate over Views and put the State to FormShells @@ -1501,14 +1500,13 @@ int SwFindDocShell( SfxObjectShellRef& xDocSh, aTmpObj.SetMark( OUString() ); // Iterate over the DocShell and get the ones with the name - TypeId aType( TYPE(SwDocShell) ); SfxObjectShell* pShell = pDestSh; bool bFirst = 0 != pShell; if( !bFirst ) // No DocShell passed, starting with the first from the DocShell list - pShell = SfxObjectShell::GetFirst( &aType ); + pShell = SfxObjectShell::GetFirst( checkSfxObjectShell<SwDocShell> ); while( pShell ) { @@ -1531,10 +1529,10 @@ int SwFindDocShell( SfxObjectShellRef& xDocSh, if( bFirst ) { bFirst = false; - pShell = SfxObjectShell::GetFirst( &aType ); + pShell = SfxObjectShell::GetFirst( checkSfxObjectShell<SwDocShell> ); } else - pShell = SfxObjectShell::GetNext( *pShell, &aType ); + pShell = SfxObjectShell::GetNext( *pShell, checkSfxObjectShell<SwDocShell> ); } // 2. Open the file ourselves diff --git a/sw/source/uibase/app/docshini.cxx b/sw/source/uibase/app/docshini.cxx index a42dde3761ec..4659bc969423 100644 --- a/sw/source/uibase/app/docshini.cxx +++ b/sw/source/uibase/app/docshini.cxx @@ -108,10 +108,10 @@ bool SwDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor ) { AddLink(); // create m_pDoc / pIo if applicable - bool bWeb = ISA( SwWebDocShell ); + bool bWeb = dynamic_cast< const SwWebDocShell *>( this ) != nullptr; if ( bWeb ) bHTMLTemplSet = SetHTMLTemplate( *GetDoc() );// Styles from HTML.vor - else if( ISA( SwGlobalDocShell ) ) + else if( dynamic_cast< const SwGlobalDocShell *>( this ) != nullptr ) GetDoc()->getIDocumentSettingAccess().set(DocumentSettingId::GLOBAL_DOCUMENT, true); // Globaldokument if ( GetCreateMode() == SfxObjectCreateMode::EMBEDDED ) @@ -420,7 +420,7 @@ void SwDocShell::AddLink() SwDocFac aFactory; m_pDoc = aFactory.GetDoc(); m_pDoc->acquire(); - m_pDoc->getIDocumentSettingAccess().set(DocumentSettingId::HTML_MODE, ISA(SwWebDocShell) ); + m_pDoc->getIDocumentSettingAccess().set(DocumentSettingId::HTML_MODE, dynamic_cast< const SwWebDocShell *>( this ) != nullptr ); } else m_pDoc->acquire(); @@ -546,12 +546,12 @@ bool SwDocShell::Load( SfxMedium& rMedium ) // If a XML document is loaded, the global doc/web doc // flags have to be set, because they aren't loaded // by this formats. - if( ISA( SwWebDocShell ) ) + if( dynamic_cast< const SwWebDocShell *>( this ) != nullptr ) { if (!m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE)) m_pDoc->getIDocumentSettingAccess().set(DocumentSettingId::HTML_MODE, true); } - if( ISA( SwGlobalDocShell ) ) + if( dynamic_cast< const SwGlobalDocShell *>( this ) != nullptr ) { if (!m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::GLOBAL_DOCUMENT)) m_pDoc->getIDocumentSettingAccess().set(DocumentSettingId::GLOBAL_DOCUMENT, true); @@ -636,7 +636,7 @@ void SwDocShell::SubInitNew() m_pDoc->getIDocumentSettingAccess().setLinkUpdateMode( GLOBALSETTING ); m_pDoc->getIDocumentSettingAccess().setFieldUpdateFlags( AUTOUPD_GLOBALSETTING ); - bool bWeb = ISA(SwWebDocShell); + bool bWeb = dynamic_cast< const SwWebDocShell *>( this ) != nullptr; sal_uInt16 nRange[] = { RES_PARATR_ADJUST, RES_PARATR_ADJUST, diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index eb33d34d6c7c..ffbd62695004 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -1277,7 +1277,7 @@ void SwDocShell::_LoadStyles( SfxObjectShell& rSource, bool bPreserveCurrentDocu */ // When the source is our document, we do the checking ourselves // (much quicker and doesn't use the crutch StxStylePool). - if( rSource.ISA( SwDocShell )) + if( dynamic_cast<const SwDocShell*>( &rSource) != nullptr) { // in order for the Headers/Footers not to get the fixed content // of the template, update all the Source's diff --git a/sw/source/uibase/app/swmodul1.cxx b/sw/source/uibase/app/swmodul1.cxx index 4033dc7a6c56..7427473aa21d 100644 --- a/sw/source/uibase/app/swmodul1.cxx +++ b/sw/source/uibase/app/swmodul1.cxx @@ -117,22 +117,20 @@ SwWrtShell* GetActiveWrtShell() SwView* GetActiveView() { SfxViewShell* pView = SfxViewShell::Current(); - return PTR_CAST( SwView, pView ); + return dynamic_cast<SwView*>( pView ); } SwView* SwModule::GetFirstView() { // returns only visible SwView - const TypeId aTypeId = TYPE(SwView); - SwView* pView = static_cast<SwView*>(SfxViewShell::GetFirst(&aTypeId)); + SwView* pView = static_cast<SwView*>(SfxViewShell::GetFirst(true, checkSfxViewShell<SwView>)); return pView; } SwView* SwModule::GetNextView(SwView* pView) { - OSL_ENSURE(PTR_CAST(SwView, pView),"return no SwView"); - const TypeId aTypeId = TYPE(SwView); - SwView* pNView = static_cast<SwView*>(SfxViewShell::GetNext(*pView, &aTypeId)); + OSL_ENSURE(dynamic_cast<SwView*>( pView),"return no SwView" ); + SwView* pNView = static_cast<SwView*>(SfxViewShell::GetNext(*pView, true, checkSfxViewShell<SwView>)); return pNView; } @@ -146,13 +144,13 @@ void SwModule::ApplyUsrPref(const SwViewOption &rUsrPref, SwView* pActView, SwMasterUsrPref* pPref = const_cast<SwMasterUsrPref*>(GetUsrPref( nDest == VIEWOPT_DEST_WEB || (nDest != VIEWOPT_DEST_TEXT - && pCurrView && pCurrView->ISA(SwWebView)) )); + && pCurrView && dynamic_cast< const SwWebView *>( pCurrView ) != nullptr) )); // with Uno, only sdbcx::View, but not the Module should be changed bool bViewOnly = VIEWOPT_DEST_VIEW_ONLY == nDest; // fob Preview off SwPagePreview* pPPView; - if( !pCurrView && 0 != (pPPView = PTR_CAST( SwPagePreview, SfxViewShell::Current())) ) + if( !pCurrView && 0 != (pPPView = dynamic_cast<SwPagePreview*>( SfxViewShell::Current())) ) { if(!bViewOnly) pPref->SetUIOptions( rUsrPref ); @@ -231,7 +229,7 @@ void SwModule::ApplyUserMetric( FieldUnit eMetric, bool bWeb ) // switch the ruler for all MDI-Windows while(pTmpView) { - if(bWeb == (0 != PTR_CAST(SwWebView, pTmpView))) + if(bWeb == (dynamic_cast<SwWebView*>( pTmpView) != nullptr) ) { pTmpView->ChangeVRulerMetric(eVScrollMetric); pTmpView->ChangeTabMetric(eHScrollMetric); @@ -265,7 +263,7 @@ void SwModule::ApplyRulerMetric( FieldUnit eMetric, bool bHorizontal, bool bWeb // switch metric at the appropriate rulers while(pTmpView) { - if(bWeb == (0 != dynamic_cast<SwWebView *>( pTmpView ))) + if(bWeb == (dynamic_cast<SwWebView *>( pTmpView ) != nullptr)) { if( bHorizontal ) pTmpView->ChangeTabMetric(eMetric); @@ -326,7 +324,7 @@ void SwModule::ApplyUserCharUnit(bool bApplyChar, bool bWeb) // switch rulers for all MDI-Windows while(pTmpView) { - if(bWeb == (0 != PTR_CAST(SwWebView, pTmpView))) + if(bWeb == (dynamic_cast<SwWebView*>( pTmpView) != nullptr) ) { pTmpView->ChangeVRulerMetric(eVScrollMetric); pTmpView->ChangeTabMetric(eHScrollMetric); @@ -611,10 +609,9 @@ void SwModule::CheckSpellChanges( bool bOnlineSpelling, bool bInvalid = bOnlyWrong || bIsSpellAllAgain; if( bOnlineSpelling || bInvalid ) { - TypeId aType = TYPE(SwDocShell); - for( SwDocShell *pDocSh = static_cast<SwDocShell*>(SfxObjectShell::GetFirst(&aType)); + for( SwDocShell *pDocSh = static_cast<SwDocShell*>(SfxObjectShell::GetFirst(checkSfxObjectShell<SwDocShell>)); pDocSh; - pDocSh = static_cast<SwDocShell*>(SfxObjectShell::GetNext( *pDocSh, &aType ) ) ) + pDocSh = static_cast<SwDocShell*>(SfxObjectShell::GetNext( *pDocSh, checkSfxObjectShell<SwDocShell> ) ) ) { SwDoc* pTmp = pDocSh->GetDoc(); if ( pTmp->getIDocumentLayoutAccess().GetCurrentViewShell() ) diff --git a/sw/source/uibase/config/viewopt.cxx b/sw/source/uibase/config/viewopt.cxx index d30967177661..1056550af03a 100644 --- a/sw/source/uibase/config/viewopt.cxx +++ b/sw/source/uibase/config/viewopt.cxx @@ -327,7 +327,7 @@ AuthorCharAttr::AuthorCharAttr() : sal_uInt16 GetHtmlMode(const SwDocShell* pShell) { sal_uInt16 nRet = 0; - if(!pShell || PTR_CAST(SwWebDocShell, pShell)) + if(!pShell || dynamic_cast<const SwWebDocShell*>( pShell) ) { nRet = HTMLMODE_ON | HTMLMODE_SOME_STYLES; SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get(); diff --git a/sw/source/uibase/dbui/mmconfigitem.cxx b/sw/source/uibase/dbui/mmconfigitem.cxx index 879870bd2cd4..9b90b1c4c4d8 100644 --- a/sw/source/uibase/dbui/mmconfigitem.cxx +++ b/sw/source/uibase/dbui/mmconfigitem.cxx @@ -1604,14 +1604,13 @@ sal_uInt32 SwMailMergeConfigItem::GetMergedDocumentCount() const static SwView* lcl_ExistsView(SwView* pView) { - const TypeId aType(TYPE(SwView)); - SfxViewShell* pViewShell = SfxViewShell::GetFirst( &aType, false ); + SfxViewShell* pViewShell = SfxViewShell::GetFirst( false, checkSfxViewShell<SwView> ); while(pViewShell) { if(pViewShell == pView) return pView; - pViewShell = SfxViewShell::GetNext( *pViewShell, &aType, false ); + pViewShell = SfxViewShell::GetNext( *pViewShell, false, checkSfxViewShell<SwView> ); } return 0; } diff --git a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx index 15cf4916c981..230202341a86 100644 --- a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx +++ b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx @@ -644,7 +644,7 @@ SwWrtShell* SwSpellDialogChildWindow::GetWrtShell_Impl() sal_uInt16 nShellIdx = 0; SfxShell* pShell; while(0 != (pShell = pDispatch->GetShell(nShellIdx++))) - if(pShell->ISA(SwView)) + if(dynamic_cast< const SwView *>( pShell ) != nullptr) { pView = static_cast<SwView* >(pShell); break; @@ -736,7 +736,7 @@ bool SwSpellDialogChildWindow::FindNextDrawTextError_Impl(SwWrtShell& rSh) if ( rMarkList.GetMarkCount() == 1 ) { SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); - if( pObj && pObj->ISA(SdrTextObj) ) + if( pObj && dynamic_cast< const SdrTextObj *>( pObj ) != nullptr ) pCurrentTextObj = static_cast<SdrTextObj*>(pObj); } // at first fill the list of drawing objects diff --git a/sw/source/uibase/dialog/regionsw.cxx b/sw/source/uibase/dialog/regionsw.cxx index de8cc639aafe..e2d984b7678a 100644 --- a/sw/source/uibase/dialog/regionsw.cxx +++ b/sw/source/uibase/dialog/regionsw.cxx @@ -221,7 +221,7 @@ void SwBaseShell::EditRegionDialog(SfxRequest& rReq) OSL_ENSURE(pFact, "Dialog creation failed!"); std::unique_ptr<AbstractEditRegionDlg> pEditRegionDlg(pFact->CreateEditRegionDlg(pParentWin, rWrtShell)); OSL_ENSURE(pEditRegionDlg, "Dialog creation failed!"); - if(pItem && pItem->ISA(SfxStringItem)) + if(pItem && dynamic_cast< const SfxStringItem *>( pItem ) != nullptr) { pEditRegionDlg->SelectSection(static_cast<const SfxStringItem*>(pItem)->GetValue()); } diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 81b0c038179e..255523c5b44f 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -1264,7 +1264,7 @@ bool SwTransferable::PasteData( TransferableDataHelper& rData, // drop as if from external const SwFrameFormat* pSwFrameFormat = rSh.GetFormatFromObj(*pPt); - if(pSwFrameFormat && 0 != dynamic_cast< const SwDrawFrameFormat* >(pSwFrameFormat)) + if(pSwFrameFormat && dynamic_cast< const SwDrawFrameFormat* >(pSwFrameFormat) != nullptr) { bPrivateDrop = false; bNeedToSelectBeforePaste = true; @@ -1601,7 +1601,7 @@ SotExchangeDest SwTransferable::GetSotDestination( const SwWrtShell& rSh, break; case OBJCNT_FLY: - if( rSh.GetView().GetDocShell()->ISA(SwWebDocShell) ) + if( dynamic_cast< const SwWebDocShell *>( rSh.GetView().GetDocShell() ) != nullptr ) nRet = SotExchangeDest::DOC_TEXTFRAME_WEB; else nRet = SotExchangeDest::DOC_TEXTFRAME; @@ -1616,7 +1616,7 @@ SotExchangeDest SwTransferable::GetSotDestination( const SwWrtShell& rSh, // what do we do at multiple selections??? default: { - if( rSh.GetView().GetDocShell()->ISA(SwWebDocShell) ) + if( dynamic_cast< const SwWebDocShell *>( rSh.GetView().GetDocShell() ) != nullptr ) nRet = SotExchangeDest::SWDOC_FREE_AREA_WEB; else nRet = SotExchangeDest::SWDOC_FREE_AREA; @@ -2354,7 +2354,7 @@ bool SwTransferable::_PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh, lclCheckAndPerformRotation(aGraphic); OUString sURL; - if( rSh.GetView().GetDocShell()->ISA(SwWebDocShell) + if( dynamic_cast< const SwWebDocShell *>( rSh.GetView().GetDocShell() ) != nullptr // #i123922# if link action is noted, also take URL || DND_ACTION_LINK == nDropAction) { @@ -2581,7 +2581,7 @@ bool SwTransferable::_PasteFileName( TransferableDataHelper& rData, OUString sFileURL = URIHelper::SmartRel2Abs(INetURLObject(), sFile, Link<OUString *, bool>(), false ); const SfxFilter* pFlt = SwPasteSdr::SetAttr == nAction ? 0 : SwIoSystem::GetFileFilter(sFileURL); - if( pFlt && !rSh.GetView().GetDocShell()->ISA(SwWebDocShell) ) + if( pFlt && dynamic_cast< const SwWebDocShell *>( rSh.GetView().GetDocShell() ) == nullptr ) { // and then pull up the insert-region-dialog by PostUser event SwSectionData * pSect = new SwSectionData( @@ -2658,7 +2658,7 @@ bool SwTransferable::_PasteDBData( TransferableDataHelper& rData, if ( SotClipboardFormatId::XFORMS == nFormat ) { rSh.MakeDrawView(); - FmFormView* pFmView = PTR_CAST( FmFormView, rSh.GetDrawView() ); + FmFormView* pFmView = dynamic_cast<FmFormView*>( rSh.GetDrawView() ); if(pFmView) { const OXFormsDescriptor &rDesc = OXFormsTransferable::extractDescriptor(rData); SdrObject* pObj = pFmView->CreateXFormsControl(rDesc); @@ -2714,7 +2714,7 @@ bool SwTransferable::_PasteDBData( TransferableDataHelper& rData, else { rSh.MakeDrawView(); - FmFormView* pFmView = PTR_CAST( FmFormView, rSh.GetDrawView() ); + FmFormView* pFmView = dynamic_cast<FmFormView*>( rSh.GetDrawView() ); if (pFmView && bHaveColumnDescriptor) { SdrObject* pObj = pFmView->CreateFieldControl( OColumnTransferable::extractColumnDescriptor(rData) ); @@ -3806,8 +3806,7 @@ void SwTrnsfrDdeLink::Disconnect( bool bRemoveDataAdvise ) bool SwTrnsfrDdeLink::FindDocShell() { - TypeId aType( TYPE( SwDocShell ) ); - SfxObjectShell* pTmpSh = SfxObjectShell::GetFirst( &aType ); + SfxObjectShell* pTmpSh = SfxObjectShell::GetFirst( checkSfxObjectShell<SwDocShell> ); while( pTmpSh ) { if( pTmpSh == pDocShell ) // that's what we want to have @@ -3816,7 +3815,7 @@ bool SwTrnsfrDdeLink::FindDocShell() return true; break; // the Doc is not there anymore, so leave! } - pTmpSh = SfxObjectShell::GetNext( *pTmpSh, &aType ); + pTmpSh = SfxObjectShell::GetNext( *pTmpSh, checkSfxObjectShell<SwDocShell> ); } pDocShell = 0; diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index ca9f2bb7b7e5..6cb20d81c44c 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -226,9 +226,9 @@ void SwPostItMgr::InsertItem(SfxBroadcaster* pItem, bool bCheckExistance, bool b } } mbLayout = bFocus; - if (pItem->ISA(SwFormatField)) + if (dynamic_cast< const SwFormatField *>( pItem ) != nullptr) mvPostItFields.push_back(new SwAnnotationItem(static_cast<SwFormatField&>(*pItem), true, bFocus) ); - OSL_ENSURE(pItem->ISA(SwFormatField),"Mgr::InsertItem: seems like new stuff was added"); + OSL_ENSURE(dynamic_cast< const SwFormatField *>( pItem ) != nullptr,"Mgr::InsertItem: seems like new stuff was added"); StartListening(*pItem); } diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx index d9d84f1ece05..d864b40114c4 100644 --- a/sw/source/uibase/docvw/SidebarTxtControl.cxx +++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx @@ -260,7 +260,7 @@ void SidebarTextControl::MouseMove( const MouseEvent& rMEvt ) if ( pItem ) { const SvxFieldData* pField = pItem->GetField(); - const SvxURLField* pURL = PTR_CAST( SvxURLField, pField ); + const SvxURLField* pURL = dynamic_cast<const SvxURLField*>( pField ); if ( pURL ) { OUString sURL( pURL->GetURL() ); @@ -289,7 +289,7 @@ void SidebarTextControl::MouseButtonDown( const MouseEvent& rMEvt ) if ( pItem ) { const SvxFieldData* pField = pItem->GetField(); - const SvxURLField* pURL = PTR_CAST( SvxURLField, pField ); + const SvxURLField* pURL = dynamic_cast<const SvxURLField*>( pField ); if ( pURL ) { GetTextView()->MouseButtonDown( rMEvt ); diff --git a/sw/source/uibase/docvw/edtdd.cxx b/sw/source/uibase/docvw/edtdd.cxx index 4ac525caab58..81ca453323f7 100644 --- a/sw/source/uibase/docvw/edtdd.cxx +++ b/sw/source/uibase/docvw/edtdd.cxx @@ -293,7 +293,7 @@ SotExchangeDest SwEditWin::GetDropDestination( const Point& rPixPnt, SdrObject * } break; case OBJCNT_FLY: - if( rSh.GetView().GetDocShell()->ISA(SwWebDocShell) ) + if( dynamic_cast< const SwWebDocShell *>( rSh.GetView().GetDocShell() ) != nullptr ) nDropDestination = SotExchangeDest::DOC_TEXTFRAME_WEB; else nDropDestination = SotExchangeDest::DOC_TEXTFRAME; @@ -309,7 +309,7 @@ SotExchangeDest SwEditWin::GetDropDestination( const Point& rPixPnt, SdrObject * } if ( !bool(nDropDestination) ) { - if( rSh.GetView().GetDocShell()->ISA(SwWebDocShell) ) + if( dynamic_cast< const SwWebDocShell *>( rSh.GetView().GetDocShell() ) != nullptr ) nDropDestination = SotExchangeDest::SWDOC_FREE_AREA_WEB; else nDropDestination = SotExchangeDest::SWDOC_FREE_AREA; diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index aadec7eef0d6..4a6d6c33953c 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -196,7 +196,7 @@ Color SwEditWin::m_aWaterCanTextColor(COL_RED); extern bool g_bExecuteDrag; -static SfxShell* lcl_GetShellFromDispatcher( SwView& rView, TypeId nType ); +static SfxShell* lcl_GetTextShellFromDispatcher( SwView& rView ); class SwAnchorMarker { @@ -357,7 +357,7 @@ void SwEditWin::UpdatePointer(const Point &rLPt, sal_uInt16 nModifier ) if( bFrameIsValidTarget && 0 !=(pFormat = rSh.GetFormatFromObj( rLPt, &pRect )) && - PTR_CAST(SwFlyFrameFormat, pFormat)) + dynamic_cast<const SwFlyFrameFormat*>( pFormat) ) { //turn on highlight for frame Rectangle aTmp( pRect->SVRect() ); @@ -953,7 +953,7 @@ void SwEditWin::FlushInBuffer() if ( xRecorder.is() ) { // determine shell - SfxShell *pSfxShell = lcl_GetShellFromDispatcher( m_rView, TYPE(SwTextShell) ); + SfxShell *pSfxShell = lcl_GetTextShellFromDispatcher( m_rView ); // generate request and record if (pSfxShell) { @@ -2286,7 +2286,7 @@ KEYINPUT_CHECKTABLE_INSDEL: if(pObj) { EnterDrawTextMode(pObj->GetLogicRect().Center()); - if ( m_rView.GetCurShell()->ISA(SwDrawTextShell) ) + if ( dynamic_cast< const SwDrawTextShell *>( m_rView.GetCurShell() ) != nullptr ) static_cast<SwDrawTextShell*>(m_rView.GetCurShell())->Init(); rSh.GetDrawView()->KeyInput( rKEvt, this ); } @@ -2329,7 +2329,7 @@ KEYINPUT_CHECKTABLE_INSDEL: if(pObj) { EnterDrawTextMode(pObj->GetLogicRect().Center()); - if ( m_rView.GetCurShell()->ISA(SwDrawTextShell) ) + if (dynamic_cast< const SwDrawTextShell *>( m_rView.GetCurShell() ) != nullptr ) static_cast<SwDrawTextShell*>(m_rView.GetCurShell())->Init(); } eKeyState = KS_End; @@ -2345,7 +2345,7 @@ KEYINPUT_CHECKTABLE_INSDEL: } break; case KS_InsTab: - if( m_rView.ISA( SwWebView )) // no Tab for WebView + if( dynamic_cast<const SwWebView*>( &m_rView) != nullptr) // no Tab for WebView { // then it should be passed along Window::KeyInput( aKeyEvent ); @@ -2632,7 +2632,7 @@ KEYINPUT_CHECKTABLE_INSDEL: if(rHdlList.GetFocusHdl()) ChangeDrawing( nDir ); else - ChangeFly( nDir, m_rView.ISA( SwWebView ) ); + ChangeFly( nDir, dynamic_cast<const SwWebView*>( &m_rView) != nullptr ); } break; case KS_Draw_Change : @@ -3301,7 +3301,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) case nsSelectionType::SEL_DRW: RstMBDownFlags(); EnterDrawTextMode(aDocPos); - if ( m_rView.GetCurShell()->ISA(SwDrawTextShell) ) + if ( dynamic_cast< const SwDrawTextShell *>( m_rView.GetCurShell() ) != nullptr ) static_cast<SwDrawTextShell*>(m_rView.GetCurShell())->Init(); return; } @@ -3800,7 +3800,7 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt) Point aRelPos = rSh.GetRelativePagePosition(aDocPt); if(aRelPos.X() >= 0) { - FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &GetView())); + FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( &GetView()) != nullptr ); SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric))); const SfxPointItem aTmp1( SID_ATTR_POSITION, aRelPos ); rBnd.SetState( aTmp1 ); @@ -4786,7 +4786,7 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) case SFX_STYLE_FAMILY_FRAME : { const SwFrameFormat* pFormat = rSh.GetFormatFromObj( aDocPt ); - if(PTR_CAST(SwFlyFrameFormat, pFormat)) + if(dynamic_cast<const SwFlyFrameFormat*>( pFormat) ) { rSh.SetFrameFormat( m_pApplyTempl->aColl.pFrameFormat, false, &aDocPt ); m_pApplyTempl->nUndo = @@ -4825,7 +4825,7 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) m_rView.GetViewFrame()->GetBindings().GetRecorder(); if ( !aStyleName.isEmpty() && xRecorder.is() ) { - SfxShell *pSfxShell = lcl_GetShellFromDispatcher( m_rView, TYPE(SwTextShell) ); + SfxShell *pSfxShell = lcl_GetTextShellFromDispatcher( m_rView ); if ( pSfxShell ) { SfxRequest aReq( m_rView.GetViewFrame(), SID_STYLE_APPLY ); @@ -4861,7 +4861,7 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) if (SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj()) { EnterDrawTextMode(pObj->GetLogicRect().Center()); - if (m_rView.GetCurShell()->ISA(SwDrawTextShell)) + if ( dynamic_cast< const SwDrawTextShell *>( m_rView.GetCurShell() ) != nullptr ) static_cast<SwDrawTextShell*>(m_rView.GetCurShell())->Init(); } } @@ -5308,7 +5308,7 @@ void SwEditWin::Command( const CommandEvent& rCEvt ) if ( xRecorder.is() ) { // determine Shell - SfxShell *pSfxShell = lcl_GetShellFromDispatcher( m_rView, TYPE(SwTextShell) ); + SfxShell *pSfxShell = lcl_GetTextShellFromDispatcher( m_rView ); // generate request and record if (pSfxShell) { @@ -5765,7 +5765,7 @@ bool SwEditWin::SelectMenuPosition(SwWrtShell& rSh, const Point& rMousePos ) return bRet; } -static SfxShell* lcl_GetShellFromDispatcher( SwView& rView, TypeId nType ) +static SfxShell* lcl_GetTextShellFromDispatcher( SwView& rView ) { // determine Shell SfxShell* pShell; @@ -5773,7 +5773,7 @@ static SfxShell* lcl_GetShellFromDispatcher( SwView& rView, TypeId nType ) for(sal_uInt16 i = 0; true; ++i ) { pShell = pDispatcher->GetShell( i ); - if( !pShell || pShell->IsA( nType ) ) + if( !pShell || dynamic_cast< const SwTextShell *>( pShell ) != nullptr ) break; } return pShell; diff --git a/sw/source/uibase/docvw/edtwin3.cxx b/sw/source/uibase/docvw/edtwin3.cxx index 2d7502a51ba8..b8c4279f5bea 100644 --- a/sw/source/uibase/docvw/edtwin3.cxx +++ b/sw/source/uibase/docvw/edtwin3.cxx @@ -40,7 +40,7 @@ void ScrollMDI( SwViewShell* pVwSh, const SwRect &rRect, sal_uInt16 nRangeX, sal_uInt16 nRangeY) { SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell(); - if (pSfxVwSh && pSfxVwSh->ISA(SwView)) + if (pSfxVwSh && dynamic_cast< const SwView *>( pSfxVwSh ) != nullptr) static_cast<SwView *>(pSfxVwSh)->Scroll( rRect.SVRect(), nRangeX, nRangeY ); } @@ -48,7 +48,7 @@ void ScrollMDI( SwViewShell* pVwSh, const SwRect &rRect, bool IsScrollMDI( SwViewShell* pVwSh, const SwRect &rRect ) { SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell(); - if (pSfxVwSh && pSfxVwSh->ISA(SwView)) + if (pSfxVwSh && dynamic_cast< const SwView *>( pSfxVwSh ) != nullptr) return static_cast<SwView *>(pSfxVwSh)->IsScroll(rRect.SVRect()); return false; } @@ -59,9 +59,9 @@ void SizeNotify(SwViewShell* pVwSh, const Size &rSize) SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell(); if (pSfxVwSh) { - if (pSfxVwSh->ISA(SwView)) + if (dynamic_cast< const SwView *>( pSfxVwSh ) != nullptr) static_cast<SwView *>(pSfxVwSh)->DocSzChgd(rSize); - else if (pSfxVwSh->ISA(SwPagePreview)) + else if (dynamic_cast< const SwPagePreview *>( pSfxVwSh ) != nullptr) static_cast<SwPagePreview *>(pSfxVwSh)->DocSzChgd( rSize ); } } @@ -71,14 +71,14 @@ void PageNumNotify( SwViewShell* pVwSh, sal_uInt16 nPhyNum, sal_uInt16 nVirtNum, const OUString& rPgStr) { SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell(); - if ( pSfxVwSh && pSfxVwSh->ISA(SwView) && + if ( pSfxVwSh && dynamic_cast< const SwView *>( pSfxVwSh ) != nullptr && static_cast<SwView*>(pSfxVwSh)->GetCurShell() ) static_cast<SwView *>(pSfxVwSh)->UpdatePageNums(nPhyNum, nVirtNum, rPgStr); } void FrameNotify( SwViewShell* pVwSh, FlyMode eMode ) { - if ( pVwSh->ISA(SwCrsrShell) ) + if ( dynamic_cast< const SwCrsrShell *>( pVwSh ) != nullptr ) SwBaseShell::SetFrmMode( eMode, static_cast<SwWrtShell*>(pVwSh) ); } @@ -110,14 +110,14 @@ TableChgMode GetTableChgDefaultMode() void RepaintPagePreview( SwViewShell* pVwSh, const SwRect& rRect ) { SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell(); - if (pSfxVwSh && pSfxVwSh->ISA( SwPagePreview )) + if (pSfxVwSh && dynamic_cast< const SwPagePreview *>( pSfxVwSh ) != nullptr) static_cast<SwPagePreview *>(pSfxVwSh)->RepaintCoreRect( rRect ); } bool JumpToSwMark( SwViewShell* pVwSh, const OUString& rMark ) { SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell(); - if( pSfxVwSh && pSfxVwSh->ISA( SwView ) ) + if( pSfxVwSh && dynamic_cast< const SwView *>( pSfxVwSh ) != nullptr ) return static_cast<SwView *>(pSfxVwSh)->JumpToSwMark( rMark ); return false; } diff --git a/sw/source/uibase/docvw/romenu.cxx b/sw/source/uibase/docvw/romenu.cxx index b659f83c3110..93271eddbbdd 100644 --- a/sw/source/uibase/docvw/romenu.cxx +++ b/sw/source/uibase/docvw/romenu.cxx @@ -66,8 +66,8 @@ void SwReadOnlyPopup::Check( sal_uInt16 nMID, sal_uInt16 nSID, SfxDispatcher &rD EnableItem( nMID ); if (_pItem) { - CheckItem ( nMID, !_pItem->ISA(SfxVoidItem) && - _pItem->ISA(SfxBoolItem) && + CheckItem ( nMID, dynamic_cast< const SfxVoidItem *>( _pItem ) == nullptr && + dynamic_cast< const SfxBoolItem *>( _pItem ) != nullptr && static_cast<SfxBoolItem*>(_pItem)->GetValue()); //remove full screen entry when not in full screen mode if( SID_WIN_FULLSCREEN == nSID && !IsItemChecked(SID_WIN_FULLSCREEN) ) diff --git a/sw/source/uibase/ribbar/concustomshape.cxx b/sw/source/uibase/ribbar/concustomshape.cxx index cd520a19f67a..0c7bf74f6371 100644 --- a/sw/source/uibase/ribbar/concustomshape.cxx +++ b/sw/source/uibase/ribbar/concustomshape.cxx @@ -183,7 +183,7 @@ void ConstCustomShape::CreateDefaultObject() if ( rMarkList.GetMarkCount() == 1 ) { SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); - if ( pObj && pObj->ISA( SdrObjCustomShape ) ) + if ( pObj && dynamic_cast< const SdrObjCustomShape *>( pObj ) != nullptr ) SetAttributes( pObj ); } } diff --git a/sw/source/uibase/ribbar/conrect.cxx b/sw/source/uibase/ribbar/conrect.cxx index b042cf46dee7..bf6ada4d650d 100644 --- a/sw/source/uibase/ribbar/conrect.cxx +++ b/sw/source/uibase/ribbar/conrect.cxx @@ -95,7 +95,7 @@ bool ConstRectangle::MouseButtonUp(const MouseEvent& rMEvt) pObj->SetMergedItemSetAndBroadcast(aItemSet); } } - else if(mbVertical && pObj && pObj->ISA(SdrTextObj)) + else if(mbVertical && pObj && dynamic_cast< const SdrTextObj *>( pObj ) != nullptr) { SdrTextObj* pText = static_cast<SdrTextObj*>(pObj); SfxItemSet aSet(pSdrView->GetModel()->GetItemPool()); diff --git a/sw/source/uibase/ribbar/tbxanchr.cxx b/sw/source/uibase/ribbar/tbxanchr.cxx index b25dd8aa1b56..e7b0d05db45f 100644 --- a/sw/source/uibase/ribbar/tbxanchr.cxx +++ b/sw/source/uibase/ribbar/tbxanchr.cxx @@ -55,7 +55,7 @@ void SwTbxAnchor::StateChanged( sal_uInt16 /*nSID*/, SfxItemState eState, const if( eState == SfxItemState::DEFAULT ) { - const SfxUInt16Item* pItem = PTR_CAST( SfxUInt16Item, pState ); + const SfxUInt16Item* pItem = dynamic_cast< const SfxUInt16Item* >( pState ); if(pItem) nActAnchorId = pItem->GetValue(); } @@ -86,8 +86,7 @@ void SwTbxAnchor::Click() SwView* pActiveView = 0; if(pViewFrame) { - const TypeId aTypeId = TYPE(SwView); - SwView* pView = static_cast<SwView*>(SfxViewShell::GetFirst(&aTypeId)); + SwView* pView = static_cast<SwView*>(SfxViewShell::GetFirst(true, checkSfxViewShell<SwView>)); while( pView ) { if(pView->GetViewFrame() == pViewFrame) @@ -95,7 +94,7 @@ void SwTbxAnchor::Click() pActiveView = pView; break; } - pView = static_cast<SwView*>(SfxViewShell::GetNext(*pView, &aTypeId)); + pView = static_cast<SwView*>(SfxViewShell::GetNext(*pView, true, checkSfxViewShell<SwView>)); } } if(!pActiveView) diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index bcfae7d184ba..7e052fbeeaf5 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -395,7 +395,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection(); - if (pFieldItem && pFieldItem->GetField()->ISA(SvxURLField)) + if (pFieldItem && dynamic_cast< const SvxURLField *>( pFieldItem->GetField() ) != nullptr ) { // Select the field so that it will be deleted during insert ESelection aSel = pOLV->GetSelection(); @@ -476,7 +476,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) { /* mod SwView* pView = &GetView(); - FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, pView)); + FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( pView) != nullptr ); SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, eMetric)); */ SfxItemSet aDlgAttr(GetPool(), EE_ITEMS_START, EE_ITEMS_END); @@ -521,7 +521,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) { /* mod todo ??? SwView* pView = &GetView(); - FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, pView)); + FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( pView) != nullptr ); SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, eMetric)); */ SfxItemSet aDlgAttr(GetPool(), @@ -935,7 +935,7 @@ void SwAnnotationShell::ExecClpbrd(SfxRequest &rReq) SotClipboardFormatId nFormat = SotClipboardFormatId::NONE; const SfxPoolItem* pItem; if ( rReq.GetArgs() && rReq.GetArgs()->GetItemState(nSlot, true, &pItem) == SfxItemState::SET && - pItem->ISA(SfxUInt32Item) ) + dynamic_cast< const SfxUInt32Item *>( pItem ) != nullptr ) { nFormat = static_cast<SotClipboardFormatId>(static_cast<const SfxUInt32Item*>(pItem)->GetValue()); } @@ -1059,7 +1059,7 @@ void SwAnnotationShell::StateInsert(SfxItemSet &rSet) { const SvxFieldData* pField = pFieldItem->GetField(); - if (pField->ISA(SvxURLField)) + if (dynamic_cast< const SvxURLField *>( pField ) != nullptr) { aHLinkItem.SetName(static_cast<const SvxURLField*>( pField)->GetRepresentation()); aHLinkItem.SetURL(static_cast<const SvxURLField*>( pField)->GetURL()); @@ -1665,7 +1665,7 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq) sSym = static_cast<const SfxStringItem*>(pItem)->GetValue(); const SfxPoolItem* pFtItem = NULL; pArgs->GetItemState( GetPool().GetWhich(SID_ATTR_SPECIALCHAR), false, &pFtItem); - const SfxStringItem* pFontItem = PTR_CAST( SfxStringItem, pFtItem ); + const SfxStringItem* pFontItem = dynamic_cast<const SfxStringItem*>( pFtItem ); if ( pFontItem ) sFontName = pFontItem->GetValue(); } diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index 0fa96789c298..0262329fc56d 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -1117,7 +1117,7 @@ void SwBaseShell::Execute(SfxRequest &rReq) if( pArgs != NULL && pArgs->GetItemState( nSlot, true, &pItem ) == SfxItemState::SET && pItem != NULL - && pItem->ISA( SfxBoolItem ) ) + && dynamic_cast< const SfxBoolItem *>( pItem ) != nullptr ) { bool bDesignMode = static_cast<const SfxBoolItem*>( pItem )->GetValue(); @@ -2109,7 +2109,7 @@ void SwBaseShell::GetTextFontCtrlState( SfxItemSet& rSet ) if(RES_CHRATR_FONT == nWhich) { vcl::Font aFont; - if(pI && pI->ISA(SvxFontItem)) + if(pI && dynamic_cast< const SvxFontItem *>( pI ) != nullptr) { aFont.SetName( static_cast<const SvxFontItem*>(pI)->GetFamilyName()); aFont.SetStyleName(static_cast<const SvxFontItem*>(pI)->GetStyleName()); diff --git a/sw/source/uibase/shells/drawsh.cxx b/sw/source/uibase/shells/drawsh.cxx index 434dcfc82c2a..4cca4f1a4833 100644 --- a/sw/source/uibase/shells/drawsh.cxx +++ b/sw/source/uibase/shells/drawsh.cxx @@ -281,7 +281,7 @@ void SwDrawShell::Execute(SfxRequest &rReq) case SID_FONTWORK: { - FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &rSh.GetView())); + FieldUnit eMetric = ::GetDfltMetric( dynamic_cast<SwWebView*>( &rSh.GetView()) != nullptr ); SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) ); SfxViewFrame* pVFrame = GetView().GetViewFrame(); if (pArgs) @@ -497,7 +497,7 @@ void SwDrawShell::GetState(SfxItemSet& rSet) // Allow creating a TextBox only in case this is a draw format without a TextBox so far. if (pFrameFormat && pFrameFormat->Which() == RES_DRAWFRMFMT && !SwTextBoxHelper::findTextBox(pFrameFormat)) { - if (SdrObjCustomShape* pCustomShape = PTR_CAST(SdrObjCustomShape, pObj)) + if (SdrObjCustomShape* pCustomShape = dynamic_cast<SdrObjCustomShape*>( pObj) ) { const SdrCustomShapeGeometryItem& rGeometryItem = static_cast<const SdrCustomShapeGeometryItem&>(pCustomShape->GetMergedItem(SDRATTR_CUSTOMSHAPE_GEOMETRY)); if (const uno::Any* pAny = rGeometryItem.GetPropertyValueByName("Type")) diff --git a/sw/source/uibase/shells/drformsh.cxx b/sw/source/uibase/shells/drformsh.cxx index 1f8157fa212a..c4f36db3dd20 100644 --- a/sw/source/uibase/shells/drformsh.cxx +++ b/sw/source/uibase/shells/drformsh.cxx @@ -89,7 +89,7 @@ void SwDrawFormShell::Execute(SfxRequest &rReq) const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList(); if (rMarkList.GetMark(0)) { - SdrUnoObj* pUnoCtrl = PTR_CAST(SdrUnoObj, rMarkList.GetMark(0)->GetMarkedSdrObj()); + SdrUnoObj* pUnoCtrl = dynamic_cast<SdrUnoObj*>( rMarkList.GetMark(0)->GetMarkedSdrObj() ); if (pUnoCtrl && FmFormInventor == pUnoCtrl->GetObjInventor()) { if(bConvertToText) @@ -177,7 +177,7 @@ void SwDrawFormShell::GetState(SfxItemSet& rSet) SvxHyperlinkItem aHLinkItem; if (rMarkList.GetMark(0)) { - SdrUnoObj* pUnoCtrl = PTR_CAST(SdrUnoObj, rMarkList.GetMark(0)->GetMarkedSdrObj()); + SdrUnoObj* pUnoCtrl = dynamic_cast<SdrUnoObj*>( rMarkList.GetMark(0)->GetMarkedSdrObj() ); if (pUnoCtrl && FmFormInventor == pUnoCtrl->GetObjInventor()) { uno::Reference< awt::XControlModel > xControlModel = pUnoCtrl->GetUnoControlModel(); diff --git a/sw/source/uibase/shells/drwbassh.cxx b/sw/source/uibase/shells/drwbassh.cxx index 51707f677cd3..eca6b0489467 100644 --- a/sw/source/uibase/shells/drwbassh.cxx +++ b/sw/source/uibase/shells/drwbassh.cxx @@ -111,7 +111,7 @@ void SwDrawBaseShell::Execute(SfxRequest &rReq) //Special case align by menu if(pItem && nSlotId == SID_OBJECT_ALIGN) { - OSL_ENSURE(PTR_CAST(SfxEnumItem, pItem),"SfxEnumItem expected"); + OSL_ENSURE(dynamic_cast<const SfxEnumItem*>( pItem),"SfxEnumItem expected" ); nSlotId = nSlotId + static_cast<const SfxEnumItem*>(pItem)->GetValue(); nSlotId++; } @@ -217,7 +217,7 @@ void SwDrawBaseShell::Execute(SfxRequest &rReq) const sal_uInt16* pRange = pDlg->GetInputRanges( *aNewAttr.GetPool() ); SfxItemSet aSet( *aNewAttr.GetPool(), pRange ); - FieldUnit eMetric = ::GetDfltMetric(0 != dynamic_cast<SwWebView*>(&GetView())); + FieldUnit eMetric = ::GetDfltMetric( dynamic_cast<SwWebView*>(&GetView()) != nullptr ); SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) ); aSet.Put( aNewAttr, false ); diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx index 0a9892e96c29..4c6cabb17fe2 100644 --- a/sw/source/uibase/shells/drwtxtex.cxx +++ b/sw/source/uibase/shells/drwtxtex.cxx @@ -332,7 +332,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) } SwView* pView = &GetView(); - FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, pView)); + FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( pView) != nullptr ); SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) ); SfxItemSet aDlgAttr(GetPool(), EE_ITEMS_START, EE_ITEMS_END); @@ -400,7 +400,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) if (!pArgs) { SwView* pView = &GetView(); - FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, pView)); + FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( pView) != nullptr ); SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) ); SfxItemSet aDlgAttr(GetPool(), EE_ITEMS_START, EE_ITEMS_END, @@ -468,7 +468,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection(); - if (pFieldItem && pFieldItem->GetField()->ISA(SvxURLField)) + if (pFieldItem && dynamic_cast< const SvxURLField *>( pFieldItem->GetField() ) != nullptr ) { // Select field so that it will be deleted during insert ESelection aSel = pOLV->GetSelection(); @@ -1043,7 +1043,7 @@ void SwDrawTextShell::StateInsert(SfxItemSet &rSet) { const SvxFieldData* pField = pFieldItem->GetField(); - if (pField->ISA(SvxURLField)) + if (dynamic_cast< const SvxURLField *>( pField ) != nullptr) { aHLinkItem.SetName(static_cast<const SvxURLField*>( pField)->GetRepresentation()); aHLinkItem.SetURL(static_cast<const SvxURLField*>( pField)->GetURL()); diff --git a/sw/source/uibase/shells/drwtxtsh.cxx b/sw/source/uibase/shells/drwtxtsh.cxx index df42de322d73..f42477ab59de 100644 --- a/sw/source/uibase/shells/drwtxtsh.cxx +++ b/sw/source/uibase/shells/drwtxtsh.cxx @@ -182,7 +182,7 @@ bool SwDrawTextShell::IsTextEdit() void SwDrawTextShell::ExecFontWork(SfxRequest& rReq) { SwWrtShell &rSh = GetShell(); - FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &rSh.GetView())); + FieldUnit eMetric = ::GetDfltMetric( dynamic_cast<SwWebView*>( &rSh.GetView()) != nullptr ); SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) ); SfxViewFrame* pVFrame = GetView().GetViewFrame(); if ( rReq.GetArgs() ) @@ -706,7 +706,7 @@ void SwDrawTextShell::InsertSymbol(SfxRequest& rReq) sSym = static_cast<const SfxStringItem*>(pItem)->GetValue(); const SfxPoolItem* pFtItem = NULL; pArgs->GetItemState( GetPool().GetWhich(SID_ATTR_SPECIALCHAR), false, &pFtItem); - const SfxStringItem* pFontItem = PTR_CAST( SfxStringItem, pFtItem ); + const SfxStringItem* pFontItem = dynamic_cast<const SfxStringItem*>( pFtItem ); if ( pFontItem ) sFontName = pFontItem->GetValue(); } diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx index 6adba620f093..ca15226035ce 100644 --- a/sw/source/uibase/shells/frmsh.cxx +++ b/sw/source/uibase/shells/frmsh.cxx @@ -459,7 +459,7 @@ void SwFrameShell::Execute(SfxRequest &rReq) sDefPage = OUStringToOString(static_cast<const SfxStringItem *>(pItem)->GetValue(), RTL_TEXTENCODING_UTF8); aSet.Put(SfxFrameItem( SID_DOCFRAME, &GetView().GetViewFrame()->GetTopFrame())); - FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &GetView())); + FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( &GetView()) != nullptr ); SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric) )); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); assert(pFact); diff --git a/sw/source/uibase/shells/grfshex.cxx b/sw/source/uibase/shells/grfshex.cxx index db0694e9a12a..69a18da6a07b 100644 --- a/sw/source/uibase/shells/grfshex.cxx +++ b/sw/source/uibase/shells/grfshex.cxx @@ -70,8 +70,7 @@ bool SwTextShell::InsertMediaDlg( SfxRequest& rReq ) if( pReqArgs ) { - const SfxStringItem* pStringItem = PTR_CAST( SfxStringItem, &pReqArgs->Get( rReq.GetSlot() ) ); - + const SfxStringItem* pStringItem = dynamic_cast<const SfxStringItem*>( &pReqArgs->Get( rReq.GetSlot() ) ); if( pStringItem ) { aURL = pStringItem->GetValue(); diff --git a/sw/source/uibase/shells/mediash.cxx b/sw/source/uibase/shells/mediash.cxx index c4326e11fe9c..415f6cbd5524 100644 --- a/sw/source/uibase/shells/mediash.cxx +++ b/sw/source/uibase/shells/mediash.cxx @@ -124,7 +124,7 @@ void SwMediaShell::ExecMedia(SfxRequest &rReq) { SdrObject* pObj = pMarkList->GetMark( 0 )->GetMarkedSdrObj(); - if( pObj && pObj->ISA( SdrMediaObj ) ) + if( pObj && dynamic_cast< const SdrMediaObj *>( pObj ) != nullptr ) { static_cast< sdr::contact::ViewContactOfSdrMediaObj& >( pObj->GetViewContact() ).executeMediaItem( static_cast< const ::avmedia::MediaItem& >( *pItem ) ); @@ -167,7 +167,7 @@ void SwMediaShell::GetMediaState(SfxItemSet &rSet) { SdrObject* pObj = pMarkList->GetMark( 0 )->GetMarkedSdrObj(); - if( pObj && pObj->ISA( SdrMediaObj ) ) + if( pObj && dynamic_cast< const SdrMediaObj *>( pObj ) != nullptr ) { ::avmedia::MediaItem aItem( SID_AVMEDIA_TOOLBOX ); diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx index 228b86583437..2532a7aa9854 100644 --- a/sw/source/uibase/shells/tabsh.cxx +++ b/sw/source/uibase/shells/tabsh.cxx @@ -559,7 +559,7 @@ void SwTableShell::Execute(SfxRequest &rReq) SfxBindings& rBindings = GetView().GetViewFrame()->GetBindings(); SfxItemSet aCoreSet( GetPool(), aUITableAttrRange); - FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &rSh.GetView())); + FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( &rSh.GetView()) != nullptr ); SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric))); std::unique_ptr<SwTableRep> pTableRep(::lcl_TableParamToItemSet( aCoreSet, rSh )); @@ -616,7 +616,7 @@ void SwTableShell::Execute(SfxRequest &rReq) SwView* pView = GetActiveView(); if(pView) { - FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, pView)); + FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( pView) != nullptr ); SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric))); SvNumberFormatter* pFormatter = rSh.GetNumberFormatter(); SfxItemSet aCoreSet( GetPool(), diff --git a/sw/source/uibase/shells/textdrw.cxx b/sw/source/uibase/shells/textdrw.cxx index dc833d3131eb..6d3115710e58 100644 --- a/sw/source/uibase/shells/textdrw.cxx +++ b/sw/source/uibase/shells/textdrw.cxx @@ -72,7 +72,7 @@ void SwBaseShell::InsertURLButton(const OUString& rURL, const OUString& rTarget, const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList(); if (rMarkList.GetMark(0)) { - SdrUnoObj* pUnoCtrl = PTR_CAST(SdrUnoObj, rMarkList.GetMark(0)->GetMarkedSdrObj()); + SdrUnoObj* pUnoCtrl = dynamic_cast<SdrUnoObj*>( rMarkList.GetMark(0)->GetMarkedSdrObj() ); OSL_ENSURE( pUnoCtrl, "not an SdrUnoObj" ); if (!pUnoCtrl) return; diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx index 49a7df724184..c9b9aadb5b20 100644 --- a/sw/source/uibase/shells/textsh.cxx +++ b/sw/source/uibase/shells/textsh.cxx @@ -573,7 +573,7 @@ void SwTextShell::ExecInsert(SfxRequest &rReq) { SfxItemSet aSet = CreateInsertFrameItemSet(aMgr); - FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, GetView().GetDocShell())); + FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebDocShell*>( GetView().GetDocShell()) != nullptr ); SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric))); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "Dialog creation failed!"); @@ -989,7 +989,7 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq ) aChars = static_cast<const SfxStringItem*>(pItem)->GetValue(); const SfxPoolItem* pFtItem = NULL; pArgs->GetItemState( GetPool().GetWhich(SID_ATTR_SPECIALCHAR), false, &pFtItem); - const SfxStringItem* pFontItem = PTR_CAST( SfxStringItem, pFtItem ); + const SfxStringItem* pFontItem = dynamic_cast<const SfxStringItem*>( pFtItem ); if ( pFontItem ) aFontName = pFontItem->GetValue(); } diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 6b816cee86a3..b8097987e7d6 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -126,7 +126,7 @@ using namespace svx::sidebar; void sw_CharDialog( SwWrtShell &rWrtSh, bool bUseDialog, sal_uInt16 nSlot,const SfxItemSet *pArgs, SfxRequest *pReq ) { - FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &rWrtSh.GetView())); + FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( &rWrtSh.GetView()) != nullptr ); SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric))); SfxItemSet aCoreSet( rWrtSh.GetView().GetPool(), RES_CHRATR_BEGIN, RES_CHRATR_END-1, @@ -912,10 +912,10 @@ void SwTextShell::Execute(SfxRequest &rReq) if ( !pPaM ) pPaM = rWrtSh.GetCrsr(); - FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &GetView())); + FieldUnit eMetric = ::GetDfltMetric( dynamic_cast<SwWebView*>( &GetView()) != nullptr ); SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric))); - bool bApplyCharUnit = ::HasCharUnit(0 != PTR_CAST(SwWebView, &GetView())); + bool bApplyCharUnit = ::HasCharUnit( dynamic_cast<SwWebView*>( &GetView()) != nullptr ); SW_MOD()->PutItem(SfxBoolItem(SID_ATTR_APPLYCHARUNIT, bApplyCharUnit)); SfxItemSet aCoreSet( GetPool(), //UUUU sorted by indices, one group of three concatenated diff --git a/sw/source/uibase/shells/txtnum.cxx b/sw/source/uibase/shells/txtnum.cxx index 626488e37e00..8651adc994be 100644 --- a/sw/source/uibase/shells/txtnum.cxx +++ b/sw/source/uibase/shells/txtnum.cxx @@ -114,7 +114,7 @@ void SwTextShell::ExecEnterNum(SfxRequest &rReq) SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL, 0 ); SwDocShell* pDocSh = GetView().GetDocShell(); - const bool bHtml = 0 != PTR_CAST( SwWebDocShell, pDocSh ); + const bool bHtml = dynamic_cast<SwWebDocShell*>( pDocSh ) != nullptr; const SwNumRule* pNumRuleAtCurrentSelection = GetShell().GetNumRuleAtCurrentSelection(); if ( pNumRuleAtCurrentSelection != NULL ) { diff --git a/sw/source/uibase/sidebar/PagePropertyPanel.cxx b/sw/source/uibase/sidebar/PagePropertyPanel.cxx index ea4edfd5a4c9..bb9b436e6bb0 100644 --- a/sw/source/uibase/sidebar/PagePropertyPanel.cxx +++ b/sw/source/uibase/sidebar/PagePropertyPanel.cxx @@ -488,7 +488,7 @@ void PagePropertyPanel::NotifyItemUpdate( case SID_ATTR_PAGE_COLUMN: { if ( eState >= SfxItemState::DEFAULT && - pState && pState->ISA(SfxInt16Item) ) + pState && dynamic_cast< const SfxInt16Item *>( pState ) != nullptr ) { mpPageColumnTypeItem.reset( static_cast<SfxInt16Item*>(pState->Clone()) ); ChangeColumnImage( mpPageColumnTypeItem->GetValue() ); @@ -497,7 +497,7 @@ void PagePropertyPanel::NotifyItemUpdate( break; case SID_ATTR_PAGE_LRSPACE: if ( eState >= SfxItemState::DEFAULT && - pState && pState->ISA(SvxLongLRSpaceItem) ) + pState && dynamic_cast< const SvxLongLRSpaceItem *>( pState ) != nullptr ) { mpPageLRMarginItem.reset( static_cast<SvxLongLRSpaceItem*>(pState->Clone()) ); ChangeMarginImage(); @@ -506,7 +506,7 @@ void PagePropertyPanel::NotifyItemUpdate( case SID_ATTR_PAGE_ULSPACE: if ( eState >= SfxItemState::DEFAULT && - pState && pState->ISA(SvxLongULSpaceItem) ) + pState && dynamic_cast< const SvxLongULSpaceItem *>( pState ) != nullptr ) { mpPageULMarginItem.reset( static_cast<SvxLongULSpaceItem*>(pState->Clone()) ); ChangeMarginImage(); @@ -515,7 +515,7 @@ void PagePropertyPanel::NotifyItemUpdate( case SID_ATTR_PAGE: if ( eState >= SfxItemState::DEFAULT && - pState && pState->ISA(SvxPageItem) ) + pState && dynamic_cast< const SvxPageItem *>( pState ) != nullptr ) { const sal_uInt16 nIdOrientation = mpToolBoxOrientation->GetItemId(UNO_ORIENTATION); mpPageItem.reset( static_cast<SvxPageItem*>(pState->Clone()) ); @@ -539,7 +539,7 @@ void PagePropertyPanel::NotifyItemUpdate( mpBindings->Invalidate( SID_ATTR_PAGE, true ); } if ( eState >= SfxItemState::DEFAULT && - pState && pState->ISA(SvxSizeItem) ) + pState && dynamic_cast< const SvxSizeItem *>( pState ) != nullptr ) { mpPageSizeItem.reset( static_cast<SvxSizeItem*>(pState->Clone()) ); ChangeSizeImage(); diff --git a/sw/source/uibase/sidebar/WrapPropertyPanel.cxx b/sw/source/uibase/sidebar/WrapPropertyPanel.cxx index 17ec875d563b..1da44b0b0143 100644 --- a/sw/source/uibase/sidebar/WrapPropertyPanel.cxx +++ b/sw/source/uibase/sidebar/WrapPropertyPanel.cxx @@ -300,7 +300,7 @@ void WrapPropertyPanel::NotifyItemUpdate( (void)bIsEnabled; if ( eState == SfxItemState::DEFAULT && - pState->ISA(SfxBoolItem) ) + dynamic_cast< const SfxBoolItem *>( pState ) != nullptr ) { //Set Radio Button enable mpRBNoWrap->Enable(); diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx index 199bd60ddf4b..7798f39c5550 100644 --- a/sw/source/uibase/uiview/pview.cxx +++ b/sw/source/uibase/uiview/pview.cxx @@ -1192,11 +1192,11 @@ SwPagePreview::SwPagePreview(SfxViewFrame *pViewFrame, SfxViewShell* pOldSh): SwViewShell *pVS, *pNew; - if( pOldSh && pOldSh->IsA( TYPE( SwPagePreview ) ) ) + if( pOldSh && dynamic_cast<const SwPagePreview *>(pOldSh) != nullptr ) pVS = static_cast<SwPagePreview*>(pOldSh)->GetViewShell(); else { - if( pOldSh && pOldSh->IsA( TYPE( SwView ) ) ) + if( pOldSh && dynamic_cast<const SwView *>(pOldSh) != nullptr ) { pVS = static_cast<SwView*>(pOldSh)->GetWrtShellPtr(); // save the current ViewData of the previous SwView @@ -1251,7 +1251,7 @@ SwPagePreview::~SwPagePreview() SwDocShell* SwPagePreview::GetDocShell() { - return PTR_CAST(SwDocShell, GetViewFrame()->GetObjectShell()); + return dynamic_cast<SwDocShell*>( GetViewFrame()->GetObjectShell() ); } int SwPagePreview::_CreateScrollbar( bool bHori ) diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx index c928c89e9213..784f6331f1ea 100644 --- a/sw/source/uibase/uiview/srcview.cxx +++ b/sw/source/uibase/uiview/srcview.cxx @@ -229,7 +229,7 @@ SwSrcView::SwSrcView(SfxViewFrame* pViewFrame, SfxViewShell*) : SwSrcView::~SwSrcView() { SwDocShell* pDocShell = GetDocShell(); - OSL_ENSURE(PTR_CAST(SwWebDocShell, pDocShell), "Why no WebDocShell?"); + OSL_ENSURE(dynamic_cast<SwWebDocShell*>( pDocShell), "Why no WebDocShell?" ); const TextSelection& rSel = aEditWin->GetTextView()->GetSelection(); static_cast<SwWebDocShell*>(pDocShell)->SetSourcePara( static_cast< sal_uInt16 >( rSel.GetStart().GetPara() ) ); @@ -276,7 +276,7 @@ void SwSrcView::Init() SwDocShell* SwSrcView::GetDocShell() { SfxObjectShell* pObjShell = GetViewFrame()->GetObjectShell(); - return PTR_CAST(SwDocShell, pObjShell); + return dynamic_cast<SwDocShell*>( pObjShell ); } void SwSrcView::SaveContent(const OUString& rTmpFile) @@ -871,7 +871,7 @@ void SwSrcView::Load(SwDocShell* pDocShell) pDocShell->SetModified();// The flag will be reset in between times. // Disable AutoLoad pDocShell->SetAutoLoad(INetURLObject(), 0, false); - OSL_ENSURE(PTR_CAST(SwWebDocShell, pDocShell), "Why no WebDocShell?"); + OSL_ENSURE(dynamic_cast<SwWebDocShell*>( pDocShell), "Why no WebDocShell?" ); sal_uInt16 nLine = static_cast<SwWebDocShell*>(pDocShell)->GetSourcePara(); aEditWin->SetStartLine(nLine); aEditWin->GetTextEngine()->ResetUndo(); diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx index 717212f525bf..1a52df3955e0 100644 --- a/sw/source/uibase/uiview/view.cxx +++ b/sw/source/uibase/uiview/view.cxx @@ -173,7 +173,7 @@ void SwView::GotFocus() const // the top then) const SfxDispatcher& rDispatcher = const_cast< SwView* >( this )->GetDispatcher(); SfxShell* pTopShell = rDispatcher.GetShell( 0 ); - FmFormShell* pAsFormShell = PTR_CAST( FmFormShell, pTopShell ); + FmFormShell* pAsFormShell = dynamic_cast<FmFormShell*>( pTopShell ); if ( pAsFormShell ) { pAsFormShell->ForgetActiveControl(); @@ -181,7 +181,7 @@ void SwView::GotFocus() const } else if ( m_pPostItMgr ) { - SwAnnotationShell* pAsAnnotationShell = PTR_CAST( SwAnnotationShell, pTopShell ); + SwAnnotationShell* pAsAnnotationShell = dynamic_cast<SwAnnotationShell*>( pTopShell ); if ( pAsAnnotationShell ) { m_pPostItMgr->SetActiveSidebarWin(0); @@ -206,7 +206,7 @@ IMPL_LINK_NOARG_TYPED(SwView, FormControlActivated, LinkParamNone*, void) // of the dispatcher stack, then we need to activate it const SfxDispatcher& rDispatcher = GetDispatcher(); const SfxShell* pTopShell = rDispatcher.GetShell( 0 ); - const FmFormShell* pAsFormShell = PTR_CAST( FmFormShell, pTopShell ); + const FmFormShell* pAsFormShell = dynamic_cast<const FmFormShell*>( pTopShell ); if ( !pAsFormShell ) { // if we're editing text currently, cancel this @@ -266,16 +266,16 @@ void SwView::SelectShell() for ( sal_uInt16 i = 0; true; ++i ) { SfxShell *pSfxShell = rDispatcher.GetShell( i ); - if ( pSfxShell->ISA( SwBaseShell ) - || pSfxShell->ISA( SwDrawTextShell ) - || pSfxShell->ISA( svx::ExtrusionBar ) - || pSfxShell->ISA( svx::FontworkBar ) - || pSfxShell->ISA( SwAnnotationShell ) + if ( dynamic_cast< const SwBaseShell *>( pSfxShell ) != nullptr + || dynamic_cast< const SwDrawTextShell *>( pSfxShell ) != nullptr + || dynamic_cast< const svx::ExtrusionBar*>( pSfxShell ) != nullptr + || dynamic_cast< const svx::FontworkBar*>( pSfxShell ) != nullptr + || dynamic_cast< const SwAnnotationShell *>( pSfxShell ) != nullptr ) { rDispatcher.Pop( *pSfxShell, SfxDispatcherPopFlags::POP_DELETE ); } - else if ( pSfxShell->ISA( FmFormShell ) ) + else if ( dynamic_cast< const FmFormShell *>( pSfxShell ) != nullptr ) { rDispatcher.Pop( *pSfxShell ); } @@ -436,7 +436,7 @@ void SwView::SelectShell() SdrView* pDView = GetWrtShell().GetDrawView(); if ( bInitFormShell && pDView ) - m_pFormShell->SetView(PTR_CAST(FmFormView, pDView)); + m_pFormShell->SetView(dynamic_cast<FmFormView*>( pDView) ); } // Opportune time for the communication with OLE objects? @@ -742,7 +742,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) m_aTimer.SetTimeout( 120 ); - SwDocShell* pDocSh = PTR_CAST( SwDocShell, _pFrame->GetObjectShell() ); + SwDocShell* pDocSh = dynamic_cast<SwDocShell*>( _pFrame->GetObjectShell() ); OSL_ENSURE( pDocSh, "view without DocShell." ); bool bOldModifyFlag = pDocSh->IsEnableSetModified(); if(bOldModifyFlag) @@ -753,7 +753,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) // manually. if( pDocSh->GetDoc()->getIDocumentSettingAccess().get( DocumentSettingId::EMBED_FONTS )) pDocSh->UpdateFontList(); - bool bWebDShell = pDocSh->ISA(SwWebDocShell); + bool bWebDShell = dynamic_cast< const SwWebDocShell *>( pDocSh ) != nullptr; const SwMasterUsrPref *pUsrPref = SW_MOD()->GetUsrPref(bWebDShell); SwViewOption aUsrPref( *pUsrPref); @@ -772,7 +772,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) { pExistingSh = pOldSh; // determine type of existing view - if( pExistingSh->IsA( TYPE( SwPagePreview ) ) ) + if( dynamic_cast<const SwPagePreview *>(pExistingSh) != nullptr ) { m_sSwViewData = static_cast<SwPagePreview*>(pExistingSh)->GetPrevSwViewData(); m_sNewCrsrPos = static_cast<SwPagePreview*>(pExistingSh)->GetNewCrsrPos(); @@ -780,12 +780,12 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) m_bOldShellWasPagePreview = true; m_bIsPreviewDoubleClick = !m_sNewCrsrPos.isEmpty() || m_nNewPage != USHRT_MAX; } - else if( pExistingSh->IsA( TYPE( SwSrcView ) ) ) + else if( dynamic_cast<const SwSrcView *>(pExistingSh) != nullptr ) bOldShellWasSrcView = true; } SAL_INFO( "sw.ui", "before create WrtShell" ); - if(PTR_CAST( SwView, pExistingSh)) + if(dynamic_cast<SwView*>( pExistingSh) ) { m_pWrtShell = new SwWrtShell( *static_cast<SwView*>(pExistingSh)->m_pWrtShell, m_pEditWin, *this); @@ -977,7 +977,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) g_bNoInterrupt = bOld; // If a new GlobalDoc will be created, the navigator will also be generated. - if( pDocSh->IsA(SwGlobalDocShell::StaticType()) && + if( dynamic_cast<const SwGlobalDocShell*>(pDocSh) != nullptr && !pVFrame->GetChildWindow( SID_NAVIGATOR )) { SfxBoolItem aNavi(SID_NAVIGATOR, true); @@ -1069,7 +1069,7 @@ SwView::~SwView() SwDocShell* SwView::GetDocShell() { SfxObjectShell* pDocShell = GetViewFrame()->GetObjectShell(); - return PTR_CAST(SwDocShell, pDocShell); + return dynamic_cast<SwDocShell*>( pDocShell ); } // Remember CursorPos @@ -1646,7 +1646,7 @@ void SwView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) if ( GetFormShell() ) { GetFormShell()->SetView( - PTR_CAST(FmFormView, GetWrtShell().GetDrawView()) ); + dynamic_cast<FmFormView*>( GetWrtShell().GetDrawView()) ); SfxBoolItem aItem( SID_FM_DESIGN_MODE, !GetDocShell()->IsReadOnly()); GetDispatcher().Execute( SID_FM_DESIGN_MODE, SfxCallMode::SYNCHRON, &aItem, 0L ); diff --git a/sw/source/uibase/uiview/view0.cxx b/sw/source/uibase/uiview/view0.cxx index b10b3f291f6d..090310e62d43 100644 --- a/sw/source/uibase/uiview/view0.cxx +++ b/sw/source/uibase/uiview/view0.cxx @@ -571,7 +571,7 @@ void SwView::ExecViewOptions(SfxRequest &rReq) } // Set UserPrefs, mark request as modified - bool bWebView = 0 != dynamic_cast<const SwWebView*>(this); + bool bWebView = dynamic_cast<const SwWebView*>(this) != nullptr; SwWrtShell &rSh = GetWrtShell(); rSh.StartAction(); SwModule* pModule = SW_MOD(); diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 61b560cdef32..ccba5b21dcfe 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -1904,7 +1904,7 @@ void SwView::InsFrmMode(sal_uInt16 nCols) /// show "edit link" dialog void SwView::EditLinkDlg() { - bool bWeb = 0 != PTR_CAST(SwWebView, this); + bool bWeb = dynamic_cast<SwWebView*>( this ) != nullptr; SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); std::unique_ptr<SfxAbstractLinksDialog> pDlg(pFact->CreateLinksDialog( &GetViewFrame()->GetWindow(), &GetWrtShell().GetLinkManager(), bWeb )); if ( pDlg ) diff --git a/sw/source/uibase/uiview/viewdlg2.cxx b/sw/source/uibase/uiview/viewdlg2.cxx index 785a00ea43af..b58cf1c0708e 100644 --- a/sw/source/uibase/uiview/viewdlg2.cxx +++ b/sw/source/uibase/uiview/viewdlg2.cxx @@ -82,7 +82,7 @@ void SwView::AutoCaption(const sal_uInt16 nType, const SvGlobalName *pOleId) { SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig(); - bool bWeb = 0 != PTR_CAST(SwWebView, this); + bool bWeb = dynamic_cast<SwWebView*>( this ) != nullptr; if (pModOpt->IsInsWithCaption(bWeb)) { const InsCaptionOpt *pOpt = pModOpt->GetCapOption(bWeb, (SwCapObjType)nType, pOleId); diff --git a/sw/source/uibase/uiview/viewdraw.cxx b/sw/source/uibase/uiview/viewdraw.cxx index 917ec4e2688c..6f1f8df3f568 100644 --- a/sw/source/uibase/uiview/viewdraw.cxx +++ b/sw/source/uibase/uiview/viewdraw.cxx @@ -128,7 +128,7 @@ void SwView::ExecDraw(SfxRequest& rReq) } else if( nSlotId == SID_FM_CREATE_FIELDCONTROL) { - FmFormView* pFormView = PTR_CAST( FmFormView, pSdrView ); + FmFormView* pFormView = dynamic_cast<FmFormView*>( pSdrView ); if ( pFormView ) { SFX_REQUEST_ARG( rReq, pDescriptorItem, SfxUnoAnyItem, SID_FM_DATACCESS_DESCRIPTOR, false ); @@ -413,10 +413,10 @@ void SwView::ExitDraw() if(pTest == m_pShell && // don't call LeaveSelFrmMode() etc. for the below, // because objects may still be selected: - !m_pShell->ISA(SwDrawBaseShell) && - !m_pShell->ISA(SwBezierShell) && - !m_pShell->ISA(svx::ExtrusionBar) && - !m_pShell->ISA(svx::FontworkBar)) + dynamic_cast< const SwDrawBaseShell *>( m_pShell ) == nullptr && + dynamic_cast< const SwBezierShell *>( m_pShell ) == nullptr && + dynamic_cast< const svx::ExtrusionBar *>( m_pShell ) == nullptr && + dynamic_cast< const svx::FontworkBar *>( m_pShell ) == nullptr) { SdrView *pSdrView = m_pWrtShell->GetDrawView(); @@ -487,9 +487,9 @@ bool SwView::EnterDrawTextMode(const Point& aDocPos) pSdrView->PickObj( aDocPos, pSdrView->getHitTolLog(), pObj, pPV, SdrSearchOptions::PICKTEXTEDIT ) && // To allow SwDrawVirtObj text objects to be activated, allow their type, too. - ( pObj->ISA( SdrTextObj ) || - ( pObj->ISA(SwDrawVirtObj) && - static_cast<SwDrawVirtObj*>(pObj)->GetReferencedObj().ISA(SdrTextObj) ) ) && + ( dynamic_cast< const SdrTextObj *>( pObj ) != nullptr || + ( dynamic_cast< const SwDrawVirtObj *>( pObj ) != nullptr && + dynamic_cast< const SdrTextObj *>(&static_cast<SwDrawVirtObj*>(pObj)->GetReferencedObj() ) != nullptr ) ) && m_pWrtShell->IsSelObjProtected(FlyProtectFlags::Content) == FlyProtectFlags::NONE ) { @@ -567,7 +567,7 @@ bool SwView::BeginTextEdit(SdrObject* pObj, SdrPageView* pPV, vcl::Window* pWin, // OutlinerView. Point aNewTextEditOffset(0, 0); - if(pObj->ISA(SwDrawVirtObj)) + if(dynamic_cast< const SwDrawVirtObj *>( pObj ) != nullptr) { SwDrawVirtObj* pVirtObj = static_cast<SwDrawVirtObj*>(pObj); pToBeActivated = &const_cast<SdrObject&>(pVirtObj->GetReferencedObj()); diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx index f2f6747fb1a3..51bb694445a2 100644 --- a/sw/source/uibase/uiview/viewling.cxx +++ b/sw/source/uibase/uiview/viewling.cxx @@ -651,7 +651,7 @@ bool SwView::ExecSpellPopup(const Point& rPt) // This makes it possible to suggest spelling corrections for // wrong words independent of the spell-checking idle job. if (pNode && pNode->IsWrongDirty() && - m_pWrtShell->ISA(SwCrsrShell) && !pCrsrShell->IsTableMode() && + dynamic_cast< const SwCrsrShell *>( m_pWrtShell ) != nullptr && !pCrsrShell->IsTableMode() && !pCrsr->HasMark() && !pCrsr->IsMultiSelection()) { SwContentFrm *pFrm = pCrsr->GetContentNode()->getLayoutFrm( diff --git a/sw/source/uibase/uiview/viewmdi.cxx b/sw/source/uibase/uiview/viewmdi.cxx index 47825289065f..a722622493fd 100644 --- a/sw/source/uibase/uiview/viewmdi.cxx +++ b/sw/source/uibase/uiview/viewmdi.cxx @@ -80,7 +80,7 @@ void SwView::_SetZoom( const Size &rEditSize, SvxZoomType eZoomType, long nFac = nFactor; - const bool bWeb = this->ISA(SwWebView); + const bool bWeb = dynamic_cast< const SwWebView *>( this ) != nullptr; SwMasterUsrPref *pUsrPref = const_cast<SwMasterUsrPref*>(SW_MOD()->GetUsrPref(bWeb)); const SwPageDesc &rDesc = m_pWrtShell->GetPageDesc( m_pWrtShell->GetCurPageDesc() ); @@ -217,7 +217,7 @@ void SwView::SetViewLayout( sal_uInt16 nColumns, bool bBookMode, bool bViewOnly if ( !GetViewFrame()->GetFrame().IsInPlace() && !bViewOnly ) { - const bool bWeb = this->ISA(SwWebView); + const bool bWeb = dynamic_cast< const SwWebView *>( this ) != nullptr; SwMasterUsrPref *pUsrPref = const_cast<SwMasterUsrPref*>(SW_MOD()->GetUsrPref(bWeb)); // Update MasterUsrPrefs and after that update the ViewOptions of the current View. diff --git a/sw/source/uibase/uiview/viewprt.cxx b/sw/source/uibase/uiview/viewprt.cxx index 032dec9274d4..dce91ea1ed4e 100644 --- a/sw/source/uibase/uiview/viewprt.cxx +++ b/sw/source/uibase/uiview/viewprt.cxx @@ -76,7 +76,7 @@ SfxPrinter* SwView::GetPrinter( bool bCreate ) SfxPrinter *pPrt = rIDDA.getPrinter( bCreate ); if ( pOld != pPrt ) { - bool bWeb = 0 != dynamic_cast<SwWebView*>(this); + bool bWeb = dynamic_cast<SwWebView*>(this) != nullptr; ::SetAppPrintOptions( &GetWrtShell(), bWeb ); } return pPrt; @@ -117,7 +117,7 @@ sal_uInt16 SwView::SetPrinter(SfxPrinter* pNew, SfxPrinterChangeFlags nDiffFlags if ( nDiffFlags & SfxPrinterChangeFlags::PRINTER ) rSh.SetModified(); } - bool bWeb = this->ISA(SwWebView); + bool bWeb = dynamic_cast< const SwWebView *>( this ) != nullptr; if ( nDiffFlags & SfxPrinterChangeFlags::OPTIONS ) ::SetPrinter( &rSh.getIDocumentDeviceAccess(), pNew, bWeb ); @@ -157,7 +157,7 @@ VclPtr<SfxTabPage> SwView::CreatePrintOptionsPage(vcl::Window* pParent, void SwView::ExecutePrint(SfxRequest& rReq) { - bool bWeb = 0 != PTR_CAST(SwWebView, this); + bool bWeb = dynamic_cast<SwWebView*>( this ) != nullptr; ::SetAppPrintOptions( &GetWrtShell(), bWeb ); switch (rReq.GetSlot()) { diff --git a/sw/source/uibase/uiview/viewstat.cxx b/sw/source/uibase/uiview/viewstat.cxx index ae97b8799a2d..762fae9ac0f8 100644 --- a/sw/source/uibase/uiview/viewstat.cxx +++ b/sw/source/uibase/uiview/viewstat.cxx @@ -70,7 +70,7 @@ void SwView::GetState(SfxItemSet &rSet) sal_uInt16 nWhich = aIter.FirstWhich(); FrmTypeFlags eFrmType = FrmTypeFlags::NONE; bool bGetFrmType = false; - bool bWeb = 0 != PTR_CAST(SwWebView, this); + bool bWeb = dynamic_cast<SwWebView*>( this ) != nullptr; while(nWhich) { @@ -360,7 +360,7 @@ void SwView::GetState(SfxItemSet &rSet) case SID_DOCUMENT_COMPARE: case SID_DOCUMENT_MERGE: - if( GetDocShell()->IsA( SwGlobalDocShell::StaticType() ) || + if( dynamic_cast<const SwGlobalDocShell* >(GetDocShell()) != nullptr|| (SID_DOCUMENT_MERGE == nWhich && m_pWrtShell->getIDocumentRedlineAccess().GetRedlinePassword().getLength())) rSet.DisableItem(nWhich); break; @@ -466,7 +466,7 @@ void SwView::GetState(SfxItemSet &rSet) void SwView::GetDrawState(SfxItemSet &rSet) { SfxWhichIter aIter(rSet); - bool bWeb = 0 != PTR_CAST(SwWebView, this); + bool bWeb = dynamic_cast<SwWebView*>( this ) != nullptr; for( sal_uInt16 nWhich = aIter.FirstWhich(); nWhich; nWhich = aIter.NextWhich() ) diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx index 23c9b59ab92b..fbb5d3ba5ec1 100644 --- a/sw/source/uibase/uiview/viewtab.cxx +++ b/sw/source/uibase/uiview/viewtab.cxx @@ -1216,7 +1216,7 @@ void SwView::StateTabWin(SfxItemSet& rSet) case SID_ATTR_TABSTOP_VERTICAL : case RES_PARATR_TABSTOP: { - if ( ISA( SwWebView ) || + if ( dynamic_cast< const SwWebView *>( this ) != nullptr || IsTabColFromDoc() || IsTabRowFromDoc() || ( nSelType & nsSelectionType::SEL_GRF ) || diff --git a/sw/source/uibase/uno/unomailmerge.cxx b/sw/source/uibase/uno/unomailmerge.cxx index 7205b4e4f2ad..2d241fd3dac8 100644 --- a/sw/source/uibase/uno/unomailmerge.cxx +++ b/sw/source/uibase/uno/unomailmerge.cxx @@ -596,7 +596,7 @@ uno::Any SAL_CALL SwXMailMerge::execute( } SfxViewFrame* pFrame = SfxViewFrame::GetFirst( xCurDocSh, false); - SwView *pView = pFrame ? PTR_CAST( SwView, pFrame->GetViewShell() ) : NULL; + SwView *pView = pFrame ? dynamic_cast<SwView*>( pFrame->GetViewShell() ) : NULL; if (!pView) throw RuntimeException(); SwWrtShell &rSh = *pView->GetWrtShellPtr(); diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 9a8128b5a345..95227e841e18 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -544,12 +544,10 @@ Reference< XInterface > SwXTextDocument::getCurrentSelection() throw( RuntimeEx Reference< XInterface > xRef; if(IsValid()) { - - const TypeId aTypeId = TYPE(SwView); - SwView* pView = static_cast<SwView*>(SfxViewShell::GetFirst(&aTypeId)); + SwView* pView = static_cast<SwView*>(SfxViewShell::GetFirst(true, checkSfxViewShell<SwView>)); while(pView && pView->GetObjectShell() != pDocShell) { - pView = static_cast<SwView*>(SfxViewShell::GetNext(*pView, &aTypeId)); + pView = static_cast<SwView*>(SfxViewShell::GetNext(*pView, true, checkSfxViewShell<SwView>)); } if(pView) { @@ -1768,9 +1766,9 @@ OUString SwXTextDocument::getImplementationName() throw( RuntimeException, std:: { return OUString("SwXTextDocument"); /* // Matching the .component information: - return PTR_CAST(SwGlobalDocShell, pDocShell) != nullptr + return dynamic_cast<SwGlobalDocShell*>( pDocShell ) != nullptr ? OUString("com.sun.star.comp.Writer.GlobalDocument") - : PTR_CAST(SwWebDocShell, pDocShell) != nullptr + : dynamic_cast<SwWebDocShell*>( pDocShell ) != nullptr ? OUString("com.sun.star.comp.Writer.WebDocument") : OUString("com.sun.star.comp.Writer.TextDocument"); */ @@ -1783,8 +1781,8 @@ sal_Bool SwXTextDocument::supportsService(const OUString& rServiceName) throw( R Sequence< OUString > SwXTextDocument::getSupportedServiceNames() throw( RuntimeException, std::exception ) { - bool bWebDoc = (0 != PTR_CAST(SwWebDocShell, pDocShell)); - bool bGlobalDoc = (0 != PTR_CAST(SwGlobalDocShell, pDocShell)); + bool bWebDoc = (dynamic_cast<SwWebDocShell*>( pDocShell) != nullptr ); + bool bGlobalDoc = (dynamic_cast<SwGlobalDocShell*>( pDocShell) != nullptr ); bool bTextDoc = (!bWebDoc && !bGlobalDoc); Sequence< OUString > aRet (3); @@ -2427,8 +2425,7 @@ SwDoc * SwXTextDocument::GetRenderDoc( // the view shell should be SwView for documents PDF export. // for the page preview no selection should be possible // (the export dialog does not allow for this option) - const TypeId aSwViewTypeId = TYPE(SwView); - if (rpView && rpView->IsA(aSwViewTypeId)) + if (rpView && dynamic_cast< const SwView *>( rpView ) != nullptr) { if (!m_pRenderData) { @@ -2530,7 +2527,7 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( // TODO/mba: we really need a generic way to get the SwViewShell! SwViewShell* pViewShell = 0; - SwView* pSwView = PTR_CAST(SwView, pView); + SwView* pSwView = dynamic_cast<SwView*>( pView ); if ( pSwView ) { pViewShell = pSwView->GetWrtShellPtr(); @@ -2705,7 +2702,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( // TODO/mba: we really need a generic way to get the SwViewShell! SwViewShell* pVwSh = 0; - SwView* pSwView = PTR_CAST(SwView, pView); + SwView* pSwView = dynamic_cast<SwView*>( pView ); if ( pSwView ) pVwSh = pSwView->GetWrtShellPtr(); else @@ -2989,12 +2986,11 @@ void SAL_CALL SwXTextDocument::render( // or SwPagePreview for PDF export of the page preview //!! (check for SwView first as in GuessViewShell) !! OSL_ENSURE( pView, "!! view missing !!" ); - const TypeId aSwViewTypeId = TYPE(SwView); SwViewShell* pVwSh = 0; if (pView) { // TODO/mba: we really need a generic way to get the SwViewShell! - SwView* pSwView = PTR_CAST(SwView, pView); + SwView* pSwView = dynamic_cast<SwView*>( pView ); if ( pSwView ) pVwSh = pSwView->GetWrtShellPtr(); else @@ -3010,8 +3006,8 @@ void SAL_CALL SwXTextDocument::render( const bool bFirstPage = m_pPrintUIOptions->getBoolValue( "IsFirstPage" ); bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages( bIsPDFExport ); - OSL_ENSURE(( pView->IsA(aSwViewTypeId) && m_pRenderData->IsViewOptionAdjust()) - || (!pView->IsA(aSwViewTypeId) && !m_pRenderData->IsViewOptionAdjust()), + OSL_ENSURE(( dynamic_cast< const SwView *>( pView ) != nullptr && m_pRenderData->IsViewOptionAdjust()) + || (dynamic_cast< const SwView *>( pView ) == nullptr && !m_pRenderData->IsViewOptionAdjust()), "SwView / SwViewOptionAdjust_Impl availability mismatch" ); // since printing now also use the API for PDF export this option @@ -3024,7 +3020,7 @@ void SAL_CALL SwXTextDocument::render( // During this process, additional information required for tagging // the pdf file are collected, which are evaulated during painting. - SwWrtShell* pWrtShell = pView->IsA(aSwViewTypeId) ? + SwWrtShell* pWrtShell = dynamic_cast< const SwView *>( pView ) != nullptr ? static_cast<SwView*>(pView)->GetWrtShellPtr() : 0; diff --git a/sw/source/uibase/utlui/bookctrl.cxx b/sw/source/uibase/utlui/bookctrl.cxx index db8bcb838963..38366cb97ab6 100644 --- a/sw/source/uibase/utlui/bookctrl.cxx +++ b/sw/source/uibase/utlui/bookctrl.cxx @@ -74,14 +74,14 @@ SwBookmarkControl::~SwBookmarkControl() void SwBookmarkControl::StateChanged( sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState ) { - if( eState != SfxItemState::DEFAULT || pState->ISA( SfxVoidItem ) ) + if( eState != SfxItemState::DEFAULT || dynamic_cast< const SfxVoidItem *>( pState ) != nullptr ) GetStatusBar().SetItemText( GetId(), OUString() ); - else if ( pState->ISA( SfxStringItem ) ) + else if ( dynamic_cast< const SfxStringItem *>( pState ) != nullptr ) { sPageNumber = static_cast<const SfxStringItem*>(pState)->GetValue(); GetStatusBar().SetItemText( GetId(), sPageNumber ); } - else if ( pState->ISA( SfxBoolItem ) ) + else if ( dynamic_cast< const SfxBoolItem *>( pState ) != nullptr ) { if (static_cast<const SfxBoolItem*>(pState)->GetValue()) // Indicates whether to show extended tooltip GetStatusBar().SetQuickHelpText(GetId(), SW_RESSTR(STR_BOOKCTRL_HINT_EXTENDED)); diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index b6da66af6191..0c6d105f0c20 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -400,7 +400,7 @@ void SwContentType::Init(bool* pbInvalidateWindow) { for(SwPostItMgr::const_iterator i = aMgr->begin(); i != aMgr->end(); ++i) { - if ( (*i)->GetBroadCaster()->ISA(SwFormatField)) // SwPostit + if ( dynamic_cast< const SwFormatField *>( (*i)->GetBroadCaster() ) != nullptr ) // SwPostit { const SwFormatField* aFormatField = static_cast<const SwFormatField*>((*i)->GetBroadCaster()); if (aFormatField->GetTextField() && aFormatField->IsFieldInDoc() && @@ -708,7 +708,7 @@ void SwContentType::FillMemberList(bool* pbLevelOrVisibilityChanged) { for(SwPostItMgr::const_iterator i = aMgr->begin(); i != aMgr->end(); ++i) { - if ( (*i)->GetBroadCaster()->ISA(SwFormatField)) // SwPostit + if ( dynamic_cast< const SwFormatField *>( (*i)->GetBroadCaster() ) != nullptr ) // SwPostit { const SwFormatField* aFormatField = static_cast<const SwFormatField*>((*i)->GetBroadCaster()); if (aFormatField->GetTextField() && aFormatField->IsFieldInDoc() && @@ -905,7 +905,7 @@ OUString SwContentTree::GetEntryAltText( SvTreeListEntry* pEntry ) const default: nCmpId = pTemp->GetObjIdentifier(); } - if(nCmpId == OBJ_GRUP /*pTemp->ISA(SdrObjGroup)*/ && pTemp->GetName() == pCnt->GetName()) + if(nCmpId == OBJ_GRUP /*dynamic_cast< const SdrObjGroup *>( pTemp ) != nullptr*/ && pTemp->GetName() == pCnt->GetName()) { return pTemp->GetTitle(); } @@ -998,7 +998,7 @@ OUString SwContentTree::GetEntryLongDescription( SvTreeListEntry* pEntry ) const default: nCmpId = pTemp->GetObjIdentifier(); } - if(nCmpId == OBJ_GRUP /*pTemp->ISA(SdrObjGroup)*/ && pTemp->GetName() == pCnt->GetName()) + if(nCmpId == OBJ_GRUP /*dynamic_cast< const SdrObjGroup *>( pTemp ) != nullptr*/ && pTemp->GetName() == pCnt->GetName()) { return pTemp->GetDescription(); } diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx index 32fe757f25ce..57661170b000 100644 --- a/sw/source/uibase/utlui/navipi.cxx +++ b/sw/source/uibase/utlui/navipi.cxx @@ -1078,14 +1078,14 @@ void SwNavigationPI::UpdateListBox() IMPL_LINK_TYPED(SwNavigationPI, DoneLink, SfxPoolItem *, pItem, void) { - const SfxViewFrameItem* pFrameItem = PTR_CAST(SfxViewFrameItem, pItem ); + const SfxViewFrameItem* pFrameItem = dynamic_cast<SfxViewFrameItem*>( pItem ); if( pFrameItem ) { SfxViewFrame* pFrame = pFrameItem->GetFrame(); if(pFrame) { aContentTree->Clear(); - pContentView = PTR_CAST(SwView, pFrame->GetViewShell()); + pContentView = dynamic_cast<SwView*>( pFrame->GetViewShell() ); OSL_ENSURE(pContentView, "no SwView"); if(pContentView) pContentWrtShell = pContentView->GetWrtShellPtr(); diff --git a/sw/source/uibase/utlui/tmplctrl.cxx b/sw/source/uibase/utlui/tmplctrl.cxx index 282a85cf17b3..4580ea8dff33 100644 --- a/sw/source/uibase/utlui/tmplctrl.cxx +++ b/sw/source/uibase/utlui/tmplctrl.cxx @@ -74,9 +74,9 @@ SwTemplateControl::~SwTemplateControl() void SwTemplateControl::StateChanged( sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState ) { - if( eState != SfxItemState::DEFAULT || pState->ISA( SfxVoidItem ) ) + if( eState != SfxItemState::DEFAULT || dynamic_cast< const SfxVoidItem *>( pState ) != nullptr ) GetStatusBar().SetItemText( GetId(), OUString() ); - else if ( pState->ISA( SfxStringItem ) ) + else if ( dynamic_cast< const SfxStringItem *>( pState ) != nullptr ) { sTemplate = static_cast<const SfxStringItem*>(pState)->GetValue(); GetStatusBar().SetItemText( GetId(), sTemplate ); diff --git a/sw/source/uibase/utlui/viewlayoutctrl.cxx b/sw/source/uibase/utlui/viewlayoutctrl.cxx index 2536586458f9..22b3f48fb180 100644 --- a/sw/source/uibase/utlui/viewlayoutctrl.cxx +++ b/sw/source/uibase/utlui/viewlayoutctrl.cxx @@ -84,11 +84,11 @@ SwViewLayoutControl::~SwViewLayoutControl() void SwViewLayoutControl::StateChanged( sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState ) { - if ( SfxItemState::DEFAULT != eState || pState->ISA( SfxVoidItem ) ) + if ( SfxItemState::DEFAULT != eState || dynamic_cast< const SfxVoidItem *>( pState ) != nullptr ) GetStatusBar().SetItemText( GetId(), OUString() ); else { - OSL_ENSURE( pState->ISA( SvxViewLayoutItem ), "invalid item type" ); + OSL_ENSURE( dynamic_cast< const SvxViewLayoutItem *>( pState ) != nullptr, "invalid item type" ); const sal_uInt16 nColumns = static_cast<const SvxViewLayoutItem*>( pState )->GetValue(); const bool bBookMode = static_cast<const SvxViewLayoutItem*>( pState )->IsBookMode(); diff --git a/sw/source/uibase/utlui/zoomctrl.cxx b/sw/source/uibase/utlui/zoomctrl.cxx index e4990cc9fcd7..5da5c9cd4664 100644 --- a/sw/source/uibase/utlui/zoomctrl.cxx +++ b/sw/source/uibase/utlui/zoomctrl.cxx @@ -43,7 +43,7 @@ SwZoomControl::~SwZoomControl() void SwZoomControl::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) { - if(SfxItemState::DEFAULT == eState && pState->ISA( SfxStringItem )) + if(SfxItemState::DEFAULT == eState && dynamic_cast< const SfxStringItem *>( pState ) != nullptr) { sPreviewZoom = static_cast<const SfxStringItem*>(pState)->GetValue(); GetStatusBar().SetItemText( GetId(), sPreviewZoom ); diff --git a/sw/source/uibase/web/wview.cxx b/sw/source/uibase/web/wview.cxx index 66736a832595..0954f8bf69d0 100644 --- a/sw/source/uibase/web/wview.cxx +++ b/sw/source/uibase/web/wview.cxx @@ -140,8 +140,8 @@ void SwWebView::SelectShell() for ( i = 0; true; ++i ) { pSfxShell = rDispatcher.GetShell( i ); - if ( !( pSfxShell->ISA( SwBaseShell ) || - pSfxShell->ISA( SwDrawTextShell ) || pSfxShell->ISA( SwAnnotationShell ) ) ) + if ( !( dynamic_cast< const SwBaseShell *>( pSfxShell ) != nullptr || + dynamic_cast< const SwDrawTextShell *>( pSfxShell ) || dynamic_cast< const SwAnnotationShell *>( pSfxShell ) != nullptr ) ) break; } if (i) @@ -280,7 +280,7 @@ void SwWebView::SelectShell() GetEditWin().UpdatePointer(aPnt); if ( bInitFormShell && GetWrtShell().GetDrawView() ) - GetFormShell()->SetView( PTR_CAST( FmFormView, + GetFormShell()->SetView( dynamic_cast< FmFormView* >( GetWrtShell().GetDrawView())); } diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx index 249321e6b018..de8d83e695e2 100644 --- a/sw/source/uibase/wrtsh/wrtsh1.cxx +++ b/sw/source/uibase/wrtsh/wrtsh1.cxx @@ -1205,7 +1205,7 @@ void SwWrtShell::NumOrBulletOn(bool bNum) : 0; GetDoc()->getIDocumentContentOperations().RemoveLeadingWhiteSpace( *GetCrsr()->GetPoint() ); - const bool bHtml = 0 != PTR_CAST(SwWebDocShell, pDocSh); + const bool bHtml = dynamic_cast<SwWebDocShell*>( pDocSh ) != nullptr; const bool bRightToLeft = IsInRightToLeftText(); for( sal_uInt8 nLvl = 0; nLvl < MAXLEVEL; ++nLvl ) { diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx b/sw/source/uibase/wrtsh/wrtsh2.cxx index 7f20bfef46f6..2d9e241c8290 100644 --- a/sw/source/uibase/wrtsh/wrtsh2.cxx +++ b/sw/source/uibase/wrtsh/wrtsh2.cxx @@ -468,7 +468,7 @@ void LoadURL( SwViewShell& rVSh, const OUString& rURL, sal_uInt16 nFilter, return ; // The shell could be 0 also!!!!! - if ( !rVSh.ISA(SwCrsrShell) ) + if ( dynamic_cast<const SwCrsrShell*>( &rVSh) == nullptr ) return; // We are doing tiledRendering, let the client handles the URL loading. diff --git a/sw/source/uibase/wrtsh/wrtsh3.cxx b/sw/source/uibase/wrtsh/wrtsh3.cxx index c361896e89dd..d90d213de832 100644 --- a/sw/source/uibase/wrtsh/wrtsh3.cxx +++ b/sw/source/uibase/wrtsh/wrtsh3.cxx @@ -177,7 +177,7 @@ bool SwWrtShell::GetURLFromButton( OUString& rURL, OUString& rDescr ) const if (rMarkList.GetMark(0)) { - SdrUnoObj* pUnoCtrl = PTR_CAST(SdrUnoObj, rMarkList.GetMark(0)->GetMarkedSdrObj()); + SdrUnoObj* pUnoCtrl = dynamic_cast<SdrUnoObj*>( rMarkList.GetMark(0)->GetMarkedSdrObj() ); if (pUnoCtrl && FmFormInventor == pUnoCtrl->GetObjInventor()) { uno::Reference< awt::XControlModel > xControlModel = pUnoCtrl->GetUnoControlModel(); |