[Libreoffice-commits] core.git: Branch 'libreoffice-7-2-2' - sw/source

Aron Budea (via logerrit) logerrit at kemper.freedesktop.org
Tue Oct 5 23:23:48 UTC 2021


 sw/source/core/text/frmcrsr.cxx  |    2 +-
 sw/source/core/text/frmform.cxx  |    4 ++--
 sw/source/core/text/frmpaint.cxx |    2 +-
 sw/source/core/text/inftxt.cxx   |    4 ++--
 sw/source/core/text/itrcrsr.cxx  |    2 +-
 sw/source/core/text/itrform2.cxx |    8 ++++----
 sw/source/core/text/itrpaint.cxx |   10 +++++-----
 sw/source/core/text/itrtxt.cxx   |    2 +-
 sw/source/core/text/porfld.cxx   |    8 ++++----
 sw/source/core/text/pormulti.cxx |    8 ++++----
 sw/source/core/text/porrst.cxx   |    2 +-
 11 files changed, 26 insertions(+), 26 deletions(-)

New commits:
commit c0553f63239f258b7e58176d2d44b96f2b7b3b72
Author:     Aron Budea <aron.budea at collabora.com>
AuthorDate: Mon Oct 4 23:35:31 2021 +0200
Commit:     Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
CommitDate: Wed Oct 6 01:23:13 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/+/123094
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.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:


More information about the Libreoffice-commits mailing list