diff options
author | Noel Grandin <noel@peralex.com> | 2014-11-18 12:55:42 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-11-19 13:19:37 +0200 |
commit | eb41a2ba205c6ac88e959f39bf0c45d2ee674150 (patch) | |
tree | 853b998ba60030224ca20a06d15ee22ffcf7d091 /sw/source/core | |
parent | 137886bb081c4d0e12677f2d8de96a9bf4ddad16 (diff) |
loplugin: cstylecast
Change-Id: I322c6f9cd106a0ac3ad5c67dd0d49660b608e079
Diffstat (limited to 'sw/source/core')
38 files changed, 308 insertions, 308 deletions
diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index a4e829d5ee31..583989166dc2 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -421,8 +421,8 @@ void SwSection::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) case RES_ATTRSET_CHG: if (pNew && pOld) { - SfxItemSet* pNewSet = ((SwAttrSetChg*)pNew)->GetChgSet(); - SfxItemSet* pOldSet = ((SwAttrSetChg*)pOld)->GetChgSet(); + SfxItemSet* pNewSet = const_cast<SwAttrSetChg*>(static_cast<const SwAttrSetChg*>(pNew))->GetChgSet(); + SfxItemSet* pOldSet = const_cast<SwAttrSetChg*>(static_cast<const SwAttrSetChg*>(pOld))->GetChgSet(); const SfxPoolItem* pItem; if( SfxItemState::SET == pNewSet->GetItemState( @@ -606,7 +606,7 @@ void SwSection::MakeChildLinksVisible( const SwSectionNode& rSectNd ) ::sfx2::SvBaseLink* pBLnk = &(*rLnks[ --n ]); if( pBLnk && !pBLnk->IsVisible() && pBLnk->ISA( SwBaseLink ) && - 0 != ( pNd = ((SwBaseLink*)pBLnk)->GetAnchor() ) ) + 0 != ( pNd = static_cast<SwBaseLink*>(pBLnk)->GetAnchor() ) ) { pNd = pNd->StartOfSectionNode(); // If it's a SectionNode const SwSectionNode* pParent; @@ -746,8 +746,8 @@ void SwSectionFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) case RES_ATTRSET_CHG: if (GetDepends() && pOld && pNew) { - SfxItemSet* pNewSet = ((SwAttrSetChg*)pNew)->GetChgSet(); - SfxItemSet* pOldSet = ((SwAttrSetChg*)pOld)->GetChgSet(); + SfxItemSet* pNewSet = const_cast<SwAttrSetChg*>(static_cast<const SwAttrSetChg*>(pNew))->GetChgSet(); + SfxItemSet* pOldSet = const_cast<SwAttrSetChg*>(static_cast<const SwAttrSetChg*>(pOld))->GetChgSet(); const SfxPoolItem *pItem; if( SfxItemState::SET == pNewSet->GetItemState( RES_PROTECT, false, &pItem )) @@ -780,7 +780,7 @@ void SwSectionFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) pNewSet->ClearItem( RES_END_AT_TXTEND ); pOldSet->ClearItem( RES_END_AT_TXTEND ); } - if( !((SwAttrSetChg*)pOld)->GetChgSet()->Count() ) + if( !static_cast<const SwAttrSetChg*>(pOld)->GetChgSet()->Count() ) return; } break; @@ -812,7 +812,7 @@ void SwSectionFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) case RES_OBJECTDYING: if( !GetDoc()->IsInDtor() && pOld && - ((SwPtrMsgPoolItem *)pOld)->pObject == (void*)GetRegisteredIn() ) + static_cast<const SwPtrMsgPoolItem *>(pOld)->pObject == (void*)GetRegisteredIn() ) { // My Parents will be destroyed, so get the Parent's Parent // and update @@ -824,8 +824,8 @@ void SwSectionFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) case RES_FMT_CHG: if( !GetDoc()->IsInDtor() && - ((SwFmtChg*)pNew)->pChangedFmt == (void*)GetRegisteredIn() && - ((SwFmtChg*)pNew)->pChangedFmt->IsA( TYPE( SwSectionFmt )) ) + static_cast<const SwFmtChg*>(pNew)->pChangedFmt == (void*)GetRegisteredIn() && + static_cast<const SwFmtChg*>(pNew)->pChangedFmt->IsA( TYPE( SwSectionFmt )) ) { // My Parent will be changed, thus I need to update SwFrmFmt::Modify( pOld, pNew ); // Rewire first! @@ -848,11 +848,11 @@ bool SwSectionFmt::GetInfo( SfxPoolItem& rInfo ) const switch( rInfo.Which() ) { case RES_FINDNEARESTNODE: - if( ((SwFmtPageDesc&)GetFmtAttr( RES_PAGEDESC )).GetPageDesc() ) + if( static_cast<const SwFmtPageDesc&>(GetFmtAttr( RES_PAGEDESC )).GetPageDesc() ) { const SwSectionNode* pNd = GetSectionNode(); if( pNd ) - ((SwFindNearestNode&)rInfo).CheckNode( *pNd ); + static_cast<SwFindNearestNode&>(rInfo).CheckNode( *pNd ); } return true; @@ -870,7 +870,7 @@ bool SwSectionFmt::GetInfo( SfxPoolItem& rInfo ) const pChild = aFormatIter.Next(); } } - ((SwPtrMsgPoolItem&)rInfo).pObject = pFrm; + static_cast<SwPtrMsgPoolItem&>(rInfo).pObject = pFrm; } return false; } @@ -1002,7 +1002,7 @@ void SwSectionFmt::UpdateParent() else if( !pSection && pLast->IsA( TYPE(SwSection) ) ) { - pSection = (SwSection*)pLast; + pSection = static_cast<SwSection*>(pLast); if( GetRegisteredIn() ) { const SwSection* pPS = GetParentSection(); @@ -1141,7 +1141,7 @@ static void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd ) if( pLnk && pLnk != &rUpdLnk && OBJECT_CLIENT_FILE == pLnk->GetObjType() && pLnk->ISA( SwBaseLink ) && - ( pBLink = (SwBaseLink*)pLnk )->IsInRange( rSectNd.GetIndex(), + ( pBLink = static_cast<SwBaseLink*>(pLnk) )->IsInRange( rSectNd.GetIndex(), rSectNd.EndOfSectionIndex() ) ) { // It's in the Section, so update. But only if it's not in the same File! @@ -1267,7 +1267,7 @@ static void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd ) sFilter, 0, pDoc->GetDocShell() ); if( nRet ) { - SwDoc* pSrcDoc = ((SwDocShell*)&xDocSh)->GetDoc(); + SwDoc* pSrcDoc = static_cast<SwDocShell*>(&xDocSh)->GetDoc(); eOldRedlineMode = pSrcDoc->getIDocumentRedlineAccess().GetRedlineMode(); pSrcDoc->getIDocumentRedlineAccess().SetRedlineMode( nsRedlineMode_t::REDLINE_SHOW_INSERT ); } @@ -1287,10 +1287,10 @@ static void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd ) if( SfxItemState::SET == xDocSh->GetMedium()->GetItemSet()-> GetItemState( SID_PASSWORD, false, &pItem ) ) rSection.SetLinkFilePassword( - ((SfxStringItem*)pItem)->GetValue() ); + static_cast<const SfxStringItem*>(pItem)->GetValue() ); } - SwDoc* pSrcDoc = ((SwDocShell*)&xDocSh)->GetDoc(); + SwDoc* pSrcDoc = static_cast<SwDocShell*>(&xDocSh)->GetDoc(); if( !sRange.isEmpty() ) { @@ -1298,8 +1298,8 @@ static void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd ) bool bRecursion = false; if( pSrcDoc == pDoc ) { - tools::SvRef<SwServerObject> refObj( (SwServerObject*) - pDoc->getIDocumentLinksAdministration().CreateLinkSource( sRange )); + tools::SvRef<SwServerObject> refObj( static_cast<SwServerObject*>( + pDoc->getIDocumentLinksAdministration().CreateLinkSource( sRange ))); if( refObj.Is() ) { bRecursion = refObj->IsLinkInServer( this ) || @@ -1378,8 +1378,8 @@ static void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd ) { if( 2 == nRet ) xDocSh->DoClose(); - else if( ((SwDocShell*)&xDocSh)->GetDoc() ) - ((SwDocShell*)&xDocSh)->GetDoc()->getIDocumentRedlineAccess().SetRedlineMode( + else if( static_cast<SwDocShell*>(&xDocSh)->GetDoc() ) + static_cast<SwDocShell*>(&xDocSh)->GetDoc()->getIDocumentRedlineAccess().SetRedlineMode( eOldRedlineMode ); } } diff --git a/sw/source/core/docnode/swbaslnk.cxx b/sw/source/core/docnode/swbaslnk.cxx index ddc3d1bf1ad1..f52e2854d77c 100644 --- a/sw/source/core/docnode/swbaslnk.cxx +++ b/sw/source/core/docnode/swbaslnk.cxx @@ -237,8 +237,8 @@ static void lcl_CallModify( SwGrfNode& rGrfNd, SfxPoolItem& rItem ) if( pLnk && OBJECT_CLIENT_GRF == pLnk->GetObjType() && pLnk->ISA( SwBaseLink ) && pLnk->GetObj() == GetObj() ) { - SwBaseLink* pBLink = (SwBaseLink*)pLnk; - SwGrfNode* pGrfNd = (SwGrfNode*)pBLink->pCntntNode; + SwBaseLink* pBLink = static_cast<SwBaseLink*>(pLnk); + SwGrfNode* pGrfNd = static_cast<SwGrfNode*>(pBLink->pCntntNode); if( pBLink != this && ( !bSwapIn || @@ -248,7 +248,7 @@ static void lcl_CallModify( SwGrfNode& rGrfNd, SfxPoolItem& rItem ) pBLink->DataChanged( rMimeType, rValue ); pBLink->bIgnoreDataChanged = true; - pGrfNd->SetGraphicArrived( ((SwGrfNode*)pCntntNode)-> + pGrfNd->SetGraphicArrived( static_cast<SwGrfNode*>(pCntntNode)-> IsGraphicArrived() ); // Adjust the Fly's graphic @@ -433,7 +433,7 @@ void SwBaseLink::Closed() { // Delete the connection if( pCntntNode->IsGrfNode() ) - ((SwGrfNode*)pCntntNode)->ReleaseLink(); + static_cast<SwGrfNode*>(pCntntNode)->ReleaseLink(); } SvBaseLink::Closed(); } @@ -465,7 +465,7 @@ const SwNode* SwBaseLink::GetAnchor() const bool SwBaseLink::IsRecursion( const SwBaseLink* pChkLnk ) const { - tools::SvRef<SwServerObject> aRef( (SwServerObject*)GetObj() ); + tools::SvRef<SwServerObject> aRef( static_cast<SwServerObject*>(GetObj()) ); if( aRef.Is() ) { // As it's a ServerObject, we query all contained Links diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index 825a1996c7e2..a8ee50e2cc48 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -104,7 +104,7 @@ SwFrmFmt *FindFrmFmt( SdrObject *pObj ) if ( pObj->ISA(SwVirtFlyDrawObj) ) { - pRetval = ((SwVirtFlyDrawObj*)pObj)->GetFmt(); + pRetval = static_cast<SwVirtFlyDrawObj*>(pObj)->GetFmt(); } else { @@ -165,7 +165,7 @@ bool IsMarqueeTextObj( const SdrObject& rObj ) SdrTextAniKind eTKind; return SdrInventor == rObj.GetObjInventor() && OBJ_TEXT == rObj.GetObjIdentifier() && - ( SDRTEXTANI_SCROLL == ( eTKind = ((SdrTextObj&)rObj).GetTextAniKind()) + ( SDRTEXTANI_SCROLL == ( eTKind = static_cast<const SdrTextObj&>(rObj).GetTextAniKind()) || SDRTEXTANI_ALTERNATE == eTKind || SDRTEXTANI_SLIDE == eTKind ); } @@ -562,7 +562,7 @@ bool CheckControlLayer( const SdrObject *pObj ) return true; if ( pObj->ISA( SdrObjGroup ) ) { - 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 ( ::CheckControlLayer( pLst->GetObj( i ) ) ) @@ -655,14 +655,14 @@ void SwDrawContact::GetTextObjectsFromFmt( std::list<SdrTextObj*>& rTextObjects, if( pSdrOElement && pSdrOElement->IsA( TYPE(SdrTextObj) ) && static_cast<SdrTextObj*>( pSdrOElement)->HasText() ) { - rTextObjects.push_back((SdrTextObj*) pSdrOElement); + rTextObjects.push_back(static_cast<SdrTextObj*>( pSdrOElement )); } } } else if( pSdrO->IsA( TYPE(SdrTextObj) ) && static_cast<SdrTextObj*>( pSdrO )->HasText() ) { - rTextObjects.push_back((SdrTextObj*) pSdrO); + rTextObjects.push_back(static_cast<SdrTextObj*>( pSdrO )); } } } @@ -991,7 +991,7 @@ void SwDrawContact::NotifyBackgrdOfAllVirtObjs( const Rectangle* pOldBoundRect ) SwRect aRect( pDrawVirtObj->GetAnchoredObj().GetObjRectWithSpaces() ); if (aRect.HasArea() && pPage) { - SwPageFrm* pPg = (SwPageFrm*)::FindPage( aRect, pPage ); + SwPageFrm* pPg = const_cast<SwPageFrm*>(static_cast<const SwPageFrm*>(::FindPage( aRect, pPage ))); if ( pPg ) ::Notify_Background( pDrawVirtObj, pPg, aRect, PREP_FLY_ARRIVE, true ); @@ -1019,7 +1019,7 @@ static void lcl_NotifyBackgroundOfObj( SwDrawContact& _rDrawContact, if( aOldRect.HasArea() ) { // #i34640# - determine correct page frame - SwPageFrm* pOldPageFrm = (SwPageFrm*)::FindPage( aOldRect, pPageFrm ); + SwPageFrm* pOldPageFrm = const_cast<SwPageFrm*>(static_cast<const SwPageFrm*>(::FindPage( aOldRect, pPageFrm ))); ::Notify_Background( &_rObj, pOldPageFrm, aOldRect, PREP_FLY_LEAVE, true); } @@ -1028,7 +1028,7 @@ static void lcl_NotifyBackgroundOfObj( SwDrawContact& _rDrawContact, SwRect aNewRect( pAnchoredObj->GetObjRectWithSpaces() ); if( aNewRect.HasArea() && pPageFrm ) { - pPageFrm = (SwPageFrm*)::FindPage( aNewRect, pPageFrm ); + pPageFrm = const_cast<SwPageFrm*>(static_cast<const SwPageFrm*>(::FindPage( aNewRect, pPageFrm ))); ::Notify_Background( &_rObj, pPageFrm, aNewRect, PREP_FLY_ARRIVE, true ); } @@ -1069,7 +1069,7 @@ void SwDrawContact::Changed( const SdrObject& rObj, { if ( pSh->Imp()->IsAction() || pSh->Imp()->IsIdleAction() ) pSh = 0; else - pSh = (SwViewShell*)pSh->GetNext(); + pSh = static_cast<SwViewShell*>(pSh->GetNext()); } while ( pSh && pSh != pOrg ); @@ -1502,11 +1502,11 @@ void SwDrawContact::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) RES_OPAQUE == nWhich || RES_WRAP_INFLUENCE_ON_OBJPOS == nWhich || ( RES_ATTRSET_CHG == nWhich && - ( SfxItemState::SET == ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState( + ( SfxItemState::SET == static_cast<const SwAttrSetChg*>(pNew)->GetChgSet()->GetItemState( RES_SURROUND, false ) || - SfxItemState::SET == ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState( + SfxItemState::SET == static_cast<const SwAttrSetChg*>(pNew)->GetChgSet()->GetItemState( RES_OPAQUE, false ) || - SfxItemState::SET == ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState( + SfxItemState::SET == static_cast<const SwAttrSetChg*>(pNew)->GetChgSet()->GetItemState( RES_WRAP_INFLUENCE_ON_OBJPOS, false ) ) ) ) { lcl_NotifyBackgroundOfObj( *this, *GetMaster(), 0L ); @@ -1518,15 +1518,15 @@ void SwDrawContact::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) // #i28701# - add attribute 'Follow text flow' RES_FOLLOW_TEXT_FLOW == nWhich || ( RES_ATTRSET_CHG == nWhich && - ( SfxItemState::SET == ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState( + ( SfxItemState::SET == static_cast<const SwAttrSetChg*>(pNew)->GetChgSet()->GetItemState( RES_LR_SPACE, false ) || - SfxItemState::SET == ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState( + SfxItemState::SET == static_cast<const SwAttrSetChg*>(pNew)->GetChgSet()->GetItemState( RES_UL_SPACE, false ) || - SfxItemState::SET == ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState( + SfxItemState::SET == static_cast<const SwAttrSetChg*>(pNew)->GetChgSet()->GetItemState( RES_HORI_ORIENT, false ) || - SfxItemState::SET == ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState( + SfxItemState::SET == static_cast<const SwAttrSetChg*>(pNew)->GetChgSet()->GetItemState( RES_VERT_ORIENT, false ) || - SfxItemState::SET == ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState( + SfxItemState::SET == static_cast<const SwAttrSetChg*>(pNew)->GetChgSet()->GetItemState( RES_FOLLOW_TEXT_FLOW, false ) ) ) ) { lcl_NotifyBackgroundOfObj( *this, *GetMaster(), 0L ); @@ -1650,7 +1650,7 @@ void SwDrawContact::RemoveMasterFromDrawPage() GetMaster()->SetUserCall( 0 ); if ( GetMaster()->IsInserted() ) { - ((SwFrmFmt*)GetRegisteredIn())->getIDocumentDrawModelAccess()->GetDrawModel()->GetPage(0)-> + static_cast<SwFrmFmt*>(GetRegisteredIn())->getIDocumentDrawModelAccess()->GetDrawModel()->GetPage(0)-> RemoveObject( GetMaster()->GetOrdNum() ); } } @@ -1730,7 +1730,7 @@ void SwDrawContact::ConnectToLayout( const SwFmtAnchor* pAnch ) return; } - SwFrmFmt* pDrawFrmFmt = (SwFrmFmt*)GetRegisteredIn(); + SwFrmFmt* pDrawFrmFmt = static_cast<SwFrmFmt*>(GetRegisteredIn()); if( !pDrawFrmFmt->getIDocumentLayoutAccess()->GetCurrentViewShell() ) return; @@ -1835,7 +1835,7 @@ void SwDrawContact::ConnectToLayout( const SwFmtAnchor* pAnch ) // (2) drawing object isn't a control object to be anchored // in header/footer. const bool bAdd = ( !pFrm->IsCntntFrm() || - !((SwCntntFrm*)pFrm)->IsFollow() ) && + !static_cast<SwCntntFrm*>(pFrm)->IsFollow() ) && ( !::CheckControlLayer( GetMaster() ) || !pFrm->FindFooterOrHeader() ); @@ -1914,7 +1914,7 @@ SwPageFrm* SwDrawContact::FindPage( const SwRect &rRect ) if ( !pPg && GetAnchorFrm() ) pPg = GetAnchorFrm()->FindPageFrm(); if ( pPg ) - pPg = (SwPageFrm*)::FindPage( rRect, pPg ); + pPg = const_cast<SwPageFrm*>(static_cast<const SwPageFrm*>(::FindPage( rRect, pPg ))); return pPg; } @@ -2034,7 +2034,7 @@ namespace sdr /// access to SwDrawVirtObj SwDrawVirtObj& GetSwDrawVirtObj() const { - return (SwDrawVirtObj&)mrObject; + return static_cast<SwDrawVirtObj&>(mrObject); } }; } // end of namespace contact diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx index 3f87623d14da..3228772a9b38 100644 --- a/sw/source/core/draw/dflyobj.cxx +++ b/sw/source/core/draw/dflyobj.cxx @@ -212,7 +212,7 @@ namespace drawinglayer { if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { - const SwVirtFlyDrawObjPrimitive& rCompare = (SwVirtFlyDrawObjPrimitive&)rPrimitive; + const SwVirtFlyDrawObjPrimitive& rCompare = static_cast<const SwVirtFlyDrawObjPrimitive&>(rPrimitive); return (&getSwVirtFlyDrawObj() == &rCompare.getSwVirtFlyDrawObj() && getOuterRange() == rCompare.getOuterRange()); @@ -274,7 +274,7 @@ namespace sdr /// access to SwVirtFlyDrawObj SwVirtFlyDrawObj& GetSwVirtFlyDrawObj() const { - return (SwVirtFlyDrawObj&)mrObject; + return static_cast<SwVirtFlyDrawObj&>(mrObject); } }; } // end of namespace contact @@ -601,7 +601,7 @@ void SwVirtFlyDrawObj::NbcMove(const Size& rSiz) //anchor must be set. Anchor and the new RelPos is calculated and //placed by the Fly itself. if( GetFlyFrm()->IsFlyAtCntFrm() ) - ((SwFlyAtCntFrm*)GetFlyFrm())->SetAbsPos( aNewPos ); + static_cast<SwFlyAtCntFrm*>(GetFlyFrm())->SetAbsPos( aNewPos ); else { const SwFrmFmt *pTmpFmt = GetFmt(); diff --git a/sw/source/core/draw/dpage.cxx b/sw/source/core/draw/dpage.cxx index 0ae7f16329d6..7e955e6a1080 100644 --- a/sw/source/core/draw/dpage.cxx +++ b/sw/source/core/draw/dpage.cxx @@ -67,8 +67,8 @@ SdrObject* SwDPage::ReplaceObject( SdrObject* pNewObj, size_t nObjNum ) OSL_ENSURE( pOld, "Oups, Object not replaced" ); SdrObjUserCall* pContact; if ( 0 != ( pContact = GetUserCall(pOld) ) && - RES_DRAWFRMFMT == ((SwContact*)pContact)->GetFmt()->Which()) - ((SwDrawContact*)pContact)->ChangeMasterObject( pNewObj ); + RES_DRAWFRMFMT == static_cast<SwContact*>(pContact)->GetFmt()->Which()) + static_cast<SwDrawContact*>(pContact)->ChangeMasterObject( pNewObj ); return FmFormPage::ReplaceObject( pNewObj, nObjNum ); } @@ -86,7 +86,7 @@ const SdrPageGridFrameList* SwDPage::GetGridFrameList( { SwViewShell *pSh = static_cast< SwDrawModel* >(GetModel())->GetDoc().getIDocumentLayoutAccess().GetCurrentViewShell(); while (pSh && pSh->Imp()->GetPageView() != pPV) - pSh = (SwViewShell*)pSh->GetNext(); + pSh = static_cast<SwViewShell*>(pSh->GetNext()); if (pSh) { if ( pGridLst ) @@ -135,7 +135,7 @@ bool SwDPage::RequestHelp( vcl::Window* pWindow, SdrView* pView, if( pView->PickObj( aPos, 0, 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(); OUString sTxt; if( rURL.GetMap() ) diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx index dcdfe6ee8111..e0a75d25cc51 100644 --- a/sw/source/core/draw/dview.cxx +++ b/sw/source/core/draw/dview.cxx @@ -77,7 +77,7 @@ bool SwSdrHdl::IsFocusHdl() const static const SwFrm *lcl_FindAnchor( const SdrObject *pObj, bool bAll ) { const SwVirtFlyDrawObj *pVirt = pObj->ISA(SwVirtFlyDrawObj) ? - (SwVirtFlyDrawObj*)pObj : 0; + static_cast<const SwVirtFlyDrawObj*>(pObj) : 0; if ( pVirt ) { if ( bAll || !pVirt->GetFlyFrm()->IsFlyInCntFrm() ) @@ -85,7 +85,7 @@ static const SwFrm *lcl_FindAnchor( const SdrObject *pObj, bool bAll ) } else { - const SwDrawContact *pCont = (const SwDrawContact*)GetUserCall(pObj); + const SwDrawContact *pCont = static_cast<const SwDrawContact*>(GetUserCall(pObj)); if ( pCont ) return pCont->GetAnchorFrm( pObj ); } @@ -93,7 +93,7 @@ static const SwFrm *lcl_FindAnchor( const SdrObject *pObj, bool bAll ) } SwDrawView::SwDrawView( SwViewImp &rI, SdrModel *pMd, OutputDevice *pOutDev) : - FmFormView( (FmFormModel*)pMd, pOutDev ), + FmFormView( static_cast<FmFormModel*>(pMd), pOutDev ), rImp( rI ) { SetPageVisible( false ); @@ -681,12 +681,12 @@ const SwFrm* SwDrawView::CalcAnchor() const bool bFly = pObj->ISA(SwVirtFlyDrawObj); if ( bFly ) { - pAnch = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm()->GetAnchorFrm(); - aMyRect = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm()->Frm().SVRect(); + pAnch = static_cast<SwVirtFlyDrawObj*>(pObj)->GetFlyFrm()->GetAnchorFrm(); + aMyRect = static_cast<SwVirtFlyDrawObj*>(pObj)->GetFlyFrm()->Frm().SVRect(); } else { - SwDrawContact *pC = (SwDrawContact*)GetUserCall(pObj); + SwDrawContact *pC = static_cast<SwDrawContact*>(GetUserCall(pObj)); // determine correct anchor position for 'virtual' drawing objects. // #i26791# pAnch = pC->GetAnchorFrm( pObj ); @@ -724,13 +724,13 @@ const SwFrm* SwDrawView::CalcAnchor() // allow drawing objects in header/footer, // but exclude control objects. bool bBodyOnly = CheckControlLayer( pObj ); - pAnch = ::FindAnchor( (SwCntntFrm*)pAnch, aPt, bBodyOnly ); + pAnch = ::FindAnchor( static_cast<const SwCntntFrm*>(pAnch), aPt, bBodyOnly ); } else if ( !bFly ) { const SwRect aRect( aPt.getX(), aPt.getY(), 1, 1 ); - SwDrawContact* pContact = (SwDrawContact*)GetUserCall(pObj); + SwDrawContact* pContact = static_cast<SwDrawContact*>(GetUserCall(pObj)); if ( pContact->GetAnchorFrm( pObj ) && pContact->GetAnchorFrm( pObj )->IsPageFrm() ) pAnch = pContact->GetPageFrm(); @@ -823,13 +823,13 @@ void SwDrawView::CheckPossibilities() const SwFrm *pFrm = NULL; if ( pObj->ISA(SwVirtFlyDrawObj) ) { - const SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm(); + const SwFlyFrm *pFly = static_cast<const SwVirtFlyDrawObj*>(pObj)->GetFlyFrm(); if ( pFly ) { pFrm = pFly->GetAnchorFrm(); if ( pFly->Lower() && pFly->Lower()->IsNoTxtFrm() ) { - SwOLENode *pNd = ((SwCntntFrm*)pFly->Lower())->GetNode()->GetOLENode(); + SwOLENode *pNd = const_cast<SwCntntFrm*>(static_cast<const SwCntntFrm*>(pFly->Lower()))->GetNode()->GetOLENode(); if ( pNd ) { uno::Reference < embed::XEmbeddedObject > xObj = pNd->GetOLEObj().GetOleRef(); @@ -855,7 +855,7 @@ void SwDrawView::CheckPossibilities() } else { - SwDrawContact *pC = (SwDrawContact*)GetUserCall(pObj); + SwDrawContact *pC = static_cast<SwDrawContact*>(GetUserCall(pObj)); if ( pC ) pFrm = pC->GetAnchorFrm( pObj ); } diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx index 2b8d882ac7ba..b542a36b5a89 100644 --- a/sw/source/core/edit/autofmt.cxx +++ b/sw/source/core/edit/autofmt.cxx @@ -248,10 +248,10 @@ SwTxtFrm* SwAutoFormat::GetFrm( const SwTxtNode& rTxtNd ) const SwRect aTmpPrt( pFrm->Prt() ); pFrm->Calc(); if( pFrm->Frm() != aTmpFrm || pFrm->Prt() != aTmpPrt || - ( pFrm->IsTxtFrm() && !((SwTxtFrm*)pFrm)->Paint().IsEmpty() ) ) + ( pFrm->IsTxtFrm() && !const_cast<SwTxtFrm*>(static_cast<const SwTxtFrm*>(pFrm))->Paint().IsEmpty() ) ) pFrm->SetCompletePaint(); } - return ((SwTxtFrm*)pFrm)->GetFormatted(); + return const_cast<SwTxtFrm*>(static_cast<const SwTxtFrm*>(pFrm))->GetFormatted(); } void SwAutoFormat::_SetRedlineTxt( sal_uInt16 nActionId ) @@ -332,7 +332,7 @@ OUString SwAutoFormat::GoNextPara() ::SetProgressState( m_aNdIdx.GetIndex() + m_nEndNdIdx - m_aEndNdIdx.GetIndex(), m_pDoc->GetDocShell() ); - m_pCurTxtNd = (SwTxtNode*)pNewNd; + m_pCurTxtNd = static_cast<SwTxtNode*>(pNewNd); m_pCurTxtFrm = GetFrm( *m_pCurTxtNd ); return m_pCurTxtNd->GetTxt(); } @@ -1024,12 +1024,12 @@ bool SwAutoFormat::HasBreakAttr( const SwTxtNode& rTxtNd ) const const SfxPoolItem* pItem; if( SfxItemState::SET == pSet->GetItemState( RES_BREAK, false, &pItem ) - && SVX_BREAK_NONE != ((SvxFmtBreakItem*)pItem)->GetBreak() ) + && SVX_BREAK_NONE != static_cast<const SvxFmtBreakItem*>(pItem)->GetBreak() ) return true; if( SfxItemState::SET == pSet->GetItemState( RES_PAGEDESC, false, &pItem ) - && ((SwFmtPageDesc*)pItem)->GetPageDesc() - && nsUseOnPage::PD_NONE != ((SwFmtPageDesc*)pItem)->GetPageDesc()->GetUseOn() ) + && static_cast<const SwFmtPageDesc*>(pItem)->GetPageDesc() + && nsUseOnPage::PD_NONE != static_cast<const SwFmtPageDesc*>(pItem)->GetPageDesc()->GetUseOn() ) return true; return false; } @@ -1194,7 +1194,7 @@ void SwAutoFormat::DelMoreLinesBlanks( bool bWithLineBreaks ) SwPaM* pNxt; do { - pNxt = (SwPaM*)m_aDelPam.GetNext(); + pNxt = static_cast<SwPaM*>(m_aDelPam.GetNext()); if( pNxt->HasMark() && *pNxt->GetPoint() != *pNxt->GetMark() ) { bool bHasBlnks = HasSelBlanks( *pNxt ); diff --git a/sw/source/core/edit/edatmisc.cxx b/sw/source/core/edit/edatmisc.cxx index 1aa40b9be4a1..8f16eaf5fa7e 100644 --- a/sw/source/core/edit/edatmisc.cxx +++ b/sw/source/core/edit/edatmisc.cxx @@ -44,7 +44,7 @@ void SwEditShell::ResetAttr( const std::set<sal_uInt16> &attrs, SwPaM* pPaM ) SwPaM* pStartCrsr = pCrsr; do { GetDoc()->ResetAttrs(*pCrsr, true, attrs); - } while ( ( pCrsr = ( SwPaM* ) pCrsr->GetNext() ) != pStartCrsr ); + } while ( ( pCrsr = static_cast< SwPaM* >( pCrsr->GetNext() ) ) != pStartCrsr ); if( bUndoGroup ) { @@ -73,7 +73,7 @@ void SwEditShell::GCAttr() SwNode* pNd = &aIdx.GetNode(); do { if( pNd->IsTxtNode() ) - ((SwTxtNode*)pNd)->GCAttr(); + static_cast<SwTxtNode*>(pNd)->GCAttr(); } while( 0 != ( pNd = GetDoc()->GetNodes().GoNext( &aIdx )) && aIdx <= rEnd ); @@ -144,7 +144,7 @@ void SwEditShell::SetAttrSet( const SfxItemSet& rSet, sal_uInt16 nFlags, SwPaM* { GetDoc()->getIDocumentContentOperations().InsertItemSet(*pTmpCrsr, rSet, nFlags ); } - } while ( ( pTmpCrsr = (SwPaM*)pTmpCrsr->GetNext() ) != pStartPaM ); + } while ( ( pTmpCrsr = static_cast<SwPaM*>(pTmpCrsr->GetNext()) ) != pStartPaM ); GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_INSATTR, NULL); } diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx index 92f256937c91..3832048de6ab 100644 --- a/sw/source/core/edit/edattr.cxx +++ b/sw/source/core/edit/edattr.cxx @@ -141,14 +141,14 @@ bool SwEditShell::GetPaMAttr( SwPaM* pPaM, SfxItemSet& rSet, ? nEndCnt : pNd->GetTxtNode()->GetTxt().getLength(); - ((SwTxtNode*)pNd)->GetAttr( *pSet, nStt, nEnd, + static_cast<SwTxtNode*>(pNd)->GetAttr( *pSet, nStt, nEnd, false, true, bMergeIndentValuesOfNumRule ); } break; case ND_GRFNODE: case ND_OLENODE: - ((SwCntntNode*)pNd)->GetAttr( *pSet ); + static_cast<SwCntntNode*>(pNd)->GetAttr( *pSet ); break; default: @@ -166,7 +166,7 @@ bool SwEditShell::GetPaMAttr( SwPaM* pPaM, SfxItemSet& rSet, pSet = &aSet; } - } while ( ( pPaM = (SwPaM*)pPaM->GetNext() ) != pStartPaM ); + } while ( ( pPaM = static_cast<SwPaM*>(pPaM->GetNext()) ) != pStartPaM ); return true; } @@ -311,7 +311,7 @@ std::vector<const SfxPoolItem*> SwEditShell::GetCurItem( sal_uInt16 nWhich ) { case ND_TEXTNODE: { - SwTxtNode* pTxtNd = (SwTxtNode*) pNd; + SwTxtNode* pTxtNd = static_cast<SwTxtNode*>(pNd); const sal_Int32 nStt = (n == nSttNd) ? nSttCnt : 0; const sal_Int32 nEnd = (n == nEndNd) ? nEndCnt : pTxtNd->GetTxt().getLength(); @@ -371,7 +371,7 @@ std::vector<const SfxPoolItem*> SwEditShell::GetCurItem( sal_uInt16 nWhich ) pNd = 0; } } - } while ( ( pPaM = (SwPaM*)pPaM->GetNext() ) != pStartPaM ); + } while ( ( pPaM = static_cast<SwPaM*>(pPaM->GetNext()) ) != pStartPaM ); return vItem; } @@ -403,7 +403,7 @@ std::vector<SwPaM*> SwEditShell::GetSplitPaM( sal_uInt16 nWhich) { case ND_TEXTNODE: { - SwTxtNode* pTxtNd = (SwTxtNode*) pNd; + SwTxtNode* pTxtNd = static_cast<SwTxtNode*>(pNd); const sal_Int32 nStt = (n == nSttNd) ? nSttCnt : 0; const sal_Int32 nEnd = (n == nEndNd) ? nEndCnt : pTxtNd->GetTxt().getLength(); @@ -451,7 +451,7 @@ std::vector<SwPaM*> SwEditShell::GetSplitPaM( sal_uInt16 nWhich) pNd = 0; } } - } while ( ( pPaM = (SwPaM*)pPaM->GetNext() ) != pStartPaM ); + } while ( ( pPaM = static_cast<SwPaM*>(pPaM->GetNext()) ) != pStartPaM ); return vPaMs; } @@ -468,7 +468,7 @@ bool SwEditShell::GetCurFtn( SwFmtFtn* pFillFtn ) if( pFtn && pFillFtn ) { // Transfer data from the attribute - const SwFmtFtn &rFtn = ((SwTxtFtn*)pFtn)->GetFtn(); + const SwFmtFtn &rFtn = static_cast<SwTxtFtn*>(pFtn)->GetFtn(); pFillFtn->SetNumber( rFtn ); pFillFtn->SetEndNote( rFtn.IsEndNote() ); } @@ -485,7 +485,7 @@ bool SwEditShell::SetCurFtn( const SwFmtFtn& rFillFtn ) bChgd |= mpDoc->SetCurFtn( *pCrsr, rFillFtn.GetNumStr(), rFillFtn.GetNumber(), rFillFtn.IsEndNote() ); - } while( pFirst != ( pCrsr = (SwPaM*)pCrsr->GetNext() )); + } while( pFirst != ( pCrsr = static_cast<SwPaM*>(pCrsr->GetNext()) )); EndAllAction(); return bChgd; @@ -523,7 +523,7 @@ size_t SwEditShell::GetSeqFtnList( SwSeqFldList& rList, bool bEndNotes ) SwNodeIndex aIdx( *pIdx, 1 ); SwTxtNode* pTxtNd = aIdx.GetNode().GetTxtNode(); if( !pTxtNd ) - pTxtNd = (SwTxtNode*)mpDoc->GetNodes().GoNext( &aIdx ); + pTxtNd = static_cast<SwTxtNode*>(mpDoc->GetNodes().GoNext( &aIdx )); if( pTxtNd ) { @@ -548,8 +548,8 @@ bool SwEditShell::IsMoveLeftMargin( bool bRight, bool bModulus ) const { bool bRet = true; - const SvxTabStopItem& rTabItem = (SvxTabStopItem&)GetDoc()-> - GetDefault( RES_PARATR_TABSTOP ); + const SvxTabStopItem& rTabItem = static_cast<const SvxTabStopItem&>(GetDoc()-> + GetDefault( RES_PARATR_TABSTOP )); sal_uInt16 nDefDist = static_cast<sal_uInt16>(rTabItem.Count() ? rTabItem[0].GetTabPos() : 1134); if( !nDefDist ) return false; @@ -566,8 +566,8 @@ bool SwEditShell::IsMoveLeftMargin( bool bRight, bool bModulus ) const for( sal_uLong n = nSttNd; bRet && n <= nEndNd; ++n ) if( 0 != ( pCNd = GetDoc()->GetNodes()[ n ]->GetTxtNode() )) { - const SvxLRSpaceItem& rLS = (SvxLRSpaceItem&) - pCNd->GetAttr( RES_LR_SPACE ); + const SvxLRSpaceItem& rLS = static_cast<const SvxLRSpaceItem&>( + pCNd->GetAttr( RES_LR_SPACE )); if( bRight ) { long nNext = rLS.GetTxtLeft() + nDefDist; diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx index e925ae1bbbbc..3e4f06d0f5b2 100644 --- a/sw/source/core/edit/eddel.cxx +++ b/sw/source/core/edit/eddel.cxx @@ -272,7 +272,7 @@ long SwEditShell::Copy( SwEditShell* pDestShell ) == pCmp->GetCntntNode(false), "Mark in wrong Node" ); bool bTst = *pCmp->GetPoint() == *pCmp->GetMark(); (void) bTst; - } while( pDestShell->GetCrsr() != ( pCmp = (SwPaM*)pCmp->GetNext() ) ); + } while( pDestShell->GetCrsr() != ( pCmp = static_cast<SwPaM*>(pCmp->GetNext()) ) ); } #endif diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx index 4d703e939120..4c6ac6266dfd 100644 --- a/sw/source/core/edit/edfcol.cxx +++ b/sw/source/core/edit/edfcol.cxx @@ -107,7 +107,7 @@ void SwEditShell::FillByEx(SwTxtFmtColl* pColl, bool bReset) SfxItemState::SET == pSet->GetItemState( RES_PAGEDESC,false ) || ( SfxItemState::SET == pSet->GetItemState( RES_PARATR_NUMRULE, false, &pItem ) && 0 != (pRule = GetDoc()->FindNumRulePtr( - ((SwNumRuleItem*)pItem)->GetValue() )) && + static_cast<const SwNumRuleItem*>(pItem)->GetValue() )) && pRule && pRule->IsAutoRule() ) ) { @@ -117,7 +117,7 @@ void SwEditShell::FillByEx(SwTxtFmtColl* pColl, bool bReset) if( pRule || (SfxItemState::SET == pSet->GetItemState( RES_PARATR_NUMRULE, false, &pItem ) && 0 != (pRule = GetDoc()->FindNumRulePtr( - ((SwNumRuleItem*)pItem)->GetValue() )) && + static_cast<const SwNumRuleItem*>(pItem)->GetValue() )) && pRule && pRule->IsAutoRule() )) aSet.ClearItem( RES_PARATR_NUMRULE ); diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx index 5d070bfc22b9..0dbcb9296a16 100644 --- a/sw/source/core/edit/edfld.cxx +++ b/sw/source/core/edit/edfld.cxx @@ -225,23 +225,23 @@ static SwTxtFld* lcl_FindInputFld( SwDoc* pDoc, SwField& rFld ) pDoc->GetAttrPool().GetItemCount2( RES_TXTATR_INPUTFIELD ); for( sal_uInt32 n = 0; n < nMaxItems; ++n ) if( 0 != (pItem = pDoc->GetAttrPool().GetItem2( RES_TXTATR_INPUTFIELD, n ) ) - && ((SwFmtFld*)pItem)->GetField() == &rFld ) + && static_cast<const SwFmtFld*>(pItem)->GetField() == &rFld ) { - pTFld = ((SwFmtFld*)pItem)->GetTxtFld(); + pTFld = const_cast<SwFmtFld*>(static_cast<const SwFmtFld*>(pItem))->GetTxtFld(); break; } } else if( RES_SETEXPFLD == rFld.Which() - && ((SwSetExpField&)rFld).GetInputFlag() ) + && static_cast<SwSetExpField&>(rFld).GetInputFlag() ) { const SfxPoolItem* pItem = NULL; const sal_uInt32 nMaxItems = pDoc->GetAttrPool().GetItemCount2( RES_TXTATR_FIELD ); for( sal_uInt32 n = 0; n < nMaxItems; ++n ) if( 0 != (pItem = pDoc->GetAttrPool().GetItem2( RES_TXTATR_FIELD, n ) ) - && ((SwFmtFld*)pItem)->GetField() == &rFld ) + && static_cast<const SwFmtFld*>(pItem)->GetField() == &rFld ) { - pTFld = ((SwFmtFld*)pItem)->GetTxtFld(); + pTFld = const_cast<SwFmtFld*>(static_cast<const SwFmtFld*>(pItem))->GetTxtFld(); break; } } diff --git a/sw/source/core/edit/edfldexp.cxx b/sw/source/core/edit/edfldexp.cxx index 86e3a1b7e14d..1591cd253fa2 100644 --- a/sw/source/core/edit/edfldexp.cxx +++ b/sw/source/core/edit/edfldexp.cxx @@ -58,7 +58,7 @@ bool SwEditShell::IsFieldDataSourceAvailable(OUString& rUsedDataSource) const if(pFmtFld->IsFldInDoc()) { const SwDBData& rData = - ((SwDBFieldType*)pFmtFld->GetField()->GetTyp())->GetDBData(); + static_cast<SwDBFieldType*>(pFmtFld->GetField()->GetTyp())->GetDBData(); try { return xDBContext->getByName(rData.sDataSource).hasValue(); diff --git a/sw/source/core/edit/edfmt.cxx b/sw/source/core/edit/edfmt.cxx index 3f2f31a110d2..ad9748efa5b3 100644 --- a/sw/source/core/edit/edfmt.cxx +++ b/sw/source/core/edit/edfmt.cxx @@ -47,7 +47,7 @@ SwCharFmt* SwEditShell::GetCurCharFmt() const const SfxPoolItem* pItem; if( GetCurAttr( aSet ) && SfxItemState::SET == aSet.GetItemState( RES_TXTATR_CHARFMT, false, &pItem ) ) - pFmt = ((SwFmtCharFmt*)pItem)->GetCharFmt(); + pFmt = static_cast<const SwFmtCharFmt*>(pItem)->GetCharFmt(); return pFmt; } diff --git a/sw/source/core/edit/edglbldc.cxx b/sw/source/core/edit/edglbldc.cxx index 10058b8c879c..3ddb6f687f14 100644 --- a/sw/source/core/edit/edglbldc.cxx +++ b/sw/source/core/edit/edglbldc.cxx @@ -75,7 +75,7 @@ sal_uInt16 SwEditShell::GetGlobalDocContent( SwGlblDocContents& rArr ) const break; // ignore case TOX_CONTENT_SECTION: OSL_ENSURE( pSect->ISA( SwTOXBaseSection ), "no TOXBaseSection!" ); - pNew = new SwGlblDocContent( (SwTOXBaseSection*)pSect ); + pNew = new SwGlblDocContent( static_cast<const SwTOXBaseSection*>(pSect) ); break; default: @@ -286,7 +286,7 @@ bool SwEditShell::DeleteGlobalDocContent( const SwGlblDocContents& rArr , case GLBLDOC_TOXBASE: { - SwTOXBaseSection* pTOX = (SwTOXBaseSection*)rDelPos.GetTOX(); + const SwTOXBaseSection* pTOX = static_cast<const SwTOXBaseSection*>(rDelPos.GetTOX()); pMyDoc->DeleteTOX( *pTOX, true ); } break; diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx index a73b37b335d4..26999845ee97 100644 --- a/sw/source/core/edit/editsh.cxx +++ b/sw/source/core/edit/editsh.cxx @@ -114,7 +114,7 @@ void SwEditShell::Insert2(const OUString &rStr, const bool bForceExpandHints ) SaveTblBoxCntnt( _pStartCrsr->GetPoint() ); - } while( (_pStartCrsr=(SwPaM *)_pStartCrsr->GetNext()) != __pStartCrsr ); + } while( (_pStartCrsr = static_cast<SwPaM *>(_pStartCrsr->GetNext() )) != __pStartCrsr ); } // calculate cursor bidi level @@ -133,7 +133,7 @@ void SwEditShell::Insert2(const OUString &rStr, const bool bForceExpandHints ) if ( nPrevPos ) --nPrevPos; - SwScriptInfo* pSI = SwScriptInfo::GetScriptInfo( ((SwTxtNode&)rNode), true ); + SwScriptInfo* pSI = SwScriptInfo::GetScriptInfo( static_cast<SwTxtNode&>(rNode), true ); sal_uInt8 nLevel = 0; if ( ! pSI ) @@ -141,17 +141,17 @@ void SwEditShell::Insert2(const OUString &rStr, const bool bForceExpandHints ) // seems to be an empty paragraph. Point aPt; SwCntntFrm* pFrm = - ((SwTxtNode&)rNode).getLayoutFrm( GetLayout(), &aPt, pTmpCrsr->GetPoint(), + static_cast<SwTxtNode&>(rNode).getLayoutFrm( GetLayout(), &aPt, pTmpCrsr->GetPoint(), false ); SwScriptInfo aScriptInfo; - aScriptInfo.InitScriptInfo( (SwTxtNode&)rNode, pFrm->IsRightToLeft() ); + aScriptInfo.InitScriptInfo( static_cast<SwTxtNode&>(rNode), pFrm->IsRightToLeft() ); nLevel = aScriptInfo.DirType( nPrevPos ); } else { if ( COMPLETE_STRING != pSI->GetInvalidityA() ) - pSI->InitScriptInfo( (SwTxtNode&)rNode ); + pSI->InitScriptInfo( static_cast<SwTxtNode&>(rNode) ); nLevel = pSI->DirType( nPrevPos ); } @@ -318,7 +318,7 @@ void SwEditShell::SetGraphicPolygon( const tools::PolyPolygon *pPoly ) SwNoTxtNode *pNd = GetCrsr()->GetNode().GetNoTxtNode(); StartAllAction(); pNd->SetContour( pPoly ); - SwFlyFrm *pFly = (SwFlyFrm*)pNd->getLayoutFrm(GetLayout())->GetUpper(); + SwFlyFrm *pFly = static_cast<SwFlyFrm*>(pNd->getLayoutFrm(GetLayout())->GetUpper()); const SwFmtSurround &rSur = pFly->GetFmt()->GetSurround(); pFly->GetFmt()->NotifyClients( (SwFmtSurround*)&rSur, (SwFmtSurround*)&rSur ); GetDoc()->getIDocumentState().SetModified(); @@ -333,7 +333,7 @@ void SwEditShell::ClearAutomaticContour() { StartAllAction(); pNd->SetContour( NULL, false ); - SwFlyFrm *pFly = (SwFlyFrm*)pNd->getLayoutFrm(GetLayout())->GetUpper(); + SwFlyFrm *pFly = static_cast<SwFlyFrm*>(pNd->getLayoutFrm(GetLayout())->GetUpper()); const SwFmtSurround &rSur = pFly->GetFmt()->GetSurround(); pFly->GetFmt()->NotifyClients( (SwFmtSurround*)&rSur, (SwFmtSurround*)&rSur ); GetDoc()->getIDocumentState().SetModified(); @@ -370,8 +370,8 @@ bool SwEditShell::HasOLEObj( const OUString &rName ) const ++aIdx; SwNode& rNd = aIdx.GetNode(); if( rNd.IsOLENode() && - rName == ((SwOLENode&)rNd).GetChartTblName() && - ((SwOLENode&)rNd).getLayoutFrm( GetLayout() ) ) + rName == static_cast<SwOLENode&>(rNd).GetChartTblName() && + static_cast<SwOLENode&>(rNd).getLayoutFrm( GetLayout() ) ) return true; aIdx.Assign( *pStNd->EndOfSectionNode(), + 1 ); @@ -505,7 +505,7 @@ void SwEditShell::ReplaceDropTxt( const OUString &rStr, SwPaM* pPaM ) OUString SwEditShell::Calculate() { OUString aFormel; // the final formula - SwPaM *pPaMLast = (SwPaM*)GetCrsr()->GetNext(), + SwPaM *pPaMLast = static_cast<SwPaM*>(GetCrsr()->GetNext()), *pPaM = pPaMLast; // cursor pointers SwCalc aCalc( *GetDoc() ); const CharClass& rCC = GetAppCharClass(); @@ -561,7 +561,7 @@ OUString SwEditShell::Calculate() aFormel += OUString(ch); } } - } while( pPaMLast != (pPaM = (SwPaM*)pPaM->GetNext()) ); + } while( pPaMLast != (pPaM = static_cast<SwPaM*>(pPaM->GetNext())) ); return aCalc.GetStrResult( aCalc.Calculate(aFormel) ); } @@ -594,7 +594,7 @@ Graphic SwEditShell::GetIMapGraphic() const } else if ( rNd.IsOLENode() ) { - aRet = *((SwOLENode&)rNd).GetGraphic(); + aRet = *static_cast<SwOLENode&>(rNd).GetGraphic(); } else { @@ -753,10 +753,10 @@ void SwEditShell::SetNumberingRestart() switch( pNd->GetNodeType() ) { case ND_TEXTNODE: - if( 0 != ( pCntFrm = ((SwTxtNode*)pNd)->getLayoutFrm( GetLayout() )) ) + if( 0 != ( pCntFrm = static_cast<SwTxtNode*>(pNd)->getLayoutFrm( GetLayout() )) ) { // skip hidden frames - ignore protection! - if( !((SwTxtFrm*)pCntFrm)->IsHiddenNow() ) + if( !static_cast<SwTxtFrm*>(pCntFrm)->IsHiddenNow() ) { // if the node is numbered and the starting value of the numbering equals the // start value of the numbering rule then set this value as hard starting value @@ -795,7 +795,7 @@ void SwEditShell::SetNumberingRestart() break; case ND_SECTIONNODE: // skip hidden sections - ignore protection! - if(((SwSectionNode*)pNd)->GetSection().IsHidden() ) + if(static_cast<SwSectionNode*>(pNd)->GetSection().IsHidden() ) nCurrNd = pNd->EndOfSectionIndex(); break; case ND_ENDNODE: @@ -865,7 +865,7 @@ sal_uInt16 SwEditShell::GetLineCount( bool bActPos ) { sal_Int32 nActPos = bActPos && aStart == rPtIdx ? pPam->GetPoint()->nContent.GetIndex() : USHRT_MAX; - nRet = nRet + ((SwTxtFrm*)pCntFrm)->GetLineCount( nActPos ); + nRet = nRet + static_cast<SwTxtFrm*>(pCntFrm)->GetLineCount( nActPos ); } } return nRet; diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx index f9c455356bb9..33755b15633e 100644 --- a/sw/source/core/edit/edlingu.cxx +++ b/sw/source/core/edit/edlingu.cxx @@ -1425,7 +1425,7 @@ bool SwSpellIter::SpellSentence(::svx::SpellPortions& rPortions, bool bIsGrammar pMySh->GoEndSentence(); if( bGrammarErrorFound ) { - const ModelToViewHelper aConversionMap((SwTxtNode&)pCrsr->GetNode()); + const ModelToViewHelper aConversionMap(static_cast<SwTxtNode&>(pCrsr->GetNode())); OUString aExpandText = aConversionMap.getViewText(); sal_Int32 nSentenceEnd = aConversionMap.ConvertToViewPosition( aGrammarResult.nBehindEndOfSentencePosition ); diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx index ba12508a3aac..33c5e0692b34 100644 --- a/sw/source/core/edit/ednumber.cxx +++ b/sw/source/core/edit/ednumber.cxx @@ -33,7 +33,7 @@ SwPamRanges::SwPamRanges( const SwPaM& rRing ) const SwPaM* pTmp = &rRing; do { Insert( pTmp->GetMark()->nNode, pTmp->GetPoint()->nNode ); - } while( &rRing != ( pTmp = (const SwPaM*)pTmp->GetNext() )); + } while( &rRing != ( pTmp = static_cast<const SwPaM*>(pTmp->GetNext()) )); } void SwPamRanges::Insert( const SwNodeIndex& rIdx1, const SwNodeIndex& rIdx2 ) @@ -485,8 +485,8 @@ bool SwEditShell::MoveNumParas( bool bUpperLower, bool bUpperLeft ) if (pNd->IsSectionNode() || ( pNd->IsEndNode() && pNd->StartOfSectionNode()->IsSectionNode()) || - ( pNd->IsTxtNode() && pOrig == ((SwTxtNode*)pNd)->GetNumRule() && - ((SwTxtNode*)pNd)->GetActualListLevel() > nUpperLevel )) + ( pNd->IsTxtNode() && pOrig == static_cast<const SwTxtNode*>(pNd)->GetNumRule() && + static_cast<const SwTxtNode*>(pNd)->GetActualListLevel() > nUpperLevel )) { ++nIdx; } diff --git a/sw/source/core/edit/edredln.cxx b/sw/source/core/edit/edredln.cxx index d77f621152b3..f62eaa7b9870 100644 --- a/sw/source/core/edit/edredln.cxx +++ b/sw/source/core/edit/edredln.cxx @@ -64,7 +64,7 @@ static void lcl_InvalidateAll( SwViewShell* pSh ) { if ( pSh->GetWin() ) pSh->GetWin()->Invalidate(); - pSh = (SwViewShell*)pSh->GetNext(); + pSh = static_cast<SwViewShell*>(pSh->GetNext()); } while ( pSh != pStop ); } diff --git a/sw/source/core/edit/edtab.cxx b/sw/source/core/edit/edtab.cxx index d4066b4591d9..1395e1fad8ef 100644 --- a/sw/source/core/edit/edtab.cxx +++ b/sw/source/core/edit/edtab.cxx @@ -304,7 +304,7 @@ bool SwEditShell::GetTblBoxFormulaAttrs( SfxItemSet& rSet ) 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 ); } } while( false ); @@ -313,7 +313,7 @@ bool SwEditShell::GetTblBoxFormulaAttrs( SfxItemSet& rSet ) const for (size_t n = 0; n < aBoxes.size(); ++n) { const SwTableBox* pSelBox = aBoxes[ n ]; - const SwTableBoxFmt* pTblFmt = (SwTableBoxFmt*)pSelBox->GetFrmFmt(); + const SwTableBoxFmt* pTblFmt = static_cast<SwTableBoxFmt*>(pSelBox->GetFrmFmt()); if( !n ) { // Convert formulae into external presentation @@ -346,7 +346,7 @@ void SwEditShell::SetTblBoxFormulaAttrs( const SfxItemSet& rSet ) } 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 ); } } while( false ); @@ -371,14 +371,14 @@ bool SwEditShell::IsTableBoxTextFormat() const if( IsTableMode() ) return false; - SwTableBox *pBox = 0; + const SwTableBox *pBox = 0; { SwFrm *pFrm = GetCurrFrm(); do { pFrm = pFrm->GetUpper(); } while ( pFrm && !pFrm->IsCellFrm() ); if ( pFrm ) - pBox = (SwTableBox*)((SwCellFrm*)pFrm)->GetTabBox(); + pBox = static_cast<const SwTableBox*>(static_cast<SwCellFrm*>(pFrm)->GetTabBox()); } if( !pBox ) @@ -389,7 +389,7 @@ bool SwEditShell::IsTableBoxTextFormat() const if( SfxItemState::SET == pBox->GetFrmFmt()->GetAttrSet().GetItemState( RES_BOXATR_FORMAT, true, &pItem )) { - nFmt = ((SwTblBoxNumFormat*)pItem)->GetValue(); + nFmt = static_cast<const SwTblBoxNumFormat*>(pItem)->GetValue(); return GetDoc()->GetNumberFormatter()->IsTextFormat( nFmt ) || NUMBERFORMAT_TEXT == nFmt; } @@ -411,14 +411,14 @@ OUString SwEditShell::GetTableBoxText() const OUString sRet; if( !IsTableMode() ) { - SwTableBox *pBox = 0; + const SwTableBox *pBox = 0; { SwFrm *pFrm = GetCurrFrm(); do { pFrm = pFrm->GetUpper(); } while ( pFrm && !pFrm->IsCellFrm() ); if ( pFrm ) - pBox = (SwTableBox*)((SwCellFrm*)pFrm)->GetTabBox(); + pBox = static_cast<const SwTableBox*>(static_cast<SwCellFrm*>(pFrm)->GetTabBox()); } sal_uLong nNd; diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx index 18e24f8e98d4..7504cce86063 100644 --- a/sw/source/core/edit/edtox.cxx +++ b/sw/source/core/edit/edtox.cxx @@ -98,14 +98,14 @@ sal_uInt16 SwEditShell::GetCurTOXMarks(SwTOXMarks& rMarks) const bool SwEditShell::IsTOXBaseReadonly(const SwTOXBase& rTOXBase) const { OSL_ENSURE( rTOXBase.ISA( SwTOXBaseSection ), "no TOXBaseSection!" ); - const SwTOXBaseSection& rTOXSect = (const SwTOXBaseSection&)rTOXBase; + const SwTOXBaseSection& rTOXSect = static_cast<const SwTOXBaseSection&>(rTOXBase); return rTOXSect.IsProtect(); } void SwEditShell::SetTOXBaseReadonly(const SwTOXBase& rTOXBase, bool bReadonly) { OSL_ENSURE( rTOXBase.ISA( SwTOXBaseSection ), "no TOXBaseSection!" ); - const SwTOXBaseSection& rTOXSect = (const SwTOXBaseSection&)rTOXBase; + const SwTOXBaseSection& rTOXSect = static_cast<const SwTOXBaseSection&>(rTOXBase); ((SwTOXBase&)rTOXBase).SetProtected(bReadonly); OSL_ENSURE( rTOXSect.SwSection::GetType() == TOX_CONTENT_SECTION, "not a TOXContentSection" ); @@ -159,7 +159,7 @@ bool SwEditShell::UpdateTableOf( const SwTOXBase& rTOX, const SfxItemSet* pSet ) bool bRet = false; OSL_ENSURE( rTOX.ISA( SwTOXBaseSection ), "no TOXBaseSection!" ); - SwTOXBaseSection* pTOX = (SwTOXBaseSection*)&rTOX; + SwTOXBaseSection* pTOX = const_cast<SwTOXBaseSection*>(static_cast<const SwTOXBaseSection*>(&rTOX)); OSL_ENSURE(pTOX, "no current listing"); if( pTOX && 0 != pTOX->GetFmt()->GetSectionNode() ) { @@ -246,7 +246,7 @@ const SwTOXBase* SwEditShell::GetTOX( sal_uInt16 nPos ) const nCnt++ == nPos ) { OSL_ENSURE( pSect->ISA( SwTOXBaseSection ), "no TOXBaseSection!" ); - return (SwTOXBaseSection*)pSect; + return static_cast<const SwTOXBaseSection*>(pSect); } } return 0; diff --git a/sw/source/core/edit/edws.cxx b/sw/source/core/edit/edws.cxx index ef20018c888d..3816ab65834f 100644 --- a/sw/source/core/edit/edws.cxx +++ b/sw/source/core/edit/edws.cxx @@ -73,10 +73,10 @@ void SwEditShell::StartAllAction() SwViewShell *pSh = this; do { if( pSh->IsA( TYPE( SwEditShell ) ) ) - ((SwEditShell*)pSh)->StartAction(); + static_cast<SwEditShell*>(pSh)->StartAction(); else pSh->StartAction(); - pSh = (SwViewShell *)pSh->GetNext(); + pSh = static_cast<SwViewShell *>(pSh->GetNext()); } while(pSh != this); } @@ -85,10 +85,10 @@ void SwEditShell::EndAllAction() SwViewShell *pSh = this; do { if( pSh->IsA( TYPE( SwEditShell ) ) ) - ((SwEditShell*)pSh)->EndAction(); + static_cast<SwEditShell*>(pSh)->EndAction(); else pSh->EndAction(); - pSh = (SwViewShell *)pSh->GetNext(); + pSh = static_cast<SwViewShell *>(pSh->GetNext()); } while(pSh != this); } @@ -102,7 +102,7 @@ void SwEditShell::CalcLayout() { if ( pSh->GetWin() ) pSh->GetWin()->Invalidate(); - pSh = (SwViewShell*)pSh->GetNext(); + pSh = static_cast<SwViewShell*>(pSh->GetNext()); } while ( pSh != this ); diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx index 77c388218039..b001b84043ae 100644 --- a/sw/source/core/fields/authfld.cxx +++ b/sw/source/core/fields/authfld.cxx @@ -91,7 +91,7 @@ void SwAuthorityFieldType::RemoveField(sal_IntPtr nHandle) for(sal_uInt16 j = 0; j < m_DataArr.size(); j++) { SwAuthEntry* pTemp = &m_DataArr[j]; - sal_IntPtr nRet = (sal_IntPtr)(void*)pTemp; + sal_IntPtr nRet = reinterpret_cast<sal_IntPtr>((void*)pTemp); if(nRet == nHandle) { #if OSL_DEBUG_LEVEL > 0 @@ -126,14 +126,14 @@ sal_IntPtr SwAuthorityFieldType::AddField(const OUString& rFieldContents) if(*pTemp == *pEntry) { DELETEZ(pEntry); - nRet = (sal_IntPtr)(void*)pTemp; + nRet = reinterpret_cast<sal_IntPtr>((void*)pTemp); pTemp->AddRef(); } } //if it is a new Entry - insert if(pEntry) { - nRet = (sal_IntPtr)(void*)pEntry; + nRet = reinterpret_cast<sal_IntPtr>((void*)pEntry); pEntry->AddRef(); m_DataArr.push_back(pEntry); //re-generate positions of the fields @@ -148,7 +148,7 @@ bool SwAuthorityFieldType::AddField(sal_IntPtr nHandle) for( sal_uInt16 j = 0; j < m_DataArr.size(); j++ ) { SwAuthEntry* pTemp = &m_DataArr[j]; - sal_IntPtr nTmp = (sal_IntPtr)(void*)pTemp; + sal_IntPtr nTmp = reinterpret_cast<sal_IntPtr>((void*)pTemp); if( nTmp == nHandle ) { bRet = true; @@ -168,7 +168,7 @@ const SwAuthEntry* SwAuthorityFieldType::GetEntryByHandle(sal_IntPtr nHandle) c for(sal_uInt16 j = 0; j < m_DataArr.size(); j++) { const SwAuthEntry* pTemp = &m_DataArr[j]; - sal_IntPtr nTmp = (sal_IntPtr)(void*)pTemp; + sal_IntPtr nTmp = reinterpret_cast<sal_IntPtr>((void*)pTemp); if( nTmp == nHandle ) { pRet = pTemp; @@ -251,7 +251,7 @@ sal_IntPtr SwAuthorityFieldType::GetHandle(sal_uInt16 nPos) if( nPos < m_DataArr.size() ) { SwAuthEntry* pTemp = &m_DataArr[nPos]; - nRet = (sal_IntPtr)(void*)pTemp; + nRet = reinterpret_cast<sal_IntPtr>((void*)pTemp); } return nRet; } @@ -277,7 +277,7 @@ sal_uInt16 SwAuthorityFieldType::GetSequencePos(sal_IntPtr nHandle) if(!pTxtFld || !pTxtFld->GetpTxtNode()) { #if OSL_DEBUG_LEVEL > 0 - if(nHandle == ((SwAuthorityField*)pFmtFld->GetField())->GetHandle()) + if(nHandle == static_cast<SwAuthorityField*>(pFmtFld->GetField())->GetHandle()) bCurrentFieldWithoutTextNode = true; #endif continue; @@ -336,8 +336,8 @@ sal_uInt16 SwAuthorityFieldType::GetSequencePos(sal_IntPtr nHandle) for(sal_uInt16 i = 0; i < aSortArr.size(); i++) { const SwTOXSortTabBase& rBase = *aSortArr[i]; - SwFmtFld& rFmtFld = ((SwTOXAuthority&)rBase).GetFldFmt(); - SwAuthorityField* pAFld = (SwAuthorityField*)rFmtFld.GetField(); + SwFmtFld& rFmtFld = const_cast<SwTOXAuthority&>(static_cast<const SwTOXAuthority&>(rBase)).GetFldFmt(); + SwAuthorityField* pAFld = static_cast<SwAuthorityField*>(rFmtFld.GetField()); m_SequArr.push_back(pAFld->GetHandle()); } for (SwTOXSortTabBases::const_iterator it = aSortArr.begin(); it != aSortArr.end(); ++it) @@ -537,7 +537,7 @@ SwAuthorityField::SwAuthorityField( SwAuthorityFieldType* pInitType, SwAuthorityField::~SwAuthorityField() { - ((SwAuthorityFieldType* )GetTyp())->RemoveField(m_nHandle); + static_cast<SwAuthorityFieldType* >(GetTyp())->RemoveField(m_nHandle); } OUString SwAuthorityField::Expand() const @@ -547,7 +547,7 @@ OUString SwAuthorityField::Expand() const OUString SwAuthorityField::ConditionalExpand(ToxAuthorityField eField) const { - SwAuthorityFieldType* pAuthType = (SwAuthorityFieldType*)GetTyp(); + SwAuthorityFieldType* pAuthType = static_cast<SwAuthorityFieldType*>(GetTyp()); OUString sRet; if(pAuthType->GetPrefix() && eField != AUTH_FIELD_TITLE) sRet = OUString(pAuthType->GetPrefix()); @@ -573,7 +573,7 @@ OUString SwAuthorityField::ConditionalExpand(ToxAuthorityField eField) const OUString SwAuthorityField::ExpandCitation(ToxAuthorityField eField) const { - SwAuthorityFieldType* pAuthType = (SwAuthorityFieldType*)GetTyp(); + SwAuthorityFieldType* pAuthType = static_cast<SwAuthorityFieldType*>(GetTyp()); OUString sRet; if( pAuthType->IsSequence() ) @@ -595,20 +595,20 @@ OUString SwAuthorityField::ExpandCitation(ToxAuthorityField eField) const SwField* SwAuthorityField::Copy() const { - SwAuthorityFieldType* pAuthType = (SwAuthorityFieldType*)GetTyp(); + SwAuthorityFieldType* pAuthType = static_cast<SwAuthorityFieldType*>(GetTyp()); return new SwAuthorityField(pAuthType, m_nHandle); } OUString SwAuthorityField::GetFieldText(ToxAuthorityField eField) const { - SwAuthorityFieldType* pAuthType = (SwAuthorityFieldType*)GetTyp(); + SwAuthorityFieldType* pAuthType = static_cast<SwAuthorityFieldType*>(GetTyp()); const SwAuthEntry* pEntry = pAuthType->GetEntryByHandle( m_nHandle ); return pEntry->GetAuthorField( eField ); } void SwAuthorityField::SetPar1(const OUString& rStr) { - SwAuthorityFieldType* pInitType = (SwAuthorityFieldType* )GetTyp(); + SwAuthorityFieldType* pInitType = static_cast<SwAuthorityFieldType* >(GetTyp()); pInitType->RemoveField(m_nHandle); m_nHandle = pInitType->AddField(rStr); } @@ -657,7 +657,7 @@ bool SwAuthorityField::QueryValue( Any& rAny, sal_uInt16 /*nWhichId*/ ) const { if(!GetTyp()) return false; - const SwAuthEntry* pAuthEntry = ((SwAuthorityFieldType*)GetTyp())->GetEntryByHandle(m_nHandle); + const SwAuthEntry* pAuthEntry = static_cast<SwAuthorityFieldType*>(GetTyp())->GetEntryByHandle(m_nHandle); if(!pAuthEntry) return false; Sequence <PropertyValue> aRet(AUTH_FIELD_END); @@ -686,7 +686,7 @@ static sal_Int16 lcl_Find(const OUString& rFieldName) bool SwAuthorityField::PutValue( const Any& rAny, sal_uInt16 /*nWhichId*/ ) { - if(!GetTyp() || !((SwAuthorityFieldType*)GetTyp())->GetEntryByHandle(m_nHandle)) + if(!GetTyp() || !static_cast<SwAuthorityFieldType*>(GetTyp())->GetEntryByHandle(m_nHandle)) return false; Sequence <PropertyValue> aParam; @@ -715,8 +715,8 @@ bool SwAuthorityField::PutValue( const Any& rAny, sal_uInt16 /*nWhichId*/ ) } } - ((SwAuthorityFieldType*)GetTyp())->RemoveField(m_nHandle); - m_nHandle = ((SwAuthorityFieldType*)GetTyp())->AddField(sToSet); + static_cast<SwAuthorityFieldType*>(GetTyp())->RemoveField(m_nHandle); + m_nHandle = static_cast<SwAuthorityFieldType*>(GetTyp())->AddField(sToSet); /* FIXME: it is weird that we always return false here */ return false; @@ -724,8 +724,8 @@ bool SwAuthorityField::PutValue( const Any& rAny, sal_uInt16 /*nWhichId*/ ) SwFieldType* SwAuthorityField::ChgTyp( SwFieldType* pFldTyp ) { - SwAuthorityFieldType* pSrcTyp = (SwAuthorityFieldType*)GetTyp(), - * pDstTyp = (SwAuthorityFieldType*)pFldTyp; + SwAuthorityFieldType* pSrcTyp = static_cast<SwAuthorityFieldType*>(GetTyp()), + * pDstTyp = static_cast<SwAuthorityFieldType*>(pFldTyp); if( pSrcTyp != pDstTyp ) { diff --git a/sw/source/core/fields/cellfml.cxx b/sw/source/core/fields/cellfml.cxx index 27edc52800f6..247a9391af84 100644 --- a/sw/source/core/fields/cellfml.cxx +++ b/sw/source/core/fields/cellfml.cxx @@ -107,12 +107,12 @@ double SwTableBox::GetValue( SwTblCalcPara& rCalcPara ) const RES_BOXATR_FORMULA, false, &pItem ) ) { rCalcPara.rCalc.SetCalcError( CALC_NOERR ); // reset status - if( !((SwTblBoxFormula*)pItem)->IsValid() ) + if( !static_cast<const SwTblBoxFormula*>(pItem)->IsValid() ) { // calculate const SwTable* pTmp = rCalcPara.pTbl; rCalcPara.pTbl = &pBox->GetSttNd()->FindTableNode()->GetTable(); - ((SwTblBoxFormula*)pItem)->Calc( rCalcPara, nRet ); + const_cast<SwTblBoxFormula*>(static_cast<const SwTblBoxFormula*>(pItem))->Calc( rCalcPara, nRet ); if( !rCalcPara.IsStackOverflow() ) { @@ -134,7 +134,7 @@ double SwTableBox::GetValue( SwTblCalcPara& rCalcPara ) const RES_BOXATR_VALUE, false, &pItem ) ) { rCalcPara.rCalc.SetCalcError( CALC_NOERR ); // reset status - nRet = ((SwTblBoxValue*)pItem)->GetValue(); + nRet = static_cast<const SwTblBoxValue*>(pItem)->GetValue(); break; } @@ -163,14 +163,14 @@ double SwTableBox::GetValue( SwTblCalcPara& rCalcPara ) const switch ( pFld->GetTyp()->Which() ) { case RES_SETEXPFLD: - nRet = ( (SwSetExpField*) pFld )->GetValue(); + nRet = static_cast<const SwSetExpField*>( pFld )->GetValue(); break; case RES_USERFLD: nRet = ( (SwUserFieldType*) pFld )->GetValue(); break; case RES_TABLEFLD: { - SwTblField* pTblFld = (SwTblField*)pFld; + SwTblField* pTblFld = const_cast<SwTblField*>(static_cast<const SwTblField*>(pFld)); if( !pTblFld->IsValid() ) { // use the right table! @@ -184,7 +184,7 @@ double SwTableBox::GetValue( SwTblCalcPara& rCalcPara ) const break; case RES_DATETIMEFLD: - nRet = ( (SwDateTimeField*) pFld )->GetValue(); + nRet = static_cast<const SwDateTimeField*>( pFld )->GetValue(); break; case RES_JUMPEDITFLD: @@ -423,7 +423,7 @@ void SwTableFormula::RelBoxNmsToPtr( const SwTable& rTbl, OUString& rNewStr, { const SwTableBox *pRelLastBox = lcl_RelToBox( rTbl, pBox, *pLastBox ); if ( pRelLastBox ) - rNewStr += OUString::number((sal_PtrDiff)pRelLastBox); + rNewStr += OUString::number(reinterpret_cast<sal_PtrDiff>(pRelLastBox)); else rNewStr += "0"; rNewStr += ":"; @@ -432,7 +432,7 @@ void SwTableFormula::RelBoxNmsToPtr( const SwTable& rTbl, OUString& rNewStr, const SwTableBox *pRelFirstBox = lcl_RelToBox( rTbl, pBox, rFirstBox ); if ( pRelFirstBox ) - rNewStr += OUString::number((sal_PtrDiff)pRelFirstBox); + rNewStr += OUString::number(reinterpret_cast<sal_PtrDiff>(pRelFirstBox)); else rNewStr += "0"; @@ -517,13 +517,13 @@ void SwTableFormula::BoxNmsToPtr( const SwTable& rTbl, OUString& rNewStr, if( pLastBox ) { pBox = rTbl.GetTblBox( *pLastBox ); - rNewStr += OUString::number((sal_PtrDiff)pBox) + rNewStr += OUString::number(reinterpret_cast<sal_PtrDiff>(pBox)) + ":"; rFirstBox = rFirstBox.copy( pLastBox->getLength()+1 ); } pBox = rTbl.GetTblBox( rFirstBox ); - rNewStr += OUString::number((sal_PtrDiff)pBox) + rNewStr += OUString::number(reinterpret_cast<sal_PtrDiff>(pBox)) + OUString(rFirstBox[ rFirstBox.getLength()-1 ]); // get label for the box } @@ -1024,7 +1024,7 @@ bool SwTableFormula::HasValidBoxes() const const SwNode* pNd = GetNodeOfFormula(); if( pNd && 0 != ( pNd = pNd->FindTableNode() ) ) ScanString( &SwTableFormula::_HasValidBoxes, - ((SwTableNode*)pNd)->GetTable(), &bRet ); + static_cast<const SwTableNode*>(pNd)->GetTable(), &bRet ); return bRet; } @@ -1180,9 +1180,9 @@ void SwTableFormula::_SplitMergeBoxNm( const SwTable& rTbl, OUString& rNewStr, } if( pLastBox ) - rNewStr += OUString::number((sal_PtrDiff)pEndBox) + ":"; + rNewStr += OUString::number(reinterpret_cast<sal_PtrDiff>(pEndBox)) + ":"; - rNewStr += OUString::number((sal_PtrDiff)pSttBox) + rNewStr += OUString::number(reinterpret_cast<sal_PtrDiff>(pSttBox)) + OUString(rFirstBox[ rFirstBox.getLength()-1] ); } @@ -1192,7 +1192,7 @@ void SwTableFormula::ToSplitMergeBoxNm( SwTableFmlUpdate& rTblUpd ) const SwTable* pTbl; const SwNode* pNd = GetNodeOfFormula(); if( pNd && 0 != ( pNd = pNd->FindTableNode() )) - pTbl = &((SwTableNode*)pNd)->GetTable(); + pTbl = &static_cast<const SwTableNode*>(pNd)->GetTable(); else pTbl = rTblUpd.pTbl; diff --git a/sw/source/core/fields/chpfld.cxx b/sw/source/core/fields/chpfld.cxx index 273d48c0e41e..8f9c5217421f 100644 --- a/sw/source/core/fields/chpfld.cxx +++ b/sw/source/core/fields/chpfld.cxx @@ -87,7 +87,7 @@ OUString SwChapterField::Expand() const SwField* SwChapterField::Copy() const { SwChapterField *pTmp = - new SwChapterField((SwChapterFieldType*)GetTyp(), GetFormat()); + new SwChapterField(static_cast<SwChapterFieldType*>(GetTyp()), GetFormat()); pTmp->nLevel = nLevel; pTmp->sTitle = sTitle; pTmp->sNumber = sNumber; diff --git a/sw/source/core/fields/dbfld.cxx b/sw/source/core/fields/dbfld.cxx index 02470082c418..edc94d0d208c 100644 --- a/sw/source/core/fields/dbfld.cxx +++ b/sw/source/core/fields/dbfld.cxx @@ -146,7 +146,7 @@ bool SwDBFieldType::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) SwTxtFld *pTxtFld = pFmtFld->GetTxtFld(); if(pTxtFld && pTxtFld->GetTxtNode().GetNodes().IsDocNodes() ) { - SwDBField* pDBField = (SwDBField*)pFmtFld->GetField(); + SwDBField* pDBField = static_cast<SwDBField*>(pFmtFld->GetField()); pDBField->ClearInitialized(); pDBField->InitContent(); } @@ -174,21 +174,21 @@ SwDBField::SwDBField(SwDBFieldType* pTyp, sal_uLong nFmt) bInitialized(false) { if (GetTyp()) - ((SwDBFieldType*)GetTyp())->AddRef(); + static_cast<SwDBFieldType*>(GetTyp())->AddRef(); InitContent(); } SwDBField::~SwDBField() { if (GetTyp()) - ((SwDBFieldType*)GetTyp())->ReleaseRef(); + static_cast<SwDBFieldType*>(GetTyp())->ReleaseRef(); } void SwDBField::InitContent() { if (!IsInitialized()) { - aContent = "<" + ((const SwDBFieldType*)GetTyp())->GetColumnName() + ">"; + aContent = "<" + static_cast<const SwDBFieldType*>(GetTyp())->GetColumnName() + ">"; } } @@ -198,7 +198,7 @@ void SwDBField::InitContent(const OUString& rExpansion) { const OUString sColumn( rExpansion.copy( 1, rExpansion.getLength() - 2 ) ); if( ::GetAppCmpStrIgnore().isEqual( sColumn, - ((SwDBFieldType *)GetTyp())->GetColumnName() )) + static_cast<SwDBFieldType *>(GetTyp())->GetColumnName() )) { InitContent(); return; @@ -216,7 +216,7 @@ OUString SwDBField::Expand() const SwField* SwDBField::Copy() const { - SwDBField *pTmp = new SwDBField((SwDBFieldType*)GetTyp(), GetFormat()); + SwDBField *pTmp = new SwDBField(static_cast<SwDBFieldType*>(GetTyp()), GetFormat()); pTmp->aContent = aContent; pTmp->bIsInBodyTxt = bIsInBodyTxt; pTmp->bValidValue = bValidValue; @@ -250,15 +250,15 @@ void SwDBField::ChgValue( double d, bool bVal ) SetValue(d); if( bValidValue ) - aContent = ((SwValueFieldType*)GetTyp())->ExpandValue(d, GetFormat(), GetLanguage()); + aContent = static_cast<SwValueFieldType*>(GetTyp())->ExpandValue(d, GetFormat(), GetLanguage()); } SwFieldType* SwDBField::ChgTyp( SwFieldType* pNewType ) { SwFieldType* pOld = SwValueField::ChgTyp( pNewType ); - ((SwDBFieldType*)pNewType)->AddRef(); - ((SwDBFieldType*)pOld)->ReleaseRef(); + static_cast<SwDBFieldType*>(pNewType)->AddRef(); + static_cast<SwDBFieldType*>(pOld)->ReleaseRef(); return pOld; } @@ -325,7 +325,7 @@ void SwDBField::Evaluate() sal_uInt32 nFmt; // search corresponding column name - OUString aColNm( ((SwDBFieldType*)GetTyp())->GetColumnName() ); + OUString aColNm( static_cast<SwDBFieldType*>(GetTyp())->GetColumnName() ); SvNumberFormatter* pDocFormatter = GetDoc()->GetNumberFormatter(); pMgr->GetMergeColumnCnt(aColNm, GetLanguage(), aContent, &nValue, &nFmt); @@ -340,7 +340,7 @@ void SwDBField::Evaluate() bValidValue = FormatValue( pDocFormatter, aContent, nFmt, nValue, nColumnType, this ); if( DBL_MAX != nValue ) - aContent = ((SwValueFieldType*)GetTyp())->ExpandValue(nValue, GetFormat(), GetLanguage()); + aContent = static_cast<SwValueFieldType*>(GetTyp())->ExpandValue(nValue, GetFormat(), GetLanguage()); bInitialized = true; } @@ -348,7 +348,7 @@ void SwDBField::Evaluate() /// get name OUString SwDBField::GetPar1() const { - return ((const SwDBFieldType*)GetTyp())->GetName(); + return static_cast<const SwDBFieldType*>(GetTyp())->GetName(); } sal_uInt16 SwDBField::GetSubType() const @@ -421,7 +421,7 @@ bool SwDBField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) while(pFmtFld) { SwTxtFld *pTxtFld = pFmtFld->GetTxtFld(); - if(pTxtFld && (SwDBField*)pFmtFld->GetField() == this ) + if(pTxtFld && static_cast<SwDBField*>(pFmtFld->GetField()) == this ) { //notify the change pTxtFld->NotifyContentChange(*pFmtFld); @@ -584,7 +584,7 @@ OUString SwDBNextSetField::Expand() const SwField* SwDBNextSetField::Copy() const { - SwDBNextSetField *pTmp = new SwDBNextSetField((SwDBNextSetFieldType*)GetTyp(), + SwDBNextSetField *pTmp = new SwDBNextSetField(static_cast<SwDBNextSetFieldType*>(GetTyp()), aCond, OUString(), GetDBData()); pTmp->SetSubType(GetSubType()); pTmp->bCondValid = bCondValid; @@ -671,7 +671,7 @@ OUString SwDBNumSetField::Expand() const SwField* SwDBNumSetField::Copy() const { - SwDBNumSetField *pTmp = new SwDBNumSetField((SwDBNumSetFieldType*)GetTyp(), + SwDBNumSetField *pTmp = new SwDBNumSetField(static_cast<SwDBNumSetFieldType*>(GetTyp()), aCond, aPar2, GetDBData()); pTmp->bCondValid = bCondValid; pTmp->SetSubType(GetSubType()); @@ -779,13 +779,13 @@ SwDBNameField::SwDBNameField(SwDBNameFieldType* pTyp, const SwDBData& rDBData, s OUString SwDBNameField::Expand() const { if(0 ==(GetSubType() & nsSwExtendedSubType::SUB_INVISIBLE)) - return ((SwDBNameFieldType*)GetTyp())->Expand(GetFormat()); + return static_cast<SwDBNameFieldType*>(GetTyp())->Expand(GetFormat()); return OUString(); } SwField* SwDBNameField::Copy() const { - SwDBNameField *pTmp = new SwDBNameField((SwDBNameFieldType*)GetTyp(), GetDBData()); + SwDBNameField *pTmp = new SwDBNameField(static_cast<SwDBNameFieldType*>(GetTyp()), GetDBData()); pTmp->ChangeFormat(GetFormat()); pTmp->SetLanguage(GetLanguage()); pTmp->SetSubType(GetSubType()); @@ -842,7 +842,7 @@ void SwDBSetNumberField::Evaluate(SwDoc* pDoc) SwField* SwDBSetNumberField::Copy() const { SwDBSetNumberField *pTmp = - new SwDBSetNumberField((SwDBSetNumberFieldType*)GetTyp(), GetDBData(), GetFormat()); + new SwDBSetNumberField(static_cast<SwDBSetNumberFieldType*>(GetTyp()), GetDBData(), GetFormat()); pTmp->SetLanguage(GetLanguage()); pTmp->SetSetNumber(nNumber); pTmp->SetSubType(GetSubType()); diff --git a/sw/source/core/fields/ddefld.cxx b/sw/source/core/fields/ddefld.cxx index 1440448b9237..a77acbfabaec 100644 --- a/sw/source/core/fields/ddefld.cxx +++ b/sw/source/core/fields/ddefld.cxx @@ -111,7 +111,7 @@ public: do { // a DDE table or a DDE field attribute in the text if( !pLast->IsA( TYPE( SwFmtFld ) ) || - ((SwFmtFld*)pLast)->GetTxtFld() ) + static_cast<SwFmtFld*>(pLast)->GetTxtFld() ) { if( !bCallModify ) { @@ -176,12 +176,12 @@ const SwNode* SwIntrnlRefLink::GetAnchor() const // a DDE table or a DDE field attribute in the text if( !pLast->IsA( TYPE( SwFmtFld ) )) { - SwDepend* pDep = (SwDepend*)pLast; - SwDDETable* pDDETbl = (SwDDETable*)pDep->GetToTell(); + SwDepend* pDep = static_cast<SwDepend*>(pLast); + SwDDETable* pDDETbl = static_cast<SwDDETable*>(pDep->GetToTell()); pNd = pDDETbl->GetTabSortBoxes()[0]->GetSttNd(); } - else if( ((SwFmtFld*)pLast)->GetTxtFld() ) - pNd = ((SwFmtFld*)pLast)->GetTxtFld()->GetpTxtNode(); + else if( static_cast<SwFmtFld*>(pLast)->GetTxtFld() ) + pNd = static_cast<SwFmtFld*>(pLast)->GetTxtFld()->GetpTxtNode(); if( pNd && &rFldType.GetDoc()->GetNodes() == &pNd->GetNodes() ) break; @@ -203,8 +203,8 @@ bool SwIntrnlRefLink::IsInRange( sal_uLong nSttNd, sal_uLong nEndNd, // a DDE table or a DDE field attribute in the text if( !pLast->IsA( TYPE( SwFmtFld ) )) { - SwDepend* pDep = (SwDepend*)pLast; - SwDDETable* pDDETbl = (SwDDETable*)pDep->GetToTell(); + SwDepend* pDep = static_cast<SwDepend*>(pLast); + SwDDETable* pDDETbl = static_cast<SwDDETable*>(pDep->GetToTell()); const SwTableNode* pTblNd = pDDETbl->GetTabSortBoxes()[0]-> GetSttNd()->FindTableNode(); if( pTblNd->GetNodes().IsDocNodes() && @@ -212,9 +212,9 @@ bool SwIntrnlRefLink::IsInRange( sal_uLong nSttNd, sal_uLong nEndNd, nEndNd > pTblNd->GetIndex() ) return true; } - else if( ((SwFmtFld*)pLast)->GetTxtFld() ) + else if( static_cast<SwFmtFld*>(pLast)->GetTxtFld() ) { - const SwTxtFld* pTFld = ((SwFmtFld*)pLast)->GetTxtFld(); + const SwTxtFld* pTFld = static_cast<SwFmtFld*>(pLast)->GetTxtFld(); const SwTxtNode* pNd = pTFld->GetpTxtNode(); if( pNd && pNds == &pNd->GetNodes() ) { @@ -385,12 +385,12 @@ SwDDEField::SwDDEField( SwDDEFieldType* pInitType ) SwDDEField::~SwDDEField() { if( GetTyp()->IsLastDepend() ) - ((SwDDEFieldType*)GetTyp())->Disconnect(); + static_cast<SwDDEFieldType*>(GetTyp())->Disconnect(); } OUString SwDDEField::Expand() const { - OUString aStr = ((SwDDEFieldType*)GetTyp())->GetExpansion(); + OUString aStr = static_cast<SwDDEFieldType*>(GetTyp())->GetExpansion(); aStr = aStr.replaceAll("\r", OUString()); aStr = aStr.replaceAll("\t", " "); aStr = aStr.replaceAll("\n", "|"); @@ -403,25 +403,25 @@ OUString SwDDEField::Expand() const SwField* SwDDEField::Copy() const { - return new SwDDEField((SwDDEFieldType*)GetTyp()); + return new SwDDEField(static_cast<SwDDEFieldType*>(GetTyp())); } /// get field type name OUString SwDDEField::GetPar1() const { - return ((const SwDDEFieldType*)GetTyp())->GetName(); + return static_cast<const SwDDEFieldType*>(GetTyp())->GetName(); } /// get field type command OUString SwDDEField::GetPar2() const { - return ((const SwDDEFieldType*)GetTyp())->GetCmd(); + return static_cast<const SwDDEFieldType*>(GetTyp())->GetCmd(); } /// set field type command void SwDDEField::SetPar2(const OUString& rStr) { - ((SwDDEFieldType*)GetTyp())->SetCmd(rStr); + static_cast<SwDDEFieldType*>(GetTyp())->SetCmd(rStr); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/fields/ddetbl.cxx b/sw/source/core/fields/ddetbl.cxx index c5013d636336..1f963fe8c6c9 100644 --- a/sw/source/core/fields/ddetbl.cxx +++ b/sw/source/core/fields/ddetbl.cxx @@ -64,7 +64,7 @@ SwDDETable::SwDDETable( SwTable& rTable, SwDDEFieldType* pDDEType, bool bUpdate SwDDETable::~SwDDETable() { - SwDDEFieldType* pFldTyp = (SwDDEFieldType*)aDepend.GetRegisteredIn(); + SwDDEFieldType* pFldTyp = static_cast<SwDDEFieldType*>(aDepend.GetRegisteredIn()); SwDoc* pDoc = GetFrmFmt()->GetDoc(); if( !pDoc->IsInDtor() && !aLines.empty() && GetTabSortBoxes()[0]->GetSttNd()->GetNodes().IsDocNodes() ) @@ -106,7 +106,7 @@ void SwDDETable::ChangeContent() return; // access to DDEFldType - SwDDEFieldType* pDDEType = (SwDDEFieldType*)aDepend.GetRegisteredIn(); + SwDDEFieldType* pDDEType = static_cast<SwDDEFieldType*>(aDepend.GetRegisteredIn()); OUString aExpand = comphelper::string::remove(pDDEType->GetExpansion(), '\r'); @@ -125,7 +125,7 @@ void SwDDETable::ChangeContent() pTxtNode->EraseText( aCntIdx ); pTxtNode->InsertText( aLine.getToken( i, '\t' ), aCntIdx ); - SwTableBoxFmt* pBoxFmt = (SwTableBoxFmt*)pBox->GetFrmFmt(); + SwTableBoxFmt* pBoxFmt = static_cast<SwTableBoxFmt*>(pBox->GetFrmFmt()); pBoxFmt->LockModify(); pBoxFmt->ResetFmtAttr( RES_BOXATR_VALUE ); pBoxFmt->UnlockModify(); @@ -140,7 +140,7 @@ void SwDDETable::ChangeContent() SwDDEFieldType* SwDDETable::GetDDEFldType() { - return (SwDDEFieldType*)aDepend.GetRegisteredIn(); + return static_cast<SwDDEFieldType*>(aDepend.GetRegisteredIn()); } bool SwDDETable::NoDDETable() @@ -171,7 +171,7 @@ bool SwDDETable::NoDDETable() GetTabLines().clear(); if( pDoc->getIDocumentLayoutAccess().GetCurrentViewShell() ) - ((SwDDEFieldType*)aDepend.GetRegisteredIn())->DecRefCnt(); + static_cast<SwDDEFieldType*>(aDepend.GetRegisteredIn())->DecRefCnt(); pTblNd->SetNewTable( pNewTbl ); // replace table diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index 4645c0785667..ec0f4e2bcad6 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -152,7 +152,7 @@ void SwPageNumberFieldType::ChangeExpansion( SwDoc* pDoc, const SwFmtPageDesc *pDesc; sal_uInt32 nMaxItems = rPool.GetItemCount2( RES_PAGEDESC ); for( sal_uInt32 n = 0; n < nMaxItems; ++n ) - if( 0 != (pDesc = (SwFmtPageDesc*)rPool.GetItem2( RES_PAGEDESC, n ) ) + if( 0 != (pDesc = static_cast<const SwFmtPageDesc*>(rPool.GetItem2( RES_PAGEDESC, n )) ) && pDesc->GetNumOffset() && pDesc->GetDefinedIn() ) { const SwCntntNode* pNd = PTR_CAST( SwCntntNode, pDesc->GetDefinedIn() ); @@ -190,7 +190,7 @@ void SwPageNumberField::ChangeExpansion(sal_uInt16 const nPageNumber, OUString SwPageNumberField::Expand() const { OUString sRet; - SwPageNumberFieldType* pFldType = (SwPageNumberFieldType*)GetTyp(); + SwPageNumberFieldType* pFldType = static_cast<SwPageNumberFieldType*>(GetTyp()); if( PG_NEXT == nSubType && 1 != nOffset ) { @@ -336,21 +336,21 @@ SwFieldType* SwAuthorFieldType::Copy() const SwAuthorField::SwAuthorField(SwAuthorFieldType* pTyp, sal_uInt32 nFmt) : SwField(pTyp, nFmt) { - aContent = ((SwAuthorFieldType*)GetTyp())->Expand(GetFormat()); + aContent = static_cast<SwAuthorFieldType*>(GetTyp())->Expand(GetFormat()); } OUString SwAuthorField::Expand() const { if (!IsFixed()) - ((SwAuthorField*)this)->aContent = - ((SwAuthorFieldType*)GetTyp())->Expand(GetFormat()); + const_cast<SwAuthorField*>(this)->aContent = + static_cast<SwAuthorFieldType*>(GetTyp())->Expand(GetFormat()); return aContent; } SwField* SwAuthorField::Copy() const { - SwAuthorField *pTmp = new SwAuthorField( (SwAuthorFieldType*)GetTyp(), + SwAuthorField *pTmp = new SwAuthorField( static_cast<SwAuthorFieldType*>(GetTyp()), GetFormat()); pTmp->SetExpansion(aContent); return pTmp; @@ -473,13 +473,13 @@ SwFieldType* SwFileNameFieldType::Copy() const SwFileNameField::SwFileNameField(SwFileNameFieldType* pTyp, sal_uInt32 nFmt) : SwField(pTyp, nFmt) { - aContent = ((SwFileNameFieldType*)GetTyp())->Expand(GetFormat()); + aContent = static_cast<SwFileNameFieldType*>(GetTyp())->Expand(GetFormat()); } OUString SwFileNameField::Expand() const { if (!IsFixed()) - ((SwFileNameField*)this)->aContent = ((SwFileNameFieldType*)GetTyp())->Expand(GetFormat()); + const_cast<SwFileNameField*>(this)->aContent = static_cast<SwFileNameFieldType*>(GetTyp())->Expand(GetFormat()); return aContent; } @@ -487,7 +487,7 @@ OUString SwFileNameField::Expand() const SwField* SwFileNameField::Copy() const { SwFileNameField *pTmp = - new SwFileNameField((SwFileNameFieldType*)GetTyp(), GetFormat()); + new SwFileNameField(static_cast<SwFileNameFieldType*>(GetTyp()), GetFormat()); pTmp->SetExpansion(aContent); return pTmp; @@ -650,13 +650,13 @@ SwTemplNameField::SwTemplNameField(SwTemplNameFieldType* pTyp, sal_uInt32 nFmt) OUString SwTemplNameField::Expand() const { - return((SwTemplNameFieldType*)GetTyp())->Expand(GetFormat()); + return static_cast<SwTemplNameFieldType*>(GetTyp())->Expand(GetFormat()); } SwField* SwTemplNameField::Copy() const { SwTemplNameField *pTmp = - new SwTemplNameField((SwTemplNameFieldType*)GetTyp(), GetFormat()); + new SwTemplNameField(static_cast<SwTemplNameFieldType*>(GetTyp()), GetFormat()); return pTmp; } @@ -777,13 +777,13 @@ SwDocStatField::SwDocStatField(SwDocStatFieldType* pTyp, sal_uInt16 nSub, sal_uI OUString SwDocStatField::Expand() const { - return((SwDocStatFieldType*)GetTyp())->Expand(nSubType, GetFormat()); + return static_cast<SwDocStatFieldType*>(GetTyp())->Expand(nSubType, GetFormat()); } SwField* SwDocStatField::Copy() const { SwDocStatField *pTmp = new SwDocStatField( - (SwDocStatFieldType*)GetTyp(), nSubType, GetFormat() ); + static_cast<SwDocStatFieldType*>(GetTyp()), nSubType, GetFormat() ); return pTmp; } @@ -800,7 +800,7 @@ void SwDocStatField::SetSubType(sal_uInt16 nSub) void SwDocStatField::ChangeExpansion( const SwFrm* pFrm ) { if( DS_PAGE == nSubType && SVX_NUM_PAGEDESC == GetFormat() ) - ((SwDocStatFieldType*)GetTyp())->SetNumFormat( + static_cast<SwDocStatFieldType*>(GetTyp())->SetNumFormat( pFrm->FindPageFrm()->GetPageDesc()->GetNumType().GetNumberingType() ); } @@ -1021,7 +1021,7 @@ SwDocInfoField::SwDocInfoField(SwDocInfoFieldType* pTyp, sal_uInt16 nSub, const SwValueField(pTyp, nFmt), nSubType(nSub) { aName = rName; - aContent = ((SwDocInfoFieldType*)GetTyp())->Expand(nSubType, nFmt, GetLanguage(), aName); + aContent = static_cast<SwDocInfoFieldType*>(GetTyp())->Expand(nSubType, nFmt, GetLanguage(), aName); } SwDocInfoField::SwDocInfoField(SwDocInfoFieldType* pTyp, sal_uInt16 nSub, const OUString& rName, const OUString& rValue, sal_uInt32 nFmt) : @@ -1118,7 +1118,7 @@ OUString SwDocInfoField::Expand() const catch (uno::Exception&) {} } else if ( !IsFixed() ) - ((SwDocInfoField*)this)->aContent = ((SwDocInfoFieldType*)GetTyp())->Expand(nSubType, GetFormat(), GetLanguage(), aName); + const_cast<SwDocInfoField*>(this)->aContent = static_cast<SwDocInfoFieldType*>(GetTyp())->Expand(nSubType, GetFormat(), GetLanguage(), aName); return aContent; } @@ -1149,7 +1149,7 @@ OUString SwDocInfoField::GetFieldName() const SwField* SwDocInfoField::Copy() const { - SwDocInfoField* pFld = new SwDocInfoField((SwDocInfoFieldType*)GetTyp(), nSubType, aName, GetFormat()); + SwDocInfoField* pFld = new SwDocInfoField(static_cast<SwDocInfoFieldType*>(GetTyp()), nSubType, aName, GetFormat()); pFld->SetAutomaticLanguage(IsAutomaticLanguage()); pFld->aContent = aContent; @@ -1341,7 +1341,7 @@ OUString SwHiddenTxtField::Expand() const if( bCanToggle && !bIsHidden ) return aTRUETxt; } - else if( !((SwHiddenTxtFieldType*)GetTyp())->GetHiddenFlag() || + else if( !static_cast<SwHiddenTxtFieldType*>(GetTyp())->GetHiddenFlag() || ( bCanToggle && bIsHidden )) return aTRUETxt; @@ -1421,7 +1421,7 @@ OUString SwHiddenTxtField::GetFieldName() const SwField* SwHiddenTxtField::Copy() const { SwHiddenTxtField* pFld = - new SwHiddenTxtField((SwHiddenTxtFieldType*)GetTyp(), aCond, + new SwHiddenTxtField(static_cast<SwHiddenTxtFieldType*>(GetTyp()), aCond, aTRUETxt, aFALSETxt); pFld->bIsHidden = bIsHidden; pFld->bValid = bValid; @@ -1590,7 +1590,7 @@ OUString SwHiddenParaField::Expand() const SwField* SwHiddenParaField::Copy() const { - SwHiddenParaField* pFld = new SwHiddenParaField((SwHiddenParaFieldType*)GetTyp(), aCond); + SwHiddenParaField* pFld = new SwHiddenParaField(static_cast<SwHiddenParaFieldType*>(GetTyp()), aCond); pFld->bIsHidden = bIsHidden; return pFld; @@ -1698,7 +1698,7 @@ OUString SwPostItField::GetDescription() const SwField* SwPostItField::Copy() const { - SwPostItField* pRet = new SwPostItField( (SwPostItFieldType*)GetTyp(), sAuthor, sTxt, sInitials, sName, + SwPostItField* pRet = new SwPostItField( static_cast<SwPostItFieldType*>(GetTyp()), sAuthor, sTxt, sInitials, sName, aDateTime); if (mpText) pRet->SetTextObject( new OutlinerParaObject(*mpText) ); @@ -1773,7 +1773,7 @@ bool SwPostItField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const { if ( !m_pTextObject ) { - SwPostItFieldType* pGetType = (SwPostItFieldType*)GetTyp(); + SwPostItFieldType* pGetType = static_cast<SwPostItFieldType*>(GetTyp()); SwDoc* pDoc = pGetType->GetDoc(); SwTextAPIEditSource* pObj = new SwTextAPIEditSource( pDoc ); const_cast <SwPostItField*> (this)->m_pTextObject = new SwTextAPIObject( pObj ); @@ -1920,20 +1920,20 @@ OUString SwExtUserFieldType::Expand(sal_uInt16 nSub, sal_uInt32 ) const SwExtUserField::SwExtUserField(SwExtUserFieldType* pTyp, sal_uInt16 nSubTyp, sal_uInt32 nFmt) : SwField(pTyp, nFmt), nType(nSubTyp) { - aContent = ((SwExtUserFieldType*)GetTyp())->Expand(nType, GetFormat()); + aContent = static_cast<SwExtUserFieldType*>(GetTyp())->Expand(nType, GetFormat()); } OUString SwExtUserField::Expand() const { if (!IsFixed()) - ((SwExtUserField*)this)->aContent = ((SwExtUserFieldType*)GetTyp())->Expand(nType, GetFormat()); + const_cast<SwExtUserField*>(this)->aContent = static_cast<SwExtUserFieldType*>(GetTyp())->Expand(nType, GetFormat()); return aContent; } SwField* SwExtUserField::Copy() const { - SwExtUserField* pFld = new SwExtUserField((SwExtUserFieldType*)GetTyp(), nType, GetFormat()); + SwExtUserField* pFld = new SwExtUserField(static_cast<SwExtUserFieldType*>(GetTyp()), nType, GetFormat()); pFld->SetExpansion(aContent); return pFld; @@ -2034,7 +2034,7 @@ OUString SwRefPageSetField::Expand() const SwField* SwRefPageSetField::Copy() const { - return new SwRefPageSetField( (SwRefPageSetFieldType*)GetTyp(), nOffset, bOn ); + return new SwRefPageSetField( static_cast<SwRefPageSetFieldType*>(GetTyp()), nOffset, bOn ); } OUString SwRefPageSetField::GetPar2() const @@ -2163,7 +2163,7 @@ sal_uInt16 SwRefPageGetFieldType::MakeSetList( _SetGetExpFlds& rTmpLst ) void SwRefPageGetFieldType::UpdateField( SwTxtFld* pTxtFld, _SetGetExpFlds& rSetList ) { - SwRefPageGetField* pGetFld = (SwRefPageGetField*)pTxtFld->GetFmtFld().GetField(); + SwRefPageGetField* pGetFld = const_cast<SwRefPageGetField*>(static_cast<const SwRefPageGetField*>(pTxtFld->GetFmtFld().GetField())); pGetFld->SetText( OUString() ); // then search the correct RefPageSet field @@ -2181,7 +2181,7 @@ void SwRefPageGetFieldType::UpdateField( SwTxtFld* pTxtFld, --itLast; const SwTxtFld* pRefTxtFld = (*itLast)->GetTxtFld(); const SwRefPageSetField* pSetFld = - (SwRefPageSetField*)pRefTxtFld->GetFmtFld().GetField(); + static_cast<const SwRefPageSetField*>(pRefTxtFld->GetFmtFld().GetField()); if( pSetFld->IsOn() ) { // determine the correct offset @@ -2224,7 +2224,7 @@ OUString SwRefPageGetField::Expand() const SwField* SwRefPageGetField::Copy() const { SwRefPageGetField* pCpy = new SwRefPageGetField( - (SwRefPageGetFieldType*)GetTyp(), GetFormat() ); + static_cast<SwRefPageGetFieldType*>(GetTyp()), GetFormat() ); pCpy->SetText( sTxt ); return pCpy; } @@ -2233,7 +2233,7 @@ void SwRefPageGetField::ChangeExpansion( const SwFrm* pFrm, const SwTxtFld* pFld ) { // only fields in Footer, Header, FootNote, Flys - SwRefPageGetFieldType* pGetType = (SwRefPageGetFieldType*)GetTyp(); + SwRefPageGetFieldType* pGetType = static_cast<SwRefPageGetFieldType*>(GetTyp()); SwDoc* pDoc = pGetType->GetDoc(); if( pFld->GetTxtNode().StartOfSectionIndex() > pDoc->GetNodes().GetEndOfExtras().GetIndex() ) @@ -2267,7 +2267,7 @@ void SwRefPageGetField::ChangeExpansion( const SwFrm* pFrm, const SwTxtFld* pRefTxtFld = (*itLast)->GetTxtFld(); const SwRefPageSetField* pSetFld = - (SwRefPageSetField*)pRefTxtFld->GetFmtFld().GetField(); + static_cast<const SwRefPageSetField*>(pRefTxtFld->GetFmtFld().GetField()); Point aPt; const SwCntntFrm* pRefFrm = pRefTxtFld->GetTxtNode().getLayoutFrm( pFrm->getRootFrm(), &aPt, 0, false ); if( pSetFld->IsOn() && pRefFrm ) @@ -2277,7 +2277,7 @@ void SwRefPageGetField::ChangeExpansion( const SwFrm* pFrm, sal_uInt16 nDiff = pPgFrm->GetPhyPageNum() - pRefFrm->FindPageFrm()->GetPhyPageNum() + 1; - SwRefPageGetField* pGetFld = (SwRefPageGetField*)pFld->GetFmtFld().GetField(); + SwRefPageGetField* pGetFld = const_cast<SwRefPageGetField*>(static_cast<const SwRefPageGetField*>(pFld->GetFmtFld().GetField())); sal_uInt32 nTmpFmt = SVX_NUM_PAGEDESC == pGetFld->GetFormat() ? pPgFrm->GetPageDesc()->GetNumType().GetNumberingType() : pGetFld->GetFormat(); @@ -2361,7 +2361,7 @@ OUString SwJumpEditField::Expand() const SwField* SwJumpEditField::Copy() const { - return new SwJumpEditField( (SwJumpEditFieldType*)GetTyp(), GetFormat(), + return new SwJumpEditField( static_cast<SwJumpEditFieldType*>(GetTyp()), GetFormat(), sTxt, sHelp ); } @@ -2481,7 +2481,7 @@ OUString SwCombinedCharField::Expand() const SwField* SwCombinedCharField::Copy() const { - return new SwCombinedCharField( (SwCombinedCharFieldType*)GetTyp(), + return new SwCombinedCharField( static_cast<SwCombinedCharFieldType*>(GetTyp()), sCharacters ); } diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx index 24e58f138167..310036319696 100644 --- a/sw/source/core/fields/expfld.cxx +++ b/sw/source/core/fields/expfld.cxx @@ -148,7 +148,7 @@ SwTxtNode* GetFirstTxtNode( const SwDoc& rDoc, SwPosition& rPos, } else if ( !pCFrm->IsValid() ) { - pTxtNode = (SwTxtNode*)pCFrm->GetNode(); + pTxtNode = const_cast<SwTxtNode*>(static_cast<const SwTxtNode*>(pCFrm->GetNode())); rPos.nNode = *pTxtNode; rPos.nContent.Assign( pTxtNode, 0 ); } @@ -171,7 +171,7 @@ const SwTxtNode* GetBodyTxtNode( const SwDoc& rDoc, SwPosition& rPos, if( pLayout->IsFlyFrm() ) { // get the FlyFormat - SwFrmFmt* pFlyFmt = ((SwFlyFrm*)pLayout)->GetFmt(); + const SwFrmFmt* pFlyFmt = static_cast<const SwFlyFrm*>(pLayout)->GetFmt(); OSL_ENSURE( pFlyFmt, "Could not find FlyFormat, where is the field?" ); const SwFmtAnchor &rAnchor = pFlyFmt->GetAnchor(); @@ -179,7 +179,7 @@ const SwTxtNode* GetBodyTxtNode( const SwDoc& rDoc, SwPosition& rPos, if( FLY_AT_FLY == rAnchor.GetAnchorId() ) { // the fly needs to be attached somewhere, so ask it - pLayout = (SwLayoutFrm*)((SwFlyFrm*)pLayout)->GetAnchorFrm(); + pLayout = static_cast<const SwLayoutFrm*>(static_cast<const SwFlyFrm*>(pLayout)->GetAnchorFrm()); continue; } else if ((FLY_AT_PARA == rAnchor.GetAnchorId()) || @@ -196,8 +196,8 @@ const SwTxtNode* GetBodyTxtNode( const SwDoc& rDoc, SwPosition& rPos, } // do not break yet, might be as well in Header/Footer/Footnote/Fly - pLayout = ((SwFlyFrm*)pLayout)->GetAnchorFrm() - ? ((SwFlyFrm*)pLayout)->GetAnchorFrm()->GetUpper() : 0; + pLayout = static_cast<const SwFlyFrm*>(pLayout)->GetAnchorFrm() + ? static_cast<const SwFlyFrm*>(pLayout)->GetAnchorFrm()->GetUpper() : 0; continue; } else @@ -210,7 +210,7 @@ const SwTxtNode* GetBodyTxtNode( const SwDoc& rDoc, SwPosition& rPos, else if( pLayout->IsFtnFrm() ) { // get the anchor's node - const SwTxtFtn* pFtn = ((SwFtnFrm*)pLayout)->GetAttr(); + const SwTxtFtn* pFtn = static_cast<const SwFtnFrm*>(pLayout)->GetAttr(); pTxtNode = &pFtn->GetTxtNode(); rPos.nNode = *pTxtNode; rPos.nContent = pFtn->GetStart(); @@ -306,7 +306,7 @@ OUString SwGetExpField::GetFieldName() const SwField* SwGetExpField::Copy() const { - SwGetExpField *pTmp = new SwGetExpField((SwGetExpFieldType*)GetTyp(), + SwGetExpField *pTmp = new SwGetExpField(static_cast<SwGetExpFieldType*>(GetTyp()), GetFormula(), nSubType, GetFormat()); pTmp->SetLanguage(GetLanguage()); pTmp->SwValueField::SetValue(GetValue()); @@ -370,7 +370,7 @@ void SwGetExpField::ChangeExpansion( const SwFrm& rFrm, const SwTxtFld& rFld ) SetValue(aCalc.Calculate(GetFormula()).GetDouble()); // analyse based on format - sExpand = ((SwValueFieldType*)GetTyp())->ExpandValue( + sExpand = static_cast<SwValueFieldType*>(GetTyp())->ExpandValue( GetValue(), GetFormat(), GetLanguage()); } } @@ -531,7 +531,7 @@ sal_uLong SwSetExpFieldType::GetSeqFormat() if( !GetDepends() ) return SVX_NUM_ARABIC; - SwField *pFld = ((SwFmtFld*)GetDepends())->GetField(); + const SwField *pFld = static_cast<const SwFmtFld*>(GetDepends())->GetField(); return pFld->GetFormat(); } @@ -551,7 +551,7 @@ sal_uInt16 SwSetExpFieldType::SetSeqRefNo( SwSetExpField& rFld ) if( pF->GetField() != &rFld && pF->GetTxtFld() && 0 != ( pNd = pF->GetTxtFld()->GetpTxtNode() ) && pNd->GetNodes().IsDocNodes() ) - InsertSort( aArr, ((SwSetExpField*)pF->GetField())->GetSeqNumber() ); + InsertSort( aArr, static_cast<SwSetExpField*>(pF->GetField())->GetSeqNumber() ); // check first if number already exists sal_uInt16 nNum = rFld.GetSeqNumber(); @@ -589,7 +589,7 @@ size_t SwSetExpFieldType::GetSeqFldList( SwSeqFldList& rList ) { _SeqFldLstElem* pNew = new _SeqFldLstElem( pNd->GetExpandTxt( 0, -1 ), - ((SwSetExpField*)pF->GetField())->GetSeqNumber() ); + static_cast<SwSetExpField*>(pF->GetField())->GetSeqNumber() ); rList.InsertSort( pNew ); } @@ -823,7 +823,7 @@ OUString SwSetExpField::GetFieldName() const SwField* SwSetExpField::Copy() const { - SwSetExpField *pTmp = new SwSetExpField((SwSetExpFieldType*)GetTyp(), + SwSetExpField *pTmp = new SwSetExpField(static_cast<SwSetExpFieldType*>(GetTyp()), GetFormula(), GetFormat()); pTmp->SwValueField::SetValue(GetValue()); pTmp->sExpand = sExpand; @@ -839,7 +839,7 @@ SwField* SwSetExpField::Copy() const void SwSetExpField::SetSubType(sal_uInt16 nSub) { - ((SwSetExpFieldType*)GetTyp())->SetType(nSub & 0xff); + static_cast<SwSetExpFieldType*>(GetTyp())->SetType(nSub & 0xff); nSubType = nSub & 0xff00; OSL_ENSURE( (nSub & 0xff) != 3, "SubType ist illegal!" ); @@ -847,7 +847,7 @@ void SwSetExpField::SetSubType(sal_uInt16 nSub) sal_uInt16 SwSetExpField::GetSubType() const { - return ((SwSetExpFieldType*)GetTyp())->GetType() | nSubType; + return static_cast<SwSetExpFieldType*>(GetTyp())->GetType() | nSubType; } void SwSetExpField::SetValue( const double& rAny ) @@ -857,14 +857,14 @@ void SwSetExpField::SetValue( const double& rAny ) if( IsSequenceFld() ) sExpand = FormatNumber( (sal_uInt32)GetValue(), GetFormat() ); else - sExpand = ((SwValueFieldType*)GetTyp())->ExpandValue( rAny, + sExpand = static_cast<SwValueFieldType*>(GetTyp())->ExpandValue( rAny, GetFormat(), GetLanguage()); } void SwGetExpField::SetValue( const double& rAny ) { SwValueField::SetValue(rAny); - sExpand = ((SwValueFieldType*)GetTyp())->ExpandValue( rAny, GetFormat(), + sExpand = static_cast<SwValueFieldType*>(GetTyp())->ExpandValue( rAny, GetFormat(), GetLanguage()); } @@ -904,10 +904,10 @@ sal_Int32 SwGetExpField::GetReferenceTextPos( const SwFmtFld& rFmt, SwDoc& rDoc, SwAttrSet aSet(rDoc.GetAttrPool(), nIds); rTxtNode.GetAttr(aSet, nRet, nRet+1); - if( RTL_TEXTENCODING_SYMBOL != ((SvxFontItem&)aSet.Get( + if( RTL_TEXTENCODING_SYMBOL != static_cast<const SvxFontItem&>(aSet.Get( GetWhichOfScript( RES_CHRATR_FONT, nSrcpt )) ).GetCharSet() ) { - LanguageType eLang = ((SvxLanguageItem&)aSet.Get( + LanguageType eLang = static_cast<const SvxLanguageItem&>(aSet.Get( GetWhichOfScript( RES_CHRATR_LANGUAGE, nSrcpt )) ).GetLanguage(); LanguageTag aLanguageTag( eLang); CharClass aCC( aLanguageTag); @@ -932,12 +932,12 @@ sal_Int32 SwGetExpField::GetReferenceTextPos( const SwFmtFld& rFmt, SwDoc& rDoc, OUString SwSetExpField::GetPar1() const { - return ((const SwSetExpFieldType*)GetTyp())->GetName(); + return static_cast<const SwSetExpFieldType*>(GetTyp())->GetName(); } OUString SwSetExpField::GetPar2() const { - sal_uInt16 nType = ((SwSetExpFieldType*)GetTyp())->GetType(); + sal_uInt16 nType = static_cast<SwSetExpFieldType*>(GetTyp())->GetType(); if (nType & nsSwGetSetExpType::GSE_STRING) return GetFormula(); @@ -946,7 +946,7 @@ OUString SwSetExpField::GetPar2() const void SwSetExpField::SetPar2(const OUString& rStr) { - sal_uInt16 nType = ((SwSetExpFieldType*)GetTyp())->GetType(); + sal_uInt16 nType = static_cast<SwSetExpFieldType*>(GetTyp())->GetType(); if( !(nType & nsSwGetSetExpType::GSE_SEQ) || !rStr.isEmpty() ) { diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx index 0827a7f3630c..18d3f30b9212 100644 --- a/sw/source/core/fields/fldbas.cxx +++ b/sw/source/core/fields/fldbas.cxx @@ -204,7 +204,7 @@ sal_uInt16 SwField::GetTypeId() const case RES_SETEXPFLD: if( nsSwGetSetExpType::GSE_SEQ & GetSubType() ) nRet = TYP_SEQFLD; - else if( ((SwSetExpField*)this)->GetInputFlag() ) + else if( static_cast<const SwSetExpField*>(this)->GetInputFlag() ) nRet = TYP_SETINPFLD; else nRet = TYP_SETFLD; @@ -339,7 +339,7 @@ bool SwField::HasClickHdl() const break; case RES_SETEXPFLD: - bRet = ((SwSetExpField*)this)->GetInputFlag(); + bRet = static_cast<const SwSetExpField*>(this)->GetInputFlag(); break; } return bRet; @@ -553,7 +553,7 @@ SwValueField::~SwValueField() */ SwFieldType* SwValueField::ChgTyp( SwFieldType* pNewType ) { - SwDoc* pNewDoc = ((SwValueFieldType *)pNewType)->GetDoc(); + SwDoc* pNewDoc = static_cast<SwValueFieldType *>(pNewType)->GetDoc(); SwDoc* pDoc = GetDoc(); if( pNewDoc && pDoc && pDoc != pNewDoc) @@ -561,7 +561,7 @@ SwFieldType* SwValueField::ChgTyp( SwFieldType* pNewType ) SvNumberFormatter* pFormatter = pNewDoc->GetNumberFormatter(); if( pFormatter && pFormatter->HasMergeFmtTbl() && - ((SwValueFieldType *)GetTyp())->UseFormat() ) + static_cast<SwValueFieldType *>(GetTyp())->UseFormat() ) SetFormat(pFormatter->GetMergeFmtIndex( GetFormat() )); } @@ -603,7 +603,7 @@ sal_uInt32 SwValueField::GetSystemFormat(SvNumberFormatter* pFormatter, sal_uInt void SwValueField::SetLanguage( sal_uInt16 nLng ) { if( IsAutomaticLanguage() && - ((SwValueFieldType *)GetTyp())->UseFormat() && + static_cast<SwValueFieldType *>(GetTyp())->UseFormat() && GetFormat() != SAL_MAX_UINT32 ) { // Bug #60010 @@ -658,7 +658,7 @@ SwFormulaField::SwFormulaField( SwValueFieldType* pFldType, sal_uInt32 nFmt, con } SwFormulaField::SwFormulaField( const SwFormulaField& rFld ) - : SwValueField((SwValueFieldType *)rFld.GetTyp(), rFld.GetFormat(), + : SwValueField(static_cast<SwValueFieldType *>(rFld.GetTyp()), rFld.GetFormat(), rFld.GetLanguage(), rFld.GetValue()) { } @@ -687,7 +687,7 @@ void SwFormulaField::SetExpandedFormula( const OUString& rStr ) { sal_uInt32 nFmt(GetFormat()); - if (nFmt && nFmt != SAL_MAX_UINT32 && ((SwValueFieldType *)GetTyp())->UseFormat()) + if (nFmt && nFmt != SAL_MAX_UINT32 && static_cast<SwValueFieldType *>(GetTyp())->UseFormat()) { double fTmpValue; @@ -697,7 +697,7 @@ void SwFormulaField::SetExpandedFormula( const OUString& rStr ) { SwValueField::SetValue(fTmpValue); - sFormula = ((SwValueFieldType *)GetTyp())->DoubleToString(fTmpValue, nFmt); + sFormula = static_cast<SwValueFieldType *>(GetTyp())->DoubleToString(fTmpValue, nFmt); return; } } @@ -708,7 +708,7 @@ OUString SwFormulaField::GetExpandedFormula() const { sal_uInt32 nFmt(GetFormat()); - if (nFmt && nFmt != SAL_MAX_UINT32 && ((SwValueFieldType *)GetTyp())->UseFormat()) + if (nFmt && nFmt != SAL_MAX_UINT32 && static_cast<SwValueFieldType *>(GetTyp())->UseFormat()) { OUString sFormattedValue; Color* pCol = 0; @@ -717,7 +717,7 @@ OUString SwFormulaField::GetExpandedFormula() const if (pFormatter->IsTextFormat(nFmt)) { - OUString sTempIn(((SwValueFieldType *)GetTyp())->DoubleToString(GetValue(), nFmt)); + OUString sTempIn(static_cast<SwValueFieldType *>(GetTyp())->DoubleToString(GetValue(), nFmt)); pFormatter->GetOutputString(sTempIn, nFmt, sFormattedValue, &pCol); } else diff --git a/sw/source/core/fields/flddat.cxx b/sw/source/core/fields/flddat.cxx index da1be0abef08..ba924d415ab2 100644 --- a/sw/source/core/fields/flddat.cxx +++ b/sw/source/core/fields/flddat.cxx @@ -78,7 +78,7 @@ OUString SwDateTimeField::Expand() const SwField* SwDateTimeField::Copy() const { SwDateTimeField *pTmp = - new SwDateTimeField((SwDateTimeFieldType*)GetTyp(), nSubType, + new SwDateTimeField(static_cast<SwDateTimeFieldType*>(GetTyp()), nSubType, GetFormat(), GetLanguage()); pTmp->SetValue(GetValue()); @@ -156,7 +156,7 @@ tools::Time SwDateTimeField::GetTime(bool bUseOffset) const aDT += fFract; if (bUseOffset) aDT += tools::Time(0, nOffset); - return (tools::Time)aDT; + return static_cast<tools::Time>(aDT); } bool SwDateTimeField::QueryValue( uno::Any& rVal, sal_uInt16 nWhichId ) const diff --git a/sw/source/core/fields/fldlst.cxx b/sw/source/core/fields/fldlst.cxx index e0fd57633305..6a134491781d 100644 --- a/sw/source/core/fields/fldlst.cxx +++ b/sw/source/core/fields/fldlst.cxx @@ -56,7 +56,7 @@ SwInputFieldList::SwInputFieldList( SwEditShell* pShell, bool bBuildTmpLst ) // only process InputFields, interactive SetExpFlds and DropDown fields if( !pTxtFld || ( RES_SETEXPFLD == nType && - !((SwSetExpField*)pFmtFld->GetField())->GetInputFlag())) + !static_cast<SwSetExpField*>(pFmtFld->GetField())->GetInputFlag())) continue; const SwTxtNode& rTxtNode = pTxtFld->GetTxtNode(); @@ -144,7 +144,7 @@ bool SwInputFieldList::BuildSortLst() // process only InputFields and interactive SetExpFlds if( !pTxtFld || ( RES_SETEXPFLD == nType && - !((SwSetExpField*)pFmtFld->GetField())->GetInputFlag())) + !static_cast<SwSetExpField*>(pFmtFld->GetField())->GetInputFlag())) continue; const SwTxtNode& rTxtNode = pTxtFld->GetTxtNode(); diff --git a/sw/source/core/fields/macrofld.cxx b/sw/source/core/fields/macrofld.cxx index 1303ba6ad197..f03ad73e7dca 100644 --- a/sw/source/core/fields/macrofld.cxx +++ b/sw/source/core/fields/macrofld.cxx @@ -54,7 +54,7 @@ OUString SwMacroField::Expand() const SwField* SwMacroField::Copy() const { - return new SwMacroField((SwMacroFieldType*)GetTyp(), aMacro, aText); + return new SwMacroField(static_cast<SwMacroFieldType*>(GetTyp()), aMacro, aText); } OUString SwMacroField::GetFieldName() const diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx index 6c9e20223e37..869950b61ee3 100644 --- a/sw/source/core/fields/reffld.cxx +++ b/sw/source/core/fields/reffld.cxx @@ -83,7 +83,7 @@ static void lcl_GetLayTree( const SwFrm* pFrm, std::vector<const SwFrm*>& rArr ) break; if( pFrm->IsFlyFrm() ) - pFrm = ((SwFlyFrm*)pFrm)->GetAnchorFrm(); + pFrm = static_cast<const SwFlyFrm*>(pFrm)->GetAnchorFrm(); else pFrm = pFrm->GetUpper(); } @@ -93,8 +93,8 @@ static void lcl_GetLayTree( const SwFrm* pFrm, std::vector<const SwFrm*>& rArr ) bool IsFrameBehind( const SwTxtNode& rMyNd, sal_Int32 nMySttPos, const SwTxtNode& rBehindNd, sal_Int32 nSttPos ) { - const SwTxtFrm *pMyFrm = (SwTxtFrm*)rMyNd.getLayoutFrm( rMyNd.GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), 0, 0, false), - *pFrm = (SwTxtFrm*)rBehindNd.getLayoutFrm( rBehindNd.GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), 0, 0, false); + const SwTxtFrm *pMyFrm = static_cast<SwTxtFrm*>(rMyNd.getLayoutFrm( rMyNd.GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), 0, 0, false) ), + *pFrm = static_cast<SwTxtFrm*>(rBehindNd.getLayoutFrm( rBehindNd.GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), 0, 0, false) ); while( pFrm && !pFrm->IsInside( nSttPos ) ) pFrm = (SwTxtFrm*)pFrm->GetFollow(); @@ -274,7 +274,7 @@ void SwGetRefField::UpdateField( const SwTxtFld* pFldTxtAttr ) { sTxt.clear(); - SwDoc* pDoc = ((SwGetRefFieldType*)GetTyp())->GetDoc(); + SwDoc* pDoc = static_cast<SwGetRefFieldType*>(GetTyp())->GetDoc(); // finding the reference target (the number) sal_Int32 nNumStart = -1; sal_Int32 nNumEnd = -1; @@ -418,7 +418,7 @@ void SwGetRefField::UpdateField( const SwTxtFld* pFldTxtAttr ) case REF_PAGE: case REF_PAGE_PGDESC: { - const SwTxtFrm* pFrm = (SwTxtFrm*)pTxtNd->getLayoutFrm( pDoc->getIDocumentLayoutAccess().GetCurrentLayout(), 0, 0, false), + const SwTxtFrm* pFrm = static_cast<SwTxtFrm*>(pTxtNd->getLayoutFrm( pDoc->getIDocumentLayoutAccess().GetCurrentLayout(), 0, 0, false)), *pSave = pFrm; while( pFrm && !pFrm->IsInside( nNumStart ) ) pFrm = (SwTxtFrm*)pFrm->GetFollow(); @@ -571,7 +571,7 @@ OUString SwGetRefField::MakeRefNumStr( const SwTxtNode& rTxtNodeOfField, SwField* SwGetRefField::Copy() const { - SwGetRefField* pFld = new SwGetRefField( (SwGetRefFieldType*)GetTyp(), + SwGetRefField* pFld = new SwGetRefField( static_cast<SwGetRefFieldType*>(GetTyp()), sSetRefName, nSubType, nSeqNo, GetFormat() ); pFld->sTxt = sTxt; @@ -747,7 +747,7 @@ void SwGetRefField::ConvertProgrammaticToUIName() { if(GetTyp() && REF_SEQUENCEFLD == nSubType) { - SwDoc* pDoc = ((SwGetRefFieldType*)GetTyp())->GetDoc(); + SwDoc* pDoc = static_cast<SwGetRefFieldType*>(GetTyp())->GetDoc(); const OUString rPar1 = GetPar1(); // don't convert when the name points to an existing field type if(!pDoc->getIDocumentFieldsAccess().GetFldType(RES_SETEXPFLD, rPar1, false)) @@ -794,7 +794,7 @@ void SwGetRefFieldType::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew { // update only the GetRef fields //JP 3.4.2001: Task 71231 - we need the correct language - SwGetRefField* pGRef = (SwGetRefField*)pFmtFld->GetField(); + SwGetRefField* pGRef = static_cast<SwGetRefField*>(pFmtFld->GetField()); const SwTxtFld* pTFld; if( !pGRef->GetLanguage() && 0 != ( pTFld = pFmtFld->GetTxtFld()) && @@ -838,13 +838,13 @@ SwTxtNode* SwGetRefFieldType::FindAnchor( SwDoc* pDoc, const OUString& rRefMark, { SwFieldType* pFldType = pDoc->getIDocumentFieldsAccess().GetFldType( RES_SETEXPFLD, rRefMark, false ); if( pFldType && pFldType->GetDepends() && - nsSwGetSetExpType::GSE_SEQ & ((SwSetExpFieldType*)pFldType)->GetType() ) + nsSwGetSetExpType::GSE_SEQ & static_cast<SwSetExpFieldType*>(pFldType)->GetType() ) { SwIterator<SwFmtFld,SwFieldType> aIter( *pFldType ); for( SwFmtFld* pFmtFld = aIter.First(); pFmtFld; pFmtFld = aIter.Next() ) { if( pFmtFld->GetTxtFld() && nSeqNo == - ((SwSetExpField*)pFmtFld->GetField())->GetSeqNumber() ) + static_cast<SwSetExpField*>(pFmtFld->GetField())->GetSeqNumber() ) { SwTxtFld* pTxtFld = pFmtFld->GetTxtFld(); pTxtNd = (SwTxtNode*)pTxtFld->GetpTxtNode(); @@ -906,7 +906,7 @@ SwTxtNode* SwGetRefFieldType::FindAnchor( SwDoc* pDoc, const OUString& rRefMark, { SwNodeIndex aIdx( *pIdx, 1 ); if( 0 == ( pTxtNd = aIdx.GetNode().GetTxtNode())) - pTxtNd = (SwTxtNode*)pDoc->GetNodes().GoNext( &aIdx ); + pTxtNd = static_cast<SwTxtNode*>(pDoc->GetNodes().GoNext( &aIdx )); } *pStt = 0; if( pEnd ) @@ -1104,7 +1104,7 @@ void SwGetRefFieldType::MergeWithOtherDoc( SwDoc& rDestDoc ) SwIterator<SwFmtFld,SwFieldType> aIter( *this ); for( SwFmtFld* pFld = aIter.First(); pFld; pFld = aIter.Next() ) { - SwGetRefField& rRefFld = *(SwGetRefField*)pFld->GetField(); + SwGetRefField& rRefFld = *static_cast<SwGetRefField*>(pFld->GetField()); switch( rRefFld.GetSubType() ) { case REF_SEQUENCEFLD: diff --git a/sw/source/core/fields/scrptfld.cxx b/sw/source/core/fields/scrptfld.cxx index 7b55f13f2808..31a933a114e9 100644 --- a/sw/source/core/fields/scrptfld.cxx +++ b/sw/source/core/fields/scrptfld.cxx @@ -52,7 +52,7 @@ OUString SwScriptField::Expand() const SwField* SwScriptField::Copy() const { - return new SwScriptField( (SwScriptFieldType*)GetTyp(), sType, sCode, bCodeURL ); + return new SwScriptField( static_cast<SwScriptFieldType*>(GetTyp()), sType, sCode, bCodeURL ); } /// set type diff --git a/sw/source/core/fields/tblcalc.cxx b/sw/source/core/fields/tblcalc.cxx index 6c47d12866a1..7833da470d10 100644 --- a/sw/source/core/fields/tblcalc.cxx +++ b/sw/source/core/fields/tblcalc.cxx @@ -61,7 +61,7 @@ SwTblField::SwTblField( SwTblFieldType* pInitType, const OUString& rFormel, SwField* SwTblField::Copy() const { - SwTblField* pTmp = new SwTblField( (SwTblFieldType*)GetTyp(), + SwTblField* pTmp = new SwTblField( static_cast<SwTblFieldType*>(GetTyp()), SwTableFormula::GetFormula(), nSubType, GetFormat() ); pTmp->sExpand = sExpand; pTmp->SwValueField::SetValue(GetValue()); @@ -133,7 +133,7 @@ void SwTblField::SetSubType(sal_uInt16 nType) void SwTblField::SetValue( const double& rVal ) { SwValueField::SetValue(rVal); - sExpand = ((SwValueFieldType*)GetTyp())->ExpandValue(rVal, GetFormat(), GetLanguage()); + sExpand = static_cast<SwValueFieldType*>(GetTyp())->ExpandValue(rVal, GetFormat(), GetLanguage()); } OUString SwTblField::GetPar2() const diff --git a/sw/source/core/fields/usrfld.cxx b/sw/source/core/fields/usrfld.cxx index 9f040bff8fec..46279c477ad2 100644 --- a/sw/source/core/fields/usrfld.cxx +++ b/sw/source/core/fields/usrfld.cxx @@ -46,14 +46,14 @@ SwUserField::SwUserField(SwUserFieldType* pTyp, sal_uInt16 nSub, sal_uInt32 nFmt OUString SwUserField::Expand() const { if(!(nSubType & nsSwExtendedSubType::SUB_INVISIBLE)) - return ((SwUserFieldType*)GetTyp())->Expand(GetFormat(), nSubType, GetLanguage()); + return static_cast<SwUserFieldType*>(GetTyp())->Expand(GetFormat(), nSubType, GetLanguage()); return OUString(); } SwField* SwUserField::Copy() const { - SwField* pTmp = new SwUserField((SwUserFieldType*)GetTyp(), nSubType, GetFormat()); + SwField* pTmp = new SwUserField(static_cast<SwUserFieldType*>(GetTyp()), nSubType, GetFormat()); pTmp->SetAutomaticLanguage(IsAutomaticLanguage()); return pTmp; } @@ -67,39 +67,39 @@ OUString SwUserField::GetFieldName() const double SwUserField::GetValue() const { - return ((SwUserFieldType*)GetTyp())->GetValue(); + return static_cast<SwUserFieldType*>(GetTyp())->GetValue(); } void SwUserField::SetValue( const double& rVal ) { - ((SwUserFieldType*)GetTyp())->SetValue(rVal); + static_cast<SwUserFieldType*>(GetTyp())->SetValue(rVal); } /// Get name OUString SwUserField::GetPar1() const { - return ((const SwUserFieldType*)GetTyp())->GetName(); + return static_cast<const SwUserFieldType*>(GetTyp())->GetName(); } /// Get content OUString SwUserField::GetPar2() const { - return ((SwUserFieldType*)GetTyp())->GetContent(GetFormat()); + return static_cast<SwUserFieldType*>(GetTyp())->GetContent(GetFormat()); } void SwUserField::SetPar2(const OUString& rStr) { - ((SwUserFieldType*)GetTyp())->SetContent(rStr, GetFormat()); + static_cast<SwUserFieldType*>(GetTyp())->SetContent(rStr, GetFormat()); } sal_uInt16 SwUserField::GetSubType() const { - return ((SwUserFieldType*)GetTyp())->GetType() | nSubType; + return static_cast<SwUserFieldType*>(GetTyp())->GetType() | nSubType; } void SwUserField::SetSubType(sal_uInt16 nSub) { - ((SwUserFieldType*)GetTyp())->SetType(nSub & 0x00ff); + static_cast<SwUserFieldType*>(GetTyp())->SetType(nSub & 0x00ff); nSubType = nSub & 0xff00; } |