diff options
author | Noel Grandin <noel@peralex.com> | 2014-11-24 10:39:29 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-11-25 10:09:51 +0200 |
commit | 0f29e157abf237055004c7b9bc1d171a78c0c27e (patch) | |
tree | fea231a08e4687e54700a7aa2addff3a9132a7b9 /sw | |
parent | c7ab37e17c514b1c86fca10ff8734e9752f458fa (diff) |
loplugin: cstylecast
Change-Id: I49d14ec4247984e78aafe90528c2919488233fe7
Diffstat (limited to 'sw')
31 files changed, 138 insertions, 138 deletions
diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index 7dcfbc13851c..b7ea89823797 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -916,7 +916,7 @@ bool SwCntntFrm::MakePrtArea( const SwBorderAttrs &rAttrs ) // At the FixSize, the surrounding Frame enforces the size; // the borders are simply subtracted. const long nLeft = rAttrs.CalcLeft( this ); - const long nRight = ((SwBorderAttrs&)rAttrs).CalcRight( this ); + const long nRight = const_cast<SwBorderAttrs&>(rAttrs).CalcRight( this ); (this->*fnRect->fnSetXMargins)( nLeft, nRight ); SwViewShell *pSh = getRootFrm()->GetCurrShell(); diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index e9b05f990d22..2b538cd66ef7 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -718,7 +718,7 @@ const SwLayoutFrm *SwFrm::GetLeaf( MakePageType eMakePage, bool bFwd, bool bFound = false; do - { pLeaf = ((SwFrm*)pLeaf)->GetLeaf( eMakePage, bFwd ); + { pLeaf = const_cast<SwFrm*>(pLeaf)->GetLeaf( eMakePage, bFwd ); if ( pLeaf && (!IsLayoutFrm() || !static_cast<const SwLayoutFrm*>(this)->IsAnLower( pLeaf ))) @@ -1845,7 +1845,7 @@ bool SwFlowFrm::MoveFwd( bool bMakePage, bool bPageBreak, bool bMoveAlways ) } } // Do not calculate split cell frames. - else if ( !pNewUpper->IsCellFrm() || ((SwLayoutFrm*)pNewUpper)->Lower() ) + else if ( !pNewUpper->IsCellFrm() || static_cast<SwLayoutFrm*>(pNewUpper)->Lower() ) pNewUpper->Calc(); SwFtnBossFrm *pNewBoss = pNewUpper->FindFtnBossFrm(); diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index f8c6f72f1d85..a43f8202e644 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -2636,7 +2636,7 @@ SwFlyFrmFmt * SwFlyFrm::GetFmt() void SwFlyFrm::Calc() const { if ( !m_bValidContentPos ) - ((SwFlyFrm*)this)->PrepareMake(); + const_cast<SwFlyFrm*>(this)->PrepareMake(); else SwLayoutFrm::Calc(); } diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx index e5fad5851700..0dfe1b814592 100644 --- a/sw/source/core/layout/flylay.cxx +++ b/sw/source/core/layout/flylay.cxx @@ -1141,7 +1141,7 @@ bool CalcClipRect( const SdrObject *pSdrObj, SwRect &rRect, bool bMove ) } long nHeight = (9*(rRect.*fnRect->fnGetHeight)())/10; long nTop; - const SwFmt *pFmt = ((SwContact*)GetUserCall(pSdrObj))->GetFmt(); + const SwFmt *pFmt = static_cast<SwContact*>(GetUserCall(pSdrObj))->GetFmt(); const SvxULSpaceItem &rUL = pFmt->GetULSpace(); if( bMove ) { @@ -1175,7 +1175,7 @@ bool CalcClipRect( const SdrObject *pSdrObj, SwRect &rRect, bool bMove ) if( !pAnchorFrm ) { OSL_FAIL( "<::CalcClipRect(..)> - missing anchor frame." ); - ((SwDrawContact*)pC)->ConnectToLayout(); + const_cast<SwDrawContact*>(pC)->ConnectToLayout(); pAnchorFrm = pC->GetAnchorFrm(); } const SwFrm* pUp = pAnchorFrm->GetUpper(); diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx index 6c3758df4c0a..b138b939f82f 100644 --- a/sw/source/core/layout/ftnfrm.cxx +++ b/sw/source/core/layout/ftnfrm.cxx @@ -806,7 +806,7 @@ bool SwFrm::IsFtnAllowed() const if ( IsInTab() ) { // no footnotes in repeated headlines - const SwTabFrm *pTab = ((SwFrm*)this)->ImplFindTabFrm(); + const SwTabFrm *pTab = const_cast<SwFrm*>(this)->ImplFindTabFrm(); if ( pTab->IsFollow() ) return !pTab->IsInHeadline( *this ); } @@ -1072,7 +1072,7 @@ SwFtnFrm *SwFtnBossFrm::FindFirstFtn() /// Get the first footnote of a given content const SwFtnFrm *SwFtnBossFrm::FindFirstFtn( SwCntntFrm *pCnt ) const { - const SwFtnFrm *pRet = ((SwFtnBossFrm*)this)->FindFirstFtn(); + const SwFtnFrm *pRet = const_cast<SwFtnBossFrm*>(this)->FindFirstFtn(); if ( pRet ) { const sal_uInt16 nColNum = lcl_ColumnNum( this ); diff --git a/sw/source/core/layout/pagedesc.cxx b/sw/source/core/layout/pagedesc.cxx index 4b5e3058a6e3..47c945a11518 100644 --- a/sw/source/core/layout/pagedesc.cxx +++ b/sw/source/core/layout/pagedesc.cxx @@ -151,9 +151,9 @@ void SwPageDesc::SetRegisterFmtColl( const SwTxtFmtColl* pFmt ) if( pFmt != GetRegisterFmtColl() ) { if( pFmt ) - ((SwTxtFmtColl*)pFmt)->Add( &aDepend ); + const_cast<SwTxtFmtColl*>(pFmt)->Add( &aDepend ); else - ((SwTxtFmtColl*)GetRegisterFmtColl())->Remove( &aDepend ); + const_cast<SwTxtFmtColl*>(GetRegisterFmtColl())->Remove( &aDepend ); RegisterChange(); } diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index e9945c18d045..92a1153a90bd 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -1627,8 +1627,8 @@ static void lcl_ExtendLeftAndRight( SwRect& _rRect, // /// first check "!bHell", then "..->Lower()" and "..->IsNoTxtFrm()" // /// have not to be performed, if frame is in "Hell" // ( !bHell && pFly->Lower() && pFly->Lower()->IsNoTxtFrm() && -// ( ((SwNoTxtFrm*)pFly->Lower())->IsTransparent() || -// ((SwNoTxtFrm*)pFly->Lower())->HasAnimation() || +// ( static_cast<SwNoTxtFrm*>(pFly->Lower())->IsTransparent() || +// static_cast<SwNoTxtFrm*>(pFly->Lower())->HasAnimation() || // pFly->GetFmt()->GetSurround().IsContour() // ) // ) @@ -1830,7 +1830,7 @@ static void lcl_DrawGraphic( const SvxBrushItem& rBrush, OutputDevice *pOut, } // No Link here, we want to load the graphic synchronously! - ((SvxBrushItem&)rBrush).SetDoneLink( Link() ); + const_cast<SvxBrushItem&>(rBrush).SetDoneLink( Link() ); GraphicObject *pGrf = (GraphicObject*)rBrush.GetGraphicObject(); // Outsource drawing of background with a background color @@ -1956,11 +1956,11 @@ void DrawGraphic( if ( (rSh).GetViewOptions()->IsPDFExport() || rSh.GetOut()->GetOutDevType() == OUTDEV_PRINTER ) { - ((SvxBrushItem*)pBrush)->PurgeMedium(); - ((SvxBrushItem*)pBrush)->SetDoneLink( Link() ); + const_cast<SvxBrushItem*>(pBrush)->PurgeMedium(); + const_cast<SvxBrushItem*>(pBrush)->SetDoneLink( Link() ); } else - ((SvxBrushItem*)pBrush)->SetDoneLink( STATIC_LINK( + const_cast<SvxBrushItem*>(pBrush)->SetDoneLink( STATIC_LINK( rSh.GetDoc(), SwDoc, BackgroundDone ) ); OUString referer; SfxObjectShell * sh = rSh.GetDoc()->GetPersist(); @@ -3203,13 +3203,13 @@ void SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) c } if ( bPerformLayoutAction ) { - ((SwRootFrm*)this)->ResetTurbo(); + const_cast<SwRootFrm*>(this)->ResetTurbo(); SwLayAction aAction( (SwRootFrm*)this, pSh->Imp() ); aAction.SetPaint( false ); aAction.SetComplete( false ); aAction.SetReschedule( gProp.pSProgress != nullptr ); aAction.Action(); - ((SwRootFrm*)this)->ResetTurboFlag(); + const_cast<SwRootFrm*>(this)->ResetTurboFlag(); if ( !pSh->ActionPend() ) pSh->Imp()->DelRegion(); } @@ -3226,7 +3226,7 @@ void SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) c // of the document. Dangerous! We better set this flag to // avoid the reformat. const bool bOldAction = IsCallbackActionEnabled(); - ((SwRootFrm*)this)->SetCallbackActionEnabled( false ); + const_cast<SwRootFrm*>(this)->SetCallbackActionEnabled( false ); const SwPageFrm *pPage = pSh->Imp()->GetFirstVisPage(); @@ -3495,7 +3495,7 @@ void SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) c gProp.pSGlobalShell = 0; } - ((SwRootFrm*)this)->SetCallbackActionEnabled( bOldAction ); + const_cast<SwRootFrm*>(this)->SetCallbackActionEnabled( bOldAction ); } static void lcl_EmergencyFormatFtnCont( SwFtnContFrm *pCont ) @@ -4386,7 +4386,7 @@ void SwTabFrm::Paint(SwRect const& rRect, SwPrintData const*const) const aTabOutRect.Intersection( aTabRect ); pViewOption->DrawRect( gProp.pSGlobalShell->GetOut(), aTabOutRect, COL_LIGHTGRAY ); } - ((SwTabFrm*)this)->ResetComplete(); + const_cast<SwTabFrm*>(this)->ResetComplete(); } /** diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx index 8089986ecad4..7633b2d9b399 100644 --- a/sw/source/core/layout/trvlfrm.cxx +++ b/sw/source/core/layout/trvlfrm.cxx @@ -209,7 +209,7 @@ bool SwPageFrm::GetCrsrOfst( SwPosition *pPos, Point &rPoint, { if ( pCMS && (pCMS->bStop || pCMS->bExactOnly) ) { - ((SwCrsrMoveState*)pCMS)->bStop = true; + static_cast<SwCrsrMoveState*>(pCMS)->bStop = true; return false; } const SwCntntFrm *pCnt = GetCntntPos( aPoint, false, false, false, pCMS, false ); @@ -418,10 +418,10 @@ bool SwRootFrm::GetCrsrOfst( SwPosition *pPos, Point &rPoint, SwCrsrMoveState* pCMS, bool bTestBackground ) const { const bool bOldAction = IsCallbackActionEnabled(); - ((SwRootFrm*)this)->SetCallbackActionEnabled( false ); + const_cast<SwRootFrm*>(this)->SetCallbackActionEnabled( false ); OSL_ENSURE( (Lower() && Lower()->IsPageFrm()), "No PageFrm found." ); if( pCMS && pCMS->pFill ) - ((SwCrsrMoveState*)pCMS)->bFillRet = false; + static_cast<SwCrsrMoveState*>(pCMS)->bFillRet = false; Point aOldPoint = rPoint; // search for page containing rPoint. The borders around the pages are considered @@ -444,7 +444,7 @@ bool SwRootFrm::GetCrsrOfst( SwPosition *pPos, Point &rPoint, pPage->SwPageFrm::GetCrsrOfst( pPos, rPoint, pCMS, bTestBackground ); } - ((SwRootFrm*)this)->SetCallbackActionEnabled( bOldAction ); + const_cast<SwRootFrm*>(this)->SetCallbackActionEnabled( bOldAction ); if( pCMS ) { if( pCMS->bStop ) @@ -477,7 +477,7 @@ bool SwCellFrm::GetCrsrOfst( SwPosition *pPos, Point &rPoint, const SwTabFrm *pTab = FindTabFrm(); if ( pTab->IsFollow() && pTab->IsInHeadline( *this ) ) { - ((SwCrsrMoveState*)pCMS)->bStop = true; + static_cast<SwCrsrMoveState*>(pCMS)->bStop = true; return false; } } @@ -608,7 +608,7 @@ bool SwCntntFrm::LeftMargin(SwPaM *pPam) const { if( &pPam->GetNode() != (SwCntntNode*)GetNode() ) return false; - ((SwCntntNode*)GetNode())-> + const_cast<SwCntntNode*>(GetNode())-> MakeStartIndex((SwIndex *) &pPam->GetPoint()->nContent); return true; } @@ -617,7 +617,7 @@ bool SwCntntFrm::RightMargin(SwPaM *pPam, bool) const { if( &pPam->GetNode() != (SwCntntNode*)GetNode() ) return false; - ((SwCntntNode*)GetNode())-> + const_cast<SwCntntNode*>(GetNode())-> MakeEndIndex((SwIndex *) &pPam->GetPoint()->nContent); return true; } @@ -1322,7 +1322,7 @@ const SwCntntFrm *SwLayoutFrm::GetCntntPos( Point& rPoint, const SwTabFrm *pTab = pActual->FindTabFrm(); if ( pTab->IsFollow() && pTab->IsInHeadline( *pActual ) ) { - ((SwCrsrMoveState*)pCMS)->bStop = true; + const_cast<SwCrsrMoveState*>(pCMS)->bStop = true; return 0; } } diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index 728f15c46079..be143fa33357 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -1384,7 +1384,7 @@ SwTwips SwFrm::AdjustNeighbourhood( SwTwips nDiff, bool bTst ) if ( pUp->GetUpper() ) static_cast<SwRootFrm*>(pUp->GetUpper())->CheckViewLayout( 0, 0 ); - //((SwPageFrm*)pUp)->AdjustRootSize( CHG_CHGPAGE, &aOldRect ); + //static_cast<SwPageFrm*>(pUp)->AdjustRootSize( CHG_CHGPAGE, &aOldRect ); Frm().SSize().Height() = nOldFrmHeight; Prt().SSize().Height() = nOldPrtHeight; @@ -2934,7 +2934,7 @@ void SwLayoutFrm::Format( const SwBorderAttrs *pAttrs ) const sal_uInt16 nLeft = (sal_uInt16)pAttrs->CalcLeft( this ); const sal_uInt16 nUpper = pAttrs->CalcTop(); - const sal_uInt16 nRight = (sal_uInt16)((SwBorderAttrs*)pAttrs)->CalcRight( this ); + const sal_uInt16 nRight = (sal_uInt16)const_cast<SwBorderAttrs*>(pAttrs)->CalcRight( this ); const sal_uInt16 nLower = pAttrs->CalcBottom(); bool bVert = IsVertical() && !IsPageFrm(); SwRectFn fnRect = bVert ? ( IsVertLR() ? fnRectVertL2R : fnRectVert ) : fnRectHori; diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx index a0740e39f355..b8a2f093ef3f 100644 --- a/sw/source/core/ole/ndole.cxx +++ b/sw/source/core/ole/ndole.cxx @@ -412,7 +412,7 @@ SwOLENode * SwNodes::MakeOLENode( const SwNodeIndex & rWhere, Size SwOLENode::GetTwipSize() const { MapMode aMapMode( MAP_TWIP ); - return ((SwOLENode*)this)->aOLEObj.GetObject().GetSize( &aMapMode ); + return const_cast<SwOLENode*>(this)->aOLEObj.GetObject().GetSize( &aMapMode ); } SwCntntNode* SwOLENode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const diff --git a/sw/source/core/text/blink.cxx b/sw/source/core/text/blink.cxx index 3323d22bf821..d84b89d71bd2 100644 --- a/sw/source/core/text/blink.cxx +++ b/sw/source/core/text/blink.cxx @@ -69,7 +69,7 @@ IMPL_LINK_NOARG(SwBlink, Blinker) { const SwBlinkPortion* pTmp = &*it; if( pTmp->GetRootFrm() && - ((SwRootFrm*)pTmp->GetRootFrm())->GetCurrShell() ) + const_cast<SwRootFrm*>(pTmp->GetRootFrm())->GetCurrShell() ) { ++it; @@ -104,7 +104,7 @@ IMPL_LINK_NOARG(SwBlink, Blinker) Rectangle aRefresh( aPos, Size( nWidth, nHeight ) ); aRefresh.Right() += ( aRefresh.Bottom()- aRefresh.Top() ) / 8; - ((SwRootFrm*)pTmp->GetRootFrm()) + const_cast<SwRootFrm*>(pTmp->GetRootFrm()) ->GetCurrShell()->InvalidateWindows( aRefresh ); } else // Portions without a shell can be removed from the list diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx index 3fe5aa816cd8..71b353f8fa7e 100644 --- a/sw/source/core/text/frmform.cxx +++ b/sw/source/core/text/frmform.cxx @@ -553,7 +553,7 @@ void SwTxtFrm::_AdjustFollow( SwTxtFormatter &rLine, { while( GetFollow() ) { - if( ((SwTxtFrm*)GetFollow())->IsLocked() ) + if( static_cast<SwTxtFrm*>(GetFollow())->IsLocked() ) { OSL_FAIL( "+SwTxtFrm::JoinFrm: Follow is locked." ); return; @@ -1215,7 +1215,7 @@ bool SwTxtFrm::FormatLine( SwTxtFormatter &rLine, const bool bPrev ) if ( bHasUnderscore || rLine.GetCurr()->HasUnderscore() ) rRepaint.Bottom( rRepaint.Bottom() + 40 ); - ((SwLineLayout*)rLine.GetCurr())->SetUnderscore( bHasUnderscore ); + const_cast<SwLineLayout*>(rLine.GetCurr())->SetUnderscore( bHasUnderscore ); } if( !bUnChg ) rLine.SetChanges(); diff --git a/sw/source/core/text/frminf.cxx b/sw/source/core/text/frminf.cxx index e679cbdd9df2..d66970ac38c7 100644 --- a/sw/source/core/text/frminf.cxx +++ b/sw/source/core/text/frminf.cxx @@ -90,7 +90,7 @@ SwTwips SwTxtFrmInfo::GetLineStart( const SwTxtCursor &rLine ) const return rLine.GetLineStart(); SwRect aRect; - if( ((SwTxtCursor&)rLine).GetCharRect( &aRect, nTxtStart ) ) + if( const_cast<SwTxtCursor&>(rLine).GetCharRect( &aRect, nTxtStart ) ) return aRect.Left(); return rLine.GetLineStart(); @@ -115,7 +115,7 @@ SwTwips SwTxtFrmInfo::GetCharPos( sal_Int32 nChar, bool bCenter ) const SwTwips nStt, nNext; SwRect aRect; - if( ((SwTxtCursor&)aLine).GetCharRect( &aRect, nChar ) ) + if( static_cast<SwTxtCursor&>(aLine).GetCharRect( &aRect, nChar ) ) { if ( bVert ) pFrm->SwitchHorizontalToVertical( aRect ); @@ -128,7 +128,7 @@ SwTwips SwTxtFrmInfo::GetCharPos( sal_Int32 nChar, bool bCenter ) const if( !bCenter ) return nStt - (pFrm->Frm().*fnRect->fnGetLeft)(); - if( ((SwTxtCursor&)aLine).GetCharRect( &aRect, nChar+1 ) ) + if( static_cast<SwTxtCursor&>(aLine).GetCharRect( &aRect, nChar+1 ) ) { if ( bVert ) pFrm->SwitchHorizontalToVertical( aRect ); diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx index 861c7ed7f692..b4eea8768c94 100644 --- a/sw/source/core/text/guess.cxx +++ b/sw/source/core/text/guess.cxx @@ -61,7 +61,7 @@ bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf, sal_uInt16 nMaxSizeDiff; const SwScriptInfo& rSI = - ((SwParaPortion*)rInf.GetParaPortion())->GetScriptInfo(); + static_cast<SwParaPortion*>(rInf.GetParaPortion())->GetScriptInfo(); sal_uInt16 nMaxComp = ( SW_CJK == rInf.GetFont()->GetActual() ) && rSI.CountCompChg() && diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index 83c9fbe1567b..d476ee996645 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -193,12 +193,12 @@ inline sal_Int32 GetMinLen( const SwTxtSizeInfo &rInf ) SwTxtSizeInfo::SwTxtSizeInfo( const SwTxtSizeInfo &rNew ) : SwTxtInfo( rNew ), - m_pKanaComp(((SwTxtSizeInfo&)rNew).GetpKanaComp()), - m_pVsh(((SwTxtSizeInfo&)rNew).GetVsh()), - m_pOut(((SwTxtSizeInfo&)rNew).GetOut()), - m_pRef(((SwTxtSizeInfo&)rNew).GetRefDev()), - m_pFnt(((SwTxtSizeInfo&)rNew).GetFont()), - m_pUnderFnt(((SwTxtSizeInfo&)rNew).GetUnderFnt()), + m_pKanaComp(const_cast<SwTxtSizeInfo&>(rNew).GetpKanaComp()), + m_pVsh(const_cast<SwTxtSizeInfo&>(rNew).GetVsh()), + m_pOut(const_cast<SwTxtSizeInfo&>(rNew).GetOut()), + m_pRef(const_cast<SwTxtSizeInfo&>(rNew).GetRefDev()), + m_pFnt(const_cast<SwTxtSizeInfo&>(rNew).GetFont()), + m_pUnderFnt(const_cast<SwTxtSizeInfo&>(rNew).GetUnderFnt()), m_pFrm(rNew.m_pFrm), m_pOpt(&rNew.GetOpt()), m_pTxt(&rNew.GetTxt()), @@ -304,12 +304,12 @@ void SwTxtSizeInfo::CtorInitTxtSizeInfo( SwTxtFrm *pFrame, SwFont *pNewFnt, SwTxtSizeInfo::SwTxtSizeInfo( const SwTxtSizeInfo &rNew, const OUString* pTxt, const sal_Int32 nIndex, const sal_Int32 nLength ) : SwTxtInfo( rNew ), - m_pKanaComp(((SwTxtSizeInfo&)rNew).GetpKanaComp()), - m_pVsh(((SwTxtSizeInfo&)rNew).GetVsh()), - m_pOut(((SwTxtSizeInfo&)rNew).GetOut()), - m_pRef(((SwTxtSizeInfo&)rNew).GetRefDev()), - m_pFnt(((SwTxtSizeInfo&)rNew).GetFont()), - m_pUnderFnt(((SwTxtSizeInfo&)rNew).GetUnderFnt()), + m_pKanaComp(const_cast<SwTxtSizeInfo&>(rNew).GetpKanaComp()), + m_pVsh(const_cast<SwTxtSizeInfo&>(rNew).GetVsh()), + m_pOut(const_cast<SwTxtSizeInfo&>(rNew).GetOut()), + m_pRef(const_cast<SwTxtSizeInfo&>(rNew).GetRefDev()), + m_pFnt(const_cast<SwTxtSizeInfo&>(rNew).GetFont()), + m_pUnderFnt(const_cast<SwTxtSizeInfo&>(rNew).GetUnderFnt()), m_pFrm( rNew.m_pFrm ), m_pOpt(&rNew.GetOpt()), m_pTxt(pTxt), @@ -461,7 +461,7 @@ void SwTxtPaintInfo::CtorInitTxtPaintInfo( SwTxtFrm *pFrame, const SwRect &rPain pSmartTags = NULL; #if OSL_DEBUG_LEVEL > 1 - pBrushItem = ((SvxBrushItem*)-1); + pBrushItem = static_cast<SvxBrushItem*>(-1); #else pBrushItem = 0; #endif @@ -824,7 +824,7 @@ static void lcl_DrawSpecial( const SwTxtPaintInfo& rInf, const SwLinePortion& rP Size aFontSize( 0, SPECIAL_FONT_HEIGHT ); m_pFnt->SetSize( aFontSize, m_pFnt->GetActual() ); - ((SwTxtPaintInfo&)rInf).SetFont( m_pFnt ); + const_cast<SwTxtPaintInfo&>(rInf).SetFont( m_pFnt ); // The maximum width depends on the current orientation const sal_uInt16 nDir = m_pFnt->GetOrientation( rInf.GetTxtFrm()->IsVertical() ); @@ -886,13 +886,13 @@ static void lcl_DrawSpecial( const SwTxtPaintInfo& rInf, const SwLinePortion& rP } Point aTmpPos( nX, nY ); - ((SwTxtPaintInfo&)rInf).SetPos( aTmpPos ); + const_cast<SwTxtPaintInfo&>(rInf).SetPos( aTmpPos ); sal_uInt16 nOldWidth = rPor.Width(); - ((SwLinePortion&)rPor).Width( (sal_uInt16)aFontSize.Width() ); + const_cast<SwLinePortion&>(rPor).Width( (sal_uInt16)aFontSize.Width() ); rInf.DrawText( aTmp, rPor ); - ((SwLinePortion&)rPor).Width( nOldWidth ); - ((SwTxtPaintInfo&)rInf).SetFont( (SwFont*)pOldFnt ); - ((SwTxtPaintInfo&)rInf).SetPos( aOldPos ); + const_cast<SwLinePortion&>(rPor).Width( nOldWidth ); + const_cast<SwTxtPaintInfo&>(rInf).SetFont( (SwFont*)pOldFnt ); + const_cast<SwTxtPaintInfo&>(rInf).SetPos( aOldPos ); } void SwTxtPaintInfo::DrawRect( const SwRect &rRect, bool bNoGraphic, @@ -901,7 +901,7 @@ void SwTxtPaintInfo::DrawRect( const SwRect &rRect, bool bNoGraphic, if ( OnWin() || !bRetouche ) { if( aTxtFly.IsOn() ) - ((SwTxtPaintInfo*)this)->GetTxtFly(). + const_cast<SwTxtPaintInfo*>(this)->GetTxtFly(). DrawFlyRect( m_pOut, rRect, *this, bNoGraphic ); else if ( bNoGraphic ) m_pOut->DrawRect( rRect.SVRect() ); @@ -941,7 +941,7 @@ void SwTxtPaintInfo::DrawLineBreak( const SwLinePortion &rPor ) const if( OnWin() ) { sal_uInt16 nOldWidth = rPor.Width(); - ((SwLinePortion&)rPor).Width( LINE_BREAK_WIDTH ); + const_cast<SwLinePortion&>(rPor).Width( LINE_BREAK_WIDTH ); SwRect aRect; CalcRect( rPor, &aRect ); @@ -955,7 +955,7 @@ void SwTxtPaintInfo::DrawLineBreak( const SwLinePortion &rPor ) const lcl_DrawSpecial( *this, rPor, aRect, Color(NON_PRINTING_CHARACTER_COLOR), cChar, nOptions ); } - ((SwLinePortion&)rPor).Width( nOldWidth ); + const_cast<SwLinePortion&>(rPor).Width( nOldWidth ); } } @@ -1706,12 +1706,12 @@ SwTxtSlot::~SwTxtSlot() SwFontSave::SwFontSave(const SwTxtSizeInfo &rInf, SwFont *pNew, SwAttrIter* pItr) : pInf(NULL) - , pFnt(pNew ? ((SwTxtSizeInfo&)rInf).GetFont() : NULL) + , pFnt(pNew ? const_cast<SwTxtSizeInfo&>(rInf).GetFont() : NULL) , pIter(NULL) { if( pFnt ) { - pInf = &((SwTxtSizeInfo&)rInf); + pInf = &const_cast<SwTxtSizeInfo&>(rInf); // In these cases we temporarily switch to the new font: // 1. the fonts have a different magic number // 2. they have different script types diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx index 28d3495591e6..34f9e1bee568 100644 --- a/sw/source/core/text/inftxt.hxx +++ b/sw/source/core/text/inftxt.hxx @@ -772,14 +772,14 @@ inline sal_uInt16 SwTxtSizeInfo::GetAscent() const { SAL_WARN_IF( !GetOut(), "sw.core", "SwTxtSizeInfo::GetAscent() without m_pOut" ); - return ((SwFont*)GetFont())->GetAscent( m_pVsh, *GetOut() ); + return const_cast<SwFont*>(GetFont())->GetAscent( m_pVsh, *GetOut() ); } inline sal_uInt16 SwTxtSizeInfo::GetTxtHeight() const { SAL_WARN_IF( !GetOut(), "sw.core", "SwTxtSizeInfo::GetTxtHeight() without m_pOut" ); - return ((SwFont*)GetFont())->GetHeight( m_pVsh, *GetOut() ); + return const_cast<SwFont*>(GetFont())->GetHeight( m_pVsh, *GetOut() ); } inline SwPosSize SwTxtSizeInfo::GetTxtSize( const OUString &rTxt ) const @@ -810,13 +810,13 @@ inline void SwTxtPaintInfo::DrawText( const OUString &rText, const sal_Int32 nStart, const sal_Int32 nLength, const bool bKern ) const { - ((SwTxtPaintInfo*)this)->_DrawText( rText, rPor, nStart, nLength, bKern ); + const_cast<SwTxtPaintInfo*>(this)->_DrawText( rText, rPor, nStart, nLength, bKern ); } inline void SwTxtPaintInfo::DrawText( const SwLinePortion &rPor, const sal_Int32 nLength, const bool bKern ) const { - ((SwTxtPaintInfo*)this)->_DrawText( *m_pTxt, rPor, m_nIdx, nLength, bKern ); + const_cast<SwTxtPaintInfo*>(this)->_DrawText( *m_pTxt, rPor, m_nIdx, nLength, bKern ); } inline void SwTxtPaintInfo::DrawMarkedText( const SwLinePortion &rPor, @@ -826,7 +826,7 @@ inline void SwTxtPaintInfo::DrawMarkedText( const SwLinePortion &rPor, const bool bSmartTags, const bool bGrammarCheck ) const { - ((SwTxtPaintInfo*)this)->_DrawText( *m_pTxt, rPor, m_nIdx, nLength, bKern, bWrong, bSmartTags, bGrammarCheck ); + const_cast<SwTxtPaintInfo*>(this)->_DrawText( *m_pTxt, rPor, m_nIdx, nLength, bKern, bWrong, bSmartTags, bGrammarCheck ); } inline sal_Int32 SwTxtFormatInfo::GetReformatStart() const diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx index 1366d59d57cc..c154c1fa0485 100644 --- a/sw/source/core/text/itrcrsr.cxx +++ b/sw/source/core/text/itrcrsr.cxx @@ -101,7 +101,7 @@ static void lcl_GetCharRectInsideField( SwTxtSizeInfo& rInf, SwRect& rOrig, rInf.GetFont()->SetActual( SwScriptInfo::WhichFont( 0, pString, 0 ) ); sal_Int32 nOldLen = pPor->GetLen(); - ((SwLinePortion*)pPor)->SetLen( nLen - 1 ); + const_cast<SwLinePortion*>(pPor)->SetLen( nLen - 1 ); const SwTwips nX1 = pPor->GetLen() ? pPor->GetTxtSize( rInf ).Width() : 0; @@ -109,11 +109,11 @@ static void lcl_GetCharRectInsideField( SwTxtSizeInfo& rInf, SwRect& rOrig, SwTwips nX2 = 0; if ( rCMS.bRealWidth ) { - ((SwLinePortion*)pPor)->SetLen( nLen ); + const_cast<SwLinePortion*>(pPor)->SetLen( nLen ); nX2 = pPor->GetTxtSize( rInf ).Width(); } - ((SwLinePortion*)pPor)->SetLen( nOldLen ); + const_cast<SwLinePortion*>(pPor)->SetLen( nOldLen ); rOrig.Pos().X() += nX1; rOrig.Width( ( nX2 > nX1 ) ? @@ -1120,7 +1120,7 @@ void SwTxtCursor::_GetCharRect( SwRect* pOrig, const sal_Int32 nOfst, // the portion. This can happen is the last portion // inside the bidi portion is a nested bidi portion SwLineLayout& rLineLayout = - ((SwMultiPortion*)pLastBidiPor)->GetRoot(); + static_cast<SwMultiPortion*>(pLastBidiPor)->GetRoot(); const SwLinePortion *pLast = rLineLayout.FindLastPortion(); if ( pLast->IsMultiPortion() ) @@ -1305,7 +1305,7 @@ sal_Int32 SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint, { if ( pPor->InSpaceGrp() && nSpaceAdd ) { - ((SwTxtSizeInfo&)GetInfo()).SetIdx( nCurrStart ); + const_cast<SwTxtSizeInfo&>(GetInfo()).SetIdx( nCurrStart ); nWidth = nWidth + sal_uInt16( pPor->CalcSpacing( nSpaceAdd, GetInfo() ) ); } if( ( pPor->InFixMargGrp() && ! pPor->IsMarginPortion() ) || @@ -1349,7 +1349,7 @@ sal_Int32 SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint, { if ( pPor->InSpaceGrp() && nSpaceAdd ) { - ((SwTxtSizeInfo&)GetInfo()).SetIdx( nCurrStart ); + const_cast<SwTxtSizeInfo&>(GetInfo()).SetIdx( nCurrStart ); nWidth = nWidth + sal_uInt16( pPor->CalcSpacing( nSpaceAdd, GetInfo() ) ); } @@ -1400,7 +1400,7 @@ sal_Int32 SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint, } } - ((SwTxtSizeInfo&)GetInfo()).SetIdx( nOldIdx ); + const_cast<SwTxtSizeInfo&>(GetInfo()).SetIdx( nOldIdx ); sal_Int32 nLength = pPor->GetLen(); @@ -1409,7 +1409,7 @@ sal_Int32 SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint, if( bFieldInfo && ( nWidth30 < nX || bRightOver || bLeftOver || ( pPor->InNumberGrp() && !pPor->IsFtnNumPortion() ) || ( pPor->IsMarginPortion() && nWidth > nX + 30 ) ) ) - ((SwCrsrMoveState*)pCMS)->bPosCorr = true; + static_cast<SwCrsrMoveState*>(pCMS)->bPosCorr = true; // #i27615# if (pCMS) @@ -1430,16 +1430,16 @@ sal_Int32 SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint, if( pCMS ) { if( pPor->IsFlyPortion() && bFieldInfo ) - ((SwCrsrMoveState*)pCMS)->bPosCorr = true; + static_cast<SwCrsrMoveState*>(pCMS)->bPosCorr = true; if (!bRightOver && nX) { if( pPor->IsFtnNumPortion()) - ((SwCrsrMoveState*)pCMS)->bFtnNoInfo = true; + static_cast<SwCrsrMoveState*>(pCMS)->bFtnNoInfo = true; else if (pPor->InNumberGrp() ) // #i23726# { - ((SwCrsrMoveState*)pCMS)->nInNumPostionOffset = nX; - ((SwCrsrMoveState*)pCMS)->bInNumPortion = true; + static_cast<SwCrsrMoveState*>(pCMS)->nInNumPostionOffset = nX; + static_cast<SwCrsrMoveState*>(pCMS)->bInNumPortion = true; } } } @@ -1587,14 +1587,14 @@ sal_Int32 SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint, sal_uInt8 nOldProp; if( GetPropFont() ) { - ((SwFont*)GetFnt())->SetProportion( GetPropFont() ); + const_cast<SwFont*>(GetFnt())->SetProportion( GetPropFont() ); nOldProp = GetFnt()->GetPropr(); } else nOldProp = 0; { SwTxtSizeInfo aSizeInf( GetInfo(), &rText, nCurrStart ); - ((SwTxtCursor*)this)->SeekAndChg( aSizeInf ); + const_cast<SwTxtCursor*>(this)->SeekAndChg( aSizeInf ); SwTxtSlot aDiffTxt( &aSizeInf, static_cast<SwTxtPortion*>(pPor), false, false ); SwFontSave aSave( aSizeInf, pPor->IsDropPortion() ? static_cast<SwDropPortion*>(pPor)->GetFnt() : NULL ); @@ -1676,7 +1676,7 @@ sal_Int32 SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint, // set cursor bidi level if ( pCMS ) - ((SwCrsrMoveState*)pCMS)->nCursorBidiLevel = + static_cast<SwCrsrMoveState*>(pCMS)->nCursorBidiLevel = aDrawInf.GetCursorBidiLevel(); if( bFieldInfo && nLength == pPor->GetLen() && @@ -1685,7 +1685,7 @@ sal_Int32 SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint, --nLength; } if( nOldProp ) - ((SwFont*)GetFnt())->SetProportion( nOldProp ); + const_cast<SwFont*>(GetFnt())->SetProportion( nOldProp ); } else { diff --git a/sw/source/core/text/itrtxt.hxx b/sw/source/core/text/itrtxt.hxx index 9ef29dedaf23..e2ec34beaa35 100644 --- a/sw/source/core/text/itrtxt.hxx +++ b/sw/source/core/text/itrtxt.hxx @@ -253,7 +253,7 @@ public: inline void GetAdjusted() const { if( pCurr->IsFormatAdj() ) - ((SwTxtAdjuster*)this)->CalcAdjLine( pCurr ); + const_cast<SwTxtAdjuster*>(this)->CalcAdjLine( pCurr ); } // Special treatment for DropCaps diff --git a/sw/source/core/text/porexp.cxx b/sw/source/core/text/porexp.cxx index fe90c4d33047..f3518494e017 100644 --- a/sw/source/core/text/porexp.cxx +++ b/sw/source/core/text/porexp.cxx @@ -119,7 +119,7 @@ sal_uInt16 SwBlankPortion::MayUnderflow( const SwTxtFormatInfo &rInf, // wenn hinter uns ein Blank ist, brauchen wir kein Underflow weiterreichen if (bUnderflow && nIdx + 1 < rInf.GetTxt().getLength() && CH_BLANK == rInf.GetTxt()[nIdx + 1]) return 0; - if( nIdx && !((SwTxtFormatInfo&)rInf).GetFly() ) + if( nIdx && !const_cast<SwTxtFormatInfo&>(rInf).GetFly() ) { while( pPos && !pPos->IsFlyPortion() ) pPos = pPos->GetPortion(); diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx index 46c4b9f47231..7b9a73702d1d 100644 --- a/sw/source/core/text/porfld.cxx +++ b/sw/source/core/text/porfld.cxx @@ -1126,11 +1126,11 @@ void SwCombinedPortion::Paint( const SwTxtPaintInfo &rInf ) const aTmpFont.SetSize( aTmpSz, nAct ); } } - ((SwTxtPaintInfo&)rInf).SetPos( aOutPos ); + const_cast<SwTxtPaintInfo&>(rInf).SetPos( aOutPos ); rInf.DrawText( aExpand, *this, i, 1 ); } // rInf is const, so we have to take back our manipulations - ((SwTxtPaintInfo&)rInf).SetPos( aOldPos ); + const_cast<SwTxtPaintInfo&>(rInf).SetPos( aOldPos ); } } diff --git a/sw/source/core/text/porfld.hxx b/sw/source/core/text/porfld.hxx index ec74bb2e5b87..952ff8ff5f63 100644 --- a/sw/source/core/text/porfld.hxx +++ b/sw/source/core/text/porfld.hxx @@ -193,7 +193,7 @@ public: inline void SetNoPaint( bool bNew ) { bNoPaint = bNew; } inline void SetRelPos( SwTwips nNew ) { nYPos = nNew; } inline void SetId( long nNew ) const - { ((SwGrfNumPortion*)this)->nId = nNew; } + { const_cast<SwGrfNumPortion*>(this)->nId = nNew; } inline SwTwips GetRelPos() const { return nYPos; } inline SwTwips GetGrfHeight() const { return nGrfHeight; } inline SwTwips GetId() const { return nId; } diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx index cd59a958973c..75f3043c986f 100644 --- a/sw/source/core/text/porlay.cxx +++ b/sw/source/core/text/porlay.cxx @@ -2028,7 +2028,7 @@ SwTwips SwLineLayout::_GetHangingMargin() const pPor = pPor->GetPortion(); } if( !bFound ) // update the hanging-flag - ((SwLineLayout*)this)->SetHanging( false ); + const_cast<SwLineLayout*>(this)->SetHanging( false ); return nDiff; } @@ -2047,7 +2047,7 @@ SwTwips SwTxtFrm::HangingMargin() const pLine = pLine->GetNext(); } while ( pLine ); if( !nRet ) // update the margin-flag - ((SwParaPortion*)GetPara())->SetMargin( false ); + const_cast<SwParaPortion*>(GetPara())->SetMargin( false ); return nRet; } diff --git a/sw/source/core/text/porlin.cxx b/sw/source/core/text/porlin.cxx index 32300d59604b..1e1719de7cab 100644 --- a/sw/source/core/text/porlin.cxx +++ b/sw/source/core/text/porlin.cxx @@ -142,12 +142,12 @@ void SwLinePortion::PrePaint( const SwTxtPaintInfo& rInf, void SwLinePortion::CalcTxtSize( const SwTxtSizeInfo &rInf ) { if( GetLen() == rInf.GetLen() ) - *((SwPosSize*)this) = GetTxtSize( rInf ); + *static_cast<SwPosSize*>(this) = GetTxtSize( rInf ); else { SwTxtSizeInfo aInf( rInf ); aInf.SetLen( GetLen() ); - *((SwPosSize*)this) = GetTxtSize( aInf ); + *static_cast<SwPosSize*>(this) = GetTxtSize( aInf ); } } diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx index 84740ed2c85f..9df8de427167 100644 --- a/sw/source/core/text/pormulti.cxx +++ b/sw/source/core/text/pormulti.cxx @@ -790,7 +790,7 @@ static bool lcl_HasRotation( const SwTxtAttr& rAttr, SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( sal_Int32 &rPos, SwMultiPortion* pMulti ) const { - SwScriptInfo& rSI = ((SwParaPortion*)GetParaPortion())->GetScriptInfo(); + SwScriptInfo& rSI = const_cast<SwParaPortion*>(GetParaPortion())->GetScriptInfo(); // get the last embedding level sal_uInt8 nCurrLevel; diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx index 345703032737..e2e92f97353d 100644 --- a/sw/source/core/text/porrst.cxx +++ b/sw/source/core/text/porrst.cxx @@ -198,7 +198,7 @@ SwArrowPortion::SwArrowPortion( const SwTxtPaintInfo &rInf ) void SwArrowPortion::Paint( const SwTxtPaintInfo &rInf ) const { - ((SwArrowPortion*)this)->aPos = rInf.GetPos(); + const_cast<SwArrowPortion*>(this)->aPos = rInf.GetPos(); } SwLinePortion *SwArrowPortion::Compress() { return this; } @@ -467,7 +467,7 @@ void SwHiddenTextPortion::Paint( const SwTxtPaintInfo & rInf) const aPos.Y() -= 150; aPos.X() -= 25; SwRect aRect( aPos, Size( 100, 200 ) ); - ((OutputDevice*)pOut)->DrawRect( aRect.SVRect() ); + static_cast<OutputDevice*>(pOut)->DrawRect( aRect.SVRect() ); pOut->SetFillColor( aOldColor ); #endif } diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx index 6b14932d9c70..e79272546fe7 100644 --- a/sw/source/core/text/portxt.cxx +++ b/sw/source/core/text/portxt.cxx @@ -64,7 +64,7 @@ static sal_Int32 lcl_AddSpace( const SwTxtSizeInfo &rInf, const OUString* pStr, nPos = rInf.GetIdx(); nEnd = rInf.GetIdx() + rPor.GetLen(); pStr = &rInf.GetTxt(); - pSI = &((SwParaPortion*)rInf.GetParaPortion())->GetScriptInfo(); + pSI = &const_cast<SwParaPortion*>(rInf.GetParaPortion())->GetScriptInfo(); } sal_Int32 nCnt = 0; diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx index 3d6c761e80f8..836436fd8736 100644 --- a/sw/source/core/text/txtdrop.cxx +++ b/sw/source/core/text/txtdrop.cxx @@ -77,7 +77,7 @@ public: }; SwDropSave::SwDropSave( const SwTxtPaintInfo &rInf ) : - pInf( ((SwTxtPaintInfo*)&rInf) ), nIdx( rInf.GetIdx() ), + pInf( const_cast<SwTxtPaintInfo*>(&rInf) ), nIdx( rInf.GetIdx() ), nLen( rInf.GetLen() ), nX( rInf.X() ), nY( rInf.Y() ) { } @@ -252,8 +252,8 @@ void SwDropPortion::PaintTxt( const SwTxtPaintInfo &rInf ) const const sal_uInt16 nOldAscent = GetAscent(); const SwTwips nBasePosY = rInf.Y(); - ((SwTxtPaintInfo&)rInf).Y( nBasePosY + nY ); - ((SwDropPortion*)this)->SetAscent( nOldAscent + nY ); + const_cast<SwTxtPaintInfo&>(rInf).Y( nBasePosY + nY ); + const_cast<SwDropPortion*>(this)->SetAscent( nOldAscent + nY ); SwDropSave aSave( rInf ); // for text inside drop portions we let vcl handle the text directions SwLayoutModeModifier aLayoutModeModifier( *rInf.GetOut() ); @@ -261,9 +261,9 @@ void SwDropPortion::PaintTxt( const SwTxtPaintInfo &rInf ) const while ( pCurrPart ) { - ((SwDropPortion*)this)->SetLen( pCurrPart->GetLen() ); - ((SwDropPortion*)this)->Width( pCurrPart->GetWidth() ); - ((SwTxtPaintInfo&)rInf).SetLen( pCurrPart->GetLen() ); + const_cast<SwDropPortion*>(this)->SetLen( pCurrPart->GetLen() ); + const_cast<SwDropPortion*>(this)->Width( pCurrPart->GetWidth() ); + const_cast<SwTxtPaintInfo&>(rInf).SetLen( pCurrPart->GetLen() ); SwFontSave aFontSave( rInf, &pCurrPart->GetFont() ); const_cast<SwDropPortion*>(this)->SetJoinBorderWithNext(pCurrPart->GetJoinBorderWithNext()); const_cast<SwDropPortion*>(this)->SetJoinBorderWithPrev(pCurrPart->GetJoinBorderWithPrev()); @@ -277,15 +277,15 @@ void SwDropPortion::PaintTxt( const SwTxtPaintInfo &rInf ) const SwTxtPortion::Paint( rInf ); - ((SwTxtPaintInfo&)rInf).SetIdx( rInf.GetIdx() + pCurrPart->GetLen() ); - ((SwTxtPaintInfo&)rInf).X( rInf.X() + pCurrPart->GetWidth() ); + const_cast<SwTxtPaintInfo&>(rInf).SetIdx( rInf.GetIdx() + pCurrPart->GetLen() ); + const_cast<SwTxtPaintInfo&>(rInf).X( rInf.X() + pCurrPart->GetWidth() ); pCurrPart = pCurrPart->GetFollow(); } - ((SwTxtPaintInfo&)rInf).Y( nBasePosY ); - ((SwDropPortion*)this)->Width( nOldWidth ); - ((SwDropPortion*)this)->SetLen( nOldLen ); - ((SwDropPortion*)this)->SetAscent( nOldAscent ); + const_cast<SwTxtPaintInfo&>(rInf).Y( nBasePosY ); + const_cast<SwDropPortion*>(this)->Width( nOldWidth ); + const_cast<SwDropPortion*>(this)->SetLen( nOldLen ); + const_cast<SwDropPortion*>(this)->SetAscent( nOldAscent ); const_cast<SwDropPortion*>(this)->SetJoinBorderWithNext(false); const_cast<SwDropPortion*>(this)->SetJoinBorderWithPrev(false); } @@ -308,12 +308,12 @@ void SwDropPortion::PaintDrop( const SwTxtPaintInfo &rInf ) const // make good for retouching // Set baseline - ((SwTxtPaintInfo&)rInf).Y( aOutPos.Y() + nDropHeight ); + const_cast<SwTxtPaintInfo&>(rInf).Y( aOutPos.Y() + nDropHeight ); // for background - ((SwDropPortion*)this)->Height( nDropHeight + nDropDescent ); - ((SwDropPortion*)this)->Width( Width() - nX ); - ((SwDropPortion*)this)->SetAscent( nDropHeight ); + const_cast<SwDropPortion*>(this)->Height( nDropHeight + nDropDescent ); + const_cast<SwDropPortion*>(this)->Width( Width() - nX ); + const_cast<SwDropPortion*>(this)->SetAscent( nDropHeight ); // adapt Clipregion to us // Und zwar immer, und nie mit dem bestehenden ClipRect @@ -331,10 +331,10 @@ void SwDropPortion::PaintDrop( const SwTxtPaintInfo &rInf ) const PaintTxt( rInf ); // save old values - ((SwDropPortion*)this)->Height( nOldHeight ); - ((SwDropPortion*)this)->Width( nOldWidth ); - ((SwDropPortion*)this)->SetAscent( nOldAscent ); - ((SwTxtPaintInfo&)rInf).Y( nOldPosY ); + const_cast<SwDropPortion*>(this)->Height( nOldHeight ); + const_cast<SwDropPortion*>(this)->Width( nOldWidth ); + const_cast<SwDropPortion*>(this)->SetAscent( nOldAscent ); + const_cast<SwTxtPaintInfo&>(rInf).Y( nOldPosY ); } void SwDropPortion::Paint( const SwTxtPaintInfo &rInf ) const @@ -397,8 +397,8 @@ SwPosSize SwDropPortion::GetTxtSize( const SwTxtSizeInfo &rInf ) const sal_Int32 nOldIdx = rInf.GetIdx(); sal_Int32 nOldLen = rInf.GetLen(); - ((SwTxtSizeInfo&)rInf).SetIdx( nIdx ); - ((SwTxtSizeInfo&)rInf).SetLen( rInf.GetLen() - nIdx ); + const_cast<SwTxtSizeInfo&>(rInf).SetIdx( nIdx ); + const_cast<SwTxtSizeInfo&>(rInf).SetLen( rInf.GetLen() - nIdx ); if( pCurrPart ) { @@ -411,8 +411,8 @@ SwPosSize SwDropPortion::GetTxtSize( const SwTxtSizeInfo &rInf ) const SwPosSize aPosSize( SwTxtPortion::GetTxtSize( rInf ) ); aPosSize.Width( aPosSize.Width() + nMyX ); - ((SwTxtSizeInfo&)rInf).SetIdx( nOldIdx ); - ((SwTxtSizeInfo&)rInf).SetLen( nOldLen ); + const_cast<SwTxtSizeInfo&>(rInf).SetIdx( nOldIdx ); + const_cast<SwTxtSizeInfo&>(rInf).SetLen( nOldLen ); if( pCurrPart ) { const_cast<SwDropPortion*>(this)->SetJoinBorderWithNext(false); @@ -513,7 +513,7 @@ SwDropPortion *SwTxtFormatter::NewDropPortion( SwTxtFormatInfo &rInf ) nPorLen = pFrm->GetTxtNode()->GetDropLen( nPorLen ); if( !nPorLen ) { - ((SwTxtFormatter*)this)->ClearDropFmt(); + static_cast<SwTxtFormatter*>(this)->ClearDropFmt(); return 0; } @@ -543,7 +543,7 @@ SwDropPortion *SwTxtFormatter::NewDropPortion( SwTxtFormatInfo &rInf ) // font is used. if ( GetDropLines() < 2 ) { - ((SwTxtFormatter*)this)->SetPaintDrop( true ); + static_cast<SwTxtFormatter*>(this)->SetPaintDrop( true ); return pDropPor; } @@ -589,7 +589,7 @@ SwDropPortion *SwTxtFormatter::NewDropPortion( SwTxtFormatInfo &rInf ) pCurrPart = pPart; } - ((SwTxtFormatter*)this)->SetPaintDrop( true ); + static_cast<SwTxtFormatter*>(this)->SetPaintDrop( true ); return pDropPor; } diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx index a6ed61e92a96..fc5cb0d16feb 100644 --- a/sw/source/core/text/txtfld.cxx +++ b/sw/source/core/text/txtfld.cxx @@ -81,7 +81,7 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf, sal_uInt16 subType = 0; // set language - ((SwTxtFormatter*)this)->SeekAndChg( rInf ); + const_cast<SwTxtFormatter*>(this)->SeekAndChg( rInf ); if (pFld->GetLanguage() != GetFnt()->GetLanguage()) { pFld->SetLanguage( GetFnt()->GetLanguage() ); diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index 65fee169f600..bfe74b5b23a8 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -259,14 +259,14 @@ SwFrmSwapper::SwFrmSwapper( const SwTxtFrm* pTxtFrm, bool bSwapIfNotSwapped ) ( ! bSwapIfNotSwapped && pFrm->IsSwapped() ) ) ) { bUndo = true; - ((SwTxtFrm*)pFrm)->SwapWidthAndHeight(); + const_cast<SwTxtFrm*>(pFrm)->SwapWidthAndHeight(); } } SwFrmSwapper::~SwFrmSwapper() { if ( bUndo ) - ((SwTxtFrm*)pFrm)->SwapWidthAndHeight(); + const_cast<SwTxtFrm*>(pFrm)->SwapWidthAndHeight(); } void SwTxtFrm::SwitchLTRtoRTL( SwRect& rRect ) const @@ -298,12 +298,12 @@ SwLayoutModeModifier::SwLayoutModeModifier( const OutputDevice& rOutp ) : SwLayoutModeModifier::~SwLayoutModeModifier() { - ((OutputDevice&)rOut).SetLayoutMode( nOldLayoutMode ); + const_cast<OutputDevice&>(rOut).SetLayoutMode( nOldLayoutMode ); } void SwLayoutModeModifier::Modify( bool bChgToRTL ) { - ((OutputDevice&)rOut).SetLayoutMode( bChgToRTL ? + const_cast<OutputDevice&>(rOut).SetLayoutMode( bChgToRTL ? TEXT_LAYOUT_BIDI_STRONG | TEXT_LAYOUT_BIDI_RTL : TEXT_LAYOUT_BIDI_STRONG ); } @@ -311,7 +311,7 @@ void SwLayoutModeModifier::Modify( bool bChgToRTL ) void SwLayoutModeModifier::SetAuto() { const ComplexTextLayoutMode nNewLayoutMode = nOldLayoutMode & ~TEXT_LAYOUT_BIDI_STRONG; - ((OutputDevice&)rOut).SetLayoutMode( nNewLayoutMode ); + const_cast<OutputDevice&>(rOut).SetLayoutMode( nNewLayoutMode ); } SwDigitModeModifier::SwDigitModeModifier( const OutputDevice& rOutp, LanguageType eCurLang ) : @@ -327,12 +327,12 @@ SwDigitModeModifier::SwDigitModeModifier( const OutputDevice& rOutp, LanguageTyp else if ( SvtCTLOptions::NUMERALS_SYSTEM == nTextNumerals ) eLang = ::GetAppLanguage(); - ((OutputDevice&)rOut).SetDigitLanguage( eLang ); + const_cast<OutputDevice&>(rOut).SetDigitLanguage( eLang ); } SwDigitModeModifier::~SwDigitModeModifier() { - ((OutputDevice&)rOut).SetDigitLanguage( nOldLanguageType ); + const_cast<OutputDevice&>(rOut).SetDigitLanguage( nOldLanguageType ); } void SwTxtFrm::Init() @@ -385,7 +385,7 @@ SwTxtFrm::~SwTxtFrm() if( 0 != ( pCNd = PTR_CAST( SwCntntNode, GetRegisteredIn() )) && !pCNd->GetDoc()->IsInDtor() && HasFtn() ) { - SwTxtNode *pTxtNd = ((SwTxtFrm*)this)->GetTxtNode(); + SwTxtNode *pTxtNd = static_cast<SwTxtFrm*>(this)->GetTxtNode(); const SwFtnIdxs &rFtnIdxs = pCNd->GetDoc()->GetFtnIdxs(); size_t nPos = 0; sal_uLong nIndex = pCNd->GetIndex(); diff --git a/sw/source/core/text/txthyph.cxx b/sw/source/core/text/txthyph.cxx index bf6d143b5045..e0ae055bc051 100644 --- a/sw/source/core/text/txthyph.cxx +++ b/sw/source/core/text/txthyph.cxx @@ -404,11 +404,11 @@ sal_uInt16 SwSoftHyphPortion::GetViewWidth( const SwTxtSizeInfo &rInf ) const if( !Width() && rInf.OnWin() && rInf.GetOpt().IsSoftHyph() && !IsExpand() ) { if( !nViewWidth ) - ((SwSoftHyphPortion*)this)->nViewWidth + const_cast<SwSoftHyphPortion*>(this)->nViewWidth = rInf.GetTxtSize(OUString('-')).Width(); } else - ((SwSoftHyphPortion*)this)->nViewWidth = 0; + const_cast<SwSoftHyphPortion*>(this)->nViewWidth = 0; return nViewWidth; } diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx index 42ae430a6628..4956a0d274d7 100644 --- a/sw/source/core/text/txttab.cxx +++ b/sw/source/core/text/txttab.cxx @@ -510,9 +510,9 @@ void SwTabPortion::Paint( const SwTxtPaintInfo &rInf ) const SwViewOption::IsFieldShadings() ) { const sal_uInt16 nTmpWidth = PrtWidth(); - ((SwTabPortion*)this)->PrtWidth( GetFixWidth() ); + static_cast<SwTabPortion*>(this)->PrtWidth( GetFixWidth() ); rInf.DrawViewOpt( *this, POR_TAB ); - ((SwTabPortion*)this)->PrtWidth( nTmpWidth ); + static_cast<SwTabPortion*>(this)->PrtWidth( nTmpWidth ); } #endif |