diff options
author | Noel Grandin <noel@peralex.com> | 2014-11-24 10:38:59 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-11-25 10:09:50 +0200 |
commit | 1be3bfed0a76c7e43f0376fb375abcfb5d954eb8 (patch) | |
tree | d4a99322685de0a29ec671cc9670b01441e9fddc /sw | |
parent | a8a8cb216fd2b25a1ed8b9c217685dccacaa428e (diff) |
loplugin: cstylecast
Change-Id: I5f260c59e9db918c4daad938981b874d89106b11
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/access/accdoc.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/access/accnotexthyperlink.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/access/acctable.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/bastyp/calc.cxx | 26 | ||||
-rw-r--r-- | sw/source/core/crsr/crsrsh.cxx | 12 | ||||
-rw-r--r-- | sw/source/core/crsr/findattr.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/crsr/findtxt.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/crsr/viscrs.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/DocumentContentOperationsManager.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/doc/DocumentFieldsManager.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/DocumentTimerManager.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/acmplwrd.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/docdesc.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/docedt.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/docfld.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/doc/docfmt.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/docftn.cxx | 34 | ||||
-rw-r--r-- | sw/source/core/doc/doclay.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/docsort.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/doc/lineinfo.cxx | 4 |
20 files changed, 61 insertions, 61 deletions
diff --git a/sw/source/core/access/accdoc.cxx b/sw/source/core/access/accdoc.cxx index 2fe410ea4983..873034a64173 100644 --- a/sw/source/core/access/accdoc.cxx +++ b/sw/source/core/access/accdoc.cxx @@ -638,7 +638,7 @@ uno::Any SAL_CALL SwAccessibleDocument::getExtendedAttributes() sAttrName = "line-number:"; SwCntntFrm* pCurrFrm = pCrsrShell->GetCurrFrm(); - SwPageFrm* pCurrPage=((SwFrm*)pCurrFrm)->FindPageFrm(); + SwPageFrm* pCurrPage=static_cast<SwFrm*>(pCurrFrm)->FindPageFrm(); sal_uLong nLineNum = 0; SwTxtFrm* pTxtFrm = NULL; SwTxtFrm* pCurrTxtFrm = NULL; @@ -735,7 +735,7 @@ uno::Any SAL_CALL SwAccessibleDocument::getExtendedAttributes() sValue += ";"; - SwFrm* pCurrCol=((SwFrm*)pCurrFrm)->FindColFrm(); + SwFrm* pCurrCol=static_cast<SwFrm*>(pCurrFrm)->FindColFrm(); sAttrName = "column-number:"; sValue += sAttrName; @@ -744,7 +744,7 @@ uno::Any SAL_CALL SwAccessibleDocument::getExtendedAttributes() if(pCurrCol!=NULL) { //SwLayoutFrm* pParent = pCurrCol->GetUpper(); - SwFrm* pCurrPageCol=((SwFrm*)pCurrFrm)->FindColFrm(); + SwFrm* pCurrPageCol=static_cast<SwFrm*>(pCurrFrm)->FindColFrm(); while(pCurrPageCol && pCurrPageCol->GetUpper() && pCurrPageCol->GetUpper()->IsPageFrm()) { pCurrPageCol = pCurrPageCol->GetUpper(); @@ -775,7 +775,7 @@ uno::Any SAL_CALL SwAccessibleDocument::getExtendedAttributes() sValue += ";"; - SwSectionFrm* pCurrSctFrm=((SwFrm*)pCurrFrm)->FindSctFrm(); + SwSectionFrm* pCurrSctFrm=static_cast<SwFrm*>(pCurrFrm)->FindSctFrm(); if(pCurrSctFrm!=NULL && pCurrSctFrm->GetSection()!=NULL ) { sAttrName = "section-name:"; diff --git a/sw/source/core/access/accnotexthyperlink.cxx b/sw/source/core/access/accnotexthyperlink.cxx index 5d59fe4c0a12..0130de969a8b 100644 --- a/sw/source/core/access/accnotexthyperlink.cxx +++ b/sw/source/core/access/accnotexthyperlink.cxx @@ -181,7 +181,7 @@ Any SAL_CALL SwAccessibleNoTextHyperlink::getAccessibleActionAnchor( throw lang::IndexOutOfBoundsException(); Any aRet; - //SwFrm* pAnchor = ((SwFlyFrm*)mpFrm)->GetAnchor(); + //SwFrm* pAnchor = static_cast<SwFlyFrm*>(mpFrm)->GetAnchor(); Reference< XAccessible > xAnchor = xFrame->GetAccessibleMap()->GetContext(mpFrm, true); //SwAccessibleNoTextFrame* pFrame = xFrame.get(); //Reference< XAccessible > xAnchor = (XAccessible*)pFrame; diff --git a/sw/source/core/access/acctable.cxx b/sw/source/core/access/acctable.cxx index b6e30dd8c3a2..2c66fb6adb22 100644 --- a/sw/source/core/access/acctable.cxx +++ b/sw/source/core/access/acctable.cxx @@ -210,7 +210,7 @@ void SwAccessibleTableData_Impl::CollectRowHeaderData( const SwFrm *pFrm ) rLower.IsAccessible( mbIsInPagePreview ) ) { //Added by yanjun. Can't find the "GetRowHeaderFlag" function(Need vefiry). - //if(((SwCellFrm*)pLower)->GetRowHeaderFlag()) + //if(static_cast<SwCellFrm*>(pLower)->GetRowHeaderFlag()) // maColumns.insert( pLower->Frm().Left() - maTabFrmPos.X() ); } else diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx index e5271b344921..8353823d12f1 100644 --- a/sw/source/core/bastyp/calc.cxx +++ b/sw/source/core/bastyp/calc.cxx @@ -150,23 +150,23 @@ extern "C" { static int SAL_CALL OperatorCompare( const void *pFirst, const void *pSecond) { int nRet = 0; - if( CALC_NAME == ((_CalcOp*)pFirst)->eOp ) + if( CALC_NAME == reinterpret_cast<const _CalcOp*>(pFirst)->eOp ) { - if( CALC_NAME == ((_CalcOp*)pSecond)->eOp ) - nRet = ((_CalcOp*)pFirst)->pUName->compareTo( - *((_CalcOp*)pSecond)->pUName ); + if( CALC_NAME == reinterpret_cast<const _CalcOp*>(pSecond)->eOp ) + nRet = reinterpret_cast<const _CalcOp*>(pFirst)->pUName->compareTo( + *reinterpret_cast<const _CalcOp*>(pSecond)->pUName ); else - nRet = ((_CalcOp*)pFirst)->pUName->compareToAscii( - ((_CalcOp*)pSecond)->pName ); + nRet = reinterpret_cast<const _CalcOp*>(pFirst)->pUName->compareToAscii( + reinterpret_cast<const _CalcOp*>(pSecond)->pName ); } else { - if( CALC_NAME == ((_CalcOp*)pSecond)->eOp ) - nRet = -1 * ((_CalcOp*)pSecond)->pUName->compareToAscii( - ((_CalcOp*)pFirst)->pName ); + if( CALC_NAME == reinterpret_cast<const _CalcOp*>(pSecond)->eOp ) + nRet = -1 * reinterpret_cast<const _CalcOp*>(pSecond)->pUName->compareToAscii( + reinterpret_cast<const _CalcOp*>(pFirst)->pName ); else - nRet = strcmp( ((_CalcOp*)pFirst)->pName, - ((_CalcOp*)pSecond)->pName ); + nRet = strcmp( reinterpret_cast<const _CalcOp*>(pFirst)->pName, + reinterpret_cast<const _CalcOp*>(pSecond)->pName ); } return nRet; } @@ -690,7 +690,7 @@ SwCalcOper SwCalc::GetToken() _CalcOp* pFnd = ::FindOperator( sLowerCaseName ); if( pFnd ) { - switch( ( eCurrOper = ((_CalcOp*)pFnd)->eOp ) ) + switch( ( eCurrOper = static_cast<_CalcOp*>(pFnd)->eOp ) ) { case CALC_SUM: case CALC_MEAN: @@ -1041,7 +1041,7 @@ SwCalcOper SwCalc::GetToken() _CalcOp* pFnd = ::FindOperator( aStr ); if( pFnd ) { - switch( ( eCurrOper = ((_CalcOp*)pFnd)->eOp ) ) + switch( ( eCurrOper = static_cast<_CalcOp*>(pFnd)->eOp ) ) { case CALC_SUM : case CALC_MEAN : diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 4c133e47e43b..5f6fd0ebc4f3 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -478,14 +478,14 @@ bool SwCrsrShell::bColumnChange() return false; } - SwFrm* pCurrCol=((SwFrm*)pCurrFrm)->FindColFrm(); + SwFrm* pCurrCol=static_cast<SwFrm*>(pCurrFrm)->FindColFrm(); while(pCurrCol== NULL && pCurrFrm!=NULL ) { SwLayoutFrm* pParent = pCurrFrm->GetUpper(); if(pParent!=NULL) { - pCurrCol=((SwFrm*)pParent)->FindColFrm(); + pCurrCol=static_cast<SwFrm*>(pParent)->FindColFrm(); pCurrFrm = (SwFrm*)pParent; } else @@ -2168,13 +2168,13 @@ SwCntntFrm *SwCrsrShell::GetCurrFrm( const bool bCalcFrm ) const { if ( bCalcFrm ) { - const sal_uInt16* pST = &mnStartAction; - ++(*((sal_uInt16*)pST)); + sal_uInt16* pST = const_cast<sal_uInt16*>(&mnStartAction); + ++(*pST); const Size aOldSz( GetDocSize() ); pRet = pNd->getLayoutFrm( GetLayout(), &m_pCurCrsr->GetPtPos(), m_pCurCrsr->GetPoint() ); - --(*((sal_uInt16*)pST)); + --(*pST); if( aOldSz != GetDocSize() ) - ((SwCrsrShell*)this)->SizeChgNotify(); + const_cast<SwCrsrShell*>(this)->SizeChgNotify(); } else pRet = pNd->getLayoutFrm( GetLayout(), &m_pCurCrsr->GetPtPos(), m_pCurCrsr->GetPoint(), false); diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx index a0439d82b930..f7a316540d93 100644 --- a/sw/source/core/crsr/findattr.cxx +++ b/sw/source/core/crsr/findattr.cxx @@ -1148,7 +1148,7 @@ int SwFindParaAttr::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion, if( bRegExp ) { pPrevRing = pRegion->GetPrev(); - ((Ring*)pRegion)->MoveRingTo( &rCursor ); + const_cast<Ring*>(static_cast<const Ring*>(pRegion))->MoveRingTo( &rCursor ); } boost::scoped_ptr<OUString> pRepl( (bRegExp) ? diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index c7ac1445d427..d9536ec6b8ab 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -579,7 +579,7 @@ int SwFindParaText::Find( SwPaM* pCrsr, SwMoveFn fnMove, if( bRegExp ) { pPrev = pRegion->GetPrev(); - ((Ring*)pRegion)->MoveRingTo( &rCursor ); + const_cast<Ring*>(static_cast<const Ring*>(pRegion))->MoveRingTo( &rCursor ); } boost::scoped_ptr<OUString> pRepl( (bRegExp) diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index 4c2854aefd47..b305c1988c34 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -621,7 +621,7 @@ short SwShellCrsr::MaxReplaceArived() void SwShellCrsr::SaveTblBoxCntnt( const SwPosition* pPos ) { - ((SwCrsrShell*)GetShell())->SaveTblBoxCntnt( pPos ); + const_cast<SwCrsrShell*>(GetShell())->SaveTblBoxCntnt( pPos ); } bool SwShellCrsr::UpDown( bool bUp, sal_uInt16 nCnt ) diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index c73da6a98fc6..55592156c6c9 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -2850,8 +2850,8 @@ bool DocumentContentOperationsManager::SplitNode( const SwPosition &rPos, bool b m_rDoc.getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_TEXT )); if( pTxtNd ) { - ((SwPosition&)rPos).nNode = pTblNd->GetIndex()-1; - ((SwPosition&)rPos).nContent.Assign( pTxtNd, 0 ); + const_cast<SwPosition&>(rPos).nNode = pTblNd->GetIndex()-1; + const_cast<SwPosition&>(rPos).nContent.Assign( pTxtNd, 0 ); // only add page breaks/styles to the body area if( nPrevPos > m_rDoc.GetNodes().GetEndOfExtras().GetIndex() ) @@ -3130,7 +3130,7 @@ void DocumentContentOperationsManager::CopyWithFlyInFly( if ( !bMergedFirstNode ) ++aSavePos; if ( bEndIsEqualEndPos ) - ((SwNodeIndex&)rRg.aEnd) = aSavePos; + const_cast<SwNodeIndex&>(rRg.aEnd) = aSavePos; aRedlRest.Restore(); #if OSL_DEBUG_LEVEL > 0 diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx index 10bee35638ec..abfc556969db 100644 --- a/sw/source/core/doc/DocumentFieldsManager.cxx +++ b/sw/source/core/doc/DocumentFieldsManager.cxx @@ -427,7 +427,7 @@ void DocumentFieldsManager::InsDeletedFldType( SwFieldType& rFldTyp ) if( i >= nSize ) // not found { - ((OUString&)rFldNm) = sSrch; + const_cast<OUString&>(rFldNm) = sSrch; break; // exit while loop } ++nNum; diff --git a/sw/source/core/doc/DocumentTimerManager.cxx b/sw/source/core/doc/DocumentTimerManager.cxx index c9f6c16e52f1..0c8bff2dcfb9 100644 --- a/sw/source/core/doc/DocumentTimerManager.cxx +++ b/sw/source/core/doc/DocumentTimerManager.cxx @@ -163,7 +163,7 @@ IMPL_LINK( DocumentTimerManager, DoIdleJobs, Timer *, pTimer ) } #ifdef TIMELOG if( pModLogFile && 1 != (long)pModLogFile ) - delete pModLogFile, ((long&)pModLogFile) = 1; + delete pModLogFile, static_cast<long&>(pModLogFile) = 1; #endif return 0; } diff --git a/sw/source/core/doc/acmplwrd.cxx b/sw/source/core/doc/acmplwrd.cxx index 747d3a60cb84..8a4749e86857 100644 --- a/sw/source/core/doc/acmplwrd.cxx +++ b/sw/source/core/doc/acmplwrd.cxx @@ -133,7 +133,7 @@ SwAutoCompleteClient& SwAutoCompleteClient::operator=(const SwAutoCompleteClient pAutoCompleteWord = rClient.pAutoCompleteWord; pDoc = rClient.pDoc; if(rClient.GetRegisteredIn()) - ((SwModify*)rClient.GetRegisteredIn())->Add(this); + const_cast<SwModify*>(rClient.GetRegisteredIn())->Add(this); else if(GetRegisteredIn()) GetRegisteredInNonConst()->Remove(this); return *this; diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx index 4f5cdce5efb5..a6a2a4a475e2 100644 --- a/sw/source/core/doc/docdesc.cxx +++ b/sw/source/core/doc/docdesc.cxx @@ -381,7 +381,7 @@ void SwDoc::ChgPageDesc( sal_uInt16 i, const SwPageDesc &rChged ) // Mirror at first if needed. if ( rChged.GetUseOn() == nsUseOnPage::PD_MIRROR ) - ((SwPageDesc&)rChged).Mirror(); + const_cast<SwPageDesc&>(rChged).Mirror(); else { // Or else transfer values from Master to Left diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index e4119357bb16..5fe5b38e6e70 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -581,7 +581,7 @@ uno::Any SwDoc::Spell( SwPaM& rPaM, uno::Reference< linguistic2::XProofreadingIterator > xGCIterator( GetGCIterator() ); if (xGCIterator.is()) { - uno::Reference< lang::XComponent > xDoc( ((SwDocShell*)GetDocShell())->GetBaseModel(), uno::UNO_QUERY ); + uno::Reference< lang::XComponent > xDoc( const_cast<SwDocShell*>(GetDocShell())->GetBaseModel(), uno::UNO_QUERY ); // Expand the string: const ModelToViewHelper aConversionMap(*pNd->GetTxtNode()); OUString aExpandText = aConversionMap.getViewText(); diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx index 6bf1a6a2936b..04a6d5e7f34b 100644 --- a/sw/source/core/doc/docfld.cxx +++ b/sw/source/core/doc/docfld.cxx @@ -941,7 +941,7 @@ void SwDocUpdtFld::_MakeFldList( SwDoc& rDoc, int eGetMode ) sFormula.clear(); // trigger formatting - ((SwFmtFld*)pFmtFld)->ModifyNotification( 0, 0 ); + const_cast<SwFmtFld*>(pFmtFld)->ModifyNotification( 0, 0 ); } break; @@ -961,7 +961,7 @@ void SwDocUpdtFld::_MakeFldList( SwDoc& rDoc, int eGetMode ) // evaluate field const_cast<SwHiddenTxtField*>(static_cast<const SwHiddenTxtField*>(pFld))->Evaluate(&rDoc); // trigger formatting - ((SwFmtFld*)pFmtFld)->ModifyNotification( 0, 0 ); + const_cast<SwFmtFld*>(pFmtFld)->ModifyNotification( 0, 0 ); } break; diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 3d9cbff0f3bc..0c7966e6bd69 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -1731,7 +1731,7 @@ SwTblNumFmtMerge::SwTblNumFmtMerge( const SwDoc& rSrc, SwDoc& rDest ) { // a different Doc -> Number formatter needs to be merged SvNumberFormatter* pN; - if( &rSrc != &rDest && 0 != ( pN = ((SwDoc&)rSrc).GetNumberFormatter( false ) )) + if( &rSrc != &rDest && 0 != ( pN = const_cast<SwDoc&>(rSrc).GetNumberFormatter( false ) )) ( pNFmt = rDest.GetNumberFormatter( true ))->MergeFormatter( *pN ); if( &rSrc != &rDest ) diff --git a/sw/source/core/doc/docftn.cxx b/sw/source/core/doc/docftn.cxx index 5842e589cc1d..e440e0aa8b40 100644 --- a/sw/source/core/doc/docftn.cxx +++ b/sw/source/core/doc/docftn.cxx @@ -45,20 +45,20 @@ SwEndNoteInfo& SwEndNoteInfo::operator=(const SwEndNoteInfo& rInfo) GetRegisteredInNonConst()->Remove(this); if ( rInfo.aPageDescDep.GetRegisteredIn() ) - ((SwModify*)rInfo.aPageDescDep.GetRegisteredIn())->Add( &aPageDescDep ); + const_cast<SwModify*>(rInfo.aPageDescDep.GetRegisteredIn())->Add( &aPageDescDep ); else if ( aPageDescDep.GetRegisteredIn() ) - ((SwModify*)aPageDescDep.GetRegisteredIn())->Remove( &aPageDescDep ); + const_cast<SwModify*>(aPageDescDep.GetRegisteredIn())->Remove( &aPageDescDep ); if ( rInfo.aCharFmtDep.GetRegisteredIn() ) - ((SwModify*)rInfo.aCharFmtDep.GetRegisteredIn())->Add( &aCharFmtDep ); + const_cast<SwModify*>(rInfo.aCharFmtDep.GetRegisteredIn())->Add( &aCharFmtDep ); else if ( aCharFmtDep.GetRegisteredIn() ) - ((SwModify*)aCharFmtDep.GetRegisteredIn())->Remove( &aCharFmtDep ); + const_cast<SwModify*>(aCharFmtDep.GetRegisteredIn())->Remove( &aCharFmtDep ); if ( rInfo.aAnchorCharFmtDep.GetRegisteredIn() ) - ((SwModify*)rInfo.aAnchorCharFmtDep.GetRegisteredIn())->Add( + const_cast<SwModify*>(rInfo.aAnchorCharFmtDep.GetRegisteredIn())->Add( &aAnchorCharFmtDep ); else if( aAnchorCharFmtDep.GetRegisteredIn() ) - ((SwModify*)aAnchorCharFmtDep.GetRegisteredIn())->Remove( + static_cast<SwModify*>(aAnchorCharFmtDep.GetRegisteredIn())->Remove( &aAnchorCharFmtDep ); aFmt = rInfo.aFmt; @@ -97,13 +97,13 @@ SwEndNoteInfo::SwEndNoteInfo(const SwEndNoteInfo& rInfo) : nFtnOffset( rInfo.nFtnOffset ) { if( rInfo.aPageDescDep.GetRegisteredIn() ) - ((SwModify*)rInfo.aPageDescDep.GetRegisteredIn())->Add( &aPageDescDep ); + const_cast<SwModify*>(rInfo.aPageDescDep.GetRegisteredIn())->Add( &aPageDescDep ); if( rInfo.aCharFmtDep.GetRegisteredIn() ) - ((SwModify*)rInfo.aCharFmtDep.GetRegisteredIn())->Add( &aCharFmtDep ); + const_cast<SwModify*>(rInfo.aCharFmtDep.GetRegisteredIn())->Add( &aCharFmtDep ); if( rInfo.aAnchorCharFmtDep.GetRegisteredIn() ) - ((SwModify*)rInfo.aAnchorCharFmtDep.GetRegisteredIn())->Add( + const_cast<SwModify*>(rInfo.aAnchorCharFmtDep.GetRegisteredIn())->Add( &aAnchorCharFmtDep ); } @@ -124,7 +124,7 @@ SwPageDesc *SwEndNoteInfo::GetPageDesc( SwDoc &rDoc ) const { SwPageDesc *pDesc = rDoc.getIDocumentStylePoolAccess().GetPageDescFromPool( static_cast<sal_uInt16>( m_bEndNote ? RES_POOLPAGE_ENDNOTE : RES_POOLPAGE_FOOTNOTE ) ); - pDesc->Add( &((SwClient&)aPageDescDep) ); + pDesc->Add( &const_cast<SwClient&>(static_cast<const SwClient&>(aPageDescDep)) ); } return const_cast<SwPageDesc*>(static_cast<const SwPageDesc*>( aPageDescDep.GetRegisteredIn() )); @@ -142,7 +142,7 @@ bool SwEndNoteInfo::DependsOn( const SwPageDesc* pDesc ) const void SwEndNoteInfo::ChgPageDesc( SwPageDesc *pDesc ) { - pDesc->Add( &((SwClient&)aPageDescDep) ); + pDesc->Add( &static_cast<SwClient&>(aPageDescDep) ); } void SwEndNoteInfo::SetFtnTxtColl(SwTxtFmtColl& rFmt) @@ -156,7 +156,7 @@ SwCharFmt* SwEndNoteInfo::GetCharFmt(SwDoc &rDoc) const { SwCharFmt* pFmt = rDoc.getIDocumentStylePoolAccess().GetCharFmtFromPool( static_cast<sal_uInt16>( m_bEndNote ? RES_POOLCHR_ENDNOTE : RES_POOLCHR_FOOTNOTE ) ); - pFmt->Add( &((SwClient&)aCharFmtDep) ); + pFmt->Add( &const_cast<SwClient&>(static_cast<const SwClient&>(aCharFmtDep)) ); } return const_cast<SwCharFmt*>(static_cast<const SwCharFmt*>(aCharFmtDep.GetRegisteredIn())); } @@ -164,7 +164,7 @@ SwCharFmt* SwEndNoteInfo::GetCharFmt(SwDoc &rDoc) const void SwEndNoteInfo::SetCharFmt( SwCharFmt* pChFmt ) { OSL_ENSURE(pChFmt, "no CharFmt?"); - pChFmt->Add( &((SwClient&)aCharFmtDep) ); + pChFmt->Add( &static_cast<SwClient&>(aCharFmtDep) ); } SwCharFmt* SwEndNoteInfo::GetAnchorCharFmt(SwDoc &rDoc) const @@ -173,7 +173,7 @@ SwCharFmt* SwEndNoteInfo::GetAnchorCharFmt(SwDoc &rDoc) const { SwCharFmt* pFmt = rDoc.getIDocumentStylePoolAccess().GetCharFmtFromPool( static_cast<sal_uInt16>( m_bEndNote ? RES_POOLCHR_ENDNOTE_ANCHOR : RES_POOLCHR_FOOTNOTE_ANCHOR ) ); - pFmt->Add( &((SwClient&)aAnchorCharFmtDep) ); + pFmt->Add( &const_cast<SwClient&>(static_cast<const SwClient&>(aAnchorCharFmtDep)) ); } return const_cast<SwCharFmt*>(static_cast<const SwCharFmt*>(aAnchorCharFmtDep.GetRegisteredIn())); } @@ -181,7 +181,7 @@ SwCharFmt* SwEndNoteInfo::GetAnchorCharFmt(SwDoc &rDoc) const void SwEndNoteInfo::SetAnchorCharFmt( SwCharFmt* pChFmt ) { OSL_ENSURE(pChFmt, "no CharFmt?"); - pChFmt->Add( &((SwClient&)aAnchorCharFmtDep) ); + pChFmt->Add( &static_cast<SwClient&>(aAnchorCharFmtDep) ); } void SwEndNoteInfo::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) @@ -433,7 +433,7 @@ bool SwDoc::SetCurFtn( const SwPaM& rPam, const OUString& rNumStr, pTxtFtn->SetNumber( nNumber, rNumStr ); if( rFtn.IsEndNote() != bIsEndNote ) { - ((SwFmtFtn&)rFtn).SetEndNote( bIsEndNote ); + const_cast<SwFmtFtn&>(rFtn).SetEndNote( bIsEndNote ); bTypeChgd = true; pTxtFtn->CheckCondColl(); //#i11339# dispose UNO wrapper when a footnote is changed to an endnote or vice versa @@ -463,7 +463,7 @@ bool SwDoc::SetCurFtn( const SwPaM& rPam, const OUString& rNumStr, pTxtFtn->SetNumber( nNumber, rNumStr ); if( rFtn.IsEndNote() != bIsEndNote ) { - ((SwFmtFtn&)rFtn).SetEndNote( bIsEndNote ); + const_cast<SwFmtFtn&>(rFtn).SetEndNote( bIsEndNote ); bTypeChgd = true; pTxtFtn->CheckCondColl(); } diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index 7534d6e6788a..7c4b58ff1c3c 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -1116,7 +1116,7 @@ lcl_InsertDrawLabel( SwDoc & rDoc, SwTxtFmtColls *const pTxtFmtCollTbl, #if OSL_DEBUG_LEVEL > 0 OSL_ENSURE( pHnt && pHnt->Which() == RES_TXTATR_FLYCNT, "Missing FlyInCnt-Hint." ); - OSL_ENSURE( pHnt && ((SwFmtFlyCnt&)pHnt->GetFlyCnt()). + OSL_ENSURE( pHnt && const_cast<SwFmtFlyCnt&>(pHnt->GetFlyCnt()). GetFrmFmt() == (SwFrmFmt*)pOldFmt, "Wrong TxtFlyCnt-Hint." ); #endif diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx index 9b722e030609..7f6a85e4b6f1 100644 --- a/sw/source/core/doc/docsort.cxx +++ b/sw/source/core/doc/docsort.cxx @@ -634,7 +634,7 @@ void MoveRow(SwDoc* pDoc, const FlatFndBox& rBox, sal_uInt16 nS, sal_uInt16 nT, SfxItemState::SET == pTFmt->GetItemState( RES_BOXATR_FORMULA ) || SfxItemState::SET == pTFmt->GetItemState( RES_BOXATR_VALUE ) ) { - pTFmt = ((SwTableBox*)pT)->ClaimFrmFmt(); + pTFmt = const_cast<SwTableBox*>(pT)->ClaimFrmFmt(); pTFmt->LockModify(); if( pTFmt->ResetFmtAttr( RES_BOXATR_FORMAT, RES_BOXATR_VALUE ) ) pTFmt->ResetFmtAttr( RES_VERT_ORIENT ); @@ -678,7 +678,7 @@ void MoveCol(SwDoc* pDoc, const FlatFndBox& rBox, sal_uInt16 nS, sal_uInt16 nT, SfxItemState::SET == pTFmt->GetItemState( RES_BOXATR_FORMULA ) || SfxItemState::SET == pTFmt->GetItemState( RES_BOXATR_VALUE ) ) { - pTFmt = ((SwTableBox*)pT)->ClaimFrmFmt(); + pTFmt = const_cast<SwTableBox*>(pT)->ClaimFrmFmt(); pTFmt->LockModify(); if( pTFmt->ResetFmtAttr( RES_BOXATR_FORMAT, RES_BOXATR_VALUE ) ) pTFmt->ResetFmtAttr( RES_VERT_ORIENT ); diff --git a/sw/source/core/doc/lineinfo.cxx b/sw/source/core/doc/lineinfo.cxx index 960a30978d7e..e000b9181292 100644 --- a/sw/source/core/doc/lineinfo.cxx +++ b/sw/source/core/doc/lineinfo.cxx @@ -77,13 +77,13 @@ SwLineNumberInfo::SwLineNumberInfo(const SwLineNumberInfo &rCpy ) : SwClient(), bRestartEachPage( rCpy.IsRestartEachPage() ) { if ( rCpy.GetRegisteredIn() ) - ((SwModify*)rCpy.GetRegisteredIn())->Add( this ); + const_cast<SwModify*>(rCpy.GetRegisteredIn())->Add( this ); } SwLineNumberInfo& SwLineNumberInfo::operator=(const SwLineNumberInfo &rCpy) { if ( rCpy.GetRegisteredIn() ) - ((SwModify*)rCpy.GetRegisteredIn())->Add( this ); + const_cast<SwModify*>(rCpy.GetRegisteredIn())->Add( this ); else if ( GetRegisteredIn() ) GetRegisteredInNonConst()->Remove( this ); |