[Libreoffice-commits] core.git: Branch 'private/mst/sw_redlinehide' - 46 commits - sw/source

Michael Stahl Michael.Stahl at cib.de
Wed May 23 09:58:17 UTC 2018


Rebased ref, commits from common ancestor:
commit 1f69ec72af274a5b6984b4d315bd5aa87953c89a
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Wed May 23 11:36:15 2018 +0200

    sw_redlinehide: SwDrawTextInfo conversion in frmpaint.cxx etc.
    
    Change-Id: I64bb3478b11888373d9b5e0c8d4716065a625f6c

diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx
index fe0ef8f78f63..c0ba1765beee 100644
--- a/sw/source/core/text/frmcrsr.cxx
+++ b/sw/source/core/text/frmcrsr.cxx
@@ -1465,7 +1465,7 @@ void SwTextFrame::FillCursorPos( SwFillData& rFill ) const
                 if( FILL_TAB != rFill.Mode() )
                 {
                     const OUString aTmp("  ");
-                    SwDrawTextInfo aDrawInf( pSh, *pOut, nullptr, aTmp, 0, 2 );
+                    SwDrawTextInfo aDrawInf( pSh, *pOut, aTmp, 0, 2 );
                     nSpace = pFnt->GetTextSize_( aDrawInf ).Width()/2;
                 }
                 if( rFill.X() >= nRight )
diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx
index 9d9107053399..3a7de75f3067 100644
--- a/sw/source/core/text/frmpaint.cxx
+++ b/sw/source/core/text/frmpaint.cxx
@@ -192,7 +192,7 @@ void SwExtraPainter::PaintExtra( SwTwips nY, long nAsc, long nMax, bool bRed )
     // Get script type of line numbering:
     pFnt->SetActual( SwScriptInfo::WhichFont( 0, &aTmp, nullptr ) );
 
-    SwDrawTextInfo aDrawInf( pSh, *pSh->GetOut(), nullptr, aTmp, 0, aTmp.getLength() );
+    SwDrawTextInfo aDrawInf( pSh, *pSh->GetOut(), aTmp, 0, aTmp.getLength() );
     aDrawInf.SetSpace( 0 );
     aDrawInf.SetWrong( nullptr );
     aDrawInf.SetGrammarCheck( nullptr );
@@ -547,7 +547,7 @@ bool SwTextFrame::PaintEmpty( const SwRect &rRect, bool bCheck ) const
                 if ( EmptyHeight( ) > 1 )
                 {
                     const OUString aTmp( CH_PAR );
-                    SwDrawTextInfo aDrawInf( pSh, *pSh->GetOut(), nullptr, aTmp, 0, 1 );
+                    SwDrawTextInfo aDrawInf( pSh, *pSh->GetOut(), aTmp, 0, 1 );
                     aDrawInf.SetPos( aPos );
                     aDrawInf.SetSpace( 0 );
                     aDrawInf.SetKanaComp( 0 );
diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index fb1e7fba9cb2..636121362f0a 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -1651,11 +1651,11 @@ TextFrameIndex SwTextCursor::GetCursorOfst( SwPosition *pPos, const Point &rPoin
                     // additional information:
                     aDrawInf.SetNumberOfBlanks( pPor->InTextGrp() ?
                                                 static_cast<const SwTextPortion*>(pPor)->GetSpaceCnt( aSizeInf, nCharCnt ) :
-                                                0 );
+                                                TextFrameIndex(0) );
                 }
 
                 if ( pPor->InFieldGrp() && pCMS && pCMS->m_pSpecialPos )
-                    aDrawInf.SetLen( COMPLETE_STRING );
+                    aDrawInf.SetLen( TextFrameIndex(COMPLETE_STRING) );
 
                 aDrawInf.SetSpace( nSpaceAdd );
                 aDrawInf.SetFont( aSizeInf.GetFont() );
diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index da26149b1725..0f0542ffc955 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -1213,7 +1213,7 @@ bool SwCombinedPortion::Format( SwTextFormatInfo &rInf )
                 aTmpFont.SetSize( aFontSize, nScrp );
             }
 
-            SwDrawTextInfo aDrawInf( pSh, *rInf.GetOut(), nullptr, m_aExpand, i, 1 );
+            SwDrawTextInfo aDrawInf(pSh, *rInf.GetOut(), m_aExpand, i, 1);
             Size aSize = aTmpFont.GetTextSize_( aDrawInf );
             const sal_uInt16 nAsc = aTmpFont.GetAscent( pSh, *rInf.GetOut() );
             aPos[ i ] = static_cast<sal_uInt16>(aSize.Width());
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index 785935e151ec..9a87329d4a26 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -529,7 +529,7 @@ void SwTextPortion::Paint( const SwTextPaintInfo &rInf ) const
         assert(false); // this is some debugging only code
         rInf.DrawBackBrush( *this );
         const OUString aText(CH_TXT_ATR_SUBST_FIELDEND);
-        rInf.DrawText( aText, *this, 0, aText.getLength() );
+        rInf.DrawText(aText, *this, TextFrameIndex(0), TextFrameIndex(aText.getLength()));
     }
     else if (rInf.OnWin() && TextFrameIndex(1) == rInf.GetLen()
         && CH_TXT_ATR_FIELDSTART == rInf.GetText()[sal_Int32(rInf.GetIdx())])
@@ -537,7 +537,7 @@ void SwTextPortion::Paint( const SwTextPaintInfo &rInf ) const
         assert(false); // this is some debugging only code
         rInf.DrawBackBrush( *this );
         const OUString aText(CH_TXT_ATR_SUBST_FIELDSTART);
