diff options
author | Noel Grandin <noel@peralex.com> | 2014-11-24 10:39:39 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-11-25 10:09:51 +0200 |
commit | e9251f1f47cf3d1c6475f51a988ff5cee0f03159 (patch) | |
tree | 2ead039173551b7a23d4bd9a29fc05c136b6ea24 | |
parent | 0f29e157abf237055004c7b9bc1d171a78c0c27e (diff) |
loplugin: cstylecast
Change-Id: I9f9fef666ee22c54d923f24ce862151d32f4a5a7
29 files changed, 152 insertions, 152 deletions
diff --git a/sw/source/core/txtnode/atrftn.cxx b/sw/source/core/txtnode/atrftn.cxx index 0248f6bb6e2c..3a0328e6f940 100644 --- a/sw/source/core/txtnode/atrftn.cxx +++ b/sw/source/core/txtnode/atrftn.cxx @@ -129,9 +129,9 @@ SwFmtFtn::SwFmtFtn( bool bEndNote ) bool SwFmtFtn::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); - return m_nNumber == ((SwFmtFtn&)rAttr).m_nNumber && - m_aNumber == ((SwFmtFtn&)rAttr).m_aNumber && - m_bEndNote == ((SwFmtFtn&)rAttr).m_bEndNote; + return m_nNumber == static_cast<const SwFmtFtn&>(rAttr).m_nNumber && + m_aNumber == static_cast<const SwFmtFtn&>(rAttr).m_aNumber && + m_bEndNote == static_cast<const SwFmtFtn&>(rAttr).m_bEndNote; } SfxPoolItem* SwFmtFtn::Clone( SfxItemPool* ) const @@ -185,12 +185,12 @@ void SwFmtFtn::GetFtnText( OUString& rStr ) const pCNd = aIdx.GetNodes().GoNext( &aIdx ); if( pCNd->IsTxtNode() ) { - rStr = ((SwTxtNode*)pCNd)->GetExpandTxt(); + rStr = static_cast<SwTxtNode*>(pCNd)->GetExpandTxt(); ++aIdx; while ( !aIdx.GetNode().IsEndNode() ) { if ( aIdx.GetNode().IsTxtNode() ) - rStr += " " + ((SwTxtNode*)(aIdx.GetNode().GetTxtNode()))->GetExpandTxt(); + rStr += " " + static_cast<SwTxtNode*>((aIdx.GetNode().GetTxtNode()))->GetExpandTxt(); ++aIdx; } } @@ -352,7 +352,7 @@ void SwTxtFtn::SetNumber( const sal_uInt16 nNewNum, const OUString &sNumStr ) { // Es koennen ja auch Grafiken in der Fussnote stehen ... if( ( pNd = rNodes[ nSttIdx ] )->IsTxtNode() ) - ((SwTxtNode*)pNd)->ModifyNotification( 0, &rFtn ); + static_cast<SwTxtNode*>(pNd)->ModifyNotification( 0, &rFtn ); } } } @@ -536,7 +536,7 @@ void SwTxtFtn::CheckCondColl() { //FEATURE::CONDCOLL if( GetStartNode() ) - ((SwStartNode&)GetStartNode()->GetNode()).CheckSectionCondColl(); + static_cast<SwStartNode&>(GetStartNode()->GetNode()).CheckSectionCondColl(); //FEATURE::CONDCOLL } diff --git a/sw/source/core/txtnode/atrref.cxx b/sw/source/core/txtnode/atrref.cxx index db7ce9d28a0f..3fbb19b17346 100644 --- a/sw/source/core/txtnode/atrref.cxx +++ b/sw/source/core/txtnode/atrref.cxx @@ -47,7 +47,7 @@ SwFmtRefMark::SwFmtRefMark( const SwFmtRefMark& rAttr ) bool SwFmtRefMark::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); - return aRefName == ((SwFmtRefMark&)rAttr).aRefName; + return aRefName == static_cast<const SwFmtRefMark&>(rAttr).aRefName; } SfxPoolItem* SwFmtRefMark::Clone( SfxItemPool* ) const diff --git a/sw/source/core/txtnode/atrtox.cxx b/sw/source/core/txtnode/atrtox.cxx index 1cbd87a94ac1..66aad100ca22 100644 --- a/sw/source/core/txtnode/atrtox.cxx +++ b/sw/source/core/txtnode/atrtox.cxx @@ -81,7 +81,7 @@ void SwTxtTOXMark::CopyTOXMark( SwDoc* pDoc ) } // Verzeichnistyp umhaengen - ((SwTOXType*)pType)->Add( &rTOX ); + const_cast<SwTOXType*>(pType)->Add( &rTOX ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/txtnode/fmtatr2.cxx b/sw/source/core/txtnode/fmtatr2.cxx index efbfe7742844..66bfb8de1679 100644 --- a/sw/source/core/txtnode/fmtatr2.cxx +++ b/sw/source/core/txtnode/fmtatr2.cxx @@ -74,7 +74,7 @@ SwFmtCharFmt::~SwFmtCharFmt() {} bool SwFmtCharFmt::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); - return GetCharFmt() == ((SwFmtCharFmt&)rAttr).GetCharFmt(); + return GetCharFmt() == static_cast<const SwFmtCharFmt&>(rAttr).GetCharFmt(); } SfxPoolItem* SwFmtCharFmt::Clone( SfxItemPool* ) const @@ -125,7 +125,7 @@ SwFmtAutoFmt::~SwFmtAutoFmt() bool SwFmtAutoFmt::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); - return mpHandle == ((SwFmtAutoFmt&)rAttr).mpHandle; + return mpHandle == static_cast<const SwFmtAutoFmt&>(rAttr).mpHandle; } SfxPoolItem* SwFmtAutoFmt::Clone( SfxItemPool* ) const @@ -200,18 +200,18 @@ bool SwFmtINetFmt::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); bool bRet = SfxPoolItem::operator==( (SfxPoolItem&) rAttr ) - && msURL == ((SwFmtINetFmt&)rAttr).msURL - && msHyperlinkName == ((SwFmtINetFmt&)rAttr).msHyperlinkName - && msTargetFrame == ((SwFmtINetFmt&)rAttr).msTargetFrame - && msINetFmtName == ((SwFmtINetFmt&)rAttr).msINetFmtName - && msVisitedFmtName == ((SwFmtINetFmt&)rAttr).msVisitedFmtName - && mnINetFmtId == ((SwFmtINetFmt&)rAttr).mnINetFmtId - && mnVisitedFmtId == ((SwFmtINetFmt&)rAttr).mnVisitedFmtId; + && msURL == static_cast<const SwFmtINetFmt&>(rAttr).msURL + && msHyperlinkName == static_cast<const SwFmtINetFmt&>(rAttr).msHyperlinkName + && msTargetFrame == static_cast<const SwFmtINetFmt&>(rAttr).msTargetFrame + && msINetFmtName == static_cast<const SwFmtINetFmt&>(rAttr).msINetFmtName + && msVisitedFmtName == static_cast<const SwFmtINetFmt&>(rAttr).msVisitedFmtName + && mnINetFmtId == static_cast<const SwFmtINetFmt&>(rAttr).mnINetFmtId + && mnVisitedFmtId == static_cast<const SwFmtINetFmt&>(rAttr).mnVisitedFmtId; if( !bRet ) return false; - const SvxMacroTableDtor* pOther = ((SwFmtINetFmt&)rAttr).mpMacroTbl; + const SvxMacroTableDtor* pOther = static_cast<const SwFmtINetFmt&>(rAttr).mpMacroTbl; if( !mpMacroTbl ) return ( !pOther || pOther->empty() ); if( !pOther ) @@ -422,11 +422,11 @@ SwFmtRuby& SwFmtRuby::operator=( const SwFmtRuby& rAttr ) bool SwFmtRuby::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); - return sRubyTxt == ((SwFmtRuby&)rAttr).sRubyTxt && - sCharFmtName == ((SwFmtRuby&)rAttr).sCharFmtName && - nCharFmtId == ((SwFmtRuby&)rAttr).nCharFmtId && - nPosition == ((SwFmtRuby&)rAttr).nPosition && - nAdjustment == ((SwFmtRuby&)rAttr).nAdjustment; + return sRubyTxt == static_cast<const SwFmtRuby&>(rAttr).sRubyTxt && + sCharFmtName == static_cast<const SwFmtRuby&>(rAttr).sCharFmtName && + nCharFmtId == static_cast<const SwFmtRuby&>(rAttr).nCharFmtId && + nPosition == static_cast<const SwFmtRuby&>(rAttr).nPosition && + nAdjustment == static_cast<const SwFmtRuby&>(rAttr).nAdjustment; } SfxPoolItem* SwFmtRuby::Clone( SfxItemPool* ) const diff --git a/sw/source/core/txtnode/fntcap.cxx b/sw/source/core/txtnode/fntcap.cxx index 4dd6e4099c10..ce2d7c40d7bd 100644 --- a/sw/source/core/txtnode/fntcap.cxx +++ b/sw/source/core/txtnode/fntcap.cxx @@ -442,7 +442,7 @@ void SwDoDrawStretchCapital::Do() GetOut().DrawStretchText( aPos, nPartWidth, rInf.GetText(), rInf.GetIdx(), rInf.GetLen() ); } - ((Point&)rInf.GetPos()).X() += nPartWidth; + const_cast<Point&>(rInf.GetPos()).X() += nPartWidth; } void SwSubFont::DrawStretchCapital( SwDrawTextInfo &rInf ) @@ -637,7 +637,7 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo ) pLastFont = pSpaceFont; pLastFont->SetDevFont( rDo.GetInf().GetShell(), rDo.GetOut() ); - ((SwDoDrawCapital&)rDo).DrawSpace( aStartPos ); + static_cast<SwDoDrawCapital&>(rDo).DrawSpace( aStartPos ); pLastFont = pBigFont; pLastFont->SetDevFont( rDo.GetInf().GetShell(), rDo.GetOut() ); diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 5b347df7f7da..74f918a2b3d6 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -137,12 +137,12 @@ SwTxtNode *SwNodes::MakeTxtNode( const SwNodeIndex & rWhere, switch (pNd->GetNodeType()) { case ND_TABLENODE: - ((SwTableNode*)pNd)->MakeFrms( aIdx ); + static_cast<SwTableNode*>(pNd)->MakeFrms( aIdx ); return pNode; case ND_SECTIONNODE: - if( ((SwSectionNode*)pNd)->GetSection().IsHidden() || - ((SwSectionNode*)pNd)->IsCntntHidden() ) + if( static_cast<SwSectionNode*>(pNd)->GetSection().IsHidden() || + static_cast<SwSectionNode*>(pNd)->IsCntntHidden() ) { SwNodeIndex aTmpIdx( *pNode ); pNd = FindPrvNxtFrmNode( aTmpIdx, pNode ); @@ -151,13 +151,13 @@ SwTxtNode *SwNodes::MakeTxtNode( const SwNodeIndex & rWhere, aTmp = *pNd; break; } - ((SwSectionNode*)pNd)->MakeFrms( aIdx ); + static_cast<SwSectionNode*>(pNd)->MakeFrms( aIdx ); return pNode; case ND_TEXTNODE: case ND_GRFNODE: case ND_OLENODE: - ((SwCntntNode*)pNd)->MakeFrms( *pNode ); + static_cast<SwCntntNode*>(pNd)->MakeFrms( *pNode ); return pNode; case ND_ENDNODE: @@ -343,7 +343,7 @@ static void lcl_ChangeFtnRef( SwTxtNode &rNode ) { pFtn->SetRef( pFrm ); pFtn = pFtn->GetFollow(); - ((SwTxtFrm*)pFrm)->SetFtn( true ); + static_cast<SwTxtFrm*>(pFrm)->SetFtn( true ); } } #if OSL_DEBUG_LEVEL > 0 @@ -484,8 +484,8 @@ SwCntntNode *SwTxtNode::SplitCntntNode( const SwPosition &rPos ) for( SwCntntFrm* pFrm = aIter.First(); pFrm; pFrm = aIter.Next() ) { pFrm->RegisterToNode( *pNode ); - if( pFrm->IsTxtFrm() && !pFrm->IsFollow() && ((SwTxtFrm*)pFrm)->GetOfst() ) - ((SwTxtFrm*)pFrm)->SetOfst( 0 ); + if( pFrm->IsTxtFrm() && !pFrm->IsFollow() && static_cast<SwTxtFrm*>(pFrm)->GetOfst() ) + static_cast<SwTxtFrm*>(pFrm)->SetOfst( 0 ); } if ( IsInCache() ) @@ -3467,7 +3467,7 @@ void SwTxtNode::ReplaceText( const SwIndex& rStart, const sal_Int32 nDelLen, // Dadurch wird die Attributierung des 1. Zeichen expandiert! m_Text = m_Text.replaceAt(nStartPos, 1, sInserted.copy(0, 1)); - ++((SwIndex&)rStart); + ++const_cast<SwIndex&>(rStart); m_Text = m_Text.replaceAt(rStart.GetIndex(), nLen - 1, ""); Update( rStart, nLen - 1, true ); @@ -3676,12 +3676,12 @@ void SwTxtNode::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewVal // Bug25481: // bei Nodes im Undo nie _ChgTxtCollUpdateNum rufen. if( pOldValue && pNewValue && RES_FMT_CHG == pOldValue->Which() && - GetRegisteredIn() == ((SwFmtChg*)pNewValue)->pChangedFmt && + GetRegisteredIn() == static_cast<const SwFmtChg*>(pNewValue)->pChangedFmt && GetNodes().IsDocNodes() ) { _ChgTxtCollUpdateNum( - (SwTxtFmtColl*)((SwFmtChg*)pOldValue)->pChangedFmt, - (SwTxtFmtColl*)((SwFmtChg*)pNewValue)->pChangedFmt ); + (SwTxtFmtColl*)static_cast<const SwFmtChg*>(pOldValue)->pChangedFmt, + (SwTxtFmtColl*)static_cast<const SwFmtChg*>(pNewValue)->pChangedFmt ); } //UUUU reset fill information @@ -3692,7 +3692,7 @@ void SwTxtNode::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewVal if(!bReset && RES_ATTRSET_CHG == nWhich) // ..on ItemChange from DrawingLayer FillAttributes { - SfxItemIter aIter(*((SwAttrSetChg*)pNewValue)->GetChgSet()); + SfxItemIter aIter(*static_cast<const SwAttrSetChg*>(pNewValue)->GetChgSet()); for(const SfxPoolItem* pItem = aIter.FirstItem(); pItem && !bReset; pItem = aIter.NextItem()) { diff --git a/sw/source/core/txtnode/swfntcch.cxx b/sw/source/core/txtnode/swfntcch.cxx index a27d15a1f93a..859db92ab4f1 100644 --- a/sw/source/core/txtnode/swfntcch.cxx +++ b/sw/source/core/txtnode/swfntcch.cxx @@ -45,7 +45,7 @@ SwFontObj::~SwFontObj() SwFontAccess::SwFontAccess( const void *pOwn, SwViewShell *pSh ) : SwCacheAccess( *pSwFontCache, pOwn, - ((SwTxtFmtColl*)pOwn)->IsInSwFntCache() ), + reinterpret_cast<const SwTxtFmtColl*>(pOwn)->IsInSwFntCache() ), pShell( pSh ) { } @@ -57,7 +57,7 @@ SwFontObj *SwFontAccess::Get( ) SwCacheObj *SwFontAccess::NewObj( ) { - ((SwTxtFmtColl*)pOwner)->SetInSwFntCache( true ); + const_cast<SwTxtFmtColl*>(reinterpret_cast<const SwTxtFmtColl*>(pOwner))->SetInSwFntCache( true ); return new SwFontObj( pOwner, pShell ); } diff --git a/sw/source/core/txtnode/swfont.cxx b/sw/source/core/txtnode/swfont.cxx index 3975cc371518..d51e951d948a 100644 --- a/sw/source/core/txtnode/swfont.cxx +++ b/sw/source/core/txtnode/swfont.cxx @@ -509,13 +509,13 @@ void SwFont::SetDiffFnt( const SfxItemSet *pAttrSet, } if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_POSTURE, true, &pItem )) - aSub[SW_LATIN].Font::SetItalic( ((SvxPostureItem*)pItem)->GetPosture() ); + aSub[SW_LATIN].Font::SetItalic( static_cast<const SvxPostureItem*>(pItem)->GetPosture() ); if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_WEIGHT, true, &pItem )) - aSub[SW_LATIN].Font::SetWeight( ((SvxWeightItem*)pItem)->GetWeight() ); + aSub[SW_LATIN].Font::SetWeight( static_cast<const SvxWeightItem*>(pItem)->GetWeight() ); if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_LANGUAGE, true, &pItem )) - aSub[SW_LATIN].SetLanguage( ((SvxLanguageItem*)pItem)->GetLanguage() ); + aSub[SW_LATIN].SetLanguage( static_cast<const SvxLanguageItem*>(pItem)->GetLanguage() ); if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_CJK_FONT, true, &pItem )) @@ -539,14 +539,14 @@ void SwFont::SetDiffFnt( const SfxItemSet *pAttrSet, } if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_CJK_POSTURE, true, &pItem )) - aSub[SW_CJK].Font::SetItalic( ((SvxPostureItem*)pItem)->GetPosture() ); + aSub[SW_CJK].Font::SetItalic( static_cast<const SvxPostureItem*>(pItem)->GetPosture() ); if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_CJK_WEIGHT, true, &pItem )) - aSub[SW_CJK].Font::SetWeight( ((SvxWeightItem*)pItem)->GetWeight() ); + aSub[SW_CJK].Font::SetWeight( static_cast<const SvxWeightItem*>(pItem)->GetWeight() ); if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_CJK_LANGUAGE, true, &pItem )) { - LanguageType eNewLang = ((SvxLanguageItem*)pItem)->GetLanguage(); + LanguageType eNewLang = static_cast<const SvxLanguageItem*>(pItem)->GetLanguage(); aSub[SW_CJK].SetLanguage( eNewLang ); aSub[SW_LATIN].SetCJKContextLanguage( eNewLang ); aSub[SW_CJK].SetCJKContextLanguage( eNewLang ); @@ -575,54 +575,54 @@ void SwFont::SetDiffFnt( const SfxItemSet *pAttrSet, } if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_CTL_POSTURE, true, &pItem )) - aSub[SW_CTL].Font::SetItalic( ((SvxPostureItem*)pItem)->GetPosture() ); + aSub[SW_CTL].Font::SetItalic( static_cast<const SvxPostureItem*>(pItem)->GetPosture() ); if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_CTL_WEIGHT, true, &pItem )) - aSub[SW_CTL].Font::SetWeight( ((SvxWeightItem*)pItem)->GetWeight() ); + aSub[SW_CTL].Font::SetWeight( static_cast<const SvxWeightItem*>(pItem)->GetWeight() ); if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_CTL_LANGUAGE, true, &pItem )) - aSub[SW_CTL].SetLanguage( ((SvxLanguageItem*)pItem)->GetLanguage() ); + aSub[SW_CTL].SetLanguage( static_cast<const SvxLanguageItem*>(pItem)->GetLanguage() ); if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_UNDERLINE, true, &pItem )) { - SetUnderline( ((SvxUnderlineItem*)pItem)->GetLineStyle() ); - SetUnderColor( ((SvxUnderlineItem*)pItem)->GetColor() ); + SetUnderline( static_cast<const SvxUnderlineItem*>(pItem)->GetLineStyle() ); + SetUnderColor( static_cast<const SvxUnderlineItem*>(pItem)->GetColor() ); } if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_OVERLINE, true, &pItem )) { - SetOverline( ((SvxOverlineItem*)pItem)->GetLineStyle() ); - SetOverColor( ((SvxOverlineItem*)pItem)->GetColor() ); + SetOverline( static_cast<const SvxOverlineItem*>(pItem)->GetLineStyle() ); + SetOverColor( static_cast<const SvxOverlineItem*>(pItem)->GetColor() ); } if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_CROSSEDOUT, true, &pItem )) - SetStrikeout( ((SvxCrossedOutItem*)pItem)->GetStrikeout() ); + SetStrikeout( static_cast<const SvxCrossedOutItem*>(pItem)->GetStrikeout() ); if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_COLOR, true, &pItem )) - SetColor( ((SvxColorItem*)pItem)->GetValue() ); + SetColor( static_cast<const SvxColorItem*>(pItem)->GetValue() ); if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_EMPHASIS_MARK, true, &pItem )) - SetEmphasisMark( ((SvxEmphasisMarkItem*)pItem)->GetEmphasisMark() ); + SetEmphasisMark( static_cast<const SvxEmphasisMarkItem*>(pItem)->GetEmphasisMark() ); SetTransparent( true ); SetAlign( ALIGN_BASELINE ); if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_CONTOUR, true, &pItem )) - SetOutline( ((SvxContourItem*)pItem)->GetValue() ); + SetOutline( static_cast<const SvxContourItem*>(pItem)->GetValue() ); if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_SHADOWED, true, &pItem )) - SetShadow( ((SvxShadowedItem*)pItem)->GetValue() ); + SetShadow( static_cast<const SvxShadowedItem*>(pItem)->GetValue() ); if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_RELIEF, true, &pItem )) - SetRelief( (FontRelief)((SvxCharReliefItem*)pItem)->GetValue() ); + SetRelief( (FontRelief)static_cast<const SvxCharReliefItem*>(pItem)->GetValue() ); if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_SHADOWED, true, &pItem )) - SetPropWidth(((SvxShadowedItem*)pItem)->GetValue() ? 50 : 100 ); + SetPropWidth(static_cast<const SvxShadowedItem*>(pItem)->GetValue() ? 50 : 100 ); if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_AUTOKERN, true, &pItem )) { - if( ((SvxAutoKernItem*)pItem)->GetValue() ) + if( static_cast<const SvxAutoKernItem*>(pItem)->GetValue() ) { SetAutoKern( ( !pIDocumentSettingAccess || !pIDocumentSettingAccess->get(IDocumentSettingAccess::KERN_ASIAN_PUNCTUATION) ) ? @@ -634,7 +634,7 @@ void SwFont::SetDiffFnt( const SfxItemSet *pAttrSet, } if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_WORDLINEMODE, true, &pItem )) - SetWordLineMode( ((SvxWordLineModeItem*)pItem)->GetValue() ); + SetWordLineMode( static_cast<const SvxWordLineModeItem*>(pItem)->GetValue() ); if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_ESCAPEMENT, true, &pItem )) @@ -646,25 +646,25 @@ void SwFont::SetDiffFnt( const SfxItemSet *pAttrSet, } if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_CASEMAP, true, &pItem )) - SetCaseMap( ((SvxCaseMapItem*)pItem)->GetCaseMap() ); + SetCaseMap( static_cast<const SvxCaseMapItem*>(pItem)->GetCaseMap() ); if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_KERNING, true, &pItem )) - SetFixKerning( ((SvxKerningItem*)pItem)->GetValue() ); + SetFixKerning( static_cast<const SvxKerningItem*>(pItem)->GetValue() ); if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_NOHYPHEN, true, &pItem )) - SetNoHyph( ((SvxNoHyphenItem*)pItem)->GetValue() ); + SetNoHyph( static_cast<const SvxNoHyphenItem*>(pItem)->GetValue() ); if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_BLINK, true, &pItem )) - SetBlink( ((SvxBlinkItem*)pItem)->GetValue() ); + SetBlink( static_cast<const SvxBlinkItem*>(pItem)->GetValue() ); if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_ROTATE, true, &pItem )) - SetVertical( ((SvxCharRotateItem*)pItem)->GetValue() ); + SetVertical( static_cast<const SvxCharRotateItem*>(pItem)->GetValue() ); if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_BACKGROUND, true, &pItem )) - pBackColor = new Color( ((SvxBrushItem*)pItem)->GetColor() ); + pBackColor = new Color( static_cast<const SvxBrushItem*>(pItem)->GetColor() ); if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_HIGHLIGHT, true, &pItem )) - SetHighlightColor(((SvxBrushItem*)pItem)->GetColor()); + SetHighlightColor(static_cast<const SvxBrushItem*>(pItem)->GetColor()); if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_BOX, true, &pItem )) { @@ -689,7 +689,7 @@ void SwFont::SetDiffFnt( const SfxItemSet *pAttrSet, const SfxPoolItem* pTwoLinesItem = 0; if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_TWO_LINES, true, &pTwoLinesItem )) - if ( ((SvxTwoLinesItem*)pTwoLinesItem)->GetValue() ) + if ( static_cast<const SvxTwoLinesItem*>(pTwoLinesItem)->GetValue() ) SetVertical( 0 ); } else @@ -841,12 +841,12 @@ SwFont::SwFont( const SwAttrSet* pAttrSet, const SfxPoolItem* pItem; if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_BACKGROUND, true, &pItem )) - pBackColor = new Color( ((SvxBrushItem*)pItem)->GetColor() ); + pBackColor = new Color( static_cast<const SvxBrushItem*>(pItem)->GetColor() ); else pBackColor = NULL; if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_HIGHLIGHT, true, &pItem )) - SetHighlightColor(((SvxBrushItem*)pItem)->GetColor()); + SetHighlightColor(static_cast<const SvxBrushItem*>(pItem)->GetColor()); else SetHighlightColor(COL_TRANSPARENT); if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_BOX, diff --git a/sw/source/core/txtnode/txtatr2.cxx b/sw/source/core/txtnode/txtatr2.cxx index 78edcb408cb7..86a0d5d4061d 100644 --- a/sw/source/core/txtnode/txtatr2.cxx +++ b/sw/source/core/txtnode/txtatr2.cxx @@ -267,17 +267,17 @@ SwCharFmt* SwTxtRuby::GetCharFmt() if( bResetMod ) { aOle2Lnk = pDoc->GetOle2Link(); - ((SwDoc*)pDoc)->SetOle2Link( Link() ); + const_cast<SwDoc*>(pDoc)->SetOle2Link( Link() ); } pRet = IsPoolUserFmt( nId ) - ? ((SwDoc*)pDoc)->FindCharFmtByName( rStr ) - : ((SwDoc*)pDoc)->getIDocumentStylePoolAccess().GetCharFmtFromPool( nId ); + ? const_cast<SwDoc*>(pDoc)->FindCharFmtByName( rStr ) + : const_cast<SwDoc*>(pDoc)->getIDocumentStylePoolAccess().GetCharFmtFromPool( nId ); if( bResetMod ) { - ((SwDoc*)pDoc)->getIDocumentState().ResetModified(); - ((SwDoc*)pDoc)->SetOle2Link( aOle2Lnk ); + const_cast<SwDoc*>(pDoc)->getIDocumentState().ResetModified(); + const_cast<SwDoc*>(pDoc)->SetOle2Link( aOle2Lnk ); } } diff --git a/sw/source/core/undo/SwUndoPageDesc.cxx b/sw/source/core/undo/SwUndoPageDesc.cxx index ec9a97fa5bb0..5d78c9e36e35 100644 --- a/sw/source/core/undo/SwUndoPageDesc.cxx +++ b/sw/source/core/undo/SwUndoPageDesc.cxx @@ -206,7 +206,7 @@ void SwUndoPageDesc::ExchangeContentNodes( SwPageDesc& rSource, SwPageDesc &rDes const SfxPoolItem* pItem; rDest.GetMaster().GetAttrSet().GetItemState( RES_HEADER, false, &pItem ); SfxPoolItem *pNewItem = pItem->Clone(); - SwFrmFmt* pNewFmt = ((SwFmtHeader*)pNewItem)->GetHeaderFmt(); + SwFrmFmt* pNewFmt = static_cast<SwFmtHeader*>(pNewItem)->GetHeaderFmt(); #if OSL_DEBUG_LEVEL > 1 const SwFmtCntnt& rSourceCntnt = rSourceHead.GetHeaderFmt()->GetCntnt(); (void)rSourceCntnt; @@ -220,7 +220,7 @@ void SwUndoPageDesc::ExchangeContentNodes( SwPageDesc& rSource, SwPageDesc &rDes // it loses the responsible and can be destroyed without removing the content nodes. rSource.GetMaster().GetAttrSet().GetItemState( RES_HEADER, false, &pItem ); pNewItem = pItem->Clone(); - pNewFmt = ((SwFmtHeader*)pNewItem)->GetHeaderFmt(); + pNewFmt = static_cast<SwFmtHeader*>(pNewItem)->GetHeaderFmt(); pNewFmt->SetFmtAttr( SwFmtCntnt() ); delete pNewItem; @@ -230,7 +230,7 @@ void SwUndoPageDesc::ExchangeContentNodes( SwPageDesc& rSource, SwPageDesc &rDes const SwFmtHeader& rSourceLeftHead = rSource.GetLeft().GetHeader(); rDest.GetLeft().GetAttrSet().GetItemState( RES_HEADER, false, &pItem ); pNewItem = pItem->Clone(); - pNewFmt = ((SwFmtHeader*)pNewItem)->GetHeaderFmt(); + pNewFmt = static_cast<SwFmtHeader*>(pNewItem)->GetHeaderFmt(); #if OSL_DEBUG_LEVEL > 1 const SwFmtCntnt& rSourceCntnt1 = rSourceLeftHead.GetHeaderFmt()->GetCntnt(); (void)rSourceCntnt1; @@ -241,7 +241,7 @@ void SwUndoPageDesc::ExchangeContentNodes( SwPageDesc& rSource, SwPageDesc &rDes delete pNewItem; rSource.GetLeft().GetAttrSet().GetItemState( RES_HEADER, false, &pItem ); pNewItem = pItem->Clone(); - pNewFmt = ((SwFmtHeader*)pNewItem)->GetHeaderFmt(); + pNewFmt = static_cast<SwFmtHeader*>(pNewItem)->GetHeaderFmt(); pNewFmt->SetFmtAttr( SwFmtCntnt() ); delete pNewItem; } @@ -251,7 +251,7 @@ void SwUndoPageDesc::ExchangeContentNodes( SwPageDesc& rSource, SwPageDesc &rDes const SwFmtHeader& rSourceFirstMasterHead = rSource.GetFirstMaster().GetHeader(); rDest.GetFirstMaster().GetAttrSet().GetItemState( RES_HEADER, false, &pItem ); pNewItem = pItem->Clone(); - pNewFmt = ((SwFmtHeader*)pNewItem)->GetHeaderFmt(); + pNewFmt = static_cast<SwFmtHeader*>(pNewItem)->GetHeaderFmt(); #if OSL_DEBUG_LEVEL > 1 const SwFmtCntnt& rSourceCntnt1 = rSourceFirstMasterHead.GetHeaderFmt()->GetCntnt(); (void)rSourceCntnt1; @@ -262,7 +262,7 @@ void SwUndoPageDesc::ExchangeContentNodes( SwPageDesc& rSource, SwPageDesc &rDes delete pNewItem; rSource.GetFirstMaster().GetAttrSet().GetItemState( RES_HEADER, false, &pItem ); pNewItem = pItem->Clone(); - pNewFmt = ((SwFmtHeader*)pNewItem)->GetHeaderFmt(); + pNewFmt = static_cast<SwFmtHeader*>(pNewItem)->GetHeaderFmt(); pNewFmt->SetFmtAttr( SwFmtCntnt() ); delete pNewItem; } @@ -275,7 +275,7 @@ void SwUndoPageDesc::ExchangeContentNodes( SwPageDesc& rSource, SwPageDesc &rDes const SfxPoolItem* pItem; rDest.GetMaster().GetAttrSet().GetItemState( RES_FOOTER, false, &pItem ); SfxPoolItem *pNewItem = pItem->Clone(); - SwFrmFmt *pNewFmt = ((SwFmtFooter*)pNewItem)->GetFooterFmt(); + SwFrmFmt *pNewFmt = static_cast<SwFmtFooter*>(pNewItem)->GetFooterFmt(); pNewFmt->SetFmtAttr( rSourceFoot.GetFooterFmt()->GetCntnt() ); delete pNewItem; @@ -287,7 +287,7 @@ void SwUndoPageDesc::ExchangeContentNodes( SwPageDesc& rSource, SwPageDesc &rDes #endif rSource.GetMaster().GetAttrSet().GetItemState( RES_FOOTER, false, &pItem ); pNewItem = pItem->Clone(); - pNewFmt = ((SwFmtFooter*)pNewItem)->GetFooterFmt(); + pNewFmt = static_cast<SwFmtFooter*>(pNewItem)->GetFooterFmt(); pNewFmt->SetFmtAttr( SwFmtCntnt() ); delete pNewItem; @@ -303,12 +303,12 @@ void SwUndoPageDesc::ExchangeContentNodes( SwPageDesc& rSource, SwPageDesc &rDes #endif rDest.GetLeft().GetAttrSet().GetItemState( RES_FOOTER, false, &pItem ); pNewItem = pItem->Clone(); - pNewFmt = ((SwFmtFooter*)pNewItem)->GetFooterFmt(); + pNewFmt = static_cast<SwFmtFooter*>(pNewItem)->GetFooterFmt(); pNewFmt->SetFmtAttr( rSourceLeftFoot.GetFooterFmt()->GetCntnt() ); delete pNewItem; rSource.GetLeft().GetAttrSet().GetItemState( RES_FOOTER, false, &pItem ); pNewItem = pItem->Clone(); - pNewFmt = ((SwFmtFooter*)pNewItem)->GetFooterFmt(); + pNewFmt = static_cast<SwFmtFooter*>(pNewItem)->GetFooterFmt(); pNewFmt->SetFmtAttr( SwFmtCntnt() ); delete pNewItem; } @@ -324,12 +324,12 @@ void SwUndoPageDesc::ExchangeContentNodes( SwPageDesc& rSource, SwPageDesc &rDes #endif rDest.GetFirstMaster().GetAttrSet().GetItemState( RES_FOOTER, false, &pItem ); pNewItem = pItem->Clone(); - pNewFmt = ((SwFmtFooter*)pNewItem)->GetFooterFmt(); + pNewFmt = static_cast<SwFmtFooter*>(pNewItem)->GetFooterFmt(); pNewFmt->SetFmtAttr( rSourceFirstMasterFoot.GetFooterFmt()->GetCntnt() ); delete pNewItem; rSource.GetFirstMaster().GetAttrSet().GetItemState( RES_FOOTER, false, &pItem ); pNewItem = pItem->Clone(); - pNewFmt = ((SwFmtFooter*)pNewItem)->GetFooterFmt(); + pNewFmt = static_cast<SwFmtFooter*>(pNewItem)->GetFooterFmt(); pNewFmt->SetFmtAttr( SwFmtCntnt() ); delete pNewItem; } diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx index b486ad82b7ac..4cac9fc0dff5 100644 --- a/sw/source/core/undo/undel.cxx +++ b/sw/source/core/undo/undel.cxx @@ -933,9 +933,9 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext) SwNode* pNode = pDoc->GetNodes()[ nEndNode + 1 ]; if( pNode->IsCntntNode() ) - ((SwCntntNode*)pNode)->ResetAttr( nStt, nEnd ); + static_cast<SwCntntNode*>(pNode)->ResetAttr( nStt, nEnd ); else if( pNode->IsTableNode() ) - ((SwTableNode*)pNode)->GetTable().GetFrmFmt()->ResetFmtAttr( nStt, nEnd ); + static_cast<SwTableNode*>(pNode)->GetTable().GetFrmFmt()->ResetFmtAttr( nStt, nEnd ); } } // delete the temporarily added Node diff --git a/sw/source/core/undo/undobj1.cxx b/sw/source/core/undo/undobj1.cxx index 4321e99fe592..e3eaed054ee2 100644 --- a/sw/source/core/undo/undobj1.cxx +++ b/sw/source/core/undo/undobj1.cxx @@ -168,7 +168,7 @@ void SwUndoFlyBase::DelFly( SwDoc* pDoc ) OSL_ENSURE( rCntnt.GetCntntIdx(), "Fly ohne Inhalt" ); SaveSection( pDoc, *rCntnt.GetCntntIdx() ); - ((SwFmtCntnt&)rCntnt).SetNewCntntIdx( (const SwNodeIndex*)0 ); + const_cast<SwFmtCntnt&>(rCntnt).SetNewCntntIdx( (const SwNodeIndex*)0 ); } // OD 02.07.2003 #108784# - remove 'master' drawing object from drawing page else if ( RES_DRAWFRMFMT == pFrmFmt->Which() ) @@ -197,7 +197,7 @@ void SwUndoFlyBase::DelFly( SwDoc* pDoc ) if( pAttr && pAttr->GetFlyCnt().GetFrmFmt() == pFrmFmt ) { // Pointer to 0, do not delete - ((SwFmtFlyCnt&)pAttr->GetFlyCnt()).SetFlyFmt(); + const_cast<SwFmtFlyCnt&>(pAttr->GetFlyCnt()).SetFlyFmt(); SwIndex aIdx( pPos->nContent ); pTxtNd->EraseText( aIdx, 1 ); } @@ -495,7 +495,7 @@ void SwUndoSetFlyFmt::GetAnchor( SwFmtAnchor& rAnchor, if( FLY_AT_FLY == nAnchorTyp ? ( !pNd->IsStartNode() || SwFlyStartNode != - ((SwStartNode*)pNd)->GetStartNodeType() ) + static_cast<SwStartNode*>(pNd)->GetStartNodeType() ) : !pNd->IsTxtNode() ) { pNd = 0; // invalid position @@ -689,7 +689,7 @@ void SwUndoSetFlyFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* ) PutAttr( nWhich, pOld ); else if( RES_ATTRSET_CHG == nWhich ) { - SfxItemIter aIter( *((SwAttrSetChg*)pOld)->GetChgSet() ); + SfxItemIter aIter( *static_cast<const SwAttrSetChg*>(pOld)->GetChgSet() ); const SfxPoolItem* pItem = aIter.GetCurItem(); while( pItem ) { diff --git a/sw/source/core/undo/undraw.cxx b/sw/source/core/undo/undraw.cxx index 570c4606a860..6accc6aeb8b0 100644 --- a/sw/source/core/undo/undraw.cxx +++ b/sw/source/core/undo/undraw.cxx @@ -138,7 +138,7 @@ static void lcl_SaveAnchor( SwFrmFmt* pFmt, sal_uLong& rNodePos ) if( pAttr && pAttr->GetFlyCnt().GetFrmFmt() == pFmt ) { // just set pointer to 0, don't delete - ((SwFmtFlyCnt&)pAttr->GetFlyCnt()).SetFlyFmt(); + const_cast<SwFmtFlyCnt&>(pAttr->GetFlyCnt()).SetFlyFmt(); SwIndex aIdx( pTxtNd, nCntntPos ); pTxtNd->EraseText( aIdx, 1 ); } diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx index c1bccf55fab9..d07fdca060ac 100644 --- a/sw/source/core/undo/unins.cxx +++ b/sw/source/core/undo/unins.cxx @@ -430,7 +430,7 @@ void SwUndoInsert::RepeatImpl(::sw::RepeatContext & rContext) { // StarView does not yet provide an option to copy a StarOBJ SvStorageRef aRef = new SvStorage( OUString() ); - SwOLEObj& rSwOLE = (SwOLEObj&)((SwOLENode*)pCNd)->GetOLEObj(); + SwOLEObj& rSwOLE = (SwOLEObj&)static_cast<SwOLENode*>(pCNd)->GetOLEObj(); // temporary storage until object is inserted // TODO/MBA: seems that here a physical copy is done - not as in drawing layer! Testing! diff --git a/sw/source/core/undo/unmove.cxx b/sw/source/core/undo/unmove.cxx index 536acd94b120..898c97de3b4a 100644 --- a/sw/source/core/undo/unmove.cxx +++ b/sw/source/core/undo/unmove.cxx @@ -220,8 +220,8 @@ void SwUndoMove::UndoImpl(::sw::UndoRedoContext & rContext) if( pCNd->HasSwAttrSet() ) pCNd->ResetAllAttr(); - if( pCNd->IsTxtNode() && ((SwTxtNode*)pCNd)->GetpSwpHints() ) - ((SwTxtNode*)pCNd)->ClearSwpHintsArr( false ); + if( pCNd->IsTxtNode() && static_cast<SwTxtNode*>(pCNd)->GetpSwpHints() ) + static_cast<SwTxtNode*>(pCNd)->ClearSwpHintsArr( false ); // first delete all attributes at InsertPos const bool bSuccess = pDoc->getIDocumentContentOperations().MoveRange( aPam, aPos, (bMoveRedlines) diff --git a/sw/source/core/undo/unredln.cxx b/sw/source/core/undo/unredln.cxx index 621454ea01dc..95548c7e77ed 100644 --- a/sw/source/core/undo/unredln.cxx +++ b/sw/source/core/undo/unredln.cxx @@ -464,7 +464,7 @@ void SwUndoCompDoc::RedoImpl(::sw::UndoRedoContext & rContext) if( pRedlData && IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() )) { SwRangeRedline* pTmp = new SwRangeRedline( *pRedlData, *pPam ); - ((SwRedlineTbl&)pDoc->getIDocumentRedlineAccess().GetRedlineTbl()).Insert( pTmp ); + static_cast<SwRedlineTbl&>(pDoc->getIDocumentRedlineAccess().GetRedlineTbl()).Insert( pTmp ); pTmp->InvalidateRange(); } else if( !( nsRedlineMode_t::REDLINE_IGNORE & GetRedlineMode() ) && @@ -484,7 +484,7 @@ void SwUndoCompDoc::RedoImpl(::sw::UndoRedoContext & rContext) SetPaM( *pPam ); SwRangeRedline* pTmp = new SwRangeRedline( *pRedlData, *pPam ); - ((SwRedlineTbl&)pDoc->getIDocumentRedlineAccess().GetRedlineTbl()).Insert( pTmp ); + static_cast<SwRedlineTbl&>(pDoc->getIDocumentRedlineAccess().GetRedlineTbl()).Insert( pTmp ); pTmp->InvalidateRange(); } diff --git a/sw/source/core/undo/unsect.cxx b/sw/source/core/undo/unsect.cxx index aa7e71d1f934..b00e5aaf91fa 100644 --- a/sw/source/core/undo/unsect.cxx +++ b/sw/source/core/undo/unsect.cxx @@ -208,7 +208,7 @@ void SwUndoInsSection::RedoImpl(::sw::UndoRedoContext & rContext) pESh->CalcLayout(); // insert page numbers - ((SwTOXBaseSection*)pUpdateTOX)->UpdatePageNum(); + const_cast<SwTOXBaseSection*>(pUpdateTOX)->UpdatePageNum(); } } diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx index ab0637c8a2cb..eb8a2b2f97b3 100644 --- a/sw/source/core/undo/untblk.cxx +++ b/sw/source/core/undo/untblk.cxx @@ -250,7 +250,7 @@ void SwUndoInserts::RedoImpl(::sw::UndoRedoContext & rContext) SwTxtFmtColl* pSavTxtFmtColl = pTxtFmtColl; if( pTxtFmtColl && pCNd && pCNd->IsTxtNode() ) - pSavTxtFmtColl = ((SwTxtNode*)pCNd)->GetTxtColl(); + pSavTxtFmtColl = static_cast<SwTxtNode*>(pCNd)->GetTxtColl(); pHistory->SetTmpEnd( nSetPos ); diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index a16b4bd8fd1a..e9ecf7590a1c 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -541,7 +541,7 @@ bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry { const SwTableNode* pTblNode = pSttNode->FindTableNode(); SwFrmFmt* pTableFmt = (SwFrmFmt*)pTblNode->GetTable().GetFrmFmt(); - //SwTable& rTable = ((SwTableNode*)pSttNode)->GetTable(); + //SwTable& rTable = static_cast<SwTableNode*>(pSttNode)->GetTable(); if(FN_UNO_TEXT_TABLE == rEntry.nWID) { uno::Reference< XTextTable > xTable = SwXTextTables::GetObject(*pTableFmt); @@ -807,7 +807,7 @@ void setNumberingProperty(const Any& rValue, SwPaM& rPam) // shall it really be created? if(!pBase) pBase = &pPool->Make(pNewCharStyles[i], SFX_STYLE_FAMILY_PAGE); - pCharFmt = ((SwDocStyleSheet*)pBase)->GetCharFmt(); + pCharFmt = static_cast<SwDocStyleSheet*>(pBase)->GetCharFmt(); } if(pCharFmt) aFmt.SetCharFmt(pCharFmt); diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index b4e0b0bbb68f..aca3920b78aa 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -528,7 +528,7 @@ sal_Int32 SwXDrawPage::getCount(void) throw( uno::RuntimeException, std::excepti return 0; else { - ((SwXDrawPage*)this)->GetSvxPage(); + static_cast<SwXDrawPage*>(this)->GetSvxPage(); std::set<const SwFrmFmt*> aTextBoxes = SwTextBoxHelper::findTextBoxes(pDoc); @@ -555,7 +555,7 @@ uno::Any SwXDrawPage::getByIndex(sal_Int32 nIndex, std::set<const SwFrmFmt*>* pT if(!pDoc->getIDocumentDrawModelAccess().GetDrawModel()) throw lang::IndexOutOfBoundsException(); - ((SwXDrawPage*)this)->GetSvxPage(); + static_cast<SwXDrawPage*>(this)->GetSvxPage(); std::set<const SwFrmFmt*> aTextBoxes; if (!pTextBoxes) { @@ -582,7 +582,7 @@ sal_Bool SwXDrawPage::hasElements(void) throw( uno::RuntimeException, std::excep if(!pDoc->getIDocumentDrawModelAccess().GetDrawModel()) return sal_False; else - return ((SwXDrawPage*)this)->GetSvxPage()->hasElements(); + return static_cast<SwXDrawPage*>(this)->GetSvxPage()->hasElements(); } void SwXDrawPage::add(const uno::Reference< drawing::XShape > & xShape) @@ -1449,7 +1449,7 @@ void SwXShape::setPropertyValue(const OUString& rPropertyName, const uno::Any& a break; } if(pItem) - ((SfxPoolItem*)pItem)->PutValue(aValue, pEntry->nMemberId); + static_cast<SfxPoolItem*>(pItem)->PutValue(aValue, pEntry->nMemberId); } } else diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx index efc0ead33edc..0b6dff338ff0 100644 --- a/sw/source/core/unocore/unoidx.cxx +++ b/sw/source/core/unocore/unoidx.cxx @@ -134,7 +134,7 @@ lcl_ReAssignTOXType(SwDoc* pDoc, SwTOXBase& rTOXBase, const OUString& rNewName) pNewType = pDoc->InsertTOXType( aNewType ); } - rTOXBase.RegisterToTOXType( *((SwTOXType*)pNewType) ); + rTOXBase.RegisterToTOXType( *const_cast<SwTOXType*>(pNewType) ); } static const char cUserDefined[] = "User-Defined"; diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx index 3acacd739615..10f1b3c1c4d1 100644 --- a/sw/source/core/unocore/unoparagraph.cxx +++ b/sw/source/core/unocore/unoparagraph.cxx @@ -650,7 +650,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception) SwTxtNode & rTxtNode(m_pImpl->GetTxtNodeOrThrow()); //SwNode& rTxtNode = pUnoCrsr->GetPoint()->nNode.GetNode(); - //const SwAttrSet& rAttrSet = ((SwTxtNode&)rTxtNode).GetSwAttrSet(); + //const SwAttrSet& rAttrSet = static_cast<SwTxtNode&>(rTxtNode).GetSwAttrSet(); //sal_uInt16 nAttrCount = rAttrSet.Count(); const sal_Int32 nProps = rPropertyNames.getLength(); diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx index aca2c381df25..78bc9433bb9d 100644 --- a/sw/source/core/unocore/unosett.cxx +++ b/sw/source/core/unocore/unosett.cxx @@ -1247,7 +1247,7 @@ void SwXNumberingRules::replaceByIndex(sal_Int32 nIndex, const uno::Any& rElemen SFX_STYLE_FAMILY_CHAR); if(!pBase) pBase = &pDocShell->GetStyleSheetPool()->Make(m_sNewCharStyleNames[i], SFX_STYLE_FAMILY_CHAR); - pCharFmt = ((SwDocStyleSheet*)pBase)->GetCharFmt(); + pCharFmt = static_cast<SwDocStyleSheet*>(pBase)->GetCharFmt(); } aFmt.SetCharFmt( pCharFmt ); @@ -1782,10 +1782,10 @@ void SwXNumberingRules::SetPropertiesToNumFmt( SfxStyleSheetBase* pBase; SfxStyleSheetBasePool* pPool = pLocalDoc->GetDocShell()->GetStyleSheetPool(); - pBase = ((SfxStyleSheetBasePool*)pPool)->Find(sCharFmtName, SFX_STYLE_FAMILY_CHAR); + pBase = static_cast<SfxStyleSheetBasePool*>(pPool)->Find(sCharFmtName, SFX_STYLE_FAMILY_CHAR); if(!pBase) pBase = &pPool->Make(sCharFmtName, SFX_STYLE_FAMILY_CHAR); - pCharFmt = ((SwDocStyleSheet*)pBase)->GetCharFmt(); + pCharFmt = static_cast<SwDocStyleSheet*>(pBase)->GetCharFmt(); } } aFmt.SetCharFmt( pCharFmt ); diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 4dbb903ff57b..a48d9ad851e3 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -258,7 +258,7 @@ uno::Any SwXStyleFamilies::getByIndex(sal_Int32 nIndex) { if(!pxCharStyles) { - ((SwXStyleFamilies*)this)->pxCharStyles = new uno::Reference< container::XNameContainer > (); + static_cast<SwXStyleFamilies*>(this)->pxCharStyles = new uno::Reference< container::XNameContainer > (); *pxCharStyles = new SwXStyleFamily(pDocShell, nType); } aRef = *pxCharStyles; @@ -268,7 +268,7 @@ uno::Any SwXStyleFamilies::getByIndex(sal_Int32 nIndex) { if(!pxParaStyles) { - ((SwXStyleFamilies*)this)->pxParaStyles = new uno::Reference< container::XNameContainer > (); + static_cast<SwXStyleFamilies*>(this)->pxParaStyles = new uno::Reference< container::XNameContainer > (); *pxParaStyles = new SwXStyleFamily(pDocShell, nType); } aRef = *pxParaStyles; @@ -278,7 +278,7 @@ uno::Any SwXStyleFamilies::getByIndex(sal_Int32 nIndex) { if(!pxPageStyles) { - ((SwXStyleFamilies*)this)->pxPageStyles = new uno::Reference< container::XNameContainer > (); + static_cast<SwXStyleFamilies*>(this)->pxPageStyles = new uno::Reference< container::XNameContainer > (); *pxPageStyles = new SwXStyleFamily(pDocShell, nType); } aRef = *pxPageStyles; @@ -288,7 +288,7 @@ uno::Any SwXStyleFamilies::getByIndex(sal_Int32 nIndex) { if(!pxFrameStyles) { - ((SwXStyleFamilies*)this)->pxFrameStyles = new uno::Reference< container::XNameContainer > (); + static_cast<SwXStyleFamilies*>(this)->pxFrameStyles = new uno::Reference< container::XNameContainer > (); *pxFrameStyles = new SwXStyleFamily(pDocShell, nType); } aRef = *pxFrameStyles; @@ -298,7 +298,7 @@ uno::Any SwXStyleFamilies::getByIndex(sal_Int32 nIndex) { if(!pxNumberingStyles) { - ((SwXStyleFamilies*)this)->pxNumberingStyles = new uno::Reference< container::XNameContainer > (); + static_cast<SwXStyleFamilies*>(this)->pxNumberingStyles = new uno::Reference< container::XNameContainer > (); *pxNumberingStyles = new SwXStyleFamily(pDocShell, nType); } aRef = *pxNumberingStyles; @@ -1307,7 +1307,7 @@ SwXStyle::SwXStyle(SfxStyleSheetBasePool& rPool, SfxStyleFamily eFam, if(nId != USHRT_MAX) bIsConditional = ::IsConditionalByPoolId( nId ); else - bIsConditional = RES_CONDTXTFMTCOLL == ((SwDocStyleSheet*)pBase)->GetCollection()->Which(); + bIsConditional = RES_CONDTXTFMTCOLL == static_cast<SwDocStyleSheet*>(pBase)->GetCollection()->Which(); } } } @@ -1892,10 +1892,10 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, { SfxStyleSheetBase* pBase; - pBase = ((SfxStyleSheetBasePool*)pBasePool)->Find(pCharStyleNames[i], SFX_STYLE_FAMILY_CHAR); + pBase = static_cast<SfxStyleSheetBasePool*>(pBasePool)->Find(pCharStyleNames[i], SFX_STYLE_FAMILY_CHAR); if(!pBase) pBase = &pBasePool->Make(pCharStyleNames[i], SFX_STYLE_FAMILY_CHAR); - pCharFmt = ((SwDocStyleSheet*)pBase)->GetCharFmt(); + pCharFmt = static_cast<SwDocStyleSheet*>(pBase)->GetCharFmt(); } @@ -1963,7 +1963,7 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, const SfxPoolItem* pItem; if(SfxItemState::SET == rStyleSet.GetItemState( RES_PAGEDESC, true, &pItem ) ) { - pNewDesc = new SwFmtPageDesc(*((SwFmtPageDesc*)pItem)); + pNewDesc = new SwFmtPageDesc(*static_cast<const SwFmtPageDesc*>(pItem)); } if(!pNewDesc) pNewDesc = new SwFmtPageDesc(); @@ -2128,7 +2128,7 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, SwFmtRuby* pRuby = 0; const SfxPoolItem* pItem; if(SfxItemState::SET == rStyleSet.GetItemState( RES_TXTATR_CJK_RUBY, true, &pItem ) ) - pRuby = new SwFmtRuby(*((SwFmtRuby*)pItem)); + pRuby = new SwFmtRuby(*static_cast<const SwFmtRuby*>(pItem)); if(!pRuby) pRuby = new SwFmtRuby(OUString()); OUString sStyle; @@ -2159,7 +2159,7 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, SwFmtDrop* pDrop = 0; const SfxPoolItem* pItem; if(SfxItemState::SET == rStyleSet.GetItemState( RES_PARATR_DROP, true, &pItem ) ) - pDrop = new SwFmtDrop(*((SwFmtDrop*)pItem)); + pDrop = new SwFmtDrop(*static_cast<const SwFmtDrop*>(pItem)); if(!pDrop) pDrop = new SwFmtDrop(); OUString uStyle; @@ -2330,11 +2330,11 @@ static uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, sal_Bool bPhys = pBase != 0; if(pBase) { - bPhys = ((SwDocStyleSheet*)pBase)->IsPhysical(); + bPhys = static_cast<SwDocStyleSheet*>(pBase)->IsPhysical(); // The standard character format is not existing physically if( bPhys && SFX_STYLE_FAMILY_CHAR == eFamily && - ((SwDocStyleSheet*)pBase)->GetCharFmt() && - ((SwDocStyleSheet*)pBase)->GetCharFmt()->IsDefault() ) + static_cast<SwDocStyleSheet*>(pBase)->GetCharFmt() && + static_cast<SwDocStyleSheet*>(pBase)->GetCharFmt()->IsDefault() ) bPhys = sal_False; } aRet.setValue(&bPhys, ::getBooleanCppuType()); @@ -2466,7 +2466,7 @@ static uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, uno::Sequence< beans::NamedValue > aSeq(COND_COMMAND_COUNT); beans::NamedValue *pSeq = aSeq.getArray(); - SwFmt *pFmt = ((SwDocStyleSheet*)pBase)->GetCollection(); + SwFmt *pFmt = static_cast<SwDocStyleSheet*>(pBase)->GetCollection(); const CommandStruct *pCmds = SwCondCollItem::GetCmds(); for (sal_uInt16 n = 0; n < COND_COMMAND_COUNT; ++n) { @@ -2474,7 +2474,7 @@ static uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, const SwCollCondition* pCond = 0; if( pFmt && RES_CONDTXTFMTCOLL == pFmt->Which() && - 0 != ( pCond = ((SwConditionTxtFmtColl*)pFmt)-> + 0 != ( pCond = static_cast<SwConditionTxtFmtColl*>(pFmt)-> HasCondition( SwCollCondition( 0, pCmds[n].nCnd, pCmds[n].nSubCond ) ) ) && pCond->GetTxtFmtColl() ) { @@ -3315,8 +3315,8 @@ void SwXStyle::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) } else if( pHint->GetId() &(SFX_STYLESHEET_CHANGED|SFX_STYLESHEET_ERASED) ) { - ((SfxStyleSheetBasePool&)rBC).SetSearchMask(eFamily); - SfxStyleSheetBase* pOwnBase = ((SfxStyleSheetBasePool&)rBC).Find(m_sStyleName); + static_cast<SfxStyleSheetBasePool&>(rBC).SetSearchMask(eFamily); + SfxStyleSheetBase* pOwnBase = static_cast<SfxStyleSheetBasePool&>(rBC).Find(m_sStyleName); if(!pOwnBase) { EndListening(rBC); diff --git a/sw/source/core/unocore/unotextmarkup.cxx b/sw/source/core/unocore/unotextmarkup.cxx index eeae669bab15..303635bddffc 100644 --- a/sw/source/core/unocore/unotextmarkup.cxx +++ b/sw/source/core/unocore/unotextmarkup.cxx @@ -155,7 +155,7 @@ void SAL_CALL SwXTextMarkup::commitStringMarkup( } bRepaint = pWList == mpTxtNode->GetGrammarCheck(); if( pWList->GetBeginInv() < COMPLETE_STRING ) - ((SwGrammarMarkUp*)pWList)->ClearGrammarList(); + static_cast<SwGrammarMarkUp*>(pWList)->ClearGrammarList(); } else if ( nType == text::TextMarkupType::SMARTTAG ) { @@ -254,7 +254,7 @@ void SAL_CALL SwXTextMarkup::commitStringMarkup( if ( bCommit ) { if( nType == text::TextMarkupType::SENTENCE ) - ((SwGrammarMarkUp*)pWList)->setSentence( nStart ); + static_cast<SwGrammarMarkUp*>(pWList)->setSentence( nStart ); else pWList->Insert( rIdentifier, xMarkupInfoContainer, nStart, nLength ); } @@ -350,7 +350,7 @@ static void lcl_commitGrammarMarkUp( if ( bCommit ) { if( nType == text::TextMarkupType::SENTENCE ) - ((SwGrammarMarkUp*)pWList)->setSentence( nStart+nLength ); + static_cast<SwGrammarMarkUp*>(pWList)->setSentence( nStart+nLength ); else pWList->Insert( rIdentifier, xMarkupInfoContainer, nStart, nLength ); } diff --git a/sw/source/core/view/vdraw.cxx b/sw/source/core/view/vdraw.cxx index aa3e013ac2a1..f59a8ca9a219 100644 --- a/sw/source/core/view/vdraw.cxx +++ b/sw/source/core/view/vdraw.cxx @@ -49,7 +49,7 @@ void SwViewImp::StartAction() { SET_CURR_SHELL( GetShell() ); if ( pSh->ISA(SwFEShell) ) - ((SwFEShell*)pSh)->HideChainMarker(); // might have changed + static_cast<SwFEShell*>(pSh)->HideChainMarker(); // might have changed } } @@ -59,7 +59,7 @@ void SwViewImp::EndAction() { SET_CURR_SHELL( GetShell() ); if ( pSh->ISA(SwFEShell) ) - ((SwFEShell*)pSh)->SetChainMarker(); // might have changed + static_cast<SwFEShell*>(pSh)->SetChainMarker(); // might have changed } } @@ -220,7 +220,7 @@ void SwViewImp::NotifySizeChg( const Size &rNewSz ) if( !pCont || !pCont->ISA(SwDrawContact) ) continue; - const SwFrm *pAnchor = ((SwDrawContact*)pCont)->GetAnchorFrm(); + const SwFrm *pAnchor = static_cast<const SwDrawContact*>(pCont)->GetAnchorFrm(); if ( !pAnchor || pAnchor->IsInFly() || !pAnchor->IsValid() || !pAnchor->GetUpper() || !pAnchor->FindPageFrm() || (FLY_AS_CHAR == pCont->GetFmt()->GetAnchor().GetAnchorId()) ) diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index d6b22ae88176..bd1b360ecdcf 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -291,7 +291,7 @@ void SwViewShell::ImplEndAction( const bool bIdleEnd ) // right border. Without ShowCrsr the selection disappears. bool bShowCrsr = pRegion && IsA( TYPE(SwCrsrShell) ); if( bShowCrsr ) - ((SwCrsrShell*)this)->HideCrsrs(); + static_cast<SwCrsrShell*>(this)->HideCrsrs(); if ( pRegion ) { @@ -395,7 +395,7 @@ void SwViewShell::ImplEndAction( const bool bIdleEnd ) Imp()->DelRegion(); } if( bShowCrsr ) - ((SwCrsrShell*)this)->ShowCrsrs( true ); + static_cast<SwCrsrShell*>(this)->ShowCrsrs( true ); } else { @@ -605,14 +605,14 @@ void SwViewShell::UpdateFlds(bool bCloseDB) bool bCrsr = ISA(SwCrsrShell); if ( bCrsr ) - ((SwCrsrShell*)this)->StartAction(); + static_cast<SwCrsrShell*>(this)->StartAction(); else StartAction(); GetDoc()->getIDocumentFieldsAccess().UpdateFlds(0, bCloseDB); if ( bCrsr ) - ((SwCrsrShell*)this)->EndAction(); + static_cast<SwCrsrShell*>(this)->EndAction(); else EndAction(); } @@ -684,12 +684,12 @@ static void lcl_InvalidateAllCntnt( SwViewShell& rSh, sal_uInt8 nInv ) { bool bCrsr = rSh.ISA(SwCrsrShell); if ( bCrsr ) - ((SwCrsrShell&)rSh).StartAction(); + static_cast<SwCrsrShell&>(rSh).StartAction(); else rSh.StartAction(); rSh.GetLayout()->InvalidateAllCntnt( nInv ); if ( bCrsr ) - ((SwCrsrShell&)rSh).EndAction(); + static_cast<SwCrsrShell&>(rSh).EndAction(); else rSh.EndAction(); @@ -968,7 +968,7 @@ void SwViewShell::SizeChgNotify() if ( !Imp()->IsCalcLayoutProgress() && ISA( SwCrsrShell ) ) { - const SwFrm *pCnt = ((SwCrsrShell*)this)->GetCurrFrm( false ); + const SwFrm *pCnt = static_cast<SwCrsrShell*>(this)->GetCurrFrm( false ); const SwPageFrm *pPage; if ( pCnt && 0 != (pPage = pCnt->FindPageFrm()) ) { @@ -2096,7 +2096,7 @@ void SwViewShell::ImplApplyViewOptions( const SwViewOption &rOpt ) if( mpOpt->IsShowHiddenField() != rOpt.IsShowHiddenField() ) { - ((SwHiddenTxtFieldType*)mpDoc->getIDocumentFieldsAccess().GetSysFldType( RES_HIDDENTXTFLD ))-> + static_cast<SwHiddenTxtFieldType*>(mpDoc->getIDocumentFieldsAccess().GetSysFldType( RES_HIDDENTXTFLD ))-> SetHiddenFlag( !rOpt.IsShowHiddenField() ); bReformat = true; } diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx index 870d6e6da412..96c04f0e357d 100644 --- a/sw/source/core/view/vnew.cxx +++ b/sw/source/core/view/vnew.cxx @@ -199,7 +199,7 @@ SwViewShell::SwViewShell( SwDoc& rDocument, vcl::Window *pWindow, SET_CURR_SHELL( this ); - ((SwHiddenTxtFieldType*)mpDoc->getIDocumentFieldsAccess().GetSysFldType( RES_HIDDENTXTFLD ))-> + static_cast<SwHiddenTxtFieldType*>(mpDoc->getIDocumentFieldsAccess().GetSysFldType( RES_HIDDENTXTFLD ))-> SetHiddenFlag( !mpOpt->IsShowHiddenField() ); // In Init a standard FrmFmt is created. @@ -273,7 +273,7 @@ SwViewShell::SwViewShell( SwViewShell& rShell, vcl::Window *pWindow, if ( mbPreview ) mpImp->InitPagePreviewLayout(); - ((SwHiddenTxtFieldType*)mpDoc->getIDocumentFieldsAccess().GetSysFldType( RES_HIDDENTXTFLD ))-> + static_cast<SwHiddenTxtFieldType*>(mpDoc->getIDocumentFieldsAccess().GetSysFldType( RES_HIDDENTXTFLD ))-> SetHiddenFlag( !mpOpt->IsShowHiddenField() ); // In Init a standard FrmFmt is created. @@ -320,7 +320,7 @@ SwViewShell::~SwViewShell() for( SwFrm* pFrm = aIter.First(); pFrm; pFrm = aIter.Next() ) { OSL_ENSURE( pFrm->IsNoTxtFrm(), "GraphicNode with Text?" ); - ((SwNoTxtFrm*)pFrm)->StopAnimation( mpOut ); + static_cast<SwNoTxtFrm*>(pFrm)->StopAnimation( mpOut ); } } } diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 7f2b520d73ce..506028e580ad 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -386,7 +386,7 @@ SwDoc * SwViewShell::FillPrtDoc( SwDoc *pPrtDoc, const SfxPrinter* pPrt) pActCrsr->GetCntntNode( (*pActCrsr->GetMark()) <= (*pActCrsr->GetPoint()) ); // copy the paragraph attributes of the first paragraph if( pLastNd && pLastNd->IsTxtNode() ) - ((SwTxtNode*)pLastNd)->CopyCollFmt( *pTxtNd ); + static_cast<SwTxtNode*>(pLastNd)->CopyCollFmt( *pTxtNd ); } // fill it with the selected content @@ -414,7 +414,7 @@ SwDoc * SwViewShell::FillPrtDoc( SwDoc *pPrtDoc, const SfxPrinter* pPrt) pFirstCrsr->GetCntntNode( (*pFirstCrsr->GetMark()) > (*pFirstCrsr->GetPoint()) ); // copy paragraph attributes of the first paragraph if( pFirstNd && pFirstNd->IsTxtNode() ) - ((SwTxtNode*)pFirstNd)->CopyCollFmt( *pTxtNd ); + static_cast<SwTxtNode*>(pFirstNd)->CopyCollFmt( *pTxtNd ); } } } |