diff options
author | Noel Grandin <noel@peralex.com> | 2014-11-19 09:31:53 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-11-19 13:19:37 +0200 |
commit | 0ad264911b9217a3241f6c0e1769b22e8bd76e48 (patch) | |
tree | b7558164e560a2bd34a35d4faef8a7db199d21eb /sw | |
parent | eb41a2ba205c6ac88e959f39bf0c45d2ee674150 (diff) |
loplugin: cstylecast
Change-Id: If25e3b030d484f03078bfba265bed82b315e2742
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/frmedt/fecopy.cxx | 22 | ||||
-rw-r--r-- | sw/source/core/frmedt/fedesc.cxx | 22 | ||||
-rw-r--r-- | sw/source/core/frmedt/fefly1.cxx | 88 | ||||
-rw-r--r-- | sw/source/core/frmedt/feflyole.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/frmedt/feshview.cxx | 104 | ||||
-rw-r--r-- | sw/source/core/frmedt/fetab.cxx | 52 | ||||
-rw-r--r-- | sw/source/core/frmedt/fews.cxx | 36 | ||||
-rw-r--r-- | sw/source/core/frmedt/tblsel.cxx | 120 | ||||
-rw-r--r-- | sw/source/core/graphic/grfatr.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/graphic/ndgrf.cxx | 24 | ||||
-rw-r--r-- | sw/source/core/layout/atrfrm.cxx | 112 | ||||
-rw-r--r-- | sw/source/core/layout/calcmove.cxx | 110 | ||||
-rw-r--r-- | sw/source/core/layout/colfrm.cxx | 36 | ||||
-rw-r--r-- | sw/source/core/layout/dbg_lay.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/layout/findfrm.cxx | 152 | ||||
-rw-r--r-- | sw/source/core/layout/flowfrm.cxx | 98 | ||||
-rw-r--r-- | sw/source/core/layout/fly.cxx | 94 |
17 files changed, 543 insertions, 543 deletions
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index 4f10aebca39f..4d059483f08b 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -104,7 +104,7 @@ bool SwFEShell::Copy( SwDoc* pClpDoc, const OUString* pNewClpTxt ) // also delete surrounding FlyFrames if any for( sal_uInt16 n = 0; n < pClpDoc->GetSpzFrmFmts()->size(); ++n ) { - SwFlyFrmFmt* pFly = (SwFlyFrmFmt*)(*pClpDoc->GetSpzFrmFmts())[n]; + SwFlyFrmFmt* pFly = static_cast<SwFlyFrmFmt*>((*pClpDoc->GetSpzFrmFmts())[n]); pClpDoc->getIDocumentLayoutAccess().DelLayoutFmt( pFly ); } pClpDoc->GetDocumentFieldsManager().GCFieldTypes(); // delete the FieldTypes @@ -199,7 +199,7 @@ bool SwFEShell::Copy( SwDoc* pClpDoc, const OUString* pNewClpTxt ) } else { - SwDrawContact *pContact = (SwDrawContact*)GetUserCall( pObj ); + SwDrawContact *pContact = static_cast<SwDrawContact*>(GetUserCall( pObj )); SwFrmFmt *pFmt = pContact->GetFmt(); SwFmtAnchor aAnchor( pFmt->GetAnchor() ); if ((FLY_AT_PARA == aAnchor.GetAnchorId()) || @@ -232,7 +232,7 @@ static const Point &lcl_FindBasePos( const SwFrm *pFrm, const Point &rPt ) while ( pF && !pF->Frm().IsInside( rPt ) ) { if ( pF->IsCntntFrm() ) - pF = ((SwCntntFrm*)pF)->GetFollow(); + pF = static_cast<const SwCntntFrm*>(pF)->GetFollow(); else pF = 0; } @@ -301,7 +301,7 @@ bool SwFEShell::CopyDrawSel( SwFEShell* pDestShell, const Point& rSttPt, { SdrObject *pObj = aMrkList.GetMark( i )->GetMarkedSdrObj(); - SwDrawContact *pContact = (SwDrawContact*)GetUserCall( pObj ); + SwDrawContact *pContact = static_cast<SwDrawContact*>(GetUserCall( pObj )); SwFrmFmt *pFmt = pContact->GetFmt(); const SwFmtAnchor& rAnchor = pFmt->GetAnchor(); @@ -549,7 +549,7 @@ bool SwFEShell::Copy( SwFEShell* pDestShell, const Point& rSttPt, // only select if it can be shifted/copied in the same shell if( bSelectInsert ) { - SwFlyFrm* pFlyFrm = ((SwFlyFrmFmt*)pFlyFmt)->GetFrm( &aPt, false ); + SwFlyFrm* pFlyFrm = static_cast<SwFlyFrmFmt*>(pFlyFmt)->GetFrm( &aPt, false ); if( pFlyFrm ) { //JP 12.05.98: should this be in SelectFlyFrm??? @@ -976,7 +976,7 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, bool bIncludingPageFrames ) if( RES_FLYFRMFMT == pNew->Which() ) { const Point aPt( GetCrsrDocPos() ); - SwFlyFrm* pFlyFrm = ((SwFlyFrmFmt*)pNew)-> + SwFlyFrm* pFlyFrm = static_cast<SwFlyFrmFmt*>(pNew)-> GetFrm( &aPt, false ); if( pFlyFrm ) SelectFlyFrm( *pFlyFrm, true ); @@ -1371,7 +1371,7 @@ void SwFEShell::Paste( SvStream& rStrm, sal_uInt16 nAction, const Point* pPt ) pFmt = FindFrmFmt( pOldObj ); Point aNullPt; - SwFlyFrm* pFlyFrm = ((SwFlyFrmFmt*)pFmt)->GetFrm( &aNullPt ); + SwFlyFrm* pFlyFrm = static_cast<const SwFlyFrmFmt*>(pFmt)->GetFrm( &aNullPt ); pAnchor = pFlyFrm ? pFlyFrm->GetAnchorFrm() : NULL; if (!pAnchor || pAnchor->FindFooterOrHeader()) @@ -1411,9 +1411,9 @@ void SwFEShell::Paste( SvStream& rStrm, sal_uInt16 nAction, const Point* pPt ) aFrmSet.Set( pFmt->GetAttrSet() ); Point aNullPt; - if( pAnchor->IsTxtFrm() && ((SwTxtFrm*)pAnchor)->IsFollow() ) + if( pAnchor->IsTxtFrm() && static_cast<const SwTxtFrm*>(pAnchor)->IsFollow() ) { - const SwTxtFrm* pTmp = (SwTxtFrm*)pAnchor; + const SwTxtFrm* pTmp = static_cast<const SwTxtFrm*>(pAnchor); do { pTmp = pTmp->FindMaster(); OSL_ENSURE( pTmp, "Where's my Master?" ); @@ -1421,7 +1421,7 @@ void SwFEShell::Paste( SvStream& rStrm, sal_uInt16 nAction, const Point* pPt ) pAnchor = pTmp; } if( pOldObj->ISA( SdrCaptionObj )) - aNullPt = ((SdrCaptionObj*)pOldObj)->GetTailPos(); + aNullPt = static_cast<SdrCaptionObj*>(pOldObj)->GetTailPos(); else aNullPt = aOldObjRect.TopLeft(); @@ -1564,7 +1564,7 @@ bool SwFEShell::Paste(const Graphic &rGrf, const OUString& rURL) if(dynamic_cast< SdrGrafObj* >(pObj)) { - SdrGrafObj* pNewGrafObj = (SdrGrafObj*)pObj->Clone(); + SdrGrafObj* pNewGrafObj = static_cast<SdrGrafObj*>(pObj->Clone()); pNewGrafObj->SetGraphic(rGrf); diff --git a/sw/source/core/frmedt/fedesc.cxx b/sw/source/core/frmedt/fedesc.cxx index 2240feb6042c..353d5b4392e3 100644 --- a/sw/source/core/frmedt/fedesc.cxx +++ b/sw/source/core/frmedt/fedesc.cxx @@ -74,15 +74,15 @@ void SwFEShell::ChgCurPageDesc( const SwPageDesc& rDesc ) break; } } - pPage = (SwPageFrm*) pPage->GetPrev(); + pPage = static_cast<SwPageFrm*>( pPage->GetPrev() ); } if ( !pPage ) { - pPage = (SwPageFrm*) (GetLayout()->Lower()); + pPage = static_cast<SwPageFrm*>(GetLayout()->Lower()); pFlow = pPage->FindFirstBodyCntnt(); if ( !pFlow ) { - pPage = (SwPageFrm*)pPage->GetNext(); + pPage = static_cast<SwPageFrm*>(pPage->GetNext()); pFlow = pPage->FindFirstBodyCntnt(); OSL_ENSURE( pFlow, "Dokuemnt ohne Inhalt?!?" ); } @@ -96,7 +96,7 @@ void SwFEShell::ChgCurPageDesc( const SwPageDesc& rDesc ) GetDoc()->SetAttr( aNew, *(SwFmt*)pFlow->FindTabFrm()->GetFmt() ); else { - SwPaM aPaM( *((SwCntntFrm*)pFlow)->GetNode() ); + SwPaM aPaM( *static_cast<const SwCntntFrm*>(pFlow)->GetNode() ); GetDoc()->getIDocumentContentOperations().InsertPoolItem( aPaM, aNew, 0 ); } EndAllActionAndCall(); @@ -185,7 +185,7 @@ const SwPageDesc* SwFEShell::GetSelectedPageDescs() const { const SwCntntNode* pCNd; const SwFrm* pMkFrm, *pPtFrm; - const SwPageDesc* pFnd, *pRetDesc = (SwPageDesc*)0xffffffff; + const SwPageDesc* pFnd, *pRetDesc = reinterpret_cast<SwPageDesc*>(0xffffffff); const Point aNulPt; FOREACHPAM_START(GetCrsr()) @@ -206,27 +206,27 @@ const SwPageDesc* SwFEShell::GetSelectedPageDescs() const if( !pMkFrm || !pPtFrm ) pFnd = 0; else if( pMkFrm == pPtFrm ) - pFnd = ((SwPageFrm*)pMkFrm)->GetPageDesc(); + pFnd = static_cast<const SwPageFrm*>(pMkFrm)->GetPageDesc(); else { // swap pointer if PtFrm before MkFrm - if( ((SwPageFrm*)pMkFrm)->GetPhyPageNum() > - ((SwPageFrm*)pPtFrm)->GetPhyPageNum() ) + if( static_cast<const SwPageFrm*>(pMkFrm)->GetPhyPageNum() > + static_cast<const SwPageFrm*>(pPtFrm)->GetPhyPageNum() ) { const SwFrm* pTmp = pMkFrm; pMkFrm = pPtFrm; pPtFrm = pTmp; } // now check from MkFrm to PtFrm for equal PageDescs - pFnd = ((SwPageFrm*)pMkFrm)->GetPageDesc(); + pFnd = static_cast<const SwPageFrm*>(pMkFrm)->GetPageDesc(); while( pFnd && pMkFrm != pPtFrm ) { pMkFrm = pMkFrm->GetNext(); - if( !pMkFrm || pFnd != ((SwPageFrm*)pMkFrm)->GetPageDesc() ) + if( !pMkFrm || pFnd != static_cast<const SwPageFrm*>(pMkFrm)->GetPageDesc() ) pFnd = 0; } } - if( (SwPageDesc*)0xffffffff == pRetDesc ) + if( reinterpret_cast<SwPageDesc*>(0xffffffff) == pRetDesc ) pRetDesc = pFnd; else if( pFnd != pRetDesc ) { diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index 13535e224113..a88dd95263e4 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -106,7 +106,7 @@ static bool lcl_FindAnchorPos( SfxItemSet& rSet ) { bool bRet = true; - SwFmtAnchor aNewAnch( (SwFmtAnchor&)rSet.Get( RES_ANCHOR ) ); + SwFmtAnchor aNewAnch( static_cast<const SwFmtAnchor&>(rSet.Get( RES_ANCHOR )) ); RndStdIds nNew = aNewAnch.GetAnchorId(); const SwFrm *pNewAnch; @@ -120,7 +120,7 @@ static bool lcl_FindAnchorPos( { // starting from the upper-left corner of the Fly, // search nearest CntntFrm - const SwFrm* pFrm = rFrm.IsFlyFrm() ? ((SwFlyFrm&)rFrm).GetAnchorFrm() + const SwFrm* pFrm = rFrm.IsFlyFrm() ? static_cast<const SwFlyFrm&>(rFrm).GetAnchorFrm() : &rFrm; pNewAnch = ::FindAnchor( pFrm, aTmpPnt ); if( pNewAnch->IsProtected() ) @@ -129,7 +129,7 @@ static bool lcl_FindAnchorPos( break; } - SwPosition aPos( *((SwCntntFrm*)pNewAnch)->GetNode() ); + SwPosition aPos( *static_cast<const SwCntntFrm*>(pNewAnch)->GetNode() ); if ((FLY_AT_CHAR == nNew) || (FLY_AS_CHAR == nNew)) { // textnode should be found, as only in those @@ -138,7 +138,7 @@ static bool lcl_FindAnchorPos( aTmpPnt.setX(aTmpPnt.getX() - 1); // do not land in the fly! if( !pNewAnch->GetCrsrOfst( &aPos, aTmpPnt, &aState ) ) { - SwCntntNode* pCNd = ((SwCntntFrm*)pNewAnch)->GetNode(); + SwCntntNode* pCNd = const_cast<SwCntntFrm*>(static_cast<const SwCntntFrm*>(pNewAnch))->GetNode(); if( pNewAnch->Frm().Bottom() < aTmpPnt.Y() ) pCNd->MakeStartIndex( &aPos.nContent ); else @@ -170,7 +170,7 @@ static bool lcl_FindAnchorPos( if( pNewAnch && &rFrm != pNewAnch && !pNewAnch->IsProtected() ) { - aPos.nNode = *((SwFlyFrm*)pNewAnch)->GetFmt()->GetCntnt(). + aPos.nNode = *static_cast<const SwFlyFrm*>(pNewAnch)->GetFmt()->GetCntnt(). GetCntntIdx(); aNewAnch.SetAnchor( &aPos ); break; @@ -204,7 +204,7 @@ bool sw_ChkAndSetNewAnchor( const SwFmtAnchor &rOldAnch = rFmt.GetAnchor(); const RndStdIds nOld = rOldAnch.GetAnchorId(); - RndStdIds nNew = ((SwFmtAnchor&)rSet.Get( RES_ANCHOR )).GetAnchorId(); + RndStdIds nNew = static_cast<const SwFmtAnchor&>(rSet.Get( RES_ANCHOR )).GetAnchorId(); if( nOld == nNew ) return false; @@ -267,7 +267,7 @@ SwFlyFrm *SwFEShell::FindFlyFrm() const return 0; SdrObject *pO = rMrkList.GetMark( 0 )->GetMarkedSdrObj(); - return ( pO && pO->ISA(SwVirtFlyDrawObj) ) ? ((SwVirtFlyDrawObj*)pO)->GetFlyFrm() : 0; + return ( pO && pO->ISA(SwVirtFlyDrawObj) ) ? static_cast<SwVirtFlyDrawObj*>(pO)->GetFlyFrm() : 0; } return 0; } @@ -301,11 +301,11 @@ const SwFrmFmt* SwFEShell::IsFlyInFly() if( pFmt && FLY_AT_FLY == pFmt->GetAnchor().GetAnchorId() ) { const SwFrm* pFly = pObj->ISA(SwVirtFlyDrawObj) ? - ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm()->GetAnchorFrm() : - ((SwDrawContact*)GetUserCall(pObj))->GetAnchorFrm( pObj ); + static_cast<SwVirtFlyDrawObj*>(pObj)->GetFlyFrm()->GetAnchorFrm() : + static_cast<SwDrawContact*>(GetUserCall(pObj))->GetAnchorFrm( pObj ); OSL_ENSURE( pFly, "IsFlyInFly: Where's my anchor?" ); OSL_ENSURE( pFly->IsFlyFrm(), "IsFlyInFly: Funny anchor!" ); - return ((SwFlyFrm*)pFly)->GetFmt(); + return static_cast<const SwFlyFrm*>(pFly)->GetFmt(); } Point aTmpPos = pObj->GetCurrentBoundRect().TopLeft(); @@ -346,7 +346,7 @@ void SwFEShell::SetFlyPos( const Point& rAbsPos ) // Set an anchor starting from the absolute position for paragraph bound Flys // Anchor and new RelPos will be calculated and set by the Fly if ( pFly->IsFlyAtCntFrm() ) - ((SwFlyAtCntFrm*)pFly)->SetAbsPos( rAbsPos ); + static_cast<SwFlyAtCntFrm*>(pFly)->SetAbsPos( rAbsPos ); else { const SwFrm *pAnch = pFly->GetAnchorFrm(); @@ -487,14 +487,14 @@ Point SwFEShell::FindAnchorPos( const Point& rAbsPos, bool bMoveIt ) } case FLY_AT_PAGE: { - aAnch.SetPageNum( ((const SwPageFrm*)pNewAnch)-> + aAnch.SetPageNum( static_cast<const SwPageFrm*>(pNewAnch)-> GetPhyPageNum() ); break; } case FLY_AT_FLY: { - SwPosition aPos( *((SwFlyFrm*)pNewAnch)->GetFmt()-> + SwPosition aPos( *static_cast<const SwFlyFrm*>(pNewAnch)->GetFmt()-> GetCntnt().GetCntntIdx() ); aAnch.SetAnchor( &aPos ); break; @@ -604,7 +604,7 @@ const SwFrmFmt *SwFEShell::NewFlyFrm( const SfxItemSet& rSet, bool bAnchValid, const SwPosition& rPos = *pCrsr->Start(); - SwFmtAnchor& rAnch = (SwFmtAnchor&)rSet.Get( RES_ANCHOR ); + SwFmtAnchor& rAnch = const_cast<SwFmtAnchor&>(static_cast<const SwFmtAnchor&>(rSet.Get( RES_ANCHOR ))); RndStdIds eRndId = rAnch.GetAnchorId(); switch( eRndId ) { @@ -655,17 +655,17 @@ const SwFrmFmt *SwFEShell::NewFlyFrm( const SfxItemSet& rSet, bool bAnchValid, const SfxPoolItem* pItem; if( SfxItemState::SET == rSet.GetItemState( RES_HORI_ORIENT, false, &pItem ) - && text::HoriOrientation::NONE == ((SwFmtHoriOrient*)pItem)->GetHoriOrient() ) + && text::HoriOrientation::NONE == static_cast<const SwFmtHoriOrient*>(pItem)->GetHoriOrient() ) { bHOriChgd = true; - aOldH = *((SwFmtHoriOrient*)pItem); + aOldH = *static_cast<const SwFmtHoriOrient*>(pItem); ((SfxItemSet&)rSet).Put( SwFmtHoriOrient( 0, text::HoriOrientation::LEFT ) ); } if( SfxItemState::SET == rSet.GetItemState( RES_VERT_ORIENT, false, &pItem ) - && text::VertOrientation::NONE == ((SwFmtVertOrient*)pItem)->GetVertOrient() ) + && text::VertOrientation::NONE == static_cast<const SwFmtVertOrient*>(pItem)->GetVertOrient() ) { bVOriChgd = true; - aOldV = *((SwFmtVertOrient*)pItem); + aOldV = *static_cast<const SwFmtVertOrient*>(pItem); ((SfxItemSet&)rSet).Put( SwFmtVertOrient( 0, text::VertOrientation::TOP ) ); } } @@ -684,10 +684,10 @@ const SwFrmFmt *SwFEShell::NewFlyFrm( const SfxItemSet& rSet, bool bAnchValid, pRet->DelFrms(); const SwFrm* pAnch = ::FindAnchor( GetLayout(), aPt, false ); - SwPosition aPos( *((SwCntntFrm*)pAnch)->GetNode() ); + SwPosition aPos( *static_cast<const SwCntntFrm*>(pAnch)->GetNode() ); if ( FLY_AS_CHAR == eRndId ) { - aPos.nContent.Assign( ((SwCntntFrm*)pAnch)->GetNode(), 0 ); + aPos.nContent.Assign( const_cast<SwCntntFrm*>(static_cast<const SwCntntFrm*>(pAnch))->GetNode(), 0 ); } pOldAnchor->SetAnchor( &aPos ); @@ -765,7 +765,7 @@ void SwFEShell::Insert( const OUString& rGrfName, const OUString& rFltName, if( SfxItemState::SET == pFlyAttrSet->GetItemState( RES_ANCHOR, false, &pItem ) ) { - SwFmtAnchor* pAnchor = (SwFmtAnchor*)pItem; + SwFmtAnchor* pAnchor = const_cast<SwFmtAnchor*>(static_cast<const SwFmtAnchor*>(pItem)); switch( pAnchor->GetAnchorId()) { case FLY_AT_PARA: @@ -947,7 +947,7 @@ void SwFEShell::SetPageObjsNewPage( std::vector<SwFrmFmt*>& rFillArr, int nOffse { SwContact *pCon = pFmt->FindContactObj(); if( pCon ) - ((SwDrawContact*)pCon)->DisconnectFromLayout(); + static_cast<SwDrawContact*>(pCon)->DisconnectFromLayout(); } else pFmt->DelFrms(); @@ -997,7 +997,7 @@ bool SwFEShell::GetFlyFrmAttr( SfxItemSet &rSet ) const const SfxPoolItem* pItem; if( SfxItemState::SET == rSet.GetItemState( RES_ANCHOR, false, &pItem ) ) { - SwFmtAnchor* pAnchor = (SwFmtAnchor*)pItem; + const SwFmtAnchor* pAnchor = static_cast<const SwFmtAnchor*>(pItem); RndStdIds eType = pAnchor->GetAnchorId(); if ( FLY_AT_PAGE != eType ) @@ -1078,7 +1078,7 @@ bool SwFEShell::SetDrawingAttr( SfxItemSet& rSet ) StartAllAction(); if( SfxItemState::SET == rSet.GetItemState( RES_ANCHOR, false )) { - RndStdIds nNew = ((SwFmtAnchor&)rSet.Get( RES_ANCHOR )).GetAnchorId(); + RndStdIds nNew = static_cast<const SwFmtAnchor&>(rSet.Get( RES_ANCHOR )).GetAnchorId(); if ( nNew != pFmt->GetAnchor().GetAnchorId() ) { ChgAnchor( nNew ); @@ -1149,7 +1149,7 @@ SwFrmFmt* SwFEShell::GetCurFrmFmt() const { SwFrmFmt* pRet = 0; SwLayoutFrm *pFly = FindFlyFrm(); - if( pFly && ( pRet = (SwFrmFmt*)pFly->GetFmt()->DerivedFrom() ) == + if( pFly && ( pRet = static_cast<SwFrmFmt*>(pFly->GetFmt()->DerivedFrom()) ) == GetDoc()->GetDfltFrmFmt() ) pRet = 0; return pRet; @@ -1163,7 +1163,7 @@ void SwFEShell::SetFrmFmt( SwFrmFmt *pNewFmt, bool bKeepOrient, Point* pDocPos ) const SwFrmFmt* pFmt = GetFmtFromObj( *pDocPos ); if(PTR_CAST(SwFlyFrmFmt, pFmt)) - pFly = ((SwFlyFrmFmt*)pFmt)->GetFrm(); + pFly = static_cast<const SwFlyFrmFmt*>(pFmt)->GetFrm(); } else pFly = FindFlyFrm(); @@ -1298,7 +1298,7 @@ Size SwFEShell::RequestObjectResize( const SwRect &rRect, const uno::Reference < pAnchor->IsTxtFrm() && !pAnchor->GetNext() && !pAnchor->GetPrev() && pAnchor->GetUpper()->IsFlyFrm() && - 0 != ( pTNd = ((SwTxtFrm*)pAnchor)->GetNode()->GetTxtNode()) && + 0 != ( pTNd = static_cast<const SwTxtFrm*>(pAnchor)->GetNode()->GetTxtNode()) && 0 != ( pHts = pTNd->GetpSwpHints() )) { // search for a sequence field: @@ -1307,10 +1307,10 @@ Size SwFEShell::RequestObjectResize( const SwRect &rRect, const uno::Reference < { const SfxPoolItem* pItem = &(*pHts)[ n ]->GetAttr(); if( RES_TXTATR_FIELD == pItem->Which() - && TYP_SEQFLD == ((SwFmtFld*)pItem)->GetField()->GetTypeId() ) + && TYP_SEQFLD == static_cast<const SwFmtFld*>(pItem)->GetField()->GetTypeId() ) { // sequence field found - SwFlyFrm* pChgFly = (SwFlyFrm*)pAnchor->GetUpper(); + SwFlyFrm* pChgFly = const_cast<SwFlyFrm*>(static_cast<const SwFlyFrm*>(pAnchor->GetUpper())); // calculate the changed size: // width must change, height can change Size aNewSz( aSz.Width() + pChgFly->Frm().Width() - @@ -1343,7 +1343,7 @@ Size SwFEShell::RequestObjectResize( const SwRect &rRect, const uno::Reference < // if the object changes, the contour is outside the object OSL_ENSURE( pFly->Lower()->IsNoTxtFrm(), "Request without NoTxt" ); - SwNoTxtNode *pNd = ((SwCntntFrm*)pFly->Lower())->GetNode()->GetNoTxtNode(); + SwNoTxtNode *pNd = static_cast<SwCntntFrm*>(pFly->Lower())->GetNode()->GetNoTxtNode(); OSL_ENSURE( pNd, "Request without Node" ); pNd->SetContour( 0 ); ClrContourCache(); @@ -1363,7 +1363,7 @@ Size SwFEShell::RequestObjectResize( const SwRect &rRect, const uno::Reference < // a new anchor is to be set. The anchor and the new RelPos are // calculated by the Fly and set if( pFly->IsFlyAtCntFrm() ) - ((SwFlyAtCntFrm*)pFly)->SetAbsPos( aPt ); + static_cast<SwFlyAtCntFrm*>(pFly)->SetAbsPos( aPt ); else { const SwFrmFmt *pFmt = pFly->GetFmt(); @@ -1422,7 +1422,7 @@ void SwFEShell::SetFlyName( const OUString& rName ) { SwLayoutFrm *pFly = FindFlyFrm(); if( pFly ) - GetDoc()->SetFlyName( *(SwFlyFrmFmt*)pFly->GetFmt(), rName ); + GetDoc()->SetFlyName( *static_cast<SwFlyFrmFmt*>(pFly->GetFmt()), rName ); else { OSL_ENSURE( false, "no FlyFrame selected" ); } @@ -1444,7 +1444,7 @@ const uno::Reference < embed::XEmbeddedObject > SwFEShell::GetOleRef() const SwFlyFrm * pFly = FindFlyFrm(); if (pFly && pFly->Lower() && pFly->Lower()->IsNoTxtFrm()) { - SwOLENode *pNd = ((SwNoTxtFrm*)pFly->Lower())->GetNode()->GetOLENode(); + SwOLENode *pNd = static_cast<SwNoTxtFrm*>(pFly->Lower())->GetNode()->GetOLENode(); if (pNd) xObj = pNd->GetOLEObj().GetOleRef(); } @@ -1474,7 +1474,7 @@ const SwFrmFmt* SwFEShell::IsURLGrfAtPos( const Point& rPt, OUString* pURL, if( pDView->PickObj( rPt, pDView->getHitTolLog(), pObj, pPV,SDRSEARCH_PICKMACRO ) && pObj->ISA(SwVirtFlyDrawObj) ) { - SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm(); + SwFlyFrm *pFly = static_cast<SwVirtFlyDrawObj*>(pObj)->GetFlyFrm(); const SwFmtURL &rURL = pFly->GetFmt()->GetURL(); if( !rURL.GetURL().isEmpty() || rURL.GetMap() ) { @@ -1541,10 +1541,10 @@ const Graphic *SwFEShell::GetGrfAtPos( const Point &rPt, if( pDView->PickObj( rPt, pDView->getHitTolLog(), pObj, pPV ) && pObj->ISA(SwVirtFlyDrawObj) ) { - SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm(); + SwFlyFrm *pFly = static_cast<SwVirtFlyDrawObj*>(pObj)->GetFlyFrm(); if ( pFly->Lower() && pFly->Lower()->IsNoTxtFrm() ) { - SwGrfNode *pNd = ((SwCntntFrm*)pFly->Lower())->GetNode()->GetGrfNode(); + SwGrfNode *pNd = static_cast<SwCntntFrm*>(pFly->Lower())->GetNode()->GetGrfNode(); if ( pNd ) { if ( pNd->IsGrfLink() ) @@ -1585,9 +1585,9 @@ const SwFrmFmt* SwFEShell::GetFmtFromObj( const Point& rPt, SwRect** pRectToFill { // first check it: if ( pObj->ISA(SwVirtFlyDrawObj) ) - pRet = ((SwVirtFlyDrawObj*)pObj)->GetFmt(); + pRet = static_cast<SwVirtFlyDrawObj*>(pObj)->GetFmt(); else if ( pObj->GetUserCall() ) //not for group objects - pRet = ((SwDrawContact*)pObj->GetUserCall())->GetFmt(); + pRet = static_cast<SwDrawContact*>(pObj->GetUserCall())->GetFmt(); if(pRet && pRectToFill) **pRectToFill = pObj->GetCurrentBoundRect(); } @@ -1607,7 +1607,7 @@ const SwFrmFmt* SwFEShell::GetFmtFromAnyObj( const Point& rPt ) const GetLayout()->GetCrsrOfst( &aPos, aPt ); SwCntntNode *pNd = aPos.nNode.GetNode().GetCntntNode(); SwFrm* pFrm = pNd->getLayoutFrm( GetLayout(), &rPt, 0, false )->FindFlyFrm(); - pRet = pFrm ? ((SwLayoutFrm*)pFrm)->GetFmt() : 0; + pRet = pFrm ? static_cast<SwLayoutFrm*>(pFrm)->GetFmt() : 0; } return pRet; } @@ -1633,7 +1633,7 @@ ObjCntType SwFEShell::GetObjCntType( const SdrObject& rObj ) const { eType = OBJCNT_CONTROL; uno::Reference< awt::XControlModel > xModel = - ((SdrUnoObj&)(*pInvestigatedObj)).GetUnoControlModel(); + static_cast<const SdrUnoObj&>(*pInvestigatedObj).GetUnoControlModel(); if( xModel.is() ) { uno::Any aVal; @@ -1652,10 +1652,10 @@ ObjCntType SwFEShell::GetObjCntType( const SdrObject& rObj ) const } else if( pInvestigatedObj->ISA(SwVirtFlyDrawObj) ) { - SwFlyFrm *pFly = ((SwVirtFlyDrawObj&)(*pInvestigatedObj)).GetFlyFrm(); + const SwFlyFrm *pFly = static_cast<const SwVirtFlyDrawObj&>(*pInvestigatedObj).GetFlyFrm(); if ( pFly->Lower() && pFly->Lower()->IsNoTxtFrm() ) { - if ( ((SwCntntFrm*)pFly->Lower())->GetNode()->GetGrfNode() ) + if ( static_cast<const SwCntntFrm*>(pFly->Lower())->GetNode()->GetGrfNode() ) eType = OBJCNT_GRF; else eType = OBJCNT_OLE; @@ -1878,7 +1878,7 @@ void SwFEShell::GetConnectableFrmFmts(SwFrmFmt & rFmt, aRestVec.clear(); /* number of page rFmt resides on */ - sal_uInt16 nPageNum = SwFmtGetPageNum((SwFlyFrmFmt *) &rFmt); + sal_uInt16 nPageNum = SwFmtGetPageNum(static_cast<SwFlyFrmFmt *>(&rFmt)); ::std::vector< const SwFrmFmt * >::const_iterator aIt; @@ -1891,7 +1891,7 @@ void SwFEShell::GetConnectableFrmFmts(SwFrmFmt & rFmt, if (aString != rReference && aString != rFmt.GetName()) { sal_uInt16 nNum1 = - SwFmtGetPageNum((SwFlyFrmFmt *) *aIt); + SwFmtGetPageNum(static_cast<const SwFlyFrmFmt *>(*aIt)); if (nNum1 == nPageNum -1) aPrevPageVec.push_back(aString); diff --git a/sw/source/core/frmedt/feflyole.cxx b/sw/source/core/frmedt/feflyole.cxx index e7f34c580e67..b58e4c714525 100644 --- a/sw/source/core/frmedt/feflyole.cxx +++ b/sw/source/core/frmedt/feflyole.cxx @@ -46,7 +46,7 @@ SwFlyFrm *SwFEShell::FindFlyFrm( const uno::Reference < embed::XEmbeddedObject > SwFlyFrm *pFly = FindFlyFrm(); if ( pFly && pFly->Lower() && pFly->Lower()->IsNoTxtFrm() ) { - SwOLENode *pNd = ((SwNoTxtFrm*)pFly->Lower())->GetNode()->GetOLENode(); + SwOLENode *pNd = static_cast<SwNoTxtFrm*>(pFly->Lower())->GetNode()->GetOLENode(); if ( !pNd || pNd->GetOLEObj().GetOleRef() != xObj ) pFly = 0; } @@ -65,10 +65,10 @@ SwFlyFrm *SwFEShell::FindFlyFrm( const uno::Reference < embed::XEmbeddedObject > { SwNode *pNd = GetNodes()[ nSttIdx+1 ]; if ( pNd->IsOLENode() && - ((SwOLENode*)pNd)->GetOLEObj().GetOleRef() == xObj ) + static_cast<SwOLENode*>(pNd)->GetOLEObj().GetOleRef() == xObj ) { bExist = true; - SwFrm *pFrm = ((SwOLENode*)pNd)->getLayoutFrm( GetLayout() ); + SwFrm *pFrm = static_cast<SwOLENode*>(pNd)->getLayoutFrm( GetLayout() ); if ( pFrm ) pFly = pFrm->FindFlyFrm(); break; @@ -121,7 +121,7 @@ bool SwFEShell::FinishOLEObj() // Server is terminated if( CNT_OLE == GetCntType() ) ClearAutomaticContour(); - if( ((SwOleClient*)pIPClient)->IsCheckForOLEInCaption() != + if( static_cast<SwOleClient*>(pIPClient)->IsCheckForOLEInCaption() != IsCheckForOLEInCaption() ) SetCheckForOLEInCaption( !IsCheckForOLEInCaption() ); diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index 44e991071e76..edbceef18e31 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -102,7 +102,7 @@ SwFlyFrm *GetFlyFromMarked( const SdrMarkList *pLst, SwViewShell *pSh ) { SdrObject *pO = pLst->GetMark( 0 )->GetMarkedSdrObj(); if ( pO && pO->ISA(SwVirtFlyDrawObj) ) - return ((SwVirtFlyDrawObj*)pO)->GetFlyFrm(); + return static_cast<SwVirtFlyDrawObj*>(pO)->GetFlyFrm(); } return 0; } @@ -178,7 +178,7 @@ bool SwFEShell::SelectObj( const Point& rPt, sal_uInt8 nFlag, SdrObject *pObj ) LockView( false ); } if ( nType & CNT_GRF && - ((SwNoTxtFrm*)pOldSelFly->Lower())->HasAnimation() ) + static_cast<SwNoTxtFrm*>(pOldSelFly->Lower())->HasAnimation() ) { GetWin()->Invalidate( pOldSelFly->Frm().SVRect() ); } @@ -246,8 +246,8 @@ bool SwFEShell::SelectObj( const Point& rPt, sal_uInt8 nFlag, SdrObject *pObj ) { const SwFlyFrm *pTmp = GetFlyFromMarked( &rMrkList, this ); OSL_ENSURE( pTmp, "Graphic without Fly" ); - if ( ((SwNoTxtFrm*)pTmp->Lower())->HasAnimation() ) - ((SwNoTxtFrm*)pTmp->Lower())->StopAnimation( GetOut() ); + if ( static_cast<const SwNoTxtFrm*>(pTmp->Lower())->HasAnimation() ) + static_cast<const SwNoTxtFrm*>(pTmp->Lower())->StopAnimation( GetOut() ); } } else if ( !pOldSelFly && bHadSelection ) @@ -297,11 +297,11 @@ bool SwFEShell::MoveAnchor( SwMove nDir ) SdrObject *pObj = pMrkList->GetMark( 0 )->GetMarkedSdrObj(); if( pObj->ISA(SwVirtFlyDrawObj) ) { - pFly = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm(); + pFly = static_cast<SwVirtFlyDrawObj*>(pObj)->GetFlyFrm(); pOld = pFly->AnchorFrm(); } else - pOld = ((SwDrawContact*)GetUserCall(pObj))->GetAnchorFrm( pObj ); + pOld = static_cast<SwDrawContact*>(GetUserCall(pObj))->GetAnchorFrm( pObj ); bool bRet = false; if( pOld ) { @@ -342,7 +342,7 @@ bool SwFEShell::MoveAnchor( SwMove nDir ) pNew = pOld->GetNext(); if( pNew && pNew != pOld ) { - aAnch.SetPageNum( ((SwPageFrm*)pNew)->GetPhyPageNum() ); + aAnch.SetPageNum( static_cast<SwPageFrm*>(pNew)->GetPhyPageNum() ); bRet = true; } break; @@ -353,7 +353,7 @@ bool SwFEShell::MoveAnchor( SwMove nDir ) if( SwMove::LEFT == nDir || SwMove::RIGHT == nDir ) { SwPosition pos = *aAnch.GetCntntAnchor(); - SwTxtNode* pTxtNd = ((SwTxtFrm*)pOld)->GetTxtNode(); + SwTxtNode* pTxtNd = static_cast<SwTxtFrm*>(pOld)->GetTxtNode(); const sal_Int32 nAct = pos.nContent.GetIndex(); if( SwMove::LEFT == nDir ) { @@ -391,7 +391,7 @@ bool SwFEShell::MoveAnchor( SwMove nDir ) if( pNew && pNew != pOld && pNew->IsCntntFrm() ) { SwPosition pos = *aAnch.GetCntntAnchor(); - SwTxtNode* pTxtNd = ((SwTxtFrm*)pNew)->GetTxtNode(); + SwTxtNode* pTxtNd = static_cast<SwTxtFrm*>(pNew)->GetTxtNode(); pos.nNode = *pTxtNd; sal_Int32 nTmp = 0; if( bRet ) @@ -641,7 +641,7 @@ long SwFEShell::EndDrag( const Point *, bool ) SwViewShell *pSh = this; do { pSh->StartAction(); - } while ( this != (pSh = (SwViewShell*)pSh->GetNext()) ); + } while ( this != (pSh = static_cast<SwViewShell*>(pSh->GetNext())) ); StartUndo( UNDO_START ); @@ -665,8 +665,8 @@ long SwFEShell::EndDrag( const Point *, bool ) do { pSh->EndAction(); if( pSh->IsA( TYPE( SwCrsrShell ) ) ) - ((SwCrsrShell*)pSh)->CallChgLnk(); - } while ( this != (pSh = (SwViewShell*)pSh->GetNext()) ); + static_cast<SwCrsrShell*>(pSh)->CallChgLnk(); + } while ( this != (pSh = static_cast<SwViewShell*>(pSh->GetNext())) ); GetDoc()->getIDocumentState().SetModified(); ::FrameNotify( this, FLY_DRAG ); @@ -733,7 +733,7 @@ static void lcl_NotifyNeighbours( const SdrMarkList *pLst ) SdrObject *pO = pLst->GetMark( j )->GetMarkedSdrObj(); if ( pO->ISA(SwVirtFlyDrawObj) ) { - SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pO)->GetFlyFrm(); + SwFlyFrm *pFly = static_cast<SwVirtFlyDrawObj*>(pO)->GetFlyFrm(); const SwFmtHoriOrient &rHori = pFly->GetFmt()->GetHoriOrient(); aHori = rHori.GetHoriOrient(); @@ -750,7 +750,7 @@ static void lcl_NotifyNeighbours( const SdrMarkList *pLst ) } else { - SwFrm* pAnch = ( (SwDrawContact*)GetUserCall(pO) )->GetAnchorFrm( pO ); + SwFrm* pAnch = static_cast<SwDrawContact*>( GetUserCall(pO) )->GetAnchorFrm( pO ); if( !pAnch ) continue; pPage = pAnch->FindPageFrm(); @@ -892,7 +892,7 @@ void SwFEShell::ChangeOpaque( SdrLayerID nLayerId ) InvalidateWindows( SwRect( pObj->GetCurrentBoundRect() ) ); if ( pObj->ISA(SwVirtFlyDrawObj) ) { - SwFmt *pFmt = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm()->GetFmt(); + SwFmt *pFmt = static_cast<SwVirtFlyDrawObj*>(pObj)->GetFlyFrm()->GetFmt(); SvxOpaqueItem aOpa( pFmt->GetOpaque() ); aOpa.SetValue( nLayerId == pIDDMA->GetHellId() ); pFmt->SetFmtAttr( aOpa ); @@ -974,7 +974,7 @@ void SwFEShell::EndTextEdit() SdrObjUserCall* pUserCall; if( 0 != ( pUserCall = GetUserCall(pObj) ) ) { - SdrObject *pTmp = ((SwContact*)pUserCall)->GetMaster(); + SdrObject *pTmp = static_cast<SwContact*>(pUserCall)->GetMaster(); if( !pTmp ) pTmp = pObj; pUserCall->Changed( *pTmp, SDRUSERCALL_RESIZE, pTmp->GetLastBoundRect() ); @@ -1153,7 +1153,7 @@ bool SwFEShell::ShouldObjectBeSelected(const Point& rPt) SdrObject *pCandidate = pPage->GetObj(a); if (pCandidate->ISA(SwVirtFlyDrawObj) && - ( (SwVirtFlyDrawObj*)pCandidate)->GetCurrentBoundRect().IsInside(rPt) ) + static_cast<SwVirtFlyDrawObj*>(pCandidate)->GetCurrentBoundRect().IsInside(rPt) ) { bRet = false; } @@ -1179,7 +1179,7 @@ static bool lcl_IsControlGroup( const SdrObject *pObj ) else if( pObj->ISA( SdrObjGroup ) ) { bRet = true; - const SdrObjList *pLst = ((SdrObjGroup*)pObj)->GetSubList(); + const SdrObjList *pLst = static_cast<const SdrObjGroup*>(pObj)->GetSubList(); for ( size_t i = 0; i < pLst->GetObjCount(); ++i ) if( !::lcl_IsControlGroup( pLst->GetObj( i ) ) ) return false; @@ -1244,7 +1244,7 @@ const SdrObject* SwFEShell::GetBestObject( bool bNext, sal_uInt16 /*GOTOOBJ_...* { const SdrObject* pStartObj = rMrkList.GetMark(0)->GetMarkedSdrObj(); if( pStartObj->ISA(SwVirtFlyDrawObj) ) - aPos = ((SwVirtFlyDrawObj*)pStartObj)->GetFlyFrm()->Frm().Pos(); + aPos = static_cast<const SwVirtFlyDrawObj*>(pStartObj)->GetFlyFrm()->Frm().Pos(); else aPos = pStartObj->GetSnapRect().TopLeft(); @@ -1286,7 +1286,7 @@ const SdrObject* SwFEShell::GetBestObject( bool bNext, sal_uInt16 /*GOTOOBJ_...* continue; if( bFlyFrm ) { - SwVirtFlyDrawObj *pO = (SwVirtFlyDrawObj*)pObj; + SwVirtFlyDrawObj *pO = static_cast<SwVirtFlyDrawObj*>(pObj); SwFlyFrm *pFly = pO->GetFlyFrm(); if( GOTOOBJ_FLY_ANY != ( GOTOOBJ_FLY_ANY & eType ) ) { @@ -1299,13 +1299,13 @@ const SdrObject* SwFEShell::GetBestObject( bool bNext, sal_uInt16 /*GOTOOBJ_...* case GOTOOBJ_FLY_GRF: if ( pFly->Lower() && (pFly->Lower()->IsLayoutFrm() || - !((SwCntntFrm*)pFly->Lower())->GetNode()->GetGrfNode())) + !static_cast<SwCntntFrm*>(pFly->Lower())->GetNode()->GetGrfNode())) continue; break; case GOTOOBJ_FLY_OLE: if ( pFly->Lower() && (pFly->Lower()->IsLayoutFrm() || - !((SwCntntFrm*)pFly->Lower())->GetNode()->GetOLENode())) + !static_cast<SwCntntFrm*>(pFly->Lower())->GetNode()->GetOLENode())) continue; break; } @@ -1331,7 +1331,7 @@ const SdrObject* SwFEShell::GetBestObject( bool bNext, sal_uInt16 /*GOTOOBJ_...* continue; if( bFlyFrm ) { - SwVirtFlyDrawObj *pO = (SwVirtFlyDrawObj*)pTmpObj; + SwVirtFlyDrawObj *pO = static_cast<SwVirtFlyDrawObj*>(pTmpObj); aCurPos = pO->GetFlyFrm()->Frm().Pos(); } else @@ -1393,7 +1393,7 @@ bool SwFEShell::GotoObj( bool bNext, sal_uInt16 /*GOTOOBJ_...*/ eType ) bool bFlyFrm = pBest->ISA(SwVirtFlyDrawObj); if( bFlyFrm ) { - SwVirtFlyDrawObj *pO = (SwVirtFlyDrawObj*)pBest; + const SwVirtFlyDrawObj *pO = static_cast<const SwVirtFlyDrawObj*>(pBest); const SwRect& rFrm = pO->GetFlyFrm()->Frm(); SelectObj( rFrm.Pos(), 0, (SdrObject*)pBest ); if( !ActionPend() ) @@ -1622,7 +1622,7 @@ bool SwFEShell::ImpEndCreate() // Always via FindAnchor, to assure the frame will be bound // to the previous. With GetCrsOfst we can also reach the next. THIS IS WRONG. pAnch = ::FindAnchor( pPage, aPt, bBodyOnly ); - aPos.nNode = *((SwCntntFrm*)pAnch)->GetNode(); + aPos.nNode = *static_cast<const SwCntntFrm*>(pAnch)->GetNode(); // do not set in ReadnOnly-content if( aPos.nNode.GetNode().IsProtect() ) @@ -1663,9 +1663,9 @@ bool SwFEShell::ImpEndCreate() nXOffset = pAnch->Frm().Left()+pAnch->Frm().Width()-rBound.Right(); else nXOffset = rBound.Left() - pAnch->Frm().Left(); - if( pAnch->IsTxtFrm() && ((SwTxtFrm*)pAnch)->IsFollow() ) + if( pAnch->IsTxtFrm() && static_cast<const SwTxtFrm*>(pAnch)->IsFollow() ) { - SwTxtFrm* pTmp = (SwTxtFrm*)pAnch; + const SwTxtFrm* pTmp = static_cast<const SwTxtFrm*>(pAnch); do { pTmp = pTmp->FindMaster(); OSL_ENSURE( pTmp, "Where's my Master?" ); @@ -1745,7 +1745,7 @@ bool SwFEShell::ImpEndCreate() { Point aRelNullPt; if( OBJ_CAPTION == nIdent ) - aRelNullPt = ((SdrCaptionObj&)rSdrObj).GetTailPos(); + aRelNullPt = static_cast<SdrCaptionObj&>(rSdrObj).GetTailPos(); else aRelNullPt = rBound.TopLeft(); @@ -1755,9 +1755,9 @@ bool SwFEShell::ImpEndCreate() SwFmtHoriOrient aHori( nXOffset, text::HoriOrientation::NONE, text::RelOrientation::FRAME ); aSet.Put( aHori ); // OD 2004-03-30 #i26791# - set vertical position - if( pAnch->IsTxtFrm() && ((SwTxtFrm*)pAnch)->IsFollow() ) + if( pAnch->IsTxtFrm() && static_cast<const SwTxtFrm*>(pAnch)->IsFollow() ) { - SwTxtFrm* pTmp = (SwTxtFrm*)pAnch; + const SwTxtFrm* pTmp = static_cast<const SwTxtFrm*>(pAnch); do { pTmp = pTmp->FindMaster(); assert(pTmp && "Where's my Master?"); @@ -1767,7 +1767,7 @@ bool SwFEShell::ImpEndCreate() } SwFmtVertOrient aVert( nYOffset, text::VertOrientation::NONE, text::RelOrientation::FRAME ); aSet.Put( aVert ); - SwDrawFrmFmt* pFmt = (SwDrawFrmFmt*)getIDocumentLayoutAccess()->MakeLayoutFmt( RND_DRAW_OBJECT, &aSet ); + SwDrawFrmFmt* pFmt = static_cast<SwDrawFrmFmt*>(getIDocumentLayoutAccess()->MakeLayoutFmt( RND_DRAW_OBJECT, &aSet )); // #i36010# - set layout direction of the position pFmt->SetPositionLayoutDir( text::PositionLayoutDir::PositionInLayoutDirOfAnchor ); @@ -1788,9 +1788,9 @@ bool SwFEShell::ImpEndCreate() aVertical.SetVertOrient( text::VertOrientation::LINE_CENTER ); pFmt->SetFmtAttr( aVertical ); } - if( pAnch->IsTxtFrm() && ((SwTxtFrm*)pAnch)->IsFollow() ) + if( pAnch->IsTxtFrm() && static_cast<const SwTxtFrm*>(pAnch)->IsFollow() ) { - SwTxtFrm* pTmp = (SwTxtFrm*)pAnch; + const SwTxtFrm* pTmp = static_cast<const SwTxtFrm*>(pAnch); do { pTmp = pTmp->FindMaster(); OSL_ENSURE( pTmp, "Where's my Master?" ); @@ -1949,7 +1949,7 @@ short SwFEShell::GetAnchorId() const nRet = -1; break; } - SwDrawContact *pContact = (SwDrawContact*)GetUserCall(pObj); + SwDrawContact *pContact = static_cast<SwDrawContact*>(GetUserCall(pObj)); short nId = static_cast<short>(pContact->GetFmt()->GetAnchor().GetAnchorId()); if ( nRet == SHRT_MAX ) nRet = nId; @@ -2057,7 +2057,7 @@ bool SwFEShell::IsGroupSelected() if ( pObj->IsGroupObject() && // --> #i38505# No ungroup allowed for 3d objects !pObj->Is3DObj() && - FLY_AS_CHAR != ((SwDrawContact*)GetUserCall(pObj))-> + FLY_AS_CHAR != static_cast<SwDrawContact*>(GetUserCall(pObj))-> GetFmt()->GetAnchor().GetAnchorId() ) { return true; @@ -2277,13 +2277,13 @@ sal_uInt8 SwFEShell::IsSelObjProtected( sal_uInt16 eType ) const if( pObj->ISA(SwVirtFlyDrawObj) ) { - SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm(); + SwFlyFrm *pFly = static_cast<SwVirtFlyDrawObj*>(pObj)->GetFlyFrm(); if ( (FLYPROTECT_CONTENT & eType) && pFly->GetFmt()->GetProtect().IsCntntProtected() ) nChk |= FLYPROTECT_CONTENT; if ( pFly->Lower() && pFly->Lower()->IsNoTxtFrm() ) { - SwOLENode *pNd = ((SwCntntFrm*)pFly->Lower())->GetNode()->GetOLENode(); + SwOLENode *pNd = static_cast<SwCntntFrm*>(pFly->Lower())->GetNode()->GetOLENode(); uno::Reference < embed::XEmbeddedObject > xObj( pNd ? pNd->GetOLEObj().GetOleRef() : 0 ); if ( xObj.is() ) { @@ -2310,10 +2310,10 @@ sal_uInt8 SwFEShell::IsSelObjProtected( sal_uInt16 eType ) const } const SwFrm* pAnch; if( pObj->ISA(SwVirtFlyDrawObj) ) - pAnch = ( (SwVirtFlyDrawObj*)pObj )->GetFlyFrm()->GetAnchorFrm(); + pAnch = static_cast<SwVirtFlyDrawObj*>( pObj )->GetFlyFrm()->GetAnchorFrm(); else { - SwDrawContact* pTmp = (SwDrawContact*)GetUserCall(pObj); + SwDrawContact* pTmp = static_cast<SwDrawContact*>(GetUserCall(pObj)); pAnch = pTmp ? pTmp->GetAnchorFrm( pObj ) : NULL; } if( pAnch && pAnch->IsProtected() ) @@ -2332,7 +2332,7 @@ bool SwFEShell::GetObjAttr( SfxItemSet &rSet ) const for ( size_t i = 0; i < rMrkList.GetMarkCount(); ++i ) { SdrObject *pObj = rMrkList.GetMark( i )->GetMarkedSdrObj(); - SwDrawContact *pContact = (SwDrawContact*)GetUserCall(pObj); + SwDrawContact *pContact = static_cast<SwDrawContact*>(GetUserCall(pObj)); // --> make code robust OSL_ENSURE( pContact, "<SwFEShell::GetObjAttr(..)> - missing <pContact> - please inform OD." ); if ( pContact ) @@ -2362,7 +2362,7 @@ bool SwFEShell::SetObjAttr( const SfxItemSet& rSet ) for ( size_t i = 0; i < rMrkList.GetMarkCount(); ++i ) { SdrObject *pObj = rMrkList.GetMark( i )->GetMarkedSdrObj(); - SwDrawContact *pContact = (SwDrawContact*)GetUserCall(pObj); + SwDrawContact *pContact = static_cast<SwDrawContact*>(GetUserCall(pObj)); GetDoc()->SetAttr( rSet, *pContact->GetFmt() ); } @@ -2381,7 +2381,7 @@ bool SwFEShell::IsAlignPossible() const if ( nCnt == 1 ) { SdrObject *pO = Imp()->GetDrawView()->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(); - SwDrawContact *pC = (SwDrawContact*)GetUserCall(pO); + SwDrawContact *pC = static_cast<SwDrawContact*>(GetUserCall(pO)); OSL_ENSURE( pC, "No SwDrawContact!"); //only as character bound drawings can be aligned bRet = pC && pC->GetFmt()->GetAnchor().GetAnchorId() == FLY_AS_CHAR; @@ -2426,7 +2426,7 @@ void SwFEShell::CheckUnboundObjects() SwFmtAnchor aAnch; { const SwFrm *pAnch = ::FindAnchor( pPage, aPt, true ); - SwPosition aPos( *((SwCntntFrm*)pAnch)->GetNode() ); + SwPosition aPos( *static_cast<const SwCntntFrm*>(pAnch)->GetNode() ); aAnch.SetType( FLY_AT_PARA ); aAnch.SetAnchor( &aPos ); ((SwRect&)GetCharRect()).Pos() = aPt; @@ -2442,7 +2442,7 @@ void SwFEShell::CheckUnboundObjects() Point aRelNullPt; if( OBJ_CAPTION == nIdent ) - aRelNullPt = ((SdrCaptionObj*)pObj)->GetTailPos(); + aRelNullPt = static_cast<SdrCaptionObj*>(pObj)->GetTailPos(); else aRelNullPt = rBound.TopLeft(); @@ -2451,7 +2451,7 @@ void SwFEShell::CheckUnboundObjects() SwFrmFmt* pFmt = getIDocumentLayoutAccess()->MakeLayoutFmt( RND_DRAW_OBJECT, &aSet ); SwDrawContact *pContact = new SwDrawContact( - (SwDrawFrmFmt*)pFmt, pObj ); + static_cast<SwDrawFrmFmt*>(pFmt), pObj ); // #i35635# pContact->MoveObjToVisibleLayer( pObj ); @@ -2488,7 +2488,7 @@ int SwFEShell::Chainable( SwRect &rRect, const SwFrmFmt &rSource, if( pDView->PickObj( rPt, pDView->getHitTolLog(), pObj, pPView, SDRSEARCH_PICKMARKABLE ) && pObj->ISA(SwVirtFlyDrawObj) ) { - SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm(); + SwFlyFrm *pFly = static_cast<SwVirtFlyDrawObj*>(pObj)->GetFlyFrm(); rRect = pFly->Frm(); // Target and source should not be equal and the list @@ -2520,7 +2520,7 @@ int SwFEShell::Chain( SwFrmFmt &rSource, const Point &rPt ) pDView->SetHitTolerancePixel( 0 ); pDView->PickObj( rPt, pDView->getHitTolLog(), pObj, pPView, SDRSEARCH_PICKMARKABLE ); pDView->SetHitTolerancePixel( nOld ); - SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm(); + SwFlyFrm *pFly = static_cast<SwVirtFlyDrawObj*>(pObj)->GetFlyFrm(); SwFlyFrmFmt *pFmt = (SwFlyFrmFmt*)pFly->GetFmt(); GetDoc()->Chain(rSource, *pFmt); @@ -2751,13 +2751,13 @@ long SwFEShell::GetSectionWidth( SwFmt& rFmt ) const break; } - ((SdrPathObj*)pObj)->SetPathPoly(aPoly); + static_cast<SdrPathObj*>(pObj)->SetPathPoly(aPoly); } else if(pObj->ISA(SdrCaptionObj)) { bool bVerticalText = ( SID_DRAW_TEXT_VERTICAL == nSlotId || SID_DRAW_CAPTION_VERTICAL == nSlotId ); - ((SdrTextObj*)pObj)->SetVerticalWriting(bVerticalText); + static_cast<SdrTextObj*>(pObj)->SetVerticalWriting(bVerticalText); if(bVerticalText) { SfxItemSet aSet(pObj->GetMergedItemSet()); @@ -2766,13 +2766,13 @@ long SwFEShell::GetSectionWidth( SwFmt& rFmt ) const pObj->SetMergedItemSet(aSet); } - ((SdrCaptionObj*)pObj)->SetLogicRect(aRect); - ((SdrCaptionObj*)pObj)->SetTailPos( + static_cast<SdrCaptionObj*>(pObj)->SetLogicRect(aRect); + static_cast<SdrCaptionObj*>(pObj)->SetTailPos( aRect.TopLeft() - Point(aRect.GetWidth() / 2, aRect.GetHeight() / 2)); } else if(pObj->ISA(SdrTextObj)) { - SdrTextObj* pText = (SdrTextObj*)pObj; + SdrTextObj* pText = static_cast<SdrTextObj*>(pObj); pText->SetLogicRect(aRect); bool bVertical = (SID_DRAW_TEXT_VERTICAL == nSlotId); diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx index 86480505ac9d..a12edc00a815 100644 --- a/sw/source/core/frmedt/fetab.cxx +++ b/sw/source/core/frmedt/fetab.cxx @@ -127,7 +127,7 @@ void SwFEShell::ParkCursorInTab() if (*pMk > aEndPos) aEndPos = *pMk; - pTmpCrsr = (SwCursor *) pTmpCrsr->GetNext(); + pTmpCrsr = static_cast<SwCursor *>( pTmpCrsr->GetNext() ); } while (pTmpCrsr != pSwCrsr); @@ -362,7 +362,7 @@ bool SwFEShell::DeleteRow(bool bCompleteTable) // 2. the preceding row, if there is another row before this // 3. otherwise below the table { - SwTableNode* pTblNd = ((SwCntntFrm*)pFrm)->GetNode()->FindTableNode(); + SwTableNode* pTblNd = static_cast<SwCntntFrm*>(pFrm)->GetNode()->FindTableNode(); // search all boxes / lines _FndBox aFndBox( 0, 0 ); @@ -565,7 +565,7 @@ void SwFEShell::_GetTabCols( SwTabCols &rToFill, const SwFrm *pBox ) const if ( pColumnCacheLastCellFrm != pBox ) { pTab->GetTable()->GetTabCols( *pLastCols, - ((SwCellFrm*)pBox)->GetTabBox(), true); + static_cast<const SwCellFrm*>(pBox)->GetTabBox(), true); pColumnCacheLastCellFrm = pBox; } rToFill = *pLastCols; @@ -578,7 +578,7 @@ void SwFEShell::_GetTabCols( SwTabCols &rToFill, const SwFrm *pBox ) const } if ( !pLastCols ) { - GetDoc()->GetTabCols( rToFill, 0, (SwCellFrm*)pBox ); + GetDoc()->GetTabCols( rToFill, 0, static_cast<const SwCellFrm*>(pBox) ); pLastCols = new SwTabCols( rToFill ); pColumnCacheLastTable = pTab->GetTable(); @@ -634,7 +634,7 @@ void SwFEShell::_GetTabRows( SwTabCols &rToFill, const SwFrm *pBox ) const } if ( !pLastRows ) { - GetDoc()->GetTabRows( rToFill, 0, (SwCellFrm*)pBox ); + GetDoc()->GetTabRows( rToFill, 0, static_cast<const SwCellFrm*>(pBox) ); pLastRows = new SwTabCols( rToFill ); pRowCacheLastTable = pTab->GetTable(); @@ -656,7 +656,7 @@ void SwFEShell::SetTabCols( const SwTabCols &rNew, bool bCurRowOnly ) pBox = pBox->GetUpper(); } while ( !pBox->IsCellFrm() ); - GetDoc()->SetTabCols( rNew, bCurRowOnly, 0, (SwCellFrm*)pBox ); + GetDoc()->SetTabCols( rNew, bCurRowOnly, 0, static_cast<SwCellFrm*>(pBox) ); EndAllActionAndCall(); } @@ -697,7 +697,7 @@ void SwFEShell::SetTabRows( const SwTabCols &rNew, bool bCurColOnly ) pBox = pBox->GetUpper(); } while ( !pBox->IsCellFrm() ); - GetDoc()->SetTabRows( rNew, bCurColOnly, 0, (SwCellFrm*)pBox ); + GetDoc()->SetTabRows( rNew, bCurColOnly, 0, static_cast<SwCellFrm*>(pBox) ); EndAllActionAndCall(); } @@ -715,7 +715,7 @@ void SwFEShell::SetMouseTabRows( const SwTabCols &rNew, bool bCurColOnly, const { SET_CURR_SHELL( this ); StartAllAction(); - GetDoc()->SetTabRows( rNew, bCurColOnly, 0, (SwCellFrm*)pBox ); + GetDoc()->SetTabRows( rNew, bCurColOnly, 0, static_cast<const SwCellFrm*>(pBox) ); EndAllActionAndCall(); } } @@ -947,7 +947,7 @@ void SwFEShell::UnProtectCells() } while ( pFrm && !pFrm->IsCellFrm() ); if( pFrm ) { - SwTableBox *pBox = (SwTableBox*)((SwCellFrm*)pFrm)->GetTabBox(); + SwTableBox *pBox = const_cast<SwTableBox*>(static_cast<const SwTableBox*>(static_cast<SwCellFrm*>(pFrm)->GetTabBox())); aBoxes.insert( pBox ); } } @@ -990,7 +990,7 @@ bool SwFEShell::CanUnProtectCells() const } while ( pFrm && !pFrm->IsCellFrm() ); if( pFrm ) { - SwTableBox *pBox = (SwTableBox*)((SwCellFrm*)pFrm)->GetTabBox(); + SwTableBox *pBox = const_cast<SwTableBox*>(static_cast<const SwTableBox*>(static_cast<SwCellFrm*>(pFrm)->GetTabBox())); aBoxes.insert( pBox ); } } @@ -1042,7 +1042,7 @@ static sal_uInt16 lcl_GetRowNumber( const SwPosition& rPos ) while ( !pRow->GetUpper()->IsTabFrm() ) pRow = pRow->GetUpper(); - const SwTabFrm* pTabFrm = (const SwTabFrm*)pRow->GetUpper(); + const SwTabFrm* pTabFrm = static_cast<const SwTabFrm*>(pRow->GetUpper()); const SwTableLine* pTabLine = static_cast<const SwRowFrm*>(pRow)->GetTabLine(); sal_uInt16 nI = 0; @@ -1108,7 +1108,7 @@ bool SwFEShell::CheckHeadline( bool bRepeat ) const } else { - bRet = ((SwLayoutFrm*)pTab->Lower())->IsAnLower( pFrm ) || + bRet = static_cast<SwLayoutFrm*>(pTab->Lower())->IsAnLower( pFrm ) || pTab->IsInHeadline( *pFrm ); } } @@ -1149,7 +1149,7 @@ bool SwFEShell::IsAdjustCellWidthAllowed( bool bBalance ) const do { pFrm = pFrm->GetUpper(); } while ( !pFrm->IsCellFrm() ); - SwTableBox *pBox = (SwTableBox*)((SwCellFrm*)pFrm)->GetTabBox(); + SwTableBox *pBox = const_cast<SwTableBox*>(static_cast<const SwTableBox*>(static_cast<SwCellFrm*>(pFrm)->GetTabBox())); aBoxes.insert( pBox ); } @@ -1161,7 +1161,7 @@ bool SwFEShell::IsAdjustCellWidthAllowed( bool bBalance ) const SwNodeIndex aIdx( *pBox->GetSttNd(), 1 ); SwTxtNode* pCNd = aIdx.GetNode().GetTxtNode(); if( !pCNd ) - pCNd = (SwTxtNode*)GetDoc()->GetNodes().GoNext( &aIdx ); + pCNd = static_cast<SwTxtNode*>(GetDoc()->GetNodes().GoNext( &aIdx )); while ( pCNd ) { @@ -1272,7 +1272,7 @@ bool SwFEShell::DeleteTblSel() // position they'll be set to the old position while( !pFrm->IsCellFrm() ) pFrm = pFrm->GetUpper(); - ParkCrsr( SwNodeIndex( *((SwCellFrm*)pFrm)->GetTabBox()->GetSttNd() )); + ParkCrsr( SwNodeIndex( *static_cast<SwCellFrm*>(pFrm)->GetTabBox()->GetSttNd() )); bRet = GetDoc()->DeleteRowCol( aBoxes ); @@ -1356,7 +1356,7 @@ static const SwFrm *lcl_FindFrmInTab( const SwLayoutFrm *pLay, const Point &rPt, { if ( pFrm->IsLayoutFrm() ) { - const SwFrm *pTmp = ::lcl_FindFrmInTab( (SwLayoutFrm*)pFrm, rPt, nFuzzy ); + const SwFrm *pTmp = ::lcl_FindFrmInTab( static_cast<const SwLayoutFrm*>(pFrm), rPt, nFuzzy ); if ( pTmp ) return pTmp; } @@ -1461,7 +1461,7 @@ static const SwCellFrm *lcl_FindFrm( const SwLayoutFrm *pLay, const Point &rPt, } const SwFrm* pTmp = bSearchForFrmInTab ? - ::lcl_FindFrmInTab( (SwLayoutFrm*)pFrm, aPt, nTmpFuzzy ) : + ::lcl_FindFrmInTab( static_cast<const SwLayoutFrm*>(pFrm), aPt, nTmpFuzzy ) : 0; if ( pTmp ) @@ -1563,7 +1563,7 @@ static const SwCellFrm *lcl_FindFrm( const SwLayoutFrm *pLay, const Point &rPt, const SwFrm* SwFEShell::GetBox( const Point &rPt, bool* pbRow, bool* pbCol ) const { - const SwPageFrm *pPage = (SwPageFrm*)GetLayout()->Lower(); + const SwPageFrm *pPage = static_cast<SwPageFrm*>(GetLayout()->Lower()); vcl::Window* pOutWin = GetWin(); SwTwips nFuzzy = COLFUZZY; if( pOutWin ) @@ -1576,7 +1576,7 @@ const SwFrm* SwFEShell::GetBox( const Point &rPt, bool* pbRow, bool* pbCol ) con } while ( pPage && !pPage->Frm().IsNear( rPt, nFuzzy ) ) - pPage = (SwPageFrm*)pPage->GetNext(); + pPage = static_cast<const SwPageFrm*>(pPage->GetNext()); const SwCellFrm *pFrm = 0; if ( pPage ) @@ -1599,11 +1599,11 @@ const SwFrm* SwFEShell::GetBox( const Point &rPt, bool* pbRow, bool* pbCol ) con } } } - const SwLayoutFrm *pLay = (SwLayoutFrm*)pPage->Lower(); + const SwLayoutFrm *pLay = static_cast<const SwLayoutFrm*>(pPage->Lower()); while ( pLay && !pFrm ) { pFrm = lcl_FindFrm( pLay, rPt, nFuzzy, pbRow, pbCol ); - pLay = (SwLayoutFrm*)pLay->GetNext(); + pLay = static_cast<const SwLayoutFrm*>(pLay->GetNext()); } } return pFrm; @@ -1860,19 +1860,19 @@ SwTab SwFEShell::WhichMouseTabCol( const Point &rPt ) const bool bSelect = false; // First try: Do we get the row/col move cursor? - SwCellFrm* pFrm = (SwCellFrm*)GetBox( rPt, &bRow, 0 ); + const SwCellFrm* pFrm = static_cast<const SwCellFrm*>(GetBox( rPt, &bRow, 0 )); if ( !pFrm ) { // Second try: Do we get the row/col/tab selection cursor? - pFrm = (SwCellFrm*)GetBox( rPt, &bRow, &bCol ); + pFrm = static_cast<const SwCellFrm*>(GetBox( rPt, &bRow, &bCol )); bSelect = true; } if( pFrm ) { while( pFrm && pFrm->Lower() && pFrm->Lower()->IsRowFrm() ) - pFrm = (SwCellFrm*)((SwLayoutFrm*)pFrm->Lower())->Lower(); + pFrm = static_cast<const SwCellFrm*>(static_cast<const SwLayoutFrm*>(pFrm->Lower())->Lower()); if( pFrm && pFrm->GetTabBox()->GetSttNd() && pFrm->GetTabBox()->GetSttNd()->IsInProtectSect() ) pFrm = 0; @@ -2005,7 +2005,7 @@ void SwFEShell::SetMouseTabCols( const SwTabCols &rNew, bool bCurRowOnly, { SET_CURR_SHELL( this ); StartAllAction(); - GetDoc()->SetTabCols( rNew, bCurRowOnly, 0, (SwCellFrm*)pBox ); + GetDoc()->SetTabCols( rNew, bCurRowOnly, 0, static_cast<const SwCellFrm*>(pBox) ); EndAllActionAndCall(); } } @@ -2173,7 +2173,7 @@ bool SwFEShell::SetColRowWidthHeight( sal_uInt16 eType, sal_uInt16 nDiff ) /** The cells are destroyed in here */ bool bRet = GetDoc()->SetColRowWidthHeight( - *(SwTableBox*)((SwCellFrm*)pFrm)->GetTabBox(), + *const_cast<SwTableBox*>(static_cast<SwCellFrm*>(pFrm)->GetTabBox()), eType, nDiff, nLogDiff ); delete pLastCols, pLastCols = 0; diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx index 8928367ac727..32747573a177 100644 --- a/sw/source/core/frmedt/fews.cxx +++ b/sw/source/core/frmedt/fews.cxx @@ -59,12 +59,12 @@ void SwFEShell::EndAllActionAndCall() do { if( pTmp->IsA( TYPE(SwCrsrShell) ) ) { - ((SwFEShell*)pTmp)->EndAction(); - ((SwFEShell*)pTmp)->CallChgLnk(); + static_cast<SwFEShell*>(pTmp)->EndAction(); + static_cast<SwFEShell*>(pTmp)->CallChgLnk(); } else pTmp->EndAction(); - } while( this != ( pTmp = (SwViewShell*)pTmp->GetNext() )); + } while( this != ( pTmp = static_cast<SwViewShell*>(pTmp->GetNext()) )); } // Determine the Cntnt's nearest to the point @@ -162,7 +162,7 @@ sal_uInt16 SwFEShell::GetPageNumber( const Point &rPoint ) const while ( pPage && !pPage->Frm().IsInside( rPoint ) ) pPage = pPage->GetNext(); if ( pPage ) - return ((const SwPageFrm*)pPage)->GetPhyPageNum(); + return static_cast<const SwPageFrm*>(pPage)->GetPhyPageNum(); else return 0; } @@ -187,15 +187,15 @@ bool SwFEShell::GetPageNumber( long nYPos, bool bAtCrsrPos, sal_uInt16& rPhyNum, else // first visible page { pPage = Imp()->GetFirstVisPage(); - if ( pPage && ((SwPageFrm*)pPage)->IsEmptyPage() ) + if ( pPage && static_cast<const SwPageFrm*>(pPage)->IsEmptyPage() ) pPage = pPage->GetNext(); } if( pPage ) { - rPhyNum = ((const SwPageFrm*)pPage)->GetPhyPageNum(); - rVirtNum = ((const SwPageFrm*)pPage)->GetVirtPageNum(); - const SvxNumberType& rNum = ((const SwPageFrm*)pPage)->GetPageDesc()->GetNumType(); + rPhyNum = static_cast<const SwPageFrm*>(pPage)->GetPhyPageNum(); + rVirtNum = static_cast<const SwPageFrm*>(pPage)->GetVirtPageNum(); + const SvxNumberType& rNum = static_cast<const SwPageFrm*>(pPage)->GetPageDesc()->GetNumType(); rDisplay = rNum.GetNumStr( rVirtNum ); } @@ -239,7 +239,7 @@ sal_uInt16 SwFEShell::GetFrmType( const Point *pPt, bool bStopAtFly ) const nReturn |= FRMTYPE_COLUMN; break; case FRM_PAGE: nReturn |= FRMTYPE_PAGE; - if( ((SwPageFrm*)pFrm)->IsFtnPage() ) + if( static_cast<const SwPageFrm*>(pFrm)->IsFtnPage() ) nReturn |= FRMTYPE_FTNPAGE; break; case FRM_HEADER: nReturn |= FRMTYPE_HEADER; break; @@ -248,13 +248,13 @@ sal_uInt16 SwFEShell::GetFrmType( const Point *pPt, bool bStopAtFly ) const nReturn |= FRMTYPE_BODY; break; case FRM_FTN: nReturn |= FRMTYPE_FOOTNOTE; break; - case FRM_FLY: if( ((SwFlyFrm*)pFrm)->IsFlyLayFrm() ) + case FRM_FLY: if( static_cast<const SwFlyFrm*>(pFrm)->IsFlyLayFrm() ) nReturn |= FRMTYPE_FLY_FREE; - else if ( ((SwFlyFrm*)pFrm)->IsFlyAtCntFrm() ) + else if ( static_cast<const SwFlyFrm*>(pFrm)->IsFlyAtCntFrm() ) nReturn |= FRMTYPE_FLY_ATCNT; else { - OSL_ENSURE( ((SwFlyFrm*)pFrm)->IsFlyInCntFrm(), + OSL_ENSURE( static_cast<const SwFlyFrm*>(pFrm)->IsFlyInCntFrm(), "New frametype?" ); nReturn |= FRMTYPE_FLY_INCNT; } @@ -268,7 +268,7 @@ sal_uInt16 SwFEShell::GetFrmType( const Point *pPt, bool bStopAtFly ) const default: /* do nothing */ break; } if ( pFrm->IsFlyFrm() ) - pFrm = ((SwFlyFrm*)pFrm)->GetAnchorFrm(); + pFrm = static_cast<const SwFlyFrm*>(pFrm)->GetAnchorFrm(); else pFrm = pFrm->GetUpper(); } @@ -361,7 +361,7 @@ void SwFEShell::SetPageOffset( sal_uInt16 nOffset ) break; } } - pPage = (SwPageFrm*)pPage->GetPrev(); + pPage = static_cast<const SwPageFrm*>(pPage->GetPrev()); } } @@ -379,7 +379,7 @@ sal_uInt16 SwFEShell::GetPageOffset() const if ( oNumOffset ) return oNumOffset.get(); } - pPage = (SwPageFrm*)pPage->GetPrev(); + pPage = static_cast<const SwPageFrm*>(pPage->GetPrev()); } return 0; } @@ -565,7 +565,7 @@ sal_uInt16 SwFEShell::_GetCurColNum( const SwFrm *pFrm, { if( ( FRM_PAGE | FRM_FLY | FRM_SECTION ) & pFrm->GetType() ) { - pPara->pFrmFmt = ((SwLayoutFrm*)pFrm)->GetFmt(); + pPara->pFrmFmt = static_cast<const SwLayoutFrm*>(pFrm)->GetFmt(); pPara->pPrtRect = &pFrm->Prt(); pPara->pFrmRect = &pFrm->Frm(); break; @@ -1002,7 +1002,7 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect, else { if( _opRef && pFly && pFly->IsFlyInCntFrm() ) - *_opRef = ( (SwFlyInCntFrm*)pFly )->GetRefPoint(); + *_opRef = static_cast<const SwFlyInCntFrm*>( pFly )->GetRefPoint(); _orRect = pUpper->Frm(); if( !pUpper->IsBodyFrm() ) @@ -1026,7 +1026,7 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect, } const SwTwips nBaseOfstForFly = ( pFrm->IsTxtFrm() && pFly ) ? - ((SwTxtFrm*)pFrm)->GetBaseOfstForFly( !bWrapThrough ) : + static_cast<const SwTxtFrm*>(pFrm)->GetBaseOfstForFly( !bWrapThrough ) : 0; if( bVert || bVertL2R ) { diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index 220955d522b5..0ed2af2b2628 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -285,7 +285,7 @@ void GetTblSel( const SwLayoutFrm* pStart, const SwLayoutFrm* pEnd, // Skip any repeated headlines in the follow: const SwLayoutFrm* pRow = pTable->IsFollow() ? pTable->GetFirstNonHeadlineRow() : - (const SwLayoutFrm*)pTable->Lower(); + static_cast<const SwLayoutFrm*>(pTable->Lower()); while( pRow && bTblIsValid ) { @@ -311,7 +311,7 @@ void GetTblSel( const SwLayoutFrm* pStart, const SwLayoutFrm* pEnd, if( ::IsFrmInTblSel( pUnion->GetUnion(), pCell ) ) { SwTableBox* pBox = (SwTableBox*) - ((SwCellFrm*)pCell)->GetTabBox(); + static_cast<const SwCellFrm*>(pCell)->GetTabBox(); // check for cell protection?? if( !bChkProtected || !pBox->GetFrmFmt()->GetProtect().IsCntntProtected() ) @@ -360,7 +360,7 @@ void GetTblSel( const SwLayoutFrm* pStart, const SwLayoutFrm* pEnd, } if ( pCell->GetNext() ) { - pCell = (const SwLayoutFrm*)pCell->GetNext(); + pCell = static_cast<const SwLayoutFrm*>(pCell->GetNext()); if ( pCell->Lower() && pCell->Lower()->IsRowFrm() ) pCell = pCell->FirstCell(); } @@ -368,7 +368,7 @@ void GetTblSel( const SwLayoutFrm* pStart, const SwLayoutFrm* pEnd, pCell = ::lcl_FindNextCellFrm( pCell ); } } - pRow = (const SwLayoutFrm*)pRow->GetNext(); + pRow = static_cast<const SwLayoutFrm*>(pRow->GetNext()); } } @@ -488,7 +488,7 @@ bool ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd ) // Skip any repeated headlines in the follow: const SwLayoutFrm* pRow = pTable->IsFollow() ? pTable->GetFirstNonHeadlineRow() : - (const SwLayoutFrm*)pTable->Lower(); + static_cast<const SwLayoutFrm*>(pTable->Lower()); while( pRow && bTblIsValid && bValidChartSel ) { @@ -544,7 +544,7 @@ bool ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd ) nFrmBottom <= nUnionBottom+ nYFuzzy ) aCellFrms.push_back( - _Sort_CellFrm( *(SwCellFrm*)pCell) ); + _Sort_CellFrm( *static_cast<const SwCellFrm*>(pCell)) ); else { bValidChartSel = false; @@ -553,7 +553,7 @@ bool ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd ) } if ( pCell->GetNext() ) { - pCell = (const SwLayoutFrm*)pCell->GetNext(); + pCell = static_cast<const SwLayoutFrm*>(pCell->GetNext()); if ( pCell->Lower() && pCell->Lower()->IsRowFrm() ) pCell = pCell->FirstCell(); } @@ -561,7 +561,7 @@ bool ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd ) pCell = ::lcl_FindNextCellFrm( pCell ); } } - pRow = (const SwLayoutFrm*)pRow->GetNext(); + pRow = static_cast<const SwLayoutFrm*>(pRow->GetNext()); } if( !bValidChartSel ) @@ -702,7 +702,7 @@ bool GetAutoSumSel( const SwCrsrShell& rShell, SwCellFrms& rBoxes ) // Skip any repeated headlines in the follow: const SwLayoutFrm* pRow = pTable->IsFollow() ? pTable->GetFirstNonHeadlineRow() : - (const SwLayoutFrm*)pTable->Lower(); + static_cast<const SwLayoutFrm*>(pTable->Lower()); while( pRow ) { @@ -730,11 +730,11 @@ bool GetAutoSumSel( const SwCrsrShell& rShell, SwCellFrms& rBoxes ) OSL_ENSURE( pCell->IsCellFrm(), "Frame without cell" ); if( ::IsFrmInTblSel( pUnion->GetUnion(), pCell ) ) - pUpperCell = (SwCellFrm*)pCell; + pUpperCell = static_cast<const SwCellFrm*>(pCell); if( pCell->GetNext() ) { - pCell = (const SwLayoutFrm*)pCell->GetNext(); + pCell = static_cast<const SwLayoutFrm*>(pCell->GetNext()); if ( pCell->Lower() && pCell->Lower()->IsRowFrm() ) pCell = pCell->FirstCell(); } @@ -750,7 +750,7 @@ bool GetAutoSumSel( const SwCrsrShell& rShell, SwCellFrms& rBoxes ) i = aUnions.size(); break; } - pRow = (const SwLayoutFrm*)pRow->GetNext(); + pRow = static_cast<const SwLayoutFrm*>(pRow->GetNext()); } } @@ -771,7 +771,7 @@ bool GetAutoSumSel( const SwCrsrShell& rShell, SwCellFrms& rBoxes ) // Skip any repeated headlines in the follow: const SwLayoutFrm* pRow = pTable->IsFollow() ? pTable->GetFirstNonHeadlineRow() : - (const SwLayoutFrm*)pTable->Lower(); + static_cast<const SwLayoutFrm*>(pTable->Lower()); while( pRow ) { @@ -799,12 +799,12 @@ bool GetAutoSumSel( const SwCrsrShell& rShell, SwCellFrms& rBoxes ) OSL_ENSURE( pCell->IsCellFrm(), "Frame without cell" ); if( ::IsFrmInTblSel( pUnion->GetUnion(), pCell ) ) { - SwCellFrm* pC = (SwCellFrm*)pCell; + SwCellFrm* pC = const_cast<SwCellFrm*>(static_cast<const SwCellFrm*>(pCell)); rBoxes.push_back( pC ); } if( pCell->GetNext() ) { - pCell = (const SwLayoutFrm*)pCell->GetNext(); + pCell = static_cast<const SwLayoutFrm*>(pCell->GetNext()); if ( pCell->Lower() && pCell->Lower()->IsRowFrm() ) pCell = pCell->FirstCell(); } @@ -818,7 +818,7 @@ bool GetAutoSumSel( const SwCrsrShell& rShell, SwCellFrms& rBoxes ) break; } - pRow = (const SwLayoutFrm*)pRow->GetNext(); + pRow = static_cast<const SwLayoutFrm*>(pRow->GetNext()); } } } @@ -852,13 +852,13 @@ static void lcl_InsTblBox( SwTableNode* pTblNd, SwDoc* pDoc, SwTableBox* pBox, ->GetCntntNode(); if( pCNd && pCNd->IsTxtNode() ) pDoc->GetNodes().InsBoxen( pTblNd, pBox->GetUpper(), - (SwTableBoxFmt*)pBox->GetFrmFmt(), - ((SwTxtNode*)pCNd)->GetTxtColl(), + static_cast<SwTableBoxFmt*>(pBox->GetFrmFmt()), + static_cast<SwTxtNode*>(pCNd)->GetTxtColl(), pCNd->GetpSwAttrSet(), nInsPos, nCnt ); else pDoc->GetNodes().InsBoxen( pTblNd, pBox->GetUpper(), - (SwTableBoxFmt*)pBox->GetFrmFmt(), + static_cast<SwTableBoxFmt*>(pBox->GetFrmFmt()), (SwTxtFmtColl*)pDoc->GetDfltTxtFmtColl(), 0, nInsPos, nCnt ); } @@ -945,7 +945,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, // Skip any repeated headlines in the follow: const SwLayoutFrm* pRow = pTabFrm->IsFollow() ? pTabFrm->GetFirstNonHeadlineRow() : - (const SwLayoutFrm*)pTabFrm->Lower(); + static_cast<const SwLayoutFrm*>(pTabFrm->Lower()); while ( pRow ) { @@ -960,7 +960,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, if( rUnion.Top() <= pCell->Frm().Top() && rUnion.Bottom() >= pCell->Frm().Bottom() ) { - SwTableBox* pBox =(SwTableBox*)((SwCellFrm*)pCell)->GetTabBox(); + SwTableBox* pBox = const_cast<SwTableBox*>(static_cast<const SwCellFrm*>(pCell)->GetTabBox()); // only overlap to the right? if( ( rUnion.Left() - COLFUZZY ) <= pCell->Frm().Left() && @@ -1031,7 +1031,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, if( SfxItemState::SET == pBox->GetFrmFmt()->GetAttrSet() .GetItemState( RES_BOX, false, &pItem )) { - SvxBoxItem aBox( *(SvxBoxItem*)pItem ); + SvxBoxItem aBox( *static_cast<const SvxBoxItem*>(pItem) ); aBox.SetLine( 0, BOX_LINE_RIGHT ); pBox->GetFrmFmt()->SetFmtAttr( aBox ); } @@ -1099,7 +1099,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, } if ( pCell->GetNext() ) { - pCell = (const SwLayoutFrm*)pCell->GetNext(); + pCell = static_cast<const SwLayoutFrm*>(pCell->GetNext()); // --> Check if table cell is not empty if ( pCell->Lower() && pCell->Lower()->IsRowFrm() ) pCell = pCell->FirstCell(); @@ -1108,7 +1108,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, pCell = ::lcl_FindNextCellFrm( pCell ); } } - pRow = (const SwLayoutFrm*)pRow->GetNext(); + pRow = static_cast<const SwLayoutFrm*>(pRow->GetNext()); } } @@ -1506,7 +1506,7 @@ static SwTwips lcl_CalcWish( const SwLayoutFrm *pCell, long nWish, { while ( pTmp->GetPrev() ) { - pTmp = (SwLayoutFrm*)pTmp->GetPrev(); + pTmp = static_cast<const SwLayoutFrm*>(pTmp->GetPrev()); long nTmp = pTmp->GetFmt()->GetFrmSize().GetWidth(); nRet += ( bRTL ? ( -1 ) : 1 ) * nTmp * nAct / nWish; } @@ -1523,9 +1523,9 @@ static void lcl_FindStartEndRow( const SwLayoutFrm *&rpStart, { // Put Start at beginning of a row. // Put End at the end of its row. - rpStart = (SwLayoutFrm*)rpStart->GetUpper()->Lower(); + rpStart = static_cast<const SwLayoutFrm*>(rpStart->GetUpper()->Lower()); while ( rpEnd->GetNext() ) - rpEnd = (SwLayoutFrm*)rpEnd->GetNext(); + rpEnd = static_cast<const SwLayoutFrm*>(rpEnd->GetNext()); std::deque<const SwLayoutFrm *> aSttArr, aEndArr; const SwLayoutFrm *pTmp; @@ -1558,18 +1558,18 @@ static void lcl_FindStartEndRow( const SwLayoutFrm *&rpStart, rpEnd = aEndArr[ n+1 ]; if( n ) { - const SwCellFrm* pCellFrm = (SwCellFrm*)aSttArr[ n-1 ]; + const SwCellFrm* pCellFrm = static_cast<const SwCellFrm*>(aSttArr[ n-1 ]); const SwTableLines& rLns = pCellFrm-> GetTabBox()->GetTabLines(); - if( rLns[ 0 ] == ((SwRowFrm*)aSttArr[ n ])->GetTabLine() && + if( rLns[ 0 ] == static_cast<const SwRowFrm*>(aSttArr[ n ])->GetTabLine() && rLns[ rLns.size() - 1 ] == - ((SwRowFrm*)aEndArr[ n ])->GetTabLine() ) + static_cast<const SwRowFrm*>(aEndArr[ n ])->GetTabLine() ) { rpStart = rpEnd = pCellFrm; while ( rpStart->GetPrev() ) - rpStart = (SwLayoutFrm*)rpStart->GetPrev(); + rpStart = static_cast<const SwLayoutFrm*>(rpStart->GetPrev()); while ( rpEnd->GetNext() ) - rpEnd = (SwLayoutFrm*)rpEnd->GetNext(); + rpEnd = static_cast<const SwLayoutFrm*>(rpEnd->GetNext()); } } } @@ -1581,9 +1581,9 @@ static void lcl_FindStartEndRow( const SwLayoutFrm *&rpStart, // Beginning and end should not be in protected cells while ( rpStart->GetFmt()->GetProtect().IsCntntProtected() ) - rpStart = (SwLayoutFrm*)rpStart->GetNext(); + rpStart = static_cast<const SwLayoutFrm*>(rpStart->GetNext()); while ( rpEnd->GetFmt()->GetProtect().IsCntntProtected() ) - rpEnd = (SwLayoutFrm*)rpEnd->GetPrev(); + rpEnd = static_cast<const SwLayoutFrm*>(rpEnd->GetPrev()); } static void lcl_FindStartEndCol( const SwLayoutFrm *&rpStart, @@ -1608,7 +1608,7 @@ static void lcl_FindStartEndCol( const SwLayoutFrm *&rpStart, { const SwFrm *pTmp = pTab->FindPrev(); OSL_ENSURE( pTmp->IsTabFrm(), "Predecessor of Follow is not Master." ); - pTab = (const SwTabFrm*)pTmp; + pTab = static_cast<const SwTabFrm*>(pTmp); } SwTwips nSX = 0; @@ -1729,7 +1729,7 @@ static void lcl_FindStartEndCol( const SwLayoutFrm *&rpStart, const SwTabFrm *pTmpTab = rpEnd->FindTabFrm(); if ( !pTmpLeaf || !pTmpTab->IsAnLower( pTmpLeaf ) ) { - pTmpTab = (const SwTabFrm*)pTmpTab->FindPrev(); + pTmpTab = static_cast<const SwTabFrm*>(pTmpTab->FindPrev()); OSL_ENSURE( pTmpTab->IsTabFrm(), "Predecessor of Follow not Master."); rpEnd = pTmpTab->FindLastCntnt()->GetUpper(); while( !rpEnd->IsCellFrm() ) @@ -1868,10 +1868,10 @@ void MakeSelUnions( SwSelUnions& rUnions, const SwLayoutFrm *pStart, // within the union and use their values for a new union const SwLayoutFrm* pRow = pTable->IsFollow() ? pTable->GetFirstNonHeadlineRow() : - (const SwLayoutFrm*)pTable->Lower(); + static_cast<const SwLayoutFrm*>(pTable->Lower()); while ( pRow && !pRow->Frm().IsOver( aUnion ) ) - pRow = (SwLayoutFrm*)pRow->GetNext(); + pRow = static_cast<const SwLayoutFrm*>(pRow->GetNext()); // #i31976# // A follow flow row may contain emtpy cells. These are not @@ -1899,7 +1899,7 @@ void MakeSelUnions( SwSelUnions& rUnions, const SwLayoutFrm *pStart, { if ( pFirst->GetNext() ) { - pFirst = (const SwLayoutFrm*)pFirst->GetNext(); + pFirst = static_cast<const SwLayoutFrm*>(pFirst->GetNext()); if ( pFirst->Lower() && pFirst->Lower()->IsRowFrm() ) pFirst = pFirst->FirstCell(); } @@ -1984,7 +1984,7 @@ bool CheckSplitCells( const SwCursor& rCrsr, sal_uInt16 nDiv, // Skip any repeated headlines in the follow: const SwLayoutFrm* pRow = pTable->IsFollow() ? pTable->GetFirstNonHeadlineRow() : - (const SwLayoutFrm*)pTable->Lower(); + static_cast<const SwLayoutFrm*>(pTable->Lower()); while ( pRow ) { @@ -2003,7 +2003,7 @@ bool CheckSplitCells( const SwCursor& rCrsr, sal_uInt16 nDiv, if ( pCell->GetNext() ) { - pCell = (const SwLayoutFrm*)pCell->GetNext(); + pCell = static_cast<const SwLayoutFrm*>(pCell->GetNext()); if ( pCell->Lower() && pCell->Lower()->IsRowFrm() ) pCell = pCell->FirstCell(); } @@ -2011,7 +2011,7 @@ bool CheckSplitCells( const SwCursor& rCrsr, sal_uInt16 nDiv, pCell = ::lcl_FindNextCellFrm( pCell ); } } - pRow = (const SwLayoutFrm*)pRow->GetNext(); + pRow = static_cast<const SwLayoutFrm*>(pRow->GetNext()); } } return true; @@ -2024,9 +2024,9 @@ bool CheckSplitCells( const SwCursor& rCrsr, sal_uInt16 nDiv, static void lcl_InsertRow( SwTableLine &rLine, SwLayoutFrm *pUpper, SwFrm *pSibling ) { SwRowFrm *pRow = new SwRowFrm( rLine, pUpper ); - if ( pUpper->IsTabFrm() && ((SwTabFrm*)pUpper)->IsFollow() ) + if ( pUpper->IsTabFrm() && static_cast<SwTabFrm*>(pUpper)->IsFollow() ) { - SwTabFrm* pTabFrm = (SwTabFrm*)pUpper; + SwTabFrm* pTabFrm = static_cast<SwTabFrm*>(pUpper); pTabFrm->FindMaster()->InvalidatePos(); //can absorb the line if ( pSibling && pTabFrm->IsInHeadline( *pSibling ) ) @@ -2188,21 +2188,21 @@ void _FndBox::DelFrms( SwTable &rTable, bool bAccTableDispose ) { bool bDel = true; SwTabFrm *pUp = !pFrm->GetPrev() && !pFrm->GetNext() ? - (SwTabFrm*)pFrm->GetUpper() : 0; + static_cast<SwTabFrm*>(pFrm->GetUpper()) : 0; if ( !pUp ) { const sal_uInt16 nRepeat = - ((SwTabFrm*)pFrm->GetUpper())->GetTable()->GetRowsToRepeat(); + static_cast<SwTabFrm*>(pFrm->GetUpper())->GetTable()->GetRowsToRepeat(); if ( nRepeat > 0 && - ((SwTabFrm*)pFrm->GetUpper())->IsFollow() ) + static_cast<SwTabFrm*>(pFrm->GetUpper())->IsFollow() ) { if ( !pFrm->GetNext() ) { SwRowFrm* pFirstNonHeadline = - ((SwTabFrm*)pFrm->GetUpper())->GetFirstNonHeadlineRow(); + static_cast<SwTabFrm*>(pFrm->GetUpper())->GetFirstNonHeadlineRow(); if ( pFirstNonHeadline == pFrm ) { - pUp = (SwTabFrm*)pFrm->GetUpper(); + pUp = static_cast<SwTabFrm*>(pFrm->GetUpper()); } } } @@ -2216,7 +2216,7 @@ void _FndBox::DelFrms( SwTable &rTable, bool bAccTableDispose ) SwFrm *pTmp = pPrev->FindPrev(); OSL_ENSURE( pTmp->IsTabFrm(), "Predecessor of Follow is no Master."); - pPrev = (SwTabFrm*)pTmp; + pPrev = static_cast<SwTabFrm*>(pTmp); } if ( pPrev ) { @@ -2258,12 +2258,12 @@ void _FndBox::DelFrms( SwTable &rTable, bool bAccTableDispose ) SwFrm* pTabFrm = pFrm->GetUpper(); if ( pTabFrm->IsTabFrm() && !pFrm->GetNext() && - ((SwTabFrm*)pTabFrm)->GetFollow() ) + static_cast<SwTabFrm*>(pTabFrm)->GetFollow() ) { // We do not delete the follow flow line, // this will be done automatically in the // next turn. - ((SwTabFrm*)pTabFrm)->SetFollowFlowLine( false ); + static_cast<SwTabFrm*>(pTabFrm)->SetFollowFlowLine( false ); } //Set acc table dispose state pFrm->SetAccTableDispose( bAccTableDispose ); @@ -2291,14 +2291,14 @@ static void lcl_UpdateRepeatedHeadlines( SwTabFrm& rTabFrm, bool bCalcLowers ) // Delete remaining headlines: SwRowFrm* pLower = 0; - while ( 0 != ( pLower = (SwRowFrm*)rTabFrm.Lower() ) && pLower->IsRepeatedHeadline() ) + while ( 0 != ( pLower = static_cast<SwRowFrm*>(rTabFrm.Lower()) ) && pLower->IsRepeatedHeadline() ) { pLower->Cut(); delete pLower; } // Insert fresh set of headlines: - pLower = (SwRowFrm*)rTabFrm.Lower(); + pLower = static_cast<SwRowFrm*>(rTabFrm.Lower()); SwTable& rTable = *rTabFrm.GetTable(); const sal_uInt16 nRepeat = rTable.GetRowsToRepeat(); for ( sal_uInt16 nIdx = 0; nIdx < nRepeat; ++nIdx ) @@ -2374,9 +2374,9 @@ void _FndBox::MakeFrms( SwTable &rTable ) for ( i = nStPos; (sal_uInt16)i <= nEndPos; ++i ) ::lcl_InsertRow( *rTable.GetTabLines()[static_cast<sal_uInt16>(i)], - (SwLayoutFrm*)pUpperFrm, pSibling ); + static_cast<SwLayoutFrm*>(pUpperFrm), pSibling ); if ( pUpperFrm->IsTabFrm() ) - ((SwTabFrm*)pUpperFrm)->SetCalcLowers(); + static_cast<SwTabFrm*>(pUpperFrm)->SetCalcLowers(); } else if ( rTable.GetRowsToRepeat() > 0 ) { @@ -2450,7 +2450,7 @@ void _FndBox::MakeNewFrms( SwTable &rTable, const sal_uInt16 nNumber, for ( ; i < nMax; ++i ) ::lcl_InsertRow( *rTable.GetTabLines()[i], pUpperFrm, pSibling ); if ( pUpperFrm->IsTabFrm() ) - ((SwTabFrm*)pUpperFrm)->SetCalcLowers(); + static_cast<SwTabFrm*>(pUpperFrm)->SetCalcLowers(); } else // insert before { @@ -2487,7 +2487,7 @@ void _FndBox::MakeNewFrms( SwTable &rTable, const sal_uInt16 nNumber, pUpperFrm = pSibling->GetUpper(); if ( pLineBefore ) - pSibling = (SwRowFrm*) pSibling->GetNext(); + pSibling = static_cast<SwRowFrm*>( pSibling->GetNext() ); sal_uInt16 nMax = nBhPos != USHRT_MAX ? nBhPos - nCnt : @@ -2498,7 +2498,7 @@ void _FndBox::MakeNewFrms( SwTable &rTable, const sal_uInt16 nNumber, ::lcl_InsertRow( *rTable.GetTabLines()[i], pUpperFrm, pSibling ); if ( pUpperFrm->IsTabFrm() ) - ((SwTabFrm*)pUpperFrm)->SetCalcLowers(); + static_cast<SwTabFrm*>(pUpperFrm)->SetCalcLowers(); } } } @@ -2519,7 +2519,7 @@ void _FndBox::MakeNewFrms( SwTable &rTable, const sal_uInt16 nNumber, lcl_UpdateRepeatedHeadlines( *pTable, true ); } - OSL_ENSURE( ((SwRowFrm*)pTable->Lower())->GetTabLine() == + OSL_ENSURE( static_cast<SwRowFrm*>(pTable->Lower())->GetTabLine() == rTable.GetTabLines()[0], "MakeNewFrms: Table corruption!" ); } } diff --git a/sw/source/core/graphic/grfatr.cxx b/sw/source/core/graphic/grfatr.cxx index ddae7dbaf5c4..a5347fe441c9 100644 --- a/sw/source/core/graphic/grfatr.cxx +++ b/sw/source/core/graphic/grfatr.cxx @@ -56,7 +56,7 @@ sal_uInt16 SwMirrorGrf::GetValueCount() const bool SwMirrorGrf::operator==( const SfxPoolItem& rItem) const { return SfxEnumItem::operator==(rItem) && - ((SwMirrorGrf&)rItem).IsGrfToggle() == IsGrfToggle(); + static_cast<const SwMirrorGrf&>(rItem).IsGrfToggle() == IsGrfToggle(); } static bool lcl_IsHoriOnEvenPages(int nEnum, bool bToggle) @@ -168,7 +168,7 @@ SfxPoolItem* SwRotationGrf::Clone( SfxItemPool * ) const bool SwRotationGrf::operator==( const SfxPoolItem& rCmp ) const { return SfxUInt16Item::operator==( rCmp ) && - GetUnrotatedSize() == ((SwRotationGrf&)rCmp).GetUnrotatedSize(); + GetUnrotatedSize() == static_cast<const SwRotationGrf&>(rCmp).GetUnrotatedSize(); } bool SwRotationGrf::QueryValue( uno::Any& rVal, sal_uInt8 ) const @@ -232,7 +232,7 @@ SfxPoolItem* SwGammaGrf::Clone( SfxItemPool * ) const bool SwGammaGrf::operator==( const SfxPoolItem& rCmp ) const { return SfxPoolItem::operator==( rCmp ) && - nValue == ((SwGammaGrf&)rCmp).GetValue(); + nValue == static_cast<const SwGammaGrf&>(rCmp).GetValue(); } bool SwGammaGrf::QueryValue( uno::Any& rVal, sal_uInt8 ) const diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx index 911ba851e752..0989b788967d 100644 --- a/sw/source/core/graphic/ndgrf.cxx +++ b/sw/source/core/graphic/ndgrf.cxx @@ -131,7 +131,7 @@ SwGrfNode::SwGrfNode( const SwNodeIndex & rWhere, FStatHelper::IsDocument( aUrl.GetMainURL( INetURLObject::NO_DECODE ) )) { // file exists, so create connection without an update - ((SwBaseLink*)&refLink)->Connect(); + static_cast<SwBaseLink*>(&refLink)->Connect(); } } } @@ -172,7 +172,7 @@ bool SwGrfNode::ReRead( if( nNewType != refLink->GetObjType() ) { refLink->Disconnect(); - ((SwBaseLink*)&refLink)->SetObjType( nNewType ); + static_cast<SwBaseLink*>(&refLink)->SetObjType( nNewType ); } } @@ -214,7 +214,7 @@ bool SwGrfNode::ReRead( else if ( bNewGrf ) { //TODO refLink->setInputStream(getInputStream()); - ((SwBaseLink*)&refLink)->SwapIn(); + static_cast<SwBaseLink*>(&refLink)->SwapIn(); } } onGraphicChanged(); @@ -249,7 +249,7 @@ bool SwGrfNode::ReRead( onGraphicChanged(); bReadGrf = true; // create connection without update, as we have the graphic - ((SwBaseLink*)&refLink)->Connect(); + static_cast<SwBaseLink*>(&refLink)->Connect(); } else if( pGrfObj ) { @@ -258,7 +258,7 @@ bool SwGrfNode::ReRead( onGraphicChanged(); bReadGrf = true; // create connection without update, as we have the graphic - ((SwBaseLink*)&refLink)->Connect(); + static_cast<SwBaseLink*>(&refLink)->Connect(); } else { @@ -268,7 +268,7 @@ bool SwGrfNode::ReRead( onGraphicChanged(); if ( bNewGrf ) { - ((SwBaseLink*)&refLink)->SwapIn(); + static_cast<SwBaseLink*>(&refLink)->SwapIn(); } } } @@ -520,7 +520,7 @@ bool SwGrfNode::SwapIn( bool bWaitForData ) bool bRet = false; bInSwapIn = true; - SwBaseLink* pLink = (SwBaseLink*)(::sfx2::SvBaseLink*) refLink; + SwBaseLink* pLink = static_cast<SwBaseLink*>((::sfx2::SvBaseLink*) refLink); if( pLink ) { @@ -737,7 +737,7 @@ void SwGrfNode::ReleaseLink() { bInSwapIn = true; - SwBaseLink* pLink = (SwBaseLink*)(::sfx2::SvBaseLink*) refLink; + SwBaseLink* pLink = static_cast<SwBaseLink*>((::sfx2::SvBaseLink*) refLink); pLink->SwapIn( true, true ); bInSwapIn = false; } @@ -986,7 +986,7 @@ IMPL_LINK( SwGrfNode, SwapGraphic, GraphicObject*, pGrfObj ) pRet = GRFMGR_AUTOSWAPSTREAM_TEMP; } - return (sal_IntPtr)pRet; + return reinterpret_cast<sal_IntPtr>(pRet); } /// delete all QuickDraw-Bitmaps in the specified document @@ -1005,7 +1005,7 @@ void DelAllGrfCacheEntries( SwDoc* pDoc ) if( pLnk && OBJECT_CLIENT_GRF == pLnk->GetObjType() && rLnkMgr.GetDisplayNames( pLnk, 0, &sFileNm ) && pLnk->ISA( SwBaseLink ) && 0 != ( pGrfNd = - ((SwBaseLink*)pLnk)->GetCntntNode()->GetGrfNode()) ) + static_cast<SwBaseLink*>(pLnk)->GetCntntNode()->GetGrfNode()) ) { pGrfNd->ReleaseGraphicFromCache(); } @@ -1096,14 +1096,14 @@ bool SwGrfNode::IsSelected() const const SwNode* pN = this; const SwViewShell* pV = pESh; do { - if( pV->ISA( SwEditShell ) && pN == &((SwCrsrShell*)pV) + if( pV->ISA( SwEditShell ) && pN == &static_cast<const SwCrsrShell*>(pV) ->GetCrsr()->GetPoint()->nNode.GetNode() ) { bRet = true; break; } } - while( pESh != ( pV = (SwViewShell*)pV->GetNext() )); + while( pESh != ( pV = static_cast<SwViewShell*>(pV->GetNext()) )); } return bRet; } diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index 80df90cc2c7e..3720cd3933fe 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -148,9 +148,9 @@ void DelHFFormat( SwClient *pToRemove, SwFrmFmt *pFmt ) while ( aIdx < nEnd ) { if ( pNode->IsCntntNode() && - ((SwCntntNode*)pNode)->GetDepends() ) + static_cast<SwCntntNode*>(pNode)->GetDepends() ) { - SwCrsrShell *pShell = SwIterator<SwCrsrShell,SwCntntNode>::FirstElement( *(SwCntntNode*)pNode ); + SwCrsrShell *pShell = SwIterator<SwCrsrShell,SwCntntNode>::FirstElement( *static_cast<SwCntntNode*>(pNode) ); if( pShell ) { pShell->ParkCrsr( aIdx ); @@ -199,13 +199,13 @@ SwFmtFrmSize& SwFmtFrmSize::operator=( const SwFmtFrmSize& rCpy ) bool SwFmtFrmSize::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); - return( m_eFrmHeightType == ((SwFmtFrmSize&)rAttr).m_eFrmHeightType && - m_eFrmWidthType == ((SwFmtFrmSize&)rAttr).m_eFrmWidthType && - m_aSize == ((SwFmtFrmSize&)rAttr).GetSize()&& - m_nWidthPercent == ((SwFmtFrmSize&)rAttr).GetWidthPercent() && - m_eWidthPercentRelation == ((SwFmtFrmSize&)rAttr).GetWidthPercentRelation() && - m_nHeightPercent == ((SwFmtFrmSize&)rAttr).GetHeightPercent() && - m_eHeightPercentRelation == ((SwFmtFrmSize&)rAttr).GetHeightPercentRelation() ); + return( m_eFrmHeightType == static_cast<const SwFmtFrmSize&>(rAttr).m_eFrmHeightType && + m_eFrmWidthType == static_cast<const SwFmtFrmSize&>(rAttr).m_eFrmWidthType && + m_aSize == static_cast<const SwFmtFrmSize&>(rAttr).GetSize()&& + m_nWidthPercent == static_cast<const SwFmtFrmSize&>(rAttr).GetWidthPercent() && + m_eWidthPercentRelation == static_cast<const SwFmtFrmSize&>(rAttr).GetWidthPercentRelation() && + m_nHeightPercent == static_cast<const SwFmtFrmSize&>(rAttr).GetHeightPercent() && + m_eHeightPercentRelation == static_cast<const SwFmtFrmSize&>(rAttr).GetHeightPercentRelation() ); } SfxPoolItem* SwFmtFrmSize::Clone( SfxItemPool* ) const @@ -465,8 +465,8 @@ SwFmtHeader::SwFmtHeader( bool bOn ) bool SwFmtHeader::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); - return ( GetRegisteredIn() == ((SwFmtHeader&)rAttr).GetRegisteredIn() && - bActive == ((SwFmtHeader&)rAttr).IsActive() ); + return ( GetRegisteredIn() == static_cast<const SwFmtHeader&>(rAttr).GetRegisteredIn() && + bActive == static_cast<const SwFmtHeader&>(rAttr).IsActive() ); } SfxPoolItem* SwFmtHeader::Clone( SfxItemPool* ) const @@ -515,8 +515,8 @@ void SwFmtFooter::RegisterToFormat( SwFmt& rFmt ) bool SwFmtFooter::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); - return ( GetRegisteredIn() == ((SwFmtFooter&)rAttr).GetRegisteredIn() && - bActive == ((SwFmtFooter&)rAttr).IsActive() ); + return ( GetRegisteredIn() == static_cast<const SwFmtFooter&>(rAttr).GetRegisteredIn() && + bActive == static_cast<const SwFmtFooter&>(rAttr).IsActive() ); } SfxPoolItem* SwFmtFooter::Clone( SfxItemPool* ) const @@ -552,10 +552,10 @@ void SwFmtCntnt::SetNewCntntIdx( const SwNodeIndex *pIdx ) bool SwFmtCntnt::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); - if( (bool)pStartNode != (bool)((SwFmtCntnt&)rAttr).pStartNode ) + if( (bool)pStartNode != (bool)static_cast<const SwFmtCntnt&>(rAttr).pStartNode ) return false; if( pStartNode ) - return ( *pStartNode == *((SwFmtCntnt&)rAttr).GetCntntIdx() ); + return ( *pStartNode == *static_cast<const SwFmtCntnt&>(rAttr).GetCntntIdx() ); return true; } @@ -603,9 +603,9 @@ bool SwFmtPageDesc::KnowsPageDesc() const bool SwFmtPageDesc::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); - return ( pDefinedIn == ((SwFmtPageDesc&)rAttr).pDefinedIn ) && - ( oNumOffset == ((SwFmtPageDesc&)rAttr).oNumOffset ) && - ( GetPageDesc() == ((SwFmtPageDesc&)rAttr).GetPageDesc() ); + return ( pDefinedIn == static_cast<const SwFmtPageDesc&>(rAttr).pDefinedIn ) && + ( oNumOffset == static_cast<const SwFmtPageDesc&>(rAttr).oNumOffset ) && + ( GetPageDesc() == static_cast<const SwFmtPageDesc&>(rAttr).GetPageDesc() ); } SfxPoolItem* SwFmtPageDesc::Clone( SfxItemPool* ) const @@ -625,9 +625,9 @@ void SwFmtPageDesc::SwClientNotify( const SwModify&, const SfxHint& rHint ) if ( pMod ) { if( pMod->ISA( SwCntntNode ) ) - ((SwCntntNode*)pMod)->SetAttr( aDfltDesc ); + const_cast<SwCntntNode*>(static_cast<const SwCntntNode*>(pMod))->SetAttr( aDfltDesc ); else if( pMod->ISA( SwFmt )) - ((SwFmt*)pMod)->SetFmtAttr( aDfltDesc ); + const_cast<SwFmt*>(static_cast<const SwFmt*>(pMod))->SetFmtAttr( aDfltDesc ); else { OSL_FAIL( "What kind of SwModify is this?" ); @@ -830,7 +830,7 @@ SwFmtCol::SwFmtCol() bool SwFmtCol::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); - const SwFmtCol &rCmp = (const SwFmtCol&)rAttr; + const SwFmtCol &rCmp = static_cast<const SwFmtCol&>(rAttr); if( !(m_eLineStyle == rCmp.m_eLineStyle && m_nLineWidth == rCmp.m_nLineWidth && m_aLineColor == rCmp.m_aLineColor && @@ -1116,10 +1116,10 @@ SwFmtSurround::SwFmtSurround( const SwFmtSurround &rCpy ) : bool SwFmtSurround::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); - return ( GetValue() == ((SwFmtSurround&)rAttr).GetValue() && - bAnchorOnly== ((SwFmtSurround&)rAttr).bAnchorOnly && - bContour== ((SwFmtSurround&)rAttr).bContour && - bOutside== ((SwFmtSurround&)rAttr).bOutside ); + return ( GetValue() == static_cast<const SwFmtSurround&>(rAttr).GetValue() && + bAnchorOnly== static_cast<const SwFmtSurround&>(rAttr).bAnchorOnly && + bContour== static_cast<const SwFmtSurround&>(rAttr).bContour && + bOutside== static_cast<const SwFmtSurround&>(rAttr).bOutside ); } SfxPoolItem* SwFmtSurround::Clone( SfxItemPool* ) const @@ -1274,9 +1274,9 @@ SwFmtVertOrient::SwFmtVertOrient( SwTwips nY, sal_Int16 eVert, bool SwFmtVertOrient::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); - return ( m_nYPos == ((SwFmtVertOrient&)rAttr).m_nYPos && - m_eOrient == ((SwFmtVertOrient&)rAttr).m_eOrient && - m_eRelation == ((SwFmtVertOrient&)rAttr).m_eRelation ); + return ( m_nYPos == static_cast<const SwFmtVertOrient&>(rAttr).m_nYPos && + m_eOrient == static_cast<const SwFmtVertOrient&>(rAttr).m_eOrient && + m_eRelation == static_cast<const SwFmtVertOrient&>(rAttr).m_eRelation ); } SfxPoolItem* SwFmtVertOrient::Clone( SfxItemPool* ) const @@ -1357,10 +1357,10 @@ SwFmtHoriOrient::SwFmtHoriOrient( SwTwips nX, sal_Int16 eHori, bool SwFmtHoriOrient::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); - return ( nXPos == ((SwFmtHoriOrient&)rAttr).nXPos && - eOrient == ((SwFmtHoriOrient&)rAttr).eOrient && - eRelation == ((SwFmtHoriOrient&)rAttr).eRelation && - bPosToggle == ((SwFmtHoriOrient&)rAttr).bPosToggle ); + return ( nXPos == static_cast<const SwFmtHoriOrient&>(rAttr).nXPos && + eOrient == static_cast<const SwFmtHoriOrient&>(rAttr).eOrient && + eRelation == static_cast<const SwFmtHoriOrient&>(rAttr).eRelation && + bPosToggle == static_cast<const SwFmtHoriOrient&>(rAttr).bPosToggle ); } SfxPoolItem* SwFmtHoriOrient::Clone( SfxItemPool* ) const @@ -1665,7 +1665,7 @@ SwFmtURL::~SwFmtURL() bool SwFmtURL::operator==( const SfxPoolItem &rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); - const SwFmtURL &rCmp = (SwFmtURL&)rAttr; + const SwFmtURL &rCmp = static_cast<const SwFmtURL&>(rAttr); bool bRet = bIsServerMap == rCmp.IsServerMap() && sURL == rCmp.GetURL() && sTargetFrameName == rCmp.GetTargetFrameName() && @@ -1835,7 +1835,7 @@ SwFmtFtnEndAtTxtEnd& SwFmtFtnEndAtTxtEnd::operator=( bool SwFmtFtnEndAtTxtEnd::operator==( const SfxPoolItem& rItem ) const { - const SwFmtFtnEndAtTxtEnd& rAttr = (SwFmtFtnEndAtTxtEnd&)rItem; + const SwFmtFtnEndAtTxtEnd& rAttr = static_cast<const SwFmtFtnEndAtTxtEnd&>(rItem); return SfxEnumItem::operator==( rAttr ) && aFmt.GetNumberingType() == rAttr.aFmt.GetNumberingType() && nOffset == rAttr.nOffset && @@ -1972,8 +1972,8 @@ bool SwFmtChain::operator==( const SfxPoolItem &rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); - return GetPrev() == ((SwFmtChain&)rAttr).GetPrev() && - GetNext() == ((SwFmtChain&)rAttr).GetNext(); + return GetPrev() == static_cast<const SwFmtChain&>(rAttr).GetPrev() && + GetNext() == static_cast<const SwFmtChain&>(rAttr).GetNext(); } SwFmtChain::SwFmtChain( const SwFmtChain &rCpy ) : @@ -2046,8 +2046,8 @@ bool SwFmtLineNumber::operator==( const SfxPoolItem &rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); - return nStartValue == ((SwFmtLineNumber&)rAttr).GetStartValue() && - bCountLines == ((SwFmtLineNumber&)rAttr).IsCount(); + return nStartValue == static_cast<const SwFmtLineNumber&>(rAttr).GetStartValue() && + bCountLines == static_cast<const SwFmtLineNumber&>(rAttr).IsCount(); } SfxPoolItem* SwFmtLineNumber::Clone( SfxItemPool* ) const @@ -2450,15 +2450,15 @@ void SwFrmFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) if( RES_ATTRSET_CHG == nWhich ) { - ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState( + static_cast<const SwAttrSetChg*>(pNew)->GetChgSet()->GetItemState( RES_HEADER, false, (const SfxPoolItem**)&pH ); - ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState( + static_cast<const SwAttrSetChg*>(pNew)->GetChgSet()->GetItemState( RES_FOOTER, false, (const SfxPoolItem**)&pF ); //UUUU reset fill information if (maFillAttributes.get() && supportsFullDrawingLayerFillAttributeSet()) { - SfxItemIter aIter(*((SwAttrSetChg*)pNew)->GetChgSet()); + SfxItemIter aIter(*static_cast<const SwAttrSetChg*>(pNew)->GetChgSet()); bool bReset(false); for(const SfxPoolItem* pItem = aIter.FirstItem(); pItem && !bReset; pItem = aIter.NextItem()) @@ -2481,9 +2481,9 @@ void SwFrmFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) } } else if( RES_HEADER == nWhich ) - pH = (SwFmtHeader*)pNew; + pH = const_cast<SwFmtHeader*>(static_cast<const SwFmtHeader*>(pNew)); else if( RES_FOOTER == nWhich ) - pF = (SwFmtFooter*)pNew; + pF = const_cast<SwFmtFooter*>(static_cast<const SwFmtFooter*>(pNew)); if( pH && pH->IsActive() && !pH->GetHeaderFmt() ) { //If he doesn't have one, I'll add one @@ -2560,7 +2560,7 @@ SwRect SwFrmFmt::FindLayoutRect( const bool bPrtArea, const Point* pPoint, if( ISA( SwSectionFmt ) ) { // get the Frame using Node2Layout - SwSectionNode* pSectNd = ((SwSectionFmt*)this)->GetSectionNode(); + const SwSectionNode* pSectNd = static_cast<const SwSectionFmt*>(this)->GetSectionNode(); if( pSectNd ) { SwNode2Layout aTmp( *pSectNd, pSectNd->GetIndex() - 1 ); @@ -2619,8 +2619,8 @@ SdrObject* SwFrmFmt::FindRealSdrObject() if( RES_FLYFRMFMT == Which() ) { Point aNullPt; - SwFlyFrm* pFly = (SwFlyFrm*)::GetFrmOfModify( 0, *this, FRM_FLY, - &aNullPt, 0, false ); + SwFlyFrm* pFly = static_cast<SwFlyFrm*>(::GetFrmOfModify( 0, *this, FRM_FLY, + &aNullPt, 0, false )); return pFly ? pFly->GetVirtDrawObj() : 0; } return FindSdrObject(); @@ -2796,7 +2796,7 @@ void SwFlyFrmFmt::MakeFrms() case FLY_AT_PAGE: { sal_uInt16 nPgNum = aAnchorAttr.GetPageNum(); - SwPageFrm *pPage = (SwPageFrm*)GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout()->Lower(); + SwPageFrm *pPage = static_cast<SwPageFrm*>(GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout()->Lower()); if( nPgNum == 0 && aAnchorAttr.GetCntntAnchor() ) { SwCntntNode *pCNd = aAnchorAttr.GetCntntAnchor()->nNode.GetNode().GetCntntNode(); @@ -2822,7 +2822,7 @@ void SwFlyFrmFmt::MakeFrms() pPage->PlaceFly( 0, this ); break; } - pPage = (SwPageFrm*)pPage->GetNext(); + pPage = static_cast<SwPageFrm*>(pPage->GetNext()); } } break; @@ -2836,7 +2836,7 @@ void SwFlyFrmFmt::MakeFrms() for( SwFrm *pFrm = aIter.First(); pFrm; pFrm = aIter.Next() ) { bool bAdd = !pFrm->IsCntntFrm() || - !((SwCntntFrm*)pFrm)->IsFollow(); + !static_cast<SwCntntFrm*>(pFrm)->IsFollow(); if ( FLY_AT_FLY == aAnchorAttr.GetAnchorId() && !pFrm->IsFlyFrm() ) { @@ -2904,8 +2904,8 @@ void SwFlyFrmFmt::MakeFrms() SwFlyFrm* SwFlyFrmFmt::GetFrm( const Point* pPoint, const bool bCalcFrm ) const { - return (SwFlyFrm*)::GetFrmOfModify( 0, *(SwModify*)this, FRM_FLY, - pPoint, 0, bCalcFrm ); + return static_cast<SwFlyFrm*>(::GetFrmOfModify( 0, *(SwModify*)this, FRM_FLY, + pPoint, 0, bCalcFrm )); } SwAnchoredObject* SwFlyFrmFmt::GetAnchoredObj( const Point* pPoint, const bool bCalcFrm ) const @@ -2928,7 +2928,7 @@ bool SwFlyFrmFmt::GetInfo( SfxPoolItem& rInfo ) const { case RES_CONTENT_VISIBLE: { - ((SwPtrMsgPoolItem&)rInfo).pObject = SwIterator<SwFrm,SwFmt>::FirstElement( *this ); + static_cast<SwPtrMsgPoolItem&>(rInfo).pObject = SwIterator<SwFrm,SwFmt>::FirstElement( *this ); } bRet = false; break; @@ -3159,14 +3159,14 @@ SwDrawFrmFmt::~SwDrawFrmFmt() void SwDrawFrmFmt::MakeFrms() { - SwDrawContact *pContact = (SwDrawContact*)FindContactObj(); + SwDrawContact *pContact = static_cast<SwDrawContact*>(FindContactObj()); if ( pContact ) pContact->ConnectToLayout(); } void SwDrawFrmFmt::DelFrms() { - SwDrawContact *pContact = (SwDrawContact *)FindContactObj(); + SwDrawContact *pContact = static_cast<SwDrawContact *>(FindContactObj()); if ( pContact ) //for the reader and other unpredictable things. pContact->DisconnectFromLayout(); } @@ -3247,12 +3247,12 @@ IMapObject* SwFrmFmt::GetIMapObject( const Point& rPoint, //Original size for OLE and graphic is TwipSize, otherwise the size of //FrmFmt of the Fly. const SwFrm *pRef; - SwNoTxtNode *pNd = 0; + const SwNoTxtNode *pNd = 0; Size aOrigSz; if( pFly->Lower() && pFly->Lower()->IsNoTxtFrm() ) { pRef = pFly->Lower(); - pNd = ((SwCntntFrm*)pRef)->GetNode()->GetNoTxtNode(); + pNd = static_cast<const SwCntntFrm*>(pRef)->GetNode()->GetNoTxtNode(); aOrigSz = pNd->GetTwipSize(); } else diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index 51ea4e679dca..7dcfbc13851c 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -253,25 +253,25 @@ void SwFrm::PrepareMake() const bool bTab = IsTabFrm(); bool bNoSect = IsInSct(); bool bOldTabLock = false, bFoll = false; - SwFlowFrm* pThis = bCnt ? (SwCntntFrm*)this : NULL; + SwFlowFrm* pThis = bCnt ? static_cast<SwCntntFrm*>(this) : NULL; if ( bTab ) { - pThis = (SwTabFrm*)this; - bOldTabLock = ((SwTabFrm*)this)->IsJoinLocked(); - ::PrepareLock( (SwTabFrm*)this ); + pThis = static_cast<SwTabFrm*>(this); + bOldTabLock = static_cast<SwTabFrm*>(this)->IsJoinLocked(); + ::PrepareLock( static_cast<SwTabFrm*>(this) ); bFoll = pThis->IsFollow(); } else if( IsSctFrm() ) { - pThis = (SwSectionFrm*)this; + pThis = static_cast<SwSectionFrm*>(this); bFoll = pThis->IsFollow(); bNoSect = false; } else if ( bCnt && (bFoll = pThis->IsFollow()) && GetPrev() ) { //Do not follow the chain when we need only one instance - const SwTxtFrm* pMaster = ((SwCntntFrm*)this)->FindMaster(); + const SwTxtFrm* pMaster = static_cast<SwCntntFrm*>(this)->FindMaster(); if ( pMaster && pMaster->IsLocked() ) { MakeAll(); @@ -304,7 +304,7 @@ void SwFrm::PrepareMake() break; pFrm->MakeAll(); - if( IsSctFrm() && !((SwSectionFrm*)this)->GetSection() ) + if( IsSctFrm() && !static_cast<SwSectionFrm*>(this)->GetSection() ) break; } // With CntntFrms, the chain may be broken while walking through @@ -319,7 +319,7 @@ void SwFrm::PrepareMake() // won't find ourselves anymore! if( bNoSect && pFrm && pFrm->IsSctFrm() ) { - SwFrm* pCnt = ((SwSectionFrm*)pFrm)->ContainsAny(); + SwFrm* pCnt = static_cast<SwSectionFrm*>(pFrm)->ContainsAny(); if( pCnt ) pFrm = pCnt; } @@ -335,7 +335,7 @@ void SwFrm::PrepareMake() } if ( bTab && !bOldTabLock ) - ::PrepareUnlock( (SwTabFrm*)this ); + ::PrepareUnlock( static_cast<SwTabFrm*>(this) ); } MakeAll(); } @@ -377,17 +377,17 @@ void SwFrm::PrepareCrsr() bool bNoSect = IsInSct(); bool bOldTabLock = false, bFoll; - SwFlowFrm* pThis = bCnt ? (SwCntntFrm*)this : NULL; + SwFlowFrm* pThis = bCnt ? static_cast<SwCntntFrm*>(this) : NULL; if ( bTab ) { - bOldTabLock = ((SwTabFrm*)this)->IsJoinLocked(); - ::PrepareLock( (SwTabFrm*)this ); - pThis = (SwTabFrm*)this; + bOldTabLock = static_cast<SwTabFrm*>(this)->IsJoinLocked(); + ::PrepareLock( static_cast<SwTabFrm*>(this) ); + pThis = static_cast<SwTabFrm*>(this); } else if( IsSctFrm() ) { - pThis = (SwSectionFrm*)this; + pThis = static_cast<SwSectionFrm*>(this); bNoSect = false; } bFoll = pThis && pThis->IsFollow(); @@ -418,7 +418,7 @@ void SwFrm::PrepareCrsr() pFrm = pFrm->FindNext(); if( bNoSect && pFrm && pFrm->IsSctFrm() ) { - SwFrm* pCnt = ((SwSectionFrm*)pFrm)->ContainsAny(); + SwFrm* pCnt = static_cast<SwSectionFrm*>(pFrm)->ContainsAny(); if( pCnt ) pFrm = pCnt; } @@ -432,7 +432,7 @@ void SwFrm::PrepareCrsr() OSL_ENSURE( GetUpper(), "Layout unstable (Upper gone III)." ); if ( bTab && !bOldTabLock ) - ::PrepareUnlock( (SwTabFrm*)this ); + ::PrepareUnlock( static_cast<SwTabFrm*>(this) ); } Calc(); } @@ -445,7 +445,7 @@ static SwFrm* lcl_Prev( SwFrm* pFrm, bool bSectPrv = true ) bSectPrv && !pFrm->IsColumnFrm() ) pRet = pFrm->GetUpper()->GetPrev(); while( pRet && pRet->IsSctFrm() && - !((SwSectionFrm*)pRet)->GetSection() ) + !static_cast<SwSectionFrm*>(pRet)->GetSection() ) pRet = pRet->GetPrev(); return pRet; } @@ -456,7 +456,7 @@ static SwFrm* lcl_NotHiddenPrev( SwFrm* pFrm ) do { pRet = lcl_Prev( pRet ); - } while ( pRet && pRet->IsTxtFrm() && ((SwTxtFrm*)pRet)->IsHiddenNow() ); + } while ( pRet && pRet->IsTxtFrm() && static_cast<SwTxtFrm*>(pRet)->IsHiddenNow() ); return pRet; } @@ -469,7 +469,7 @@ void SwFrm::MakePos() SwFrm* pPrv = lcl_Prev( this ); if ( pPrv && ( !pPrv->IsCntntFrm() || - ( ((SwCntntFrm*)pPrv)->GetFollow() != this ) ) + ( static_cast<SwCntntFrm*>(pPrv)->GetFollow() != this ) ) ) { if ( !StackHack::IsLocked() && @@ -674,7 +674,7 @@ void SwPageFrm::MakeAll() const long nTop = pAttrs->CalcTopLine() + aBorder.Height(); const long nBottom = pAttrs->CalcBottomLine()+ aBorder.Height(); - long nWidth = GetUpper() ? ((SwRootFrm*)GetUpper())->GetBrowseWidth() : 0; + long nWidth = GetUpper() ? static_cast<SwRootFrm*>(GetUpper())->GetBrowseWidth() : 0; if ( nWidth < pSh->GetBrowseWidth() ) nWidth = pSh->GetBrowseWidth(); nWidth += + 2 * aBorder.Width(); @@ -696,18 +696,18 @@ void SwPageFrm::MakeAll() while ( pFrm ) { long nTmp = 0; - SwFrm *pCnt = ((SwLayoutFrm*)pFrm)->ContainsAny(); + SwFrm *pCnt = static_cast<SwLayoutFrm*>(pFrm)->ContainsAny(); while ( pCnt && (pCnt->GetUpper() == pFrm || - ((SwLayoutFrm*)pFrm)->IsAnLower( pCnt ))) + static_cast<SwLayoutFrm*>(pFrm)->IsAnLower( pCnt ))) { nTmp += pCnt->Frm().Height(); if( pCnt->IsTxtFrm() && - ((SwTxtFrm*)pCnt)->IsUndersized() ) - nTmp += ((SwTxtFrm*)pCnt)->GetParHeight() + static_cast<SwTxtFrm*>(pCnt)->IsUndersized() ) + nTmp += static_cast<SwTxtFrm*>(pCnt)->GetParHeight() - pCnt->Prt().Height(); else if( pCnt->IsSctFrm() && - ((SwSectionFrm*)pCnt)->IsUndersized() ) - nTmp += ((SwSectionFrm*)pCnt)->Undersize(); + static_cast<SwSectionFrm*>(pCnt)->IsUndersized() ) + nTmp += static_cast<SwSectionFrm*>(pCnt)->Undersize(); pCnt = pCnt->FindNext(); } // OD 29.10.2002 #97265# - consider invalid body frame properties @@ -880,8 +880,8 @@ bool SwFrm::IsCollapse() const if (!IsTxtFrm()) return false; - const SwTxtFrm *pTxtFrm=(SwTxtFrm*)this; - const SwTxtNode *pTxtNode=pTxtFrm->GetTxtNode(); + const SwTxtFrm *pTxtFrm = static_cast<const SwTxtFrm*>(this); + const SwTxtNode *pTxtNode = pTxtFrm->GetTxtNode(); return pTxtNode && pTxtNode->IsCollapse(); } @@ -896,13 +896,13 @@ bool SwCntntFrm::MakePrtArea( const SwBorderAttrs &rAttrs ) SWRECTFN( this ) const bool bTxtFrm = IsTxtFrm(); SwTwips nUpper = 0; - if ( bTxtFrm && ((SwTxtFrm*)this)->IsHiddenNow() ) + if ( bTxtFrm && static_cast<SwTxtFrm*>(this)->IsHiddenNow() ) { - if ( ((SwTxtFrm*)this)->HasFollow() ) - ((SwTxtFrm*)this)->JoinFrm(); + if ( static_cast<SwTxtFrm*>(this)->HasFollow() ) + static_cast<SwTxtFrm*>(this)->JoinFrm(); if( (Prt().*fnRect->fnGetHeight)() ) - ((SwTxtFrm*)this)->HideHidden(); + static_cast<SwTxtFrm*>(this)->HideHidden(); Prt().Pos().setX(0); Prt().Pos().setY(0); (Prt().*fnRect->fnSetWidth)( (Frm().*fnRect->fnGetWidth)() ); @@ -1035,11 +1035,11 @@ void SwCntntFrm::MakeAll() if ( IsJoinLocked() ) return; - OSL_ENSURE( !((SwTxtFrm*)this)->IsSwapped(), "Calculation of a swapped frame" ); + OSL_ENSURE( !static_cast<SwTxtFrm*>(this)->IsSwapped(), "Calculation of a swapped frame" ); StackHack aHack; - if ( ((SwTxtFrm*)this)->IsLocked() ) + if ( static_cast<SwTxtFrm*>(this)->IsLocked() ) { OSL_FAIL( "Format for locked TxtFrm." ); return; @@ -1111,13 +1111,13 @@ void SwCntntFrm::MakeAll() { SwFtnFrm *pFtn = FindFtnFrm(); SwSectionFrm* pSct = pFtn->FindSctFrm(); - if ( !((SwTxtFrm*)pFtn->GetRef())->IsLocked() ) + if ( !static_cast<SwTxtFrm*>(pFtn->GetRef())->IsLocked() ) { SwFtnBossFrm* pBoss = pFtn->GetRef()->FindFtnBossFrm( pFtn->GetAttr()->GetFtn().IsEndNote() ); if( !pSct || pSct->IsColLocked() || !pSct->Growable() ) pSaveFtn = new SwSaveFtnHeight( pBoss, - ((SwTxtFrm*)pFtn->GetRef())->GetFtnLine( pFtn->GetAttr() ) ); + static_cast<SwTxtFrm*>(pFtn->GetRef())->GetFtnLine( pFtn->GetAttr() ) ); } } @@ -1154,7 +1154,7 @@ void SwCntntFrm::MakeAll() // If a Follow sits next to it's Master and doesn't fit, we know it can // be moved right now. - if ( lcl_Prev( this ) && ((SwTxtFrm*)this)->IsFollow() && IsMoveable() ) + if ( lcl_Prev( this ) && static_cast<SwTxtFrm*>(this)->IsFollow() && IsMoveable() ) { bMovedFwd = true; // OD 2004-03-02 #106629# - If follow frame is in table, it's master @@ -1388,9 +1388,9 @@ void SwCntntFrm::MakeAll() SwFrm *pNxt = HasFollow() ? NULL : FindNext(); while( pNxt && pNxt->IsSctFrm() ) { // Leave empty sections out, go into the other ones. - if( ((SwSectionFrm*)pNxt)->GetSection() ) + if( static_cast<SwSectionFrm*>(pNxt)->GetSection() ) { - SwFrm* pTmp = ((SwSectionFrm*)pNxt)->ContainsAny(); + SwFrm* pTmp = static_cast<SwSectionFrm*>(pNxt)->ContainsAny(); if( pTmp ) { pNxt = pTmp; @@ -1480,9 +1480,9 @@ void SwCntntFrm::MakeAll() // the page if required. while( pNxt && pNxt->IsSctFrm() ) { - if( ((SwSectionFrm*)pNxt)->GetSection() ) + if( static_cast<SwSectionFrm*>(pNxt)->GetSection() ) { - pNxt = ((SwSectionFrm*)pNxt)->ContainsAny(); + pNxt = static_cast<SwSectionFrm*>(pNxt)->ContainsAny(); break; } pNxt = pNxt->FindNext(); @@ -1492,7 +1492,7 @@ void SwCntntFrm::MakeAll() const bool bMoveFwdInvalid = 0 != GetIndNext(); const bool bNxtNew = ( 0 == (pNxt->Prt().*fnRect->fnGetHeight)() ) && - (!pNxt->IsTxtFrm() ||!((SwTxtFrm*)pNxt)->IsHiddenNow()); + (!pNxt->IsTxtFrm() ||!static_cast<SwTxtFrm*>(pNxt)->IsHiddenNow()); pNxt->Calc(); @@ -1602,7 +1602,7 @@ void SwCntntFrm::MakeAll() if( IsInSct() && bMovedFwd && bMakePage && pOldUp->IsColBodyFrm() && pOldUp->GetUpper()->GetUpper()->IsSctFrm() && ( pPre || pOldUp->GetUpper()->GetPrev() ) && - ((SwSectionFrm*)pOldUp->GetUpper()->GetUpper())->MoveAllowed(this) ) + static_cast<SwSectionFrm*>(pOldUp->GetUpper()->GetUpper())->MoveAllowed(this) ) { bMovedFwd = false; } @@ -1699,7 +1699,7 @@ void MakeNxt( SwFrm *pFrm, SwFrm *pNxt ) // we recursively end up in here again. if ( pNxt->IsCntntFrm() ) { - SwCntntNotify aNotify( (SwCntntFrm*)pNxt ); + SwCntntNotify aNotify( static_cast<SwCntntFrm*>(pNxt) ); SwBorderAttrAccess aAccess( SwFrm::GetCache(), pNxt ); const SwBorderAttrs &rAttrs = *aAccess.Get(); if ( !pNxt->GetValidSizeFlag() ) @@ -1709,12 +1709,12 @@ void MakeNxt( SwFrm *pFrm, SwFrm *pNxt ) else pNxt->Frm().Width( pNxt->GetUpper()->Prt().Width() ); } - ((SwCntntFrm*)pNxt)->MakePrtArea( rAttrs ); + static_cast<SwCntntFrm*>(pNxt)->MakePrtArea( rAttrs ); pNxt->Format( &rAttrs ); } else { - SwLayNotify aNotify( (SwLayoutFrm*)pNxt ); + SwLayNotify aNotify( static_cast<SwLayoutFrm*>(pNxt) ); SwBorderAttrAccess aAccess( SwFrm::GetCache(), pNxt ); const SwBorderAttrs &rAttrs = *aAccess.Get(); if ( !pNxt->GetValidSizeFlag() ) @@ -1770,7 +1770,7 @@ bool SwCntntFrm::_WouldFit( SwTwips nSpace, SwCntntFrm *pFrm = this; const SwFrm *pTmpPrev = pNewUpper->Lower(); if( pTmpPrev && pTmpPrev->IsFtnFrm() ) - pTmpPrev = ((SwFtnFrm*)pTmpPrev)->Lower(); + pTmpPrev = static_cast<const SwFtnFrm*>(pTmpPrev)->Lower(); while ( pTmpPrev && pTmpPrev->GetNext() ) pTmpPrev = pTmpPrev->GetNext(); do @@ -1802,15 +1802,15 @@ bool SwCntntFrm::_WouldFit( SwTwips nSpace, pTmpFrm->InsertBefore( pNewUpper, 0 ); if ( pFrm->IsTxtFrm() && ( bTstMove || - ((SwTxtFrm*)pFrm)->HasFollow() || - ( !((SwTxtFrm*)pFrm)->HasPara() && - !((SwTxtFrm*)pFrm)->IsEmpty() + static_cast<SwTxtFrm*>(pFrm)->HasFollow() || + ( !static_cast<SwTxtFrm*>(pFrm)->HasPara() && + !static_cast<SwTxtFrm*>(pFrm)->IsEmpty() ) ) ) { bTstMove = true; - bRet = ((SwTxtFrm*)pFrm)->TestFormat( pTmpPrev, nSpace, bSplit ); + bRet = static_cast<SwTxtFrm*>(pFrm)->TestFormat( pTmpPrev, nSpace, bSplit ); } else bRet = pFrm->WouldFit( nSpace, bSplit, false ); @@ -1914,9 +1914,9 @@ bool SwCntntFrm::_WouldFit( SwTwips nSpace, { if( bTstMove ) { - while( pFrm->IsTxtFrm() && ((SwTxtFrm*)pFrm)->HasFollow() ) + while( pFrm->IsTxtFrm() && static_cast<SwTxtFrm*>(pFrm)->HasFollow() ) { - pFrm = ((SwTxtFrm*)pFrm)->GetFollow(); + pFrm = static_cast<SwTxtFrm*>(pFrm)->GetFollow(); } // OD 11.04.2003 #108824# - If last follow frame of <this> text // frame isn't valid, a formatting of the next content frame @@ -1952,12 +1952,12 @@ bool SwCntntFrm::_WouldFit( SwTwips nSpace, pTmpPrev = 0; else { - if( pFrm->IsTxtFrm() && ((SwTxtFrm*)pFrm)->IsHiddenNow() ) + if( pFrm->IsTxtFrm() && static_cast<SwTxtFrm*>(pFrm)->IsHiddenNow() ) pTmpPrev = lcl_NotHiddenPrev( pFrm ); else pTmpPrev = pFrm; } - pFrm = (SwCntntFrm*)pNxt; + pFrm = static_cast<SwCntntFrm*>(pNxt); } else pFrm = 0; diff --git a/sw/source/core/layout/colfrm.cxx b/sw/source/core/layout/colfrm.cxx index 641bb8548bec..fae9adfc2681 100644 --- a/sw/source/core/layout/colfrm.cxx +++ b/sw/source/core/layout/colfrm.cxx @@ -59,17 +59,17 @@ static void lcl_RemoveColumns( SwLayoutFrm *pCont, sal_uInt16 nCnt ) OSL_ENSURE( pCont && pCont->Lower() && pCont->Lower()->IsColumnFrm(), "no columns to remove." ); - SwColumnFrm *pColumn = (SwColumnFrm*)pCont->Lower(); + SwColumnFrm *pColumn = static_cast<SwColumnFrm*>(pCont->Lower()); sw_RemoveFtns( pColumn, true, true ); while ( pColumn->GetNext() ) { OSL_ENSURE( pColumn->GetNext()->IsColumnFrm(), "neighbor of ColumnFrame is no ColumnFrame." ); - pColumn = (SwColumnFrm*)pColumn->GetNext(); + pColumn = static_cast<SwColumnFrm*>(pColumn->GetNext()); } for ( sal_uInt16 i = 0; i < nCnt; ++i ) { - SwColumnFrm *pTmp = (SwColumnFrm*)pColumn->GetPrev(); + SwColumnFrm *pTmp = static_cast<SwColumnFrm*>(pColumn->GetPrev()); pColumn->Cut(); delete pColumn; //format is going to be destroyed in the DTor if needed. pColumn = pTmp; @@ -80,7 +80,7 @@ static SwLayoutFrm * lcl_FindColumns( SwLayoutFrm *pLay, sal_uInt16 nCount ) { SwFrm *pCol = pLay->Lower(); if ( pLay->IsPageFrm() ) - pCol = ((SwPageFrm*)pLay)->FindBodyCont()->Lower(); + pCol = static_cast<SwPageFrm*>(pLay)->FindBodyCont()->Lower(); if ( pCol && pCol->IsColumnFrm() ) { @@ -88,7 +88,7 @@ static SwLayoutFrm * lcl_FindColumns( SwLayoutFrm *pLay, sal_uInt16 nCount ) sal_uInt16 i; for ( i = 0; pTmp; pTmp = pTmp->GetNext(), ++i ) /* do nothing */; - return i == nCount ? (SwLayoutFrm*)pCol : 0; + return i == nCount ? static_cast<SwLayoutFrm*>(pCol) : 0; } return 0; } @@ -133,14 +133,14 @@ static bool lcl_AddColumns( SwLayoutFrm *pCont, sal_uInt16 nCount ) while ( pTmp ) { pTmp = pTmp->GetNext(); - pNeighbourCol = (SwLayoutFrm*)pNeighbourCol->GetNext(); + pNeighbourCol = static_cast<SwLayoutFrm*>(pNeighbourCol->GetNext()); } for ( sal_uInt16 i = 0; i < nCount; ++i ) { SwColumnFrm *pTmpCol = new SwColumnFrm( pNeighbourCol->GetFmt(), pCont ); pTmpCol->SetMaxFtnHeight( nMax ); pTmpCol->InsertBefore( pCont, NULL ); - pNeighbourCol = (SwLayoutFrm*)pNeighbourCol->GetNext(); + pNeighbourCol = static_cast<SwLayoutFrm*>(pNeighbourCol->GetNext()); } } else @@ -195,7 +195,7 @@ void SwLayoutFrm::ChgColumns( const SwFmtCol &rOld, const SwFmtCol &rNew, ++nNewNum; bool bAtEnd; if( IsSctFrm() ) - bAtEnd = ((SwSectionFrm*)this)->IsAnyNoteAtEnd(); + bAtEnd = static_cast<SwSectionFrm*>(this)->IsAnyNoteAtEnd(); else bAtEnd = false; @@ -211,7 +211,7 @@ void SwLayoutFrm::ChgColumns( const SwFmtCol &rOld, const SwFmtCol &rNew, // SaveCntnt would also suck up the content of the footnote container // and store it within the normal text flow. if( IsPageBodyFrm() ) - pDoc->getIDocumentLayoutAccess().GetCurrentLayout()->RemoveFtns( (SwPageFrm*)GetUpper(), true, false ); + pDoc->getIDocumentLayoutAccess().GetCurrentLayout()->RemoveFtns( static_cast<SwPageFrm*>(GetUpper()), true, false ); pSave = ::SaveCntnt( this ); //If columns exist, they get deleted if a column count of 0 or 1 is requested. @@ -273,10 +273,10 @@ void SwLayoutFrm::ChgColumns( const SwFmtCol &rOld, const SwFmtCol &rNew, if ( pSave ) { OSL_ENSURE( Lower() && Lower()->IsLayoutFrm() && - ((SwLayoutFrm*)Lower())->Lower() && - ((SwLayoutFrm*)Lower())->Lower()->IsLayoutFrm(), + static_cast<SwLayoutFrm*>(Lower())->Lower() && + static_cast<SwLayoutFrm*>(Lower())->Lower()->IsLayoutFrm(), "no column body." ); // ColumnFrms contain BodyFrms - ::RestoreCntnt( pSave, (SwLayoutFrm*)((SwLayoutFrm*)Lower())->Lower(), 0, true ); + ::RestoreCntnt( pSave, static_cast<SwLayoutFrm*>(static_cast<SwLayoutFrm*>(Lower())->Lower()), 0, true ); } } @@ -300,9 +300,9 @@ void SwLayoutFrm::AdjustColumns( const SwFmtCol *pAttr, bool bAdjustAttributes ) if ( !bAdjustAttributes ) { long nAvail = (Prt().*fnRect->fnGetWidth)(); - for ( SwLayoutFrm *pCol = (SwLayoutFrm*)Lower(); + for ( SwLayoutFrm *pCol = static_cast<SwLayoutFrm*>(Lower()); pCol; - pCol = (SwLayoutFrm*)pCol->GetNext() ) + pCol = static_cast<SwLayoutFrm*>(pCol->GetNext()) ) nAvail -= (pCol->Frm().*fnRect->fnGetWidth)(); if ( !nAvail ) return; @@ -343,7 +343,7 @@ void SwLayoutFrm::AdjustColumns( const SwFmtCol *pAttr, bool bAdjustAttributes ) // Don't use the flag with frame columns because BodyFrms in frame // columns can grow/shrink. if( IsBodyFrm() ) - ((SwLayoutFrm*)pCol)->Lower()->ChgSize( aColSz ); + static_cast<SwLayoutFrm*>(pCol)->Lower()->ChgSize( aColSz ); nAvail -= nWidth; } @@ -387,8 +387,8 @@ void SwLayoutFrm::AdjustColumns( const SwFmtCol *pAttr, bool bAdjustAttributes ) aUL.SetUpper( pC->GetUpper()); aUL.SetLower( pC->GetLower()); - ((SwLayoutFrm*)pCol)->GetFmt()->SetFmtAttr( aLR ); - ((SwLayoutFrm*)pCol)->GetFmt()->SetFmtAttr( aUL ); + static_cast<SwLayoutFrm*>(pCol)->GetFmt()->SetFmtAttr( aLR ); + static_cast<SwLayoutFrm*>(pCol)->GetFmt()->SetFmtAttr( aUL ); } nGutter += aLR.GetLeft() + aLR.GetRight(); @@ -421,7 +421,7 @@ void SwLayoutFrm::AdjustColumns( const SwFmtCol *pAttr, bool bAdjustAttributes ) pCol->ChgSize( aColSz ); if( IsBodyFrm() ) - ((SwLayoutFrm*)pCol)->Lower()->ChgSize( aColSz ); + static_cast<SwLayoutFrm*>(pCol)->Lower()->ChgSize( aColSz ); nAvail -= nWidth; } diff --git a/sw/source/core/layout/dbg_lay.cxx b/sw/source/core/layout/dbg_lay.cxx index e2867c745937..378130caff4a 100644 --- a/sw/source/core/layout/dbg_lay.cxx +++ b/sw/source/core/layout/dbg_lay.cxx @@ -115,7 +115,7 @@ static sal_uLong lcl_GetFrameId( const SwFrm* pFrm ) return pFrm->GetFrmId(); #endif if( pFrm && pFrm->IsTxtFrm() ) - return ((SwTxtFrm*)pFrm)->GetTxtNode()->GetIndex(); + return static_cast<const SwTxtFrm*>(pFrm)->GetTxtNode()->GetIndex(); return 0; } diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx index e2b7c8ab43f9..7e4b82353d4b 100644 --- a/sw/source/core/layout/findfrm.cxx +++ b/sw/source/core/layout/findfrm.cxx @@ -38,7 +38,7 @@ SwLayoutFrm *SwFtnBossFrm::FindBodyCont() SwFrm *pLay = Lower(); while ( pLay && !pLay->IsBodyFrm() ) pLay = pLay->GetNext(); - return (SwLayoutFrm*)pLay; + return static_cast<SwLayoutFrm*>(pLay); } /// Searches the last CntntFrm in BodyText below the page. @@ -70,7 +70,7 @@ const SwCntntFrm *SwLayoutFrm::ContainsCntnt() const { while ( (!pLayLeaf->IsSctFrm() || pLayLeaf == this ) && pLayLeaf->Lower() && pLayLeaf->Lower()->IsLayoutFrm() ) - pLayLeaf = (SwLayoutFrm*)pLayLeaf->Lower(); + pLayLeaf = static_cast<const SwLayoutFrm*>(pLayLeaf->Lower()); if( pLayLeaf->IsSctFrm() && pLayLeaf != this ) { @@ -81,15 +81,15 @@ const SwCntntFrm *SwLayoutFrm::ContainsCntnt() const { if( pLayLeaf->GetNext()->IsLayoutFrm() ) { - pLayLeaf = (SwLayoutFrm*)pLayLeaf->GetNext(); + pLayLeaf = static_cast<const SwLayoutFrm*>(pLayLeaf->GetNext()); continue; } else - return (SwCntntFrm*)pLayLeaf->GetNext(); + return static_cast<const SwCntntFrm*>(pLayLeaf->GetNext()); } } else if ( pLayLeaf->Lower() ) - return (SwCntntFrm*)pLayLeaf->Lower(); + return static_cast<const SwCntntFrm*>(pLayLeaf->Lower()); pLayLeaf = pLayLeaf->GetNextLayoutLeaf(); if( !IsAnLower( pLayLeaf) ) @@ -108,7 +108,7 @@ const SwCellFrm *SwLayoutFrm::FirstCell() const const SwFrm* pCnt = ContainsAny(); while( pCnt && !pCnt->IsCellFrm() ) pCnt = pCnt->GetUpper(); - return (const SwCellFrm*)pCnt; + return static_cast<const SwCellFrm*>(pCnt); } /** return CntntFrms, sections, and tables. @@ -130,7 +130,7 @@ const SwFrm *SwLayoutFrm::ContainsAny( const bool _bInvestigateFtnForSections ) while ( ( (!pLayLeaf->IsSctFrm() && !pLayLeaf->IsTabFrm()) || pLayLeaf == this ) && pLayLeaf->Lower() && pLayLeaf->Lower()->IsLayoutFrm() ) - pLayLeaf = (SwLayoutFrm*)pLayLeaf->Lower(); + pLayLeaf = static_cast<const SwLayoutFrm*>(pLayLeaf->Lower()); if( ( pLayLeaf->IsTabFrm() || pLayLeaf->IsSctFrm() ) && pLayLeaf != this ) @@ -140,7 +140,7 @@ const SwFrm *SwLayoutFrm::ContainsAny( const bool _bInvestigateFtnForSections ) return pLayLeaf; } else if ( pLayLeaf->Lower() ) - return (SwCntntFrm*)pLayLeaf->Lower(); + return static_cast<const SwCntntFrm*>(pLayLeaf->Lower()); pLayLeaf = pLayLeaf->GetNextLayoutLeaf(); if( bNoFtn && pLayLeaf && pLayLeaf->IsInFtn() ) @@ -158,12 +158,12 @@ const SwFrm *SwLayoutFrm::ContainsAny( const bool _bInvestigateFtnForSections ) const SwFrm* SwFrm::GetLower() const { - return IsLayoutFrm() ? ((SwLayoutFrm*)this)->Lower() : 0; + return IsLayoutFrm() ? static_cast<const SwLayoutFrm*>(this)->Lower() : 0; } SwFrm* SwFrm::GetLower() { - return IsLayoutFrm() ? ((SwLayoutFrm*)this)->Lower() : 0; + return IsLayoutFrm() ? static_cast<SwLayoutFrm*>(this)->Lower() : 0; } bool SwLayoutFrm::IsAnLower( const SwFrm *pAssumed ) const @@ -174,7 +174,7 @@ bool SwLayoutFrm::IsAnLower( const SwFrm *pAssumed ) const if ( pUp == this ) return true; if ( pUp->IsFlyFrm() ) - pUp = ((SwFlyFrm*)pUp)->GetAnchorFrm(); + pUp = static_cast<const SwFlyFrm*>(pUp)->GetAnchorFrm(); else pUp = pUp->GetUpper(); } @@ -226,11 +226,11 @@ bool SwLayoutFrm::IsBefore( const SwLayoutFrm* _pCheckRefLayFrm ) const { // travel through the next's of <pUp> and check if one of these // contain the check reference. - SwLayoutFrm* pUpNext = (SwLayoutFrm*)pUp->GetNext(); + const SwLayoutFrm* pUpNext = static_cast<const SwLayoutFrm*>(pUp->GetNext()); while ( pUpNext && !pUpNext->IsAnLower( _pCheckRefLayFrm ) ) { - pUpNext = (SwLayoutFrm*)pUpNext->GetNext(); + pUpNext = static_cast<const SwLayoutFrm*>(pUpNext->GetNext()); } bReturn = pUpNext != 0; } @@ -245,7 +245,7 @@ static const SwFrm* lcl_FindLayoutFrame( const SwFrm* pFrm, bool bNext ) { const SwFrm* pRet = 0; if ( pFrm->IsFlyFrm() ) - pRet = bNext ? ((SwFlyFrm*)pFrm)->GetNextLink() : ((SwFlyFrm*)pFrm)->GetPrevLink(); + pRet = bNext ? static_cast<const SwFlyFrm*>(pFrm)->GetNextLink() : static_cast<const SwFlyFrm*>(pFrm)->GetPrevLink(); else pRet = bNext ? pFrm->GetNext() : pFrm->GetPrev(); @@ -307,7 +307,7 @@ const SwLayoutFrm *SwFrm::ImplGetNextLayoutLeaf( bool bFwd ) const } while( ( p && !p->IsFlowFrm() ) || pFrm == this || - 0 == ( pLayoutFrm = pFrm->IsLayoutFrm() ? (SwLayoutFrm*)pFrm : 0 ) || + 0 == ( pLayoutFrm = pFrm->IsLayoutFrm() ? static_cast<const SwLayoutFrm*>(pFrm) : 0 ) || pLayoutFrm->IsAnLower( this ) ); return pLayoutFrm; @@ -327,7 +327,7 @@ const SwCntntFrm* SwCntntFrm::ImplGetNextCntntFrm( bool bFwd ) const { const SwFrm *pFrm = this; // #100926# - SwCntntFrm *pCntntFrm = 0; + const SwCntntFrm *pCntntFrm = 0; bool bGoingUp = false; do { const SwFrm *p = 0; @@ -357,7 +357,7 @@ const SwCntntFrm* SwCntntFrm::ImplGetNextCntntFrm( bool bFwd ) const } pFrm = p; - } while ( 0 == (pCntntFrm = (pFrm->IsCntntFrm() ? (SwCntntFrm*)pFrm:0) )); + } while ( 0 == (pCntntFrm = (pFrm->IsCntntFrm() ? static_cast<const SwCntntFrm*>(pFrm) : 0) )); return pCntntFrm; } @@ -380,7 +380,7 @@ SwPageFrm* SwFrm::FindPageFrm() else return 0; } - return (SwPageFrm*)pRet; + return static_cast<SwPageFrm*>(pRet); } SwFtnBossFrm* SwFrm::FindFtnBossFrm( bool bFootnotes ) @@ -413,7 +413,7 @@ SwFtnBossFrm* SwFrm::FindFtnBossFrm( bool bFootnotes ) if( !pSct->IsFtnAtEnd() ) return pSct->FindFtnBossFrm( true ); } - return (SwFtnBossFrm*)pRet; + return static_cast<SwFtnBossFrm*>(pRet); } SwTabFrm* SwFrm::ImplFindTabFrm() @@ -425,7 +425,7 @@ SwTabFrm* SwFrm::ImplFindTabFrm() if ( !pRet ) return 0; } - return (SwTabFrm*)pRet; + return static_cast<SwTabFrm*>(pRet); } SwSectionFrm* SwFrm::ImplFindSctFrm() @@ -437,7 +437,7 @@ SwSectionFrm* SwFrm::ImplFindSctFrm() if ( !pRet ) return 0; } - return (SwSectionFrm*)pRet; + return static_cast<SwSectionFrm*>(pRet); } SwFtnFrm *SwFrm::ImplFindFtnFrm() @@ -449,16 +449,16 @@ SwFtnFrm *SwFrm::ImplFindFtnFrm() if ( !pRet ) return 0; } - return (SwFtnFrm*)pRet; + return static_cast<SwFtnFrm*>(pRet); } SwFlyFrm *SwFrm::ImplFindFlyFrm() { - const SwFrm *pRet = this; + SwFrm *pRet = this; do { if ( pRet->IsFlyFrm() ) - return (SwFlyFrm*)pRet; + return static_cast<SwFlyFrm*>(pRet); else pRet = pRet->GetUpper(); } while ( pRet ); @@ -492,7 +492,7 @@ SwFrm* SwFrm::FindFooterOrHeader() else if ( pRet->GetUpper() ) pRet = pRet->GetUpper(); else if ( pRet->IsFlyFrm() ) - pRet = ((SwFlyFrm*)pRet)->AnchorFrm(); + pRet = static_cast<SwFlyFrm*>(pRet)->AnchorFrm(); else return 0; } while ( pRet ); @@ -501,7 +501,7 @@ SwFrm* SwFrm::FindFooterOrHeader() const SwFtnFrm* SwFtnContFrm::FindFootNote() const { - const SwFtnFrm* pRet = (SwFtnFrm*)Lower(); + const SwFtnFrm* pRet = static_cast<const SwFtnFrm*>(Lower()); if( pRet && !pRet->GetAttr()->GetFtn().IsEndNote() ) return pRet; return NULL; @@ -552,9 +552,9 @@ const SwPageFrm* SwRootFrm::GetPageAtPos( const Point& rPt, const Size* pSize, b const SwAttrSet* SwFrm::GetAttrSet() const { if ( IsCntntFrm() ) - return &((const SwCntntFrm*)this)->GetNode()->GetSwAttrSet(); + return &static_cast<const SwCntntFrm*>(this)->GetNode()->GetSwAttrSet(); else - return &((const SwLayoutFrm*)this)->GetFmt()->GetAttrSet(); + return &static_cast<const SwLayoutFrm*>(this)->GetFmt()->GetAttrSet(); } //UUUU @@ -608,11 +608,11 @@ static SwFrm* lcl_NextFrm( SwFrm* pFrm ) SwFrm *p = 0; bool bGoingFwd = false; - bool bGoingDown = (!bGoingUp && ( 0 != (p = pFrm->IsLayoutFrm() ? ((SwLayoutFrm*)pFrm)->Lower() : 0))); + bool bGoingDown = (!bGoingUp && ( 0 != (p = pFrm->IsLayoutFrm() ? static_cast<SwLayoutFrm*>(pFrm)->Lower() : 0))); if( !bGoingDown ) { - bGoingFwd = (0 != (p = ( pFrm->IsFlyFrm() ? ((SwFlyFrm*)pFrm)->GetNextLink() : pFrm->GetNext()))); + bGoingFwd = (0 != (p = ( pFrm->IsFlyFrm() ? static_cast<SwFlyFrm*>(pFrm)->GetNextLink() : pFrm->GetNext()))); if ( !bGoingFwd ) { bGoingUp = (0 != (p = pFrm->GetUpper())); @@ -639,10 +639,10 @@ SwFrm *SwFrm::_FindNext() //The last Cntnt of the table gets picked up and his follower is //returned. To be able to deactivate the special case for tables //(see below) bIgnoreTab will be set. - if ( ((SwTabFrm*)this)->GetFollow() ) - return ((SwTabFrm*)this)->GetFollow(); + if ( static_cast<SwTabFrm*>(this)->GetFollow() ) + return static_cast<SwTabFrm*>(this)->GetFollow(); - pThis = ((SwTabFrm*)this)->FindLastCntnt(); + pThis = static_cast<SwTabFrm*>(this)->FindLastCntnt(); if ( !pThis ) pThis = this; bIgnoreTab = true; @@ -650,23 +650,23 @@ SwFrm *SwFrm::_FindNext() else if ( IsSctFrm() ) { //The last Cntnt of the section gets picked and his follower is returned. - if ( ((SwSectionFrm*)this)->GetFollow() ) - return ((SwSectionFrm*)this)->GetFollow(); + if ( static_cast<SwSectionFrm*>(this)->GetFollow() ) + return static_cast<SwSectionFrm*>(this)->GetFollow(); - pThis = ((SwSectionFrm*)this)->FindLastCntnt(); + pThis = static_cast<SwSectionFrm*>(this)->FindLastCntnt(); if ( !pThis ) pThis = this; } else if ( IsCntntFrm() ) { - if( ((SwCntntFrm*)this)->GetFollow() ) - return ((SwCntntFrm*)this)->GetFollow(); + if( static_cast<SwCntntFrm*>(this)->GetFollow() ) + return static_cast<SwCntntFrm*>(this)->GetFollow(); } else if ( IsRowFrm() ) { SwFrm* pMyUpper = GetUpper(); - if ( pMyUpper->IsTabFrm() && ((SwTabFrm*)pMyUpper)->GetFollow() ) - return ((SwTabFrm*)pMyUpper)->GetFollow()->GetLower(); + if ( pMyUpper->IsTabFrm() && static_cast<SwTabFrm*>(pMyUpper)->GetFollow() ) + return static_cast<SwTabFrm*>(pMyUpper)->GetFollow()->GetLower(); else return NULL; } else @@ -680,9 +680,9 @@ SwFrm *SwFrm::_FindNext() while ( !pUp->IsCellFrm() ) pUp = pUp->GetUpper(); OSL_ENSURE( pUp, "Cntnt in Tabelle aber nicht in Zelle." ); - SwFrm* pNxt = ((SwCellFrm*)pUp)->GetFollowCell(); + SwFrm* pNxt = static_cast<SwCellFrm*>(pUp)->GetFollowCell(); if ( pNxt ) - pNxt = ((SwCellFrm*)pNxt)->ContainsCntnt(); + pNxt = static_cast<SwCellFrm*>(pNxt)->ContainsCntnt(); if ( !pNxt ) { pNxt = lcl_NextFrm( pThis ); @@ -766,36 +766,36 @@ SwCntntFrm *SwFrm::_FindNextCnt( const bool _bInSameFtn ) if ( IsTabFrm() ) { - if ( ((SwTabFrm*)this)->GetFollow() ) + if ( static_cast<SwTabFrm*>(this)->GetFollow() ) { - pThis = ((SwTabFrm*)this)->GetFollow()->ContainsCntnt(); + pThis = static_cast<SwTabFrm*>(this)->GetFollow()->ContainsCntnt(); if( pThis ) - return (SwCntntFrm*)pThis; + return static_cast<SwCntntFrm*>(pThis); } - pThis = ((SwTabFrm*)this)->FindLastCntnt(); + pThis = static_cast<SwTabFrm*>(this)->FindLastCntnt(); if ( !pThis ) return 0; } else if ( IsSctFrm() ) { - if ( ((SwSectionFrm*)this)->GetFollow() ) + if ( static_cast<SwSectionFrm*>(this)->GetFollow() ) { - pThis = ((SwSectionFrm*)this)->GetFollow()->ContainsCntnt(); + pThis = static_cast<SwSectionFrm*>(this)->GetFollow()->ContainsCntnt(); if( pThis ) - return (SwCntntFrm*)pThis; + return static_cast<SwCntntFrm*>(pThis); } - pThis = ((SwSectionFrm*)this)->FindLastCntnt(); + pThis = static_cast<SwSectionFrm*>(this)->FindLastCntnt(); if ( !pThis ) return 0; } - else if ( IsCntntFrm() && ((SwCntntFrm*)this)->GetFollow() ) - return ((SwCntntFrm*)this)->GetFollow(); + else if ( IsCntntFrm() && static_cast<SwCntntFrm*>(this)->GetFollow() ) + return static_cast<SwCntntFrm*>(this)->GetFollow(); if ( pThis->IsCntntFrm() ) { const bool bBody = pThis->IsInDocBody(); const bool bFtn = pThis->IsInFtn(); - SwCntntFrm *pNxtCnt = ((SwCntntFrm*)pThis)->GetNextCntntFrm(); + SwCntntFrm *pNxtCnt = static_cast<SwCntntFrm*>(pThis)->GetNextCntntFrm(); if ( pNxtCnt ) { // #i27138# @@ -1021,16 +1021,16 @@ SwFrm *SwFrm::_FindPrev() //The first Cntnt of the table gets picked up and his predecessor is //returned. To be able to deactivate the special case for tables //(see below) bIgnoreTab will be set. - if ( ((SwTabFrm*)this)->IsFollow() ) - return ((SwTabFrm*)this)->FindMaster(); + if ( static_cast<SwTabFrm*>(this)->IsFollow() ) + return static_cast<SwTabFrm*>(this)->FindMaster(); else - pThis = ((SwTabFrm*)this)->ContainsCntnt(); + pThis = static_cast<SwTabFrm*>(this)->ContainsCntnt(); bIgnoreTab = true; } if ( pThis && pThis->IsCntntFrm() ) { - SwCntntFrm *pPrvCnt = ((SwCntntFrm*)pThis)->GetPrevCntntFrm(); + SwCntntFrm *pPrvCnt = static_cast<SwCntntFrm*>(pThis)->GetPrevCntntFrm(); if( !pPrvCnt ) return 0; if ( !bIgnoreTab && pThis->IsInTab() ) @@ -1097,13 +1097,13 @@ void SwFrm::ImplInvalidateNextPos( bool bNoFtn ) { while( pFrm && pFrm->IsSctFrm() ) { - if( ((SwSectionFrm*)pFrm)->GetSection() ) + if( static_cast<SwSectionFrm*>(pFrm)->GetSection() ) { - SwFrm* pTmp = ((SwSectionFrm*)pFrm)->ContainsAny(); + SwFrm* pTmp = static_cast<SwSectionFrm*>(pFrm)->ContainsAny(); if( pTmp ) pTmp->InvalidatePos(); else if( !bNoFtn ) - ((SwSectionFrm*)pFrm)->InvalidateFtnPos(); + static_cast<SwSectionFrm*>(pFrm)->InvalidateFtnPos(); if( !IsInSct() || FindSctFrm()->GetFollow() != pFrm ) pFrm->InvalidatePos(); return; @@ -1116,7 +1116,7 @@ void SwFrm::ImplInvalidateNextPos( bool bNoFtn ) { // We need to invalidate the section's content so it gets // the chance to flow to a different page. - SwFrm* pTmp = ((SwSectionFrm*)pFrm)->ContainsAny(); + SwFrm* pTmp = static_cast<SwSectionFrm*>(pFrm)->ContainsAny(); if( pTmp ) pTmp->InvalidatePos(); if( !IsInSct() || FindSctFrm()->GetFollow() != pFrm ) @@ -1316,7 +1316,7 @@ void SwFrm::SetDirFlags( bool bVert ) if( mbDerivedVert ) { const SwFrm* pAsk = IsFlyFrm() ? - ((SwFlyFrm*)this)->GetAnchorFrm() : GetUpper(); + static_cast<SwFlyFrm*>(this)->GetAnchorFrm() : GetUpper(); OSL_ENSURE( pAsk != this, "Autsch! Stack overflow is about to happen" ); @@ -1342,7 +1342,7 @@ void SwFrm::SetDirFlags( bool bVert ) if( mbDerivedR2L ) { const SwFrm* pAsk = IsFlyFrm() ? - ((SwFlyFrm*)this)->GetAnchorFrm() : GetUpper(); + static_cast<SwFlyFrm*>(this)->GetAnchorFrm() : GetUpper(); OSL_ENSURE( pAsk != this, "Oops! Stack overflow is about to happen" ); @@ -1362,7 +1362,7 @@ SwLayoutFrm* SwFrm::GetNextCellLeaf( MakePageType ) pTmpFrm = pTmpFrm->GetUpper(); OSL_ENSURE( pTmpFrm, "SwFrm::GetNextCellLeaf() without cell" ); - return ((SwCellFrm*)pTmpFrm)->GetFollowCell(); + return static_cast<SwCellFrm*>(pTmpFrm)->GetFollowCell(); } SwLayoutFrm* SwFrm::GetPrevCellLeaf( MakePageType ) @@ -1372,7 +1372,7 @@ SwLayoutFrm* SwFrm::GetPrevCellLeaf( MakePageType ) pTmpFrm = pTmpFrm->GetUpper(); OSL_ENSURE( pTmpFrm, "SwFrm::GetNextPreviousLeaf() without cell" ); - return ((SwCellFrm*)pTmpFrm)->GetPreviousCell(); + return static_cast<SwCellFrm*>(pTmpFrm)->GetPreviousCell(); } static SwCellFrm* lcl_FindCorrespondingCellFrm( const SwRowFrm& rOrigRow, @@ -1381,13 +1381,13 @@ static SwCellFrm* lcl_FindCorrespondingCellFrm( const SwRowFrm& rOrigRow, bool bInFollow ) { SwCellFrm* pRet = NULL; - SwCellFrm* pCell = (SwCellFrm*)rOrigRow.Lower(); - SwCellFrm* pCorrCell = (SwCellFrm*)rCorrRow.Lower(); + const SwCellFrm* pCell = static_cast<const SwCellFrm*>(rOrigRow.Lower()); + SwCellFrm* pCorrCell = const_cast<SwCellFrm*>(static_cast<const SwCellFrm*>(rCorrRow.Lower())); while ( pCell != &rOrigCell && !pCell->IsAnLower( &rOrigCell ) ) { - pCell = (SwCellFrm*)pCell->GetNext(); - pCorrCell = (SwCellFrm*)pCorrCell->GetNext(); + pCell = static_cast<const SwCellFrm*>(pCell->GetNext()); + pCorrCell = static_cast<SwCellFrm*>(pCorrCell->GetNext()); } assert(pCell && pCorrCell && "lcl_FindCorrespondingCellFrm does not work"); @@ -1398,9 +1398,9 @@ static SwCellFrm* lcl_FindCorrespondingCellFrm( const SwRowFrm& rOrigRow, assert(pCell->Lower() && pCell->Lower()->IsRowFrm() && "lcl_FindCorrespondingCellFrm does not work"); - SwRowFrm* pRow = (SwRowFrm*)pCell->Lower(); + const SwRowFrm* pRow = static_cast<const SwRowFrm*>(pCell->Lower()); while ( !pRow->IsAnLower( &rOrigCell ) ) - pRow = (SwRowFrm*)pRow->GetNext(); + pRow = static_cast<const SwRowFrm*>(pRow->GetNext()); SwRowFrm* pCorrRow = 0; if ( bInFollow ) @@ -1467,7 +1467,7 @@ SwCellFrm* SwCellFrm::GetFollowCell() const if ( !pRow->GetNext() && NULL != ( pFollowRow = pRow->IsInSplitTableRow() ) && ( !pFollowRow->IsRowSpanLine() || nRowSpan > 1 ) ) - pRet = lcl_FindCorrespondingCellFrm( *((SwRowFrm*)pRow), *pThisCell, *pFollowRow, true ); + pRet = lcl_FindCorrespondingCellFrm( *static_cast<const SwRowFrm*>(pRow), *pThisCell, *pFollowRow, true ); return pRet; } @@ -1489,7 +1489,7 @@ SwCellFrm* SwCellFrm::GetPreviousCell() const OSL_ENSURE( pRow->GetUpper() && pRow->GetUpper()->IsTabFrm(), "GetPreviousCell without Table" ); - SwTabFrm* pTab = (SwTabFrm*)pRow->GetUpper(); + const SwTabFrm* pTab = static_cast<const SwTabFrm*>(pRow->GetUpper()); if ( pTab->IsFollow() ) { @@ -1503,7 +1503,7 @@ SwCellFrm* SwCellFrm::GetPreviousCell() const { SwRowFrm* pMasterRow = static_cast<SwRowFrm*>(pMaster->GetLastLower()); if ( pMasterRow ) - pRet = lcl_FindCorrespondingCellFrm( *((SwRowFrm*)pRow), *this, *pMasterRow, false ); + pRet = lcl_FindCorrespondingCellFrm( *static_cast<const SwRowFrm*>(pRow), *this, *pMasterRow, false ); if ( pRet && pRet->GetTabBox()->getRowSpan() < 1 ) pRet = &const_cast<SwCellFrm&>(pRet->FindStartEndOfRowSpanCell( true, true )); } @@ -1617,7 +1617,7 @@ const SwRowFrm* SwFrm::IsInSplitTableRow() const OSL_ENSURE( pRow->GetUpper()->IsTabFrm(), "Confusion in table layout" ); - const SwTabFrm* pTab = (SwTabFrm*)pRow->GetUpper(); + const SwTabFrm* pTab = static_cast<const SwTabFrm*>(pRow->GetUpper()); // If most upper row frame is a headline row, the current frame // can't be in a splitted table row. Thus, add corresponding condition. @@ -1649,7 +1649,7 @@ const SwRowFrm* SwFrm::IsInFollowFlowRow() const OSL_ENSURE( pRow->GetUpper()->IsTabFrm(), "Confusion in table layout" ); - const SwTabFrm* pTab = (SwTabFrm*)pRow->GetUpper(); + const SwTabFrm* pTab = static_cast<const SwTabFrm*>(pRow->GetUpper()); const SwTabFrm* pMaster = pTab->IsFollow() ? pTab->FindMaster() : 0; diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index ba8072682243..e9b05f990d22 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -136,7 +136,7 @@ void SwFlowFrm::CheckKeep() SwFrm *pPre = m_rThis.GetIndPrev(); if( pPre->IsSctFrm() ) { - SwFrm *pLast = ((SwSectionFrm*)pPre)->FindLastCntnt(); + SwFrm *pLast = static_cast<SwSectionFrm*>(pPre)->FindLastCntnt(); if( pLast && pLast->FindSctFrm() == pPre ) pPre = pLast; else @@ -149,7 +149,7 @@ void SwFlowFrm::CheckKeep() { if( pTmp->IsSctFrm() ) { - SwFrm *pLast = ((SwSectionFrm*)pTmp)->FindLastCntnt(); + SwFrm *pLast = static_cast<SwSectionFrm*>(pTmp)->FindLastCntnt(); if( pLast && pLast->FindSctFrm() == pTmp ) pTmp = pLast; else @@ -331,14 +331,14 @@ sal_uInt8 SwFlowFrm::BwdMoveNecessary( const SwPageFrm *pPage, const SwRect &rRe { const SwNode *pNode; if ( m_rThis.IsCntntFrm() ) - pNode = ((SwCntntFrm&)m_rThis).GetNode(); + pNode = static_cast<SwCntntFrm&>(m_rThis).GetNode(); else if( m_rThis.IsSctFrm() ) - pNode = ((SwSectionFmt*)((SwSectionFrm&)m_rThis). + pNode = static_cast<SwSectionFmt*>(static_cast<SwSectionFrm&>(m_rThis). GetFmt())->GetSectionNode(); else { OSL_ENSURE( m_rThis.IsTabFrm(), "new FowFrm?" ); - pNode = ((SwTabFrm&)m_rThis).GetTable()-> + pNode = static_cast<SwTabFrm&>(m_rThis).GetTable()-> GetTabSortBoxes()[0]->GetSttNd()->FindTableNode(); } nIndex = pNode->GetIndex(); @@ -391,15 +391,15 @@ SwLayoutFrm *SwFlowFrm::CutTree( SwFrm *pStart ) if ( pLay->IsFtnFrm() ) { if ( !pLay->Lower() && !pLay->IsColLocked() && - !((SwFtnFrm*)pLay)->IsBackMoveLocked() ) + !static_cast<SwFtnFrm*>(pLay)->IsBackMoveLocked() ) { pLay->Cut(); delete pLay; } else { - bool bUnlock = !((SwFtnFrm*)pLay)->IsBackMoveLocked(); - ((SwFtnFrm*)pLay)->LockBackMove(); + bool bUnlock = !static_cast<SwFtnFrm*>(pLay)->IsBackMoveLocked(); + static_cast<SwFtnFrm*>(pLay)->LockBackMove(); pLay->InvalidateSize(); pLay->Calc(); SwCntntFrm *pCnt = pLay->ContainsCntnt(); @@ -409,14 +409,14 @@ SwLayoutFrm *SwFlowFrm::CutTree( SwFrm *pStart ) // to end up in an endless page migration, so we're not even // going to call Calc! OSL_ENSURE( pCnt->IsTxtFrm(), "The Graphic has landed." ); - if ( ((SwTxtFrm*)pCnt)->IsLocked() || - ((SwTxtFrm*)pCnt)->GetFollow() == pStart ) + if ( static_cast<SwTxtFrm*>(pCnt)->IsLocked() || + static_cast<SwTxtFrm*>(pCnt)->GetFollow() == pStart ) break; pCnt->Calc(); pCnt = pCnt->GetNextCntntFrm(); } if( bUnlock ) - ((SwFtnFrm*)pLay)->UnlockBackMove(); + static_cast<SwFtnFrm*>(pLay)->UnlockBackMove(); } pLay = 0; } @@ -498,8 +498,8 @@ bool SwFlowFrm::PasteTree( SwFrm *pStart, SwLayoutFrm *pParent, SwFrm *pSibling, // The CacheIdx idea seems to be a bit risky! if ( pFloat->IsTxtFrm() ) { - if ( ((SwTxtFrm*)pFloat)->GetCacheIdx() != USHRT_MAX ) - ((SwTxtFrm*)pFloat)->Init(); // I'm his friend. + if ( static_cast<SwTxtFrm*>(pFloat)->GetCacheIdx() != USHRT_MAX ) + static_cast<SwTxtFrm*>(pFloat)->Init(); // I'm his friend. } else bRet = true; @@ -521,7 +521,7 @@ bool SwFlowFrm::PasteTree( SwFrm *pStart, SwLayoutFrm *pParent, SwFrm *pSibling, if( pSibling->IsInFtn() ) { if( pSibling->IsSctFrm() ) - pSibling = ((SwSectionFrm*)pSibling)->ContainsAny(); + pSibling = static_cast<SwSectionFrm*>(pSibling)->ContainsAny(); if( pSibling ) pSibling->Prepare( PREP_ERGOSUM ); } @@ -534,7 +534,7 @@ bool SwFlowFrm::PasteTree( SwFrm *pStart, SwLayoutFrm *pParent, SwFrm *pSibling, } if ( pParent->IsFtnFrm() ) - ((SwFtnFrm*)pParent)->InvalidateNxtFtnCnts( pParent->FindPageFrm() ); + static_cast<SwFtnFrm*>(pParent)->InvalidateNxtFtnCnts( pParent->FindPageFrm() ); return bRet; } @@ -593,7 +593,7 @@ void SwFlowFrm::MoveSubTree( SwLayoutFrm* pParent, SwFrm* pSibling ) m_rThis.GetUpper()->Calc(); else if( m_rThis.GetUpper()->IsSctFrm() ) { - SwSectionFrm* pTmpSct = (SwSectionFrm*)m_rThis.GetUpper(); + SwSectionFrm* pTmpSct = static_cast<SwSectionFrm*>(m_rThis.GetUpper()); bool bOld = pTmpSct->IsCntntLocked(); pTmpSct->SetCntntLock( true ); pTmpSct->Calc(); @@ -607,7 +607,7 @@ void SwFlowFrm::MoveSubTree( SwLayoutFrm* pParent, SwFrm* pSibling ) m_rThis.InvalidatePage( pPage ); if ( m_rThis.IsLayoutFrm() ) { - SwCntntFrm *pCnt = ((SwLayoutFrm*)&m_rThis)->ContainsCntnt(); + SwCntntFrm *pCnt = static_cast<SwLayoutFrm*>(&m_rThis)->ContainsCntnt(); if ( pCnt ) pCnt->InvalidatePage( pPage ); } @@ -641,7 +641,7 @@ SwTxtFrm* SwCntntFrm::FindMaster() const if ( pPrec && pPrec->HasFollow() && pPrec->GetFollow() == this ) { OSL_ENSURE( pPrec->IsTxtFrm(), "NoTxtFrm with follow found" ); - return ( SwTxtFrm* )pPrec; + return const_cast<SwTxtFrm*>(static_cast< const SwTxtFrm* >(pPrec)); } OSL_FAIL( "Follow ist lost in Space." ); @@ -721,7 +721,7 @@ const SwLayoutFrm *SwFrm::GetLeaf( MakePageType eMakePage, bool bFwd, { pLeaf = ((SwFrm*)pLeaf)->GetLeaf( eMakePage, bFwd ); if ( pLeaf && - (!IsLayoutFrm() || !((SwLayoutFrm*)this)->IsAnLower( pLeaf ))) + (!IsLayoutFrm() || !static_cast<const SwLayoutFrm*>(this)->IsAnLower( pLeaf ))) { if ( pAnch->IsInDocBody() == pLeaf->IsInDocBody() && pAnch->IsInFtn() == pLeaf->IsInFtn() ) @@ -731,7 +731,7 @@ const SwLayoutFrm *SwFrm::GetLeaf( MakePageType eMakePage, bool bFwd, } } while ( !bFound && pLeaf ); - return (const SwLayoutFrm*)pLeaf; + return static_cast<const SwLayoutFrm*>(pLeaf); } SwLayoutFrm *SwFrm::GetLeaf( MakePageType eMakePage, bool bFwd ) @@ -861,7 +861,7 @@ SwLayoutFrm *SwFrm::GetNextLeaf( MakePageType eMakePage ) SwLayoutFrm *pLayLeaf = 0; if ( IsTabFrm() ) { - SwCntntFrm* pTmp = ((SwTabFrm*)this)->FindLastCntnt(); + SwCntntFrm* pTmp = static_cast<SwTabFrm*>(this)->FindLastCntnt(); if ( pTmp ) pLayLeaf = pTmp->GetUpper(); } @@ -920,7 +920,7 @@ SwLayoutFrm *SwFrm::GetNextLeaf( MakePageType eMakePage ) // If the reference of the first footnote of this page // lies before the page, we'd rather not insert a new page. // (Bug #55620#) - SwFtnFrm *pFtn = (SwFtnFrm*)pCont->Lower(); + SwFtnFrm *pFtn = static_cast<SwFtnFrm*>(pCont->Lower()); if( pFtn && pFtn->GetRef() ) { const sal_uInt16 nRefNum = pNew->GetPhyPageNum(); @@ -938,7 +938,7 @@ SwLayoutFrm *SwFrm::GetNextLeaf( MakePageType eMakePage ) pOldLayLeaf->FindPageFrm() : 0; if ( pPg && pPg->IsEmptyPage() ) // Don't insert behind. Insert before the EmptyPage. - pPg = (SwPageFrm*)pPg->GetPrev(); + pPg = static_cast<SwPageFrm*>(pPg->GetPrev()); if ( !pPg || pPg == pNew ) pPg = FindPageFrm(); @@ -1093,7 +1093,7 @@ bool SwFlowFrm::IsPageBreak( bool bAct ) const // Determine predecessor const SwFrm *pPrev = m_rThis.FindPrev(); while ( pPrev && ( !pPrev->IsInDocBody() || - ( pPrev->IsTxtFrm() && ((SwTxtFrm*)pPrev)->IsHiddenNow() ) ) ) + ( pPrev->IsTxtFrm() && static_cast<const SwTxtFrm*>(pPrev)->IsHiddenNow() ) ) ) pPrev = pPrev->FindPrev(); if ( pPrev ) @@ -1147,7 +1147,7 @@ bool SwFlowFrm::IsColBreak( bool bAct ) const // Determine predecessor const SwFrm *pPrev = m_rThis.FindPrev(); while( pPrev && ( ( !pPrev->IsInDocBody() && !m_rThis.IsInFly() ) || - ( pPrev->IsTxtFrm() && ((SwTxtFrm*)pPrev)->IsHiddenNow() ) ) ) + ( pPrev->IsTxtFrm() && static_cast<const SwTxtFrm*>(pPrev)->IsHiddenNow() ) ) ) pPrev = pPrev->FindPrev(); if ( pPrev ) @@ -1187,7 +1187,7 @@ bool SwFlowFrm::HasParaSpaceAtPages( bool bSct ) const { if( pTmp->IsCellFrm() || pTmp->IsFlyFrm() || pTmp->IsFooterFrm() || pTmp->IsHeaderFrm() || - ( pTmp->IsFtnFrm() && !((SwFtnFrm*)pTmp)->GetMaster() ) ) + ( pTmp->IsFtnFrm() && !static_cast<const SwFtnFrm*>(pTmp)->GetMaster() ) ) return true; if( pTmp->IsPageFrm() ) return !( pTmp->GetPrev() && !IsPageBreak(true) ); @@ -1298,14 +1298,14 @@ static bool lcl_IdenticalStyles(const SwFrm* pPrevFrm, const SwFrm* pFrm) SwTxtFmtColl *pPrevFmtColl = 0; if (pPrevFrm && pPrevFrm->IsTxtFrm()) { - SwTxtFrm *pTxtFrm = ( SwTxtFrm * ) pPrevFrm; + const SwTxtFrm *pTxtFrm = static_cast< const SwTxtFrm * >( pPrevFrm ); pPrevFmtColl = dynamic_cast<SwTxtFmtColl*>(pTxtFrm->GetTxtNode()->GetFmtColl()); } bool bIdenticalStyles = false; if (pFrm && pFrm->IsTxtFrm()) { - SwTxtFrm *pTxtFrm = ( SwTxtFrm * ) pFrm; + const SwTxtFrm *pTxtFrm = static_cast< const SwTxtFrm * >( pFrm ); SwTxtFmtColl *pFmtColl = dynamic_cast<SwTxtFmtColl*>(pTxtFrm->GetTxtNode()->GetFmtColl()); bIdenticalStyles = pPrevFmtColl == pFmtColl; } @@ -1338,7 +1338,7 @@ SwTwips SwFlowFrm::CalcUpperSpace( const SwBorderAttrs *pAttrs, { if( m_rThis.IsSctFrm() ) { - SwSectionFrm* pFoll = &((SwSectionFrm&)m_rThis); + SwSectionFrm* pFoll = &static_cast<SwSectionFrm&>(m_rThis); do pOwn = pFoll->ContainsAny(); while( !pOwn && 0 != ( pFoll = pFoll->GetFollow() ) ); @@ -1424,7 +1424,7 @@ SwTwips SwFlowFrm::CalcUpperSpace( const SwBorderAttrs *pAttrs, { // former consideration if ( pOwn->IsTxtFrm() ) - nUpper = std::max( nUpper, ((SwTxtFrm*)pOwn)->GetLineSpace() ); + nUpper = std::max( nUpper, static_cast<SwTxtFrm*>(pOwn)->GetLineSpace() ); if ( nPrevLineSpacing != 0 ) { nUpper = std::max( nUpper, nPrevLineSpacing ); @@ -1696,15 +1696,15 @@ bool SwFlowFrm::CheckMoveFwd( bool& rbMakePage, bool bKeep, bool ) const SwFrm* pNxt = m_rThis.GetIndNext(); if ( bKeep && //!bMovedBwd && - ( !pNxt || ( pNxt->IsTxtFrm() && ((SwTxtFrm*)pNxt)->IsEmptyMaster() ) ) && + ( !pNxt || ( pNxt->IsTxtFrm() && static_cast<const SwTxtFrm*>(pNxt)->IsEmptyMaster() ) ) && ( 0 != (pNxt = m_rThis.FindNext()) ) && IsKeepFwdMoveAllowed() ) { if( pNxt->IsSctFrm() ) { // Don't get fooled by empty SectionFrms const SwFrm* pTmp = NULL; while( pNxt && pNxt->IsSctFrm() && - ( !((SwSectionFrm*)pNxt)->GetSection() || - 0 == ( pTmp = ((SwSectionFrm*)pNxt)->ContainsAny() ) ) ) + ( !static_cast<const SwSectionFrm*>(pNxt)->GetSection() || + 0 == ( pTmp = static_cast<const SwSectionFrm*>(pNxt)->ContainsAny() ) ) ) { pNxt = pNxt->FindNext(); pTmp = NULL; @@ -1781,7 +1781,7 @@ bool SwFlowFrm::MoveFwd( bool bMakePage, bool bPageBreak, bool bMoveAlways ) //!!!!MoveFtnCntFwd might need to be updated as well. SwFtnBossFrm *pOldBoss = m_rThis.FindFtnBossFrm(); if ( m_rThis.IsInFtn() ) - return ((SwCntntFrm&)m_rThis).MoveFtnCntFwd( bMakePage, pOldBoss ); + return static_cast<SwCntntFrm&>(m_rThis).MoveFtnCntFwd( bMakePage, pOldBoss ); if( !IsFwdMoveAllowed() && !bMoveAlways ) { @@ -1877,11 +1877,11 @@ bool SwFlowFrm::MoveFwd( bool bMakePage, bool bPageBreak, bool bMoveAlways ) SwSaveFtnHeight aHeight( pOldBoss, (pOldBoss->Frm().*fnRect->fnGetBottom)() ); SwCntntFrm* pStart = m_rThis.IsCntntFrm() ? - (SwCntntFrm*)&m_rThis : ((SwLayoutFrm&)m_rThis).ContainsCntnt(); - OSL_ENSURE( pStart || ( m_rThis.IsTabFrm() && !((SwTabFrm&)m_rThis).Lower() ), + static_cast<SwCntntFrm*>(&m_rThis) : static_cast<SwLayoutFrm&>(m_rThis).ContainsCntnt(); + OSL_ENSURE( pStart || ( m_rThis.IsTabFrm() && !static_cast<SwTabFrm&>(m_rThis).Lower() ), "MoveFwd: Missing Content" ); SwLayoutFrm* pBody = pStart ? ( pStart->IsTxtFrm() ? - (SwLayoutFrm*)((SwTxtFrm*)pStart)->FindBodyFrm() : 0 ) : 0; + (SwLayoutFrm*)static_cast<SwTxtFrm*>(pStart)->FindBodyFrm() : 0 ) : 0; if( pBody ) bFtnMoved = pBody->MoveLowerFtns( pStart, pOldBoss, pNewBoss, false); @@ -2048,7 +2048,7 @@ bool SwFlowFrm::MoveBwd( bool &rbReformat ) long nDiff = pOldPage->GetPhyPageNum() - pFlow->GetPhyPageNum(); if ( nDiff > 1 ) { - if ( ((SwPageFrm*)pOldPage->GetPrev())->IsEmptyPage() ) + if ( static_cast<SwPageFrm*>(pOldPage->GetPrev())->IsEmptyPage() ) nDiff -= 1; if ( nDiff > 1 ) { @@ -2159,8 +2159,8 @@ bool SwFlowFrm::MoveBwd( bool &rbReformat ) { // ColumnFrms now with BodyFrm SwLayoutFrm* pColBody = pCol->IsColumnFrm() ? - (SwLayoutFrm*)((SwLayoutFrm*)pCol)->Lower() : - (SwLayoutFrm*)pCol; + const_cast<SwLayoutFrm*>(static_cast<const SwLayoutFrm*>(static_cast<const SwLayoutFrm*>(pCol)->Lower())) : + const_cast<SwLayoutFrm*>(static_cast<const SwLayoutFrm*>(pCol)); if ( pColBody->ContainsCntnt() ) { bGoOn = false; // We have content here! we accept this @@ -2411,11 +2411,11 @@ bool SwFlowFrm::MoveBwd( bool &rbReformat ) while( pTmp->GetNext() ) pTmp = pTmp->GetNext(); if( !pTmp->IsSctFrm() || - ((SwSectionFrm*)pTmp)->GetFollow() != pSct ) + static_cast<SwSectionFrm*>(pTmp)->GetFollow() != pSct ) pTmp = NULL; } if( pTmp ) - pNewUpper = (SwSectionFrm*)pTmp; + pNewUpper = static_cast<SwSectionFrm*>(pTmp); else { pSct = new SwSectionFrm( *pSct, true ); @@ -2480,7 +2480,7 @@ bool SwFlowFrm::MoveBwd( bool &rbReformat ) { SwPageFrm* pStartPage = bCheckPageDescOfNextPage ? pNewPage : - (SwPageFrm*)pNewPage->GetNext(); + static_cast<SwPageFrm*>(pNewPage->GetNext()); SwFrm::CheckPageDescs( pStartPage, false); } else if ( m_rThis.GetAttrSet()->GetPageDesc().GetPageDesc() ) @@ -2498,22 +2498,22 @@ bool SwFlowFrm::MoveBwd( bool &rbReformat ) SwFlowFrm *SwFlowFrm::CastFlowFrm( SwFrm *pFrm ) { if ( pFrm->IsCntntFrm() ) - return (SwCntntFrm*)pFrm; + return static_cast<SwCntntFrm*>(pFrm); if ( pFrm->IsTabFrm() ) - return (SwTabFrm*)pFrm; + return static_cast<SwTabFrm*>(pFrm); if ( pFrm->IsSctFrm() ) - return (SwSectionFrm*)pFrm; + return static_cast<SwSectionFrm*>(pFrm); return 0; } const SwFlowFrm *SwFlowFrm::CastFlowFrm( const SwFrm *pFrm ) { if ( pFrm->IsCntntFrm() ) - return (SwCntntFrm*)pFrm; + return static_cast<const SwCntntFrm*>(pFrm); if ( pFrm->IsTabFrm() ) - return (SwTabFrm*)pFrm; + return static_cast<const SwTabFrm*>(pFrm); if ( pFrm->IsSctFrm() ) - return (SwSectionFrm*)pFrm; + return static_cast<const SwSectionFrm*>(pFrm); return 0; } diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index 4ca1f0ad97e9..554144b884a7 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -90,7 +90,7 @@ SwFlyFrm::SwFlyFrm( SwFlyFrmFmt *pFmt, SwFrm* pSib, SwFrm *pAnch ) : // Size setting: Fixed size is always the width const SwFmtFrmSize &rFrmSize = pFmt->GetFrmSize(); const sal_uInt16 nDir = - ((SvxFrameDirectionItem&)pFmt->GetFmtAttr( RES_FRAMEDIR )).GetValue(); + static_cast<const SvxFrameDirectionItem&>(pFmt->GetFmtAttr( RES_FRAMEDIR )).GetValue(); if( FRMDIR_ENVIRONMENT == nDir ) { mbDerivedVert = true; @@ -196,8 +196,8 @@ void SwFlyFrm::InsertCnt() const SwFmtCntnt& rCntnt = GetFmt()->GetCntnt(); OSL_ENSURE( rCntnt.GetCntntIdx(), ":-( no content prepared." ); sal_uLong nIndex = rCntnt.GetCntntIdx()->GetIndex(); - // Lower() means SwColumnFrm; the Content then needs to be instered into the (Column)BodyFrm - ::_InsertCnt( Lower() ? (SwLayoutFrm*)((SwLayoutFrm*)Lower())->Lower() : (SwLayoutFrm*)this, + // 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, GetFmt()->GetDoc(), nIndex ); // NoTxt always have a fixed height. @@ -436,7 +436,7 @@ void SwFlyFrm::FinitDrawObj() // as the Object was already removed if( pSh->HasDrawView() ) pSh->Imp()->GetDrawView()->UnmarkAll(); - pSh = (SwViewShell*)pSh->GetNext(); + pSh = static_cast<SwViewShell*>(pSh->GetNext()); } while ( pSh != p1St ); } @@ -555,8 +555,8 @@ void SwFlyFrm::UnchainFrames( SwFlyFrm *pMaster, SwFlyFrm *pFollow ) OSL_ENSURE( rCntnt.GetCntntIdx(), ":-( No content prepared." ); sal_uLong nIndex = rCntnt.GetCntntIdx()->GetIndex(); // Lower() means SwColumnFrm: this one contains another SwBodyFrm - ::_InsertCnt( pFollow->Lower() ? (SwLayoutFrm*)((SwLayoutFrm*)pFollow->Lower())->Lower() - : (SwLayoutFrm*)pFollow, + ::_InsertCnt( pFollow->Lower() ? const_cast<SwLayoutFrm*>(static_cast<const SwLayoutFrm*>(static_cast<const SwLayoutFrm*>(pFollow->Lower())->Lower())) + : static_cast<SwLayoutFrm*>(pFollow), pFollow->GetFmt()->GetDoc(), ++nIndex ); // invalidate accessible relation set (accessibility wrapper) @@ -683,10 +683,10 @@ void SwFlyFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew ) if (pNew && pOld && RES_ATTRSET_CHG == pNew->Which()) { - SfxItemIter aNIter( *((SwAttrSetChg*)pNew)->GetChgSet() ); - SfxItemIter aOIter( *((SwAttrSetChg*)pOld)->GetChgSet() ); - SwAttrSetChg aOldSet( *(SwAttrSetChg*)pOld ); - SwAttrSetChg aNewSet( *(SwAttrSetChg*)pNew ); + SfxItemIter aNIter( *static_cast<const SwAttrSetChg*>(pNew)->GetChgSet() ); + SfxItemIter aOIter( *static_cast<const SwAttrSetChg*>(pOld)->GetChgSet() ); + SwAttrSetChg aOldSet( *static_cast<const SwAttrSetChg*>(pOld) ); + SwAttrSetChg aNewSet( *static_cast<const SwAttrSetChg*>(pNew) ); while( true ) { _UpdateAttr( (SfxPoolItem*)aOIter.GetCurItem(), @@ -784,7 +784,7 @@ void SwFlyFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew, if ( Lower() && Lower()->IsNoTxtFrm() && !GetFmt()->GetSurround().IsContour() ) { - SwNoTxtNode *pNd = (SwNoTxtNode*)((SwCntntFrm*)Lower())->GetNode(); + SwNoTxtNode *pNd = static_cast<SwNoTxtNode*>(static_cast<SwCntntFrm*>(Lower())->GetNode()); if ( pNd->HasContour() ) pNd->SetContour( 0 ); } @@ -797,7 +797,7 @@ void SwFlyFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew, case RES_PROTECT: if (pNew) { - const SvxProtectItem *pP = (SvxProtectItem*)pNew; + const SvxProtectItem *pP = static_cast<const SvxProtectItem*>(pNew); GetVirtDrawObj()->SetMoveProtect( pP->IsPosProtected() ); GetVirtDrawObj()->SetResizeProtect( pP->IsSizeProtected() ); if( pSh ) @@ -811,7 +811,7 @@ void SwFlyFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew, case RES_COL: if (pOld && pNew) { - ChgColumns( *(const SwFmtCol*)pOld, *(const SwFmtCol*)pNew ); + ChgColumns( *static_cast<const SwFmtCol*>(pOld), *static_cast<const SwFmtCol*>(pNew) ); const SwFmtFrmSize &rNew = GetFmt()->GetFrmSize(); if ( FrmSizeChg( rNew ) ) NotifyDrawObj(); @@ -830,10 +830,10 @@ void SwFlyFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew, { SwRect aNew( GetObjRectWithSpaces() ); SwRect aOld( maFrm ); - const SvxULSpaceItem &rUL = ((SwFmtChg*)pOld)->pChangedFmt->GetULSpace(); + const SvxULSpaceItem &rUL = static_cast<const SwFmtChg*>(pOld)->pChangedFmt->GetULSpace(); aOld.Top( std::max( aOld.Top() - long(rUL.GetUpper()), 0L ) ); aOld.SSize().Height()+= rUL.GetLower(); - const SvxLRSpaceItem &rLR = ((SwFmtChg*)pOld)->pChangedFmt->GetLRSpace(); + const SvxLRSpaceItem &rLR = static_cast<const SwFmtChg*>(pOld)->pChangedFmt->GetLRSpace(); aOld.Left ( std::max( aOld.Left() - long(rLR.GetLeft()), 0L ) ); aOld.SSize().Width() += rLR.GetRight(); aNew.Union( aOld ); @@ -862,9 +862,9 @@ void SwFlyFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew, SwFmtFrmSize *pNewFmtFrmSize = NULL; SwFmtChg *pOldFmtChg = NULL; if (nWhich == RES_FRM_SIZE) - pNewFmtFrmSize = (SwFmtFrmSize*)pNew; + pNewFmtFrmSize = const_cast<SwFmtFrmSize*>(static_cast<const SwFmtFrmSize*>(pNew)); else - pOldFmtChg = (SwFmtChg*)pOld; + pOldFmtChg = const_cast<SwFmtChg*>(static_cast<const SwFmtChg*>(pOld)); if (aURL.GetMap() && (pNewFmtFrmSize || pOldFmtChg)) { @@ -902,14 +902,14 @@ void SwFlyFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew, if( Lower()->IsNoTxtFrm() && !GetFmt()->GetSurround().IsContour() ) { - SwNoTxtNode *pNd = (SwNoTxtNode*)((SwCntntFrm*)Lower())->GetNode(); + SwNoTxtNode *pNd = static_cast<SwNoTxtNode*>(static_cast<SwCntntFrm*>(Lower())->GetNode()); if ( pNd->HasContour() ) pNd->SetContour( 0 ); } else if( !Lower()->IsColumnFrm() ) { SwFrm* pFrm = GetLastLower(); - if( pFrm->IsTxtFrm() && ((SwTxtFrm*)pFrm)->IsUndersized() ) + if( pFrm->IsTxtFrm() && static_cast<SwTxtFrm*>(pFrm)->IsUndersized() ) pFrm->Prepare( PREP_ADJUST_FRM ); } } @@ -932,13 +932,13 @@ void SwFlyFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew, { if ( RES_UL_SPACE == nWhich ) { - const SvxULSpaceItem &rUL = *(SvxULSpaceItem*)pNew; + const SvxULSpaceItem &rUL = *static_cast<const SvxULSpaceItem*>(pNew); aOld.Top( std::max( aOld.Top() - long(rUL.GetUpper()), 0L ) ); aOld.SSize().Height()+= rUL.GetLower(); } else { - const SvxLRSpaceItem &rLR = *(SvxLRSpaceItem*)pNew; + const SvxLRSpaceItem &rLR = *static_cast<const SvxLRSpaceItem*>(pNew); aOld.Left ( std::max( aOld.Left() - long(rLR.GetLeft()), 0L ) ); aOld.SSize().Width() += rLR.GetRight(); } @@ -972,7 +972,7 @@ void SwFlyFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew, pSh->InvalidateWindows( Frm() ); const IDocumentDrawModelAccess* pIDDMA = GetFmt()->getIDocumentDrawModelAccess(); - const sal_uInt8 nId = ((SvxOpaqueItem*)pNew)->GetValue() ? + const sal_uInt8 nId = static_cast<const SvxOpaqueItem*>(pNew)->GetValue() ? pIDDMA->GetHeavenId() : pIDDMA->GetHellId(); GetVirtDrawObj()->SetLayer( nId ); @@ -995,7 +995,7 @@ void SwFlyFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew, // The interface changes the frame size when interacting with text frames, // the Map, however, needs to be relative to FrmSize(). if ( (!Lower() || !Lower()->IsNoTxtFrm()) && pNew && pOld && - ((SwFmtURL*)pNew)->GetMap() && ((SwFmtURL*)pOld)->GetMap() ) + static_cast<const SwFmtURL*>(pNew)->GetMap() && static_cast<const SwFmtURL*>(pOld)->GetMap() ) { const SwFmtFrmSize &rSz = GetFmt()->GetFrmSize(); if ( rSz.GetHeight() != Frm().Height() || @@ -1017,7 +1017,7 @@ void SwFlyFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew, case RES_CHAIN: if (pNew) { - SwFmtChain *pChain = (SwFmtChain*)pNew; + const SwFmtChain *pChain = static_cast<const SwFmtChain*>(pNew); if ( pChain->GetNext() ) { SwFlyFrm *pFollow = FindChainNeighbour( *pChain->GetNext() ); @@ -1127,7 +1127,7 @@ void SwFlyFrm::ChgRelPos( const Point &rNewPos ) RES_VERT_ORIENT, RES_HORI_ORIENT); SwFmtVertOrient aVert( pFmt->GetVertOrient() ); - SwTxtFrm *pAutoFrm = NULL; + const SwTxtFrm *pAutoFrm = NULL; // #i34948# - handle also at-page and at-fly anchored // Writer fly frames const RndStdIds eAnchorType = GetFrmFmt().GetAnchor().GetAnchorId(); @@ -1151,7 +1151,7 @@ void SwFlyFrm::ChgRelPos( const Point &rNewPos ) sal_Int32 nOfs = pFmt->GetAnchor().GetCntntAnchor()->nContent.GetIndex(); OSL_ENSURE( GetAnchorFrm()->IsTxtFrm(), "TxtFrm expected" ); - pAutoFrm = (SwTxtFrm*)GetAnchorFrm(); + pAutoFrm = static_cast<const SwTxtFrm*>(GetAnchorFrm()); while( pAutoFrm->GetFollow() && pAutoFrm->GetFollow()->GetOfst() <= nOfs ) { @@ -1160,7 +1160,7 @@ void SwFlyFrm::ChgRelPos( const Point &rNewPos ) nTmpY -= pAutoFrm->GetUpper()->Prt().Height(); pAutoFrm = pAutoFrm->GetFollow(); } - nTmpY = ((SwFlyAtCntFrm*)this)->GetRelCharY(pAutoFrm)-nTmpY; + nTmpY = static_cast<SwFlyAtCntFrm*>(this)->GetRelCharY(pAutoFrm)-nTmpY; } else aVert.SetVertOrient( text::VertOrientation::CHAR_BOTTOM ); @@ -1207,12 +1207,12 @@ void SwFlyFrm::ChgRelPos( const Point &rNewPos ) sal_Int32 nOfs = pFmt->GetAnchor().GetCntntAnchor() ->nContent.GetIndex(); OSL_ENSURE( GetAnchorFrm()->IsTxtFrm(), "TxtFrm expected"); - pAutoFrm = (SwTxtFrm*)GetAnchorFrm(); + pAutoFrm = static_cast<const SwTxtFrm*>(GetAnchorFrm()); while( pAutoFrm->GetFollow() && pAutoFrm->GetFollow()->GetOfst() <= nOfs ) pAutoFrm = pAutoFrm->GetFollow(); } - nTmpX -= ((SwFlyAtCntFrm*)this)->GetRelCharX(pAutoFrm); + nTmpX -= static_cast<SwFlyAtCntFrm*>(this)->GetRelCharX(pAutoFrm); } } else @@ -1378,7 +1378,7 @@ void CalcCntnt( SwLayoutFrm *pLay, bool bCollect = false; if( pLay->IsSctFrm() ) { - pSect = (SwSectionFrm*)pLay; + pSect = static_cast<SwSectionFrm*>(pLay); if( pSect->IsEndnAtEnd() && !bNoColl ) { bCollect = true; @@ -1442,14 +1442,14 @@ void CalcCntnt( SwLayoutFrm *pLay, if ( pFrm->IsTabFrm() ) { - ((SwTabFrm*)pFrm)->bCalcLowers = true; + static_cast<SwTabFrm*>(pFrm)->bCalcLowers = true; // OD 26.08.2003 #i18103# - lock move backward of follow table, // if no section content is formatted or follow table belongs // to the section, which content is formatted. - if ( ((SwTabFrm*)pFrm)->IsFollow() && + if ( static_cast<SwTabFrm*>(pFrm)->IsFollow() && ( !pSect || pSect == pFrm->FindSctFrm() ) ) { - ((SwTabFrm*)pFrm)->bLockBackMove = true; + static_cast<SwTabFrm*>(pFrm)->bLockBackMove = true; } } @@ -1615,23 +1615,23 @@ void CalcCntnt( SwLayoutFrm *pLay, } if ( pFrm->IsTabFrm() ) { - if ( ((SwTabFrm*)pFrm)->IsFollow() ) - ((SwTabFrm*)pFrm)->bLockBackMove = false; + if ( static_cast<SwTabFrm*>(pFrm)->IsFollow() ) + static_cast<SwTabFrm*>(pFrm)->bLockBackMove = false; } pFrm = bPrevInvalid ? pTmpPrev : pFrm->FindNext(); if( !bPrevInvalid && pFrm && pFrm->IsSctFrm() && pSect ) { // Empty SectionFrms could be present here - while( pFrm && pFrm->IsSctFrm() && !((SwSectionFrm*)pFrm)->GetSection() ) + while( pFrm && pFrm->IsSctFrm() && !static_cast<SwSectionFrm*>(pFrm)->GetSection() ) pFrm = pFrm->FindNext(); // If FindNext returns the Follow of the original Area, we want to // continue with this content as long as it flows back. if( pFrm && pFrm->IsSctFrm() && ( pFrm == pSect->GetFollow() || - ((SwSectionFrm*)pFrm)->IsAnFollow( pSect ) ) ) + static_cast<SwSectionFrm*>(pFrm)->IsAnFollow( pSect ) ) ) { - pFrm = ((SwSectionFrm*)pFrm)->ContainsAny(); + pFrm = static_cast<SwSectionFrm*>(pFrm)->ContainsAny(); if( pFrm ) pFrm->_InvalidatePos(); } @@ -1828,7 +1828,7 @@ SwTwips SwFlyFrm::_Grow( SwTwips nDist, bool bTst ) bFormatHeightOnly = true; } static_cast<SwFlyFreeFrm*>(this)->SetNoMoveOnCheckClip( true ); - ((SwFlyFreeFrm*)this)->SwFlyFreeFrm::MakeAll(); + static_cast<SwFlyFreeFrm*>(this)->SwFlyFreeFrm::MakeAll(); static_cast<SwFlyFreeFrm*>(this)->SetNoMoveOnCheckClip( false ); // #i55416# if ( rFrmSz.GetWidthSizeType() != ATT_FIX_SIZE ) @@ -1923,7 +1923,7 @@ SwTwips SwFlyFrm::_Shrink( SwTwips nDist, bool bTst ) bFormatHeightOnly = true; } static_cast<SwFlyFreeFrm*>(this)->SetNoMoveOnCheckClip( true ); - ((SwFlyFreeFrm*)this)->SwFlyFreeFrm::MakeAll(); + static_cast<SwFlyFreeFrm*>(this)->SwFlyFreeFrm::MakeAll(); static_cast<SwFlyFreeFrm*>(this)->SetNoMoveOnCheckClip( false ); // #i55416# if ( rFrmSz.GetWidthSizeType() != ATT_FIX_SIZE ) @@ -1999,7 +1999,7 @@ bool SwFlyFrm::IsLowerOf( const SwLayoutFrm* pUpperFrm ) const if ( pFrm == pUpperFrm ) return true; pFrm = pFrm->IsFlyFrm() - ? ((const SwFlyFrm*)pFrm)->GetAnchorFrm() + ? static_cast<const SwFlyFrm*>(pFrm)->GetAnchorFrm() : pFrm->GetUpper(); } while ( pFrm ); return false; @@ -2389,21 +2389,21 @@ static SwTwips lcl_CalcAutoWidth( const SwLayoutFrm& rFrm ) { if ( pFrm->IsSctFrm() ) { - nMin = lcl_CalcAutoWidth( *(SwSectionFrm*)pFrm ); + nMin = lcl_CalcAutoWidth( *static_cast<const SwSectionFrm*>(pFrm) ); } if ( pFrm->IsTxtFrm() ) { - nMin = ((SwTxtFrm*)pFrm)->CalcFitToContent(); + nMin = const_cast<SwTxtFrm*>(static_cast<const SwTxtFrm*>(pFrm))->CalcFitToContent(); const SvxLRSpaceItem &rSpace = - ((SwTxtFrm*)pFrm)->GetTxtNode()->GetSwAttrSet().GetLRSpace(); - if (!((SwTxtFrm*)pFrm)->IsLocked()) + static_cast<const SwTxtFrm*>(pFrm)->GetTxtNode()->GetSwAttrSet().GetLRSpace(); + if (!static_cast<const SwTxtFrm*>(pFrm)->IsLocked()) nMin += rSpace.GetRight() + rSpace.GetTxtLeft() + rSpace.GetTxtFirstLineOfst(); } else if ( pFrm->IsTabFrm() ) { - const SwFmtFrmSize& rTblFmtSz = ((SwTabFrm*)pFrm)->GetTable()->GetFrmFmt()->GetFrmSize(); + const SwFmtFrmSize& rTblFmtSz = static_cast<const SwTabFrm*>(pFrm)->GetTable()->GetFrmFmt()->GetFrmSize(); if ( USHRT_MAX == rTblFmtSz.GetSize().Width() || - text::HoriOrientation::NONE == ((SwTabFrm*)pFrm)->GetFmt()->GetHoriOrient().GetHoriOrient() ) + text::HoriOrientation::NONE == static_cast<const SwTabFrm*>(pFrm)->GetFmt()->GetHoriOrient().GetHoriOrient() ) { const SwPageFrm* pPage = rFrm.FindPageFrm(); // auto width table |