sw/source/core/text/frmcrsr.cxx | 4 ++-- sw/source/core/text/frmform.cxx | 4 ++-- sw/source/core/text/frmpaint.cxx | 2 +- sw/source/core/text/inftxt.cxx | 8 ++++---- sw/source/core/text/itrcrsr.cxx | 6 +++--- sw/source/core/text/itrform2.cxx | 32 ++++++++++++++++---------------- sw/source/core/text/itrpaint.cxx | 10 +++++----- sw/source/core/text/itrtxt.cxx | 2 +- sw/source/core/text/porfld.cxx | 20 ++++++++++---------- sw/source/core/text/porfly.cxx | 6 +++--- sw/source/core/text/porlin.cxx | 4 ++-- sw/source/core/text/pormulti.cxx | 18 +++++++++--------- sw/source/core/text/porrst.cxx | 6 +++--- sw/source/core/text/txtdrop.cxx | 12 ++++++------ sw/source/core/text/txtfrm.cxx | 8 ++++---- 15 files changed, 71 insertions(+), 71 deletions(-)
New commits: commit 15bdf9d77cef4a898e4d64d2d56cd83df2c3a06a Author: Aron Budea <aron.bu...@collabora.com> AuthorDate: Mon Oct 4 23:35:31 2021 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Tue Oct 5 14:43:31 2021 +0200 Revert "sw: eliminate recently added static_cast<SwTwips>() calls" Needed to revert 301278b656e76b6f42af5cf8a6f5c6c02acfffeb in libreoffice-7-2. This reverts commit 9e075acf2bf1ce6c43fdf5b601507ee0663bd691. Change-Id: I79460e19dadc5a9def5b0ee89cd1cbb5c3ad699c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123089 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx index 8be43264f192..554599d60568 100644 --- a/sw/source/core/text/frmcrsr.cxx +++ b/sw/source/core/text/frmcrsr.cxx @@ -590,7 +590,7 @@ bool SwTextFrame::GetModelPositionForViewPoint_(SwPosition* pPos, const Point& r // See comment in AdjustFrame() SwTwips nMaxY = getFrameArea().Top() + getFramePrintArea().Top() + getFramePrintArea().Height(); aLine.TwipsToLine( rPoint.Y() ); - while( aLine.Y() + o3tl::narrowing<SwTwips>(aLine.GetLineHeight()) > nMaxY ) + while( aLine.Y() + static_cast<SwTwips>(aLine.GetLineHeight()) > nMaxY ) { if( !aLine.Prev() ) break; diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx index f59665b2602b..763645891c88 100644 --- a/sw/source/core/text/frmform.cxx +++ b/sw/source/core/text/frmform.cxx @@ -1205,7 +1205,7 @@ bool SwTextFrame::FormatLine( SwTextFormatter &rLine, const bool bPrev ) bOldHyph == pNew->IsEndHyph(); if ( bUnChg && !bPrev ) { - const tools::Long nWidthDiff = nOldWidth > o3tl::narrowing<SwTwips>(pNew->Width()) + const tools::Long nWidthDiff = nOldWidth > static_cast<SwTwips>(pNew->Width()) ? nOldWidth - pNew->Width() : pNew->Width() - nOldWidth; @@ -1259,7 +1259,7 @@ bool SwTextFrame::FormatLine( SwTextFormatter &rLine, const bool bPrev ) rLine.SetUnclipped( false ); } } - SwTwips nRght = std::max( nOldWidth, o3tl::narrowing<SwTwips>(pNew->Width()) + + SwTwips nRght = std::max( nOldWidth, static_cast<SwTwips>(pNew->Width()) + pNew->GetHangingMargin() ); SwViewShell *pSh = getRootFrame()->GetCurrShell(); const SwViewOption *pOpt = pSh ? pSh->GetViewOptions() : nullptr; diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx index 76630fc573f6..93007bfcf539 100644 --- a/sw/source/core/text/frmpaint.cxx +++ b/sw/source/core/text/frmpaint.cxx @@ -356,7 +356,7 @@ void SwTextFrame::PaintExtraData( const SwRect &rRect ) const SwTextPainter aLine( const_cast<SwTextFrame*>(this), &aInf ); bool bNoDummy = !aLine.GetNext(); // Only one empty line! - while( aLine.Y() + o3tl::narrowing<SwTwips>(aLine.GetLineHeight()) <= rRect.Top() ) + while( aLine.Y() + static_cast<SwTwips>(aLine.GetLineHeight()) <= rRect.Top() ) { if( !aLine.GetCurr()->IsDummy() && ( rLineInf.IsCountBlankLines() || diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index 3e3b5d78af23..cb7cb3b36c63 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -1023,13 +1023,13 @@ void SwTextPaintInfo::DrawRedArrow( const SwLinePortion &rPor ) const { aRect.Pos().AdjustY(20 - GetAscent() ); aRect.Pos().AdjustX(20 ); - if( aSize.Height() > o3tl::narrowing<SwTwips>(rPor.Height()) ) + if( aSize.Height() > static_cast<SwTwips>(rPor.Height()) ) aRect.Height( rPor.Height() ); cChar = CHAR_LEFT_ARROW; } else { - if( aSize.Height() > o3tl::narrowing<SwTwips>(rPor.Height()) ) + if( aSize.Height() > static_cast<SwTwips>(rPor.Height()) ) aRect.Height( rPor.Height() ); aRect.Pos().AdjustY( -(aRect.Height() + 20) ); aRect.Pos().AdjustX( -(aRect.Width() + 20) ); diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx index 64792666e80e..94ee6dd7562f 100644 --- a/sw/source/core/text/itrcrsr.cxx +++ b/sw/source/core/text/itrcrsr.cxx @@ -1051,7 +1051,7 @@ void SwTextCursor::GetCharRect_( SwRect* pOrig, TextFrameIndex const nOfst, nPorHeight = nPorAscent; pOrig->Height( nPorHeight + static_cast<SwDropPortion*>(pPor)->GetDropDescent() ); - if( o3tl::narrowing<SwTwips>(nTmpHeight) < pOrig->Height() ) + if( static_cast<SwTwips>(nTmpHeight) < pOrig->Height() ) { nTmpAscent = nPorAscent; nTmpHeight = sal_uInt16( pOrig->Height() ); diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index 289905bc6f50..be712337c8e9 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -2422,7 +2422,7 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo &rInf ) nAscent = pLast->GetAscent(); nHeight = pLast->Height(); - if ( o3tl::narrowing<SwTwips>(m_pCurr->GetRealHeight()) > nHeight ) + if ( static_cast<SwTwips>(m_pCurr->GetRealHeight()) > nHeight ) nTop += m_pCurr->GetRealHeight() - nHeight; else // Important for fixed space between lines @@ -2553,7 +2553,7 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo &rInf ) if( nH < SAL_MAX_UINT16 ) pFly->Height( sal_uInt16( nH ) ); } - if( nAscent < o3tl::narrowing<SwTwips>(pFly->Height()) ) + if( nAscent < static_cast<SwTwips>(pFly->Height()) ) pFly->SetAscent( sal_uInt16(nAscent) ); else pFly->SetAscent( pFly->Height() ); @@ -2569,7 +2569,7 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo &rInf ) else { pFly->Height( sal_uInt16(aInter.Height()) ); - if( nAscent < o3tl::narrowing<SwTwips>(pFly->Height()) ) + if( nAscent < static_cast<SwTwips>(pFly->Height()) ) pFly->SetAscent( sal_uInt16(nAscent) ); else pFly->SetAscent( pFly->Height() ); @@ -2666,7 +2666,7 @@ SwFlyCntPortion *SwTextFormatter::NewFlyCntPortion( SwTextFormatInfo &rInf, { nAscent = rInf.GetLast()->GetAscent(); } - else if( o3tl::narrowing<SwTwips>(nAscent) > nFlyAsc ) + else if( static_cast<SwTwips>(nAscent) > nFlyAsc ) nFlyAsc = nAscent; Point aBase( GetLeftMargin() + rInf.X(), Y() + nAscent ); diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx index 8ff1067abd0d..88c8236887ad 100644 --- a/sw/source/core/text/itrpaint.cxx +++ b/sw/source/core/text/itrpaint.cxx @@ -83,14 +83,14 @@ SwLinePortion *SwTextPainter::CalcPaintOfst( const SwRect &rPaint ) { SwLinePortion *pLast = nullptr; // 7529 and 4757: not <= nPaintOfst - while( pPor && o3tl::narrowing<SwTwips>(GetInfo().X() + pPor->Width() + (pPor->Height()/2)) + while( pPor && static_cast<SwTwips>(GetInfo().X() + pPor->Width() + (pPor->Height()/2)) < nPaintOfst ) { if( pPor->InSpaceGrp() && GetInfo().GetSpaceAdd() ) { tools::Long nTmp = GetInfo().X() +pPor->Width() + pPor->CalcSpacing( GetInfo().GetSpaceAdd(), GetInfo() ); - if( o3tl::narrowing<SwTwips>(nTmp + (pPor->Height()/2)) >= nPaintOfst ) + if( static_cast<SwTwips>(nTmp + (pPor->Height()/2)) >= nPaintOfst ) break; GetInfo().X( nTmp ); GetInfo().SetIdx( GetInfo().GetIdx() + pPor->GetLen() ); @@ -192,7 +192,7 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip, if( GetInfo().GetPos().X() < rPaint.Left() || GetInfo().GetPos().Y() < rPaint.Top() || - GetInfo().GetPos().Y() + o3tl::narrowing<SwTwips>(nTmpHeight) > rPaint.Top() + rPaint.Height() ) + GetInfo().GetPos().Y() + static_cast<SwTwips>(nTmpHeight) > rPaint.Top() + rPaint.Height() ) { bClip = false; rClip.ChgClip( rPaint, m_pFrame, m_pCurr->HasUnderscore() ); @@ -347,7 +347,7 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip, // A safety distance of half the height is added, so that // TTF-"f" isn't overlapping into the page margin. if( bClip && - o3tl::narrowing<SwTwips>(GetInfo().X() + pPor->Width() + ( pPor->Height() / 2 )) > nMaxRight ) + static_cast<SwTwips>(GetInfo().X() + pPor->Width() + ( pPor->Height() / 2 )) > nMaxRight ) { bClip = false; rClip.ChgClip( rPaint, m_pFrame, m_pCurr->HasUnderscore() ); @@ -480,7 +480,7 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip, SwTwips nDiff = GetInfo().Y() + nTmpHeight - nTmpAscent - GetTextFrame()->getFrameArea().Bottom(); if( ( nDiff > 0 && (GetEnd() < TextFrameIndex(GetInfo().GetText().getLength()) || - ( nDiff > o3tl::narrowing<SwTwips>(nTmpHeight)/2 && GetPrevLine() ) ) ) || + ( nDiff > static_cast<SwTwips>(nTmpHeight)/2 && GetPrevLine() ) ) ) || (nDiff >= 0 && bNextUndersized) ) { diff --git a/sw/source/core/text/itrtxt.cxx b/sw/source/core/text/itrtxt.cxx index 8e49e490f7e1..88c09c47e7ce 100644 --- a/sw/source/core/text/itrtxt.cxx +++ b/sw/source/core/text/itrtxt.cxx @@ -299,7 +299,7 @@ sal_uInt32 SwTextCursor::AdjustBaseLine( const SwLineLayout& rLine, void SwTextIter::TwipsToLine( const SwTwips y) { - while( m_nY + o3tl::narrowing<SwTwips>(GetLineHeight()) <= y && Next() ) + while( m_nY + static_cast<SwTwips>(GetLineHeight()) <= y && Next() ) ; while( m_nY > y && Prev() ) ; diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx index 26f3dcf56c98..6f576983ab55 100644 --- a/sw/source/core/text/porfld.cxx +++ b/sw/source/core/text/porfld.cxx @@ -594,10 +594,10 @@ bool SwNumberPortion::Format( SwTextFormatInfo &rInf ) // Height has to be changed if ( rInf.IsMulti() ) { - if ( o3tl::narrowing<SwTwips>(Height()) < nDiff ) + if ( static_cast<SwTwips>(Height()) < nDiff ) Height( sal_uInt16( nDiff ) ); } - else if( o3tl::narrowing<SwTwips>(Width()) < nDiff ) + else if( static_cast<SwTwips>(Width()) < nDiff ) Width( sal_uInt16(nDiff) ); } return bFull; @@ -868,7 +868,7 @@ bool SwGrfNumPortion::Format( SwTextFormatInfo &rInf ) SetHide( true ); } - if( o3tl::narrowing<SwTwips>(Width()) < nDiff ) + if( static_cast<SwTwips>(Width()) < nDiff ) Width( sal_uInt16(nDiff) ); return bFull; } @@ -1257,7 +1257,7 @@ bool SwCombinedPortion::Format( SwTextFormatInfo &rInf ) Height( Height() + nMainAscent - GetAscent() ); SetAscent( nMainAscent ); } - if( o3tl::narrowing<SwTwips>(Height()) < nMainAscent + nMainDescent ) + if( static_cast<SwTwips>(Height()) < nMainAscent + nMainDescent ) Height( nMainAscent + nMainDescent ); // We calculate the x positions of the characters in both lines... diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx index 0667db603fae..def38b80ee04 100644 --- a/sw/source/core/text/pormulti.cxx +++ b/sw/source/core/text/pormulti.cxx @@ -399,7 +399,7 @@ void SwDoubleLinePortion::FormatBrackets( SwTextFormatInfo &rInf, SwTwips& nMaxW m_pBracket->nAscent = rInf.GetAscent(); m_pBracket->nHeight = aSize.Height(); aTmpFnt.SetActual( nActualScr ); - if( nMaxWidth > o3tl::narrowing<SwTwips>(aSize.Width()) ) + if( nMaxWidth > static_cast<SwTwips>(aSize.Width()) ) { m_pBracket->nPreWidth = aSize.Width(); nMaxWidth -= aSize.Width(); @@ -428,7 +428,7 @@ void SwDoubleLinePortion::FormatBrackets( SwTextFormatInfo &rInf, SwTwips& nMaxW } if( aSize.Height() > m_pBracket->nHeight ) m_pBracket->nHeight = aSize.Height(); - if( nMaxWidth > o3tl::narrowing<SwTwips>(aSize.Width()) ) + if( nMaxWidth > static_cast<SwTwips>(aSize.Width()) ) { m_pBracket->nPostWidth = aSize.Width(); nMaxWidth -= aSize.Width(); @@ -2169,7 +2169,7 @@ bool SwTextFormatter::BuildMultiPortion( SwTextFormatInfo &rInf, // Setting this to the portion width ( = rMulti.Width() ) // can make GetTextBreak inside SwTextGuess::Guess return too small // values. Therefore we add some extra twips. - if( nActWidth > nTmpX + o3tl::narrowing<SwTwips>(rMulti.Width()) + 6 ) + if( nActWidth > nTmpX + static_cast<SwTwips>(rMulti.Width()) + 6 ) nActWidth = nTmpX + rMulti.Width() + 6; nMaxWidth = nActWidth; nActWidth = ( 3 * nMaxWidth + nMinWidth + 3 ) / 4; @@ -2520,7 +2520,7 @@ SwTextCursorSave::SwTextCursorSave( SwTextCursor* pCursor, { pCursor->m_nStart = nCurrStart; pCursor->m_pCurr = &pMulti->GetRoot(); - while( pCursor->Y() + o3tl::narrowing<SwTwips>(pCursor->GetLineHeight()) < nY && + while( pCursor->Y() + static_cast<SwTwips>(pCursor->GetLineHeight()) < nY && pCursor->Next() ) ; // nothing nWidth = pCursor->m_pCurr->Width(); diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx index 21a51e135b85..d8d48f3671dc 100644 --- a/sw/source/core/text/porrst.cxx +++ b/sw/source/core/text/porrst.cxx @@ -642,7 +642,7 @@ void SwControlCharPortion::Paint( const SwTextPaintInfo &rInf ) const Point aOldPos = rInf.GetPos(); Point aNewPos( aOldPos ); - auto const deltaX((o3tl::narrowing<SwTwips>(Width()) / 2) - mnHalfCharWidth); + auto const deltaX((static_cast<SwTwips>(Width()) / 2) - mnHalfCharWidth); switch (rInf.GetFont()->GetOrientation(rInf.GetTextFrame()->IsVertical()).get()) { case 0: commit 567c28545e6d067b7afe3d617540b921c39b1e18 Author: Aron Budea <aron.bu...@collabora.com> AuthorDate: Mon Oct 4 23:22:47 2021 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Tue Oct 5 14:43:16 2021 +0200 Partially revert "sw: replace most static_cast<sal_uInt16>()... ... calls with o3tl::narrowing()" Only the changes that enable 301278b656e76b6f42af5cf8a6f5c6c02acfffeb to be reverted easily in libreoffice-7-2. This reverts commit 2634bc59092b24217d984a5845365d703bdb08d2. Change-Id: Id43bcb8eb386d8aa49a6a0c3768abfc916cce717 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123088 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx index 9ea484912cff..8be43264f192 100644 --- a/sw/source/core/text/frmcrsr.cxx +++ b/sw/source/core/text/frmcrsr.cxx @@ -1418,7 +1418,7 @@ void SwTextFrame::FillCursorPos( SwFillData& rFill ) const if( nDiff > 0 ) { nDiff /= nDist; - rFill.Fill().nParaCnt = o3tl::narrowing<sal_uInt16>(nDiff + 1); + rFill.Fill().nParaCnt = static_cast<sal_uInt16>(nDiff + 1); rFill.nLineWidth = 0; rFill.bInner = false; rFill.bEmpty = true; diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index ddfc54bc6fc3..3e3b5d78af23 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -426,7 +426,7 @@ void SwTextSizeInfo::GetTextSize( const SwScriptInfo* pSI, const TextFrameIndex aDrawInf.SetSnapToGrid( SnapToGrid() ); aDrawInf.SetKanaComp( nComp ); SwPosSize aSize( m_pFnt->GetTextSize_( aDrawInf ) ); - nMaxSizeDiff = o3tl::narrowing<sal_uInt16>(aDrawInf.GetKanaDiff()); + nMaxSizeDiff = static_cast<sal_uInt16>(aDrawInf.GetKanaDiff()); nMinSize = aSize.Width(); } @@ -955,7 +955,7 @@ static void lcl_DrawSpecial( const SwTextPaintInfo& rTextPaintInfo, const SwLine Point aTmpPos( nX, nY ); rNonConstTextPaintInfo.SetPos( aTmpPos ); sal_uInt16 nOldWidth = rPor.Width(); - const_cast<SwLinePortion&>(rPor).Width( o3tl::narrowing<sal_uInt16>(aFontSize.Width()) ); + const_cast<SwLinePortion&>(rPor).Width( static_cast<sal_uInt16>(aFontSize.Width()) ); rTextPaintInfo.DrawText( aTmp, rPor ); const_cast<SwLinePortion&>(rPor).Width( nOldWidth ); rNonConstTextPaintInfo.SetFont( const_cast<SwFont*>(pOldFnt) ); diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx index 138359e68c41..64792666e80e 100644 --- a/sw/source/core/text/itrcrsr.cxx +++ b/sw/source/core/text/itrcrsr.cxx @@ -142,7 +142,7 @@ namespace { nListLevel = MAXLEVEL - 1; const SwNumFormat& rNumFormat = - rTextNode.GetNumRule()->Get( o3tl::narrowing<sal_uInt16>(nListLevel) ); + rTextNode.GetNumRule()->Get( static_cast<sal_uInt16>(nListLevel) ); if ( rNumFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) { bRet = true; @@ -1627,7 +1627,7 @@ TextFrameIndex SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con nTmpY = pPor->Height() - nTmpY; if( nTmpY < 0 ) nTmpY = 0; - nX = o3tl::narrowing<sal_uInt16>(nTmpY); + nX = static_cast<sal_uInt16>(nTmpY); } if( static_cast<SwMultiPortion*>(pPor)->HasBrackets() ) diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index 8e5a2b403e42..289905bc6f50 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -242,7 +242,7 @@ SwLinePortion *SwTextFormatter::Underflow( SwTextFormatInfo &rInf ) // line width is adjusted, so that pPor does not fit to current // line anymore - rInf.Width( o3tl::narrowing<sal_uInt16>(rInf.X() + (pPor->Width() ? pPor->Width() - 1 : 0)) ); + rInf.Width( static_cast<sal_uInt16>(rInf.X() + (pPor->Width() ? pPor->Width() - 1 : 0)) ); rInf.SetLen( pPor->GetLen() ); rInf.SetFull( false ); if( pFly ) @@ -431,7 +431,7 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf ) { SwFontScript nNxtActual = rInf.GetFont()->GetActual(); SwFontScript nLstActual = nNxtActual; - sal_uInt16 nLstHeight = o3tl::narrowing<sal_uInt16>(rInf.GetFont()->GetHeight()); + sal_uInt16 nLstHeight = static_cast<sal_uInt16>(rInf.GetFont()->GetHeight()); bool bAllowBehind = false; const CharClass& rCC = GetAppCharClass(); @@ -474,7 +474,7 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf ) if ( pTmpFnt ) { nLstActual = pTmpFnt->GetActual(); - nLstHeight = o3tl::narrowing<sal_uInt16>(pTmpFnt->GetHeight()); + nLstHeight = static_cast<sal_uInt16>(pTmpFnt->GetHeight()); } } } @@ -535,7 +535,7 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf ) const SwTwips nRestWidth = rInf.Width() - rInf.X(); if ( nKernWidth <= nRestWidth ) - pGridKernPortion->Width( o3tl::narrowing<sal_uInt16>(nKernWidth) ); + pGridKernPortion->Width( static_cast<sal_uInt16>(nKernWidth) ); } if ( pGridKernPortion != pPor ) @@ -622,7 +622,7 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf ) (m_pScriptInfo->ScriptType(nTmp - TextFrameIndex(1)) == css::i18n::ScriptType::ASIAN || m_pScriptInfo->ScriptType(nTmp) == css::i18n::ScriptType::ASIAN) ) { - const sal_uInt16 nDist = o3tl::narrowing<sal_uInt16>(rInf.GetFont()->GetHeight()/5); + const sal_uInt16 nDist = static_cast<sal_uInt16>(rInf.GetFont()->GetHeight()/5); if( nDist ) { @@ -677,7 +677,7 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf ) 0; const SwTwips nTmpWidth = i * nGridWidth; const SwTwips nKernWidth = std::min(nTmpWidth - nSumWidth, nRestWidth); - const sal_uInt16 nKernWidth_1 = o3tl::narrowing<sal_uInt16>(nKernWidth / 2); + const sal_uInt16 nKernWidth_1 = static_cast<sal_uInt16>(nKernWidth / 2); OSL_ENSURE( nKernWidth <= nRestWidth, "Not enough space left for adjusting non-asian text in grid mode" ); @@ -1488,7 +1488,7 @@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf ) PortionType::TabDecimal == pLastTabPortion->GetWhichPor() ) { OSL_ENSURE( rInf.X() >= pLastTabPortion->GetFix(), "Decimal tab stop position cannot be calculated" ); - const sal_uInt16 nWidthOfPortionsUpToDecimalPosition = o3tl::narrowing<sal_uInt16>(rInf.X() - pLastTabPortion->GetFix() ); + const sal_uInt16 nWidthOfPortionsUpToDecimalPosition = static_cast<sal_uInt16>(rInf.X() - pLastTabPortion->GetFix() ); static_cast<SwTabDecimalPortion*>(pLastTabPortion)->SetWidthOfPortionsUpToDecimalPosition( nWidthOfPortionsUpToDecimalPosition ); rInf.SetTabDecimal( 0 ); } @@ -1863,7 +1863,7 @@ void SwTextFormatter::CalcRealHeight( bool bNewLine ) nTmp = 100; nTmp *= nLineHeight; - nLineHeight = o3tl::narrowing<sal_uInt16>(nTmp / 100); + nLineHeight = static_cast<sal_uInt16>(nTmp / 100); } m_pCurr->SetRealHeight( nLineHeight ); @@ -1898,7 +1898,7 @@ void SwTextFormatter::CalcRealHeight( bool bNewLine ) nTmp /= 100; if( !nTmp ) ++nTmp; - nLineHeight = o3tl::narrowing<sal_uInt16>(nTmp); + nLineHeight = static_cast<sal_uInt16>(nTmp); sal_uInt16 nAsc = ( 4 * nLineHeight ) / 5; // 80% #if 0 // could do clipping here (like Word does) @@ -1956,7 +1956,7 @@ void SwTextFormatter::CalcRealHeight( bool bNewLine ) nTmp += nLineHeight; if (nTmp < 1) nTmp = 1; - nLineHeight = o3tl::narrowing<sal_uInt16>(nTmp); + nLineHeight = static_cast<sal_uInt16>(nTmp); break; } case SvxInterLineSpaceRule::Fix: @@ -2522,7 +2522,7 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo &rInf ) if( bForced ) { m_pCurr->SetForcedLeftMargin(); - rInf.ForcedLeftMargin( o3tl::narrowing<sal_uInt16>(aInter.Width()) ); + rInf.ForcedLeftMargin( static_cast<sal_uInt16>(aInter.Width()) ); } if( bFullLine ) @@ -2612,7 +2612,7 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo &rInf ) const tools::Long nNewWidth = ( i - 1 ) * nGridWidth - nOfst; if ( nNewWidth > 0 ) - rInf.Width( o3tl::narrowing<sal_uInt16>(nNewWidth) ); + rInf.Width( static_cast<sal_uInt16>(nNewWidth) ); else rInf.Width( 0 ); diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx index 4d589427850c..26f3dcf56c98 100644 --- a/sw/source/core/text/porfld.cxx +++ b/sw/source/core/text/porfld.cxx @@ -785,7 +785,7 @@ SwGrfNumPortion::SwGrfNumPortion( m_nYPos = 0; m_eOrient = text::VertOrientation::TOP; } - Width( o3tl::narrowing<sal_uInt16>(rGrfSize.Width() + 2 * GRFNUM_SECURE) ); + Width( static_cast<sal_uInt16>(rGrfSize.Width() + 2 * GRFNUM_SECURE) ); m_nFixWidth = Width(); m_nGrfHeight = rGrfSize.Height() + 2 * GRFNUM_SECURE; Height( sal_uInt16(m_nGrfHeight) ); @@ -834,7 +834,7 @@ bool SwGrfNumPortion::Format( SwTextFormatInfo &rInf ) if( bFull ) { - Width( rInf.Width() - o3tl::narrowing<sal_uInt16>(rInf.X()) ); + Width( rInf.Width() - static_cast<sal_uInt16>(rInf.X()) ); if( bFly ) { SetLen(TextFrameIndex(0)); @@ -1170,7 +1170,7 @@ bool SwCombinedPortion::Format( SwTextFormatInfo &rInf ) { rInf.GetOut()->SetFont( rInf.GetFont()->GetFnt( m_aScrType[i] ) ); m_aWidth[ m_aScrType[i] ] = - o3tl::narrowing<sal_uInt16>(2 * rInf.GetOut()->GetFontMetric().GetFontSize().Width() / 3); + static_cast<sal_uInt16>(2 * rInf.GetOut()->GetFontMetric().GetFontSize().Width() / 3); } } } @@ -1217,7 +1217,7 @@ bool SwCombinedPortion::Format( SwTextFormatInfo &rInf ) SwDrawTextInfo aDrawInf(pSh, *rInf.GetOut(), m_aExpand, i, 1); Size aSize = aTmpFont.GetTextSize_( aDrawInf ); const sal_uInt16 nAsc = aTmpFont.GetAscent( pSh, *rInf.GetOut() ); - m_aPos[ i ] = o3tl::narrowing<sal_uInt16>(aSize.Width()); + m_aPos[ i ] = static_cast<sal_uInt16>(aSize.Width()); if( i == nTop ) // enter the second line { m_nLowPos = nMaxDescent; @@ -1232,7 +1232,7 @@ bool SwCombinedPortion::Format( SwTextFormatInfo &rInf ) if( nAsc > nMaxAscent ) nMaxAscent = nAsc; if( aSize.Height() - nAsc > nMaxDescent ) - nMaxDescent = o3tl::narrowing<sal_uInt16>(aSize.Height() - nAsc); + nMaxDescent = static_cast<sal_uInt16>(aSize.Height() - nAsc); } // for one or two characters we double the width of the portion if( nCount < 3 ) @@ -1295,7 +1295,7 @@ bool SwCombinedPortion::Format( SwTextFormatInfo &rInf ) { if( rInf.GetLineStart() == rInf.GetIdx() && (!rInf.GetLast()->InFieldGrp() || !static_cast<SwFieldPortion*>(rInf.GetLast())->IsFollow() ) ) - Width( o3tl::narrowing<sal_uInt16>( rInf.Width() - rInf.X() ) ); + Width( static_cast<sal_uInt16>( rInf.Width() - rInf.X() ) ); else { Truncate(); diff --git a/sw/source/core/text/porfly.cxx b/sw/source/core/text/porfly.cxx index b999e3d7c354..000acd4bb61d 100644 --- a/sw/source/core/text/porfly.cxx +++ b/sw/source/core/text/porfly.cxx @@ -58,7 +58,7 @@ bool SwFlyPortion::Format( SwTextFormatInfo &rInf ) rInf.GetLastTab()->FormatEOL( rInf ); rInf.GetLast()->FormatEOL( rInf ); - PrtWidth( o3tl::narrowing<sal_uInt16>(GetFix() - rInf.X() + PrtWidth()) ); + PrtWidth( static_cast<sal_uInt16>(GetFix() - rInf.X() + PrtWidth()) ); if( !Width() ) { OSL_ENSURE( Width(), "+SwFlyPortion::Format: a fly is a fly is a fly" ); @@ -82,7 +82,7 @@ bool SwFlyPortion::Format( SwTextFormatInfo &rInf ) SetLen(TextFrameIndex(1)); } - const sal_uInt16 nNewWidth = o3tl::narrowing<sal_uInt16>(rInf.X() + PrtWidth()); + const sal_uInt16 nNewWidth = static_cast<sal_uInt16>(rInf.X() + PrtWidth()); if( rInf.Width() <= nNewWidth ) { Truncate(); @@ -431,7 +431,7 @@ void SwFlyCntPortion::SetBase( const SwTextFrame& rFrame, const Point &rBase, else { mnAscent = 0; - Height( Height() + o3tl::narrowing<sal_uInt16>(nRelPos) ); + Height( Height() + static_cast<sal_uInt16>(nRelPos) ); } } else diff --git a/sw/source/core/text/porlin.cxx b/sw/source/core/text/porlin.cxx index e0a157d9d579..035f670d464b 100644 --- a/sw/source/core/text/porlin.cxx +++ b/sw/source/core/text/porlin.cxx @@ -88,7 +88,7 @@ void SwLinePortion::PrePaint( const SwTextPaintInfo& rInf, sal_uInt16 nLastWidth = pLast->Width(); if ( pLast->InSpaceGrp() && rInf.GetSpaceAdd() ) - nLastWidth = nLastWidth + o3tl::narrowing<sal_uInt16>(pLast->CalcSpacing( rInf.GetSpaceAdd(), rInf )); + nLastWidth = nLastWidth + static_cast<sal_uInt16>(pLast->CalcSpacing( rInf.GetSpaceAdd(), rInf )); sal_uInt16 nPos; SwTextPaintInfo aInf( rInf ); @@ -246,7 +246,7 @@ bool SwLinePortion::Format( SwTextFormatInfo &rInf ) const SwLinePortion *pLast = rInf.GetLast(); Height( pLast->Height() ); SetAscent( pLast->GetAscent() ); - const sal_uInt16 nNewWidth = o3tl::narrowing<sal_uInt16>(rInf.X() + PrtWidth()); + const sal_uInt16 nNewWidth = static_cast<sal_uInt16>(rInf.X() + PrtWidth()); // Only portions with true width can return true // Notes for example never set bFull==true if( rInf.Width() <= nNewWidth && PrtWidth() && ! IsKernPortion() ) diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx index 55cb637e34ea..0667db603fae 100644 --- a/sw/source/core/text/pormulti.cxx +++ b/sw/source/core/text/pormulti.cxx @@ -654,9 +654,9 @@ void SwRubyPortion::Adjust_( SwTextFormatInfo &rInf ) TextFrameIndex nSub(0); switch ( m_nAdjustment ) { - case css::text::RubyAdjust_CENTER: nRight = o3tl::narrowing<sal_uInt16>(nLineDiff / 2); + case css::text::RubyAdjust_CENTER: nRight = static_cast<sal_uInt16>(nLineDiff / 2); [[fallthrough]]; - case css::text::RubyAdjust_RIGHT: nLeft = o3tl::narrowing<sal_uInt16>(nLineDiff - nRight); break; + case css::text::RubyAdjust_RIGHT: nLeft = static_cast<sal_uInt16>(nLineDiff - nRight); break; case css::text::RubyAdjust_BLOCK: nSub = TextFrameIndex(1); [[fallthrough]]; case css::text::RubyAdjust_INDENT_BLOCK: @@ -683,8 +683,8 @@ void SwRubyPortion::Adjust_( SwTextFormatInfo &rInf ) } if( nLineDiff > 1 ) { - nRight = o3tl::narrowing<sal_uInt16>(nLineDiff / 2); - nLeft = o3tl::narrowing<sal_uInt16>(nLineDiff - nRight); + nRight = static_cast<sal_uInt16>(nLineDiff / 2); + nLeft = static_cast<sal_uInt16>(nLineDiff - nRight); } break; } @@ -2545,7 +2545,7 @@ SwTextCursorSave::SwTextCursorSave( SwTextCursor* pCursor, } if( nSpaceAdd > 0 && !pMulti->HasTabulator() ) - pCursor->m_pCurr->Width( o3tl::narrowing<sal_uInt16>(nWidth + nSpaceAdd * sal_Int32(nSpaceCnt) / SPACING_PRECISION_FACTOR) ); + pCursor->m_pCurr->Width( static_cast<sal_uInt16>(nWidth + nSpaceAdd * sal_Int32(nSpaceCnt) / SPACING_PRECISION_FACTOR) ); // For a BidiPortion we have to calculate the offset from the // end of the portion diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx index 23f837d63051..21a51e135b85 100644 --- a/sw/source/core/text/porrst.cxx +++ b/sw/source/core/text/porrst.cxx @@ -243,7 +243,7 @@ SwArrowPortion::SwArrowPortion( const SwLinePortion &rPortion ) : SwArrowPortion::SwArrowPortion( const SwTextPaintInfo &rInf ) : m_bLeft( false ) { - Height( o3tl::narrowing<sal_uInt16>(rInf.GetTextFrame()->getFramePrintArea().Height()) ); + Height( static_cast<sal_uInt16>(rInf.GetTextFrame()->getFramePrintArea().Height()) ); m_aPos.setX( rInf.GetTextFrame()->getFrameArea().Left() + rInf.GetTextFrame()->getFramePrintArea().Right() ); m_aPos.setY( rInf.GetTextFrame()->getFrameArea().Top() + @@ -493,7 +493,7 @@ bool SwTextFrame::FillRegister( SwTwips& rRegStart, sal_uInt16& rRegDiff ) nTmp /= 100; if( !nTmp ) ++nTmp; - rRegDiff = o3tl::narrowing<sal_uInt16>(nTmp); + rRegDiff = static_cast<sal_uInt16>(nTmp); nNetHeight = rRegDiff; break; } diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx index ce39a3e9e1dc..e5ac47c692f7 100644 --- a/sw/source/core/text/txtdrop.cxx +++ b/sw/source/core/text/txtdrop.cxx @@ -775,7 +775,7 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTextFormatInfo &rInf m_aText[ nTmpIdx ] = aStr; m_aWishedHeight[ nTmpIdx ] = sal_uInt16(nWishedHeight); // save initial scaling factor - m_aFactor[ nTmpIdx ] = o3tl::narrowing<sal_uInt16>(nFactor); + m_aFactor[ nTmpIdx ] = static_cast<sal_uInt16>(nFactor); } bool bGrow = (pDrop->GetLen() != TextFrameIndex(0)); @@ -925,7 +925,7 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTextFormatInfo &rInf else { if ( bUseCache ) - m_aFactor[ nTmpIdx ] = o3tl::narrowing<sal_uInt16>(nFactor); + m_aFactor[ nTmpIdx ] = static_cast<sal_uInt16>(nFactor); nMin = nFactor; } @@ -982,7 +982,7 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTextFormatInfo &rInf bool SwDropPortion::Format( SwTextFormatInfo &rInf ) { bool bFull = false; - m_nFix = o3tl::narrowing<sal_uInt16>(rInf.X()); + m_nFix = static_cast<sal_uInt16>(rInf.X()); SwLayoutModeModifier aLayoutModeModifier( *rInf.GetOut() ); aLayoutModeModifier.SetAuto(); @@ -1020,7 +1020,7 @@ bool SwDropPortion::Format( SwTextFormatInfo &rInf ) Width(); // set values - pCurrPart->SetWidth( o3tl::narrowing<sal_uInt16>(nTmpWidth) ); + pCurrPart->SetWidth( static_cast<sal_uInt16>(nTmpWidth) ); // Move rInf.SetIdx( rInf.GetIdx() + pCurrPart->GetLen() ); @@ -1029,7 +1029,7 @@ bool SwDropPortion::Format( SwTextFormatInfo &rInf ) } SetJoinBorderWithNext(false); SetJoinBorderWithPrev(false); - Width( o3tl::narrowing<sal_uInt16>(rInf.X() - nOldX) ); + Width( static_cast<sal_uInt16>(rInf.X() - nOldX) ); } // reset my length @@ -1066,7 +1066,7 @@ bool SwDropPortion::Format( SwTextFormatInfo &rInf ) else { const sal_uInt16 nWant = Width() + GetDistance(); - const sal_uInt16 nRest = o3tl::narrowing<sal_uInt16>(rInf.Width() - rInf.X()); + const sal_uInt16 nRest = static_cast<sal_uInt16>(rInf.Width() - rInf.X()); if( ( nWant > nRest ) || lcl_IsDropFlyInter( rInf, Width() + GetDistance(), m_nDropHeight ) ) m_nDistance = 0; diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index ce0d6cc99c2f..a85f2977a8d4 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -3330,11 +3330,11 @@ sal_uInt32 SwTextFrame::GetParHeight() const if( !HasPara() ) { // For non-empty paragraphs this is a special case // For UnderSized we can simply just ask 1 Twip more - sal_uInt16 nRet = o3tl::narrowing<sal_uInt16>(getFramePrintArea().SSize().Height()); + sal_uInt16 nRet = static_cast<sal_uInt16>(getFramePrintArea().SSize().Height()); if( IsUndersized() ) { if( IsEmpty() || GetText().isEmpty() ) - nRet = o3tl::narrowing<sal_uInt16>(EmptyHeight()); + nRet = static_cast<sal_uInt16>(EmptyHeight()); else ++nRet; } @@ -3485,7 +3485,7 @@ void SwTextFrame::CalcAdditionalFirstLineOffset() nListLevel = MAXLEVEL - 1; const SwNumFormat& rNumFormat = - pTextNode->GetNumRule()->Get( o3tl::narrowing<sal_uInt16>(nListLevel) ); + pTextNode->GetNumRule()->Get( static_cast<sal_uInt16>(nListLevel) ); if ( rNumFormat.GetPositionAndSpaceMode() != SvxNumberFormat::LABEL_ALIGNMENT ) return; @@ -3732,7 +3732,7 @@ sal_uInt16 SwTextFrame::FirstLineHeight() const if ( !HasPara() ) { if( IsEmpty() && isFrameAreaDefinitionValid() ) - return IsVertical() ? o3tl::narrowing<sal_uInt16>(getFramePrintArea().Width()) : o3tl::narrowing<sal_uInt16>(getFramePrintArea().Height()); + return IsVertical() ? static_cast<sal_uInt16>(getFramePrintArea().Width()) : static_cast<sal_uInt16>(getFramePrintArea().Height()); return USHRT_MAX; } const SwParaPortion *pPara = GetPara();