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

Michael Stahl Michael.Stahl at cib.de
Thu May 3 17:07:07 UTC 2018


Rebased ref, commits from common ancestor:
commit 4775674ae24ca588d3b2791fbc685157d83e08ae
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Thu May 3 19:01:57 2018 +0200

    EnhancedPDFExportHelper.cxx
    
    Change-Id: Id41c8cdd567f3fdf688338a17bc513553a8b2b71

diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 7d18ac32c423..85b5e787e0b5 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -760,7 +760,7 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType )
             if (pPor->GetWhichPor() == POR_SOFTHYPH || pPor->GetWhichPor() == POR_HYPH)
                 aActualText = OUString(u'\x00ad'); // soft hyphen
             else
-                aActualText = rInf.GetText().copy(rInf.GetIdx(), pPor->GetLen());
+                aActualText = rInf.GetText().copy(rInf.GetIdx(), sal_Int32(pPor->GetLen()));
             mpPDFExtOutDevData->SetActualText( aActualText );
         }
 
commit 82eeaf6619067519114b37deef93095100b8f3a4
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Thu May 3 19:01:46 2018 +0200

    accpara.cxx
    
    Change-Id: I76a39b81c6770dea1905a0fb20691cd33e8be130

diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index 238fcfa62f83..d144127be4f7 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -961,12 +961,10 @@ void SAL_CALL SwAccessibleParagraph::grabFocus()
     if( pCursorSh != nullptr && pTextNd != nullptr &&
         ( pCursor == nullptr ||
            pCursor->GetPoint()->nNode.GetIndex() != pTextNd->GetIndex() ||
-          !pTextFrame->IsInside( pCursor->GetPoint()->nContent.GetIndex()) ) )
+          !pTextFrame->IsInside(pTextFrame->MapModelToViewPos(*pCursor->GetPoint()))))
     {
         // create pam for selection
-        SwIndex aIndex( const_cast< SwTextNode * >( pTextNd ),
-                        pTextFrame->GetOfst() );
-        SwPosition aStartPos( *pTextNd, aIndex );
+        SwPosition const aStartPos(pTextFrame->MapViewToModelPos(pTextFrame->GetOfst()));
         SwPaM aPaM( aStartPos );
 
         // set PaM at cursor shell
@@ -2966,7 +2964,7 @@ SwHyperlinkIter_Impl::SwHyperlinkIter_Impl( const SwTextFrame *pTextFrame ) :
     nPos( 0 )
 {
     const SwTextFrame *pFollFrame = pTextFrame->GetFollow();
-    nEnd = pFollFrame ? pFollFrame->GetOfst() : pTextFrame->GetTextNode()->Len();
+    nEnd = pFollFrame ? pFollFrame->GetOfst() : TextFrameIndex(pTextFrame->GetText().getLength());
 }
 
 const SwTextAttr *SwHyperlinkIter_Impl::next()
commit 0261ad58392a23f22c2ac2fb2be6ae7a370041d3
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Thu May 3 19:01:19 2018 +0200

    acccontext.cxx
    
    Change-Id: I537d218afbd7d2832461e24fd98cc1d63304e17a

diff --git a/sw/source/core/access/acccontext.cxx b/sw/source/core/access/acccontext.cxx
index 628ad727dc47..ba217a027a79 100644
--- a/sw/source/core/access/acccontext.cxx
+++ b/sw/source/core/access/acccontext.cxx
@@ -956,9 +956,7 @@ void SAL_CALL SwAccessibleContext::grabFocus()
             if( pTextNd )
             {
                 // create pam for selection
-                SwIndex aIndex( const_cast< SwTextNode * >( pTextNd ),
-                                pTextFrame->GetOfst() );
-                SwPosition aStartPos( *pTextNd, aIndex );
+                SwPosition const aStartPos(pTextFrame->MapViewToModelPos(pTextFrame->GetOfst()));
                 SwPaM aPaM( aStartPos );
 
                 // set PaM at cursor shell
commit 83aac19830f309b24afa75457aa0bd735a9e316c
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Thu May 3 18:46:10 2018 +0200

    sw: do all trivial conversions in txtftn.cxx
    
    Change-Id: I80a7303d73ff1e5f2d6496add4a31121f3fbfd8e

diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx
index e5815623dab0..655e10346123 100644
--- a/sw/source/core/text/txtftn.cxx
+++ b/sw/source/core/text/txtftn.cxx
@@ -97,10 +97,13 @@ void SwTextFrame::CalcFootnoteFlag()
     const size_t nSize = pHints->Count();
 
 #ifdef DBG_UTIL
-    const sal_Int32 nEnd = nStop != COMPLETE_STRING ? nStop
-                        : GetFollow() ? GetFollow()->GetOfst() : COMPLETE_STRING;
+    const TextFrameIndex nEnd = nStop != TextFrameIndex(COMPLETE_STRING)
+        ? nStop
+        : GetFollow() ? GetFollow()->GetOfst() : TextFrameIndex(COMPLETE_STRING);
 #else
-    const sal_Int32 nEnd = GetFollow() ? GetFollow()->GetOfst() : COMPLETE_STRING;
+    const TextFrameIndex nEnd = GetFollow()
+        ? GetFollow()->GetOfst()
+        : TextFrameIndex(COMPLETE_STRING);
 #endif
 
     for ( size_t i = 0; i < nSize; ++i )
@@ -396,9 +399,9 @@ void SwTextFrame::RemoveFootnote(TextFrameIndex const nStart, TextFrameIndex con
     if( !pHints )
         return;
 
-    bool bRollBack = nLen != COMPLETE_STRING;
+    bool bRollBack = nLen != TextFrameIndex(COMPLETE_STRING);
     const size_t nSize = pHints->Count();
-    sal_Int32 nEnd;
+    TextFrameIndex nEnd;
     SwTextFrame* pSource;
     if( bRollBack )
     {
@@ -409,7 +412,7 @@ void SwTextFrame::RemoveFootnote(TextFrameIndex const nStart, TextFrameIndex con
     }
     else
     {
-        nEnd = COMPLETE_STRING;
+        nEnd = TextFrameIndex(COMPLETE_STRING);
         pSource = this;
     }
 
@@ -549,14 +552,14 @@ void SwTextFrame::RemoveFootnote(TextFrameIndex const nStart, TextFrameIndex con
     // to be passed to the Follow. The Offset of the Follow is, however, outdated;
     // it'll be set soon. CalcFntFlag depends on a correctly set Follow Offset.
     // Therefore we temporarily calculate the Follow Offset here
-    sal_Int32 nOldOfst = COMPLETE_STRING;
+    TextFrameIndex nOldOfst(COMPLETE_STRING);
     if( HasFollow() && nStart > GetOfst() )
     {
         nOldOfst = GetFollow()->GetOfst();
-        GetFollow()->ManipOfst( nStart + ( bRollBack ? nLen : 0 ) );
+        GetFollow()->ManipOfst(nStart + (bRollBack ? nLen : TextFrameIndex(0)));
     }
     pSource->CalcFootnoteFlag();
-    if( nOldOfst < COMPLETE_STRING )
+    if (nOldOfst < TextFrameIndex(COMPLETE_STRING))
         GetFollow()->ManipOfst( nOldOfst );
 }
 
@@ -1088,7 +1091,7 @@ TextFrameIndex SwTextFormatter::FormatQuoVadis(TextFrameIndex const nOffset)
 
     Right( Right() - nQuoWidth );
 
-    sal_Int32 nRet;
+    TextFrameIndex nRet;
     {
         SwSwapIfNotSwapped swap(m_pFrame);
 
@@ -1108,7 +1111,7 @@ TextFrameIndex SwTextFormatter::FormatQuoVadis(TextFrameIndex const nOffset)
     {
         pGlue->Height( 0 );
         pGlue->Width( 0 );
-        pGlue->SetLen( 0 );
+        pGlue->SetLen(TextFrameIndex(0));
         pGlue->SetAscent( 0 );
         pGlue->SetPortion( nullptr );
         pGlue->SetFixWidth(0);
@@ -1126,7 +1129,7 @@ TextFrameIndex SwTextFormatter::FormatQuoVadis(TextFrameIndex const nOffset)
                 case SvxAdjust::Block:
                 {
                     if( !m_pCurr->GetLen() ||
-                        CH_BREAK != GetInfo().GetChar(m_nStart+m_pCurr->GetLen()-1))
+                        CH_BREAK != GetInfo().GetChar(m_nStart + m_pCurr->GetLen() - TextFrameIndex(1)))
                         nLastLeft = pQuo->GetAscent();
                     nQuoWidth = nQuoWidth + nLastLeft;
                     break;
@@ -1313,7 +1316,7 @@ SwFootnotePortion::SwFootnotePortion( const OUString &rExpand,
         , mbPreferredScriptTypeSet( false )
         , mnPreferredScriptType( SwFontScript::Latin )
 {
-    SetLen(1);
+    SetLen(TextFrameIndex(1));
     SetWhichPor( POR_FTN );
 }
 
@@ -1374,7 +1377,7 @@ SwFieldPortion *SwQuoVadisPortion::Clone( const OUString &rExpand ) const
 SwQuoVadisPortion::SwQuoVadisPortion( const OUString &rExp, const OUString& rStr )
     : SwFieldPortion( rExp ), aErgo(rStr)
 {
-    SetLen(0);
+    SetLen(TextFrameIndex(0));
     SetWhichPor( POR_QUOVADIS );
 }
 
@@ -1383,14 +1386,14 @@ bool SwQuoVadisPortion::Format( SwTextFormatInfo &rInf )
     // First try; maybe the Text fits
     CheckScript( rInf );
     bool bFull = SwFieldPortion::Format( rInf );
-    SetLen( 0 );
+    SetLen(TextFrameIndex(0));
 
     if( bFull )
     {
         // Second try; we make the String shorter
         m_aExpand = "...";
         bFull = SwFieldPortion::Format( rInf );
-        SetLen( 0 );
+        SetLen(TextFrameIndex(0));
         if( bFull  )
             // Third try; we're done: we crush
             Width( sal_uInt16(rInf.Width() - rInf.X()) );
@@ -1441,7 +1444,7 @@ SwFieldPortion *SwErgoSumPortion::Clone( const OUString &rExpand ) const
 SwErgoSumPortion::SwErgoSumPortion(const OUString &rExp, const OUString& rStr)
     : SwFieldPortion( rExp )
 {
-    SetLen(0);
+    SetLen(TextFrameIndex(0));
     m_aExpand += rStr;
 
     // One blank distance to the text
@@ -1451,13 +1454,13 @@ SwErgoSumPortion::SwErgoSumPortion(const OUString &rExp, const OUString& rStr)
 
 TextFrameIndex SwErgoSumPortion::GetCursorOfst(const sal_uInt16) const
 {
-    return 0;
+    return TextFrameIndex(0);
 }
 
 bool SwErgoSumPortion::Format( SwTextFormatInfo &rInf )
 {
     const bool bFull = SwFieldPortion::Format( rInf );
-    SetLen( 0 );
+    SetLen(TextFrameIndex(0));
     rInf.SetErgoDone( true );
 
     // No multiline Fields for QuoVadis and ErgoSum
commit bd59417e19e9edc15485e219ff7f2237df4fdfbf
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Thu May 3 18:30:07 2018 +0200

    sw: some trivial conversions in txtfrm.cxx
    
    Change-Id: I3c5392370b36c30ad86062c72402049ef294a4a4

diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 8dff0a00cdd8..73ff2c1b88c4 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -589,8 +589,7 @@ void SwTextFrame::HideHidden()
     OSL_ENSURE( !GetFollow() && IsHiddenNow(),
             "HideHidden on visible frame of hidden frame has follow" );
 
-    const sal_Int32 nEnd = COMPLETE_STRING;
-    HideFootnotes( GetOfst(), nEnd );
+    HideFootnotes(GetOfst(), TextFrameIndex(COMPLETE_STRING));
     HideAndShowObjects();
 
     // format information is obsolete
@@ -778,8 +777,8 @@ TextFrameIndex SwTextFrame::FindBrk(const OUString &rText,
                               const TextFrameIndex nStart,
                               const TextFrameIndex nEnd)
 {
-    sal_Int32 nFound = nStart;
-    const sal_Int32 nEndLine = std::min( nEnd, rText.getLength() - 1 );
+    sal_Int32 nFound = sal_Int32(nStart);
+    const sal_Int32 nEndLine = std::min(sal_Int32(nEnd), rText.getLength() - 1);
 
     // Skip all leading blanks.
     while( nFound <= nEndLine && ' ' == rText[nFound] )
@@ -796,7 +795,7 @@ TextFrameIndex SwTextFrame::FindBrk(const OUString &rText,
         nFound++;
     }
 
-    return nFound;
+    return TextFrameIndex(nFound);
 }
 
 bool SwTextFrame::IsIdxInside(TextFrameIndex const nPos, TextFrameIndex const nLen) const
@@ -806,7 +805,7 @@ bool SwTextFrame::IsIdxInside(TextFrameIndex const nPos, TextFrameIndex const nL
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wstrict-overflow"
 #endif
-    if( nLen != COMPLETE_STRING && GetOfst() > nPos + nLen ) // the range preceded us
+    if (nLen != TextFrameIndex(COMPLETE_STRING) && GetOfst() > nPos + nLen) // the range preceded us
 #if defined __GNUC__ && !defined __clang__
 #pragma GCC diagnostic pop
 #endif
@@ -815,7 +814,7 @@ bool SwTextFrame::IsIdxInside(TextFrameIndex const nPos, TextFrameIndex const nL
     if( !GetFollow() ) // the range doesn't precede us,
         return true; // nobody follows us.
 
-    const sal_Int32 nMax = GetFollow()->GetOfst();
+    TextFrameIndex const nMax = GetFollow()->GetOfst();
 
     // either the range overlap or our text has been deleted
     if( nMax > nPos || nMax > GetText().getLength() )
@@ -854,7 +853,7 @@ void SwTextFrame::InvalidateRange_( const SwCharRange &aRange, const long nD)
     }
     SwCharRange &rReformat = pPara->GetReformat();
     if(aRange != rReformat) {
-        if( COMPLETE_STRING == rReformat.Len() )
+        if (TextFrameIndex(COMPLETE_STRING) == rReformat.Len())
             rReformat = aRange;
         else
             rReformat += aRange;
@@ -1098,7 +1097,7 @@ void SwTextFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew )
         case RES_DEL_CHR:
         {
             nPos = static_cast<const SwDelChr*>(pNew)->nPos;
-            InvalidateRange( SwCharRange( nPos, 1 ), -1 );
+            InvalidateRange( SwCharRange(nPos, TextFrameIndex(1)), -1 );
             lcl_SetWrong( *this, nPos, -1, true );
             lcl_SetScriptInval( *this, nPos );
             bSetFieldsDirty = bRecalcFootnoteFlag = true;
@@ -1116,7 +1115,7 @@ void SwTextFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew )
                 if( !nLen )
                     InvalidateSize();
                 else
-                    InvalidateRange( SwCharRange( nPos, 1 ), m );
+                    InvalidateRange( SwCharRange(nPos, TextFrameIndex(1)), m );
             }
             lcl_SetWrong( *this, nPos, m, true );
             lcl_SetScriptInval( *this, nPos );
@@ -1181,7 +1180,7 @@ void SwTextFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew )
         case RES_TXTATR_ANNOTATION:
             {
                 nPos = static_cast<const SwFormatField*>(pNew)->GetTextField()->GetStart();
-                if( IsIdxInside( nPos, 1 ) )
+                if (IsIdxInside(nPos, TextFrameIndex(1)))
                 {
                     if( pNew == pOld )
                     {
@@ -1191,7 +1190,7 @@ void SwTextFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew )
                         SetCompletePaint();
                     }
                     else
-                        InvalidateRange_( SwCharRange( nPos, 1 ) );
+                        InvalidateRange_(SwCharRange(nPos, TextFrameIndex(1)));
                 }
                 bSetFieldsDirty = true;
                 // ST2
@@ -1203,7 +1202,7 @@ void SwTextFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew )
         case RES_TXTATR_FTN :
         {
             nPos = static_cast<const SwFormatFootnote*>(pNew)->GetTextFootnote()->GetStart();
-            if( IsInFootnote() || IsIdxInside( nPos, 1 ) )
+            if (IsInFootnote() || IsIdxInside(nPos, TextFrameIndex(1)))
                 Prepare( PREP_FTN, static_cast<const SwFormatFootnote*>(pNew)->GetTextFootnote() );
             break;
         }
@@ -1220,7 +1219,7 @@ void SwTextFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew )
             if( SfxItemState::SET == rNewSet.GetItemState( RES_TXTATR_FTN, false, &pItem ))
             {
                 nPos = static_cast<const SwFormatFootnote*>(pItem)->GetTextFootnote()->GetStart();
-                if( IsIdxInside( nPos, 1 ) )
+                if (IsIdxInside(nPos, TextFrameIndex(1)))
                     Prepare( PREP_FTN, pNew );
                 nClear = 0x01;
                 --nCount;
@@ -1229,7 +1228,7 @@ void SwTextFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew )
             if( SfxItemState::SET == rNewSet.GetItemState( RES_TXTATR_FIELD, false, &pItem ))
             {
                 nPos = static_cast<const SwFormatField*>(pItem)->GetTextField()->GetStart();
-                if( IsIdxInside( nPos, 1 ) )
+                if (IsIdxInside(nPos, TextFrameIndex(1)))
                 {
                     const SfxPoolItem* pOldItem = pOld ?
                         &(static_cast<const SwAttrSetChg*>(pOld)->GetChgSet()->Get(RES_TXTATR_FIELD)) : nullptr;
@@ -1239,7 +1238,7 @@ void SwTextFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew )
                         SetCompletePaint();
                     }
                     else
-                        InvalidateRange_( SwCharRange( nPos, 1 ) );
+                        InvalidateRange_(SwCharRange(nPos, TextFrameIndex(1)));
                 }
                 nClear |= 0x02;
                 --nCount;
@@ -1417,7 +1416,7 @@ void SwTextFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew )
                 {
                     const SwFormatField *pField = static_cast<const SwFormatField *>(pNew);
                     InvalidateRange(
-                        SwCharRange( pField->GetTextField()->GetStart(), 1 ) );
+                        SwCharRange(pField->GetTextField()->GetStart(), TextFrameIndex(1)));
                 }
             }
             break;
@@ -1496,7 +1495,7 @@ void SwTextFrame::PrepWidows( const sal_uInt16 nNeed, bool bNotify )
     SwTextSizeInfo aInf( this );
     SwTextMargin aLine( this, &aInf );
     aLine.Bottom();
-    sal_Int32 nTmpLen = aLine.GetCurr()->GetLen();
+    TextFrameIndex nTmpLen = aLine.GetCurr()->GetLen();
     while( nHave && aLine.PrevLine() )
     {
         if( nTmpLen )
@@ -1650,9 +1649,9 @@ bool SwTextFrame::Prepare( const PrepareHint ePrep, const void* pVoid,
             if( IsFootnoteNumFrame() != pPara->IsFootnoteNum() ||
                 IsUndersized() )
             {
-                InvalidateRange( SwCharRange( 0, 1 ), 1);
+                InvalidateRange(SwCharRange(TextFrameIndex(0), TextFrameIndex(1)), 1);
                 if( GetOfst() && !IsFollow() )
-                    SetOfst_( 0 );
+                    SetOfst_(TextFrameIndex(0));
             }
             break;
         case PREP_MUST_FIT :
@@ -1678,7 +1677,7 @@ bool SwTextFrame::Prepare( const PrepareHint ePrep, const void* pVoid,
                 if( !GetPrev() )
                     // So we're a TextFrame of the footnote, which has
                     // to display the footnote number or the ErgoSum text
-                    InvalidateRange( SwCharRange( 0, 1 ), 1);
+                    InvalidateRange(SwCharRange(TextFrameIndex(0), TextFrameIndex(1)), 1);
 
                 if( !GetNext() )
                 {
@@ -1690,7 +1689,7 @@ bool SwTextFrame::Prepare( const PrepareHint ePrep, const void* pVoid,
                         sal_Int32 nPos = pPara->GetParLen();
                         if( nPos )
                             --nPos;
-                        InvalidateRange( SwCharRange( nPos, 1 ), 1);
+                        InvalidateRange( SwCharRange(nPos, TextFrameIndex(1)), 1);
                     }
                 }
             }
@@ -1698,7 +1697,7 @@ bool SwTextFrame::Prepare( const PrepareHint ePrep, const void* pVoid,
             {
                 // We are the TextFrame _with_ the footnote
                 const sal_Int32 nPos = pFootnote->GetStart();
-                InvalidateRange( SwCharRange( nPos, 1 ), 1);
+                InvalidateRange(SwCharRange(nPos, TextFrameIndex(1)), 1);
             }
             break;
         }
@@ -1710,7 +1709,7 @@ bool SwTextFrame::Prepare( const PrepareHint ePrep, const void* pVoid,
                 bool bOld = IsVertical();
                 SetInvalidVert( true );
                 if( bOld != IsVertical() )
-                    InvalidateRange( SwCharRange( GetOfst(), COMPLETE_STRING ) );
+                    InvalidateRange(SwCharRange(GetOfst(), TextFrameIndex(COMPLETE_STRING)));
             }
 
             if( HasFollow() )
@@ -1718,15 +1717,15 @@ bool SwTextFrame::Prepare( const PrepareHint ePrep, const void* pVoid,
                 sal_Int32 nNxtOfst = GetFollow()->GetOfst();
                 if( nNxtOfst )
                     --nNxtOfst;
-                InvalidateRange( SwCharRange( nNxtOfst, 1 ), 1);
+                InvalidateRange(SwCharRange( nNxtOfst, TextFrameIndex(1)), 1);
             }
             if( IsInFootnote() )
             {
                 sal_Int32 nPos;
                 if( lcl_ErgoVadis( this, nPos, PREP_QUOVADIS ) )
-                    InvalidateRange( SwCharRange( nPos, 1 ) );
+                    InvalidateRange( SwCharRange( nPos, TextFrameIndex(1)) );
                 if( lcl_ErgoVadis( this, nPos, PREP_ERGOSUM ) )
-                    InvalidateRange( SwCharRange( nPos, 1 ) );
+                    InvalidateRange( SwCharRange( nPos, TextFrameIndex(1)) );
             }
             // If we have a page number field, we must invalidate those spots
             SwpHints *pHints = GetTextNode()->GetpSwpHints();
@@ -1751,7 +1750,7 @@ bool SwTextFrame::Prepare( const PrepareHint ePrep, const void* pVoid,
                         const sal_uInt16 nWhich = pHt->Which();
                         if( RES_TXTATR_FIELD == nWhich ||
                             (HasFootnote() && pVoid && RES_TXTATR_FTN == nWhich))
-                        InvalidateRange( SwCharRange( nStart, 1 ), 1 );
+                        InvalidateRange(SwCharRange(nStart, TextFrameIndex(1)), 1);
                     }
                 }
             }
@@ -1759,7 +1758,7 @@ bool SwTextFrame::Prepare( const PrepareHint ePrep, const void* pVoid,
             if( IsUndersized() )
             {
                 InvalidateSize_();
-                InvalidateRange( SwCharRange( GetOfst(), 1 ), 1);
+                InvalidateRange(SwCharRange(GetOfst(), TextFrameIndex(1)), 1);
             }
             break;
         }
@@ -1884,7 +1883,7 @@ bool SwTextFrame::Prepare( const PrepareHint ePrep, const void* pVoid,
                     FindMaster()->Prepare( PREP_FTN_GONE ); // Master's Prepare
                 if( nPos )
                     --nPos; // The char preceding our Follow
-                InvalidateRange( SwCharRange( nPos, 1 ) );
+                InvalidateRange(SwCharRange(nPos, TextFrameIndex(1)));
                 return bParaPossiblyInvalid;
             }
         case PREP_ERGOSUM:
@@ -1892,7 +1891,7 @@ bool SwTextFrame::Prepare( const PrepareHint ePrep, const void* pVoid,
             {
                 sal_Int32 nPos;
                 if( lcl_ErgoVadis( this, nPos, ePrep ) )
-                    InvalidateRange( SwCharRange( nPos, 1 ) );
+                    InvalidateRange(SwCharRange(nPos, TextFrameIndex(1)));
             }
             break;
         case PREP_FLY_ATTR_CHG:
@@ -1901,7 +1900,7 @@ bool SwTextFrame::Prepare( const PrepareHint ePrep, const void* pVoid,
             {
                 sal_Int32 nWhere = CalcFlyPos( static_cast<SwFrameFormat const *>(pVoid) );
                 OSL_ENSURE( COMPLETE_STRING != nWhere, "Prepare: Why me?" );
-                InvalidateRange( SwCharRange( nWhere, 1 ) );
+                InvalidateRange(SwCharRange(nWhere, TextFrameIndex(1)));
                 return bParaPossiblyInvalid;
             }
             SAL_FALLTHROUGH; // else: continue with default case block
commit 8a32961da7a3e9512e7a0ecb485c1f0f2bf31da0
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Thu May 3 18:15:44 2018 +0200

    sw: do all trivial conversions in guess.cxx
    
    Change-Id: I43c174aa39b6a4e6a2fdfb92f880934cec3edff3

diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx
index ae3dd4d28d0b..8d3e4f14d42a 100644
--- a/sw/source/core/text/guess.cxx
+++ b/sw/source/core/text/guess.cxx
@@ -53,7 +53,7 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
     if( !rInf.GetLen() || rInf.GetText().isEmpty() )
         return false;
 
-    OSL_ENSURE( rInf.GetIdx() < rInf.GetText().getLength(),
+    OSL_ENSURE( rInf.GetIdx() < TextFrameIndex(rInf.GetText().getLength()),
             "+SwTextGuess::Guess: invalid SwTextFormatInfo" );
 
     OSL_ENSURE( nPorHeight, "+SwTextGuess::Guess: no height" );
@@ -71,7 +71,7 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
                             0 ;
 
     SwTwips nLineWidth = rInf.Width() - rInf.X();
-    sal_Int32 nMaxLen = rInf.GetText().getLength() - rInf.GetIdx();
+    TextFrameIndex nMaxLen = TextFrameIndex(rInf.GetText().getLength()) - rInf.GetIdx();
 
     const SvxAdjust& rAdjust = rInf.GetTextFrame()->GetTextNode()->GetSwAttrSet().GetAdjust().GetAdjust();
 
@@ -83,15 +83,16 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
         {
             if ( rAdjust == SvxAdjust::Right || rAdjust == SvxAdjust::Center )
             {
-                sal_Int32 nSpaceCnt = 0;
-                for ( int i = (rInf.GetText().getLength() - 1); i >= rInf.GetIdx(); --i )
+                TextFrameIndex nSpaceCnt(0);
+                for (sal_Int32 i = (rInf.GetText().getLength() - 1);
+                     sal_Int32(rInf.GetIdx()) <= i; --i)
                 {
                     sal_Unicode cChar = rInf.GetText()[i];
                     if ( cChar != CH_BLANK && cChar != CH_FULL_BLANK )
                         break;
                     ++nSpaceCnt;
                 }
-                sal_Int32 nCharsCnt = nMaxLen - nSpaceCnt;
+                TextFrameIndex nCharsCnt = nMaxLen - nSpaceCnt;
                 if ( nSpaceCnt && nCharsCnt < rPor.GetLen() )
                 {
                     nMaxLen = nCharsCnt;
@@ -122,9 +123,11 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
         }
 
         // do not add extra italic value for an isolated blank:
-        if ( 1 == rInf.GetLen() &&
-             CH_BLANK == rInf.GetText()[ rInf.GetIdx() ] )
+        if (TextFrameIndex(1) == rInf.GetLen() &&
+            CH_BLANK == rInf.GetText()[sal_Int32(rInf.GetIdx())])
+        {
             bAddItalic = false;
+        }
 
         nItalic = bAddItalic ? nPorHeight / 12 : 0;
 
@@ -144,7 +147,7 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
             getIDocumentSettingAccess()->get(DocumentSettingId::UNBREAKABLE_NUMBERINGS);
 
     // first check if everything fits to line
-    if ( ( long ( nLineWidth ) * 2 > long ( nMaxLen ) * nPorHeight ) ||
+    if ( ( long ( nLineWidth ) * 2 > sal_Int32(nMaxLen) * nPorHeight ) ||
          ( bUnbreakableNumberings && rPor.IsNumberPortion() ) )
     {
         // call GetTextSize with maximum compression (for kanas)
@@ -156,10 +159,10 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
             // portion fits to line
             nCutPos = rInf.GetIdx() + nMaxLen;
             if( nItalic &&
-                ( nCutPos >= rInf.GetText().getLength() ||
+                (nCutPos >= TextFrameIndex(rInf.GetText().getLength()) ||
                   // #i48035# Needed for CalcFitToContent
                   // if first line ends with a manual line break
-                  rInf.GetText()[ nCutPos ] == CH_BREAK ) )
+                  rInf.GetText()[sal_Int32(nCutPos)] == CH_BREAK))
                 nBreakWidth = nBreakWidth + nItalic;
 
             // save maximum width for later use
@@ -173,7 +176,7 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
     }
 
     bool bHyph = rInf.IsHyphenate() && !rInf.IsHyphForbud();
-    sal_Int32 nHyphPos = 0;
+    TextFrameIndex nHyphPos = TextFrameIndex(0);
 
     // nCutPos is the first character not fitting to the current line
     // nHyphPos is the first character not fitting to the current line,
@@ -183,7 +186,7 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
         nCutPos = rInf.GetTextBreak( nLineWidth, nMaxLen, nMaxComp, nHyphPos, rInf.GetCachedVclData().get() );
 
         if ( !nHyphPos && rInf.GetIdx() )
-            nHyphPos = rInf.GetIdx() - 1;
+            nHyphPos = rInf.GetIdx() - TextFrameIndex(1);
     }
     else
     {
@@ -203,7 +206,7 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
     if( nCutPos > rInf.GetIdx() + nMaxLen )
     {
         // second check if everything fits to line
-        nCutPos = nBreakPos = rInf.GetIdx() + nMaxLen - 1;
+        nCutPos = nBreakPos = rInf.GetIdx() + nMaxLen - TextFrameIndex(1);
         rInf.GetTextSize( &rSI, rInf.GetIdx(), nMaxLen, nMaxComp,
                          nBreakWidth, nMaxSizeDiff );
 
@@ -211,7 +214,7 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
         // there likely has been a pixel rounding error in GetTextBreak
         if ( nBreakWidth <= nLineWidth )
         {
-            if( nItalic && ( nBreakPos + 1 ) >= rInf.GetText().getLength() )
+            if (nItalic && (nBreakPos + TextFrameIndex(1)) >= TextFrameIndex(rInf.GetText().getLength()))
                 nBreakWidth = nBreakWidth + nItalic;
 
             // save maximum width for later use
@@ -229,30 +232,32 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
     if ( rPor.IsFootnotePortion() )
     {
         nBreakPos = rInf.GetIdx();
-        nCutPos = -1;
+        nCutPos = TextFrameIndex(-1);
         return false;
     }
 
-    sal_Int32 nPorLen = 0;
+    TextFrameIndex nPorLen(0);
     // do not call the break iterator nCutPos is a blank
-    sal_Unicode cCutChar = nCutPos < rInf.GetText().getLength() ? rInf.GetText()[nCutPos] : 0;
+    sal_Unicode cCutChar = nCutPos < TextFrameIndex(rInf.GetText().getLength())
+        ? rInf.GetText()[sal_Int32(nCutPos)]
+        : 0;
     if( CH_BLANK == cCutChar || CH_FULL_BLANK == cCutChar )
     {
         nBreakPos = nCutPos;
-        sal_Int32 nX = nBreakPos;
+        TextFrameIndex nX = nBreakPos;
 
         if ( rAdjust == SvxAdjust::Left )
         {
             // we step back until a non blank character has been found
             // or there is only one more character left
-            while( nX && nBreakPos > rInf.GetText().getLength() &&
+            while (nX && TextFrameIndex(rInf.GetText().getLength()) < nBreakPos &&
                    ( CH_BLANK == ( cCutChar = rInf.GetChar( --nX ) ) ||
                      CH_FULL_BLANK == cCutChar ) )
                 --nBreakPos;
         }
         else // #i20878#
         {
-            while( nX && nBreakPos > rInf.GetLineStart() + 1 &&
+            while (nX && nBreakPos > rInf.GetLineStart() + TextFrameIndex(1) &&
                    ( CH_BLANK == ( cCutChar = rInf.GetChar( --nX ) ) ||
                      CH_FULL_BLANK == cCutChar ) )
                 --nBreakPos;
@@ -260,7 +265,7 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
 
         if( nBreakPos > rInf.GetIdx() )
             nPorLen = nBreakPos - rInf.GetIdx();
-        while( ++nCutPos < rInf.GetText().getLength() &&
+        while (++nCutPos < TextFrameIndex(rInf.GetText().getLength()) &&
                ( CH_BLANK == ( cCutChar = rInf.GetChar( nCutPos ) ) ||
                  CH_FULL_BLANK == cCutChar ) )
             ; // nothing
@@ -274,7 +279,7 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
         // into our string. If the line break position is inside of before
         // the field portion, we trigger an underflow.
 
-        sal_Int32 nOldIdx = rInf.GetIdx();
+        TextFrameIndex nOldIdx = rInf.GetIdx();
         sal_Unicode cFieldChr = 0;
 
 #if OSL_DEBUG_LEVEL > 0
@@ -287,7 +292,7 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
              ! rInf.GetLast()->IsFootnotePortion() &&
              rInf.GetIdx() > rInf.GetLineStart() &&
              CH_TXTATR_BREAKWORD ==
-                ( cFieldChr = rInf.GetText()[ rInf.GetIdx() - 1 ] ) )
+                (cFieldChr = rInf.GetText()[sal_Int32(rInf.GetIdx()) - 1]))
         {
             SwFieldPortion* pField = static_cast<SwFieldPortion*>(rInf.GetLast());
             OUString aText;
@@ -295,7 +300,7 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
 
             if ( !aText.isEmpty() )
             {
-                nFieldDiff = aText.getLength() - 1;
+                nFieldDiff = TextFrameIndex(aText.getLength() - 1);
                 nCutPos = nCutPos + nFieldDiff;
                 nHyphPos = nHyphPos + nFieldDiff;
 
@@ -317,7 +322,7 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
         {
             xHyph = ::GetHyphenator();
             aHyphOpt = LineBreakHyphenationOptions( xHyph,
-                                rInf.GetHyphValues(), nHyphPos );
+                                rInf.GetHyphValues(), sal_Int32(nHyphPos));
         }
 
         // Get Language for break iterator.
@@ -335,22 +340,22 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
             const CharClass& rCC = GetAppCharClass();
 
             // step back until a non-punctuation character is reached
-            sal_Int32 nLangIndex = nCutPos;
+            TextFrameIndex nLangIndex = nCutPos;
 
             // If a field has been expanded right in front of us we do not
             // step further than the beginning of the expanded field
             // (which is the position of the field placeholder in our
             // original string).
-            const sal_Int32 nDoNotStepOver = CH_TXTATR_BREAKWORD == cFieldChr ?
-                                              rInf.GetIdx() - nFieldDiff - 1:
-                                              0;
+            const TextFrameIndex nDoNotStepOver = CH_TXTATR_BREAKWORD == cFieldChr
+                    ? rInf.GetIdx() - nFieldDiff - TextFrameIndex(1)
+                    : TextFrameIndex(0);
 
             if ( nLangIndex > nDoNotStepOver &&
-                    rInf.GetText().getLength() == nLangIndex )
+                    TextFrameIndex(rInf.GetText().getLength()) == nLangIndex)
                 --nLangIndex;
 
             while ( nLangIndex > nDoNotStepOver &&
-                    ! rCC.isLetterNumeric( rInf.GetText(), nLangIndex ) )
+                    !rCC.isLetterNumeric(rInf.GetText(), sal_Int32(nLangIndex)))
                 --nLangIndex;
 
             // last "real" character is not inside our current portion
@@ -358,7 +363,7 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
             if ( nLangIndex < rInf.GetIdx() )
             {
                 sal_uInt16 nScript = g_pBreakIt->GetRealScriptOfText( rInf.GetText(),
-                                                                nLangIndex );
+                                        sal_Int32(nLangIndex));
                 OSL_ENSURE( nScript, "Script is not between 1 and 4" );
 
                 // compare current script with script from last "real" character
@@ -395,10 +400,10 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
         // determines first possible line break from nCutPos to
         // start index of current line
         LineBreakResults aResult = g_pBreakIt->GetBreakIter()->getLineBreak(
-            rInf.GetText(), nCutPos, aLocale,
-            rInf.GetLineStart(), aHyphOpt, aUserOpt );
+            rInf.GetText(), sal_Int32(nCutPos), aLocale,
+            sal_Int32(rInf.GetLineStart()), aHyphOpt, aUserOpt );
 
-        nBreakPos = aResult.breakIndex;
+        nBreakPos = TextFrameIndex(aResult.breakIndex);
 
         // if we are formatting multi portions we want to allow line breaks
         // at the border between single line and multi line portion
@@ -412,35 +417,35 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
 
         bHyph = BreakType::HYPHENATION == aResult.breakType;
 
-        if ( bHyph && nBreakPos != COMPLETE_STRING )
+        if (bHyph && nBreakPos != TextFrameIndex(COMPLETE_STRING))
         {
             // found hyphenation position within line
             // nBreakPos is set to the hyphenation position
             xHyphWord = aResult.rHyphenatedWord;
-            nBreakPos += xHyphWord->getHyphenationPos() + 1;
+            nBreakPos += TextFrameIndex(xHyphWord->getHyphenationPos() + 1);
 
             // if not in interactive mode, we have to break behind a soft hyphen
             if ( ! rInf.IsInterHyph() && rInf.GetIdx() )
             {
-                const long nSoftHyphPos =
+                sal_Int32 const nSoftHyphPos =
                         xHyphWord->getWord().indexOf( CHAR_SOFTHYPHEN );
 
                 if ( nSoftHyphPos >= 0 &&
-                     nBreakStart + nSoftHyphPos <= nBreakPos &&
+                     nBreakStart + TextFrameIndex(nSoftHyphPos) <= nBreakPos &&
                      nBreakPos > rInf.GetLineStart() )
-                    nBreakPos = rInf.GetIdx() - 1;
+                    nBreakPos = rInf.GetIdx() - TextFrameIndex(1);
             }
 
             if( nBreakPos >= rInf.GetIdx() )
             {
                 nPorLen = nBreakPos - rInf.GetIdx();
-                if( '-' == rInf.GetText()[ nBreakPos - 1 ] )
+                if ('-' == rInf.GetText()[ sal_Int32(nBreakPos) - 1 ])
                     xHyphWord = nullptr;
             }
         }
         else if ( !bHyph && nBreakPos >= rInf.GetLineStart() )
         {
-            OSL_ENSURE( nBreakPos != COMPLETE_STRING, "we should have found a break pos" );
+            OSL_ENSURE(sal_Int32(nBreakPos) != COMPLETE_STRING, "we should have found a break pos");
 
             // found break position within line
             xHyphWord = nullptr;
@@ -448,8 +453,10 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
             // check, if break position is soft hyphen and an underflow
             // has to be triggered
             if( nBreakPos > rInf.GetLineStart() && rInf.GetIdx() &&
-                CHAR_SOFTHYPHEN == rInf.GetText()[ nBreakPos - 1 ] )
-                nBreakPos = rInf.GetIdx() - 1;
+                CHAR_SOFTHYPHEN == rInf.GetText()[ sal_Int32(nBreakPos) - 1 ])
+            {
+                nBreakPos = rInf.GetIdx() - TextFrameIndex(1);
+            }
 
             if( rAdjust != SvxAdjust::Left )
             {
@@ -457,7 +464,7 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
                 // If a field has been expanded, we do not want to delete any
                 // blanks inside the field portion. This would cause an unwanted
                 // underflow
-                sal_Int32 nX = nBreakPos;
+                TextFrameIndex nX = nBreakPos;
                 while( nX > rInf.GetLineStart() &&
                        ( CH_TXTATR_BREAKWORD != cFieldChr || nX > rInf.GetIdx() ) &&
                        ( CH_BLANK == rInf.GetChar( --nX ) ||
@@ -471,14 +478,14 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
         {
             // no line break found, setting nBreakPos to COMPLETE_STRING
             // causes a break cut
-            nBreakPos = COMPLETE_STRING;
+            nBreakPos = TextFrameIndex(COMPLETE_STRING);
             OSL_ENSURE( nCutPos >= rInf.GetIdx(), "Deep cut" );
             nPorLen = nCutPos - rInf.GetIdx();
         }
 
-        if( nBreakPos > nCutPos && nBreakPos != COMPLETE_STRING )
+        if (nBreakPos > nCutPos && nBreakPos != TextFrameIndex(COMPLETE_STRING))
         {
-            const sal_Int32 nHangingLen = nBreakPos - nCutPos;
+            const TextFrameIndex nHangingLen = nBreakPos - nCutPos;
             SwPosSize aTmpSize = rInf.GetTextSize( &rSI, nCutPos, nHangingLen );
             aTmpSize.Width(aTmpSize.Width() + nLeftRightBorderSpace);
             OSL_ENSURE( !pHanging, "A hanging portion is hanging around" );
@@ -495,8 +502,8 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
         if ( CH_TXTATR_BREAKWORD == cFieldChr )
         {
             if ( nBreakPos < rInf.GetIdx() )
-                nBreakPos = nOldIdx - 1;
-            else if ( COMPLETE_STRING != nBreakPos )
+                nBreakPos = nOldIdx - TextFrameIndex(1);
+            else if (TextFrameIndex(COMPLETE_STRING) != nBreakPos)
             {
                 OSL_ENSURE( nBreakPos >= nFieldDiff, "I've got field trouble!" );
                 nBreakPos = nBreakPos - nFieldDiff;
@@ -547,20 +554,20 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
 // returns true if word at position nPos has a different spelling
 // if hyphenated at this position (old german spelling)
 bool SwTextGuess::AlternativeSpelling( const SwTextFormatInfo &rInf,
-    TextFrameIndex const nPos)
+    const TextFrameIndex nPos)
 {
     // get word boundaries
-    Boundary aBound =
-        g_pBreakIt->GetBreakIter()->getWordBoundary( rInf.GetText(), nPos,
+    Boundary aBound = g_pBreakIt->GetBreakIter()->getWordBoundary(
+        rInf.GetText(), sal_Int32(nPos),
         g_pBreakIt->GetLocale( rInf.GetFont()->GetLanguage() ),
         WordType::DICTIONARY_WORD, true );
-    nBreakStart = aBound.startPos;
-    sal_Int32 nWordLen = aBound.endPos - nBreakStart;
+    nBreakStart = TextFrameIndex(aBound.startPos);
+    sal_Int32 nWordLen = aBound.endPos - sal_Int32(nBreakStart);
 
     // if everything else fails, we want to cut at nPos
     nCutPos = nPos;
 
-    OUString aText( rInf.GetText().copy( nBreakStart, nWordLen ) );
+    OUString const aText( rInf.GetText().copy(sal_Int32(nBreakStart), nWordLen) );
 
     // check, if word has alternative spelling
     Reference< XHyphenator >  xHyph( ::GetHyphenator() );
@@ -568,7 +575,8 @@ bool SwTextGuess::AlternativeSpelling( const SwTextFormatInfo &rInf,
     //! subtract 1 since the UNO-interface is 0 based
     xHyphWord = xHyph->queryAlternativeSpelling( aText,
                         g_pBreakIt->GetLocale( rInf.GetFont()->GetLanguage() ),
-                        nPos - nBreakStart, rInf.GetHyphValues() );
+                    sal::static_int_cast<sal_Int16>(sal_Int32(nPos - nBreakStart)),
+                    rInf.GetHyphValues() );
     return xHyphWord.is() && xHyphWord->isAlternativeSpelling();
 }
 
commit d8efcb1ebfd0d565433af18e073967541cd0c5f1
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Thu May 3 18:04:36 2018 +0200

    sw: do all trivial conversions in frminf.cxx
    
    Change-Id: I57b5ca913e3289c3d168e2717e991af16b55df9c

diff --git a/sw/source/core/text/frminf.cxx b/sw/source/core/text/frminf.cxx
index d72e137e5120..909c3855817a 100644
--- a/sw/source/core/text/frminf.cxx
+++ b/sw/source/core/text/frminf.cxx
@@ -24,11 +24,11 @@
 TextFrameIndex SwTextMargin::GetTextStart() const
 {
     const OUString &rText = GetInfo().GetText();
-    const sal_Int32 nEnd = m_nStart + m_pCurr->GetLen();
+    const TextFrameIndex nEnd = m_nStart + m_pCurr->GetLen();
 
-    for( sal_Int32 i = m_nStart; i < nEnd; ++i )
+    for (TextFrameIndex i = m_nStart; i < nEnd; ++i)
     {
-        const sal_Unicode aChar = rText[i];
+        const sal_Unicode aChar = rText[sal_Int32(i)];
         if( CH_TAB != aChar && ' ' != aChar )
             return i;
     }
@@ -38,12 +38,12 @@ TextFrameIndex SwTextMargin::GetTextStart() const
 TextFrameIndex SwTextMargin::GetTextEnd() const
 {
     const OUString &rText = GetInfo().GetText();
-    const sal_Int32 nEnd = m_nStart + m_pCurr->GetLen();
-    for( sal_Int32 i = nEnd - 1; i >= m_nStart; --i )
+    const TextFrameIndex nEnd = m_nStart + m_pCurr->GetLen();
+    for (TextFrameIndex i = nEnd - TextFrameIndex(1); i >= m_nStart; --i)
     {
-        const sal_Unicode aChar = rText[i];
+        const sal_Unicode aChar = rText[sal_Int32(i)];
         if( CH_TAB != aChar && CH_BREAK != aChar && ' ' != aChar )
-            return i + 1;
+            return i + TextFrameIndex(1);
     }
     return m_nStart;
 }
@@ -85,7 +85,7 @@ bool SwTextFrameInfo::IsFilled( const sal_uInt8 nPercent ) const
 // Where does the text start (without whitespace)? (document global)
 SwTwips SwTextFrameInfo::GetLineStart( const SwTextCursor &rLine )
 {
-    const sal_Int32 nTextStart = rLine.GetTextStart();
+    const TextFrameIndex nTextStart = rLine.GetTextStart();
     if( rLine.GetStart() == nTextStart )
         return rLine.GetLineStart();
 
@@ -128,7 +128,7 @@ SwTwips SwTextFrameInfo::GetCharPos(TextFrameIndex const nChar, bool bCenter) co
     if( !bCenter )
         return nStt - aRectFnSet.GetLeft(pFrame->getFrameArea());
 
-    if( aLine.GetCharRect( &aRect, nChar+1 ) )
+    if (aLine.GetCharRect( &aRect, nChar + TextFrameIndex(1) ))
     {
         if ( aRectFnSet.IsVert() )
             pFrame->SwitchHorizontalToVertical( aRect );
@@ -142,27 +142,28 @@ SwTwips SwTextFrameInfo::GetCharPos(TextFrameIndex const nChar, bool bCenter) co
 }
 
 SwPaM *AddPam( SwPaM *pPam, const SwTextFrame* pTextFrame,
-                const sal_Int32 nPos, const sal_Int32 nLen )
+            TextFrameIndex const nPos, TextFrameIndex const nLen)
 {
     if( nLen )
     {
+        SwPosition const start(pTextFrame->MapViewToModelPos(nPos));
+        SwPosition const end(pTextFrame->MapViewToModelPos(nPos + nLen));
         // It could be the first
         if( pPam->HasMark() )
         {
             // If the new position is right after the current one, then
             // simply extend the Pam
-            if( nPos == pPam->GetPoint()->nContent.GetIndex() )
+            if (start == *pPam->GetPoint())
             {
-                pPam->GetPoint()->nContent += nLen;
+                *pPam->GetPoint() = end;
                 return pPam;
             }
             pPam = new SwPaM(*pPam, pPam);
         }
 
-        SwIndex &rContent = pPam->GetPoint()->nContent;
-        rContent.Assign( const_cast<SwTextNode*>(pTextFrame->GetTextNode()), nPos );
+        *pPam->GetPoint() = start;
         pPam->SetMark();
-        rContent += nLen;
+        *pPam->GetPoint() = end;
     }
     return pPam;
 }
@@ -178,7 +179,7 @@ void SwTextFrameInfo::GetSpaces( SwPaM &rPam, bool bWithLineBreak ) const
 
         if( aLine.GetCurr()->GetLen() )
         {
-            sal_Int32 nPos = aLine.GetTextStart();
+            TextFrameIndex nPos = aLine.GetTextStart();
             // Do NOT include the blanks/tabs from the first line
             // in the selection
             if( !bFirstLine && nPos > aLine.GetStart() )
@@ -193,9 +194,9 @@ void SwTextFrameInfo::GetSpaces( SwPaM &rPam, bool bWithLineBreak ) const
 
                 if( nPos < aLine.GetEnd() )
                 {
-                    sal_uInt16 nOff = !bWithLineBreak && CH_BREAK ==
-                                aLine.GetInfo().GetChar( aLine.GetEnd() - 1 )
-                                ? 1 : 0;
+                    TextFrameIndex const nOff( !bWithLineBreak && CH_BREAK ==
+                        aLine.GetInfo().GetChar(aLine.GetEnd() - TextFrameIndex(1))
+                                ? 1 : 0 );
                     pPam = AddPam( pPam, pFrame, nPos, aLine.GetEnd() - nPos - nOff );
                 }
             }
@@ -207,7 +208,7 @@ void SwTextFrameInfo::GetSpaces( SwPaM &rPam, bool bWithLineBreak ) const
 
 // Is there a bullet/symbol etc. at the text position?
 // Fonts: CharSet, SYMBOL and DONTKNOW
-bool SwTextFrameInfo::IsBullet( sal_Int32 nTextStart ) const
+bool SwTextFrameInfo::IsBullet(TextFrameIndex const nTextStart) const
 {
     SwTextSizeInfo aInf( const_cast<SwTextFrame*>(pFrame) );
     SwTextMargin aLine( const_cast<SwTextFrame*>(pFrame), &aInf );
@@ -280,24 +281,24 @@ sal_Int32 SwTextFrameInfo::GetBigIndent(TextFrameIndex& rFndPos,
 
     const Point aPoint( nNextIndent, aLine.Y() );
     rFndPos = aLine.GetCursorOfst( nullptr, aPoint, false );
-    if( 1 >= rFndPos )
+    if (TextFrameIndex(1) >= rFndPos)
         return 0;
 
     // Is on front of a non-space
     const OUString& rText = aInf.GetText();
-    sal_Unicode aChar = rText[rFndPos];
+    sal_Unicode aChar = rText[sal_Int32(rFndPos)];
     if( CH_TAB == aChar || CH_BREAK == aChar || ' ' == aChar ||
         (( CH_TXTATR_BREAKWORD == aChar || CH_TXTATR_INWORD == aChar ) &&
             aInf.HasHint( rFndPos ) ) )
         return 0;
 
     // and after a space
-    aChar = rText[rFndPos - 1];
+    aChar = rText[sal_Int32(rFndPos) - 1];
     if( CH_TAB != aChar && CH_BREAK != aChar &&
         ( ( CH_TXTATR_BREAKWORD != aChar && CH_TXTATR_INWORD != aChar ) ||
-            !aInf.HasHint( rFndPos - 1 ) ) &&
+            !aInf.HasHint(rFndPos - TextFrameIndex(1))) &&
         // More than two Blanks!
-        ( ' ' != aChar || ' ' != rText[rFndPos - 2] ) )
+        (' ' != aChar || ' ' != rText[sal_Int32(rFndPos) - 2]))
         return 0;
 
     SwRect aRect;
commit ac5a153079930df2afbd8453426e88584d088a49
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Thu May 3 18:02:20 2018 +0200

    more itratr header
    
    Change-Id: Id8951a08cee8b62b935adf6140fa133e9f72ec26

diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index 1b98d1688e47..ce5eb8326264 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -133,7 +133,7 @@ bool SwAttrIter::SeekAndChgAttrIter(TextFrameIndex const nNewPos, OutputDevice*
     return bChg;
 }
 
-bool SwAttrIter::IsSymbol( const sal_Int32 nNewPos )
+bool SwAttrIter::IsSymbol(TextFrameIndex const nNewPos)
 {
     Seek( nNewPos );
     if ( !m_nChgCnt && !m_nPropFont )
diff --git a/sw/source/core/text/itratr.hxx b/sw/source/core/text/itratr.hxx
index bed422740618..539db488c7ea 100644
--- a/sw/source/core/text/itratr.hxx
+++ b/sw/source/core/text/itratr.hxx
@@ -109,7 +109,7 @@ public:
     bool Seek( const sal_Int32 nPos );
     // Creates the font at the specified position via Seek() and checks
     // if it's a symbol font.
-    bool IsSymbol( const sal_Int32 nPos );
+    bool IsSymbol(TextFrameIndex nPos);
 
     /** Executes ChgPhysFnt if Seek() returns true
      *  and change font to merge character border with neighbours.
commit 9b89101124f00ef8ab0b33596b64ee8f8b61de0e
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Thu May 3 17:37:14 2018 +0200

    sw: do all trivial conversions in frmcrsr.cxx
    
    Change-Id: I87f83a10043f3d5f7edbca5c4f5cf56720a42661

diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx
index b8b1f3487317..882595ac4a2c 100644
--- a/sw/source/core/text/frmcrsr.cxx
+++ b/sw/source/core/text/frmcrsr.cxx
@@ -70,14 +70,14 @@ SwTextFrame *GetAdjFrameAtPos( SwTextFrame *pFrame, const SwPosition &rPos,
     if( !bNoScroll || pFrame->GetFollow() )
     {
         pFrameAtPos = pFrame->GetFrameAtPos( rPos );
-        if( nOffset < pFrameAtPos->GetOfst() &&
+        if (rPos < pFrameAtPos->MapViewToModelPos(pFrameAtPos->GetOfst()) &&
             !pFrameAtPos->IsFollow() )
         {
-            sal_Int32 nNew = nOffset;
-            if( nNew < MIN_OFFSET_STEP )
-                nNew = 0;
+            TextFrameIndex nNew = pFrameAtPos->MapModelToViewPos(rPos);
+            if (nNew < TextFrameIndex(MIN_OFFSET_STEP))
+                nNew = TextFrameIndex(0);
             else
-                nNew -= MIN_OFFSET_STEP;
+                nNew -= TextFrameIndex(MIN_OFFSET_STEP);
             sw_ChangeOffset( pFrameAtPos, nNew );
         }
     }
@@ -90,7 +90,8 @@ SwTextFrame *GetAdjFrameAtPos( SwTextFrame *pFrame, const SwPosition &rPos,
 
     if( nOffset && bRightMargin )
     {
-        while( pFrameAtPos && pFrameAtPos->GetOfst() == nOffset &&
+        while (pFrameAtPos &&
+               pFrameAtPos->MapViewToModelPos(pFrameAtPos->GetOfst()) == rPos &&
                pFrameAtPos->IsFollow() )
         {
             pFrameAtPos->GetFormatted();
@@ -124,7 +125,7 @@ bool sw_ChangeOffset(SwTextFrame* pFrame, TextFrameIndex nNew)
                 {
                     if( !pFrame->GetOfst() )
                         return false;
-                    nNew = 0;
+                    nNew = TextFrameIndex(0);
                 }
                 pFrame->SetOfst( nNew );
                 pFrame->SetPara( nullptr );
@@ -148,14 +149,15 @@ SwTextFrame& SwTextFrame::GetFrameAtOfst(TextFrameIndex const nWhere)
 
 SwTextFrame *SwTextFrame::GetFrameAtPos( const SwPosition &rPos )
 {
+    TextFrameIndex const nPos(MapModelToViewPos(rPos));
     SwTextFrame *pFoll = this;
     while( pFoll->GetFollow() )
     {
-        if( rPos.nContent.GetIndex() > pFoll->GetFollow()->GetOfst() )
+        if (nPos > pFoll->GetFollow()->GetOfst())
             pFoll = pFoll->GetFollow();
         else
         {
-            if( rPos.nContent.GetIndex() == pFoll->GetFollow()->GetOfst()
+            if (nPos == pFoll->GetFollow()->GetOfst()
                  && !SwTextCursor::IsRightMargin() )
                  pFoll = pFoll->GetFollow();
             else
@@ -263,8 +265,8 @@ bool SwTextFrame::GetCharRect( SwRect& rOrig, const SwPosition &rPos,
             nMaxY = pFrame->SwitchVerticalToHorizontal( nMaxY );
 
         bool bGoOn = true;
-        const sal_Int32 nOffset = rPos.nContent.GetIndex();
-        sal_Int32 nNextOfst;
+        TextFrameIndex const nOffset = MapModelToViewPos(rPos);
+        TextFrameIndex nNextOfst;
 
         do
         {
@@ -361,7 +363,7 @@ bool SwTextFrame::GetAutoPos( SwRect& rOrig, const SwPosition &rPos ) const
     if( IsHiddenNow() )
         return false;
 
-    const sal_Int32 nOffset = rPos.nContent.GetIndex();
+    TextFrameIndex const nOffset = MapModelToViewPos(rPos);
     SwTextFrame* pFrame = &(const_cast<SwTextFrame*>(this)->GetFrameAtOfst( nOffset ));
 
     pFrame->GetFormatted();
@@ -452,9 +454,9 @@ bool SwTextFrame::GetTopOfLine( SwTwips& _onTopOfLine,
     bool bRet = true;
 
     // get position offset
-    const sal_Int32 nOffset = _rPos.nContent.GetIndex();
+    TextFrameIndex const nOffset = MapModelToViewPos(_rPos);
 
-    if ( GetText().getLength() < nOffset )
+    if (TextFrameIndex(GetText().getLength()) < nOffset)
     {
         bRet = false;
     }
@@ -598,7 +600,7 @@ bool SwTextFrame::GetCursorOfst_(SwPosition* pPos, const Point& rPoint,
             while( aLine.GetLineNr() > 1 )
                 aLine.Prev();
 
-        sal_Int32 nOffset = aLine.GetCursorOfst( pPos, rPoint, bChgFrame, pCMS );
+        TextFrameIndex nOffset = aLine.GetCursorOfst(pPos, rPoint, bChgFrame, pCMS);
 
         if( pCMS && pCMS->m_eState == MV_NONE && aLine.GetEnd() == nOffset )
             pCMS->m_eState = MV_RIGHTMARGIN;
@@ -608,11 +610,10 @@ bool SwTextFrame::GetCursorOfst_(SwPosition* pPos, const Point& rPoint,
     // If SwTextIter::GetCursorOfst calls GetCursorOfst further by itself
     // nNode changes the position.
     // In such cases, pPos must not be calculated.
-        if( COMPLETE_STRING != nOffset )
+        if (TextFrameIndex(COMPLETE_STRING) != nOffset)
         {
             SwTextNode* pTextNd = const_cast<SwTextFrame*>(this)->GetTextNode();
-            pPos->nNode = *pTextNd;
-            pPos->nContent.Assign( pTextNd, nOffset );
+            *pPos = MapViewToModelPos(nOffset);
             if( pFillData )
             {
                 if (pTextNd->GetText().getLength() > nOffset ||
@@ -677,23 +678,23 @@ bool SwTextFrame::LeftMargin(SwPaM *pPam) const
     SwTextFrame *pFrame = GetAdjFrameAtPos( const_cast<SwTextFrame*>(this), *pPam->GetPoint(),
                                      SwTextCursor::IsRightMargin() );
     pFrame->GetFormatted();
-    sal_Int32 nIndx;
+    TextFrameIndex nIndx;
     if ( pFrame->IsEmpty() )
-        nIndx = 0;
+        nIndx = TextFrameIndex(0);
     else
     {
         SwTextSizeInfo aInf( pFrame );
         SwTextCursor  aLine( pFrame, &aInf );
 
-        aLine.CharCursorToLine(pPam->GetPoint()->nContent.GetIndex());
+        aLine.CharCursorToLine(pFrame->MapModelToViewPos(*pPam->GetPoint()));
         nIndx = aLine.GetStart();
         if( pFrame->GetOfst() && !pFrame->IsFollow() && !aLine.GetPrev() )
         {
-            sw_ChangeOffset( pFrame, 0 );
-            nIndx = 0;
+            sw_ChangeOffset(pFrame, TextFrameIndex(0));
+            nIndx = TextFrameIndex(0);
         }
     }
-    pPam->GetPoint()->nContent.Assign(pFrame->GetTextNode(), nIndx);
+    *pPam->GetPoint() = pFrame->MapViewToModelPos(nIndx);
     SwTextCursor::SetRightMargin( false );
     return true;
 }
@@ -712,29 +713,27 @@ bool SwTextFrame::RightMargin(SwPaM *pPam, bool bAPI) const
     SwTextFrame *pFrame = GetAdjFrameAtPos( const_cast<SwTextFrame*>(this), *pPam->GetPoint(),
                                      SwTextCursor::IsRightMargin() );
     pFrame->GetFormatted();
-    sal_Int32 nRightMargin;
-    if ( IsEmpty() )
-        nRightMargin = 0;
-    else
+    TextFrameIndex nRightMargin(0);
+    if (!IsEmpty())
     {
         SwTextSizeInfo aInf( pFrame );
         SwTextCursor  aLine( pFrame, &aInf );
 
-        aLine.CharCursorToLine(pPam->GetPoint()->nContent.GetIndex());
+        aLine.CharCursorToLine(MapModelToViewPos(*pPam->GetPoint()));
         nRightMargin = aLine.GetStart() + aLine.GetCurr()->GetLen();
 
         // We skip hard line brakes
         if( aLine.GetCurr()->GetLen() &&
-            CH_BREAK == aInf.GetText()[nRightMargin - 1])
+            CH_BREAK == aInf.GetText()[sal_Int32(nRightMargin) - 1])
             --nRightMargin;
         else if( !bAPI && (aLine.GetNext() || pFrame->GetFollow()) )
         {
             while( nRightMargin > aLine.GetStart() &&
-                ' ' == aInf.GetText()[nRightMargin - 1])
+                ' ' == aInf.GetText()[sal_Int32(nRightMargin) - 1])
                 --nRightMargin;
         }
     }
-    pPam->GetPoint()->nContent.Assign(pFrame->GetTextNode(), nRightMargin);
+    *pPam->GetPoint() = pFrame->MapViewToModelPos(nRightMargin);
     SwTextCursor::SetRightMargin( !bAPI );
     return true;
 }
@@ -769,15 +768,15 @@ bool SwTextFrame::UnitUp_( SwPaM *pPam, const SwTwips nOffset,
     }
 
     const_cast<SwTextFrame*>(this)->GetFormatted();
-    const sal_Int32 nPos = pPam->GetPoint()->nContent.GetIndex();
+    const TextFrameIndex nPos = MapModelToViewPos(*pPam->GetPoint());
     SwRect aCharBox;
 
     if( !IsEmpty() && !IsHiddenNow() )
     {
-        sal_Int32 nFormat = COMPLETE_STRING;
+        TextFrameIndex nFormat(COMPLETE_STRING);
         do
         {
-            if( nFormat != COMPLETE_STRING && !IsFollow() )
+            if (nFormat != TextFrameIndex(COMPLETE_STRING) && !IsFollow())
                 sw_ChangeOffset( const_cast<SwTextFrame*>(this), nFormat );
 
             SwTextSizeInfo aInf( const_cast<SwTextFrame*>(this) );
@@ -790,7 +789,7 @@ bool SwTextFrame::UnitUp_( SwPaM *pPam, const SwTwips nOffset,
                 aLine.Top();
 
             const SwLineLayout *pPrevLine = aLine.GetPrevLine();
-            const sal_Int32 nStart = aLine.GetStart();
+            const TextFrameIndex nStart = aLine.GetStart();
             aLine.GetCharRect( &aCharBox, nPos );
 
             bool bSecondOfDouble = ( aInf.IsMulti() && ! aInf.IsFirstMulti() );
@@ -799,13 +798,13 @@ bool SwTextFrame::UnitUp_( SwPaM *pPam, const SwTwips nOffset,
             if( !pPrevLine && !bSecondOfDouble && GetOfst() && !IsFollow() )
             {
                 nFormat = GetOfst();
-                sal_Int32 nDiff = aLine.GetLength();
+                TextFrameIndex nDiff = aLine.GetLength();
                 if( !nDiff )
-                    nDiff = MIN_OFFSET_STEP;
+                    nDiff = TextFrameIndex(MIN_OFFSET_STEP);
                 if( nFormat > nDiff )
                     nFormat = nFormat - nDiff;
                 else
-                    nFormat = 0;
+                    nFormat = TextFrameIndex(0);
                 continue;
             }
 
@@ -830,7 +829,7 @@ bool SwTextFrame::UnitUp_( SwPaM *pPam, const SwTwips nOffset,
                 const sal_uLong nOldNode = pPam->GetPoint()->nNode.GetIndex();
 #endif
                 // The node should not be changed
-                sal_Int32 nTmpOfst = aLine.GetCursorOfst( pPam->GetPoint(),
+                TextFrameIndex nTmpOfst = aLine.GetCursorOfst(pPam->GetPoint(),
                                                          aCharBox.Pos(), false );
 #if OSL_DEBUG_LEVEL > 0
                 OSL_ENSURE( nOldNode == pPam->GetPoint()->nNode.GetIndex(),
@@ -843,7 +842,7 @@ bool SwTextFrame::UnitUp_( SwPaM *pPam, const SwTwips nOffset,
                     nTmpOfst = nStart;
                     aSet.SetRight( true );
                 }
-                pPam->GetPoint()->nContent.Assign(const_cast<SwTextFrame*>(this)->GetTextNode(), nTmpOfst);
+                *pPam->GetPoint() = MapViewToModelPos(nTmpOfst);
                 return true;
             }
 
@@ -862,7 +861,7 @@ bool SwTextFrame::UnitUp_( SwPaM *pPam, const SwTwips nOffset,
     if ( IsFollow() )
     {
         const SwTextFrame *pTmpPrev = FindMaster();
-        sal_Int32 nOffs = GetOfst();
+        TextFrameIndex nOffs = GetOfst();
         if( pTmpPrev )
         {
             SwViewShell *pSh = getRootFrame()->GetCurrShell();
@@ -893,8 +892,8 @@ bool SwTextFrame::UnitUp_( SwPaM *pPam, const SwTwips nOffset,
 // nPos: the new visual position
 // bLeft: whether the break iterator has to add or subtract from the
 //        current position
-static void lcl_VisualMoveRecursion( const SwLineLayout& rCurrLine, sal_Int32 nIdx,
-                              sal_Int32& nPos, bool& bRight,
+static void lcl_VisualMoveRecursion(const SwLineLayout& rCurrLine, TextFrameIndex nIdx,
+                              TextFrameIndex & nPos, bool& bRight,
                               sal_uInt8& nCursorLevel, sal_uInt8 nDefaultDir )
 {
     const SwLinePortion* pPor = rCurrLine.GetFirstPortion();
@@ -948,10 +947,10 @@ static void lcl_VisualMoveRecursion( const SwLineLayout& rCurrLine, sal_Int32 nI
         if ( bRecurse )
         {
             const SwLineLayout& rLine = static_cast<const SwMultiPortion*>(pPor)->GetRoot();
-            sal_Int32 nTmpPos = nPos - nIdx;
+            TextFrameIndex nTmpPos = nPos - nIdx;
             bool bTmpForward = ! bRight;
             sal_uInt8 nTmpCursorLevel = nCursorLevel;
-            lcl_VisualMoveRecursion( rLine, 0, nTmpPos, bTmpForward,
+            lcl_VisualMoveRecursion(rLine, TextFrameIndex(0), nTmpPos, bTmpForward,
                                      nTmpCursorLevel, nDefaultDir + 1 );
 
             nPos = nTmpPos + nIdx;
@@ -1007,10 +1006,10 @@ static void lcl_VisualMoveRecursion( const SwLineLayout& rCurrLine, sal_Int32 nI
         if ( bRecurse )
         {
             const SwLineLayout& rLine = static_cast<const SwMultiPortion*>(pPor)->GetRoot();
-            sal_Int32 nTmpPos = nPos - nIdx;
+            TextFrameIndex nTmpPos = nPos - nIdx;
             bool bTmpForward = ! bRight;
             sal_uInt8 nTmpCursorLevel = nCursorLevel;
-            lcl_VisualMoveRecursion( rLine, 0, nTmpPos, bTmpForward,
+            lcl_VisualMoveRecursion(rLine, TextFrameIndex(0), nTmpPos, bTmpForward,
                                      nTmpCursorLevel, nDefaultDir + 1 );
 
             // special case:
@@ -1055,8 +1054,8 @@ void SwTextFrame::PrepareVisualMove(TextFrameIndex & nPos, sal_uInt8& nCursorLev
         aLine.Top();
 
     const SwLineLayout* pLine = aLine.GetCurr();
-    const sal_Int32 nStt = aLine.GetStart();
-    const sal_Int32 nLen = pLine->GetLen();
+    const TextFrameIndex nStt = aLine.GetStart();
+    const TextFrameIndex nLen = pLine->GetLen();
 
     // We have to distinguish between an insert and overwrite cursor:
     // The insert cursor position depends on the cursor level:
@@ -1096,11 +1095,11 @@ void SwTextFrame::PrepareVisualMove(TextFrameIndex & nPos, sal_uInt8& nCursorLev
         // visual indices are always LTR aligned
         if ( bVisualRight )
         {
-            if ( nTmpPos + 1 < nStt + nLen )
+            if (nTmpPos + TextFrameIndex(1) < nStt + nLen)
                 ++nTmpPos;
             else
             {
-                nPos = nDefaultDir == UBIDI_RTL ? 0 : nStt + nLen;
+                nPos = nDefaultDir == UBIDI_RTL ? TextFrameIndex(0) : nStt + nLen;
                 bOutOfBounds = true;
             }
         }
@@ -1110,14 +1109,14 @@ void SwTextFrame::PrepareVisualMove(TextFrameIndex & nPos, sal_uInt8& nCursorLev
                 --nTmpPos;
             else
             {
-                nPos = nDefaultDir == UBIDI_RTL ? nStt + nLen : 0;
+                nPos = nDefaultDir == UBIDI_RTL ? nStt + nLen : TextFrameIndex(0);
                 bOutOfBounds = true;
             }
         }
     }
     else
     {
-        nTmpPos = nDefaultDir == UBIDI_LTR ? nPos - 1 : 0;
+        nTmpPos = nDefaultDir == UBIDI_LTR ? nPos - TextFrameIndex(1) : TextFrameIndex(0);
     }
 
     if ( ! bOutOfBounds )
@@ -1154,7 +1153,7 @@ bool SwTextFrame::UnitDown_(SwPaM *pPam, const SwTwips nOffset,
         return SwContentFrame::UnitDown( pPam, nOffset, bSetInReadOnly );
     }
     const_cast<SwTextFrame*>(this)->GetFormatted();
-    const sal_Int32 nPos = pPam->GetPoint()->nContent.GetIndex();
+    const TextFrameIndex nPos = MapModelToViewPos(*pPam->GetPoint());
     SwRect aCharBox;
     const SwContentFrame *pTmpFollow = nullptr;
 
@@ -1163,10 +1162,10 @@ bool SwTextFrame::UnitDown_(SwPaM *pPam, const SwTwips nOffset,
 
     if ( !IsEmpty() && !IsHiddenNow() )
     {
-        sal_Int32 nFormat = COMPLETE_STRING;
+        TextFrameIndex nFormat = TextFrameIndex(COMPLETE_STRING);
         do
         {
-            if( nFormat != COMPLETE_STRING && !IsFollow() &&
+            if (nFormat != TextFrameIndex(COMPLETE_STRING) && !IsFollow() &&
                 !sw_ChangeOffset( const_cast<SwTextFrame*>(this), nFormat ) )
                 break;
 
@@ -1177,7 +1176,7 @@ bool SwTextFrame::UnitDown_(SwPaM *pPam, const SwTwips nOffset,
             aLine.CharCursorToLine( nPos );
 
             const SwLineLayout* pNextLine = aLine.GetNextLine();
-            const sal_Int32 nStart = aLine.GetStart();
+            const TextFrameIndex nStart = aLine.GetStart();
             aLine.GetCharRect( &aCharBox, nPos );
 
             bool bFirstOfDouble = ( aInf.IsMulti() && aInf.IsFirstMulti() );
@@ -1192,7 +1191,7 @@ bool SwTextFrame::UnitDown_(SwPaM *pPam, const SwTwips nOffset,
                 if ( pNextLine && ! bFirstOfDouble )
                     aLine.NextLine();
 
-                sal_Int32 nTmpOfst = aLine.GetCursorOfst( pPam->GetPoint(),
+                TextFrameIndex nTmpOfst = aLine.GetCursorOfst( pPam->GetPoint(),
                                  aCharBox.Pos(), false );
 #if OSL_DEBUG_LEVEL > 0
                 OSL_ENSURE( nOldNode == pPam->GetPoint()->nNode.GetIndex(),
@@ -1201,8 +1200,8 @@ bool SwTextFrame::UnitDown_(SwPaM *pPam, const SwTwips nOffset,
 
                 // We make sure that we move down.
                 if( nTmpOfst <= nStart && ! bFirstOfDouble )
-                    nTmpOfst = nStart + 1;
-                pPam->GetPoint()->nContent.Assign(const_cast<SwTextFrame*>(this)->GetTextNode(), nTmpOfst);
+                    nTmpOfst = nStart + TextFrameIndex(1);
+                *pPam->GetPoint() = MapViewToModelPos(nTmpOfst);
 
                 if ( IsVertical() )
                     const_cast<SwTextFrame*>(this)->SwapWidthAndHeight();
@@ -1233,12 +1232,12 @@ bool SwTextFrame::UnitDown_(SwPaM *pPam, const SwTwips nOffset,
             }
             else if( !IsFollow() )
             {
-                sal_Int32 nTmpLen = aInf.GetText().getLength();
+                TextFrameIndex nTmpLen(aInf.GetText().getLength());
                 if( aLine.GetEnd() < nTmpLen )
                 {
                     if( nFormat <= GetOfst() )
                     {
-                        nFormat = std::min( sal_Int32( GetOfst() + MIN_OFFSET_STEP ),
+                        nFormat = std::min(GetOfst() + TextFrameIndex(MIN_OFFSET_STEP),
                                        nTmpLen );
                         if( nFormat <= GetOfst() )
                             break;
commit 4a09964f416d19ff1c428f2c11f57ebe569f6498
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Thu May 3 17:28:15 2018 +0200

    sw: do all trivial conversions in frmform.cxx
    
    Change-Id: Ib79eb02fe6487f555381f0ef9c290503646fb54d

diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index 8f75cdb41a61..34af7aa4edbf 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -593,8 +593,8 @@ void SwTextFrame::AdjustFollow_( SwTextFormatter &rLine,
     // Dancing on the volcano: We'll just format the last line quickly
     // for the QuoVadis stuff.
     // The Offset can move of course:
-    const sal_Int32 nNewOfst = ( IsInFootnote() && ( !GetIndNext() || HasFollow() ) ) ?
-                            rLine.FormatQuoVadis(nOffset) : nOffset;
+    const TextFrameIndex nNewOfst = (IsInFootnote() && (!GetIndNext() || HasFollow()))
+        ? rLine.FormatQuoVadis(nOffset) : nOffset;
 
     if( !(nMode & 1) )
     {
@@ -611,7 +611,7 @@ void SwTextFrame::AdjustFollow_( SwTextFormatter &rLine,
     if( GetFollow() )
     {
         if ( nMode )
-            GetFollow()->ManipOfst( 0 );
+            GetFollow()->ManipOfst(TextFrameIndex(0));
 
         if ( CalcFollow( nNewOfst ) )   // CalcFollow only at the end, we do a SetOfst there
             rLine.SetOnceMore( true );
@@ -626,7 +626,7 @@ SwContentFrame *SwTextFrame::JoinFrame()
     SwTextFrame *pNxt = pFoll->GetFollow();
 
     // All footnotes of the to-be-destroyed Follow are relocated to us
-    sal_Int32 nStart = pFoll->GetOfst();
+    TextFrameIndex nStart = pFoll->GetOfst();
     if ( pFoll->HasFootnote() )
     {
         const SwpHints *pHints = pFoll->GetTextNode()->GetpSwpHints();
@@ -666,7 +666,7 @@ SwContentFrame *SwTextFrame::JoinFrame()
     }
 #endif
 
-    pFoll->MoveFlyInCnt( this, nStart, COMPLETE_STRING );
+    pFoll->MoveFlyInCnt( this, nStart, TextFrameIndex(COMPLETE_STRING) );
     pFoll->SetFootnote( false );
     // i#27138
     // Notify accessibility paragraphs objects about changed CONTENT_FLOWS_FROM/_TO relation.
@@ -753,12 +753,12 @@ void SwTextFrame::SplitFrame(TextFrameIndex const nTextPos)
 #ifdef DBG_UTIL
     else
     {
-        CalcFootnoteFlag( nTextPos-1 );
+        CalcFootnoteFlag( nTextPos - TextFrameIndex(1) );
         OSL_ENSURE( !HasFootnote(), "Missing FootnoteFlag." );
     }
 #endif
 
-    MoveFlyInCnt( pNew, nTextPos, COMPLETE_STRING );
+    MoveFlyInCnt( pNew, nTextPos, TextFrameIndex(COMPLETE_STRING) );
 
     // No SetOfst or CalcFollow, because an AdjustFollow follows immediately anyways
 
@@ -775,8 +775,8 @@ void SwTextFrame::SetOfst_(TextFrameIndex const nNewOfst)
     if( pPara )
     {
         SwCharRange &rReformat = pPara->GetReformat();
-        rReformat.Start() = 0;
-        rReformat.Len() = GetText().getLength();
+        rReformat.Start() = TextFrameIndex(0);
+        rReformat.Len() = TextFrameIndex(GetText().getLength());
         pPara->GetDelta() = rReformat.Len();
     }
     InvalidateSize();
@@ -930,20 +930,20 @@ bool SwTextFrame::CalcPreps()
                     // Let's see if it works ...
                     aLine.TruncLines();
                     aFrameBreak.SetRstHeight( aLine );
-                    FormatAdjust( aLine, aFrameBreak, aInf.GetText().getLength(), aInf.IsStop() );
+                    FormatAdjust( aLine, aFrameBreak, TextFrameIndex(aInf.GetText().getLength()), aInf.IsStop() );
                 }
                 else
                 {
                     if( !GetFollow() )
                     {
                         FormatAdjust( aLine, aFrameBreak,
-                                      aInf.GetText().getLength(), aInf.IsStop() );
+                            TextFrameIndex(aInf.GetText().getLength()), aInf.IsStop() );
                     }
                     else if ( !aFrameBreak.IsKeepAlways() )
                     {
                         // We delete a line before the Master, because the Follow
                         // could hand over a line
-                        const SwCharRange aFollowRg( GetFollow()->GetOfst(), 1 );
+                        const SwCharRange aFollowRg(GetFollow()->GetOfst(), TextFrameIndex(1));
                         pPara->GetReformat() += aFollowRg;
                         // We should continue!
                     bRet = false;
@@ -993,9 +993,9 @@ bool SwTextFrame::CalcPreps()
 #define CHG_OFFSET( pFrame, nNew )\
     {\
         if( pFrame->GetOfst() < nNew )\
-            pFrame->MoveFlyInCnt( this, 0, nNew );\
+            pFrame->MoveFlyInCnt( this, TextFrameIndex(0), nNew );\
         else if( pFrame->GetOfst() > nNew )\
-            MoveFlyInCnt( pFrame, nNew, COMPLETE_STRING );\
+            MoveFlyInCnt( pFrame, nNew, TextFrameIndex(COMPLETE_STRING) );\
     }
 
 void SwTextFrame::FormatAdjust( SwTextFormatter &rLine,
@@ -1007,7 +1007,7 @@ void SwTextFrame::FormatAdjust( SwTextFormatter &rLine,
 
     SwParaPortion *pPara = rLine.GetInfo().GetParaPortion();
 
-    sal_Int32 nEnd = rLine.GetStart();
+    TextFrameIndex nEnd = rLine.GetStart();
 
     const bool bHasToFit = pPara->IsPrepMustFit();
 
@@ -1026,7 +1026,7 @@ void SwTextFrame::FormatAdjust( SwTextFormatter &rLine,
     // i#84870
     // no split of text frame, which only contains a as-character anchored object
     bool bOnlyContainsAsCharAnchoredObj =
-            !IsFollow() && nStrLen == 1 &&
+            !IsFollow() && nStrLen == TextFrameIndex(1) &&
             GetDrawObjs() && GetDrawObjs()->size() == 1 &&
             (*GetDrawObjs())[0]->GetFrameFormat().GetAnchor().GetAnchorId() == RndStdIds::FLY_AS_CHAR;
 
@@ -1068,7 +1068,7 @@ void SwTextFrame::FormatAdjust( SwTextFormatter &rLine,
         // If we're done formatting, we set nEnd to the end.
         // AdjustFollow might execute JoinFrame() because of this.
         // Else, nEnd is the end of the last line in the Master.
-        sal_Int32 nOld = nEnd;
+        TextFrameIndex nOld = nEnd;
         nEnd = rLine.GetEnd();
         if( GetFollow() )
         {
@@ -1096,11 +1096,12 @@ void SwTextFrame::FormatAdjust( SwTextFormatter &rLine,
             // the numbering and must stay.
             if ( GetFollow()->GetOfst() != nEnd ||
                  GetFollow()->IsFieldFollow() ||
-                 ( nStrLen == 0 && GetTextNode()->GetNumRule() ) )
+                 (nStrLen == TextFrameIndex(0) && GetTextNode()->GetNumRule()))
             {
                 nNew |= 3;
             }
-            else if (FindTabFrame() && nEnd > 0 && rLine.GetInfo().GetChar(nEnd - 1) == CH_BREAK)
+            else if (FindTabFrame() && nEnd > TextFrameIndex(0) &&
+                rLine.GetInfo().GetChar(nEnd - TextFrameIndex(1)) == CH_BREAK)
             {
                 // We are in a table, the paragraph has a follow and the text
                 // ends with a hard line break. Don't join the follow just
@@ -1118,8 +1119,8 @@ void SwTextFrame::FormatAdjust( SwTextFormatter &rLine,
             // i#84870 - No split, if text frame only contains one
             // as-character anchored object.
             if ( !bOnlyContainsAsCharAnchoredObj &&
-                 ( nStrLen > 0 ||
-                   ( nStrLen == 0 && GetTextNode()->GetNumRule() ) )
+                 (nStrLen > TextFrameIndex(0) ||
+                   (nStrLen == TextFrameIndex(0) && GetTextNode()->GetNumRule()))
                )
             {
                 SplitFrame( nEnd );
@@ -1177,7 +1178,7 @@ bool SwTextFrame::FormatLine( SwTextFormatter &rLine, const bool bPrev )
             "SwTextFrame::FormatLine( rLine, bPrev) with unswapped frame" );
     SwParaPortion *pPara = rLine.GetInfo().GetParaPortion();
     const SwLineLayout *pOldCur = rLine.GetCurr();
-    const sal_Int32 nOldLen    = pOldCur->GetLen();
+    const TextFrameIndex nOldLen = pOldCur->GetLen();
     const sal_uInt16 nOldAscent = pOldCur->GetAscent();
     const sal_uInt16 nOldHeight = pOldCur->Height();
     const SwTwips nOldWidth = pOldCur->Width() + pOldCur->GetHangingMargin();
@@ -1187,7 +1188,7 @@ bool SwTextFrame::FormatLine( SwTextFormatter &rLine, const bool bPrev )
     if( rLine.GetCurr()->IsClipping() )
         rLine.CalcUnclipped( nOldTop, nOldBottom );
 
-    const sal_Int32 nNewStart = rLine.FormatLine( rLine.GetStart() );
+    TextFrameIndex const nNewStart = rLine.FormatLine( rLine.GetStart() );
 
     OSL_ENSURE( getFrameArea().Pos().Y() + getFramePrintArea().Pos().Y() == rLine.GetFirstPos(),
             "SwTextFrame::FormatLine: frame leaves orbit." );
@@ -1296,7 +1297,7 @@ bool SwTextFrame::FormatLine( SwTextFormatter &rLine, const bool bPrev )
         return true;
 
     // Reached the Reformat's end?
-    const sal_Int32 nEnd = pPara->GetReformat().Start() +
+    const TextFrameIndex nEnd = pPara->GetReformat().Start() +
                         pPara->GetReformat().Len();
 
     if( nNewStart <= nEnd )
@@ -1355,7 +1356,7 @@ void SwTextFrame::Format_( SwTextFormatter &rLine, SwTextFormatInfo &rInf,
     // to the result of FindBrk() does not solve the problem in all cases,
     // nevertheless it should be sufficient.
     bool bPrev = rLine.GetPrev() &&
-                     ( FindBrk( rString, rLine.GetStart(), rReformat.Start() + 1 )
+                     (FindBrk(rString, rLine.GetStart(), rReformat.Start() + TextFrameIndex(1))
                        // i#46560
                        + 1
                        >= rReformat.Start() ||
@@ -1369,11 +1370,11 @@ void SwTextFrame::Format_( SwTextFormatter &rLine, SwTextFormatInfo &rInf,
                     rLine.Top(); // So that NumDone doesn't get confused
                 break;
             }
-        sal_Int32 nNew = rLine.GetStart() + rLine.GetLength();
+        TextFrameIndex nNew = rLine.GetStart() + rLine.GetLength();
         if( nNew )
         {
             --nNew;
-            if( CH_BREAK == rString[nNew] )
+            if (CH_BREAK == rString[sal_Int32(nNew)])
             {
                 ++nNew;
                 rLine.Next();
@@ -1622,7 +1623,7 @@ void SwTextFrame::Format_( SwTextFormatter &rLine, SwTextFormatInfo &rInf,
             rLine.Bottom();
             SwTwips nNewBottom = rLine.Y();
             if( nNewBottom < nOldBottom )
-                SetOfst_( 0 );
+                SetOfst_(TextFrameIndex(0));
         }
     }
 }
@@ -1649,7 +1650,7 @@ void SwTextFrame::FormatOnceMore( SwTextFormatter &rLine, SwTextFormatInfo &rInf
         rLine.Top();
         if( !rLine.GetDropFormat() )
             rLine.SetOnceMore( false );
-        SwCharRange aRange( 0, rInf.GetText().getLength() );
+        SwCharRange aRange(TextFrameIndex(0), TextFrameIndex(rInf.GetText().getLength()));
         pPara->GetReformat() = aRange;
         Format_( rLine, rInf );
 
@@ -1679,7 +1680,7 @@ void SwTextFrame::FormatOnceMore( SwTextFormatter &rLine, SwTextFormatInfo &rInf
                 rLine.CtorInitTextFormatter( this, &rInf );
                 rLine.SetDropLines( 1 );
                 rLine.CalcDropHeight( 1 );
-                SwCharRange aTmpRange( 0, rInf.GetText().getLength() );
+                SwCharRange aTmpRange(TextFrameIndex(0), TextFrameIndex(rInf.GetText().getLength()));
                 pPara->GetReformat() = aTmpRange;
                 Format_( rLine, rInf, true );
                 // We paint everything ...
@@ -1874,7 +1875,7 @@ void SwTextFrame::Format( vcl::RenderContext* pRenderContext, const SwBorderAttr
         {
             // bSetOfst here means that we have the "red arrow situation"
             if ( bSetOfst )
-                SetOfst_( 0 );
+                SetOfst_(TextFrameIndex(0));
 
             const bool bOrphan = IsWidow();
             const SwFootnoteBossFrame* pFootnoteBoss = HasFootnote() ? FindFootnoteBossFrame() : nullptr;
@@ -1972,14 +1973,15 @@ bool SwTextFrame::FormatQuick( bool bForceQuickFormat )
     if( aLine.GetDropFormat() )
         return false;
 
-    sal_Int32 nStart = GetOfst();
-    const sal_Int32 nEnd = GetFollow()
-                      ? GetFollow()->GetOfst() : aInf.GetText().getLength();
+    TextFrameIndex nStart = GetOfst();
+    const TextFrameIndex nEnd = GetFollow()
+                  ? GetFollow()->GetOfst()
+                  : TextFrameIndex(aInf.GetText().getLength());
 
     int nLoopProtection = 0;
     do
     {
-        sal_Int32 nNewStart = aLine.FormatLine(nStart);
+        TextFrameIndex nNewStart = aLine.FormatLine(nStart);
         if (nNewStart == nStart)
             ++nLoopProtection;
         else
@@ -2002,7 +2004,7 @@ bool SwTextFrame::FormatQuick( bool bForceQuickFormat )
     if( !bForceQuickFormat && nNewHeight != nOldHeight && !IsUndersized() )
     {
         // Attention: This situation can occur due to FormatLevel==12. Don't panic!
-        const sal_Int32 nStrt = GetOfst();
+        TextFrameIndex const nStrt = GetOfst();
         InvalidateRange_( SwCharRange( nStrt, nEnd - nStrt) );
         return false;
     }
commit 059edb82170cf70231c7235eb238ef03b1fbb76c
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Thu May 3 16:59:19 2018 +0200

    itratr header
    
    Change-Id: Id02fbcf5112358fb12f4069e5bedc3292ad200b1

diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index 73dc9d8aa938..1b98d1688e47 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -112,7 +112,7 @@ SwTextAttr *SwAttrIter::GetAttr( const sal_Int32 nPosition ) const
     return (m_pTextNode) ? m_pTextNode->GetTextAttrForCharAt(nPosition) : nullptr;
 }
 
-bool SwAttrIter::SeekAndChgAttrIter( const sal_Int32 nNewPos, OutputDevice* pOut )
+bool SwAttrIter::SeekAndChgAttrIter(TextFrameIndex const nNewPos, OutputDevice* pOut)
 {
     bool bChg = m_nStartIndex && nNewPos == m_nPosition ? m_pFont->IsFntChg() : Seek( nNewPos );
     if ( m_pLastOut.get() != pOut )
diff --git a/sw/source/core/text/itratr.hxx b/sw/source/core/text/itratr.hxx
index bbab150ef7e9..bed422740618 100644
--- a/sw/source/core/text/itratr.hxx
+++ b/sw/source/core/text/itratr.hxx
@@ -114,7 +114,7 @@ public:
     /** Executes ChgPhysFnt if Seek() returns true
      *  and change font to merge character border with neighbours.
     **/
-    bool SeekAndChgAttrIter( const sal_Int32 nPos, OutputDevice* pOut );
+    bool SeekAndChgAttrIter(TextFrameIndex nPos, OutputDevice* pOut);
     bool SeekStartAndChgAttrIter( OutputDevice* pOut, const bool bParaFont );
 
     // Do we have an attribute change at all?
commit 90a74c781667ee0bea27fe79935e34b681649862
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Thu May 3 15:06:58 2018 +0200

    sw: convert headers to TextFrameIndex
    
    Only convert the interfaces now, convert the implementations later.
    
    Change-Id: I8a84f239d59a5fe21c62615d9ff8e2defa07badc

diff --git a/sw/source/core/inc/frminf.hxx b/sw/source/core/inc/frminf.hxx
index 360cba17a4cd..844e5bb4be87 100644
--- a/sw/source/core/inc/frminf.hxx
+++ b/sw/source/core/inc/frminf.hxx
@@ -21,6 +21,7 @@
 #define INCLUDED_SW_SOURCE_CORE_INC_FRMINF_HXX
 
 #include <swtypes.hxx>
+#include "TextFrameIndex.hxx"
 
 class SwTextFrame;
 class SwPaM;
@@ -46,13 +47,13 @@ public:
     SwTwips GetLineStart() const;
 
     // return center position of the next character
-    SwTwips GetCharPos( sal_Int32 nChar, bool bCenter = true ) const;
+    SwTwips GetCharPos(TextFrameIndex nChar, bool bCenter = true) const;
 
     // collect all whitespaces at the beginning and end of a line in Pam
     void GetSpaces( SwPaM &rPam, bool bWithLineBreak ) const;
 
     // Is a bullet point/symbol/etc. at the first text position?
-    bool IsBullet( sal_Int32 nTextPos ) const;
+    bool IsBullet(TextFrameIndex nTextPos) const;
 
     // determine indentation for first line
     SwTwips GetFirstIndent() const;
@@ -62,7 +63,7 @@ public:
         { pFrame = pNew; return *this; }
 
     // Is it a comparison? Returns position in frame.
-    sal_Int32 GetBigIndent( sal_Int32& rFndPos,
+    sal_Int32 GetBigIndent( TextFrameIndex & rFndPos,
                         const SwTextFrame *pNextFrame ) const;
 };
 
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index f56f748572db..cf0ebe4d05da 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -54,7 +54,7 @@ class SW_DLLPUBLIC SwTextFrame: public SwContentFrame
     friend class SwTestFormat;
     friend class WidowsAndOrphans;
     friend class TextFrameLockGuard; // May Lock()/Unlock()
-    friend bool sw_ChangeOffset( SwTextFrame* pFrame, sal_Int32 nNew );
+    friend bool sw_ChangeOffset(SwTextFrame* pFrame, TextFrameIndex nNew);
 
     /// SwLineLayout cache: the lines are not actually owned by the SwTextFrame
     /// but by this SwCache, so they will be deleted in large documents
@@ -85,13 +85,13 @@ class SW_DLLPUBLIC SwTextFrame: public SwContentFrame
     // It is NOT used for the determination of printing area.
     SwTwips mnAdditionalFirstLineOffset;
 
-    sal_Int32 mnOffset; // Is the offset in the Content (character count)
+    TextFrameIndex mnOffset; // Is the offset in the Content (character count)
 
     sal_uInt16 mnCacheIndex; // Index into the cache, USHRT_MAX if there's definitely no fitting object in the cache
 
     // Separates the Master and creates a Follow or adjusts the data in the Follow
-    void AdjustFollow_( SwTextFormatter &rLine, const sal_Int32 nOffset,
-                               const sal_Int32 nStrEnd, const sal_uInt8 nMode );
+    void AdjustFollow_( SwTextFormatter &rLine, TextFrameIndex nOffset,
+                               TextFrameIndex nStrEnd, const sal_uInt8 nMode );
 
     // Iterates all Lines and sets the line spacing using the attribute
     void CalcLineSpace();
@@ -107,7 +107,7 @@ class SW_DLLPUBLIC SwTextFrame: public SwContentFrame
 
     // WidowsAndOrphans, AdjustFrame, AdjustFollow
     void FormatAdjust( SwTextFormatter &rLine, WidowsAndOrphans &rFrameBreak,
-                       const sal_Int32 nStrLen, const bool bDummy );
+                       TextFrameIndex nStrLen, const bool bDummy );
 
     bool mbLocked        : 1;        // In the Format?
     bool mbWidow         : 1;        // Are we a Widow?
@@ -135,7 +135,7 @@ class SW_DLLPUBLIC SwTextFrame: public SwContentFrame
     void SetEmpty( const bool bNew ) { mbEmpty = bNew; }
     void SetFieldFollow( const bool bNew ) { mbFieldFollow = bNew; }
 
-    bool IsIdxInside( const sal_Int32 nPos, const sal_Int32 nLen ) const;
+    bool IsIdxInside(TextFrameIndex nPos, TextFrameIndex nLen) const;
 
     // Changes the Frame or not (cf. FlyCnt)
     bool GetCursorOfst_(SwPosition *pPos, const Point &rPoint,
@@ -153,13 +153,13 @@ class SW_DLLPUBLIC SwTextFrame: public SwContentFrame
     void FormatOnceMore( SwTextFormatter &rLine, SwTextFormatInfo &rInf );
 
     // Formats the Follow and ensures disposing on orphans
-    bool CalcFollow(  const sal_Int32 nTextOfst );
+    bool CalcFollow(TextFrameIndex nTextOfst);
 
     virtual void MakePos() override;
 
     // Corrects the position from which we need to format
-    static sal_Int32 FindBrk(const OUString &rText, const sal_Int32 nStart,
-                                       const sal_Int32 nEnd);
+    static TextFrameIndex FindBrk(const OUString &rText, TextFrameIndex nStart,
+                                  TextFrameIndex nEnd);
 
     // inline branch
     SwTwips GetFootnoteFrameHeight_() const;
@@ -312,19 +312,19 @@ public:
      * Prepares the cursor position for a visual cursor move (BiDi).
      * The behaviour is different for insert and overwrite cursors
      */
-    void PrepareVisualMove( sal_Int32& nPos, sal_uInt8& nCursorLevel,
+    void PrepareVisualMove( TextFrameIndex& nPos, sal_uInt8& nCursorLevel,
                             bool& bRight, bool bInsertCursor );
 
     /// Methods to manage the FollowFrame
-    void            SplitFrame( const sal_Int32 nTextPos );
+    void            SplitFrame(TextFrameIndex nTextPos);
     SwContentFrame *JoinFrame();
-    sal_Int32  GetOfst() const { return mnOffset; }
-           void        SetOfst_( const sal_Int32 nNewOfst );
-    inline void        SetOfst ( const sal_Int32 nNewOfst );
-    void        ManipOfst ( const sal_Int32 nNewOfst ){ mnOffset = nNewOfst; }
+    TextFrameIndex GetOfst() const { return mnOffset; }
+           void        SetOfst_(TextFrameIndex nNewOfst);
+    inline void        SetOfst (TextFrameIndex nNewOfst);
+    void ManipOfst(TextFrameIndex const nNewOfst) { mnOffset = nNewOfst; }
            SwTextFrame   *GetFrameAtPos ( const SwPosition &rPos);
     inline const SwTextFrame *GetFrameAtPos ( const SwPosition &rPos) const;
-    SwTextFrame&   GetFrameAtOfst( const sal_Int32 nOfst );
+    SwTextFrame&   GetFrameAtOfst(TextFrameIndex nOfst);
     /// If there's a Follow and we don't contain text ourselves
     bool IsEmptyMaster() const
         { return GetFollow() && !GetFollow()->GetOfst(); }
@@ -422,7 +422,7 @@ public:
 
     /// Does the Frame have a local footnote (in this Frame or Follow)?
 #ifdef DBG_UTIL
-    void CalcFootnoteFlag( sal_Int32 nStop = COMPLETE_STRING ); //For testing SplitFrame
+    void CalcFootnoteFlag(TextFrameIndex nStop = TextFrameIndex(COMPLETE_STRING)); //For testing SplitFrame
 #else
     void CalcFootnoteFlag();
 #endif
@@ -430,7 +430,7 @@ public:
     /// Hidden
     bool IsHiddenNow() const;       // bHidden && pOut == pPrt
     void HideHidden();              // Remove appendage if Hidden
-    void HideFootnotes( sal_Int32 nStart, sal_Int32 nEnd );
+    void HideFootnotes(TextFrameIndex nStart, TextFrameIndex nEnd);
 
     /**
      * Hides respectively shows objects, which are anchored at paragraph,
@@ -440,8 +440,8 @@ public:
     void HideAndShowObjects();
 
     /// Footnote
-    void RemoveFootnote( const sal_Int32 nStart,
-                    const sal_Int32 nLen = COMPLETE_STRING );
+    void RemoveFootnote(TextFrameIndex nStart,
+                        TextFrameIndex nLen = TextFrameIndex(COMPLETE_STRING));
     inline SwTwips GetFootnoteFrameHeight() const;
     SwTextFrame *FindFootnoteRef( const SwTextFootnote *pFootnote );
     const SwTextFrame *FindFootnoteRef( const SwTextFootnote *pFootnote ) const
@@ -480,7 +480,7 @@ public:
     void SetFootnote( const bool bNew ) { mbFootnote = bNew; }
 
     /// Respect the Follows
-    inline bool IsInside( const sal_Int32 nPos ) const;
+    inline bool IsInside(TextFrameIndex nPos) const;
 
     const SwBodyFrame   *FindBodyFrame()   const;
 
@@ -533,16 +533,16 @@ public:
     sal_uInt16 FirstLineHeight() const;
 
     /// Rewires FlyInContentFrame, if nEnd > Index >= nStart
-    void MoveFlyInCnt( SwTextFrame *pNew, sal_Int32 nStart, sal_Int32 nEnd );
+    void MoveFlyInCnt(SwTextFrame *pNew, TextFrameIndex nStart, TextFrameIndex nEnd);
 
     /// Calculates the position of FlyInContentFrames
-    sal_Int32 CalcFlyPos( SwFrameFormat const * pSearch );
+    TextFrameIndex CalcFlyPos( SwFrameFormat const * pSearch );
 
     /// Determines the start position and step size of the register
     bool FillRegister( SwTwips& rRegStart, sal_uInt16& rRegDiff );
 
     /// Determines the line count
-    sal_uInt16 GetLineCount( sal_Int32 nPos );
+    sal_uInt16 GetLineCount(TextFrameIndex nPos);
 
     /// For displaying the line numbers
     sal_uLong GetAllLines()  const { return mnAllLines; }
@@ -701,7 +701,7 @@ inline SwTwips SwTextFrame::GrowTst( const SwTwips nGrow )
     return Grow( nGrow, true );
 }
 
-inline bool SwTextFrame::IsInside( const sal_Int32 nPos ) const
+inline bool SwTextFrame::IsInside(TextFrameIndex const nPos) const
 {
     bool bRet = true;
     if( nPos < GetOfst() )
@@ -737,7 +737,7 @@ inline const SwTextFrame *SwTextFrame::GetFrameAtPos( const SwPosition &rPos) co
     return const_cast<SwTextFrame*>(this)->GetFrameAtPos( rPos );
 }
 
-inline void SwTextFrame::SetOfst( const sal_Int32 nNewOfst )
+inline void SwTextFrame::SetOfst(TextFrameIndex const nNewOfst)
 {
     if ( mnOffset != nNewOfst )
         SetOfst_( nNewOfst );
diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx
index 2d2dd975ed65..b8b1f3487317 100644
--- a/sw/source/core/text/frmcrsr.cxx
+++ b/sw/source/core/text/frmcrsr.cxx
@@ -103,7 +103,7 @@ SwTextFrame *GetAdjFrameAtPos( SwTextFrame *pFrame, const SwPosition &rPos,
 
 }
 
-bool sw_ChangeOffset( SwTextFrame* pFrame, sal_Int32 nNew )
+bool sw_ChangeOffset(SwTextFrame* pFrame, TextFrameIndex nNew)
 {
     // Do not scroll in areas and outside of flies
     OSL_ENSURE( !pFrame->IsFollow(), "Illegal Scrolling by Follow!" );
@@ -138,7 +138,7 @@ bool sw_ChangeOffset( SwTextFrame* pFrame, sal_Int32 nNew )
     return false;
 }
 
-SwTextFrame& SwTextFrame::GetFrameAtOfst( const sal_Int32 nWhere )
+SwTextFrame& SwTextFrame::GetFrameAtOfst(TextFrameIndex const nWhere)
 {
     SwTextFrame* pRet = this;
     while( pRet->HasFollow() && nWhere >= pRet->GetFollow()->GetOfst() )
@@ -1038,7 +1038,7 @@ static void lcl_VisualMoveRecursion( const SwLineLayout& rCurrLine, sal_Int32 nI
     }
 }
 
-void SwTextFrame::PrepareVisualMove( sal_Int32& nPos, sal_uInt8& nCursorLevel,
+void SwTextFrame::PrepareVisualMove(TextFrameIndex & nPos, sal_uInt8& nCursorLevel,
                                   bool& bForward, bool bInsertCursor )
 {
     if( IsEmpty() || IsHiddenNow() )
diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index b6203899aee0..8f75cdb41a61 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -183,7 +183,7 @@ const SwBodyFrame *SwTextFrame::FindBodyFrame() const
     return nullptr;
 }
 
-bool SwTextFrame::CalcFollow( const sal_Int32 nTextOfst )
+bool SwTextFrame::CalcFollow(TextFrameIndex const nTextOfst)
 {
     vcl::RenderContext* pRenderContext = getRootFrame()->GetCurrShell()->GetOut();
     SwSwapIfSwapped swap( this );
@@ -565,7 +565,7 @@ css::uno::Sequence< css::style::TabStop > SwTextFrame::GetTabStopInfo( SwTwips C
 // and the Follow starts.
 // If it's 0, the FollowFrame is deleted.
 void SwTextFrame::AdjustFollow_( SwTextFormatter &rLine,
-                             const sal_Int32 nOffset, const sal_Int32 nEnd,
+                 const TextFrameIndex nOffset, const TextFrameIndex nEnd,
                              const sal_uInt8 nMode )
 {
     SwFrameSwapper aSwapper( this, false );
@@ -689,7 +689,7 @@ SwContentFrame *SwTextFrame::JoinFrame()
     return pNxt;
 }
 
-void SwTextFrame::SplitFrame( const sal_Int32 nTextPos )
+void SwTextFrame::SplitFrame(TextFrameIndex const nTextPos)
 {
     SwSwapIfSwapped swap( this );
 
@@ -765,7 +765,7 @@ void SwTextFrame::SplitFrame( const sal_Int32 nTextPos )
     pNew->ManipOfst( nTextPos );
 }
 
-void SwTextFrame::SetOfst_( const sal_Int32 nNewOfst )
+void SwTextFrame::SetOfst_(TextFrameIndex const nNewOfst)
 {
     // We do not need to invalidate out Follow.
     // We are a Follow, get formatted right away and call
@@ -1000,7 +1000,7 @@ bool SwTextFrame::CalcPreps()
 
 void SwTextFrame::FormatAdjust( SwTextFormatter &rLine,
                              WidowsAndOrphans &rFrameBreak,
-                             const sal_Int32 nStrLen,
+                             TextFrameIndex const nStrLen,
                              const bool bDummy )
 {
     SwSwapIfNotSwapped swap( this );
diff --git a/sw/source/core/text/frminf.cxx b/sw/source/core/text/frminf.cxx
index 6625a0dd594d..d72e137e5120 100644
--- a/sw/source/core/text/frminf.cxx
+++ b/sw/source/core/text/frminf.cxx
@@ -21,7 +21,7 @@
 #include <frminf.hxx>
 #include "itrtxt.hxx"
 
-sal_Int32 SwTextMargin::GetTextStart() const
+TextFrameIndex SwTextMargin::GetTextStart() const
 {
     const OUString &rText = GetInfo().GetText();
     const sal_Int32 nEnd = m_nStart + m_pCurr->GetLen();
@@ -35,7 +35,7 @@ sal_Int32 SwTextMargin::GetTextStart() const
     return nEnd;
 }
 
-sal_Int32 SwTextMargin::GetTextEnd() const
+TextFrameIndex SwTextMargin::GetTextEnd() const
 {
     const OUString &rText = GetInfo().GetText();
     const sal_Int32 nEnd = m_nStart + m_pCurr->GetLen();
@@ -105,7 +105,7 @@ SwTwips SwTextFrameInfo::GetLineStart() const
 }
 
 // Calculates the character's position and returns the middle position
-SwTwips SwTextFrameInfo::GetCharPos( sal_Int32 nChar, bool bCenter ) const
+SwTwips SwTextFrameInfo::GetCharPos(TextFrameIndex const nChar, bool bCenter) const
 {
     SwRectFnSet aRectFnSet(pFrame);
     SwFrameSwapper aSwapper( pFrame, true );
@@ -251,7 +251,7 @@ SwTwips SwTextFrameInfo::GetFirstIndent() const
     return 1;
 }
 
-sal_Int32 SwTextFrameInfo::GetBigIndent( sal_Int32& rFndPos,
+sal_Int32 SwTextFrameInfo::GetBigIndent(TextFrameIndex& rFndPos,
                                     const SwTextFrame *pNextFrame ) const
 {
     SwTextSizeInfo aInf( const_cast<SwTextFrame*>(pFrame) );
diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx
index 5ddf80485522..ae3dd4d28d0b 100644
--- a/sw/source/core/text/guess.cxx
+++ b/sw/source/core/text/guess.cxx
@@ -547,7 +547,7 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
 // returns true if word at position nPos has a different spelling
 // if hyphenated at this position (old german spelling)
 bool SwTextGuess::AlternativeSpelling( const SwTextFormatInfo &rInf,
-    const sal_Int32 nPos )
+    TextFrameIndex const nPos)
 {
     // get word boundaries
     Boundary aBound =
diff --git a/sw/source/core/text/guess.hxx b/sw/source/core/text/guess.hxx
index b5d76688a5ce..ee558d460dcc 100644
--- a/sw/source/core/text/guess.hxx
+++ b/sw/source/core/text/guess.hxx
@@ -31,10 +31,10 @@ class SwTextGuess
 {
     css::uno::Reference< css::linguistic2::XHyphenatedWord >  xHyphWord;
     std::unique_ptr<SwHangingPortion> pHanging; // for hanging punctuation
-    sal_Int32 nCutPos;         // this character doesn't fit
-    sal_Int32 nBreakStart;     // start index of word containing line break
-    sal_Int32 nBreakPos;       // start index of break position
-    sal_Int32 nFieldDiff;      // absolute positions can be wrong if we
+    TextFrameIndex nCutPos;         // this character doesn't fit
+    TextFrameIndex nBreakStart;     // start index of word containing line break
+    TextFrameIndex nBreakPos;       // start index of break position
+    TextFrameIndex nFieldDiff;      // absolute positions can be wrong if we
                                // a field in the text has been expanded
     sal_uInt16 nBreakWidth;    // width of the broken portion
 public:
@@ -45,15 +45,15 @@ public:
     // true, if current portion still fits to current line
     bool Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
                     const sal_uInt16 nHeight );
-    bool AlternativeSpelling( const SwTextFormatInfo &rInf, const sal_Int32 nPos );
+    bool AlternativeSpelling( const SwTextFormatInfo &rInf, const TextFrameIndex nPos );
 
     SwHangingPortion* GetHangingPortion() const { return pHanging.get(); }
     SwHangingPortion* ReleaseHangingPortion() { return pHanging.release(); }
     sal_uInt16 BreakWidth() const { return nBreakWidth; }
-    sal_Int32 CutPos() const { return nCutPos; }
-    sal_Int32 BreakStart() const { return nBreakStart; }
-    sal_Int32 BreakPos() const {return nBreakPos; }
-    sal_Int32 FieldDiff() const {return nFieldDiff; }
+    TextFrameIndex CutPos() const { return nCutPos; }
+    TextFrameIndex BreakStart() const { return nBreakStart; }
+    TextFrameIndex BreakPos() const {return nBreakPos; }
+    TextFrameIndex FieldDiff() const {return nFieldDiff; }
     const css::uno::Reference< css::linguistic2::XHyphenatedWord >& HyphWord() const
         { return xHyphWord; }
 };
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 65e25af2ee58..d115c860002a 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -383,8 +383,8 @@ void SwTextSizeInfo::NoteAnimation() const
 SwPosSize SwTextSizeInfo::GetTextSize( OutputDevice* pOutDev,
                                      const SwScriptInfo* pSI,
                                      const OUString& rText,
-                                     const sal_Int32 nIndex,
-                                     const sal_Int32 nLength) const
+                                     const TextFrameIndex nIndex,
+                                     const TextFrameIndex nLength) const
 {
     SwDrawTextInfo aDrawInf( m_pVsh, *pOutDev, pSI, rText, nIndex, nLength );
     aDrawInf.SetFrame( m_pFrame );
@@ -415,8 +415,8 @@ SwPosSize SwTextSizeInfo::GetTextSize() const
     return SwPosSize(m_pFnt->GetTextSize_( aDrawInf ));
 }
 
-void SwTextSizeInfo::GetTextSize( const SwScriptInfo* pSI, const sal_Int32 nIndex,

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list