[Libreoffice-commits] core.git: include/vcl vcl/source

Stephan Bergmann sbergman at redhat.com
Tue Mar 14 17:23:42 UTC 2017


 include/vcl/texteng.hxx      |    8 ++++--
 vcl/source/edit/textdat2.hxx |   24 ++++++++++--------
 vcl/source/edit/textdata.cxx |   18 ++++++++------
 vcl/source/edit/texteng.cxx  |   55 +++++++++++++++++++++----------------------
 vcl/source/edit/textview.cxx |    4 ++-
 5 files changed, 62 insertions(+), 47 deletions(-)

New commits:
commit b481928a2104bb659021bd0795c73fcf64129c99
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Mar 14 18:22:21 2017 +0100

    Clean up uses of integer types in vcl/texteng
    
    Change-Id: Ic70f57784e69cd82910d834c43a65bce4c00caea

diff --git a/include/vcl/texteng.hxx b/include/vcl/texteng.hxx
index 469594e..58c4b58 100644
--- a/include/vcl/texteng.hxx
+++ b/include/vcl/texteng.hxx
@@ -19,6 +19,10 @@
 #ifndef INCLUDED_VCL_TEXTENG_HXX
 #define INCLUDED_VCL_TEXTENG_HXX
 
+#include <sal/config.h>
+
+#include <cstddef>
+
 #include <vcl/dllapi.h>
 #include <vcl/vclptr.hxx>
 #include <rtl/ustring.hxx>
@@ -174,7 +178,7 @@ protected:
     bool                CreateLines( sal_uInt32 nPara );
     void                CreateAndInsertEmptyLine( sal_uInt32 nPara );
     void                ImpBreakLine( sal_uInt32 nPara, TextLine* pLine, TETextPortion* pPortion, sal_Int32 nPortionStart, long nRemainingWidth );
-    sal_uInt16          SplitTextPortion( sal_uInt32 nPara, sal_Int32 nPos );
+    std::size_t         SplitTextPortion( sal_uInt32 nPara, sal_Int32 nPos );
     void                CreateTextPortions( sal_uInt32 nPara, sal_Int32 nStartPos );
     void                RecalcTextPortion( sal_uInt32 nPara, sal_Int32 nStartPos, sal_Int32 nNewChars );
     void                SeekCursor( sal_uInt32 nNode, sal_Int32 nPos, vcl::Font& rFont, OutputDevice* pOutDev );
@@ -192,7 +196,7 @@ protected:
     sal_Int32           GetCharPos( sal_uInt32 nPara, std::vector<TextLine>::size_type nLine, long nDocPosX, bool bSmart = false );
     Rectangle           GetEditCursor( const TextPaM& rPaM, bool bSpecial, bool bPreferPortionStart = false );
     sal_Int32           ImpFindIndex( sal_uInt32 nPortion, const Point& rPosInPara, bool bSmart );
-    long                ImpGetPortionXOffset( sal_uInt32 nPara, TextLine* pLine, sal_uInt16 nTextPortion );
+    long                ImpGetPortionXOffset( sal_uInt32 nPara, TextLine* pLine, std::size_t nTextPortion );
     long                ImpGetXPos( sal_uInt32 nPara, TextLine* pLine, sal_Int32 nIndex, bool bPreferPortionStart = false );
     long                ImpGetOutputOffset( sal_uInt32 nPara, TextLine* pLine, sal_Int32 nIndex, sal_Int32 nIndex2 );
     sal_uInt8           ImpGetRightToLeft( sal_uInt32 nPara, sal_Int32 nPos );
diff --git a/vcl/source/edit/textdat2.hxx b/vcl/source/edit/textdat2.hxx
index 90b5f85..96e0cec 100644
--- a/vcl/source/edit/textdat2.hxx
+++ b/vcl/source/edit/textdat2.hxx
@@ -25,6 +25,8 @@
 #include <vcl/cursor.hxx>
 #include <vcl/idle.hxx>
 
+#include <cstddef>
+#include <limits>
 #include <vector>
 
 class TextNode;
@@ -73,24 +75,26 @@ private:
     std::vector<TETextPortion*> maPortions;
 
 public:
+    static constexpr auto npos = std::numeric_limits<std::size_t>::max();
+
     TETextPortionList();
     ~TETextPortionList();
 
