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

Michael Stahl Michael.Stahl at cib.de
Wed May 9 16:48:03 UTC 2018


Rebased ref, commits from common ancestor:
commit a55f192344b0bb748a5887ffa66255831d63e09b
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Wed May 9 18:40:21 2018 +0200

    sw_redlinehide: trivial conversions in objectpositioning/
    
    Change-Id: Ice9c49596d478bd02728827dbd0dc2c77d7a13db

diff --git a/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx b/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx
index 4144f8241154..43070b3547f1 100644
--- a/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx
+++ b/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx
@@ -223,7 +223,7 @@ void SwToContentAnchoredObjectPosition::CalcPosition()
             // #i22341# - get top of line, in which the anchor character is.
             mnToCharTopOfLine = GetAnchoredObj().GetLastTopOfLine();
             pOrientFrame = &(const_cast<SwTextFrame&>(rAnchorTextFrame).GetFrameAtOfst(
-                                rAnch.GetContentAnchor()->nContent.GetIndex() ) );
+                rAnchorTextFrame.MapModelToViewPos(*rAnch.GetContentAnchor())));
             mpToCharOrientFrame = pOrientFrame;
         }
     }
commit 158db4f4a716eb2601f4089cb89fd4324a95dd51
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Wed May 9 18:39:59 2018 +0200

    sw_redlinehide: trivial conversions in trvlfrm.cxx
    
    Change-Id: I812ba7a03b9bd25134dab2e85fcead1c7bed617a

diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index 1586d7e5753d..d4c1e5c002c9 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -1013,10 +1013,9 @@ sal_uInt16 SwRootFrame::SetCurrPage( SwCursor* pToSet, sal_uInt16 nPageNum )
             pContent = pContent->GetNextContentFrame();
     if ( pContent )
     {
-        SwContentNode* pCNd = const_cast<SwContentNode*>(pContent->GetNode());
-        pToSet->GetPoint()->nNode = *pCNd;
-        pCNd->MakeStartIndex( &pToSet->GetPoint()->nContent );
-        pToSet->GetPoint()->nContent = static_cast<const SwTextFrame*>(pContent)->GetOfst();
+        assert(pContent->IsTextFrame());
+        SwTextFrame const*const pFrame(static_cast<const SwTextFrame*>(pContent));
+        *pToSet->GetPoint() = pFrame->MapViewToModelPos(pFrame->GetOfst());
 
         SwShellCursor* pSCursor = dynamic_cast<SwShellCursor*>(pToSet);
         if( pSCursor )
@@ -1110,15 +1109,14 @@ bool GetFrameInPage( const SwContentFrame *pCnt, SwWhichPage fnWhichPage,
             }
         }
 
-        SwContentNode *pCNd = const_cast<SwContentNode*>(pCnt->GetNode());
-        pPam->GetPoint()->nNode = *pCNd;
-        sal_Int32 nIdx;
-        if( fnPosPage == GetFirstSub )
-            nIdx = static_cast<const SwTextFrame*>(pCnt)->GetOfst();
-        else
-            nIdx = pCnt->GetFollow() ?
-                    static_cast<const SwTextFrame*>(pCnt)->GetFollow()->GetOfst()-1 : pCNd->Len();
-        pPam->GetPoint()->nContent.Assign( pCNd, nIdx );
+        assert(pCnt->IsTextFrame());
+        SwTextFrame const*const pFrame(static_cast<const SwTextFrame*>(pCnt));
+        TextFrameIndex const nIdx((fnPosPage == GetFirstSub)
+            ? pFrame->GetOfst()
+            : (pFrame->GetFollow())
+                ? pFrame->GetFollow()->GetOfst() - TextFrameIndex(1)
+                : TextFrameIndex(pFrame->GetText().getLength()));
+        *pPam->GetPoint() = pFrame->MapViewToModelPos(nIdx);
         return true;
     }
 }
commit 504bf0ed129ba72489c9bb37678d199569ab3a29
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Wed May 9 18:39:09 2018 +0200

    sw_redlinehide: trivial conversions in softpagebreak.cxx
    
    Still a bit TODO here wrt. finding the frame from every node...
    
    Change-Id: Icff33d2fae3afee77c4329db0938b444f0e47537

diff --git a/sw/source/core/layout/softpagebreak.cxx b/sw/source/core/layout/softpagebreak.cxx
index 051364d935e4..109730e8cfa0 100644
--- a/sw/source/core/layout/softpagebreak.cxx
+++ b/sw/source/core/layout/softpagebreak.cxx
@@ -79,7 +79,11 @@ void SwTextNode::fillSoftPageBreakList( SwSoftPageBreakList& rBreak ) const
                         if( pFirst2 == pFrame )
                         {   // Here we are: a first content inside a cell
                             // inside the splitted row => soft page break
-                            rBreak.insert( pFrame->GetOfst() );
+                            auto const pos(pFrame->MapViewToModel(pFrame->GetOfst()));
+                            if (pos.first == this)
+                            {
+                                rBreak.insert(pos.second);
+                            }
                             break;
                         }
                         pCell = pCell->GetNext();
@@ -88,7 +92,14 @@ void SwTextNode::fillSoftPageBreakList( SwSoftPageBreakList& rBreak ) const
             }
             else // No soft page break if there's a "hard" page break attribute
             if( pFirst2 == pFrame && !pFrame->IsPageBreak( true ) )
-                rBreak.insert( pFrame->GetOfst() );
+            {
+                auto const pos(pFrame->MapViewToModel(pFrame->GetOfst()));
+                if (pos.first == this)
+                {   // in the !Show case, we have to iterate over the merged
+                    // SwTextFrame for every node
+                    rBreak.insert(pos.second);
+                }
+            }
         }
     }
 }
commit 42790a71840aa56e25692bb90773a544c17461c2
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Wed May 9 18:38:03 2018 +0200

    sw_redlinehide: trivial conversions in layout/
    
    Change-Id: I5ce4590af52b3bfc08f89915999e86f4973fa9e3

diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx
index aaf96027e7aa..0a4292638342 100644
--- a/sw/source/core/layout/anchoreddrawobject.cxx
+++ b/sw/source/core/layout/anchoreddrawobject.cxx
@@ -572,7 +572,7 @@ void SwAnchoredDrawObject::InvalidateObjPos()
                  (GetFrameFormat().GetAnchor().GetAnchorId() == RndStdIds::FLY_AS_CHAR) )
             {
                 SwTextFrame* pAnchorTextFrame( static_cast<SwTextFrame*>(AnchorFrame()) );
-                if (pAnchorTextFrame->CalcFlyPos(&GetFrameFormat()) != COMPLETE_STRING)
+                if (pAnchorTextFrame->CalcFlyPos(&GetFrameFormat()) != TextFrameIndex(COMPLETE_STRING))
                 {
                     AnchorFrame()->Prepare( PREP_FLY_ATTR_CHG, &GetFrameFormat() );
                 }
diff --git a/sw/source/core/layout/anchoredobject.cxx b/sw/source/core/layout/anchoredobject.cxx
index 0145389eab9e..5958f29085bc 100644
--- a/sw/source/core/layout/anchoredobject.cxx
+++ b/sw/source/core/layout/anchoredobject.cxx
@@ -545,7 +545,7 @@ bool SwAnchoredObject::HasClearedEnvironment() const
             const SwTextFrame* pTmpTextFrame = static_cast<const SwTextFrame*>(pTmpFrame);
             if ( pTmpTextFrame->IsUndersized() ||
                  ( pTmpTextFrame->GetFollow() &&
-                   pTmpTextFrame->GetFollow()->GetOfst() == 0 ) )
+                   pTmpTextFrame->GetFollow()->GetOfst() == TextFrameIndex(0)))
             {
                 bHasClearedEnvironment = true;
             }
@@ -716,8 +716,9 @@ SwTextFrame* SwAnchoredObject::FindAnchorCharFrame()
         if ((rAnch.GetAnchorId() == RndStdIds::FLY_AT_CHAR) ||
             (rAnch.GetAnchorId() == RndStdIds::FLY_AS_CHAR))
         {
-            pAnchorCharFrame = &(static_cast<SwTextFrame*>(AnchorFrame())->
-                        GetFrameAtOfst( rAnch.GetContentAnchor()->nContent.GetIndex() ));
+            SwTextFrame *const pFrame(static_cast<SwTextFrame*>(AnchorFrame()));
+            TextFrameIndex const nOffset(pFrame->MapModelToViewPos(*rAnch.GetContentAnchor()));
+            pAnchorCharFrame = &pFrame->GetFrameAtOfst(nOffset);
         }
     }
 
diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx
index d4df9db6d843..21b9c443c8ce 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -1404,7 +1404,8 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/)
                 const SwTwips nHDiff = nOldH - aRectFnSet.GetHeight(getFrameArea());
                 const bool bNoPrepAdjustFrame =
                     nHDiff > 0 && IsInTab() && GetFollow() &&
