sw/inc/fmtpdsc.hxx | 5 - sw/inc/unodraw.hxx | 2 sw/source/core/doc/DocumentLayoutManager.cxx | 8 +- sw/source/core/doc/DocumentStylePoolManager.cxx | 14 ++-- sw/source/core/doc/extinput.cxx | 8 +- sw/source/core/doc/fmtcol.cxx | 38 +++++------ sw/source/core/doc/ftnidx.cxx | 4 - sw/source/core/doc/gctable.cxx | 12 +-- sw/source/core/doc/htmltbl.cxx | 6 - sw/source/core/doc/lineinfo.cxx | 4 - sw/source/core/doc/notxtfrm.cxx | 24 +++---- sw/source/core/doc/number.cxx | 4 - sw/source/core/doc/swserv.cxx | 34 ++++----- sw/source/core/doc/tblafmt.cxx | 58 ++++++++-------- sw/source/core/doc/tblcpy.cxx | 2 sw/source/core/doc/tblrwcl.cxx | 76 +++++++++++----------- sw/source/core/doc/visiturl.cxx | 4 - sw/source/core/docnode/ndcopy.cxx | 14 ++-- sw/source/core/docnode/ndnotxt.cxx | 4 - sw/source/core/docnode/ndsect.cxx | 24 +++---- sw/source/core/docnode/ndtbl.cxx | 52 +++++++-------- sw/source/core/docnode/ndtbl1.cxx | 30 ++++---- sw/source/core/docnode/node.cxx | 80 +++++++++++------------ sw/source/core/docnode/node2lay.cxx | 40 +++++------ sw/source/core/docnode/nodes.cxx | 82 ++++++++++++------------ 25 files changed, 315 insertions(+), 314 deletions(-)
New commits: commit dca29d672a7a908972fa2735a44fa51fc75c2e93 Author: Noel Grandin <n...@peralex.com> Date: Fri Nov 14 16:10:52 2014 +0200 loplugin: cstylecast Change-Id: I939e4af2ca27b34f78d079bb1e209d9b118eed01 diff --git a/sw/inc/fmtpdsc.hxx b/sw/inc/fmtpdsc.hxx index f095978..6661b32 100644 --- a/sw/inc/fmtpdsc.hxx +++ b/sw/inc/fmtpdsc.hxx @@ -25,6 +25,7 @@ #include <format.hxx> #include <calbck.hxx> #include <boost/optional.hpp> +#include <pagedesc.hxx> class SwPageDesc; class SwHistory; @@ -68,8 +69,8 @@ public: virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE; virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE; - SwPageDesc *GetPageDesc() { return (SwPageDesc*)GetRegisteredIn(); } - const SwPageDesc *GetPageDesc() const { return (SwPageDesc*)GetRegisteredIn(); } + SwPageDesc *GetPageDesc() { return static_cast<SwPageDesc*>(GetRegisteredIn()); } + const SwPageDesc *GetPageDesc() const { return static_cast<const SwPageDesc*>(GetRegisteredIn()); } ::boost::optional<sal_uInt16> GetNumOffset() const { return oNumOffset; } void SetNumOffset( ::boost::optional<sal_uInt16> oNum ) { oNumOffset = oNum; } diff --git a/sw/inc/unodraw.hxx b/sw/inc/unodraw.hxx index 06b4c30..5790b92 100644 --- a/sw/inc/unodraw.hxx +++ b/sw/inc/unodraw.hxx @@ -273,7 +273,7 @@ public: virtual OUString SAL_CALL getShapeType( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; SwShapeDescriptor_Impl* GetDescImpl() {return pImpl;} - SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); } + SwFrmFmt* GetFrmFmt() const { return const_cast<SwFrmFmt*>(static_cast<const SwFrmFmt*>(GetRegisteredIn())); } ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > GetAggregationInterface() {return xShapeAgg;} // helper diff --git a/sw/source/core/doc/DocumentLayoutManager.cxx b/sw/source/core/doc/DocumentLayoutManager.cxx index e1499f1..450fac1 100644 --- a/sw/source/core/doc/DocumentLayoutManager.cxx +++ b/sw/source/core/doc/DocumentLayoutManager.cxx @@ -292,7 +292,7 @@ void DocumentLayoutManager::DelLayoutFmt( SwFrmFmt *pFmt ) if( pCntIdx ) { SwNode *pNode = &pCntIdx->GetNode(); - ((SwFmtCntnt&)pFmt->GetFmtAttr( RES_CNTNT )).SetNewCntntIdx( 0 ); + const_cast<SwFmtCntnt&>(static_cast<const SwFmtCntnt&>(pFmt->GetFmtAttr( RES_CNTNT ))).SetNewCntntIdx( 0 ); m_rDoc.getIDocumentContentOperations().DeleteSection( pNode ); } @@ -369,7 +369,7 @@ SwFrmFmt *DocumentLayoutManager::CopyLayoutFmt( SwFrmFmt* pDest = m_rDoc.GetDfltFrmFmt(); if( rSource.GetRegisteredIn() != pSrcDoc->GetDfltFrmFmt() ) - pDest = m_rDoc.CopyFrmFmt( *(SwFrmFmt*)rSource.GetRegisteredIn() ); + pDest = m_rDoc.CopyFrmFmt( *static_cast<const SwFrmFmt*>(rSource.GetRegisteredIn()) ); if( bFly ) { // #i11176# @@ -450,9 +450,9 @@ SwFrmFmt *DocumentLayoutManager::CopyLayoutFmt( { OSL_ENSURE( RES_DRAWFRMFMT == rSource.Which(), "Neither Fly nor Draw." ); // #i52780# - Note: moving object to visible layer not needed. - SwDrawContact* pSourceContact = (SwDrawContact *)rSource.FindContactObj(); + const SwDrawContact* pSourceContact = static_cast<const SwDrawContact *>(rSource.FindContactObj()); - SwDrawContact* pContact = new SwDrawContact( (SwDrawFrmFmt*)pDest, + SwDrawContact* pContact = new SwDrawContact( static_cast<SwDrawFrmFmt*>(pDest), m_rDoc.CloneSdrObj( *pSourceContact->GetMaster(), m_rDoc.IsCopyIsMove() && &m_rDoc == pSrcDoc ) ); // #i49730# - notify draw frame format that position attributes are diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx b/sw/source/core/doc/DocumentStylePoolManager.cxx index de9496d..089c9a5 100644 --- a/sw/source/core/doc/DocumentStylePoolManager.cxx +++ b/sw/source/core/doc/DocumentStylePoolManager.cxx @@ -114,7 +114,7 @@ namespace }; for( sal_uInt16 n = 0; n < 3; ++n ) { - sal_uInt16 nLng = ((SvxLanguageItem&)rSet.GetPool()->GetDefaultItem( + sal_uInt16 nLng = static_cast<const SvxLanguageItem&>(rSet.GetPool()->GetDefaultItem( aArr[n].nResLngId )).GetLanguage(); vcl::Font aFnt( OutputDevice::GetDefaultFont( nFntType, nLng, DEFAULTFONT_FLAGS_ONLYONE ) ); @@ -143,7 +143,7 @@ namespace for( sal_uInt16 n = 0; n < 3; ++n ) { - sal_uInt16 nLng = ((SvxLanguageItem&)rSet.GetPool()->GetDefaultItem( + sal_uInt16 nLng = static_cast<const SvxLanguageItem&>(rSet.GetPool()->GetDefaultItem( aArr[n].nResLngId )).GetLanguage(); vcl::Font aFnt( OutputDevice::GetDefaultFont( aArr[n].nFntType, nLng, DEFAULTFONT_FLAGS_ONLYONE ) ); @@ -190,7 +190,7 @@ namespace SvxNumberFormat::LABEL_WIDTH_AND_POSITION && ( rNFmt.GetAbsLSpace() || rNFmt.GetFirstLineOffset() ) ) { - SvxLRSpaceItem aLR( (SvxLRSpaceItem&)pColl->GetFmtAttr( RES_LR_SPACE ) ); + SvxLRSpaceItem aLR( static_cast<const SvxLRSpaceItem&>(pColl->GetFmtAttr( RES_LR_SPACE )) ); aLR.SetTxtFirstLineOfstValue( rNFmt.GetFirstLineOffset() ); aLR.SetTxtLeft( rNFmt.GetAbsLSpace() ); pColl->SetFmtAttr( aLR ); @@ -436,7 +436,7 @@ SwTxtFmtColl* DocumentStylePoolManager::GetTxtCollFromPool( sal_uInt16 nId, bool for( const sal_uInt16* pArr = aFntInit; *pArr; pArr += 4 ) { - sal_uInt16 nLng = ((SvxLanguageItem&)m_rDoc.GetDefault( *(pArr+2) )).GetLanguage(); + sal_uInt16 nLng = static_cast<const SvxLanguageItem&>(m_rDoc.GetDefault( *(pArr+2) )).GetLanguage(); if( LANGUAGE_DONTKNOW == nLng ) nLng = *(pArr+3); @@ -1209,7 +1209,7 @@ SwFmt* DocumentStylePoolManager::GetFmtFromPool( sal_uInt16 nId ) case RES_POOLCHR_RUBYTEXT: { - long nH = ((SvxFontHeightItem*)GetDfltAttr( + long nH = static_cast<const SvxFontHeightItem*>(GetDfltAttr( RES_CHRATR_CJK_FONTSIZE ))->GetHeight() / 2; SetAllScriptItem( aSet, SvxFontHeightItem( nH, 100, RES_CHRATR_FONTSIZE)); aSet.Put(SvxUnderlineItem( UNDERLINE_NONE, RES_CHRATR_UNDERLINE )); @@ -1338,12 +1338,12 @@ SwFmt* DocumentStylePoolManager::GetFmtFromPool( sal_uInt16 nId ) SwFrmFmt* DocumentStylePoolManager::GetFrmFmtFromPool( sal_uInt16 nId ) { - return (SwFrmFmt*)GetFmtFromPool( nId ); + return static_cast<SwFrmFmt*>(GetFmtFromPool( nId )); } SwCharFmt* DocumentStylePoolManager::GetCharFmtFromPool( sal_uInt16 nId ) { - return (SwCharFmt*)GetFmtFromPool( nId ); + return static_cast<SwCharFmt*>(GetFmtFromPool( nId )); } SwPageDesc* DocumentStylePoolManager::GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage ) diff --git a/sw/source/core/doc/extinput.cxx b/sw/source/core/doc/extinput.cxx index a222fa0..f7109fa 100644 --- a/sw/source/core/doc/extinput.cxx +++ b/sw/source/core/doc/extinput.cxx @@ -39,7 +39,7 @@ using namespace ::com::sun::star; SwExtTextInput::SwExtTextInput( const SwPaM& rPam, Ring* pRing ) - : SwPaM( *rPam.GetPoint(), (SwPaM*)pRing ), + : SwPaM( *rPam.GetPoint(), static_cast<SwPaM*>(pRing) ), eInputLanguage(LANGUAGE_DONTKNOW) { bIsOverwriteCursor = false; @@ -249,7 +249,7 @@ void SwDoc::DeleteExtTextInput( SwExtTextInput* pDel ) if( pDel == mpExtInputRing ) { if( pDel->GetNext() != mpExtInputRing ) - mpExtInputRing = (SwPaM*)pDel->GetNext(); + mpExtInputRing = static_cast<SwPaM*>(pDel->GetNext()); else mpExtInputRing = 0; } @@ -263,7 +263,7 @@ SwExtTextInput* SwDoc::GetExtTextInput( const SwNode& rNd, if( mpExtInputRing ) { sal_uLong nNdIdx = rNd.GetIndex(); - SwExtTextInput* pTmp = (SwExtTextInput*)mpExtInputRing; + SwExtTextInput* pTmp = static_cast<SwExtTextInput*>(mpExtInputRing); do { sal_uLong nPt = pTmp->GetPoint()->nNode.GetIndex(), nMk = pTmp->GetMark()->nNode.GetIndex(); @@ -293,7 +293,7 @@ SwExtTextInput* SwDoc::GetExtTextInput() const { OSL_ENSURE( !mpExtInputRing || mpExtInputRing == mpExtInputRing->GetNext(), "more than one InputEngine available" ); - return (SwExtTextInput*)mpExtInputRing; + return static_cast<SwExtTextInput*>(mpExtInputRing); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx index 759462c..a27a809 100644 --- a/sw/source/core/doc/fmtcol.cxx +++ b/sw/source/core/doc/fmtcol.cxx @@ -119,21 +119,21 @@ void SwTxtFmtColl::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) } bool bNewParent( false ); // #i66431# - adjust type of <bNewParent> - SvxULSpaceItem *pNewULSpace = 0, *pOldULSpace = 0; - SvxLRSpaceItem *pNewLRSpace = 0, *pOldLRSpace = 0; - SvxFontHeightItem* aFontSizeArr[3] = {0,0,0}; + const SvxULSpaceItem *pNewULSpace = 0, *pOldULSpace = 0; + const SvxLRSpaceItem *pNewLRSpace = 0, *pOldLRSpace = 0; + const SvxFontHeightItem* aFontSizeArr[3] = {0,0,0}; // #i70223# const bool bAssignedToListLevelOfOutlineStyle(IsAssignedToListLevelOfOutlineStyle()); const SwNumRuleItem* pNewNumRuleItem( 0L ); - SwAttrSetChg *pNewChgSet = 0, *pOldChgSet = 0; + const SwAttrSetChg *pNewChgSet = 0, *pOldChgSet = 0; switch( pOld ? pOld->Which() : pNew ? pNew->Which() : 0 ) { case RES_ATTRSET_CHG: // Only recalculate if we're not the sender! - pNewChgSet = (SwAttrSetChg*)pNew; - pOldChgSet = (SwAttrSetChg*)pOld; + pNewChgSet = static_cast<const SwAttrSetChg*>(pNew); + pOldChgSet = static_cast<const SwAttrSetChg*>(pOld); pNewChgSet->GetChgSet()->GetItemState( RES_LR_SPACE, false, (const SfxPoolItem**)&pNewLRSpace ); pNewChgSet->GetChgSet()->GetItemState( @@ -159,36 +159,36 @@ void SwTxtFmtColl::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) if( GetAttrSet().GetParent() ) { const SfxItemSet* pParent = GetAttrSet().GetParent(); - pNewLRSpace = (SvxLRSpaceItem*)&pParent->Get( RES_LR_SPACE ); - pNewULSpace = (SvxULSpaceItem*)&pParent->Get( RES_UL_SPACE ); - aFontSizeArr[0] = (SvxFontHeightItem*)&pParent->Get( RES_CHRATR_FONTSIZE ); - aFontSizeArr[1] = (SvxFontHeightItem*)&pParent->Get( RES_CHRATR_CJK_FONTSIZE ); - aFontSizeArr[2] = (SvxFontHeightItem*)&pParent->Get( RES_CHRATR_CTL_FONTSIZE ); + pNewLRSpace = static_cast<const SvxLRSpaceItem*>(&pParent->Get( RES_LR_SPACE )); + pNewULSpace = static_cast<const SvxULSpaceItem*>(&pParent->Get( RES_UL_SPACE )); + aFontSizeArr[0] = static_cast<const SvxFontHeightItem*>(&pParent->Get( RES_CHRATR_FONTSIZE )); + aFontSizeArr[1] = static_cast<const SvxFontHeightItem*>(&pParent->Get( RES_CHRATR_CJK_FONTSIZE )); + aFontSizeArr[2] = static_cast<const SvxFontHeightItem*>(&pParent->Get( RES_CHRATR_CTL_FONTSIZE )); // #i66431# - modify has to be propagated, because of new parent format. bNewParent = true; } break; case RES_LR_SPACE: - pNewLRSpace = (SvxLRSpaceItem*)pNew; + pNewLRSpace = static_cast<const SvxLRSpaceItem*>(pNew); break; case RES_UL_SPACE: - pNewULSpace = (SvxULSpaceItem*)pNew; + pNewULSpace = static_cast<const SvxULSpaceItem*>(pNew); break; case RES_CHRATR_FONTSIZE: - aFontSizeArr[0] = (SvxFontHeightItem*)pNew; + aFontSizeArr[0] = static_cast<const SvxFontHeightItem*>(pNew); break; case RES_CHRATR_CJK_FONTSIZE: - aFontSizeArr[1] = (SvxFontHeightItem*)pNew; + aFontSizeArr[1] = static_cast<const SvxFontHeightItem*>(pNew); break; case RES_CHRATR_CTL_FONTSIZE: - aFontSizeArr[2] = (SvxFontHeightItem*)pNew; + aFontSizeArr[2] = static_cast<const SvxFontHeightItem*>(pNew); break; // #i70223# case RES_PARATR_NUMRULE: if (bAssignedToListLevelOfOutlineStyle) { - pNewNumRuleItem = (SwNumRuleItem*)pNew; + pNewNumRuleItem = static_cast<const SwNumRuleItem*>(pNew); } break; default: @@ -280,7 +280,7 @@ void SwTxtFmtColl::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) for( int nC = 0, nArrLen = sizeof(aFontSizeArr) / sizeof( aFontSizeArr[0]); nC < nArrLen; ++nC ) { - SvxFontHeightItem *pFSize = aFontSizeArr[ nC ], *pOldFSize; + const SvxFontHeightItem *pFSize = aFontSizeArr[ nC ], *pOldFSize; if( pFSize && SfxItemState::SET == GetItemState( pFSize->Which(), false, (const SfxPoolItem**)&pOldFSize ) && // Avoid recursion (SetAttr!) @@ -616,7 +616,7 @@ void SwTxtFmtColl::SetAttrOutlineLevel( int nLevel) int SwTxtFmtColl::GetAttrOutlineLevel() const { - return ((const SfxUInt16Item &)GetFmtAttr(RES_PARATR_OUTLINELEVEL)).GetValue(); + return static_cast<const SfxUInt16Item &>(GetFmtAttr(RES_PARATR_OUTLINELEVEL)).GetValue(); } int SwTxtFmtColl::GetAssignedOutlineStyleLevel() const diff --git a/sw/source/core/doc/ftnidx.cxx b/sw/source/core/doc/ftnidx.cxx index fd8fa56..df909db 100644 --- a/sw/source/core/doc/ftnidx.cxx +++ b/sw/source/core/doc/ftnidx.cxx @@ -287,7 +287,7 @@ const SwSectionNode* SwUpdFtnEndNtAtEnd::FindSectNdWithEndAttr( sal_uInt16 nVal; const SwSectionNode* pNd = rTxtFtn.GetTxtNode().FindSectionNode(); while( pNd && FTNEND_ATTXTEND_OWNNUMSEQ != ( nVal = - ((const SwFmtFtnEndAtTxtEnd&)pNd->GetSection().GetFmt()-> + static_cast<const SwFmtFtnEndAtTxtEnd&>(pNd->GetSection().GetFmt()-> GetFmtAttr( nWh, true )).GetValue() ) && FTNEND_ATTXTEND_OWNNUMANDFMT != nVal ) pNd = pNd->StartOfSectionNode()->FindSectionNode(); @@ -324,7 +324,7 @@ sal_uInt16 SwUpdFtnEndNtAtEnd::GetNumber( const SwTxtFtn& rTxtFtn, if( !nRet ) { pArr->push_back( &rNd ); - nRet = ((SwFmtFtnEndAtTxtEnd&)rNd.GetSection().GetFmt()-> + nRet = static_cast<const SwFmtFtnEndAtTxtEnd&>(rNd.GetSection().GetFmt()-> GetFmtAttr( nWh )).GetOffset(); ++nRet; pNum->push_back( nRet ); diff --git a/sw/source/core/doc/gctable.cxx b/sw/source/core/doc/gctable.cxx index bac1c50..705670a 100644 --- a/sw/source/core/doc/gctable.cxx +++ b/sw/source/core/doc/gctable.cxx @@ -36,7 +36,7 @@ bool _SwGCBorder_BoxBrd::CheckLeftBorderOfFormat( const SwFrmFmt& rFmt ) const SvxBorderLine* pBrd; const SfxPoolItem* pItem; if( SfxItemState::SET == rFmt.GetItemState( RES_BOX, true, &pItem ) && - 0 != ( pBrd = ((SvxBoxItem*)pItem)->GetLeft() ) ) + 0 != ( pBrd = static_cast<const SvxBoxItem*>(pItem)->GetLeft() ) ) { if( *pBrdLn == *pBrd ) bAnyBorderFnd = true; @@ -105,7 +105,7 @@ static sal_uInt16 lcl_FindEndPosOfBorder( const SwCollectTblLineBoxes& rCollTLB, const SwTableBox& rBox = rCollTLB.GetBox( rStt, &nPos ); if( SfxItemState::SET != rBox.GetFrmFmt()->GetItemState(RES_BOX,true, &pItem ) - || 0 == ( pBrd = GetLineTB( (SvxBoxItem*)pItem, bTop )) + || 0 == ( pBrd = GetLineTB( static_cast<const SvxBoxItem*>(pItem), bTop )) || !( *pBrd == rBrdLn )) break; nLastPos = nPos; @@ -118,7 +118,7 @@ static inline const SvxBorderLine* lcl_GCBorder_GetBorder( const SwTableBox& rBo const SfxPoolItem** ppItem ) { return SfxItemState::SET == rBox.GetFrmFmt()->GetItemState( RES_BOX, true, ppItem ) - ? GetLineTB( (SvxBoxItem*)*ppItem, bTop ) + ? GetLineTB( static_cast<const SvxBoxItem*>(*ppItem), bTop ) : 0; } @@ -136,7 +136,7 @@ static void lcl_GCBorder_DelBorder( const SwCollectTblLineBoxes& rCollTLB, do { if( pLn && *pLn == rLine ) { - SvxBoxItem aBox( *(SvxBoxItem*)pItem ); + SvxBoxItem aBox( *static_cast<const SvxBoxItem*>(pItem) ); if( bTop ) aBox.SetLine( 0, BOX_LINE_TOP ); else @@ -185,14 +185,14 @@ void sw_GC_Line_Border( const SwTableLine* pLine, _SwGCLineBorder* pGCPara ) for( sal_uInt16 i = aBoxes.size(); i; ) if( SfxItemState::SET == (pBox = aBoxes[ --i ])->GetFrmFmt()-> GetItemState( RES_BOX, true, &pItem ) && - 0 != ( pBrd = ((SvxBoxItem*)pItem)->GetRight() ) ) + 0 != ( pBrd = static_cast<const SvxBoxItem*>(pItem)->GetRight() ) ) { aBPara.SetBorder( *pBrd ); const SwTableBox* pNextBox = rBoxes[n+1]; if( lcl_GCBorder_ChkBoxBrd_B( pNextBox, &aBPara ) && aBPara.IsAnyBorderFound() ) { - SvxBoxItem aBox( *(SvxBoxItem*)pItem ); + SvxBoxItem aBox( *static_cast<const SvxBoxItem*>(pItem) ); aBox.SetLine( 0, BOX_LINE_RIGHT ); if( pGCPara->pShareFmts ) pGCPara->pShareFmts->SetAttr( *pBox, aBox ); diff --git a/sw/source/core/doc/htmltbl.cxx b/sw/source/core/doc/htmltbl.cxx index 3cb6556..9c219df 100644 --- a/sw/source/core/doc/htmltbl.cxx +++ b/sw/source/core/doc/htmltbl.cxx @@ -380,12 +380,12 @@ sal_uInt16 SwHTMLTableLayout::GetBrowseWidthByTabFrm( const SwFrm *pUpper = rTabFrm.GetUpper(); if( MayBeInFlyFrame() && pUpper->IsFlyFrm() && - ((const SwFlyFrm *)pUpper)->GetAnchorFrm() ) + static_cast<const SwFlyFrm *>(pUpper)->GetAnchorFrm() ) { // If the table is located within a self-created frame, the anchor's // width is relevant not the frame's width. // For paragraph-bound frames we don't respect paragraph indents. - const SwFrm *pAnchor = ((const SwFlyFrm *)pUpper)->GetAnchorFrm(); + const SwFrm *pAnchor = static_cast<const SwFlyFrm *>(pUpper)->GetAnchorFrm(); if( pAnchor->IsTxtFrm() ) nWidth = pAnchor->Frm().Width(); else @@ -461,7 +461,7 @@ static void lcl_GetMinMaxSize( sal_uLong& rMinNoAlignCnts, sal_uLong& rMaxNoAlig while( pColl && !pColl->IsDefault() && (USER_FMT & pColl->GetPoolFmtId()) ) { - pColl = (const SwFmtColl *)pColl->DerivedFrom(); + pColl = static_cast<const SwFmtColl *>(pColl->DerivedFrom()); } // <NOBR> in the whole cell apply to text but not to tables. diff --git a/sw/source/core/doc/lineinfo.cxx b/sw/source/core/doc/lineinfo.cxx index cfa0ab8..960a309 100644 --- a/sw/source/core/doc/lineinfo.cxx +++ b/sw/source/core/doc/lineinfo.cxx @@ -123,7 +123,7 @@ SwCharFmt* SwLineNumberInfo::GetCharFmt( IDocumentStylePoolAccess& rIDSPA ) cons SwCharFmt* pFmt = rIDSPA.GetCharFmtFromPool( RES_POOLCHR_LINENUM ); pFmt->Add( (SwClient*)this ); } - return (SwCharFmt*)GetRegisteredIn(); + return const_cast<SwCharFmt*>(static_cast<const SwCharFmt*>(GetRegisteredIn())); } void SwLineNumberInfo::SetCharFmt( SwCharFmt *pChFmt ) @@ -135,7 +135,7 @@ void SwLineNumberInfo::SetCharFmt( SwCharFmt *pChFmt ) void SwLineNumberInfo::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) { CheckRegistration( pOld, pNew ); - SwDoc *pDoc = ((SwCharFmt*)GetRegisteredIn())->GetDoc(); + SwDoc *pDoc = static_cast<SwCharFmt*>(GetRegisteredIn())->GetDoc(); SwRootFrm* pRoot = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); if( pRoot ) { diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index 8ee1638..55c690b 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -227,7 +227,7 @@ void SwNoTxtFrm::Paint(SwRect const& rRect, SwPrintData const*const) const const SwNoTxtNode* pNd = GetNode()->GetNoTxtNode(); OUString aTxt( pNd->GetTitle() ); if ( aTxt.isEmpty() && pNd->IsGrfNode() ) - GetRealURL( *(SwGrfNode*)pNd, aTxt ); + GetRealURL( *static_cast<const SwGrfNode*>(pNd), aTxt ); if( aTxt.isEmpty() ) aTxt = FindFlyFrm()->GetFmt()->GetName(); lcl_PaintReplacement( Frm(), aTxt, *pSh, this, false ); @@ -247,7 +247,7 @@ void SwNoTxtFrm::Paint(SwRect const& rRect, SwPrintData const*const) const bool bClip = true; tools::PolyPolygon aPoly; - SwNoTxtNode& rNoTNd = *(SwNoTxtNode*)GetNode(); + SwNoTxtNode& rNoTNd = const_cast<SwNoTxtNode&>(*static_cast<const SwNoTxtNode*>(GetNode())); SwGrfNode* pGrfNd = rNoTNd.GetGrfNode(); if( pGrfNd ) pGrfNd->SetFrameInPaint( true ); @@ -364,7 +364,7 @@ void SwNoTxtFrm::GetGrfArea( SwRect &rRect, SwRect* pOrigRect, // We read graphic from the Node, if needed. // It may fail, however. long nLeftCrop, nRightCrop, nTopCrop, nBottomCrop; - Size aOrigSz( ((SwNoTxtNode*)GetNode())->GetTwipSize() ); + Size aOrigSz( static_cast<const SwNoTxtNode*>(GetNode())->GetTwipSize() ); if ( !aOrigSz.Width() ) { aOrigSz.Width() = Prt().Width(); @@ -578,7 +578,7 @@ void SwNoTxtFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) if( ND_GRFNODE == GetNode()->GetNodeType() ) { bComplete = false; - SwGrfNode* pNd = (SwGrfNode*) GetNode(); + SwGrfNode* pNd = static_cast<SwGrfNode*>( GetNode()); SwViewShell *pVSh = pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); if( pVSh ) @@ -597,7 +597,7 @@ void SwNoTxtFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) else pSh->GetWin()->Invalidate( Frm().SVRect() ); } - } while( pVSh != (pSh = (SwViewShell*)pSh->GetNext() )); + } while( pVSh != (pSh = static_cast<SwViewShell*>(pSh->GetNext()) )); } } } @@ -609,17 +609,17 @@ void SwNoTxtFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) } // fall through case RES_FMT_CHG: - CLEARCACHE( (SwGrfNode*) GetNode() ) + CLEARCACHE( static_cast<SwGrfNode*>( GetNode()) ) break; case RES_ATTRSET_CHG: { sal_uInt16 n; for( n = RES_GRFATR_BEGIN; n < RES_GRFATR_END; ++n ) - if( SfxItemState::SET == ((SwAttrSetChg*)pOld)->GetChgSet()-> + if( SfxItemState::SET == static_cast<const SwAttrSetChg*>(pOld)->GetChgSet()-> GetItemState( n, false )) { - CLEARCACHE( (SwGrfNode*) GetNode() ) + CLEARCACHE( static_cast<SwGrfNode*>( GetNode()) ) break; } if( RES_GRFATR_END == n ) // not found @@ -634,7 +634,7 @@ void SwNoTxtFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) if ( GetNode()->GetNodeType() == ND_GRFNODE ) { bComplete = false; - SwGrfNode* pNd = (SwGrfNode*) GetNode(); + SwGrfNode* pNd = static_cast<SwGrfNode*>( GetNode()); CLEARCACHE( pNd ) @@ -659,7 +659,7 @@ void SwNoTxtFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) pSh->GetWin()->Invalidate( aRect.SVRect() ); } - pSh = (SwViewShell *)pSh->GetNext(); + pSh = static_cast<SwViewShell *>(pSh->GetNext()); } while( pSh != pVSh ); } break; @@ -836,7 +836,7 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons { SwViewShell* pShell = getRootFrm()->GetCurrShell(); - SwNoTxtNode& rNoTNd = *(SwNoTxtNode*)GetNode(); + SwNoTxtNode& rNoTNd = const_cast<SwNoTxtNode&>(*static_cast<const SwNoTxtNode*>(GetNode())); SwGrfNode* pGrfNd = rNoTNd.GetGrfNode(); SwOLENode* pOLENd = rNoTNd.GetOLENode(); @@ -1049,7 +1049,7 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons { const SwFlyFrm *pFly = FindFlyFrm(); assert( pFly != NULL ); - ((SwFEShell*)pShell)->ConnectObj( pOLENd->GetOLEObj().GetObject(), pFly->Prt(), pFly->Frm()); + static_cast<SwFEShell*>(pShell)->ConnectObj( pOLENd->GetOLEObj().GetObject(), pFly->Prt(), pFly->Frm()); } } diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx index 5725862..0667e46 100644 --- a/sw/source/core/doc/number.cxx +++ b/sw/source/core/doc/number.cxx @@ -312,8 +312,8 @@ void SwNumFmt::SetCharFmtName(const OUString& rSet) OUString SwNumFmt::GetCharFmtName() const { - if((SwCharFmt*)GetRegisteredIn()) - return ((SwCharFmt*)GetRegisteredIn())->GetName(); + if(static_cast<const SwCharFmt*>(GetRegisteredIn())) + return static_cast<const SwCharFmt*>(GetRegisteredIn())->GetName(); return OUString(); } diff --git a/sw/source/core/doc/swserv.cxx b/sw/source/core/doc/swserv.cxx index d2c1129..de948b2 100644 --- a/sw/source/core/doc/swserv.cxx +++ b/sw/source/core/doc/swserv.cxx @@ -234,24 +234,24 @@ bool SwServerObject::IsLinkInServer( const SwBaseLink* pChkLnk ) const SwServerObject::ServerModes eSave = eType; if( !pChkLnk ) ((SwServerObject*)this)->eType = NONE_SERVER; - for( sal_uInt16 n = rLnks.size(); n; ) + for( sal_uInt16 n = rLnks.size(); n; ) + { + const ::sfx2::SvBaseLink* pLnk = &(*rLnks[ --n ]); + if( pLnk && OBJECT_CLIENT_GRF != pLnk->GetObjType() && + pLnk->ISA( SwBaseLink ) && + !static_cast<const SwBaseLink*>(pLnk)->IsNoDataFlag() && + static_cast<const SwBaseLink*>(pLnk)->IsInRange( nSttNd, nEndNd, nStt, nEnd )) + { + if( pChkLnk ) { - const ::sfx2::SvBaseLink* pLnk = &(*rLnks[ --n ]); - if( pLnk && OBJECT_CLIENT_GRF != pLnk->GetObjType() && - pLnk->ISA( SwBaseLink ) && - !((SwBaseLink*)pLnk)->IsNoDataFlag() && - ((SwBaseLink*)pLnk)->IsInRange( nSttNd, nEndNd, nStt, nEnd )) - { - if( pChkLnk ) - { - if( pLnk == pChkLnk || - ((SwBaseLink*)pLnk)->IsRecursion( pChkLnk ) ) - return true; - } - else if( ((SwBaseLink*)pLnk)->IsRecursion( (SwBaseLink*)pLnk ) ) - ((SwBaseLink*)pLnk)->SetNoDataFlag(); - } + if( pLnk == pChkLnk || + static_cast<const SwBaseLink*>(pLnk)->IsRecursion( pChkLnk ) ) + return true; } + else if( static_cast<const SwBaseLink*>(pLnk)->IsRecursion( static_cast<const SwBaseLink*>(pLnk) ) ) + const_cast<SwBaseLink*>(static_cast<const SwBaseLink*>(pLnk))->SetNoDataFlag(); + } + } if( !pChkLnk ) ((SwServerObject*)this)->eType = eSave; } @@ -314,7 +314,7 @@ SwDataChanged::~SwDataChanged() // Any one else interested in the Object? if( refObj->HasDataLinks() && refObj->ISA( SwServerObject )) { - SwServerObject& rObj = *(SwServerObject*)&refObj; + SwServerObject& rObj = *static_cast<SwServerObject*>(&refObj); if( pPos ) rObj.SendDataChanged( *pPos ); else diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx index 27d40cc..e3fd50c 100644 --- a/sw/source/core/doc/tblafmt.cxx +++ b/sw/source/core/doc/tblafmt.cxx @@ -257,17 +257,17 @@ void SwAfVersions::Load( SvStream& rStream, sal_uInt16 nVer ) } SwBoxAutoFmt::SwBoxAutoFmt() - : aFont( *(SvxFontItem*)GetDfltAttr( RES_CHRATR_FONT ) ), + : aFont( *static_cast<const SvxFontItem*>(GetDfltAttr( RES_CHRATR_FONT )) ), aHeight( 240, 100, RES_CHRATR_FONTSIZE ), aWeight( WEIGHT_NORMAL, RES_CHRATR_WEIGHT ), aPosture( ITALIC_NONE, RES_CHRATR_POSTURE ), - aCJKFont( *(SvxFontItem*)GetDfltAttr( RES_CHRATR_CJK_FONT ) ), + aCJKFont( *static_cast<const SvxFontItem*>(GetDfltAttr( RES_CHRATR_CJK_FONT )) ), aCJKHeight( 240, 100, RES_CHRATR_CJK_FONTSIZE ), aCJKWeight( WEIGHT_NORMAL, RES_CHRATR_CJK_WEIGHT ), aCJKPosture( ITALIC_NONE, RES_CHRATR_CJK_POSTURE ), - aCTLFont( *(SvxFontItem*)GetDfltAttr( RES_CHRATR_CTL_FONT ) ), + aCTLFont( *static_cast<const SvxFontItem*>(GetDfltAttr( RES_CHRATR_CTL_FONT )) ), aCTLHeight( 240, 100, RES_CHRATR_CTL_FONTSIZE ), aCTLWeight( WEIGHT_NORMAL, RES_CHRATR_CTL_WEIGHT ), aCTLPosture( ITALIC_NONE, RES_CHRATR_CTL_POSTURE ), @@ -389,7 +389,7 @@ SwBoxAutoFmt& SwBoxAutoFmt::operator=( const SwBoxAutoFmt& rNew ) #define READ( aItem, aItemType, nVers )\ pNew = aItem.Create(rStream, nVers ); \ - aItem = *(aItemType*)pNew; \ + aItem = *static_cast<aItemType*>(pNew); \ delete pNew; bool SwBoxAutoFmt::Load( SvStream& rStream, const SwAfVersions& rVersions, sal_uInt16 nVer ) @@ -439,7 +439,7 @@ bool SwBoxAutoFmt::Load( SvStream& rStream, const SwAfVersions& rVersions, sal_u READ( aBackground, SvxBrushItem , rVersions.nBrushVersion) pNew = aAdjust.Create(rStream, rVersions.nAdjustVersion ); - SetAdjust( *(SvxAdjustItem*)pNew ); + SetAdjust( *static_cast<SvxAdjustItem*>(pNew) ); delete pNew; if (nVer >= AUTOFORMAT_DATA_ID_31005 && WriterSpecificBlockExists(rStream)) @@ -455,16 +455,16 @@ bool SwBoxAutoFmt::Load( SvStream& rStream, const SwAfVersions& rVersions, sal_u READ( aMargin, SvxMarginItem , rVersions.nMarginVersion) pNew = aLinebreak.Create(rStream, rVersions.nBoolVersion ); - aLinebreak.SetValue( ((SfxBoolItem*)pNew)->GetValue() ); + aLinebreak.SetValue( static_cast<SfxBoolItem*>(pNew)->GetValue() ); delete pNew; if ( nVer >= AUTOFORMAT_DATA_ID_504 ) { pNew = aRotateAngle.Create( rStream, rVersions.nInt32Version ); - aRotateAngle.SetValue( ((SfxInt32Item*)pNew)->GetValue() ); + aRotateAngle.SetValue( static_cast<SfxInt32Item*>(pNew)->GetValue() ); delete pNew; pNew = aRotateMode.Create( rStream, rVersions.nRotateModeVersion ); - aRotateMode.SetValue( ((SvxRotateModeItem*)pNew)->GetValue() ); + aRotateMode.SetValue( static_cast<SvxRotateModeItem*>(pNew)->GetValue() ); delete pNew; } @@ -699,33 +699,33 @@ void SwTableAutoFmt::UpdateFromSet( sal_uInt8 nPos, if( UPDATE_CHAR & eFlags ) { - pFmt->SetFont( (SvxFontItem&)rSet.Get( RES_CHRATR_FONT ) ); - pFmt->SetHeight( (SvxFontHeightItem&)rSet.Get( RES_CHRATR_FONTSIZE ) ); - pFmt->SetWeight( (SvxWeightItem&)rSet.Get( RES_CHRATR_WEIGHT ) ); - pFmt->SetPosture( (SvxPostureItem&)rSet.Get( RES_CHRATR_POSTURE ) ); - pFmt->SetCJKFont( (SvxFontItem&)rSet.Get( RES_CHRATR_CJK_FONT ) ); - pFmt->SetCJKHeight( (SvxFontHeightItem&)rSet.Get( RES_CHRATR_CJK_FONTSIZE ) ); - pFmt->SetCJKWeight( (SvxWeightItem&)rSet.Get( RES_CHRATR_CJK_WEIGHT ) ); - pFmt->SetCJKPosture( (SvxPostureItem&)rSet.Get( RES_CHRATR_CJK_POSTURE ) ); - pFmt->SetCTLFont( (SvxFontItem&)rSet.Get( RES_CHRATR_CTL_FONT ) ); - pFmt->SetCTLHeight( (SvxFontHeightItem&)rSet.Get( RES_CHRATR_CTL_FONTSIZE ) ); - pFmt->SetCTLWeight( (SvxWeightItem&)rSet.Get( RES_CHRATR_CTL_WEIGHT ) ); - pFmt->SetCTLPosture( (SvxPostureItem&)rSet.Get( RES_CHRATR_CTL_POSTURE ) ); - pFmt->SetUnderline( (SvxUnderlineItem&)rSet.Get( RES_CHRATR_UNDERLINE ) ); - pFmt->SetOverline( (SvxOverlineItem&)rSet.Get( RES_CHRATR_OVERLINE ) ); - pFmt->SetCrossedOut( (SvxCrossedOutItem&)rSet.Get( RES_CHRATR_CROSSEDOUT ) ); - pFmt->SetContour( (SvxContourItem&)rSet.Get( RES_CHRATR_CONTOUR ) ); - pFmt->SetShadowed( (SvxShadowedItem&)rSet.Get( RES_CHRATR_SHADOWED ) ); - pFmt->SetColor( (SvxColorItem&)rSet.Get( RES_CHRATR_COLOR ) ); - pFmt->SetAdjust( (SvxAdjustItem&)rSet.Get( RES_PARATR_ADJUST ) ); + pFmt->SetFont( static_cast<const SvxFontItem&>(rSet.Get( RES_CHRATR_FONT )) ); + pFmt->SetHeight( static_cast<const SvxFontHeightItem&>(rSet.Get( RES_CHRATR_FONTSIZE )) ); + pFmt->SetWeight( static_cast<const SvxWeightItem&>(rSet.Get( RES_CHRATR_WEIGHT )) ); + pFmt->SetPosture( static_cast<const SvxPostureItem&>(rSet.Get( RES_CHRATR_POSTURE )) ); + pFmt->SetCJKFont( static_cast<const SvxFontItem&>(rSet.Get( RES_CHRATR_CJK_FONT )) ); + pFmt->SetCJKHeight( static_cast<const SvxFontHeightItem&>(rSet.Get( RES_CHRATR_CJK_FONTSIZE )) ); + pFmt->SetCJKWeight( static_cast<const SvxWeightItem&>(rSet.Get( RES_CHRATR_CJK_WEIGHT )) ); + pFmt->SetCJKPosture( static_cast<const SvxPostureItem&>(rSet.Get( RES_CHRATR_CJK_POSTURE )) ); + pFmt->SetCTLFont( static_cast<const SvxFontItem&>(rSet.Get( RES_CHRATR_CTL_FONT )) ); + pFmt->SetCTLHeight( static_cast<const SvxFontHeightItem&>(rSet.Get( RES_CHRATR_CTL_FONTSIZE )) ); + pFmt->SetCTLWeight( static_cast<const SvxWeightItem&>(rSet.Get( RES_CHRATR_CTL_WEIGHT )) ); + pFmt->SetCTLPosture( static_cast<const SvxPostureItem&>(rSet.Get( RES_CHRATR_CTL_POSTURE )) ); + pFmt->SetUnderline( static_cast<const SvxUnderlineItem&>(rSet.Get( RES_CHRATR_UNDERLINE )) ); + pFmt->SetOverline( static_cast<const SvxOverlineItem&>(rSet.Get( RES_CHRATR_OVERLINE )) ); + pFmt->SetCrossedOut( static_cast<const SvxCrossedOutItem&>(rSet.Get( RES_CHRATR_CROSSEDOUT )) ); + pFmt->SetContour( static_cast<const SvxContourItem&>(rSet.Get( RES_CHRATR_CONTOUR )) ); + pFmt->SetShadowed( static_cast<const SvxShadowedItem&>(rSet.Get( RES_CHRATR_SHADOWED )) ); + pFmt->SetColor( static_cast<const SvxColorItem&>(rSet.Get( RES_CHRATR_COLOR )) ); + pFmt->SetAdjust( static_cast<const SvxAdjustItem&>(rSet.Get( RES_PARATR_ADJUST )) ); } if( UPDATE_BOX & eFlags ) { - pFmt->SetBox( (SvxBoxItem&)rSet.Get( RES_BOX ) ); + pFmt->SetBox( static_cast<const SvxBoxItem&>(rSet.Get( RES_BOX )) ); // FIXME - add attribute IDs for the diagonal line items // pFmt->SetTLBR( (SvxLineItem&)rSet.Get( RES_... ) ); // pFmt->SetBLTR( (SvxLineItem&)rSet.Get( RES_... ) ); - pFmt->SetBackground( (SvxBrushItem&)rSet.Get( RES_BACKGROUND ) ); + pFmt->SetBackground( static_cast<const SvxBrushItem&>(rSet.Get( RES_BACKGROUND )) ); pFmt->SetTextOrientation(static_cast<const SvxFrameDirectionItem&>(rSet.Get(RES_FRAMEDIR))); pFmt->SetVerticalAlignment(static_cast<const SwFmtVertOrient&>(rSet.Get(RES_VERT_ORIENT))); diff --git a/sw/source/core/doc/tblcpy.cxx b/sw/source/core/doc/tblcpy.cxx index 4836b63..d9bb700 100644 --- a/sw/source/core/doc/tblcpy.cxx +++ b/sw/source/core/doc/tblcpy.cxx @@ -649,7 +649,7 @@ static void lcl_CpyBox( const SwTable& rCpyTbl, const SwTableBox* pCpyBox, if( pN && pN->HasMergeFmtTbl() && SfxItemState::SET == aBoxAttrSet. GetItemState( RES_BOXATR_FORMAT, false, &pItem ) ) { - sal_uLong nOldIdx = ((SwTblBoxNumFormat*)pItem)->GetValue(); + sal_uLong nOldIdx = static_cast<const SwTblBoxNumFormat*>(pItem)->GetValue(); sal_uLong nNewIdx = pN->GetMergeFmtIndex( nOldIdx ); if( nNewIdx != nOldIdx ) aBoxAttrSet.Put( SwTblBoxNumFormat( nNewIdx )); diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index fd5da9f..227091d 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -298,7 +298,7 @@ static void lcl_CopyCol( _FndBox & rFndBox, _CpyPara *const pCpyPara) { // Look up the Frame Format in the Frame Format Array SwTableBox* pBox = rFndBox.GetBox(); - _CpyTabFrm aFindFrm( (SwTableBoxFmt*)pBox->GetFrmFmt() ); + _CpyTabFrm aFindFrm( static_cast<SwTableBoxFmt*>(pBox->GetFrmFmt()) ); sal_uInt16 nFndPos; if( pCpyPara->nCpyCnt ) @@ -308,7 +308,7 @@ static void lcl_CopyCol( _FndBox & rFndBox, _CpyPara *const pCpyPara) if( itFind == pCpyPara->rTabFrmArr.end() || !(*itFind == aFindFrm) ) { // For nested copying, also save the new Format as an old one. - SwTableBoxFmt* pNewFmt = (SwTableBoxFmt*)pBox->ClaimFrmFmt(); + SwTableBoxFmt* pNewFmt = static_cast<SwTableBoxFmt*>(pBox->ClaimFrmFmt()); // Find the selected Boxes in the Line: _FndLine const* pCmpLine = NULL; @@ -367,7 +367,7 @@ static void lcl_CopyCol( _FndBox & rFndBox, _CpyPara *const pCpyPara) itFind != pCpyPara->rTabFrmArr.end() ) aFindFrm = *itFind; else - aFindFrm.pNewFrmFmt = (SwTableBoxFmt*)pBox->GetFrmFmt(); + aFindFrm.pNewFrmFmt = static_cast<SwTableBoxFmt*>(pBox->GetFrmFmt()); } if (!rFndBox.GetLines().empty()) @@ -396,7 +396,7 @@ static void lcl_CopyCol( _FndBox & rFndBox, _CpyPara *const pCpyPara) ? rBoxItem.GetTop() : rBoxItem.GetRight() ) { - aFindFrm.Value.pFrmFmt = (SwTableBoxFmt*)pBox->GetFrmFmt(); + aFindFrm.Value.pFrmFmt = static_cast<SwTableBoxFmt*>(pBox->GetFrmFmt()); SvxBoxItem aNew( rBoxItem ); if( 8 > pCpyPara->nDelBorderFlag ) @@ -412,7 +412,7 @@ static void lcl_CopyCol( _FndBox & rFndBox, _CpyPara *const pCpyPara) pCpyPara->nInsPos - 1 ]; } - aFindFrm.pNewFrmFmt = (SwTableBoxFmt*)pBox->GetFrmFmt(); + aFindFrm.pNewFrmFmt = static_cast<SwTableBoxFmt*>(pBox->GetFrmFmt()); // Else we copy before that and the first Line keeps the TopLine // and we remove it at the original @@ -428,7 +428,7 @@ static void lcl_CopyCol( _FndBox & rFndBox, _CpyPara *const pCpyPara) static void lcl_CopyRow(_FndLine& rFndLine, _CpyPara *const pCpyPara) { SwTableLine* pNewLine = new SwTableLine( - (SwTableLineFmt*)rFndLine.GetLine()->GetFrmFmt(), + static_cast<SwTableLineFmt*>(rFndLine.GetLine()->GetFrmFmt()), rFndLine.GetBoxes().size(), pCpyPara->pInsBox ); if( pCpyPara->pInsBox ) { @@ -676,7 +676,7 @@ static void lcl_LastBoxSetWidth( SwTableBoxes &rBoxes, const long nOffset, aNew.SetWidth( aNew.GetWidth() + nOffset ); SwFrmFmt *pFmt = rShareFmts.GetFormat( *pBoxFmt, aNew ); if( pFmt ) - rBox.ChgFrmFmt( (SwTableBoxFmt*)pFmt ); + rBox.ChgFrmFmt( static_cast<SwTableBoxFmt*>(pFmt) ); else { pFmt = rBox.ClaimFrmFmt(); @@ -771,7 +771,7 @@ void _DeleteBox( SwTable& rTbl, SwTableBox* pBox, SwUndo* pUndo, { // Has the UndoObject been prepared to save the Section? if( pUndo && pUndo->IsDelBox() ) - ((SwUndoTblNdsChg*)pUndo)->SaveSection( pSttNd ); + static_cast<SwUndoTblNdsChg*>(pUndo)->SaveSection( pSttNd ); else pSttNd->GetDoc()->getIDocumentContentOperations().DeleteSection( pSttNd ); } @@ -1085,7 +1085,7 @@ bool SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCn // Insert nCnt new Lines into the Box SwTableLine* pInsLine = pSelBox->GetUpper(); - SwTableBoxFmt* pFrmFmt = (SwTableBoxFmt*)pSelBox->GetFrmFmt(); + SwTableBoxFmt* pFrmFmt = static_cast<SwTableBoxFmt*>(pSelBox->GetFrmFmt()); // Respect the Line's height, reset if needed SwFmtFrmSize aFSz( pInsLine->GetFrmFmt()->GetFrmSize() ); @@ -1117,16 +1117,16 @@ bool SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCn } } - SwTableBoxFmt* pCpyBoxFrmFmt = (SwTableBoxFmt*)pSelBox->GetFrmFmt(); + SwTableBoxFmt* pCpyBoxFrmFmt = static_cast<SwTableBoxFmt*>(pSelBox->GetFrmFmt()); bool bChkBorder = 0 != pCpyBoxFrmFmt->GetBox().GetTop(); if( bChkBorder ) - pCpyBoxFrmFmt = (SwTableBoxFmt*)pSelBox->ClaimFrmFmt(); + pCpyBoxFrmFmt = static_cast<SwTableBoxFmt*>(pSelBox->ClaimFrmFmt()); for( sal_uInt16 i = 0; i <= nCnt; ++i ) { // Create a new Line in the new Box SwTableLine* pNewLine = new SwTableLine( - (SwTableLineFmt*)pInsLine->GetFrmFmt(), 1, pNewBox ); + static_cast<SwTableLineFmt*>(pInsLine->GetFrmFmt()), 1, pNewBox ); if( bChgLineSz ) { pNewLine->ClaimFrmFmt()->SetFmtAttr( aFSz ); @@ -1146,7 +1146,7 @@ bool SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCn if( bChkBorder ) { - pCpyBoxFrmFmt = (SwTableBoxFmt*)pNewLine->GetTabBoxes()[ 0 ]->ClaimFrmFmt(); + pCpyBoxFrmFmt = static_cast<SwTableBoxFmt*>(pNewLine->GetTabBoxes()[ 0 ]->ClaimFrmFmt()); SvxBoxItem aTmp( pCpyBoxFrmFmt->GetBox() ); aTmp.SetLine( 0, BOX_LINE_TOP ); pCpyBoxFrmFmt->SetFmtAttr( aTmp ); @@ -1169,7 +1169,7 @@ bool SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCn } } // In Boxes with Lines, we can only have Size/Fillorder - pFrmFmt = (SwTableBoxFmt*)pNewBox->ClaimFrmFmt(); + pFrmFmt = static_cast<SwTableBoxFmt*>(pNewBox->ClaimFrmFmt()); pFrmFmt->ResetFmtAttr( RES_LR_SPACE, RES_FRMATR_END - 1 ); pFrmFmt->ResetFmtAttr( RES_BOXATR_BEGIN, RES_BOXATR_END - 1 ); } @@ -1224,13 +1224,13 @@ bool SwTable::SplitCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt ) // Find the Frame Format in the Frame Format Array SwTableBoxFmt* pLastBoxFmt; - _CpyTabFrm aFindFrm( (SwTableBoxFmt*)pSelBox->GetFrmFmt() ); + _CpyTabFrm aFindFrm( static_cast<SwTableBoxFmt*>(pSelBox->GetFrmFmt()) ); _CpyTabFrms::const_iterator itFind = aFrmArr.lower_bound( aFindFrm ); nFndPos = itFind - aFrmArr.begin(); if( itFind == aFrmArr.end() || !(*itFind == aFindFrm) ) { // Change the FrmFmt - aFindFrm.pNewFrmFmt = (SwTableBoxFmt*)pSelBox->ClaimFrmFmt(); + aFindFrm.pNewFrmFmt = static_cast<SwTableBoxFmt*>(pSelBox->ClaimFrmFmt()); SwTwips nBoxSz = aFindFrm.pNewFrmFmt->GetFrmSize().GetWidth(); SwTwips nNewBoxSz = nBoxSz / ( nCnt + 1 ); aFindFrm.pNewFrmFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, @@ -1491,9 +1491,9 @@ static void lcl_Merge_MoveLine(_FndLine& rFndLine, _InsULPara *const pULPara) // inserted SwTableLine* pInsLine = pULPara->pLeftBox->GetUpper(); SwTableBox* pLMBox = new SwTableBox( - (SwTableBoxFmt*)pULPara->pLeftBox->GetFrmFmt(), 0, pInsLine ); + static_cast<SwTableBoxFmt*>(pULPara->pLeftBox->GetFrmFmt()), 0, pInsLine ); SwTableLine* pLMLn = new SwTableLine( - (SwTableLineFmt*)pInsLine->GetFrmFmt(), 2, pLMBox ); + static_cast<SwTableLineFmt*>(pInsLine->GetFrmFmt()), 2, pLMBox ); pLMLn->ClaimFrmFmt()->ResetFmtAttr( RES_FRM_SIZE ); pLMBox->GetTabLines().insert( pLMBox->GetTabLines().begin(), pLMLn ); @@ -1526,9 +1526,9 @@ static void lcl_Merge_MoveLine(_FndLine& rFndLine, _InsULPara *const pULPara) if( pULPara->pLeftBox->GetUpper() == pInsLine ) { pRMBox = new SwTableBox( - (SwTableBoxFmt*)pULPara->pRightBox->GetFrmFmt(), 0, pInsLine ); + static_cast<SwTableBoxFmt*>(pULPara->pRightBox->GetFrmFmt()), 0, pInsLine ); SwTableLine* pRMLn = new SwTableLine( - (SwTableLineFmt*)pInsLine->GetFrmFmt(), 2, pRMBox ); + static_cast<SwTableLineFmt*>(pInsLine->GetFrmFmt()), 2, pRMBox ); pRMLn->ClaimFrmFmt()->ResetFmtAttr( RES_FRM_SIZE ); pRMBox->GetTabLines().insert( pRMBox->GetTabLines().begin(), pRMLn ); @@ -1554,12 +1554,12 @@ static void lcl_Merge_MoveLine(_FndLine& rFndLine, _InsULPara *const pULPara) { // Merge all Lines into a new Line and Box SwTableLine* pNewLn = new SwTableLine( - (SwTableLineFmt*)pInsLine->GetFrmFmt(), 1, pRMBox ); + static_cast<SwTableLineFmt*>(pInsLine->GetFrmFmt()), 1, pRMBox ); pNewLn->ClaimFrmFmt()->ResetFmtAttr( RES_FRM_SIZE ); pRMBox->GetTabLines().insert( pRMBox->GetTabLines().begin() + (pULPara->bUL ? nMvPos : nMvPos+1), pNewLn ); - pRMBox = new SwTableBox( (SwTableBoxFmt*)pRMBox->GetFrmFmt(), 0, pNewLn ); + pRMBox = new SwTableBox( static_cast<SwTableBoxFmt*>(pRMBox->GetFrmFmt()), 0, pNewLn ); pNewLn->GetTabBoxes().insert( pNewLn->GetTabBoxes().begin(), pRMBox ); sal_uInt16 nPos1, nPos2; @@ -1574,7 +1574,7 @@ static void lcl_Merge_MoveLine(_FndLine& rFndLine, _InsULPara *const pULPara) pNewLn->GetUpper()->GetTabLines(), pRMBox ); lcl_CalcWidth( pRMBox ); // calculate the Box's width - pRMBox = new SwTableBox( (SwTableBoxFmt*)pRMBox->GetFrmFmt(), 0, pNewLn ); + pRMBox = new SwTableBox( static_cast<SwTableBoxFmt*>(pRMBox->GetFrmFmt()), 0, pNewLn ); pNewLn->GetTabBoxes().push_back( pRMBox ); } } @@ -1605,7 +1605,7 @@ static void lcl_Merge_MoveLine(_FndLine& rFndLine, _InsULPara *const pULPara) pLines = &pULPara->pInsBox->GetTabLines(); SwTableLine* pNewLine = new SwTableLine( - (SwTableLineFmt*)rFndLine.GetLine()->GetFrmFmt(), 0, pULPara->pInsBox ); + static_cast<SwTableLineFmt*>(rFndLine.GetLine()->GetFrmFmt()), 0, pULPara->pInsBox ); _InsULPara aPara( *pULPara ); // copying aPara.pInsLine = pNewLine; _FndBoxes & rLineBoxes = rFndLine.GetBoxes(); @@ -1666,7 +1666,7 @@ bool SwTable::OldMerge( SwDoc* pDoc, const SwSelBoxes& rBoxes, } SwTableLine* pInsLine = new SwTableLine( - (SwTableLineFmt*)pFndBox->GetLines().front().GetLine()->GetFrmFmt(), 0, + static_cast<SwTableLineFmt*>(pFndBox->GetLines().front().GetLine()->GetFrmFmt()), 0, !pFndBox->GetUpper() ? 0 : pFndBox->GetBox() ); pInsLine->ClaimFrmFmt()->ResetFmtAttr( RES_FRM_SIZE ); @@ -1678,8 +1678,8 @@ bool SwTable::OldMerge( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nInsPos = pLines->GetPos( pNewLine ); pLines->insert( pLines->begin() + nInsPos, pInsLine ); - SwTableBox* pLeftBox = new SwTableBox( (SwTableBoxFmt*)pMergeBox->GetFrmFmt(), 0, pInsLine ); - SwTableBox* pRightBox = new SwTableBox( (SwTableBoxFmt*)pMergeBox->GetFrmFmt(), 0, pInsLine ); + SwTableBox* pLeftBox = new SwTableBox( static_cast<SwTableBoxFmt*>(pMergeBox->GetFrmFmt()), 0, pInsLine ); + SwTableBox* pRightBox = new SwTableBox( static_cast<SwTableBoxFmt*>(pMergeBox->GetFrmFmt()), 0, pInsLine ); pMergeBox->SetUpper( pInsLine ); pInsLine->GetTabBoxes().insert( pInsLine->GetTabBoxes().begin(), pLeftBox ); pLeftBox->ClaimFrmFmt(); @@ -1979,7 +1979,7 @@ static void lcl_CopyBoxToDoc(_FndBox const& rFndBox, _CpyPara *const pCpyPara) if( pN && pN->HasMergeFmtTbl() && SfxItemState::SET == aBoxAttrSet. GetItemState( RES_BOXATR_FORMAT, false, &pItem ) ) { - sal_uLong nOldIdx = ((SwTblBoxNumFormat*)pItem)->GetValue(); + sal_uLong nOldIdx = static_cast<const SwTblBoxNumFormat*>(pItem)->GetValue(); sal_uLong nNewIdx = pN->GetMergeFmtIndex( nOldIdx ); if( nNewIdx != nOldIdx ) aBoxAttrSet.Put( SwTblBoxNumFormat( nNewIdx )); @@ -2018,7 +2018,7 @@ static void lcl_CopyLineToDoc(const _FndLine& rFndLine, _CpyPara *const pCpyPara) { // Find the Frame Format in the list of all Frame Formats - _CpyTabFrm aFindFrm( (SwTableBoxFmt*)rFndLine.GetLine()->GetFrmFmt() ); + _CpyTabFrm aFindFrm( static_cast<SwTableBoxFmt*>(rFndLine.GetLine()->GetFrmFmt()) ); _CpyTabFrms::const_iterator itFind = pCpyPara->rTabFrmArr.find( aFindFrm ); if( itFind == pCpyPara->rTabFrmArr.end() ) { @@ -2165,12 +2165,12 @@ bool SwTable::MakeCopy( SwDoc* pInsDoc, const SwPosition& rPos, // A DDE-Table is being copied // Does the new Document actually have it's FieldType? SwFieldType* pFldType = pInsDoc->getIDocumentFieldsAccess().InsertFldType( - *((SwDDETable*)this)->GetDDEFldType() ); + *static_cast<const SwDDETable*>(this)->GetDDEFldType() ); OSL_ENSURE( pFldType, "unknown FieldType" ); // Change the Table Pointer at the Node pNewTbl = new SwDDETable( *pNewTbl, - (SwDDEFieldType*)pFldType ); + static_cast<SwDDEFieldType*>(pFldType) ); pTblNd->SetNewTable( pNewTbl, false ); } @@ -2635,7 +2635,7 @@ static bool lcl_InsSelBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, for( n = 0; n < rBoxes.size(); ++n ) { SwTableBox* pBox = rBoxes[ n ]; - SwTableBoxFmt* pFmt = (SwTableBoxFmt*)pBox->GetFrmFmt(); + SwTableBoxFmt* pFmt = static_cast<SwTableBoxFmt*>(pBox->GetFrmFmt()); const SwFmtFrmSize& rSz = pFmt->GetFrmSize(); SwTwips nWidth = rSz.GetWidth(); @@ -4116,7 +4116,7 @@ static bool lcl_InsDelSelLine( SwTableLine* pLine, CR_SetLineHeight& rParam, else { // Insert Line - SwTableLine* pNewLine = new SwTableLine( (SwTableLineFmt*)pLine->GetFrmFmt(), + SwTableLine* pNewLine = new SwTableLine( static_cast<SwTableLineFmt*>(pLine->GetFrmFmt()), rBoxes.size(), pLine->GetUpper() ); SwTableLines* pLines; if( pLine->GetUpper() ) @@ -4145,7 +4145,7 @@ static bool lcl_InsDelSelLine( SwTableLine* pLine, CR_SetLineHeight& rParam, pOld = pOld->GetTabLines()[ 0 ]->GetTabBoxes()[ 0 ]; } ::_InsTblBox( pDoc, rParam.pTblNd, pNewLine, - (SwTableBoxFmt*)pOld->GetFrmFmt(), pOld, n ); + static_cast<SwTableBoxFmt*>(pOld->GetFrmFmt()), pOld, n ); // Special treatment for the border: // The top one needs to be removed @@ -4520,13 +4520,13 @@ void SwShareBoxFmts::ChangeFrmFmt( SwTableBox* pBox, SwTableLine* pLn, { pOld = pBox->GetFrmFmt(); pOld->Add( &aCl ); - pBox->ChgFrmFmt( (SwTableBoxFmt*)&rFmt ); + pBox->ChgFrmFmt( static_cast<SwTableBoxFmt*>(&rFmt) ); } else if( pLn ) { pOld = pLn->GetFrmFmt(); pOld->Add( &aCl ); - pLn->ChgFrmFmt( (SwTableLineFmt*)&rFmt ); + pLn->ChgFrmFmt( static_cast<SwTableLineFmt*>(&rFmt) ); } if( pOld && pOld->IsLastDepend() ) { @@ -4586,7 +4586,7 @@ void SwShareBoxFmts::RemoveFormat( const SwFrmFmt& rFmt ) bool SwShareBoxFmts::Seek_Entry( const SwFrmFmt& rFmt, sal_uInt16* pPos ) const { - sal_uLong nIdx = (sal_uLong)&rFmt; + sal_uLong nIdx = reinterpret_cast<sal_uLong>(&rFmt); sal_uInt16 nO = aShareArr.size(), nM, nU = 0; if( nO > 0 ) { @@ -4594,7 +4594,7 @@ bool SwShareBoxFmts::Seek_Entry( const SwFrmFmt& rFmt, sal_uInt16* pPos ) const while( nU <= nO ) { nM = nU + ( nO - nU ) / 2; - sal_uLong nFmt = (sal_uLong)&aShareArr[ nM ].GetOldFormat(); + sal_uLong nFmt = reinterpret_cast<sal_uLong>(&aShareArr[ nM ].GetOldFormat()); if( nFmt == nIdx ) { if( pPos ) diff --git a/sw/source/core/doc/visiturl.cxx b/sw/source/core/doc/visiturl.cxx index c0ee2d7..7dafb6b 100644 --- a/sw/source/core/doc/visiturl.cxx +++ b/sw/source/core/doc/visiturl.cxx @@ -45,7 +45,7 @@ void SwURLStateChanged::Notify( SfxBroadcaster& , const SfxHint& rHint ) if( dynamic_cast<const INetURLHistoryHint*>(&rHint) && pDoc->getIDocumentLayoutAccess().GetCurrentViewShell() ) { // This URL has been changed: - const INetURLObject* pIURL = ((INetURLHistoryHint&)rHint).GetObject(); + const INetURLObject* pIURL = static_cast<const INetURLHistoryHint&>(rHint).GetObject(); OUString sURL( pIURL->GetMainURL( INetURLObject::NO_DECODE ) ), sBkmk; SwEditShell* pESh = pDoc->GetEditShell(); @@ -59,7 +59,7 @@ void SwURLStateChanged::Notify( SfxBroadcaster& , const SfxHint& rHint ) sal_uInt32 nMaxItems = pDoc->GetAttrPool().GetItemCount2( RES_TXTATR_INETFMT ); for( sal_uInt32 n = 0; n < nMaxItems; ++n ) { - const SwFmtINetFmt* pItem = (SwFmtINetFmt*)pDoc->GetAttrPool().GetItem2(RES_TXTATR_INETFMT, n ); + const SwFmtINetFmt* pItem = static_cast<const SwFmtINetFmt*>(pDoc->GetAttrPool().GetItem2(RES_TXTATR_INETFMT, n )); if( pItem != 0 && ( pItem->GetValue() == sURL || ( !sBkmk.isEmpty() && pItem->GetValue() == sBkmk ))) { diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx index 59ef2fc..afe7eea 100644 --- a/sw/source/core/docnode/ndcopy.cxx +++ b/sw/source/core/docnode/ndcopy.cxx @@ -139,7 +139,7 @@ static void lcl_CopyTblLine( const SwTableLine* pLine, _CopyTable* pCT ); static void lcl_CopyTblBox( SwTableBox* pBox, _CopyTable* pCT ) { - SwTableBoxFmt* pBoxFmt = (SwTableBoxFmt*)pBox->GetFrmFmt(); + SwTableBoxFmt* pBoxFmt = static_cast<SwTableBoxFmt*>(pBox->GetFrmFmt()); for( _MapTblFrmFmts::const_iterator it = pCT->rMapArr.begin(); it != pCT->rMapArr.end(); ++it ) if ( !lcl_SrchNew( *it, (const SwFrmFmt**)&pBoxFmt ) ) break; @@ -147,9 +147,9 @@ static void lcl_CopyTblBox( SwTableBox* pBox, _CopyTable* pCT ) { const SfxPoolItem* pItem; if( SfxItemState::SET == pBoxFmt->GetItemState( RES_BOXATR_FORMULA, false, - &pItem ) && ((SwTblBoxFormula*)pItem)->IsIntrnlName() ) + &pItem ) && static_cast<const SwTblBoxFormula*>(pItem)->IsIntrnlName() ) { - ((SwTblBoxFormula*)pItem)->PtrToBoxNm( pCT->pOldTable ); + const_cast<SwTblBoxFormula*>(static_cast<const SwTblBoxFormula*>(pItem))->PtrToBoxNm( pCT->pOldTable ); } pBoxFmt = pCT->pDoc->MakeTableBoxFmt(); @@ -161,7 +161,7 @@ static void lcl_CopyTblBox( SwTableBox* pBox, _CopyTable* pCT ) if( pN && pN->HasMergeFmtTbl() && SfxItemState::SET == pBoxFmt-> GetItemState( RES_BOXATR_FORMAT, false, &pItem ) ) { - sal_uLong nOldIdx = ((SwTblBoxNumFormat*)pItem)->GetValue(); + sal_uLong nOldIdx = static_cast<const SwTblBoxNumFormat*>(pItem)->GetValue(); sal_uLong nNewIdx = pN->GetMergeFmtIndex( nOldIdx ); if( nNewIdx != nOldIdx ) pBoxFmt->SetFmtAttr( SwTblBoxNumFormat( nNewIdx )); @@ -201,7 +201,7 @@ static void lcl_CopyTblBox( SwTableBox* pBox, _CopyTable* pCT ) static void lcl_CopyTblLine( const SwTableLine* pLine, _CopyTable* pCT ) { - SwTableLineFmt* pLineFmt = (SwTableLineFmt*)pLine->GetFrmFmt(); + SwTableLineFmt* pLineFmt = static_cast<SwTableLineFmt*>(pLine->GetFrmFmt()); for( _MapTblFrmFmts::const_iterator it = pCT->rMapArr.begin(); it != pCT->rMapArr.end(); ++it ) if ( !lcl_SrchNew( *it, (const SwFrmFmt**)&pLineFmt ) ) break; @@ -270,11 +270,11 @@ SwTableNode* SwTableNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const { // We're copying a DDE table // Is the field type available in the new document? - pDDEType = ((SwDDETable&)GetTable()).GetDDEFldType(); + pDDEType = const_cast<SwDDETable&>(static_cast<const SwDDETable&>(GetTable())).GetDDEFldType(); if( pDDEType->IsDeleted() ) pDoc->getIDocumentFieldsAccess().InsDeletedFldType( *pDDEType ); else - pDDEType = (SwDDEFieldType*)pDoc->getIDocumentFieldsAccess().InsertFldType( *pDDEType ); + pDDEType = static_cast<SwDDEFieldType*>(pDoc->getIDocumentFieldsAccess().InsertFldType( *pDDEType )); OSL_ENSURE( pDDEType, "unknown FieldType" ); // Swap the table pointers in the node diff --git a/sw/source/core/docnode/ndnotxt.cxx b/sw/source/core/docnode/ndnotxt.cxx index 32fe1c8..cb348a0 100644 --- a/sw/source/core/docnode/ndnotxt.cxx +++ b/sw/source/core/docnode/ndnotxt.cxx @@ -252,12 +252,12 @@ Graphic SwNoTxtNode::GetGraphic() const Graphic aRet; if ( GetGrfNode() ) { - aRet = ((SwGrfNode*)this)->GetGrf(true); + aRet = static_cast<const SwGrfNode*>(this)->GetGrf(true); } else { OSL_ENSURE( GetOLENode(), "new type of Node?" ); - aRet = *((SwOLENode*)this)->SwOLENode::GetGraphic(); + aRet = *const_cast<SwOLENode*>(static_cast<const SwOLENode*>(this))->SwOLENode::GetGraphic(); } return aRet; } diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx index de1f3d4..27af382 100644 --- a/sw/source/core/docnode/ndsect.cxx +++ b/sw/source/core/docnode/ndsect.cxx @@ -308,7 +308,7 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData, { if( pUndoInsSect && pCNd->IsTxtNode() ) { - pUndoInsSect->SaveSplitNode( (SwTxtNode*)pCNd, true ); + pUndoInsSect->SaveSplitNode( const_cast<SwTxtNode*>(static_cast<const SwTxtNode*>(pCNd)), true ); } getIDocumentContentOperations().SplitNode( *pPos, false ); pNewSectNode = GetNodes().InsertTextSection( @@ -352,11 +352,11 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData, bool bUpdateFtn = false; if( GetFtnIdxs().size() && pAttr ) { - sal_uInt16 nVal = ((SwFmtFtnAtTxtEnd&)pAttr->Get( + sal_uInt16 nVal = static_cast<const SwFmtFtnAtTxtEnd&>(pAttr->Get( RES_FTN_AT_TXTEND )).GetValue(); if( ( FTNEND_ATTXTEND_OWNNUMSEQ == nVal || FTNEND_ATTXTEND_OWNNUMANDFMT == nVal ) || - ( FTNEND_ATTXTEND_OWNNUMSEQ == ( nVal = ((SwFmtEndAtTxtEnd&) + ( FTNEND_ATTXTEND_OWNNUMSEQ == ( nVal = static_cast<const SwFmtEndAtTxtEnd&>( pAttr->Get( RES_END_AT_TXTEND )).GetValue() ) || FTNEND_ATTXTEND_OWNNUMANDFMT == nVal )) { @@ -419,7 +419,7 @@ sal_uInt16 SwDoc::IsInsRegionAvailable( const SwPaM& rRange, aIdx--; } if( !pPrvNd ) - pPrvNd = pNd->IsStartNode() ? (SwStartNode*)pNd + pPrvNd = pNd->IsStartNode() ? static_cast<const SwStartNode*>(pNd) : pNd->StartOfSectionNode(); aIdx = pEnd->nNode.GetIndex() + 1; @@ -924,22 +924,22 @@ SwSectionNode* SwNodes::InsertTextSection(SwNodeIndex const& rNdIdx, // Make up the Format's nesting if( pNd->IsSectionNode() ) { - ((SwSectionNode*)pNd)->GetSection().GetFmt()-> + static_cast<SwSectionNode*>(pNd)->GetSection().GetFmt()-> SetDerivedFrom( pSectFmt ); - ((SwSectionNode*)pNd)->DelFrms(); + static_cast<SwSectionNode*>(pNd)->DelFrms(); n = pNd->EndOfSectionIndex(); } else { if( pNd->IsTableNode() ) - ((SwTableNode*)pNd)->DelFrms(); + static_cast<SwTableNode*>(pNd)->DelFrms(); if( ULONG_MAX == nSkipIdx ) nSkipIdx = pNd->EndOfSectionIndex(); } } else if( pNd->IsCntntNode() ) - ((SwCntntNode*)pNd)->DelFrms(); + static_cast<SwCntntNode*>(pNd)->DelFrms(); } sw_DeleteFtn( pSectNd, nStart, nEnde ); @@ -1010,7 +1010,7 @@ SwFrm* SwClearDummies( SwFrm* pFrm ) OSL_ENSURE( !pTmp->GetUpper(), "SwClearDummies: No Upper allowed!" ); if( pTmp->IsSctFrm() ) { - SwSectionFrm* pSectFrm = (SwSectionFrm*)pFrm; + SwSectionFrm* pSectFrm = static_cast<SwSectionFrm*>(pFrm); pTmp = pTmp->GetNext(); if( !pSectFrm->GetLower() ) { @@ -1072,7 +1072,7 @@ void SwSectionNode::MakeFrms(const SwNodeIndex & rIdx ) return; } pCNd = aIdx.GetNode().GetCntntNode(); - pCNd->MakeFrms( (SwCntntNode&)rIdx.GetNode() ); + pCNd->MakeFrms( static_cast<SwCntntNode&>(rIdx.GetNode()) ); } else { @@ -1110,7 +1110,7 @@ void SwSectionNode::MakeFrms(const SwNodeIndex & rIdx ) while( pUp->Lower() ) // for columned sections { OSL_ENSURE( pUp->Lower()->IsLayoutFrm(),"Who's in there?" ); - pUp = (SwLayoutFrm*)pUp->Lower(); + pUp = static_cast<SwLayoutFrm*>(pUp->Lower()); } pNew->Paste( pUp, NULL ); // #i27138# @@ -1306,7 +1306,7 @@ bool SwSectionNode::IsCntntHidden() const { if( aTmp.GetNode().IsSectionNode() ) { - const SwSection& rSect = ((SwSectionNode&)aTmp.GetNode()).GetSection(); + const SwSection& rSect = static_cast<SwSectionNode&>(aTmp.GetNode()).GetSection(); if( rSect.IsHiddenFlag() ) // Skip this Section aTmp = *aTmp.GetNode().EndOfSectionNode(); diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 6208bfc..f61083b 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -1024,7 +1024,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh, cCh = 0x09; // Get the separator's position from the first Node, in order for the Boxes to be set accordingly - SwTxtFrmInfo aFInfo( (SwTxtFrm*)pTxtNd->getLayoutFrm( pTxtNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ) ); + SwTxtFrmInfo aFInfo( static_cast<SwTxtFrm*>(pTxtNd->getLayoutFrm( pTxtNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() )) ); if( aFInfo.IsOneLine() ) // only makes sense in this case { OUString const& rTxt(pTxtNd->GetTxt()); @@ -1622,11 +1622,11 @@ bool SwNodes::TableToText( const SwNodeRange& rRange, sal_Unicode cCh, if( 0 != ( pCNd = aDelRg.aStart.GetNode().GetCntntNode())) { if( pFrmNd->IsCntntNode() ) - ((SwCntntNode*)pFrmNd)->MakeFrms( *pCNd ); + static_cast<SwCntntNode*>(pFrmNd)->MakeFrms( *pCNd ); else if( pFrmNd->IsTableNode() ) - ((SwTableNode*)pFrmNd)->MakeFrms( aDelRg.aStart ); + static_cast<SwTableNode*>(pFrmNd)->MakeFrms( aDelRg.aStart ); else if( pFrmNd->IsSectionNode() ) - ((SwSectionNode*)pFrmNd)->MakeFrms( aDelRg.aStart ); + static_cast<SwSectionNode*>(pFrmNd)->MakeFrms( aDelRg.aStart ); pFrmNd = pCNd; } else if( 0 != ( pSNd = aDelRg.aStart.GetNode().GetSectionNode())) @@ -2274,7 +2274,7 @@ sal_uInt16 SwDoc::MergeTbl( SwPaM& rPam ) rPam.DeleteMark(); SwPaM* pTmp = &rPam; - while( &rPam != ( pTmp = (SwPaM*)pTmp->GetNext() )) + while( &rPam != ( pTmp = static_cast<SwPaM*>(pTmp->GetNext()) )) for( int i = 0; i < 2; ++i ) pTmp->GetBound( (bool)i ) = *rPam.GetPoint(); } @@ -2488,7 +2488,7 @@ void SwDoc::GetTabCols( SwTabCols &rFill, const SwCursor* pCrsr, pTmpFrm = pTmpFrm->GetUpper(); } while ( !pTmpFrm->IsCellFrm() ); - pBoxFrm = (SwCellFrm*)pTmpFrm; + pBoxFrm = static_cast<const SwCellFrm*>(pTmpFrm); pTab = ((SwFrm*)pBoxFrm)->ImplFindTabFrm(); pBox = pBoxFrm->GetTabBox(); } @@ -2557,7 +2557,7 @@ void SwDoc::GetTabRows( SwTabCols &rFill, const SwCursor* , const SwCntntFrm* pCntnt = ::GetCellCntnt( *pBoxFrm ); if ( pCntnt && pCntnt->IsTxtFrm() ) { - const SwPosition aPos( *((SwTxtFrm*)pCntnt)->GetTxtNode() ); + const SwPosition aPos( *static_cast<const SwTxtFrm*>(pCntnt)->GetTxtNode() ); const SwCursor aTmpCrsr( aPos, 0, false ); ::GetTblSel( aTmpCrsr, aBoxes, nsSwTblSearchType::TBLSEARCH_COL ); } @@ -2637,11 +2637,11 @@ void SwDoc::GetTabRows( SwTabCols &rFill, const SwCursor* , { aHiddenIter = aHidden.find( nTmpVal ); if ( aHiddenIter == aHidden.end() ) - aHidden[ nTmpVal ] = !lcl_IsFrmInColumn( *((SwCellFrm*)pFrm), aBoxes ); + aHidden[ nTmpVal ] = !lcl_IsFrmInColumn( *static_cast<const SwCellFrm*>(pFrm), aBoxes ); else { if ( aHidden[ nTmpVal ] && - lcl_IsFrmInColumn( *((SwCellFrm*)pFrm), aBoxes ) ) + lcl_IsFrmInColumn( *static_cast<const SwCellFrm*>(pFrm), aBoxes ) ) aHidden[ nTmpVal ] = false; } nTmpVal = nLowerBorder; @@ -2702,7 +2702,7 @@ void SwDoc::SetTabCols( const SwTabCols &rNew, bool bCurRowOnly, pTmpFrm = pTmpFrm->GetUpper(); } while ( !pTmpFrm->IsCellFrm() ); - pBoxFrm = (SwCellFrm*)pTmpFrm; + pBoxFrm = static_cast<const SwCellFrm*>(pTmpFrm); pTab = ((SwFrm*)pBoxFrm)->ImplFindTabFrm(); pBox = pBoxFrm->GetTabBox(); } @@ -2815,7 +2815,7 @@ void SwDoc::SetTabRows( const SwTabCols &rNew, bool bCurColOnly, const SwCursor* // but the pLine will be set if the box is not an overlapping box // In the new table model the row height can be adjusted, // when both variables are set. - SwTxtFrm* pTxtFrm = 0; + const SwTxtFrm* pTxtFrm = 0; const SwTableLine* pLine = 0; // Iterate over all SwCellFrms with Bottom = nOldPos @@ -2834,10 +2834,10 @@ void SwDoc::SetTabRows( const SwTabCols &rNew, bool bCurColOnly, const SwCursor* if ( pCntnt && pCntnt->IsTxtFrm() ) { - const SwTableBox* pBox = ((SwCellFrm*)pFrm)->GetTabBox(); + const SwTableBox* pBox = static_cast<const SwCellFrm*>(pFrm)->GetTabBox(); const long nRowSpan = pBox->getRowSpan(); if( nRowSpan > 0 ) // Not overlapped - pTxtFrm = (SwTxtFrm*)pCntnt; + pTxtFrm = static_cast<const SwTxtFrm*>(pCntnt); if( nRowSpan < 2 ) // Not overlapping for row height pLine = pBox->GetUpper(); if( pLine && pTxtFrm ) // always for old table model @@ -2851,7 +2851,7 @@ void SwDoc::SetTabRows( const SwTabCols &rNew, bool bCurColOnly, const SwCursor* if ( ATT_VAR_SIZE == aNew.GetHeightSizeType() ) aNew.SetHeightSizeType( ATT_MIN_SIZE ); // This position must not be in an overlapped box - const SwPosition aPos( *((SwTxtFrm*)pCntnt)->GetTxtNode() ); + const SwPosition aPos( *static_cast<const SwTxtFrm*>(pCntnt)->GetTxtNode() ); const SwCursor aTmpCrsr( aPos, 0, false ); SetRowHeight( aTmpCrsr, aNew ); // For the new table model we're done, for the old one @@ -3305,7 +3305,7 @@ static void lcl_SplitTable_CpyBox( SwTableBox* pBox, _SplitTable_Para* pPara ); static void lcl_SplitTable_CpyLine( SwTableLine* pLn, _SplitTable_Para* pPara ) { SwFrmFmt *pSrcFmt = pLn->GetFrmFmt(); - SwTableLineFmt* pDestFmt = (SwTableLineFmt*) pPara->GetDestFmt( pSrcFmt ); + SwTableLineFmt* pDestFmt = static_cast<SwTableLineFmt*>( pPara->GetDestFmt( pSrcFmt ) ); if( pDestFmt == NULL ) { pPara->InsertSrcDest( pSrcFmt, pLn->ClaimFrmFmt() ); @@ -3321,7 +3321,7 @@ static void lcl_SplitTable_CpyLine( SwTableLine* pLn, _SplitTable_Para* pPara ) static void lcl_SplitTable_CpyBox( SwTableBox* pBox, _SplitTable_Para* pPara ) { SwFrmFmt *pSrcFmt = pBox->GetFrmFmt(); - SwTableBoxFmt* pDestFmt = (SwTableBoxFmt*)pPara->GetDestFmt( pSrcFmt ); + SwTableBoxFmt* pDestFmt = static_cast<SwTableBoxFmt*>(pPara->GetDestFmt( pSrcFmt )); if( pDestFmt == NULL ) { pPara->InsertSrcDest( pSrcFmt, pBox->ClaimFrmFmt() ); @@ -3928,7 +3928,7 @@ SwTableFmt* SwDoc::FindTblFmtByName( const OUString& rName, bool bAll ) const } } } - return (SwTableFmt*)pRet; + return const_cast<SwTableFmt*>(static_cast<const SwTableFmt*>(pRet)); } bool SwDoc::SetColRowWidthHeight( SwTableBox& rAktBox, sal_uInt16 eType, @@ -3989,7 +3989,7 @@ void SwDoc::ChkBoxNumFmt( SwTableBox& rBox, bool bCallUpdate ) const SfxPoolItem* pNumFmtItem = 0; if( SfxItemState::SET == rBox.GetFrmFmt()->GetItemState( RES_BOXATR_FORMAT, false, &pNumFmtItem ) && GetNumberFormatter()->IsTextFormat( - ((SwTblBoxNumFormat*)pNumFmtItem)->GetValue() )) + static_cast<const SwTblBoxNumFormat*>(pNumFmtItem)->GetValue() )) return ; SwUndoTblNumFmt* pUndo = 0; @@ -4011,7 +4011,7 @@ void SwDoc::ChkBoxNumFmt( SwTableBox& rBox, bool bCallUpdate ) pUndo->SetNumFmt( nFmtIdx, fNumber ); } - SwTableBoxFmt* pBoxFmt = (SwTableBoxFmt*)rBox.GetFrmFmt(); + SwTableBoxFmt* pBoxFmt = static_cast<SwTableBoxFmt*>(rBox.GetFrmFmt()); SfxItemSet aBoxSet( GetAttrPool(), RES_BOXATR_FORMAT, RES_BOXATR_VALUE ); bool bLockModify = true; @@ -4023,7 +4023,7 @@ void SwDoc::ChkBoxNumFmt( SwTableBox& rBox, bool bCallUpdate ) // format recognition if( pNumFmtItem && !bForceNumberFormat ) { - sal_uLong nOldNumFmt = ((SwTblBoxNumFormat*)pNumFmtItem)->GetValue(); + sal_uLong nOldNumFmt = static_cast<const SwTblBoxNumFormat*>(pNumFmtItem)->GetValue(); SvNumberFormatter* pNumFmtr = GetNumberFormatter(); short nFmtType = pNumFmtr->GetType( nFmtIdx ); @@ -4044,7 +4044,7 @@ void SwDoc::ChkBoxNumFmt( SwTableBox& rBox, bool bCallUpdate ) if( bSetNumberFormat || bForceNumberFormat ) { - pBoxFmt = (SwTableBoxFmt*)rBox.ClaimFrmFmt(); + pBoxFmt = static_cast<SwTableBoxFmt*>(rBox.ClaimFrmFmt()); aBoxSet.Put( SwTblBoxValue( fNumber )); aBoxSet.Put( SwTblBoxNumFormat( nFmtIdx )); @@ -4071,7 +4071,7 @@ void SwDoc::ChkBoxNumFmt( SwTableBox& rBox, bool bCallUpdate ) { // It's not a number const SfxPoolItem* pValueItem = 0, *pFmtItem = 0; - SwTableBoxFmt* pBoxFmt = (SwTableBoxFmt*)rBox.GetFrmFmt(); + SwTableBoxFmt* pBoxFmt = static_cast<SwTableBoxFmt*>(rBox.GetFrmFmt()); if( SfxItemState::SET == pBoxFmt->GetItemState( RES_BOXATR_FORMAT, false, &pFmtItem ) || SfxItemState::SET == pBoxFmt->GetItemState( RES_BOXATR_VALUE, @@ -4083,7 +4083,7 @@ void SwDoc::ChkBoxNumFmt( SwTableBox& rBox, bool bCallUpdate ) pUndo = new SwUndoTblNumFmt( rBox ); } - pBoxFmt = (SwTableBoxFmt*)rBox.ClaimFrmFmt(); + pBoxFmt = static_cast<SwTableBoxFmt*>(rBox.ClaimFrmFmt()); // Remove all number formats sal_uInt16 nWhich1 = RES_BOXATR_FORMULA; @@ -4181,7 +4181,7 @@ void SwDoc::ClearLineNumAttrs( SwPosition & rPos ) aRegH.RegisterInModify( pTxtNode , *pTxtNode ); if ( pUndo ) pUndo->AddNode( *pTxtNode , false ); - SfxStringItem * pNewItem = (SfxStringItem*)pFmtItem->Clone(); + SfxStringItem * pNewItem = static_cast<SfxStringItem*>(pFmtItem->Clone()); pNewItem->SetValue(OUString()); rSet.Put( *pNewItem ); pTxtNode->SetAttr( rSet ); @@ -4217,7 +4217,7 @@ void SwDoc::ClearBoxNumAttrs( const SwNodeIndex& rNode ) // Keep TextFormats! sal_uInt16 nWhich1 = RES_BOXATR_FORMAT; if( pFmtItem && GetNumberFormatter()->IsTextFormat( - ((SwTblBoxNumFormat*)pFmtItem)->GetValue() )) + static_cast<const SwTblBoxNumFormat*>(pFmtItem)->GetValue() )) nWhich1 = RES_BOXATR_FORMULA; else // Just resetting Attributes is not enough @@ -4506,7 +4506,7 @@ bool SwDoc::UnProtectTbls( const SwPaM& rPam ) bFound = pStt->nNode.GetIndex() < nTblIdx && nTblIdx < pEnd->nNode.GetIndex(); - } while( !bFound && &rPam != ( pTmp = (SwPaM*)pTmp->GetNext() ) ); + } while( !bFound && &rPam != ( pTmp = static_cast<SwPaM*>(pTmp->GetNext()) ) ); if( !bFound ) continue; // Continue searching } diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx index 48b2018..3c9af04 100644 --- a/sw/source/core/docnode/ndtbl1.cxx +++ b/sw/source/core/docnode/ndtbl1.cxx @@ -139,7 +139,7 @@ static bool lcl_GetBoxSel( const SwCursor& rCursor, SwSelBoxes& rBoxes, rBoxes.insert( pBox ); } } while( bAllCrsr && - pSttPam != ( pCurPam = (SwPaM*)pCurPam->GetNext()) ); + pSttPam != ( pCurPam = static_cast<SwPaM*>(pCurPam->GetNext())) ); } return !rBoxes.empty(); } @@ -259,7 +259,7 @@ static void lcl_ProcessRowAttr( std::vector<SwTblFmtCmp*>& rFmtCmp, SwTableLine* { SwFrmFmt *pNewFmt; if ( 0 != (pNewFmt = SwTblFmtCmp::FindNewFmt( rFmtCmp, pLine->GetFrmFmt(), 0 ))) - pLine->ChgFrmFmt( (SwTableLineFmt*)pNewFmt ); + pLine->ChgFrmFmt( static_cast<SwTableLineFmt*>(pNewFmt) ); else { SwFrmFmt *pOld = pLine->GetFrmFmt(); @@ -527,7 +527,7 @@ static void lcl_CollectCells( std::vector<SwCellFrm*> &rArr, const SwRect &rUnio pCell = pCell->GetUpper(); OSL_ENSURE( pCell, "Frame is not a Cell" ); if ( rUnion.IsOver( pCell->Frm() ) ) - ::InsertCell( rArr, (SwCellFrm*)pCell ); + ::InsertCell( rArr, static_cast<SwCellFrm*>(pCell) ); // Make sure the Cell is left (Areas) SwLayoutFrm *pTmp = pCell; @@ -779,7 +779,7 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) SwTableBox *pBox = (SwTableBox*)pCell->GetTabBox(); SwFrmFmt *pNewFmt; if ( 0 != (pNewFmt = SwTblFmtCmp::FindNewFmt( aFmtCmp, pBox->GetFrmFmt(), nType ))) - pBox->ChgFrmFmt( (SwTableBoxFmt*)pNewFmt ); + pBox->ChgFrmFmt( static_cast<SwTableBoxFmt*>(pNewFmt) ); else { SwFrmFmt *pOld = pBox->GetFrmFmt(); @@ -869,7 +869,7 @@ void SwDoc::SetTabLineStyle( const SwCursor& rCursor, SvxBoxItem aBox( pFmt->GetBox() ); if ( !pBorderLine && bSetLine ) - aBox = *(SvxBoxItem*)::GetDfltAttr( RES_BOX ); + aBox = *static_cast<const SvxBoxItem*>(::GetDfltAttr( RES_BOX )); else { if ( aBox.GetTop() ) @@ -918,8 +918,8 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const if( !aUnions.empty() ) { - SvxBoxItem aSetBox ((const SvxBoxItem &) rSet.Get(RES_BOX )); - SvxBoxInfoItem aSetBoxInfo((const SvxBoxInfoItem&) rSet.Get(SID_ATTR_BORDER_INNER)); + SvxBoxItem aSetBox (static_cast<const SvxBoxItem &>( rSet.Get(RES_BOX ))); + SvxBoxInfoItem aSetBoxInfo(static_cast<const SvxBoxInfoItem&>( rSet.Get(SID_ATTR_BORDER_INNER))); bool bTopSet = false, bBottomSet = false, @@ -1113,8 +1113,8 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const // fdo#62470 fix the reading for table format. if ( bRTLTab ) { - SvxBoxItem aTempBox ((const SvxBoxItem &) rSet.Get(RES_BOX )); - SvxBoxInfoItem aTempBoxInfo((const SvxBoxInfoItem&) rSet.Get(SID_ATTR_BORDER_INNER)); + SvxBoxItem aTempBox (static_cast<const SvxBoxItem &>( rSet.Get(RES_BOX ))); + SvxBoxInfoItem aTempBoxInfo(static_cast<const SvxBoxInfoItem&>( rSet.Get(SID_ATTR_BORDER_INNER))); aTempBox.SetLine( aSetBox.GetRight(), BOX_LINE_RIGHT); aSetBox.SetLine( aSetBox.GetLeft(), BOX_LINE_RIGHT); @@ -1150,7 +1150,7 @@ void SwDoc::SetBoxAttr( const SwCursor& rCursor, const SfxPoolItem &rNew ) SwFrmFmt *pNewFmt; if ( 0 != (pNewFmt = SwTblFmtCmp::FindNewFmt( aFmtCmp, pBox->GetFrmFmt(), 0 ))) - pBox->ChgFrmFmt( (SwTableBoxFmt*)pNewFmt ); + pBox->ChgFrmFmt( static_cast<SwTableBoxFmt*>(pNewFmt) ); else { SwFrmFmt *pOld = pBox->GetFrmFmt(); @@ -1194,7 +1194,7 @@ bool SwDoc::GetBoxAttr( const SwCursor& rCursor, SfxPoolItem& rToFill ) const aBoxes[i]->GetFrmFmt()->makeBackgroundBrushItem(); if( !bOneFound ) { - (SvxBrushItem&)rToFill = aBack; + static_cast<SvxBrushItem&>(rToFill) = aBack; bOneFound = true; } else if( rToFill != aBack ) @@ -1208,7 +1208,7 @@ bool SwDoc::GetBoxAttr( const SwCursor& rCursor, SfxPoolItem& rToFill ) const aBoxes[i]->GetFrmFmt()->GetFrmDir(); if( !bOneFound ) { - (SvxFrameDirectionItem&)rToFill = rDir; + static_cast<SvxFrameDirectionItem&>(rToFill) = rDir; bOneFound = true; } else if( rToFill != rDir ) @@ -1267,7 +1267,7 @@ static sal_uInt16 lcl_CalcCellFit( const SwLayoutFrm *pCell ) // pFrm does not necessarily have to be a SwTxtFrm! const SwTwips nCalcFitToContent = pFrm->IsTxtFrm() ? - ((SwTxtFrm*)pFrm)->CalcFitToContent() : + const_cast<SwTxtFrm*>(static_cast<const SwTxtFrm*>(pFrm))->CalcFitToContent() : (pFrm->Prt().*fnRect->fnGetWidth)(); nRet = std::max( nRet, nCalcFitToContent + nAdd ); @@ -1462,7 +1462,7 @@ void SwDoc::AdjustCellWidth( const SwCursor& rCursor, bool bBalance ) return; // Robust SwTabCols aTabCols; - GetTabCols( aTabCols, 0, (SwCellFrm*)pBoxFrm ); + GetTabCols( aTabCols, 0, static_cast<SwCellFrm*>(pBoxFrm) ); if ( ! aTabCols.Count() ) return; @@ -1561,7 +1561,7 @@ void SwDoc::AdjustCellWidth( const SwCursor& rCursor, bool bBalance ) const sal_Int16 nOriHori = pFmt->GetHoriOrient().GetHoriOrient(); // We can leave the "real" work to the SwTable now - SetTabCols( aTabCols, false, 0, (SwCellFrm*)pBoxFrm ); + SetTabCols( aTabCols, false, 0, static_cast<SwCellFrm*>(pBoxFrm) ); // Alignment might have been changed in SetTabCols; restore old value const SwFmtHoriOrient &rHori = pFmt->GetHoriOrient(); diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index f24d25b..eab82da2 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -92,7 +92,7 @@ void GetNewAutoStyle( boost::shared_ptr<const SfxItemSet>& rpAttrSet, rpAttrSet = rSA.getAutomaticStyle( rNewAttrSet, rNode.IsTxtNode() ? IStyleAccess::AUTO_STYLE_PARA : IStyleAccess::AUTO_STYLE_NOTXT ); - const bool bSetModifyAtAttr = ((SwAttrSet*)rpAttrSet.get())->SetModifyAtAttr( &rNode ); + const bool bSetModifyAtAttr = const_cast<SwAttrSet*>(static_cast<const SwAttrSet*>(rpAttrSet.get()))->SetModifyAtAttr( &rNode ); rNode.SetModifyAtAttr( bSetModifyAtAttr ); } @@ -136,7 +136,7 @@ const SfxPoolItem* Put( boost::shared_ptr<const SfxItemSet>& rpAttrSet, const SwCntntNode& rNode, const SfxPoolItem& rAttr ) { - SwAttrSet aNewSet( (SwAttrSet&)*rpAttrSet ); + SwAttrSet aNewSet( static_cast<const SwAttrSet&>(*rpAttrSet) ); const SfxPoolItem* pRet = aNewSet.Put( rAttr ); if ( pRet ) GetNewAutoStyle( rpAttrSet, rNode, aNewSet ); @@ -146,7 +146,7 @@ const SfxPoolItem* Put( boost::shared_ptr<const SfxItemSet>& rpAttrSet, bool Put( boost::shared_ptr<const SfxItemSet>& rpAttrSet, const SwCntntNode& rNode, const SfxItemSet& rSet ) { - SwAttrSet aNewSet( (SwAttrSet&)*rpAttrSet ); + SwAttrSet aNewSet( static_cast<const SwAttrSet&>(*rpAttrSet) ); // #i76273# Robust SfxItemSet* pStyleNames = 0; @@ -175,7 +175,7 @@ bool Put_BC( boost::shared_ptr<const SfxItemSet>& rpAttrSet, const SwCntntNode& rNode, const SfxPoolItem& rAttr, SwAttrSet* pOld, SwAttrSet* pNew ) { - SwAttrSet aNewSet( (SwAttrSet&)*rpAttrSet ); + SwAttrSet aNewSet( static_cast<const SwAttrSet&>(*rpAttrSet) ); // for a correct broadcast, we need to do a SetModifyAtAttr with the items // from aNewSet. The 'regular' SetModifyAtAttr is done in GetNewAutoStyle @@ -194,7 +194,7 @@ bool Put_BC( boost::shared_ptr<const SfxItemSet>& rpAttrSet, const SwCntntNode& rNode, const SfxItemSet& rSet, SwAttrSet* pOld, SwAttrSet* pNew ) { - SwAttrSet aNewSet( (SwAttrSet&)*rpAttrSet ); + SwAttrSet aNewSet( static_cast<const SwAttrSet&>(*rpAttrSet) ); // #i76273# Robust SfxItemSet* pStyleNames = 0; @@ -228,7 +228,7 @@ sal_uInt16 ClearItem_BC( boost::shared_ptr<const SfxItemSet>& rpAttrSet, const SwCntntNode& rNode, sal_uInt16 nWhich, SwAttrSet* pOld, SwAttrSet* pNew ) { - SwAttrSet aNewSet( (SwAttrSet&)*rpAttrSet ); + SwAttrSet aNewSet( static_cast<const SwAttrSet&>(*rpAttrSet) ); if( rNode.GetModifyAtAttr() ) aNewSet.SetModifyAtAttr( &rNode ); const sal_uInt16 nRet = aNewSet.ClearItem_BC( nWhich, pOld, pNew ); @@ -242,7 +242,7 @@ sal_uInt16 ClearItem_BC( boost::shared_ptr<const SfxItemSet>& rpAttrSet, sal_uInt16 nWhich1, sal_uInt16 nWhich2, SwAttrSet* pOld, SwAttrSet* pNew ) { - SwAttrSet aNewSet( (SwAttrSet&)*rpAttrSet ); + SwAttrSet aNewSet( static_cast<const SwAttrSet&>(*rpAttrSet) ); if( rNode.GetModifyAtAttr() ) aNewSet.SetModifyAtAttr( &rNode ); const sal_uInt16 nRet = aNewSet.ClearItem_BC( nWhich1, nWhich2, pOld, pNew ); @@ -415,13 +415,13 @@ bool SwNode::IsProtect() const { const SwNode* pNd = ND_SECTIONNODE == nNodeType ? pStartOfSection : this; const SwStartNode* pSttNd = pNd->FindSectionNode(); - if( pSttNd && ((SwSectionNode*)pSttNd)->GetSection().IsProtectFlag() ) + if( pSttNd && static_cast<const SwSectionNode*>(pSttNd)->GetSection().IsProtectFlag() ) return true; if( 0 != ( pSttNd = FindTableBoxStartNode() ) ) { SwCntntFrm* pCFrm; - if( IsCntntNode() && 0 != (pCFrm = ((SwCntntNode*)this)->getLayoutFrm( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ) )) + if( IsCntntNode() && 0 != (pCFrm = static_cast<const SwCntntNode*>(this)->getLayoutFrm( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ) )) return pCFrm->IsProtected(); const SwTableBox* pBox = pSttNd->FindTableNode()->GetTable(). @@ -478,7 +478,7 @@ const SwPageDesc* SwNode::FindPageDesc( bool bCalcLay, { pNode = GetCntntNode(); if( pNode ) - pPgDesc = ((SwFmtPageDesc&)pNode->GetAttr( RES_PAGEDESC )).GetPageDesc(); + pPgDesc = static_cast<const SwFmtPageDesc&>(pNode->GetAttr( RES_PAGEDESC )).GetPageDesc(); } // Are we going through the layout? @@ -665,19 +665,19 @@ const SwPageDesc* SwNode::FindPageDesc( bool bCalcLay, sal_uInt32 i, nMaxItems = pDoc->GetAttrPool().GetItemCount2( RES_PAGEDESC ); for( i = 0; i < nMaxItems; ++i ) if( 0 != (pItem = pDoc->GetAttrPool().GetItem2( RES_PAGEDESC, i ) ) && - ((SwFmtPageDesc*)pItem)->GetDefinedIn() ) + static_cast<const SwFmtPageDesc*>(pItem)->GetDefinedIn() ) { - const SwModify* pMod = ((SwFmtPageDesc*)pItem)->GetDefinedIn(); + const SwModify* pMod = static_cast<const SwFmtPageDesc*>(pItem)->GetDefinedIn(); if( pMod->ISA( SwCntntNode ) ) - aInfo.CheckNode( *(SwCntntNode*)pMod ); + aInfo.CheckNode( *static_cast<const SwCntntNode*>(pMod) ); else if( pMod->ISA( SwFmt )) - ((SwFmt*)pMod)->GetInfo( aInfo ); + static_cast<const SwFmt*>(pMod)->GetInfo( aInfo ); } if( 0 != ( pNd = aInfo.GetFoundNode() )) { if( pNd->IsCntntNode() ) - pPgDesc = ((SwFmtPageDesc&)pNd->GetCntntNode()-> + pPgDesc = static_cast<const SwFmtPageDesc&>(pNd->GetCntntNode()-> GetAttr( RES_PAGEDESC )).GetPageDesc(); else if( pNd->IsTableNode() ) pPgDesc = pNd->GetTableNode()->GetTable(). @@ -706,7 +706,7 @@ SwFrmFmt* SwNode::GetFlyFmt() const { if( IsCntntNode() ) { - SwCntntFrm* pFrm = SwIterator<SwCntntFrm,SwCntntNode>::FirstElement( *(SwCntntNode*)this ); + SwCntntFrm* pFrm = SwIterator<SwCntntFrm,SwCntntNode>::FirstElement( *static_cast<const SwCntntNode*>(this) ); if( pFrm ) pRet = pFrm->FindFlyFrm()->GetFmt(); } @@ -742,7 +742,7 @@ SwTableBox* SwNode::GetTblBox() const SwStartNode* SwNode::FindSttNodeByType( SwStartNodeType eTyp ) { - SwStartNode* pTmp = IsStartNode() ? (SwStartNode*)this : pStartOfSection; + SwStartNode* pTmp = IsStartNode() ? static_cast<SwStartNode*>(this) : pStartOfSection; while( eTyp != pTmp->GetStartNodeType() && pTmp->GetIndex() ) pTmp = pTmp->pStartOfSection; @@ -919,7 +919,7 @@ SwCntntNode::~SwCntntNode() delete pCondColl; if ( mpAttrSet.get() && mbSetModifyAtAttr ) - ((SwAttrSet*)mpAttrSet.get())->SetModifyAtAttr( 0 ); + const_cast<SwAttrSet*>(static_cast<const SwAttrSet*>(mpAttrSet.get()))->SetModifyAtAttr( 0 ); } void SwCntntNode::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue ) @@ -932,7 +932,7 @@ void SwCntntNode::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewV case RES_OBJECTDYING : if (pNewValue) { - SwFmt * pFmt = (SwFmt *) ((SwPtrMsgPoolItem *)pNewValue)->pObject; + SwFmt * pFmt = static_cast<SwFmt *>( static_cast<const SwPtrMsgPoolItem *>(pNewValue)->pObject ); // Do not mangle pointers if it is the upper-most format! if( GetRegisteredIn() == pFmt ) @@ -959,7 +959,7 @@ void SwCntntNode::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewV // If the Format parent was switched, register the Attrset at the new one // Skip own Modify! if( GetpSwAttrSet() && pNewValue && - ((SwFmtChg*)pNewValue)->pChangedFmt == GetRegisteredIn() ) + static_cast<const SwFmtChg*>(pNewValue)->pChangedFmt == GetRegisteredIn() ) { // Attach Set to the new parent AttrSetHandleHelper::SetParent( mpAttrSet, *this, GetFmtColl(), GetFmtColl() ); @@ -968,7 +968,7 @@ void SwCntntNode::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewV //FEATURE::CONDCOLL case RES_CONDCOLL_CONDCHG: - if( pNewValue && ((SwCondCollCondChg*)pNewValue)->pChangedFmt == GetRegisteredIn() && + if( pNewValue && static_cast<const SwCondCollCondChg*>(pNewValue)->pChangedFmt == GetRegisteredIn() && &GetNodes() == &GetDoc()->GetNodes() ) { ChkCondColl(); @@ -979,10 +979,10 @@ void SwCntntNode::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewV case RES_ATTRSET_CHG: if (GetNodes().IsDocNodes() && IsTxtNode() && pOldValue) { - if( SfxItemState::SET == ((SwAttrSetChg*)pOldValue)->GetChgSet()->GetItemState( + if( SfxItemState::SET == static_cast<const SwAttrSetChg*>(pOldValue)->GetChgSet()->GetItemState( RES_CHRATR_HIDDEN, false ) ) { - ((SwTxtNode*)this)->SetCalcHiddenCharFlags(); + static_cast<SwTxtNode*>(this)->SetCalcHiddenCharFlags(); } } break; @@ -990,11 +990,11 @@ void SwCntntNode::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewV case RES_UPDATE_ATTR: if (GetNodes().IsDocNodes() && IsTxtNode() && pNewValue) { - const sal_uInt16 nTmp = ((SwUpdateAttr*)pNewValue)->getWhichAttr(); + const sal_uInt16 nTmp = static_cast<const SwUpdateAttr*>(pNewValue)->getWhichAttr(); if ( RES_ATTRSET_CHG == nTmp ) { // TODO: anybody wants to do some optimization here? - ((SwTxtNode*)this)->SetCalcHiddenCharFlags(); + static_cast<SwTxtNode*>(this)->SetCalcHiddenCharFlags(); } } break; @@ -1009,9 +1009,9 @@ bool SwCntntNode::InvalidateNumRule() const SfxPoolItem* pItem; if( GetNodes().IsDocNodes() && 0 != ( pItem = GetNoCondAttr( RES_PARATR_NUMRULE, true )) && - !((SwNumRuleItem*)pItem)->GetValue().isEmpty() && + !static_cast<const SwNumRuleItem*>(pItem)->GetValue().isEmpty() && 0 != (pRule = GetDoc()->FindNumRulePtr( - ((SwNumRuleItem*)pItem)->GetValue() ) ) ) + static_cast<const SwNumRuleItem*>(pItem)->GetValue() ) ) ) { pRule->SetInvalidRule( true ); } @@ -1021,16 +1021,16 @@ bool SwCntntNode::InvalidateNumRule() SwCntntFrm *SwCntntNode::getLayoutFrm( const SwRootFrm* _pRoot, const Point* pPoint, const SwPosition *pPos, const bool bCalcFrm ) const { - return (SwCntntFrm*) ::GetFrmOfModify( _pRoot, *(SwModify*)this, FRM_CNTNT, - pPoint, pPos, bCalcFrm ); + return static_cast<SwCntntFrm*>( ::GetFrmOfModify( _pRoot, *(SwModify*)this, FRM_CNTNT, + pPoint, pPos, bCalcFrm )); } SwRect SwCntntNode::FindLayoutRect( const bool bPrtArea, const Point* pPoint, const bool bCalcFrm ) const { SwRect aRet; - SwCntntFrm* pFrm = (SwCntntFrm*)::GetFrmOfModify( 0, *(SwModify*)this, - FRM_CNTNT, pPoint, 0, bCalcFrm ); + SwCntntFrm* pFrm = static_cast<SwCntntFrm*>( ::GetFrmOfModify( 0, *(SwModify*)this, + FRM_CNTNT, pPoint, 0, bCalcFrm ) ); if( pFrm ) aRet = bPrtArea ? pFrm->Prt() : pFrm->Frm(); return aRet; @@ -1308,21 +1308,21 @@ bool SwCntntNode::GetInfo( SfxPoolItem& rInfo ) const switch( rInfo.Which() ) { case RES_AUTOFMT_DOCNODE: - if( &GetNodes() == ((SwAutoFmtGetDocNode&)rInfo).pNodes ) + if( &GetNodes() == static_cast<SwAutoFmtGetDocNode&>(rInfo).pNodes ) { - ((SwAutoFmtGetDocNode&)rInfo).pCntntNode = this; + static_cast<SwAutoFmtGetDocNode&>(rInfo).pCntntNode = this; return false; } break; case RES_FINDNEARESTNODE: - if( ((SwFmtPageDesc&)GetAttr( RES_PAGEDESC )).GetPageDesc() ) - ((SwFindNearestNode&)rInfo).CheckNode( *this ); + if( static_cast<const SwFmtPageDesc&>(GetAttr( RES_PAGEDESC )).GetPageDesc() ) + static_cast<SwFindNearestNode&>(rInfo).CheckNode( *this ); return true; case RES_CONTENT_VISIBLE: { - ((SwPtrMsgPoolItem&)rInfo).pObject = + static_cast<SwPtrMsgPoolItem&>(rInfo).pObject = SwIterator<SwFrm,SwCntntNode>::FirstElement(*this); } return false; @@ -1613,7 +1613,7 @@ const SfxPoolItem* SwCntntNode::GetNoCondAttr( sal_uInt16 nWhich, if( !GetpSwAttrSet() || ( SfxItemState::SET != GetpSwAttrSet()->GetItemState( nWhich, false, &pFnd ) && bInParents )) { - (void)((SwFmt*)GetRegisteredIn())->GetItemState( nWhich, bInParents, &pFnd ); + (void)static_cast<const SwFmt*>(GetRegisteredIn())->GetItemState( nWhich, bInParents, &pFnd ); } } // undo change of issue #i51029# @@ -1832,12 +1832,12 @@ void SwCntntNode::ChkCondColl() if (!bDone) { - if( IsTxtNode() && ((SwTxtNode*)this)->GetNumRule()) + if( IsTxtNode() && static_cast<SwTxtNode*>(this)->GetNumRule()) { // Is at which Level in a list? aTmp.SetCondition( PARA_IN_LIST, - ((SwTxtNode*)this)->GetActualListLevel() ); - pCColl = ((SwConditionTxtFmtColl*)GetFmtColl())-> + static_cast<SwTxtNode*>(this)->GetActualListLevel() ); + pCColl = static_cast<SwConditionTxtFmtColl*>(GetFmtColl())-> HasCondition( aTmp ); } else diff --git a/sw/source/core/docnode/node2lay.cxx b/sw/source/core/docnode/node2lay.cxx index 538b419..319a16b 100644 --- a/sw/source/core/docnode/node2lay.cxx +++ b/sw/source/core/docnode/node2lay.cxx @@ -69,9 +69,9 @@ SwNode* GoNextWithFrm(const SwNodes& rNodes, SwNodeIndex *pIdx) pNd = &aTmp.GetNode(); bool bFound = false; if ( pNd->IsCntntNode() ) - bFound = ( SwIterator<SwFrm,SwCntntNode>::FirstElement(*(SwCntntNode*)pNd) != 0); + bFound = ( SwIterator<SwFrm,SwCntntNode>::FirstElement(*static_cast<SwCntntNode*>(pNd)) != 0); else if ( pNd->IsTableNode() ) - bFound = ( SwIterator<SwFrm,SwFmt>::FirstElement(*((SwTableNode*)pNd)->GetTable().GetFrmFmt()) != 0 ); + bFound = ( SwIterator<SwFrm,SwFmt>::FirstElement(*static_cast<SwTableNode*>(pNd)->GetTable().GetFrmFmt()) != 0 ); else if( pNd->IsEndNode() && !pNd->StartOfSectionNode()->IsSectionNode() ) { pNd = 0; @@ -101,9 +101,9 @@ SwNode* GoPreviousWithFrm(SwNodeIndex *pIdx) pNd = &aTmp.GetNode(); bool bFound = false; if ( pNd->IsCntntNode() ) - bFound = ( SwIterator<SwFrm,SwCntntNode>::FirstElement(*(SwCntntNode*)pNd) != 0); + bFound = ( SwIterator<SwFrm,SwCntntNode>::FirstElement(*static_cast<SwCntntNode*>(pNd)) != 0); else if ( pNd->IsTableNode() ) - bFound = ( SwIterator<SwFrm,SwFmt>::FirstElement(*((SwTableNode*)pNd)->GetTable().GetFrmFmt()) != 0 ); + bFound = ( SwIterator<SwFrm,SwFmt>::FirstElement(*static_cast<SwTableNode*>(pNd)->GetTable().GetFrmFmt()) != 0 ); else if( pNd->IsStartNode() && !pNd->IsSectionNode() ) { pNd = 0; @@ -262,11 +262,11 @@ void SwNode2LayImpl::SaveUpperFrms() if( pFrm ) { if( pFrm->IsFtnFrm() ) - ((SwFtnFrm*)pFrm)->ColLock(); + static_cast<SwFtnFrm*>(pFrm)->ColLock(); else if( pFrm->IsInSct() ) pFrm->FindSctFrm()->ColLock(); if( pPrv && pPrv->IsSctFrm() ) - ((SwSectionFrm*)pPrv)->LockJoin(); + static_cast<SwSectionFrm*>(pPrv)->LockJoin(); pUpperFrms->push_back( pPrv ); pUpperFrms->push_back( pFrm ); } @@ -291,9 +291,9 @@ SwLayoutFrm* SwNode2LayImpl::UpperFrm( SwFrm* &rpFrm, const SwNode &rNode ) if( pFrm && pFrm->IsSctFrm() ) { // pFrm could be a "dummy"-section - if( ((SwSectionFrm*)pFrm)->GetSection() && - (&((SwSectionNode*)pNode)->GetSection() == - ((SwSectionFrm*)pFrm)->GetSection()) ) + if( static_cast<SwSectionFrm*>(pFrm)->GetSection() && + (&static_cast<const SwSectionNode*>(pNode)->GetSection() == + static_cast<SwSectionFrm*>(pFrm)->GetSection()) ) { // #i22922# - consider columned sections // 'Go down' the section frame as long as the layout frame @@ -314,7 +314,7 @@ SwLayoutFrm* SwNode2LayImpl::UpperFrm( SwFrm* &rpFrm, const SwNode &rNode ) return static_cast<SwLayoutFrm*>(pFrm); } - pUpper = new SwSectionFrm(((SwSectionNode*)pNode)->GetSection(), rpFrm); + pUpper = new SwSectionFrm(const_cast<SwSectionNode*>(static_cast<const SwSectionNode*>(pNode))->GetSection(), rpFrm); pUpper->Paste( rpFrm->GetUpper(), ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits