diff options
author | Oliver Specht <oliver.specht@cib.de> | 2015-09-30 16:10:07 +0200 |
---|---|---|
committer | Oliver Specht <oliver.specht@cib.de> | 2015-10-06 07:29:37 +0000 |
commit | 89d39bc100aabf5dccbe77c0b5c0c85736e85b39 (patch) | |
tree | 871a91210913ecee91530c95392534bf18f80f3f /sc/source/ui/view | |
parent | 32b9901dae7403453d773f5904de15551a323595 (diff) |
tdf#94559: 4th step to remove rtti.hxx
replaced use of PTR_CAST, IS_TYPE, ISA in
idl, editeng, sc, sd, sw, sfx2, sot, starmath
Change-Id: I4a5bba4fdc4829099618c09b690c83f876a3d653
Reviewed-on: https://gerrit.libreoffice.org/19132
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Oliver Specht <oliver.specht@cib.de>
Diffstat (limited to 'sc/source/ui/view')
26 files changed, 62 insertions, 65 deletions
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) { |