-                    ( 1 == static_cast<SwTextFrame*>(GetFollow())->GetLineCount( COMPLETE_STRING ) || aRectFnSet.GetWidth(static_cast<SwTextFrame*>(GetFollow())->getFrameArea()) < 0 ) &&
+                    (1 == static_cast<SwTextFrame*>(GetFollow())->GetLineCount(TextFrameIndex(COMPLETE_STRING))
+                     || aRectFnSet.GetWidth(static_cast<SwTextFrame*>(GetFollow())->getFrameArea()) < 0) &&
                     GetFollow()->CalcAddLowerSpaceAsLastInTableCell() == nHDiff;
                 if ( !bNoPrepAdjustFrame )
                 {
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 47ca08c9ef72..2f817865535a 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -1082,10 +1082,10 @@ void SwFlyFrame::ChgRelPos( const Point &rNewPos )
             if( LONG_MAX != nNewY )
             {
                 aVert.SetVertOrient( text::VertOrientation::NONE );
-                sal_Int32 nOfs =
-                    pFormat->GetAnchor().GetContentAnchor()->nContent.GetIndex();
-                OSL_ENSURE( GetAnchorFrame()->IsTextFrame(), "TextFrame expected" );
+                assert(GetAnchorFrame()->IsTextFrame());
                 pAutoFrame = static_cast<const SwTextFrame*>(GetAnchorFrame());
+                TextFrameIndex const nOfs(pAutoFrame->MapModelToViewPos(
+                            *pFormat->GetAnchor().GetContentAnchor()));
                 while( pAutoFrame->GetFollow() &&
                        pAutoFrame->GetFollow()->GetOfst() <= nOfs )
                 {
@@ -1138,10 +1138,10 @@ void SwFlyFrame::ChgRelPos( const Point &rNewPos )
                 {
                     if( !pAutoFrame )
                     {
-                        sal_Int32 nOfs = pFormat->GetAnchor().GetContentAnchor()
-                                      ->nContent.GetIndex();
-                        OSL_ENSURE( GetAnchorFrame()->IsTextFrame(), "TextFrame expected");
+                        assert(GetAnchorFrame()->IsTextFrame());
                         pAutoFrame = static_cast<const SwTextFrame*>(GetAnchorFrame());
+                        TextFrameIndex const nOfs(pAutoFrame->MapModelToViewPos(
+                                    *pFormat->GetAnchor().GetContentAnchor()));
                         while( pAutoFrame->GetFollow() &&
                                pAutoFrame->GetFollow()->GetOfst() <= nOfs )
                             pAutoFrame = pAutoFrame->GetFollow();
diff --git a/sw/source/core/layout/objectformattertxtfrm.cxx b/sw/source/core/layout/objectformattertxtfrm.cxx
index 954b77913b67..1af4476d4946 100644
--- a/sw/source/core/layout/objectformattertxtfrm.cxx
+++ b/sw/source/core/layout/objectformattertxtfrm.cxx
@@ -272,7 +272,7 @@ bool SwObjectFormatterTextFrame::DoFormatObj( SwAnchoredObject& _rAnchoredObj,
             // objects under the condition, that its follow contains all its text.
             else if ( !mrAnchorTextFrame.IsFollow() &&
                       mrAnchorTextFrame.GetFollow() &&
-                      mrAnchorTextFrame.GetFollow()->GetOfst() == 0 )
+                      mrAnchorTextFrame.GetFollow()->GetOfst() == TextFrameIndex(0))
             {
                 SwLayouter::RemoveMovedFwdFrame(
                                 *(mrAnchorTextFrame.FindPageFrame()->GetFormat()->GetDoc()),
@@ -440,7 +440,7 @@ bool SwObjectFormatterTextFrame::DoFormatObjs()
         // objects under the condition, that its follow contains all its text.
         else if ( !mrAnchorTextFrame.IsFollow() &&
                   mrAnchorTextFrame.GetFollow() &&
-                  mrAnchorTextFrame.GetFollow()->GetOfst() == 0 )
+                  mrAnchorTextFrame.GetFollow()->GetOfst() == TextFrameIndex(0))
         {
             SwLayouter::RemoveMovedFwdFrame(
                             *(mrAnchorTextFrame.FindPageFrame()->GetFormat()->GetDoc()),
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 96612798d990..90cc289b2b21 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -5461,7 +5461,7 @@ static SwTwips lcl_CalcHeightOfFirstContentLine( const SwRowFrame& rSourceLine )
                     // would have no follow and thus would add this space.
                     if ( pTmp->IsTextFrame() &&
                          const_cast<SwTextFrame*>(static_cast<const SwTextFrame*>(pTmp))
-                                            ->GetLineCount( COMPLETE_STRING ) == 1 )
+                            ->GetLineCount(TextFrameIndex(COMPLETE_STRING)) == 1)
                     {
                         nTmpHeight += SwFlowFrame::CastFlowFrame(pTmp)
                                         ->CalcAddLowerSpaceAsLastInTableCell();
commit 79974c0aa75cc83cf06fcfb40f24444f6f1447b3
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Wed May 9 17:36:39 2018 +0200

    sw_redlinehide: convert SwTextIter::TruncLines() to MergedAttrIter
    
    Change-Id: I84d405df29139361dc521b490a50c16c95d10efa

diff --git a/sw/source/core/text/itrtxt.cxx b/sw/source/core/text/itrtxt.cxx
index d90186c05c1d..002eaf932fb4 100644
--- a/sw/source/core/text/itrtxt.cxx
+++ b/sw/source/core/text/itrtxt.cxx
@@ -342,16 +342,16 @@ void SwTextIter::TruncLines( bool bNoteFollow )
                     pLine = pLine->GetNext();
                 }
 
-                SwpHints* pTmpHints = GetTextFrame()->GetTextNode()->GetpSwpHints();
-
                 // examine hints in range nEnd - (nEnd + nRangeChar)
-                for( size_t i = 0; i < pTmpHints->Count(); ++i )
+                SwTextNode const* pNode(nullptr);
+                sw::MergedAttrIter iter(*GetTextFrame());
+                for (SwTextAttr const* pHt = iter.NextAttr(&pNode); pHt; pHt = iter.NextAttr(&pNode))
                 {
-                    const SwTextAttr* pHt = pTmpHints->Get( i );
                     if( RES_TXTATR_FLYCNT == pHt->Which() )
                     {
-                        // check, if hint is in our range
-                        const sal_Int32 nTmpPos = pHt->GetStart();
+                        // check if hint is in our range
+                        TextFrameIndex const nTmpPos(
+                            GetTextFrame()->MapModelToView(pNode, pHt->GetStart()));
                         if ( nEnd <= nTmpPos && nTmpPos < nRangeEnd )
                             pFollow->InvalidateRange_(
                                 SwCharRange( nTmpPos, nTmpPos ) );
commit d0c75f258fbf478bc94f95dafaf1ef947b736948
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Wed May 9 17:30:32 2018 +0200

    sw_redlinehide: trivial conversions in itrtxt.cxx
    
    Change-Id: Ia61fbdff0aa87669e643fa7d3d3fe08e23becd74

diff --git a/sw/source/core/text/itrtxt.cxx b/sw/source/core/text/itrtxt.cxx
index c842251e73ee..d90186c05c1d 100644
--- a/sw/source/core/text/itrtxt.cxx
+++ b/sw/source/core/text/itrtxt.cxx
@@ -206,7 +206,7 @@ const SwLineLayout *SwTextCursor::CharCursorToLine(TextFrameIndex const nPositio
         bRightMargin = false;
     bool bPrevious = bRightMargin && m_pCurr->GetLen() && GetPrev() &&
         GetPrev()->GetLen();
-    if( bPrevious && nPosition && CH_BREAK == GetInfo().GetChar( nPosition-1 ) )
+    if (bPrevious && nPosition && CH_BREAK == GetInfo().GetChar(nPosition - TextFrameIndex(1)))
         bPrevious = false;
     return bPrevious ? PrevLine() : m_pCurr;
 }
@@ -317,7 +317,7 @@ static bool lcl_NeedsFieldRest( const SwLineLayout* pCurr )
 void SwTextIter::TruncLines( bool bNoteFollow )
 {
     SwLineLayout *pDel = m_pCurr->GetNext();
-    const sal_Int32 nEnd = m_nStart + m_pCurr->GetLen();
+    TextFrameIndex const nEnd = m_nStart + m_pCurr->GetLen();
 
     if( pDel )
     {
@@ -332,7 +332,7 @@ void SwTextIter::TruncLines( bool bNoteFollow )
             if ( pFollow && ! pFollow->IsLocked() &&
                  nEnd == pFollow->GetOfst() )
             {
-                sal_Int32 nRangeEnd = nEnd;
+                TextFrameIndex nRangeEnd = nEnd;
                 SwLineLayout* pLine = pDel;
 
                 // determine range to be searched for flys anchored as characters
@@ -363,8 +363,10 @@ void SwTextIter::TruncLines( bool bNoteFollow )
     }
     if( m_pCurr->IsDummy() &&
         !m_pCurr->GetLen() &&
-         m_nStart < GetTextFrame()->GetText().getLength() )
+         m_nStart < TextFrameIndex(GetTextFrame()->GetText().getLength()))
+    {
         m_pCurr->SetRealHeight( 1 );
+    }
     if( GetHints() )
         m_pFrame->RemoveFootnote( nEnd );
 }
commit bbaaf00b7e6d47dc2254ec7710bad0a1daa3fb14
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Wed May 9 17:24:01 2018 +0200

    sw_redlinehide: trivial conversions in xmldump.cxx
    
    Change-Id: I37015a42cc1efdc324ccf7ac92423d9dbfb50be1

diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx
index 484f52405dd3..0f951cd6f033 100644
--- a/sw/source/core/text/xmldump.cxx
+++ b/sw/source/core/text/xmldump.cxx
@@ -31,7 +31,7 @@ class XmlPortionDumper:public SwPortionHandler
 {
   private:
     xmlTextWriterPtr writer;
-    sal_Int32 ofs;
+    TextFrameIndex ofs;
 
     static const char* getTypeName( sal_uInt16 nType )
     {
@@ -115,7 +115,7 @@ class XmlPortionDumper:public SwPortionHandler
         @param rText
                 text which is painted on-screen
       */
-    virtual void Text( sal_Int32 nLength,
+    virtual void Text( TextFrameIndex nLength,
                        sal_uInt16 nType,
                        sal_Int32 nHeight,
                        sal_Int32 nWidth) override
@@ -146,7 +146,7 @@ class XmlPortionDumper:public SwPortionHandler
         @param nHeight
                 font size of the painted text
       */
-    virtual void Special( sal_Int32 nLength,
+    virtual void Special( TextFrameIndex nLength,
                           const OUString & rText,
                           sal_uInt16 nType,
                           sal_Int32 nHeight,
@@ -191,7 +191,7 @@ class XmlPortionDumper:public SwPortionHandler
       * @param nLength
       *         number of 'model string' characters to be skipped
       */
-    virtual void Skip( sal_Int32 nLength ) override
+    virtual void Skip( TextFrameIndex nLength ) override
     {
         xmlTextWriterStartElement( writer, BAD_CAST( "Skip" ) );
         xmlTextWriterWriteFormatAttribute( writer,
commit f0cc5220321a1a3b136c6613b5542e8225d7b48a
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Wed May 9 17:17:57 2018 +0200

    sw_redlinehide: trivial conversions in itrpaint.cxx
    
    Change-Id: I12cdc805c3e07840b5b914397026a48a589785ea

diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx
index 47769b372ef8..cc98272947d1 100644
--- a/sw/source/core/text/itrpaint.cxx
+++ b/sw/source/core/text/itrpaint.cxx
@@ -317,7 +317,7 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip,
             SeekAndChgBefore( GetInfo() );
         else if ( pPor->IsQuoVadisPortion() )
         {
-            sal_Int32 nOffset = GetInfo().GetIdx();
+            TextFrameIndex nOffset = GetInfo().GetIdx();
             SeekStartAndChg( GetInfo(), true );
             if( GetRedln() && m_pCurr->HasRedline() )
                 GetRedln()->Seek( *m_pFont, nOffset, 0 );
@@ -428,7 +428,7 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip,
         if( !GetNextLine() &&
             GetInfo().GetVsh() && !GetInfo().GetVsh()->IsPreview() &&
             GetInfo().GetOpt().IsParagraph() && !GetTextFrame()->GetFollow() &&
-            GetInfo().GetIdx() >= GetInfo().GetText().getLength() )
+            GetInfo().GetIdx() >= TextFrameIndex(GetInfo().GetText().getLength()))
         {
             const SwTmpEndPortion aEnd( *pEndTempl );
             GetFnt()->ChgPhysFnt( GetInfo().GetVsh(), *pOut );
@@ -460,7 +460,7 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip,
                 // GetInfo().Y() must be current baseline
                 SwTwips nDiff = GetInfo().Y() + nTmpHeight - nTmpAscent - GetTextFrame()->getFrameArea().Bottom();
                 if( ( nDiff > 0 &&
-                      ( GetEnd() < GetInfo().GetText().getLength() ||
+                      (GetEnd() < TextFrameIndex(GetInfo().GetText().getLength()) ||
                         ( nDiff > nTmpHeight/2 && GetPrevLine() ) ) ) ||
                     (nDiff >= 0 && bNextUndersized) )
 
@@ -490,7 +490,8 @@ void SwTextPainter::CheckSpecialUnderline( const SwLinePortion* pPor,
         return;
     }
     // Reuse calculated underline font as much as possible.
-    if ( GetInfo().GetUnderFnt() && GetInfo().GetIdx() + pPor->GetLen() <= GetInfo().GetUnderFnt()->GetEnd() + 1 )
+    if (GetInfo().GetUnderFnt() &&
+        GetInfo().GetIdx() + pPor->GetLen() <= GetInfo().GetUnderFnt()->GetEnd() + TextFrameIndex(1))
     {
         SwFont &rFont = GetInfo().GetUnderFnt()->GetFont();
         const Color aColor = GetUnderColor( GetInfo().GetFont() );
@@ -536,47 +537,47 @@ void SwTextPainter::CheckSpecialUnderline( const SwLinePortion* pPor,
         }
     }
 
-    const sal_Int32 nIndx = GetInfo().GetIdx();
-    long nUnderEnd = 0;
+    const TextFrameIndex nIndx = GetInfo().GetIdx();
+    TextFrameIndex nUnderEnd(0);
     const size_t nCnt = aUnderMulti.GetRangeCount();
 
     // find the underline range the current portion is contained in
     for( size_t i = 0; i < nCnt; ++i )
     {
         const Range& rRange = aUnderMulti.GetRange( i );
-        if( nUnderEnd == rRange.Min() )
-            nUnderEnd = rRange.Max();
-        else if( nIndx >= rRange.Min() )
+        if (nUnderEnd == TextFrameIndex(rRange.Min()))
+            nUnderEnd = TextFrameIndex(rRange.Max());
+        else if (nIndx >= TextFrameIndex(rRange.Min()))
         {
-            nUnderEnd = rRange.Max();
+            nUnderEnd = TextFrameIndex(rRange.Max());
         }
         else
             break;
     }
 
     if ( GetEnd() && GetEnd() <= nUnderEnd )
-        nUnderEnd = GetEnd() - 1;
+        nUnderEnd = GetEnd() - TextFrameIndex(1);
 
     // calculate the new common underline font
     SwFont* pUnderlineFnt = nullptr;
     Point aCommonBaseLine;
 
     // check, if underlining is not isolated
-    if ( nIndx + GetInfo().GetLen() < nUnderEnd + 1 )
+    if (nIndx + GetInfo().GetLen() < nUnderEnd + TextFrameIndex(1))
     {
         // here starts the algorithm for calculating the underline font
         SwScriptInfo& rScriptInfo = GetInfo().GetParaPortion()->GetScriptInfo();
         SwAttrIter aIter( *GetInfo().GetTextFrame()->GetTextNode(),
                           rScriptInfo );
 
-        sal_Int32 nTmpIdx = nIndx;
+        TextFrameIndex nTmpIdx = nIndx;
         sal_uLong nSumWidth = 0;
         sal_uLong nSumHeight = 0;
         sal_uLong nBold = 0;
         sal_uInt16 nMaxBaseLineOfst = 0;
         int nNumberOfPortions = 0;
 
-        while( sal::static_int_cast<long>(nTmpIdx) <= nUnderEnd && pPor )
+        while (nTmpIdx <= nUnderEnd && pPor)
         {
             if ( pPor->IsFlyPortion() || pPor->IsFlyCntPortion() ||
                 pPor->IsBreakPortion() || pPor->IsMarginPortion() ||
commit 04678d3571cd0b1b45b4d3dd0ad7b6fa996a3597
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Wed May 9 16:46:46 2018 +0200

    sw_redlinehide: trivial conversions in itrform2.cxx
    
    Change-Id: I83c0dd85f2f6c68edb7a48928db68fb4e84e5387

diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 9f5eb81469af..b77b2d29d386 100755
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -68,10 +68,10 @@ namespace {
     //! Calculates and sets optimal repaint offset for the current line
     long lcl_CalcOptRepaint( SwTextFormatter &rThis,
                                     SwLineLayout const &rCurr,
-                                    const sal_Int32 nOldLineEnd,
+                                    TextFrameIndex nOldLineEnd,
                                     const std::vector<long> &rFlyStarts );
     //! Determine if we need to build hidden portions
-    bool lcl_BuildHiddenPortion( const SwTextSizeInfo& rInf, sal_Int32 &rPos );
+    bool lcl_BuildHiddenPortion(const SwTextSizeInfo& rInf, TextFrameIndex &rPos);
 
     // Check whether the two font has the same border
     bool lcl_HasSameBorder(const SwFont& rFirst, const SwFont& rSecond);
@@ -95,15 +95,15 @@ void SwTextFormatter::CtorInitTextFormatter( SwTextFrame *pNewFrame, SwTextForma
     bTruncLines = false;
     nCntEndHyph = 0;
     nCntMidHyph = 0;
-    nLeftScanIdx = COMPLETE_STRING;
-    nRightScanIdx = 0;
+    nLeftScanIdx = TextFrameIndex(COMPLETE_STRING);
+    nRightScanIdx = TextFrameIndex(0);
     m_nHintEndIndex = 0;
     m_pFirstOfBorderMerge = nullptr;
 
-    if( m_nStart > GetInfo().GetText().getLength() )
+    if (m_nStart > TextFrameIndex(GetInfo().GetText().getLength()))
     {
         OSL_ENSURE( false, "+SwTextFormatter::CTOR: bad offset" );
-        m_nStart = GetInfo().GetText().getLength();
+        m_nStart = TextFrameIndex(GetInfo().GetText().getLength());
     }
 
 }
@@ -159,8 +159,8 @@ SwLinePortion *SwTextFormatter::Underflow( SwTextFormatInfo &rInf )
     // line again.
     // Can be seen in 8081.sdw, if you enter text in the first line
 
-    const sal_Int32 nSoftHyphPos = rInf.GetSoftHyphPos();
-    const sal_Int32 nUnderScorePos = rInf.GetUnderScorePos();
+    TextFrameIndex const nSoftHyphPos = rInf.GetSoftHyphPos();
+    TextFrameIndex const nUnderScorePos = rInf.GetUnderScorePos();
 
     // Save flys and set to 0, or else segmentation fault
     // Not ClearFly(rInf) !
@@ -398,8 +398,8 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf )
 
     while( pPor && !rInf.IsStop() )
     {
-        OSL_ENSURE( rInf.GetLen() < COMPLETE_STRING &&
-                rInf.GetIdx() <= rInf.GetText().getLength(),
+        OSL_ENSURE(rInf.GetLen() < TextFrameIndex(COMPLETE_STRING) &&
+                rInf.GetIdx() <= TextFrameIndex(rInf.GetText().getLength()),
                 "SwTextFormatter::BuildPortions: bad length in info" );
 
         // We have to check the script for fields in order to set the
@@ -435,7 +435,7 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf )
             else
             {
                 const OUString& rText = rInf.GetText();
-                sal_Int32 nIdx = rInf.GetIdx();
+                sal_Int32 nIdx = sal_Int32(rInf.GetIdx());
                 bAllowBehind = nIdx < rText.getLength() && rCC.isLetterNumeric(rText, nIdx);
             }
 
@@ -462,10 +462,10 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf )
                 }
                 else if ( rInf.GetIdx() )
                 {
-                    bAllowBefore = rCC.isLetterNumeric( rInf.GetText(), rInf.GetIdx() - 1 );
+                    bAllowBefore = rCC.isLetterNumeric(rInf.GetText(), sal_Int32(rInf.GetIdx()) - 1);
                     // Note: ScriptType returns values in [1,4]
                     if ( bAllowBefore )
-                        nLstActual = SwFontScript(m_pScriptInfo->ScriptType( rInf.GetIdx() - 1 ) - 1);
+                        nLstActual = SwFontScript(m_pScriptInfo->ScriptType(rInf.GetIdx() - TextFrameIndex(1)) - 1);
                 }
 
                 nLstHeight /= 5;
@@ -758,7 +758,7 @@ void SwTextFormatter::CalcAscent( SwTextFormatInfo &rInf, SwLinePortion *pPor )
     // i#89179
     // tab portion representing the list tab of a list label gets the
     // same height and ascent as the corresponding number portion
-    else if ( pPor->InTabGrp() && pPor->GetLen() == 0 &&
+    else if ( pPor->InTabGrp() && pPor->GetLen() == TextFrameIndex(0) &&
               rInf.GetLast() && rInf.GetLast()->InNumberGrp() &&
               static_cast<const SwNumberPortion*>(rInf.GetLast())->HasFont() )
     {
@@ -886,17 +886,16 @@ SwTextPortion *SwTextFormatter::WhichTextPor( SwTextFormatInfo &rInf ) const
             // Only at the End!
             // If pCurr does not have a width, it can however already have content.
             // E.g. for non-displayable characters
-            if (rInf.GetText()[rInf.GetIdx()]==CH_TXT_ATR_FIELDSTART)
+            auto const ch(rInf.GetText()[sal_Int32(rInf.GetIdx())]);
+            if (ch == CH_TXT_ATR_FIELDSTART)
                 pPor = new SwFieldMarkPortion();
-            else if (rInf.GetText()[rInf.GetIdx()]==CH_TXT_ATR_FIELDEND)
+            else if (ch == CH_TXT_ATR_FIELDEND)
                 pPor = new SwFieldMarkPortion();
-            else if (rInf.GetText()[rInf.GetIdx()]==CH_TXT_ATR_FORMELEMENT)
+            else if (ch == CH_TXT_ATR_FORMELEMENT)
             {
-                SwTextNode *pNd = rInf.GetTextFrame()->GetTextNode();
-                const SwDoc *doc = pNd->GetDoc();
-                SwIndex aIndex(pNd, rInf.GetIdx());
-                SwPosition aPosition(*pNd, aIndex);
-                sw::mark::IFieldmark *pBM = doc->getIDocumentMarkAccess()->getFieldmarkFor(aPosition);
+                SwTextFrame const*const pFrame(rInf.GetTextFrame());
+                SwPosition aPosition(pFrame->MapViewToModelPos(rInf.GetIdx()));
+                sw::mark::IFieldmark *pBM = pFrame->GetDoc().getIDocumentMarkAccess()->getFieldmarkFor(aPosition);
                 OSL_ENSURE(pBM != nullptr, "Where is my form field bookmark???");
                 if (pBM != nullptr)
                 {
@@ -947,8 +946,8 @@ SwTextPortion *SwTextFormatter::NewTextPortion( SwTextFormatInfo &rInf )
     SwTextPortion *pPor = WhichTextPor( rInf );
 
     // until next attribute change:
-    const sal_Int32 nNextAttr = GetNextAttr();
-    sal_Int32 nNextChg = std::min( nNextAttr, rInf.GetText().getLength() );
+    const TextFrameIndex nNextAttr = GetNextAttr();
+    TextFrameIndex nNextChg = std::min(nNextAttr, TextFrameIndex(rInf.GetText().getLength()));
 
     // end of script type:
     const sal_Int32 nNextScript = m_pScriptInfo->NextScriptChg( rInf.GetIdx() );
@@ -971,7 +970,7 @@ SwTextPortion *SwTextFormatter::NewTextPortion( SwTextFormatInfo &rInf )
     // It follows that a line with a lot of blanks is processed incorrectly.
     // Therefore we increase from factor 2 to 8 (due to negative kerning).
 
-    pPor->SetLen(1);
+    pPor->SetLen(TextFrameIndex(1));
     CalcAscent( rInf, pPor );
 
     const SwFont* pTmpFnt = rInf.GetFont();
@@ -979,9 +978,9 @@ SwTextPortion *SwTextFormatter::NewTextPortion( SwTextFormatInfo &rInf )
                              sal_Int32( pPor->GetAscent() ) ) / 8;
     if ( !nExpect )
         nExpect = 1;
-    nExpect = rInf.GetIdx() + ((rInf.Width() - rInf.X()) / nExpect);
-    if( nExpect > rInf.GetIdx() && nNextChg > nExpect )
-        nNextChg = std::min( nExpect, rInf.GetText().getLength() );
+    nExpect = sal_Int32(rInf.GetIdx()) + ((rInf.Width() - rInf.X()) / nExpect);
+    if (TextFrameIndex(nExpect) > rInf.GetIdx() && nNextChg > TextFrameIndex(nExpect))
+        nNextChg = TextFrameIndex(std::min(nExpect, rInf.GetText().getLength()));
 
     // we keep an invariant during method calls:
     // there are no portion ending characters like hard spaces
@@ -1231,7 +1230,7 @@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf )
     // Check for Hidden Portion:
     if ( !pPor )
     {
-        sal_Int32 nEnd = rInf.GetIdx();
+        TextFrameIndex nEnd = rInf.GetIdx();
         if ( ::lcl_BuildHiddenPortion( rInf, nEnd ) )
             pPor = new SwHiddenTextPortion( nEnd - rInf.GetIdx() );
     }
@@ -1245,7 +1244,7 @@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf )
         {
             // We open a multiportion part, if we enter a multi-line part
             // of the paragraph.
-            sal_Int32 nEnd = rInf.GetIdx();
+            TextFrameIndex nEnd = rInf.GetIdx();
             SwMultiCreator* pCreate = rInf.GetMultiCreator( nEnd, pMulti );
             if( pCreate )
             {
@@ -1257,7 +1256,7 @@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf )
                 {
                     pTmp = new SwRubyPortion( *pCreate, *rInf.GetFont(),
                                               *GetTextFrame()->GetTextNode()->getIDocumentSettingAccess(),
-                                              nEnd, 0, rInf );
+                                              nEnd, TextFrameIndex(0), rInf );
                 }
                 else if( SwMultiCreatorId::Rotate == pCreate->nId )
                     pTmp = new SwRotatedPortion( *pCreate, nEnd,
@@ -1287,7 +1286,7 @@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf )
         }
         else
         {
-            if( rInf.GetIdx() >= rInf.GetText().getLength() )
+            if (rInf.GetIdx() >= TextFrameIndex(rInf.GetText().getLength()))
             {
                 rInf.SetFull(true);
                 CalcFlyWidth( rInf );
@@ -1370,7 +1369,7 @@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf )
         // if a portion is created despite there being a pending RestPortion,
         // then it is a field which has been split (e.g. because it contains a Tab)
         if( pPor && rInf.GetRest() )
-            pPor->SetLen( 0 );
+            pPor->SetLen(TextFrameIndex(0));
 
         // robust:
         if( !pPor || rInf.IsStop() )
@@ -1409,9 +1408,10 @@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf )
                 if ( 0 != nDir )
                 {
                     delete pPor;
-                    pPor = new SwRotatedPortion( rInf.GetIdx() + 1, 900 == nDir ?
-                                                    DIR_BOTTOM2TOP :
-                                                    DIR_TOP2BOTTOM );
+                    pPor = new SwRotatedPortion(rInf.GetIdx() + TextFrameIndex(1),
+                                                900 == nDir
+                                                    ? DIR_BOTTOM2TOP
+                                                    : DIR_TOP2BOTTOM );
                 }
             }
         }
@@ -1425,9 +1425,9 @@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf )
                 if ( 0 != nDir )
                 {
                     delete pPor;
-                    pPor = new SwRotatedPortion( 0, 900 == nDir ?
-                                                    DIR_BOTTOM2TOP :
-                                                    DIR_TOP2BOTTOM );
+                    pPor = new SwRotatedPortion(TextFrameIndex(0), 900 == nDir
+                                                    ? DIR_BOTTOM2TOP
+                                                    : DIR_TOP2BOTTOM );
 
                     rInf.SetNumDone( false );
                     rInf.SetFootnoteDone( false );
@@ -1470,8 +1470,8 @@ TextFrameIndex SwTextFormatter::FormatLine(TextFrameIndex const nStartPos)
 
     // For the formatting routines, we set pOut to the reference device.
     SwHookOut aHook( GetInfo() );
-    if( GetInfo().GetLen() < GetInfo().GetText().getLength() )
-        GetInfo().SetLen( GetInfo().GetText().getLength() );
+    if (GetInfo().GetLen() < TextFrameIndex(GetInfo().GetText().getLength()))
+        GetInfo().SetLen(TextFrameIndex(GetInfo().GetText().getLength()));
 
     bool bBuild = true;
     SetFlyInCntBase( false );
@@ -1497,7 +1497,7 @@ TextFrameIndex SwTextFormatter::FormatLine(TextFrameIndex const nStartPos)
     // for an optimal repaint rectangle, we want to compare fly portions
     // before and after the BuildPortions call
     const bool bOptimizeRepaint = AllowRepaintOpt();
-    const sal_Int32 nOldLineEnd = nStartPos + m_pCurr->GetLen();
+    TextFrameIndex const nOldLineEnd = nStartPos + m_pCurr->GetLen();
     std::vector<long> flyStarts;
 
     // these are the conditions for a fly position comparison
@@ -1539,7 +1539,7 @@ TextFrameIndex SwTextFormatter::FormatLine(TextFrameIndex const nStartPos)
 
         if( GetInfo().IsStop() )
         {
-            m_pCurr->SetLen( 0 );
+            m_pCurr->SetLen(TextFrameIndex(0));
             m_pCurr->Height( GetFrameRstHeight() + 1 );
             m_pCurr->SetRealHeight( GetFrameRstHeight() + 1 );
             m_pCurr->Width(0);
@@ -1594,7 +1594,7 @@ TextFrameIndex SwTextFormatter::FormatLine(TextFrameIndex const nStartPos)
                 if ( xSaveField )
                     GetInfo().SetRest( new SwFieldPortion( *xSaveField ) );
 
-                m_pCurr->SetLen( 0 );
+                m_pCurr->SetLen(TextFrameIndex(0));
                 m_pCurr->Width(0);
                 m_pCurr->Truncate();
             }
@@ -1639,7 +1639,7 @@ TextFrameIndex SwTextFormatter::FormatLine(TextFrameIndex const nStartPos)
     // delete master copy of rest portion
     xSaveField.reset();
 
-    sal_Int32 nNewStart = nStartPos + m_pCurr->GetLen();
+    TextFrameIndex const nNewStart = nStartPos + m_pCurr->GetLen();
 
     // adjust text if kana compression is enabled
     if ( GetInfo().CompressLine() )
@@ -1723,8 +1723,9 @@ void SwTextFormatter::CalcRealHeight( bool bNewLine )
     // consider register-true and so on. Unfortunately an empty line can be at
     // the end of a paragraph (empty paragraphs or behind a Shift-Return),
     // which should consider the register.
-    if( !m_pCurr->IsDummy() || ( !m_pCurr->GetNext() &&
-        GetStart() >= GetTextFrame()->GetText().getLength() && !bNewLine ) )
+    if (!m_pCurr->IsDummy() || (!m_pCurr->GetNext()
+            && GetStart() >= TextFrameIndex(GetTextFrame()->GetText().getLength())
+            && !bNewLine))
     {
         const SvxLineSpacingItem *pSpace = m_aLineInf.GetLineSpacing();
         if( pSpace )
@@ -1953,10 +1954,12 @@ bool SwTextFormatter::AllowRepaintOpt() const
     }
 
     // Again another special case: invisible SoftHyphs
-    const sal_Int32 nReformat = GetInfo().GetReformatStart();
-    if( bOptimizeRepaint && COMPLETE_STRING != nReformat )
+    const TextFrameIndex nReformat = GetInfo().GetReformatStart();
+    if (bOptimizeRepaint && TextFrameIndex(COMPLETE_STRING) != nReformat)
     {
-        const sal_Unicode cCh = nReformat >= GetInfo().GetText().getLength() ? 0 : GetInfo().GetText()[ nReformat ];
+        const sal_Unicode cCh = nReformat >= TextFrameIndex(GetInfo().GetText().getLength())
+            ? 0
+            : GetInfo().GetText()[ sal_Int32(nReformat) ];
         bOptimizeRepaint = ( CH_TXTATR_BREAKWORD != cCh && CH_TXTATR_INWORD != cCh )
                             || ! GetInfo().HasHint( nReformat );
     }
@@ -2083,7 +2086,7 @@ void SwTextFormatter::UpdatePos( SwLineLayout *pCurrent, Point aStart,
                 // jump to end of the bidi portion
                 aSt.AdjustX(pLay->Width() );
 
-            sal_Int32 nStIdx = aTmpInf.GetIdx();
+            TextFrameIndex nStIdx = aTmpInf.GetIdx();
             do
             {
                 UpdatePos( pLay, aSt, nStIdx, bAlways );
@@ -2343,7 +2346,7 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo &rInf )
 
     // Although no text is left, we need to format another line,
     // because also empty lines need to avoid a Fly with no wrapping.
-    if( bFullLine && rInf.GetIdx() == rInf.GetText().getLength() )
+    if (bFullLine && rInf.GetIdx() == TextFrameIndex(rInf.GetText().getLength()))
     {
         rInf.SetNewLine( true );
         // We know that for dummies, it holds ascent == height
@@ -2394,7 +2397,7 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo &rInf )
     }
     else
     {
-        if( rInf.GetIdx() == rInf.GetText().getLength() )
+        if (rInf.GetIdx() == TextFrameIndex(rInf.GetText().getLength()))
         {
             // Don't use nHeight, or we have a huge descent
             pFly->Height( pLast->Height() );
@@ -2590,9 +2593,11 @@ void SwTextFormatter::MergeCharacterBorder( SwLinePortion& rPortion, SwLinePorti
 
         // Get next portion's font
         bool bSeek = false;
-        if( !rInf.IsFull() && // Not the last portion of the line (in case of line break)
-            rInf.GetIdx() + rPortion.GetLen() != rInf.GetText().getLength() ) // Not the last portion of the paragraph
+        if (!rInf.IsFull() && // Not the last portion of the line (in case of line break)
+            rInf.GetIdx() + rPortion.GetLen() != TextFrameIndex(rInf.GetText().getLength())) // Not the last portion of the paragraph
+        {
             bSeek = Seek(rInf.GetIdx() + rPortion.GetLen());
+        }
         // Don't join the next portion if SwKernPortion sits between two different boxes.
         bool bDisconnect = rPortion.IsKernPortion() && !rPortion.GetJoinBorderWithPrev();
         // If next portion has the same border then merge
@@ -2660,7 +2665,7 @@ namespace {
     // calculates and sets optimal repaint offset for the current line
     long lcl_CalcOptRepaint( SwTextFormatter &rThis,
                          SwLineLayout const &rCurr,
-                         const sal_Int32 nOldLineEnd,
+                         TextFrameIndex const nOldLineEnd,
                          const std::vector<long> &rFlyStarts )
     {
         SwTextFormatInfo& txtFormatInfo = rThis.GetInfo();
@@ -2669,7 +2674,7 @@ namespace {
         // something of our text has moved to the next line
             return 0;
 
-        sal_Int32 nReformat = std::min<sal_Int32>( txtFormatInfo.GetReformatStart(), nOldLineEnd );
+        TextFrameIndex nReformat = std::min(txtFormatInfo.GetReformatStart(), nOldLineEnd);
 
         // in case we do not have any fly in our line, our repaint position
         // is the changed position - 1
@@ -2681,16 +2686,16 @@ namespace {
             // limit for the repaint offset
             const long nFormatRepaint = txtFormatInfo.GetPaintOfst();
 
-            if ( nReformat < txtFormatInfo.GetLineStart() + 3 )
+            if (nReformat < txtFormatInfo.GetLineStart() + TextFrameIndex(3))
                 return 0;
 
             // step back two positions for smoother repaint
-            nReformat -= 2;
+            nReformat -= TextFrameIndex(2);
 
             // i#28795, i#34607, i#38388
             // step back more characters, this is required by complex scripts
             // e.g., for Khmer (thank you, Javier!)
-            static const sal_Int32 nMaxContext = 10;
+            static const TextFrameIndex nMaxContext(10);
             if (nReformat > txtFormatInfo.GetLineStart() + nMaxContext)
                 nReformat = nReformat - nMaxContext;
             else
@@ -2729,7 +2734,7 @@ namespace {
             long nPOfst = 0;
             size_t nCnt = 0;
             long nX = 0;
-            sal_Int32 nIdx = rThis.GetInfo().GetLineStart();
+            TextFrameIndex nIdx = rThis.GetInfo().GetLineStart();
             SwLinePortion* pPor = rCurr.GetFirstPortion();
 
             while ( pPor )
@@ -2758,7 +2763,7 @@ namespace {
     }
 
     // Determine if we need to build hidden portions
-    bool lcl_BuildHiddenPortion( const SwTextSizeInfo& rInf, sal_Int32 &rPos )
+    bool lcl_BuildHiddenPortion(const SwTextSizeInfo& rInf, TextFrameIndex & rPos)
     {
         // Only if hidden text should not be shown:
     //    if ( rInf.GetVsh() && rInf.GetVsh()->GetWin() && rInf.GetOpt().IsShowHiddenChar() )
@@ -2768,8 +2773,8 @@ namespace {
             return false;
 
         const SwScriptInfo& rSI = rInf.GetParaPortion()->GetScriptInfo();
-        sal_Int32 nHiddenStart;
-        sal_Int32 nHiddenEnd;
+        TextFrameIndex nHiddenStart;
+        TextFrameIndex nHiddenEnd;
         rSI.GetBoundsOfHiddenRange( rPos, nHiddenStart, nHiddenEnd );
         if ( nHiddenEnd )
         {
commit 5bc9621031d0812665ff22c773fe5e508da2b245
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Wed May 9 16:00:22 2018 +0200

    sw_redlinehide: trivial conversions in itrcrsr.cxx
    
    Change-Id: Ic402f6f2d8bbe92b7cfa65f5f4018ad47f44eed8

diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index 143f959fb85c..44c9212ff233 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -101,8 +101,8 @@ static void lcl_GetCharRectInsideField( SwTextSizeInfo& rInf, SwRect& rOrig,
             // get script for field portion
             rInf.GetFont()->SetActual( SwScriptInfo::WhichFont( 0, pString, nullptr ) );
 
-            sal_Int32 nOldLen = pPor->GetLen();
-            const_cast<SwLinePortion*>(pPor)->SetLen( nLen - 1 );
+            TextFrameIndex const nOldLen = pPor->GetLen();
+            const_cast<SwLinePortion*>(pPor)->SetLen(TextFrameIndex(nLen - 1));
             const SwTwips nX1 = pPor->GetLen() ?
                                 pPor->GetTextSize( rInf ).Width() :
                                 0;
@@ -110,7 +110,7 @@ static void lcl_GetCharRectInsideField( SwTextSizeInfo& rInf, SwRect& rOrig,
             SwTwips nX2 = 0;
             if ( rCMS.m_bRealWidth )
             {
-                const_cast<SwLinePortion*>(pPor)->SetLen( nLen );
+                const_cast<SwLinePortion*>(pPor)->SetLen(TextFrameIndex(nLen));
                 nX2 = pPor->GetTextSize( rInf ).Width();
             }
 
@@ -403,7 +403,7 @@ bool SwTextCursor::GetEndCharRect(SwRect* pOrig, const TextFrameIndex nOfst,
     {
         // 8810: Master line RightMargin, after that LeftMargin
         const bool bRet = GetCharRect( pOrig, nOfst, pCMS, nMax );
-        bRightMargin = nOfst >= GetEnd() && nOfst < GetInfo().GetText().getLength();
+        bRightMargin = nOfst >= GetEnd() && nOfst < TextFrameIndex(GetInfo().GetText().getLength());
         return bRet;
     }
 
@@ -502,7 +502,7 @@ void SwTextCursor::GetCharRect_( SwRect* pOrig, TextFrameIndex const nOfst,
         SwTwips nTmpFirst = 0;
         SwLinePortion *pPor = m_pCurr->GetFirstPortion();
         SwBidiPortion* pLastBidiPor = nullptr;
-        sal_Int32 nLastBidiIdx = -1;
+        TextFrameIndex nLastBidiIdx(-1);
         SwTwips nLastBidiPorWidth = 0;
         std::deque<sal_uInt16>* pKanaComp = m_pCurr->GetpKanaComp();
         sal_uInt16 nSpaceIdx = 0;
@@ -593,9 +593,10 @@ void SwTextCursor::GetCharRect_( SwRect* pOrig, TextFrameIndex const nOfst,
                 // For common portions (including BidiPortions) we want to add
                 // the portion width to nX. For MultiPortions, nExtra = 0,
                 // therefore we go to the 'else' branch and start a recursion.
-                const sal_Int32 nExtra = pPor->IsMultiPortion() &&
-                                    ! static_cast<SwMultiPortion*>(pPor)->IsBidi() &&
-                                    ! bWidth ? 0 : 1;
+                const TextFrameIndex nExtra( (pPor->IsMultiPortion()
+                             && !static_cast<SwMultiPortion*>(pPor)->IsBidi()
+                             && !bWidth)
+                        ? 0 : 1 );
                 if ( aInf.GetIdx() + pPor->GetLen() < nOfst + nExtra )
                 {
                     if ( pPor->InSpaceGrp() && nSpaceAdd )
@@ -703,7 +704,7 @@ void SwTextCursor::GetCharRect_( SwRect* pOrig, TextFrameIndex const nOfst,
                         // In a multi-portion we use GetCharRect()-function
                         // recursively and must add the x-position
                         // of the multi-portion.
-                        sal_Int32 nOldStart = m_nStart;
+                        TextFrameIndex const nOldStart = m_nStart;
                         SwTwips nOldY = m_nY;
                         sal_uInt8 nOldProp = GetPropFont();
                         m_nStart = aInf.GetIdx();
@@ -872,7 +873,7 @@ void SwTextCursor::GetCharRect_( SwRect* pOrig, TextFrameIndex const nOfst,
                     }
                     if ( pPor->PrtWidth() )
                     {
-                        sal_Int32 nOldLen = pPor->GetLen();
+                        TextFrameIndex const nOldLen = pPor->GetLen();
                         pPor->SetLen( nOfst - aInf.GetIdx() );
                         aInf.SetLen( pPor->GetLen() );
                         if( nX || !pPor->InNumberGrp() )
@@ -889,7 +890,7 @@ void SwTextCursor::GetCharRect_( SwRect* pOrig, TextFrameIndex const nOfst,
                                 nX += pPor->CalcSpacing( nSpaceAdd, aInf );
                             if( bWidth )
                             {
-                                pPor->SetLen( pPor->GetLen() + 1 );
+                                pPor->SetLen(pPor->GetLen() + TextFrameIndex(1));
                                 aInf.SetLen( pPor->GetLen() );
                                 aInf.SetOnWin( false ); // no BULLETs!
                                 nTmp += pPor->GetTextSize( aInf ).Width();
@@ -910,7 +911,7 @@ void SwTextCursor::GetCharRect_( SwRect* pOrig, TextFrameIndex const nOfst,
                             {
                                 SwDropPortion* pDrop = static_cast<SwDropPortion*>(pPor);
                                 const SwDropPortionPart* pCurrPart = pDrop->GetPart();
-                                sal_Int16 nSumLength = 0;
+                                TextFrameIndex nSumLength(0);
                                 while( pCurrPart && (nSumLength += pCurrPart->GetLen()) < nOfst - aInf.GetIdx() )
                                 {
                                     pCurrPart = pCurrPart->GetFollow();
@@ -1057,7 +1058,7 @@ void SwTextCursor::GetCharRect_( SwRect* pOrig, TextFrameIndex const nOfst,
                         nPorAscent = pPor->GetAscent();
                     }
                     SwTwips nTmp;
-                    if( 2 > pPor->GetLen() )
+                    if (TextFrameIndex(2) > pPor->GetLen())
                     {
                         nTmp = pPor->Width();
                         if ( pPor->InSpaceGrp() && nSpaceAdd )
@@ -1066,8 +1067,8 @@ void SwTextCursor::GetCharRect_( SwRect* pOrig, TextFrameIndex const nOfst,
                     else
                     {
                         const bool bOldOnWin = aInf.OnWin();
-                        sal_Int32 nOldLen = pPor->GetLen();
-                        pPor->SetLen( 1 );
+                        TextFrameIndex const nOldLen = pPor->GetLen();
+                        pPor->SetLen( TextFrameIndex(1) );
                         aInf.SetLen( pPor->GetLen() );
                         SeekAndChg( aInf );
                         aInf.SetOnWin( false ); // no BULLETs!
@@ -1124,7 +1125,7 @@ void SwTextCursor::GetCharRect_( SwRect* pOrig, TextFrameIndex const nOfst,
                     {
                         OSL_ENSURE( static_cast<const SwMultiPortion*>(pLast)->IsBidi(),
                                  "Non-BidiPortion inside BidiPortion" );
-                        sal_Int32 nIdx = aInf.GetIdx();
+                        TextFrameIndex const nIdx = aInf.GetIdx();
                         // correct the index before using CalcSpacing.
                         aInf.SetIdx(nLastBidiIdx);
                         pOrig->Pos().AdjustX(pLast->Width() +
@@ -1173,7 +1174,7 @@ bool SwTextCursor::GetCharRect( SwRect* pOrig, TextFrameIndex const nOfst,
     // Indicates that a position inside a special portion (field, number portion)
     // is requested.
     const bool bSpecialPos = pCMS && pCMS->m_pSpecialPos;
-    sal_Int32 nFindOfst = nOfst;
+    TextFrameIndex nFindOfst = nOfst;
 
     if ( bSpecialPos )
     {
@@ -1260,7 +1261,7 @@ TextFrameIndex SwTextCursor::GetCursorOfst( SwPosition *pPos, const Point &rPoin
     GetAdjusted();
 
     const OUString &rText = GetInfo().GetText();
-    sal_Int32 nOffset = 0;
+    TextFrameIndex nOffset(0);
 
     // x is the horizontal offset within the line.
     SwTwips x = rPoint.X();
@@ -1287,12 +1288,12 @@ TextFrameIndex SwTextCursor::GetCursorOfst( SwPosition *pPos, const Point &rPoin
     // If there are attribute changes in the line, search for the paragraph,
     // in which nX is situated.
     SwLinePortion *pPor = m_pCurr->GetFirstPortion();
-    sal_Int32 nCurrStart  = m_nStart;
+    TextFrameIndex nCurrStart = m_nStart;
     bool bHolePortion = false;
     bool bLastHyph = false;
 
     std::deque<sal_uInt16> *pKanaComp = m_pCurr->GetpKanaComp();
-    sal_Int32 nOldIdx = GetInfo().GetIdx();
+    TextFrameIndex const nOldIdx = GetInfo().GetIdx();
     sal_uInt16 nSpaceIdx = 0;
     size_t nKanaIdx = 0;
     long nSpaceAdd = m_pCurr->IsSpaceAdd() ? m_pCurr->GetLLSpaceAdd( 0 ) : 0;
@@ -1403,7 +1404,7 @@ TextFrameIndex SwTextCursor::GetCursorOfst( SwPosition *pPos, const Point &rPoin
 
     const_cast<SwTextSizeInfo&>(GetInfo()).SetIdx( nOldIdx );
 
-    sal_Int32 nLength = pPor->GetLen();
+    TextFrameIndex nLength = pPor->GetLen();
 
     const bool bFieldInfo = pCMS && pCMS->m_bFieldInfo;
 
@@ -1445,14 +1446,14 @@ TextFrameIndex SwTextCursor::GetCursorOfst( SwPosition *pPos, const Point &rPoin
             }
         }
         if( !nCurrStart )
-            return 0;
+            return TextFrameIndex(0);
 
         // 7849, 7816: pPor->GetHyphPortion is mandatory!
         if( bHolePortion || ( !bRightAllowed && bLastHyph ) ||
             ( pPor->IsMarginPortion() && !pPor->GetPortion() &&
               // 46598: Consider the situation: We might end up behind the last character,
               // in the last line of a centered paragraph
-              nCurrStart < rText.getLength() ) )
+              nCurrStart < TextFrameIndex(rText.getLength())))
             --nCurrStart;
         else if( pPor->InFieldGrp() && static_cast<SwFieldPortion*>(pPor)->IsFollow()
                  && nWidth > nX )
@@ -1470,7 +1471,7 @@ TextFrameIndex SwTextCursor::GetCursorOfst( SwPosition *pPos, const Point &rPoin
         }
         return nCurrStart;
     }
-    if ( 1 == nLength )
+    if (TextFrameIndex(1) == nLength)
     {
         if ( nWidth )
         {
@@ -1525,7 +1526,7 @@ TextFrameIndex SwTextCursor::GetCursorOfst( SwPosition *pPos, const Point &rPoin
 
     // Skip space at the end of the line
     if( bLastPortion && (m_pCurr->GetNext() || m_pFrame->GetFollow() )
-        && rText[nCurrStart + nLength - 1] == ' ' )
+        && rText[sal_Int32(nCurrStart + nLength) - 1] == ' ' )
         --nLength;
 
     if( nWidth > nX ||
@@ -1618,14 +1619,14 @@ TextFrameIndex SwTextCursor::GetCursorOfst( SwPosition *pPos, const Point &rPoin
                     sal_uInt16 nSumWidth = 0;
                     sal_uInt16 nSumBorderWidth = 0;
                     // Shift offset with the right and left border of previous parts and left border of actual one
-                    while( pCurrPart && nSumWidth <= nX - nCurrStart )
+                    while (pCurrPart && nSumWidth <= nX - sal_Int32(nCurrStart))
                     {
                         nSumWidth += pCurrPart->GetWidth();
                         if( pCurrPart->GetFont().GetLeftBorder() && !pCurrPart->GetJoinBorderWithPrev() )
                         {
                             nSumBorderWidth += pCurrPart->GetFont().GetLeftBorderSpace();
                         }
-                        if( nSumWidth <= nX - nCurrStart && pCurrPart->GetFont().GetRightBorder() &&
+                        if (nSumWidth <= nX - sal_Int32(nCurrStart) && pCurrPart->GetFont().GetRightBorder() &&
                             !pCurrPart->GetJoinBorderWithNext() )
                         {
                             nSumBorderWidth += pCurrPart->GetFont().GetRightBorderSpace();
@@ -1644,7 +1645,7 @@ TextFrameIndex SwTextCursor::GetCursorOfst( SwPosition *pPos, const Point &rPoin
 
                 if ( nSpaceAdd )
                 {
-                    sal_Int32 nCharCnt = 0;
+                    TextFrameIndex nCharCnt(0);
                     // #i41860# Thai justified alignment needs some
                     // additional information:
                     aDrawInf.SetNumberOfBlanks( pPor->InTextGrp() ?
@@ -1672,7 +1673,7 @@ TextFrameIndex SwTextCursor::GetCursorOfst( SwPosition *pPos, const Point &rPoin
                 if ( pPor->InFieldGrp() && pCMS && pCMS->m_pSpecialPos )
                 {
                     pCMS->m_pSpecialPos->nCharOfst = nLength;
-                    nLength = 0;
+                    nLength = TextFrameIndex(0);
                 }
 
                 // set cursor bidi level
@@ -1719,7 +1720,7 @@ TextFrameIndex SwTextCursor::GetCursorOfst( SwPosition *pPos, const Point &rPoin
 
                     // 6776: The pIter->GetCursorOfst is returning here
                     // from a nesting with COMPLETE_STRING.
-                    return COMPLETE_STRING;
+                    return TextFrameIndex(COMPLETE_STRING);
                 }
             }
             else
commit 0a43a81b985d41232aa9ca0b1d7642c000300ac6
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Wed May 9 14:57:26 2018 +0200

    sw_redlinehide: trivial conversions in itradj.cxx
    
    Change-Id: Ifc9cc3187e16e63aa468e31efa454c70fd907f50

diff --git a/sw/source/core/text/itradj.cxx b/sw/source/core/text/itradj.cxx
index ee37e1785040..524454d7a093 100644
--- a/sw/source/core/text/itradj.cxx
+++ b/sw/source/core/text/itradj.cxx
@@ -44,7 +44,7 @@ void SwTextAdjuster::FormatBlock( )
     const SwLinePortion *pFly = nullptr;
 
     bool bSkip = !IsLastBlock() &&
-        m_nStart + m_pCurr->GetLen() >= GetInfo().GetText().getLength();
+        m_nStart + m_pCurr->GetLen() >= TextFrameIndex(GetInfo().GetText().getLength());
 
     // Multi-line fields are tricky, because we need to check whether there are
     // any other text portions in the paragraph.
@@ -102,7 +102,7 @@ void SwTextAdjuster::FormatBlock( )
         }
     }
 
-    const sal_Int32 nOldIdx = GetInfo().GetIdx();
+    const TextFrameIndex nOldIdx = GetInfo().GetIdx();
     GetInfo().SetIdx( m_nStart );
     CalcNewBlock( m_pCurr, pFly );
     GetInfo().SetIdx( nOldIdx );
@@ -110,14 +110,14 @@ void SwTextAdjuster::FormatBlock( )
 }
 
 static bool lcl_CheckKashidaPositions( SwScriptInfo& rSI, SwTextSizeInfo& rInf, SwTextIter& rItr,
-                                sal_Int32& rKashidas, sal_Int32& nGluePortion )
+            sal_Int32& rKashidas, TextFrameIndex& nGluePortion)
 {
     if ( rInf.GetOut()->GetMinKashida() <= 0 )
         return false;
 
     // i60594 validate Kashida justification
-    sal_Int32 nIdx = rItr.GetStart();
-    sal_Int32 nEnd = rItr.GetEnd();
+    TextFrameIndex nIdx = rItr.GetStart();
+    TextFrameIndex nEnd = rItr.GetEnd();
 
     // Note on calling KashidaJustify():
     // Kashida positions may be marked as invalid. Therefore KashidaJustify may return the clean
@@ -138,7 +138,7 @@ static bool lcl_CheckKashidaPositions( SwScriptInfo& rSI, SwTextSizeInfo& rInf,
     while ( rKashidas && nIdx < nEnd )
     {
         rItr.SeekAndChgAttrIter( nIdx, rInf.GetOut() );
-        sal_Int32 nNext = rItr.GetNextAttr();
+        TextFrameIndex nNext = rItr.GetNextAttr();
 
         // is there also a script change before?
         // if there is, nNext should point to the script change
@@ -146,7 +146,7 @@ static bool lcl_CheckKashidaPositions( SwScriptInfo& rSI, SwTextSizeInfo& rInf,
         if( nNextScript < nNext )
             nNext = nNextScript;
 
-        if ( nNext == COMPLETE_STRING || nNext > nEnd )
+        if (nNext == TextFrameIndex(COMPLETE_STRING) || nNext > nEnd)
             nNext = nEnd;
         sal_Int32 nKashidasInAttr = rSI.KashidaJustify ( nullptr, nullptr, nIdx, nNext - nIdx );
         if (nKashidasInAttr > 0)
@@ -182,7 +182,7 @@ static bool lcl_CheckKashidaPositions( SwScriptInfo& rSI, SwTextSizeInfo& rInf,
 }
 
 static bool lcl_CheckKashidaWidth ( SwScriptInfo& rSI, SwTextSizeInfo& rInf, SwTextIter& rItr, sal_Int32& rKashidas,
-                             sal_Int32& nGluePortion, const long nGluePortionWidth, long& nSpaceAdd )
+                             TextFrameIndex& nGluePortion, const long nGluePortionWidth, long& nSpaceAdd )
 {
     // check kashida width
     // if width is smaller than minimal kashida width allowed by fonts in the current line
@@ -190,12 +190,12 @@ static bool lcl_CheckKashidaWidth ( SwScriptInfo& rSI, SwTextSizeInfo& rInf, SwT
     while (rKashidas)
     {
         bool bAddSpaceChanged = false;
-        sal_Int32 nIdx = rItr.GetStart();
-        sal_Int32 nEnd = rItr.GetEnd();
+        TextFrameIndex nIdx = rItr.GetStart();
+        TextFrameIndex nEnd = rItr.GetEnd();
         while ( nIdx < nEnd )
         {
             rItr.SeekAndChgAttrIter( nIdx, rInf.GetOut() );
-            sal_Int32 nNext = rItr.GetNextAttr();
+            TextFrameIndex nNext = rItr.GetNextAttr();
 
             // is there also a script change before?
             // if there is, nNext should point to the script change
@@ -221,7 +221,7 @@ static bool lcl_CheckKashidaWidth ( SwScriptInfo& rSI, SwTextSizeInfo& rInf, SwT
                     if( !rKashidas || !nGluePortion ) // nothing left, return false to
                         return false;                 // do regular blank justification
 
-                    nSpaceAdd = nGluePortionWidth / nGluePortion;
+                    nSpaceAdd = nGluePortionWidth / sal_Int32(nGluePortion);
                     bAddSpaceChanged = true;
                }
                if( nKashidasDropped )
@@ -248,8 +248,8 @@ void SwTextAdjuster::CalcNewBlock( SwLineLayout *pCurrent,
     OSL_ENSURE( pCurrent->Height(), "SwTextAdjuster::CalcBlockAdjust: missing CalcLine()" );
 
     pCurrent->InitSpaceAdd();
-    sal_Int32 nGluePortion = 0;
-    sal_Int32 nCharCnt = 0;
+    TextFrameIndex nGluePortion(0);
+    TextFrameIndex nCharCnt(0);
     sal_uInt16 nSpaceIdx = 0;
 
     // i60591: hennerdrews
@@ -307,8 +307,8 @@ void SwTextAdjuster::CalcNewBlock( SwLineLayout *pCurrent,
                     pCurrent->SetLLSpaceAdd( 0, nSpaceIdx );
 
                 nSpaceIdx++;
-                nGluePortion = 0;
-                nCharCnt = 0;
+                nGluePortion = TextFrameIndex(0);
+                nCharCnt = TextFrameIndex(0);
             }
             else if( pMulti->IsDouble() )
                 nGluePortion = nGluePortion + static_cast<SwDoubleLinePortion*>(pMulti)->GetSpaceCnt();
@@ -344,7 +344,7 @@ void SwTextAdjuster::CalcNewBlock( SwLineLayout *pCurrent,
 
                 if( nGluePortion )
                 {
-                    long nSpaceAdd = nGluePortionWidth / nGluePortion;
+                    long nSpaceAdd = nGluePortionWidth / sal_Int32(nGluePortion);
 
                     // i60594
                     if( rSI.CountKashida() && !bSkipKashida )
@@ -363,16 +363,16 @@ void SwTextAdjuster::CalcNewBlock( SwLineLayout *pCurrent,
                     pCurrent->SetLLSpaceAdd( nSpaceAdd , nSpaceIdx );
                     pPos->Width( static_cast<SwGluePortion*>(pPos)->GetFixWidth() );
                 }
-                else if ( IsOneBlock() && nCharCnt > 1 )
+                else if (IsOneBlock() && nCharCnt > TextFrameIndex(1))
                 {
-                    const long nSpaceAdd = - nGluePortionWidth / ( nCharCnt - 1 );
+                    const long nSpaceAdd = - nGluePortionWidth / (sal_Int32(nCharCnt) - 1);
                     pCurrent->SetLLSpaceAdd( nSpaceAdd, nSpaceIdx );
                     pPos->Width( static_cast<SwGluePortion*>(pPos)->GetFixWidth() );
                 }
 
                 nSpaceIdx++;
-                nGluePortion = 0;
-                nCharCnt = 0;
+                nGluePortion = TextFrameIndex(0);
+                nCharCnt = TextFrameIndex(0);
             }
             else
                 ++nGluePortion;
@@ -582,10 +582,10 @@ void SwTextAdjuster::CalcFlyAdjust( SwLineLayout *pCurrent )
     CalcRightMargin( pCurrent );
 
     SwLinePortion *pPos = pLeft->GetPortion();
-    sal_Int32 nLen = 0;
+    TextFrameIndex nLen(0);
 
     // If we only have one line, the text portion is consecutive and we center, then ...
-    bool bComplete = 0 == m_nStart;
+    bool bComplete = TextFrameIndex(0) == m_nStart;
     const bool bTabCompat = GetTextFrame()->GetNode()->getIDocumentSettingAccess()->get(DocumentSettingId::TAB_COMPAT);
     bool bMultiTab = false;
 
@@ -607,7 +607,7 @@ void SwTextAdjuster::CalcFlyAdjust( SwLineLayout *pCurrent )
                 // to left-aligned.
                 // The first text portion gets the whole Glue, but only if we have
                 // more than one line.
-                if( bComplete && GetInfo().GetText().getLength() == nLen )
+                if (bComplete && TextFrameIndex(GetInfo().GetText().getLength()) == nLen)
                     static_cast<SwGluePortion*>(pPos)->MoveHalfGlue( pGlue );
                 else
                 {
commit ec91c8b201ba022b9c9d77ab947c4e5c05a026b7
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Wed May 9 14:31:28 2018 +0200

    sw_redlinehide: trivial conversions in inftxt.cxx
    
    Change-Id: I8a9af6677edb1c8e2744a7909b0ff4a9d04c6a7d

diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 1faa5779a6ff..997f1971cf77 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -172,12 +172,12 @@ void ChkOutDev( const SwTextSizeInfo &rInf )
 }
 #endif
 
-inline sal_Int32 GetMinLen( const SwTextSizeInfo &rInf )
+inline TextFrameIndex GetMinLen( const SwTextSizeInfo &rInf )
 {
-    const sal_Int32 nTextLen = rInf.GetText().getLength();
-    if (rInf.GetLen() == COMPLETE_STRING)
+    const TextFrameIndex nTextLen(rInf.GetText().getLength());
+    if (rInf.GetLen() == TextFrameIndex(COMPLETE_STRING))
         return nTextLen;
-    const sal_Int32 nInfLen = rInf.GetIdx() + rInf.GetLen();
+    const TextFrameIndex nInfLen = rInf.GetIdx() + rInf.GetLen();
     return std::min(nTextLen, nInfLen);
 }
 
@@ -311,7 +311,7 @@ void SwTextSizeInfo::CtorInitTextSizeInfo( OutputDevice* pRenderContext, SwTextF
     m_pText = &m_pFrame->GetText();
 
     m_nIdx = nNewIdx;
-    m_nLen = COMPLETE_STRING;
+    m_nLen = TextFrameIndex(COMPLETE_STRING);
     m_bNotEOL = false;
     m_bStopUnderflow = m_bFootnoteInside = m_bOtherThanFootnoteInside = false;
     m_bMulti = m_bFirstMulti = m_bRuby = m_bHanging = m_bScriptSpace =
@@ -481,7 +481,7 @@ bool SwTextSizeInfo::HasHint(TextFrameIndex const nPos) const
 
 void SwTextPaintInfo::CtorInitTextPaintInfo( OutputDevice* pRenderContext, SwTextFrame *pFrame, const SwRect &rPaint )
 {
-    CtorInitTextSizeInfo( pRenderContext, pFrame, 0 );
+    CtorInitTextSizeInfo( pRenderContext, pFrame, TextFrameIndex(0) );
     aTextFly.CtorInitTextFly( pFrame );
     aPaintRect = rPaint;
     nSpaceIdx = 0;
@@ -626,12 +626,12 @@ void SwTextPaintInfo::DrawText_( const OUString &rText, const SwLinePortion &rPo
                              rPor.InNumberGrp() ) ? 0 : GetSpaceAdd();
     if ( nSpaceAdd )
     {
-        sal_Int32 nCharCnt = 0;
+        TextFrameIndex nCharCnt(0);
         // #i41860# Thai justified alignment needs some
         // additional information:
         aDrawInf.SetNumberOfBlanks( rPor.InTextGrp() ?
                                     static_cast<const SwTextPortion&>(rPor).GetSpaceCnt( *this, nCharCnt ) :
-                                    0 );
+                                    TextFrameIndex(0) );
     }
 
     aDrawInf.SetSpace( nSpaceAdd );
@@ -1116,19 +1116,11 @@ void SwTextPaintInfo::DrawBackBrush( const SwLinePortion &rPor ) const
         CalcRect( rPor, &aIntersect, nullptr, true );
         if(aIntersect.HasArea())
         {
-            SwTextNode *pNd = m_pFrame->GetTextNode();
-            const ::sw::mark::IMark* pFieldmark = nullptr;
-            if(pNd)
-            {
-                const SwDoc *doc=pNd->GetDoc();
-                if(doc)
-                {
-                    SwIndex aIndex(pNd, GetIdx());
-                    SwPosition aPosition(*pNd, aIndex);
-                    pFieldmark=doc->getIDocumentMarkAccess()->getFieldmarkFor(aPosition);
-                }
-            }
-            bool bIsStartMark=(1==GetLen() && CH_TXT_ATR_FIELDSTART==GetText()[GetIdx()]);
+            SwPosition const aPosition(m_pFrame->MapViewToModelPos(GetIdx()));
+            const ::sw::mark::IMark* pFieldmark =
+                m_pFrame->GetDoc().getIDocumentMarkAccess()->getFieldmarkFor(aPosition);
+            bool bIsStartMark = (TextFrameIndex(1) == GetLen()
+                    && CH_TXT_ATR_FIELDSTART == GetText()[sal_Int32(GetIdx())]);
             if(pFieldmark) {
                 SAL_INFO("sw.core", "Found Fieldmark " << pFieldmark->ToString());
             }
@@ -1180,22 +1172,24 @@ void SwTextPaintInfo::DrawBackBrush( const SwLinePortion &rPor ) const
                 bool           draw = false;
                 bool           full = false;
                 SwLinePortion *pPos = const_cast<SwLinePortion *>(&rPor);
-                sal_Int32      nIdx = GetIdx();
-                sal_Int32      nLen;
+                TextFrameIndex nIdx = GetIdx();
+                TextFrameIndex nLen;
 
                 do
                 {
                     nLen = pPos->GetLen();
-                    for ( int i = nIdx; i < (nIdx + nLen); ++i )
+                    for (TextFrameIndex i = nIdx; i < (nIdx + nLen); ++i)
                     {
-                        if ( i < GetText().getLength() && GetText()[i] == CH_TXTATR_NEWLINE )
+                        if (i < TextFrameIndex(GetText().getLength())
+                            && GetText()[sal_Int32(i)] == CH_TXTATR_NEWLINE)
                         {
                             if ( i >= (GetIdx() + rPor.GetLen()) )
                             {
                                 goto drawcontinue;
                             }
                         }
-                        if ( i >= GetText().getLength() || GetText()[i] != CH_BLANK )
+                        if (i >= TextFrameIndex(GetText().getLength())
+                            || GetText()[sal_Int32(i)] != CH_BLANK)
                         {
                             draw = true;
                             if ( i >= (GetIdx() + rPor.GetLen()) )
@@ -1220,16 +1214,20 @@ void SwTextPaintInfo::DrawBackBrush( const SwLinePortion &rPor ) const
                     nIdx = GetIdx();
 
                     nLen = pPos->GetLen();
-                    for ( int i = (nIdx + nLen - 1); i >= nIdx; --i )
+                    for (TextFrameIndex i = (nIdx + nLen - TextFrameIndex(1));
+                            i >= nIdx; --i)
                     {
-                        if ( i < GetText().getLength() && GetText()[i] == CH_TXTATR_NEWLINE )
+                        if (i < TextFrameIndex(GetText().getLength())
+                            && GetText()[sal_Int32(i)] == CH_TXTATR_NEWLINE)
                         {
                             continue;
                         }
-                        if ( i >= GetText().getLength() || GetText()[i] != CH_BLANK )
+                        if (i >= TextFrameIndex(GetText().getLength())
+                            || GetText()[sal_Int32(i)] != CH_BLANK)
                         {
                             sal_uInt16 nOldWidth = rPor.Width();
-                            sal_uInt16 nNewWidth = GetTextSize( m_pOut, nullptr, GetText(), nIdx, (i + 1 - nIdx) ).Width();
+                            sal_uInt16 nNewWidth = GetTextSize(m_pOut, nullptr,
+                                GetText(), nIdx, (i + TextFrameIndex(1) - nIdx)).Width();
 
                             const_cast<SwLinePortion&>(rPor).Width( nNewWidth );
                             CalcRect( rPor, nullptr, &aIntersect, true );
@@ -1403,7 +1401,7 @@ void SwTextFormatInfo::CtorInitTextFormatInfo( OutputDevice* pRenderContext, SwT
     m_pRest = nullptr;
     m_nLineHeight = 0;
     m_nLineNetHeight = 0;
-    SetLineStart(0);
+    SetLineStart(TextFrameIndex(0));
 
     SvtCTLOptions::TextNumerals const nTextNumerals(
             SW_MOD()->GetCTLOptions().GetCTLTextNumerals());
@@ -1483,11 +1481,11 @@ void SwTextFormatInfo::Init()
     m_cTabDecimal = 0;
     m_nWidth = m_nRealWidth;
     m_nForcedLeftMargin = 0;
-    m_nSoftHyphPos = 0;
-    m_nUnderScorePos = COMPLETE_STRING;
+    m_nSoftHyphPos = TextFrameIndex(0);
+    m_nUnderScorePos = TextFrameIndex(COMPLETE_STRING);
     m_cHookChar = 0;
-    SetIdx(0);
-    SetLen( GetText().getLength() );
+    SetIdx(TextFrameIndex(0));
+    SetLen(TextFrameIndex(GetText().getLength()));
     SetPaintOfst(0);
 }
 
@@ -1516,8 +1514,8 @@ SwTextFormatInfo::SwTextFormatInfo( const SwTextFormatInfo& rInf,
     m_pRest = nullptr;
     m_pLastTab = nullptr;
 
-    m_nSoftHyphPos = 0;
-    m_nUnderScorePos = COMPLETE_STRING;
+    m_nSoftHyphPos = TextFrameIndex(0);
+    m_nUnderScorePos = TextFrameIndex(COMPLETE_STRING);
     m_nLineStart = rInf.GetIdx();
     m_nLeft = rInf.m_nLeft;
     m_nRight = rInf.m_nRight;
@@ -1573,7 +1571,7 @@ TextFrameIndex SwTextFormatInfo::ScanPortionEnd(TextFrameIndex const nStart,
                                                 TextFrameIndex const nEnd)
 {
     m_cHookChar = 0;
-    sal_Int32 i = nStart;
+    TextFrameIndex i = nStart;
 
     // Used for decimal tab handling:
     const sal_Unicode cTabDec = GetLastTab() ? GetTabDecimal() : 0;
@@ -1607,7 +1605,7 @@ TextFrameIndex SwTextFormatInfo::ScanPortionEnd(TextFrameIndex const nStart,
             return i;
 
         case CHAR_UNDERSCORE:
-            if ( COMPLETE_STRING == m_nUnderScorePos )
+            if (TextFrameIndex(COMPLETE_STRING) == m_nUnderScorePos)
                 m_nUnderScorePos = i;
             break;
 
@@ -1649,7 +1647,7 @@ TextFrameIndex SwTextFormatInfo::ScanPortionEnd(TextFrameIndex const nStart,
 
     // Check if character *behind* the portion has
     // to become the hook:
-    if ( i == nEnd && i < GetText().getLength() && bNumFound )
+    if (i == nEnd && i < TextFrameIndex(GetText().getLength()) && bNumFound)
     {
         const sal_Unicode cPos = GetChar( i );
         if ( cPos != cTabDec && cPos != cThousandSep && cPos !=cThousandSep2 && ( 0x2F >= cPos || cPos >= 0x3A ) )
@@ -1723,8 +1721,8 @@ SwTextSlot::SwTextSlot(
         pOldText = &(pInf->GetText());
         m_pOldCachedVclData = pInf->GetCachedVclData();
         pInf->SetText( aText );
-        pInf->SetIdx( 0 );
-        pInf->SetLen( bTextLen ? pInf->GetText().getLength() : pPor->GetLen() );
+        pInf->SetIdx(TextFrameIndex(0));
+        pInf->SetLen(bTextLen ? TextFrameIndex(pInf->GetText().getLength()) : pPor->GetLen());
         pInf->SetCachedVclData(nullptr);
 
         // ST2
commit 90fac20a7191b038c644b854754e5bed1d1b2afa
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Wed May 9 14:03:02 2018 +0200

    sw_redlinehide: trivial conversions in txttab.cxx
    
    Change-Id: I13b7668fc2cf4b7886c1f96a4a7775dea206e05b

diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx
index 0fb6c591242a..90bbe6d552ce 100644
--- a/sw/source/core/text/txttab.cxx
+++ b/sw/source/core/text/txttab.cxx
@@ -294,7 +294,7 @@ SwTabPortion *SwTextFormatter::NewTabPortion( SwTextFormatInfo &rInf, bool bAuto
 SwTabPortion::SwTabPortion( const sal_uInt16 nTabPosition, const sal_Unicode cFillChar, const bool bAutoTab )
     : SwFixPortion(), nTabPos(nTabPosition), cFill(cFillChar), bAutoTabStop( bAutoTab )
 {
-    nLineLength = 1;
+    nLineLength = TextFrameIndex(1);
     OSL_ENSURE(!IsFilled() || ' ' != cFill, "SwTabPortion::CTOR: blanks ?!");
     SetWhichPor( POR_TAB );
 }
@@ -336,7 +336,7 @@ bool SwTabPortion::PreFormat( SwTextFormatInfo &rInf )
         // tab portion representing the list tab of a list label gets the
         // same font as the corresponding number portion
         std::unique_ptr< SwFontSave > pSave;
-        if ( GetLen() == 0 &&
+        if ( GetLen() == TextFrameIndex(0) &&
              rInf.GetLast() && rInf.GetLast()->InNumberGrp() &&
              static_cast<SwNumberPortion*>(rInf.GetLast())->HasFont() )
         {
@@ -389,7 +389,7 @@ bool SwTabPortion::PreFormat( SwTextFormatInfo &rInf )
                 // In tabulator compatibility mode, we reset the bFull flag
                 // if the tabulator is at the end of the paragraph and the
                 // tab stop position is outside the frame:
-                bool bAtParaEnd = rInf.GetIdx() + GetLen() == rInf.GetText().getLength();
+                bool bAtParaEnd = rInf.GetIdx() + GetLen() == TextFrameIndex(rInf.GetText().getLength());
                 if ( bFull && bTabCompat &&
                      ( ( bTabOverflow && ( rInf.IsTabOverflow() || !bAutoTabStop ) ) || bAtParaEnd ) &&
                      GetTabPos() >= rInf.GetTextFrame()->getFrameArea().Width() )
@@ -420,7 +420,7 @@ bool SwTabPortion::PreFormat( SwTextFormatInfo &rInf )
         {
             Height( 0 );
             Width( 0 );
-            SetLen( 0 );
+            SetLen( TextFrameIndex(0) );
             SetAscent( 0 );
             SetPortion( nullptr ); //?????
         }
@@ -517,7 +517,7 @@ void SwTabPortion::Paint( const SwTextPaintInfo &rInf ) const
     // same font as the corresponding number portion
     std::unique_ptr< SwFontSave > pSave;
     bool bAfterNumbering = false;
-    if ( GetLen() == 0 )
+    if (GetLen() == TextFrameIndex(0))
     {
         const SwLinePortion* pPrevPortion =
             const_cast<SwTabPortion*>(this)->FindPrevPortion( rInf.GetParaPortion() );
@@ -562,7 +562,8 @@ void SwTabPortion::Paint( const SwTextPaintInfo &rInf ) const
             sal_uInt16 nChar = Width() / nCharWidth;
             OUStringBuffer aBuf;
             comphelper::string::padToLength(aBuf, nChar, ' ');
-            rInf.DrawText(aBuf.makeStringAndClear(), *this, 0, nChar, true);
+            rInf.DrawText(aBuf.makeStringAndClear(), *this, TextFrameIndex(0),
+                            TextFrameIndex(nChar), true);
         }
     }
 
@@ -582,7 +583,8 @@ void SwTabPortion::Paint( const SwTextPaintInfo &rInf ) const
                 ++nChar; // to avoid gaps
             OUStringBuffer aBuf;
             comphelper::string::padToLength(aBuf, nChar, cFill);
-            rInf.DrawText(aBuf.makeStringAndClear(), *this, 0, nChar, true);
+            rInf.DrawText(aBuf.makeStringAndClear(), *this, TextFrameIndex(0),
+                            TextFrameIndex(nChar), true);
         }
     }
 }
commit 695eae2ea3afe92bde94706f43c56f0b2045ab07
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Wed May 9 13:50:55 2018 +0200

    sw_redlinehide: trivial conversions in txthyph.cxx
    
    Change-Id: I6300ff1e6618f80c59bd97deeb4e850c5d2b1244

diff --git a/sw/source/core/text/txthyph.cxx b/sw/source/core/text/txthyph.cxx
index 1bff97648f32..929eb95fda2e 100644
--- a/sw/source/core/text/txthyph.cxx
+++ b/sw/source/core/text/txthyph.cxx
@@ -263,7 +263,7 @@ bool SwTextPortion::CreateHyphen( SwTextFormatInfo &rInf, SwTextGuess const &rGu
         return false;
 
     SwHyphPortion *pHyphPor;
-    sal_Int32 nPorEnd;
+    TextFrameIndex nPorEnd;
     SwTextSizeInfo aInf( rInf );
 
     // first case: hyphenated word has alternative spelling
@@ -274,11 +274,11 @@ bool SwTextPortion::CreateHyphen( SwTextFormatInfo &rInf, SwTextGuess const &rGu
         OSL_ENSURE( aAltSpell.bIsAltSpelling, "no alternative spelling" );
 
         OUString aAltText = aAltSpell.aReplacement;
-        nPorEnd = aAltSpell.nChangedPos + rGuess.BreakStart() - rGuess.FieldDiff();
+        nPorEnd = TextFrameIndex(aAltSpell.nChangedPos) + rGuess.BreakStart() - rGuess.FieldDiff();
         sal_Int32 nTmpLen = 0;
 
         // soft hyphen at alternative spelling position?
-        if( rInf.GetText()[ rInf.GetSoftHyphPos() ] == CHAR_SOFTHYPHEN )
+        if( rInf.GetText()[sal_Int32(rInf.GetSoftHyphPos())] == CHAR_SOFTHYPHEN )
         {
             pHyphPor = new SwSoftHyphStrPortion( aAltText );
             nTmpLen = 1;
@@ -288,15 +288,15 @@ bool SwTextPortion::CreateHyphen( SwTextFormatInfo &rInf, SwTextGuess const &rGu
         }
 
         // length of pHyphPor is adjusted
-        pHyphPor->SetLen( aAltText.getLength() + 1 );
+        pHyphPor->SetLen( TextFrameIndex(aAltText.getLength() + 1) );
         static_cast<SwPosSize&>(*pHyphPor) = pHyphPor->GetTextSize( rInf );
-        pHyphPor->SetLen( aAltSpell.nChangedLength + nTmpLen );
+        pHyphPor->SetLen( TextFrameIndex(aAltSpell.nChangedLength + nTmpLen) );
     }
     else
     {
         // second case: no alternative spelling
         pHyphPor = new SwHyphPortion;
-        pHyphPor->SetLen( 1 );
+        pHyphPor->SetLen(TextFrameIndex(1));
 
         static const void* pLastMagicNo = nullptr;
         static sal_uInt16 aMiniCacheH = 0, aMiniCacheW = 0;
@@ -312,11 +312,11 @@ bool SwTextPortion::CreateHyphen( SwTextFormatInfo &rInf, SwTextGuess const &rGu
             pHyphPor->Height( aMiniCacheH );
             pHyphPor->Width( aMiniCacheW );
         }
-        pHyphPor->SetLen( 0 );
+        pHyphPor->SetLen(TextFrameIndex(0));
 
         // values required for this
-        nPorEnd = xHyphWord->getHyphenPos() + 1 + rGuess.BreakStart()
-                - rGuess.FieldDiff();
+        nPorEnd = TextFrameIndex(xHyphWord->getHyphenPos() + 1)
+                + rGuess.BreakStart() - rGuess.FieldDiff();
     }
 
     // portion end must be in front of us
@@ -391,7 +391,7 @@ SwLinePortion *SwSoftHyphPortion::Compress() { return this; }
 SwSoftHyphPortion::SwSoftHyphPortion() :
     bExpand(false), nViewWidth(0)
 {
-    SetLen(1);
+    SetLen(TextFrameIndex(1));
     SetWhichPor( POR_SOFTHYPH );
 }
 
@@ -466,13 +466,13 @@ bool SwSoftHyphPortion::Format( SwTextFormatInfo &rInf )
             // portion has to trigger an underflow
             SwTextGuess aGuess;
             bFull = rInf.IsInterHyph() ||
-                    !aGuess.AlternativeSpelling( rInf, rInf.GetIdx() - 1 );
+                    !aGuess.AlternativeSpelling(rInf, rInf.GetIdx() - TextFrameIndex(1));
         }
         rInf.ChgHyph( bHyph );
 
         if( bFull && !rInf.IsHyphForbud() )
         {
-            rInf.SetSoftHyphPos(0);
+            rInf.SetSoftHyphPos(TextFrameIndex(0));
             FormatEOL( rInf );
             if ( rInf.GetFly() )
                 rInf.GetRoot()->SetMidHyph( true );
@@ -488,7 +488,7 @@ bool SwSoftHyphPortion::Format( SwTextFormatInfo &rInf )
         return true;
     }
 
-    rInf.SetSoftHyphPos(0);
+    rInf.SetSoftHyphPos(TextFrameIndex(0));
     SetExpand( true );
     bFull = SwHyphPortion::Format( rInf );
     SetExpand( false );
@@ -513,7 +513,7 @@ void SwSoftHyphPortion::FormatEOL( SwTextFormatInfo &rInf )
 
         // We need to reset the old values
         const SwTwips nOldX  = rInf.X();
-        const sal_Int32 nOldIdx = rInf.GetIdx();
+        TextFrameIndex const nOldIdx = rInf.GetIdx();
         rInf.X( rInf.X() - PrtWidth() );
         rInf.SetIdx( rInf.GetIdx() - GetLen() );
         const bool bFull = SwHyphPortion::Format( rInf );
@@ -565,7 +565,7 @@ void SwSoftHyphStrPortion::Paint( const SwTextPaintInfo &rInf ) const
 SwSoftHyphStrPortion::SwSoftHyphStrPortion( const OUString &rStr )
     : SwHyphStrPortion( rStr )
 {
-    SetLen( 1 );
+    SetLen(TextFrameIndex(1));
     SetWhichPor( POR_SOFTHYPHSTR );
 }
 
commit ca61c7ac7a56db4176d50896e4fefd9e3d712280
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Wed May 9 12:53:25 2018 +0200

    sw_redlinehide: trivial conversions in txtdrop.cxx
    
    Change-Id: Ic1a982011d39002ffafb27d03944eede967bb19f

diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx
index 5633f8a0ffa1..58103fcf4687 100644
--- a/sw/source/core/text/txtdrop.cxx
+++ b/sw/source/core/text/txtdrop.cxx
@@ -85,8 +85,8 @@ SwDropSave::SwDropSave( const SwTextPaintInfo &rInf ) :
 
 SwDropSave::~SwDropSave()
 {
-    pInf->SetIdx( nIdx );
-    pInf->SetLen( nLen );
+    pInf->SetIdx(TextFrameIndex(nIdx));
+    pInf->SetLen(TextFrameIndex(nLen));
     pInf->X( nX );
     pInf->Y( nY );
 }
@@ -247,7 +247,7 @@ void SwDropPortion::PaintText( const SwTextPaintInfo &rInf ) const
     OSL_ENSURE( nDropHeight && pPart && nLines != 1, "Drop Portion painted twice" );
 
     const SwDropPortionPart* pCurrPart = GetPart();
-    const sal_Int32 nOldLen = GetLen();
+    const TextFrameIndex nOldLen = GetLen();
     const sal_uInt16 nOldWidth = Width();
     const sal_uInt16 nOldAscent = GetAscent();
 
@@ -364,8 +364,8 @@ void SwDropPortion::Paint( const SwTextPaintInfo &rInf ) const
 
 bool SwDropPortion::FormatText( SwTextFormatInfo &rInf )
 {
-    const sal_Int32 nOldLen = GetLen();
-    const sal_Int32 nOldInfLen = rInf.GetLen();
+    const TextFrameIndex nOldLen = GetLen();
+    const TextFrameIndex nOldInfLen = rInf.GetLen();
     if (!SwTextPortion::Format( rInf ))
         return false;
 
@@ -381,7 +381,7 @@ bool SwDropPortion::FormatText( SwTextFormatInfo &rInf )
 SwPosSize SwDropPortion::GetTextSize( const SwTextSizeInfo &rInf ) const
 {
     sal_uInt16 nMyX = 0;
-    sal_Int32 nIdx = 0;
+    TextFrameIndex nIdx(0);
 
     const SwDropPortionPart* pCurrPart = GetPart();
 
@@ -393,8 +393,8 @@ SwPosSize SwDropPortion::GetTextSize( const SwTextSizeInfo &rInf ) const
         pCurrPart = pCurrPart->GetFollow();
     }
 
-    sal_Int32 nOldIdx = rInf.GetIdx();
-    sal_Int32 nOldLen = rInf.GetLen();
+    TextFrameIndex const nOldIdx = rInf.GetIdx();
+    TextFrameIndex const nOldLen = rInf.GetLen();
 
     const_cast<SwTextSizeInfo&>(rInf).SetIdx( nIdx );
     const_cast<SwTextSizeInfo&>(rInf).SetLen( rInf.GetLen() - nIdx );
@@ -423,7 +423,7 @@ SwPosSize SwDropPortion::GetTextSize( const SwTextSizeInfo &rInf ) const
 
 TextFrameIndex SwDropPortion::GetCursorOfst(const sal_uInt16) const
 {
-    return 0;
+    return TextFrameIndex(0);
 }
 
 void SwTextFormatter::CalcDropHeight( const sal_uInt16 nLines )
@@ -673,8 +673,8 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTextFormatInfo &rInf
 
     SwDropPortionPart* pCurrPart = pDrop->GetPart();
     const bool bUseCache = ! pCurrPart->GetFollow() && !pCurrPart->GetFont().HasBorder();
-    sal_Int32 nIdx = rInf.GetIdx();
-    OUString aStr(rInf.GetText().copy(nIdx, pCurrPart->GetLen()));
+    TextFrameIndex nIdx = rInf.GetIdx();
+    OUString aStr(rInf.GetText().copy(sal_Int32(nIdx), sal_Int32(pCurrPart->GetLen())));
 
     long nDescent = 0;
     long nFactor = -1;
@@ -730,7 +730,7 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTextFormatInfo &rInf
             aFactor[ nTmpIdx ] = static_cast<sal_uInt16>(nFactor);
         }
 
-        bool bGrow = ( pDrop->GetLen() != 0 );
+        bool bGrow = (pDrop->GetLen() != TextFrameIndex(0));
 
         // for growing control
         long nMax = USHRT_MAX;
@@ -777,8 +777,8 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTextFormatInfo &rInf
 
                 // we get the rectangle that covers all chars
                 bool bHaveGlyphRect = pOut->GetTextBoundRect( aRect, rInf.GetText(), 0,
-                                     nIdx, pCurrPart->GetLen() ) &&
-                                 ! aRect.IsEmpty();
+                            sal_Int32(nIdx), sal_Int32(pCurrPart->GetLen()))
+                    && ! aRect.IsEmpty();
 
                 if ( ! bHaveGlyphRect )
                 {
@@ -796,8 +796,8 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTextFormatInfo &rInf
                         pWin->SetFont( rFnt.GetActualFont() );
 
                         bHaveGlyphRect = pWin->GetTextBoundRect( aRect, rInf.GetText(), 0,
-                                            nIdx, pCurrPart->GetLen() ) &&
-                                        ! aRect.IsEmpty();
+                                sal_Int32(nIdx), sal_Int32(pCurrPart->GetLen()))
+                            && ! aRect.IsEmpty();
                     }
                     if (!bHaveGlyphRect)
                     {
commit 0cb07f10d04555e178a9c451ea348c85e50ed053
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Wed May 9 12:37:21 2018 +0200

    sw_redlinehide: trivial conversions in txtfld.cxx
    
    Change-Id: Ie2b17b4dba14359a1358d4be50846750ef8939b0

diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index 559216676999..88d29a4a3542 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -350,8 +350,8 @@ SwLinePortion *SwTextFormatter::NewExtraPortion( SwTextFormatInfo &rInf )
     if( !pHint )
     {
         pRet = new SwTextPortion;
-        pRet->SetLen( 1 );
-        rInf.SetLen( 1 );
+        pRet->SetLen(TextFrameIndex(1));
+        rInf.SetLen(TextFrameIndex(1));
         return pRet;
     }
 
@@ -394,7 +394,7 @@ SwLinePortion *SwTextFormatter::NewExtraPortion( SwTextFormatInfo &rInf )
     {
         const OUString aNothing;
         pRet = new SwFieldPortion( aNothing );
-        rInf.SetLen( 1 );
+        rInf.SetLen(TextFrameIndex(1));
     }
     return pRet;
 }
commit c5761226b0d58eff940b3c945376803afd8d64b2
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Wed May 9 12:04:03 2018 +0200

    sw_redlinehide: convert FindFootnoteRef() and GetFootnoteLine()
    
    SwTextFootnote has a GetTextNode(), neat...
    
    Change-Id: I527f3c3318b56b582fdf3fb6e3044cb76586730f

diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx
index 5988b6f40b13..34b353b10f80 100644
--- a/sw/source/core/text/txtftn.cxx
+++ b/sw/source/core/text/txtftn.cxx
@@ -71,7 +71,7 @@ bool SwTextFrame::IsFootnoteNumFrame_() const
 SwTextFrame *SwTextFrame::FindFootnoteRef( const SwTextFootnote *pFootnote )
 {
     SwTextFrame *pFrame = this;
-    const bool bFwd = pFootnote->GetStart() >= GetOfst();
+    const bool bFwd = MapModelToView(&pFootnote->GetTextNode(), pFootnote->GetStart()) >= GetOfst();
     while( pFrame )
     {
         if( SwFootnoteBossFrame::FindFootnote( pFrame, pFootnote ) )
@@ -273,7 +273,8 @@ SwTwips SwTextFrame::GetFootnoteLine( const SwTextFootnote *pFootnote ) const
 
         SwTextInfo aInf( pThis );
         SwTextIter aLine( pThis, &aInf );
-        const sal_Int32 nPos = pFootnote->GetStart();
+        TextFrameIndex const nPos(MapModelToView(
+                    &pFootnote->GetTextNode(), pFootnote->GetStart()));
         aLine.CharToLine( nPos );
 
         nRet = aLine.Y() + SwTwips(aLine.GetLineHeight());
commit c8ab9b5dc1c0c305b58efde8bfd8c6d7e793a9e6
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Wed May 9 11:54:51 2018 +0200

    sw_redlinehide: convert SwTextFrame::RemoveFootnote() to MergedAttrIter
    
    Change-Id: I19a04ec615bc0b679f79ade680026cf26a0b2ff6

diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx
index d3eb26d2c4b5..5988b6f40b13 100644
--- a/sw/source/core/text/txtftn.cxx
+++ b/sw/source/core/text/txtftn.cxx
@@ -390,12 +390,7 @@ void SwTextFrame::RemoveFootnote(TextFrameIndex const nStart, TextFrameIndex con
     if ( !IsFootnoteAllowed() )
         return;
 
-    SwpHints *pHints = GetTextNode()->GetpSwpHints();
-    if( !pHints )
-        return;
-
     bool bRollBack = nLen != TextFrameIndex(COMPLETE_STRING);
-    const size_t nSize = pHints->Count();
     TextFrameIndex nEnd;
     SwTextFrame* pSource;
     if( bRollBack )
@@ -411,136 +406,134 @@ void SwTextFrame::RemoveFootnote(TextFrameIndex const nStart, TextFrameIndex con
         pSource = this;
     }
 
-    if( nSize )
+    SwPageFrame* pUpdate = nullptr;
+    bool bRemove = false;
+    SwFootnoteBossFrame *pFootnoteBoss = nullptr;
+    SwFootnoteBossFrame *pEndBoss = nullptr;
+    bool bFootnoteEndDoc
+        = FTNPOS_CHAPTER == GetNode()->GetDoc()->GetFootnoteInfo().ePos;
+    SwTextNode const* pNode(nullptr);
+    sw::MergedAttrIterReverse iter(*this);
+    for (SwTextAttr const* pHt = iter.PrevAttr(&pNode); pHt; pHt = iter.PrevAttr(&pNode))
     {
-        SwPageFrame* pUpdate = nullptr;
-        bool bRemove = false;
-        SwFootnoteBossFrame *pFootnoteBoss = nullptr;
-        SwFootnoteBossFrame *pEndBoss = nullptr;
-        bool bFootnoteEndDoc
-            = FTNPOS_CHAPTER == GetNode()->GetDoc()->GetFootnoteInfo().ePos;
-        for ( size_t i = nSize; i; )
-        {
-            SwTextAttr *pHt = pHints->Get(--i);
-            if ( RES_TXTATR_FTN != pHt->Which() )
-                continue;
+        if (RES_TXTATR_FTN != pHt->Which())
+            continue;
 
-            const sal_Int32 nIdx = pHt->GetStart();
-            if( nStart > nIdx )
-                break;
+        TextFrameIndex const nIdx(MapModelToView(pNode, pHt->GetStart()));
+        if (nStart > nIdx)
+            break;
 
-            if( nEnd >= nIdx )
-            {
-                SwTextFootnote *pFootnote = static_cast<SwTextFootnote*>(pHt);
-                const bool bEndn = pFootnote->GetFootnote().IsEndNote();
+        if (nEnd >= nIdx)
+        {
+            SwTextFootnote const*const pFootnote(static_cast<SwTextFootnote const*>(pHt));
+            const bool bEndn = pFootnote->GetFootnote().IsEndNote();
 
-                if( bEndn )
+            if (bEndn)
+            {
+                if (!pEndBoss)
+                    pEndBoss = pSource->FindFootnoteBossFrame();
+            }
+            else
+            {
+                if (!pFootnoteBoss)
                 {
-                    if( !pEndBoss )
-                        pEndBoss = pSource->FindFootnoteBossFrame();
+                    pFootnoteBoss = pSource->FindFootnoteBossFrame( true );
+                    if( pFootnoteBoss->GetUpper()->IsSctFrame() )
+                    {
+                        SwSectionFrame* pSect = static_cast<SwSectionFrame*>(
+                                              pFootnoteBoss->GetUpper());
+                        if (pSect->IsFootnoteAtEnd())
+                            bFootnoteEndDoc = false;
+                    }
                 }
-                else
+            }
+
+            // We don't delete, but move instead.
+            // Three cases are to be considered:
+            // 1) There's neither Follow nor PrevFollow:
+            //    -> RemoveFootnote() (maybe even a OSL_ENSURE(value))
+            //
+            // 2) nStart > GetOfst, I have a Follow
+            //    -> Footnote moves into Follow
+            //
+            // 3) nStart < GetOfst, I am a Follow
+            //    -> Footnote moves into the PrevFollow
+            //
+            // Both need to be on one Page/in one Column
+            SwFootnoteFrame *pFootnoteFrame = SwFootnoteBossFrame::FindFootnote(pSource, pFootnote);
+
+            if (pFootnoteFrame)
+            {
+                const bool bEndDoc = bEndn || bFootnoteEndDoc;
+                if( bRollBack )
                 {
-                    if( !pFootnoteBoss )
+                    while (pFootnoteFrame)
                     {
-                        pFootnoteBoss = pSource->FindFootnoteBossFrame( true );
-                        if( pFootnoteBoss->GetUpper()->IsSctFrame() )
-                        {
-                            SwSectionFrame* pSect = static_cast<SwSectionFrame*>(
-                                                  pFootnoteBoss->GetUpper());
-                            if( pSect->IsFootnoteAtEnd() )
-                                bFootnoteEndDoc = false;
-                        }
+                        pFootnoteFrame->SetRef( this );
+                        pFootnoteFrame = pFootnoteFrame->GetFollow();
+                        SetFootnote( true );
                     }
                 }
-
-                // We don't delete, but move instead.
-                // Three cases are to be considered:
-                // 1) There's neither Follow nor PrevFollow:
-                //    -> RemoveFootnote() (maybe even a OSL_ENSURE(value))
-                //
-                // 2) nStart > GetOfst, I have a Follow
-                //    -> Footnote moves into Follow
-                //
-                // 3) nStart < GetOfst, I am a Follow
-                //    -> Footnote moves into the PrevFollow
-                //
-                // Both need to be on one Page/in one Column
-                SwFootnoteFrame *pFootnoteFrame = SwFootnoteBossFrame::FindFootnote(pSource, pFootnote);
-
-                if( pFootnoteFrame )
+                else if (GetFollow())
                 {
-                    const bool bEndDoc = bEndn || bFootnoteEndDoc;
-                    if( bRollBack )
+                    SwContentFrame *pDest = GetFollow();
+                    while (pDest->GetFollow() && static_cast<SwTextFrame*>(pDest->
+                           GetFollow())->GetOfst() <= nIdx)
+                        pDest = pDest->GetFollow();
+                    OSL_ENSURE( !SwFootnoteBossFrame::FindFootnote(
+                        pDest,pFootnote),"SwTextFrame::RemoveFootnote: footnote exists");
+
+                    // Never deregister; always move
+                    if (bEndDoc ||
+                        !pFootnoteFrame->FindFootnoteBossFrame()->IsBefore(pDest->FindFootnoteBossFrame(!bEndn))
+                       )
                     {
+                        SwPageFrame* pTmp = pFootnoteFrame->FindPageFrame();
+                        if( pUpdate && pUpdate != pTmp )
+                            pUpdate->UpdateFootnoteNum();
+                        pUpdate = pTmp;
                         while ( pFootnoteFrame )
                         {
-                            pFootnoteFrame->SetRef( this );
+                            pFootnoteFrame->SetRef( pDest );
                             pFootnoteFrame = pFootnoteFrame->GetFollow();
-                            SetFootnote( true );
                         }
                     }
-                    else if( GetFollow() )
+                    else
                     {
-                        SwContentFrame *pDest = GetFollow();
-                        while( pDest->GetFollow() && static_cast<SwTextFrame*>(pDest->
-                               GetFollow())->GetOfst() <= nIdx )
-                            pDest = pDest->GetFollow();
-                        OSL_ENSURE( !SwFootnoteBossFrame::FindFootnote(
-                            pDest,pFootnote),"SwTextFrame::RemoveFootnote: footnote exists");
-
-                        // Never deregister; always move
-                        if ( bEndDoc ||
-                             !pFootnoteFrame->FindFootnoteBossFrame()->IsBefore( pDest->FindFootnoteBossFrame( !bEndn ) )
-                           )
-                        {
-                            SwPageFrame* pTmp = pFootnoteFrame->FindPageFrame();
-                            if( pUpdate && pUpdate != pTmp )
-                                pUpdate->UpdateFootnoteNum();
-                            pUpdate = pTmp;
-                            while ( pFootnoteFrame )
-                            {
-                                pFootnoteFrame->SetRef( pDest );
-                                pFootnoteFrame = pFootnoteFrame->GetFollow();
-                            }
-                        }
-                        else
-                        {
-                            pFootnoteBoss->MoveFootnotes( this, pDest, pFootnote );
-                            bRemove = true;
-                        }
-                        static_cast<SwTextFrame*>(pDest)->SetFootnote( true );
-
-                        OSL_ENSURE( SwFootnoteBossFrame::FindFootnote( pDest,
-                           pFootnote),"SwTextFrame::RemoveFootnote: footnote ChgRef failed");
+                        pFootnoteBoss->MoveFootnotes( this, pDest, pFootnote );
+                        bRemove = true;
                     }
-                    else
+                    static_cast<SwTextFrame*>(pDest)->SetFootnote( true );
+
+                    OSL_ENSURE( SwFootnoteBossFrame::FindFootnote( pDest,
+                       pFootnote),"SwTextFrame::RemoveFootnote: footnote ChgRef failed");
+                }

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list