diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-06-08 16:28:47 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-06-08 16:28:47 +0200 |
commit | b2c8ea3a0253ce87f1b292fbb19b461a53c14912 (patch) | |
tree | 853cc34d4ced72c029f9b5bc4b3077d8b1944412 /sw/source/core | |
parent | bc2becdf1a12a1020584ee808c965e41f1837383 (diff) |
loplugin:cstylecast: deal with remaining pointer casts
Change-Id: I8d27ae80d209159690182ab91e272cf00e9f863d
Diffstat (limited to 'sw/source/core')
69 files changed, 157 insertions, 157 deletions
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index c6b433e33e2f..7815447e2381 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -1191,7 +1191,7 @@ uno::Any SwAccessibleParagraph::queryInterface( const uno::Type& rType ) uno::Any aRet; if ( rType == cppu::UnoType<XAccessibleText>::get()) { - uno::Reference<XAccessibleText> aAccText = (XAccessibleText *) *this; // resolve ambiguity + uno::Reference<XAccessibleText> aAccText = static_cast<XAccessibleText *>(*this); // resolve ambiguity aRet <<= aAccText; } else if ( rType == cppu::UnoType<XAccessibleEditableText>::get()) diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx index 1eb97f33e5e9..1b0574420d7f 100644 --- a/sw/source/core/bastyp/calc.cxx +++ b/sw/source/core/bastyp/calc.cxx @@ -178,8 +178,8 @@ _CalcOp* FindOperator( const OUString& rSrch ) aSrch.pUName = &rSrch; aSrch.eOp = CALC_NAME; - return static_cast<_CalcOp*>(bsearch( (void*) &aSrch, - (void*) aOpTable, + return static_cast<_CalcOp*>(bsearch( static_cast<void*>(&aSrch), + static_cast<void const *>(aOpTable), sizeof( aOpTable ) / sizeof( _CalcOp ), sizeof( _CalcOp ), OperatorCompare )); diff --git a/sw/source/core/crsr/callnk.cxx b/sw/source/core/crsr/callnk.cxx index 76e8e3bcfc77..1db2c606c746 100644 --- a/sw/source/core/crsr/callnk.cxx +++ b/sw/source/core/crsr/callnk.cxx @@ -225,7 +225,7 @@ SwCallLink::~SwCallLink() if( rStNd.EndOfSectionNode()->StartOfSectionIndex() > nNode || nNode > rStNd.EndOfSectionIndex() ) - rShell.GetFlyMacroLnk().Call( (void*)pFlyFrm->GetFormat() ); + rShell.GetFlyMacroLnk().Call( const_cast<SwFlyFrameFormat *>(pFlyFrm->GetFormat()) ); } } diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 5464ce356371..0b8aba3ca019 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -491,7 +491,7 @@ bool SwCrsrShell::bColumnChange() if(pParent!=NULL) { pCurrCol=static_cast<SwFrm*>(pParent)->FindColFrm(); - pCurrFrm = (SwFrm*)pParent; + pCurrFrm = static_cast<SwFrm*>(pParent); } else { @@ -2163,7 +2163,7 @@ void SwCrsrShell::ShGetFcs( bool bUpdate ) /** Get current frame in which the cursor is positioned. */ SwContentFrm *SwCrsrShell::GetCurrFrm( const bool bCalcFrm ) const { - SET_CURR_SHELL( (SwViewShell*)this ); + SET_CURR_SHELL( static_cast<SwViewShell*>(const_cast<SwCrsrShell *>(this)) ); SwContentFrm *pRet = 0; SwContentNode *pNd = m_pCurCrsr->GetContentNode(); if ( pNd ) diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx index a1cbabf2f112..b75c504ed436 100644 --- a/sw/source/core/crsr/pam.cxx +++ b/sw/source/core/crsr/pam.cxx @@ -1089,7 +1089,7 @@ void SwPaM::InvalidatePaM() // pretend that the PaM marks inserted text to recalc the portion... SwInsText aHint( Start()->nContent.GetIndex(), End()->nContent.GetIndex() - Start()->nContent.GetIndex() + 1 ); - SwModify *_pModify=(SwModify*)_pTextNd; + SwModify *_pModify=const_cast<SwModify*>(static_cast<SwModify const *>(_pTextNd)); _pModify->ModifyNotification( 0, &aHint); } } diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index c3d591c8c215..38cb79e8ef52 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -167,7 +167,7 @@ void SwVisCrsr::_SetPosAndShow() if( aRect.Height() ) { ::SwCalcPixStatics( m_pCrsrShell->GetOut() ); - ::SwAlignRect( aRect, (SwViewShell*)m_pCrsrShell ); + ::SwAlignRect( aRect, static_cast<SwViewShell const *>(m_pCrsrShell) ); } if( !m_pCrsrShell->IsOverwriteCrsr() || m_bIsDragCrsr || m_pCrsrShell->IsSelection() ) diff --git a/sw/source/core/doc/CntntIdxStore.cxx b/sw/source/core/doc/CntntIdxStore.cxx index 5b6271e58465..834ff27b5999 100644 --- a/sw/source/core/doc/CntntIdxStore.cxx +++ b/sw/source/core/doc/CntntIdxStore.cxx @@ -371,7 +371,7 @@ void ContentIdxStoreImpl::RestoreFlys(SwDoc* pDoc, updater_t& rUpdater, bool bAu else if( bAuto ) { SwFrameFormat *pFrameFormat = (*pSpz)[ aEntry.m_nIdx ]; - SfxPoolItem *pAnchor = (SfxPoolItem*)&pFrameFormat->GetAnchor(); + SfxPoolItem const *pAnchor = static_cast<SfxPoolItem const *>(&pFrameFormat->GetAnchor()); pFrameFormat->NotifyClients( pAnchor, pAnchor ); } } diff --git a/sw/source/core/doc/acmplwrd.cxx b/sw/source/core/doc/acmplwrd.cxx index acfcb57c8e94..9388bfee030b 100644 --- a/sw/source/core/doc/acmplwrd.cxx +++ b/sw/source/core/doc/acmplwrd.cxx @@ -145,7 +145,7 @@ void SwAutoCompleteClient::Modify( const SfxPoolItem* pOld, const SfxPoolItem *) { case RES_REMOVE_UNO_OBJECT: case RES_OBJECTDYING: - if( (void*)GetRegisteredIn() == static_cast<const SwPtrMsgPoolItem *>(pOld)->pObject ) + if( static_cast<void*>(GetRegisteredIn()) == static_cast<const SwPtrMsgPoolItem *>(pOld)->pObject ) static_cast<SwModify*>(GetRegisteredIn())->Remove(this); pAutoCompleteWord->DocumentDying(*pDoc); break; diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index fb43e0c78b25..2d3866147018 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -946,7 +946,7 @@ void SwDoc::CalculatePagePairsForProspectPrinting( // just one page is special ... if ( 1 == aVec.size() ) - aVec.insert( aVec.begin() + 1, (SwPageFrm *)0 ); // insert a second empty page + aVec.insert( aVec.begin() + 1, nullptr ); // insert a second empty page else { // now extend the number of pages to fit a multiple of 4 diff --git a/sw/source/core/doc/docglos.cxx b/sw/source/core/doc/docglos.cxx index 8cc57ff8ab34..282df7f7af2a 100644 --- a/sw/source/core/doc/docglos.cxx +++ b/sw/source/core/doc/docglos.cxx @@ -158,7 +158,7 @@ bool SwDoc::InsertGlossary( SwTextBlocks& rBlock, const OUString& rEntry, SwNodeIndex aStt( pGDoc->GetNodes().GetEndOfExtras(), 1 ); SwContentNode* pContentNd = pGDoc->GetNodes().GoNext( &aStt ); const SwTableNode* pTableNd = pContentNd->FindTableNode(); - SwPaM aCpyPam( pTableNd ? *(SwNode*)pTableNd : *(SwNode*)pContentNd ); + SwPaM aCpyPam( pTableNd ? *const_cast<SwNode*>(static_cast<SwNode const *>(pTableNd)) : *static_cast<SwNode*>(pContentNd) ); aCpyPam.SetMark(); // till the nodes array's end diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index 4d8a04b22e99..1dc1d432ced2 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -1115,7 +1115,7 @@ lcl_InsertDrawLabel( SwDoc & rDoc, SwTextFormatColls *const pTextFormatCollTable OSL_ENSURE( pHint && pHint->Which() == RES_TXTATR_FLYCNT, "Missing FlyInCnt-Hint." ); OSL_ENSURE( pHint && pHint->GetFlyCnt(). - GetFrameFormat() == (SwFrameFormat*)pOldFormat, + GetFrameFormat() == static_cast<SwFrameFormat*>(pOldFormat), "Wrong TextFlyCnt-Hint." ); #endif const_cast<SwFormatFlyCnt&>(pHint->GetFlyCnt()).SetFlyFormat( pNewFormat ); diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 302ebefd8b9e..ef6b904587db 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -896,7 +896,7 @@ SfxObjectShell* SwDoc::CreateCopy(bool bCallInitNew ) const #endif // remove the temporary shell if it is there as it was done before - pRet->SetTmpDocShell( (SfxObjectShell*)NULL ); + pRet->SetTmpDocShell( nullptr ); (void)pRet->release(); diff --git a/sw/source/core/doc/lineinfo.cxx b/sw/source/core/doc/lineinfo.cxx index 578b5767c8a6..c4f5cbb22a30 100644 --- a/sw/source/core/doc/lineinfo.cxx +++ b/sw/source/core/doc/lineinfo.cxx @@ -121,7 +121,7 @@ SwCharFormat* SwLineNumberInfo::GetCharFormat( IDocumentStylePoolAccess& rIDSPA if ( !GetRegisteredIn() ) { SwCharFormat* pFormat = rIDSPA.GetCharFormatFromPool( RES_POOLCHR_LINENUM ); - pFormat->Add( (SwClient*)this ); + pFormat->Add( const_cast<SwClient*>(static_cast<SwClient const *>(this)) ); } return const_cast<SwCharFormat*>(static_cast<const SwCharFormat*>(GetRegisteredIn())); } diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index 893104502584..c3d62ed4928b 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -504,7 +504,7 @@ void SwNoTextFrm::Format( const SwBorderAttrs * ) bool SwNoTextFrm::GetCharRect( SwRect &rRect, const SwPosition& rPos, SwCrsrMoveState *pCMS ) const { - if ( &rPos.nNode.GetNode() != (SwNode*)GetNode() ) + if ( &rPos.nNode.GetNode() != static_cast<SwNode const *>(GetNode()) ) return false; Calc(); diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx index e100b39b965c..0da9ae91a690 100644 --- a/sw/source/core/docnode/ndsect.cxx +++ b/sw/source/core/docnode/ndsect.cxx @@ -553,7 +553,7 @@ void SwDoc::DelSectionFormat( SwSectionFormat *pFormat, bool bDelNodes ) 0 != (pSectNd = pIdx->GetNode().GetSectionNode() )) { SwNodeIndex aUpdIdx( *pIdx ); - getIDocumentContentOperations().DeleteSection( (SwNode*)pSectNd ); + getIDocumentContentOperations().DeleteSection( const_cast<SwNode*>(static_cast<SwNode const *>(pSectNd)) ); if( pFootnoteEndAtTextEnd ) GetFootnoteIdxs().UpdateFootnote( aUpdIdx ); getIDocumentState().SetModified(); diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 16041a22fb13..5fc6f391b774 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -215,7 +215,7 @@ SwTableNode* SwDoc::IsIdxInTable(const SwNodeIndex& rIdx) SwTableNode* pTableNd = 0; sal_uLong nIndex = rIdx.GetIndex(); do { - SwNode* pNd = (SwNode*)GetNodes()[ nIndex ]->StartOfSectionNode(); + SwNode* pNd = static_cast<SwNode*>(GetNodes()[ nIndex ]->StartOfSectionNode()); if( 0 != ( pTableNd = pNd->GetTableNode() ) ) break; @@ -1907,7 +1907,7 @@ bool SwDoc::DeleteRow( const SwCursor& rCursor ) if( pCNd ) { // Change the Shell's Cursor or the one passed? - SwPaM* pPam = (SwPaM*)&rCursor; + SwPaM* pPam = const_cast<SwPaM*>(static_cast<SwPaM const *>(&rCursor)); pPam->GetPoint()->nNode = aIdx; pPam->GetPoint()->nContent.Assign( pCNd, 0 ); pPam->SetMark(); // Both want a part of it @@ -2492,7 +2492,7 @@ void SwDoc::GetTabCols( SwTabCols &rFill, const SwCursor* pCrsr, if( pBoxFrm ) { - pTab = ((SwFrm*)pBoxFrm)->ImplFindTabFrm(); + pTab = const_cast<SwFrm*>(static_cast<SwFrm const *>(pBoxFrm))->ImplFindTabFrm(); pBox = pBoxFrm->GetTabBox(); } else if( pCrsr ) @@ -2512,7 +2512,7 @@ void SwDoc::GetTabCols( SwTabCols &rFill, const SwCursor* pCrsr, } while ( !pTmpFrm->IsCellFrm() ); pBoxFrm = static_cast<const SwCellFrm*>(pTmpFrm); - pTab = ((SwFrm*)pBoxFrm)->ImplFindTabFrm(); + pTab = const_cast<SwFrm*>(static_cast<SwFrm const *>(pBoxFrm))->ImplFindTabFrm(); pBox = pBoxFrm->GetTabBox(); } else if( !pCrsr && !pBoxFrm ) @@ -2706,7 +2706,7 @@ void SwDoc::SetTabCols( const SwTabCols &rNew, bool bCurRowOnly, if( pBoxFrm ) { - pTab = ((SwFrm*)pBoxFrm)->ImplFindTabFrm(); + pTab = const_cast<SwFrm*>(static_cast<SwFrm const *>(pBoxFrm))->ImplFindTabFrm(); pBox = pBoxFrm->GetTabBox(); } else if( pCrsr ) @@ -2726,7 +2726,7 @@ void SwDoc::SetTabCols( const SwTabCols &rNew, bool bCurRowOnly, } while ( !pTmpFrm->IsCellFrm() ); pBoxFrm = static_cast<const SwCellFrm*>(pTmpFrm); - pTab = ((SwFrm*)pBoxFrm)->ImplFindTabFrm(); + pTab = const_cast<SwFrm*>(static_cast<SwFrm const *>(pBoxFrm))->ImplFindTabFrm(); pBox = pBoxFrm->GetTabBox(); } else if( !pCrsr && !pBoxFrm ) @@ -2781,7 +2781,7 @@ void SwDoc::SetTabRows( const SwTabCols &rNew, bool bCurColOnly, const SwCursor* OSL_ENSURE( pBoxFrm, "SetTabRows called without pBoxFrm" ); - pTab = ((SwFrm*)pBoxFrm)->ImplFindTabFrm(); + pTab = const_cast<SwFrm*>(static_cast<SwFrm const *>(pBoxFrm))->ImplFindTabFrm(); // If the Table is still using relative values (USHRT_MAX) // we need to switch to absolute ones. diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx index e405c5f2a2fa..6913c1fbf417 100644 --- a/sw/source/core/docnode/ndtbl1.cxx +++ b/sw/source/core/docnode/ndtbl1.cxx @@ -1470,7 +1470,7 @@ void SwDoc::AdjustCellWidth( const SwCursor& rCursor, bool bBalance ) // It's more robust if we calculate the minimum values for the whole Table const SwTabFrm *pTab = pStart->ImplFindTabFrm(); - pStart = (SwLayoutFrm*)pTab->FirstCell(); + pStart = const_cast<SwLayoutFrm*>(static_cast<SwLayoutFrm const *>(pTab->FirstCell())); pEnd = const_cast<SwLayoutFrm*>(pTab->FindLastContent()->GetUpper()); while( !pEnd->IsCellFrm() ) pEnd = pEnd->GetUpper(); diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index 6cacd008e309..a7c205563a02 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -516,7 +516,7 @@ const SwPageDesc* SwNode::FindPageDesc( bool bCalcLay, const SwFrameFormat* pFrameFormat = rFormats[ n ]; const SwFormatContent& rContent = pFrameFormat->GetContent(); if( rContent.GetContentIdx() && - &rContent.GetContentIdx()->GetNode() == (SwNode*)pSttNd ) + &rContent.GetContentIdx()->GetNode() == static_cast<SwNode const *>(pSttNd) ) { pFormat = pFrameFormat; break; @@ -618,7 +618,7 @@ const SwPageDesc* SwNode::FindPageDesc( bool bCalcLay, const SwFormatContent& rContent = pHdFtFormat->GetContent(); if( rContent.GetContentIdx() && &rContent.GetContentIdx()->GetNode() == - (SwNode*)pSttNd ) + static_cast<SwNode const *>(pSttNd) ) { pPgDesc = &rPgDsc; break; @@ -638,7 +638,7 @@ const SwPageDesc* SwNode::FindPageDesc( bool bCalcLay, const SwFootnoteIdxs& rFootnoteArr = pDoc->GetFootnoteIdxs(); for( size_t n = 0; n < rFootnoteArr.size(); ++n ) if( 0 != ( pTextFootnote = rFootnoteArr[ n ])->GetStartNode() && - (SwNode*)pSttNd == + static_cast<SwNode const *>(pSttNd) == &pTextFootnote->GetStartNode()->GetNode() ) { pNd = &pTextFootnote->GetTextNode(); @@ -1111,7 +1111,7 @@ bool SwContentNode::InvalidateNumRule() SwContentFrm *SwContentNode::getLayoutFrm( const SwRootFrm* _pRoot, const Point* pPoint, const SwPosition *pPos, const bool bCalcFrm ) const { - return static_cast<SwContentFrm*>( ::GetFrmOfModify( _pRoot, *(SwModify*)this, FRM_CNTNT, + return static_cast<SwContentFrm*>( ::GetFrmOfModify( _pRoot, *const_cast<SwModify*>(static_cast<SwModify const *>(this)), FRM_CNTNT, pPoint, pPos, bCalcFrm )); } @@ -1119,7 +1119,7 @@ SwRect SwContentNode::FindLayoutRect( const bool bPrtArea, const Point* pPoint, const bool bCalcFrm ) const { SwRect aRet; - SwContentFrm* pFrm = static_cast<SwContentFrm*>( ::GetFrmOfModify( 0, *(SwModify*)this, + SwContentFrm* pFrm = static_cast<SwContentFrm*>( ::GetFrmOfModify( 0, *const_cast<SwModify*>(static_cast<SwModify const *>(this)), FRM_CNTNT, pPoint, 0, bCalcFrm ) ); if( pFrm ) aRet = bPrtArea ? pFrm->Prt() : pFrm->Frm(); @@ -1130,7 +1130,7 @@ SwRect SwContentNode::FindPageFrmRect( const bool bPrtArea, const Point* pPoint, const bool bCalcFrm ) const { SwRect aRet; - SwFrm* pFrm = ::GetFrmOfModify( 0, *(SwModify*)this, + SwFrm* pFrm = ::GetFrmOfModify( 0, *const_cast<SwModify*>(static_cast<SwModify const *>(this)), FRM_CNTNT, pPoint, 0, bCalcFrm ); if( pFrm && 0 != ( pFrm = pFrm->FindPageFrm() )) aRet = bPrtArea ? pFrm->Prt() : pFrm->Frm(); diff --git a/sw/source/core/docnode/node2lay.cxx b/sw/source/core/docnode/node2lay.cxx index 4ed1518c2d56..09edd1df58ae 100644 --- a/sw/source/core/docnode/node2lay.cxx +++ b/sw/source/core/docnode/node2lay.cxx @@ -163,7 +163,7 @@ SwNode2LayImpl::SwNode2LayImpl( const SwNode& rNode, sal_uLong nIdx, bool bSearc if( pNd ) { if( pNd->IsContentNode() ) - pMod = (SwModify*)pNd->GetContentNode(); + pMod = const_cast<SwModify*>(static_cast<SwModify const *>(pNd->GetContentNode())); else { OSL_ENSURE( pNd->IsTableNode(), "For Tablenodes only" ); diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index ffc6bc876b54..c2e920b7791b 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -812,7 +812,7 @@ void SwSectionFormat::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) case RES_OBJECTDYING: if( !GetDoc()->IsInDtor() && pOld && - static_cast<const SwPtrMsgPoolItem *>(pOld)->pObject == (void*)GetRegisteredIn() ) + static_cast<const SwPtrMsgPoolItem *>(pOld)->pObject == static_cast<void*>(GetRegisteredIn()) ) { // My Parents will be destroyed, so get the Parent's Parent // and update @@ -824,7 +824,7 @@ void SwSectionFormat::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) case RES_FMT_CHG: if( !GetDoc()->IsInDtor() && - static_cast<const SwFormatChg*>(pNew)->pChangedFormat == (void*)GetRegisteredIn() && + static_cast<const SwFormatChg*>(pNew)->pChangedFormat == static_cast<void*>(GetRegisteredIn()) && static_cast<const SwFormatChg*>(pNew)->pChangedFormat->IsA( TYPE( SwSectionFormat )) ) { // My Parent will be changed, thus I need to update @@ -977,16 +977,16 @@ void SwSectionFormat::UpdateParent() if (!pProtect->IsContentProtected() != !pSection->IsProtectFlag()) { - pLast->ModifyNotification( (SfxPoolItem*)pProtect, - (SfxPoolItem*)pProtect ); + pLast->ModifyNotification( static_cast<SfxPoolItem const *>(pProtect), + static_cast<SfxPoolItem const *>(pProtect) ); } // edit in readonly sections if (!pEditInReadonly->GetValue() != !pSection->IsEditInReadonlyFlag()) { - pLast->ModifyNotification( (SfxPoolItem*)pEditInReadonly, - (SfxPoolItem*)pEditInReadonly ); + pLast->ModifyNotification( static_cast<SfxPoolItem const *>(pEditInReadonly), + static_cast<SfxPoolItem const *>(pEditInReadonly) ); } if( bIsHidden == pSection->IsHiddenFlag() ) @@ -1414,7 +1414,7 @@ static void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd ) pPam = pCrsr; } - SvMemoryStream aStrm( (void*)aSeq.getConstArray(), aSeq.getLength(), + SvMemoryStream aStrm( const_cast<sal_Int8 *>(aSeq.getConstArray()), aSeq.getLength(), StreamMode::READ ); aStrm.Seek( 0 ); diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx index efd249ff071d..43ba556daef7 100644 --- a/sw/source/core/draw/dflyobj.cxx +++ b/sw/source/core/draw/dflyobj.cxx @@ -996,7 +996,7 @@ SdrObject* SwVirtFlyDrawObj::CheckMacroHit( const SdrObjMacroHitRec& rRec ) cons { if( !rURL.GetMap() || pFlyFrm->GetFormat()->GetIMapObject( rRec.aPos, pFlyFrm )) - return (SdrObject*)this; + return const_cast<SdrObject*>(static_cast<SdrObject const *>(this)); return 0; } diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx index 3e109c75fceb..ac67d6214938 100644 --- a/sw/source/core/draw/dview.cxx +++ b/sw/source/core/draw/dview.cxx @@ -298,7 +298,7 @@ SdrObject* SwDrawView::GetMaxToBtmObj(SdrObject* pObj) const const SwFlyFrm *pFly = pAnch->FindFlyFrm(); if ( pFly ) { - SdrObject *pRet = (SdrObject*)pFly->GetVirtDrawObj(); + SdrObject *pRet = const_cast<SdrObject*>(static_cast<SdrObject const *>(pFly->GetVirtDrawObj())); return pRet != pObj ? pRet : 0; } } diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx index 72d76a34b384..f498f753912c 100644 --- a/sw/source/core/edit/editsh.cxx +++ b/sw/source/core/edit/editsh.cxx @@ -574,14 +574,14 @@ sfx2::LinkManager& SwEditShell::GetLinkManager() void *SwEditShell::GetIMapInventor() const { // The node on which the cursor points should be sufficient as a unique identifier - return (void*)&(GetCrsr()->GetNode()); + return static_cast<void*>(&(GetCrsr()->GetNode())); } // #i73788# Graphic SwEditShell::GetIMapGraphic() const { // returns always a graphic if the cursor is in a Fly - SET_CURR_SHELL( (SwViewShell*)this ); + SET_CURR_SHELL( const_cast<SwViewShell*>(static_cast<SwViewShell const *>(this)) ); Graphic aRet; SwPaM* pCrsr = GetCrsr(); if ( !pCrsr->HasMark() ) diff --git a/sw/source/core/edit/edws.cxx b/sw/source/core/edit/edws.cxx index 2303e07a3a45..b87ec6f742d6 100644 --- a/sw/source/core/edit/edws.cxx +++ b/sw/source/core/edit/edws.cxx @@ -172,7 +172,7 @@ SwMvContext::~SwMvContext() SwFrameFormat *SwEditShell::GetTableFormat() // fastest test on a table { const SwTableNode* pTableNd = IsCrsrInTable(); - return pTableNd ? (SwFrameFormat*)pTableNd->GetTable().GetFrameFormat() : 0; + return pTableNd ? static_cast<SwFrameFormat*>(pTableNd->GetTable().GetFrameFormat()) : 0; } // TODO: Why is this called 3x for a new document? diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx index ec4f7c4ae7d2..f8fa23ce9d9b 100644 --- a/sw/source/core/fields/authfld.cxx +++ b/sw/source/core/fields/authfld.cxx @@ -88,7 +88,7 @@ void SwAuthorityFieldType::RemoveField(sal_IntPtr nHandle) for(SwAuthDataArr::size_type j = 0; j < m_DataArr.size(); ++j) { SwAuthEntry* pTemp = &m_DataArr[j]; - sal_IntPtr nRet = reinterpret_cast<sal_IntPtr>((void*)pTemp); + sal_IntPtr nRet = reinterpret_cast<sal_IntPtr>(static_cast<void*>(pTemp)); if(nRet == nHandle) { pTemp->RemoveRef(); @@ -117,14 +117,14 @@ sal_IntPtr SwAuthorityFieldType::AddField(const OUString& rFieldContents) if(rTemp == *pEntry) { delete pEntry; - nRet = reinterpret_cast<sal_IntPtr>((void*)&rTemp); + nRet = reinterpret_cast<sal_IntPtr>(static_cast<void*>(&rTemp)); rTemp.AddRef(); return nRet; } } //if it is a new Entry - insert - nRet = reinterpret_cast<sal_IntPtr>((void*)pEntry); + nRet = reinterpret_cast<sal_IntPtr>(static_cast<void*>(pEntry)); pEntry->AddRef(); m_DataArr.push_back(pEntry); //re-generate positions of the fields @@ -136,7 +136,7 @@ bool SwAuthorityFieldType::AddField(sal_IntPtr nHandle) { for(auto &rTemp : m_DataArr) { - sal_IntPtr nTmp = reinterpret_cast<sal_IntPtr>((void*)&rTemp); + sal_IntPtr nTmp = reinterpret_cast<sal_IntPtr>(static_cast<void*>(&rTemp)); if( nTmp == nHandle ) { rTemp.AddRef(); @@ -153,7 +153,7 @@ const SwAuthEntry* SwAuthorityFieldType::GetEntryByHandle(sal_IntPtr nHandle) c { for(auto &rTemp : m_DataArr) { - sal_IntPtr nTmp = reinterpret_cast<sal_IntPtr>((void*)&rTemp); + sal_IntPtr nTmp = reinterpret_cast<sal_IntPtr>(static_cast<void const *>(&rTemp)); if( nTmp == nHandle ) { return &rTemp; @@ -224,7 +224,7 @@ sal_IntPtr SwAuthorityFieldType::GetHandle(sal_uInt16 nPos) if( nPos < m_DataArr.size() ) { SwAuthEntry* pTemp = &m_DataArr[nPos]; - return reinterpret_cast<sal_IntPtr>((void*)pTemp); + return reinterpret_cast<sal_IntPtr>(static_cast<void*>(pTemp)); } return 0; } diff --git a/sw/source/core/fields/cellfml.cxx b/sw/source/core/fields/cellfml.cxx index 1010f0032b8e..a44b3db93441 100644 --- a/sw/source/core/fields/cellfml.cxx +++ b/sw/source/core/fields/cellfml.cxx @@ -548,7 +548,7 @@ void SwTableFormula::PtrToBoxNm( const SwTable* pTable ) case EXTRNL_NAME: return; } - m_sFormula = ScanString( fnFormula, *pTable, (void*)pNd ); + m_sFormula = ScanString( fnFormula, *pTable, const_cast<void*>(static_cast<void const *>(pNd)) ); m_eNmType = EXTRNL_NAME; } @@ -573,7 +573,7 @@ void SwTableFormula::BoxNmToPtr( const SwTable* pTable ) case INTRNL_NAME: return; } - m_sFormula = ScanString( fnFormula, *pTable, (void*)pNd ); + m_sFormula = ScanString( fnFormula, *pTable, const_cast<void*>(static_cast<void const *>(pNd)) ); m_eNmType = INTRNL_NAME; } @@ -595,7 +595,7 @@ void SwTableFormula::ToRelBoxNm( const SwTable* pTable ) case REL_NAME: return; } - m_sFormula = ScanString( fnFormula, *pTable, (void*)pNd ); + m_sFormula = ScanString( fnFormula, *pTable, const_cast<void*>(static_cast<void const *>(pNd)) ); m_eNmType = REL_NAME; } @@ -1196,7 +1196,7 @@ void SwTableFormula::ToSplitMergeBoxNm( SwTableFormulaUpdate& rTableUpd ) else pTable = rTableUpd.pTable; - m_sFormula = ScanString( &SwTableFormula::_SplitMergeBoxNm, *pTable, (void*)&rTableUpd ); + m_sFormula = ScanString( &SwTableFormula::_SplitMergeBoxNm, *pTable, static_cast<void*>(&rTableUpd) ); m_eNmType = INTRNL_NAME; } diff --git a/sw/source/core/fields/ddetbl.cxx b/sw/source/core/fields/ddetbl.cxx index b4823e6a61e2..9f6a74d2fcd6 100644 --- a/sw/source/core/fields/ddetbl.cxx +++ b/sw/source/core/fields/ddetbl.cxx @@ -156,7 +156,7 @@ bool SwDDETable::NoDDETable() if( aLines.empty() ) return false; OSL_ENSURE( !GetTabSortBoxes().empty(), "Table without content?" ); - SwNode* pNd = (SwNode*)GetTabSortBoxes()[0]->GetSttNd(); + SwNode* pNd = const_cast<SwNode*>(static_cast<SwNode const *>(GetTabSortBoxes()[0]->GetSttNd())); if( !pNd->GetNodes().IsDocNodes() ) return false; diff --git a/sw/source/core/frmedt/fedesc.cxx b/sw/source/core/frmedt/fedesc.cxx index 35d9210e26f8..391ce161675e 100644 --- a/sw/source/core/frmedt/fedesc.cxx +++ b/sw/source/core/frmedt/fedesc.cxx @@ -93,7 +93,7 @@ void SwFEShell::ChgCurPageDesc( const SwPageDesc& rDesc ) aNew.SetNumOffset( oPageNumOffset ); if ( pFlow->IsInTab() ) - GetDoc()->SetAttr( aNew, *(SwFormat*)pFlow->FindTabFrm()->GetFormat() ); + GetDoc()->SetAttr( aNew, *const_cast<SwFormat*>(static_cast<SwFormat const *>(pFlow->FindTabFrm()->GetFormat())) ); else { SwPaM aPaM( *static_cast<const SwContentFrm*>(pFlow)->GetNode() ); diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index 2937f04928e4..7a73af074341 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -985,7 +985,7 @@ bool SwFEShell::GetFlyFrmAttr( SfxItemSet &rSet ) const } } - SET_CURR_SHELL( (SwViewShell*)this ); + SET_CURR_SHELL( const_cast<SwViewShell*>(static_cast<SwViewShell const *>(this)) ); if( !rSet.Set( pFly->GetFormat()->GetAttrSet(), true ) ) return false; @@ -1823,8 +1823,8 @@ void SwFEShell::GetConnectableFrameFormats(SwFrameFormat & rFormat, StartAction(); SwFormatChain rChain = rFormat.GetChain(); - SwFrameFormat * pOldChainNext = (SwFrameFormat *) rChain.GetNext(); - SwFrameFormat * pOldChainPrev = (SwFrameFormat *) rChain.GetPrev(); + SwFrameFormat * pOldChainNext = static_cast<SwFrameFormat *>(rChain.GetNext()); + SwFrameFormat * pOldChainPrev = static_cast<SwFrameFormat *>(rChain.GetPrev()); if (pOldChainNext) mpDoc->Unchain(rFormat); diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index 4b46bfc02103..b72bead59631 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -111,7 +111,7 @@ static void lcl_GrabCursor( SwFEShell* pSh, SwFlyFrm* pOldSelFly) (!pOldSelFly || pOldSelFly->GetFormat() != pFlyFormat) ) { // now call set macro if applicable - pSh->GetFlyMacroLnk().Call( (void*)pFlyFormat ); + pSh->GetFlyMacroLnk().Call( const_cast<void*>(static_cast<void const *>(pFlyFormat)) ); extern bool g_bNoInterrupt; // in swmodule.cxx // if a dialog was started inside a macro, then // MouseButtonUp arrives at macro and not to us. Therefore @@ -552,7 +552,7 @@ FrmTypeFlags SwFEShell::GetSelFrmType() const { // obtain marked item as fly frame; if no fly frame, it must // be a draw object - const SwFlyFrm* pFly = ::GetFlyFromMarked(pMarkList, (SwViewShell*)this); + const SwFlyFrm* pFly = ::GetFlyFromMarked(pMarkList, const_cast<SwViewShell*>(static_cast<SwViewShell const *>(this))); if ( pFly != NULL ) { if( pFly->IsFlyLayFrm() ) @@ -978,7 +978,7 @@ bool SwFEShell::IsFrmSelected() const return false; else return 0 != ::GetFlyFromMarked( &Imp()->GetDrawView()->GetMarkedObjectList(), - (SwViewShell*)this ); + const_cast<SwViewShell*>(static_cast<SwViewShell const *>(this)) ); } bool SwFEShell::IsObjSelected( const SdrObject& rObj ) const diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx index 78d406b4cb87..44dd490907d8 100644 --- a/sw/source/core/frmedt/fews.cxx +++ b/sw/source/core/frmedt/fews.cxx @@ -70,7 +70,7 @@ void SwFEShell::EndAllActionAndCall() // Determine the Content's nearest to the point Point SwFEShell::GetContentPos( const Point& rPoint, bool bNext ) const { - SET_CURR_SHELL( (SwViewShell*)this ); + SET_CURR_SHELL( const_cast<SwViewShell*>(static_cast<SwViewShell const *>(this)) ); return GetLayout()->GetNextPrevContentPos( rPoint, bNext ); } @@ -79,7 +79,7 @@ const SwRect& SwFEShell::GetAnyCurRect( CurRectType eType, const Point* pPt, { const SwFrm *pFrm = Imp()->HasDrawView() ? ::GetFlyFromMarked( &Imp()->GetDrawView()->GetMarkedObjectList(), - (SwViewShell*)this) + const_cast<SwViewShell*>(static_cast<SwViewShell const *>(this))) : 0; if( !pFrm ) @@ -597,8 +597,8 @@ sal_uInt16 SwFEShell::GetCurOutColNum( SwGetCurColNumPara* pPara ) const OSL_ENSURE( pFrm, "Crsr parked?" ); if( pFrm ) { - pFrm = pFrm->IsInTab() ? (SwFrm*)pFrm->FindTabFrm() - : (SwFrm*)pFrm->FindSctFrm(); + pFrm = pFrm->IsInTab() ? static_cast<SwFrm*>(pFrm->FindTabFrm()) + : static_cast<SwFrm*>(pFrm->FindSctFrm()); OSL_ENSURE( pFrm, "No Tab, no Sect" ); if( pFrm ) nRet = _GetCurColNum( pFrm, pPara ); diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx index 5c2867e5a6a2..f2e55e34ac2c 100644 --- a/sw/source/core/graphic/ndgrf.cxx +++ b/sw/source/core/graphic/ndgrf.cxx @@ -520,7 +520,7 @@ bool SwGrfNode::SwapIn( bool bWaitForData ) bool bRet = false; bInSwapIn = true; - SwBaseLink* pLink = static_cast<SwBaseLink*>((::sfx2::SvBaseLink*) refLink); + SwBaseLink* pLink = static_cast<SwBaseLink*>(static_cast<sfx2::SvBaseLink*>(refLink)); if( pLink ) { @@ -737,7 +737,7 @@ void SwGrfNode::ReleaseLink() { bInSwapIn = true; - SwBaseLink* pLink = static_cast<SwBaseLink*>((::sfx2::SvBaseLink*) refLink); + SwBaseLink* pLink = static_cast<SwBaseLink*>(static_cast<sfx2::SvBaseLink*>(refLink)); pLink->SwapIn( true, true ); bInSwapIn = false; } diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index 93d139c25f3f..e48f4be06632 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -159,7 +159,7 @@ void DelHFFormat( SwClient *pToRemove, SwFrameFormat *pFormat ) pNode = & aIdx.GetNode(); } } - rCnt.SetNewContentIdx( (const SwNodeIndex*)0 ); + rCnt.SetNewContentIdx( nullptr ); // When deleting a header/footer-format, we ALWAYS need to disable // the undo function (Bug 31069) @@ -2696,7 +2696,7 @@ SwRect SwFrameFormat::FindLayoutRect( const bool bPrtArea, const Point* pPoint, else { const sal_uInt16 nFrmType = RES_FLYFRMFMT == Which() ? FRM_FLY : USHRT_MAX; - pFrm = ::GetFrmOfModify( 0, *(SwModify*)this, nFrmType, pPoint, + pFrm = ::GetFrmOfModify( 0, *const_cast<SwModify*>(static_cast<SwModify const *>(this)), nFrmType, pPoint, 0, bCalcFrm ); } @@ -3049,7 +3049,7 @@ void SwFlyFrameFormat::MakeFrms() SwFlyFrm* SwFlyFrameFormat::GetFrm( const Point* pPoint, const bool bCalcFrm ) const { - return static_cast<SwFlyFrm*>(::GetFrmOfModify( 0, *(SwModify*)this, FRM_FLY, + return static_cast<SwFlyFrm*>(::GetFrmOfModify( 0, *const_cast<SwModify*>(static_cast<SwModify const *>(this)), FRM_FLY, pPoint, 0, bCalcFrm )); } diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index ec2da7d8f385..e52cfd0d0447 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -1314,7 +1314,7 @@ void SwContentFrm::MakeAll() { // In this Prepare, an _InvalidateSize() might happen. // mbValidSize becomes false and Format() gets called. - Prepare( PREP_POS_CHGD, (const void*)&bFormatted, false ); + Prepare( PREP_POS_CHGD, static_cast<const void*>(&bFormatted), false ); if ( bWidow && GetFollow() ) { Prepare( PREP_WIDOWS_ORPHANS, 0, false ); @@ -1370,7 +1370,7 @@ void SwContentFrm::MakeAll() MakePos(); if( aOldPos != (Frm().*fnRect->fnGetPos)() ) { - Prepare( PREP_POS_CHGD, (const void*)&bFormatted, false ); + Prepare( PREP_POS_CHGD, static_cast<const void*>(&bFormatted), false ); if ( !mbValidSize ) { (Frm().*fnRect->fnSetWidth)( (GetUpper()-> @@ -1801,7 +1801,7 @@ bool SwContentFrm::_WouldFit( SwTwips nSpace, // Within footnotes, we may even need to put the SwFootnoteFrm somewhere else, if // there's no SwFootnoteFrm there. SwFrm* pTmpFrm = pFrm->IsInFootnote() && !pNewUpper->FindFootnoteFrm() ? - (SwFrm*)pFrm->FindFootnoteFrm() : pFrm; + static_cast<SwFrm*>(pFrm->FindFootnoteFrm()) : pFrm; SwLayoutFrm *pUp = pTmpFrm->GetUpper(); SwFrm *pOldNext = pTmpFrm->GetNext(); pTmpFrm->RemoveFromLayout(); diff --git a/sw/source/core/layout/dumpfilter.cxx b/sw/source/core/layout/dumpfilter.cxx index 60d73c5c58ed..244dac889d09 100644 --- a/sw/source/core/layout/dumpfilter.cxx +++ b/sw/source/core/layout/dumpfilter.cxx @@ -104,7 +104,7 @@ namespace sw // Dump the layout XML into the XOutputStream xmlOutputBufferPtr outBuffer = xmlOutputBufferCreateIO( - writeCallback, closeCallback, ( void* ) xOut.get(), NULL ); + writeCallback, closeCallback, static_cast<void*>(xOut.get()), NULL ); xmlTextWriterPtr writer = xmlNewTextWriter( outBuffer ); xmlTextWriterSetIndent(writer, 1); diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx index 18189ba9ad95..fdf9ca38fc9e 100644 --- a/sw/source/core/layout/findfrm.cxx +++ b/sw/source/core/layout/findfrm.cxx @@ -1088,7 +1088,7 @@ SwFrm *SwFrm::_FindPrev() (bFootnote && pPrvCnt->IsInFootnote()) ) { pRet = pPrvCnt->IsInTab() ? pPrvCnt->FindTabFrm() - : (SwFrm*)pPrvCnt; + : static_cast<SwFrm*>(pPrvCnt); return pRet; } pPrvCnt = pPrvCnt->GetPrevContentFrm(); @@ -1097,7 +1097,7 @@ SwFrm *SwFrm::_FindPrev() else if ( pThis->IsInFly() ) { pRet = pPrvCnt->IsInTab() ? pPrvCnt->FindTabFrm() - : (SwFrm*)pPrvCnt; + : static_cast<SwFrm*>(pPrvCnt); return pRet; } else // footer or header or Fly @@ -1112,7 +1112,7 @@ SwFrm *SwFrm::_FindPrev() if ( pCntUp == pUp ) { pRet = pPrvCnt->IsInTab() ? pPrvCnt->FindTabFrm() - : (SwFrm*)pPrvCnt; + : static_cast<SwFrm*>(pPrvCnt); return pRet; } } diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index 41cac22cbd5f..197a68d8e8f8 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -2482,7 +2482,7 @@ bool SwFlowFrm::MoveBwd( bool &rbReformat ) SwPageFrm *pNewPage = m_rThis.FindPageFrm(); if( pNewPage != pOldPage ) { - m_rThis.Prepare( PREP_BOSS_CHGD, (const void*)pOldPage, false ); + m_rThis.Prepare( PREP_BOSS_CHGD, static_cast<const void*>(pOldPage), false ); SwViewShell *pSh = m_rThis.getRootFrm()->GetCurrShell(); if ( pSh && !pSh->Imp()->IsUpdateExpFields() ) pSh->GetDoc()->getIDocumentFieldsAccess().SetNewFieldLst(true); // Will be done by CalcLayout() later on diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index 4d7c3d81ecb6..02eed3a77595 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -197,7 +197,7 @@ void SwFlyFrm::InsertCnt() OSL_ENSURE( rContent.GetContentIdx(), ":-( no content prepared." ); sal_uLong nIndex = rContent.GetContentIdx()->GetIndex(); // Lower() means SwColumnFrm; the Content then needs to be inserted into the (Column)BodyFrm - ::_InsertCnt( Lower() ? static_cast<SwLayoutFrm*>(static_cast<SwLayoutFrm*>(Lower())->Lower()) : (SwLayoutFrm*)this, + ::_InsertCnt( Lower() ? static_cast<SwLayoutFrm*>(static_cast<SwLayoutFrm*>(Lower())->Lower()) : static_cast<SwLayoutFrm*>(this), GetFormat()->GetDoc(), nIndex ); // NoText always have a fixed height. diff --git a/sw/source/core/layout/flyincnt.cxx b/sw/source/core/layout/flyincnt.cxx index dde26732eff6..cbd0d3045e78 100644 --- a/sw/source/core/layout/flyincnt.cxx +++ b/sw/source/core/layout/flyincnt.cxx @@ -187,7 +187,7 @@ void SwFlyInCntFrm::NotifyBackground( SwPageFrm *, const SwRect& rRect, if ( eHint == PREP_FLY_ATTR_CHG ) AnchorFrm()->Prepare( PREP_FLY_ATTR_CHG ); else - AnchorFrm()->Prepare( eHint, (void*)&rRect ); + AnchorFrm()->Prepare( eHint, static_cast<void const *>(&rRect) ); } const Point SwFlyInCntFrm::GetRelPos() const diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx index dd4866f44993..a5b27b6f5725 100644 --- a/sw/source/core/layout/flylay.cxx +++ b/sw/source/core/layout/flylay.cxx @@ -549,7 +549,7 @@ void SwPageFrm::AppendFlyToPage( SwFlyFrm *pNew ) { if ( !pNew->GetVirtDrawObj()->IsInserted() ) getRootFrm()->GetDrawPage()->InsertObject( - (SdrObject*)pNew->GetVirtDrawObj(), + static_cast<SdrObject*>(pNew->GetVirtDrawObj()), pNew->GetVirtDrawObj()->GetReferencedObj().GetOrdNumDirect() ); InvalidateSpelling(); diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index 3855f33ed544..698772a2434d 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -2207,11 +2207,11 @@ void SwBorderAttrs::_GetBottomLine( const SwFrm& _rFrm ) SwBorderAttrAccess::SwBorderAttrAccess( SwCache &rCach, const SwFrm *pFrm ) : SwCacheAccess( rCach, (pFrm->IsContentFrm() ? - (void*)static_cast<const SwContentFrm*>(pFrm)->GetNode() : - (void*)static_cast<const SwLayoutFrm*>(pFrm)->GetFormat()), + const_cast<void*>(static_cast<void const *>(static_cast<const SwContentFrm*>(pFrm)->GetNode())) : + const_cast<void*>(static_cast<void const *>(static_cast<const SwLayoutFrm*>(pFrm)->GetFormat()))), (pFrm->IsContentFrm() ? - ((SwModify*)static_cast<const SwContentFrm*>(pFrm)->GetNode())->IsInCache() : - ((SwModify*)static_cast<const SwLayoutFrm*>(pFrm)->GetFormat())->IsInCache()) ), + static_cast<SwModify const *>(static_cast<const SwContentFrm*>(pFrm)->GetNode())->IsInCache() : + static_cast<SwModify const *>(static_cast<const SwLayoutFrm*>(pFrm)->GetFormat())->IsInCache()) ), pConstructor( pFrm ) { } @@ -2886,7 +2886,7 @@ static void lcl_NotifyContent( const SdrObject *pThis, SwContentFrm *pCnt, // #i23129# - only invalidate, if the text frame // printing area overlaps with the given rectangle. else if ( aCntPrt.IsOver( rRect ) ) - pCnt->Prepare( eHint, (void*)&aCntPrt._Intersection( rRect ) ); + pCnt->Prepare( eHint, static_cast<void*>(&aCntPrt._Intersection( rRect )) ); if ( pCnt->GetDrawObjs() ) { const SwSortedObjs &rObjs = *pCnt->GetDrawObjs(); diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx index 4836695768c2..ca53eda8e784 100644 --- a/sw/source/core/layout/ftnfrm.cxx +++ b/sw/source/core/layout/ftnfrm.cxx @@ -780,7 +780,7 @@ SwLayoutFrm *SwFrm::GetPrevFootnoteLeaf( MakePageType eMakeFootnote ) const SwFootnoteBossFrm* pNewBoss = pRet->FindFootnoteBossFrm(); bool bJump = false; if( pOldBoss->IsColumnFrm() && pOldBoss->GetPrev() ) // a previous column exists - bJump = pOldBoss->GetPrev() != (SwFrm*)pNewBoss; // did we chose it? + bJump = pOldBoss->GetPrev() != static_cast<SwFrm const *>(pNewBoss); // did we chose it? else if( pNewBoss->IsColumnFrm() && pNewBoss->GetNext() ) bJump = true; // there is another column after the boss (not the old boss) else @@ -846,7 +846,7 @@ void sw_RemoveFootnotes( SwFootnoteBossFrm* pBoss, bool bPageOnly, bool bEndNote if ( !pFootnote->GetAttr()->GetFootnote().IsEndNote() || bEndNotes ) { - pFootnote->GetRef()->Prepare( PREP_FTN, (void*)pFootnote->GetAttr() ); + pFootnote->GetRef()->Prepare( PREP_FTN, static_cast<void*>(pFootnote->GetAttr()) ); if ( bPageOnly && !pNxt ) pNxt = pFootnote->GetFollow(); pFootnote->Cut(); diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index c06706e0dc06..5289d58faf3a 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -1094,7 +1094,7 @@ bool SwLayAction::IsShortCut( SwPageFrm *&prPage ) if ( pContent->IsInSct() ) { - const SwSectionFrm *pSct = ((SwFrm*)pContent)->ImplFindSctFrm(); + const SwSectionFrm *pSct = const_cast<SwFrm*>(static_cast<SwFrm const *>(pContent))->ImplFindSctFrm(); if ( !pSct->IsValid() ) { pSct->Calc(); @@ -1120,7 +1120,7 @@ bool SwLayAction::IsShortCut( SwPageFrm *&prPage ) if ( !bPageChg && pContent->IsInTab() ) { - const SwTabFrm *pTab = ((SwFrm*)pContent)->ImplFindTabFrm(); + const SwTabFrm *pTab = const_cast<SwFrm*>(static_cast<SwFrm const *>(pContent))->ImplFindTabFrm(); if ( !pTab->IsValid() ) { pTab->Calc(); @@ -1135,7 +1135,7 @@ bool SwLayAction::IsShortCut( SwPageFrm *&prPage ) if ( !bPageChg && pContent->IsInSct() ) { - const SwSectionFrm *pSct = ((SwFrm*)pContent)->ImplFindSctFrm(); + const SwSectionFrm *pSct = const_cast<SwFrm*>(static_cast<SwFrm const *>(pContent))->ImplFindSctFrm(); if ( !pSct->IsValid() ) { pSct->Calc(); diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index eb770178616a..95493a149f6a 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -1663,7 +1663,7 @@ static void lcl_SubtractFlys( const SwFrm *pFrm, const SwPageFrm *pPage, ) { SwRect aRect; - SwBorderAttrAccess aAccess( SwFrm::GetCache(), (SwFrm*)pFly ); + SwBorderAttrAccess aAccess( SwFrm::GetCache(), static_cast<SwFrm const *>(pFly) ); const SwBorderAttrs &rAttrs = *aAccess.Get(); ::lcl_CalcBorderRect( aRect, pFly, rAttrs, true, rProperties ); rRegion -= aRect; @@ -1680,7 +1680,7 @@ static void lcl_SubtractFlys( const SwFrm *pFrm, const SwPageFrm *pPage, //So the border won't get dismantled by the background of the other //Fly. SwRect aRect; - SwBorderAttrAccess aAccess( SwFrm::GetCache(), (SwFrm*)pFly ); + SwBorderAttrAccess aAccess( SwFrm::GetCache(), static_cast<SwFrm const *>(pFly) ); const SwBorderAttrs &rAttrs = *aAccess.Get(); ::lcl_CalcBorderRect( aRect, pFly, rAttrs, true, rProperties ); rRegion -= aRect; @@ -3202,7 +3202,7 @@ void SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) c gProp.pSGlobalShell = pSh; if( !pSh->GetWin() ) - gProp.pSProgress = SfxProgress::GetActiveProgress( (SfxObjectShell*) pSh->GetDoc()->GetDocShell() ); + gProp.pSProgress = SfxProgress::GetActiveProgress( static_cast<SfxObjectShell*>(pSh->GetDoc()->GetDocShell()) ); ::SwCalcPixStatics( pSh->GetOut() ); aGlobalRetoucheColor = pSh->Imp()->GetRetoucheColor(); @@ -4246,7 +4246,7 @@ void SwFlyFrm::Paint(SwRect const& rRect, SwPrintData const*const) const pPage = FindPageFrm(); - SwBorderAttrAccess aAccess( SwFrm::GetCache(), (SwFrm*)this ); + SwBorderAttrAccess aAccess( SwFrm::GetCache(), static_cast<SwFrm const *>(this) ); const SwBorderAttrs &rAttrs = *aAccess.Get(); // paint background @@ -4376,7 +4376,7 @@ void SwTabFrm::Paint(SwRect const& rRect, SwPrintData const*const) const // #i29550# if ( IsCollapsingBorders() ) { - SwBorderAttrAccess aAccess( SwFrm::GetCache(), (SwFrm*)this ); + SwBorderAttrAccess aAccess( SwFrm::GetCache(), static_cast<SwFrm const *>(this) ); const SwBorderAttrs &rAttrs = *aAccess.Get(); // paint shadow diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx index e9cc07bd9833..3922b7a9d3da 100644 --- a/sw/source/core/layout/sectfrm.cxx +++ b/sw/source/core/layout/sectfrm.cxx @@ -914,9 +914,9 @@ static void lcl_ColumnRefresh( SwSectionFrm* pSect, bool bFollow ) do { pCol->_InvalidateSize(); pCol->_InvalidatePos(); - ((SwLayoutFrm*)pCol)->Lower()->_InvalidateSize(); + static_cast<SwLayoutFrm*>(pCol)->Lower()->_InvalidateSize(); pCol->Calc(); // calculation of column and - ((SwLayoutFrm*)pCol)->Lower()->Calc(); // body + static_cast<SwLayoutFrm*>(pCol)->Lower()->Calc(); // body pCol = static_cast<SwColumnFrm*>(pCol->GetNext()); } while ( pCol ); } @@ -1859,7 +1859,7 @@ bool SwSectionFrm::Growable() const (Frm().*fnRect->fnGetBottom)() ) > 0 ) return true; - return ( GetUpper() && ((SwFrm*)GetUpper())->Grow( LONG_MAX, true ) ); + return ( GetUpper() && const_cast<SwFrm*>(static_cast<SwFrm const *>(GetUpper()))->Grow( LONG_MAX, true ) ); } SwTwips SwSectionFrm::_Grow( SwTwips nDist, bool bTst ) @@ -2124,7 +2124,7 @@ bool SwSectionFrm::MoveAllowed( const SwFrm* pFrm) const if( IsInTab() || ( !IsInDocBody() && FindFooterOrHeader() ) ) return false; // It doesn't work in tables/headers/footers if( IsInFly() ) // In column based or chained frames - return 0 != ((SwFrm*)GetUpper())->GetNextLeaf( MAKEPAGE_NONE ); + return 0 != const_cast<SwFrm*>(static_cast<SwFrm const *>(GetUpper()))->GetNextLeaf( MAKEPAGE_NONE ); return true; } diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index c2f63c184c95..6b2202f70666 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -2098,7 +2098,7 @@ void SwTabFrm::MakeAll() } if ( nOld != (Frm().*fnRect->fnGetHeight)() ) - lcl_RecalcTable( *this, (SwLayoutFrm*)pRow, aNotify ); + lcl_RecalcTable( *this, static_cast<SwLayoutFrm*>(pRow), aNotify ); continue; } @@ -2394,7 +2394,7 @@ void SwTabFrm::MakeAll() if ( !GetFollow()->GetFollow() ) { - SwFrm* pNxt = ((SwFrm*)GetFollow())->FindNext(); + SwFrm* pNxt = static_cast<SwFrm*>(GetFollow())->FindNext(); if ( pNxt ) { // #i18103# - no formatting of found next diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index 73ca1dd29ed8..537a0f11e059 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -1450,9 +1450,9 @@ SwTwips SwFrm::AdjustNeighbourhood( SwTwips nDiff, bool bTst ) { const bool bFootnotePage = pBoss->IsPageFrm() && static_cast<const SwPageFrm*>(pBoss)->IsFootnotePage(); if ( bFootnotePage && !IsFootnoteContFrm() ) - pFrm = (SwFrm*)pBoss->FindFootnoteCont(); + pFrm = const_cast<SwFrm*>(static_cast<SwFrm const *>(pBoss->FindFootnoteCont())); if ( !pFrm ) - pFrm = (SwFrm*)pBoss->FindBodyCont(); + pFrm = const_cast<SwFrm*>(static_cast<SwFrm const *>(pBoss->FindBodyCont())); if ( !pFrm ) return 0; diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index 3f4af08fa8ea..fdc6d6ff24ca 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -207,20 +207,20 @@ void* lcl_GetKeyFromFrame( const SwFrm& rFrm ) void* pKey = 0; if ( rFrm.IsPageFrm() ) - pKey = (void*)static_cast<const SwPageFrm&>(rFrm).GetFormat()->getIDocumentSettingAccess(); + pKey = const_cast<void*>(static_cast<void const *>((static_cast<const SwPageFrm&>(rFrm).GetFormat()->getIDocumentSettingAccess()))); else if ( rFrm.IsTextFrm() ) - pKey = (void*)static_cast<const SwTextFrm&>(rFrm).GetTextNode(); + pKey = const_cast<void*>(static_cast<void const *>(static_cast<const SwTextFrm&>(rFrm).GetTextNode())); else if ( rFrm.IsSctFrm() ) - pKey = (void*)static_cast<const SwSectionFrm&>(rFrm).GetSection(); + pKey = const_cast<void*>(static_cast<void const *>(static_cast<const SwSectionFrm&>(rFrm).GetSection())); else if ( rFrm.IsTabFrm() ) - pKey = (void*)static_cast<const SwTabFrm&>(rFrm).GetTable(); + pKey = const_cast<void*>(static_cast<void const *>(static_cast<const SwTabFrm&>(rFrm).GetTable())); else if ( rFrm.IsRowFrm() ) - pKey = (void*)static_cast<const SwRowFrm&>(rFrm).GetTabLine(); + pKey = const_cast<void*>(static_cast<void const *>(static_cast<const SwRowFrm&>(rFrm).GetTabLine())); else if ( rFrm.IsCellFrm() ) { const SwTabFrm* pTabFrm = rFrm.FindTabFrm(); const SwTable* pTable = pTabFrm->GetTable(); - pKey = (void*) & static_cast<const SwCellFrm&>(rFrm).GetTabBox()->FindStartOfRowSpan( *pTable ); + pKey = const_cast<void*>(static_cast<void const *>(& static_cast<const SwCellFrm&>(rFrm).GetTabBox()->FindStartOfRowSpan( *pTable ))); } return pKey; @@ -235,7 +235,7 @@ bool lcl_HasPreviousParaSameNumRule( const SwTextNode& rNode ) const SwNode* pNode = &rNode; const SwNumRule* pNumRule = rNode.GetNumRule(); - while (! (pNode == rNodes.DocumentSectionStartNode((SwNode*)&rNode) ) ) + while (! (pNode == rNodes.DocumentSectionStartNode(const_cast<SwNode*>(static_cast<SwNode const *>(&rNode))) ) ) { --aIdx; diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx index 51abdd35146f..86d173fd1d4f 100644 --- a/sw/source/core/text/frmcrsr.cxx +++ b/sw/source/core/text/frmcrsr.cxx @@ -192,7 +192,7 @@ bool SwTextFrm::GetCharRect( SwRect& rOrig, const SwPosition &rPos, SwTextFrm *pFrm = GetAdjFrmAtPos( const_cast<SwTextFrm*>(this), rPos, bRightMargin, bNoScroll ); pFrm->GetFormatted(); - const SwFrm* pTmpFrm = (SwFrm*)pFrm->GetUpper(); + const SwFrm* pTmpFrm = static_cast<SwFrm*>(pFrm->GetUpper()); SWRECTFN ( pFrm ) const SwTwips nUpperMaxY = (pTmpFrm->*fnRect->fnGetPrtBottom)(); @@ -362,7 +362,7 @@ bool SwTextFrm::GetAutoPos( SwRect& rOrig, const SwPosition &rPos ) const SwTextFrm* pFrm = &(const_cast<SwTextFrm*>(this)->GetFrmAtOfst( nOffset )); pFrm->GetFormatted(); - const SwFrm* pTmpFrm = (SwFrm*)pFrm->GetUpper(); + const SwFrm* pTmpFrm = static_cast<SwFrm*>(pFrm->GetUpper()); SWRECTFN( pTmpFrm ) SwTwips nUpperMaxY = (pTmpFrm->*fnRect->fnGetPrtBottom)(); diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index 3e6467424851..5ecb0b3f4bae 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -143,7 +143,7 @@ sal_uInt16 SwTextFormatter::GetFrmRstHeight() const // GetFrmRstHeight() is being called with Footnote. // Wrong: const SwFrm *pUpper = pFrm->GetUpper(); - const SwFrm *pPage = (const SwFrm*)pFrm->FindPageFrm(); + const SwFrm *pPage = static_cast<const SwFrm*>(pFrm->FindPageFrm()); const SwTwips nHeight = pPage->Frm().Top() + pPage->Prt().Top() + pPage->Prt().Height() - Y(); @@ -279,7 +279,7 @@ SwLinePortion *SwTextFormatter::Underflow( SwTextFormatInfo &rInf ) if( pPor->InTextGrp() && !pPor->InExpGrp() ) { const sal_uInt16 nOldWhich = pCurr->GetWhichPor(); - *(SwLinePortion*)pCurr = *pPor; + *static_cast<SwLinePortion*>(pCurr) = *pPor; pCurr->SetPortion( pPor->GetPortion() ); pCurr->SetWhichPor( nOldWhich ); pPor->SetPortion( 0 ); @@ -1031,7 +1031,7 @@ SwLinePortion *SwTextFormatter::WhichFirstPortion(SwTextFormatInfo &rInf) if( !rInf.IsErgoDone() ) { if( pFrm->IsInFootnote() && !pFrm->GetIndPrev() ) - pPor = (SwLinePortion*)NewErgoSumPortion( rInf ); + pPor = static_cast<SwLinePortion*>(NewErgoSumPortion( rInf )); rInf.SetErgoDone( true ); } @@ -1076,7 +1076,7 @@ SwLinePortion *SwTextFormatter::WhichFirstPortion(SwTextFormatInfo &rInf) const bool bFootnoteNum = pFrm->IsFootnoteNumFrm(); rInf.GetParaPortion()->SetFootnoteNum( bFootnoteNum ); if( bFootnoteNum ) - pPor = (SwLinePortion*)NewFootnoteNumPortion( rInf ); + pPor = static_cast<SwLinePortion*>(NewFootnoteNumPortion( rInf )); rInf.SetFootnoteDone( true ); } @@ -1085,7 +1085,7 @@ SwLinePortion *SwTextFormatter::WhichFirstPortion(SwTextFormatInfo &rInf) if( !rInf.IsErgoDone() && !pPor && ! rInf.IsMulti() ) { if( pFrm->IsInFootnote() && !pFrm->GetIndPrev() ) - pPor = (SwLinePortion*)NewErgoSumPortion( rInf ); + pPor = static_cast<SwLinePortion*>(NewErgoSumPortion( rInf )); rInf.SetErgoDone( true ); } @@ -1097,12 +1097,12 @@ SwLinePortion *SwTextFormatter::WhichFirstPortion(SwTextFormatInfo &rInf) // If we're in the follow, then of course not if( GetTextFrm()->GetTextNode()->GetNumRule() ) - pPor = (SwLinePortion*)NewNumberPortion( rInf ); + pPor = static_cast<SwLinePortion*>(NewNumberPortion( rInf )); rInf.SetNumDone( true ); } // 8. The DropCaps if( !pPor && GetDropFormat() && ! rInf.IsMulti() ) - pPor = (SwLinePortion*)NewDropPortion( rInf ); + pPor = static_cast<SwLinePortion*>(NewDropPortion( rInf )); // 9. Kerning portions at beginning of line in grid mode if ( !pPor && !pCurr->GetPortion() ) @@ -2476,7 +2476,7 @@ SwFlyCntPortion *SwTextFormatter::NewFlyCntPortion( SwTextFormatInfo &rInf, SwTextAttr *pHint ) const { SwFlyCntPortion *pRet = 0; - const SwFrm *pFrame = (SwFrm*)pFrm; + const SwFrm *pFrame = static_cast<SwFrm*>(pFrm); SwFlyInCntFrm *pFly; SwFrameFormat* pFrameFormat = static_cast<SwTextFlyCnt*>(pHint)->GetFlyCnt().GetFrameFormat(); diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx index a13c1501777b..dacc158f7a7d 100644 --- a/sw/source/core/text/porfld.cxx +++ b/sw/source/core/text/porfld.cxx @@ -656,7 +656,7 @@ void SwNumberPortion::Paint( const SwTextPaintInfo &rInf ) const // follow field portions if ( ! IsFollow() ) { - SwLinePortion *pThis = (SwLinePortion*)this; + SwLinePortion *pThis = const_cast<SwLinePortion*>(static_cast<SwLinePortion const *>(this)); pThis->Width( nSumWidth ); rInf.DrawViewOpt( *this, POR_NUMBER ); pThis->Width( nOldWidth ); @@ -682,7 +682,7 @@ void SwNumberPortion::Paint( const SwTextPaintInfo &rInf ) const else { // logical const: reset width - SwLinePortion *pThis = (SwLinePortion*)this; + SwLinePortion *pThis = const_cast<SwLinePortion*>(static_cast<SwLinePortion const *>(this)); bPaintSpace = bPaintSpace && nFixWidth < nOldWidth; sal_uInt16 nSpaceOffs = nFixWidth; pThis->Width( nFixWidth ); diff --git a/sw/source/core/text/porlin.hxx b/sw/source/core/text/porlin.hxx index 792c9ef3b63e..d6efaabb72dc 100644 --- a/sw/source/core/text/porlin.hxx +++ b/sw/source/core/text/porlin.hxx @@ -190,7 +190,7 @@ public: inline SwLinePortion &SwLinePortion::operator=(const SwLinePortion &rPortion) { - *(SwPosSize*)this = rPortion; + *static_cast<SwPosSize*>(this) = rPortion; nLineLength = rPortion.nLineLength; nAscent = rPortion.nAscent; nWhichPor = rPortion.nWhichPor; diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx index aadea9a52914..5e78961844a9 100644 --- a/sw/source/core/text/porrst.cxx +++ b/sw/source/core/text/porrst.cxx @@ -210,7 +210,7 @@ SwTwips SwTextFrm::EmptyHeight() const if ( pSh->IsA( TYPE(SwCrsrShell) ) ) { SwCrsrShell *pCrSh = static_cast<SwCrsrShell*>(pSh); SwContentFrm *pCurrFrm=pCrSh->GetCurrFrm(); - if (pCurrFrm==(SwContentFrm*)this) { + if (pCurrFrm==static_cast<SwContentFrm const *>(this)) { // do nothing } else { return 1; diff --git a/sw/source/core/text/txtcache.cxx b/sw/source/core/text/txtcache.cxx index 00a7d4549024..389cb67ef918 100644 --- a/sw/source/core/text/txtcache.cxx +++ b/sw/source/core/text/txtcache.cxx @@ -22,7 +22,7 @@ #include "porlay.hxx" SwTextLine::SwTextLine( SwTextFrm *pFrm, SwParaPortion *pNew ) : - SwCacheObj( (void*)pFrm ), + SwCacheObj( static_cast<void*>(pFrm) ), pLine( pNew ) { } diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx index 002af6921abb..8b585516db6e 100644 --- a/sw/source/core/text/txtfly.cxx +++ b/sw/source/core/text/txtfly.cxx @@ -454,7 +454,7 @@ const SwContentFrm* SwTextFly::_GetMaster() { pMaster = pCurrFrm; while( pMaster && pMaster->IsFollow() ) - pMaster = (SwContentFrm*)pMaster->FindMaster(); + pMaster = static_cast<SwContentFrm*>(pMaster->FindMaster()); return pMaster; } diff --git a/sw/source/core/text/widorp.cxx b/sw/source/core/text/widorp.cxx index d954926c9435..3ff2662ea7cd 100644 --- a/sw/source/core/text/widorp.cxx +++ b/sw/source/core/text/widorp.cxx @@ -466,7 +466,7 @@ bool WidowsAndOrphans::FindWidows( SwTextFrm *pFrame, SwTextMargin &rLine ) return false; } - pMaster->Prepare( PREP_WIDOWS, (void*)&nNeed ); + pMaster->Prepare( PREP_WIDOWS, static_cast<void*>(&nNeed) ); return true; } diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx index 3ba10e149c04..0b6a85269217 100644 --- a/sw/source/core/tox/tox.cxx +++ b/sw/source/core/tox/tox.cxx @@ -428,7 +428,7 @@ OUString SwForm::GetFormAuth() {return OUString("<A>");} SwTOXBase::SwTOXBase(const SwTOXType* pTyp, const SwForm& rForm, sal_uInt16 nCreaType, const OUString& rTitle ) - : SwClient((SwModify*)pTyp) + : SwClient(const_cast<SwModify*>(static_cast<SwModify const *>(pTyp))) , aForm(rForm) , aTitle(rTitle) , eLanguage((LanguageType)::GetAppLanguage()) diff --git a/sw/source/core/txtnode/atrflyin.cxx b/sw/source/core/txtnode/atrflyin.cxx index bca151d1dd74..ee67fa2bfa06 100644 --- a/sw/source/core/txtnode/atrflyin.cxx +++ b/sw/source/core/txtnode/atrflyin.cxx @@ -153,7 +153,7 @@ void SwTextFlyCnt::SetAnchor( const SwTextNode *pNode ) if( !aAnchor.GetContentAnchor() || !aAnchor.GetContentAnchor()->nNode.GetNode().GetNodes().IsDocNodes() || - &aAnchor.GetContentAnchor()->nNode.GetNode() != (SwNode*)pNode ) + &aAnchor.GetContentAnchor()->nNode.GetNode() != static_cast<SwNode const *>(pNode) ) aPos.nNode = *pNode; else aPos.nNode = aAnchor.GetContentAnchor()->nNode; diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index 277a4d5cc6c5..54c8ab238420 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -2400,7 +2400,7 @@ lcl_CollectHintSpans(const SwpHints& i_rHints, const sal_Int32 nLength, { // insert dummy span covering the gap o_rSpanMap.insert(AttrSpanMap_t::value_type( - AttrSpan_t(nLastEnd, aSpan.first), (const SwTextAttr *)0)); + AttrSpan_t(nLastEnd, aSpan.first), nullptr)); } nLastEnd = aSpan.second; @@ -2411,7 +2411,7 @@ lcl_CollectHintSpans(const SwpHints& i_rHints, const sal_Int32 nLength, if (nLastEnd != nLength && nLength != 0) { o_rSpanMap.insert( - AttrSpanMap_t::value_type(AttrSpan_t(nLastEnd, nLength), (const SwTextAttr *)0)); + AttrSpanMap_t::value_type(AttrSpan_t(nLastEnd, nLength), nullptr)); } } diff --git a/sw/source/core/undo/undobj1.cxx b/sw/source/core/undo/undobj1.cxx index 6260382cc1e5..933df1518edc 100644 --- a/sw/source/core/undo/undobj1.cxx +++ b/sw/source/core/undo/undobj1.cxx @@ -168,7 +168,7 @@ void SwUndoFlyBase::DelFly( SwDoc* pDoc ) OSL_ENSURE( rContent.GetContentIdx(), "Fly ohne Inhalt" ); SaveSection( *rContent.GetContentIdx() ); - const_cast<SwFormatContent&>(rContent).SetNewContentIdx( (const SwNodeIndex*)0 ); + const_cast<SwFormatContent&>(rContent).SetNewContentIdx( nullptr ); } // OD 02.07.2003 #108784# - remove 'master' drawing object from drawing page else if ( RES_DRAWFRMFMT == pFrameFormat->Which() ) diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index 21281a4fe268..f4e21ef873bc 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -305,7 +305,7 @@ void SwUndoInsTable::RedoImpl(::sw::UndoRedoContext & rContext) const SwTable* pTable = rDoc.InsertTable( aInsTableOpts, aPos, nRows, nCols, nAdjust, pAutoFormat, pColWidth ); - ((SwFrameFormat*)pTable->GetFrameFormat())->SetName( sTableNm ); + static_cast<SwFrameFormat*>(pTable->GetFrameFormat())->SetName( sTableNm ); SwTableNode* pTableNode = rDoc.GetNodes()[nSttNode]->GetTableNode(); if( pDDEFieldType ) @@ -793,7 +793,7 @@ void SwUndoTextToTable::RedoImpl(::sw::UndoRedoContext & rContext) SwTable const*const pTable = rContext.GetDoc().TextToTable( aInsTableOpts, rPam, cTrenner, nAdjust, pAutoFormat ); - ((SwFrameFormat*)pTable->GetFrameFormat())->SetName( sTableNm ); + static_cast<SwFrameFormat*>(pTable->GetFrameFormat())->SetName( sTableNm ); } void SwUndoTextToTable::RepeatImpl(::sw::RepeatContext & rContext) diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx index 8f805e537162..18606735ebf7 100644 --- a/sw/source/core/unocore/unocoll.cxx +++ b/sw/source/core/unocore/unocoll.cxx @@ -568,7 +568,7 @@ SwXServiceProvider::MakeInstance(sal_uInt16 nObjectType, SwDoc & rDoc) { SwVbaObjectForCodeNameProvider* pObjProv = new SwVbaObjectForCodeNameProvider(rDoc.GetDocShell()); - xRet = (cppu::OWeakObject*)pObjProv; + xRet = static_cast<cppu::OWeakObject*>(pObjProv); } #endif break; @@ -578,7 +578,7 @@ SwXServiceProvider::MakeInstance(sal_uInt16 nObjectType, SwDoc & rDoc) if (rDoc.GetDocShell() && ooo::vba::isAlienWordDoc(*rDoc.GetDocShell())) { SwVbaCodeNameProvider* pObjProv = new SwVbaCodeNameProvider(rDoc.GetDocShell()); - xRet = (cppu::OWeakObject*)pObjProv; + xRet = static_cast<cppu::OWeakObject*>(pObjProv); } } #endif @@ -702,7 +702,7 @@ SwXServiceProvider::MakeInstance(sal_uInt16 nObjectType, SwDoc & rDoc) : (eFamily == SFX_STYLE_FAMILY_FRAME) ? new SwXFrameStyle(&rDoc) : new SwXStyle(&rDoc, eFamily, nObjectType == SW_SERVICE_STYLE_CONDITIONAL_PARAGRAPH_STYLE); - xRet = (cppu::OWeakObject*)pNewStyle; + xRet = static_cast<cppu::OWeakObject*>(pNewStyle); } break; case SW_SERVICE_FIELDTYPE_DATETIME: @@ -794,13 +794,13 @@ SwXServiceProvider::MakeInstance(sal_uInt16 nObjectType, SwDoc & rDoc) xRet = SwXParagraph::CreateXParagraph(rDoc, 0); break; case SW_SERVICE_NUMBERING_RULES : - xRet = (cppu::OWeakObject*)new SwXNumberingRules(rDoc); + xRet = static_cast<cppu::OWeakObject*>(new SwXNumberingRules(rDoc)); break; case SW_SERVICE_TEXT_COLUMNS : - xRet = (cppu::OWeakObject*)new SwXTextColumns(0); + xRet = static_cast<cppu::OWeakObject*>(new SwXTextColumns(0)); break; case SW_SERVICE_DEFAULTS: - xRet = (cppu::OWeakObject*)new SwXTextDefaults(&rDoc); + xRet = static_cast<cppu::OWeakObject*>(new SwXTextDefaults(&rDoc)); break; case SW_SERVICE_IMAP_RECTANGLE : xRet = SvUnoImageMapRectangleObject_createInstance( sw_GetSupportedMacroItems() ); @@ -817,7 +817,7 @@ SwXServiceProvider::MakeInstance(sal_uInt16 nObjectType, SwDoc & rDoc) // This should not happen during copy/paste, as this will unlink // charts using table data. if (rDoc.GetDocShell()->GetCreateMode() != SfxObjectCreateMode::EMBEDDED) - xRet = (cppu::OWeakObject*) rDoc.getIDocumentChartDataProviderAccess().GetChartDataProvider( true /* create - if not yet available */ ); + xRet = static_cast<cppu::OWeakObject*>(rDoc.getIDocumentChartDataProviderAccess().GetChartDataProvider( true /* create - if not yet available */ )); else SAL_WARN("sw.uno", "not creating chart data provider for embedded object"); diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index e0e668b8c3a3..de3afb5f6661 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -538,7 +538,7 @@ bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry if( pAny ) { const SwTableNode* pTableNode = pSttNode->FindTableNode(); - SwFrameFormat* pTableFormat = (SwFrameFormat*)pTableNode->GetTable().GetFrameFormat(); + SwFrameFormat* pTableFormat = static_cast<SwFrameFormat*>(pTableNode->GetTable().GetFrameFormat()); //SwTable& rTable = static_cast<SwTableNode*>(pSttNode)->GetTable(); if(FN_UNO_TEXT_TABLE == rEntry.nWID) { diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index 42a8013ee4c5..d1b01a48f8cd 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -286,7 +286,7 @@ uno::Reference< uno::XInterface > SwFmDrawPage::GetInterface( SdrObject* pObj SwXShape* pxShape = SwIterator<SwXShape,SwFormat>( *pFormat ).First(); if(pxShape) { - xShape = *(cppu::OWeakObject*)pxShape; + xShape = *static_cast<cppu::OWeakObject*>(pxShape); } else xShape = pObj->getUnoShape(); @@ -861,7 +861,7 @@ SwFmDrawPage* SwXDrawPage::GetSvxPage() xPageAgg = *static_cast<uno::Reference< uno::XAggregation > const *>(aAgg.getValue()); } if( xPageAgg.is() ) - xPageAgg->setDelegator( (cppu::OWeakObject*)this ); + xPageAgg->setDelegator( static_cast<cppu::OWeakObject*>(this) ); } return pDrawPage; } @@ -949,7 +949,7 @@ SwXShape::SwXShape(uno::Reference< uno::XInterface > & xShape) : xShape = 0; m_refCount++; if( xShapeAgg.is() ) - xShapeAgg->setDelegator( (cppu::OWeakObject*)this ); + xShapeAgg->setDelegator( static_cast<cppu::OWeakObject*>(this) ); m_refCount--; uno::Reference< lang::XUnoTunnel > xShapeTunnel(xShapeAgg, uno::UNO_QUERY); @@ -2139,7 +2139,7 @@ void SwXShape::attach(const uno::Reference< text::XTextRange > & xTextRange) uno::Any aPos; aPos <<= xTextRange; setPropertyValue("TextRange", aPos); - uno::Reference< drawing::XShape > xTemp( (cppu::OWeakObject*) this, uno::UNO_QUERY ); + uno::Reference< drawing::XShape > xTemp( static_cast<cppu::OWeakObject*>(this), uno::UNO_QUERY ); xDP->add( xTemp ); } } diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index 4d175fb843db..6d048c959410 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -2648,7 +2648,7 @@ void SwXTextField::Impl::Modify( { case RES_REMOVE_UNO_OBJECT: case RES_OBJECTDYING: - if( (void*)GetRegisteredIn() == static_cast<const SwPtrMsgPoolItem *>(pOld)->pObject ) + if( static_cast<void*>(GetRegisteredIn()) == static_cast<const SwPtrMsgPoolItem *>(pOld)->pObject ) Invalidate(); break; diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx index 89e716ceac83..bd09158a7301 100644 --- a/sw/source/core/unocore/unoobj2.cxx +++ b/sw/source/core/unocore/unoobj2.cxx @@ -290,7 +290,7 @@ void ClientModify(SwClient* pClient, const SfxPoolItem *pOld, const SfxPoolItem { case RES_REMOVE_UNO_OBJECT: case RES_OBJECTDYING: - if( (void*)pClient->GetRegisteredIn() == static_cast<const SwPtrMsgPoolItem *>(pOld)->pObject ) + if( static_cast<void*>(pClient->GetRegisteredIn()) == static_cast<const SwPtrMsgPoolItem *>(pOld)->pObject ) pClient->GetRegisteredIn()->Remove(pClient); break; diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index 8b578ff2369b..0417bbe3a093 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -1281,7 +1281,7 @@ static void lcl_CreatePortions( lcl_FillAnnotationStartArray( *pDoc, *pUnoCrsr, AnnotationStarts ); PortionStack_t PortionStack; - PortionStack.push( PortionList_t(&i_rPortions, (const SwTextAttr *)0) ); + PortionStack.push( PortionList_t(&i_rPortions, nullptr) ); std::set<const SwFrameFormat*> aTextBoxes = SwTextBoxHelper::findTextBoxes(pUnoCrsr->GetNode()); diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 4662759f9f56..3bcbdce084bf 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -3061,7 +3061,7 @@ sal_uInt16 SwXTextTable::getColumnCount() void SwXTextTable::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) { if(pOld && pOld->Which() == RES_REMOVE_UNO_OBJECT && - (void*)GetRegisteredIn() == static_cast<const SwPtrMsgPoolItem *>(pOld)->pObject ) + static_cast<void*>(GetRegisteredIn()) == static_cast<const SwPtrMsgPoolItem *>(pOld)->pObject ) GetRegisteredIn()->Remove(this); else ClientModify(this, pOld, pNew); @@ -3946,7 +3946,7 @@ uno::Any SwXTableRows::getByIndex(sal_Int32 nIndex) pFrameFormat->CallSwClientNotify(aHint); if(!aHint.m_pResult) aHint.m_pResult = new SwXTextTableRow(pFrameFormat, pLine); - uno::Reference<beans::XPropertySet> xRet = (beans::XPropertySet*)aHint.m_pResult; + uno::Reference<beans::XPropertySet> xRet = static_cast<beans::XPropertySet*>(aHint.m_pResult); return uno::makeAny(xRet); } diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx index 1c436df90235..81333b442ad2 100644 --- a/sw/source/core/view/vnew.cxx +++ b/sw/source/core/view/vnew.cxx @@ -155,8 +155,8 @@ SwViewShell::SwViewShell( SwDoc& rDocument, vcl::Window *pWindow, mpImp( new SwViewShellImp( this ) ), mpWin( pWindow ), mpOut( pOutput ? pOutput - : pWindow ? (OutputDevice*)pWindow - : (OutputDevice*)rDocument.getIDocumentDeviceAccess().getPrinter( true )), + : pWindow ? static_cast<OutputDevice*>(pWindow) + : static_cast<OutputDevice*>(rDocument.getIDocumentDeviceAccess().getPrinter( true ))), mpTmpRef( 0 ), mpOpt( 0 ), mpAccOptions( new SwAccessibilityOptions ), @@ -231,8 +231,8 @@ SwViewShell::SwViewShell( SwViewShell& rShell, vcl::Window *pWindow, mpImp( new SwViewShellImp( this ) ), mpWin( pWindow ), mpOut( pOutput ? pOutput - : pWindow ? (OutputDevice*)pWindow - : (OutputDevice*)rShell.GetDoc()->getIDocumentDeviceAccess().getPrinter( true )), + : pWindow ? static_cast<OutputDevice*>(pWindow) + : static_cast<OutputDevice*>(rShell.GetDoc()->getIDocumentDeviceAccess().getPrinter( true ))), mpTmpRef( 0 ), mpOpt( 0 ), mpAccOptions( new SwAccessibilityOptions ), |