-        rInf.DrawText( aText, *this, 0, aText.getLength() );
+        rInf.DrawText(aText, *this, TextFrameIndex(0), TextFrameIndex(aText.getLength()));
     }
     else if( GetLen() )
     {
diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx
index 0d698da79ab9..1ae7660a5bdd 100644
--- a/sw/source/core/text/txtfly.cxx
+++ b/sw/source/core/text/txtfly.cxx
@@ -469,22 +469,23 @@ void SwTextFly::DrawTextOpaque( SwDrawTextInfo &rInf )
     SwRect aRect( rInf.GetPos(), rInf.GetSize() );
     if( rInf.GetSpace() )
     {
-        sal_Int32 nTmpLen = COMPLETE_STRING == rInf.GetLen() ? rInf.GetText().getLength() :
-                                                      rInf.GetLen();
+        TextFrameIndex const nTmpLen = TextFrameIndex(COMPLETE_STRING) == rInf.GetLen()
+                ? TextFrameIndex(rInf.GetText().getLength())
+                : rInf.GetLen();
         if( rInf.GetSpace() > 0 )
         {
             sal_Int32 nSpaceCnt = 0;
-            const sal_Int32 nEndPos = rInf.GetIdx() + nTmpLen;
-            for( sal_Int32 nPos = rInf.GetIdx(); nPos < nEndPos; ++nPos )
+            const TextFrameIndex nEndPos = rInf.GetIdx() + nTmpLen;
+            for (TextFrameIndex nPos = rInf.GetIdx(); nPos < nEndPos; ++nPos)
             {
-                if( CH_BLANK == rInf.GetText()[ nPos ] )
+                if (CH_BLANK == rInf.GetText()[sal_Int32(nPos)])
                     ++nSpaceCnt;
             }
             if( nSpaceCnt )
                 aRect.Width( aRect.Width() + nSpaceCnt * rInf.GetSpace() );
         }
         else
-            aRect.Width( aRect.Width() - nTmpLen * rInf.GetSpace() );
+            aRect.Width( aRect.Width() - sal_Int32(nTmpLen) * rInf.GetSpace() );
     }
 
     if( aClipSave.IsOn() && rInf.GetOut().IsClipRegion() )
commit d44cd039faf3c44d537eca3c2fe9cfbb177746ae
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Wed May 23 11:37:20 2018 +0200

    sw_redlinehide: SwDrawTextInfo conversion in itratr.cxx
    
    Change-Id: Ibce3ce21e3ddeb762d082b641a4f5d49099b1a6d

diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index 612f23ff827f..1eff85d177f6 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -763,7 +763,7 @@ static bool lcl_MinMaxString( SwMinMaxArgs& rArg, SwFont* pFnt, const OUString &
         if( nStop > nEnd )
             nStop = nEnd;
 
-        SwDrawTextInfo aDrawInf( rArg.pSh, *rArg.pOut, nullptr, rText, nIdx, nStop - nIdx );
+        SwDrawTextInfo aDrawInf(rArg.pSh, *rArg.pOut, rText, nIdx, nStop - nIdx);
         long nCurrentWidth = pFnt->GetTextSize_( aDrawInf ).Width();
         rArg.nRowWidth += nCurrentWidth;
         if( bClear )
@@ -1038,7 +1038,7 @@ void SwTextNode::GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rM
             {
                 OUString sTmp( cChar );
                 SwDrawTextInfo aDrawInf( getIDocumentLayoutAccess().GetCurrentViewShell(),
-                    *pOut, nullptr, sTmp, 0, 1, 0, false );
+                    *pOut, sTmp, 0, 1, 0, false );
                 nCurrentWidth = aIter.GetFnt()->GetTextSize_( aDrawInf ).Width();
                 aArg.nWordWidth += nCurrentWidth;
                 aArg.nRowWidth += nCurrentWidth;
@@ -1261,7 +1261,7 @@ sal_uInt16 SwTextNode::GetScalingOfSelectedText( sal_Int32 nStt, sal_Int32 nEnd
         // calculate text widths up to cChar
         if ( nStop > nIdx )
         {
-            SwDrawTextInfo aDrawInf( pSh, *pOut, nullptr, GetText(), nIdx, nStop - nIdx );
+            SwDrawTextInfo aDrawInf(pSh, *pOut, GetText(), nIdx, nStop - nIdx);
             nProWidth += aIter.GetFnt()->GetTextSize_( aDrawInf ).Width();
         }
 
@@ -1278,7 +1278,7 @@ sal_uInt16 SwTextNode::GetScalingOfSelectedText( sal_Int32 nStt, sal_Int32 nEnd
         {
             // tab receives width of one space
             OUString sTmp( CH_BLANK );
-            SwDrawTextInfo aDrawInf( pSh, *pOut, nullptr, sTmp, 0, 1 );
+            SwDrawTextInfo aDrawInf( pSh, *pOut, sTmp, 0, 1 );
             nProWidth += aIter.GetFnt()->GetTextSize_( aDrawInf ).Width();
             nIdx++;
         }
@@ -1287,7 +1287,7 @@ sal_uInt16 SwTextNode::GetScalingOfSelectedText( sal_Int32 nStt, sal_Int32 nEnd
         else if ( cChar == CHAR_HARDBLANK || cChar == CHAR_HARDHYPHEN )
         {
             OUString sTmp( cChar );
-            SwDrawTextInfo aDrawInf( pSh, *pOut, nullptr, sTmp, 0, 1 );
+            SwDrawTextInfo aDrawInf( pSh, *pOut, sTmp, 0, 1 );
             nProWidth += aIter.GetFnt()->GetTextSize_( aDrawInf ).Width();
             nIdx++;
         }
@@ -1298,7 +1298,7 @@ sal_uInt16 SwTextNode::GetScalingOfSelectedText( sal_Int32 nStt, sal_Int32 nEnd
             case RES_TXTATR_FTN :
                 {
                     const OUString aText = pHint->GetFootnote().GetNumStr();
-                    SwDrawTextInfo aDrawInf( pSh, *pOut, nullptr, aText, 0, aText.getLength() );
+                    SwDrawTextInfo aDrawInf(pSh, *pOut, aText, 0, aText.getLength());
 
                     nProWidth += aIter.GetFnt()->GetTextSize_( aDrawInf ).Width();
                     break;
@@ -1309,7 +1309,7 @@ sal_uInt16 SwTextNode::GetScalingOfSelectedText( sal_Int32 nStt, sal_Int32 nEnd
                 {
                     SwField *pField = const_cast<SwField*>(pHint->GetFormatField().GetField());
                     OUString const aText = pField->ExpandField(true);
-                    SwDrawTextInfo aDrawInf( pSh, *pOut, nullptr, aText, 0, aText.getLength() );
+                    SwDrawTextInfo aDrawInf(pSh, *pOut, aText, 0, aText.getLength());
 
                     nProWidth += aIter.GetFnt()->GetTextSize_( aDrawInf ).Width();
                     break;
@@ -1356,7 +1356,7 @@ sal_uInt16 SwTextNode::GetScalingOfSelectedText( sal_Int32 nStt, sal_Int32 nEnd
     aIter.SeekAndChgAttrIter( nStt, pOut );
     pOut->SetMapMode( aOldMap );
 
-    SwDrawTextInfo aDrawInf( pSh, *pOut, nullptr, GetText(), nStt, 1 );
+    SwDrawTextInfo aDrawInf( pSh, *pOut, GetText(), nStt, 1 );
     return static_cast<sal_uInt16>( nWidth ? ((100 * aIter.GetFnt()->GetTextSize_( aDrawInf ).Height()) / nWidth ) : 0 );
 }
 
commit 829dec9687c919e4c72e28284a24dd214fd4c02a
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Wed May 23 11:34:15 2018 +0200

    sw_redlinehide: trivial conversions in swfont.cxx
    
    Change-Id: I41880720c0e9d076a8cbe6cb42fdbf70862f6544

diff --git a/sw/source/core/txtnode/swfont.cxx b/sw/source/core/txtnode/swfont.cxx
index 1cd73e40cc2a..82adaaa4b51c 100644
--- a/sw/source/core/txtnode/swfont.cxx
+++ b/sw/source/core/txtnode/swfont.cxx
@@ -1038,8 +1038,9 @@ Size SwSubFont::GetTextSize_( SwDrawTextInfo& rInf )
     SwDigitModeModifier aDigitModeModifier( rInf.GetOut(), rInf.GetFont()->GetLanguage() );
 
     Size aTextSize;
-    sal_Int32 nLn = ( rInf.GetLen() == COMPLETE_STRING ? rInf.GetText().getLength()
-                                                   : rInf.GetLen() );
+    TextFrameIndex const nLn = rInf.GetLen() == TextFrameIndex(COMPLETE_STRING)
+            ? TextFrameIndex(rInf.GetText().getLength())
+            : rInf.GetLen();
     rInf.SetLen( nLn );
     if( IsCapital() && nLn )
         aTextSize = GetCapitalSize( rInf );
@@ -1062,14 +1063,14 @@ Size SwSubFont::GetTextSize_( SwDrawTextInfo& rInf )
                 // If the length of the original string and the CaseMapped one
                 // are different, it is necessary to handle the given text part as
                 // a single snippet since its size may differ, too.
-                sal_Int32 nOldIdx(rInf.GetIdx());
-                sal_Int32 nOldLen(rInf.GetLen());
-                const OUString aSnippet(oldStr.copy(nOldIdx, nOldLen));
+                TextFrameIndex const nOldIdx(rInf.GetIdx());
+                TextFrameIndex const nOldLen(rInf.GetLen());
+                const OUString aSnippet(oldStr.copy(sal_Int32(nOldIdx), sal_Int32(nOldLen)));
                 const OUString aNewText(CalcCaseMap(aSnippet));
 
                 rInf.SetText( aNewText );
-                rInf.SetIdx( 0 );
-                rInf.SetLen( aNewText.getLength() );
+                rInf.SetIdx( TextFrameIndex(0) );
+                rInf.SetLen( TextFrameIndex(aNewText.getLength()) );
 
                 aTextSize = pLastFont->GetTextSize( rInf );
 
@@ -1097,26 +1098,28 @@ Size SwSubFont::GetTextSize_( SwDrawTextInfo& rInf )
         }
     }
 
-    if (1==rInf.GetLen() && CH_TXT_ATR_FIELDSTART==rInf.GetText()[rInf.GetIdx()])
+    if (TextFrameIndex(1) == rInf.GetLen()
+        && CH_TXT_ATR_FIELDSTART == rInf.GetText()[sal_Int32(rInf.GetIdx())])
     {
-        sal_Int32 nOldIdx(rInf.GetIdx());
-        sal_Int32 nOldLen(rInf.GetLen());
+        TextFrameIndex const nOldIdx(rInf.GetIdx());
+        TextFrameIndex const nOldLen(rInf.GetLen());
         const OUString aNewText(CH_TXT_ATR_SUBST_FIELDSTART);
         rInf.SetText( aNewText );
-        rInf.SetIdx( 0 );
-        rInf.SetLen( aNewText.getLength() );
+        rInf.SetIdx( TextFrameIndex(0) );
+        rInf.SetLen( TextFrameIndex(aNewText.getLength()) );
         aTextSize = pLastFont->GetTextSize( rInf );
         rInf.SetIdx( nOldIdx );
         rInf.SetLen( nOldLen );
     }
-    else if (1==rInf.GetLen() && CH_TXT_ATR_FIELDEND==rInf.GetText()[ rInf.GetIdx() ])
+    else if (TextFrameIndex(1) == rInf.GetLen()
+            && CH_TXT_ATR_FIELDEND == rInf.GetText()[sal_Int32(rInf.GetIdx())])
     {
-        sal_Int32 nOldIdx(rInf.GetIdx());
-        sal_Int32 nOldLen(rInf.GetLen());
+        TextFrameIndex const nOldIdx(rInf.GetIdx());
+        TextFrameIndex const nOldLen(rInf.GetLen());
         const OUString aNewText(CH_TXT_ATR_SUBST_FIELDEND);
         rInf.SetText( aNewText );
-        rInf.SetIdx( 0 );
-        rInf.SetLen( aNewText.getLength() );
+        rInf.SetIdx( TextFrameIndex(0) );
+        rInf.SetLen( TextFrameIndex(aNewText.getLength()) );
         aTextSize = pLastFont->GetTextSize( rInf );
         rInf.SetIdx( nOldIdx );
         rInf.SetLen( nOldLen );
@@ -1128,10 +1131,10 @@ Size SwSubFont::GetTextSize_( SwDrawTextInfo& rInf )
 void SwSubFont::DrawText_( SwDrawTextInfo &rInf, const bool bGrey )
 {
     rInf.SetGreyWave( bGrey );
-    sal_Int32 nLn = rInf.GetText().getLength();
+    TextFrameIndex const nLn(rInf.GetText().getLength());
     if( !rInf.GetLen() || !nLn )
         return;
-    if( COMPLETE_STRING == rInf.GetLen() )
+    if (TextFrameIndex(COMPLETE_STRING) == rInf.GetLen())
         rInf.SetLen( nLn );
 
     FontLineStyle nOldUnder = LINESTYLE_NONE;
@@ -1176,14 +1179,14 @@ void SwSubFont::DrawText_( SwDrawTextInfo &rInf, const bool bGrey )
                 // If the length of the original string and the CaseMapped one
                 // are different, it is necessary to handle the given text part as
                 // a single snippet since its size may differ, too.
-                sal_Int32 nOldIdx(rInf.GetIdx());
-                sal_Int32 nOldLen(rInf.GetLen());
-                const OUString aSnippet(oldStr.copy(nOldIdx, nOldLen));
+                TextFrameIndex const nOldIdx(rInf.GetIdx());
+                TextFrameIndex const nOldLen(rInf.GetLen());
+                const OUString aSnippet(oldStr.copy(sal_Int32(nOldIdx), sal_Int32(nOldLen)));
                 const OUString aNewText = CalcCaseMap(aSnippet);
 
                 rInf.SetText( aNewText );
-                rInf.SetIdx( 0 );
-                rInf.SetLen( aNewText.getLength() );
+                rInf.SetIdx( TextFrameIndex(0) );
+                rInf.SetLen( TextFrameIndex(aNewText.getLength()) );
 
                 pLastFont->DrawText( rInf );
 
@@ -1205,8 +1208,8 @@ void SwSubFont::DrawText_( SwDrawTextInfo &rInf, const bool bGrey )
         Size aFontSize = GetTextSize_( rInf );
         const OUString oldStr = rInf.GetText();
 
-        sal_Int32 nOldIdx = rInf.GetIdx();
-        sal_Int32 nOldLen = rInf.GetLen();
+        TextFrameIndex const nOldIdx = rInf.GetIdx();
+        TextFrameIndex const nOldLen = rInf.GetLen();
         long nSpace = 0;
         if( rInf.GetSpace() )
         {
@@ -1236,8 +1239,8 @@ void SwSubFont::DrawText_( SwDrawTextInfo &rInf, const bool bGrey )
 
         rInf.SetWidth( sal_uInt16(aFontSize.Width() + nSpace) );
         rInf.SetText( "  " );
-        rInf.SetIdx( 0 );
-        rInf.SetLen( 2 );
+        rInf.SetIdx( TextFrameIndex(0) );
+        rInf.SetLen( TextFrameIndex(2) );
         SetUnderline( nOldUnder );
         rInf.SetUnderFnt( nullptr );
 
@@ -1305,20 +1308,21 @@ void SwSubFont::DrawStretchText_( SwDrawTextInfo &rInf )
 
         if ( !IsCaseMap() )
             rInf.GetOut().DrawStretchText( aPos, rInf.GetWidth(),
-                            rInf.GetText(), rInf.GetIdx(), rInf.GetLen() );
+                rInf.GetText(), sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen()));
         else
-            rInf.GetOut().DrawStretchText( aPos, rInf.GetWidth(), CalcCaseMap(
-                            rInf.GetText() ), rInf.GetIdx(), rInf.GetLen() );
+            rInf.GetOut().DrawStretchText( aPos, rInf.GetWidth(),
+                    CalcCaseMap(rInf.GetText()),
+                    sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen()));
     }
 
     if( pUnderFnt && nOldUnder != LINESTYLE_NONE )
     {
         const OUString oldStr = rInf.GetText();
-        sal_Int32 nOldIdx = rInf.GetIdx();
-        sal_Int32 nOldLen = rInf.GetLen();
+        TextFrameIndex const nOldIdx = rInf.GetIdx();
+        TextFrameIndex const nOldLen = rInf.GetLen();
         rInf.SetText( "  " );
-        rInf.SetIdx( 0 );
-        rInf.SetLen( 2 );
+        rInf.SetIdx( TextFrameIndex(0) );
+        rInf.SetLen( TextFrameIndex(2) );
         SetUnderline( nOldUnder );
         rInf.SetUnderFnt( nullptr );
 
@@ -1343,10 +1347,11 @@ TextFrameIndex SwSubFont::GetCursorOfst_( SwDrawTextInfo& rInf )
 
     SwDigitModeModifier aDigitModeModifier( rInf.GetOut(), rInf.GetFont()->GetLanguage() );
 
-    sal_Int32 nLn = rInf.GetLen() == COMPLETE_STRING ? rInf.GetText().getLength()
-                                                 : rInf.GetLen();
+    TextFrameIndex const nLn = rInf.GetLen() == TextFrameIndex(COMPLETE_STRING)
+            ? TextFrameIndex(rInf.GetText().getLength())
+            : rInf.GetLen();
     rInf.SetLen( nLn );
-    sal_Int32 nCursor = 0;
+    TextFrameIndex nCursor(0);
     if( IsCapital() && nLn )
         nCursor = GetCapitalCursorOfst( rInf );
     else
commit 20e994b03ab914628050c92c6f7f509d2327445e
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Wed May 23 11:33:19 2018 +0200

    sw_redlinehide: trivial conversions in fntcache.cxx, part 2
    
    Change-Id: I7d0bd7c2bfa84914a0659123b75282e7d0c54f1f

diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index f6bcb5a403e3..a2eaf20eb3e2 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -1805,8 +1805,9 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
 Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf )
 {
     Size aTextSize;
-    const sal_Int32 nLn = ( COMPLETE_STRING != rInf.GetLen() ) ? rInf.GetLen() :
-                           rInf.GetText().getLength();
+    const TextFrameIndex nLn = (TextFrameIndex(COMPLETE_STRING) != rInf.GetLen())
+        ? rInf.GetLen()
+        : TextFrameIndex(rInf.GetText().getLength());
 
     // be sure to have the correct layout mode at the printer
     if ( m_pPrinter )
@@ -1835,8 +1836,8 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf )
             else
                 pOutDev = rInf.GetpOut();
 
-            aTextSize.setWidth(
-                    pOutDev->GetTextWidth( rInf.GetText(), rInf.GetIdx(), nLn ) );
+            aTextSize.setWidth( pOutDev->GetTextWidth(rInf.GetText(),
+                        sal_Int32(rInf.GetIdx()), sal_Int32(nLn)) );
 
             OSL_ENSURE( !rInf.GetShell() ||
                     ( USHRT_MAX != GetGuessedLeading() && USHRT_MAX != GetExternalLeading() ),
@@ -1844,13 +1845,13 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf )
             aTextSize.setHeight( pOutDev->GetTextHeight() +
                                 GetFontLeading( rInf.GetShell(), rInf.GetOut() ) );
 
-            long nAvgWidthPerChar = aTextSize.Width() / nLn;
+            long nAvgWidthPerChar = aTextSize.Width() / sal_Int32(nLn);
 
             const sal_uLong i = nAvgWidthPerChar ?
                             ( nAvgWidthPerChar - 1 ) / nGridWidth + 1:
                             1;
 
-            aTextSize.setWidth( i * nGridWidth * nLn );
+            aTextSize.setWidth(i * nGridWidth * sal_Int32(nLn));
             rInf.SetKanaDiff( 0 );
             return aTextSize;
         }
@@ -1872,10 +1873,11 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf )
             }
             else
                 pOutDev = rInf.GetpOut();
-            aTextSize.setWidth( pOutDev->GetTextWidth( rInf.GetText(), rInf.GetIdx(), nLn ) );
+            aTextSize.setWidth(pOutDev->GetTextWidth(rInf.GetText(),
+                        sal_Int32(rInf.GetIdx()), sal_Int32(nLn)));
             aTextSize.setHeight( pOutDev->GetTextHeight() +
                                 GetFontLeading( rInf.GetShell(), rInf.GetOut() ) );
-            aTextSize.AdjustWidth(nLn * nGridWidthAdd );
+            aTextSize.AdjustWidth(sal_Int32(nLn) * nGridWidthAdd);
             //if ( rInf.GetKern() && nLn )
             //    aTextSize.Width() += ( nLn ) * long( rInf.GetKern() );
 
@@ -1901,15 +1903,16 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf )
         if( !m_pPrtFont->IsSameInstance( m_pPrinter->GetFont() ) )
             m_pPrinter->SetFont(*m_pPrtFont);
         aTextSize.setWidth( m_pPrinter->GetTextWidth( rInf.GetText(),
-                                                   rInf.GetIdx(), nLn ) );
+                               sal_Int32(rInf.GetIdx()), sal_Int32(nLn)));
         aTextSize.setHeight( m_pPrinter->GetTextHeight() );
-        long* pKernArray = new long[nLn];
+        long* pKernArray = new long[sal_Int32(nLn)];
         CreateScrFont( *rInf.GetShell(), rInf.GetOut() );
         if( !GetScrFont()->IsSameInstance( rInf.GetOut().GetFont() ) )
             rInf.GetOut().SetFont( *m_pScrFont );
         long nScrPos;
 
-        m_pPrinter->GetTextArray( rInf.GetText(), pKernArray, rInf.GetIdx(),nLn );
+        m_pPrinter->GetTextArray(rInf.GetText(), pKernArray,
+                sal_Int32(rInf.GetIdx()), sal_Int32(nLn));
         if( bCompress )
             rInf.SetKanaDiff( rInf.GetScriptInfo()->Compress( pKernArray,
                 rInf.GetIdx(), nLn, rInf.GetKanaComp(),
@@ -1918,20 +1921,20 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf )
             rInf.SetKanaDiff( 0 );
 
         if ( rInf.GetKanaDiff() )
-            nScrPos = pKernArray[ nLn - 1 ];
+            nScrPos = pKernArray[ sal_Int32(nLn) - 1 ];
         else
         {
-            std::unique_ptr<long[]> pScrArray( new long[ rInf.GetLen() ] );
+            std::unique_ptr<long[]> pScrArray(new long[sal_Int32(rInf.GetLen())]);
             rInf.GetOut().GetTextArray( rInf.GetText(), pScrArray.get(),
-                                        rInf.GetIdx(), rInf.GetLen() );
+                        sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen()));
             nScrPos = pScrArray[ 0 ];
-            sal_Int32 nCnt = rInf.GetText().getLength();
+            TextFrameIndex nCnt(rInf.GetText().getLength());
             if ( nCnt < rInf.GetIdx() )
-                nCnt=0;
+                nCnt = TextFrameIndex(0); // assert???
             else
                 nCnt = nCnt - rInf.GetIdx();
-            nCnt = std::min<sal_Int32>(nCnt, nLn);
-            sal_Unicode nChPrev = rInf.GetText()[ rInf.GetIdx() ];
+            nCnt = std::min(nCnt, nLn);
+            sal_Unicode nChPrev = rInf.GetText()[ sal_Int32(rInf.GetIdx()) ];
 
             sal_Unicode nCh;
 
@@ -1939,9 +1942,9 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf )
             // grows
             const int nMul = m_pPrtFont->GetKerning() != FontKerning::NONE ? 1 : 3;
             const int nDiv = nMul+1;
-            for( sal_Int32 i = 1; i<nCnt; i++ )
+            for (sal_Int32 i = 1; i < sal_Int32(nCnt); i++)
             {
-                nCh = rInf.GetText()[ rInf.GetIdx() + i ];
+                nCh = rInf.GetText()[ sal_Int32(rInf.GetIdx()) + i ];
                 long nScr;
                 nScr = pScrArray[ i ] - pScrArray[ i - 1 ];
                 if ( nCh == CH_BLANK )
@@ -1970,18 +1973,18 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf )
             rInf.GetOut().SetFont( *m_pPrtFont );
         if( bCompress )
         {
-            std::unique_ptr<long[]> pKernArray( new long[nLn] );
+            std::unique_ptr<long[]> pKernArray( new long[sal_Int32(nLn)] );
             rInf.GetOut().GetTextArray( rInf.GetText(), pKernArray.get(),
-                                        rInf.GetIdx(), nLn );
+                                sal_Int32(rInf.GetIdx()), sal_Int32(nLn));
             rInf.SetKanaDiff( rInf.GetScriptInfo()->Compress( pKernArray.get(),
                 rInf.GetIdx(), nLn, rInf.GetKanaComp(),
                 static_cast<sal_uInt16>(m_aFont.GetFontSize().Height()) ,lcl_IsFullstopCentered( rInf.GetOut() ) ) );
-            aTextSize.setWidth( pKernArray[ nLn - 1 ] );
+            aTextSize.setWidth( pKernArray[sal_Int32(nLn) - 1] );
         }
         else
         {
             aTextSize.setWidth( rInf.GetOut().GetTextWidth( rInf.GetText(),
-                                                           rInf.GetIdx(), nLn,
+                                   sal_Int32(rInf.GetIdx()), sal_Int32(nLn),
                                                            rInf.GetVclCache()) );
             rInf.SetKanaDiff( 0 );
         }
@@ -1990,7 +1993,7 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf )
     }
 
     if ( rInf.GetKern() && nLn )
-        aTextSize.AdjustWidth(( nLn - 1 ) * rInf.GetKern() );
+        aTextSize.AdjustWidth((sal_Int32(nLn) - 1) * rInf.GetKern());
 
     OSL_ENSURE( !rInf.GetShell() ||
             ( USHRT_MAX != GetGuessedLeading() && USHRT_MAX != GetExternalLeading() ),
@@ -2008,7 +2011,7 @@ TextFrameIndex SwFntObj::GetCursorOfst(SwDrawTextInfo &rInf)
     if( 0 != nSperren )
         nKern -= nSperren;
 
-    std::unique_ptr<long[]> pKernArray( new long[ rInf.GetLen() ] );
+    std::unique_ptr<long[]> pKernArray(new long[sal_Int32(rInf.GetLen())]);
 
     // be sure to have the correct layout mode at the printer
     if ( m_pPrinter )
@@ -2016,11 +2019,11 @@ TextFrameIndex SwFntObj::GetCursorOfst(SwDrawTextInfo &rInf)
         m_pPrinter->SetLayoutMode( rInf.GetOut().GetLayoutMode() );
         m_pPrinter->SetDigitLanguage( rInf.GetOut().GetDigitLanguage() );
         m_pPrinter->GetTextArray( rInf.GetText(), pKernArray.get(),
-                                rInf.GetIdx(), rInf.GetLen() );
+                sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen()));
     }
     else
         rInf.GetOut().GetTextArray( rInf.GetText(), pKernArray.get(),
-                                    rInf.GetIdx(), rInf.GetLen() );
+                sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen()));
 
     const SwScriptInfo* pSI = rInf.GetScriptInfo();
     if ( rInf.GetFont() && rInf.GetLen() )
@@ -2086,7 +2089,7 @@ TextFrameIndex SwFntObj::GetCursorOfst(SwDrawTextInfo &rInf)
 
     long nLeft = 0;
     long nRight = 0;
-    sal_Int32 nCnt = 0;
+    TextFrameIndex nCnt(0);
     long nSpaceSum = 0;
     long nKernSum = 0;
 
@@ -2099,7 +2102,7 @@ TextFrameIndex SwFntObj::GetCursorOfst(SwDrawTextInfo &rInf)
             const SwDoc* pDoc = rInf.GetShell()->GetDoc();
             const sal_uInt16 nGridWidth = GetGridWidth(*pGrid, *pDoc);
 
-            long nAvgWidthPerChar = pKernArray[ rInf.GetLen() - 1 ] / rInf.GetLen();
+            long nAvgWidthPerChar = pKernArray[sal_Int32(rInf.GetLen()) - 1] / sal_Int32(rInf.GetLen());
 
             sal_uLong i = nAvgWidthPerChar ?
                       ( nAvgWidthPerChar - 1 ) / nGridWidth + 1:
@@ -2107,8 +2110,9 @@ TextFrameIndex SwFntObj::GetCursorOfst(SwDrawTextInfo &rInf)
 
             nAvgWidthPerChar = i * nGridWidth;
 
-            nCnt = rInf.GetOfst() / nAvgWidthPerChar;
-            if ( 2 * ( rInf.GetOfst() - nCnt * nAvgWidthPerChar ) > nAvgWidthPerChar )
+// stupid CLANG
+            nCnt = TextFrameIndex(rInf.GetOfst() / nAvgWidthPerChar);
+            if (2 * (rInf.GetOfst() - sal_Int32(nCnt) * nAvgWidthPerChar) > nAvgWidthPerChar)
                 ++nCnt;
 
             return nCnt;
@@ -2124,9 +2128,9 @@ TextFrameIndex SwFntObj::GetCursorOfst(SwDrawTextInfo &rInf)
 
             const long nGridWidthAdd = EvalGridWidthAdd( pGrid, rInf );
 
-            for(sal_Int32 j = 0; j < rInf.GetLen(); j++)
+            for (TextFrameIndex j = TextFrameIndex(0); j < rInf.GetLen(); j++)
             {
-                long nScr = pKernArray[ j ] + ( nSpaceAdd + nGridWidthAdd  ) * ( j + 1 );
+                long nScr = pKernArray[sal_Int32(j)] + (nSpaceAdd + nGridWidthAdd) * (sal_Int32(j) + 1);
                 if( nScr >= rInf.GetOfst())
                 {
                     nCnt = j;
@@ -2138,9 +2142,9 @@ TextFrameIndex SwFntObj::GetCursorOfst(SwDrawTextInfo &rInf)
     }
 
     sal_Int32 nDone = 0;
-    sal_Int32 nIdx = rInf.GetIdx();
-    sal_Int32 nLastIdx = nIdx;
-    const sal_Int32 nEnd = rInf.GetIdx() + rInf.GetLen();
+    TextFrameIndex nIdx = rInf.GetIdx();
+    TextFrameIndex nLastIdx = nIdx;
+    const TextFrameIndex nEnd = rInf.GetIdx() + rInf.GetLen();
 
     // #i105901#
     // skip character cells for all script types
@@ -2148,20 +2152,21 @@ TextFrameIndex SwFntObj::GetCursorOfst(SwDrawTextInfo &rInf)
 
     while ( ( nRight < long( rInf.GetOfst() ) ) && ( nIdx < nEnd ) )
     {
-        if ( nSpaceAdd && CH_BLANK == rInf.GetText()[ nIdx ] )
+        if (nSpaceAdd && CH_BLANK == rInf.GetText()[ sal_Int32(nIdx)])
             nSpaceSum += nSpaceAdd;
 
         // go to next character (cell).
         nLastIdx = nIdx;
 
-        nIdx = g_pBreakIt->GetBreakIter()->nextCharacters( rInf.GetText(),
-                    nIdx, g_pBreakIt->GetLocale( aLang ),
-                    i18n::CharacterIteratorMode::SKIPCELL, 1, nDone );
+        nIdx = TextFrameIndex(g_pBreakIt->GetBreakIter()->nextCharacters(
+                    rInf.GetText(), sal_Int32(nIdx),
+                    g_pBreakIt->GetLocale( aLang ),
+                    i18n::CharacterIteratorMode::SKIPCELL, 1, nDone));
         if ( nIdx <= nLastIdx )
             break;
 
         nLeft = nRight;
-        nRight = pKernArray[ nIdx - rInf.GetIdx() - 1 ] + nKernSum + nSpaceSum;
+        nRight = pKernArray[sal_Int32(nIdx - rInf.GetIdx()) - 1] + nKernSum + nSpaceSum;
 
         nKernSum += nKern;
     }
@@ -2305,11 +2310,11 @@ TextFrameIndex SwFont::GetTextBreak(SwDrawTextInfo const & rInf, long nTextWidth
     OSL_ENSURE( !bCompress || ( rInf.GetScriptInfo() && rInf.GetScriptInfo()->
             CountCompChg()), "Compression without info" );
 
-    sal_Int32 nTextBreak = 0;
+    TextFrameIndex nTextBreak(0);
     long nKern = 0;
 
-    sal_Int32 nLn = rInf.GetLen() == COMPLETE_STRING
-        ? rInf.GetText().getLength() : rInf.GetLen();
+    TextFrameIndex nLn = rInf.GetLen() == TextFrameIndex(COMPLETE_STRING)
+        ? TextFrameIndex(rInf.GetText().getLength()) : rInf.GetLen();
 
     if ( rInf.GetFrame() && nLn && rInf.SnapToGrid() &&
          rInf.GetFont() && SwFontScript::CJK == rInf.GetFont()->GetActual() )
@@ -2320,11 +2325,11 @@ TextFrameIndex SwFont::GetTextBreak(SwDrawTextInfo const & rInf, long nTextWidth
             const SwDoc* pDoc = rInf.GetShell()->GetDoc();
             const sal_uInt16 nGridWidth = GetGridWidth(*pGrid, *pDoc);
 
-            std::unique_ptr<long[]> pKernArray( new long[rInf.GetLen()] );
+            std::unique_ptr<long[]> pKernArray(new long[sal_Int32(rInf.GetLen())]);
             rInf.GetOut().GetTextArray( rInf.GetText(), pKernArray.get(),
-                                        rInf.GetIdx(), rInf.GetLen() );
+                    sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen()));
 
-            long nAvgWidthPerChar = pKernArray[ rInf.GetLen() - 1 ] / rInf.GetLen();
+            long nAvgWidthPerChar = pKernArray[sal_Int32(rInf.GetLen()) - 1] / sal_Int32(rInf.GetLen());
 
             const sal_uLong i = nAvgWidthPerChar ?
                             ( nAvgWidthPerChar - 1 ) / nGridWidth + 1:
@@ -2351,13 +2356,13 @@ TextFrameIndex SwFont::GetTextBreak(SwDrawTextInfo const & rInf, long nTextWidth
         {
             const long nGridWidthAdd = EvalGridWidthAdd( pGrid, rInf );
 
-            std::unique_ptr<long[]> pKernArray( new long[rInf.GetLen()] );
+            std::unique_ptr<long[]> pKernArray(new long[sal_Int32(rInf.GetLen())] );
             rInf.GetOut().GetTextArray( rInf.GetText(), pKernArray.get(),
-                                            rInf.GetIdx(), rInf.GetLen() );
-            long nCurrPos = pKernArray[nTextBreak] + nGridWidthAdd;
+                        sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen()));
+            long nCurrPos = pKernArray[sal_Int32(nTextBreak)] + nGridWidthAdd;
             while (++nTextBreak < rInf.GetLen() && nTextWidth >= nCurrPos)
             {
-                nCurrPos = pKernArray[nTextBreak] + nGridWidthAdd * ( nTextBreak + 1 );
+                nCurrPos = pKernArray[sal_Int32(nTextBreak)] + nGridWidthAdd * (sal_Int32(nTextBreak) + 1);
             }
             return nTextBreak + rInf.GetIdx();
         }
@@ -2375,8 +2380,8 @@ TextFrameIndex SwFont::GetTextBreak(SwDrawTextInfo const & rInf, long nTextWidth
 
         const OUString* pTmpText;
         OUString aTmpText;
-        sal_Int32 nTmpIdx;
-        sal_Int32 nTmpLen;
+        TextFrameIndex nTmpIdx;
+        TextFrameIndex nTmpLen;
         bool bTextReplaced = false;
 
         if ( !m_aSub[m_nActual].IsCaseMap() )
@@ -2387,7 +2392,7 @@ TextFrameIndex SwFont::GetTextBreak(SwDrawTextInfo const & rInf, long nTextWidth
         }
         else
         {
-            const OUString aSnippet(rInf.GetText().copy(rInf.GetIdx(), nLn));
+            const OUString aSnippet(rInf.GetText().copy(sal_Int32(rInf.GetIdx()), sal_Int32(nLn)));
             aTmpText = m_aSub[m_nActual].CalcCaseMap( aSnippet );
             const bool bTitle = SvxCaseMap::Capitalize == m_aSub[m_nActual].GetCaseMap();
 
@@ -2396,7 +2401,7 @@ TextFrameIndex SwFont::GetTextBreak(SwDrawTextInfo const & rInf, long nTextWidth
             {
                 // check if rInf.GetIdx() is begin of word
                 if ( !g_pBreakIt->GetBreakIter()->isBeginWord(
-                     rInf.GetText(), rInf.GetIdx(),
+                     rInf.GetText(), sal_Int32(rInf.GetIdx()),
                      g_pBreakIt->GetLocale( m_aSub[m_nActual].GetLanguage() ),
                      i18n::WordType::ANYWORD_IGNOREWHITESPACES ) )
                 {
@@ -2408,23 +2413,27 @@ TextFrameIndex SwFont::GetTextBreak(SwDrawTextInfo const & rInf, long nTextWidth
             }
 
             pTmpText = &aTmpText;
-            nTmpIdx = 0;
-            nTmpLen = aTmpText.getLength();
+            nTmpIdx = TextFrameIndex(0);
+            nTmpLen = TextFrameIndex(aTmpText.getLength());
             bTextReplaced = true;
         }
 
         if( rInf.GetHyphPos() ) {
-            sal_Int32 nHyphPos = *rInf.GetHyphPos();
-            nTextBreak = rInf.GetOut().GetTextBreak( *pTmpText, nTextWidth,
+            sal_Int32 nHyphPos = sal_Int32(*rInf.GetHyphPos());
+            nTextBreak = TextFrameIndex(rInf.GetOut().GetTextBreak(
+                             *pTmpText, nTextWidth,
                              u'-', nHyphPos,
-                             nTmpIdx, nTmpLen, nKern, rInf.GetVclCache());
-            *rInf.GetHyphPos() = (nHyphPos == -1) ? COMPLETE_STRING : nHyphPos;
+                             sal_Int32(nTmpIdx), sal_Int32(nTmpLen),
+                             nKern, rInf.GetVclCache()));
+            *rInf.GetHyphPos() = TextFrameIndex((nHyphPos == -1) ? COMPLETE_STRING : nHyphPos);
         }
         else
-            nTextBreak = rInf.GetOut().GetTextBreak( *pTmpText, nTextWidth,
-                             nTmpIdx, nTmpLen, nKern, rInf.GetVclCache());
+            nTextBreak = TextFrameIndex(rInf.GetOut().GetTextBreak(
+                             *pTmpText, nTextWidth,
+                             sal_Int32(nTmpIdx), sal_Int32(nTmpLen),
+                             nKern, rInf.GetVclCache()));
 
-        if ( bTextReplaced && nTextBreak != -1 )
+        if (bTextReplaced && sal_Int32(nTextBreak) != -1)
         {
             if ( nTmpLen != nLn )
                 nTextBreak = sw_CalcCaseMap( *this, rInf.GetText(),
@@ -2434,7 +2443,9 @@ TextFrameIndex SwFont::GetTextBreak(SwDrawTextInfo const & rInf, long nTextWidth
         }
     }
 
-    sal_Int32 nTextBreak2 = nTextBreak == -1 ? COMPLETE_STRING : nTextBreak;
+    TextFrameIndex nTextBreak2 = sal_Int32(nTextBreak) == -1
+            ? TextFrameIndex(COMPLETE_STRING)
+            : nTextBreak;
 
     if ( ! bCompress )
         return nTextBreak2;
@@ -2444,21 +2455,21 @@ TextFrameIndex SwFont::GetTextBreak(SwDrawTextInfo const & rInf, long nTextWidth
     if( nTextBreak2 < nLn )
     {
         if( !nTextBreak2 && nLn )
-            nLn = 1;
-        else if( nLn > 2 * nTextBreak2 )
-            nLn = 2 * nTextBreak2;
-        std::unique_ptr<long[]> pKernArray( new long[ nLn ] );
+            nLn = TextFrameIndex(1);
+        else if (nLn > nTextBreak2 + nTextBreak2)
+            nLn = nTextBreak2 + nTextBreak2;
+        std::unique_ptr<long[]> pKernArray( new long[sal_Int32(nLn)] );
         rInf.GetOut().GetTextArray( rInf.GetText(), pKernArray.get(),
-                                    rInf.GetIdx(), nLn );
+                                    sal_Int32(rInf.GetIdx()), sal_Int32(nLn));
         if( rInf.GetScriptInfo()->Compress( pKernArray.get(), rInf.GetIdx(), nLn,
                             rInf.GetKanaComp(), static_cast<sal_uInt16>(GetHeight( m_nActual )),
                             lcl_IsFullstopCentered( rInf.GetOut() ) ) )
         {
             long nKernAdd = nKern;
-            sal_Int32 nTmpBreak = nTextBreak2;
+            TextFrameIndex const nTmpBreak = nTextBreak2;
             if( nKern && nTextBreak2 )
-                nKern *= nTextBreak2 - 1;
-            while( nTextBreak2<nLn && nTextWidth >= pKernArray[nTextBreak2] +nKern )
+                nKern *= sal_Int32(nTextBreak2) - 1;
+            while (nTextBreak2 < nLn && nTextWidth >= pKernArray[sal_Int32(nTextBreak2)] + nKern)
             {
                 nKern += nKernAdd;
                 ++nTextBreak2;
commit d00ee391a8629e882cb75d3ff71558f75e2cefb7
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Wed May 23 11:32:31 2018 +0200

    sw_redlinehide: trivial conversions in fntcache.cxx, part 1
    
    Change-Id: I3564ad15d3913a6de4f6f978d8a357e3ff18e52f

diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 18e35fc38913..f6bcb5a403e3 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -186,7 +186,7 @@ struct CalcLinePosData
 {
     SwDrawTextInfo& rInf;
     vcl::Font& rFont;
-    sal_Int32 nCnt;
+    TextFrameIndex nCnt;
     const bool bSwitchH2V;
     const bool bSwitchL2R;
     long nHalfSpace;
@@ -194,7 +194,7 @@ struct CalcLinePosData
     const bool bBidiPor;
 
     CalcLinePosData( SwDrawTextInfo& _rInf, vcl::Font& _rFont,
-                      sal_Int32 _nCnt, const bool _bSwitchH2V, const bool _bSwitchL2R,
+          TextFrameIndex const _nCnt, const bool _bSwitchH2V, const bool _bSwitchL2R,
                       long _nHalfSpace, long* _pKernArray, const bool _bBidiPor) :
         rInf( _rInf ),
         rFont( _rFont ),
@@ -211,24 +211,24 @@ struct CalcLinePosData
 // Computes the start and end position of an underline. This function is called
 // from the DrawText-method (for underlining misspelled words or smarttag terms).
 static void lcl_calcLinePos( const CalcLinePosData &rData,
-    Point &rStart, Point &rEnd, sal_Int32 nStart, sal_Int32 nWrLen )
+    Point &rStart, Point &rEnd, TextFrameIndex const nStart, TextFrameIndex const nWrLen)
 {
     long nBlank = 0;
-    const sal_Int32 nEnd = nStart + nWrLen;
+    const TextFrameIndex nEnd = nStart + nWrLen;
     const long nTmpSpaceAdd = rData.rInf.GetSpace() / SPACING_PRECISION_FACTOR;
 
     if ( nEnd < rData.nCnt
-       && CH_BLANK == rData.rInf.GetText()[ rData.rInf.GetIdx() + nEnd ] )
+       && CH_BLANK == rData.rInf.GetText()[sal_Int32(rData.rInf.GetIdx() + nEnd)] )
     {
-        if( nEnd + 1 == rData.nCnt )
+        if (nEnd + TextFrameIndex(1) == rData.nCnt)
             nBlank -= nTmpSpaceAdd;
         else
             nBlank -= rData.nHalfSpace;
     }
 
     // determine start, end and length of wave line
-    sal_Int32 nKernStart = nStart ? rData.pKernArray[ nStart - 1 ] : 0;
-    sal_Int32 nKernEnd = rData.pKernArray[ nEnd - 1 ];
+    sal_Int32 nKernStart = nStart ? rData.pKernArray[sal_Int32(nStart) - 1] : 0;
+    sal_Int32 nKernEnd = rData.pKernArray[sal_Int32(nEnd) - 1];
 
     const sal_uInt16 nDir = rData.bBidiPor ? 1800 :
         UnMapDirection( rData.rFont.GetOrientation(), rData.bSwitchH2V );
@@ -650,8 +650,8 @@ static void lcl_DrawLineForWrongListData(
 {
     if (!pWList) return;
 
-    sal_Int32 nStart = rInf.GetIdx();
-    sal_Int32 nWrLen = rInf.GetLen();
+    TextFrameIndex nStart = rInf.GetIdx();
+    TextFrameIndex nWrLen = rInf.GetLen();
 
     // check if respective data is available in the current text range
     if (!pWList->Check( nStart, nWrLen ))
@@ -908,8 +908,8 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
     if ( bChgColor )
         pTmpFont->SetColor( aOldColor );
 
-    if ( COMPLETE_STRING == rInf.GetLen() )
-        rInf.SetLen( rInf.GetText().getLength() );
+    if (TextFrameIndex(COMPLETE_STRING) == rInf.GetLen())
+        rInf.SetLen( TextFrameIndex(rInf.GetText().getLength()) );
 
     // ASIAN LINE AND CHARACTER GRID MODE START
 
@@ -927,21 +927,21 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
             const sal_uInt16 nGridWidth = GetGridWidth(*pGrid, *pDoc);
 
             // kerning array - gives the absolute position of end of each character
-            std::unique_ptr<long[]> pKernArray(new long[rInf.GetLen()]);
+            std::unique_ptr<long[]> pKernArray(new long[sal_Int32(rInf.GetLen())]);
 
             if ( m_pPrinter )
                 m_pPrinter->GetTextArray( rInf.GetText(), pKernArray.get(),
-                                        rInf.GetIdx(), rInf.GetLen() );
+                            sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen()));
             else
                 rInf.GetOut().GetTextArray( rInf.GetText(), pKernArray.get(),
-                                            rInf.GetIdx(), rInf.GetLen() );
+                            sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen()));
 
             // Change the average width per character to an appropriate grid width
             // basically get the ratio of the avg width to the grid unit width, then
             // multiple this ratio to give the new avg width - which in this case
             // gives a new grid width unit size
 
-            long nAvgWidthPerChar = pKernArray[ rInf.GetLen() - 1 ] / rInf.GetLen();
+            long nAvgWidthPerChar = pKernArray[sal_Int32(rInf.GetLen()) - 1] / sal_Int32(rInf.GetLen());
 
             const sal_uLong nRatioAvgWidthCharToGridWidth = nAvgWidthPerChar ?
                                 ( nAvgWidthPerChar - 1 ) / nGridWidth + 1:
@@ -964,7 +964,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
             // If the character is "special right", then the offset is correct already
             // so the fix offset is as normal - half the average character width
 
-            sal_Unicode cChar = rInf.GetText()[ rInf.GetIdx() ];
+            sal_Unicode cChar = rInf.GetText()[ sal_Int32(rInf.GetIdx()) ];
             sal_uInt8 nType = lcl_WhichPunctuation( cChar );
             switch ( nType )
             {
@@ -983,7 +983,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
             }
 
             // calculate offsets
-            for( sal_Int32 j = 1; j < rInf.GetLen(); ++j )
+            for (sal_Int32 j = 1; j < sal_Int32(rInf.GetLen()); ++j)
             {
                 long nCurrentCharWidth = pKernArray[ j ] - pKernArray[ j - 1 ];
                 nNextFix += nAvgWidthPerChar;
@@ -993,7 +993,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
                 // average character width minus the characters actual char width
                 // to get the offset into the centre of the next character
 
-                cChar = rInf.GetText()[ rInf.GetIdx() + j ];
+                cChar = rInf.GetText()[ sal_Int32(rInf.GetIdx()) + j ];
                 nType = lcl_WhichPunctuation( cChar );
                 switch ( nType )
                 {
@@ -1009,14 +1009,14 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
             }
 
             // the layout engine requires the total width of the output
-            pKernArray[ rInf.GetLen() - 1 ] = rInf.GetWidth() -
+            pKernArray[sal_Int32(rInf.GetLen()) - 1] = rInf.GetWidth() -
                                               aTextOriginPos.X() + rInf.GetPos().X() ;
 
             if ( bSwitchH2V )
                 rInf.GetFrame()->SwitchHorizontalToVertical( aTextOriginPos );
 
             rInf.GetOut().DrawTextArray( aTextOriginPos, rInf.GetText(),
-                pKernArray.get(), rInf.GetIdx(), rInf.GetLen() );
+                pKernArray.get(), sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen()));
 
             return;
         }
@@ -1034,14 +1034,14 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
         {
             const long nGridWidthAdd = EvalGridWidthAdd( pGrid, rInf );
 
-            std::unique_ptr<long[]> pKernArray( new long[rInf.GetLen()] );
+            std::unique_ptr<long[]> pKernArray(new long[sal_Int32(rInf.GetLen())]);
 
             if ( m_pPrinter )
                 m_pPrinter->GetTextArray( rInf.GetText(), pKernArray.get(),
-                rInf.GetIdx(), rInf.GetLen() );
+                    sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen()));
             else
                 rInf.GetOut().GetTextArray( rInf.GetText(), pKernArray.get(),
-                rInf.GetIdx(), rInf.GetLen() );
+                    sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen()));
             if ( bSwitchH2V )
                 rInf.GetFrame()->SwitchHorizontalToVertical( aTextOriginPos );
             if ( rInf.GetSpace() || rInf.GetKanaComp())
@@ -1068,7 +1068,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
                         if (!MsLangId::isKorean(aLang))
                         {
                             long nSpaceSum = nSpaceAdd;
-                            for ( sal_Int32 nI = 0; nI < rInf.GetLen(); ++nI )
+                            for (sal_Int32 nI = 0; nI < sal_Int32(rInf.GetLen()); ++nI)
                             {
                                 pKernArray[ nI ] += nSpaceSum;
                                 nSpaceSum += nSpaceAdd;
@@ -1078,43 +1078,45 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
                         }
                     }
                     long nGridAddSum = nGridWidthAdd;
-                    for(sal_Int32 i = 0; i < rInf.GetLen(); i++, nGridAddSum += nGridWidthAdd )
+                    for (sal_Int32 i = 0; i < sal_Int32(rInf.GetLen()); i++, nGridAddSum += nGridWidthAdd )
                     {
                         pKernArray[i] += nGridAddSum;
                     }
                     long nKernSum = rInf.GetKern();
                     if ( bSpecialJust || rInf.GetKern() )
                     {
-                        for( sal_Int32 i = 0; i < rInf.GetLen(); i++, nKernSum += rInf.GetKern() )
+                        for (sal_Int32 i = 0; i < sal_Int32(rInf.GetLen()); i++, nKernSum += rInf.GetKern())
                         {
-                            if ( CH_BLANK == rInf.GetText()[ rInf.GetIdx()+i ] )
+                            if (CH_BLANK == rInf.GetText()[sal_Int32(rInf.GetIdx())+i])
                                 nKernSum += nSpaceAdd;
                             pKernArray[i] += nKernSum;
                         }
                         ///With through/uderstr. Grouped style requires a blank at the end
                         ///of a text edition special measures:
                         if( m_bPaintBlank && rInf.GetLen() && (CH_BLANK ==
-                            rInf.GetText()[ rInf.GetIdx() + rInf.GetLen() - 1 ] ) )
+                            rInf.GetText()[sal_Int32(rInf.GetIdx() + rInf.GetLen()) - 1]))
                         {
                             ///If it concerns a singular, underlined space acts,
                             ///we must spend two:
-                            if( 1 == rInf.GetLen() )
+                            if (TextFrameIndex(1) == rInf.GetLen())
                             {
                                 pKernArray[0] = rInf.GetWidth() + nSpaceAdd;
                                 rInf.GetOut().DrawTextArray( aTextOriginPos, rInf.GetText(),
-                                    pKernArray.get(), rInf.GetIdx(), 1 );
+                                    pKernArray.get(), sal_Int32(rInf.GetIdx()), 1);
                             }
                             else
                             {
-                                pKernArray[ rInf.GetLen() - 2] += nSpaceAdd;
+                                pKernArray[sal_Int32(rInf.GetLen()) - 2] += nSpaceAdd;
                                 rInf.GetOut().DrawTextArray( aTextOriginPos, rInf.GetText(),
-                                    pKernArray.get(), rInf.GetIdx(), rInf.GetLen() );
+                                    pKernArray.get(), sal_Int32(rInf.GetIdx()),
+                                    sal_Int32(rInf.GetLen()));
                             }
                         }
                         else
                         {
                             rInf.GetOut().DrawTextArray( aTextOriginPos, rInf.GetText(),
-                                pKernArray.get(), rInf.GetIdx(), rInf.GetLen() );
+                                pKernArray.get(), sal_Int32(rInf.GetIdx()),
+                                sal_Int32(rInf.GetLen()));
                         }
                     }
                     else
@@ -1123,14 +1125,15 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
                         sal_Int32 i;
                         sal_Int32 j = 0;
                         long nSpaceSum = 0;
-                        for( i = 0; i < rInf.GetLen(); i++ )
+                        for (i = 0; i < sal_Int32(rInf.GetLen()); i++ )
                         {
-                            if( CH_BLANK == rInf.GetText()[ rInf.GetIdx() + i ] )
+                            if( CH_BLANK == rInf.GetText()[ sal_Int32(rInf.GetIdx()) + i ] )
                             {
                                 nSpaceSum += nSpaceAdd;
                                 if( j < i)
                                     rInf.GetOut().DrawTextArray( aTmpPos, rInf.GetText(),
-                                    pKernArray.get() + j, rInf.GetIdx() + j, i - j );
+                                    pKernArray.get() + j,
+                                    sal_Int32(rInf.GetIdx()) + j, i - j );
                                 j = i + 1;
                                 pKernArray[i] = pKernArray[i] + nSpaceSum;
                                 aTmpPos.setX( aTextOriginPos.X() + pKernArray[ i ] + nKernSum );
@@ -1138,7 +1141,8 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
                         }
                         if( j < i )
                             rInf.GetOut().DrawTextArray( aTmpPos, rInf.GetText(),
-                            pKernArray.get() + j, rInf.GetIdx() +j , i - j );
+                                pKernArray.get() + j,
+                                sal_Int32(rInf.GetIdx()) + j, i - j );
                     }
                 }
             }
@@ -1147,12 +1151,13 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
                 //long nKernAdd = rInf.GetKern();
                 long nKernAdd = 0;
                 long nGridAddSum = nGridWidthAdd + nKernAdd;
-                for(sal_Int32 i = 0; i < rInf.GetLen(); i++,nGridAddSum += nGridWidthAdd + nKernAdd )
+                for (sal_Int32 i = 0; i < sal_Int32(rInf.GetLen());
+                     i++, nGridAddSum += nGridWidthAdd + nKernAdd)
                 {
                     pKernArray[i] += nGridAddSum;
                 }
                 rInf.GetOut().DrawTextArray( aTextOriginPos, rInf.GetText(),
-                    pKernArray.get(), rInf.GetIdx(), rInf.GetLen() );
+                    pKernArray.get(), sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen()));
             }
             return;
         }
@@ -1163,7 +1168,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
     if ( bDirectPrint )
     {
         const Fraction aTmp( 1, 1 );
-        bool bStretch = rInf.GetWidth() && ( rInf.GetLen() > 1 ) && bPrt
+        bool bStretch = rInf.GetWidth() && (rInf.GetLen() > TextFrameIndex(1)) && bPrt
                         && ( aTmp != rInf.GetOut().GetMapMode().GetScaleX() );
 
         if ( bSwitchL2R )
@@ -1179,15 +1184,15 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
         // Simple kerning is handled by DrawStretchText
         if( rInf.GetSpace() || rInf.GetKanaComp() )
         {
-            std::unique_ptr<long[]> pKernArray( new long[ rInf.GetLen() ] );
+            std::unique_ptr<long[]> pKernArray(new long[sal_Int32(rInf.GetLen())]);
             rInf.GetOut().GetTextArray( rInf.GetText(), pKernArray.get(),
-                                       rInf.GetIdx(), rInf.GetLen() );
+                           sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen()));
 
             if( bStretch )
             {
-                sal_Int32 nZwi = rInf.GetLen() - 1;
+                sal_Int32 nZwi = sal_Int32(rInf.GetLen()) - 1;
                 long nDiff = rInf.GetWidth() - pKernArray[ nZwi ]
-                             - rInf.GetLen() * rInf.GetKern();
+                             - sal_Int32(rInf.GetLen()) * rInf.GetKern();
                 long nRest = nDiff % nZwi;
                 long nAdd;
                 if( nRest < 0 )
@@ -1288,10 +1293,10 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
 
             if ( bStretch || m_bPaintBlank || rInf.GetKern() || bSpecialJust )
             {
-                for( sal_Int32 i = 0; i < rInf.GetLen(); i++,
+                for (sal_Int32 i = 0; i < sal_Int32(rInf.GetLen()); i++,
                      nKernSum += rInf.GetKern() )
                 {
-                    if ( CH_BLANK == rInf.GetText()[ rInf.GetIdx()+i ] )
+                    if (CH_BLANK == rInf.GetText()[sal_Int32(rInf.GetIdx()) + i])
                         nKernSum += nSpaceAdd;
                     pKernArray[i] += nKernSum;
                 }
@@ -1299,40 +1304,40 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
                 // In case of underlined/strike-through justified text
                 // a blank at the end requires special handling:
                 if( m_bPaintBlank && rInf.GetLen() && ( CH_BLANK ==
-                    rInf.GetText()[ rInf.GetIdx()+rInf.GetLen()-1 ] ) )
+                    rInf.GetText()[sal_Int32(rInf.GetIdx() + rInf.GetLen())-1]))
                 {
                     // If it is a single underlined space, output 2 spaces:
-                    if( 1 == rInf.GetLen() )
+                    if (TextFrameIndex(1) == rInf.GetLen())
                     {
                         pKernArray[0] = rInf.GetWidth() + nSpaceAdd;
 
                         rInf.GetOut().DrawTextArray( aTextOriginPos, rInf.GetText(),
-                                                     pKernArray.get(), rInf.GetIdx(), 1 );
+                             pKernArray.get(), sal_Int32(rInf.GetIdx()), 1 );
                     }
                     else
                     {
-                        pKernArray[ rInf.GetLen() - 2 ] += nSpaceAdd;
+                        pKernArray[ sal_Int32(rInf.GetLen()) - 2 ] += nSpaceAdd;
                         rInf.GetOut().DrawTextArray( aTextOriginPos, rInf.GetText(),
-                            pKernArray.get(), rInf.GetIdx(), rInf.GetLen() );
+                            pKernArray.get(), sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen()));
                     }
                 }
                 else
                     rInf.GetOut().DrawTextArray( aTextOriginPos, rInf.GetText(),
-                                                 pKernArray.get(), rInf.GetIdx(), rInf.GetLen() );
+                            pKernArray.get(), sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen()));
             }
             else
             {
                 Point aTmpPos( aTextOriginPos );
                 sal_Int32 j = 0;
                 sal_Int32 i;
-                for( i = 0; i < rInf.GetLen(); i++ )
+                for( i = 0; i < sal_Int32(rInf.GetLen()); i++ )
                 {
-                    if( CH_BLANK == rInf.GetText()[ rInf.GetIdx()+i ] )
+                    if (CH_BLANK == rInf.GetText()[sal_Int32(rInf.GetIdx()) + i])
                     {
                         nKernSum += nSpaceAdd;
                         if( j < i )
                             rInf.GetOut().DrawText( aTmpPos, rInf.GetText(),
-                                                rInf.GetIdx() + j, i - j );
+                                        sal_Int32(rInf.GetIdx()) + j, i - j);
                         j = i + 1;
                         SwTwips nAdd = pKernArray[ i ] + nKernSum;
                         if ( ( ComplexTextLayoutFlags::BiDiStrong | ComplexTextLayoutFlags::BiDiRtl ) == nMode )
@@ -1342,7 +1347,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
                 }
                 if( j < i )
                     rInf.GetOut().DrawText( aTmpPos, rInf.GetText(),
-                                            rInf.GetIdx() + j, i - j );
+                                sal_Int32(rInf.GetIdx()) + j, i - j);
             }
         }
         else if( bStretch )
@@ -1351,7 +1356,8 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
             if( rInf.GetKern() && rInf.GetLen() && nTmpWidth > rInf.GetKern() )
                 nTmpWidth -= rInf.GetKern();
             rInf.GetOut().DrawStretchText( aTextOriginPos, nTmpWidth,
-                                           rInf.GetText(), rInf.GetIdx(), rInf.GetLen() );
+                       rInf.GetText(),
+                       sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen()));
         }
         else if( rInf.GetKern() )
         {
@@ -1368,11 +1374,12 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
             }
 
             rInf.GetOut().DrawStretchText( aTextOriginPos, nTmpWidth,
-                                           rInf.GetText(), rInf.GetIdx(), rInf.GetLen() );
+                    rInf.GetText(),
+                    sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen()));
         }
         else
             rInf.GetOut().DrawText( aTextOriginPos, rInf.GetText(),
-                                    rInf.GetIdx(), rInf.GetLen() );
+                    sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen()));
     }
 
     // PAINTING WITH FORMATTING DEVICE/SCREEN ADJUSTMENT
@@ -1386,14 +1393,14 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
         bool bBullet = rInf.GetBullet();
         if( m_bSymbol )
             bBullet = false;
-        std::unique_ptr<long[]> pKernArray( new long[ rInf.GetLen() ] );
+        std::unique_ptr<long[]> pKernArray(new long[sal_Int32(rInf.GetLen())]);
         CreateScrFont( *rInf.GetShell(), rInf.GetOut() );
         long nScrPos;
 
         // get screen array
-        std::unique_ptr<long[]> pScrArray( new long[ rInf.GetLen() ] );
+        std::unique_ptr<long[]> pScrArray(new long[sal_Int32(rInf.GetLen())]);
         rInf.GetOut().GetTextArray( rInf.GetText(), pScrArray.get(),
-                                    rInf.GetIdx(), rInf.GetLen() );
+                        sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen()));
 
         // OLE: no printer available
         // OSL_ENSURE( pPrinter, "DrawText needs pPrinter" )
@@ -1405,13 +1412,13 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
                 if( !m_pPrtFont->IsSameInstance( m_pPrinter->GetFont() ) )
                     m_pPrinter->SetFont( *m_pPrtFont );
             }
-            m_pPrinter->GetTextArray( rInf.GetText(), pKernArray.get(), rInf.GetIdx(),
-                                    rInf.GetLen() );
+            m_pPrinter->GetTextArray(rInf.GetText(), pKernArray.get(),
+                    sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen()));
         }
         else
         {
             rInf.GetOut().GetTextArray( rInf.GetText(), pKernArray.get(),
-                                        rInf.GetIdx(), rInf.GetLen() );
+                    sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen()));
         }
 
         // Modify Printer and ScreenArrays for special justifications
@@ -1493,11 +1500,11 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
             // !!! HACK !!!
             // The Arabic layout engine requires some context of the string
             // which should be painted.
-            sal_Int32 nCopyStart = rInf.GetIdx();
+            sal_Int32 nCopyStart = sal_Int32(rInf.GetIdx());
             if ( nCopyStart )
                 --nCopyStart;
 
-            sal_Int32 nCopyLen = rInf.GetLen();
+            sal_Int32 nCopyLen = sal_Int32(rInf.GetLen());
             if ( nCopyStart + nCopyLen < rInf.GetText().getLength() )
                 ++nCopyLen;
 
@@ -1512,7 +1519,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
                     /* fdo#72488 Hack: try to see if the space is zero width
                      * and don't bother with inserting a bullet in this case.
                      */
-                    if ((i + nCopyStart + 1 >= rInf.GetLen()) ||
+                    if ((i + nCopyStart + 1 >= sal_Int32(rInf.GetLen())) ||
                         pKernArray[i + nCopyStart] != pKernArray[ i + nCopyStart + 1])
                     {
                         aBulletOverlay = aBulletOverlay.replaceAt(i, 1, OUString(CH_BULLET));
@@ -1528,18 +1535,18 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
                 }
         }
 
-        sal_Int32 nCnt = rInf.GetText().getLength();
+        TextFrameIndex nCnt(rInf.GetText().getLength());
         if ( nCnt < rInf.GetIdx() )
             assert(false); // layout bug, not handled below
         else
             nCnt = nCnt - rInf.GetIdx();
-        nCnt = std::min<sal_Int32>( nCnt, rInf.GetLen() );
+        nCnt = std::min(nCnt, rInf.GetLen());
         long nKernSum = rInf.GetKern();
-        sal_Unicode cChPrev = rInf.GetText()[ rInf.GetIdx() ];
+        sal_Unicode cChPrev = rInf.GetText()[sal_Int32(rInf.GetIdx())];
 
         // In case of a single underlined space in justified text,
         // have to output 2 spaces:
-        if ( ( nCnt == 1 ) && rInf.GetSpace() && ( cChPrev == CH_BLANK ) )
+        if ((nCnt == TextFrameIndex(1)) && rInf.GetSpace() && (cChPrev == CH_BLANK))
         {
             pKernArray[0] = rInf.GetWidth() +
                             rInf.GetKern() +
@@ -1552,7 +1559,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
                 rInf.GetFrame()->SwitchHorizontalToVertical( aTextOriginPos );
 
             rInf.GetOut().DrawTextArray( aTextOriginPos, rInf.GetText(),
-                                         pKernArray.get(), rInf.GetIdx(), 1 );
+                         pKernArray.get(), sal_Int32(rInf.GetIdx()), 1 );
             if( bBullet )
                 rInf.GetOut().DrawTextArray( aTextOriginPos, *pStr, pKernArray.get(),
                                              rInf.GetIdx() ? 1 : 0, 1 );
@@ -1582,9 +1589,9 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
             const long nOtherHalf = nSpaceAdd - nHalfSpace;
             if ( nSpaceAdd && ( cChPrev == CH_BLANK ) )
                 nSpaceSum = nHalfSpace;
-            for( sal_Int32 i=1; i<nCnt; ++i, nKernSum += rInf.GetKern() )
+            for (sal_Int32 i = 1; i < sal_Int32(nCnt); ++i, nKernSum += rInf.GetKern())
             {
-                nCh = rInf.GetText()[ rInf.GetIdx() + i ];
+                nCh = rInf.GetText()[sal_Int32(rInf.GetIdx()) + i];
 
                 OSL_ENSURE( pScrArray, "Where is the screen array?" );
                 long nScr;
@@ -1600,7 +1607,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
 
                     if ( cChPrev == CH_BLANK )
                         nSpaceSum += nOtherHalf;
-                    if ( i + 1 == nCnt )
+                    if (i + 1 == sal_Int32(nCnt))
                         nSpaceSum += nSpaceAdd;
                     else
                         nSpaceSum += nHalfSpace;
@@ -1627,12 +1634,12 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
                 // ends with a blank, the full nSpaceAdd value has been added to the character in
                 // front of the blank. This leads to painting artifacts, therefore we remove the
                 // nSpaceAdd value again:
-                if ( (bNoHalfSpace || m_pPrtFont->IsWordLineMode()) && i+1 == nCnt && nCh == CH_BLANK )
+                if ((bNoHalfSpace || m_pPrtFont->IsWordLineMode()) && i+1 == sal_Int32(nCnt) && nCh == CH_BLANK)
                     pKernArray[i-1] = pKernArray[i-1] - nSpaceAdd;
             }
 
             // the layout engine requires the total width of the output
-            pKernArray[ rInf.GetLen() - 1 ] += nKernSum + nSpaceSum;
+            pKernArray[sal_Int32(rInf.GetLen()) - 1] += nKernSum + nSpaceSum;
 
             if( rInf.GetGreyWave() )
             {
@@ -1651,7 +1658,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
                             rInf.GetOut().SetLineColor( *pWaveCol );
 
                         Point aEnd;
-                        long nKernVal = pKernArray[ rInf.GetLen() - 1 ];
+                        long nKernVal = pKernArray[sal_Int32(rInf.GetLen()) - 1];
 
                         const sal_uInt16 nDir = bBidiPor ?
                                         1800 :
@@ -1725,7 +1732,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
             }
 
             sal_Int32 nOffs = 0;
-            sal_Int32 nLen = rInf.GetLen();
+            sal_Int32 nLen = sal_Int32(rInf.GetLen());
 
             if( nOffs < nLen )
             {
@@ -1740,9 +1747,9 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
                 // the paragraph string. For the layout engine, the copy
                 // of the string has to be an environment of the range which
                 // is painted
-                sal_Int32 nTmpIdx = bBullet ?
-                                              ( rInf.GetIdx() ? 1 : 0 ) :
-                                              rInf.GetIdx();
+                sal_Int32 nTmpIdx = bBullet
+                            ? (rInf.GetIdx() ? 1 : 0)
+                            : sal_Int32(rInf.GetIdx());
                 rInf.GetOut().DrawTextArray( aTextOriginPos, *pStr, pKernArray.get() + nOffs,
                                              nTmpIdx + nOffs , nLen - nOffs );
                 if (bBullet)
commit da91fa196a1345b93d7a5276f2339ce475f64a35
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Wed May 23 11:28:06 2018 +0200

    sw_redlinehide: trivial conversions in fntcap.cxx
    
    Change-Id: Idf7a334f2ab77fdcb21372569e069e2318396503

diff --git a/sw/source/core/inc/fntcap.hxx b/sw/source/core/inc/fntcap.hxx
index 4fd0290ffce3..03591c51791d 100644
--- a/sw/source/core/inc/fntcap.hxx
+++ b/sw/source/core/inc/fntcap.hxx
@@ -22,14 +22,15 @@
 
 #include <sal/types.h>
 #include <rtl/ustring.hxx>
+#include "TextFrameIndex.hxx"
 
 class SwFont;
 
-sal_Int32 sw_CalcCaseMap( const SwFont& rFnt,
+TextFrameIndex sw_CalcCaseMap( const SwFont& rFnt,
                           const OUString& rOrigString,
-                          sal_Int32 nOfst,
-                          sal_Int32 nLen,
-                          sal_Int32 nIdx );
+                          TextFrameIndex nOfst,
+                          TextFrameIndex nLen,
+                          TextFrameIndex nIdx );
 
 
 #endif
diff --git a/sw/source/core/txtnode/fntcap.cxx b/sw/source/core/txtnode/fntcap.cxx
index caf897e6f520..062f8aa2bc37 100644
--- a/sw/source/core/txtnode/fntcap.cxx
+++ b/sw/source/core/txtnode/fntcap.cxx
@@ -46,8 +46,8 @@ public:
     explicit SwCapitalInfo( const OUString& rOrigText ) :
         rString( rOrigText ), nIdx( 0 ), nLen( 0 ) {};
     const OUString& rString;
-    sal_Int32 nIdx;
-    sal_Int32 nLen;
+    TextFrameIndex nIdx;
+    TextFrameIndex nLen;
 };
 
 // rFnt: required for CalcCaseMap
@@ -56,32 +56,32 @@ public:
 // nLen: Length if the substring in rOrigString
 // nIdx: Referes to a position in the display string and should be mapped
 //       to a position in rOrigString
-sal_Int32 sw_CalcCaseMap( const SwFont& rFnt,
+TextFrameIndex sw_CalcCaseMap(const SwFont& rFnt,
                             const OUString& rOrigString,
-                            sal_Int32 nOfst,
-                            sal_Int32 nLen,
-                            sal_Int32 nIdx )
+                            TextFrameIndex const nOfst,
+                            TextFrameIndex const nLen,
+                            TextFrameIndex const nIdx)
 {
     int j = 0;
-    const sal_Int32 nEnd = nOfst + nLen;
-    OSL_ENSURE( nEnd <= rOrigString.getLength(), "sw_CalcCaseMap: Wrong parameters" );
+    const TextFrameIndex nEnd = nOfst + nLen;
+    OSL_ENSURE( sal_Int32(nEnd) <= rOrigString.getLength(), "sw_CalcCaseMap: Wrong parameters" );
 
     // special case for title case:
     const bool bTitle = SvxCaseMap::Capitalize == rFnt.GetCaseMap();
-    for ( sal_Int32 i = nOfst; i < nEnd; ++i )
+    for (TextFrameIndex i = nOfst; i < nEnd; ++i)
     {
-        OUString aTmp(rOrigString.copy(i, 1));
+        OUString aTmp(rOrigString.copy(sal_Int32(i), 1));
 
         if ( !bTitle ||
              g_pBreakIt->GetBreakIter()->isBeginWord(
-                 rOrigString, i,
+                 rOrigString, sal_Int32(i),
                  g_pBreakIt->GetLocale( rFnt.GetLanguage() ),
                  WordType::ANYWORD_IGNOREWHITESPACES ) )
             aTmp = rFnt.GetActualFont().CalcCaseMap( aTmp );
 
         j += aTmp.getLength();
 
-        if ( j > nIdx )
+        if (TextFrameIndex(j) > nIdx)
             return i;
     }
 
@@ -156,7 +156,8 @@ class SwDoGetCapitalBreak : public SwDoCapitals
 {
 protected:
     long nTextWidth;
-    sal_Int32 m_nBreak;
+    TextFrameIndex m_nBreak;
+
 public:
     SwDoGetCapitalBreak( SwDrawTextInfo &rInfo, long const nWidth)
         :   SwDoCapitals ( rInfo )
@@ -166,7 +167,7 @@ public:
     virtual ~SwDoGetCapitalBreak() {}
     virtual void Init( SwFntObj *pUpperFont, SwFntObj *pLowerFont ) override;
     virtual void Do() override;
-    sal_Int32 getBreak() const { return m_nBreak; }
+    TextFrameIndex getBreak() const { return m_nBreak; }
 };
 
 void SwDoGetCapitalBreak::Init( SwFntObj *, SwFntObj * )
@@ -181,11 +182,12 @@ void SwDoGetCapitalBreak::Do()
             nTextWidth -= rInf.GetSize().Width();
         else
         {
-            sal_Int32 nEnd = rInf.GetEnd();
-            m_nBreak = GetOut().GetTextBreak( rInf.GetText(), nTextWidth,
-                               rInf.GetIdx(), rInf.GetLen(), rInf.GetKern() );
+            TextFrameIndex nEnd = rInf.GetEnd();
+            m_nBreak = TextFrameIndex(GetOut().GetTextBreak(
+                           rInf.GetText(), nTextWidth, sal_Int32(rInf.GetIdx()),
+                           sal_Int32(rInf.GetLen()), rInf.GetKern()));
 
-            if (m_nBreak > nEnd || m_nBreak < 0)
+            if (m_nBreak > nEnd || m_nBreak < TextFrameIndex(0))
                 m_nBreak = nEnd;
 
             // m_nBreak may be relative to the display string. It has to be
@@ -316,7 +318,7 @@ class SwDoCapitalCursorOfst : public SwDoCapitals
 protected:
     SwFntObj *pUpperFnt;
     SwFntObj *pLowerFnt;
-    sal_Int32 nCursor;
+    TextFrameIndex nCursor;
     sal_uInt16 nOfst;
 public:
     SwDoCapitalCursorOfst( SwDrawTextInfo &rInfo, const sal_uInt16 nOfs ) :
@@ -326,7 +328,7 @@ public:
     virtual void Init( SwFntObj *pUpperFont, SwFntObj *pLowerFont ) override;
     virtual void Do() override;
 
-    sal_Int32 GetCursor(){ return nCursor; }
+    TextFrameIndex GetCursor(){ return nCursor; }
 };
 
 void SwDoCapitalCursorOfst::Init( SwFntObj *pUpperFont, SwFntObj *pLowerFont )
@@ -386,7 +388,7 @@ TextFrameIndex SwSubFont::GetCapitalCursorOfst( SwDrawTextInfo& rInf )
 
 class SwDoDrawStretchCapital : public SwDoDrawCapital
 {
-    const sal_Int32 nStrLen;
+    const TextFrameIndex nStrLen;
     const sal_uInt16 nCapWidth;
     const sal_uInt16 nOrgWidth;
 public:
@@ -411,8 +413,8 @@ void SwDoDrawStretchCapital::Do()
         long nDiff = long(nOrgWidth) - long(nCapWidth);
         if( nDiff )
         {
-            nDiff *= rInf.GetLen();
-            nDiff /= nStrLen;
+            nDiff *= sal_Int32(rInf.GetLen());
+            nDiff /= sal_Int32(nStrLen);
             nDiff += nPartWidth;
             if( 0 < nDiff )
                 nPartWidth = nDiff;
@@ -431,12 +433,12 @@ void SwDoDrawStretchCapital::Do()
             rInf.GetFrame()->SwitchHorizontalToVertical( aPos );
 
         // Optimise:
-        if( 1 >= rInf.GetLen() )
-            GetOut().DrawText( aPos, rInf.GetText(), rInf.GetIdx(),
-                rInf.GetLen() );
+        if (TextFrameIndex(1) >= rInf.GetLen())
+            GetOut().DrawText(aPos, rInf.GetText(), sal_Int32(rInf.GetIdx()),
+                sal_Int32(rInf.GetLen()));
         else
-            GetOut().DrawStretchText( aPos, nPartWidth,
-                                rInf.GetText(), rInf.GetIdx(), rInf.GetLen() );
+            GetOut().DrawStretchText(aPos, nPartWidth, rInf.GetText(),
+                    sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen()));
     }
     const_cast<Point&>(rInf.GetPos()).AdjustX(nPartWidth );
 }
@@ -445,8 +447,8 @@ void SwSubFont::DrawStretchCapital( SwDrawTextInfo &rInf )
 {
     // Precondition: rInf.GetPos() has already been calculated
 
-    if( rInf.GetLen() == COMPLETE_STRING )
-        rInf.SetLen( rInf.GetText().getLength() );
+    if (rInf.GetLen() == TextFrameIndex(COMPLETE_STRING))
+        rInf.SetLen(TextFrameIndex(rInf.GetText().getLength()));
 
     const Point aOldPos = rInf.GetPos();
     const sal_uInt16 nCapWidth = static_cast<sal_uInt16>( GetCapitalSize( rInf ).Width() );
@@ -465,14 +467,15 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
 
     long nKana = 0;
     const OUString aText( CalcCaseMap( rDo.GetInf().GetText() ) );
-    sal_Int32 nMaxPos = std::min( rDo.GetInf().GetText().getLength() - rDo.GetInf().GetIdx(),
+    TextFrameIndex nMaxPos = std::min(
+        TextFrameIndex(rDo.GetInf().GetText().getLength()) - rDo.GetInf().GetIdx(),
                              rDo.GetInf().GetLen() );
     rDo.GetInf().SetLen( nMaxPos );
 
     const OUString oldText = rDo.GetInf().GetText();
     rDo.GetInf().SetText( aText );
-    sal_Int32 nPos = rDo.GetInf().GetIdx();
-    sal_Int32 nOldPos = nPos;
+    TextFrameIndex nPos = rDo.GetInf().GetIdx();
+    TextFrameIndex nOldPos = nPos;
     nMaxPos = nMaxPos + nPos;
 
     // Look if the length of the original text and the ToUpper-converted
@@ -549,10 +552,10 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
 
     if( nPos < nMaxPos )
     {
-        nPos = g_pBreakIt->GetBreakIter()->endOfCharBlock(
-                        oldText, nPos,
-            g_pBreakIt->GetLocale( eLng ), CharType::LOWERCASE_LETTER);
-        if (nPos < 0)
+        nPos = TextFrameIndex(g_pBreakIt->GetBreakIter()->endOfCharBlock(
+                        oldText, sal_Int32(nPos),
+            g_pBreakIt->GetLocale( eLng ), CharType::LOWERCASE_LETTER));
+        if (nPos < TextFrameIndex(0))
             nPos = nOldPos;
         else if( nPos > nMaxPos )
             nPos = nMaxPos;
@@ -574,11 +577,12 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
                 // Build an own 'changed' string for the given part of the
                 // source string and use it. That new string may differ in length
                 // from the source string.
-                const OUString aNewText = CalcCaseMap( oldText.copy(nOldPos, nPos-nOldPos) );
+                const OUString aNewText = CalcCaseMap(
+                    oldText.copy(sal_Int32(nOldPos), sal_Int32(nPos-nOldPos)));
                 aCapInf.nIdx = nOldPos;
                 aCapInf.nLen = nPos - nOldPos;
-                rDo.GetInf().SetIdx( 0 );
-                rDo.GetInf().SetLen( aNewText.getLength() );
+                rDo.GetInf().SetIdx(TextFrameIndex(0));
+                rDo.GetInf().SetLen(TextFrameIndex(aNewText.getLength()));
                 rDo.GetInf().SetText( aNewText );
             }
             else
@@ -598,10 +602,10 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
             rDo.Do();
             nOldPos = nPos;
         }
-        nPos = g_pBreakIt->GetBreakIter()->nextCharBlock(
-                            oldText, nPos,
-               g_pBreakIt->GetLocale( eLng ), CharType::LOWERCASE_LETTER);
-        if (nPos < 0 || nPos > nMaxPos)
+        nPos = TextFrameIndex(g_pBreakIt->GetBreakIter()->nextCharBlock(
+                            oldText, sal_Int32(nPos),
+               g_pBreakIt->GetLocale( eLng ), CharType::LOWERCASE_LETTER));
+        if (nPos < TextFrameIndex(0) || nPos > nMaxPos)
             nPos = nMaxPos;
         OSL_ENSURE( nPos, "nextCharBlock not implemented?" );
 #if OSL_DEBUG_LEVEL > 1
@@ -618,11 +622,11 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
                 rDo.GetInf().SetUpper( true );
                 pLastFont = pBigFont;
                 pLastFont->SetDevFont( rDo.GetInf().GetShell(), rDo.GetOut() );
-                sal_Int32 nTmp;
+                TextFrameIndex nTmp;
                 if( bWordWise )
                 {
                     nTmp = nOldPos;
-                    while (nTmp < nPos && CH_BLANK == oldText[nTmp])
+                    while (nTmp < nPos && CH_BLANK == oldText[sal_Int32(nTmp)])
                         ++nTmp;
                     if( nOldPos < nTmp )
                     {
@@ -640,11 +644,12 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
                             // Build an own 'changed' string for the given part of the
                             // source string and use it. That new string may differ in length
                             // from the source string.
-                            const OUString aNewText = CalcCaseMap( oldText.copy(nOldPos, nTmp-nOldPos) );
+                            const OUString aNewText = CalcCaseMap(
+                                oldText.copy(sal_Int32(nOldPos), sal_Int32(nTmp-nOldPos)));
                             aCapInf.nIdx = nOldPos;
                             aCapInf.nLen = nTmp - nOldPos;
-                            rDo.GetInf().SetIdx( 0 );
-                            rDo.GetInf().SetLen( aNewText.getLength() );
+                            rDo.GetInf().SetIdx(TextFrameIndex(0));
+                            rDo.GetInf().SetLen(TextFrameIndex(aNewText.getLength()));
                             rDo.GetInf().SetText( aNewText );
                         }
                         else
@@ -658,7 +663,7 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
                         nKana += rDo.GetInf().GetKanaDiff();
                         rDo.GetInf().SetOut( *pOldOut );
                         if( nSpaceAdd )
-                            aPartSize.AdjustWidth(nSpaceAdd * ( nTmp - nOldPos ) );
+                            aPartSize.AdjustWidth(nSpaceAdd * sal_Int32(nTmp - nOldPos));
                         if( nTmpKern && nPos < nMaxPos )
                             aPartSize.AdjustWidth(nTmpKern );
                         rDo.GetInf().SetSize( aPartSize );
@@ -667,7 +672,7 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
                         nOldPos = nTmp;
                     }
 
-                    while (nTmp < nPos && CH_BLANK != oldText[nTmp])
+                    while (nTmp < nPos && CH_BLANK != oldText[sal_Int32(nTmp)])
                         ++nTmp;
                 }
                 else
@@ -680,11 +685,12 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
                         // Build an own 'changed' string for the given part of the
                         // source string and use it. That new string may differ in length
                         // from the source string.
-                        const OUString aNewText = CalcCaseMap( oldText.copy(nOldPos, nTmp-nOldPos) );
+                        const OUString aNewText = CalcCaseMap(
+                            oldText.copy(sal_Int32(nOldPos), sal_Int32(nTmp-nOldPos)));
                         aCapInf.nIdx = nOldPos;
                         aCapInf.nLen = nTmp - nOldPos;
-                        rDo.GetInf().SetIdx( 0 );
-                        rDo.GetInf().SetLen( aNewText.getLength() );
+                        rDo.GetInf().SetIdx(TextFrameIndex(0));
+                        rDo.GetInf().SetLen(TextFrameIndex(aNewText.getLength()));
                         rDo.GetInf().SetText( aNewText );
                     }
                     else
@@ -699,9 +705,9 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
                     rDo.GetInf().SetOut( *pOldOut );
                     if( !bWordWise && rDo.GetInf().GetSpace() )
                     {
-                        for( sal_Int32 nI = nOldPos; nI < nPos; ++nI )
+                        for (TextFrameIndex nI = nOldPos; nI < nPos; ++nI)
                         {
-                            if (CH_BLANK == oldText[nI])
+                            if (CH_BLANK == oldText[sal_Int32(nI)])
                                 aPartSize.AdjustWidth(nSpaceAdd );
                         }
                     }
@@ -713,10 +719,10 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
                 }
             } while( nOldPos != nPos );
         }
-        nPos = g_pBreakIt->GetBreakIter()->endOfCharBlock(
-                            oldText, nPos,
-               g_pBreakIt->GetLocale( eLng ), CharType::LOWERCASE_LETTER);
-        if (nPos < 0 || nPos > nMaxPos)
+        nPos = TextFrameIndex(g_pBreakIt->GetBreakIter()->endOfCharBlock(
+                            oldText, sal_Int32(nPos),
+               g_pBreakIt->GetLocale( eLng ), CharType::LOWERCASE_LETTER));
+        if (nPos < TextFrameIndex(0) || nPos > nMaxPos)
             nPos = nMaxPos;
         OSL_ENSURE( nPos, "endOfCharBlock not implemented?" );
 #if OSL_DEBUG_LEVEL > 1
commit 6d44161442a034f6f5bfc977eb5ffe74df52b8ec
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Tue May 22 17:36:43 2018 +0200

    sw_redlinehide: SwFntObj header
    
    Change-Id: If03651c63f844890be9c7aea71be3d88e4e027d6

diff --git a/sw/source/core/inc/fntcache.hxx b/sw/source/core/inc/fntcache.hxx
index 6baf1c2d56ad..a8ab21a418ff 100644
--- a/sw/source/core/inc/fntcache.hxx
+++ b/sw/source/core/inc/fntcache.hxx
@@ -25,6 +25,7 @@
 #include <tools/mempool.hxx>
 #include <swtypes.hxx>
 #include "swcache.hxx"
+#include "TextFrameIndex.hxx"
 
 class OutputDevice;
 class FontMetric;
@@ -109,7 +110,7 @@ public:
     void   DrawText( SwDrawTextInfo &rInf );
     /// determine the TextSize (of the printer)
     Size  GetTextSize( SwDrawTextInfo &rInf );
-    sal_Int32 GetCursorOfst( SwDrawTextInfo &rInf );
+    TextFrameIndex GetCursorOfst(SwDrawTextInfo &rInf);
 
     void CreateScrFont( const SwViewShell& rSh, const OutputDevice& rOut );
     void CreatePrtFont( const OutputDevice& rOut );
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index cb4706bdc927..18e35fc38913 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -1992,7 +1992,7 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf )
     return aTextSize;
 }
 
-sal_Int32 SwFntObj::GetCursorOfst( SwDrawTextInfo &rInf )
+TextFrameIndex SwFntObj::GetCursorOfst(SwDrawTextInfo &rInf)
 {
     long nSpaceAdd =       rInf.GetSpace() / SPACING_PRECISION_FACTOR;
     const long nSperren = -rInf.GetSperren() / SPACING_PRECISION_FACTOR;
commit 9623d108fbf5d4967fa08ba1a44cf4208b346cba
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Tue May 22 17:04:54 2018 +0200

    sw_redlinehide: SwDrawTextInfo header
    
    Change-Id: If2227e9af248bb77981f245de5bc9505f178fdd7

diff --git a/sw/source/core/inc/drawfont.hxx b/sw/source/core/inc/drawfont.hxx
index f09f30681ccf..f484e56546c9 100644
--- a/sw/source/core/inc/drawfont.hxx
+++ b/sw/source/core/inc/drawfont.hxx
@@ -24,6 +24,7 @@
 #include <osl/diagnose.h>
 #include <vcl/vclptr.hxx>
 #include <vcl/outdev.hxx>
+#include "TextFrameIndex.hxx"
 
 class SwTextFrame;
 class SwViewShell;
@@ -55,10 +56,11 @@ class SW_DLLPUBLIC SwDrawTextInfo
     Size m_aSize;
     SwFont *m_pFnt;
     SwUnderlineFont* m_pUnderFnt;
-    sal_Int32* m_pHyphPos;
+    TextFrameIndex* m_pHyphPos;
     long m_nKanaDiff;
-    sal_Int32 m_nIdx;
-    sal_Int32 m_nLen;
+    TextFrameIndex m_nIdx;
+    TextFrameIndex m_nLen;
+    /// this is not a string index
     sal_Int32 m_nOfst;
     sal_uInt16 m_nWidth;
     sal_uInt16 m_nAscent;
@@ -66,7 +68,7 @@ class SW_DLLPUBLIC SwDrawTextInfo
     long m_nSperren;
     long m_nSpace;
     long m_nKern;
-    sal_Int32 m_nNumberOfBlanks;
+    TextFrameIndex m_nNumberOfBlanks;
     sal_uInt8 m_nCursorBidiLevel;
     bool m_bBullet : 1;
     bool m_bUpper : 1;        // for small caps: upper case flag
@@ -103,8 +105,15 @@ public:
     bool m_bDrawSp: 1;
 #endif
 
+    /// constructor for simple strings
+    SwDrawTextInfo( SwViewShell const *pSh, OutputDevice &rOut,
+                    const OUString &rText, sal_Int32 const nIdx, sal_Int32 const nLen,
+                    sal_uInt16 nWidth = 0, bool bBullet = false)
+        : SwDrawTextInfo(pSh, rOut, nullptr, rText, TextFrameIndex(nIdx), TextFrameIndex(nLen), nWidth, bBullet)
+    {}
+    /// constructor for text frame contents
     SwDrawTextInfo( SwViewShell const *pSh, OutputDevice &rOut, const SwScriptInfo* pSI,
-                    const OUString &rText, sal_Int32 nIdx, sal_Int32 nLen,
+                    const OUString &rText, TextFrameIndex const nIdx, TextFrameIndex const nLen,
                     sal_uInt16 nWidth = 0, bool bBullet = false,
                     vcl::TextLayoutCache const*const pCachedVclData = nullptr)
         : m_pCachedVclData(pCachedVclData)
@@ -119,7 +128,7 @@ public:
         m_nKern = 0;
         m_nCompress = 0;
         m_nWidth = nWidth;
-        m_nNumberOfBlanks = 0;
+        m_nNumberOfBlanks = TextFrameIndex(0);
         m_nCursorBidiLevel = 0;
         m_bBullet = bBullet;
         m_pUnderFnt = nullptr;
@@ -193,7 +202,7 @@ public:
         return m_aPos;
     }
 