-    TETextPortion* operator[]( size_t nPos );
+    TETextPortion* operator[]( std::size_t nPos );
     std::vector<TETextPortion*>::iterator begin();
     std::vector<TETextPortion*>::const_iterator begin() const;
     std::vector<TETextPortion*>::iterator end();
     std::vector<TETextPortion*>::const_iterator end() const;
     bool empty() const;
-    size_t size() const;
+    std::size_t size() const;
     std::vector<TETextPortion*>::iterator erase( std::vector<TETextPortion*>::iterator aIter );
     std::vector<TETextPortion*>::iterator insert( std::vector<TETextPortion*>::iterator aIter,
                                                   TETextPortion* pTP );
     void push_back( TETextPortion* pTP );
 
     void    Reset();
-    sal_uInt16  FindPortion( sal_Int32 nCharPos, sal_Int32& rPortionStart, bool bPreferStartingPortion = false );
-    void    DeleteFromPortion( size_t nDelFrom );
+    std::size_t FindPortion( sal_Int32 nCharPos, sal_Int32& rPortionStart, bool bPreferStartingPortion = false );
+    void    DeleteFromPortion( std::size_t nDelFrom );
 };
 
 struct TEWritingDirectionInfo
@@ -110,8 +114,8 @@ class TextLine
 private:
     sal_Int32           mnStart;
     sal_Int32           mnEnd;
-    sal_uInt16          mnStartPortion;
-    sal_uInt16          mnEndPortion;
+    std::size_t         mnStartPortion;
+    std::size_t         mnEndPortion;
 
     short               mnStartX;
 
@@ -136,11 +140,11 @@ public:
     void            SetEnd( sal_Int32 n )           { mnEnd = n; }
     sal_Int32       GetEnd() const                  { return mnEnd; }
 
-    void            SetStartPortion( sal_uInt16 n )     { mnStartPortion = n; }
-    sal_uInt16      GetStartPortion() const         { return mnStartPortion; }
+    void            SetStartPortion( std::size_t n ) { mnStartPortion = n; }
+    std::size_t     GetStartPortion() const         { return mnStartPortion; }
 
-    void            SetEndPortion( sal_uInt16 n )       { mnEndPortion = n; }
-    sal_uInt16      GetEndPortion() const           { return mnEndPortion; }
+    void            SetEndPortion( std::size_t n )  { mnEndPortion = n; }
+    std::size_t     GetEndPortion() const           { return mnEndPortion; }
 
     sal_Int32       GetLen() const                  { return mnEnd - mnStart; }
 
diff --git a/vcl/source/edit/textdata.cxx b/vcl/source/edit/textdata.cxx
index 010b585..4705386 100644
--- a/vcl/source/edit/textdata.cxx
+++ b/vcl/source/edit/textdata.cxx
@@ -17,6 +17,10 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
+
+#include <cstddef>
+
 #include <vcl/textdata.hxx>
 #include <textdat2.hxx>
 
@@ -55,7 +59,7 @@ TETextPortionList::~TETextPortionList()
     Reset();
 }
 
-TETextPortion* TETextPortionList::operator[]( size_t nPos )
+TETextPortion* TETextPortionList::operator[]( std::size_t nPos )
 {
     return maPortions[ nPos ];
 }
@@ -85,7 +89,7 @@ bool TETextPortionList::empty() const
     return maPortions.empty();
 }
 
-size_t TETextPortionList::size() const
+std::size_t TETextPortionList::size() const
 {
     return maPortions.size();
 }
@@ -113,7 +117,7 @@ void TETextPortionList::Reset()
     maPortions.clear();
 }
 
-void TETextPortionList::DeleteFromPortion( size_t nDelFrom )
+void TETextPortionList::DeleteFromPortion( std::size_t nDelFrom )
 {
     SAL_WARN_IF( ( nDelFrom >= maPortions.size() ) && ( (nDelFrom != 0) || (maPortions.size() != 0) ), "vcl", "DeleteFromPortion: Out of range" );
     for ( auto it = maPortions.begin() + nDelFrom; it != maPortions.end(); ++it )
@@ -121,11 +125,11 @@ void TETextPortionList::DeleteFromPortion( size_t nDelFrom )
     maPortions.erase( maPortions.begin() + nDelFrom, maPortions.end() );
 }
 
-sal_uInt16 TETextPortionList::FindPortion( sal_Int32 nCharPos, sal_Int32& nPortionStart, bool bPreferStartingPortion )
+std::size_t TETextPortionList::FindPortion( sal_Int32 nCharPos, sal_Int32& nPortionStart, bool bPreferStartingPortion )
 {
     // find left portion at nCharPos at portion border
     sal_Int32 nTmpPos = 0;
-    for ( size_t nPortion = 0; nPortion < maPortions.size(); nPortion++ )
+    for ( std::size_t nPortion = 0; nPortion < maPortions.size(); nPortion++ )
     {
         TETextPortion* pPortion = maPortions[ nPortion ];
         nTmpPos += pPortion->GetLen();
@@ -237,14 +241,14 @@ void TEParaPortion::CorrectValuesBehindLastFormattedLine( sal_uInt16 nLastFormat
     {
         const TextLine& rLastFormatted = maLines[ nLastFormattedLine ];
         const TextLine& rUnformatted = maLines[ nLastFormattedLine+1 ];
-        short nPortionDiff = rUnformatted.GetStartPortion() - rLastFormatted.GetEndPortion();
+        std::ptrdiff_t nPortionDiff = rUnformatted.GetStartPortion() - rLastFormatted.GetEndPortion();
         sal_Int32 nTextDiff = rUnformatted.GetStart() - rLastFormatted.GetEnd();
         nTextDiff++;    // LastFormatted.GetEnd() was inclusive => subtracted one too much!
 
         // The first unformatted one has to start exactly one portion past the last
         // formatted one.
         // If a portion got split in the changed row, nLastEnd could be > nNextStart!
-        short nPDiff = sal::static_int_cast< short >(-( nPortionDiff-1 ));
+        std::ptrdiff_t nPDiff = -( nPortionDiff-1 );
         const sal_Int32 nTDiff = -( nTextDiff-1 );
         if ( nPDiff || nTDiff )
         {
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index cd17c10..11c8704 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -54,6 +54,7 @@
 #include <unicode/ubidi.h>
 
 #include <algorithm>
+#include <cstddef>
 #include <cstdlib>
 #include <memory>
 #include <set>
@@ -931,7 +932,7 @@ long TextEngine::ImpGetXPos( sal_uInt32 nPara, TextLine* pLine, sal_Int32 nIndex
     TEParaPortion* pParaPortion = mpTEParaPortions->GetObject( nPara );
 
     sal_Int32 nTextPortionStart = 0;
-    size_t nTextPortion = pParaPortion->GetTextPortions().FindPortion( nIndex, nTextPortionStart, bDoPreferPortionStart );
+    std::size_t nTextPortion = pParaPortion->GetTextPortions().FindPortion( nIndex, nTextPortionStart, bDoPreferPortionStart );
 
     SAL_WARN_IF( ( nTextPortion < pLine->GetStartPortion() ) || ( nTextPortion > pLine->GetEndPortion() ), "vcl", "GetXPos: Portion not in current line!" );
 
@@ -1102,7 +1103,7 @@ sal_Int32 TextEngine::GetCharPos( sal_uInt32 nPortion, std::vector<TextLine>::si
     if ( nXPos <= nTmpX )
         return nCurIndex;
 
-    for ( sal_uInt16 i = rLine.GetStartPortion(); i <= rLine.GetEndPortion(); i++ )
+    for ( std::size_t i = rLine.GetStartPortion(); i <= rLine.GetEndPortion(); i++ )
     {
         TETextPortion* pTextPortion = pPortion->GetTextPortions()[ i ];
         nTmpX += pTextPortion->GetWidth();
@@ -1157,7 +1158,7 @@ long TextEngine::CalcTextWidth( sal_uInt32 nPara )
     {
         long nLineWidth = 0;
         TextLine& rLine = pPortion->GetLines()[ --nLine ];
-        for ( sal_uInt16 nTP = rLine.GetStartPortion(); nTP <= rLine.GetEndPortion(); nTP++ )
+        for ( std::size_t nTP = rLine.GetStartPortion(); nTP <= rLine.GetEndPortion(); nTP++ )
         {
             TETextPortion* pTextPortion = pPortion->GetTextPortions()[ nTP ];
             nLineWidth += pTextPortion->GetWidth();
@@ -1217,7 +1218,7 @@ void TextEngine::GetTextPortionRange(const TextPaM& rPaM, sal_Int32& nStart, sal
     nStart = 0;
     nEnd = 0;
     TEParaPortion* pParaPortion = mpTEParaPortions->GetObject( rPaM.GetPara() );
-    for ( size_t i = 0; i < pParaPortion->GetTextPortions().size(); ++i )
+    for ( std::size_t i = 0; i < pParaPortion->GetTextPortions().size(); ++i )
     {
         TETextPortion* pTextPortion = pParaPortion->GetTextPortions()[ i ];
         if (nStart + pTextPortion->GetLen() > rPaM.GetIndex())
@@ -1633,7 +1634,7 @@ void TextEngine::CreateAndInsertEmptyLine( sal_uInt32 nPara )
     if ( bLineBreak )
     {
         // -2: The new one is already inserted.
-        const sal_uInt16 nPos = (sal_uInt16) pTEParaPortion->GetTextPortions().size() - 1;
+        const std::size_t nPos = pTEParaPortion->GetTextPortions().size() - 1;
         aTmpLine.SetStartPortion( nPos );
         aTmpLine.SetEndPortion( nPos );
     }
@@ -1674,7 +1675,7 @@ void TextEngine::ImpBreakLine( sal_uInt32 nPara, TextLine* pLine, TETextPortion*
 
     // the damaged Portion is the End Portion
     pLine->SetEnd( nBreakPos );
-    const sal_uInt16 nEndPortion = SplitTextPortion( nPara, nBreakPos );
+    const std::size_t nEndPortion = SplitTextPortion( nPara, nBreakPos );
 
     if ( nBreakPos >= pLine->GetStart() &&
          nBreakPos < pNode->GetText().getLength() &&
@@ -1689,18 +1690,18 @@ void TextEngine::ImpBreakLine( sal_uInt32 nPara, TextLine* pLine, TETextPortion*
     pLine->SetEndPortion( nEndPortion );
 }
 
-sal_uInt16 TextEngine::SplitTextPortion( sal_uInt32 nPara, sal_Int32 nPos )
+std::size_t TextEngine::SplitTextPortion( sal_uInt32 nPara, sal_Int32 nPos )
 {
 
     // the Portion at nPos is being split, unless there is already a switch at nPos
     if ( nPos == 0 )
         return 0;
 
-    sal_uInt16 nSplitPortion;
+    std::size_t nSplitPortion;
     sal_Int32 nTmpPos = 0;
     TETextPortion* pTextPortion = nullptr;
     TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara );
-    const sal_uInt16 nPortions = pTEParaPortion->GetTextPortions().size();
+    const std::size_t nPortions = pTEParaPortion->GetTextPortions().size();
     for ( nSplitPortion = 0; nSplitPortion < nPortions; nSplitPortion++ )
     {
         TETextPortion* pTP = pTEParaPortion->GetTextPortions()[nSplitPortion];
@@ -1774,8 +1775,8 @@ void TextEngine::CreateTextPortions( sal_uInt32 nPara, sal_Int32 nStartPos )
     // Unfortunately, the number of TextPortions does not have to be
     // equal to aPositions.Count(), because of linebreaks
     sal_Int32 nPortionStart = 0;
-    size_t nInvPortion = 0;
-    size_t nP;
+    std::size_t nInvPortion = 0;
+    std::size_t nP;
     for ( nP = 0; nP < pTEParaPortion->GetTextPortions().size(); nP++ )
     {
         TETextPortion* pTmpPortion = pTEParaPortion->GetTextPortions()[nP];
@@ -1835,7 +1836,7 @@ void TextEngine::RecalcTextPortion( sal_uInt32 nPara, sal_Int32 nStartPos, sal_I
              ( nStartPos && ( pNode->GetText()[ nStartPos - 1 ] == '\t' ) ) ||
              ( ( !nStartPos && ( nNewChars < pNode->GetText().getLength() ) && pNode->GetText()[ nNewChars ] == '\t' ) ) )
         {
-            sal_uInt16 nNewPortionPos = 0;
+            std::size_t nNewPortionPos = 0;
             if ( nStartPos )
                 nNewPortionPos = SplitTextPortion( nPara, nStartPos ) + 1;
 
@@ -1856,7 +1857,7 @@ void TextEngine::RecalcTextPortion( sal_uInt32 nPara, sal_Int32 nStartPos, sal_I
         else
         {
             sal_Int32 nPortionStart {0};
-            const sal_uInt16 nTP = pTEParaPortion->GetTextPortions().FindPortion( nStartPos, nPortionStart );
+            const std::size_t nTP = pTEParaPortion->GetTextPortions().FindPortion( nStartPos, nPortionStart );
             TETextPortion* const pTP = pTEParaPortion->GetTextPortions()[ nTP ];
             SAL_WARN_IF( !pTP, "vcl", "RecalcTextPortion: Portion not found!"  );
             pTP->GetLen() += nNewChars;
@@ -1870,10 +1871,10 @@ void TextEngine::RecalcTextPortion( sal_uInt32 nPara, sal_Int32 nStartPos, sal_I
 
         // There must be no Portion reaching into or starting within,
         // thus: nStartPos <= nPos <= nStartPos - nNewChars(neg.)
-        size_t nPortion = 0;
+        std::size_t nPortion = 0;
         sal_Int32 nPos = 0;
         const sal_Int32 nEnd = nStartPos-nNewChars;
-        const size_t nPortions = pTEParaPortion->GetTextPortions().size();
+        const std::size_t nPortions = pTEParaPortion->GetTextPortions().size();
         TETextPortion* pTP = nullptr;
         for ( nPortion = 0; nPortion < nPortions; nPortion++ )
         {
@@ -1948,7 +1949,7 @@ void TextEngine::ImpPaint( OutputDevice* pOutDev, const Point& rStartPos, Rectan
                 {
                     // for all Portions of the line
                     nIndex = rLine.GetStart();
-                    for ( sal_uInt16 y = rLine.GetStartPortion(); y <= rLine.GetEndPortion(); y++ )
+                    for ( std::size_t y = rLine.GetStartPortion(); y <= rLine.GetEndPortion(); y++ )
                     {
                         OSL_ENSURE(pPortion->GetTextPortions().size(),
                                 "ImpPaint: Line without Textportion!");
@@ -2166,7 +2167,7 @@ bool TextEngine::CreateLines( sal_uInt32 nPara )
     TextLine* pLine =  &( pTEParaPortion->GetLines()[ nLine ] );
 
     // format all lines starting here
-    size_t nDelFromLine = std::numeric_limits<size_t>::max();
+    std::size_t nDelFromLine = TETextPortionList::npos;
 
     sal_Int32 nIndex = pLine->GetStart();
     TextLine aSaveLine( *pLine );
@@ -2180,7 +2181,7 @@ bool TextEngine::CreateLines( sal_uInt32 nPara )
         sal_Int32 nPortionEnd = 0;
 
         sal_Int32 nTmpPos = nIndex;
-        sal_uInt16 nTmpPortion = pLine->GetStartPortion();
+        std::size_t nTmpPortion = pLine->GetStartPortion();
         long nTmpWidth = mpDoc->GetLeftMargin();
         // do not subtract margin; it is included in TmpWidth
         long nXWidth = mnMaxTextWidth ? mnMaxTextWidth : std::numeric_limits<long>::max();
@@ -2250,7 +2251,7 @@ bool TextEngine::CreateLines( sal_uInt32 nPara )
             pLine->SetEnd( nPortionEnd );
             OSL_ENSURE(pTEParaPortion->GetTextPortions().size(),
                     "CreateLines: No TextPortions?");
-            pLine->SetEndPortion( (sal_uInt16)pTEParaPortion->GetTextPortions().size() - 1 );
+            pLine->SetEndPortion( pTEParaPortion->GetTextPortions().size() - 1 );
         }
 
         if ( bFixedEnd )
@@ -2274,7 +2275,7 @@ bool TextEngine::CreateLines( sal_uInt32 nPara )
         {
             // adjust
             long nTextWidth = 0;
-            for ( sal_uInt16 nTP = pLine->GetStartPortion(); nTP <= pLine->GetEndPortion(); nTP++ )
+            for ( std::size_t nTP = pLine->GetStartPortion(); nTP <= pLine->GetEndPortion(); nTP++ )
             {
                 TETextPortion* pTextPortion = pTEParaPortion->GetTextPortions()[ nTP ];
                 nTextWidth += pTextPortion->GetWidth();
@@ -2344,7 +2345,7 @@ bool TextEngine::CreateLines( sal_uInt32 nPara )
         nIndex = pLine->GetEnd();   // next line Start = previous line End
                                     // because nEnd is past the last char!
 
-        const sal_uInt16 nEndPortion = pLine->GetEndPortion();
+        const std::size_t nEndPortion = pLine->GetEndPortion();
 
         // next line or new line
         pLine = nullptr;
@@ -2376,7 +2377,7 @@ bool TextEngine::CreateLines( sal_uInt32 nPara )
 
     }   // while ( Index < Len )
 
-    if (nDelFromLine != std::numeric_limits<size_t>::max())
+    if (nDelFromLine != TETextPortionList::npos)
     {
         pTEParaPortion->GetLines().erase( pTEParaPortion->GetLines().begin() + nDelFromLine,
                                           pTEParaPortion->GetLines().end() );
@@ -2885,13 +2886,13 @@ sal_uInt8 TextEngine::ImpGetRightToLeft( sal_uInt32 nPara, sal_Int32 nPos )
     return nRightToLeft;
 }
 
-long TextEngine::ImpGetPortionXOffset( sal_uInt32 nPara, TextLine* pLine, sal_uInt16 nTextPortion )
+long TextEngine::ImpGetPortionXOffset( sal_uInt32 nPara, TextLine* pLine, std::size_t nTextPortion )
 {
     long nX = pLine->GetStartX();
 
     TEParaPortion* pParaPortion = mpTEParaPortions->GetObject( nPara );
 
-    for ( sal_uInt16 i = pLine->GetStartPortion(); i < nTextPortion; i++ )
+    for ( std::size_t i = pLine->GetStartPortion(); i < nTextPortion; i++ )
     {
         TETextPortion* pPortion = pParaPortion->GetTextPortions()[ i ];
         nX += pPortion->GetWidth();
@@ -2903,7 +2904,7 @@ long TextEngine::ImpGetPortionXOffset( sal_uInt32 nPara, TextLine* pLine, sal_uI
         if ( !IsRightToLeft() && pDestPortion->IsRightToLeft() )
         {
             // Portions behind must be added, visual before this portion
-            sal_uInt16 nTmpPortion = nTextPortion+1;
+            std::size_t nTmpPortion = nTextPortion+1;
             while ( nTmpPortion <= pLine->GetEndPortion() )
             {
                 TETextPortion* pNextTextPortion = pParaPortion->GetTextPortions()[ nTmpPortion ];
@@ -2928,7 +2929,7 @@ long TextEngine::ImpGetPortionXOffset( sal_uInt32 nPara, TextLine* pLine, sal_uI
         else if ( IsRightToLeft() && !pDestPortion->IsRightToLeft() )
         {
             // Portions behind must be removed, visual behind this portion
-            sal_uInt16 nTmpPortion = nTextPortion+1;
+            std::size_t nTmpPortion = nTextPortion+1;
             while ( nTmpPortion <= pLine->GetEndPortion() )
             {
                 TETextPortion* pNextTextPortion = pParaPortion->GetTextPortions()[ nTmpPortion ];
@@ -2982,7 +2983,7 @@ long TextEngine::ImpGetOutputOffset( sal_uInt32 nPara, TextLine* pLine, sal_Int3
     TEParaPortion* pPortion = mpTEParaPortions->GetObject( nPara );
 
     sal_Int32 nPortionStart {0};
-    const sal_uInt16 nPortion = pPortion->GetTextPortions().FindPortion( nIndex, nPortionStart, true );
+    const std::size_t nPortion = pPortion->GetTextPortions().FindPortion( nIndex, nPortionStart, true );
 
     TETextPortion* pTextPortion = pPortion->GetTextPortions()[ nPortion ];
 
diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx
index af34061..bbb842e 100644
--- a/vcl/source/edit/textview.cxx
+++ b/vcl/source/edit/textview.cxx
@@ -59,6 +59,8 @@
 #include <osl/mutex.hxx>
 
 #include <algorithm>
+#include <cstddef>
+
 #include <o3tl/make_unique.hxx>
 
 class TETextDataObject :    public css::datatransfer::XTransferable,
@@ -1627,7 +1629,7 @@ void TextView::ImpShowCursor( bool bGotoCursor, bool bForceVisCursor, bool bSpec
             TEParaPortion* pParaPortion = mpImpl->mpTextEngine->mpTEParaPortions->GetObject( aPaM.GetPara() );
 
             sal_Int32 nTextPortionStart = 0;
-            sal_uInt16 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nTextPortionStart, true );
+            std::size_t nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nTextPortionStart, true );
             TETextPortion* pTextPortion = pParaPortion->GetTextPortions()[ nTextPortion ];
             if ( pTextPortion->GetKind() == PORTIONKIND_TAB )
             {


More information about the Libreoffice-commits mailing list