diff options
458 files changed, 1727 insertions, 1769 deletions
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx index 57080ca15a09..01586bd94996 100644 --- a/basic/source/classes/sb.cxx +++ b/basic/source/classes/sb.cxx @@ -1106,7 +1106,7 @@ SbModule* StarBASIC::MakeModule32( const OUString& rName, const ModuleInfo& mInf void StarBASIC::Insert( SbxVariable* pVar ) { - if( pVar->IsA( TYPE(SbModule) ) ) + if( dynamic_cast<const SbModule*>(pVar) != nullptr) { pModules->Insert( pVar, pModules->Count() ); pVar->SetParent( this ); @@ -1125,7 +1125,7 @@ void StarBASIC::Insert( SbxVariable* pVar ) void StarBASIC::Remove( SbxVariable* pVar ) { - if( pVar->IsA( TYPE(SbModule) ) ) + if( dynamic_cast<const SbModule*>(pVar) != nullptr) { // #87540 Can be last reference! SbxVariableRef xVar = pVar; diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index 167a172f0c73..ce72ed39514b 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -966,14 +966,14 @@ void SbModule::SetSource32( const OUString& r ) static void _SendHint( SbxObject* pObj, sal_uIntPtr nId, SbMethod* p ) { // Self a BASIC? - if( pObj->IsA( TYPE(StarBASIC) ) && pObj->IsBroadcaster() ) + if( dynamic_cast<const StarBASIC *>(pObj) != nullptr && pObj->IsBroadcaster() ) pObj->GetBroadcaster().Broadcast( SbxHint( nId, p ) ); // Then ask for the subobjects SbxArray* pObjs = pObj->GetObjects(); for( sal_uInt16 i = 0; i < pObjs->Count(); i++ ) { SbxVariable* pVar = pObjs->Get( i ); - if( pVar->IsA( TYPE(SbxObject) ) ) + if( dynamic_cast<const SbxObject *>(pVar) != nullptr ) _SendHint( dynamic_cast<SbxObject*>( pVar), nId, p ); } } diff --git a/basic/source/comp/parser.cxx b/basic/source/comp/parser.cxx index 97592cb9d3ba..c3e7a898fceb 100644 --- a/basic/source/comp/parser.cxx +++ b/basic/source/comp/parser.cxx @@ -156,7 +156,7 @@ SbiSymDef* SbiParser::CheckRTLForSym(const OUString& rSym, SbxDataType eType) if (!pVar) return nullptr; - if (pVar->IsA(TYPE(SbxMethod))) + if (dynamic_cast<const SbxMethod *>(pVar) != nullptr) { SbiProcDef* pProc_ = aRtlSyms.AddProc( rSym ); SbxMethod* pMethod = static_cast<SbxMethod*>(pVar); diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 2c21bc3e768b..4628686c0f69 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -4439,11 +4439,11 @@ RTLFUNC(Load) SbxBase* pObj = static_cast<SbxObject*>(rPar.Get(1)->GetObject()); if ( pObj ) { - if( pObj->IsA( TYPE( SbUserFormModule ) ) ) + if( dynamic_cast<const SbUserFormModule *>(pObj) != nullptr ) { static_cast<SbUserFormModule*>(pObj)->Load(); } - else if( pObj->IsA( TYPE( SbxObject ) ) ) + else if( dynamic_cast<const SbxObject *>(pObj) != nullptr ) { SbxVariable* pVar = static_cast<SbxObject*>(pObj)->Find( OUString("Load"), SbxCLASS_METHOD ); if( pVar ) @@ -4470,12 +4470,12 @@ RTLFUNC(Unload) SbxBase* pObj = static_cast<SbxObject*>(rPar.Get(1)->GetObject()); if ( pObj ) { - if( pObj->IsA( TYPE( SbUserFormModule ) ) ) + if( dynamic_cast<const SbUserFormModule *>(pObj) != nullptr ) { SbUserFormModule* pFormModule = static_cast<SbUserFormModule*>(pObj); pFormModule->Unload(); } - else if( pObj->IsA( TYPE( SbxObject ) ) ) + else if( dynamic_cast<const SbxObject *>(pObj) != nullptr ) { SbxVariable* pVar = static_cast<SbxObject*>(pObj)->Find( OUString("Unload"), SbxCLASS_METHOD ); if( pVar ) @@ -4524,7 +4524,7 @@ RTLFUNC(SavePicture) } SbxBase* pObj = static_cast<SbxObject*>(rPar.Get(1)->GetObject()); - if( pObj->IsA( TYPE( SbStdPicture ) ) ) + if( dynamic_cast<const SbStdPicture *>(pObj) != nullptr ) { SvFileStream aOStream( rPar.Get(2)->GetOUString(), StreamMode::WRITE | StreamMode::TRUNC ); Graphic aGraphic = static_cast<SbStdPicture*>(pObj)->GetGraphic(); diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index 04416668535a..33ab052aa623 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -673,7 +673,7 @@ void SbiRuntime::SetParameters( SbxArray* pParams ) SbxVariable* v = pParams->Get( i ); // methods are always byval! - bool bByVal = v->IsA( TYPE(SbxMethod) ); + bool bByVal = dynamic_cast<const SbxMethod *>(v) != nullptr; SbxDataType t = v->GetType(); bool bTargetTypeIsArray = false; if( p ) @@ -995,7 +995,7 @@ SbxVariableRef SbiRuntime::PopVar() SAL_INFO("basic", "PopVar: Name equals 'Cells'" ); #endif // methods hold themselves in parameter 0 - if( xVar->IsA( TYPE(SbxMethod) ) ) + if( dynamic_cast<const SbxMethod *>(xVar.get()) != nullptr ) { xVar->SetParameters(0); } @@ -1725,7 +1725,7 @@ void SbiRuntime::StepPUT() refVar->Broadcast( SBX_HINT_DATAWANTED ); if ( refVar->GetType() == SbxOBJECT ) { - if ( refVar->IsA( TYPE(SbxMethod) ) || ! refVar->GetParent() ) + if ( dynamic_cast<const SbxMethod *>(refVar.get()) != nullptr || ! refVar->GetParent() ) { SbxVariable* pDflt = getDefaultProp( refVar ); @@ -1735,7 +1735,7 @@ void SbiRuntime::StepPUT() else bObjAssign = true; } - if ( refVal->GetType() == SbxOBJECT && !bObjAssign && ( refVal->IsA( TYPE(SbxMethod) ) || ! refVal->GetParent() ) ) + if ( refVal->GetType() == SbxOBJECT && !bObjAssign && ( dynamic_cast<const SbxMethod *>(refVal.get()) != nullptr || ! refVal->GetParent() ) ) { SbxVariable* pDflt = getDefaultProp( refVal ); if ( pDflt ) @@ -1877,7 +1877,7 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b bool bObjAssign = false; if ( refVar->GetType() == SbxOBJECT ) { - if ( refVar->IsA( TYPE(SbxMethod) ) || ! refVar->GetParent() ) + if ( dynamic_cast<const SbxMethod *>(refVar.get()) != nullptr || ! refVar->GetParent() ) { SbxVariable* pDflt = getDefaultProp( refVar ); if ( pDflt ) @@ -3240,19 +3240,19 @@ bool SbiRuntime::checkClass_Impl( const SbxVariableRef& refVal, if( t == SbxOBJECT ) { SbxObject* pObj; - if( pVal->IsA( TYPE(SbxObject) ) ) + if( dynamic_cast<const SbxObject *>(pVal) != nullptr ) pObj = static_cast<SbxObject*>( pVal ); else { pObj = static_cast<SbxObject*>( refVal->GetObject() ); - if( pObj && !pObj->IsA( TYPE(SbxObject) ) ) + if( pObj && dynamic_cast<const SbxObject *>(pObj) == nullptr ) pObj = NULL; } if( pObj ) { if( !implIsClass( pObj, aClass ) ) { - if ( ( bVBAEnabled || CodeCompleteOptions::IsExtendedTypeDeclaration() ) && pObj->IsA( TYPE(SbUnoObject) ) ) + if ( ( bVBAEnabled || CodeCompleteOptions::IsExtendedTypeDeclaration() ) && dynamic_cast<const SbUnoObject *>(pObj) != nullptr ) { SbUnoObject& rUnoObj = dynamic_cast<SbUnoObject&>(*pObj); bOk = checkUnoObjectType(rUnoObj, aClass); @@ -3540,7 +3540,7 @@ SbxVariable* SbiRuntime::FindElement( SbxObject* pObj, sal_uInt32 nOp1, sal_uInt SetupArgs( pElem, nOp1 ); } // because a particular call-type is requested - if( pElem->IsA( TYPE(SbxMethod) ) ) + if( dynamic_cast<const SbxMethod *>(pElem) != nullptr ) { // shall the type be converted? SbxDataType t2 = pElem->GetType(); diff --git a/basic/source/sbx/sbxobj.cxx b/basic/source/sbx/sbxobj.cxx index 4b1499944ffa..46f34f13d2e6 100644 --- a/basic/source/sbx/sbxobj.cxx +++ b/basic/source/sbx/sbxobj.cxx @@ -783,7 +783,7 @@ void SbxObject::Dump( SvStream& rStrm, bool bFill ) { aLine += aAttrs2; } - if( !pVar->IsA( TYPE(SbxMethod) ) ) + if( dynamic_cast<const SbxMethod *>(pVar) == nullptr ) { aLine += " !! Not a Method !!"; } @@ -822,7 +822,7 @@ void SbxObject::Dump( SvStream& rStrm, bool bFill ) { aLine += aAttrs3; } - if( !pVar->IsA( TYPE(SbxProperty) ) ) + if( dynamic_cast<const SbxProperty *>(pVar) == nullptr ) { aLine += " !! Not a Property !!"; } diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx index 2e353261b5c7..bb8880c690eb 100644 --- a/basic/source/sbx/sbxvar.cxx +++ b/basic/source/sbx/sbxvar.cxx @@ -590,7 +590,7 @@ bool SbxVariable::StoreData( SvStream& rStrm ) const { rStrm.WriteUChar( 0xFF ); // Marker bool bValStore; - if( this->IsA( TYPE(SbxMethod) ) ) + if( dynamic_cast<const SbxMethod *>(this) != nullptr ) { // #50200 Avoid that objects , which during the runtime // as return-value are saved in the method as a value were saved diff --git a/connectivity/source/drivers/dbase/DIndexIter.cxx b/connectivity/source/drivers/dbase/DIndexIter.cxx index 1d529958c2b8..070cf542b4ef 100644 --- a/connectivity/source/drivers/dbase/DIndexIter.cxx +++ b/connectivity/source/drivers/dbase/DIndexIter.cxx @@ -70,13 +70,13 @@ sal_uIntPtr OIndexIterator::Find(bool bFirst) ONDXKey* pKey = GetNextKey(); nRes = pKey ? pKey->GetRecord() : NODE_NOTFOUND; } - else if (m_pOperator->IsA(TYPE(OOp_ISNOTNULL))) + else if (dynamic_cast<const OOp_ISNOTNULL *>(m_pOperator) != nullptr) nRes = GetNotNull(bFirst); - else if (m_pOperator->IsA(TYPE(OOp_ISNULL))) + else if (dynamic_cast<const OOp_ISNULL *>(m_pOperator) != nullptr) nRes = GetNull(bFirst); - else if (m_pOperator->IsA(TYPE(OOp_LIKE))) + else if (dynamic_cast<const OOp_LIKE *>(m_pOperator) != nullptr) nRes = GetLike(bFirst); - else if (m_pOperator->IsA(TYPE(OOp_COMPARE))) + else if (dynamic_cast<const OOp_COMPARE *>(m_pOperator) != nullptr) nRes = GetCompare(bFirst); return nRes; diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx index 0450870bc34c..b271fc28f144 100644 --- a/cui/source/tabpages/backgrnd.cxx +++ b/cui/source/tabpages/backgrnd.cxx @@ -441,10 +441,6 @@ VclPtr<SfxTabPage> SvxBackgroundTabPage::Create( vcl::Window* pParent, const Sfx void SvxBackgroundTabPage::Reset( const SfxItemSet* rSet ) { -// os: Such a nonsense! One will always find such an item somewhere, -// but it must be existing in the rSet! -// const SfxPoolItem* pX = GetOldItem( rSet, SID_VIEW_FLD_PIC ); -// if( pX && pX->ISA(SfxWallpaperItem)) if(SfxItemState::DEFAULT <= rSet->GetItemState(GetWhich(SID_VIEW_FLD_PIC), false)) { ResetFromWallpaperItem( *rSet ); @@ -640,11 +636,6 @@ bool SvxBackgroundTabPage::FillItemSet( SfxItemSet* rCoreSet ) pPageImpl->pLoadIdle->Stop(); LoadIdleHdl_Impl( pPageImpl->pLoadIdle ); } -// os: Such a nonsense! One will always find such an item somewhere, -// but it must be existing in the rSet! - -// const SfxPoolItem* pX = GetOldItem( rCoreSet, SID_VIEW_FLD_PIC ); -// if( pX && pX->ISA(SfxWallpaperItem)) if(SfxItemState::DEFAULT <= rCoreSet->GetItemState(GetWhich(SID_VIEW_FLD_PIC), false)) return FillItemSetWithWallpaperItem( *rCoreSet, SID_VIEW_FLD_PIC ); diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx index 08bd5f070712..caf452641e66 100644 --- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx +++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx @@ -89,7 +89,7 @@ using namespace com::sun::star::frame; namespace { - bool implCheckItemType( SfxItemSet& _rSet, const sal_uInt16 _nId, const TypeId _nExpectedItemType ) + bool implCheckItemType( SfxItemSet& _rSet, const sal_uInt16 _nId, std::function<bool ( const SfxPoolItem* )> isItemType ) { bool bCorrectType = false; @@ -98,7 +98,7 @@ namespace if ( pPool ) { const SfxPoolItem& rDefItem = pPool->GetDefaultItem( _nId ); - bCorrectType = rDefItem.IsA( _nExpectedItemType ); + bCorrectType = isItemType(&rDefItem); } return bCorrectType; } @@ -902,13 +902,14 @@ OString ODbDataSourceAdministrationHelper::translatePropertyId( sal_Int32 _nId ) OString aReturn( aString.getStr(), aString.getLength(), RTL_TEXTENCODING_ASCII_US ); return aReturn; } +template<class T> bool checkItemType(const SfxPoolItem* pItem){ return dynamic_cast<const T*>(pItem) != nullptr;} void ODbDataSourceAdministrationHelper::implTranslateProperty( SfxItemSet& _rSet, sal_Int32 _nId, const Any& _rValue ) { switch ( _rValue.getValueType().getTypeClass() ) { case TypeClass_STRING: - if ( implCheckItemType( _rSet, _nId, SfxStringItem::StaticType() ) ) + if ( implCheckItemType( _rSet, _nId, checkItemType<SfxStringItem> ) ) { OUString sValue; _rValue >>= sValue; @@ -925,13 +926,13 @@ void ODbDataSourceAdministrationHelper::implTranslateProperty( SfxItemSet& _rSet break; case TypeClass_BOOLEAN: - if ( implCheckItemType( _rSet, _nId, SfxBoolItem::StaticType() ) ) + if ( implCheckItemType( _rSet, _nId, checkItemType<SfxBoolItem> ) ) { bool bVal = false; _rValue >>= bVal; _rSet.Put(SfxBoolItem(_nId, bVal)); } - else if ( implCheckItemType( _rSet, _nId, OptionalBoolItem::StaticType() ) ) + else if ( implCheckItemType( _rSet, _nId, checkItemType<OptionalBoolItem> ) ) { OptionalBoolItem aItem( _nId ); if ( _rValue.hasValue() ) @@ -955,7 +956,7 @@ void ODbDataSourceAdministrationHelper::implTranslateProperty( SfxItemSet& _rSet break; case TypeClass_LONG: - if ( implCheckItemType( _rSet, _nId, SfxInt32Item::StaticType() ) ) + if ( implCheckItemType( _rSet, _nId, checkItemType<SfxInt32Item> ) ) { sal_Int32 nValue = 0; _rValue >>= nValue; @@ -972,7 +973,7 @@ void ODbDataSourceAdministrationHelper::implTranslateProperty( SfxItemSet& _rSet break; case TypeClass_SEQUENCE: - if ( implCheckItemType( _rSet, _nId, OStringListItem::StaticType() ) ) + if ( implCheckItemType( _rSet, _nId, checkItemType<OStringListItem> ) ) { // determine the element type TypeDescription aTD(_rValue.getValueType()); diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index 5e7fdb59cfdf..610e7545173f 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -876,7 +876,7 @@ void ConvertItem( SfxPoolItem& rPoolItem, MapUnit eSourceUnit, MapUnit eDestUnit { case EE_PARA_LRSPACE: { - DBG_ASSERT( rPoolItem.IsA( TYPE( SvxLRSpaceItem ) ), "ConvertItem: invalid Item!" ); + DBG_ASSERT( dynamic_cast<const SvxLRSpaceItem *>(&rPoolItem) != nullptr, "ConvertItem: invalid Item!" ); SvxLRSpaceItem& rItem = static_cast<SvxLRSpaceItem&>(rPoolItem); rItem.SetTextFirstLineOfst( sal::static_int_cast< short >( OutputDevice::LogicToLogic( rItem.GetTextFirstLineOfst(), eSourceUnit, eDestUnit ) ) ); rItem.SetTextLeft( OutputDevice::LogicToLogic( rItem.GetTextLeft(), eSourceUnit, eDestUnit ) ); @@ -885,7 +885,7 @@ void ConvertItem( SfxPoolItem& rPoolItem, MapUnit eSourceUnit, MapUnit eDestUnit break; case EE_PARA_ULSPACE: { - DBG_ASSERT( rPoolItem.IsA( TYPE( SvxULSpaceItem ) ), "ConvertItem: Invalid Item!" ); + DBG_ASSERT( dynamic_cast<const SvxULSpaceItem *>(&rPoolItem) != nullptr, "ConvertItem: Invalid Item!" ); SvxULSpaceItem& rItem = static_cast<SvxULSpaceItem&>(rPoolItem); rItem.SetUpper( sal::static_int_cast< sal_uInt16 >( OutputDevice::LogicToLogic( rItem.GetUpper(), eSourceUnit, eDestUnit ) ) ); rItem.SetLower( sal::static_int_cast< sal_uInt16 >( OutputDevice::LogicToLogic( rItem.GetLower(), eSourceUnit, eDestUnit ) ) ); @@ -893,7 +893,7 @@ void ConvertItem( SfxPoolItem& rPoolItem, MapUnit eSourceUnit, MapUnit eDestUnit break; case EE_PARA_SBL: { - DBG_ASSERT( rPoolItem.IsA( TYPE( SvxLineSpacingItem ) ), "ConvertItem: Invalid Item!" ); + DBG_ASSERT( dynamic_cast<const SvxLineSpacingItem *>(&rPoolItem) != nullptr, "ConvertItem: Invalid Item!" ); SvxLineSpacingItem& rItem = static_cast<SvxLineSpacingItem&>(rPoolItem); // SetLineHeight changes also eLineSpace! if ( rItem.GetLineSpaceRule() == SVX_LINE_SPACE_MIN ) @@ -902,7 +902,7 @@ void ConvertItem( SfxPoolItem& rPoolItem, MapUnit eSourceUnit, MapUnit eDestUnit break; case EE_PARA_TABS: { - DBG_ASSERT( rPoolItem.IsA( TYPE( SvxTabStopItem ) ), "ConvertItem: Invalid Item!" ); + DBG_ASSERT( dynamic_cast<const SvxTabStopItem *>(&rPoolItem) != nullptr, "ConvertItem: Invalid Item!" ); SvxTabStopItem& rItem = static_cast<SvxTabStopItem&>(rPoolItem); SvxTabStopItem aNewItem( EE_PARA_TABS ); for ( sal_uInt16 i = 0; i < rItem.Count(); i++ ) @@ -918,7 +918,7 @@ void ConvertItem( SfxPoolItem& rPoolItem, MapUnit eSourceUnit, MapUnit eDestUnit case EE_CHAR_FONTHEIGHT_CJK: case EE_CHAR_FONTHEIGHT_CTL: { - DBG_ASSERT( rPoolItem.IsA( TYPE( SvxFontHeightItem ) ), "ConvertItem: Invalid Item!" ); + DBG_ASSERT( dynamic_cast<const SvxFontHeightItem *>(&rPoolItem) != nullptr, "ConvertItem: Invalid Item!" ); SvxFontHeightItem& rItem = static_cast<SvxFontHeightItem&>(rPoolItem); rItem.SetHeight( OutputDevice::LogicToLogic( rItem.GetHeight(), eSourceUnit, eDestUnit ) ); } diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index 64c5738660f7..f137bb4c809e 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -2284,7 +2284,7 @@ bool EditEngine::UpdateFieldsOnly() return pImpEditEngine->UpdateFields(); } -void EditEngine::RemoveFields( bool bKeepFieldText, TypeId aType ) +void EditEngine::RemoveFields( bool bKeepFieldText, std::function<bool ( const SvxFieldData* )> isFieldData ) { if ( bKeepFieldText ) @@ -2301,7 +2301,7 @@ void EditEngine::RemoveFields( bool bKeepFieldText, TypeId aType ) if (rAttr.Which() == EE_FEATURE_FIELD) { const SvxFieldData* pFldData = static_cast<const SvxFieldItem*>(rAttr.GetItem())->GetField(); - if ( pFldData && ( !aType || ( pFldData->IsA( aType ) ) ) ) + if ( pFldData && ( isFieldData( pFldData ) ) ) { DBG_ASSERT( dynamic_cast<const SvxFieldItem*>(rAttr.GetItem()), "no field item..." ); EditSelection aSel( EditPaM(pNode, rAttr.GetStart()), EditPaM(pNode, rAttr.GetEnd()) ); diff --git a/editeng/source/outliner/outlin2.cxx b/editeng/source/outliner/outlin2.cxx index 2d16ba588de9..d52f7556035c 100644 --- a/editeng/source/outliner/outlin2.cxx +++ b/editeng/source/outliner/outlin2.cxx @@ -153,9 +153,9 @@ bool Outliner::UpdateFields() return pEditEngine->UpdateFields(); } -void Outliner::RemoveFields( bool bKeepFieldText, TypeId aType ) +void Outliner::RemoveFields( bool bKeepFieldText, std::function<bool ( const SvxFieldData* )> isFieldData ) { - pEditEngine->RemoveFields( bKeepFieldText, aType ); + pEditEngine->RemoveFields( bKeepFieldText, isFieldData ); } void Outliner::SetWordDelimiters( const OUString& rDelimiters ) diff --git a/idl/inc/basobj.hxx b/idl/inc/basobj.hxx index 71dc13675b46..f63e1580f569 100644 --- a/idl/inc/basobj.hxx +++ b/idl/inc/basobj.hxx @@ -23,7 +23,7 @@ #include <tools/ref.hxx> #include <bastype.hxx> #include <tools/pstm.hxx> - +#include <functional> class SvTokenStream; class SvMetaObject; class SvIdlDataBase; @@ -67,6 +67,10 @@ public: virtual bool Test( SvIdlDataBase &, SvTokenStream & rInStm ); virtual bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ); }; +template<class T> bool checkSvMetaObject(const SvMetaObject* pObject) +{ + return dynamic_cast<const T*>(pObject) != nullptr; +} class SvMetaObjectMemberStack { @@ -77,10 +81,10 @@ public: void Push( SvMetaObject * pObj ) { aList.push_back( pObj ); } SvMetaObject * Pop() { return aList.pop_back(); } - SvMetaObject * Get( TypeId nType ) + SvMetaObject * Get( std::function<bool ( const SvMetaObject* )> isSvMetaObject ) { for( SvMetaObjectMemberList::reverse_iterator it = aList.rbegin(); it != aList.rend(); ++it ) - if( (*it)->IsA( nType ) ) + if( isSvMetaObject(*it) ) return *it; return NULL; } diff --git a/idl/source/objects/basobj.cxx b/idl/source/objects/basobj.cxx index 59a832ecb503..a9a90624774e 100644 --- a/idl/source/objects/basobj.cxx +++ b/idl/source/objects/basobj.cxx @@ -188,7 +188,7 @@ const SvGlobalName & SvMetaExtern::GetUUId() const void SvMetaExtern::SetModule( SvIdlDataBase & rBase ) { - pModule = static_cast<SvMetaModule *>(rBase.GetStack().Get( TYPE( SvMetaModule ) )); + pModule = static_cast<SvMetaModule *>(rBase.GetStack().Get( checkSvMetaObject<SvMetaModule> )); } void SvMetaExtern::ReadAttributesSvIdl( SvIdlDataBase & rBase, diff --git a/idl/source/objects/object.cxx b/idl/source/objects/object.cxx index 3310770334a1..218504f18487 100644 --- a/idl/source/objects/object.cxx +++ b/idl/source/objects/object.cxx @@ -176,7 +176,7 @@ bool SvMetaClass::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm ) bool SvMetaClass::TestAttribute( SvIdlDataBase & rBase, SvTokenStream & rInStm, SvMetaAttribute & rAttr ) const { - if ( !rAttr.GetRef() && rAttr.IsA( TYPE( SvMetaSlot ) ) ) + if ( !rAttr.GetRef() && dynamic_cast<const SvMetaSlot *>(&rAttr) != nullptr ) { OSL_FAIL( "Neuer Slot : " ); OSL_FAIL( rAttr.GetSlotId().getString().getStr() ); diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx index d9aee4bd5af6..a35a3424309d 100644 --- a/include/editeng/editeng.hxx +++ b/include/editeng/editeng.hxx @@ -39,6 +39,7 @@ #include <editeng/eedata.hxx> #include <o3tl/typed_flags_set.hxx> #include <svl/languageoptions.hxx> +#include <functional> namespace com { namespace sun { namespace star { namespace linguistic2 { @@ -136,6 +137,10 @@ namespace o3tl { template<> struct typed_flags<GetAttribsFlags> : is_typed_flags<GetAttribsFlags, 0x07> {}; } +template<class T> bool checkSvxFieldData(const SvxFieldData* pData) +{ + return dynamic_cast<const T*>(pData) != nullptr; +} class SdrObject; class EDITENG_DLLPUBLIC EditEngine @@ -452,7 +457,7 @@ public: bool UpdateFields(); bool UpdateFieldsOnly(); - void RemoveFields( bool bKeepFieldText, TypeId aType = NULL ); + void RemoveFields( bool bKeepFieldText, std::function<bool ( const SvxFieldData* )> isFieldData = [] (const SvxFieldData* ){return true;} ); sal_uInt16 GetFieldCount( sal_Int32 nPara ) const; EFieldInfo GetFieldInfo( sal_Int32 nPara, sal_uInt16 nField ) const; diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index 77ae2e0dd41d..69ccb523fbe0 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -908,7 +908,7 @@ public: void QuickFormatDoc( bool bFull = false ); bool UpdateFields(); - void RemoveFields( bool bKeepFieldText, TypeId aType = NULL ); + void RemoveFields( bool bKeepFieldText, std::function<bool ( const SvxFieldData* )> isFieldData = [] (const SvxFieldData* ){return true;} ); void FieldClicked( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos ); virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, Color*& rTxtColor, Color*& rFldColor ); diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx index bf88c0fa6e99..f30c068ca780 100644 --- a/include/sfx2/objsh.hxx +++ b/include/sfx2/objsh.hxx @@ -52,6 +52,7 @@ #include <memory> #include <set> #include <o3tl/typed_flags_set.hxx> +#include <functional> #define LOK_USE_UNSTABLE_API #include <LibreOfficeKit/LibreOfficeKitTypes.h> @@ -193,6 +194,10 @@ enum class SfxObjectCreateMode class SfxToolBoxConfig; struct TransferableObjectDescriptor; +template<class T> bool checkSfxObjectShell(const SfxObjectShell* pShell) +{ + return dynamic_cast<const T*>(pShell) != nullptr; +} class SFX2_DLLPUBLIC SfxObjectShell : public SfxShell, virtual public SotObject, @@ -255,10 +260,10 @@ public: static OUString CreateShellID( const SfxObjectShell* pShell ); // Document-Shell Iterator - static SfxObjectShell* GetFirst( const TypeId* pType = 0, + static SfxObjectShell* GetFirst( std::function<bool ( const SfxObjectShell* )> isObjectShell = nullptr, bool bOnlyVisible = true ); static SfxObjectShell* GetNext( const SfxObjectShell& rPrev, - const TypeId* pType = 0, + std::function<bool ( const SfxObjectShell* )> isObjectShell = nullptr, bool bOnlyVisible = true ); static SfxObjectShell* Current(); static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > diff --git a/include/sfx2/request.hxx b/include/sfx2/request.hxx index 5aafc55e357f..c796d0cd66dc 100644..100755 --- a/include/sfx2/request.hxx +++ b/include/sfx2/request.hxx @@ -24,6 +24,7 @@ #include <sal/types.h> #include <svl/itemset.hxx> #include <svl/hint.hxx> +#include <functional> #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/beans/PropertyValue.hpp> @@ -39,8 +40,6 @@ class SfxViewFrame; struct SfxRequest_Impl; enum class SfxCallMode : sal_uInt16; - - class SFX2_DLLPUBLIC SfxRequest: public SfxHint { friend struct SfxRequest_Impl; @@ -49,7 +48,6 @@ friend struct SfxRequest_Impl; SfxAllItemSet* pArgs; SfxRequest_Impl* pImp; - public: SAL_DLLPRIVATE void Record_Impl( SfxShell &rSh, const SfxSlot &rSlot, com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > xRecorder, @@ -82,8 +80,9 @@ public: static const SfxPoolItem* GetItem( const SfxItemSet*, sal_uInt16 nSlotId, bool bDeep = false, - TypeId aType = 0 ); - const SfxPoolItem* GetArg( sal_uInt16 nSlotId, bool bDeep = false, TypeId aType = 0 ) const; + std::function<bool ( const SfxPoolItem* )> isItemType = nullptr ); + const SfxPoolItem* GetArg( sal_uInt16 nSlotId, bool bDeep = false, std::function<bool ( const SfxPoolItem* )> isItemType = nullptr ) const; + void ReleaseArgs(); void SetReturnValue(const SfxPoolItem &); const SfxPoolItem* GetReturnValue() const; @@ -111,14 +110,17 @@ private: const SfxRequest& operator=(const SfxRequest &) SAL_DELETED_FUNCTION; }; - +template<class T> bool checkSfxPoolItem(const SfxPoolItem* pItem) +{ + return dynamic_cast<const T*>(pItem) != nullptr; +} #define SFX_REQUEST_ARG(rReq, pItem, ItemType, nSlotId, bDeep) \ const ItemType *pItem = static_cast<const ItemType*>( \ - rReq.GetArg( nSlotId, bDeep, TYPE(ItemType) ) ) + rReq.GetArg( nSlotId, bDeep, checkSfxPoolItem<ItemType> ) ) #define SFX_ITEMSET_ARG(pArgs, pItem, ItemType, nSlotId, bDeep) \ const ItemType *pItem = static_cast<const ItemType*>( \ - SfxRequest::GetItem( pArgs, nSlotId, bDeep, TYPE(ItemType) ) ) + SfxRequest::GetItem( pArgs, nSlotId, bDeep, checkSfxPoolItem<ItemType> ) ) #endif diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx index ca5090f4cce2..1928989aec85 100644 --- a/include/sfx2/viewsh.hxx +++ b/include/sfx2/viewsh.hxx @@ -41,6 +41,7 @@ #include <sfx2/tabdlg.hxx> #define LOK_USE_UNSTABLE_API #include <LibreOfficeKit/LibreOfficeKitTypes.h> +#include <functional> class SfxBaseController; class Size; @@ -137,6 +138,11 @@ public: \ #define SFX_VIEW_REGISTRATION(DocClass) \ DocClass::Factory().RegisterViewFactory( *Factory() ) +template<class T> bool checkSfxViewShell(const SfxViewShell* pShell) +{ + return dynamic_cast<const T*>(pShell) != nullptr; +} + class SFX2_DLLPUBLIC SfxViewShell: public SfxShell, public SfxListener { #ifdef INCLUDED_SFX2_VIEWSH_HXX @@ -166,9 +172,10 @@ protected: public: // Iteration - static SfxViewShell* GetFirst( const TypeId* pType = 0, bool bOnlyVisible = true ); + static SfxViewShell* GetFirst( bool bOnlyVisible = true, std::function<bool ( const SfxViewShell* )> isViewShell = nullptr ); static SfxViewShell* GetNext( const SfxViewShell& rPrev, - const TypeId* pType = 0, bool bOnlyVisible = true ); + bool bOnlyVisible = true, + std::function<bool ( const SfxViewShell* )> isViewShell = nullptr ); static SfxViewShell* Current(); static SfxViewShell* Get( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController>& i_rController ); diff --git a/include/tools/pstm.hxx b/include/tools/pstm.hxx index 9d22c4234c39..577c301d0c8c 100644 --- a/include/tools/pstm.hxx +++ b/include/tools/pstm.hxx @@ -75,7 +75,7 @@ public: { \ SvPersistBase * pObj; \ rStm >> pObj; \ - rpObj = PTR_CAST( Class, pObj ); \ + rpObj = dynamic_cast< Class*>( pObj ); \ return rStm; \ } diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index d391733fd9ed..e6d9081ff1cc 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -6764,8 +6764,7 @@ void Test::testUndoDataAnchor() ScDocShell* Test::findLoadedDocShellByName(const OUString& rName) { - TypeId aType(TYPE(ScDocShell)); - ScDocShell* pShell = static_cast<ScDocShell*>(SfxObjectShell::GetFirst(&aType, false)); + ScDocShell* pShell = static_cast<ScDocShell*>(SfxObjectShell::GetFirst(checkSfxObjectShell<ScDocShell>, false)); while (pShell) { SfxMedium* pMedium = pShell->GetMedium(); @@ -6775,7 +6774,7 @@ ScDocShell* Test::findLoadedDocShellByName(const OUString& rName) if (aName.equals(rName)) return pShell; } - pShell = static_cast<ScDocShell*>(SfxObjectShell::GetNext(*pShell, &aType, false)); + pShell = static_cast<ScDocShell*>(SfxObjectShell::GetNext(*pShell, checkSfxObjectShell<ScDocShell>, false)); } return NULL; } diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx index d9e9bd376ebd..15818a927a10 100644 --- a/sc/source/core/data/documen8.cxx +++ b/sc/source/core/data/documen8.cxx @@ -726,7 +726,7 @@ void ScDocument::SaveDdeLinks(SvStream& rStream) const for (i=0; i<nCount; i++) { ::sfx2::SvBaseLink* pBase = *rLinks[i]; - if (pBase->ISA(ScDdeLink)) + if (dynamic_cast<const ScDdeLink*>( pBase) != nullptr) if ( !bExport40 || static_cast<ScDdeLink*>(pBase)->GetMode() == SC_DDE_DEFAULT ) ++nDdeCount; } @@ -741,7 +741,7 @@ void ScDocument::SaveDdeLinks(SvStream& rStream) const for (i=0; i<nCount; i++) { ::sfx2::SvBaseLink* pBase = *rLinks[i]; - if (pBase->ISA(ScDdeLink)) + if (dynamic_cast<const ScDdeLink*>( pBase) != nullptr) { ScDdeLink* pLink = static_cast<ScDdeLink*>(pBase); if ( !bExport40 || pLink->GetMode() == SC_DDE_DEFAULT ) @@ -893,7 +893,7 @@ void ScDocument::CopyDdeLinks( ScDocument* pDestDoc ) const for (size_t i = 0, n = rLinks.size(); i < n; ++i) { const sfx2::SvBaseLink* pBase = *rLinks[i]; - if (pBase->ISA(ScDdeLink)) + if (dynamic_cast<const ScDdeLink*>( pBase) != nullptr) { const ScDdeLink* p = static_cast<const ScDdeLink*>(pBase); ScDdeLink* pNew = new ScDdeLink(pDestDoc, *p); @@ -922,7 +922,7 @@ ScDdeLink* lclGetDdeLink( for( size_t nIndex = 0; nIndex < nCount; ++nIndex ) { ::sfx2::SvBaseLink* pLink = *rLinks[ nIndex ]; - if( ScDdeLink* pDdeLink = PTR_CAST( ScDdeLink, pLink ) ) + if( ScDdeLink* pDdeLink = dynamic_cast<ScDdeLink*>( pLink ) ) { if( (OUString(pDdeLink->GetAppl()) == rAppl) && (OUString(pDdeLink->GetTopic()) == rTopic) && @@ -949,7 +949,7 @@ ScDdeLink* lclGetDdeLink( const sfx2::LinkManager* pLinkManager, size_t nDdePos for( size_t nIndex = 0; nIndex < nCount; ++nIndex ) { ::sfx2::SvBaseLink* pLink = *rLinks[ nIndex ]; - if( ScDdeLink* pDdeLink = PTR_CAST( ScDdeLink, pLink ) ) + if( ScDdeLink* pDdeLink = dynamic_cast<ScDdeLink*>( pLink ) ) { if( nDdeIndex == nDdePos ) return pDdeLink; @@ -1046,7 +1046,7 @@ bool ScDocument::HasAreaLinks() const const ::sfx2::SvBaseLinks& rLinks = pMgr->GetLinks(); sal_uInt16 nCount = rLinks.size(); for (sal_uInt16 i=0; i<nCount; i++) - if ((*rLinks[i])->ISA(ScAreaLink)) + if (0 != dynamic_cast<const ScAreaLink* >((*rLinks[i]).get())) return true; return false; @@ -1062,7 +1062,7 @@ void ScDocument::UpdateAreaLinks() for (size_t i=0; i<rLinks.size(); i++) { ::sfx2::SvBaseLink* pBase = *rLinks[i]; - if (pBase->ISA(ScAreaLink)) + if (dynamic_cast<const ScAreaLink*>( pBase) != nullptr) pBase->Update(); } } @@ -1078,7 +1078,7 @@ void ScDocument::DeleteAreaLinksOnTab( SCTAB nTab ) while ( nPos < rLinks.size() ) { const ::sfx2::SvBaseLink* pBase = *rLinks[nPos]; - if ( pBase->ISA(ScAreaLink) && + if ( dynamic_cast<const ScAreaLink*>( pBase) != nullptr && static_cast<const ScAreaLink*>(pBase)->GetDestArea().aStart.Tab() == nTab ) pMgr->Remove(nPos); else @@ -1100,7 +1100,7 @@ void ScDocument::UpdateRefAreaLinks( UpdateRefMode eUpdateRefMode, for (sal_uInt16 i=0; i<nCount; i++) { ::sfx2::SvBaseLink* pBase = *rLinks[i]; - if (pBase->ISA(ScAreaLink)) + if (dynamic_cast<const ScAreaLink*>( pBase) != nullptr) { ScAreaLink* pLink = static_cast<ScAreaLink*>(pBase); ScRange aOutRange = pLink->GetDestArea(); @@ -1136,13 +1136,13 @@ void ScDocument::UpdateRefAreaLinks( UpdateRefMode eUpdateRefMode, { bool bFound = false; ::sfx2::SvBaseLink* pFirst = *rLinks[nFirstIndex]; - if ( pFirst->ISA(ScAreaLink) ) + if ( dynamic_cast<const ScAreaLink*>( pFirst) != nullptr ) { ScAddress aFirstPos = static_cast<ScAreaLink*>(pFirst)->GetDestArea().aStart; for ( sal_uInt16 nSecondIndex = nFirstIndex + 1; nSecondIndex < nCount && !bFound; ++nSecondIndex ) { ::sfx2::SvBaseLink* pSecond = *rLinks[nSecondIndex]; - if ( pSecond->ISA(ScAreaLink) && + if ( dynamic_cast<const ScAreaLink*>( pSecond) != nullptr && static_cast<ScAreaLink*>(pSecond)->GetDestArea().aStart == aFirstPos ) { // remove the first link, exit the inner loop, don't increment nFirstIndex diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx index 0c9ad39acfc5..9ca20922cded 100644 --- a/sc/source/core/data/documen9.cxx +++ b/sc/source/core/data/documen9.cxx @@ -344,7 +344,7 @@ void ScDocument::StartAnimations( SCTAB nTab, vcl::Window* pWin ) SdrObject* pObject = aIter.Next(); while (pObject) { - if (pObject->ISA(SdrGrafObj)) + if (dynamic_cast<const SdrGrafObj*>( pObject) != nullptr) { SdrGrafObj* pGrafObj = static_cast<SdrGrafObj*>(pObject); if ( pGrafObj->IsAnimated() ) diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 68d99591386e..8fafa7b3b3dc 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -4818,7 +4818,7 @@ bool ScDocument::IsStyleSheetUsed( const ScStyleSheet& rStyle, bool bGatherAllSt for ( const SfxStyleSheetBase* pStyle = aIter.First(); pStyle; pStyle = aIter.Next() ) { - const ScStyleSheet* pScStyle = PTR_CAST( ScStyleSheet, pStyle ); + const ScStyleSheet* pScStyle = dynamic_cast<const ScStyleSheet*>( pStyle ); if ( pScStyle ) pScStyle->SetUsage( ScStyleSheet::NOTUSED ); } diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index dc7576ce81aa..f87954f742c5 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -552,7 +552,7 @@ void ScDrawLayer::MoveCells( SCTAB nTab, SCCOL nCol1,SCROW nRow1, SCCOL nCol2,SC } if (bChange) { - if ( pObj->ISA( SdrRectObj ) && pData->maStart.IsValid() && pData->maEnd.IsValid() ) + if ( dynamic_cast<const SdrRectObj*>( pObj) != nullptr && pData->maStart.IsValid() && pData->maEnd.IsValid() ) pData->maStart.PutInOrder( pData->maEnd ); // Update also an untransformed anchor thats what we stored ( and still do ) to xml @@ -2047,7 +2047,7 @@ IMapObject* ScDrawLayer::GetHitIMapObject( SdrObject* pObj, Graphic aGraphic; bool bObjSupported = false; - if ( pObj->ISA( SdrGrafObj ) ) // Simple Graphics object + if ( dynamic_cast<const SdrGrafObj*>( pObj) != nullptr ) // Simple Graphics object { const SdrGrafObj* pGrafObj = static_cast<const SdrGrafObj*>( pObj ); const GeoStat& rGeo = pGrafObj->GetGeoStat(); @@ -2075,7 +2075,7 @@ IMapObject* ScDrawLayer::GetHitIMapObject( SdrObject* pObj, bObjSupported = true; } - else if ( pObj->ISA( SdrOle2Obj ) ) // OLE object + else if ( dynamic_cast<const SdrOle2Obj*>( pObj) != nullptr ) // OLE object { // TODO/LEAN: working with visual area needs running state aGraphSize = static_cast<const SdrOle2Obj*>(pObj)->GetOrigObjSize(); diff --git a/sc/source/core/data/stlpool.cxx b/sc/source/core/data/stlpool.cxx index d175cc75c9ab..ecc6b45f3327 100644 --- a/sc/source/core/data/stlpool.cxx +++ b/sc/source/core/data/stlpool.cxx @@ -110,7 +110,7 @@ SfxStyleSheetBase* ScStyleSheetPool::Create( const OUString& rName, SfxStyleSheetBase* ScStyleSheetPool::Create( const SfxStyleSheetBase& rStyle ) { - OSL_ENSURE( rStyle.ISA(ScStyleSheet), "Invalid StyleSheet-class! :-/" ); + OSL_ENSURE( dynamic_cast<const ScStyleSheet*>( &rStyle) != nullptr, "Invalid StyleSheet-class! :-/" ); return new ScStyleSheet( static_cast<const ScStyleSheet&>(rStyle) ); } diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx index e54eaa7f5f22..fe8db9143d8c 100644 --- a/sc/source/core/data/table5.cxx +++ b/sc/source/core/data/table5.cxx @@ -133,7 +133,7 @@ void ScTable::UpdatePageBreaks( const ScRange* pUserArea ) { if ( pStyleSet->GetItemState( ATTR_PAGE_SCALETOPAGES, false, &pItem ) == SfxItemState::SET ) { - OSL_ENSURE( pItem->ISA(SfxUInt16Item), "invalid Item" ); + OSL_ENSURE( dynamic_cast<const SfxUInt16Item*>( pItem) != nullptr, "invalid Item" ); bSkipColBreaks = bSkipRowBreaks = static_cast<const SfxUInt16Item*>(pItem)->GetValue() > 0; } diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx index e168ec6110f1..2e77adac1745 100644 --- a/sc/source/core/data/validat.cxx +++ b/sc/source/core/data/validat.cxx @@ -289,7 +289,7 @@ bool ScValidationData::DoMacro( const ScAddress& rPos, const OUString& rInput, StarBASIC* pRoot = pDocSh->GetBasic(); SbxVariable* pVar = pRoot->Find( aErrorTitle, SbxCLASS_METHOD ); - if ( pVar && pVar->ISA(SbMethod) ) + if ( pVar && dynamic_cast<const SbMethod*>( pVar) != nullptr ) { SbMethod* pMethod = static_cast<SbMethod*>(pVar); SbModule* pModule = pMethod->GetModule(); diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 41c526ee7ff5..91bef3d0c2fd 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -3064,7 +3064,7 @@ bool ScCompiler::IsMacro( const OUString& rName ) // It really should be a BASIC function! if( pMeth->GetType() == SbxVOID || ( pMeth->IsFixed() && pMeth->GetType() == SbxEMPTY ) - || !pMeth->ISA(SbMethod) ) + || dynamic_cast<const SbMethod*>( pMeth) == nullptr ) { return false; } diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx index be0c53cf5c7b..1b318010fa6d 100644 --- a/sc/source/core/tool/detfunc.cxx +++ b/sc/source/core/tool/detfunc.cxx @@ -1251,7 +1251,7 @@ bool ScDetectiveFunc::DeleteAll( ScDetectiveDelete eWhat ) bool bDoThis = true; if ( eWhat != SC_DET_ALL ) { - bool bCircle = ( pObject->ISA(SdrCircObj) ); + bool bCircle = ( dynamic_cast<const SdrCircObj*>( pObject) != nullptr ); bool bCaption = ScDrawLayer::IsNoteCaption( pObject ); if ( eWhat == SC_DET_DETECTIVE ) // detektive, from menue bDoThis = !bCaption; // also circles @@ -1502,7 +1502,7 @@ void ScDetectiveFunc::UpdateAllArrowColors() { // frame for area reference has no ObjType, always gets arrow color - if ( pObject->ISA( SdrRectObj ) && !pObject->ISA( SdrCaptionObj ) ) + if ( dynamic_cast<const SdrRectObj*>( pObject) != nullptr && dynamic_cast<const SdrCaptionObj*>( pObject) == nullptr ) { bArrow = true; } @@ -1544,7 +1544,7 @@ bool ScDetectiveFunc::FindFrameForObject( SdrObject* pObject, ScRange& rRange ) { SdrObject* pPrevObj = pPage->GetObj(nOrdNum - 1); - if ( pPrevObj && pPrevObj->GetLayer() == SC_LAYER_INTERN && pPrevObj->ISA(SdrRectObj) ) + if ( pPrevObj && pPrevObj->GetLayer() == SC_LAYER_INTERN && dynamic_cast<const SdrRectObj*>( pPrevObj) != nullptr ) { ScDrawObjData* pPrevData = ScDrawLayer::GetObjDataTab( pPrevObj, rRange.aStart.Tab() ); if ( pPrevData && pPrevData->maStart.IsValid() && pPrevData->maEnd.IsValid() && (pPrevData->maStart == rRange.aStart) ) @@ -1596,7 +1596,7 @@ ScDetectiveObjType ScDetectiveFunc::GetDetectiveObjectType( SdrObject* pObject, if ( nObjColor == GetErrorColor() && nObjColor != GetArrowColor() ) rRedLine = true; } - else if ( pObject->ISA(SdrCircObj) ) + else if ( dynamic_cast<const SdrCircObj*>( pObject) != nullptr ) { if ( bValidStart ) { diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx index 4d797ccda674..c2fedb2749c4 100644 --- a/sc/source/core/tool/editutil.cxx +++ b/sc/source/core/tool/editutil.cxx @@ -877,7 +877,7 @@ void ScFieldEditEngine::FieldClicked( const SvxFieldItem& rField, sal_Int32, sal { const SvxFieldData* pFld = rField.GetField(); - if ( pFld && pFld->ISA( SvxURLField ) && bExecuteURL ) + if ( pFld && dynamic_cast<const SvxURLField*>( pFld) != nullptr && bExecuteURL ) { const SvxURLField* pURLField = static_cast<const SvxURLField*>(pFld); ScGlobal::OpenURL( pURLField->GetURL(), pURLField->GetTargetFrame() ); diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index 677f2d305208..ce1fdda1cd91 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -2346,7 +2346,7 @@ static ScDdeLink* lcl_GetDdeLink( sfx2::LinkManager* pLinkMgr, for (size_t i=0; i<nCount; i++ ) { ::sfx2::SvBaseLink* pBase = *pLinkMgr->GetLinks()[i]; - if (pBase->ISA(ScDdeLink)) + if (dynamic_cast<const ScDdeLink*>( pBase) != nullptr) { ScDdeLink* pLink = static_cast<ScDdeLink*>(pBase); if ( pLink->GetAppl() == rA && diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index 68d182ca5f83..211ac7cb49f1 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -2907,7 +2907,7 @@ void ScInterpreter::ScMacro() } SbxVariable* pVar = pRoot ? pRoot->Find(aMacro, SbxCLASS_METHOD) : NULL; - if( !pVar || pVar->GetType() == SbxVOID || !pVar->ISA(SbMethod) ) + if( !pVar || pVar->GetType() == SbxVOID || dynamic_cast<const SbMethod*>( pVar) == nullptr ) { PushError( errNoMacro ); return; @@ -2919,7 +2919,7 @@ void ScInterpreter::ScMacro() SbModule* pModule = pMethod->GetModule(); bool bUseVBAObjects = pModule->IsVBACompat(); SbxObject* pObject = pModule->GetParent(); - OSL_ENSURE(pObject->IsA(TYPE(StarBASIC)), "No Basic found!"); + OSL_ENSURE(dynamic_cast<const StarBASIC *>(pObject) != nullptr, "No Basic found!"); OUString aMacroStr = pObject->GetName() + "." + pModule->GetName() + "." + pMethod->GetName(); OUString aBasicStr; if (pObject->GetParent()) @@ -3095,7 +3095,7 @@ void ScInterpreter::ScMacro() else if ( eResType & SbxARRAY ) { SbxBase* pElemObj = refRes->GetObject(); - SbxDimArray* pDimArray = PTR_CAST(SbxDimArray,pElemObj); + SbxDimArray* pDimArray = dynamic_cast< SbxDimArray *>( pElemObj ); short nDim = pDimArray->GetDims(); if ( 1 <= nDim && nDim <= 2 ) { diff --git a/sc/source/filter/excel/xehelper.cxx b/sc/source/filter/excel/xehelper.cxx index ab144bba1f76..e67cba02f623 100644 --- a/sc/source/filter/excel/xehelper.cxx +++ b/sc/source/filter/excel/xehelper.cxx @@ -465,7 +465,7 @@ XclExpStringRef lclCreateFormattedString( if( aEditSet.GetItemState( EE_FEATURE_FIELD, false, &pItem ) == SfxItemState::SET ) { const SvxFieldData* pField = static_cast< const SvxFieldItem* >( pItem )->GetField(); - if( const SvxURLField* pUrlField = PTR_CAST( SvxURLField, pField ) ) + if( const SvxURLField* pUrlField = dynamic_cast<const SvxURLField*>( pField ) ) { // convert URL field to string representation aXclPortionText = pLinkHelper ? @@ -808,19 +808,19 @@ void XclExpHFConverter::AppendPortion( const EditTextObject* pTextObj, sal_Unico { if( const SvxFieldData* pFieldData = static_cast< const SvxFieldItem* >( pItem )->GetField() ) { - if( pFieldData->ISA( SvxPageField ) ) + if( dynamic_cast<const SvxPageField*>( pFieldData) != nullptr ) aParaText += "&P"; - else if( pFieldData->ISA( SvxPagesField ) ) + else if( dynamic_cast<const SvxPagesField*>( pFieldData) != nullptr ) aParaText += "&N"; - else if( pFieldData->ISA( SvxDateField ) ) + else if( dynamic_cast<const SvxDateField*>( pFieldData) != nullptr ) aParaText += "&D"; - else if( pFieldData->ISA( SvxTimeField ) || pFieldData->ISA( SvxExtTimeField ) ) + else if( dynamic_cast<const SvxTimeField*>( pFieldData) != nullptr || dynamic_cast<const SvxExtTimeField*>( pFieldData) != nullptr ) aParaText += "&T"; - else if( pFieldData->ISA( SvxTableField ) ) + else if( dynamic_cast<const SvxTableField*>( pFieldData) != nullptr ) aParaText += "&A"; - else if( pFieldData->ISA( SvxFileField ) ) // title -> file name + else if( dynamic_cast<const SvxFileField*>( pFieldData) != nullptr ) // title -> file name aParaText += "&F"; - else if( const SvxExtFileField* pFileField = PTR_CAST( SvxExtFileField, pFieldData ) ) + else if( const SvxExtFileField* pFileField = dynamic_cast<const SvxExtFileField*>( pFieldData ) ) { switch( pFileField->GetFormat() ) { diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx index 8ddd831875bb..c8d362275788 100644 --- a/sc/source/filter/html/htmlexp.cxx +++ b/sc/source/filter/html/htmlexp.cxx @@ -1268,7 +1268,7 @@ bool ScHTMLExport::WriteFieldText( const EditTextObject* pData ) if ( aSet.GetItemState( EE_FEATURE_FIELD, false, &pItem ) == SfxItemState::SET ) { const SvxFieldData* pField = static_cast<const SvxFieldItem*>(pItem)->GetField(); - if ( pField && pField->ISA(SvxURLField) ) + if ( pField && dynamic_cast<const SvxURLField*>( pField) != nullptr ) { bUrl = true; const SvxURLField* pURLField = static_cast<const SvxURLField*>(pField); diff --git a/sc/source/filter/xcl97/xcl97esc.cxx b/sc/source/filter/xcl97/xcl97esc.cxx index 0191c89cc081..6a36a78eb98b 100644 --- a/sc/source/filter/xcl97/xcl97esc.cxx +++ b/sc/source/filter/xcl97/xcl97esc.cxx @@ -287,7 +287,7 @@ EscherExHostAppData* XclEscherEx::StartShape( const Reference< XShape >& rxShape pAnchor->SetFlags( *pObj ); pCurrAppData->SetClientAnchor( pAnchor ); } - const SdrTextObj* pTextObj = PTR_CAST( SdrTextObj, pObj ); + const SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>( pObj ); if( pTextObj && !lcl_IsFontwork( pTextObj ) && (pObj->GetObjIdentifier() != OBJ_CAPTION) ) { const OutlinerParaObject* pParaObj = pTextObj->GetOutlinerParaObject(); diff --git a/sc/source/ui/app/client.cxx b/sc/source/ui/app/client.cxx index 0fea634e739b..11702c6efc23 100644 --- a/sc/source/ui/app/client.cxx +++ b/sc/source/ui/app/client.cxx @@ -80,7 +80,7 @@ SdrOle2Obj* ScClient::GetDrawObj() void ScClient::RequestNewObjectArea( Rectangle& aLogicRect ) { SfxViewShell* pSfxViewSh = GetViewShell(); - ScTabViewShell* pViewSh = PTR_CAST( ScTabViewShell, pSfxViewSh ); + ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>( pSfxViewSh ); if (!pViewSh) { OSL_FAIL("Wrong ViewShell"); @@ -142,7 +142,7 @@ void ScClient::RequestNewObjectArea( Rectangle& aLogicRect ) void ScClient::ObjectAreaChanged() { SfxViewShell* pSfxViewSh = GetViewShell(); - ScTabViewShell* pViewSh = PTR_CAST( ScTabViewShell, pSfxViewSh ); + ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>( pSfxViewSh ); if (!pViewSh) { OSL_FAIL("Wrong ViewShell"); @@ -174,7 +174,7 @@ void ScClient::ObjectAreaChanged() // set document modified (SdrModel::SetChanged is not used) // TODO/LATER: is there a reason that this code is not executed in Draw? // SfxViewShell* pSfxViewSh = GetViewShell(); -// ScTabViewShell* pViewSh = PTR_CAST( ScTabViewShell, pSfxViewSh ); +// ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>( pSfxViewSh ); if (pViewSh) pViewSh->GetViewData().GetDocShell()->SetDrawModified(); } @@ -226,7 +226,7 @@ void ScClient::ViewChanged() //SetObjArea( aObjArea ); SfxViewShell* pSfxViewSh = GetViewShell(); - ScTabViewShell* pViewSh = PTR_CAST( ScTabViewShell, pSfxViewSh ); + ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>( pSfxViewSh ); if ( pViewSh ) { vcl::Window* pWin = pViewSh->GetActiveWin(); diff --git a/sc/source/ui/app/drwtrans.cxx b/sc/source/ui/app/drwtrans.cxx index c2182667c703..4cd8e87c5b3b 100644 --- a/sc/source/ui/app/drwtrans.cxx +++ b/sc/source/ui/app/drwtrans.cxx @@ -127,7 +127,7 @@ ScDrawTransferObj::ScDrawTransferObj( SdrModel* pClipModel, ScDocShell* pContain // URL button - SdrUnoObj* pUnoCtrl = PTR_CAST(SdrUnoObj, pObject); + SdrUnoObj* pUnoCtrl = dynamic_cast<SdrUnoObj*>( pObject ); if (pUnoCtrl && FmFormInventor == pUnoCtrl->GetObjInventor()) { uno::Reference<awt::XControlModel> xControlModel = pUnoCtrl->GetUnoControlModel(); @@ -267,7 +267,7 @@ static bool lcl_HasOnlyControls( SdrModel* pModel ) bOnlyControls = true; // only set if there are any objects at all while ( pObj ) { - if (!pObj->ISA(SdrUnoObj)) + if (dynamic_cast<const SdrUnoObj*>( pObj) == nullptr) { bOnlyControls = false; break; @@ -746,7 +746,7 @@ void ScDrawTransferObj::InitDocShell() SdrObject* pObject = aIter.Next(); while (pObject) { - if ( pObject->ISA(SdrUnoObj) ) + if ( dynamic_cast<const SdrUnoObj*>( pObject) != nullptr ) pObject->NbcSetLayer(SC_LAYER_CONTROLS); else pObject->NbcSetLayer(SC_LAYER_FRONT); diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 8cabdcb91706..9d5567df845b 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -1676,7 +1676,7 @@ void ScInputHandler::ViewShellGone(ScTabViewShell* pViewSh) // Executed synchron UpdateAutoCorrFlag(); } - pActiveViewSh = PTR_CAST( ScTabViewShell, SfxViewShell::Current() ); + pActiveViewSh = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() ); if ( pActiveViewSh && pActiveViewSh == pViewSh ) { @@ -2226,7 +2226,7 @@ void ScInputHandler::ShowRefFrame() // Modifying pActiveViewSh here would interfere with the bInEnterHandler / bRepeat // checks in NotifyChange, and lead to keeping the wrong value in pActiveViewSh. // A local variable is used instead. - ScTabViewShell* pVisibleSh = PTR_CAST( ScTabViewShell, SfxViewShell::Current() ); + ScTabViewShell* pVisibleSh = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() ); if ( pRefViewSh && pRefViewSh != pVisibleSh ) { bool bFound = false; @@ -3395,7 +3395,7 @@ void ScInputHandler::NotifyChange( const ScInputHdlState* pState, if ( pSourceSh ) pActiveViewSh = pSourceSh; else - pActiveViewSh = PTR_CAST(ScTabViewShell, SfxViewShell::Current()); + pActiveViewSh = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() ); ImplCreateEditEngine(); diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index a717f00fdd38..ae0554381779 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -161,7 +161,7 @@ static VclPtr<ScTextWndBase> lcl_chooseRuntimeImpl( vcl::Window* pParent, SfxBin { SfxViewFrame* pViewFrm = pDisp->GetFrame(); if ( pViewFrm ) - pViewSh = PTR_CAST( ScTabViewShell, pViewFrm->GetViewShell() ); + pViewSh = dynamic_cast<ScTabViewShell*>( pViewFrm->GetViewShell() ); } if ( !lcl_isExperimentalMode() ) @@ -196,7 +196,7 @@ ScInputWindow::ScInputWindow( vcl::Window* pParent, SfxBindings* pBind ) : { SfxViewFrame* pViewFrm = pDisp->GetFrame(); if ( pViewFrm ) - pViewSh = PTR_CAST( ScTabViewShell, pViewFrm->GetViewShell() ); + pViewSh = dynamic_cast<ScTabViewShell*>( pViewFrm->GetViewShell() ); } OSL_ENSURE( pViewSh, "no view shell for input window" ); @@ -271,8 +271,7 @@ void ScInputWindow::dispose() if ( !bDown ) { - TypeId aScType = TYPE(ScTabViewShell); - SfxViewShell* pSh = SfxViewShell::GetFirst( &aScType ); + SfxViewShell* pSh = SfxViewShell::GetFirst( true, checkSfxViewShell<ScTabViewShell> ); while ( pSh ) { ScInputHandler* pHdl = static_cast<ScTabViewShell*>(pSh)->GetInputHandler(); @@ -281,7 +280,7 @@ void ScInputWindow::dispose() pHdl->SetInputWindow( NULL ); pHdl->StopInputWinEngine( false ); // reset pTopView pointer } - pSh = SfxViewShell::GetNext( *pSh, &aScType ); + pSh = SfxViewShell::GetNext( *pSh, true, checkSfxViewShell<ScTabViewShell> ); } } @@ -309,7 +308,7 @@ void ScInputWindow::SetInputHandler( ScInputHandler* pNew ) bool ScInputWindow::UseSubTotal(ScRangeList* pRangeList) { bool bSubTotal = false; - ScTabViewShell* pViewSh = PTR_CAST( ScTabViewShell, SfxViewShell::Current() ); + ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() ); if ( pViewSh ) { ScDocument* pDoc = pViewSh->GetViewData().GetDocument(); @@ -401,7 +400,7 @@ void ScInputWindow::Select() case SID_INPUT_SUM: { - ScTabViewShell* pViewSh = PTR_CAST( ScTabViewShell, SfxViewShell::Current() ); + ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() ); if ( pViewSh ) { const ScMarkData& rMark = pViewSh->GetViewData().GetMarkData(); @@ -511,7 +510,7 @@ void ScInputWindow::Select() sal_Int32 nStartPos = 1; sal_Int32 nEndPos = 1; - ScTabViewShell* pViewSh = PTR_CAST( ScTabViewShell, SfxViewShell::Current() ); + ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() ); if ( pViewSh ) { const OUString& rString = aTextWindow.GetTextString(); @@ -1799,7 +1798,7 @@ void ScTextWnd::StartEditEngine() // as long as EditEngine and DrawText sometimes differ for CTL text, // repaint now to have the EditEngine's version visible // SfxObjectShell* pObjSh = SfxObjectShell::Current(); - if ( pObjSh && pObjSh->ISA(ScDocShell) ) + if ( pObjSh && dynamic_cast<const ScDocShell*>( pObjSh) != nullptr ) { ScDocument& rDoc = static_cast<ScDocShell*>(pObjSh)->GetDocument(); // any document SvtScriptType nScript = rDoc.GetStringScriptType( aString ); @@ -1896,7 +1895,7 @@ void ScTextWnd::SetTextString( const OUString& rNewString ) SvtScriptType nOldScript = SvtScriptType::NONE; SvtScriptType nNewScript = SvtScriptType::NONE; SfxObjectShell* pObjSh = SfxObjectShell::Current(); - if ( pObjSh && pObjSh->ISA(ScDocShell) ) + if ( pObjSh && dynamic_cast<const ScDocShell*>( pObjSh) != nullptr ) { // any document can be used (used only for its break iterator) ScDocument& rDoc = static_cast<ScDocShell*>(pObjSh)->GetDocument(); @@ -2140,7 +2139,7 @@ void ScPosWnd::FillRangeNames() Clear(); SfxObjectShell* pObjSh = SfxObjectShell::Current(); - if ( pObjSh && pObjSh->ISA(ScDocShell) ) + if ( pObjSh && dynamic_cast<const ScDocShell*>( pObjSh) != nullptr ) { ScDocument& rDoc = static_cast<ScDocShell*>(pObjSh)->GetDocument(); @@ -2392,7 +2391,7 @@ void ScPosWnd::DoEnter() } else { - ScTabViewShell* pViewSh = PTR_CAST( ScTabViewShell, SfxViewShell::Current() ); + ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() ); ScInputHandler* pHdl = pScMod->GetInputHdl( pViewSh ); if (pHdl) pHdl->InsertFunction( aText ); @@ -2531,7 +2530,7 @@ void ScPosWnd::ReleaseFocus_Impl() HideTip(); SfxViewShell* pCurSh = SfxViewShell::Current(); - ScInputHandler* pHdl = SC_MOD()->GetInputHdl( PTR_CAST( ScTabViewShell, pCurSh ) ); + ScInputHandler* pHdl = SC_MOD()->GetInputHdl( dynamic_cast<ScTabViewShell*>( pCurSh ) ); if ( pHdl && pHdl->IsTopMode() ) { // Focus back in input row? diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index 1265653b1081..81626abc9dc4 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -246,7 +246,7 @@ void ScModule::ConfigurationChanged( utl::ConfigurationBroadcaster* p, sal_uInt3 SfxViewShell* pViewShell = SfxViewShell::GetFirst(); while(pViewShell) { - if ( pViewShell->ISA(ScTabViewShell) ) + if ( dynamic_cast<const ScTabViewShell*>( pViewShell) != nullptr ) { ScTabViewShell* pViewSh = static_cast<ScTabViewShell*>(pViewShell); pViewSh->PaintGrid(); @@ -258,7 +258,7 @@ void ScModule::ConfigurationChanged( utl::ConfigurationBroadcaster* p, sal_uInt3 if ( pHdl ) pHdl->ForgetLastPattern(); // EditEngine BackgroundColor may change } - else if ( pViewShell->ISA(ScPreviewShell) ) + else if ( dynamic_cast<const ScPreviewShell*>( pViewShell) != nullptr ) { vcl::Window* pWin = pViewShell->GetWindow(); if (pWin) @@ -293,7 +293,7 @@ void ScModule::ConfigurationChanged( utl::ConfigurationBroadcaster* p, sal_uInt3 SfxViewShell* pSh = SfxViewShell::GetFirst(); while ( pSh ) { - if ( pSh->ISA( ScTabViewShell ) ) + if ( dynamic_cast<const ScTabViewShell*>( pSh) != nullptr ) { ScTabViewShell* pViewSh = static_cast<ScTabViewShell*>(pSh); @@ -305,7 +305,7 @@ void ScModule::ConfigurationChanged( utl::ConfigurationBroadcaster* p, sal_uInt3 pViewSh->DigitLanguageChanged(); pViewSh->PaintGrid(); } - else if ( pSh->ISA( ScPreviewShell ) ) + else if ( dynamic_cast<const ScPreviewShell*>( pSh) != nullptr ) { ScPreviewShell* pPreviewSh = static_cast<ScPreviewShell*>(pSh); ScPreview* pPreview = pPreviewSh->GetPreview(); @@ -398,7 +398,7 @@ void ScModule::Execute( SfxRequest& rReq ) bSet = static_cast<const SfxBoolItem*>(pItem)->GetValue(); else { // Toggle - ScDocShell* pDocSh = PTR_CAST(ScDocShell, SfxObjectShell::Current()); + ScDocShell* pDocSh = dynamic_cast<ScDocShell*>( SfxObjectShell::Current() ); if ( pDocSh ) bSet = !pDocSh->GetDocument().GetDocOptions().IsAutoSpell(); else @@ -476,7 +476,7 @@ void ScModule::Execute( SfxRequest& rReq ) if (pReqArgs) { const SfxUInt16Item& rItem = static_cast<const SfxUInt16Item&>(pReqArgs->Get(SID_PSZ_FUNCTION)); - OSL_ENSURE(rItem.ISA(SfxUInt16Item),"wrong Parameter"); + OSL_ENSURE(dynamic_cast<const SfxUInt16Item*>( &rItem) != nullptr,"wrong Parameter"); ScAppOptions aNewOpts( GetAppOptions() ); aNewOpts.SetStatusFunc( rItem.GetValue() ); @@ -501,7 +501,7 @@ void ScModule::Execute( SfxRequest& rReq ) const SfxPoolItem* pItem; if ( pReqArgs && SfxItemState::SET == pReqArgs->GetItemState( GetPool().GetWhich(nSlot), true, &pItem ) ) { - ScDocShell* pDocSh = PTR_CAST(ScDocShell, SfxObjectShell::Current()); + ScDocShell* pDocSh = dynamic_cast<ScDocShell*>( SfxObjectShell::Current() ); if ( pDocSh ) { ScDocument& rDoc = pDocSh->GetDocument(); @@ -524,7 +524,7 @@ void ScModule::Execute( SfxRequest& rReq ) ScInputHandler* pInputHandler = GetInputHdl(); if ( pInputHandler ) pInputHandler->UpdateSpellSettings(); // EditEngine flags - ScTabViewShell* pViewSh = PTR_CAST(ScTabViewShell, SfxViewShell::Current()); + ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() ); if ( pViewSh ) pViewSh->UpdateDrawTextOutliner(); // EditEngine flags @@ -570,7 +570,7 @@ void ScModule::Execute( SfxRequest& rReq ) void ScModule::GetState( SfxItemSet& rSet ) { - ScDocShell* pDocSh = PTR_CAST(ScDocShell, SfxObjectShell::Current()); + ScDocShell* pDocSh = dynamic_cast<ScDocShell*>( SfxObjectShell::Current() ); bool bTabView = pDocSh && (pDocSh->GetBestViewShell() != NULL); SfxWhichIter aIter(rSet); @@ -961,8 +961,8 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet ) SfxViewFrame* pViewFrm = SfxViewFrame::Current(); SfxBindings* pBindings = pViewFrm ? &pViewFrm->GetBindings() : NULL; - ScTabViewShell* pViewSh = PTR_CAST(ScTabViewShell, SfxViewShell::Current()); - ScDocShell* pDocSh = PTR_CAST(ScDocShell, SfxObjectShell::Current()); + ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() ); + ScDocShell* pDocSh = dynamic_cast<ScDocShell*>( SfxObjectShell::Current() ); ScDocument* pDoc = pDocSh ? &pDocSh->GetDocument() : NULL; const SfxPoolItem* pItem = NULL; bool bRepaint = false; @@ -1331,8 +1331,7 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet ) } // for all (tab-) views: - TypeId aScType = TYPE(ScTabViewShell); - SfxViewShell* pSh = SfxViewShell::GetFirst( &aScType ); + SfxViewShell* pSh = SfxViewShell::GetFirst( true, checkSfxViewShell<ScTabViewShell> ); while ( pSh ) { ScTabViewShell* pOneViewSh = static_cast<ScTabViewShell*>(pSh); @@ -1351,7 +1350,7 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet ) pOneViewSh->PaintTop(); pOneViewSh->PaintLeft(); - pSh = SfxViewShell::GetNext( *pSh, &aScType ); + pSh = SfxViewShell::GetNext( *pSh, true, checkSfxViewShell<ScTabViewShell> ); } } } @@ -1369,7 +1368,7 @@ ScInputHandler* ScModule::GetInputHdl( ScTabViewShell* pViewSh, bool bUseRef ) { // in case a UIActive embedded object has no ViewShell (UNO component) // the own calc view shell will be set as current, but no handling should happen - ScTabViewShell* pCurViewSh = PTR_CAST( ScTabViewShell, SfxViewShell::Current() ); + ScTabViewShell* pCurViewSh = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() ); if ( pCurViewSh && !pCurViewSh->GetUIActiveClient() ) pViewSh = pCurViewSh; } @@ -1552,7 +1551,7 @@ void ScModule::SetRefDialog( sal_uInt16 nId, bool bVis, SfxViewFrame* pViewFrm ) { // store the dialog id also in the view shell SfxViewShell* pViewSh = pViewFrm->GetViewShell(); - if ( pViewSh && pViewSh->ISA( ScTabViewShell ) ) + if ( pViewSh && dynamic_cast<const ScTabViewShell*>( pViewSh) != nullptr ) static_cast<ScTabViewShell*>(pViewSh)->SetCurRefDlgId( nCurRefDlgId ); else { @@ -1834,7 +1833,7 @@ static void lcl_CheckNeedsRepaint( ScDocShell* pDocShell ) while ( pFrame ) { SfxViewShell* p = pFrame->GetViewShell(); - ScTabViewShell* pViewSh = PTR_CAST(ScTabViewShell,p); + ScTabViewShell* pViewSh = dynamic_cast< ScTabViewShell *>( p ); if ( pViewSh ) pViewSh->CheckNeedsRepaint(); pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell ); @@ -1966,14 +1965,12 @@ SfxItemSet* ScModule::CreateItemSet( sal_uInt16 nId ) const ScAppOptions& rAppOpt = GetAppOptions(); - ScDocShell* pDocSh = PTR_CAST(ScDocShell, - SfxObjectShell::Current()); + ScDocShell* pDocSh = dynamic_cast< ScDocShell *>( SfxObjectShell::Current() ); ScDocOptions aCalcOpt = pDocSh ? pDocSh->GetDocument().GetDocOptions() : GetDocOptions(); - ScTabViewShell* pViewSh = PTR_CAST(ScTabViewShell, - SfxViewShell::Current()); + ScTabViewShell* pViewSh = dynamic_cast< ScTabViewShell *>( SfxViewShell::Current() ); ScViewOptions aViewOpt = pViewSh ? pViewSh->GetViewData().GetOptions() : GetViewOptions(); @@ -2149,7 +2146,7 @@ IMPL_LINK_TYPED( ScModule, CalcFieldValueHdl, EditFieldInfo*, pInfo, void ) const SvxFieldItem& rField = pInfo->GetField(); const SvxFieldData* pField = rField.GetField(); - if (pField && pField->ISA(SvxURLField)) + if (pField && dynamic_cast<const SvxURLField*>( pField) != nullptr) { // URLField const SvxURLField* pURLField = static_cast<const SvxURLField*>(pField); diff --git a/sc/source/ui/app/seltrans.cxx b/sc/source/ui/app/seltrans.cxx index b48acb4c89df..0e199354d94f 100644 --- a/sc/source/ui/app/seltrans.cxx +++ b/sc/source/ui/app/seltrans.cxx @@ -43,7 +43,7 @@ static bool lcl_IsURLButton( SdrObject* pObject ) { bool bRet = false; - SdrUnoObj* pUnoCtrl = PTR_CAST(SdrUnoObj, pObject); + SdrUnoObj* pUnoCtrl = dynamic_cast<SdrUnoObj*>( pObject ); if (pUnoCtrl && FmFormInventor == pUnoCtrl->GetObjInventor()) { uno::Reference<awt::XControlModel> xControlModel = pUnoCtrl->GetUnoControlModel(); diff --git a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx index 44c59c04ba35..79d4b92b2b1e 100644 --- a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx +++ b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx @@ -61,7 +61,7 @@ void ScZoomSliderControl::StateChanged( sal_uInt16 /*nSID*/, SfxItemState eState ScZoomSliderWnd* pBox = static_cast<ScZoomSliderWnd*>(rTbx.GetItemWindow( nId )); OSL_ENSURE( pBox ,"Control not found!" ); - if ( SfxItemState::DEFAULT != eState || pState->ISA( SfxVoidItem ) ) + if ( SfxItemState::DEFAULT != eState || dynamic_cast<const SfxVoidItem*>( pState) != nullptr ) { SvxZoomSliderItem aZoomSliderItem( 100 ); pBox->Disable(); @@ -70,7 +70,7 @@ void ScZoomSliderControl::StateChanged( sal_uInt16 /*nSID*/, SfxItemState eState else { pBox->Enable(); - OSL_ENSURE( pState->ISA( SvxZoomSliderItem ), "invalid item type" ); + OSL_ENSURE( dynamic_cast<const SvxZoomSliderItem*>( pState) != nullptr, "invalid item type" ); const SvxZoomSliderItem* pZoomSliderItem = dynamic_cast< const SvxZoomSliderItem* >( pState ); OSL_ENSURE( pZoomSliderItem, "Sc::ScZoomSliderControl::StateChanged(), wrong item type!" ); diff --git a/sc/source/ui/dbgui/scuiimoptdlg.cxx b/sc/source/ui/dbgui/scuiimoptdlg.cxx index 98c77dae318e..5ca9b8f5dfc0 100644 --- a/sc/source/ui/dbgui/scuiimoptdlg.cxx +++ b/sc/source/ui/dbgui/scuiimoptdlg.cxx @@ -208,7 +208,7 @@ ScImportOptionsDlg::ScImportOptionsDlg( m_pCbQuoteAll->Show(); m_pCbQuoteAll->Check( false ); m_pCbFormulas->Show(); - ScTabViewShell* pViewSh = PTR_CAST( ScTabViewShell, SfxViewShell::Current()); + ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() ); bool bFormulas = pViewSh && pViewSh->GetViewData().GetOptions().GetOption( VOPT_FORMULAS); m_pCbFormulas->Check( bFormulas ); diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx index c982dcb1bfa0..f1f24800df08 100644 --- a/sc/source/ui/docshell/arealink.cxx +++ b/sc/source/ui/docshell/arealink.cxx @@ -72,7 +72,7 @@ ScAreaLink::ScAreaLink( SfxObjectShell* pShell, const OUString& rFile, bInCreate (false), bDoInsert (true) { - OSL_ENSURE(pShell->ISA(ScDocShell), "ScAreaLink mit falscher ObjectShell"); + OSL_ENSURE(dynamic_cast< const ScDocShell *>( pShell ) != nullptr, "ScAreaLink mit falscher ObjectShell"); pImpl->m_pDocSh = static_cast< ScDocShell* >( pShell ); SetRefreshHandler( LINK( this, ScAreaLink, RefreshHdl ) ); SetRefreshControl( &pImpl->m_pDocSh->GetDocument().GetRefreshTimerControlAddress() ); diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 15fa0ece667a..b554dd29060b 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -5220,7 +5220,7 @@ bool ScDocFunc::InsertAreaLink( const OUString& rFile, const OUString& rFilter, while (nLinkPos<nLinkCount) { ::sfx2::SvBaseLink* pBase = *pLinkManager->GetLinks()[nLinkPos]; - if ( pBase->ISA(ScAreaLink) && + if ( dynamic_cast< const ScAreaLink *>( pBase ) != nullptr && static_cast<ScAreaLink*>(pBase)->GetDestArea().aStart == rDestRange.aStart ) { if ( bUndo ) diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 9860e53bc953..b3fd054626bc 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -2501,7 +2501,7 @@ bool ScDocShell::PrepareClose( bool bUI ) if( pFrame ) { SfxViewShell* p = pFrame->GetViewShell(); - ScTabViewShell* pViewSh = PTR_CAST(ScTabViewShell,p); + ScTabViewShell* pViewSh = dynamic_cast< ScTabViewShell *>( p ); if(pViewSh!=NULL) { vcl::Window *pWin=pViewSh->GetWindow(); @@ -2887,7 +2887,7 @@ VclPtr<SfxDocumentInfoDialog> ScDocShell::CreateDocumentInfoDialog( vcl::Window *pParent, const SfxItemSet &rSet ) { VclPtr<SfxDocumentInfoDialog> pDlg = VclPtr<SfxDocumentInfoDialog>::Create( pParent, rSet ); - ScDocShell* pDocSh = PTR_CAST(ScDocShell,SfxObjectShell::Current()); + ScDocShell* pDocSh = dynamic_cast< ScDocShell *>( SfxObjectShell::Current() ); // Only for statistics, if this Doc is shown; not from the Doc Manager if( pDocSh == this ) diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx index 0671e754a2fb..a1135db48cbb 100644 --- a/sc/source/ui/docshell/docsh3.cxx +++ b/sc/source/ui/docshell/docsh3.cxx @@ -480,7 +480,7 @@ sal_uInt16 ScDocShell::SetPrinter( SfxPrinter* pNewPrinter, SfxPrinterChangeFlag while (pFrame) { SfxViewShell* pSh = pFrame->GetViewShell(); - if (pSh && pSh->ISA(ScTabViewShell)) + if (pSh && dynamic_cast<const ScTabViewShell*>( pSh) != nullptr) { ScTabViewShell* pViewSh = static_cast<ScTabViewShell*>(pSh); ScInputHandler* pInputHdl = pScMod->GetInputHdl(pViewSh); diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 262b902ab9d4..79cabb134d8c 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -677,26 +677,26 @@ void ScDocShell::Execute( SfxRequest& rReq ) SfxMedium* pMed = NULL; if ( pReqArgs && pReqArgs->GetItemState( SID_FILE_NAME, true, &pItem ) == SfxItemState::SET && - pItem->ISA(SfxStringItem) ) + dynamic_cast<const SfxStringItem*>( pItem) != nullptr ) { OUString aFileName = static_cast<const SfxStringItem*>(pItem)->GetValue(); OUString aFilterName; if ( pReqArgs->GetItemState( SID_FILTER_NAME, true, &pItem ) == SfxItemState::SET && - pItem->ISA(SfxStringItem) ) + dynamic_cast<const SfxStringItem*>( pItem) != nullptr ) { aFilterName = static_cast<const SfxStringItem*>(pItem)->GetValue(); } OUString aOptions; if ( pReqArgs->GetItemState( SID_FILE_FILTEROPTIONS, true, &pItem ) == SfxItemState::SET && - pItem->ISA(SfxStringItem) ) + dynamic_cast<const SfxStringItem*>( pItem) != nullptr ) { aOptions = static_cast<const SfxStringItem*>(pItem)->GetValue(); } short nVersion = 0; if ( pReqArgs->GetItemState( SID_VERSION, true, &pItem ) == SfxItemState::SET && - pItem->ISA(SfxInt16Item) ) + dynamic_cast<const SfxInt16Item*>( pItem) != nullptr ) { nVersion = static_cast<const SfxInt16Item*>(pItem)->GetValue(); } @@ -817,7 +817,7 @@ void ScDocShell::Execute( SfxRequest& rReq ) const SfxPoolItem* pItem; if ( pReqArgs->GetItemState( nSlot, true, &pItem ) == SfxItemState::SET ) { - if ( pItem->ISA(SfxStringItem) ) + if ( dynamic_cast<const SfxStringItem*>( pItem) != nullptr ) { OUString aName = static_cast<const SfxStringItem*>(pItem)->GetValue(); SCTAB nTab; @@ -845,7 +845,7 @@ void ScDocShell::Execute( SfxRequest& rReq ) const SfxPoolItem* pItem; if ( pReqArgs->GetItemState( nSlot, true, &pItem ) == SfxItemState::SET ) { - if ( pItem->ISA(SfxStringItem) ) + if ( dynamic_cast<const SfxStringItem*>( pItem) != nullptr ) { OUString aName = static_cast<const SfxStringItem*>(pItem)->GetValue(); SCTAB nTab; @@ -893,7 +893,7 @@ void ScDocShell::Execute( SfxRequest& rReq ) const SfxPoolItem* pItem; if ( pReqArgs->GetItemState( nSlot, true, &pItem ) == SfxItemState::SET ) { - if ( pItem->ISA(SfxUInt16Item) ) + if ( dynamic_cast<const SfxUInt16Item*>( pItem) != nullptr ) { sal_uInt16 nY2k = static_cast<const SfxUInt16Item*>(pItem)->GetValue(); // immer an den DocOptions setzen, damit das auch fuer SO50 @@ -2205,7 +2205,7 @@ bool ScDocShell::DdeSetData( const OUString& rItem, ScViewData* ScDocShell::GetViewData() { SfxViewShell* pCur = SfxViewShell::Current(); - ScTabViewShell* pViewSh = PTR_CAST(ScTabViewShell,pCur); + ScTabViewShell* pViewSh = dynamic_cast< ScTabViewShell *>( pCur ); return pViewSh ? &pViewSh->GetViewData() : NULL; } @@ -2231,7 +2231,7 @@ ScTabViewShell* ScDocShell::GetBestViewShell( bool bOnlyVisible ) if( pFrame ) { SfxViewShell* p = pFrame->GetViewShell(); - pViewSh = PTR_CAST(ScTabViewShell,p); + pViewSh = dynamic_cast< ScTabViewShell *>( p ); } } return pViewSh; @@ -2295,7 +2295,7 @@ IMPL_LINK_TYPED( ScDocShell, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg SfxItemSet* pSet = pMed->GetItemSet(); if ( pSet && pSet->GetItemState( SID_VERSION, true, &pItem ) == SfxItemState::SET && - pItem->ISA( SfxInt16Item ) ) + dynamic_cast<const SfxInt16Item*>( pItem) != nullptr ) { pImpl->pRequest->AppendItem( *pItem ); } diff --git a/sc/source/ui/docshell/docsh6.cxx b/sc/source/ui/docshell/docsh6.cxx index 5acc3dd912da..737423695da7 100644 --- a/sc/source/ui/docshell/docsh6.cxx +++ b/sc/source/ui/docshell/docsh6.cxx @@ -354,7 +354,7 @@ void ScDocShell::UpdateLinks() { --k; ::sfx2::SvBaseLink* pBase = *pLinkManager->GetLinks()[k]; - if (pBase->ISA(ScTableLink)) + if (dynamic_cast<const ScTableLink*>( pBase) != nullptr) { ScTableLink* pTabLink = static_cast<ScTableLink*>(pBase); if (pTabLink->IsUsed()) @@ -418,7 +418,7 @@ bool ScDocShell::ReloadTabLinks() for (size_t i=0; i<nCount; i++ ) { ::sfx2::SvBaseLink* pBase = *pLinkManager->GetLinks()[i]; - if (pBase->ISA(ScTableLink)) + if (dynamic_cast<const ScTableLink*>( pBase) != nullptr) { ScTableLink* pTabLink = static_cast<ScTableLink*>(pBase); // pTabLink->SetAddUndo(sal_False); //! Undo's zusammenfassen diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx index 1a32289a8540..0730927a608f 100644 --- a/sc/source/ui/docshell/externalrefmgr.cxx +++ b/sc/source/ui/docshell/externalrefmgr.cxx @@ -2257,8 +2257,7 @@ ScDocument* ScExternalRefManager::getInMemorySrcDocument(sal_uInt16 nFileId) return NULL; ScDocument* pSrcDoc = NULL; - TypeId aType(TYPE(ScDocShell)); - ScDocShell* pShell = static_cast<ScDocShell*>(SfxObjectShell::GetFirst(&aType, false)); + ScDocShell* pShell = static_cast<ScDocShell*>(SfxObjectShell::GetFirst(checkSfxObjectShell<ScDocShell>, false)); while (pShell) { SfxMedium* pMedium = pShell->GetMedium(); @@ -2287,7 +2286,7 @@ ScDocument* ScExternalRefManager::getInMemorySrcDocument(sal_uInt16 nFileId) break; } } - pShell = static_cast<ScDocShell*>(SfxObjectShell::GetNext(*pShell, &aType, false)); + pShell = static_cast<ScDocShell*>(SfxObjectShell::GetNext(*pShell, checkSfxObjectShell<ScDocShell>, false)); } initDocInCache(maRefCache, pSrcDoc, nFileId); @@ -2556,14 +2555,13 @@ bool ScExternalRefManager::isOwnDocument(const OUString& rFile) const void ScExternalRefManager::convertToAbsName(OUString& rFile) const { // unsaved documents have no AbsName - TypeId aType(TYPE(ScDocShell)); - ScDocShell* pShell = static_cast<ScDocShell*>(SfxObjectShell::GetFirst(&aType, false)); + ScDocShell* pShell = static_cast<ScDocShell*>(SfxObjectShell::GetFirst(checkSfxObjectShell<ScDocShell>, false)); while (pShell) { if (rFile == pShell->GetName()) return; - pShell = static_cast<ScDocShell*>(SfxObjectShell::GetNext(*pShell, &aType, false)); + pShell = static_cast<ScDocShell*>(SfxObjectShell::GetNext(*pShell, checkSfxObjectShell<ScDocShell>, false)); } SfxObjectShell* pDocShell = mpDoc->GetDocumentShell(); diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index 4feaccc3af15..0e84f2da3246 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -80,7 +80,7 @@ enum SylkVersion // Whole document without Undo ScImportExport::ScImportExport( ScDocument* p ) - : pDocSh( PTR_CAST(ScDocShell,p->GetDocumentShell()) ), pDoc( p ), + : pDocSh( dynamic_cast< ScDocShell* >(p->GetDocumentShell()) ), pDoc( p ), nSizeLimit( 0 ), cSep( '\t' ), cStr( '"' ), bFormulas( false ), bIncludeFiltered( true ), bAll( true ), bSingle( true ), bUndo( false ), @@ -94,7 +94,7 @@ ScImportExport::ScImportExport( ScDocument* p ) // Insert am current cell without range(es) ScImportExport::ScImportExport( ScDocument* p, const ScAddress& rPt ) - : pDocSh( PTR_CAST(ScDocShell,p->GetDocumentShell()) ), pDoc( p ), + : pDocSh( dynamic_cast< ScDocShell* >(p->GetDocumentShell()) ), pDoc( p ), aRange( rPt ), nSizeLimit( 0 ), cSep( '\t' ), cStr( '"' ), bFormulas( false ), bIncludeFiltered( true ), @@ -110,7 +110,7 @@ ScImportExport::ScImportExport( ScDocument* p, const ScAddress& rPt ) // ctor with a range is only used for export //! ctor with a string (and bSingle=true) is also used for DdeSetData ScImportExport::ScImportExport( ScDocument* p, const ScRange& r ) - : pDocSh( PTR_CAST(ScDocShell,p->GetDocumentShell()) ), pDoc( p ), + : pDocSh( dynamic_cast<ScDocShell* >(p->GetDocumentShell()) ), pDoc( p ), aRange( r ), nSizeLimit( 0 ), cSep( '\t' ), cStr( '"' ), bFormulas( false ), bIncludeFiltered( true ), @@ -128,7 +128,7 @@ ScImportExport::ScImportExport( ScDocument* p, const ScRange& r ) // Evaluate input string - either range, cell or the whole document (when error) // If a View exists, the TabNo of the view will be used. ScImportExport::ScImportExport( ScDocument* p, const OUString& rPos ) - : pDocSh( PTR_CAST(ScDocShell,p->GetDocumentShell()) ), pDoc( p ), + : pDocSh( dynamic_cast< ScDocShell* >(p->GetDocumentShell()) ), pDoc( p ), nSizeLimit( 0 ), cSep( '\t' ), cStr( '"' ), bFormulas( false ), bIncludeFiltered( true ), bAll( false ), bSingle( true ), bUndo( pDocSh != NULL ), diff --git a/sc/source/ui/docshell/servobj.cxx b/sc/source/ui/docshell/servobj.cxx index 8fddc9b74427..e090bd26724b 100644 --- a/sc/source/ui/docshell/servobj.cxx +++ b/sc/source/ui/docshell/servobj.cxx @@ -209,7 +209,7 @@ void ScServerObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) // don't access DocShell anymore for EndListening etc. } } - else if (rBC.ISA(SfxApplication)) + else if (dynamic_cast<const SfxApplication*>( &rBC) != nullptr) { const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>( &rHint ); if ( !aItemStr.isEmpty() && pSimpleHint && diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx index 07d5c7a3ba92..4cb613f5fd51 100644 --- a/sc/source/ui/docshell/tablink.cxx +++ b/sc/source/ui/docshell/tablink.cxx @@ -442,8 +442,7 @@ bool ScDocumentLoader::GetFilterName( const OUString& rFileName, OUString& rFilter, OUString& rOptions, bool bWithContent, bool bWithInteraction ) { - TypeId aScType = TYPE(ScDocShell); - SfxObjectShell* pDocSh = SfxObjectShell::GetFirst( &aScType ); + SfxObjectShell* pDocSh = SfxObjectShell::GetFirst( checkSfxObjectShell<ScDocShell> ); while ( pDocSh ) { if ( pDocSh->HasName() ) @@ -456,7 +455,7 @@ bool ScDocumentLoader::GetFilterName( const OUString& rFileName, return true; } } - pDocSh = SfxObjectShell::GetNext( *pDocSh, &aScType ); + pDocSh = SfxObjectShell::GetNext( *pDocSh, checkSfxObjectShell<ScDocShell> ); } INetURLObject aUrl( rFileName ); diff --git a/sc/source/ui/docshell/tpstat.cxx b/sc/source/ui/docshell/tpstat.cxx index 0be22a9b0428..2675f2834263 100644 --- a/sc/source/ui/docshell/tpstat.cxx +++ b/sc/source/ui/docshell/tpstat.cxx @@ -39,7 +39,7 @@ ScDocStatPage::ScDocStatPage( vcl::Window *pParent, const SfxItemSet& rSet ) get(m_pFtCells,"nocells"); get(m_pFtPages,"nopages"); get(m_pFtFormula,"noformula"); - ScDocShell* pDocSh = PTR_CAST( ScDocShell, SfxObjectShell::Current() ); + ScDocShell* pDocSh = dynamic_cast<ScDocShell*>( SfxObjectShell::Current() ); ScDocStat aDocStat; if ( pDocSh ) diff --git a/sc/source/ui/drawfunc/chartsh.cxx b/sc/source/ui/drawfunc/chartsh.cxx index 07752f6aac77..1fb50a91877c 100644 --- a/sc/source/ui/drawfunc/chartsh.cxx +++ b/sc/source/ui/drawfunc/chartsh.cxx @@ -78,7 +78,7 @@ void ScChartShell::GetExportAsGraphicState( SfxItemSet& rSet ) { SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); - if( pObj && pObj->ISA( SdrOle2Obj ) ) + if( pObj && dynamic_cast<const SdrOle2Obj*>( pObj) != nullptr ) bEnable = true; } @@ -95,7 +95,7 @@ void ScChartShell::ExecuteExportAsGraphic( SfxRequest& ) { SdrObject* pObject = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); - if( pObject && pObject->ISA( SdrOle2Obj ) ) + if( pObject && dynamic_cast<const SdrOle2Obj*>( pObject) != nullptr ) { Reference< drawing::XShape > xSourceDoc = Reference< drawing::XShape >( pObject->getUnoShape(), UNO_QUERY_THROW ); GraphicHelper::SaveShapeAsGraphic( xSourceDoc ); diff --git a/sc/source/ui/drawfunc/drawsh2.cxx b/sc/source/ui/drawfunc/drawsh2.cxx index d582b3a9778e..24d69a1907bb 100644 --- a/sc/source/ui/drawfunc/drawsh2.cxx +++ b/sc/source/ui/drawfunc/drawsh2.cxx @@ -365,7 +365,7 @@ bool ScDrawShell::AreAllObjectsOnLayer(sal_uInt16 nLayerNo,const SdrMarkList& rM for (size_t i=0; i<nCount; ++i) { SdrObject* pObj = rMark.GetMark(i)->GetMarkedSdrObj(); - if ( !pObj->ISA(SdrUnoObj) ) + if ( dynamic_cast<const SdrUnoObj*>( pObj) == nullptr ) { if(nLayerNo!=pObj->GetLayer()) { diff --git a/sc/source/ui/drawfunc/drawsh5.cxx b/sc/source/ui/drawfunc/drawsh5.cxx index cdb6999bbad4..8a94c121896f 100644 --- a/sc/source/ui/drawfunc/drawsh5.cxx +++ b/sc/source/ui/drawfunc/drawsh5.cxx @@ -80,7 +80,7 @@ void ScDrawShell::GetHLinkState( SfxItemSet& rSet ) // Hyperlink aHLinkItem.SetURL( pInfo->GetHlink() ); aHLinkItem.SetInsertMode(HLINK_FIELD); } - SdrUnoObj* pUnoCtrl = PTR_CAST(SdrUnoObj, pObj); + SdrUnoObj* pUnoCtrl = dynamic_cast<SdrUnoObj*>( pObj ); if (pUnoCtrl && FmFormInventor == pUnoCtrl->GetObjInventor()) { uno::Reference<awt::XControlModel> xControlModel = pUnoCtrl->GetUnoControlModel(); @@ -166,7 +166,7 @@ void ScDrawShell::ExecuteHLink( SfxRequest& rReq ) if ( rMarkList.GetMarkCount() == 1 ) { SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); - SdrUnoObj* pUnoCtrl = PTR_CAST(SdrUnoObj, pObj ); + SdrUnoObj* pUnoCtrl = dynamic_cast<SdrUnoObj*>( pObj ); if (pUnoCtrl && FmFormInventor == pUnoCtrl->GetObjInventor()) { uno::Reference<awt::XControlModel> xControlModel = diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx index 04b9d34dc68c..a0c259259b13 100644 --- a/sc/source/ui/drawfunc/drtxtob.cxx +++ b/sc/source/ui/drawfunc/drtxtob.cxx @@ -182,7 +182,7 @@ void ScDrawTextObjectBar::Execute( SfxRequest &rReq ) const SfxPoolItem* pItem; if ( pReqArgs && pReqArgs->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()); } @@ -227,7 +227,7 @@ void ScDrawTextObjectBar::Execute( SfxRequest &rReq ) aString = 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 ) { OUString aFontName(pFontItem->GetValue()); @@ -274,7 +274,7 @@ void ScDrawTextObjectBar::Execute( SfxRequest &rReq ) if (pFieldItem) { const SvxFieldData* pField = pFieldItem->GetField(); - if ( pField && pField->ISA(SvxURLField) ) + if ( pField && dynamic_cast<const SvxURLField*>( pField) != nullptr ) { // altes Feld selektieren @@ -323,7 +323,7 @@ void ScDrawTextObjectBar::Execute( SfxRequest &rReq ) if ( pFieldItem ) { const SvxFieldData* pField = pFieldItem->GetField(); - if( pField && pField->ISA( SvxURLField ) ) + if( pField && dynamic_cast<const SvxURLField*>( pField) != nullptr ) { const SvxURLField* pURLField = static_cast< const SvxURLField* >( pField ); ScGlobal::OpenURL( pURLField->GetURL(), pURLField->GetTargetFrame() ); @@ -391,7 +391,7 @@ void ScDrawTextObjectBar::GetState( SfxItemSet& rSet ) if (pFieldItem) { const SvxFieldData* pField = pFieldItem->GetField(); - if ( pField && pField->ISA(SvxURLField) ) + if ( pField && dynamic_cast<const SvxURLField*>( pField) != nullptr ) { const SvxURLField* pURLField = static_cast<const SvxURLField*>(pField); aHLinkItem.SetName( pURLField->GetRepresentation() ); @@ -423,7 +423,7 @@ void ScDrawTextObjectBar::GetState( SfxItemSet& rSet ) if ( pFieldItem ) { const SvxFieldData* pField = pFieldItem->GetField(); - bEnable = pField && pField->ISA( SvxURLField ); + bEnable = pField && dynamic_cast<const SvxURLField*>( pField) != nullptr; } } if( !bEnable ) diff --git a/sc/source/ui/drawfunc/fuconarc.cxx b/sc/source/ui/drawfunc/fuconarc.cxx index c916a5177cf9..dcfaa8281380 100644 --- a/sc/source/ui/drawfunc/fuconarc.cxx +++ b/sc/source/ui/drawfunc/fuconarc.cxx @@ -189,7 +189,7 @@ SdrObject* FuConstArc::CreateDefaultObject(const sal_uInt16 nID, const Rectangle if(pObj) { - if(pObj->ISA(SdrCircObj)) + if(dynamic_cast<const SdrCircObj*>( pObj) != nullptr) { Rectangle aRect(rRectangle); diff --git a/sc/source/ui/drawfunc/fuconpol.cxx b/sc/source/ui/drawfunc/fuconpol.cxx index 2132b081d9eb..aa8ff4fc65b0 100644 --- a/sc/source/ui/drawfunc/fuconpol.cxx +++ b/sc/source/ui/drawfunc/fuconpol.cxx @@ -242,7 +242,7 @@ SdrObject* FuConstPolygon::CreateDefaultObject(const sal_uInt16 nID, const Recta if(pObj) { - if(pObj->ISA(SdrPathObj)) + if(dynamic_cast<const SdrPathObj*>( pObj) != nullptr) { basegfx::B2DPolyPolygon aPoly; diff --git a/sc/source/ui/drawfunc/fuconrec.cxx b/sc/source/ui/drawfunc/fuconrec.cxx index a39f12fc9235..5698732d94c8 100644 --- a/sc/source/ui/drawfunc/fuconrec.cxx +++ b/sc/source/ui/drawfunc/fuconrec.cxx @@ -129,7 +129,7 @@ bool FuConstRectangle::MouseButtonUp(const MouseEvent& rMEvt) { SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); // create OutlinerParaObject now so it can be set to vertical - if ( pObj->ISA(SdrTextObj) ) + if ( dynamic_cast<const SdrTextObj*>( pObj) != nullptr ) static_cast<SdrTextObj*>(pObj)->ForceOutlinerParaObject(); OutlinerParaObject* pOPO = pObj->GetOutlinerParaObject(); if( pOPO && !pOPO->IsVertical() ) @@ -232,7 +232,7 @@ SdrObject* FuConstRectangle::CreateDefaultObject(const sal_uInt16 nID, const Rec { case SID_DRAW_LINE: { - if(pObj->ISA(SdrPathObj)) + if(dynamic_cast<const SdrPathObj*>( pObj) != nullptr) { sal_Int32 nYMiddle((aRect.Top() + aRect.Bottom()) / 2); basegfx::B2DPolygon aPoly; @@ -250,7 +250,7 @@ SdrObject* FuConstRectangle::CreateDefaultObject(const sal_uInt16 nID, const Rec case SID_DRAW_CAPTION: case SID_DRAW_CAPTION_VERTICAL: { - if(pObj->ISA(SdrCaptionObj)) + if(dynamic_cast<const SdrCaptionObj*>( pObj) != nullptr) { bool bIsVertical(SID_DRAW_CAPTION_VERTICAL == nID); diff --git a/sc/source/ui/drawfunc/fuconstr.cxx b/sc/source/ui/drawfunc/fuconstr.cxx index 60447d90decd..b8cc232ca08e 100644 --- a/sc/source/ui/drawfunc/fuconstr.cxx +++ b/sc/source/ui/drawfunc/fuconstr.cxx @@ -230,7 +230,7 @@ bool FuConstruct::MouseButtonUp(const MouseEvent& rMEvt) SdrObject* pObj = pMark->GetMarkedSdrObj(); // bei Uno-Controls nicht in Textmodus - if ( pObj->ISA(SdrTextObj) && !pObj->ISA(SdrUnoObj) ) + if ( dynamic_cast<const SdrTextObj*>( pObj) != nullptr && dynamic_cast<const SdrUnoObj*>( pObj) == nullptr ) { OutlinerParaObject* pOPO = pObj->GetOutlinerParaObject(); bool bVertical = ( pOPO && pOPO->IsVertical() ); diff --git a/sc/source/ui/drawfunc/fudraw.cxx b/sc/source/ui/drawfunc/fudraw.cxx index aeefe44bbab3..073508bb4aaf 100644 --- a/sc/source/ui/drawfunc/fudraw.cxx +++ b/sc/source/ui/drawfunc/fudraw.cxx @@ -186,7 +186,7 @@ bool FuDraw::MouseButtonUp(const MouseEvent& rMEvt) static bool lcl_KeyEditMode( SdrObject* pObj, ScTabViewShell* pViewShell, const KeyEvent* pInitialKey ) { bool bReturn = false; - if ( pObj && pObj->ISA(SdrTextObj) && !pObj->ISA(SdrUnoObj) ) + if ( pObj && dynamic_cast<const SdrTextObj*>( pObj) != nullptr && dynamic_cast<const SdrUnoObj*>( pObj) == nullptr ) { // start text edit - like FuSelection::MouseButtonUp, // but with bCursorToEnd instead of mouse position @@ -269,7 +269,7 @@ bool FuDraw::KeyInput(const KeyEvent& rKEvt) { bool bOle = pViewShell->GetViewFrame()->GetFrame().IsInPlace(); SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); - if( pObj && pObj->ISA( SdrOle2Obj ) && !bOle ) + if( pObj && dynamic_cast<const SdrOle2Obj*>( pObj) != nullptr && !bOle ) { pViewShell->ActivateObject( static_cast< SdrOle2Obj* >( pObj ), 0 ); diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx index 7670949fa3d8..c7fd4c96c8ae 100644 --- a/sc/source/ui/drawfunc/fuins1.cxx +++ b/sc/source/ui/drawfunc/fuins1.cxx @@ -342,7 +342,7 @@ FuInsertMedia::FuInsertMedia( ScTabViewShell* pViewSh, 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 ) { diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx index 02c5ecca76fb..cb472fc4c90f 100644 --- a/sc/source/ui/drawfunc/fuins2.cxx +++ b/sc/source/ui/drawfunc/fuins2.cxx @@ -551,9 +551,9 @@ FuInsertChart::FuInsertChart(ScTabViewShell* pViewSh, vcl::Window* pWin, ScDrawV if( pReqArgs->HasItem( FN_PARAM_4, &pItem ) ) { - if ( pItem->ISA( SfxUInt16Item ) ) + if ( dynamic_cast<const SfxUInt16Item*>( pItem) != nullptr ) nToTable = static_cast<const SfxUInt16Item*>(pItem)->GetValue(); - else if ( pItem->ISA( SfxBoolItem ) ) + else if ( dynamic_cast<const SfxBoolItem*>( pItem) != nullptr ) { // in der idl fuer Basic steht FN_PARAM_4 als SfxBoolItem // -> wenn gesetzt, neue Tabelle, sonst aktuelle Tabelle diff --git a/sc/source/ui/drawfunc/fusel.cxx b/sc/source/ui/drawfunc/fusel.cxx index f3e172db308c..02fb2c9fea2a 100644 --- a/sc/source/ui/drawfunc/fusel.cxx +++ b/sc/source/ui/drawfunc/fusel.cxx @@ -535,7 +535,7 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt) // not in UNO controls // #i32352# not in media objects - else if ( pObj->ISA(SdrTextObj) && !pObj->ISA(SdrUnoObj) && !pObj->ISA(SdrMediaObj) ) + else if ( dynamic_cast<const SdrTextObj*>( pObj) != nullptr && dynamic_cast<const SdrUnoObj*>( pObj) == nullptr && dynamic_cast<const SdrMediaObj*>( pObj) == nullptr ) { OutlinerParaObject* pOPO = pObj->GetOutlinerParaObject(); bool bVertical = ( pOPO && pOPO->IsVertical() ); diff --git a/sc/source/ui/drawfunc/futext.cxx b/sc/source/ui/drawfunc/futext.cxx index f9581a437493..b7996f533f26 100644 --- a/sc/source/ui/drawfunc/futext.cxx +++ b/sc/source/ui/drawfunc/futext.cxx @@ -474,7 +474,7 @@ bool FuText::MouseButtonUp(const MouseEvent& rMEvt) if(rMarkList.GetMark(0)) { SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); - if(pObj && pObj->ISA(SdrTextObj)) + if(pObj && dynamic_cast<const SdrTextObj*>( pObj) != nullptr) { SdrTextObj* pText = static_cast<SdrTextObj*>(pObj); SfxItemSet aSet(pDrDoc->GetItemPool()); @@ -651,7 +651,7 @@ void FuText::SetInEditMode(SdrObject* pObj, const Point* pMousePixel, if (nSdrObjKind == OBJ_TEXT || nSdrObjKind == OBJ_TITLETEXT || nSdrObjKind == OBJ_OUTLINETEXT || - pObj->ISA(SdrTextObj)) + dynamic_cast<const SdrTextObj*>( pObj) != nullptr) { SdrPageView* pPV = pView->GetSdrPageView(); @@ -728,7 +728,7 @@ SdrObject* FuText::CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rR if(pObj) { - if(pObj->ISA(SdrTextObj)) + if(dynamic_cast<const SdrTextObj*>( pObj) != nullptr) { SdrTextObj* pText = static_cast<SdrTextObj*>(pObj); pText->SetLogicRect(rRectangle); diff --git a/sc/source/ui/drawfunc/futext3.cxx b/sc/source/ui/drawfunc/futext3.cxx index 61f8d809eedb..2c4e8ed7ffc4 100644 --- a/sc/source/ui/drawfunc/futext3.cxx +++ b/sc/source/ui/drawfunc/futext3.cxx @@ -88,7 +88,7 @@ void FuText::StopEditMode(bool /*bTextDirection*/) /* Note has been created before editing, if first undo action is an insert action. Needed below to decide whether to drop the undo if editing a new note has been cancelled. */ - bNewNote = (pCalcUndo->GetActionCount() > 0) && pCalcUndo->GetAction( 0 )->ISA( SdrUndoNewObj ); + bNewNote = (pCalcUndo->GetActionCount() > 0) && dynamic_cast< SdrUndoNewObj* >(pCalcUndo->GetAction( 0 )); // create a "insert note" undo action if needed if( bNewNote ) diff --git a/sc/source/ui/drawfunc/graphsh.cxx b/sc/source/ui/drawfunc/graphsh.cxx index 94742a0a177c..b3145732e6e6 100644 --- a/sc/source/ui/drawfunc/graphsh.cxx +++ b/sc/source/ui/drawfunc/graphsh.cxx @@ -94,7 +94,7 @@ void ScGraphicShell::GetFilterState( SfxItemSet& rSet ) { SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); - if( pObj && pObj->ISA( SdrGrafObj ) && ( static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) ) + if( pObj && dynamic_cast<const SdrGrafObj*>( pObj) != nullptr && ( static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) ) bEnable = true; } @@ -111,7 +111,7 @@ void ScGraphicShell::ExecuteFilter( SfxRequest& rReq ) { SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); - if( pObj && pObj->ISA( SdrGrafObj ) && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) + if( pObj && dynamic_cast<const SdrGrafObj*>( pObj) != nullptr && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) { GraphicObject aFilterObj( static_cast<SdrGrafObj*>(pObj)->GetGraphicObject() ); @@ -145,7 +145,7 @@ void ScGraphicShell::GetExternalEditState( SfxItemSet& rSet ) { SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); - if( pObj && pObj->ISA( SdrGrafObj ) && ( static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) ) + if( pObj && dynamic_cast<const SdrGrafObj*>( pObj) != nullptr && ( static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) ) bEnable = true; } @@ -162,7 +162,7 @@ void ScGraphicShell::ExecuteExternalEdit( SfxRequest& ) { SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); - if( pObj && pObj->ISA( SdrGrafObj ) && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) + if( pObj && dynamic_cast<const SdrGrafObj*>( pObj) != nullptr && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) { GraphicObject aGraphicObject( static_cast<SdrGrafObj*>(pObj)->GetGraphicObject() ); m_ExternalEdits.push_back( std::unique_ptr<SdrExternalToolEdit>( @@ -183,7 +183,7 @@ void ScGraphicShell::GetCompressGraphicState( SfxItemSet& rSet ) { SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); - if( pObj && pObj->ISA( SdrGrafObj ) && ( static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) ) + if( pObj && dynamic_cast<const SdrGrafObj*>( pObj) != nullptr && ( static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) ) bEnable = true; } @@ -200,7 +200,7 @@ void ScGraphicShell::ExecuteCompressGraphic( SfxRequest& ) { SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); - if( pObj && pObj->ISA( SdrGrafObj ) && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) + if( pObj && dynamic_cast<const SdrGrafObj*>( pObj) != nullptr && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) { SdrGrafObj* pGraphicObj = static_cast<SdrGrafObj*>(pObj); ScopedVclPtrInstance< CompressGraphicsDialog > dialog( GetViewData()->GetDialogParent(), pGraphicObj, GetViewData()->GetBindings() ); @@ -228,7 +228,7 @@ void ScGraphicShell::GetCropGraphicState( SfxItemSet& rSet ) { SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); - if( pObj && pObj->ISA( SdrGrafObj ) && ( static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) ) + if( pObj && 0 != dynamic_cast<const SdrGrafObj*>( pObj) && ( static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) ) bEnable = true; } @@ -245,7 +245,7 @@ void ScGraphicShell::ExecuteCropGraphic( SfxRequest& ) { SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); - if( pObj && pObj->ISA( SdrGrafObj ) && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) + if( pObj && dynamic_cast<const SdrGrafObj*>( pObj) != nullptr && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) { pView->SetEditMode(SDREDITMODE_EDIT); pView->SetDragMode(SDRDRAG_CROP); @@ -262,7 +262,7 @@ void ScGraphicShell::ExecuteSaveGraphic(SfxRequest& /*rReq*/) if( rMarkList.GetMarkCount() == 1 ) { SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); - if( pObj && pObj->ISA( SdrGrafObj ) && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) + if( pObj && dynamic_cast<const SdrGrafObj*>( pObj) != nullptr && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) { GraphicObject aGraphicObject( static_cast<SdrGrafObj*>( pObj )->GetGraphicObject() ); { @@ -283,7 +283,7 @@ void ScGraphicShell::GetSaveGraphicState(SfxItemSet &rSet) { SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); - if( pObj && pObj->ISA( SdrGrafObj ) && ( static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) ) + if( pObj && dynamic_cast<const SdrGrafObj*>( pObj) != nullptr && ( static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) ) bEnable = true; } @@ -300,7 +300,7 @@ void ScGraphicShell::ExecuteChangePicture(SfxRequest& /*rReq*/) { SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); - if( pObj && pObj->ISA( SdrGrafObj ) && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) + if( pObj && 0 != dynamic_cast<const SdrGrafObj*>( pObj) && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) { SdrGrafObj* pGraphicObj = static_cast<SdrGrafObj*>(pObj); SvxOpenGraphicDialog aDlg(ScResId(STR_INSERTGRAPHIC)); @@ -335,7 +335,7 @@ void ScGraphicShell::GetChangePictureState(SfxItemSet &rSet) { SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); - if( pObj && pObj->ISA( SdrGrafObj ) && ( static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) ) + if( pObj && dynamic_cast<const SdrGrafObj*>( pObj) != nullptr && ( static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) ) bEnable = true; } diff --git a/sc/source/ui/drawfunc/mediash.cxx b/sc/source/ui/drawfunc/mediash.cxx index 17d3dd569e43..a7281ad77115 100644 --- a/sc/source/ui/drawfunc/mediash.cxx +++ b/sc/source/ui/drawfunc/mediash.cxx @@ -78,7 +78,7 @@ void ScMediaShell::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 ); @@ -117,7 +117,7 @@ void ScMediaShell::ExecuteMedia( 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 ) ); diff --git a/sc/source/ui/formdlg/dwfunctr.cxx b/sc/source/ui/formdlg/dwfunctr.cxx index 766575a007b3..9ea7238a0864 100644 --- a/sc/source/ui/formdlg/dwfunctr.cxx +++ b/sc/source/ui/formdlg/dwfunctr.cxx @@ -817,7 +817,7 @@ void ScFunctionDockWin::DoEnter() { ScModule* pScMod = SC_MOD(); - ScTabViewShell* pViewSh = PTR_CAST( ScTabViewShell, pCurSh); + ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>( pCurSh ); ScInputHandler* pHdl = pScMod->GetInputHdl( pViewSh ); if(!pScMod->IsEditMode()) { diff --git a/sc/source/ui/formdlg/formula.cxx b/sc/source/ui/formdlg/formula.cxx index b2ae1297d81e..4e51d2e1969d 100644 --- a/sc/source/ui/formdlg/formula.cxx +++ b/sc/source/ui/formdlg/formula.cxx @@ -84,7 +84,7 @@ ScFormulaDlg::ScFormulaDlg( SfxBindings* pB, SfxChildWindow* pCW, SfxViewFrame* pMyViewFrm = pMyDisp->GetFrame(); if (pMyViewFrm) { - pScViewShell = PTR_CAST( ScTabViewShell, pMyViewFrm->GetViewShell() ); + pScViewShell = dynamic_cast<ScTabViewShell*>( pMyViewFrm->GetViewShell() ); if( pScViewShell ) pScViewShell->UpdateInputHandler(true); } @@ -265,13 +265,12 @@ bool ScFormulaDlg::IsInputHdl(ScInputHandler* pHdl) // belongs InputHandler to a ViewShell? - TypeId aScType = TYPE(ScTabViewShell); - SfxViewShell* pSh = SfxViewShell::GetFirst( &aScType ); + SfxViewShell* pSh = SfxViewShell::GetFirst( true, checkSfxViewShell<ScTabViewShell> ); while ( pSh && !bAlive ) { if (static_cast<ScTabViewShell*>(pSh)->GetInputHandler() == pHdl) bAlive = true; - pSh = SfxViewShell::GetNext( *pSh, &aScType ); + pSh = SfxViewShell::GetNext( *pSh, true, checkSfxViewShell<ScTabViewShell> ); } return bAlive; @@ -286,7 +285,7 @@ ScInputHandler* ScFormulaDlg::GetNextInputHandler(ScDocShell* pDocShell, ScTabVi while( pFrame && pHdl==NULL) { SfxViewShell* p = pFrame->GetViewShell(); - ScTabViewShell* pViewSh = PTR_CAST(ScTabViewShell,p); + ScTabViewShell* pViewSh = dynamic_cast< ScTabViewShell *>( p ); if(pViewSh!=NULL) { pHdl=pViewSh->GetInputHandler(); @@ -560,7 +559,7 @@ void ScFormulaDlg::clear() pScMod->SetRefInputHdl(NULL); // force Enable() of edit line - ScTabViewShell* pScViewShell = PTR_CAST(ScTabViewShell, SfxViewShell::Current()); + ScTabViewShell* pScViewShell = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() ); if ( pScViewShell ) pScViewShell->UpdateInputHandler(); } @@ -577,7 +576,7 @@ void ScFormulaDlg::switchBack() } // restore current chart (cause mouse-RefInput) - ScTabViewShell* pScViewShell = PTR_CAST(ScTabViewShell, SfxViewShell::Current()); + ScTabViewShell* pScViewShell = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() ); if ( pScViewShell ) { ScViewData& rVD=pScViewShell->GetViewData(); diff --git a/sc/source/ui/inc/ChildWindowWrapper.hxx b/sc/source/ui/inc/ChildWindowWrapper.hxx index aec24f93d6cd..bfedab53af8d 100644 --- a/sc/source/ui/inc/ChildWindowWrapper.hxx +++ b/sc/source/ui/inc/ChildWindowWrapper.hxx @@ -28,7 +28,7 @@ public: { ScTabViewShell* pViewShell = getTabViewShell( pBindings ); if (!pViewShell) - pViewShell = PTR_CAST( ScTabViewShell, SfxViewShell::Current() ); + pViewShell = dynamic_cast< ScTabViewShell *>( SfxViewShell::Current() ); OSL_ENSURE(pViewShell, "Missing view shell!"); if (pViewShell) diff --git a/sc/source/ui/inc/prevwsh.hxx b/sc/source/ui/inc/prevwsh.hxx index 796c9594406e..43c8b1bfce97 100644 --- a/sc/source/ui/inc/prevwsh.hxx +++ b/sc/source/ui/inc/prevwsh.hxx @@ -36,7 +36,7 @@ struct ScHeaderFieldData; class ScPreviewLocationData; class CommandEvent; -class ScPreviewShell: public SfxViewShell +class SC_DLLPUBLIC ScPreviewShell: public SfxViewShell { ScDocShell* pDocShell; @@ -75,7 +75,7 @@ protected: virtual void ReadUserDataSequence (const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, bool bBrowse = false ) SAL_OVERRIDE; public: - TYPEINFO_VISIBILITY_OVERRIDE( SC_DLLPUBLIC ); + TYPEINFO_OVERRIDE(); SFX_DECL_INTERFACE(SCID_PREVIEW_SHELL) SFX_DECL_VIEWFACTORY(ScPreviewShell); @@ -116,7 +116,7 @@ public: const ScPreviewLocationData& GetLocationData(); ScDocument& GetDocument(); - SC_DLLPUBLIC ScPreview* GetPreview() { return pPreview; } + ScPreview* GetPreview() { return pPreview; } }; #endif diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx index 9a0bf9f20437..f636120fe131 100644 --- a/sc/source/ui/inc/tabvwsh.hxx +++ b/sc/source/ui/inc/tabvwsh.hxx @@ -89,7 +89,7 @@ enum ObjectSelectionType OST_Media }; -class ScTabViewShell: public SfxViewShell, public ScDBFunc +class SC_DLLPUBLIC ScTabViewShell: public SfxViewShell, public ScDBFunc { private: SvxHtmlOptions aHTMLOpt; @@ -220,7 +220,7 @@ protected: virtual SdrView* GetDrawView() const SAL_OVERRIDE; public: - TYPEINFO_VISIBILITY_OVERRIDE(SC_DLLPUBLIC); + TYPEINFO_OVERRIDE(); SFX_DECL_INTERFACE(SCID_TABVIEW_SHELL) SFX_DECL_VIEWFACTORY(ScTabViewShell); @@ -236,7 +236,7 @@ public: virtual ~ScTabViewShell(); - SC_DLLPUBLIC vcl::Window* GetDialogParent(); + vcl::Window* GetDialogParent(); bool IsRefInputMode() const; void ExecuteInputDirect(); @@ -252,8 +252,8 @@ public: ::editeng::SvxBorderLine* GetDefaultFrameLine() const { return pCurFrameLine; } void SetDefaultFrameLine(const ::editeng::SvxBorderLine* pLine ); - SC_DLLPUBLIC void Execute( SfxRequest& rReq ); - SC_DLLPUBLIC void GetState( SfxItemSet& rSet ); + void Execute( SfxRequest& rReq ); + void GetState( SfxItemSet& rSet ); void ExecuteTable( SfxRequest& rReq ); void GetStateTable( SfxItemSet& rSet ); @@ -340,7 +340,7 @@ public: void DeactivateOle(); - SC_DLLPUBLIC static ScTabViewShell* GetActiveViewShell(); + static ScTabViewShell* GetActiveViewShell(); VclPtr<SfxModelessDialog> CreateRefDialog( SfxBindings* pB, SfxChildWindow* pCW, SfxChildWinInfo* pInfo, vcl::Window* pParent, sal_uInt16 nSlotId ); diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx index 93232fde5e22..385537a20f26 100644 --- a/sc/source/ui/miscdlgs/anyrefdg.cxx +++ b/sc/source/ui/miscdlgs/anyrefdg.cxx @@ -92,8 +92,7 @@ void ScFormulaReferenceHelper::dispose() void ScFormulaReferenceHelper::enableInput( bool bEnable ) { - TypeId aType(TYPE(ScDocShell)); - ScDocShell* pDocShell = static_cast<ScDocShell*>(SfxObjectShell::GetFirst(&aType)); + ScDocShell* pDocShell = static_cast<ScDocShell*>(SfxObjectShell::GetFirst(checkSfxObjectShell<ScDocShell>)); while( pDocShell ) { SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDocShell ); @@ -103,7 +102,7 @@ void ScFormulaReferenceHelper::enableInput( bool bEnable ) if ( !pFrame->GetFrame().IsInPlace() ) { SfxViewShell* p = pFrame->GetViewShell(); - ScTabViewShell* pViewSh = PTR_CAST(ScTabViewShell,p); + ScTabViewShell* pViewSh = dynamic_cast< ScTabViewShell *>( p ); if(pViewSh!=NULL) { vcl::Window *pWin=pViewSh->GetWindow(); @@ -122,7 +121,7 @@ void ScFormulaReferenceHelper::enableInput( bool bEnable ) pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell ); } - pDocShell = static_cast<ScDocShell*>(SfxObjectShell::GetNext(*pDocShell, &aType)); + pDocShell = static_cast<ScDocShell*>(SfxObjectShell::GetNext(*pDocShell, checkSfxObjectShell<ScDocShell>)); } } @@ -655,8 +654,7 @@ void ScFormulaReferenceHelper::SetDispatcherLock( bool bLock ) { // lock / unlock only the dispatchers of Calc documents - TypeId aType(TYPE(ScDocShell)); - ScDocShell* pDocShell = static_cast<ScDocShell*>(SfxObjectShell::GetFirst(&aType)); + ScDocShell* pDocShell = static_cast<ScDocShell*>(SfxObjectShell::GetFirst(checkSfxObjectShell<ScDocShell>)); while( pDocShell ) { SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDocShell ); @@ -668,7 +666,7 @@ void ScFormulaReferenceHelper::SetDispatcherLock( bool bLock ) pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell ); } - pDocShell = static_cast<ScDocShell*>(SfxObjectShell::GetNext(*pDocShell, &aType)); + pDocShell = static_cast<ScDocShell*>(SfxObjectShell::GetNext(*pDocShell, checkSfxObjectShell<ScDocShell>)); } // if a new view is created while the dialog is open, @@ -684,8 +682,7 @@ void ScFormulaReferenceHelper::ViewShellChanged() } void ScFormulaReferenceHelper::EnableSpreadsheets(bool bFlag, bool bChildren) { - TypeId aType(TYPE(ScDocShell)); - ScDocShell* pDocShell = static_cast<ScDocShell*>(SfxObjectShell::GetFirst(&aType)); + ScDocShell* pDocShell = static_cast<ScDocShell*>(SfxObjectShell::GetFirst(checkSfxObjectShell<ScDocShell>)); while( pDocShell ) { SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDocShell ); @@ -695,7 +692,7 @@ void ScFormulaReferenceHelper::EnableSpreadsheets(bool bFlag, bool bChildren) if ( !pFrame->GetFrame().IsInPlace() ) { SfxViewShell* p = pFrame->GetViewShell(); - ScTabViewShell* pViewSh = PTR_CAST(ScTabViewShell,p); + ScTabViewShell* pViewSh = dynamic_cast< ScTabViewShell *>( p ); if(pViewSh!=NULL) { vcl::Window *pWin=pViewSh->GetWindow(); @@ -714,14 +711,13 @@ void ScFormulaReferenceHelper::EnableSpreadsheets(bool bFlag, bool bChildren) pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell ); } - pDocShell = static_cast<ScDocShell*>(SfxObjectShell::GetNext(*pDocShell, &aType)); + pDocShell = static_cast<ScDocShell*>(SfxObjectShell::GetNext(*pDocShell, checkSfxObjectShell<ScDocShell>)); } } static void lcl_InvalidateWindows() { - TypeId aType(TYPE(ScDocShell)); - ScDocShell* pDocShell = static_cast<ScDocShell*>(SfxObjectShell::GetFirst(&aType)); + ScDocShell* pDocShell = static_cast<ScDocShell*>(SfxObjectShell::GetFirst(checkSfxObjectShell<ScDocShell>)); while( pDocShell ) { SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDocShell ); @@ -731,7 +727,7 @@ static void lcl_InvalidateWindows() if ( !pFrame->GetFrame().IsInPlace() ) { SfxViewShell* p = pFrame->GetViewShell(); - ScTabViewShell* pViewSh = PTR_CAST(ScTabViewShell,p); + ScTabViewShell* pViewSh = dynamic_cast< ScTabViewShell *>( p ); if(pViewSh!=NULL) { vcl::Window *pWin=pViewSh->GetWindow(); @@ -746,18 +742,17 @@ static void lcl_InvalidateWindows() pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell ); } - pDocShell = static_cast<ScDocShell*>(SfxObjectShell::GetNext(*pDocShell, &aType)); + pDocShell = static_cast<ScDocShell*>(SfxObjectShell::GetNext(*pDocShell, checkSfxObjectShell<ScDocShell>)); } } static void lcl_HideAllReferences() { - TypeId aScType = TYPE(ScTabViewShell); - SfxViewShell* pSh = SfxViewShell::GetFirst( &aScType ); + SfxViewShell* pSh = SfxViewShell::GetFirst( true, checkSfxViewShell<ScTabViewShell> ); while ( pSh ) { static_cast<ScTabViewShell*>(pSh)->ClearHighlightRanges(); - pSh = SfxViewShell::GetNext( *pSh, &aScType ); + pSh = SfxViewShell::GetNext( *pSh, true, checkSfxViewShell<ScTabViewShell> ); } } @@ -799,7 +794,7 @@ bool ScRefHandler::EnterRefMode() SfxViewFrame* pMyViewFrm = pMyDisp->GetFrame(); if (pMyViewFrm) { - pScViewShell = PTR_CAST( ScTabViewShell, pMyViewFrm->GetViewShell() ); + pScViewShell = dynamic_cast<ScTabViewShell*>( pMyViewFrm->GetViewShell() ); if( pScViewShell ) pScViewShell->UpdateInputHandler(true); pParentDoc = pMyViewFrm->GetObjectShell(); @@ -875,8 +870,7 @@ void ScRefHandler::SwitchToDocument() } } - TypeId aScType = TYPE(ScTabViewShell); - SfxViewShell* pSh = SfxViewShell::GetFirst( &aScType ); + SfxViewShell* pSh = SfxViewShell::GetFirst( true, checkSfxViewShell<ScTabViewShell> ); while ( pSh ) { SfxObjectShell* pObjSh = pSh->GetObjectShell(); @@ -886,7 +880,7 @@ void ScRefHandler::SwitchToDocument() static_cast<ScTabViewShell*>(pSh)->SetActive(); return; } - pSh = SfxViewShell::GetNext( *pSh, &aScType ); + pSh = SfxViewShell::GetNext( *pSh, true, checkSfxViewShell<ScTabViewShell> ); } } diff --git a/sc/source/ui/miscdlgs/mvtabdlg.cxx b/sc/source/ui/miscdlgs/mvtabdlg.cxx index a6f2f24620fe..e1f9226ae5d9 100644 --- a/sc/source/ui/miscdlgs/mvtabdlg.cxx +++ b/sc/source/ui/miscdlgs/mvtabdlg.cxx @@ -227,7 +227,7 @@ void ScMoveTableDlg::InitDocListBox() while ( pSh ) { - pScSh = PTR_CAST( ScDocShell, pSh ); + pScSh = dynamic_cast<ScDocShell*>( pSh ); if ( pScSh ) { diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx index b6c79df9dafb..9b03f5b0eff3 100644 --- a/sc/source/ui/navipi/content.cxx +++ b/sc/source/ui/navipi/content.cxx @@ -85,13 +85,12 @@ ScDocShell* ScContentTree::GetManualOrCurrent() ScDocShell* pSh = NULL; if ( !aManualDoc.isEmpty() ) { - TypeId aScType = TYPE(ScDocShell); - SfxObjectShell* pObjSh = SfxObjectShell::GetFirst( &aScType ); + SfxObjectShell* pObjSh = SfxObjectShell::GetFirst( checkSfxObjectShell<ScDocShell> ); while ( pObjSh && !pSh ) { if ( pObjSh->GetTitle() == aManualDoc ) - pSh = PTR_CAST( ScDocShell, pObjSh ); - pObjSh = SfxObjectShell::GetNext( *pObjSh, &aScType ); + pSh = dynamic_cast<ScDocShell*>( pObjSh ); + pObjSh = SfxObjectShell::GetNext( *pObjSh, checkSfxObjectShell<ScDocShell> ); } } else @@ -103,7 +102,7 @@ ScDocShell* ScContentTree::GetManualOrCurrent() if ( pViewSh ) { SfxObjectShell* pObjSh = pViewSh->GetViewFrame()->GetObjectShell(); - pSh = PTR_CAST( ScDocShell, pObjSh ); + pSh = dynamic_cast<ScDocShell*>( pObjSh ); } } @@ -593,11 +592,11 @@ void ScContentTree::Command( const CommandEvent& rCEvt ) sal_uInt16 i=0; sal_uInt16 nPos=0; // geladene Dokumente - ScDocShell* pCurrentSh = PTR_CAST( ScDocShell, SfxObjectShell::Current() ); + ScDocShell* pCurrentSh = dynamic_cast<ScDocShell*>( SfxObjectShell::Current() ); SfxObjectShell* pSh = SfxObjectShell::GetFirst(); while ( pSh ) { - if ( pSh->ISA(ScDocShell) ) + if ( dynamic_cast<const ScDocShell*>( pSh) != nullptr ) { OUString aName = pSh->GetTitle(); OUString aEntry = aName; @@ -1028,7 +1027,7 @@ void ScContentTree::GetLinkNames() for (sal_uInt16 i=0; i<nCount; i++) { ::sfx2::SvBaseLink* pBase = *rLinks[i]; - if (pBase->ISA(ScAreaLink)) + if (dynamic_cast<const ScAreaLink*>( pBase) != nullptr) InsertContent( ScContentId::AREALINK, static_cast<ScAreaLink*>(pBase)->GetSource() ); // in der Liste die Namen der Quellbereiche @@ -1049,7 +1048,7 @@ const ScAreaLink* ScContentTree::GetLink( sal_uLong nIndex ) for (sal_uInt16 i=0; i<nCount; i++) { ::sfx2::SvBaseLink* pBase = *rLinks[i]; - if (pBase->ISA(ScAreaLink)) + if (dynamic_cast<const ScAreaLink*>( pBase) != nullptr) { if (nFound == nIndex) return static_cast<const ScAreaLink*>(pBase); @@ -1592,7 +1591,7 @@ void ScContentTree::SelectDoc(const OUString& rName) // rName wie im Menue/ SfxObjectShell* pSh = SfxObjectShell::GetFirst(); while ( pSh && !bLoaded ) { - if ( pSh->ISA(ScDocShell) ) + if ( dynamic_cast<const ScDocShell*>( pSh) != nullptr ) if ( pSh->GetTitle() == aRealName ) bLoaded = true; pSh = SfxObjectShell::GetNext( *pSh ); diff --git a/sc/source/ui/navipi/navcitem.cxx b/sc/source/ui/navipi/navcitem.cxx index ef981c99aaea..bfbf7fe90759 100644 --- a/sc/source/ui/navipi/navcitem.cxx +++ b/sc/source/ui/navipi/navcitem.cxx @@ -43,7 +43,7 @@ void ScNavigatorControllerItem::StateChanged( sal_uInt16 /* nSID */, SfxItemStat case SID_CURRENTCELL: if ( pItem ) { - const SfxStringItem* pCellPosItem = PTR_CAST(SfxStringItem, pItem); + const SfxStringItem* pCellPosItem = dynamic_cast<const SfxStringItem*>( pItem ); OSL_ENSURE( pCellPosItem, "SfxStringItem expected!" ); @@ -65,7 +65,7 @@ void ScNavigatorControllerItem::StateChanged( sal_uInt16 /* nSID */, SfxItemStat case SID_CURRENTTAB: if ( pItem ) { - const SfxUInt16Item* pTabItem = PTR_CAST(SfxUInt16Item, pItem); + const SfxUInt16Item* pTabItem = dynamic_cast< const SfxUInt16Item *>( pItem ); OSL_ENSURE( pTabItem, "SfxUInt16Item expected!" ); diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx index 382488ba777b..0b564f1c93bd 100644 --- a/sc/source/ui/navipi/navipi.cxx +++ b/sc/source/ui/navipi/navipi.cxx @@ -990,7 +990,7 @@ void ScNavigatorDlg::SetCurrentDoc( const OUString& rDocName ) // activat ScTabViewShell* ScNavigatorDlg::GetTabViewShell() { - return PTR_CAST( ScTabViewShell, SfxViewShell::Current() ); + return dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() ); } ScNavigatorSettings* ScNavigatorDlg::GetNavigatorSettings() @@ -1204,13 +1204,13 @@ void ScNavigatorDlg::GetDocNames( const OUString* pManualSel ) aLbDocuments->Clear(); aLbDocuments->SetUpdateMode( false ); - ScDocShell* pCurrentSh = PTR_CAST( ScDocShell, SfxObjectShell::Current() ); + ScDocShell* pCurrentSh = dynamic_cast<ScDocShell*>( SfxObjectShell::Current() ); OUString aSelEntry; SfxObjectShell* pSh = SfxObjectShell::GetFirst(); while ( pSh ) { - if ( pSh->ISA(ScDocShell) ) + if ( dynamic_cast<const ScDocShell*>( pSh) != nullptr ) { OUString aName = pSh->GetTitle(); OUString aEntry = aName; diff --git a/sc/source/ui/navipi/scenwnd.cxx b/sc/source/ui/navipi/scenwnd.cxx index a8e53ab997a5..322a154c9965 100644 --- a/sc/source/ui/navipi/scenwnd.cxx +++ b/sc/source/ui/navipi/scenwnd.cxx @@ -252,7 +252,7 @@ void ScScenarioWindow::NotifyState( const SfxPoolItem* pState ) { aLbScenario->Enable(); - if ( pState->ISA(SfxStringItem) ) + if ( dynamic_cast<const SfxStringItem*>( pState) != nullptr ) { OUString aNewEntry( static_cast<const SfxStringItem*>(pState)->GetValue() ); @@ -261,7 +261,7 @@ void ScScenarioWindow::NotifyState( const SfxPoolItem* pState ) else aLbScenario->SetNoSelection(); } - else if ( pState->ISA(SfxStringListItem) ) + else if ( dynamic_cast<const SfxStringListItem*>( pState) != nullptr ) { aLbScenario->UpdateEntries( static_cast<const SfxStringListItem*>(pState)->GetList() ); } diff --git a/sc/source/ui/optdlg/opredlin.cxx b/sc/source/ui/optdlg/opredlin.cxx index e2bea02f386c..5322adf821b5 100644 --- a/sc/source/ui/optdlg/opredlin.cxx +++ b/sc/source/ui/optdlg/opredlin.cxx @@ -124,7 +124,7 @@ bool ScRedlineOptionsTabPage::FillItemSet( SfxItemSet* /* rSet */ ) // Repaint (wenn alles ueber Items laufen wuerde, wie es sich gehoert, // waere das nicht noetig...) - ScDocShell* pDocSh = PTR_CAST(ScDocShell, SfxObjectShell::Current()); + ScDocShell* pDocSh = dynamic_cast<ScDocShell*>( SfxObjectShell::Current() ); if (pDocSh) pDocSh->PostPaintGridAll(); diff --git a/sc/source/ui/optdlg/tpusrlst.cxx b/sc/source/ui/optdlg/tpusrlst.cxx index 3b8de0f93041..2c96167fb022 100644 --- a/sc/source/ui/optdlg/tpusrlst.cxx +++ b/sc/source/ui/optdlg/tpusrlst.cxx @@ -109,7 +109,7 @@ void ScTpUserLists::dispose() void ScTpUserLists::Init() { SfxViewShell* pSh = SfxViewShell::Current(); - ScTabViewShell* pViewSh = PTR_CAST(ScTabViewShell, pSh); + ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>( pSh ); mpLbLists->SetSelectHdl ( LINK( this, ScTpUserLists, LbSelectHdl ) ); mpBtnNew->SetClickHdl ( LINK( this, ScTpUserLists, BtnClickHdl ) ); diff --git a/sc/source/ui/optdlg/tpview.cxx b/sc/source/ui/optdlg/tpview.cxx index 4511ce716664..c2db50993c06 100644 --- a/sc/source/ui/optdlg/tpview.cxx +++ b/sc/source/ui/optdlg/tpview.cxx @@ -308,7 +308,7 @@ void ScTpContentOptions::InitGridOpt() { SfxObjectShell* pDocSh = SfxObjectShell::Current(); // there might be another DocShell here - pDocSh = PTR_CAST(ScDocShell, pDocSh); + pDocSh = dynamic_cast<ScDocShell*>( pDocSh ); XColorListRef pColorList; if ( pDocSh ) @@ -459,7 +459,7 @@ VclPtr<SfxTabPage> ScTpLayoutOptions::Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ) { VclPtrInstance<ScTpLayoutOptions> pNew( pParent, *rCoreSet ); - ScDocShell* pDocSh = PTR_CAST(ScDocShell,SfxObjectShell::Current()); + ScDocShell* pDocSh = dynamic_cast< ScDocShell *>( SfxObjectShell::Current() ); if(pDocSh!=NULL) pNew->SetDocument(&pDocSh->GetDocument()); diff --git a/sc/source/ui/pagedlg/areasdlg.cxx b/sc/source/ui/pagedlg/areasdlg.cxx index 9db2934591f8..334a8d4b9882 100644 --- a/sc/source/ui/pagedlg/areasdlg.cxx +++ b/sc/source/ui/pagedlg/areasdlg.cxx @@ -119,8 +119,8 @@ ScPrintAreasDlg::ScPrintAreasDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Win get(pBtnOk,"ok"); get(pBtnCancel,"cancel"); - ScTabViewShell* pScViewSh = PTR_CAST( ScTabViewShell, SfxViewShell::Current() ); - ScDocShell* pScDocSh = PTR_CAST( ScDocShell, SfxObjectShell::Current() ); + ScTabViewShell* pScViewSh = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() ); + ScDocShell* pScDocSh = dynamic_cast<ScDocShell*>( SfxObjectShell::Current() ); OSL_ENSURE( pScDocSh, "Current DocumentShell not found :-(" ); diff --git a/sc/source/ui/pagedlg/scuitphfedit.cxx b/sc/source/ui/pagedlg/scuitphfedit.cxx index 2f1cb0daafe6..2fb3a486d794 100644 --- a/sc/source/ui/pagedlg/scuitphfedit.cxx +++ b/sc/source/ui/pagedlg/scuitphfedit.cxx @@ -391,7 +391,7 @@ void ScHFEditPage::SetSelectDefinedList() if(pFieldItem) { const SvxFieldData* pField = pFieldItem->GetField(); - if(pField && pField->ISA(SvxTableField)) + if(pField && dynamic_cast<const SvxTableField*>( pField) != nullptr) { eSelectEntry = eSheetEntry; bFound = true; @@ -530,7 +530,7 @@ bool ScHFEditPage::IsPageEntry(EditEngine*pEngine, EditTextObject* pTextObj) if(pFieldItem) { const SvxFieldData* pField = pFieldItem->GetField(); - if(pField && pField->ISA(SvxPageField)) + if(pField && dynamic_cast<const SvxPageField*>( pField) != nullptr) bReturn = true; } } @@ -552,7 +552,7 @@ bool ScHFEditPage::IsDateEntry(EditTextObject* pTextObj) if(pFieldItem) { const SvxFieldData* pField = pFieldItem->GetField(); - if(pField && pField->ISA(SvxDateField)) + if(pField && dynamic_cast<const SvxDateField*>( pField) != nullptr) bReturn = true; } } @@ -570,7 +570,7 @@ bool ScHFEditPage::IsExtFileNameEntry(EditTextObject* pTextObj) if(pFieldItem) { const SvxFieldData* pField = pFieldItem->GetField(); - if(pField && pField->ISA(SvxExtFileField)) + if(pField && dynamic_cast<const SvxExtFileField*>( pField) != nullptr) bReturn = true; } } diff --git a/sc/source/ui/pagedlg/tphf.cxx b/sc/source/ui/pagedlg/tphf.cxx index b8bb332aeee4..716e5238debd 100644 --- a/sc/source/ui/pagedlg/tphf.cxx +++ b/sc/source/ui/pagedlg/tphf.cxx @@ -54,7 +54,7 @@ ScHFPage::ScHFPage( vcl::Window* pParent, const SfxItemSet& rSet, sal_uInt16 nSe SetExchangeSupport(); SfxViewShell* pSh = SfxViewShell::Current(); - ScTabViewShell* pViewSh = PTR_CAST(ScTabViewShell,pSh); + ScTabViewShell* pViewSh = dynamic_cast< ScTabViewShell *>( pSh ); m_pBtnEdit->Show(); aDataSet.Put( rSet ); diff --git a/sc/source/ui/pagedlg/tphfedit.cxx b/sc/source/ui/pagedlg/tphfedit.cxx index a152453b8fbc..b1c833cb028a 100644 --- a/sc/source/ui/pagedlg/tphfedit.cxx +++ b/sc/source/ui/pagedlg/tphfedit.cxx @@ -60,9 +60,9 @@ static void lcl_GetFieldData( ScHeaderFieldData& rData ) SfxViewShell* pShell = SfxViewShell::Current(); if (pShell) { - if (pShell->ISA(ScTabViewShell)) + if (dynamic_cast<const ScTabViewShell*>( pShell) != nullptr) static_cast<ScTabViewShell*>(pShell)->FillFieldData(rData); - else if (pShell->ISA(ScPreviewShell)) + else if (dynamic_cast<const ScPreviewShell*>( pShell) != nullptr) static_cast<ScPreviewShell*>(pShell)->FillFieldData(rData); } } @@ -191,7 +191,7 @@ void ScEditWindow::SetCharAttributes() SfxViewShell* pViewSh = SfxViewShell::Current(); - ScTabViewShell* pTabViewSh = PTR_CAST(ScTabViewShell, SfxViewShell::Current()); + ScTabViewShell* pTabViewSh = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() ); OSL_ENSURE( pDocSh, "Current DocShell not found" ); OSL_ENSURE( pViewSh, "Current ViewShell not found" ); diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx index 9ef96251d0e9..bbe7da3eb5cd 100644 --- a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx +++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx @@ -276,7 +276,7 @@ void AlignmentPropertyPanel::NotifyItemUpdate( case SID_H_ALIGNCELL: { SvxCellHorJustify meHorAlignState = SVX_HOR_JUSTIFY_STANDARD; - if(eState >= SfxItemState::DEFAULT && pState && pState->ISA(SvxHorJustifyItem) ) + if(eState >= SfxItemState::DEFAULT && pState && dynamic_cast<const SvxHorJustifyItem*>( pState) != nullptr ) { const SvxHorJustifyItem* pItem = static_cast<const SvxHorJustifyItem*>(pState); meHorAlignState = (SvxCellHorJustify)pItem->GetValue(); @@ -298,7 +298,7 @@ void AlignmentPropertyPanel::NotifyItemUpdate( } break; case SID_ATTR_ALIGN_INDENT: - if(eState >= SfxItemState::DEFAULT && pState && pState->ISA(SfxUInt16Item) ) + if(eState >= SfxItemState::DEFAULT && pState && dynamic_cast<const SfxUInt16Item*>( pState) != nullptr ) { const SfxUInt16Item* pItem = static_cast<const SfxUInt16Item*>(pState); sal_uInt16 nVal = pItem->GetValue(); @@ -311,7 +311,7 @@ void AlignmentPropertyPanel::NotifyItemUpdate( } break; case FID_MERGE_TOGGLE: - if(eState >= SfxItemState::DEFAULT && pState && pState->ISA(SfxBoolItem) ) + if(eState >= SfxItemState::DEFAULT && pState && dynamic_cast<const SfxBoolItem*>( pState) != nullptr ) { mpCBXMergeCell->Enable(); const SfxBoolItem* pItem = static_cast<const SfxBoolItem*>(pState); @@ -334,7 +334,7 @@ void AlignmentPropertyPanel::NotifyItemUpdate( else { mpCBXWrapText->Enable(); - if(eState >= SfxItemState::DEFAULT && pState && pState->ISA(SfxBoolItem) ) + if(eState >= SfxItemState::DEFAULT && pState && dynamic_cast<const SfxBoolItem*>( pState) != nullptr ) { mpCBXWrapText->EnableTriState(false); const SfxBoolItem* pItem = static_cast<const SfxBoolItem*>(pState); diff --git a/sc/source/ui/undo/areasave.cxx b/sc/source/ui/undo/areasave.cxx index 1fba078c212b..8c2bd5d9b0d1 100644 --- a/sc/source/ui/undo/areasave.cxx +++ b/sc/source/ui/undo/areasave.cxx @@ -107,7 +107,7 @@ bool ScAreaLinkSaveCollection::IsEqual( const ScDocument* pDoc ) const for (sal_uInt16 i=0; i<nLinkCount; i++) { ::sfx2::SvBaseLink* pBase = *rLinks[i]; - if (pBase->ISA(ScAreaLink)) + if (dynamic_cast<const ScAreaLink*>( pBase) != nullptr) { if ( nPos >= size() || !(*this)[nPos].IsEqual( *static_cast<ScAreaLink*>(pBase) ) ) return false; @@ -128,7 +128,7 @@ static ScAreaLink* lcl_FindLink( const ::sfx2::SvBaseLinks& rLinks, const ScArea for (sal_uInt16 i=0; i<nLinkCount; i++) { ::sfx2::SvBaseLink* pBase = *rLinks[i]; - if ( pBase->ISA(ScAreaLink) && + if ( dynamic_cast<const ScAreaLink*>( pBase) != nullptr && rSaver.IsEqualSource( *static_cast<ScAreaLink*>(pBase) ) ) { return static_cast<ScAreaLink*>(pBase); // found @@ -173,7 +173,7 @@ ScAreaLinkSaveCollection* ScAreaLinkSaveCollection::CreateFromDoc( const ScDocum for (sal_uInt16 i=0; i<nLinkCount; i++) { ::sfx2::SvBaseLink* pBase = *rLinks[i]; - if (pBase->ISA(ScAreaLink)) + if (dynamic_cast<const ScAreaLink*>( pBase) != nullptr) { if (!pColl) pColl = new ScAreaLinkSaveCollection; diff --git a/sc/source/ui/undo/undobase.cxx b/sc/source/ui/undo/undobase.cxx index cecea867609f..522f64b2beb5 100644 --- a/sc/source/ui/undo/undobase.cxx +++ b/sc/source/ui/undo/undobase.cxx @@ -75,7 +75,7 @@ bool ScSimpleUndo::Merge( SfxUndoAction *pNextAction ) // AddUndoAction is only called with bTryMerg=sal_True // for automatic update. - if ( !pDetectiveUndo && pNextAction->ISA(ScUndoDraw) ) + if ( !pDetectiveUndo && dynamic_cast<const ScUndoDraw*>( pNextAction) != nullptr ) { // Take SdrUndoAction from ScUndoDraw Action, // ScUndoDraw is later deleted by the UndoManager diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx index 3c88e4798d16..023f52971bd4 100644 --- a/sc/source/ui/undo/undoblk.cxx +++ b/sc/source/ui/undo/undoblk.cxx @@ -130,11 +130,11 @@ bool ScUndoInsertCells::Merge( SfxUndoAction* pNextAction ) if ( pPasteUndo ) return pPasteUndo->Merge( pNextAction ); - if ( bPartOfPaste && pNextAction->ISA( ScUndoWrapper ) ) + if ( bPartOfPaste && dynamic_cast<const ScUndoWrapper*>( pNextAction) != nullptr ) { ScUndoWrapper* pWrapper = static_cast<ScUndoWrapper*>(pNextAction); SfxUndoAction* pWrappedAction = pWrapper->GetWrappedUndo(); - if ( pWrappedAction && pWrappedAction->ISA( ScUndoPaste ) ) + if ( pWrappedAction && dynamic_cast<const ScUndoPaste*>( pWrappedAction) != nullptr ) { // Store paste action if this is part of paste with inserting cells. // A list action isn't used because Repeat wouldn't work (insert wrong cells). @@ -311,7 +311,7 @@ void ScUndoInsertCells::Redo() void ScUndoInsertCells::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) { if ( pPasteUndo ) { @@ -327,7 +327,7 @@ void ScUndoInsertCells::Repeat(SfxRepeatTarget& rTarget) bool ScUndoInsertCells::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } ScUndoDeleteCells::ScUndoDeleteCells( ScDocShell* pNewDocShell, @@ -555,13 +555,13 @@ void ScUndoDeleteCells::Redo() void ScUndoDeleteCells::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->DeleteCells( eCmd ); } bool ScUndoDeleteCells::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } // delete cells in multiselection @@ -734,13 +734,13 @@ void ScUndoDeleteMulti::Redo() void ScUndoDeleteMulti::Repeat(SfxRepeatTarget& rTarget) { // if single selection - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->DeleteCells( DEL_DELROWS ); } bool ScUndoDeleteMulti::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } ScUndoCut::ScUndoCut( ScDocShell* pNewDocShell, @@ -835,13 +835,13 @@ void ScUndoCut::Redo() void ScUndoCut::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->CutToClip( NULL, true ); } bool ScUndoCut::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } ScUndoPaste::ScUndoPaste( ScDocShell* pNewDocShell, const ScRangeList& rRanges, @@ -1095,7 +1095,7 @@ void ScUndoPaste::Redo() void ScUndoPaste::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) { ScTabViewShell* pViewSh = static_cast<ScTabViewTarget&>(rTarget).GetViewShell(); ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pViewSh->GetActiveWin() ); @@ -1113,7 +1113,7 @@ void ScUndoPaste::Repeat(SfxRepeatTarget& rTarget) bool ScUndoPaste::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } ScUndoDragDrop::ScUndoDragDrop( ScDocShell* pNewDocShell, @@ -1498,13 +1498,13 @@ void ScUndoListNames::Redo() void ScUndoListNames::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->InsertNameList(); } bool ScUndoListNames::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } ScUndoConditionalFormat::ScUndoConditionalFormat(ScDocShell* pNewDocShell, @@ -1660,7 +1660,7 @@ void ScUndoUseScenario::Redo() void ScUndoUseScenario::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) { OUString aTemp = aName; static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->UseScenario(aTemp); @@ -1669,7 +1669,7 @@ void ScUndoUseScenario::Repeat(SfxRepeatTarget& rTarget) bool ScUndoUseScenario::CanRepeat(SfxRepeatTarget& rTarget) const { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) { ScViewData& rViewData = static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->GetViewData(); return !rViewData.GetDocument()->IsScenario( rViewData.GetTabNo() ); @@ -1760,7 +1760,7 @@ void ScUndoSelectionStyle::Redo() void ScUndoSelectionStyle::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) { ScDocument& rDoc = pDocShell->GetDocument(); ScStyleSheetPool* pStlPool = rDoc.GetStyleSheetPool(); @@ -1779,7 +1779,7 @@ void ScUndoSelectionStyle::Repeat(SfxRepeatTarget& rTarget) bool ScUndoSelectionStyle::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } sal_uInt16 ScUndoSelectionStyle::GetId() const @@ -1859,7 +1859,7 @@ void ScUndoEnterMatrix::Redo() void ScUndoEnterMatrix::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) { OUString aTemp = aFormula; ScDocument& rDoc = pDocShell->GetDocument(); @@ -1869,7 +1869,7 @@ void ScUndoEnterMatrix::Repeat(SfxRepeatTarget& rTarget) bool ScUndoEnterMatrix::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } static ScRange lcl_GetMultiMarkRange( const ScMarkData& rMark ) @@ -1929,13 +1929,13 @@ void ScUndoIndent::Redo() void ScUndoIndent::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->ChangeIndent( bIsIncrement ); } bool ScUndoIndent::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } ScUndoTransliterate::ScUndoTransliterate( ScDocShell* pNewDocShell, const ScMarkData& rMark, @@ -1985,13 +1985,13 @@ void ScUndoTransliterate::Redo() void ScUndoTransliterate::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->TransliterateText( nTransliterationType ); } bool ScUndoTransliterate::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } ScUndoClearItems::ScUndoClearItems( ScDocShell* pNewDocShell, const ScMarkData& rMark, @@ -2046,7 +2046,7 @@ void ScUndoClearItems::Redo() void ScUndoClearItems::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) { ScViewData& rViewData = static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->GetViewData(); rViewData.GetDocFunc().ClearItems( rViewData.GetMarkData(), pWhich, false ); @@ -2055,7 +2055,7 @@ void ScUndoClearItems::Repeat(SfxRepeatTarget& rTarget) bool ScUndoClearItems::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } // remove all line breaks of a table @@ -2110,7 +2110,7 @@ void ScUndoRemoveBreaks::Redo() void ScUndoRemoveBreaks::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) { ScTabViewShell& rViewShell = *static_cast<ScTabViewTarget&>(rTarget).GetViewShell(); rViewShell.RemoveManualBreaks(); @@ -2119,7 +2119,7 @@ void ScUndoRemoveBreaks::Repeat(SfxRepeatTarget& rTarget) bool ScUndoRemoveBreaks::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } ScUndoRemoveMerge::ScUndoRemoveMerge( ScDocShell* pNewDocShell, @@ -2221,13 +2221,13 @@ void ScUndoRemoveMerge::Redo() void ScUndoRemoveMerge::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->RemoveMerge(); } bool ScUndoRemoveMerge::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } void ScUndoRemoveMerge::SetCurTab() diff --git a/sc/source/ui/undo/undoblk2.cxx b/sc/source/ui/undo/undoblk2.cxx index dfd6242346a9..bf35142c4f6f 100644 --- a/sc/source/ui/undo/undoblk2.cxx +++ b/sc/source/ui/undo/undoblk2.cxx @@ -163,13 +163,13 @@ void ScUndoWidthOrHeight::Redo() void ScUndoWidthOrHeight::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->SetMarkedWidthOrHeight( bWidth, eMode, nNewSize, true ); } bool ScUndoWidthOrHeight::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx index 95b0077b7544..5ebdd63da6bd 100644 --- a/sc/source/ui/undo/undoblk3.cxx +++ b/sc/source/ui/undo/undoblk3.cxx @@ -214,13 +214,13 @@ void ScUndoDeleteContents::Redo() void ScUndoDeleteContents::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->DeleteContents( nFlags ); } bool ScUndoDeleteContents::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } ScUndoFillTable::ScUndoFillTable( ScDocShell* pNewDocShell, @@ -347,13 +347,13 @@ void ScUndoFillTable::Redo() void ScUndoFillTable::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->FillTab( nFlags, nFunction, bSkipEmpty, bAsLink ); } bool ScUndoFillTable::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } ScUndoSelectionAttr::ScUndoSelectionAttr( ScDocShell* pNewDocShell, @@ -481,7 +481,7 @@ void ScUndoSelectionAttr::Redo() void ScUndoSelectionAttr::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) { ScTabViewShell& rViewShell = *static_cast<ScTabViewTarget&>(rTarget).GetViewShell(); if (pLineOuter) @@ -493,7 +493,7 @@ void ScUndoSelectionAttr::Repeat(SfxRepeatTarget& rTarget) bool ScUndoSelectionAttr::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } ScUndoAutoFill::ScUndoAutoFill( ScDocShell* pNewDocShell, @@ -628,7 +628,7 @@ void ScUndoAutoFill::Redo() void ScUndoAutoFill::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) { ScTabViewShell& rViewShell = *static_cast<ScTabViewTarget&>(rTarget).GetViewShell(); if (eFillCmd==FILL_SIMPLE) @@ -641,7 +641,7 @@ void ScUndoAutoFill::Repeat(SfxRepeatTarget& rTarget) bool ScUndoAutoFill::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } ScUndoMerge::ScUndoMerge( ScDocShell* pNewDocShell, const ScCellMergeOption& rOption, @@ -756,7 +756,7 @@ void ScUndoMerge::Redo() void ScUndoMerge::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) { ScTabViewShell& rViewShell = *static_cast<ScTabViewTarget&>(rTarget).GetViewShell(); bool bCont = false; @@ -766,7 +766,7 @@ void ScUndoMerge::Repeat(SfxRepeatTarget& rTarget) bool ScUndoMerge::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } ScUndoAutoFormat::ScUndoAutoFormat( ScDocShell* pNewDocShell, @@ -909,13 +909,13 @@ void ScUndoAutoFormat::Redo() void ScUndoAutoFormat::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->AutoFormat( nFormatNo ); } bool ScUndoAutoFormat::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } ScUndoReplace::ScUndoReplace( ScDocShell* pNewDocShell, const ScMarkData& rMark, @@ -1088,13 +1088,13 @@ void ScUndoReplace::Redo() void ScUndoReplace::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->SearchAndReplace( pSearchItem, true, false ); } bool ScUndoReplace::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } // multi-operation (only simple blocks) @@ -1270,13 +1270,13 @@ void ScUndoConversion::Redo() void ScUndoConversion::Repeat( SfxRepeatTarget& rTarget ) { - if( rTarget.ISA( ScTabViewTarget ) ) + if( dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr ) static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->DoSheetConversion( maConvParam ); } bool ScUndoConversion::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA( ScTabViewTarget ); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } ScUndoRefConversion::ScUndoRefConversion( ScDocShell* pNewDocShell, @@ -1356,13 +1356,13 @@ void ScUndoRefConversion::Redo() void ScUndoRefConversion::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->DoRefConversion(); } bool ScUndoRefConversion::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } ScUndoRefreshLink::ScUndoRefreshLink( ScDocShell* pNewDocShell, @@ -1482,7 +1482,7 @@ static ScAreaLink* lcl_FindAreaLink( sfx2::LinkManager* pLinkManager, const OUSt for (sal_uInt16 i=0; i<nCount; i++) { ::sfx2::SvBaseLink* pBase = *rLinks[i]; - if (pBase->ISA(ScAreaLink)) + if (dynamic_cast<const ScAreaLink*>( pBase) != nullptr) if ( static_cast<ScAreaLink*>(pBase)->IsEqual( rDoc, rFlt, rOpt, rSrc, rDest ) ) return static_cast<ScAreaLink*>(pBase); } diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx index e90875be756c..d95a94422d9e 100644 --- a/sc/source/ui/undo/undocell.cxx +++ b/sc/source/ui/undo/undocell.cxx @@ -175,13 +175,13 @@ void ScUndoCursorAttr::Redo() void ScUndoCursorAttr::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->ApplySelectionPattern( *pApplyPattern ); } bool ScUndoCursorAttr::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } ScUndoEnterData::Value::Value() : mnTab(-1), mbHasFormat(false), mnFormat(0) {} @@ -313,7 +313,7 @@ void ScUndoEnterData::Redo() void ScUndoEnterData::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) { OUString aTemp = maNewString; static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->EnterDataAtCursor( aTemp ); @@ -322,7 +322,7 @@ void ScUndoEnterData::Repeat(SfxRepeatTarget& rTarget) bool ScUndoEnterData::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } ScUndoEnterValue::ScUndoEnterValue( @@ -559,7 +559,7 @@ void ScUndoPageBreak::Redo() void ScUndoPageBreak::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) { ScTabViewShell& rViewShell = *static_cast<ScTabViewTarget&>(rTarget).GetViewShell(); @@ -572,7 +572,7 @@ void ScUndoPageBreak::Repeat(SfxRepeatTarget& rTarget) bool ScUndoPageBreak::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } ScUndoPrintZoom::ScUndoPrintZoom( ScDocShell* pNewDocShell, @@ -632,7 +632,7 @@ void ScUndoPrintZoom::Redo() void ScUndoPrintZoom::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) { ScTabViewShell& rViewShell = *static_cast<ScTabViewTarget&>(rTarget).GetViewShell(); ScViewData& rViewData = rViewShell.GetViewData(); @@ -642,7 +642,7 @@ void ScUndoPrintZoom::Repeat(SfxRepeatTarget& rTarget) bool ScUndoPrintZoom::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } ScUndoThesaurus::ScUndoThesaurus( @@ -717,13 +717,13 @@ void ScUndoThesaurus::Redo() void ScUndoThesaurus::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->DoThesaurus(); } bool ScUndoThesaurus::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } ScUndoReplaceNote::ScUndoReplaceNote( ScDocShell& rDocShell, const ScAddress& rPos, diff --git a/sc/source/ui/undo/undodat.cxx b/sc/source/ui/undo/undodat.cxx index 849e9f764ab3..1e1775cf7e0a 100644 --- a/sc/source/ui/undo/undodat.cxx +++ b/sc/source/ui/undo/undodat.cxx @@ -221,7 +221,7 @@ void ScUndoMakeOutline::Redo() void ScUndoMakeOutline::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) { ScTabViewShell& rViewShell = *static_cast<ScTabViewTarget&>(rTarget).GetViewShell(); @@ -234,7 +234,7 @@ void ScUndoMakeOutline::Repeat(SfxRepeatTarget& rTarget) bool ScUndoMakeOutline::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } ScUndoOutlineLevel::ScUndoOutlineLevel( ScDocShell* pNewDocShell, @@ -314,13 +314,13 @@ void ScUndoOutlineLevel::Redo() void ScUndoOutlineLevel::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->SelectLevel( bColumns, nLevel, true ); } bool ScUndoOutlineLevel::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } /** show/hide outline over block marks */ @@ -410,7 +410,7 @@ void ScUndoOutlineBlock::Redo() void ScUndoOutlineBlock::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) { ScTabViewShell& rViewShell = *static_cast<ScTabViewTarget&>(rTarget).GetViewShell(); @@ -423,7 +423,7 @@ void ScUndoOutlineBlock::Repeat(SfxRepeatTarget& rTarget) bool ScUndoOutlineBlock::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } ScUndoRemoveAllOutlines::ScUndoRemoveAllOutlines( ScDocShell* pNewDocShell, @@ -502,13 +502,13 @@ void ScUndoRemoveAllOutlines::Redo() void ScUndoRemoveAllOutlines::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->RemoveAllOutlines(); } bool ScUndoRemoveAllOutlines::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } ScUndoAutoOutline::ScUndoAutoOutline( ScDocShell* pNewDocShell, @@ -605,13 +605,13 @@ void ScUndoAutoOutline::Redo() void ScUndoAutoOutline::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->AutoOutline(); } bool ScUndoAutoOutline::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } ScUndoSubTotals::ScUndoSubTotals( ScDocShell* pNewDocShell, SCTAB nNewTab, @@ -1239,7 +1239,7 @@ void ScUndoImportData::Redo() void ScUndoImportData::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) { ScTabViewShell& rViewShell = *static_cast<ScTabViewTarget&>(rTarget).GetViewShell(); @@ -1257,7 +1257,7 @@ bool ScUndoImportData::CanRepeat(SfxRepeatTarget& rTarget) const // Repeat only for import using a database range, then pUndoDBData is set if (pUndoDBData) - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; else return false; // Address book } @@ -1416,13 +1416,13 @@ void ScUndoRepeatDB::Redo() void ScUndoRepeatDB::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->RepeatDB(); } bool ScUndoRepeatDB::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } ScUndoDataPilot::ScUndoDataPilot( ScDocShell* pNewDocShell, @@ -1877,7 +1877,7 @@ void ScUndoDataForm::Repeat(SfxRepeatTarget& /*rTarget*/) bool ScUndoDataForm::CanRepeat(SfxRepeatTarget& rTarget) const { - return (rTarget.ISA(ScTabViewTarget)); + return (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr); } void ScUndoDataForm::DoChange( const bool bUndo ) diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx index 2b20217f53dc..044035d1a2cc 100644 --- a/sc/source/ui/undo/undotab.cxx +++ b/sc/source/ui/undo/undotab.cxx @@ -159,14 +159,14 @@ void ScUndoInsertTab::Redo() void ScUndoInsertTab::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->GetViewData().GetDispatcher(). Execute(FID_INS_TABLE, SfxCallMode::SLOT | SfxCallMode::RECORD); } bool ScUndoInsertTab::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } ScUndoInsertTables::ScUndoInsertTables( ScDocShell* pNewDocShell, @@ -254,14 +254,14 @@ void ScUndoInsertTables::Redo() void ScUndoInsertTables::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->GetViewData().GetDispatcher(). Execute(FID_INS_TABLE, SfxCallMode::SLOT | SfxCallMode::RECORD); } bool ScUndoInsertTables::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } ScUndoDeleteTab::ScUndoDeleteTab( ScDocShell* pNewDocShell, const vector<SCTAB> &aTab, @@ -412,7 +412,7 @@ void ScUndoDeleteTab::Redo() void ScUndoDeleteTab::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) { ScTabViewShell* pViewShell = static_cast<ScTabViewTarget&>(rTarget).GetViewShell(); pViewShell->DeleteTable( pViewShell->GetViewData().GetTabNo() ); @@ -421,7 +421,7 @@ void ScUndoDeleteTab::Repeat(SfxRepeatTarget& rTarget) bool ScUndoDeleteTab::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } ScUndoRenameTab::ScUndoRenameTab( ScDocShell* pNewDocShell, @@ -866,7 +866,7 @@ void ScUndoMakeScenario::Redo() void ScUndoMakeScenario::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) { static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->MakeScenario( aName, aComment, aColor, nFlags ); } @@ -874,7 +874,7 @@ void ScUndoMakeScenario::Repeat(SfxRepeatTarget& rTarget) bool ScUndoMakeScenario::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } ScUndoImportTab::ScUndoImportTab( ScDocShell* pShell, @@ -1023,14 +1023,14 @@ void ScUndoImportTab::Redo() void ScUndoImportTab::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->GetViewData().GetDispatcher(). Execute(FID_INS_TABLE, SfxCallMode::SLOT | SfxCallMode::RECORD); } bool ScUndoImportTab::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } ScUndoRemoveLink::ScUndoRemoveLink( ScDocShell* pShell, const OUString& rDocName ) : @@ -1156,7 +1156,7 @@ void ScUndoShowHideTab::Redo() void ScUndoShowHideTab::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->GetViewData().GetDispatcher(). Execute( bShow ? FID_TABLE_SHOW : FID_TABLE_HIDE, SfxCallMode::SLOT | SfxCallMode::RECORD); @@ -1164,7 +1164,7 @@ void ScUndoShowHideTab::Repeat(SfxRepeatTarget& rTarget) bool ScUndoShowHideTab::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } OUString ScUndoShowHideTab::GetComment() const @@ -1563,14 +1563,14 @@ void ScUndoLayoutRTL::Redo() void ScUndoLayoutRTL::Repeat(SfxRepeatTarget& rTarget) { - if (rTarget.ISA(ScTabViewTarget)) + if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->GetViewData().GetDispatcher(). Execute( FID_TAB_RTL, SfxCallMode::SLOT | SfxCallMode::RECORD); } bool ScUndoLayoutRTL::CanRepeat(SfxRepeatTarget& rTarget) const { - return rTarget.ISA(ScTabViewTarget); + return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr; } OUString ScUndoLayoutRTL::GetComment() const diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 855d65983af6..f11d9edccc60 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -4778,7 +4778,7 @@ uno::Sequence<OUString> SAL_CALL ScCellRangesObj::getSupportedServiceNames() uno::Reference<table::XCellRange> ScCellRangeObj::CreateRangeFromDoc( ScDocument* pDoc, const ScRange& rR ) { SfxObjectShell* pObjSh = pDoc->GetDocumentShell(); - if ( pObjSh && pObjSh->ISA(ScDocShell) ) + if ( pObjSh && dynamic_cast<const ScDocShell*>( pObjSh) != nullptr ) return new ScCellRangeObj( static_cast<ScDocShell*>(pObjSh), rR ); return NULL; } @@ -7683,7 +7683,7 @@ void SAL_CALL ScTableSheetObj::link( const OUString& aUrl, const OUString& aShee for ( sal_uInt16 i=0; i<nCount; i++ ) { ::sfx2::SvBaseLink* pBase = *pLinkManager->GetLinks()[i]; - if (pBase->ISA(ScTableLink)) + if (dynamic_cast<const ScTableLink*>( pBase) != nullptr) { ScTableLink* pTabLink = static_cast<ScTableLink*>(pBase); if ( aFileString.equals(pTabLink->GetFileName()) ) diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index f9c7fdec8bbe..0c7954ea1496 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -719,16 +719,16 @@ OString ScModelObj::getTextSelection(const char* pMimeType, OString& rUsedMimeTy ScViewData* pViewData = ScDocShell::GetViewData(); uno::Reference<datatransfer::XTransferable> xTransferable; - if (( pShell = PTR_CAST( ScEditShell, pViewData->GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) ))) + if (( pShell = dynamic_cast<ScEditShell*>( pViewData->GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) )) ) xTransferable = pShell->GetEditView()->GetTransferable(); - else if ((PTR_CAST( ScDrawTextObjectBar, pViewData->GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) ))) + else if ( 0 != dynamic_cast<ScDrawTextObjectBar*>( pViewData->GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) )) { ScDrawView* pView = pViewData->GetScDrawView(); OutlinerView* pOutView = pView->GetTextEditOutlinerView(); if (pOutView) xTransferable = pOutView->GetEditView().GetTransferable(); } - else if (( pDrawShell = PTR_CAST( ScDrawShell, pViewData->GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) ))) + else if (( pDrawShell = dynamic_cast<ScDrawShell*>( pViewData->GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) )) ) xTransferable = pDrawShell->GetDrawView()->CopyToTransferable(); else { @@ -1571,7 +1571,7 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec long nDisplayStart = pPrintFuncCache->GetDisplayStart( nTab ); long nTabStart = pPrintFuncCache->GetTabStart( nTab ); - vcl::PDFExtOutDevData* pPDFData = PTR_CAST( vcl::PDFExtOutDevData, pDev->GetExtOutDevData() ); + vcl::PDFExtOutDevData* pPDFData = dynamic_cast< vcl::PDFExtOutDevData* >(pDev->GetExtOutDevData() ); if ( nRenderer == nTabStart ) { // first page of a sheet: add outline item for the sheet name diff --git a/sc/source/ui/unoobj/linkuno.cxx b/sc/source/ui/unoobj/linkuno.cxx index eb2b8b9fb8f5..ed02a3f1f890 100644 --- a/sc/source/ui/unoobj/linkuno.cxx +++ b/sc/source/ui/unoobj/linkuno.cxx @@ -116,7 +116,7 @@ ScTableLink* ScSheetLinkObj::GetLink_Impl() const for (size_t i=0; i<nCount; i++) { ::sfx2::SvBaseLink* pBase = *pLinkManager->GetLinks()[i]; - if (pBase->ISA(ScTableLink)) + if (dynamic_cast<const ScTableLink*>( pBase) != nullptr) { ScTableLink* pTabLink = static_cast<ScTableLink*>(pBase); if ( pTabLink->GetFileName().equals(aFileName) ) @@ -587,7 +587,7 @@ static ScAreaLink* lcl_GetAreaLink( ScDocShell* pDocShell, size_t nPos ) for (size_t i=0; i<nTotalCount; i++) { ::sfx2::SvBaseLink* pBase = *pLinkManager->GetLinks()[i]; - if (pBase->ISA(ScAreaLink)) + if (dynamic_cast<const ScAreaLink*>( pBase) != nullptr) { if ( nAreaCount == nPos ) return static_cast<ScAreaLink*>(pBase); @@ -1011,7 +1011,7 @@ sal_Int32 SAL_CALL ScAreaLinksObj::getCount() throw(uno::RuntimeException, std:: for (size_t i=0; i<nTotalCount; i++) { ::sfx2::SvBaseLink* pBase = *pLinkManager->GetLinks()[i]; - if (pBase->ISA(ScAreaLink)) + if (dynamic_cast<const ScAreaLink*>( pBase) != nullptr) ++nAreaCount; } } diff --git a/sc/source/ui/unoobj/shapeuno.cxx b/sc/source/ui/unoobj/shapeuno.cxx index ed20b5b793a3..03716f8cfcac 100644 --- a/sc/source/ui/unoobj/shapeuno.cxx +++ b/sc/source/ui/unoobj/shapeuno.cxx @@ -344,7 +344,7 @@ void SAL_CALL ScShapeObj::setPropertyValue(const OUString& aPropertyName, const if ( pDoc ) { SfxObjectShell* pObjSh = pDoc->GetDocumentShell(); - if ( pObjSh && pObjSh->ISA(ScDocShell) ) + if ( pObjSh && dynamic_cast<const ScDocShell*>( pObjSh) != nullptr ) { ScDocShell* pDocSh = static_cast<ScDocShell*>(pObjSh); @@ -479,7 +479,7 @@ void SAL_CALL ScShapeObj::setPropertyValue(const OUString& aPropertyName, const if ( pDoc ) { SfxObjectShell* pObjSh = pDoc->GetDocumentShell(); - if ( pObjSh && pObjSh->ISA(ScDocShell) ) + if ( pObjSh && dynamic_cast<const ScDocShell*>( pObjSh) != nullptr ) { ScDocShell* pDocSh = static_cast<ScDocShell*>(pObjSh); uno::Reference<drawing::XShape> xShape( mxShapeAgg, uno::UNO_QUERY ); @@ -577,7 +577,7 @@ void SAL_CALL ScShapeObj::setPropertyValue(const OUString& aPropertyName, const if ( pDoc ) { SfxObjectShell* pObjSh = pDoc->GetDocumentShell(); - if ( pObjSh && pObjSh->ISA(ScDocShell) ) + if ( pObjSh && dynamic_cast<const ScDocShell*>( pObjSh) != nullptr ) { ScDocShell* pDocSh = static_cast<ScDocShell*>(pObjSh); uno::Reference<drawing::XShape> xShape( mxShapeAgg, uno::UNO_QUERY ); @@ -676,7 +676,7 @@ uno::Any SAL_CALL ScShapeObj::getPropertyValue( const OUString& aPropertyName ) if ( lcl_GetPageNum( pPage, *pModel, nTab ) ) { SfxObjectShell* pObjSh = pDoc->GetDocumentShell(); - if ( pObjSh && pObjSh->ISA(ScDocShell) ) + if ( pObjSh && dynamic_cast<const ScDocShell*>( pObjSh) != nullptr ) { ScDocShell* pDocSh = static_cast<ScDocShell*>(pObjSh); uno::Reference< uno::XInterface > xAnchor; @@ -1033,7 +1033,7 @@ uno::Reference<text::XTextRange> SAL_CALL ScShapeObj::getAnchor() if ( pDoc ) { SfxObjectShell* pObjSh = pDoc->GetDocumentShell(); - if ( pObjSh && pObjSh->ISA(ScDocShell) ) + if ( pObjSh && dynamic_cast<const ScDocShell*>( pObjSh) != nullptr ) { ScDocShell* pDocSh = static_cast<ScDocShell*>(pObjSh); @@ -1293,7 +1293,7 @@ uno::Reference< uno::XInterface > SAL_CALL ScShapeObj::getParent() throw (uno::R if ( pDoc ) { SfxObjectShell* pObjSh = pDoc->GetDocumentShell(); - if ( pObjSh && pObjSh->ISA(ScDocShell) ) + if ( pObjSh && dynamic_cast<const ScDocShell*>( pObjSh) != nullptr ) { ScDocShell* pDocSh = static_cast<ScDocShell*>(pObjSh); diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx index a810a5ff6cc2..556be91cba78 100644 --- a/sc/source/ui/unoobj/viewuno.cxx +++ b/sc/source/ui/unoobj/viewuno.cxx @@ -2229,11 +2229,11 @@ ScTabViewObj* ScTabViewObj::getImplementation(const uno::Reference<uno::XInterfa std::exception) { SolarMutexGuard aGuard; - ScEditShell* pShell = PTR_CAST( ScEditShell, GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) ); + ScEditShell* pShell = dynamic_cast<ScEditShell*>( GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) ); if (pShell) return pShell->GetEditView()->GetTransferable(); - ScDrawTextObjectBar* pTextShell = PTR_CAST( ScDrawTextObjectBar, GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) ); + ScDrawTextObjectBar* pTextShell = dynamic_cast<ScDrawTextObjectBar*>( GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) ); if (pTextShell) { ScViewData& rViewData = GetViewShell()->GetViewData(); @@ -2243,7 +2243,7 @@ ScTabViewObj* ScTabViewObj::getImplementation(const uno::Reference<uno::XInterfa return pOutView->GetEditView().GetTransferable(); } - ScDrawShell* pDrawShell = PTR_CAST( ScDrawShell, GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) ); + ScDrawShell* pDrawShell = dynamic_cast<ScDrawShell*>( GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) ); if (pDrawShell) return pDrawShell->GetDrawView()->CopyToTransferable(); @@ -2258,12 +2258,12 @@ void SAL_CALL ScTabViewObj::insertTransferable( const ::com::sun::star::uno::Ref std::exception) { SolarMutexGuard aGuard; - ScEditShell* pShell = PTR_CAST( ScEditShell, GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) ); + ScEditShell* pShell = dynamic_cast<ScEditShell*>( GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) ); if (pShell) pShell->GetEditView()->InsertText( xTrans, OUString(), false ); else { - ScDrawTextObjectBar* pTextShell = PTR_CAST( ScDrawTextObjectBar, GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) ); + ScDrawTextObjectBar* pTextShell = dynamic_cast<ScDrawTextObjectBar*>( GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) ); if (pTextShell) { ScViewData& rViewData = GetViewShell()->GetViewData(); diff --git a/sc/source/ui/vba/vbaworksheets.cxx b/sc/source/ui/vba/vbaworksheets.cxx index 5f6b24e73d29..0b6541ca8cb7 100644 --- a/sc/source/ui/vba/vbaworksheets.cxx +++ b/sc/source/ui/vba/vbaworksheets.cxx @@ -521,7 +521,7 @@ void ScVbaWorksheets::PrintPreview( const css::uno::Any& /*EnableChanges*/ ) thr dispatchExecute( pViewShell, SID_VIEWSHELL1 ); SfxViewShell* pShell = SfxViewShell::Get( pViewFrame->GetFrame().GetFrameInterface()->getController() ); - if ( pShell->ISA( ScPreviewShell ) ) + if ( dynamic_cast<const ScPreviewShell*>( pShell) != nullptr ) { ScPreviewShell* pPrvShell = static_cast< ScPreviewShell* >( pShell ); ScPreview* pPrvView = pPrvShell->GetPreview(); diff --git a/sc/source/ui/view/auditsh.cxx b/sc/source/ui/view/auditsh.cxx index 4194841c025e..57a95438498f 100644 --- a/sc/source/ui/view/auditsh.cxx +++ b/sc/source/ui/view/auditsh.cxx @@ -95,7 +95,7 @@ void ScAuditingShell::Execute( SfxRequest& rReq ) if ( pReqArgs->GetItemState( SID_RANGE_COL, true, &pXItem ) == SfxItemState::SET && pReqArgs->GetItemState( SID_RANGE_ROW, true, &pYItem ) == SfxItemState::SET ) { - OSL_ENSURE( pXItem->ISA(SfxInt16Item) && pYItem->ISA(SfxInt32Item), + OSL_ENSURE( dynamic_cast<const SfxInt16Item*>( pXItem) != nullptr && dynamic_cast<const SfxInt32Item*>( pYItem) != nullptr, "wrong items" ); SCsCOL nCol = static_cast<SCsCOL>(static_cast<const SfxInt16Item*>(pXItem)->GetValue()); SCsROW nRow = static_cast<SCsROW>(static_cast<const SfxInt32Item*>(pYItem)->GetValue()); diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 106bc5c2b307..954da76c3e49 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -1286,7 +1286,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) const SfxPoolItem* pItem; if ( pReqArgs && pReqArgs->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()); } @@ -1541,7 +1541,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) const SfxPoolItem* pItem=nullptr; if ( pReqArgs && pReqArgs->GetItemState(nSlot, true, &pItem) == SfxItemState::SET && - pItem->ISA(SfxUInt32Item) ) + dynamic_cast<const SfxUInt32Item*>( pItem) != nullptr ) { SotClipboardFormatId nFormat = static_cast<SotClipboardFormatId>(static_cast<const SfxUInt32Item*>(pItem)->GetValue()); bool bRet=true; @@ -2309,12 +2309,12 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) pArgs->GetItemState(GetPool().GetWhich(SID_CHARMAP), false, &pItem); if ( pItem ) { - const SfxStringItem* pStringItem = PTR_CAST( SfxStringItem, pItem ); + const SfxStringItem* pStringItem = dynamic_cast<const SfxStringItem*>( pItem ); if ( pStringItem ) aChars = pStringItem->GetValue(); const SfxPoolItem* pFtItem = nullptr; 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/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx index b5667e6ac3d9..6b2dd8de432f 100644 --- a/sc/source/ui/view/cellsh3.cxx +++ b/sc/source/ui/view/cellsh3.cxx @@ -747,7 +747,7 @@ void ScCellShell::Execute( SfxRequest& rReq ) if ( pReqArgs && pReqArgs->GetItemState(nSlot, true, &pItem) == SfxItemState::SET ) { - OSL_ENSURE(pItem && pItem->ISA(SfxBoolItem), "wrong item"); + OSL_ENSURE(pItem && dynamic_cast<const SfxBoolItem*>( pItem) != nullptr, "wrong item"); bMoveContents = static_cast<const SfxBoolItem*>(pItem)->GetValue(); } diff --git a/sc/source/ui/view/drawvie3.cxx b/sc/source/ui/view/drawvie3.cxx index 7e79ef9b3889..43bf80d1206f 100644 --- a/sc/source/ui/view/drawvie3.cxx +++ b/sc/source/ui/view/drawvie3.cxx @@ -197,7 +197,7 @@ void ScDrawView::UpdateIMap( SdrObject* pObj ) { if ( pViewData && pViewData->GetViewShell()->GetViewFrame()->HasChildWindow( ScIMapChildWindowId() ) && - pObj && ( pObj->ISA(SdrGrafObj) || pObj->ISA(SdrOle2Obj) ) ) + pObj && ( dynamic_cast<const SdrGrafObj*>( pObj) != nullptr || dynamic_cast<const SdrOle2Obj*>( pObj) != nullptr ) ) { Graphic aGraphic; TargetList aTargetList; @@ -210,7 +210,7 @@ void ScDrawView::UpdateIMap( SdrObject* pObj ) pViewData->GetViewShell()->GetViewFrame()->GetTargetList( aTargetList ); // handle graphics from object - if ( pObj->ISA( SdrGrafObj ) ) + if ( dynamic_cast<const SdrGrafObj*>( pObj) != nullptr ) aGraphic = static_cast<SdrGrafObj*>(pObj)->GetGraphic(); else { diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx index 73794d28b852..acbe5defcc40 100644 --- a/sc/source/ui/view/drawvie4.cxx +++ b/sc/source/ui/view/drawvie4.cxx @@ -70,7 +70,7 @@ void ScDrawView::CheckOle( const SdrMarkList& rMarkList, bool& rAnyOle, bool& rO rOneOle = (nCount == 1); break; } - else if ( pObj->ISA(SdrObjGroup) ) + else if ( dynamic_cast<const SdrObjGroup*>( pObj) != nullptr ) { SdrObjListIter aIter( *pObj, IM_DEEPNOGROUPS ); SdrObject* pSubObj = aIter.Next(); diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx index f49c66ab53b1..8d2f4d8e0e48 100644 --- a/sc/source/ui/view/drawview.cxx +++ b/sc/source/ui/view/drawview.cxx @@ -218,7 +218,7 @@ void ScDrawView::SetMarkedToLayer( sal_uInt8 nLayerNo ) for (size_t i=0; i<nCount; ++i) { SdrObject* pObj = rMark.GetMark(i)->GetMarkedSdrObj(); - if ( !pObj->ISA(SdrUnoObj) && (pObj->GetLayer() != SC_LAYER_INTERN) ) + if ( dynamic_cast<const SdrUnoObj*>( pObj) == nullptr && (pObj->GetLayer() != SC_LAYER_INTERN) ) { AddUndo( new SdrUndoObjectLayerChange( *pObj, pObj->GetLayer(), (SdrLayerID)nLayerNo) ); pObj->SetLayer( nLayerNo ); @@ -241,7 +241,7 @@ bool ScDrawView::HasMarkedControl() const { SdrObjListIter aIter( GetMarkedObjectList() ); for( SdrObject* pObj = aIter.Next(); pObj; pObj = aIter.Next() ) - if( pObj->ISA( SdrUnoObj ) ) + if( dynamic_cast<const SdrUnoObj*>( pObj) != nullptr ) return true; return false; } @@ -428,7 +428,7 @@ void ScDrawView::MarkListHasChanged() for (size_t i=0; i<nMarkCount; ++i) { SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj(); - if ( pObj->ISA( SdrObjGroup ) ) + if ( dynamic_cast<const SdrObjGroup*>( pObj) != nullptr ) { const SdrObjList *pLst = static_cast<SdrObjGroup*>(pObj)->GetSubList(); const size_t nListCount = pLst->GetObjCount(); @@ -443,7 +443,7 @@ void ScDrawView::MarkListHasChanged() { SdrObject *pSubObj = pLst->GetObj( j ); - if (!pSubObj->ISA(SdrUnoObj)) + if (dynamic_cast<const SdrUnoObj*>( pSubObj) == nullptr) bOnlyControls = false; if (pSubObj->GetObjIdentifier() != OBJ_GRAF) bOnlyGraf = false; @@ -453,7 +453,7 @@ void ScDrawView::MarkListHasChanged() } else { - if (!pObj->ISA(SdrUnoObj)) + if (dynamic_cast<const SdrUnoObj*>( pObj) == nullptr) bOnlyControls = false; if (pObj->GetObjIdentifier() != OBJ_GRAF) bOnlyGraf = false; @@ -897,7 +897,7 @@ void ScDrawView::MarkDropObj( SdrObject* pObj ) void ScDrawView::SyncForGrid( SdrObject* pObj ) { // process members of a group shape separately - if ( pObj->ISA( SdrObjGroup ) ) + if ( dynamic_cast<const SdrObjGroup*>( pObj) != nullptr ) { SdrObjList *pLst = static_cast<SdrObjGroup*>(pObj)->GetSubList(); for ( size_t i = 0, nCount = pLst->GetObjCount(); i < nCount; ++i ) diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index 31463d1b89c1..70c5469163da 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -253,7 +253,7 @@ void ScEditShell::Execute( SfxRequest& rReq ) const SfxPoolItem* pItem; if ( pReqArgs && pReqArgs->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()); } @@ -395,7 +395,7 @@ void ScEditShell::Execute( SfxRequest& rReq ) aString = 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 ) { OUString aFontName(pFontItem->GetValue()); @@ -791,7 +791,7 @@ const SvxURLField* ScEditShell::GetURLField() if (pFieldItem) { const SvxFieldData* pField = pFieldItem->GetField(); - if ( pField && pField->ISA(SvxURLField) ) + if ( pField && dynamic_cast<const SvxURLField*>( pField) != nullptr ) return static_cast<const SvxURLField*>(pField); } } diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index ccd622d709da..aab5d7c962eb 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -456,7 +456,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) if ( SfxItemState::SET == pArgs->GetItemState( nSlotId, true, &pItem ) ) { - const SfxStringItem* pStrItem = PTR_CAST(SfxStringItem,pItem); + const SfxStringItem* pStrItem = dynamic_cast< const SfxStringItem *>( pItem ); if ( pStrItem ) { aStyleName = pStrItem->GetValue(); @@ -1419,12 +1419,12 @@ void ScFormatShell::ExecuteTextAttr( SfxRequest& rReq ) { const SfxPoolItem& rUnderline = pSet->Get( ATTR_FONT_UNDERLINE ); - if( rUnderline.ISA(SvxUnderlineItem) ) + if( dynamic_cast<const SvxUnderlineItem*>( &rUnderline) != nullptr ) { pTabViewShell->ApplyAttr( rUnderline ); pNewSet->Put( rUnderline,rUnderline.Which() ); } - else if ( rUnderline.ISA(SvxTextLineItem) ) + else if ( dynamic_cast<const SvxTextLineItem*>( &rUnderline) != nullptr ) { // #i106580# also allow SvxTextLineItem (base class of SvxUnderlineItem) const SvxTextLineItem& rTextLineItem = static_cast<const SvxTextLineItem&>(rUnderline); diff --git a/sc/source/ui/view/hdrcont.cxx b/sc/source/ui/view/hdrcont.cxx index 6bcc0bbd357f..ece03625ac4d 100644 --- a/sc/source/ui/view/hdrcont.cxx +++ b/sc/source/ui/view/hdrcont.cxx @@ -818,8 +818,7 @@ void ScHeaderControl::Command( const CommandEvent& rCEvt ) // execute popup menu - ScTabViewShell* pViewSh = PTR_CAST( ScTabViewShell, - SfxViewShell::Current() ); + ScTabViewShell* pViewSh = dynamic_cast< ScTabViewShell *>( SfxViewShell::Current() ); if ( pViewSh ) { if ( rCEvt.IsMouseEvent() ) diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx index 5c2952202ecb..468953af8272 100644 --- a/sc/source/ui/view/output.cxx +++ b/sc/source/ui/view/output.cxx @@ -2401,7 +2401,7 @@ void ScOutputData::DrawNoteMarks(vcl::RenderContext& rRenderContext) void ScOutputData::AddPDFNotes() { - vcl::PDFExtOutDevData* pPDFData = PTR_CAST( vcl::PDFExtOutDevData, mpDev->GetExtOutDevData() ); + vcl::PDFExtOutDevData* pPDFData = dynamic_cast< vcl::PDFExtOutDevData* >( mpDev->GetExtOutDevData() ); if ( !pPDFData || !pPDFData->GetIsExportNotes() ) return; diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index e07b7f7a3bb3..8a727f5b7f6c 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -821,7 +821,7 @@ double ScOutputData::GetStretch() static void lcl_DoHyperlinkResult( OutputDevice* pDev, const Rectangle& rRect, ScRefCellValue& rCell ) { - vcl::PDFExtOutDevData* pPDFData = PTR_CAST( vcl::PDFExtOutDevData, pDev->GetExtOutDevData() ); + vcl::PDFExtOutDevData* pPDFData = dynamic_cast< vcl::PDFExtOutDevData* >( pDev->GetExtOutDevData() ); OUString aCellText; OUString aURL; @@ -1433,7 +1433,7 @@ Rectangle ScOutputData::LayoutStrings(bool bPixelToLogic, bool bPaint, const ScA mpDev->GetMapMode().GetMapUnit() == mpRefDevice->GetMapMode().GetMapUnit(), "LayoutStrings: different MapUnits ?!?!" ); - vcl::PDFExtOutDevData* pPDFData = PTR_CAST( vcl::PDFExtOutDevData, mpDev->GetExtOutDevData() ); + vcl::PDFExtOutDevData* pPDFData = dynamic_cast< vcl::PDFExtOutDevData* >(mpDev->GetExtOutDevData() ); sc::IdleSwitch aIdleSwitch(*mpDoc, false); ScDrawStringsVars aVars( this, bPixelToLogic ); @@ -2711,7 +2711,7 @@ void ScOutputData::DrawEditParam::adjustForRTL() void ScOutputData::DrawEditParam::adjustForHyperlinkInPDF(Point aURLStart, OutputDevice* pDev) { // PDF: whole-cell hyperlink from formula? - vcl::PDFExtOutDevData* pPDFData = PTR_CAST( vcl::PDFExtOutDevData, pDev->GetExtOutDevData() ); + vcl::PDFExtOutDevData* pPDFData = dynamic_cast<vcl::PDFExtOutDevData* >( pDev->GetExtOutDevData() ); bool bHasURL = pPDFData && isHyperlinkCell(); if (!bHasURL) return; diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx index f9a0c9b3f80c..2b9f1234e65c 100644 --- a/sc/source/ui/view/prevwsh.cxx +++ b/sc/source/ui/view/prevwsh.cxx @@ -158,7 +158,7 @@ ScPreviewShell::ScPreviewShell( SfxViewFrame* pViewFrame, { Construct( &pViewFrame->GetWindow() ); - if ( pOldSh && pOldSh->ISA( ScTabViewShell ) ) + if ( pOldSh && dynamic_cast<const ScTabViewShell*>( pOldSh) != nullptr ) { // store view settings, show table from TabView //! store live ScViewData instead, and update on ScTablesHint? diff --git a/sc/source/ui/view/reffact.cxx b/sc/source/ui/view/reffact.cxx index b08af0ae9931..4c986dd94f2f 100644 --- a/sc/source/ui/view/reffact.cxx +++ b/sc/source/ui/view/reffact.cxx @@ -88,7 +88,7 @@ namespace /************************************************************************************/\ ScTabViewShell* pViewShell = lcl_GetTabViewShell( p ); \ if (!pViewShell) \ - pViewShell = PTR_CAST( ScTabViewShell, SfxViewShell::Current() ); \ + pViewShell = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() ); \ OSL_ENSURE( pViewShell, "missing view shell :-(" ); \ SetWindow( pViewShell ? \ pViewShell->CreateRefDialog( p, this, pInfo, pParentP, sid ) : nullptr ); \ @@ -146,7 +146,7 @@ ScSimpleRefDlgWrapper::ScSimpleRefDlgWrapper( vcl::Window* pParentP, { SfxViewFrame* pViewFrm = pDisp->GetFrame(); if ( pViewFrm ) - pViewShell = PTR_CAST( ScTabViewShell, pViewFrm->GetViewShell() ); + pViewShell = dynamic_cast<ScTabViewShell*>( pViewFrm->GetViewShell() ); } OSL_ENSURE( pViewShell, "missing view shell :-(" ); @@ -236,7 +236,7 @@ ScAcceptChgDlgWrapper::ScAcceptChgDlgWrapper( vcl::Window* pParentP, SfxChildWindow( pParentP, nId ) { ScTabViewShell* pViewShell = - PTR_CAST( ScTabViewShell, SfxViewShell::Current() ); + dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() ); OSL_ENSURE( pViewShell, "missing view shell :-(" ); if (pViewShell) { @@ -252,7 +252,7 @@ ScAcceptChgDlgWrapper::ScAcceptChgDlgWrapper( vcl::Window* pParentP, void ScAcceptChgDlgWrapper::ReInitDlg() { ScTabViewShell* pViewShell = - PTR_CAST( ScTabViewShell, SfxViewShell::Current() ); + dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() ); OSL_ENSURE( pViewShell, "missing view shell :-(" ); if(GetWindow() && pViewShell) @@ -297,7 +297,7 @@ ScValidityRefChildWin::ScValidityRefChildWin( vcl::Window* pParent else pViewShell = lcl_GetTabViewShell( p ); if (!pViewShell) - pViewShell = PTR_CAST( ScTabViewShell, SfxViewShell::Current() ); + pViewShell = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() ); OSL_ENSURE( pViewShell, "missing view shell :-(" ); if (pViewShell && !GetWindow()) pViewShell->GetViewFrame()->SetChildWindow( nId, false ); diff --git a/sc/source/ui/view/spelldialog.cxx b/sc/source/ui/view/spelldialog.cxx index 714ab370a494..033bcd207394 100644 --- a/sc/source/ui/view/spelldialog.cxx +++ b/sc/source/ui/view/spelldialog.cxx @@ -118,7 +118,7 @@ void ScSpellDialogChildWindow::LoseFocus() void ScSpellDialogChildWindow::Reset() { - if( mpViewShell && (mpViewShell == PTR_CAST( ScTabViewShell, SfxViewShell::Current() )) ) + if( mpViewShell && (mpViewShell == dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() )) ) { if( mxEngine.get() && mxEngine->IsAnyModified() ) { @@ -163,7 +163,7 @@ void ScSpellDialogChildWindow::Init() { if( mpViewShell ) return; - if( (mpViewShell = PTR_CAST( ScTabViewShell, SfxViewShell::Current() )) == 0 ) + if( (mpViewShell = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() )) == 0 ) return; mpViewData = &mpViewShell->GetViewData(); @@ -262,7 +262,7 @@ void ScSpellDialogChildWindow::Init() bool ScSpellDialogChildWindow::IsSelectionChanged() { - if( !mxOldRangeList.get() || !mpViewShell || (mpViewShell != PTR_CAST( ScTabViewShell, SfxViewShell::Current() )) ) + if( !mxOldRangeList.get() || !mpViewShell || (mpViewShell != dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() )) ) return true; if( EditView* pEditView = mpViewData->GetSpellingView() ) diff --git a/sc/source/ui/view/spelleng.cxx b/sc/source/ui/view/spelleng.cxx index dc838e234db5..9b9f4c2572e1 100644 --- a/sc/source/ui/view/spelleng.cxx +++ b/sc/source/ui/view/spelleng.cxx @@ -188,7 +188,7 @@ bool ScConversionEngineBase::FindNextConversionCell() // language changed? const SfxPoolItem* pItem = mrDoc.GetAttr( nNewCol, nNewRow, mnStartTab, ATTR_FONT_LANGUAGE ); - if( const SvxLanguageItem* pLangItem = PTR_CAST( SvxLanguageItem, pItem ) ) + if( const SvxLanguageItem* pLangItem = dynamic_cast<const SvxLanguageItem*>( pItem ) ) { LanguageType eLang = static_cast< LanguageType >( pLangItem->GetValue() ); if( eLang == LANGUAGE_SYSTEM ) diff --git a/sc/source/ui/view/tabvwsh2.cxx b/sc/source/ui/view/tabvwsh2.cxx index 6e229523d346..60e811e2f5c4 100644 --- a/sc/source/ui/view/tabvwsh2.cxx +++ b/sc/source/ui/view/tabvwsh2.cxx @@ -102,7 +102,7 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq) { const SfxPoolItem* pItem; if ( pArgs->GetItemState( SID_INSERT_DRAW, true, &pItem ) == SfxItemState::SET && - pItem->ISA( SvxDrawToolItem ) ) + dynamic_cast<const SvxDrawToolItem*>( pItem) != nullptr ) { SvxDrawToolEnum eSel = (SvxDrawToolEnum)static_cast<const SvxDrawToolItem*>(pItem)->GetValue(); switch (eSel) @@ -139,7 +139,7 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq) { const SfxPoolItem* pItem; if ( pArgs->GetItemState( SID_FM_CONTROL_IDENTIFIER, true, &pItem ) == SfxItemState::SET && - pItem->ISA( SfxUInt16Item ) ) + dynamic_cast<const SfxUInt16Item*>( pItem) != nullptr ) nNewFormId = static_cast<const SfxUInt16Item*>(pItem)->GetValue(); } @@ -147,7 +147,7 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq) if ( pArgs ) { const SfxPoolItem* pItem; - if ( pArgs->GetItemState( nNewId, true, &pItem ) == SfxItemState::SET && pItem->ISA( SfxStringItem ) ) + if ( pArgs->GetItemState( nNewId, true, &pItem ) == SfxItemState::SET && dynamic_cast<const SfxStringItem*>( pItem) != nullptr ) sStringItemValue = static_cast<const SfxStringItem*>(pItem)->GetValue(); } bool bSwitchCustom = ( !sStringItemValue.isEmpty() && !sDrawCustom.isEmpty() && sStringItemValue != sDrawCustom ); diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx index 569f578cbdb9..70ab1592ece2 100644 --- a/sc/source/ui/view/tabvwsh3.cxx +++ b/sc/source/ui/view/tabvwsh3.cxx @@ -945,7 +945,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) const SfxPoolItem* pItem; if ( pReqArgs && pReqArgs->GetItemState( nSlot, true, &pItem ) == SfxItemState::SET && - pItem->ISA( SfxStringItem ) ) + dynamic_cast<const SfxStringItem*>( pItem) != nullptr ) { OUString aComment = static_cast<const SfxStringItem*>(pItem)->GetValue(); pDocSh->SetChangeComment( pAction, aComment ); diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index 151a57bc9594..13eef44e8d97 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -136,9 +136,7 @@ void ScTabViewShell::Activate(bool bMDI) ScInputHandler* pOldHdl=pWin->GetInputHandler(); - TypeId aScType = TYPE(ScTabViewShell); - - SfxViewShell* pSh = SfxViewShell::GetFirst( &aScType ); + SfxViewShell* pSh = SfxViewShell::GetFirst( true, checkSfxViewShell<ScTabViewShell> ); while ( pSh!=NULL && pOldHdl!=NULL) { if (static_cast<ScTabViewShell*>(pSh)->GetInputHandler() == pOldHdl) @@ -146,7 +144,7 @@ void ScTabViewShell::Activate(bool bMDI) pOldHdl->ResetDelayTimer(); break; } - pSh = SfxViewShell::GetNext( *pSh, &aScType ); + pSh = SfxViewShell::GetNext( *pSh, true, checkSfxViewShell<ScTabViewShell> ); } pWin->SetInputHandler( pInputHandler ); @@ -1037,7 +1035,7 @@ void ScTabViewShell::SetDrawTextUndo( ::svl::IUndoManager* pNewUndoMgr ) ScTabViewShell* ScTabViewShell::GetActiveViewShell() { - return PTR_CAST(ScTabViewShell,Current()); + return dynamic_cast< ScTabViewShell *>( Current() ); } SfxPrinter* ScTabViewShell::GetPrinter( bool bCreate ) @@ -1694,7 +1692,7 @@ ScTabViewShell::ScTabViewShell( SfxViewFrame* pViewFrame, // old DesignMode state from form layer must be restored, too TriState nForceDesignMode = TRISTATE_INDET; - if ( pOldSh && pOldSh->ISA( ScPreviewShell ) ) + if ( pOldSh && dynamic_cast<const ScPreviewShell*>( pOldSh) != nullptr ) { ScPreviewShell* pPreviewShell = static_cast<ScPreviewShell*>(pOldSh); nForceDesignMode = pPreviewShell->GetSourceDesignMode(); diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx index cd36fea739e4..c8875511140b 100644 --- a/sc/source/ui/view/tabvwshb.cxx +++ b/sc/source/ui/view/tabvwshb.cxx @@ -401,17 +401,17 @@ void ScTabViewShell::ExecDrawIns(SfxRequest& rReq) pNewDBField->SetLogicRect(aNewObjectRectangle); // controls must be on control layer, groups on front layer - if ( pNewDBField->ISA(SdrUnoObj) ) + if ( dynamic_cast<const SdrUnoObj*>( pNewDBField) != nullptr ) pNewDBField->NbcSetLayer(SC_LAYER_CONTROLS); else pNewDBField->NbcSetLayer(SC_LAYER_FRONT); - if (pNewDBField->ISA(SdrObjGroup)) + if (dynamic_cast<const SdrObjGroup*>( pNewDBField) != nullptr) { SdrObjListIter aIter( *pNewDBField, IM_DEEPWITHGROUPS ); SdrObject* pSubObj = aIter.Next(); while (pSubObj) { - if ( pSubObj->ISA(SdrUnoObj) ) + if ( dynamic_cast<const SdrUnoObj*>( pSubObj) != nullptr ) pSubObj->NbcSetLayer(SC_LAYER_CONTROLS); else pSubObj->NbcSetLayer(SC_LAYER_FRONT); diff --git a/sc/source/ui/view/tabvwshe.cxx b/sc/source/ui/view/tabvwshe.cxx index e3d03d12741f..f8b8d5cd6d98 100644 --- a/sc/source/ui/view/tabvwshe.cxx +++ b/sc/source/ui/view/tabvwshe.cxx @@ -227,7 +227,7 @@ void ScTabViewShell::ExecSearch( SfxRequest& rReq ) if ( pReqArgs && SfxItemState::SET == pReqArgs->GetItemState(SID_SEARCH_ITEM, false, &pItem) ) { - OSL_ENSURE( pItem->ISA(SvxSearchItem), "wrong Item" ); + OSL_ENSURE( dynamic_cast<const SvxSearchItem*>( pItem) != nullptr, "wrong Item" ); const SvxSearchItem* pSearchItem = static_cast<const SvxSearchItem*>(pItem); ScGlobal::SetSearchItem( *pSearchItem ); @@ -261,7 +261,7 @@ void ScTabViewShell::ExecSearch( SfxRequest& rReq ) pReqArgs->GetItemState(SID_SEARCH_ITEM, false, &pItem)) { // remember search item - OSL_ENSURE( pItem->ISA(SvxSearchItem), "wrong Item" ); + OSL_ENSURE( dynamic_cast<const SvxSearchItem*>( pItem) != nullptr, "wrong Item" ); ScGlobal::SetSearchItem( *static_cast<const SvxSearchItem*>(pItem )); } else diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx index c3959c606434..132789c6d05f 100644 --- a/sc/source/ui/view/tabvwshf.cxx +++ b/sc/source/ui/view/tabvwshf.cxx @@ -460,7 +460,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) while ( pSh ) { - pScSh = PTR_CAST( ScDocShell, pSh ); + pScSh = dynamic_cast<ScDocShell*>( pSh ); if( pScSh ) { diff --git a/sc/source/ui/view/tabvwshg.cxx b/sc/source/ui/view/tabvwshg.cxx index 7711cfe0ec17..b9e5ed326bc1 100644 --- a/sc/source/ui/view/tabvwshg.cxx +++ b/sc/source/ui/view/tabvwshg.cxx @@ -60,7 +60,7 @@ void ScTabViewShell::InsertURLButton( const OUString& rName, const OUString& rUR SdrObject* pObj = SdrObjFactory::MakeNewObject(FmFormInventor, OBJ_FM_BUTTON, pDrView->GetSdrPageView()->GetPage(), pModel); - SdrUnoObj* pUnoCtrl = PTR_CAST(SdrUnoObj, pObj); + SdrUnoObj* pUnoCtrl = dynamic_cast<SdrUnoObj*>( pObj ); OSL_ENSURE( pUnoCtrl, "no SdrUnoObj"); if( !pUnoCtrl ) return; diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index 0c57a933e254..eeddce788b50 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -2533,13 +2533,13 @@ void ScViewFunc::MoveTable( SID_OPENDOC, SfxCallMode::API|SfxCallMode::SYNCHRON, &aItem, &aTarget, 0L ); if ( pRetItem ) { - if ( pRetItem->ISA( SfxObjectItem ) ) - pDestShell = PTR_CAST( ScDocShell, static_cast<const SfxObjectItem*>(pRetItem)->GetShell() ); - else if ( pRetItem->ISA( SfxViewFrameItem ) ) + if ( dynamic_cast<const SfxObjectItem*>( pRetItem) != nullptr ) + pDestShell = dynamic_cast<ScDocShell*>( static_cast<const SfxObjectItem*>(pRetItem)->GetShell() ); + else if ( dynamic_cast<const SfxViewFrameItem*>( pRetItem) != nullptr ) { SfxViewFrame* pFrm = static_cast<const SfxViewFrameItem*>(pRetItem)->GetFrame(); if (pFrm) - pDestShell = PTR_CAST( ScDocShell, pFrm->GetObjectShell() ); + pDestShell = dynamic_cast<ScDocShell*>( pFrm->GetObjectShell() ); } if (pDestShell) pDestViewSh = pDestShell->GetBestViewShell(); diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx index 4b1c0c07bd5e..dd8bb7e7c9e3 100644 --- a/sc/source/ui/view/viewfun5.cxx +++ b/sc/source/ui/view/viewfun5.cxx @@ -433,17 +433,17 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId, aRect.SetPos(aInsPos); pObj->SetLogicRect(aRect); - if ( pObj->ISA(SdrUnoObj) ) + if ( dynamic_cast<const SdrUnoObj*>( pObj) != nullptr ) pObj->NbcSetLayer(SC_LAYER_CONTROLS); else pObj->NbcSetLayer(SC_LAYER_FRONT); - if (pObj->ISA(SdrObjGroup)) + if (dynamic_cast<const SdrObjGroup*>( pObj) != nullptr) { SdrObjListIter aIter( *pObj, IM_DEEPWITHGROUPS ); SdrObject* pSubObj = aIter.Next(); while (pSubObj) { - if ( pSubObj->ISA(SdrUnoObj) ) + if ( dynamic_cast<const SdrUnoObj*>( pSubObj) != nullptr ) pSubObj->NbcSetLayer(SC_LAYER_CONTROLS); else pSubObj->NbcSetLayer(SC_LAYER_FRONT); @@ -510,7 +510,7 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId, SdrObject* pObject = aIter.Next(); while (pObject) { - if ( pObject->ISA(SdrUnoObj) ) + if ( dynamic_cast<const SdrUnoObj*>( pObject) != nullptr ) pObject->NbcSetLayer(SC_LAYER_CONTROLS); else pObject->NbcSetLayer(SC_LAYER_FRONT); diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx index 3bed5d9e9faa..79da9e04d826 100644 --- a/sc/source/ui/view/viewfun7.cxx +++ b/sc/source/ui/view/viewfun7.cxx @@ -163,7 +163,7 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel, pNeuObj->SetPage(pDestPage); // copy graphics within the same model - always needs new name - if ( pNeuObj->ISA(SdrGrafObj) && !bPasteIsMove ) + if ( dynamic_cast<const SdrGrafObj*>( pNeuObj) != nullptr && !bPasteIsMove ) pNeuObj->SetName(static_cast<ScDrawLayer*>(pDrawModel)->GetNewGraphicName()); if (nDiffX!=0 || nDiffY!=0) @@ -236,7 +236,7 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel, SdrObject* pObject = aIter.Next(); while (pObject) { - if ( pObject->ISA(SdrUnoObj) && pObject->GetLayer() != SC_LAYER_CONTROLS ) + if ( dynamic_cast<const SdrUnoObj*>( pObject) != nullptr && pObject->GetLayer() != SC_LAYER_CONTROLS ) pObject->NbcSetLayer(SC_LAYER_CONTROLS); if (ScDrawLayer::IsCellAnchored(*pObject)) diff --git a/sc/source/ui/view/viewutil.cxx b/sc/source/ui/view/viewutil.cxx index 5747d0592e13..9bbaa7c6e13b 100644 --- a/sc/source/ui/view/viewutil.cxx +++ b/sc/source/ui/view/viewutil.cxx @@ -77,7 +77,7 @@ sal_uInt16 ScViewUtil::GetEffLanguage( ScDocument* pDoc, const ScAddress& rPos ) sal_uInt16 nWhich = ( nScript == SvtScriptType::ASIAN ) ? ATTR_CJK_FONT_LANGUAGE : ( ( nScript == SvtScriptType::COMPLEX ) ? ATTR_CTL_FONT_LANGUAGE : ATTR_FONT_LANGUAGE ); const SfxPoolItem* pItem = pDoc->GetAttr( rPos.Col(), rPos.Row(), rPos.Tab(), nWhich); - const SvxLanguageItem* pLangIt = PTR_CAST( SvxLanguageItem, pItem ); + const SvxLanguageItem* pLangIt = dynamic_cast<const SvxLanguageItem*>( pItem ); LanguageType eLnge; if (pLangIt) { diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx index 5c50be3365d8..16849adb32a3 100644 --- a/sd/source/core/drawdoc.cxx +++ b/sd/source/core/drawdoc.cxx @@ -761,7 +761,7 @@ void SdDrawDocument::NewOrLoadCompleted( SdPage* pPage, SdStyleSheetPool* pSPool } } - if (pObj->ISA(SdrTextObj) && pObj->IsEmptyPresObj()) + if( dynamic_cast< const SdrTextObj *>( pObj ) != nullptr && pObj->IsEmptyPresObj()) { PresObjKind ePresObjKind = pPage->GetPresObjKind(pObj); OUString aString( pPage->GetPresObjText(ePresObjKind) ); diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx index 4f08dd3c0fc1..dac47fe62954 100644 --- a/sd/source/core/drawdoc2.cxx +++ b/sd/source/core/drawdoc2.cxx @@ -981,7 +981,7 @@ IMapObject* SdDrawDocument::GetHitIMapObject( SdrObject* pObj, bool bObjSupported = false; // execute HitTest - if ( pObj->ISA( SdrGrafObj ) ) // simple graphics object + if ( dynamic_cast< const SdrGrafObj *>( pObj ) != nullptr ) // simple graphics object { const SdrGrafObj* pGrafObj = static_cast<const SdrGrafObj*>(pObj); const GeoStat& rGeo = pGrafObj->GetGeoStat(); @@ -1008,7 +1008,7 @@ IMapObject* SdDrawDocument::GetHitIMapObject( SdrObject* pObj, delete pGeoData; bObjSupported = true; } - else if ( pObj->ISA( SdrOle2Obj ) ) // OLE object + else if ( dynamic_cast<const SdrOle2Obj* >(pObj) != nullptr ) // OLE object { aGraphSize = static_cast<SdrOle2Obj*>( pObj )->GetOrigObjSize(); bObjSupported = true; diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx index 84aaae171ed7..d4fc04876dbd 100644 --- a/sd/source/core/drawdoc4.cxx +++ b/sd/source/core/drawdoc4.cxx @@ -833,7 +833,7 @@ IMPL_LINK_NOARG_TYPED(SdDrawDocument, OnlineSpellingHdl, Idle *, void) if (pObj) { - if (pObj->GetOutlinerParaObject() && pObj->ISA(SdrTextObj)) + if (pObj->GetOutlinerParaObject() && dynamic_cast< const SdrTextObj *>( pObj ) != nullptr) { // Spell text object SpellObject(static_cast<SdrTextObj*>(pObj)); @@ -849,7 +849,7 @@ IMPL_LINK_NOARG_TYPED(SdDrawDocument, OnlineSpellingHdl, Idle *, void) { SdrObject* pSubObj = aGroupIter.Next(); - if (pSubObj->GetOutlinerParaObject() && pSubObj->ISA(SdrTextObj)) + if (pSubObj->GetOutlinerParaObject() && dynamic_cast< SdrTextObj *>( pSubObj ) != nullptr) { // Found a text object in a group object SpellObject(static_cast<SdrTextObj*>(pSubObj)); @@ -975,7 +975,7 @@ void SdDrawDocument::ImpOnlineSpellCallback(SpellCallbackInfo* pInfo, SdrObject* // restart when add to dictionary takes place, too. || nCommand == SpellCallbackCommand::ADDTODICTIONARY) { - if(pObj && pOutl && pObj->ISA(SdrTextObj)) + if(pObj && pOutl && dynamic_cast< const SdrTextObj *>( pObj ) != nullptr) { bool bModified(IsChanged()); static_cast<SdrTextObj*>(pObj)->SetOutlinerParaObject(pOutl->CreateParaObject()); diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx index 9caab81a83bb..768e8aabd05a 100644 --- a/sd/source/core/sdpage.cxx +++ b/sd/source/core/sdpage.cxx @@ -407,7 +407,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const Rec InsertObject(pSdrObj); - if ( pSdrObj->ISA(SdrTextObj) ) + if ( dynamic_cast< const SdrTextObj *>( pSdrObj ) != nullptr ) { // Tell the object EARLY that it is vertical to have the // defaults for AutoGrowWidth/Height reversed @@ -454,7 +454,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const Rec } OUString aString = GetPresObjText(eObjKind); - if( (!aString.isEmpty() || bForceText) && pSdrObj->ISA(SdrTextObj) ) + if( (!aString.isEmpty() || bForceText) && dynamic_cast< const SdrTextObj *>( pSdrObj ) != nullptr ) { SdrOutliner* pOutliner = static_cast<SdDrawDocument*>( GetModel() )->GetInternalOutliner(); @@ -2023,7 +2023,7 @@ void SdPage::ScaleObjects(const Size& rNewPageSize, const Rectangle& rNewBorderR } else if ( eObjKind != OBJ_TITLETEXT && eObjKind != OBJ_OUTLINETEXT && - pObj->ISA(SdrTextObj) && + dynamic_cast< const SdrTextObj *>( pObj ) != nullptr && pObj->GetOutlinerParaObject() ) { /****************************************************** @@ -2316,7 +2316,7 @@ SdrObject* SdPage::InsertAutoLayoutShape(SdrObject* pObj, PresObjKind eObjKind, } } - if ( pObj && (pObj->GetUserCall() || bInit) && ( pObj->IsEmptyPresObj() || !pObj->ISA(SdrGrafObj) ) ) + if ( pObj && (pObj->GetUserCall() || bInit) && ( pObj->IsEmptyPresObj() || dynamic_cast< const SdrGrafObj *>( pObj ) == nullptr ) ) pObj->AdjustToMaxRect(rRect); return pObj; @@ -2380,7 +2380,7 @@ void SdPage::SetObjText(SdrTextObj* pObj, SdrOutliner* pOutliner, PresObjKind eO { if ( pObj ) { - DBG_ASSERT( pObj->ISA(SdrTextObj), "SetObjText: No SdrTextObj!" ); + DBG_ASSERT( dynamic_cast< const SdrTextObj *>( pObj ) != nullptr, "SetObjText: No SdrTextObj!" ); ::Outliner* pOutl = pOutliner; if (!pOutliner) diff --git a/sd/source/filter/eppt/eppt.cxx b/sd/source/filter/eppt/eppt.cxx index 50ac9395091d..6605755d0fb8 100644 --- a/sd/source/filter/eppt/eppt.cxx +++ b/sd/source/filter/eppt/eppt.cxx @@ -1273,7 +1273,7 @@ void PPTWriter::ImplWriteOLE( ) case NORMAL_OLE_OBJECT : { SdrObject* pSdrObj = GetSdrObjectFromXShape( pPtr->xShape ); - if ( pSdrObj && pSdrObj->ISA( SdrOle2Obj ) ) + if ( pSdrObj && dynamic_cast<const SdrOle2Obj* >(pSdrObj) != nullptr ) { ::uno::Reference < embed::XEmbeddedObject > xObj( static_cast<SdrOle2Obj*>(pSdrObj)->GetObjRef() ); if( xObj.is() ) diff --git a/sd/source/filter/grf/sdgrffilter.cxx b/sd/source/filter/grf/sdgrffilter.cxx index d20aceaba719..e0dfbb07e868 100644 --- a/sd/source/filter/grf/sdgrffilter.cxx +++ b/sd/source/filter/grf/sdgrffilter.cxx @@ -241,8 +241,7 @@ bool SdGRFFilter::Export() uno::Reference< drawing::XGraphicExportFilter > xExporter = drawing::GraphicExportFilter::create( xContext ); SdPage* pPage = NULL; - sd::DrawViewShell* pDrawViewShell = static_cast< ::sd::DrawViewShell* > - ( ( ( mrDocShell.GetViewShell() && mrDocShell.GetViewShell()->ISA(::sd::DrawViewShell ) ) ? mrDocShell.GetViewShell() : NULL ) ); + sd::DrawViewShell* pDrawViewShell = dynamic_cast<::sd::DrawViewShell* >(mrDocShell.GetViewShell() ); PageKind ePageKind = PK_STANDARD; if( pDrawViewShell ) diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx index 41fbc5dd68c3..8d82eb7595d1 100644 --- a/sd/source/filter/html/htmlex.cxx +++ b/sd/source/filter/html/htmlex.cxx @@ -1462,7 +1462,7 @@ OUString HtmlExport::TextAttribToHTMLString( SfxItemSet* pSet, HtmlState* pState const SvxFieldItem* pItem = static_cast<const SvxFieldItem*>(pSet->GetItem( EE_FEATURE_FIELD )); if(pItem) { - const SvxURLField* pURL = PTR_CAST(SvxURLField, pItem->GetField()); + const SvxURLField* pURL = dynamic_cast<const SvxURLField*>( pItem->GetField() ); if(pURL) { aLink = pURL->GetURL(); diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx index 7af03e59db47..ecefc2df9294 100644 --- a/sd/source/filter/ppt/pptin.cxx +++ b/sd/source/filter/ppt/pptin.cxx @@ -2395,7 +2395,7 @@ SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj } else if ( pTextObj->GetShapeType() == mso_sptPictureFrame ) { - if ( !pTextObj->Count() && pObj->ISA( SdrGrafObj ) ) + if ( !pTextObj->Count() && dynamic_cast< const SdrGrafObj *>( pObj ) != nullptr ) { bEmptyPresObj = false; switch ( nPlaceholderId ) @@ -2576,7 +2576,7 @@ SdrObject* ImplSdPPTImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi if ( pObj ) { // further setup placeholder objects - if( pObj->ISA(SdrPageObj) && pData ) + if( dynamic_cast< const SdrPageObj *>( pObj ) != nullptr && pData ) { const ProcessData* pProcessData=static_cast<const ProcessData*>(pData); if( pProcessData->pPage.page ) @@ -2623,7 +2623,7 @@ SdrObject* ImplSdPPTImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>(pObj); if( pTextObj && pTextObj->HasText() && - !pObj->ISA( SdrObjGroup ) && + dynamic_cast< SdrObjGroup *>( pObj ) == nullptr && pAnimation->HasAnimateAssociatedShape() ) { const SfxItemSet& rObjItemSet = pObj->GetMergedItemSet(); diff --git a/sd/source/filter/ppt/pptinanimations.cxx b/sd/source/filter/ppt/pptinanimations.cxx index 3b8199907edf..8d9907e3c610 100644 --- a/sd/source/filter/ppt/pptinanimations.cxx +++ b/sd/source/filter/ppt/pptinanimations.cxx @@ -2969,7 +2969,7 @@ sal_Int32 AnimationImporter::importTargetElementContainer( const Atom* pAtom, An case 8: rSubType = ShapeAnimationSubType::ONLY_TEXT; break; case 2: // one paragraph { - if( ((begin == -1) && (end == -1)) || !pSdrObject->ISA( SdrTextObj ) ) + if( ((begin == -1) && (end == -1)) || dynamic_cast< SdrTextObj *>( pSdrObject ) == nullptr ) break; SdrTextObj* pTextObj = static_cast< SdrTextObj* >( pSdrObject ); diff --git a/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx index afd26268d4fe..d10f3c415107 100644 --- a/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx +++ b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx @@ -739,7 +739,7 @@ uno::Any SAL_CALL AccessibleDocumentViewBase::getExtendedAttributes() uno::Any anyAtrribute; OUString sValue; - if (mpViewShell && mpViewShell->ISA(::sd::DrawViewShell)) + if (0 != dynamic_cast<const ::sd::DrawViewShell* > (mpViewShell)) { ::sd::DrawViewShell* pDrViewSh = static_cast< ::sd::DrawViewShell*>(mpViewShell); OUString sDisplay; @@ -796,7 +796,7 @@ uno::Any SAL_CALL AccessibleDocumentViewBase::getExtendedAttributes() sValue += ";"; } } - if (mpViewShell && mpViewShell->ISA(::sd::PresentationViewShell)) + if (dynamic_cast<const ::sd::PresentationViewShell* >(mpViewShell) != nullptr ) { ::sd::PresentationViewShell* pPresViewSh = static_cast< ::sd::PresentationViewShell*>(mpViewShell); SdPage* pCurrPge = pPresViewSh->getCurrentPage(); @@ -827,7 +827,7 @@ uno::Any SAL_CALL AccessibleDocumentViewBase::getExtendedAttributes() } } } - if (mpViewShell && mpViewShell->ISA(::sd::OutlineViewShell) ) + if (dynamic_cast<const ::sd::OutlineViewShell* >(mpViewShell ) != nullptr ) { OUString sName; OUString sDisplay; diff --git a/sd/source/ui/accessibility/AccessibleOutlineView.cxx b/sd/source/ui/accessibility/AccessibleOutlineView.cxx index f7f6477cb3dd..29e02ab72857 100644 --- a/sd/source/ui/accessibility/AccessibleOutlineView.cxx +++ b/sd/source/ui/accessibility/AccessibleOutlineView.cxx @@ -74,7 +74,7 @@ AccessibleOutlineView::AccessibleOutlineView ( { ::sd::View* pView = pViewShell->GetView(); - if (pView && pView->ISA(::sd::OutlineView)) + if (dynamic_cast<const ::sd::OutlineView* >( pView ) != nullptr) { OutlinerView* pOutlineView = static_cast< ::sd::OutlineView*>( pView)->GetViewByWindow( pSdWindow ); diff --git a/sd/source/ui/app/sdmod.cxx b/sd/source/ui/app/sdmod.cxx index d1c4e6f2a49d..7747cc76ca40 100644 --- a/sd/source/ui/app/sdmod.cxx +++ b/sd/source/ui/app/sdmod.cxx @@ -155,7 +155,7 @@ SdOptions* SdModule::GetSdOptions(DocumentType eDocType) { sal_uInt16 nMetric = pOptions->GetMetric(); - ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current() ); + ::sd::DrawDocShell* pDocSh = dynamic_cast< ::sd::DrawDocShell *>( SfxObjectShell::Current() ); SdDrawDocument* pDoc = NULL; if (pDocSh) pDoc = pDocSh->GetDoc(); @@ -175,7 +175,7 @@ SdOptions* SdModule::GetSdOptions(DocumentType eDocType) tools::SvRef<SotStorageStream> SdModule::GetOptionStream( const OUString& rOptionName, SdOptionStreamMode eMode ) { - ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current() ); + ::sd::DrawDocShell* pDocSh = dynamic_cast< ::sd::DrawDocShell *>( SfxObjectShell::Current() ); tools::SvRef<SotStorageStream> xStm; if( pDocSh ) diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx index 69599d9b7fa7..c8a376b5c402 100644 --- a/sd/source/ui/app/sdmod1.cxx +++ b/sd/source/ui/app/sdmod1.cxx @@ -111,7 +111,7 @@ void SdModule::Execute(SfxRequest& rReq) { bool bOnlineSpelling = static_cast<const SfxBoolItem*>( pItem )->GetValue(); // save at document: - ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current()); + ::sd::DrawDocShell* pDocSh = dynamic_cast< ::sd::DrawDocShell *>( SfxObjectShell::Current() ); if( pDocSh ) { SdDrawDocument* pDoc = pDocSh->GetDoc(); @@ -135,7 +135,7 @@ void SdModule::Execute(SfxRequest& rReq) case FUNIT_PICA: case FUNIT_POINT: { - ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current() ); + ::sd::DrawDocShell* pDocSh = dynamic_cast< ::sd::DrawDocShell *>( SfxObjectShell::Current() ); if(pDocSh) { DocumentType eDocType = pDocSh->GetDoc()->GetDocumentType(); @@ -170,7 +170,7 @@ void SdModule::Execute(SfxRequest& rReq) ) { // save at the document: - ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current()); + ::sd::DrawDocShell* pDocSh = dynamic_cast< ::sd::DrawDocShell *>( SfxObjectShell::Current() ); if ( pDocSh ) { LanguageType eLanguage = static_cast<const SvxLanguageItem*>(pItem)->GetValue(); @@ -208,7 +208,7 @@ void SdModule::Execute(SfxRequest& rReq) case SID_OPENDOC: { bool bIntercept = false; - ::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current()); + ::sd::DrawDocShell* pDocShell = dynamic_cast< ::sd::DrawDocShell *>( SfxObjectShell::Current() ); if (pDocShell) { ::sd::ViewShell* pViewShell = pDocShell->GetViewShell(); @@ -323,7 +323,7 @@ void SdModule::GetState(SfxItemSet& rItemSet) } else { - ::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current()); + ::sd::DrawDocShell* pDocShell = dynamic_cast< ::sd::DrawDocShell *>( SfxObjectShell::Current() ); if (pDocShell) { ::sd::ViewShell* pViewShell = pDocShell->GetViewShell(); @@ -340,7 +340,7 @@ void SdModule::GetState(SfxItemSet& rItemSet) if( SfxItemState::DEFAULT == rItemSet.GetItemState( SID_ATTR_METRIC ) ) { - ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current() ); + ::sd::DrawDocShell* pDocSh = dynamic_cast< ::sd::DrawDocShell *>( SfxObjectShell::Current() ); if(pDocSh) { DocumentType eDocType = pDocSh->GetDoc()->GetDocumentType(); @@ -369,7 +369,7 @@ void SdModule::GetState(SfxItemSet& rItemSet) if( SfxItemState::DEFAULT == rItemSet.GetItemState( SID_AUTOSPELL_CHECK ) ) { ::sd::DrawDocShell* pDocSh = - PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current()); + dynamic_cast< ::sd::DrawDocShell *>( SfxObjectShell::Current() ); if( pDocSh ) { SdDrawDocument* pDoc = pDocSh->GetDoc(); @@ -379,28 +379,28 @@ void SdModule::GetState(SfxItemSet& rItemSet) if( SfxItemState::DEFAULT == rItemSet.GetItemState( SID_ATTR_LANGUAGE ) ) { - ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current()); + ::sd::DrawDocShell* pDocSh = dynamic_cast< ::sd::DrawDocShell *>( SfxObjectShell::Current() ); if( pDocSh ) rItemSet.Put( SvxLanguageItem( pDocSh->GetDoc()->GetLanguage( EE_CHAR_LANGUAGE ), SID_ATTR_LANGUAGE ) ); } if( SfxItemState::DEFAULT == rItemSet.GetItemState( SID_ATTR_CHAR_CJK_LANGUAGE ) ) { - ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current()); + ::sd::DrawDocShell* pDocSh = dynamic_cast< ::sd::DrawDocShell *>( SfxObjectShell::Current() ); if( pDocSh ) rItemSet.Put( SvxLanguageItem( pDocSh->GetDoc()->GetLanguage( EE_CHAR_LANGUAGE_CJK ), SID_ATTR_CHAR_CJK_LANGUAGE ) ); } if( SfxItemState::DEFAULT == rItemSet.GetItemState( SID_ATTR_CHAR_CTL_LANGUAGE ) ) { - ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current()); + ::sd::DrawDocShell* pDocSh = dynamic_cast< ::sd::DrawDocShell *>( SfxObjectShell::Current() ); if( pDocSh ) rItemSet.Put( SvxLanguageItem( pDocSh->GetDoc()->GetLanguage( EE_CHAR_LANGUAGE_CTL ), SID_ATTR_CHAR_CTL_LANGUAGE ) ); } if ( !mbEventListenerAdded ) { - ::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current()); + ::sd::DrawDocShell* pDocShell = dynamic_cast< ::sd::DrawDocShell *>( SfxObjectShell::Current() ); if( pDocShell ) // Impress or Draw ? { ::sd::ViewShell* pViewShell = pDocShell->GetViewShell(); @@ -429,7 +429,7 @@ IMPL_STATIC_LINK_TYPED( SdModule, EventListenerHdl, VclSimpleEvent&, rSimpleEven { case MediaCommand::Play: { - ::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current()); + ::sd::DrawDocShell* pDocShell = dynamic_cast< ::sd::DrawDocShell *>( SfxObjectShell::Current() ); if( pDocShell ) // Impress or Draw ? { ::sd::ViewShell* pViewShell = pDocShell->GetViewShell(); @@ -591,7 +591,7 @@ SfxFrame* SdModule::ExecuteNewDocument( SfxRequest& rReq ) aSet.Put( aPassword ); const SfxPoolItem* pRet = SfxFrame::OpenDocumentSynchron( aSet, xTargetFrame ); - const SfxViewFrameItem* pFrameItem = PTR_CAST( SfxViewFrameItem, pRet ); + const SfxViewFrameItem* pFrameItem = dynamic_cast<const SfxViewFrameItem*>( pRet ); if ( pFrameItem && pFrameItem->GetFrame() ) pFrame = &pFrameItem->GetFrame()->GetFrame(); } @@ -610,7 +610,7 @@ SfxFrame* SdModule::ExecuteNewDocument( SfxRequest& rReq ) try { const SfxPoolItem* pRet = SfxGetpApp()->ExecuteSlot (aRequest); - const SfxViewFrameItem* pFrameItem = PTR_CAST( SfxViewFrameItem, pRet ); + const SfxViewFrameItem* pFrameItem = dynamic_cast<const SfxViewFrameItem*>( pRet ); if ( pFrameItem ) pFrame = &pFrameItem->GetFrame()->GetFrame(); } @@ -652,7 +652,7 @@ SfxFrame* SdModule::ExecuteNewDocument( SfxRequest& rReq ) SdDrawDocument* pDoc(NULL); if (pShell && pViewFrame) { - pDocShell = PTR_CAST(::sd::DrawDocShell, pShell); + pDocShell = dynamic_cast< ::sd::DrawDocShell *>( pShell ); pDoc = pDocShell ? pDocShell->GetDoc() : NULL; pBase = ::sd::ViewShellBase::GetViewShellBase(pViewFrame); } diff --git a/sd/source/ui/app/sdmod2.cxx b/sd/source/ui/app/sdmod2.cxx index 2b4866d680fa..873a99bfb10b 100644 --- a/sd/source/ui/app/sdmod2.cxx +++ b/sd/source/ui/app/sdmod2.cxx @@ -87,7 +87,7 @@ static SdPage* GetCurrentPage( sd::ViewShell* pViewSh, EditFieldInfo* pInfo, boo // first try to check if we are inside the outline view sd::OutlineView* pSdView = NULL; - if( pViewSh && pViewSh->ISA(sd::OutlineViewShell)) + if( dynamic_cast<const sd::OutlineViewShell* >(pViewSh) != nullptr ) pSdView = static_cast<sd::OutlineView*> (static_cast<sd::OutlineViewShell*>(pViewSh)->GetView()); if (pSdView != NULL && (pOutliner == &pSdView->GetOutliner())) @@ -218,7 +218,7 @@ IMPL_LINK_TYPED(SdModule, CalcFieldValueHdl, EditFieldInfo*, pInfo, void) ::sd::ViewShell* pViewSh = pDocShell ? pDocShell->GetViewShell() : NULL; if(pViewSh == NULL) { - ::sd::ViewShellBase* pBase = PTR_CAST(::sd::ViewShellBase, SfxViewShell::Current()); + ::sd::ViewShellBase* pBase = dynamic_cast< ::sd::ViewShellBase *>( SfxViewShell::Current() ); if(pBase) pViewSh = pBase->GetMainViewShell().get(); } @@ -255,7 +255,7 @@ IMPL_LINK_TYPED(SdModule, CalcFieldValueHdl, EditFieldInfo*, pInfo, void) ::sd::ViewShell* pViewSh = pDocShell ? pDocShell->GetViewShell() : NULL; if(pViewSh == NULL) { - ::sd::ViewShellBase* pBase = PTR_CAST(::sd::ViewShellBase, SfxViewShell::Current()); + ::sd::ViewShellBase* pBase = dynamic_cast< ::sd::ViewShellBase *>( SfxViewShell::Current() ); if(pBase) pViewSh = pBase->GetMainViewShell().get(); } @@ -285,7 +285,7 @@ IMPL_LINK_TYPED(SdModule, CalcFieldValueHdl, EditFieldInfo*, pInfo, void) ::sd::ViewShell* pViewSh = pDocShell ? pDocShell->GetViewShell() : NULL; if(pViewSh == NULL) { - ::sd::ViewShellBase* pBase = PTR_CAST(::sd::ViewShellBase, SfxViewShell::Current()); + ::sd::ViewShellBase* pBase = dynamic_cast< ::sd::ViewShellBase *>( SfxViewShell::Current() ); if(pBase) pViewSh = pBase->GetMainViewShell().get(); } @@ -409,7 +409,7 @@ IMPL_LINK_TYPED(SdModule, CalcFieldValueHdl, EditFieldInfo*, pInfo, void) SfxItemSet* SdModule::CreateItemSet( sal_uInt16 nSlot ) { ::sd::FrameView* pFrameView = NULL; - ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current() ); + ::sd::DrawDocShell* pDocSh = dynamic_cast< ::sd::DrawDocShell *>( SfxObjectShell::Current() ); SdDrawDocument* pDoc = NULL; // Here we set the DocType of the option dialog (not document!) @@ -536,7 +536,7 @@ void SdModule::ApplyItemSet( sal_uInt16 nSlot, const SfxItemSet& rSet ) bool bNewPrintOptions = false; bool bMiscOptions = false; - ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current() ); + ::sd::DrawDocShell* pDocSh = dynamic_cast< ::sd::DrawDocShell *>( SfxObjectShell::Current() ); SdDrawDocument* pDoc = NULL; // Here we set the DocType of the option dialog (not document!) DocumentType eDocType = DOCUMENT_TYPE_IMPRESS; diff --git a/sd/source/ui/app/sdpopup.cxx b/sd/source/ui/app/sdpopup.cxx index 526a338df8ca..071340202dd1 100644 --- a/sd/source/ui/app/sdpopup.cxx +++ b/sd/source/ui/app/sdpopup.cxx @@ -55,7 +55,7 @@ void SdFieldPopup::Fill( LanguageType eLanguage ) InsertItem( nID++, SD_RESSTR( STR_VAR ), nStyle ); InsertSeparator(); - if( pField->ISA( SvxDateField ) ) + if( dynamic_cast< const SvxDateField *>( pField ) != nullptr ) { const SvxDateField* pDateField = static_cast<const SvxDateField*>( pField ); SvxDateField aDateField( *pDateField ); @@ -87,7 +87,7 @@ void SdFieldPopup::Fill( LanguageType eLanguage ) CheckItem( (sal_uInt16) ( pDateField->GetFormat() ) + 1 ); // - 2 + 3 ! } - else if( pField->ISA( SvxExtTimeField ) ) + else if( dynamic_cast< const SvxExtTimeField *>( pField ) != nullptr ) { const SvxExtTimeField* pTimeField = static_cast<const SvxExtTimeField*>( pField ); SvxExtTimeField aTimeField( *pTimeField ); @@ -121,7 +121,7 @@ void SdFieldPopup::Fill( LanguageType eLanguage ) CheckItem( (sal_uInt16) ( pTimeField->GetFormat() ) + 1 ); // - 2 + 3 ! } - else if( pField->ISA( SvxExtFileField ) ) + else if( dynamic_cast< const SvxExtFileField *>( pField ) != nullptr ) { const SvxExtFileField* pFileField = static_cast<const SvxExtFileField*>(pField); //SvxExtFileField aFileField( *pFileField ); @@ -138,7 +138,7 @@ void SdFieldPopup::Fill( LanguageType eLanguage ) CheckItem( (sal_uInt16) ( pFileField->GetFormat() ) + 3 ); } - else if( pField->ISA( SvxAuthorField ) ) + else if( dynamic_cast< const SvxAuthorField *>( pField ) != nullptr ) { const SvxAuthorField* pAuthorField = static_cast<const SvxAuthorField*>(pField); SvxAuthorField aAuthorField( *pAuthorField ); @@ -166,7 +166,7 @@ SvxFieldData* SdFieldPopup::GetField() SvxFieldData* pNewField = NULL; sal_uInt16 nCount = GetItemCount(); - if( pField->ISA( SvxDateField ) ) + if( dynamic_cast< const SvxDateField *>( pField ) != nullptr ) { const SvxDateField* pDateField = static_cast<const SvxDateField*>(pField); SvxDateType eType; @@ -199,7 +199,7 @@ SvxFieldData* SdFieldPopup::GetField() } } } - else if( pField->ISA( SvxExtTimeField ) ) + else if( dynamic_cast< const SvxExtTimeField *>( pField ) != nullptr ) { const SvxExtTimeField* pTimeField = static_cast<const SvxExtTimeField*>(pField); SvxTimeType eType; @@ -233,7 +233,7 @@ SvxFieldData* SdFieldPopup::GetField() } } - else if( pField->ISA( SvxExtFileField ) ) + else if( dynamic_cast< const SvxExtFileField *>( pField ) != nullptr ) { const SvxExtFileField* pFileField = static_cast<const SvxExtFileField*>(pField); SvxFileType eType; @@ -255,8 +255,7 @@ SvxFieldData* SdFieldPopup::GetField() if( pFileField->GetFormat() != eFormat || pFileField->GetType() != eType ) { - ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, - SfxObjectShell::Current() ); + ::sd::DrawDocShell* pDocSh = dynamic_cast<::sd::DrawDocShell* >( SfxObjectShell::Current() ); if( pDocSh ) { @@ -273,7 +272,7 @@ SvxFieldData* SdFieldPopup::GetField() } } } - else if( pField->ISA( SvxAuthorField ) ) + else if( dynamic_cast< const SvxAuthorField *>( pField ) != nullptr ) { const SvxAuthorField* pAuthorField = static_cast<const SvxAuthorField*>(pField); SvxAuthorType eType; diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx index f82d9da4d72d..06c80790ff3f 100644 --- a/sd/source/ui/app/sdxfer.cxx +++ b/sd/source/ui/app/sdxfer.cxx @@ -157,7 +157,7 @@ void SdTransferable::CreateObjectReplacement( SdrObject* pObj ) delete mpBookmark, mpBookmark = NULL; delete mpImageMap, mpImageMap = NULL; - if( pObj->ISA( SdrOle2Obj ) ) + if( 0!= dynamic_cast< const SdrOle2Obj* >( pObj ) ) { try { @@ -177,7 +177,7 @@ void SdTransferable::CreateObjectReplacement( SdrObject* pObj ) catch( uno::Exception& ) {} } - else if( pObj->ISA( SdrGrafObj ) && (mpSourceDoc && !mpSourceDoc->GetAnimationInfo( pObj )) ) + else if( dynamic_cast< const SdrGrafObj *>( pObj ) != nullptr && (mpSourceDoc && !mpSourceDoc->GetAnimationInfo( pObj )) ) { mpGraphic = new Graphic( static_cast< SdrGrafObj* >( pObj )->GetTransformedGraphic() ); } @@ -211,7 +211,7 @@ void SdTransferable::CreateObjectReplacement( SdrObject* pObj ) } } } - else if( pObj->ISA( SdrTextObj ) ) + else if( dynamic_cast< const SdrTextObj *>( pObj ) != nullptr ) { const OutlinerParaObject* pPara; @@ -223,7 +223,7 @@ void SdTransferable::CreateObjectReplacement( SdrObject* pObj ) { const SvxFieldData* pData = pField->GetField(); - if( pData && pData->ISA( SvxURLField ) ) + if( pData && dynamic_cast< const SvxURLField *>( pData ) != nullptr ) { const SvxURLField* pURL = static_cast<const SvxURLField*>(pData); @@ -357,7 +357,7 @@ static bool lcl_HasOnlyControls( SdrModel* pModel ) bOnlyControls = true; // only set if there are any objects at all while ( pObj ) { - if (!pObj->ISA(SdrUnoObj)) + if (dynamic_cast< const SdrUnoObj *>( pObj ) == nullptr) { bOnlyControls = false; break; diff --git a/sd/source/ui/app/tmplctrl.cxx b/sd/source/ui/app/tmplctrl.cxx index 4e3ca3394fc2..fc4a6560fe68 100644 --- a/sd/source/ui/app/tmplctrl.cxx +++ b/sd/source/ui/app/tmplctrl.cxx @@ -76,9 +76,9 @@ SdTemplateControl::~SdTemplateControl() void SdTemplateControl::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 ) { msTemplate = static_cast<const SfxStringItem*>(pState)->GetValue(); GetStatusBar().SetItemText( GetId(), msTemplate ); diff --git a/sd/source/ui/dlg/LayerTabBar.cxx b/sd/source/ui/dlg/LayerTabBar.cxx index 4e47bbc81121..e1127c3a0fb7 100644 --- a/sd/source/ui/dlg/LayerTabBar.cxx +++ b/sd/source/ui/dlg/LayerTabBar.cxx @@ -234,7 +234,7 @@ void LayerTabBar::EndRenaming() if( !IsEditModeCanceled() ) { ::sd::View* pView = pDrViewSh->GetView(); - DrawView* pDrView = PTR_CAST( DrawView, pView ); + DrawView* pDrView = dynamic_cast<DrawView*>( pView ); SdDrawDocument& rDoc = pView->GetDoc(); OUString aLayerName = pView->GetActiveLayer(); diff --git a/sd/source/ui/dlg/SpellDialogChildWindow.cxx b/sd/source/ui/dlg/SpellDialogChildWindow.cxx index 574ba97eb773..dbf9c9d8584d 100644 --- a/sd/source/ui/dlg/SpellDialogChildWindow.cxx +++ b/sd/source/ui/dlg/SpellDialogChildWindow.cxx @@ -105,7 +105,7 @@ void SpellDialogChildWindow::LoseFocus() void SpellDialogChildWindow::ProvideOutliner() { - ViewShellBase* pViewShellBase = PTR_CAST (ViewShellBase, SfxViewShell::Current()); + ViewShellBase* pViewShellBase = dynamic_cast<ViewShellBase*>( SfxViewShell::Current() ); if (pViewShellBase != NULL) { @@ -113,8 +113,8 @@ void SpellDialogChildWindow::ProvideOutliner() // If there already exists an outliner that has been created // for another view shell then destroy it first. if (mpSdOutliner != NULL) - if ((pViewShell->ISA(DrawViewShell) && ! mbOwnOutliner) - || (pViewShell->ISA(OutlineViewShell) && mbOwnOutliner)) + if(( dynamic_cast< const DrawViewShell *>( pViewShell ) != nullptr && ! mbOwnOutliner) + || (dynamic_cast< const OutlineViewShell *>( pViewShell ) != nullptr && mbOwnOutliner)) { mpSdOutliner->EndSpelling(); if (mbOwnOutliner) @@ -125,7 +125,7 @@ void SpellDialogChildWindow::ProvideOutliner() // Now create/get an outliner if none is present. if (mpSdOutliner == NULL) { - if (pViewShell->ISA(DrawViewShell)) + if( dynamic_cast< const DrawViewShell *>( pViewShell ) != nullptr) { // We need an outliner for the spell check so we have // to create one. @@ -134,7 +134,7 @@ void SpellDialogChildWindow::ProvideOutliner() pViewShell->GetDoc(), OUTLINERMODE_TEXTOBJECT); } - else if (pViewShell->ISA(OutlineViewShell)) + else if( dynamic_cast< const OutlineViewShell *>( pViewShell ) != nullptr) { // An outline view is already visible. The SdOutliner // will use it instead of creating its own. diff --git a/sd/source/ui/dlg/animobjs.cxx b/sd/source/ui/dlg/animobjs.cxx index 8e3989c42acd..4535372b81e6 100644 --- a/sd/source/ui/dlg/animobjs.cxx +++ b/sd/source/ui/dlg/animobjs.cxx @@ -1147,7 +1147,7 @@ void AnimationControllerItem::StateChanged( sal_uInt16 nSId, { if( eState >= SfxItemState::DEFAULT && nSId == SID_ANIMATOR_STATE ) { - const SfxUInt16Item* pStateItem = PTR_CAST( SfxUInt16Item, pItem ); + const SfxUInt16Item* pStateItem = dynamic_cast< const SfxUInt16Item*>( pItem ); assert(pStateItem); //SfxUInt16Item expected if (pStateItem) { diff --git a/sd/source/ui/dlg/dlgass.cxx b/sd/source/ui/dlg/dlgass.cxx index 82a83a630e67..c0fc28a8a63c 100644 --- a/sd/source/ui/dlg/dlgass.cxx +++ b/sd/source/ui/dlg/dlgass.cxx @@ -941,7 +941,7 @@ SfxObjectShellLock AssistentDlgImpl::GetDocument() UpdatePageList(); SfxObjectShell* pShell = xDocShell; - ::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell,pShell); + ::sd::DrawDocShell* pDocShell = dynamic_cast< ::sd::DrawDocShell *>( pShell ); SdDrawDocument* pDoc = pDocShell?pDocShell->GetDoc():NULL; if(pDoc) @@ -1309,7 +1309,7 @@ void AssistentDlgImpl::UpdateUserData() OUString aInfo = mpPage4AskInfoEDT->GetText(); SfxObjectShell* pShell = xDocShell; - DrawDocShell* pDocShell = PTR_CAST(DrawDocShell,pShell); + DrawDocShell* pDocShell = dynamic_cast< DrawDocShell *>( pShell ); SdDrawDocument* pDoc = pDocShell?pDocShell->GetDoc():NULL; SdPage* pPage = pDoc?pDoc->GetSdPage(0, PK_STANDARD):NULL; @@ -1372,7 +1372,7 @@ void AssistentDlgImpl::UpdatePageList() maPageListFile = maDocFile; SfxObjectShell* pShell = xDocShell; - DrawDocShell* pDocShell = PTR_CAST(DrawDocShell,pShell); + DrawDocShell* pDocShell = dynamic_cast< DrawDocShell *>( pShell ); SdDrawDocument* pDoc = pDocShell?pDocShell->GetDoc():NULL; mpPage5PageListCT->Clear(); @@ -1431,7 +1431,7 @@ void AssistentDlgImpl::UpdatePreview( bool bDocPreview ) if( aLayoutFile != maLayoutFile ) { SfxObjectShell* pShell = xDocShell; - DrawDocShell* pDocShell = PTR_CAST(DrawDocShell,pShell); + DrawDocShell* pDocShell = dynamic_cast< DrawDocShell *>( pShell ); ::svl::IUndoManager* pUndoMgr = pDocShell?pDocShell->GetUndoManager():NULL; if(pUndoMgr) pUndoMgr->Undo(); @@ -1470,7 +1470,7 @@ void AssistentDlgImpl::UpdatePreview( bool bDocPreview ) aReq.AppendItem( SfxBoolItem( SID_HIDDEN, true ) ); aReq.AppendItem( SfxBoolItem( SID_PREVIEW, bDocPreview ) ); - const SfxViewFrameItem* pRet = PTR_CAST( SfxViewFrameItem, SfxGetpApp()->ExecuteSlot( aReq ) ); + const SfxViewFrameItem* pRet = dynamic_cast<const SfxViewFrameItem*>( SfxGetpApp()->ExecuteSlot( aReq ) ); if ( pRet && pRet->GetFrame() && pRet->GetFrame()->GetObjectShell() ) xDocShell = pRet->GetFrame()->GetObjectShell(); @@ -1509,11 +1509,11 @@ void AssistentDlgImpl::UpdatePreview( bool bDocPreview ) // determine the implementation SfxObjectShell* pShell = xDocShell; - DrawDocShell* pDocShell = PTR_CAST(DrawDocShell,pShell); + DrawDocShell* pDocShell = dynamic_cast< DrawDocShell *>( pShell ); SdDrawDocument* pDoc = pDocShell?pDocShell->GetDoc():NULL; pShell = xLayoutDocShell; - pDocShell = PTR_CAST(DrawDocShell,pShell); + pDocShell = dynamic_cast< DrawDocShell *>( pShell ); SdDrawDocument* pLayoutDoc = pDocShell?pDocShell->GetDoc():NULL; if( pDoc && pLayoutDoc ) diff --git a/sd/source/ui/dlg/dlgfield.cxx b/sd/source/ui/dlg/dlgfield.cxx index cbd3265cb242..f2c6359569a6 100644 --- a/sd/source/ui/dlg/dlgfield.cxx +++ b/sd/source/ui/dlg/dlgfield.cxx @@ -80,7 +80,7 @@ SvxFieldData* SdModifyFieldDlg::GetField() m_pRbtVar->IsValueChangedFromSaved() || m_pLbFormat->IsValueChangedFromSaved() ) { - if( pField->ISA( SvxDateField ) ) + if( dynamic_cast< const SvxDateField *>( pField ) != nullptr ) { const SvxDateField* pDateField = static_cast<const SvxDateField*>(pField); SvxDateType eType; @@ -97,7 +97,7 @@ SvxFieldData* SdModifyFieldDlg::GetField() static_cast<SvxDateField*>( pNewField )->SetType( eType ); static_cast<SvxDateField*>( pNewField )->SetFormat( eFormat ); } - else if( pField->ISA( SvxExtTimeField ) ) + else if( dynamic_cast< const SvxExtTimeField *>( pField ) != nullptr ) { const SvxExtTimeField* pTimeField = static_cast<const SvxExtTimeField*>( pField ); SvxTimeType eType; @@ -114,7 +114,7 @@ SvxFieldData* SdModifyFieldDlg::GetField() static_cast<SvxExtTimeField*>( pNewField )->SetType( eType ); static_cast<SvxExtTimeField*>( pNewField )->SetFormat( eFormat ); } - else if( pField->ISA( SvxExtFileField ) ) + else if( dynamic_cast< const SvxExtFileField *>( pField ) != nullptr ) { const SvxExtFileField* pFileField = static_cast<const SvxExtFileField*>( pField ); SvxFileType eType; @@ -127,8 +127,7 @@ SvxFieldData* SdModifyFieldDlg::GetField() eFormat = (SvxFileFormat) ( m_pLbFormat->GetSelectEntryPos() ); - ::sd::DrawDocShell* pDocSh = PTR_CAST( ::sd::DrawDocShell, - SfxObjectShell::Current() ); + ::sd::DrawDocShell* pDocSh = dynamic_cast< ::sd::DrawDocShell* >(SfxObjectShell::Current() ); if( pDocSh ) { @@ -144,7 +143,7 @@ SvxFieldData* SdModifyFieldDlg::GetField() static_cast<SvxExtFileField*>( pNewField )->SetFormat( eFormat ); } } - else if( pField->ISA( SvxAuthorField ) ) + else if( dynamic_cast< const SvxAuthorField *>( pField ) != nullptr ) { SvxAuthorType eType; SvxAuthorFormat eFormat; @@ -173,7 +172,7 @@ void SdModifyFieldDlg::FillFormatList() m_pLbFormat->Clear(); - if( pField->ISA( SvxDateField ) ) + if( dynamic_cast< const SvxDateField *>( pField ) != nullptr ) { const SvxDateField* pDateField = static_cast<const SvxDateField*>( pField ); SvxDateField aDateField( *pDateField ); @@ -199,7 +198,7 @@ void SdModifyFieldDlg::FillFormatList() m_pLbFormat->SelectEntryPos( (sal_uInt16) ( pDateField->GetFormat() - 2 ) ); } - else if( pField->ISA( SvxExtTimeField ) ) + else if( dynamic_cast< const SvxExtTimeField *>( pField ) != nullptr ) { const SvxExtTimeField* pTimeField = static_cast<const SvxExtTimeField*>( pField ); SvxExtTimeField aTimeField( *pTimeField ); @@ -227,7 +226,7 @@ void SdModifyFieldDlg::FillFormatList() m_pLbFormat->SelectEntryPos( (sal_uInt16) ( pTimeField->GetFormat() - 2 ) ); } - else if( pField->ISA( SvxExtFileField ) ) + else if( dynamic_cast< const SvxExtFileField *>( pField ) != nullptr ) { const SvxExtFileField* pFileField = static_cast<const SvxExtFileField*>( pField ); SvxExtFileField aFileField( *pFileField ); @@ -239,7 +238,7 @@ void SdModifyFieldDlg::FillFormatList() m_pLbFormat->SelectEntryPos( (sal_uInt16) ( pFileField->GetFormat() ) ); } - else if( pField->ISA( SvxAuthorField ) ) + else if( dynamic_cast< const SvxAuthorField *>( pField ) != nullptr ) { const SvxAuthorField* pAuthorField = static_cast<const SvxAuthorField*>( pField ); SvxAuthorField aAuthorField( *pAuthorField ); @@ -260,7 +259,7 @@ void SdModifyFieldDlg::FillControls() { m_pLbFormat->Clear(); - if( pField->ISA( SvxDateField ) ) + if( dynamic_cast< const SvxDateField *>( pField ) != nullptr ) { const SvxDateField* pDateField = static_cast<const SvxDateField*>(pField); SvxDateField aDateField( *pDateField ); @@ -270,7 +269,7 @@ void SdModifyFieldDlg::FillControls() else m_pRbtVar->Check(); } - else if( pField->ISA( SvxExtTimeField ) ) + else if( dynamic_cast< const SvxExtTimeField *>( pField ) != nullptr ) { const SvxExtTimeField* pTimeField = static_cast<const SvxExtTimeField*>(pField); SvxExtTimeField aTimeField( *pTimeField ); @@ -280,7 +279,7 @@ void SdModifyFieldDlg::FillControls() else m_pRbtVar->Check(); } - else if( pField->ISA( SvxExtFileField ) ) + else if( dynamic_cast< const SvxExtFileField *>( pField ) != nullptr ) { const SvxExtFileField* pFileField = static_cast<const SvxExtFileField*>(pField); SvxExtFileField aFileField( *pFileField ); @@ -290,7 +289,7 @@ void SdModifyFieldDlg::FillControls() else m_pRbtVar->Check(); } - else if( pField->ISA( SvxAuthorField ) ) + else if( dynamic_cast< const SvxAuthorField *>( pField ) != nullptr ) { const SvxAuthorField* pAuthorField = static_cast<const SvxAuthorField*>(pField); SvxAuthorField aAuthorField( *pAuthorField ); diff --git a/sd/source/ui/dlg/docprev.cxx b/sd/source/ui/dlg/docprev.cxx index 688f578a831e..7540fa7a1946 100644 --- a/sd/source/ui/dlg/docprev.cxx +++ b/sd/source/ui/dlg/docprev.cxx @@ -214,7 +214,7 @@ bool SdDocPreviewWin::Notify( NotifyEvent& rNEvt ) void SdDocPreviewWin::updateViewSettings() { - ::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell,mpObj); + ::sd::DrawDocShell* pDocShell = dynamic_cast< ::sd::DrawDocShell *>( mpObj ); SdDrawDocument* pDoc = pDocShell?pDocShell->GetDoc():NULL; SvtAccessibilityOptions aAccOptions; diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx b/sd/source/ui/dlg/headerfooterdlg.cxx index 8b22fd2d6bd4..1276126cb055 100644 --- a/sd/source/ui/dlg/headerfooterdlg.cxx +++ b/sd/source/ui/dlg/headerfooterdlg.cxx @@ -651,7 +651,7 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType &rLanguage, boo if( aFieldInfo.pFieldItem ) { const SvxFieldData* pFieldData = aFieldInfo.pFieldItem->GetField(); - if( pFieldData && (pFieldData->ISA( SvxDateTimeField ) || pFieldData->ISA( SvxDateField )) ) + if( pFieldData && ( dynamic_cast< const SvxDateTimeField *>( pFieldData ) != nullptr || dynamic_cast< const SvxDateField *>( pFieldData ) != nullptr)) { break; } diff --git a/sd/source/ui/dlg/navigatr.cxx b/sd/source/ui/dlg/navigatr.cxx index bfd0e6cbc359..644250429ca9 100644 --- a/sd/source/ui/dlg/navigatr.cxx +++ b/sd/source/ui/dlg/navigatr.cxx @@ -694,11 +694,11 @@ void SdNavigatorWin::RefreshDocumentLB( const OUString* pDocName ) maLbDocs->InsertEntry( aStr, 0 ); ::sd::DrawDocShell* pCurrentDocShell = - PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current() ); - SfxObjectShell* pSfxDocShell = SfxObjectShell::GetFirst(0, false); + dynamic_cast< ::sd::DrawDocShell *>( SfxObjectShell::Current() ); + SfxObjectShell* pSfxDocShell = SfxObjectShell::GetFirst([](const SfxObjectShell*){return true;}, false); while( pSfxDocShell ) { - ::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell, pSfxDocShell ); + ::sd::DrawDocShell* pDocShell = dynamic_cast< ::sd::DrawDocShell *>( pSfxDocShell ); if( pDocShell && !pDocShell->IsInDestruction() && ( pDocShell->GetCreateMode() != SfxObjectCreateMode::EMBEDDED ) ) { NavDocInfo aInfo ; @@ -724,7 +724,7 @@ void SdNavigatorWin::RefreshDocumentLB( const OUString* pDocName ) maDocList.push_back( aInfo ); } - pSfxDocShell = SfxObjectShell::GetNext( *pSfxDocShell, 0, false ); + pSfxDocShell = SfxObjectShell::GetNext( *pSfxDocShell, [](const SfxObjectShell*){return true;}, false ); } } maLbDocs->SelectEntryPos( nPos ); @@ -873,7 +873,7 @@ void SdNavigatorControllerItem::StateChanged( sal_uInt16 nSId, { if( eState >= SfxItemState::DEFAULT && nSId == SID_NAVIGATOR_STATE ) { - const SfxUInt32Item* pStateItem = PTR_CAST( SfxUInt32Item, pItem ); + const SfxUInt32Item* pStateItem = dynamic_cast< const SfxUInt32Item* >( pItem ); DBG_ASSERT( pStateItem, "SfxUInt16Item expected"); sal_uInt32 nState = pStateItem->GetValue(); @@ -957,7 +957,7 @@ void SdPageNameControllerItem::StateChanged( sal_uInt16 nSId, NavDocInfo* pInfo = pNavigatorWin->GetDocInfo(); if( pInfo && pInfo->IsActive() ) { - const SfxStringItem* pStateItem = PTR_CAST( SfxStringItem, pItem ); + const SfxStringItem* pStateItem = dynamic_cast<const SfxStringItem*>( pItem ); DBG_ASSERT( pStateItem, "SfxStringItem expected"); OUString aPageName = pStateItem->GetValue(); diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx index 042d38e0a45b..fafaafe8eedd 100644 --- a/sd/source/ui/dlg/sdtreelb.cxx +++ b/sd/source/ui/dlg/sdtreelb.cxx @@ -421,7 +421,7 @@ OUString SdPageObjsTLB::GetObjectName( { aRet = pObject->GetName(); - if (aRet.isEmpty() && pObject->ISA(SdrOle2Obj)) + if (aRet.isEmpty() && dynamic_cast<const SdrOle2Obj* >(pObject) != nullptr) aRet = static_cast< const SdrOle2Obj* >( pObject )->GetPersistName(); } diff --git a/sd/source/ui/docshell/docshel3.cxx b/sd/source/ui/docshell/docshel3.cxx index 9e5b3ab66208..91f347d1a2e5 100644 --- a/sd/source/ui/docshell/docshel3.cxx +++ b/sd/source/ui/docshell/docshel3.cxx @@ -174,7 +174,7 @@ void DrawDocShell::Execute( SfxRequest& rReq ) while (pShell) { - if (pShell->ISA(DrawDocShell)) + if( dynamic_cast< const DrawDocShell *>( pShell ) != nullptr) { static_cast<DrawDocShell*>(pShell)->CancelSearching(); } diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx index e80bb8952eeb..fd6e879a8609 100644 --- a/sd/source/ui/docshell/docshel4.cxx +++ b/sd/source/ui/docshell/docshel4.cxx @@ -187,7 +187,7 @@ void DrawDocShell::OnDocumentPrinterChanged(Printer* pNewPrinter) return; } - // if (mpPrinter->IsA(SfxPrinter)) + // if 0 != dynamic_cast< SfxPrinter *>( (mpPrinter )) { // Since we do not have RTTI we use a hard cast (...) SetPrinter(static_cast<SfxPrinter*>(pNewPrinter)); @@ -635,7 +635,7 @@ bool DrawDocShell::SaveCompleted( const ::com::sun::star::uno::Reference< ::com: if( mpViewShell ) { - if( mpViewShell->ISA( OutlineViewShell ) ) + if( dynamic_cast< OutlineViewShell *>( mpViewShell ) != nullptr ) static_cast<OutlineView*>(mpViewShell->GetView()) ->GetOutliner().ClearModifyFlag(); @@ -671,7 +671,7 @@ bool DrawDocShell::GotoBookmark(const OUString& rBookmark) { bool bFound = false; - if (mpViewShell && mpViewShell->ISA(DrawViewShell)) + if (mpViewShell && dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr) { DrawViewShell* pDrawViewShell = static_cast<DrawViewShell*>(mpViewShell); ViewShellBase& rBase (mpViewShell->GetViewShellBase()); @@ -837,7 +837,7 @@ bool DrawDocShell::IsMarked( SdrObject* pObject ) { bool bisMarked =false; - if (mpViewShell && mpViewShell->ISA(DrawViewShell)) + if (mpViewShell && dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr) { DrawViewShell* pDrViewSh = static_cast<DrawViewShell*>( mpViewShell ); if (pObject ) @@ -855,7 +855,7 @@ bool DrawDocShell::GetObjectIsmarked(const OUString& rBookmark) OUStringToOString(rBookmark, RTL_TEXTENCODING_UTF8).getStr()); bool bUnMark = false; - if (mpViewShell && mpViewShell->ISA(DrawViewShell)) + if (mpViewShell && dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr) { DrawViewShell* pDrViewSh = static_cast<DrawViewShell*>( mpViewShell ); @@ -936,7 +936,7 @@ bool DrawDocShell::GotoTreeBookmark(const OUString& rBookmark) OUStringToOString(rBookmark, RTL_TEXTENCODING_UTF8).getStr()); bool bFound = false; - if (mpViewShell && mpViewShell->ISA(DrawViewShell)) + if (mpViewShell && dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr) { DrawViewShell* pDrViewSh = static_cast<DrawViewShell*>( mpViewShell ); @@ -1133,7 +1133,7 @@ void DrawDocShell::OpenBookmark( const OUString& rBookmarkURL ) VclPtr<SfxDocumentInfoDialog> DrawDocShell::CreateDocumentInfoDialog( vcl::Window *pParent, const SfxItemSet &rSet ) { VclPtr<SfxDocumentInfoDialog> pDlg = VclPtr<SfxDocumentInfoDialog>::Create( pParent, rSet ); - DrawDocShell* pDocSh = PTR_CAST(DrawDocShell,SfxObjectShell::Current()); + DrawDocShell* pDocSh = dynamic_cast< DrawDocShell *>( SfxObjectShell::Current() ); if( pDocSh == this ) { diff --git a/sd/source/ui/docshell/docshell.cxx b/sd/source/ui/docshell/docshell.cxx index 5be6ef9b0258..7b252ff9268c 100644 --- a/sd/source/ui/docshell/docshell.cxx +++ b/sd/source/ui/docshell/docshell.cxx @@ -300,8 +300,7 @@ void DrawDocShell::InPlaceActivate( bool bActive ) { // determine the number of FrameViews SfxViewShell* pSfxViewSh = pSfxViewFrame->GetViewShell(); - // FIXME this used to be a PTR_CAST, but when I updated the macro, I discovered that SfxViewShell is not statically castable to sd::ViewShell - ViewShell* pViewSh = (pSfxViewSh && pSfxViewSh->IsA( TYPE(ViewShell) )) ? dynamic_cast<ViewShell*>(pSfxViewSh) : 0; + ViewShell* pViewSh = dynamic_cast<ViewShell*>(pSfxViewSh); if ( pViewSh && pViewSh->GetFrameView() ) { @@ -321,8 +320,7 @@ void DrawDocShell::InPlaceActivate( bool bActive ) { // determine the number of FrameViews SfxViewShell* pSfxViewSh = pSfxViewFrame->GetViewShell(); - // FIXME this used to be a PTR_CAST, but when I updated the macro, I discovered that SfxViewShell is not statically castable to sd::ViewShell - ViewShell* pViewSh = (pSfxViewSh && pSfxViewSh->IsA( TYPE(ViewShell) )) ? dynamic_cast<ViewShell*>(pSfxViewSh) : 0; + ViewShell* pViewSh = dynamic_cast<ViewShell*>(pSfxViewSh); if ( pViewSh ) { diff --git a/sd/source/ui/func/fubullet.cxx b/sd/source/ui/func/fubullet.cxx index cc989a3efd9a..461749f55bd0 100644 --- a/sd/source/ui/func/fubullet.cxx +++ b/sd/source/ui/func/fubullet.cxx @@ -103,13 +103,13 @@ void FuBullet::InsertFormattingMark( sal_Unicode cMark ) ::Outliner* pOL = NULL; // depending on ViewShell set Outliner and OutlinerView - if (mpViewShell->ISA(DrawViewShell)) + if( dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr) { pOV = mpView->GetTextEditOutlinerView(); if (pOV) pOL = mpView->GetTextEditOutliner(); } - else if (mpViewShell->ISA(OutlineViewShell)) + else if( dynamic_cast< const OutlineViewShell *>( mpViewShell ) != nullptr) { pOL = &static_cast<OutlineView*>(mpView)->GetOutliner(); pOV = static_cast<OutlineView*>(mpView)->GetViewByWindow( @@ -162,7 +162,7 @@ void FuBullet::InsertSpecialCharacter( SfxRequest& rReq ) aChars = static_cast<const SfxStringItem*>(pItem)->GetValue(); const SfxPoolItem* pFtItem = NULL; pArgs->GetItemState( mpDoc->GetPool().GetWhich(SID_ATTR_SPECIALCHAR), false, &pFtItem); - const SfxStringItem* pFontItem = PTR_CAST( SfxStringItem, pFtItem ); + const SfxStringItem* pFontItem = dynamic_cast<const SfxStringItem*>( pFtItem ); if ( pFontItem ) { OUString aFontName = pFontItem->GetValue(); @@ -223,7 +223,7 @@ void FuBullet::InsertSpecialCharacter( SfxRequest& rReq ) ::Outliner* pOL = NULL; // determine depending on ViewShell Outliner and OutlinerView - if(mpViewShell && mpViewShell->ISA(DrawViewShell)) + if(mpViewShell && dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr) { pOV = mpView->GetTextEditOutlinerView(); if (pOV) @@ -231,7 +231,7 @@ void FuBullet::InsertSpecialCharacter( SfxRequest& rReq ) pOL = mpView->GetTextEditOutliner(); } } - else if(mpViewShell && mpViewShell->ISA(OutlineViewShell)) + else if(mpViewShell && dynamic_cast< const OutlineViewShell *>( mpViewShell ) != nullptr) { pOL = &static_cast<OutlineView*>(mpView)->GetOutliner(); pOV = static_cast<OutlineView*>(mpView)->GetViewByWindow( diff --git a/sd/source/ui/func/fuconarc.cxx b/sd/source/ui/func/fuconarc.cxx index d6b887010c94..4abbc7686071 100644 --- a/sd/source/ui/func/fuconarc.cxx +++ b/sd/source/ui/func/fuconarc.cxx @@ -227,7 +227,7 @@ SdrObject* FuConstructArc::CreateDefaultObject(const sal_uInt16 nID, const Recta if(pObj) { - if(pObj->ISA(SdrCircObj)) + if( dynamic_cast< const SdrCircObj *>( pObj ) != nullptr) { Rectangle aRect(rRectangle); diff --git a/sd/source/ui/func/fuconbez.cxx b/sd/source/ui/func/fuconbez.cxx index 8be8252b39cc..3fda2e13d3b5 100644 --- a/sd/source/ui/func/fuconbez.cxx +++ b/sd/source/ui/func/fuconbez.cxx @@ -329,7 +329,7 @@ SdrObject* FuConstructBezierPolygon::CreateDefaultObject(const sal_uInt16 nID, c if(pObj) { - if(pObj->ISA(SdrPathObj)) + if( dynamic_cast< const SdrPathObj *>( pObj ) != nullptr) { basegfx::B2DPolyPolygon aPoly; diff --git a/sd/source/ui/func/fuconrec.cxx b/sd/source/ui/func/fuconrec.cxx index 8d5ec3893d67..25f9548be7b3 100644 --- a/sd/source/ui/func/fuconrec.cxx +++ b/sd/source/ui/func/fuconrec.cxx @@ -239,7 +239,7 @@ bool FuConstructRectangle::MouseButtonUp(const MouseEvent& rMEvt) } // init text position when vertical caption object is created - if(pObj->ISA(SdrCaptionObj) && SID_DRAW_CAPTION_VERTICAL == nSlotId) + if( dynamic_cast< const SdrCaptionObj *>( pObj ) != nullptr && SID_DRAW_CAPTION_VERTICAL == nSlotId) { // draw text object, needs to be initialized when vertical text is used SfxItemSet aSet(pObj->GetMergedItemSet()); @@ -815,7 +815,7 @@ SdrObject* FuConstructRectangle::CreateDefaultObject(const sal_uInt16 nID, const case SID_LINE_ARROW_SQUARE: case SID_LINE_SQUARE_ARROW: { - if(pObj->ISA(SdrPathObj)) + if( dynamic_cast< const SdrPathObj *>( pObj ) != nullptr) { sal_Int32 nYMiddle((aRect.Top() + aRect.Bottom()) / 2); @@ -834,7 +834,7 @@ SdrObject* FuConstructRectangle::CreateDefaultObject(const sal_uInt16 nID, const case SID_DRAW_MEASURELINE: { - if(pObj->ISA(SdrMeasureObj)) + if( dynamic_cast< SdrMeasureObj *>( pObj ) != nullptr) { sal_Int32 nYMiddle((aRect.Top() + aRect.Bottom()) / 2); static_cast<SdrMeasureObj*>(pObj)->SetPoint(Point(aStart.X(), nYMiddle), 0); @@ -877,7 +877,7 @@ SdrObject* FuConstructRectangle::CreateDefaultObject(const sal_uInt16 nID, const case SID_CONNECTOR_LINES_CIRCLE_END: case SID_CONNECTOR_LINES_CIRCLES: { - if(pObj->ISA(SdrEdgeObj)) + if( dynamic_cast< SdrEdgeObj *>( pObj ) != nullptr) { static_cast<SdrEdgeObj*>(pObj)->SetTailPoint(false, aStart); static_cast<SdrEdgeObj*>(pObj)->SetTailPoint(true, aEnd); @@ -892,7 +892,7 @@ SdrObject* FuConstructRectangle::CreateDefaultObject(const sal_uInt16 nID, const case SID_DRAW_CAPTION: case SID_DRAW_CAPTION_VERTICAL: { - if(pObj->ISA(SdrCaptionObj)) + if( dynamic_cast< SdrCaptionObj *>( pObj ) != nullptr) { bool bIsVertical(SID_DRAW_CAPTION_VERTICAL == nID); diff --git a/sd/source/ui/func/fudraw.cxx b/sd/source/ui/func/fudraw.cxx index 87fd5f415e12..1655822dee2b 100644 --- a/sd/source/ui/func/fudraw.cxx +++ b/sd/source/ui/func/fudraw.cxx @@ -557,7 +557,7 @@ void FuDraw::ForcePointer(const MouseEvent* pMEvt) // wouldn't be possible per default. const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); SdrObject* pObject = rMarkList.GetMark(0)->GetMarkedSdrObj(); - if ((pObject->ISA(E3dObject)) && (rMarkList.GetMarkCount() == 1)) + if ((dynamic_cast<const E3dObject* >(pObject) != nullptr) && (rMarkList.GetMarkCount() == 1)) { mpWindow->SetPointer(Pointer(PointerStyle::Rotate)); bDefPointer = false; // Otherwise it'll be calles Joes routine and the mousepointer will reconfigurate again @@ -573,7 +573,7 @@ void FuDraw::ForcePointer(const MouseEvent* pMEvt) { pObj = aVEvt.pObj; } - else if (eHit == SDRHIT_TEXTEDITOBJ && this->ISA(FuSelection)) + else if (eHit == SDRHIT_TEXTEDITOBJ && dynamic_cast< const FuSelection *>( this ) != nullptr) { sal_uInt16 nSdrObjKind = aVEvt.pObj->GetObjIdentifier(); @@ -588,12 +588,12 @@ void FuDraw::ForcePointer(const MouseEvent* pMEvt) } } - if (pObj && pMEvt && !pMEvt->IsMod2() && this->ISA(FuSelection)) + if (pObj && pMEvt && !pMEvt->IsMod2() && dynamic_cast< const FuSelection *>( this ) != nullptr) { // test for animation or ImageMap bDefPointer = !SetPointer(pObj, aPnt); - if (bDefPointer && (pObj->ISA(SdrObjGroup) || pObj->ISA(E3dPolyScene))) + if (bDefPointer && (dynamic_cast< const SdrObjGroup *>( pObj ) != nullptr || dynamic_cast< const E3dPolyScene* >(pObj) != nullptr)) { // take a glance into the group if (mpView->PickObj(aPnt, mpView->getHitTolLog(), pObj, pPV, SdrSearchOptions::ALSOONMASTER | SdrSearchOptions::DEEP)) @@ -617,7 +617,7 @@ bool FuDraw::SetPointer(SdrObject* pObj, const Point& rPos) { bool bSet = false; - bool bAnimationInfo = !mpDocSh->ISA(GraphicDocShell) && + bool bAnimationInfo = dynamic_cast< const GraphicDocShell *>( mpDocSh ) == nullptr && mpDoc->GetAnimationInfo(pObj); bool bImageMapInfo = false; @@ -657,7 +657,7 @@ bool FuDraw::SetPointer(SdrObject* pObj, const Point& rPos) ******************************************************/ SdAnimationInfo* pInfo = mpDoc->GetAnimationInfo(pObj); - if ((mpView->ISA(DrawView) && + if(( dynamic_cast< const DrawView *>( mpView ) != nullptr && (pInfo->meClickAction == presentation::ClickAction_BOOKMARK || pInfo->meClickAction == presentation::ClickAction_DOCUMENT || pInfo->meClickAction == presentation::ClickAction_PREVPAGE || @@ -669,7 +669,7 @@ bool FuDraw::SetPointer(SdrObject* pObj, const Point& rPos) pInfo->meClickAction == presentation::ClickAction_MACRO || pInfo->meClickAction == presentation::ClickAction_SOUND)) || - (mpView->ISA(DrawView) && + ( dynamic_cast< const DrawView *>( mpView ) != nullptr && SlideShow::IsRunning( mpViewShell->GetViewShellBase() ) && (pInfo->meClickAction == presentation::ClickAction_VANISH || pInfo->meClickAction == presentation::ClickAction_INVISIBLE || @@ -735,7 +735,7 @@ void FuDraw::DoubleClick(const MouseEvent& rMEvt) GetDispatcher()->Execute( SID_INSERT_GRAPHIC, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD ); } - else if ( ( pObj->ISA(SdrTextObj) || pObj->ISA(SdrObjGroup) ) && + else if ( ( dynamic_cast< const SdrTextObj *>( pObj ) != nullptr || dynamic_cast< const SdrObjGroup *>( pObj ) != nullptr ) && !SD_MOD()->GetWaterCan() && mpViewShell->GetFrameView()->IsDoubleClickTextEdit() && !mpDocSh->IsReadOnly()) @@ -777,7 +777,7 @@ bool FuDraw::RequestHelp(const HelpEvent& rHEvt) bReturn = SetHelpText(pObj, aPosPixel, aVEvt); - if (!bReturn && (pObj->ISA(SdrObjGroup) || pObj->ISA(E3dPolyScene))) + if (!bReturn && (dynamic_cast< const SdrObjGroup *>( pObj ) != nullptr || dynamic_cast< const E3dPolyScene* >(pObj) != nullptr)) { // take a glance into the group SdrPageView* pPV = NULL; @@ -821,7 +821,7 @@ bool FuDraw::SetHelpText(SdrObject* pObj, const Point& rPosPixel, const SdrViewE } } } - else if (!mpDocSh->ISA(GraphicDocShell) && mpDoc->GetAnimationInfo(pObj)) + else if (dynamic_cast< GraphicDocShell *>( mpDocSh ) == nullptr && mpDoc->GetAnimationInfo(pObj)) { SdAnimationInfo* pInfo = mpDoc->GetAnimationInfo(pObj); diff --git a/sd/source/ui/func/fuhhconv.cxx b/sd/source/ui/func/fuhhconv.cxx index a8331942f3c9..6b7a259d0209 100644 --- a/sd/source/ui/func/fuhhconv.cxx +++ b/sd/source/ui/func/fuhhconv.cxx @@ -63,12 +63,12 @@ FuHangulHanjaConversion::FuHangulHanjaConversion ( pSdOutliner(NULL), bOwnOutliner(false) { - if ( mpViewShell->ISA(DrawViewShell) ) + if ( dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr ) { bOwnOutliner = true; pSdOutliner = new Outliner( mpDoc, OUTLINERMODE_TEXTOBJECT ); } - else if ( mpViewShell->ISA(OutlineViewShell) ) + else if ( dynamic_cast< const OutlineViewShell *>( mpViewShell ) != nullptr ) { bOwnOutliner = false; pSdOutliner = mpDoc->GetOutliner(); @@ -102,13 +102,13 @@ void FuHangulHanjaConversion::StartConversion( sal_Int16 nSourceLanguage, sal_In mpView->BegUndo(SD_RESSTR(STR_UNDO_HANGULHANJACONVERSION)); - ViewShellBase* pBase = PTR_CAST(ViewShellBase, SfxViewShell::Current()); + ViewShellBase* pBase = dynamic_cast<ViewShellBase*>( SfxViewShell::Current() ); if (pBase != NULL) mpViewShell = pBase->GetMainViewShell().get(); if( mpViewShell ) { - if ( pSdOutliner && mpViewShell->ISA(DrawViewShell) && !bOwnOutliner ) + if ( pSdOutliner && dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr && !bOwnOutliner ) { pSdOutliner->EndConversion(); @@ -116,7 +116,7 @@ void FuHangulHanjaConversion::StartConversion( sal_Int16 nSourceLanguage, sal_In pSdOutliner = new Outliner( mpDoc, OUTLINERMODE_TEXTOBJECT ); pSdOutliner->BeginConversion(); } - else if ( pSdOutliner && mpViewShell->ISA(OutlineViewShell) && bOwnOutliner ) + else if ( pSdOutliner && dynamic_cast< const OutlineViewShell *>( mpViewShell ) != nullptr && bOwnOutliner ) { pSdOutliner->EndConversion(); delete pSdOutliner; diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx index f2c1432c103b..da787904b807 100644 --- a/sd/source/ui/func/fuinsert.cxx +++ b/sd/source/ui/func/fuinsert.cxx @@ -123,7 +123,7 @@ void FuInsertGraphic::DoExecute( SfxRequest& ) int nError = aDlg.GetGraphic(aGraphic); if( nError == GRFILTER_OK ) { - if( mpViewShell && mpViewShell->ISA(DrawViewShell)) + if( mpViewShell && dynamic_cast< DrawViewShell *>( mpViewShell ) != nullptr) { sal_Int8 nAction = DND_ACTION_COPY; SdrObject* pPickObj; @@ -228,7 +228,7 @@ void FuInsertClipboard::DoExecute( SfxRequest& ) if( !mpView->InsertData( aDataHelper, mpWindow->PixelToLogic( Rectangle( Point(), mpWindow->GetOutputSizePixel() ).Center() ), nAction, false, nFormatId ) && - ( mpViewShell && mpViewShell->ISA( DrawViewShell ) ) ) + ( mpViewShell && dynamic_cast< DrawViewShell *>( mpViewShell ) != nullptr ) ) { DrawViewShell* pDrViewSh = static_cast<DrawViewShell*>(mpViewShell); INetBookmark aINetBookmark( "", "" ); @@ -702,7 +702,7 @@ void FuInsertAVMedia::DoExecute( 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 ) { diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx index 281155e1b7b4..163a9acf5e70 100644 --- a/sd/source/ui/func/fuinsfil.cxx +++ b/sd/source/ui/func/fuinsfil.cxx @@ -264,7 +264,7 @@ void FuInsertFile::DoExecute( SfxRequest& rReq ) SfxGetpApp()->GetFilterMatcher().GuessFilter( *pMedium, &pFilter, SfxFilterFlags::IMPORT, SFX_FILTER_NOTINSTALLED ); - bool bDrawMode = mpViewShell && mpViewShell->ISA(DrawViewShell); + bool bDrawMode = mpViewShell && dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr; bool bInserted = false; if( pFilter ) @@ -357,7 +357,7 @@ bool FuInsertFile::InsSDDinDrMode(SfxMedium* pMedium) if (pView) { - if (pView->ISA(OutlineView)) + if( dynamic_cast< const OutlineView *>( pView ) != nullptr) { pPage = static_cast<OutlineView*>(pView)->GetActualPage(); } diff --git a/sd/source/ui/func/fulinend.cxx b/sd/source/ui/func/fulinend.cxx index 985824f860d1..9aa90de5db82 100644 --- a/sd/source/ui/func/fulinend.cxx +++ b/sd/source/ui/func/fulinend.cxx @@ -61,7 +61,7 @@ void FuLineEnd::DoExecute( SfxRequest& ) const SdrObject* pNewObj; SdrObject* pConvPolyObj = NULL; - if( pObj->ISA( SdrPathObj ) ) + if( dynamic_cast< const SdrPathObj *>( pObj ) != nullptr ) { pNewObj = pObj; } @@ -78,7 +78,7 @@ void FuLineEnd::DoExecute( SfxRequest& ) { pNewObj = pConvPolyObj = pObj->ConvertToPolyObj( true, false ); - if( !pNewObj || !pNewObj->ISA( SdrPathObj ) ) + if( !pNewObj || dynamic_cast< const SdrPathObj *>( pNewObj ) == nullptr ) return; // Cancel, additional security, but it does not help // for group objects } diff --git a/sd/source/ui/func/fumorph.cxx b/sd/source/ui/func/fumorph.cxx index 4f9d2cfa89de..523ad26798c2 100644 --- a/sd/source/ui/func/fumorph.cxx +++ b/sd/source/ui/func/fumorph.cxx @@ -113,14 +113,14 @@ void FuMorph::DoExecute( SfxRequest& ) while(aIter1.IsMore()) { SdrObject* pObj = aIter1.Next(); - if(pObj && pObj->ISA(SdrPathObj)) + if(pObj && dynamic_cast< SdrPathObj *>( pObj ) != nullptr) aPolyPoly1.append(static_cast<SdrPathObj*>(pObj)->GetPathPoly()); } while(aIter2.IsMore()) { SdrObject* pObj = aIter2.Next(); - if(pObj && pObj->ISA(SdrPathObj)) + if(pObj && dynamic_cast< SdrPathObj *>( pObj ) != nullptr) aPolyPoly2.append(static_cast<SdrPathObj*>(pObj)->GetPathPoly()); } diff --git a/sd/source/ui/func/funavig.cxx b/sd/source/ui/func/funavig.cxx index 1c28b93d7bce..a739109a6c95 100644 --- a/sd/source/ui/func/funavig.cxx +++ b/sd/source/ui/func/funavig.cxx @@ -59,7 +59,7 @@ void FuNavigation::DoExecute( SfxRequest& rReq ) case SID_GO_TO_FIRST_PAGE: { if (!mpView->IsTextEdit() - && mpViewShell->ISA(DrawViewShell) + && dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr && !bSlideShow) { // jump to first page @@ -70,7 +70,7 @@ void FuNavigation::DoExecute( SfxRequest& rReq ) case SID_GO_TO_PREVIOUS_PAGE: { - if(mpViewShell->ISA(DrawViewShell) && !bSlideShow) + if( dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr && !bSlideShow) { // With no modifier pressed we move to the previous // slide. @@ -100,7 +100,7 @@ void FuNavigation::DoExecute( SfxRequest& rReq ) case SID_GO_TO_NEXT_PAGE: { - if(mpViewShell->ISA(DrawViewShell) && !bSlideShow) + if( dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr && !bSlideShow) { // With no modifier pressed we move to the next slide. mpView->SdrEndTextEdit(); @@ -129,7 +129,7 @@ void FuNavigation::DoExecute( SfxRequest& rReq ) case SID_GO_TO_LAST_PAGE: { if (!mpView->IsTextEdit() - && mpViewShell->ISA(DrawViewShell) + && dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr && !bSlideShow) { // jump to last page diff --git a/sd/source/ui/func/fuolbull.cxx b/sd/source/ui/func/fuolbull.cxx index 653562aeb61e..f13a8035cc0a 100644 --- a/sd/source/ui/func/fuolbull.cxx +++ b/sd/source/ui/func/fuolbull.cxx @@ -99,7 +99,7 @@ void FuOutlineBullet::DoExecute( SfxRequest& rReq ) std::unique_ptr< OutlineViewModelChangeGuard > aGuard; - if (mpView->ISA(OutlineView)) + if( dynamic_cast< const OutlineView *>( mpView ) != nullptr) { pOLV = static_cast<OutlineView*>(mpView) ->GetViewByWindow(mpViewShell->GetActiveWindow()); @@ -236,7 +236,7 @@ void FuOutlineBullet::SetCurrentBulletsNumbering(SfxRequest& rReq) OutlinerView* pOLV = mpView->GetTextEditOutlinerView(); std::unique_ptr< OutlineViewModelChangeGuard > aGuard; { - if (mpView->ISA(OutlineView)) + if( dynamic_cast< const OutlineView *>( mpView ) != nullptr) { pOLV = static_cast<OutlineView*>(mpView) ->GetViewByWindow(mpViewShell->GetActiveWindow()); diff --git a/sd/source/ui/func/fuoltext.cxx b/sd/source/ui/func/fuoltext.cxx index a3dceffd6599..ee94791407e4 100644 --- a/sd/source/ui/func/fuoltext.cxx +++ b/sd/source/ui/func/fuoltext.cxx @@ -144,7 +144,7 @@ bool FuOutlineText::MouseButtonUp(const MouseEvent& rMEvt) { const SvxFieldData* pField = pFieldItem->GetField(); - if( pField && pField->ISA( SvxURLField ) ) + if( pField && dynamic_cast< const SvxURLField *>( pField ) != nullptr ) { bReturn = true; mpWindow->ReleaseMouse(); diff --git a/sd/source/ui/func/fupoor.cxx b/sd/source/ui/func/fupoor.cxx index b2be7eb2884e..06e431d9fa83 100644 --- a/sd/source/ui/func/fupoor.cxx +++ b/sd/source/ui/func/fupoor.cxx @@ -202,7 +202,7 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt) { if(rKEvt.GetKeyCode().IsMod1()) { - if (mpViewShell->ISA(DrawViewShell)) + if( dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr) { DrawViewShell* pDrawViewShell = static_cast<DrawViewShell*>(mpViewShell); @@ -217,7 +217,7 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt) { SdrObject* pObj = aIter.Next(); - if(pObj && pObj->ISA(SdrTextObj)) + if(pObj && dynamic_cast< const SdrTextObj *>( pObj ) != nullptr) { sal_uInt32 nInv(pObj->GetObjInventor()); sal_uInt16 nKnd(pObj->GetObjIdentifier()); @@ -260,12 +260,12 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt) { SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); - if( pObj && pObj->ISA( SdrOle2Obj ) && !mpDocSh->IsUIActive() ) + if( pObj && dynamic_cast< const SdrOle2Obj* >( pObj ) != nullptr && !mpDocSh->IsUIActive() ) { //HMHmpView->HideMarkHdl(); mpViewShell->ActivateObject( static_cast< SdrOle2Obj* >( pObj ), 0 ); } - else if( pObj && pObj->IsEmptyPresObj() && pObj->ISA( SdrGrafObj ) ) + else if( pObj && pObj->IsEmptyPresObj() && dynamic_cast< const SdrGrafObj *>( pObj ) != nullptr ) { mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_INSERT_GRAPHIC, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD ); } @@ -321,7 +321,7 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt) // increase zoom mpViewShell->SetZoom(mpWindow->GetZoom() * 3 / 2); - if (mpViewShell->ISA(DrawViewShell)) + if( dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr) static_cast<DrawViewShell*>(mpViewShell) ->SetZoomOnPage(false); @@ -337,7 +337,7 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt) // decrease zoom mpViewShell->SetZoom(mpWindow->GetZoom() * 2 / 3); - if (mpViewShell->ISA(DrawViewShell)) + if( dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr) static_cast<DrawViewShell*>(mpViewShell) ->SetZoomOnPage(false); @@ -399,7 +399,7 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt) case KEY_HOME: { if (!mpView->IsTextEdit() - && mpViewShell->ISA(DrawViewShell) + && dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr && !bSlideShow) { // jump to first page @@ -412,7 +412,7 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt) case KEY_END: { if (!mpView->IsTextEdit() - && mpViewShell->ISA(DrawViewShell) + && dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr && !bSlideShow) { // jump to last page @@ -431,7 +431,7 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt) if( rKEvt.GetKeyCode().IsMod1() && rKEvt.GetKeyCode().IsMod2() ) break; - if(mpViewShell->ISA(DrawViewShell) && !bSlideShow) + if( dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr && !bSlideShow) { // The page-up key switches layers or pages depending on the // modifier key. @@ -478,7 +478,7 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt) { if( rKEvt.GetKeyCode().IsMod1() && rKEvt.GetKeyCode().IsMod2() ) break; - if(mpViewShell->ISA(DrawViewShell) && !bSlideShow) + if(dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr && !bSlideShow) { // The page-down key switches layers or pages depending on the // modifier key. @@ -626,7 +626,7 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt) bool bOldSuppress = false; SdrEdgeObj* pEdgeObj = 0L; - if(pHdl && pHdl->GetObj() && pHdl->GetObj()->ISA(SdrEdgeObj) && 0 == pHdl->GetPolyNum()) + if(pHdl && pHdl->GetObj() && 0 != dynamic_cast< const SdrEdgeObj *>( pHdl->GetObj() ) && 0 == pHdl->GetPolyNum()) { pEdgeObj = static_cast<SdrEdgeObj*>(pHdl->GetObj()); @@ -811,7 +811,7 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt) SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); // #i118485# allow TextInput for OLEs, too - if(pObj->ISA(SdrTextObj) && pObj->HasTextEdit()) + if( dynamic_cast< const SdrTextObj *>( pObj ) != nullptr && pObj->HasTextEdit()) { // use common IsSimpleCharInput from the EditEngine. bool bPrintable(EditEngine::IsSimpleCharInput(rKEvt)); @@ -836,7 +836,7 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt) { // test if there is a title object there. If yes, try to // set it to edit mode and start typing... - if(mpViewShell->ISA(DrawViewShell) + if( dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr && EditEngine::IsSimpleCharInput(rKEvt)) { DrawViewShell* pDrawViewShell = @@ -852,7 +852,7 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt) { SdrObject* pObj = aIter.Next(); - if(pObj && pObj->ISA(SdrTextObj)) + if(pObj && dynamic_cast< const SdrTextObj *>( pObj ) != nullptr) { sal_uInt32 nInv(pObj->GetObjInventor()); sal_uInt16 nKnd(pObj->GetObjIdentifier()); @@ -1044,7 +1044,7 @@ void FuPoor::ReceiveRequest(SfxRequest& rReq) { const SfxPoolItem& rItem = pSet->Get( nSlotId ); - if( rItem.ISA( SfxAllEnumItem ) ) + if( dynamic_cast< const SfxAllEnumItem *>( &rItem ) != nullptr ) { nSlotValue = static_cast<const SfxAllEnumItem&>( rItem ).GetValue(); } @@ -1076,7 +1076,7 @@ void FuPoor::ImpForceQuadratic(Rectangle& rRect) void FuPoor::SwitchLayer (sal_Int32 nOffset) { - if(mpViewShell && mpViewShell->ISA(DrawViewShell)) + if(mpViewShell && dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr) { DrawViewShell* pDrawViewShell = static_cast<DrawViewShell*>(mpViewShell); @@ -1114,7 +1114,7 @@ void FuPoor::SwitchLayer (sal_Int32 nOffset) */ bool FuPoor::cancel() { - if ( !this->ISA(FuSelection) ) + if ( dynamic_cast< const FuSelection *>( this ) == nullptr ) { mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SfxCallMode::ASYNCHRON); return true; diff --git a/sd/source/ui/func/fuprlout.cxx b/sd/source/ui/func/fuprlout.cxx index 01993ba790c1..16665d1c6f64 100644 --- a/sd/source/ui/func/fuprlout.cxx +++ b/sd/source/ui/func/fuprlout.cxx @@ -93,7 +93,7 @@ void FuPresentationLayout::DoExecute( SfxRequest& rReq ) /* if we are on a master page, the changes apply for all pages and notes- pages who are using the relevant layout */ bool bOnMaster = false; - if( mpViewShell && mpViewShell->ISA(DrawViewShell)) + if( mpViewShell && dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr) { EditMode eEditMode = static_cast<DrawViewShell*>(mpViewShell)->GetEditMode(); @@ -210,7 +210,7 @@ void FuPresentationLayout::DoExecute( SfxRequest& rReq ) /* That isn't quite right. If the masterpageview is active and you are removing a masterpage, it's possible that you are removing the current masterpage. So you have to call ResetActualPage ! */ - if( mpViewShell->ISA(DrawViewShell) && !bCheckMasters ) + if( dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr && !bCheckMasters ) static_cast<DrawView*>(mpView)->BlockPageOrderChangedHint(true); if (bLoad) @@ -236,7 +236,7 @@ void FuPresentationLayout::DoExecute( SfxRequest& rReq ) } // remove blocking - if (mpViewShell->ISA(DrawViewShell) && !bCheckMasters ) + if( dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr && !bCheckMasters ) static_cast<DrawView*>(mpView)->BlockPageOrderChangedHint(false); // if the master page was visible, show it again @@ -244,7 +244,7 @@ void FuPresentationLayout::DoExecute( SfxRequest& rReq ) { if (bOnMaster) { - if (mpViewShell->ISA(DrawViewShell)) + if( dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr) { ::sd::View* pView = static_cast<DrawViewShell*>(mpViewShell)->GetView(); @@ -276,7 +276,7 @@ void FuPresentationLayout::DoExecute( SfxRequest& rReq ) // fake a mode change to repaint the page tab bar - if( mpViewShell && mpViewShell->ISA( DrawViewShell ) ) + if( mpViewShell && dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr ) { DrawViewShell* pDrawViewSh = static_cast<DrawViewShell*>(mpViewShell); diff --git a/sd/source/ui/func/fuscale.cxx b/sd/source/ui/func/fuscale.cxx index 2c2db012d629..4c54f95d27b7 100644 --- a/sd/source/ui/func/fuscale.cxx +++ b/sd/source/ui/func/fuscale.cxx @@ -77,7 +77,7 @@ void FuScale::DoExecute( SfxRequest& rReq ) nValue = (sal_Int16) mpWindow->GetZoom(); // zoom on page size? - if( mpViewShell && mpViewShell->ISA( DrawViewShell ) && + if( mpViewShell && dynamic_cast< DrawViewShell *>( mpViewShell ) != nullptr && static_cast<DrawViewShell*>(mpViewShell)->IsZoomOnPage() ) { pZoomItem.reset(new SvxZoomItem( SvxZoomType::WHOLEPAGE, nValue )); @@ -90,7 +90,7 @@ void FuScale::DoExecute( SfxRequest& rReq ) // limit range if( mpViewShell ) { - if( mpViewShell->ISA( DrawViewShell ) ) + if( dynamic_cast< DrawViewShell *>( mpViewShell ) != nullptr ) { SdrPageView* pPageView = mpView->GetSdrPageView(); if( ( pPageView && pPageView->GetObjList()->GetObjCount() == 0 ) ) @@ -99,7 +99,7 @@ void FuScale::DoExecute( SfxRequest& rReq ) nZoomValues &= ~SvxZoomEnableFlags::OPTIMAL; } } - else if( mpViewShell->ISA( OutlineViewShell ) ) + else if( dynamic_cast< OutlineViewShell *>( mpViewShell ) != nullptr ) { nZoomValues &= ~SvxZoomEnableFlags::OPTIMAL; nZoomValues &= ~SvxZoomEnableFlags::WHOLEPAGE; @@ -156,7 +156,7 @@ void FuScale::DoExecute( SfxRequest& rReq ) case SvxZoomType::OPTIMAL: { - if( mpViewShell->ISA( DrawViewShell ) ) + if( dynamic_cast< DrawViewShell *>( mpViewShell ) != nullptr ) { // name confusion: SID_SIZE_ALL -> zoom onto all objects // --> the program offers it as optimal diff --git a/sd/source/ui/func/fusearch.cxx b/sd/source/ui/func/fusearch.cxx index eb0003520830..a6d535f43821 100644 --- a/sd/source/ui/func/fusearch.cxx +++ b/sd/source/ui/func/fusearch.cxx @@ -73,12 +73,12 @@ void FuSearch::DoExecute( SfxRequest& ) { mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArraySpell ); - if ( mpViewShell->ISA(DrawViewShell) ) + if ( dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr ) { bOwnOutliner = true; pSdOutliner = new ::sd::Outliner( mpDoc, OUTLINERMODE_TEXTOBJECT ); } - else if ( mpViewShell->ISA(OutlineViewShell) ) + else if ( dynamic_cast< const OutlineViewShell *>( mpViewShell ) != nullptr ) { bOwnOutliner = false; pSdOutliner = mpDoc->GetOutliner(); @@ -102,14 +102,14 @@ FuSearch::~FuSearch() void FuSearch::SearchAndReplace( const SvxSearchItem* pSearchItem ) { - ViewShellBase* pBase = PTR_CAST(ViewShellBase, SfxViewShell::Current()); + ViewShellBase* pBase = dynamic_cast<ViewShellBase*>( SfxViewShell::Current() ); ViewShell* pViewShell = NULL; if (pBase != NULL) pViewShell = pBase->GetMainViewShell().get(); if (pViewShell != NULL) { - if ( pSdOutliner && pViewShell->ISA(DrawViewShell) && !bOwnOutliner ) + if ( pSdOutliner && dynamic_cast< const DrawViewShell *>( pViewShell ) != nullptr && !bOwnOutliner ) { pSdOutliner->EndSpelling(); @@ -117,7 +117,7 @@ void FuSearch::SearchAndReplace( const SvxSearchItem* pSearchItem ) pSdOutliner = new ::sd::Outliner( mpDoc, OUTLINERMODE_TEXTOBJECT ); pSdOutliner->PrepareSpelling(); } - else if ( pSdOutliner && pViewShell->ISA(OutlineViewShell) && bOwnOutliner ) + else if ( pSdOutliner && dynamic_cast< const OutlineViewShell *>( pViewShell ) != nullptr && bOwnOutliner ) { pSdOutliner->EndSpelling(); delete pSdOutliner; diff --git a/sd/source/ui/func/fusel.cxx b/sd/source/ui/func/fusel.cxx index 63a78c3568ae..585454445d38 100644 --- a/sd/source/ui/func/fusel.cxx +++ b/sd/source/ui/func/fusel.cxx @@ -300,7 +300,7 @@ bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt) bReturn = true; } else if(!rMEvt.IsMod2() - && mpViewShell->ISA(DrawViewShell) + && dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr ) { if(mpView->PickObj(aMDPos, mpView->getHitTolLog(), pObj, pPV, SdrSearchOptions::ALSOONMASTER)) @@ -309,7 +309,7 @@ bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt) if ( ! bSelectionOnly) bReturn = AnimateObj(pObj, aMDPos); - if (!bReturn && (pObj->ISA(SdrObjGroup) || pObj->ISA(E3dPolyScene))) + if( !bReturn && (dynamic_cast< const SdrObjGroup *>( pObj ) != nullptr || dynamic_cast< const E3dPolyScene* >(pObj) != nullptr)) { if(rMEvt.GetClicks() == 1) { @@ -1257,8 +1257,8 @@ bool FuSelection::AnimateObj(SdrObject* pObj, const Point& rPos) bAnimated = true; } } - else if (!mpDocSh->ISA(GraphicDocShell) && - mpView->ISA(DrawView) && + else if( dynamic_cast< const GraphicDocShell *>( mpDocSh ) == nullptr && + dynamic_cast< const DrawView *>( mpView ) != nullptr && mpDoc->GetAnimationInfo(pObj)) { /********************************************************** @@ -1448,8 +1448,8 @@ bool FuSelection::AnimateObj(SdrObject* pObj, const Point& rPos) } if (!bAnimated && - mpView->ISA(DrawView) && - !mpDocSh->ISA(GraphicDocShell) && + dynamic_cast< const DrawView *>( mpView ) != nullptr && + dynamic_cast< const GraphicDocShell *>( mpDocSh ) == nullptr && SlideShow::IsRunning( mpViewShell->GetViewShellBase() ) && mpDoc->GetAnimationInfo(pObj)) { diff --git a/sd/source/ui/func/futempl.cxx b/sd/source/ui/func/futempl.cxx index 2b4624758356..f8cfe96a645c 100644 --- a/sd/source/ui/func/futempl.cxx +++ b/sd/source/ui/func/futempl.cxx @@ -529,7 +529,7 @@ void FuTemplate::DoExecute( SfxRequest& rReq ) while( aIter.IsMore() ) { SdrObject* pObj = aIter.Next(); - if( pObj->ISA(SdrPageObj) ) + if( dynamic_cast< const SdrPageObj *>( pObj ) != nullptr ) { // repaint only pObj->ActionChanged(); @@ -609,7 +609,7 @@ void FuTemplate::DoExecute( SfxRequest& rReq ) case SID_STYLE_UPDATE_BY_EXAMPLE: { if ((mpView->AreObjectsMarked() && mpView->GetMarkedObjectList().GetMarkCount() == 1) || - mpView->ISA(OutlineView)) + dynamic_cast< const OutlineView *>( mpView ) != nullptr) { pStyleSheet = mpView->GetStyleSheet(); diff --git a/sd/source/ui/func/futext.cxx b/sd/source/ui/func/futext.cxx index 9aa0bbc997b3..b6a29ddfca84 100644 --- a/sd/source/ui/func/futext.cxx +++ b/sd/source/ui/func/futext.cxx @@ -323,7 +323,7 @@ bool FuText::MouseButtonDown(const MouseEvent& rMEvt) select object and set to EditMode */ mpView->MarkObj(aVEvt.pRootObj, pPV); - if (aVEvt.pObj && aVEvt.pObj->ISA(SdrTextObj)) + if (aVEvt.pObj && dynamic_cast< const SdrTextObj *>( aVEvt.pObj ) != nullptr) { mxTextObj.reset( static_cast<SdrTextObj*>(aVEvt.pObj) ); } @@ -1178,7 +1178,7 @@ bool FuText::RequestHelp(const HelpEvent& rHEvt) const SvxFieldItem* pFieldItem = pOLV->GetFieldUnderMousePointer(); const SvxFieldData* pField = pFieldItem->GetField(); - if (pField && pField->ISA(SvxURLField)) + if (pField && dynamic_cast< const SvxURLField *>( pField ) != nullptr) { // URL-Field aHelpText = INetURLObject::decode( static_cast<const SvxURLField*>(pField)->GetURL(), INetURLObject::DECODE_WITH_CHARSET ); @@ -1235,7 +1235,7 @@ void FuText::ReceiveRequest(SfxRequest& rReq) mpView->PickAnything(aMEvt, SdrMouseEventKind::BUTTONDOWN, aVEvt); mpView->MarkObj(aVEvt.pRootObj, pPV); - if (aVEvt.pObj && aVEvt.pObj->ISA(SdrTextObj)) + if (aVEvt.pObj && dynamic_cast< SdrTextObj *>( aVEvt.pObj ) != nullptr) { mxTextObj.reset( static_cast< SdrTextObj* >( aVEvt.pObj ) ); } @@ -1249,7 +1249,7 @@ void FuText::ReceiveRequest(SfxRequest& rReq) { SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); - if (pObj->ISA(SdrTextObj)) + if( dynamic_cast< const SdrTextObj *>( pObj ) != nullptr) { mxTextObj.reset( static_cast< SdrTextObj* >( pObj ) ); } @@ -1293,7 +1293,7 @@ SdrObject* FuText::CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rR if(pObj) { - if(pObj->ISA(SdrTextObj)) + if( dynamic_cast< SdrTextObj *>( pObj ) != nullptr) { SdrTextObj* pText = static_cast<SdrTextObj*>(pObj); pText->SetLogicRect(rRectangle); diff --git a/sd/source/ui/func/futhes.cxx b/sd/source/ui/func/futhes.cxx index 7ccee443f4d6..b3218da08a3a 100644 --- a/sd/source/ui/func/futhes.cxx +++ b/sd/source/ui/func/futhes.cxx @@ -70,7 +70,7 @@ void FuThesaurus::DoExecute( SfxRequest& ) SfxErrorContext aContext(ERRCTX_SVX_LINGU_THESAURUS, OUString(), mpWindow, RID_SVXERRCTX, &DIALOG_MGR() ); - if (mpViewShell && mpViewShell->ISA(DrawViewShell)) + if (mpViewShell && dynamic_cast< DrawViewShell *>( mpViewShell ) != nullptr) { SdrTextObj* pTextObj = NULL; @@ -83,7 +83,7 @@ void FuThesaurus::DoExecute( SfxRequest& ) SdrMark* pMark = rMarkList.GetMark(0); SdrObject* pObj = pMark->GetMarkedSdrObj(); - if ( pObj->ISA(SdrTextObj) ) + if ( dynamic_cast< const SdrTextObj *>( pObj ) != nullptr ) { pTextObj = static_cast<SdrTextObj*>(pObj); } @@ -117,7 +117,7 @@ void FuThesaurus::DoExecute( SfxRequest& ) } } } - else if (mpViewShell && mpViewShell->ISA(OutlineViewShell)) + else if (mpViewShell && dynamic_cast< OutlineViewShell *>( mpViewShell ) != nullptr) { Outliner* pOutliner = mpDoc->GetOutliner(); OutlinerView* pOutlView = pOutliner->GetView(0); diff --git a/sd/source/ui/func/fuvect.cxx b/sd/source/ui/func/fuvect.cxx index 2ceda3bc7d70..a4fbbf00c654 100644 --- a/sd/source/ui/func/fuvect.cxx +++ b/sd/source/ui/func/fuvect.cxx @@ -61,7 +61,7 @@ void FuVectorize::DoExecute( SfxRequest& ) { SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); - if( pObj && pObj->ISA( SdrGrafObj ) ) + if( pObj && dynamic_cast< const SdrGrafObj *>( pObj ) != nullptr ) { SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); std::unique_ptr<AbstractSdVectorizeDlg> pDlg(pFact ? pFact->CreateSdVectorizeDlg( mpWindow, static_cast<SdrGrafObj*>( pObj )->GetGraphic().GetBitmap(), mpDocSh ) : 0); diff --git a/sd/source/ui/func/sdundogr.cxx b/sd/source/ui/func/sdundogr.cxx index 688c08d0c3dc..0c012205eed1 100644 --- a/sd/source/ui/func/sdundogr.cxx +++ b/sd/source/ui/func/sdundogr.cxx @@ -35,7 +35,7 @@ bool SdUndoGroup::Merge( SfxUndoAction* pNextAction ) { bool bRet = false; - if( pNextAction && pNextAction->ISA( SdUndoAction ) ) + if( pNextAction && dynamic_cast< const SdUndoAction *>( pNextAction ) != nullptr ) { SdUndoAction* pClone = static_cast< SdUndoAction* >( pNextAction )->Clone(); diff --git a/sd/source/ui/func/undolayer.cxx b/sd/source/ui/func/undolayer.cxx index 33897e1dc33c..f852c48c1804 100644 --- a/sd/source/ui/func/undolayer.cxx +++ b/sd/source/ui/func/undolayer.cxx @@ -55,8 +55,7 @@ void SdLayerModifyUndoAction::Undo() ::sd::DrawDocShell* mpDocSh = mpDoc->GetDocSh(); if( mpDocSh ) { - ::sd::DrawViewShell* pDrViewSh = - PTR_CAST(::sd::DrawViewShell, mpDocSh->GetViewShell() ); + ::sd::DrawViewShell* pDrViewSh = dynamic_cast< ::sd::DrawViewShell*> ( mpDocSh->GetViewShell() ); if( pDrViewSh ) { pDrViewSh->ModifyLayer( mpLayer, maOldLayerName, maOldLayerTitle, maOldLayerDesc, mbOldIsVisible, mbOldIsLocked, mbOldIsPrintable ); @@ -69,8 +68,7 @@ void SdLayerModifyUndoAction::Redo() ::sd::DrawDocShell* mpDocSh = mpDoc->GetDocSh(); if( mpDocSh ) { - ::sd::DrawViewShell* pDrViewSh = - PTR_CAST(::sd::DrawViewShell, mpDocSh->GetViewShell() ); + ::sd::DrawViewShell* pDrViewSh = dynamic_cast< ::sd::DrawViewShell* >( mpDocSh->GetViewShell() ); if( pDrViewSh ) { pDrViewSh->ModifyLayer( mpLayer, maNewLayerName, maNewLayerTitle, maNewLayerDesc, mbNewIsVisible, mbNewIsLocked, mbNewIsPrintable ); diff --git a/sd/source/ui/sidebar/MasterPageContainerProviders.cxx b/sd/source/ui/sidebar/MasterPageContainerProviders.cxx index 6474735da5e8..1c73b514ff09 100644 --- a/sd/source/ui/sidebar/MasterPageContainerProviders.cxx +++ b/sd/source/ui/sidebar/MasterPageContainerProviders.cxx @@ -160,7 +160,7 @@ SdPage* TemplatePageObjectProvider::operator() (SdDrawDocument* pContainerDocume mxDocumentShell = NULL; } SfxObjectShell* pShell = mxDocumentShell; - return PTR_CAST(::sd::DrawDocShell,pShell); + return dynamic_cast< ::sd::DrawDocShell *>( pShell ); } int TemplatePageObjectProvider::GetCostIndex() diff --git a/sd/source/ui/sidebar/MasterPageObserver.cxx b/sd/source/ui/sidebar/MasterPageObserver.cxx index 9e71684192d4..d2a6d2d9bae6 100644 --- a/sd/source/ui/sidebar/MasterPageObserver.cxx +++ b/sd/source/ui/sidebar/MasterPageObserver.cxx @@ -232,7 +232,7 @@ void MasterPageObserver::Implementation::Notify( // filters out events that are sent in between the insertion // of a new standard master page and a new notes master // page. - if (rBroadcaster.ISA(SdDrawDocument)) + if (dynamic_cast< const SdDrawDocument *>( &rBroadcaster ) != nullptr) { SdDrawDocument& rDocument ( static_cast<SdDrawDocument&>(rBroadcaster)); diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index 0b3f79d912ef..e3c527af1a96 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -691,7 +691,7 @@ void SAL_CALL SlideshowImpl::disposing() } // show current window again - if( mpViewShell && !mpViewShell->ISA(PresentationViewShell)) + if( mpViewShell && dynamic_cast< PresentationViewShell *>( mpViewShell ) == nullptr) { if( meAnimationMode == ANIMATIONMODE_SHOW ) { @@ -1624,7 +1624,7 @@ void SlideshowImpl::click( const Reference< XShape >& xShape, const ::com::sun:: { // todo, better do it async? SdrObject* pObj = GetSdrObjectFromXShape( xShape ); - SdrOle2Obj* pOleObject = PTR_CAST(SdrOle2Obj, pObj); + SdrOle2Obj* pOleObject = dynamic_cast< SdrOle2Obj* >(pObj); if (pOleObject && mpViewShell ) mpViewShell->ActivateObject(pOleObject, pEvent->mnVerb); } diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx index ca2e0583bee3..2d0523b0ed51 100644 --- a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx +++ b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +#/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * @@ -485,7 +485,7 @@ void SlideSorterViewShell::Activate (bool bIsMDIActivate) case ViewShell::ST_NOTES: case ViewShell::ST_DRAW: eContext = EnumContext::Context_DrawPage; - if (pMainViewShell->ISA(DrawViewShell)) + if( 0 != dynamic_cast< const DrawViewShell *>( pMainViewShell.get() )) { DrawViewShell* pDrawViewShell = dynamic_cast<DrawViewShell*>(pMainViewShell.get()); if (pDrawViewShell != NULL) @@ -726,7 +726,7 @@ void SlideSorterViewShell::GetStateMovePageFirst (SfxItemSet& rSet) if ( ! IsMainViewShell()) { std::shared_ptr<ViewShell> pMainViewShell = GetViewShellBase().GetMainViewShell(); - if (pMainViewShell.get() != NULL && pMainViewShell->ISA(DrawViewShell)) + if (pMainViewShell.get() != NULL && 0 != dynamic_cast< const DrawViewShell *>( pMainViewShell.get() )) { DrawViewShell* pDrawViewShell = dynamic_cast<DrawViewShell*>(pMainViewShell.get()); if (pDrawViewShell != NULL && pDrawViewShell->GetPageKind() == PK_HANDOUT) @@ -843,7 +843,7 @@ void SlideSorterViewShell::ExecMovePageLast (SfxRequest& /*rReq*/) void SlideSorterViewShell::GetStateMovePageLast (SfxItemSet& rSet) { std::shared_ptr<ViewShell> pMainViewShell = GetViewShellBase().GetMainViewShell(); - if (pMainViewShell.get() != NULL && pMainViewShell->ISA(DrawViewShell)) + if (pMainViewShell.get() != NULL && 0 != dynamic_cast< const DrawViewShell *>( pMainViewShell.get() )) { DrawViewShell* pDrawViewShell = dynamic_cast<DrawViewShell*>(pMainViewShell.get()); if (pDrawViewShell != NULL && pDrawViewShell->GetPageKind() == PK_HANDOUT) diff --git a/sd/source/ui/unoidl/unolayer.cxx b/sd/source/ui/unoidl/unolayer.cxx index 5ece5f1ddfee..af8f5e15f1f1 100644 --- a/sd/source/ui/unoidl/unolayer.cxx +++ b/sd/source/ui/unoidl/unolayer.cxx @@ -698,8 +698,7 @@ void SdLayerManager::UpdateLayerView( bool modify ) const throw() { if(mpModel->mpDocShell) { - ::sd::DrawViewShell* pDrViewSh = - PTR_CAST(::sd::DrawViewShell, mpModel->mpDocShell->GetViewShell()); + ::sd::DrawViewShell* pDrViewSh = dynamic_cast< ::sd::DrawViewShell* >( mpModel->mpDocShell->GetViewShell()); if(pDrViewSh) { diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 0d322ea151f8..6dcf8cbe008a 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -1769,7 +1769,7 @@ vcl::PDFWriter::StructElement ImplRenderPaintProc::ImplBegStructureTag( SdrObjec { sal_uInt32 nInventor = rObject.GetObjInventor(); sal_uInt16 nIdentifier = rObject.GetObjIdentifier(); - bool bIsTextObj = rObject.ISA( SdrTextObj ); + bool bIsTextObj = dynamic_cast< const SdrTextObj *>( &rObject ) != nullptr; if ( nInventor == SdrInventor ) { @@ -1913,7 +1913,7 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& r if( pOut ) { - vcl::PDFExtOutDevData* pPDFExtOutDevData = PTR_CAST( vcl::PDFExtOutDevData, pOut->GetExtOutDevData() ); + vcl::PDFExtOutDevData* pPDFExtOutDevData = dynamic_cast<vcl::PDFExtOutDevData* >( pOut->GetExtOutDevData() ); if ( !( (mpDoc->GetSdPage((sal_Int16) nPageNumber-1, PK_STANDARD))->IsExcluded() ) || (pPDFExtOutDevData && pPDFExtOutDevData->GetIsExportHiddenSlides()) ) diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx index b5381cffdaae..70d7574fa706 100644 --- a/sd/source/ui/unoidl/unoobj.cxx +++ b/sd/source/ui/unoidl/unoobj.cxx @@ -902,7 +902,7 @@ bool SdXShape::IsPresObj() const SdrObject* pObj = mpShape->GetSdrObject(); if(pObj) { - SdPage* pPage = PTR_CAST(SdPage,pObj->GetPage()); + SdPage* pPage = dynamic_cast<SdPage* >(pObj->GetPage()); if(pPage) return pPage->GetPresObjKind(pObj) != PRESOBJ_NONE; } @@ -945,7 +945,7 @@ OUString SdXShape::GetPlaceholderText() const if( pObj == NULL ) return OUString(); - SdPage* pPage = PTR_CAST(SdPage,pObj->GetPage()); + SdPage* pPage = dynamic_cast< SdPage* >(pObj->GetPage()); DBG_ASSERT( pPage, "no page?" ); if( pPage == NULL ) return OUString(); @@ -975,10 +975,10 @@ void SdXShape::SetEmptyPresObj(bool bEmpty) // really delete SdrOutlinerObj at pObj pObj->NbcSetOutlinerParaObject(0L); - if( bVertical && PTR_CAST( SdrTextObj, pObj ) ) + if( bVertical && dynamic_cast<SdrTextObj*>( pObj ) ) static_cast<SdrTextObj*>(pObj)->SetVerticalWriting( true ); - SdrGrafObj* pGraphicObj = PTR_CAST( SdrGrafObj, pObj ); + SdrGrafObj* pGraphicObj = dynamic_cast<SdrGrafObj*>( pObj ); if( pGraphicObj ) { Graphic aEmpty; @@ -986,7 +986,7 @@ void SdXShape::SetEmptyPresObj(bool bEmpty) } else { - SdrOle2Obj* pOleObj = PTR_CAST( SdrOle2Obj, pObj ); + SdrOle2Obj* pOleObj = dynamic_cast< SdrOle2Obj* >( pObj ); if( pOleObj ) { pOleObj->SetGraphic( NULL ); @@ -1010,7 +1010,7 @@ void SdXShape::SetEmptyPresObj(bool bEmpty) if( pOutliner == NULL ) break; - SdPage* pPage = PTR_CAST(SdPage,pObj->GetPage()); + SdPage* pPage = dynamic_cast< SdPage* >(pObj->GetPage()); DBG_ASSERT( pPage, "no page?" ); if( pPage == NULL ) break; @@ -1049,7 +1049,7 @@ void SdXShape::SetMasterDepend( bool bDepend ) throw() { if( bDepend ) { - SdPage* pPage = PTR_CAST(SdPage,pObj->GetPage()); + SdPage* pPage = dynamic_cast< SdPage* >(pObj->GetPage()); pObj->SetUserCall( pPage ); } else diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx index 6d22bec8281c..fa9897225afb 100644 --- a/sd/source/ui/unoidl/unopage.cxx +++ b/sd/source/ui/unoidl/unopage.cxx @@ -406,8 +406,8 @@ SdrObject * SdGenericDrawPage::_CreateSdrObject( const Reference< drawing::XShap // #i119287# similar to the code in the SdrObject methods the graphic and ole // SdrObjects need another default style than the rest, see task. Adding here, too. // TTTT: Same as for #i119287#: Can be removed in branch aw080 again - const bool bIsSdrGrafObj(0 != dynamic_cast< SdrGrafObj* >(pObj)); - const bool bIsSdrOle2Obj(0 != dynamic_cast< SdrOle2Obj* >(pObj)); + const bool bIsSdrGrafObj(dynamic_cast< const SdrGrafObj* >(pObj) != nullptr); + const bool bIsSdrOle2Obj(dynamic_cast< const SdrOle2Obj* >(pObj) != nullptr); if(bIsSdrGrafObj || bIsSdrOle2Obj) { @@ -1782,7 +1782,7 @@ static void refreshpage( SdDrawDocument* pDoc, const PageKind ePageKind ) if( pViewSh ) { - if( pViewSh->ISA(::sd::DrawViewShell ) ) + if( dynamic_cast<const ::sd::DrawViewShell* >(pViewSh) != nullptr ) static_cast< ::sd::DrawViewShell*>(pViewSh)->ResetActualPage(); Size aPageSize = pDoc->GetSdPage(0, ePageKind)->GetSize(); @@ -1917,7 +1917,7 @@ sal_Bool SAL_CALL SdPageLinkTargets::hasElements() { SdrObject* pObj = aIter.Next(); OUString aStr( pObj->GetName() ); - if( aStr.isEmpty() && pObj->ISA( SdrOle2Obj ) ) + if( aStr.isEmpty() && dynamic_cast< const SdrOle2Obj *>( pObj ) != nullptr ) aStr = static_cast< const SdrOle2Obj* >( pObj )->GetPersistName(); if( !aStr.isEmpty() ) return sal_True; @@ -1964,7 +1964,7 @@ Sequence< OUString > SAL_CALL SdPageLinkTargets::getElementNames() { SdrObject* pObj = aIter.Next(); OUString aStr( pObj->GetName() ); - if( aStr.isEmpty() && pObj->ISA( SdrOle2Obj ) ) + if( aStr.isEmpty() && dynamic_cast< const SdrOle2Obj *>( pObj ) != nullptr ) aStr = static_cast< const SdrOle2Obj* >( pObj )->GetPersistName(); if( !aStr.isEmpty() ) nObjCount++; @@ -1981,7 +1981,7 @@ Sequence< OUString > SAL_CALL SdPageLinkTargets::getElementNames() { SdrObject* pObj = aIter.Next(); OUString aStr( pObj->GetName() ); - if( aStr.isEmpty() && pObj->ISA( SdrOle2Obj ) ) + if( aStr.isEmpty() && dynamic_cast< const SdrOle2Obj *>( pObj ) != nullptr ) aStr = static_cast< const SdrOle2Obj* >( pObj )->GetPersistName(); if( !aStr.isEmpty() ) *pStr++ = aStr; @@ -2011,7 +2011,7 @@ SdrObject* SdPageLinkTargets::FindObject( const OUString& rName ) const throw() { SdrObject* pObj = aIter.Next(); OUString aStr( pObj->GetName() ); - if( aStr.isEmpty() && pObj->ISA( SdrOle2Obj ) ) + if( aStr.isEmpty() && dynamic_cast< const SdrOle2Obj *>( pObj ) != nullptr ) aStr = static_cast< const SdrOle2Obj* >( pObj )->GetPersistName(); if( !aStr.isEmpty() && (aStr == rName) ) return pObj; @@ -2319,7 +2319,7 @@ void SAL_CALL SdDrawPage::setName( const OUString& rName ) // fake a mode change to repaint the page tab bar ::sd::DrawDocShell* pDocSh = GetModel()->GetDocShell(); ::sd::ViewShell* pViewSh = pDocSh ? pDocSh->GetViewShell() : NULL; - if( pViewSh && pViewSh->ISA(::sd::DrawViewShell)) + if( pViewSh && dynamic_cast< const ::sd::DrawViewShell* >(pViewSh) != nullptr) { ::sd::DrawViewShell* pDrawViewSh = static_cast< ::sd::DrawViewShell*>(pViewSh); @@ -3037,7 +3037,7 @@ void SAL_CALL SdMasterPage::setName( const OUString& rName ) // fake a mode change to repaint the page tab bar ::sd::DrawDocShell* pDocSh = GetModel()->GetDocShell(); ::sd::ViewShell* pViewSh = pDocSh ? pDocSh->GetViewShell() : NULL; - if( pViewSh && pViewSh->ISA(::sd::DrawViewShell ) ) + if( pViewSh && dynamic_cast< const ::sd::DrawViewShell* >(pViewSh) != nullptr ) { ::sd::DrawViewShell* pDrawViewSh = static_cast< ::sd::DrawViewShell*>(pViewSh); diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx index 86df4579f849..06dd0ef4bdaa 100644 --- a/sd/source/ui/view/DocumentRenderer.cxx +++ b/sd/source/ui/view/DocumentRenderer.cxx @@ -1421,7 +1421,7 @@ private: rOutliner.SetControlWord( nCntrl ); // When in outline view then apply all pending changes to the model. - if (pShell->ISA(OutlineViewShell)) + if( dynamic_cast< OutlineViewShell *>( pShell ) != nullptr) static_cast<OutlineViewShell*>(pShell)->PrepareClose (false); // Collect some frequently used data. diff --git a/sd/source/ui/view/GraphicObjectBar.cxx b/sd/source/ui/view/GraphicObjectBar.cxx index 3de3a18959f6..50907f81262a 100644 --- a/sd/source/ui/view/GraphicObjectBar.cxx +++ b/sd/source/ui/view/GraphicObjectBar.cxx @@ -108,7 +108,7 @@ void GraphicObjectBar::GetFilterState( SfxItemSet& rSet ) { SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); - if( pObj && pObj->ISA( SdrGrafObj ) && ( static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) ) + if( pObj && dynamic_cast< SdrGrafObj *>( pObj ) != nullptr && ( static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) ) bEnable = true; } @@ -124,7 +124,7 @@ void GraphicObjectBar::ExecuteFilter( SfxRequest& rReq ) { SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); - if( pObj && pObj->ISA( SdrGrafObj ) && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) + if( pObj && dynamic_cast< SdrGrafObj *>( pObj ) != nullptr && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) { GraphicObject aFilterObj( static_cast<SdrGrafObj*>(pObj)->GetGraphicObject() ); diff --git a/sd/source/ui/view/MediaObjectBar.cxx b/sd/source/ui/view/MediaObjectBar.cxx index 7c191ae057c7..a0df58bfecd3 100644 --- a/sd/source/ui/view/MediaObjectBar.cxx +++ b/sd/source/ui/view/MediaObjectBar.cxx @@ -93,7 +93,7 @@ void MediaObjectBar::GetState( SfxItemSet& rSet ) { SdrObject* pObj =pMarkList->GetMark( 0 )->GetMarkedSdrObj(); - if( pObj && pObj->ISA( SdrMediaObj ) ) + if( pObj && dynamic_cast< SdrMediaObj *>( pObj ) != nullptr ) { ::avmedia::MediaItem aItem( SID_AVMEDIA_TOOLBOX ); @@ -129,7 +129,7 @@ void MediaObjectBar::Execute( SfxRequest& rReq ) { SdrObject* pObj = pMarkList->GetMark( 0 )->GetMarkedSdrObj(); - if( pObj && pObj->ISA( SdrMediaObj ) ) + if( pObj && dynamic_cast< SdrMediaObj *>( pObj ) != nullptr ) { static_cast< sdr::contact::ViewContactOfSdrMediaObj& >( pObj->GetViewContact() ).executeMediaItem( static_cast< const ::avmedia::MediaItem& >( *pItem ) ); diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index 29521588152b..9cde9d74b9dc 100644 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -251,7 +251,7 @@ void Outliner::PrepareSpelling() { mbPrepareSpellingPending = false; - ViewShellBase* pBase = PTR_CAST(ViewShellBase,SfxViewShell::Current()); + ViewShellBase* pBase = dynamic_cast< ViewShellBase *>( SfxViewShell::Current() ); if (pBase != NULL) SetViewShell (pBase->GetMainViewShell()); SetRefDevice( SD_MOD()->GetRefDevice( *mpDrawDocument->GetDocSh() ) ); @@ -294,7 +294,7 @@ void Outliner::EndSpelling() std::shared_ptr<ViewShell> pViewShell (mpWeakViewShell.lock()); std::shared_ptr<ViewShell> pOldViewShell (pViewShell); - ViewShellBase* pBase = PTR_CAST(ViewShellBase,SfxViewShell::Current()); + ViewShellBase* pBase = dynamic_cast< ViewShellBase *>( SfxViewShell::Current() ); if (pBase != NULL) pViewShell = pBase->GetMainViewShell(); else @@ -303,7 +303,7 @@ void Outliner::EndSpelling() // When in <member>PrepareSpelling()</member> a new outline view has // been created then delete it here. - bool bViewIsDrawViewShell(pViewShell && pViewShell->ISA(DrawViewShell)); + bool bViewIsDrawViewShell(pViewShell && 0 != dynamic_cast< const DrawViewShell *>( pViewShell.get() )); if (bViewIsDrawViewShell) { SetStatusEventHdl(Link<EditStatus&,void>()); @@ -331,7 +331,7 @@ void Outliner::EndSpelling() // changes were done at SpellCheck if(IsModified()) { - if(mpView && mpView->ISA(OutlineView)) + if(mpView && dynamic_cast< const OutlineView *>( mpView ) != nullptr) static_cast<OutlineView*>(mpView)->PrepareClose(false); if(mpDrawDocument && !mpDrawDocument->IsChanged()) mpDrawDocument->SetChanged(); @@ -354,7 +354,7 @@ void Outliner::EndSpelling() bool Outliner::SpellNextDocument() { std::shared_ptr<ViewShell> pViewShell (mpWeakViewShell.lock()); - if (pViewShell->ISA(OutlineViewShell)) + if( 0 != dynamic_cast< const OutlineViewShell *>( pViewShell.get() )) { // When doing a spell check in the outline view then there is // only one document. @@ -363,7 +363,7 @@ bool Outliner::SpellNextDocument() } else { - if (mpView->ISA(OutlineView)) + if( dynamic_cast< const OutlineView *>( mpView ) != nullptr) static_cast<OutlineView*>(mpView)->PrepareClose(false); mpDrawDocument->GetDocSh()->SetWaitCursor( true ); @@ -439,7 +439,7 @@ bool Outliner::StartSearchAndReplace (const SvxSearchItem* pSearchItem) mpDrawDocument->GetDocSh()->SetWaitCursor( true ); if (mbPrepareSpellingPending) PrepareSpelling(); - ViewShellBase* pBase = PTR_CAST(ViewShellBase,SfxViewShell::Current()); + ViewShellBase* pBase = dynamic_cast< ViewShellBase *>( SfxViewShell::Current() ); // Determine whether we have to abort the search. This is necessary // when the main view shell does not support searching. bool bAbort = false; @@ -532,7 +532,7 @@ void Outliner::Initialize (bool bDirectionIsForward) // In case we are searching in an outline view then first remove the // current selection and place cursor at its start or end. - if (pViewShell->ISA(OutlineViewShell)) + if( 0 != dynamic_cast< const OutlineViewShell *>( pViewShell.get() )) { ESelection aSelection = mpImpl->GetOutlinerView()->GetSelection (); if (mbDirectionIsForward) @@ -591,7 +591,7 @@ bool Outliner::SearchAndReplaceAll() return true; } - if (pViewShell->ISA(OutlineViewShell)) + if( 0 != dynamic_cast< const OutlineViewShell *>( pViewShell.get() )) { // Put the cursor to the beginning/end of the outliner. mpImpl->GetOutlinerView()->SetSelection (GetSearchStartPosition ()); @@ -599,7 +599,7 @@ bool Outliner::SearchAndReplaceAll() // The outliner does all the work for us when we are in this mode. SearchAndReplaceOnce(); } - else if (pViewShell->ISA(DrawViewShell)) + else if( 0 != dynamic_cast< const DrawViewShell *>( pViewShell.get() )) { // Go to beginning/end of document. maObjectIterator = ::sd::outliner::OutlinerContainer(this).begin(); @@ -644,7 +644,7 @@ bool Outliner::SearchAndReplaceOnce() mpWindow = pViewShell->GetActiveWindow(); pOutlinerView->SetWindow(mpWindow); - if (pViewShell->ISA(DrawViewShell) ) + if( 0 != dynamic_cast< const DrawViewShell *>( pViewShell.get() )) { // When replacing we first check if there is a selection // indicating a match. If there is then replace it. The @@ -689,7 +689,7 @@ bool Outliner::SearchAndReplaceOnce() } } } - else if (pViewShell->ISA(OutlineViewShell)) + else if( 0 != dynamic_cast< const OutlineViewShell *>( pViewShell.get() )) { mpDrawDocument->GetDocSh()->SetWaitCursor(false); // The following loop is executed more than once only when a @@ -835,7 +835,7 @@ void Outliner::RememberStartPosition() if ( mnStartPageIndex != (sal_uInt16) -1 ) return; - if (pViewShell->ISA(DrawViewShell)) + if( 0 != dynamic_cast< const DrawViewShell *>( pViewShell.get() )) { std::shared_ptr<DrawViewShell> pDrawViewShell ( std::dynamic_pointer_cast<DrawViewShell>(pViewShell)); @@ -863,7 +863,7 @@ void Outliner::RememberStartPosition() } } } - else if (pViewShell->ISA(OutlineViewShell)) + else if( 0 != dynamic_cast< const OutlineViewShell *>( pViewShell.get() )) { // Remember the current cursor position. OutlinerView* pView = GetView(0); @@ -890,7 +890,7 @@ void Outliner::RestoreStartPosition() if (bRestore) { - if (pViewShell->ISA(DrawViewShell)) + if( 0 != dynamic_cast< const DrawViewShell *>( pViewShell.get() )) { std::shared_ptr<DrawViewShell> pDrawViewShell ( std::dynamic_pointer_cast<DrawViewShell>(pViewShell)); @@ -898,7 +898,7 @@ void Outliner::RestoreStartPosition() if (pDrawViewShell.get() != NULL) SetPage (meStartEditMode, mnStartPageIndex); } - else if (pViewShell->ISA(OutlineViewShell)) + else if( 0 != dynamic_cast< const OutlineViewShell *>( pViewShell.get() )) { // Set cursor to its old position. OutlinerView* pView = GetView(0); @@ -996,7 +996,7 @@ void Outliner::EndOfSearch() // Before we display a dialog we first jump to where the last valid text // object was found. All page and view mode switching since then was // temporary and should not be visible to the user. - if ( ! pViewShell->ISA(OutlineViewShell)) + if( 0 == dynamic_cast< const OutlineViewShell *>( pViewShell.get() )) SetObject (maLastValidPosition); if (mbRestrictSearchToSelection) @@ -1016,7 +1016,7 @@ void Outliner::EndOfSearch() mbMatchMayExist = false; // Everything back to beginning (or end?) of the document. maObjectIterator = ::sd::outliner::OutlinerContainer(this).begin(); - if (pViewShell->ISA(OutlineViewShell)) + if( 0 != dynamic_cast< const OutlineViewShell *>( pViewShell.get() )) { // Set cursor to first character of the document. OutlinerView* pOutlinerView = mpImpl->GetOutlinerView(); @@ -1425,7 +1425,7 @@ void Outliner::StartConversion( sal_Int16 nSourceLanguage, sal_Int16 nTargetLan const vcl::Font *pTargetFont, sal_Int32 nOptions, bool bIsInteractive ) { std::shared_ptr<ViewShell> pViewShell (mpWeakViewShell.lock()); - bool bMultiDoc = pViewShell->ISA(DrawViewShell); + bool bMultiDoc = 0 != dynamic_cast< const DrawViewShell *>( pViewShell.get() ); meMode = TEXT_CONVERSION; mbDirectionIsForward = true; @@ -1477,7 +1477,7 @@ void Outliner::BeginConversion() { SetRefDevice( SD_MOD()->GetRefDevice( *mpDrawDocument->GetDocSh() ) ); - ViewShellBase* pBase = PTR_CAST(ViewShellBase, SfxViewShell::Current()); + ViewShellBase* pBase = dynamic_cast<ViewShellBase*>( SfxViewShell::Current() ); if (pBase != NULL) SetViewShell (pBase->GetMainViewShell()); @@ -1510,7 +1510,7 @@ void Outliner::EndConversion() bool Outliner::ConvertNextDocument() { std::shared_ptr<ViewShell> pViewShell (mpWeakViewShell.lock()); - if (pViewShell && pViewShell->ISA(OutlineViewShell) ) + if (pViewShell && 0 != dynamic_cast< const OutlineViewShell *>( pViewShell.get() ) ) return false; mpDrawDocument->GetDocSh()->SetWaitCursor( true ); diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index 6c4e4041eda6..df28bb3a22b9 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -244,7 +244,7 @@ ViewShellBase::ViewShellBase ( _pFrame->GetWindow().SetBackground(Application::GetSettings().GetStyleSettings().GetLightColor()); // Set up the members in the correct order. - if (GetViewFrame()->GetObjectShell()->ISA(DrawDocShell)) + if (0 != dynamic_cast< DrawDocShell *>( GetViewFrame()->GetObjectShell() )) mpDocShell = static_cast<DrawDocShell*>( GetViewFrame()->GetObjectShell()); if (mpDocShell != NULL) @@ -386,7 +386,7 @@ ViewShellBase* ViewShellBase::GetViewShellBase (SfxViewFrame* pViewFrame) // Get the view shell for the frame and cast it to // sd::ViewShellBase. SfxViewShell* pSfxViewShell = pViewFrame->GetViewShell(); - if (pSfxViewShell!=NULL && pSfxViewShell->ISA(::sd::ViewShellBase)) + if (pSfxViewShell!=NULL && dynamic_cast< ::sd::ViewShellBase *>( pSfxViewShell ) != nullptr) pBase = static_cast<ViewShellBase*>(pSfxViewShell); } @@ -689,7 +689,7 @@ void ViewShellBase::ReadUserDataSequence ( case ViewShell::ST_HANDOUT: { OUString sViewURL; - switch (PTR_CAST(DrawViewShell, pShell)->GetPageKind()) + switch (dynamic_cast<DrawViewShell*>( pShell)->GetPageKind() ) { default: case PK_STANDARD: @@ -1270,8 +1270,8 @@ void ViewShellBase::Implementation::GetSlotState (SfxItemSet& rSet) ViewShell* pCenterViewShell = FrameworkHelper::Instance(mrBase)->GetViewShell( FrameworkHelper::msCenterPaneURL).get(); bool bMasterPageMode (false); - if (pCenterViewShell!=NULL && pCenterViewShell->ISA(DrawViewShell)) - if (PTR_CAST(DrawViewShell,pCenterViewShell)->GetEditMode() + if (pCenterViewShell!=NULL && dynamic_cast< DrawViewShell *>( pCenterViewShell ) != nullptr) + if (dynamic_cast< DrawViewShell *>( pCenterViewShell )->GetEditMode() == EM_MASTERPAGE) { bMasterPageMode = true; diff --git a/sd/source/ui/view/ViewShellImplementation.cxx b/sd/source/ui/view/ViewShellImplementation.cxx index 970e9db8a05f..2dfddca385a9 100644 --- a/sd/source/ui/view/ViewShellImplementation.cxx +++ b/sd/source/ui/view/ViewShellImplementation.cxx @@ -234,8 +234,8 @@ void ViewShell::Implementation::ProcessModifyPageSlot ( void ViewShell::Implementation::AssignLayout ( SfxRequest& rRequest, PageKind ePageKind ) { - const SfxUInt32Item* pWhatPage = static_cast< const SfxUInt32Item* > ( rRequest.GetArg( ID_VAL_WHATPAGE, false, TYPE(SfxUInt32Item) ) ); - const SfxUInt32Item* pWhatLayout = static_cast< const SfxUInt32Item* > ( rRequest.GetArg( ID_VAL_WHATLAYOUT, false, TYPE(SfxUInt32Item) ) ); + const SfxUInt32Item* pWhatPage = static_cast< const SfxUInt32Item* > ( rRequest.GetArg( ID_VAL_WHATPAGE, false, checkSfxPoolItem< SfxUInt32Item > ) ); + const SfxUInt32Item* pWhatLayout = static_cast< const SfxUInt32Item* > ( rRequest.GetArg( ID_VAL_WHATLAYOUT, false, checkSfxPoolItem< SfxUInt32Item > ) ); SdDrawDocument* pDocument = mrViewShell.GetDoc(); if( !pDocument ) diff --git a/sd/source/ui/view/drbezob.cxx b/sd/source/ui/view/drbezob.cxx index a52dd5786ea0..24c141789627 100644 --- a/sd/source/ui/view/drbezob.cxx +++ b/sd/source/ui/view/drbezob.cxx @@ -96,12 +96,12 @@ void BezierObjectBar::GetAttrState(SfxItemSet& rSet) if(xFunc.is()) { - if(xFunc->ISA(FuSelection)) + if( 0 != dynamic_cast< const FuSelection *>( xFunc.get() )) { sal_uInt16 nEditMode = static_cast<FuSelection*>(xFunc.get())->GetEditMode(); rSet.Put(SfxBoolItem(nEditMode, true)); } - else if (xFunc->ISA(FuConstructBezierPolygon)) + else if( 0 != dynamic_cast< const FuConstructBezierPolygon *>( xFunc.get() )) { sal_uInt16 nEditMode = static_cast<FuConstructBezierPolygon*>(xFunc.get())->GetEditMode(); rSet.Put(SfxBoolItem(nEditMode, true)); @@ -302,11 +302,11 @@ void BezierObjectBar::Execute(SfxRequest& rReq) if(xFunc.is()) { - if(xFunc->ISA(FuSelection)) + if( 0 != dynamic_cast< const FuSelection *>( xFunc.get() )) { static_cast<FuSelection*>(xFunc.get())->SetEditMode(rReq.GetSlot()); } - else if(xFunc->ISA(FuConstructBezierPolygon)) + else if( 0 != dynamic_cast< const FuConstructBezierPolygon *>( xFunc.get() )) { static_cast<FuConstructBezierPolygon*>(xFunc.get())->SetEditMode(rReq.GetSlot()); } diff --git a/sd/source/ui/view/drtxtob.cxx b/sd/source/ui/view/drtxtob.cxx index 45c868f13f06..900ea482b165 100644 --- a/sd/source/ui/view/drtxtob.cxx +++ b/sd/source/ui/view/drtxtob.cxx @@ -189,7 +189,7 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) OutlinerView* pOLV = mpView->GetTextEditOutlinerView(); SdrOutliner *pOutliner = mpView->GetTextEditOutliner(); - if (mpView->ISA(OutlineView)) + if( dynamic_cast< const OutlineView *>( mpView ) != nullptr) { pOLV = static_cast<OutlineView*>(mpView)->GetViewByWindow( mpViewShell->GetActiveWindow()); @@ -261,13 +261,13 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) { OutlinerView* pOLV = mpView->GetTextEditOutlinerView(); - if (mpView->ISA(OutlineView)) + if( dynamic_cast< const OutlineView *>( mpView ) != nullptr) { pOLV = static_cast<OutlineView*>(mpView)->GetViewByWindow( mpViewShell->GetActiveWindow()); } - bool bOutlineViewSh = mpViewShell->ISA(OutlineViewShell); + bool bOutlineViewSh = dynamic_cast< const OutlineViewShell *>( mpViewShell ) != nullptr; if (pOLV && ( pOLV->GetOutliner()->GetMode() == OUTLINERMODE_OUTLINEOBJECT || bOutlineViewSh ) ) @@ -428,7 +428,7 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) rSet.Put( aAttrSet, false ); // <- sal_False, so DontCare-Status gets acquired // these are disabled in outline-mode - if (!mpViewShell || !mpViewShell->ISA(DrawViewShell)) + if (!mpViewShell || dynamic_cast< const DrawViewShell *>( mpViewShell ) == nullptr) { rSet.DisableItem( SID_ATTR_PARA_ADJUST_LEFT ); rSet.DisableItem( SID_ATTR_PARA_ADJUST_RIGHT ); diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx index be7b3fc0cdc4..4a50c0374a32 100644 --- a/sd/source/ui/view/drtxtob1.cxx +++ b/sd/source/ui/view/drtxtob1.cxx @@ -89,7 +89,7 @@ void TextObjectBar::Execute( SfxRequest &rReq ) std::unique_ptr< OutlineViewModelChangeGuard > aGuard; - if (mpView->ISA(OutlineView)) + if( dynamic_cast< const OutlineView *>( mpView ) != nullptr) { pOLV = static_cast<OutlineView*>(mpView) ->GetViewByWindow(mpViewShell->GetActiveWindow()); diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index 2a8c7bfb6844..67c41682501c 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -37,6 +37,7 @@ #include <editeng/editdata.hxx> #include <editeng/eeitem.hxx> #include <editeng/flditem.hxx> +#include <editeng/editeng.hxx> #include <sfx2/bindings.hxx> #include <sfx2/dispatch.hxx> @@ -808,7 +809,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) ::Outliner* pOutl = mpDrawView->GetTextEditOutliner(); if (pOutl) { - pOutl->RemoveFields(true, SvxURLField::StaticType()); + pOutl->RemoveFields(true, checkSvxFieldData<SvxURLField>); } pSet.reset(new SfxItemSet( GetPool(), EE_ITEMS_START, EE_ITEMS_END )); @@ -953,7 +954,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) if( rMarkList.GetMarkCount() == 1 ) { SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); - if( pObj && pObj->ISA( SdrGrafObj ) && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) + if( pObj && dynamic_cast< const SdrGrafObj *>( pObj ) != nullptr && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) { GraphicObject aGraphicObject( static_cast<SdrGrafObj*>( pObj )->GetGraphicObject() ); { @@ -972,7 +973,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) if( rMarkList.GetMarkCount() == 1 ) { SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); - if( pObj && pObj->ISA( SdrGrafObj ) && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) + if( pObj && dynamic_cast< const SdrGrafObj *>( pObj ) != nullptr && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) { GraphicObject aGraphicObject( static_cast<SdrGrafObj*>(pObj)->GetGraphicObject() ); m_ExternalEdits.push_back( @@ -993,7 +994,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) { SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); - if( pObj && pObj->ISA( SdrGrafObj ) && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) + if( pObj && dynamic_cast< const SdrGrafObj *>( pObj ) != nullptr && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) { SdrGrafObj* pGraphicObj = static_cast<SdrGrafObj*>(pObj); ScopedVclPtrInstance< CompressGraphicsDialog > dialog( GetParentWindow(), pGraphicObj, GetViewFrame()->GetBindings() ); @@ -1700,7 +1701,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) if ( pFieldItem ) { const SvxFieldData* pField = pFieldItem->GetField(); - if( pField && pField->ISA( SvxURLField ) ) + if( pField && dynamic_cast< const SvxURLField *>( pField ) != nullptr ) { const SvxURLField* pURLField = static_cast< const SvxURLField* >( pField ); @@ -1905,13 +1906,13 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) { const SvxFieldItem* pOldFldItem = pOLV->GetFieldAtSelection(); - if( pOldFldItem && ( pOldFldItem->GetField()->ISA( SvxURLField ) || - pOldFldItem->GetField()->ISA( SvxDateField ) || - pOldFldItem->GetField()->ISA( SvxTimeField ) || - pOldFldItem->GetField()->ISA( SvxExtTimeField ) || - pOldFldItem->GetField()->ISA( SvxExtFileField ) || - pOldFldItem->GetField()->ISA( SvxAuthorField ) || - pOldFldItem->GetField()->ISA( SvxPageField ) ) ) + if( pOldFldItem && ( 0 != dynamic_cast< const SvxURLField *>( pOldFldItem->GetField() ) || + 0 != dynamic_cast< const SvxDateField *>( pOldFldItem->GetField() ) || + 0 != dynamic_cast< const SvxTimeField *>( pOldFldItem->GetField() ) || + 0 != dynamic_cast< const SvxExtTimeField *>( pOldFldItem->GetField() ) || + 0 != dynamic_cast< const SvxExtFileField *>( pOldFldItem->GetField() ) || + 0 != dynamic_cast< const SvxAuthorField *>( pOldFldItem->GetField() ) || + 0 != dynamic_cast< const SvxPageField *>( pOldFldItem->GetField() ) ) ) { // select field, then it will be deleted when inserting ESelection aSel = pOLV->GetSelection(); @@ -1970,10 +1971,10 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) { const SvxFieldItem* pFldItem = pOLV->GetFieldAtSelection(); - if( pFldItem && (pFldItem->GetField()->ISA( SvxDateField ) || - pFldItem->GetField()->ISA( SvxAuthorField ) || - pFldItem->GetField()->ISA( SvxExtFileField ) || - pFldItem->GetField()->ISA( SvxExtTimeField ) ) ) + if( pFldItem && (0 != dynamic_cast< const SvxDateField *>( pFldItem->GetField() ) || + 0 != dynamic_cast< const SvxAuthorField *>( pFldItem->GetField() ) || + 0 != dynamic_cast< const SvxExtFileField *>( pFldItem->GetField() ) || + 0 != dynamic_cast< const SvxExtTimeField *>( pFldItem->GetField() ) ) ) { // Dialog... SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); @@ -2335,8 +2336,8 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) { SdrMark* pM=rMarkList.GetMark(nm); SdrObject* pObj=pM->GetMarkedSdrObj(); - SdrGrafObj* pGraf=PTR_CAST(SdrGrafObj,pObj); - SdrOle2Obj* pOle2=PTR_CAST(SdrOle2Obj,pObj); + SdrGrafObj* pGraf= dynamic_cast< SdrGrafObj *>( pObj ); + SdrOle2Obj* pOle2= dynamic_cast< SdrOle2Obj *>( pObj ); if(pGraf) { diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx index 7d073ae2ea80..9a162934414c 100644 --- a/sd/source/ui/view/drviews4.cxx +++ b/sd/source/ui/view/drviews4.cxx @@ -153,7 +153,7 @@ bool DrawViewShell::KeyInput (const KeyEvent& rKEvt, ::sd::Window* pWin) { SdrObject* pObj = aIter.Next(); - if(pObj && pObj->ISA(SdrTextObj)) + if(pObj && dynamic_cast< const SdrTextObj *>( pObj ) != nullptr) { sal_uInt32 nInv(pObj->GetObjInventor()); sal_uInt16 nKnd(pObj->GetObjIdentifier()); @@ -507,7 +507,7 @@ void DrawViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin) pWin != NULL && !mpDrawView->IsAction() && !SD_MOD()->GetWaterCan() ) { sal_uInt16 nSdResId = 0; // ResourceID for popup menu - bool bGraphicShell = this->ISA(GraphicViewShell); + bool bGraphicShell = dynamic_cast< const GraphicViewShell *>( this ) != nullptr; // is there a snap object under the cursor? SdrPageView* pPV; @@ -538,10 +538,10 @@ void DrawViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin) nSdResId = RID_DRAW_GLUEPOINT_POPUP; } // field command? - else if( pFldItem && (pFldItem->GetField()->ISA( SvxDateField ) || - pFldItem->GetField()->ISA( SvxExtTimeField ) || - pFldItem->GetField()->ISA( SvxExtFileField ) || - pFldItem->GetField()->ISA( SvxAuthorField ) ) ) + else if( pFldItem && (0 != dynamic_cast< const SvxDateField *>( pFldItem->GetField() ) || + 0 != dynamic_cast< const SvxExtTimeField *>( pFldItem->GetField() ) || + 0 != dynamic_cast< const SvxExtFileField *>( pFldItem->GetField() ) || + 0 != dynamic_cast< const SvxAuthorField *>( pFldItem->GetField() ) ) ) { LanguageType eLanguage( LANGUAGE_SYSTEM ); diff --git a/sd/source/ui/view/drviews6.cxx b/sd/source/ui/view/drviews6.cxx index 607c54dbb8a9..d6565591acbb 100644 --- a/sd/source/ui/view/drviews6.cxx +++ b/sd/source/ui/view/drviews6.cxx @@ -356,7 +356,7 @@ void DrawViewShell::GetBmpMaskState( SfxItemSet& rSet ) pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); // valid graphic object? - if( pObj && pObj->ISA( SdrGrafObj ) && + if( pObj && dynamic_cast< const SdrGrafObj *>( pObj ) != nullptr && !static_cast<const SdrGrafObj*>(pObj)->IsEPS() && !mpDrawView->IsTextEdit() ) { diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx index 480b433445de..f165ddbb5fc9 100644 --- a/sd/source/ui/view/drviews7.cxx +++ b/sd/source/ui/view/drviews7.cxx @@ -609,7 +609,7 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet ) // avoid clipboard initialization for // read-only presentation views (workaround for NT4.0 // clipboard prob...) - if( !ISA(PresentationViewShell) ) + if( dynamic_cast< const PresentationViewShell *>( this ) == nullptr ) { // create listener mpClipEvtLstnr = new TransferableClipboardListener( LINK( this, DrawViewShell, ClipboardChanged ) ); @@ -1491,7 +1491,7 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet ) if ( abs( aSel.nEndPos - aSel.nStartPos ) == 1 ) { const SvxFieldData* pField = pFieldItem->GetField(); - if ( pField->ISA(SvxURLField) ) + if ( dynamic_cast< const SvxURLField *>( pField ) != nullptr ) bDisableEditHyperlink = false; } } @@ -1499,7 +1499,7 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet ) } else { - SdrUnoObj* pUnoCtrl = PTR_CAST(SdrUnoObj, mpDrawView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj()); + SdrUnoObj* pUnoCtrl = dynamic_cast<SdrUnoObj*>( mpDrawView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj() ); if ( pUnoCtrl && FmFormInventor == pUnoCtrl->GetObjInventor() ) { diff --git a/sd/source/ui/view/drviews8.cxx b/sd/source/ui/view/drviews8.cxx index 17c070993c8f..c1d409e6727b 100644 --- a/sd/source/ui/view/drviews8.cxx +++ b/sd/source/ui/view/drviews8.cxx @@ -110,7 +110,7 @@ void DrawViewShell::ScannerEvent( const ::com::sun::star::lang::EventObject& ) SdrMark* pMark = rMarkList.GetMark(0); SdrObject* pObj = pMark->GetMarkedSdrObj(); - if( pObj->ISA( SdrGrafObj ) ) + if( dynamic_cast< SdrGrafObj *>( pObj ) != nullptr ) { pGrafObj = static_cast< SdrGrafObj* >( pObj ); diff --git a/sd/source/ui/view/drviewsc.cxx b/sd/source/ui/view/drviewsc.cxx index 72e50e70b0c8..68266fc0591f 100644 --- a/sd/source/ui/view/drviewsc.cxx +++ b/sd/source/ui/view/drviewsc.cxx @@ -53,7 +53,7 @@ namespace sd { void DrawViewShell::UpdateIMapDlg( SdrObject* pObj ) { - if( ( pObj->ISA( SdrGrafObj ) || pObj->ISA( SdrOle2Obj ) ) && !mpDrawView->IsTextEdit() && + if( ( dynamic_cast< SdrGrafObj *>( pObj ) != nullptr || dynamic_cast< SdrOle2Obj *>( pObj ) != nullptr ) && !mpDrawView->IsTextEdit() && GetViewFrame()->HasChildWindow( SvxIMapDlgChildWindow::GetChildWindowId() ) ) { Graphic aGraphic; diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx index 9a86ddbd0f10..32e15576e051 100644 --- a/sd/source/ui/view/drviewse.cxx +++ b/sd/source/ui/view/drviewse.cxx @@ -266,7 +266,7 @@ void DrawViewShell::FuPermanent(SfxRequest& rReq) if(pDescriptorItem) { // get the form view - FmFormView* pFormView = PTR_CAST(FmFormView, mpDrawView); + FmFormView* pFormView = dynamic_cast<FmFormView*>( mpDrawView ); SdrPageView* pPageView = pFormView ? pFormView->GetSdrPageView() : NULL; if(pPageView) @@ -348,7 +348,7 @@ void DrawViewShell::FuPermanent(SfxRequest& rReq) while (i < nMarkCnt && !b3DObjMarked) { - if (rMarkList.GetMark(i)->GetMarkedSdrObj()->ISA(E3dObject)) + if (0 != dynamic_cast< E3dObject *>( rMarkList.GetMark(i)->GetMarkedSdrObj() )) { b3DObjMarked = true; } diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx index 1e1e322f817d..bd6070a3ee53 100644 --- a/sd/source/ui/view/drviewsf.cxx +++ b/sd/source/ui/view/drviewsf.cxx @@ -97,7 +97,7 @@ void DrawViewShell::GetCtrlState(SfxItemSet &rSet) if ( abs( aSel.nEndPos - aSel.nStartPos ) == 1 ) { 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/sd/source/ui/view/drviewsg.cxx b/sd/source/ui/view/drviewsg.cxx index 94bb4df5e5c4..ab5a8d3f214d 100644 --- a/sd/source/ui/view/drviewsg.cxx +++ b/sd/source/ui/view/drviewsg.cxx @@ -85,7 +85,7 @@ void DrawViewShell::GetIMapState( SfxItemSet& rSet ) const SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); SvxIMapDlg* pImageMapDialog = ViewShell::Implementation::GetImageMapDialog(); - if ( ( pObj->ISA( SdrGrafObj ) /*|| pObj->ISA( SdrOle2Obj )*/ ) + if ( ( dynamic_cast< const SdrGrafObj *>( pObj ) != nullptr /*|| pObj->ISA( SdrOle2Obj )*/ ) && pImageMapDialog!=NULL && ( pImageMapDialog->GetEditingObject() == static_cast<void const *>(pObj) ) ) { diff --git a/sd/source/ui/view/drviewsj.cxx b/sd/source/ui/view/drviewsj.cxx index 503b7404ae52..b8a19814ea0b 100644 --- a/sd/source/ui/view/drviewsj.cxx +++ b/sd/source/ui/view/drviewsj.cxx @@ -134,14 +134,14 @@ void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet ) /* If it is not a group object or 3D object, we disable "enter group". */ - if( !( ( pObj->ISA( SdrObjGroup ) && nInv == SdrInventor ) || - (pObj->ISA (E3dPolyScene) || pObj->ISA (E3dScene) /*|| pObj->ISA (E3dCompoundObject) */) ) ) + if( !( ( dynamic_cast< const SdrObjGroup *>( pObj ) != nullptr && nInv == SdrInventor ) || + (dynamic_cast< const E3dPolyScene* >(pObj) != nullptr|| dynamic_cast< const E3dScene* >(pObj) != nullptr /*|| pObj->ISA (E3dCompoundObject) */) ) ) { rSet.DisableItem( SID_ENTER_GROUP ); } // If it is not a group object, we disable "ungroup" - if (!(pObj->ISA(SdrObjGroup) && nInv == SdrInventor)) + if(!(dynamic_cast< const SdrObjGroup *>( pObj ) != nullptr && nInv == SdrInventor)) { rSet.DisableItem(SID_UNGROUP); } @@ -170,7 +170,7 @@ void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet ) rSet.DisableItem( SID_ATTR_FILL_TRANSPARENCE ); rSet.DisableItem( SID_ATTR_FILL_FLOATTRANSPARENCE ); } - if( (!pObj->ISA( SdrPathObj ) && !aInfoRec.bCanConvToPath) || pObj->ISA( SdrObjGroup ) ) // As long as JOE handles it incorrectly! + if( (dynamic_cast< const SdrPathObj *>( pObj ) == nullptr&& !aInfoRec.bCanConvToPath) || dynamic_cast< const SdrObjGroup *>( pObj ) != nullptr ) // As long as JOE handles it incorrectly! { // JOE: a group object may can be converted into a PathObj rSet.DisableItem( SID_LINEEND_POLYGON ); } @@ -225,7 +225,7 @@ void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet ) rSet.DisableItem( SID_OBJECT_SHEAR ); } - if(pObj->ISA(E3dCompoundObject)) + if(dynamic_cast< const E3dCompoundObject *>( pObj ) != nullptr) { rSet.DisableItem( SID_OBJECT_ALIGN ); rSet.DisableItem( SID_OBJECT_ALIGN_LEFT ); @@ -268,10 +268,10 @@ void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet ) { const SvxFieldItem* pFldItem = pOLV->GetFieldAtSelection(); - if( !( pFldItem && (pFldItem->GetField()->ISA( SvxDateField ) || - pFldItem->GetField()->ISA( SvxAuthorField ) || - pFldItem->GetField()->ISA( SvxExtFileField ) || - pFldItem->GetField()->ISA( SvxExtTimeField ) ) ) ) + if( !( pFldItem && (0 != dynamic_cast< const SvxDateField *>( pFldItem->GetField() ) || + 0 != dynamic_cast< const SvxAuthorField *>( pFldItem->GetField() ) || + 0 != dynamic_cast< const SvxExtFileField *>( pFldItem->GetField() ) || + 0 != dynamic_cast< const SvxExtTimeField *>( pFldItem->GetField() ) ) ) ) { rSet.DisableItem( SID_MODIFY_FIELD ); } @@ -360,9 +360,9 @@ void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet ) } else if (nInv == E3dInventor) { - if(pObj->ISA(E3dScene)) + if(dynamic_cast< const E3dScene *>( pObj ) != nullptr) b3dObj = true; - else if(pObj->ISA(E3dCompoundObject)) + else if(dynamic_cast< const E3dCompoundObject* >(pObj) != nullptr) bE3dCompoundObject = true; } } diff --git a/sd/source/ui/view/frmview.cxx b/sd/source/ui/view/frmview.cxx index 03db5e64631d..c1f65c78b39f 100644 --- a/sd/source/ui/view/frmview.cxx +++ b/sd/source/ui/view/frmview.cxx @@ -84,7 +84,7 @@ FrameView::FrameView(SdDrawDocument* pDrawDoc, FrameView* pFrameView /* = NULK * // Count the FrameViews and remember the type of the main // view shell. SfxViewShell* pSfxViewSh = pSfxViewFrame->GetViewShell(); - ViewShellBase* pBase = PTR_CAST(ViewShellBase, pSfxViewSh ); + ViewShellBase* pBase = dynamic_cast<ViewShellBase*>( pSfxViewSh ); if (pBase != NULL) { diff --git a/sd/source/ui/view/outlnvs2.cxx b/sd/source/ui/view/outlnvs2.cxx index a12ac7bb4b38..366ac905703a 100644 --- a/sd/source/ui/view/outlnvs2.cxx +++ b/sd/source/ui/view/outlnvs2.cxx @@ -546,14 +546,14 @@ void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq) const SvxFieldItem* pOldFldItem = pOutlinerView->GetFieldAtSelection(); - if( pOldFldItem && ( pOldFldItem->GetField()->ISA( SvxURLField ) || - pOldFldItem->GetField()->ISA( SvxDateField ) || - pOldFldItem->GetField()->ISA( SvxTimeField ) || - pOldFldItem->GetField()->ISA( SvxExtTimeField ) || - pOldFldItem->GetField()->ISA( SvxExtFileField ) || - pOldFldItem->GetField()->ISA( SvxAuthorField ) || - pOldFldItem->GetField()->ISA( SvxPageField ) || - pOldFldItem->GetField()->ISA( SvxPagesField )) ) + if( pOldFldItem && ( 0 != dynamic_cast< const SvxURLField *>( pOldFldItem->GetField() ) || + 0 != dynamic_cast< const SvxDateField *>( pOldFldItem->GetField() ) || + 0 != dynamic_cast< const SvxTimeField *>( pOldFldItem->GetField() ) || + 0 != dynamic_cast< const SvxExtTimeField *>( pOldFldItem->GetField() ) || + 0 != dynamic_cast< const SvxExtFileField *>( pOldFldItem->GetField() ) || + 0 != dynamic_cast< const SvxAuthorField *>( pOldFldItem->GetField() ) || + 0 != dynamic_cast< const SvxPageField *>( pOldFldItem->GetField() ) || + 0 != dynamic_cast< const SvxPagesField *>( pOldFldItem->GetField() )) ) { // select field, so it gets deleted on Insert ESelection aSel = pOutlinerView->GetSelection(); @@ -576,10 +576,10 @@ void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq) { const SvxFieldItem* pFldItem = pOutlinerView->GetFieldAtSelection(); - if( pFldItem && (pFldItem->GetField()->ISA( SvxDateField ) || - pFldItem->GetField()->ISA( SvxAuthorField ) || - pFldItem->GetField()->ISA( SvxExtFileField ) || - pFldItem->GetField()->ISA( SvxExtTimeField ) ) ) + if( pFldItem && (0 != dynamic_cast< const SvxDateField *>( pFldItem->GetField() ) || + 0 != dynamic_cast< const SvxAuthorField *>( pFldItem->GetField() ) || + 0 != dynamic_cast< const SvxExtFileField *>( pFldItem->GetField() ) || + 0 != dynamic_cast< const SvxExtTimeField *>( pFldItem->GetField() ) ) ) { // Dialog... SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx index e540acf76d8a..feedfac3d24a 100644 --- a/sd/source/ui/view/outlnvsh.cxx +++ b/sd/source/ui/view/outlnvsh.cxx @@ -371,7 +371,7 @@ void OutlineViewShell::GetCtrlState(SfxItemSet &rSet) if ( abs( aSel.nEndPos - aSel.nStartPos ) == 1 ) { 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()); @@ -941,10 +941,10 @@ void OutlineViewShell::GetMenuState( SfxItemSet &rSet ) { const SvxFieldItem* pFldItem = pOutlinerView->GetFieldAtSelection(); - if( !( pFldItem && (pFldItem->GetField()->ISA( SvxDateField ) || - pFldItem->GetField()->ISA( SvxAuthorField ) || - pFldItem->GetField()->ISA( SvxExtFileField ) || - pFldItem->GetField()->ISA( SvxExtTimeField ) ) ) ) + if( !( pFldItem && (0 != dynamic_cast< const SvxDateField *>( pFldItem->GetField() ) || + 0 != dynamic_cast< const SvxAuthorField *>( pFldItem->GetField() ) || + 0 != dynamic_cast< const SvxExtFileField *>( pFldItem->GetField() ) || + 0 != dynamic_cast< const SvxExtTimeField *>( pFldItem->GetField() ) ) ) ) { rSet.DisableItem( SID_MODIFY_FIELD ); } diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx index 8b100921d904..6a88acb4599f 100644 --- a/sd/source/ui/view/sdview.cxx +++ b/sd/source/ui/view/sdview.cxx @@ -222,7 +222,7 @@ drawinglayer::primitive2d::Primitive2DSequence ViewRedirector::createRedirectedP { bool bCreateOutline(false); - if( pObject->IsEmptyPresObj() && pObject->ISA(SdrTextObj) ) + if( pObject->IsEmptyPresObj() && dynamic_cast< SdrTextObj *>( pObject ) != nullptr ) { if( !bSubContentProcessing || !pObject->IsNotVisibleAsMaster() ) { @@ -992,7 +992,7 @@ bool View::IsMorphingAllowed() const ( nKind1 != OBJ_GRAF && nKind2 != OBJ_GRAF ) && ( nKind1 != OBJ_OLE2 && nKind2 != OBJ_OLE2 ) && ( nKind1 != OBJ_CAPTION && nKind2 != OBJ_CAPTION ) && - !pObj1->ISA( E3dObject) && !pObj2->ISA( E3dObject) ) + dynamic_cast< const E3dObject *>( pObj1 ) == nullptr && dynamic_cast< const E3dObject *>( pObj2 ) == nullptr ) { SfxItemSet aSet1( mrDoc.GetPool(), XATTR_FILLSTYLE, XATTR_FILLSTYLE ); SfxItemSet aSet2( mrDoc.GetPool(), XATTR_FILLSTYLE, XATTR_FILLSTYLE ); @@ -1276,7 +1276,7 @@ bool View::ShouldToggleOn( SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(GetMarkedObjectByIndex(nIndex)); if (!pTextObj || pTextObj->IsTextEditActive()) continue; - if (pTextObj->ISA(SdrTableObj)) + if( dynamic_cast< const SdrTableObj *>( pTextObj ) != nullptr) { SdrTableObj* pTableObj = dynamic_cast< SdrTableObj* >(pTextObj); if (!pTableObj) @@ -1346,7 +1346,7 @@ void View::ChangeMarkedObjectsBulletsNumbering( SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(GetMarkedObjectByIndex(nIndex)); if (!pTextObj || pTextObj->IsTextEditActive()) continue; - if (pTextObj->ISA(SdrTableObj)) + if( dynamic_cast< SdrTableObj *>( pTextObj ) != nullptr) { SdrTableObj* pTableObj = dynamic_cast< SdrTableObj* >(pTextObj); if (!pTableObj) diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx index 24bff878d70c..c440d4befcc9 100644 --- a/sd/source/ui/view/sdview2.cxx +++ b/sd/source/ui/view/sdview2.cxx @@ -126,7 +126,7 @@ struct SdNavigatorDropEvent : public ExecuteDropEvent { SdrObject* pObj = GetMarkedObjectByIndex(0); - if( pObj && pObj->ISA(SdrOle2Obj) && static_cast<SdrOle2Obj*>(pObj)->GetObjRef().is() ) + if( pObj && dynamic_cast< const SdrOle2Obj *>( pObj ) != nullptr && static_cast<SdrOle2Obj*>(pObj)->GetObjRef().is() ) { // If object has no persistence it must be copied as part of the document try @@ -172,7 +172,7 @@ struct SdNavigatorDropEvent : public ExecuteDropEvent { SdrObject* pObj = GetMarkedObjectByIndex( 0 ); - if( pObj && pObj->ISA( SdrOle2Obj ) && static_cast<SdrOle2Obj*>(pObj)->GetObjRef().is() ) + if( pObj && dynamic_cast< const SdrOle2Obj *>( pObj ) != nullptr && static_cast<SdrOle2Obj*>(pObj)->GetObjRef().is() ) { // If object has no persistence it must be copied as part of the document try @@ -369,7 +369,7 @@ void View::StartDrag( const Point& rStartPos, vcl::Window* pWindow ) { rtl::Reference<FuPoor> xFunction( pDrawViewShell->GetCurrentFunction() ); - if( xFunction.is() && xFunction->ISA( FuDraw ) ) + if( xFunction.is() && 0 != dynamic_cast< const FuDraw *>( xFunction.get() ) ) static_cast<FuDraw*>(xFunction.get())->ForcePointer( NULL ); } @@ -792,7 +792,7 @@ sal_Int8 View::ExecuteDrop( const ExecuteDropEvent& rEvt, DropTargetHelper& rTar nRet = nDropAction; } } - else if( mpViewSh->ISA( DrawViewShell ) ) + else if( dynamic_cast< const DrawViewShell *>( mpViewSh ) != nullptr ) { // insert as normal URL button static_cast<DrawViewShell*>( mpViewSh )->InsertURLButton( aINetBookmark.GetURL(), aINetBookmark.GetDescription(), OUString(), &aPos ); @@ -928,7 +928,7 @@ typedef std::vector< SdrObject* > SdrObjectVector; void ImplProcessObjectList(SdrObject* pObj, SdrObjectVector& rVector ) { bool bIsGroup(pObj->IsGroupObject()); - if(bIsGroup && pObj->ISA(E3dObject) && !pObj->ISA(E3dScene)) + if(bIsGroup && dynamic_cast< const E3dObject *>( pObj ) != nullptr && dynamic_cast< const E3dScene *>( pObj ) == nullptr) bIsGroup = false; rVector.push_back( pObj ); diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx index d9a4211320fb..3d28ee2cf496 100644 --- a/sd/source/ui/view/sdview3.cxx +++ b/sd/source/ui/view/sdview3.cxx @@ -277,7 +277,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, { OSL_ASSERT (mpViewSh->GetViewShell()!=NULL); SfxInPlaceClient* pIpClient = mpViewSh->GetViewShell()->GetIPClient(); - if( mpViewSh->ISA(::sd::slidesorter::SlideSorterViewShell) + if( dynamic_cast< ::sd::slidesorter::SlideSorterViewShell *>( mpViewSh ) != nullptr || (pIpClient!=NULL && pIpClient->IsObjectInPlaceActive())) nPasteOptions |= SdrInsertFlags::DONTMARK; } @@ -360,7 +360,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, { const View* pSourceView = pOwnData->GetView(); - if( pOwnData->GetDocShell() && pOwnData->IsPageTransferable() && ISA( View ) ) + if( pOwnData->GetDocShell() && pOwnData->IsPageTransferable() && dynamic_cast< View *>( this) != nullptr ) { mpClipboard->HandlePageDrop (*pOwnData); bReturn = true; @@ -487,7 +487,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, pRem->pClone = pObj; aConnectorContainer.push_back(pRem); - if(pObj->ISA(SdrEdgeObj)) + if(dynamic_cast< SdrEdgeObj *>( pObj ) != nullptr) nConnectorCount++; } } @@ -499,7 +499,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, { ImpRememberOrigAndClone* pRem = aConnectorContainer[a]; - if(pRem->pClone->ISA(SdrEdgeObj)) + if(dynamic_cast< const SdrEdgeObj *>( pRem->pClone ) != nullptr) { SdrEdgeObj* pOrigEdge = static_cast<SdrEdgeObj*>(pRem->pOrig); SdrEdgeObj* pCloneEdge = static_cast<SdrEdgeObj*>(pRem->pClone); @@ -737,7 +737,9 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, bChanged = true; mnAction = DND_ACTION_COPY; } - else if( ( mnAction & DND_ACTION_LINK ) && pPickObj && pObj && !pPickObj->ISA( SdrGrafObj ) && !pPickObj->ISA( SdrOle2Obj ) ) + else if( ( mnAction & DND_ACTION_LINK ) && pPickObj && pObj && + dynamic_cast< const SdrGrafObj *>( pPickObj ) == nullptr && + dynamic_cast< const SdrOle2Obj *>( pPickObj ) == nullptr ) { SfxItemSet aSet( mrDoc.GetPool() ); @@ -769,7 +771,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, pPickObj->SetMergedItemSetAndBroadcast( aSet ); - if( pPickObj->ISA( E3dObject ) && pObj->ISA( E3dObject ) ) + if( dynamic_cast< E3dObject *>( pPickObj ) != nullptr && dynamic_cast< E3dObject *>( pObj ) != nullptr ) { // handle 3D attribute in addition SfxItemSet aNewSet( mrDoc.GetPool(), SID_ATTR_3D_START, SID_ATTR_3D_END, 0 ); diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx index 0ce3beea00fd..8036eeecaf47 100644 --- a/sd/source/ui/view/sdview4.cxx +++ b/sd/source/ui/view/sdview4.cxx @@ -86,7 +86,7 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction, SdrObject* pPickObj = pObj; const bool bOnMaster = pPV && pPV->GetPage() && pPV->GetPage()->IsMasterPage(); - if(pPV && this->ISA(::sd::slidesorter::view::SlideSorterView)) + if(pPV && dynamic_cast< const ::sd::slidesorter::view::SlideSorterView* >(this) != nullptr) { if(!pPV->GetPageRect().IsInside(rPos)) pPV = 0L; @@ -98,7 +98,7 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction, PickObj(rPos, getHitTolLog(), pPickObj, pPageView); } - const bool bIsGraphic(0 != dynamic_cast< SdrGrafObj* >(pPickObj)); + const bool bIsGraphic(dynamic_cast< const SdrGrafObj* >(pPickObj) != nullptr); if (DND_ACTION_LINK == mnAction && pPickObj @@ -150,7 +150,7 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction, && pPickObj && !bIsGraphic && pPickObj->IsClosedObj() - && !dynamic_cast< SdrOle2Obj* >(pPickObj)) + && !dynamic_cast< const SdrOle2Obj* >(pPickObj)) { // fill style change (fill object with graphic), independent of mnAction // and thus of DND_ACTION_LINK or DND_ACTION_MOVE @@ -206,7 +206,7 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction, && mpViewSh->GetViewShell()!=NULL && mpViewSh->GetViewShell()->GetIPClient() && mpViewSh->GetViewShell()->GetIPClient()->IsObjectInPlaceActive()) - || this->ISA(::sd::slidesorter::view::SlideSorterView)) + || dynamic_cast<const ::sd::slidesorter::view::SlideSorterView* >(this)) nOptions |= SdrInsertFlags::DONTMARK; if( ( mnAction & DND_ACTION_MOVE ) && pPickObj && (pPickObj->IsEmptyPresObj() || pPickObj->GetUserCall()) ) @@ -330,7 +330,7 @@ SdrMediaObj* View::InsertMediaObj( const OUString& rMediaURL, const OUString& rM SdrPageView* pPV = GetSdrPageView(); SdrObject* pPickObj = GetEmptyPresentationObject( PRESOBJ_MEDIA ); - if(pPV && this->ISA(::sd::slidesorter::view::SlideSorterView )) + if(pPV && dynamic_cast<const ::sd::slidesorter::view::SlideSorterView* >(this) ) { if(!pPV->GetPageRect().IsInside(rPos)) pPV = 0L; @@ -342,7 +342,7 @@ SdrMediaObj* View::InsertMediaObj( const OUString& rMediaURL, const OUString& rM PickObj(rPos, getHitTolLog(), pPickObj, pPageView); } - if( mnAction == DND_ACTION_LINK && pPickObj && pPV && pPickObj->ISA( SdrMediaObj ) ) + if( mnAction == DND_ACTION_LINK && pPickObj && pPV && dynamic_cast< SdrMediaObj *>( pPickObj ) != nullptr ) { pNewMediaObj = static_cast< SdrMediaObj* >( pPickObj->Clone() ); pNewMediaObj->setURL( rMediaURL, ""/*TODO?*/, rMimeType ); diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx index a9a4bd035e81..83b65bd0ca48 100644 --- a/sd/source/ui/view/sdwindow.cxx +++ b/sd/source/ui/view/sdwindow.cxx @@ -346,7 +346,7 @@ long Window::SetZoomFactor(long nZoom) UpdateMapOrigin(); // Update the view's snapping to the new zoom factor. - if ( mpViewShell && mpViewShell->ISA(DrawViewShell) ) + if ( mpViewShell && dynamic_cast< DrawViewShell *>( mpViewShell ) != nullptr ) static_cast<DrawViewShell*>(mpViewShell)->GetView()-> RecalcLogicSnapMagnetic(*this); @@ -585,7 +585,7 @@ void Window::UpdateMapMode() // removed old stuff here which still forced zoom to be // %BRUSH_SIZE which is outdated now - if (mpViewShell && mpViewShell->ISA(DrawViewShell)) + if (mpViewShell && dynamic_cast< DrawViewShell *>( mpViewShell ) != nullptr) { // page should not "stick" to the window border if (aPix.Width() == 0) @@ -790,7 +790,7 @@ void Window::DataChanged( const DataChangedEvent& rDCEvt ) else nPreviewSlot = SID_PREVIEW_QUALITY_COLOR; - if( mpViewShell->ISA( DrawViewShell ) ) + if( dynamic_cast< DrawViewShell *>( mpViewShell ) != nullptr ) { SetDrawMode( nOutputMode ); mpViewShell->GetFrameView()->SetDrawMode( nOutputMode ); @@ -798,7 +798,7 @@ void Window::DataChanged( const DataChangedEvent& rDCEvt ) } // Overwrite window color for OutlineView - if( mpViewShell->ISA(OutlineViewShell ) ) + if( dynamic_cast< OutlineViewShell *>( mpViewShell ) != nullptr ) { svtools::ColorConfig aColorConfig; const Color aDocColor( aColorConfig.GetColorValue( svtools::DOCCOLOR ).nColor ); @@ -811,7 +811,7 @@ void Window::DataChanged( const DataChangedEvent& rDCEvt ) mpViewShell->ArrangeGUIElements(); // re-create handles to show new outfit - if(mpViewShell->ISA(DrawViewShell)) + if(dynamic_cast< DrawViewShell *>( mpViewShell ) != nullptr) { mpViewShell->GetView()->AdjustMarkHdl(); } @@ -882,7 +882,7 @@ sal_Int8 Window::AcceptDrop( const AcceptDropEvent& rEvt ) if( mpViewShell ) nRet = mpViewShell->AcceptDrop( rEvt, *this, this, SDRPAGE_NOTFOUND, SDRLAYER_NOTFOUND ); - if (mbUseDropScroll && ! mpViewShell->ISA(OutlineViewShell)) + if (mbUseDropScroll && dynamic_cast< OutlineViewShell *>( mpViewShell ) == nullptr) DropScroll( rEvt.maPosPixel ); } @@ -953,7 +953,7 @@ void Window::DropScroll(const Point& rMousePos) Window::CreateAccessible() { // If current viewshell is PresentationViewShell, just return empty because the correct ShowWin will be created later. - if (mpViewShell && mpViewShell->ISA(PresentationViewShell)) + if (mpViewShell && dynamic_cast< PresentationViewShell *>( mpViewShell ) != nullptr) { return vcl::Window::CreateAccessible (); } diff --git a/sd/source/ui/view/tabcontr.cxx b/sd/source/ui/view/tabcontr.cxx index d66f3198575e..22c5ac1db45b 100644 --- a/sd/source/ui/view/tabcontr.cxx +++ b/sd/source/ui/view/tabcontr.cxx @@ -280,7 +280,7 @@ void TabControl::Command(const CommandEvent& rCEvt) { if ( rCEvt.GetCommand() == CommandEventId::ContextMenu ) { - bool bGraphicShell = pDrViewSh->ISA(GraphicViewShell); + bool bGraphicShell = dynamic_cast< GraphicViewShell *>( pDrViewSh ) != nullptr; sal_uInt16 nResId = bGraphicShell ? RID_GRAPHIC_PAGETAB_POPUP : RID_DRAW_PAGETAB_POPUP; SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher(); diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index 642f33f14a45..99aca248383b 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -114,7 +114,7 @@ namespace sd { bool ViewShell::IsPageFlipMode() const { - return this->ISA(DrawViewShell) && mpContentWindow.get() != NULL && + return dynamic_cast< const DrawViewShell *>( this ) != nullptr && mpContentWindow.get() != NULL && mpContentWindow->GetVisibleHeight() >= 1.0; } diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx index 5ba334baa765..27ad057e2d19 100644 --- a/sfx2/source/appl/appcfg.cxx +++ b/sfx2/source/appl/appcfg.cxx @@ -508,7 +508,7 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet ) comphelper::ConfigurationChanges::create()); if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_BUTTON_OUTSTYLE3D), true, &pItem) ) { - DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); + DBG_ASSERT(dynamic_cast< const SfxBoolItem *>( pItem ) != nullptr, "BoolItem expected"); sal_uInt16 nOutStyle = static_cast<const SfxBoolItem *>(pItem)->GetValue() ? 0 : TOOLBOX_STYLE_FLAT; aMiscOptions.SetToolboxStyle( nOutStyle ); @@ -516,7 +516,7 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet ) if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_BUTTON_BIGSIZE), true, &pItem) ) { - DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); + DBG_ASSERT(dynamic_cast< const SfxBoolItem *>( pItem ) != nullptr, "BoolItem expected"); bool bBigSize = static_cast<const SfxBoolItem*>(pItem)->GetValue(); aMiscOptions.SetSymbolsSize( sal::static_int_cast< sal_Int16 >( @@ -534,104 +534,104 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet ) // Backup if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_BACKUP), true, &pItem) ) { - DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); + DBG_ASSERT(dynamic_cast< const SfxBoolItem *>( pItem ) != nullptr, "BoolItem expected"); aSaveOptions.SetBackup( static_cast<const SfxBoolItem*>(pItem)->GetValue() ); } // PrettyPrinting if ( SfxItemState::SET == rSet.GetItemState( rPool.GetWhich( SID_ATTR_PRETTYPRINTING ), true, &pItem ) ) { - DBG_ASSERT( pItem->ISA( SfxBoolItem ), "BoolItem expected" ); + DBG_ASSERT( dynamic_cast< const SfxBoolItem *>( pItem ) != nullptr, "BoolItem expected" ); aSaveOptions.SetPrettyPrinting( static_cast< const SfxBoolItem*> ( pItem )->GetValue() ); } // WarnAlienFormat if ( SfxItemState::SET == rSet.GetItemState( rPool.GetWhich( SID_ATTR_WARNALIENFORMAT ), true, &pItem ) ) { - DBG_ASSERT( pItem->ISA( SfxBoolItem ), "BoolItem expected" ); + DBG_ASSERT( dynamic_cast< const SfxBoolItem *>( pItem ) != nullptr, "BoolItem expected" ); aSaveOptions.SetWarnAlienFormat( static_cast< const SfxBoolItem*> ( pItem )->GetValue() ); } // AutoSave if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_AUTOSAVE), true, &pItem)) { - DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); + DBG_ASSERT(dynamic_cast< const SfxBoolItem *>( pItem ) != nullptr, "BoolItem expected"); aSaveOptions.SetAutoSave( static_cast<const SfxBoolItem*>(pItem)->GetValue() ); } // AutoSave-Prompt if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_AUTOSAVEPROMPT), true, &pItem)) { - DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); + DBG_ASSERT(dynamic_cast< const SfxBoolItem *>( pItem ) != nullptr, "BoolItem expected"); aSaveOptions.SetAutoSavePrompt(static_cast<const SfxBoolItem *>(pItem)->GetValue()); } // AutoSave-Time if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_AUTOSAVEMINUTE), true, &pItem)) { - DBG_ASSERT(pItem->ISA(SfxUInt16Item), "UInt16Item expected"); + DBG_ASSERT(dynamic_cast< const SfxUInt16Item *>( pItem ) != nullptr, "UInt16Item expected"); aSaveOptions.SetAutoSaveTime(static_cast<const SfxUInt16Item *>(pItem)->GetValue()); } // UserAutoSave if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_USERAUTOSAVE), true, &pItem)) { - DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); + DBG_ASSERT(dynamic_cast< const SfxBoolItem *>( pItem ) != nullptr, "BoolItem expected"); aSaveOptions.SetUserAutoSave( static_cast<const SfxBoolItem*>(pItem)->GetValue() ); } // DocInfo if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_DOCINFO), true, &pItem)) { - DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); + DBG_ASSERT(dynamic_cast< const SfxBoolItem *>( pItem ) != nullptr, "BoolItem expected"); aSaveOptions.SetDocInfoSave(static_cast<const SfxBoolItem *>(pItem)->GetValue()); } // Mark open Documents if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_WORKINGSET), true, &pItem)) { - DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); + DBG_ASSERT(dynamic_cast< const SfxBoolItem *>( pItem ) != nullptr, "BoolItem expected"); aSaveOptions.SetSaveWorkingSet(static_cast<const SfxBoolItem *>(pItem)->GetValue()); } // Save window settings if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_SAVEDOCVIEW), true, &pItem)) { - DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); + DBG_ASSERT(dynamic_cast< const SfxBoolItem *>( pItem ) != nullptr, "BoolItem expected"); aSaveOptions.SetSaveDocView(static_cast<const SfxBoolItem *>(pItem)->GetValue()); } // Metric if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_METRIC), true, &pItem)) { - DBG_ASSERT(pItem->ISA(SfxUInt16Item), "UInt16Item expected"); + DBG_ASSERT(dynamic_cast< const SfxUInt16Item *>( pItem ) != nullptr, "UInt16Item expected"); } // HelpBalloons if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_HELPBALLOONS), true, &pItem)) { - DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); + DBG_ASSERT(dynamic_cast< const SfxBoolItem *>( pItem ) != nullptr, "BoolItem expected"); aHelpOptions.SetExtendedHelp(static_cast<const SfxBoolItem *>(pItem)->GetValue()); } // HelpTips if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_HELPTIPS), true, &pItem)) { - DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); + DBG_ASSERT(dynamic_cast< const SfxBoolItem *>( pItem ) != nullptr, "BoolItem expected"); aHelpOptions.SetHelpTips( static_cast<const SfxBoolItem *>(pItem)->GetValue()); } // WelcomeScreen if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_WELCOMESCREEN ), true, &pItem)) { - DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); + DBG_ASSERT(dynamic_cast< const SfxBoolItem *>( pItem ) != nullptr, "BoolItem expected"); aHelpOptions.SetWelcomeScreen( static_cast<const SfxBoolItem *>(pItem)->GetValue() ); } // WelcomeScreen if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_WELCOMESCREEN_RESET ), true, &pItem)) { - DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); + DBG_ASSERT(dynamic_cast< const SfxBoolItem *>( pItem ) != nullptr, "BoolItem expected"); bool bReset = static_cast<const SfxBoolItem *>(pItem)->GetValue(); if ( bReset ) { @@ -640,28 +640,28 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet ) if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_HELP_STYLESHEET ), true, &pItem)) { - DBG_ASSERT(pItem->ISA(SfxStringItem), "StringItem expected"); + DBG_ASSERT(dynamic_cast< const SfxStringItem *>( pItem ) != nullptr, "StringItem expected"); aHelpOptions.SetHelpStyleSheet( static_cast<const SfxStringItem *>(pItem)->GetValue() ); } // SaveRelINet if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_SAVEREL_INET), true, &pItem)) { - DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); + DBG_ASSERT(dynamic_cast< const SfxBoolItem *>( pItem ) != nullptr, "BoolItem expected"); aSaveOptions.SetSaveRelINet(static_cast<const SfxBoolItem *>(pItem)->GetValue()); } // SaveRelFSys if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_SAVEREL_FSYS), true, &pItem)) { - DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); + DBG_ASSERT(dynamic_cast< const SfxBoolItem *>( pItem ) != nullptr, "BoolItem expected"); aSaveOptions.SetSaveRelFSys(static_cast<const SfxBoolItem *>(pItem)->GetValue()); } // Undo-Count if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_UNDO_COUNT), true, &pItem)) { - DBG_ASSERT(pItem->ISA(SfxUInt16Item), "UInt16Item expected"); + DBG_ASSERT(dynamic_cast< const SfxUInt16Item *>( pItem ) != nullptr, "UInt16Item expected"); sal_uInt16 nUndoCount = static_cast<const SfxUInt16Item*>(pItem)->GetValue(); officecfg::Office::Common::Undo::Steps::set(nUndoCount, batch); @@ -690,58 +690,58 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet ) // Office autostart if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_QUICKLAUNCHER), true, &pItem)) { - DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); + DBG_ASSERT(dynamic_cast< const SfxBoolItem *>( pItem ) != nullptr, "BoolItem expected"); ShutdownIcon::SetAutostart( static_cast<const SfxBoolItem*>( pItem )->GetValue() ); } // StarBasic Enable if ( SfxItemState::SET == rSet.GetItemState(SID_BASIC_ENABLED, true, &pItem)) { - DBG_ASSERT(pItem->ISA(SfxUInt16Item), "SfxInt16Item expected"); + DBG_ASSERT(dynamic_cast< const SfxUInt16Item *>( pItem ) != nullptr, "SfxInt16Item expected"); aSecurityOptions.SetBasicMode( (EBasicSecurityMode)static_cast<const SfxUInt16Item*>( pItem )->GetValue() ); } // Execute PlugIns if ( SfxItemState::SET == rSet.GetItemState(SID_INET_EXE_PLUGIN, true, &pItem)) { - DBG_ASSERT(pItem->ISA(SfxBoolItem), "SfxBoolItem expected"); + DBG_ASSERT(dynamic_cast< const SfxBoolItem *>( pItem ) != nullptr, "SfxBoolItem expected"); aSecurityOptions.SetExecutePlugins( static_cast<const SfxBoolItem *>( pItem )->GetValue() ); } if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_INET_PROXY_TYPE), true, &pItem)) { - DBG_ASSERT( pItem->ISA(SfxUInt16Item), "UInt16Item expected" ); + DBG_ASSERT( dynamic_cast< const SfxUInt16Item *>( pItem ) != nullptr, "UInt16Item expected" ); officecfg::Inet::Settings::ooInetProxyType::set( static_cast< SfxUInt16Item const * >(pItem)->GetValue(), batch); } if ( SfxItemState::SET == rSet.GetItemState( rPool.GetWhich( SID_INET_HTTP_PROXY_NAME ), true, &pItem ) ) { - DBG_ASSERT( pItem->ISA(SfxStringItem), "StringItem expected" ); + DBG_ASSERT( dynamic_cast< const SfxStringItem *>( pItem ) != nullptr, "StringItem expected" ); officecfg::Inet::Settings::ooInetHTTPProxyName::set( static_cast< SfxStringItem const * >(pItem)->GetValue(), batch); } if ( SfxItemState::SET == rSet.GetItemState( rPool.GetWhich( SID_INET_HTTP_PROXY_PORT ), true, &pItem ) ) { - DBG_ASSERT( pItem->ISA(SfxInt32Item), "Int32Item expected" ); + DBG_ASSERT( dynamic_cast< const SfxInt32Item *>( pItem ) != nullptr, "Int32Item expected" ); officecfg::Inet::Settings::ooInetHTTPProxyPort::set( static_cast< SfxInt32Item const * >(pItem)->GetValue(), batch); } if ( SfxItemState::SET == rSet.GetItemState( rPool.GetWhich( SID_INET_FTP_PROXY_NAME ), true, &pItem ) ) { - DBG_ASSERT( pItem->ISA(SfxStringItem), "StringItem expected" ); + DBG_ASSERT( dynamic_cast< const SfxStringItem *>( pItem ) != nullptr, "StringItem expected" ); officecfg::Inet::Settings::ooInetFTPProxyName::set( static_cast< SfxStringItem const * >(pItem)->GetValue(), batch); } if ( SfxItemState::SET == rSet.GetItemState( rPool.GetWhich( SID_INET_FTP_PROXY_PORT ), true, &pItem ) ) { - DBG_ASSERT( pItem->ISA(SfxInt32Item), "Int32Item expected" ); + DBG_ASSERT( dynamic_cast< const SfxInt32Item *>( pItem ) != nullptr, "Int32Item expected" ); officecfg::Inet::Settings::ooInetFTPProxyPort::set( static_cast< SfxInt32Item const * >(pItem)->GetValue(), batch); } if ( SfxItemState::SET == rSet.GetItemState(SID_INET_NOPROXY, true, &pItem)) { - DBG_ASSERT(pItem->ISA(SfxStringItem), "StringItem expected"); + DBG_ASSERT(dynamic_cast< const SfxStringItem *>( pItem ) != nullptr, "StringItem expected"); officecfg::Inet::Settings::ooInetNoProxy::set( static_cast< SfxStringItem const * >(pItem)->GetValue(), batch); } @@ -749,7 +749,7 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet ) // Secure-Referers if ( SfxItemState::SET == rSet.GetItemState(SID_SECURE_URL, true, &pItem)) { - DBG_ASSERT(pItem->ISA(SfxStringListItem), "StringListItem expected"); + DBG_ASSERT(dynamic_cast< const SfxStringListItem *>( pItem ) != nullptr, "StringListItem expected"); ::com::sun::star::uno::Sequence< OUString > seqURLs; static_cast<const SfxStringListItem*>(pItem)->GetStringList(seqURLs); aSecurityOptions.SetSecureURLs( seqURLs ); @@ -757,12 +757,12 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet ) if ( SfxItemState::SET == rSet.GetItemState(SID_MACRO_WARNING, true, &pItem)) { - DBG_ASSERT(pItem->ISA(SfxBoolItem), "SfxBoolItem expected"); + DBG_ASSERT(dynamic_cast< const SfxBoolItem *>( pItem ) != nullptr, "SfxBoolItem expected"); aSecurityOptions.SetWarningEnabled( static_cast<const SfxBoolItem *>(pItem)->GetValue() ); } if ( SfxItemState::SET == rSet.GetItemState(SID_MACRO_CONFIRMATION, true, &pItem)) { - DBG_ASSERT(pItem->ISA(SfxBoolItem), "SfxBoolItem expected"); + DBG_ASSERT(dynamic_cast< const SfxBoolItem *>( pItem ) != nullptr, "SfxBoolItem expected"); aSecurityOptions.SetConfirmationEnabled( static_cast<const SfxBoolItem *>(pItem)->GetValue() ); } @@ -784,7 +784,7 @@ void SfxApplication::SetOptions(const SfxItemSet &rSet) // PathName if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_PATHNAME), true, &pItem)) { - DBG_ASSERT(pItem->ISA(SfxAllEnumItem), "AllEnumItem expected"); + DBG_ASSERT(dynamic_cast< const SfxAllEnumItem *>( pItem ) != nullptr, "AllEnumItem expected"); const SfxAllEnumItem* pEnumItem = static_cast<const SfxAllEnumItem *>(pItem); sal_uInt32 nCount = pEnumItem->GetValueCount(); OUString aNoChangeStr( ' ' ); diff --git a/sfx2/source/appl/appdde.cxx b/sfx2/source/appl/appdde.cxx index 799f6e0ce9dd..f38a3341272a 100644 --- a/sfx2/source/appl/appdde.cxx +++ b/sfx2/source/appl/appdde.cxx @@ -123,8 +123,7 @@ bool ImplDdeService::MakeTopic( const OUString& rNm ) // with the specific name: sal_Bool bRet = sal_False; OUString sNm( rNm.toAsciiLowerCase() ); - TypeId aType( TYPE(SfxObjectShell) ); - SfxObjectShell* pShell = SfxObjectShell::GetFirst( &aType ); + SfxObjectShell* pShell = SfxObjectShell::GetFirst(); while( pShell ) { OUString sTmp( pShell->GetTitle(SFX_TITLE_FULLNAME) ); @@ -134,7 +133,7 @@ bool ImplDdeService::MakeTopic( const OUString& rNm ) bRet = true; break; } - pShell = SfxObjectShell::GetNext( *pShell, &aType ); + pShell = SfxObjectShell::GetNext( *pShell ); } if( !bRet ) @@ -155,7 +154,7 @@ bool ImplDdeService::MakeTopic( const OUString& rNm ) &aName, &aNewView, &aSilent, 0L ); - if( pRet && pRet->ISA( SfxViewFrameItem ) && + if( pRet && dynamic_cast< const SfxViewFrameItem *>( pRet ) != nullptr && ((SfxViewFrameItem*)pRet)->GetFrame() && 0 != ( pShell = ((SfxViewFrameItem*)pRet) ->GetFrame()->GetObjectShell() ) ) @@ -174,8 +173,7 @@ OUString ImplDdeService::Topics() if( GetSysTopic() ) sRet += GetSysTopic()->GetName(); - TypeId aType( TYPE(SfxObjectShell) ); - SfxObjectShell* pShell = SfxObjectShell::GetFirst( &aType ); + SfxObjectShell* pShell = SfxObjectShell::GetFirst(); while( pShell ) { if( SfxViewFrame::GetFirst( pShell ) ) @@ -184,7 +182,7 @@ OUString ImplDdeService::Topics() sRet += "\t"; sRet += pShell->GetTitle(SFX_TITLE_FULLNAME); } - pShell = SfxObjectShell::GetNext( *pShell, &aType ); + pShell = SfxObjectShell::GetNext( *pShell ); } if( !sRet.isEmpty() ) sRet += "\r\n"; @@ -413,14 +411,13 @@ void SfxObjectShell::ReconnectDdeLink(SfxObjectShell& /*rServer*/) void SfxObjectShell::ReconnectDdeLinks(SfxObjectShell& rServer) { - TypeId aType = TYPE(SfxObjectShell); - SfxObjectShell* p = GetFirst(&aType, false); + SfxObjectShell* p = GetFirst(nullptr, false); while (p) { if (&rServer != p) p->ReconnectDdeLink(rServer); - p = GetNext(*p, &aType, false); + p = GetNext(*p, nullptr, false); } } diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index 144f6fd09f67..55b35b6fb69f 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -323,12 +323,12 @@ sal_uIntPtr SfxApplication::LoadTemplate( SfxObjectShellLock& xDoc, const OUStri SfxStringItem aFlags( SID_OPTIONS, OUString("T") ); SfxBoolItem aHidden( SID_HIDDEN, true ); const SfxPoolItem *pRet = GetDispatcher_Impl()->Execute( SID_OPENDOC, SfxCallMode::SYNCHRON, &aName, &aHidden, &aReferer, &aFlags, 0L ); - const SfxObjectItem *pObj = PTR_CAST( SfxObjectItem, pRet ); + const SfxObjectItem *pObj = dynamic_cast<const SfxObjectItem*>( pRet ); if ( pObj ) - xDoc = PTR_CAST( SfxObjectShell, pObj->GetShell() ); + xDoc = dynamic_cast<SfxObjectShell*>( pObj->GetShell() ); else { - const SfxViewFrameItem *pView = PTR_CAST( SfxViewFrameItem, pRet ); + const SfxViewFrameItem *pView = dynamic_cast<const SfxViewFrameItem*>( pRet ); if ( pView ) { SfxViewFrame *pFrame = pView->GetFrame(); @@ -437,7 +437,7 @@ void SfxApplication::NewDocDirectExec_Impl( SfxRequest& rReq ) aReq.AppendItem( *pDefaultNameItem ); SfxGetpApp()->ExecuteSlot( aReq ); - const SfxViewFrameItem* pItem = PTR_CAST( SfxViewFrameItem, aReq.GetReturnValue() ); + const SfxViewFrameItem* pItem = dynamic_cast<const SfxViewFrameItem*>( aReq.GetReturnValue() ); if ( pItem ) rReq.SetReturnValue( SfxFrameItem( 0, pItem->GetFrame() ) ); } @@ -1094,7 +1094,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) { // try to find the SfxFrame for the controller SfxFrame* pCntrFrame = NULL; - for ( SfxViewShell* pShell = SfxViewShell::GetFirst( 0, false ); pShell; pShell = SfxViewShell::GetNext( *pShell, 0, false ) ) + for ( SfxViewShell* pShell = SfxViewShell::GetFirst( false ); pShell; pShell = SfxViewShell::GetNext( *pShell, false ) ) { if ( pShell->GetController() == xController ) { diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 69073f9a1601..e08fb056db53 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -425,7 +425,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) if ( pObjSh->IsModified() ) { pObjSh->ExecuteSlot( aReq ); - const SfxBoolItem *pItem = PTR_CAST( SfxBoolItem, aReq.GetReturnValue() ); + const SfxBoolItem *pItem = dynamic_cast<const SfxBoolItem*>( aReq.GetReturnValue() ); if ( !pItem || !pItem->GetValue() ) bOK = false; } @@ -572,7 +572,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) { SfxBoolItem const * pItem = static_cast< SfxBoolItem const * >( rReq.GetArg(SID_SHOW_IME_STATUS_WINDOW, false, - TYPE(SfxBoolItem))); + checkSfxPoolItem<SfxBoolItem>)); bool bShow = pItem == 0 ? !pAppData_Impl->m_xImeStatusWindow->isShowing() : pItem->GetValue(); @@ -636,7 +636,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) case SID_AVAILABLE_TOOLBARS: { SfxStringItem const * pToolbarName = static_cast< SfxStringItem const *>( - rReq.GetArg(SID_AVAILABLE_TOOLBARS, false, TYPE(SfxStringItem))); + rReq.GetArg(SID_AVAILABLE_TOOLBARS, false, checkSfxPoolItem< SfxStringItem >)); if ( pToolbarName ) { @@ -971,7 +971,7 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) Reference < XFrame > xFrame; if ( pArgs && pArgs->GetItemState( SID_FILLFRAME, false, &pItem ) == SfxItemState::SET ) { - OSL_ENSURE( pItem->ISA( SfxUnoFrameItem ), "SfxApplication::OfaExec_Impl: XFrames are to be transported via SfxUnoFrameItem by now!" ); + OSL_ENSURE( dynamic_cast< const SfxUnoFrameItem *>( pItem ) != nullptr, "SfxApplication::OfaExec_Impl: XFrames are to be transported via SfxUnoFrameItem by now!" ); xFrame = static_cast< const SfxUnoFrameItem*>( pItem )->GetFrame(); } SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index c856fedea099..d2bb8817a944 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -1439,12 +1439,12 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, uno::Sequence<b if ( rSet.GetItemState( SID_FILLFRAME, false, &pItem ) == SfxItemState::SET ) { pValue[nActProp].Name = sFrame; - if ( pItem->ISA( SfxUsrAnyItem ) ) + if ( dynamic_cast< const SfxUsrAnyItem *>( pItem ) != nullptr ) { OSL_FAIL( "TransformItems: transporting an XFrame via an SfxUsrAnyItem is not deprecated!" ); pValue[nActProp++].Value = static_cast< const SfxUsrAnyItem* >( pItem )->GetValue(); } - else if ( pItem->ISA( SfxUnoFrameItem ) ) + else if ( dynamic_cast< const SfxUnoFrameItem *>( pItem ) != nullptr ) pValue[nActProp++].Value <<= static_cast< const SfxUnoFrameItem* >( pItem )->GetFrame(); else OSL_FAIL( "TransformItems: invalid item type for SID_FILLFRAME!" ); diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx index 3fa3e4665fdf..9137af4d890a 100644 --- a/sfx2/source/appl/linkmgr2.cxx +++ b/sfx2/source/appl/linkmgr2.cxx @@ -583,8 +583,6 @@ bool SvxInternalLink::Connect( sfx2::SvBaseLink* pLink ) // with the name: CharClass aCC( LanguageTag( LANGUAGE_SYSTEM) ); - TypeId aType( TYPE(SfxObjectShell) ); - bool bFirst = true; SfxObjectShell* pShell = pLinkMgr->GetPersist(); if( pShell && pShell->GetMedium() ) @@ -600,7 +598,7 @@ bool SvxInternalLink::Connect( sfx2::SvBaseLink* pLink ) if ( !pShell ) { bFirst = false; - pShell = SfxObjectShell::GetFirst( &aType, false ); + pShell = SfxObjectShell::GetFirst( nullptr, false ); } OUString sTmp; @@ -623,10 +621,10 @@ bool SvxInternalLink::Connect( sfx2::SvBaseLink* pLink ) if( bFirst ) { bFirst = false; - pShell = SfxObjectShell::GetFirst( &aType, false ); + pShell = SfxObjectShell::GetFirst( nullptr, false ); } else - pShell = SfxObjectShell::GetNext( *pShell, &aType, false ); + pShell = SfxObjectShell::GetNext( *pShell, nullptr, false ); sTmp.clear(); } diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx index 3a0a1dd52bc4..58eeb662a4b1 100644 --- a/sfx2/source/control/bindings.cxx +++ b/sfx2/source/control/bindings.cxx @@ -1154,7 +1154,7 @@ const SfxPoolItem* SfxBindings::Execute_Impl( sal_uInt16 nId, const SfxPoolItem* } if ( bGlobalOnly ) - if ( !pShell->ISA(SfxModule) && !pShell->ISA(SfxApplication) && !pShell->ISA(SfxViewFrame) ) + if ( dynamic_cast< const SfxModule *>( pShell ) == nullptr && dynamic_cast< const SfxApplication *>( pShell ) == nullptr && dynamic_cast< const SfxViewFrame *>( pShell ) == nullptr ) return NULL; SfxItemPool &rPool = pShell->GetPool(); @@ -1223,7 +1223,7 @@ void SfxBindings::Execute_Impl( SfxRequest& aReq, const SfxSlot* pSlot, SfxShell SfxItemPool::IsWhich(nWhich) && pOldItem ) ) { - if ( pOldItem->ISA(SfxBoolItem) ) + if ( dynamic_cast< const SfxBoolItem *>( pOldItem ) != nullptr ) { // we can toggle Bools bool bOldValue = static_cast<const SfxBoolItem *>(pOldItem)->GetValue(); @@ -1232,7 +1232,7 @@ void SfxBindings::Execute_Impl( SfxRequest& aReq, const SfxSlot* pSlot, SfxShell aReq.AppendItem( *pNewItem ); delete pNewItem; } - else if ( pOldItem->ISA(SfxEnumItemInterface) && + else if ( dynamic_cast< const SfxEnumItemInterface *>( pOldItem ) != nullptr && static_cast<const SfxEnumItemInterface *>(pOldItem)->HasBoolValue()) { // and Enums with Bool-Interface @@ -1253,13 +1253,13 @@ void SfxBindings::Execute_Impl( SfxRequest& aReq, const SfxSlot* pSlot, SfxShell DBG_ASSERT( pNewItem, "Toggle to slot without ItemFactory" ); pNewItem->SetWhich( nWhich ); - if ( pNewItem->ISA(SfxBoolItem) ) + if ( dynamic_cast< const SfxBoolItem *>( pNewItem ) != nullptr ) { // we can toggle Bools static_cast<SfxBoolItem*>(pNewItem)->SetValue( true ); aReq.AppendItem( *pNewItem ); } - else if ( pNewItem->ISA(SfxEnumItemInterface) && + else if ( dynamic_cast< const SfxEnumItemInterface *>( pNewItem ) != nullptr && static_cast<SfxEnumItemInterface *>(pNewItem)->HasBoolValue()) { // and Enums with Bool-Interface @@ -1489,14 +1489,13 @@ void SfxBindings::UpdateControllers_Impl // Update the slots for so far available and bound Controllers for // Slave-Slots (Enum-value) DBG_ASSERT( !pSlot || 0 == pSlot->GetLinkedSlot() || !pItem || - pItem->ISA(SfxEnumItemInterface), + dynamic_cast< const SfxEnumItemInterface *>( pItem ) != nullptr, "master slot with non-enum-type found" ); const SfxSlot *pFirstSlave = pSlot ? pSlot->GetLinkedSlot() : 0; if ( pIF && pFirstSlave) { // Items cast on EnumItem - const SfxEnumItemInterface *pEnumItem = - PTR_CAST(SfxEnumItemInterface,pItem); + const SfxEnumItemInterface *pEnumItem = dynamic_cast< const SfxEnumItemInterface* >(pItem); if ( eState == SfxItemState::DEFAULT && !pEnumItem ) eState = SfxItemState::DONTCARE; else diff --git a/sfx2/source/control/ctrlitem.cxx b/sfx2/source/control/ctrlitem.cxx index 0be5e36658b7..aa4dbde381d1 100644 --- a/sfx2/source/control/ctrlitem.cxx +++ b/sfx2/source/control/ctrlitem.cxx @@ -324,7 +324,7 @@ SfxItemState SfxControllerItem::GetItemState ? SfxItemState::DISABLED : IsInvalidItem(pState) ? SfxItemState::DONTCARE - : pState->ISA(SfxVoidItem) && !pState->Which() + : dynamic_cast< const SfxVoidItem *>( pState ) != nullptr && !pState->Which() ? SfxItemState::UNKNOWN : SfxItemState::DEFAULT; } diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index a34c9296bf0e..a50c052fb14c 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -1684,7 +1684,7 @@ bool SfxDispatcher::_FindServer(sal_uInt16 nSlot, SfxSlotServer& rServer, bool b SfxShell *pSh = GetShell(nShell); if ( pSh == NULL ) return false; - if ( pSh->ISA(SfxViewShell) ) + if ( dynamic_cast< const SfxViewShell *>( pSh ) != nullptr ) { const SfxSlot* pSlot = pSh->GetVerbSlot_Impl(nSlot); if ( pSlot ) @@ -1826,7 +1826,7 @@ bool SfxDispatcher::_FillState(const SfxSlotServer& rSvr, SfxItemSet& rState, pItem; pItem = aIter.NextItem() ) { - if ( !IsInvalidItem(pItem) && !pItem->ISA(SfxVoidItem) ) + if ( !IsInvalidItem(pItem) && dynamic_cast< const SfxVoidItem *>( pItem ) == nullptr ) { sal_uInt16 nSlotId = rState.GetPool()->GetSlotId(pItem->Which()); SAL_INFO_IF( @@ -2008,7 +2008,7 @@ SfxItemState SfxDispatcher::QueryState( sal_uInt16 nSID, ::com::sun::star::uno:: else { ::com::sun::star::uno::Any aState; - if ( !pItem->ISA(SfxVoidItem) ) + if ( dynamic_cast< const SfxVoidItem *>( pItem ) == nullptr ) { sal_uInt16 nSubId( 0 ); SfxItemPool& rPool = pShell->GetPool(); @@ -2032,7 +2032,7 @@ bool SfxDispatcher::IsReadOnlyShell_Impl( sal_uInt16 nShell ) const if ( nShell < nShellCount ) { SfxShell* pShell = *( xImp->aStack.rbegin() + nShell ); - if( pShell->ISA( SfxModule ) || pShell->ISA( SfxApplication ) || pShell->ISA( SfxViewFrame ) ) + if( dynamic_cast< const SfxModule *>( pShell ) != nullptr || dynamic_cast< const SfxApplication *>( pShell ) != nullptr || dynamic_cast< const SfxViewFrame *>( pShell ) != nullptr ) return false; else return xImp->bReadOnly; @@ -2117,7 +2117,7 @@ SfxModule* SfxDispatcher::GetModule() const SfxShell *pSh = GetShell(nShell); if ( pSh == NULL ) return 0; - if ( pSh->ISA(SfxModule) ) + if ( dynamic_cast< const SfxModule *>( pSh ) != nullptr ) return static_cast<SfxModule*>(pSh); } } diff --git a/sfx2/source/control/request.cxx b/sfx2/source/control/request.cxx index d50ff5068b24..187409467f5e 100644..100755 --- a/sfx2/source/control/request.cxx +++ b/sfx2/source/control/request.cxx @@ -432,10 +432,10 @@ const SfxPoolItem* SfxRequest::GetArg ( sal_uInt16 nSlotId, // Slot-Id or Which-Id of the parameters bool bDeep, // sal_False: do not search in the Parent-ItemSets - TypeId aType // != 0: RTTI check with Assertion + std::function<bool ( const SfxPoolItem* )> isItemType // != 0: check for required pool item class ) const { - return GetItem( pArgs, nSlotId, bDeep, aType ); + return GetItem( pArgs, nSlotId, bDeep, isItemType ); } @@ -445,7 +445,7 @@ const SfxPoolItem* SfxRequest::GetItem const SfxItemSet* pArgs, sal_uInt16 nSlotId, // Slot-Id or Which-Id of the parameters bool bDeep, // sal_False: do not search in the Parent-ItemSets - TypeId aType // != 0: RTTI check with Assertion + std::function<bool ( const SfxPoolItem* )> isItemType // != 0: check for required pool item class ) /* [Description] @@ -493,7 +493,7 @@ const SfxPoolItem* SfxRequest::GetItem <= pArgs->GetItemState( nWhich, bDeep, &pItem ) ) { // Compare type - if ( !pItem || pItem->IsA(aType) ) + if ( !pItem || (!isItemType || isItemType(pItem)) ) return pItem; // Item of wrong type => Programming error diff --git a/sfx2/source/control/shell.cxx b/sfx2/source/control/shell.cxx index 434bf24120c7..2faa75ca6a45 100644 --- a/sfx2/source/control/shell.cxx +++ b/sfx2/source/control/shell.cxx @@ -165,7 +165,7 @@ void SfxShell::PutItem which is stored in the SfxShell in a list. */ ) { - DBG_ASSERT( !rItem.ISA(SfxSetItem), "SetItems aren't allowed here" ); + DBG_ASSERT( dynamic_cast< const SfxSetItem* >( &rItem) == nullptr, "SetItems aren't allowed here" ); DBG_ASSERT( SfxItemPool::IsSlot( rItem.Which() ), "items with Which-Ids aren't allowed here" ); @@ -527,7 +527,7 @@ void SfxStubSfxShellVerbState(SfxShell *, SfxItemSet& rSet) void SfxShell::SetVerbs(const com::sun::star::uno::Sequence < com::sun::star::embed::VerbDescriptor >& aVerbs) { - SfxViewShell *pViewSh = PTR_CAST ( SfxViewShell, this); + SfxViewShell *pViewSh = dynamic_cast<SfxViewShell*>( this ); DBG_ASSERT(pViewSh, "Only call SetVerbs at the ViewShell!"); if ( !pViewSh ) diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index 617a7a8da92c..f38e7f1050d0 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -892,7 +892,7 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util aEvent.State = com::sun::star::frame::DispatchResultState::FAILURE; aEvent.Source = static_cast<com::sun::star::frame::XDispatch*>(pDispatch); - if ( bSuccess && pItem && !pItem->ISA(SfxVoidItem) ) + if ( bSuccess && pItem && dynamic_cast< const SfxVoidItem *>( pItem ) == nullptr ) { sal_uInt16 nSubId( 0 ); if ( eMapUnit == SFX_MAPUNIT_TWIP ) @@ -966,7 +966,7 @@ void SfxDispatchController_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eSt bool bNotify = true; if ( pState && !IsInvalidItem( pState ) ) { - if ( !pState->ISA( SfxVisibilityItem ) ) + if ( dynamic_cast< const SfxVisibilityItem *>( pState ) == nullptr ) { if (pLastState && !IsInvalidItem(pLastState)) { @@ -989,7 +989,7 @@ void SfxDispatchController_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eSt if (bNotify) { ::com::sun::star::uno::Any aState; - if ( ( eState >= SfxItemState::DEFAULT ) && pState && !IsInvalidItem( pState ) && !pState->ISA(SfxVoidItem) ) + if ( ( eState >= SfxItemState::DEFAULT ) && pState && !IsInvalidItem( pState ) && dynamic_cast< const SfxVoidItem *>( pState ) == nullptr ) { // Retrieve metric from pool to have correct sub ID when calling QueryValue sal_uInt16 nSubId( 0 ); diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index 8f6e8211f94d..3b24d4da76ab 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -1183,7 +1183,7 @@ SfxDocumentInfoDialog::SfxDocumentInfoDialog( vcl::Window* pParent, } else { - DBG_ASSERT( pItem->IsA( TYPE( SfxStringItem ) ), + DBG_ASSERT( dynamic_cast<const SfxStringItem *>(pItem) != nullptr, "SfxDocumentInfoDialog:<SfxStringItem> expected" ); aTitle += static_cast<const SfxStringItem*>(pItem)->GetValue(); } diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index db43463e2798..207166cc74f1 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -1631,7 +1631,7 @@ bool SfxCommonTemplateDialog_Impl::Execute_Impl( if ( (nId == SID_STYLE_NEW || SID_STYLE_EDIT == nId) && (pTreeBox || aFmtLb->GetSelectionCount() <= 1) ) { - const SfxUInt16Item *pFilterItem = PTR_CAST(SfxUInt16Item, pItem); + const SfxUInt16Item *pFilterItem = dynamic_cast< const SfxUInt16Item* >(pItem); OSL_ENSURE(pFilterItem, "SfxUINT16Item expected"); sal_uInt16 nFilterFlags = pFilterItem->GetValue() & ~SFXSTYLEBIT_USERDEF; if(!nFilterFlags) // User Template? @@ -1881,7 +1881,7 @@ void SfxCommonTemplateDialog_Impl::NewHdl(void *) { vcl::Window* pTmp; pTmp = Application::GetDefDialogParent(); - if ( ISA(SfxTemplateDialog_Impl) ) + if ( dynamic_cast< const SfxTemplateDialog_Impl* >(this) != nullptr ) Application::SetDefDialogParent( pWindow->GetParent() ); else Application::SetDefDialogParent( pWindow ); @@ -1920,7 +1920,7 @@ void SfxCommonTemplateDialog_Impl::EditHdl(void *) vcl::Window* pTmp; //DefModalDialogParent set for modality of the following dialogs pTmp = Application::GetDefDialogParent(); - if ( ISA(SfxTemplateDialog_Impl) ) + if ( dynamic_cast< const SfxTemplateDialog_Impl* >(this) != nullptr ) Application::SetDefDialogParent( pWindow->GetParent() ); else Application::SetDefDialogParent( pWindow ); @@ -2076,7 +2076,7 @@ void SfxCommonTemplateDialog_Impl::EnableDelete() // After selecting a focused item if possible again on the app window void SfxCommonTemplateDialog_Impl::ResetFocus() { - if(ISA(SfxTemplateDialog_Impl)) + if ( dynamic_cast< const SfxTemplateDialog_Impl* >(this) != nullptr ) { SfxViewFrame *pViewFrame = pBindings->GetDispatcher_Impl()->GetFrame(); SfxViewShell *pVu = pViewFrame->GetViewShell(); diff --git a/sfx2/source/dialog/tplcitem.cxx b/sfx2/source/dialog/tplcitem.cxx index 3210a5e44501..42764ecab279 100644 --- a/sfx2/source/dialog/tplcitem.cxx +++ b/sfx2/source/dialog/tplcitem.cxx @@ -70,8 +70,7 @@ void SfxTemplateControllerItem::StateChanged( sal_uInt16 nSID, SfxItemState eSta if ( !bAvailable ) rTemplateDlg.SetFamilyState(GetId(), 0); else { - const SfxTemplateItem *pStateItem = PTR_CAST( - SfxTemplateItem, pItem); + const SfxTemplateItem *pStateItem = dynamic_cast< const SfxTemplateItem* >(pItem); DBG_ASSERT(pStateItem != 0, "SfxTemplateItem expected"); rTemplateDlg.SetFamilyState( GetId(), pStateItem ); } @@ -146,7 +145,7 @@ void SfxTemplateControllerItem::StateChanged( sal_uInt16 nSID, SfxItemState eSta } case SID_STYLE_FAMILY : { - const SfxUInt16Item *pStateItem = PTR_CAST( SfxUInt16Item, pItem); + const SfxUInt16Item *pStateItem = dynamic_cast< const SfxUInt16Item* >(pItem); if (pStateItem) rTemplateDlg.SetFamily( pStateItem->GetValue() ); break; diff --git a/sfx2/source/doc/objitem.cxx b/sfx2/source/doc/objitem.cxx index e7c6b45de192..81467c3f529f 100644 --- a/sfx2/source/doc/objitem.cxx +++ b/sfx2/source/doc/objitem.cxx @@ -27,7 +27,7 @@ TYPEINIT1_AUTOFACTORY(SfxObjectItem,SfxPoolItem) bool SfxObjectShellItem::operator==( const SfxPoolItem &rItem ) const { - return PTR_CAST(SfxObjectShellItem, &rItem)->pObjSh == pObjSh; + return dynamic_cast<const SfxObjectShellItem*>( &rItem )->pObjSh == pObjSh; } SfxPoolItem* SfxObjectShellItem::Clone( SfxItemPool *) const @@ -88,7 +88,7 @@ SfxObjectItem::SfxObjectItem( sal_uInt16 nWhichId, SfxShell *pSh ) bool SfxObjectItem::operator==( const SfxPoolItem &rItem ) const { - const SfxObjectItem *pOther = PTR_CAST(SfxObjectItem, &rItem); + const SfxObjectItem *pOther = dynamic_cast<const SfxObjectItem*>( &rItem ); return pOther->_pSh == _pSh; } diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index bebf3c26aeed..c7b5097ee560 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -523,7 +523,7 @@ bool SfxObjectShell::SwitchToShared( bool bShared, bool bSave ) { // TODO/LATER: currently the application guards against the reentrance problem const SfxPoolItem* pItem = pViewFrame->GetBindings().ExecuteSynchron( HasName() ? SID_SAVEDOC : SID_SAVEASDOC ); - const SfxBoolItem* pResult = PTR_CAST( SfxBoolItem, pItem ); + const SfxBoolItem* pResult = dynamic_cast<const SfxBoolItem*>( pItem ); bResult = ( pResult && pResult->GetValue() ); if ( bResult ) aOrigURL = GetMedium()->GetURLObject().GetMainURL( INetURLObject::NO_DECODE ); @@ -557,7 +557,7 @@ bool SfxObjectShell::SwitchToShared( bool bShared, bool bSave ) // TODO/LATER: currently the application guards against the reentrance problem SetModified(); // the modified flag has to be set to let the document be stored with the shared flag const SfxPoolItem* pItem = pViewFrame->GetBindings().ExecuteSynchron( HasName() ? SID_SAVEDOC : SID_SAVEASDOC ); - const SfxBoolItem* pResult = PTR_CAST( SfxBoolItem, pItem ); + const SfxBoolItem* pResult = dynamic_cast<const SfxBoolItem*>( pItem ); bResult = ( pResult && pResult->GetValue() ); } } diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index a08c65ddbb70..3530e0622441 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -730,7 +730,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) if ( ( nId == SID_SAVEASDOC || nId == SID_SAVEASREMOTE ) && nErrorCode == ERRCODE_NONE ) { SfxBoolItem const * saveTo = static_cast<SfxBoolItem const *>( - rReq.GetArg(SID_SAVETO, false, TYPE(SfxBoolItem))); + rReq.GetArg(SID_SAVETO, false, checkSfxPoolItem< SfxBoolItem >)); if (saveTo == nullptr || !saveTo->GetValue()) { GetFrame()->RemoveInfoBar("readonly"); diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index e3682e305759..9946b0a28044 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -866,7 +866,7 @@ bool SfxObjectShell::DoLoad( SfxMedium *pMed ) } const SfxBoolItem* pDdeReconnectItem = static_cast<const SfxBoolItem*>( - SfxRequest::GetItem(pMedium->GetItemSet(), SID_DDE_RECONNECT_ONLOAD, false, TYPE(SfxBoolItem))); + SfxRequest::GetItem(pMedium->GetItemSet(), SID_DDE_RECONNECT_ONLOAD, false, checkSfxPoolItem< SfxBoolItem >)); bool bReconnectDde = true; // by default, we try to auto-connect DDE connections. if (pDdeReconnectItem) @@ -1429,7 +1429,7 @@ bool SfxObjectShell::SaveTo_Impl pFilter = rMedium.GetFilter(); const SfxStringItem *pVersionItem = ( !rMedium.IsInCheckIn( ) && pSet ) - ? static_cast<const SfxStringItem*>( SfxRequest::GetItem( pSet, SID_DOCINFO_COMMENTS, false, TYPE(SfxStringItem) ) ) + ? static_cast<const SfxStringItem*>( SfxRequest::GetItem( pSet, SID_DOCINFO_COMMENTS, false, checkSfxPoolItem< SfxStringItem > ) ) : NULL; OUString aTmpVersionURL; @@ -1519,7 +1519,7 @@ bool SfxObjectShell::SaveTo_Impl { // store a version also const SfxStringItem *pAuthorItem = pSet - ? static_cast<const SfxStringItem*>( SfxRequest::GetItem( pSet, SID_DOCINFO_AUTHOR, false, TYPE(SfxStringItem) ) ) + ? static_cast<const SfxStringItem*>( SfxRequest::GetItem( pSet, SID_DOCINFO_AUTHOR, false, checkSfxPoolItem< SfxStringItem > ) ) : NULL; // version comment diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 8ac27a5d3df8..be40c27288ad 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -497,7 +497,7 @@ OUString SfxObjectShell::CreateShellID( const SfxObjectShell* pShell ) SfxObjectShell* SfxObjectShell::GetFirst ( - const TypeId* pType , + std::function<bool ( const SfxObjectShell* )> isObjectShell, bool bOnlyVisible ) { @@ -510,7 +510,7 @@ SfxObjectShell* SfxObjectShell::GetFirst if ( bOnlyVisible && pSh->IsPreview() && pSh->IsReadOnly() ) continue; - if ( ( !pType || pSh->IsA(*pType) ) && + if ( (!isObjectShell || isObjectShell( pSh)) && ( !bOnlyVisible || SfxViewFrame::GetFirst( pSh ))) return pSh; } @@ -524,7 +524,7 @@ SfxObjectShell* SfxObjectShell::GetFirst SfxObjectShell* SfxObjectShell::GetNext ( const SfxObjectShell& rPrev, - const TypeId* pType, + std::function<bool ( const SfxObjectShell* )> isObjectShell, bool bOnlyVisible ) { @@ -543,7 +543,7 @@ SfxObjectShell* SfxObjectShell::GetNext if ( bOnlyVisible && pSh->IsPreview() && pSh->IsReadOnly() ) continue; - if ( ( !pType || pSh->IsA(*pType) ) && + if ( (!isObjectShell || isObjectShell( pSh)) && ( !bOnlyVisible || SfxViewFrame::GetFirst( pSh ))) return pSh; } @@ -655,7 +655,7 @@ bool SfxObjectShell::PrepareClose pPoolItem = pFrame->GetBindings().ExecuteSynchron( IsReadOnlyMedium() ? SID_SAVEASDOC : SID_SAVEDOC, ppArgs ); } - if ( !pPoolItem || pPoolItem->ISA(SfxVoidItem) || ( pPoolItem->ISA(SfxBoolItem) && !static_cast<const SfxBoolItem*>( pPoolItem )->GetValue() ) ) + if ( !pPoolItem || dynamic_cast< const SfxVoidItem *>( pPoolItem ) != nullptr || ( dynamic_cast< const SfxBoolItem *>( pPoolItem ) != nullptr && !static_cast<const SfxBoolItem*>( pPoolItem )->GetValue() ) ) return false; } else if ( RET_CANCEL == nRet ) diff --git a/sfx2/source/inet/inettbc.cxx b/sfx2/source/inet/inettbc.cxx index 47d361e7ca87..e030555e23df 100644 --- a/sfx2/source/inet/inettbc.cxx +++ b/sfx2/source/inet/inettbc.cxx @@ -239,7 +239,7 @@ void SfxURLToolBoxControl_Impl::StateChanged } } - const SfxStringItem *pURL = PTR_CAST(SfxStringItem,pState); + const SfxStringItem *pURL = dynamic_cast< const SfxStringItem* >(pState); OUString aRep( pURL->GetValue() ); INetURLObject aURL( aRep ); INetProtocol eProt = aURL.GetProtocol(); diff --git a/sfx2/source/menu/mnuitem.cxx b/sfx2/source/menu/mnuitem.cxx index 1f9d23258083..5a94cd38e65d 100644 --- a/sfx2/source/menu/mnuitem.cxx +++ b/sfx2/source/menu/mnuitem.cxx @@ -194,7 +194,7 @@ void SfxMenuControl::StateChanged } bool bCheck = false; - if ( pState->ISA(SfxBoolItem) ) + if ( dynamic_cast< const SfxBoolItem *>( pState ) != nullptr ) { // BoolItem for check DBG_ASSERT( GetId() < SID_OBJECTMENU0 || GetId() > SID_OBJECTMENU_LAST, @@ -203,7 +203,7 @@ void SfxMenuControl::StateChanged Menu* pMenu = pOwnMenu->GetSVMenu(); pMenu->SetItemBits( GetId() , pMenu->GetItemBits( GetId() ) | MenuItemBits::CHECKABLE); } - else if ( pState->ISA(SfxEnumItemInterface) && + else if ( dynamic_cast< const SfxEnumItemInterface *>( pState ) != nullptr && static_cast<const SfxEnumItemInterface *>(pState)->HasBoolValue() ) { // Treat EnumItem as Bool @@ -213,7 +213,7 @@ void SfxMenuControl::StateChanged Menu* pMenu = pOwnMenu->GetSVMenu(); pMenu->SetItemBits( GetId() , pMenu->GetItemBits( GetId() ) | MenuItemBits::CHECKABLE); } - else if ( ( b_ShowStrings || bIsObjMenu ) && pState->ISA(SfxStringItem) ) + else if ( ( b_ShowStrings || bIsObjMenu ) && dynamic_cast< const SfxStringItem *>( pState ) != nullptr ) { // Get MenuText from SfxStringItem OUString aStr( static_cast<const SfxStringItem*>(pState)->GetValue() ); diff --git a/sfx2/source/menu/virtmenu.cxx b/sfx2/source/menu/virtmenu.cxx index 7f471bfeb7fb..08259692acd8 100644 --- a/sfx2/source/menu/virtmenu.cxx +++ b/sfx2/source/menu/virtmenu.cxx @@ -77,7 +77,7 @@ public: void SfxMenuImageControl_Impl::StateChanged( sal_uInt16 /*nSID*/, SfxItemState /*eState*/, const SfxPoolItem* pState ) { - const SfxImageItem* pItem = PTR_CAST( SfxImageItem, pState ); + const SfxImageItem* pItem = dynamic_cast<const SfxImageItem*>( pState ); if ( pItem ) { lRotation = pItem->GetRotation(); diff --git a/sfx2/source/statbar/stbitem.cxx b/sfx2/source/statbar/stbitem.cxx index 1a6a50530186..afa7638bb4ec 100644 --- a/sfx2/source/statbar/stbitem.cxx +++ b/sfx2/source/statbar/stbitem.cxx @@ -444,12 +444,12 @@ void SfxStatusBarControl::StateChanged { DBG_ASSERT( pBar != nullptr, "setting state to dangling StatusBar" ); - const SfxStringItem* pStr = PTR_CAST( SfxStringItem, pState ); + const SfxStringItem* pStr = dynamic_cast<const SfxStringItem*>( pState ); if ( eState == SfxItemState::DEFAULT && pStr ) pBar->SetItemText( nSID, pStr->GetValue() ); else { - DBG_ASSERT( eState != SfxItemState::DEFAULT || pState->ISA(SfxVoidItem), + DBG_ASSERT( eState != SfxItemState::DEFAULT || dynamic_cast< const SfxVoidItem *>( pState ) != nullptr, "wrong SfxPoolItem subclass in SfxStatusBarControl" ); pBar->SetItemText( nSID, OUString() ); } diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx index e3940f16434b..b1aad075ba8a 100644 --- a/sfx2/source/toolbox/tbxitem.cxx +++ b/sfx2/source/toolbox/tbxitem.cxx @@ -386,7 +386,7 @@ SfxItemState SfxToolBoxControl::GetItemState( ? SfxItemState::DISABLED : IsInvalidItem(pState) ? SfxItemState::DONTCARE - : pState->ISA(SfxVoidItem) && !pState->Which() + : dynamic_cast< const SfxVoidItem *>( pState ) != nullptr && !pState->Which() ? SfxItemState::UNKNOWN : SfxItemState::DEFAULT; } @@ -680,14 +680,14 @@ void SfxToolBoxControl::StateChanged case SfxItemState::DEFAULT: if ( pState ) { - if ( pState->ISA(SfxBoolItem) ) + if ( dynamic_cast< const SfxBoolItem* >(pState) != nullptr ) { // BoolItem for checking if ( static_cast<const SfxBoolItem*>(pState)->GetValue() ) eTri = TRISTATE_TRUE; nItemBits |= ToolBoxItemBits::CHECKABLE; } - else if ( pState->ISA(SfxEnumItemInterface) && + else if ( dynamic_cast< const SfxEnumItemInterface *>( pState ) != nullptr && static_cast<const SfxEnumItemInterface *>(pState)->HasBoolValue()) { // EnumItem is handled as Bool @@ -695,7 +695,7 @@ void SfxToolBoxControl::StateChanged eTri = TRISTATE_TRUE; nItemBits |= ToolBoxItemBits::CHECKABLE; } - else if ( pImpl->bShowString && pState->ISA(SfxStringItem) ) + else if ( pImpl->bShowString && dynamic_cast< const SfxStringItem *>( pState ) != nullptr ) pImpl->pBox->SetItemText(nId, static_cast<const SfxStringItem*>(pState)->GetValue() ); } break; diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx index 70796e9a74aa..79287c3a3314 100644 --- a/sfx2/source/view/frame.cxx +++ b/sfx2/source/view/frame.cxx @@ -631,7 +631,7 @@ SfxUnoFrameItem::SfxUnoFrameItem( sal_uInt16 nWhichId, const ::com::sun::star::u bool SfxUnoFrameItem::operator==( const SfxPoolItem& i_rItem ) const { - return i_rItem.ISA( SfxUnoFrameItem ) && static_cast< const SfxUnoFrameItem& >( i_rItem ).m_xFrame == m_xFrame; + return dynamic_cast< const SfxUnoFrameItem* >(&i_rItem) != nullptr && static_cast< const SfxUnoFrameItem& >( i_rItem ).m_xFrame == m_xFrame; } SfxPoolItem* SfxUnoFrameItem::Clone( SfxItemPool* ) const diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index bae61e76852b..edc01fb72927 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -331,7 +331,7 @@ namespace // On the other side some special slots return a boolean state, // which can be set to FALSE. - const SfxBoolItem *pItem = PTR_CAST( SfxBoolItem, _pResult ); + const SfxBoolItem *pItem = dynamic_cast<const SfxBoolItem*>( _pResult ); if ( pItem ) bSuccess = pItem->GetValue(); @@ -402,7 +402,8 @@ void SfxFrameLoader_Impl::impl_determineFilter( ::comphelper::NamedValueCollecti SfxObjectShellRef SfxFrameLoader_Impl::impl_findObjectShell( const Reference< XModel2 >& i_rxDocument ) { - for ( SfxObjectShell* pDoc = SfxObjectShell::GetFirst( NULL, false ); pDoc; pDoc = SfxObjectShell::GetNext( *pDoc, NULL, false ) ) + for ( SfxObjectShell* pDoc = SfxObjectShell::GetFirst( nullptr, false ); pDoc; + pDoc = SfxObjectShell::GetNext( *pDoc, nullptr, false ) ) { if ( i_rxDocument == pDoc->GetModel() ) { diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 6cce9411dfe7..213753aaef6e 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -1967,9 +1967,9 @@ SfxViewFrame* SfxViewFrame::Get( const Reference< XController>& i_rController, c if ( !pDoc ) { Reference< XModel > xDocument( i_rController->getModel() ); - for ( pDoc = SfxObjectShell::GetFirst( 0, false ); + for ( pDoc = SfxObjectShell::GetFirst( nullptr, false ); pDoc; - pDoc = SfxObjectShell::GetNext( *pDoc, 0, false ) + pDoc = SfxObjectShell::GetNext( *pDoc, nullptr, false ) ) { if ( pDoc->GetModel() == xDocument ) diff --git a/sfx2/source/view/viewfrm2.cxx b/sfx2/source/view/viewfrm2.cxx index 726e83a92f90..93940f35100b 100644 --- a/sfx2/source/view/viewfrm2.cxx +++ b/sfx2/source/view/viewfrm2.cxx @@ -98,7 +98,7 @@ void SfxViewFrame::UpdateTitle() void SwDocShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { - if ( rHint.IsA(TYPE(SfxSimpleHint)) ) + if ( dynamic_cast<const SfxSimpleHint *>(&rHint) != nullptr ) { switch( ( (SfxSimpleHint&) rHint ).GetId() ) { @@ -225,7 +225,7 @@ void SfxViewFrame::Exec_Impl(SfxRequest &rReq ) aReq.AppendItem( SfxFrameItem( SID_DOCFRAME, &GetFrame() ) ); aReq.AppendItem( SfxStringItem( SID_TARGETNAME, OUString( "_blank" ) ) ); SfxGetpApp()->ExecuteSlot( aReq ); - const SfxViewFrameItem* pItem = PTR_CAST( SfxViewFrameItem, aReq.GetReturnValue() ); + const SfxViewFrameItem* pItem = dynamic_cast<const SfxViewFrameItem*>( aReq.GetReturnValue() ); if ( pItem ) rReq.SetReturnValue( SfxFrameItem( 0, pItem->GetFrame() ) ); break; diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index b103283fcfd4..eb278cbd3fa3 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -1342,9 +1342,9 @@ SfxViewShell* SfxViewShell::Get( const Reference< XController>& i_rController ) if ( !i_rController.is() ) return NULL; - for ( SfxViewShell* pViewShell = SfxViewShell::GetFirst( NULL, false ); + for ( SfxViewShell* pViewShell = SfxViewShell::GetFirst( false ); pViewShell; - pViewShell = SfxViewShell::GetNext( *pViewShell, NULL, false ) + pViewShell = SfxViewShell::GetNext( *pViewShell, false ) ) { if ( pViewShell->GetController() == i_rController ) @@ -1503,11 +1503,10 @@ void SfxViewShell::WriteUserDataSequence ( uno::Sequence < beans::PropertyValue // returns the first shell of spec. type viewing the specified doc. - SfxViewShell* SfxViewShell::GetFirst ( - const TypeId* pType, - bool bOnlyVisible + bool bOnlyVisible, + std::function< bool ( const SfxViewShell* ) > isViewShell ) { // search for a SfxViewShell of the specified type @@ -1527,7 +1526,7 @@ SfxViewShell* SfxViewShell::GetFirst if ( pFrame == pShell->GetViewFrame() ) { // only ViewShells with a valid ViewFrame will be returned - if ( ( !bOnlyVisible || pFrame->IsVisible() ) && ( !pType || pShell->IsA(*pType) ) ) + if ( ( !bOnlyVisible || pFrame->IsVisible() ) && (!isViewShell || isViewShell(pShell))) return pShell; break; } @@ -1544,8 +1543,8 @@ SfxViewShell* SfxViewShell::GetFirst SfxViewShell* SfxViewShell::GetNext ( const SfxViewShell& rPrev, - const TypeId* pType, - bool bOnlyVisible + bool bOnlyVisible, + std::function<bool ( const SfxViewShell* )> isViewShell ) { SfxViewShellArr_Impl &rShells = SfxGetpApp()->GetViewShells_Impl(); @@ -1569,7 +1568,7 @@ SfxViewShell* SfxViewShell::GetNext if ( pFrame == pShell->GetViewFrame() ) { // only ViewShells with a valid ViewFrame will be returned - if ( ( !bOnlyVisible || pFrame->IsVisible() ) && ( !pType || pShell->IsA(*pType) ) ) + if ( ( !bOnlyVisible || pFrame->IsVisible() ) && (!isViewShell || isViewShell(pShell)) ) return pShell; break; } diff --git a/sot/source/sdstor/stg.cxx b/sot/source/sdstor/stg.cxx index 3ebd1c21a553..787c5adc3208 100644 --- a/sot/source/sdstor/stg.cxx +++ b/sot/source/sdstor/stg.cxx @@ -185,7 +185,7 @@ StorageStream::~StorageStream() bool StorageStream::Equals( const BaseStorageStream& rStream ) const { - const StorageStream* pOther = PTR_CAST( StorageStream, &rStream ); + const StorageStream* pOther = dynamic_cast<const StorageStream*>( &rStream ); return pOther && ( pOther->pEntry == pEntry ); } @@ -948,7 +948,7 @@ bool Storage::ValidateMode( StreamMode nMode, StgDirEntry* p ) const bool Storage::Equals( const BaseStorage& rStorage ) const { - const Storage* pOther = PTR_CAST( Storage, &rStorage ); + const Storage* pOther = dynamic_cast<const Storage*>( &rStorage ); return pOther && ( pOther->pEntry == pEntry ); } diff --git a/sot/source/sdstor/storage.cxx b/sot/source/sdstor/storage.cxx index 3a337d5e7d2a..3c86fd2c7b9b 100644 --- a/sot/source/sdstor/storage.cxx +++ b/sot/source/sdstor/storage.cxx @@ -275,7 +275,7 @@ bool SotStorageStream::Commit() bool SotStorageStream::SetProperty( const OUString& rName, const ::com::sun::star::uno::Any& rValue ) { - UCBStorageStream* pStg = PTR_CAST( UCBStorageStream, pOwnStm ); + UCBStorageStream* pStg = dynamic_cast<UCBStorageStream*>( pOwnStm ); if ( pStg ) { return pStg->SetProperty( rName, rValue ); @@ -807,7 +807,7 @@ bool SotStorage::Validate() bool SotStorage::IsOLEStorage() const { - UCBStorage* pStg = PTR_CAST( UCBStorage, m_pOwnStg ); + UCBStorage* pStg = dynamic_cast<UCBStorage*>( m_pOwnStg ); return !pStg; } diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx index ff7a20694e43..f85c87d38079 100644 --- a/sot/source/sdstor/ucbstorage.cxx +++ b/sot/source/sdstor/ucbstorage.cxx @@ -1374,7 +1374,7 @@ bool UCBStorageStream::CopyTo( BaseStorageStream* pDestStm ) if( !pImp->Init() ) return false; - UCBStorageStream* pStg = PTR_CAST( UCBStorageStream, pDestStm ); + UCBStorageStream* pStg = dynamic_cast<UCBStorageStream*>( pDestStm ); if ( pStg ) pStg->pImp->m_aContentType = pImp->m_aContentType; @@ -2535,8 +2535,8 @@ bool UCBStorage::CopyStorageElement_Impl( UCBStorageElement_Impl& rElement, Base bDeleteStorage = true; } - UCBStorage* pUCBDest = PTR_CAST( UCBStorage, pDest ); - UCBStorage* pUCBCopy = PTR_CAST( UCBStorage, pStorage ); + UCBStorage* pUCBDest = dynamic_cast<UCBStorage*>( pDest ); + UCBStorage* pUCBCopy = dynamic_cast<UCBStorage*>( pStorage ); bool bOpenUCBStorage = pUCBDest && pUCBCopy; std::unique_ptr<BaseStorage> pOtherStorage(bOpenUCBStorage ? @@ -2588,7 +2588,7 @@ bool UCBStorage::CopyTo( BaseStorage* pDestStg ) const // For UCB storages, the class id and the format id may differ, // do passing the class id is not sufficient. - if( pDestStg->ISA( UCBStorage ) ) + if( dynamic_cast<const UCBStorage *>(pDestStg) != nullptr ) pDestStg->SetClass( pImp->m_aClassId, pImp->m_nFormat, pImp->m_aUserTypeName ); else @@ -2787,7 +2787,7 @@ BaseStorage* UCBStorage::OpenStorage_Impl( const OUString& rEleName, StreamMode if ( !pElement->m_xStream.Is() ) { BaseStorageStream* pStr = OpenStream( rEleName, nMode, bDirect ); - UCBStorageStream* pStream = PTR_CAST( UCBStorageStream, pStr ); + UCBStorageStream* pStream = dynamic_cast<UCBStorageStream*>( pStr ); if ( !pStream ) { SetError( ( nMode & StreamMode::WRITE ) ? SVSTREAM_CANNOT_MAKE : SVSTREAM_FILE_NOT_FOUND ); diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx index fbea9403064e..ae493da6c0a6 100644 --- a/starmath/source/ElementsDockingWindow.cxx +++ b/starmath/source/ElementsDockingWindow.cxx @@ -743,7 +743,7 @@ IMPL_LINK( SmElementsDockingWindow, ElementSelectedHandle, ListBox*, pList) SmViewShell* SmElementsDockingWindow::GetView() { SfxViewShell* pView = GetBindings().GetDispatcher()->GetFrame()->GetViewShell(); - return PTR_CAST(SmViewShell, pView); + return dynamic_cast<SmViewShell*>( pView); } void SmElementsDockingWindow::Resize() diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx index d7d7d0e2e805..e7806a41723e 100644 --- a/starmath/source/edit.cxx +++ b/starmath/source/edit.cxx @@ -414,7 +414,7 @@ void SmEditWindow::KeyInput(const KeyEvent& rKEvt) { bool bCallBase = true; SfxViewShell* pViewShell = GetView(); - if ( pViewShell && pViewShell->ISA(SmViewShell) ) + if ( pViewShell && dynamic_cast<const SmViewShell *>(pViewShell) != nullptr ) { // Terminate possible InPlace mode bCallBase = !pViewShell->Escape(); @@ -482,7 +482,7 @@ void SmEditWindow::KeyInput(const KeyEvent& rKEvt) // SFX has maybe called a slot of the view and thus (because of a hack in SFX) // set the focus to the view SfxViewShell* pVShell = GetView(); - if ( pVShell && pVShell->ISA(SmViewShell) && + if ( pVShell && dynamic_cast<const SmViewShell *>(pVShell) != nullptr && static_cast<SmViewShell*>(pVShell)->GetGraphicWindow().HasFocus() ) { GrabFocus(); diff --git a/starmath/source/smmod.cxx b/starmath/source/smmod.cxx index 771528a0552d..d6c7f7e09d63 100644 --- a/starmath/source/smmod.cxx +++ b/starmath/source/smmod.cxx @@ -180,11 +180,10 @@ SmModule::~SmModule() void SmModule::ApplyColorConfigValues( const svtools::ColorConfig &rColorCfg ) { //invalidate all graphic and edit windows - const TypeId aSmViewTypeId = TYPE(SmViewShell); SfxViewShell* pViewShell = SfxViewShell::GetFirst(); while (pViewShell) { - if ((pViewShell->IsA(aSmViewTypeId))) + if ((dynamic_cast<const SmViewShell *>(pViewShell) != nullptr)) { SmViewShell *pSmView = static_cast<SmViewShell *>(pViewShell); pSmView->GetGraphicWindow().ApplyColorConfigValues( rColorCfg ); diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index 0f52e97b815e..fe292eb264bb 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -1033,11 +1033,10 @@ void SAL_CALL SmModel::render( { //!! when called via API we may not have an active view //!! thus we go and look for a view that can be used. - const TypeId aTypeId = TYPE( SmViewShell ); - SfxViewShell* pViewSh = SfxViewShell::GetFirst( &aTypeId, false /* search non-visible views as well*/ ); + SfxViewShell* pViewSh = SfxViewShell::GetFirst( false /* search non-visible views as well*/, checkSfxViewShell<SmViewShell> ); while (pViewSh && pViewSh->GetObjectShell() != pDocSh) - pViewSh = SfxViewShell::GetNext( *pViewSh, &aTypeId, false /* search non-visible views as well*/ ); - SmViewShell *pView = PTR_CAST( SmViewShell, pViewSh ); + pViewSh = SfxViewShell::GetNext( *pViewSh, false /* search non-visible views as well*/, checkSfxViewShell<SmViewShell> ); + SmViewShell *pView = dynamic_cast< SmViewShell *>( pViewSh ); SAL_WARN_IF( !pView, "starmath", "SmModel::render : no SmViewShell found" ); if (pView) diff --git a/starmath/source/utility.cxx b/starmath/source/utility.cxx index f575600e8fd2..5083cbbda90f 100644 --- a/starmath/source/utility.cxx +++ b/starmath/source/utility.cxx @@ -42,7 +42,7 @@ SmViewShell * SmGetActiveView() { SfxViewShell *pView = SfxViewShell::Current(); - return PTR_CAST(SmViewShell, pView); + return dynamic_cast<SmViewShell*>( pView); } diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index d548b61d2925..ad512b1d50d8 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -694,7 +694,7 @@ SmEditController::~SmEditController() void SmEditController::StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState) { - const SfxStringItem *pItem = PTR_CAST(SfxStringItem, pState); + const SfxStringItem *pItem = dynamic_cast<const SfxStringItem*>( pState); if ((pItem != NULL) && (rEdit.GetText() != OUString(pItem->GetValue()))) rEdit.SetText(pItem->GetValue()); @@ -737,7 +737,7 @@ SmViewShell * SmCmdBoxWindow::GetView() { SfxDispatcher *pDispatcher = GetBindings().GetDispatcher(); SfxViewShell *pView = pDispatcher ? pDispatcher->GetFrame()->GetViewShell() : NULL; - return PTR_CAST(SmViewShell, pView); + return dynamic_cast<SmViewShell*>( pView); } void SmCmdBoxWindow::Resize() diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx index 3c320ebbcda0..362e7257c974 100644 --- a/svl/source/items/itempool.cxx +++ b/svl/source/items/itempool.cxx @@ -411,7 +411,7 @@ void SfxItemPool::SetSecondaryPool( SfxItemPool *pPool ) // Does the Master have SetItems? bool bHasSetItems = false; for ( sal_uInt16 i = 0; !bHasSetItems && i < pImp->mnEnd - pImp->mnStart; ++i ) - bHasSetItems = pImp->ppStaticDefaults[i]->ISA(SfxSetItem); + bHasSetItems = dynamic_cast<const SfxSetItem *>(pImp->ppStaticDefaults[i]) != nullptr; // Detached Pools must be empty bool bOK = bHasSetItems; diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx index c9e251239cb2..2b6be1719eb7 100644 --- a/svl/source/items/itemset.cxx +++ b/svl/source/items/itemset.cxx @@ -882,7 +882,7 @@ const SfxPoolItem& SfxItemSet::Get( sal_uInt16 nWhich, bool bSrchInParent) const } #ifdef DBG_UTIL const SfxPoolItem *pItem = *ppFnd; - if ( pItem->ISA(SfxVoidItem) || !pItem->Which() ) + if ( dynamic_cast<const SfxVoidItem *>(pItem) != nullptr || !pItem->Which() ) SAL_INFO("svl.items", "SFX_WARNING: Getting disabled Item"); #endif return **ppFnd; 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(); diff --git a/vcl/source/app/vclevent.cxx b/vcl/source/app/vclevent.cxx index bcbe518f7b7b..c6a96b95c3bc 100644 --- a/vcl/source/app/vclevent.cxx +++ b/vcl/source/app/vclevent.cxx @@ -52,7 +52,7 @@ void VclEventListeners::Call( VclSimpleEvent& rEvent ) const std::vector<Link<VclSimpleEvent&,void>> aCopy( m_aListeners ); std::vector<Link<VclSimpleEvent&,void>>::iterator aIter( aCopy.begin() ); std::vector<Link<VclSimpleEvent&,void>>::const_iterator aEnd( aCopy.end() ); - if( rEvent.IsA( VclWindowEvent::StaticType() ) ) + if( dynamic_cast<const VclWindowEvent*>( &rEvent ) != nullptr ) { VclWindowEvent* pWinEvent = static_cast<VclWindowEvent*>(&rEvent); ImplDelData aDel( pWinEvent->GetWindow() ); |