-    sal_Int32 *GetHyphPos() const
+    TextFrameIndex *GetHyphPos() const
     {
 #ifdef DBG_UTIL
         OSL_ENSURE( m_bHyph, "DrawTextInfo: Undefined Hyph Position" );
@@ -253,12 +262,12 @@ public:
         return m_pUnderFnt;
     }
 
-    sal_Int32 GetIdx() const
+    TextFrameIndex GetIdx() const
     {
         return m_nIdx;
     }
 
-    sal_Int32 GetLen() const
+    TextFrameIndex GetLen() const
     {
         return m_nLen;
     }
@@ -271,7 +280,7 @@ public:
         return m_nOfst;
     }
 
-    sal_Int32 GetEnd() const
+    TextFrameIndex GetEnd() const
     {
         return m_nIdx + m_nLen;
     }
@@ -323,7 +332,7 @@ public:
         return m_nSpace;
     }
 
-    sal_Int32 GetNumberOfBlanks() const
+    TextFrameIndex GetNumberOfBlanks() const
     {
 #ifdef DBG_UTIL
         OSL_ENSURE( m_bNumberOfBlanks, "DrawTextInfo::Undefined NumberOfBlanks" );
@@ -395,7 +404,7 @@ public:
 #endif
     }
 
-    void SetHyphPos( sal_Int32 *pNew )
+    void SetHyphPos(TextFrameIndex *const pNew)
     {
         m_pHyphPos = pNew;
 #ifdef DBG_UTIL
@@ -446,12 +455,12 @@ public:
 #endif
     }
 
-    void SetIdx( sal_Int32 nNew )
+    void SetIdx(TextFrameIndex const nNew)
     {
         m_nIdx = nNew;
     }
 
-    void SetLen( sal_Int32 nNew )
+    void SetLen(TextFrameIndex const nNew)
     {
         m_nLen = nNew;
     }
@@ -508,7 +517,7 @@ public:
 #endif
     }
 
-    void SetNumberOfBlanks( sal_Int32 nNew )
+    void SetNumberOfBlanks( TextFrameIndex const nNew )
     {
 #ifdef DBG_UTIL
         m_bNumberOfBlanks = true;
commit 0fa8f225daf32e3231a9dcdae940fd6a27a47dd8
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Tue May 22 17:02:41 2018 +0200

    sw_redlinehide: font headers
    
    Change-Id: If5d7ef45cf1c722728c4f31dd1390ce5d76aa255

diff --git a/sw/source/core/inc/swfont.hxx b/sw/source/core/inc/swfont.hxx
index 3049a9478704..d44055a8dd49 100644
--- a/sw/source/core/inc/swfont.hxx
+++ b/sw/source/core/inc/swfont.hxx
@@ -79,8 +79,8 @@ class SwSubFont : public SvxFont
     void DrawStretchCapital( SwDrawTextInfo &rInf );
     void DoOnCapitals( SwDoCapitals &rDo );
     void DrawStretchText_( SwDrawTextInfo &rInf );
-    sal_Int32 GetCursorOfst_( SwDrawTextInfo& rInf );
-    sal_Int32 GetCapitalCursorOfst( SwDrawTextInfo& rInf );
+    TextFrameIndex GetCursorOfst_( SwDrawTextInfo& rInf );
+    TextFrameIndex GetCapitalCursorOfst( SwDrawTextInfo& rInf );
 
     inline void SetColor( const Color& rColor );
     inline void SetFillColor( const Color& rColor );
@@ -297,10 +297,9 @@ public:
     // makes the logical font be effective in the OutputDevice
     void ChgPhysFnt( SwViewShell const *pSh, OutputDevice& rOut );
 
-    sal_Int32 GetCapitalBreak( SwViewShell const* pSh,  const OutputDevice* pOut,
+    TextFrameIndex GetCapitalBreak( SwViewShell const* pSh,  const OutputDevice* pOut,
         const SwScriptInfo* pScript, const OUString& rText,
-        long nTextWidth, const sal_Int32 nIdx,
-        const sal_Int32 nLen );
+        long nTextWidth, TextFrameIndex nIdx, TextFrameIndex nLen);
 
     void DoOnCapitals( SwDoCapitals &rDo )
         { m_aSub[m_nActual].DoOnCapitals( rDo ); }
@@ -308,9 +307,9 @@ public:
     Size GetTextSize_( SwDrawTextInfo& rInf )
         { rInf.SetFont( this ); return m_aSub[m_nActual].GetTextSize_( rInf ); }
 
-    sal_Int32 GetTextBreak( SwDrawTextInfo const & rInf, long nTextWidth );
+    TextFrameIndex GetTextBreak( SwDrawTextInfo const & rInf, long nTextWidth );
 
-    sal_Int32 GetCursorOfst_( SwDrawTextInfo& rInf )
+    TextFrameIndex GetCursorOfst_( SwDrawTextInfo& rInf )
         { return m_aSub[m_nActual].GetCursorOfst_( rInf ); }
 
     void DrawText_( SwDrawTextInfo &rInf )
@@ -947,14 +946,14 @@ inline void SwFont::SetHighlightColor( const Color& aNewColor )
 class SwUnderlineFont
 {
     Point m_aPos;
-    sal_Int32 m_nEnd;
+    TextFrameIndex m_nEnd;
     std::unique_ptr<SwFont> m_pFont;
 
 public:
     // sets the font which should paint the common baseline,
     // index where continuous underline ends,
     // and the starting point of the common baseline
-    SwUnderlineFont( SwFont& rFnt ,sal_Int32 m_nEnd , const Point& rPoint );
+    SwUnderlineFont(SwFont& rFnt, TextFrameIndex nEnd, const Point& rPoint);
     ~SwUnderlineFont();
 
     SwFont& GetFont()
@@ -963,7 +962,7 @@ public:
         return *m_pFont;
     }
     const Point& GetPos() const { return m_aPos; }
-    sal_Int32 GetEnd() const { return m_nEnd; }
+    TextFrameIndex GetEnd() const { return m_nEnd; }
     // the x coordinate of the starting point has to be set for each portion
     void SetPos( const Point& rPoint ) { m_aPos = rPoint;  }
 };
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 9aab72c50ddf..cb4706bdc927 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -2285,7 +2285,7 @@ SwCacheObj *SwFntAccess::NewObj( )
     return new SwFntObj( *static_cast<SwSubFont const *>(m_pOwner), ++pMagicNo, pShell );
 }
 
-sal_Int32 SwFont::GetTextBreak( SwDrawTextInfo const & rInf, long nTextWidth )
+TextFrameIndex SwFont::GetTextBreak(SwDrawTextInfo const & rInf, long nTextWidth)
 {
     ChgFnt( rInf.GetShell(), rInf.GetOut() );
 
diff --git a/sw/source/core/txtnode/fntcap.cxx b/sw/source/core/txtnode/fntcap.cxx
index 8bc703817a21..caf897e6f520 100644
--- a/sw/source/core/txtnode/fntcap.cxx
+++ b/sw/source/core/txtnode/fntcap.cxx
@@ -206,9 +206,9 @@ void SwDoGetCapitalBreak::Do()
     }
 }
 
-sal_Int32 SwFont::GetCapitalBreak( SwViewShell const * pSh, const OutputDevice* pOut,
+TextFrameIndex SwFont::GetCapitalBreak( SwViewShell const * pSh, const OutputDevice* pOut,
     const SwScriptInfo* pScript, const OUString& rText, long const nTextWidth,
-    const sal_Int32 nIdx, const sal_Int32 nLen )
+    TextFrameIndex const nIdx, TextFrameIndex const nLen)
 {
     // Start:
     Point aPos( 0, 0 );
@@ -372,7 +372,7 @@ void SwDoCapitalCursorOfst::Do()
     }
 }
 
-sal_Int32 SwSubFont::GetCapitalCursorOfst( SwDrawTextInfo& rInf )
+TextFrameIndex SwSubFont::GetCapitalCursorOfst( SwDrawTextInfo& rInf )
 {
     const long nOldKern = rInf.GetKern();
     rInf.SetKern( CheckKerning() );
diff --git a/sw/source/core/txtnode/swfont.cxx b/sw/source/core/txtnode/swfont.cxx
index 5e83449a6a98..1cd73e40cc2a 100644
--- a/sw/source/core/txtnode/swfont.cxx
+++ b/sw/source/core/txtnode/swfont.cxx
@@ -1336,7 +1336,7 @@ void SwSubFont::DrawStretchText_( SwDrawTextInfo &rInf )
     rInf.SetPos(aOldPos);
 }
 
-sal_Int32 SwSubFont::GetCursorOfst_( SwDrawTextInfo& rInf )
+TextFrameIndex SwSubFont::GetCursorOfst_( SwDrawTextInfo& rInf )
 {
     if ( !pLastFont || pLastFont->GetOwner()!=m_pMagic )
         ChgFnt( rInf.GetShell(), rInf.GetOut() );
@@ -1468,7 +1468,7 @@ void SwDrawTextInfo::Shift( sal_uInt16 nDir )
 /**
  * @note Used for the "continuous underline" feature.
  **/
-SwUnderlineFont::SwUnderlineFont( SwFont& rFnt, sal_Int32 nEnd, const Point& rPoint )
+SwUnderlineFont::SwUnderlineFont(SwFont& rFnt, TextFrameIndex const nEnd, const Point& rPoint)
         : m_aPos( rPoint ), m_nEnd( nEnd ), m_pFont( &rFnt )
 {
 };
commit 3642e6ce9e29ca8420d38d29c81417c3e522ef19
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Tue May 22 10:50:19 2018 +0200

    sw_redlinehide: trivial conversions in editsh.cxx,ndtxt.cxx
    
    Change-Id: Ife3df66e1873b2325a41ff196299008ce2422901

diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx
index 08248c57373c..2d206ba1d935 100644
--- a/sw/source/core/edit/editsh.cxx
+++ b/sw/source/core/edit/editsh.cxx
@@ -826,7 +826,7 @@ sal_uInt16 SwEditShell::GetLineCount()
     {
         if( nullptr != ( pContentFrame = pCNd->getLayoutFrame( GetLayout() ) ) && pContentFrame->IsTextFrame() )
         {
-            nRet = nRet + static_cast<SwTextFrame*>(pContentFrame)->GetLineCount( COMPLETE_STRING );
+            nRet = nRet + static_cast<SwTextFrame*>(pContentFrame)->GetLineCount(TextFrameIndex(COMPLETE_STRING));
         }
     }
     return nRet;
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 3b34cf52344a..3609f40054fe 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -483,7 +483,7 @@ SwContentNode *SwTextNode::SplitContentNode( const SwPosition &rPos )
             pFrame->RegisterToNode( *pNode );
             if (!pFrame->IsFollow() && pFrame->GetOfst())
             {
-                pFrame->SetOfst( 0 );
+                pFrame->SetOfst( TextFrameIndex(0) );
             }
         }
 
commit 65bd298621e3bee109f5a553d14a1c8e17e0d71b
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Tue May 22 10:49:36 2018 +0200

    sw_redlinehide: trivial conversions in reffld.cxx
    
    Change-Id: If40199166d63595edccc8d8329f36c7af67d5643

diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index 1087e04c0a6e..8bbdfde92c63 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -98,9 +98,11 @@ bool IsFrameBehind( const SwTextNode& rMyNd, sal_Int32 nMySttPos,
     const SwTextFrame *pMyFrame = static_cast<SwTextFrame*>(rMyNd.getLayoutFrame( rMyNd.GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr, false) ),
                    *pFrame = static_cast<SwTextFrame*>(rBehindNd.getLayoutFrame( rBehindNd.GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr, false) );
 
-    while( pFrame && !pFrame->IsInside( nSttPos ) )
+    TextFrameIndex const nMySttPosIndex(pFrame->MapModelToView(&rMyNd, nMySttPos));
+    TextFrameIndex const nSttPosIndex(pFrame->MapModelToView(&rBehindNd, nSttPos));
+    while (pFrame && !pFrame->IsInside(nSttPosIndex))
         pFrame = pFrame->GetFollow();
-    while( pMyFrame && !pMyFrame->IsInside( nMySttPos ) )
+    while (pMyFrame && !pMyFrame->IsInside(nMySttPosIndex))
         pMyFrame = pMyFrame->GetFollow();
 
     if( !pFrame || !pMyFrame || pFrame == pMyFrame )
@@ -566,7 +568,8 @@ void SwGetRefField::UpdateField( const SwTextField* pFieldTextAttr )
         {
             const SwTextFrame* pFrame = static_cast<SwTextFrame*>(pTextNd->getLayoutFrame( pDoc->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr, false)),
                         *pSave = pFrame;
-            while( pFrame && !pFrame->IsInside( nNumStart ) )
+            TextFrameIndex const nNumStartIndex(pFrame->MapModelToView(pTextNd, nNumStart));
+            while (pFrame && !pFrame->IsInside(nNumStartIndex))
                 pFrame = pFrame->GetFollow();
 
             if( pFrame || nullptr != ( pFrame = pSave ))
commit 5da797f5499d454c5b203d2f0d149e19318c8a68
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Tue May 22 10:47:01 2018 +0200

    sw_redlinehide: trivial conversions in dcontact.cxx
    
    Change-Id: I735a0879db5b44ab14202f6b3a75766c9a2d9cd0

diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index de8d91615722..67843b7f70ef 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -1710,16 +1710,17 @@ void SwDrawContact::DisconnectObjFromLayout( SdrObject* _pDrawObj )
 }
 
 static SwTextFrame* lcl_GetFlyInContentAnchor( SwTextFrame* _pProposedAnchorFrame,
-                                   const sal_Int32 _nTextOfs )
+                                   SwPosition const& rAnchorPos)
 {
     SwTextFrame* pAct = _pProposedAnchorFrame;
     SwTextFrame* pTmp;
+    TextFrameIndex const nTextOffset(_pProposedAnchorFrame->MapModelToViewPos(rAnchorPos));
     do
     {
         pTmp = pAct;

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list