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

Stephan Bergmann sbergman at redhat.com
Wed Mar 8 13:20:06 UTC 2017


 include/vcl/texteng.hxx      |    2 +-
 vcl/source/edit/textdat2.hxx |    2 +-
 vcl/source/edit/textdata.cxx |    4 ++--
 vcl/source/edit/texteng.cxx  |    4 ++--
 vcl/source/edit/textview.cxx |   19 ++++++++++---------
 5 files changed, 16 insertions(+), 15 deletions(-)

New commits:
commit fc33ca85789c340dace4a4505fc12124a812195a
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Mar 8 14:19:30 2017 +0100

    Clean up uses of integer types
    
    Change-Id: Ia89668f12f93c9fada3ecf31851f8df2a2567979

diff --git a/include/vcl/texteng.hxx b/include/vcl/texteng.hxx
index af67814..469594e 100644
--- a/include/vcl/texteng.hxx
+++ b/include/vcl/texteng.hxx
@@ -189,7 +189,7 @@ protected:
 
     bool                IsFormatted() const { return mbFormatted; }
 
-    sal_Int32           GetCharPos( sal_uInt32 nPara, sal_uInt16 nLine, long nDocPosX, bool bSmart = false );
+    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 );
diff --git a/vcl/source/edit/textdat2.hxx b/vcl/source/edit/textdat2.hxx
index ce84aa9..d461018 100644
--- a/vcl/source/edit/textdat2.hxx
+++ b/vcl/source/edit/textdat2.hxx
@@ -205,7 +205,7 @@ public:
     TETextPortionList&  GetTextPortions()           { return maTextPortions; }
     std::vector<TEWritingDirectionInfo>& GetWritingDirectionInfos() { return maWritingDirectionInfos; }
 
-    sal_uInt16          GetLineNumber( sal_Int32 nIndex, bool bInclEnd );
+    std::vector<TextLine>::size_type GetLineNumber( sal_Int32 nIndex, bool bInclEnd );
     void                CorrectValuesBehindLastFormattedLine( sal_uInt16 nLastFormattedLine );
 };
 
diff --git a/vcl/source/edit/textdata.cxx b/vcl/source/edit/textdata.cxx
index 6b8abdf..3cbb812 100644
--- a/vcl/source/edit/textdata.cxx
+++ b/vcl/source/edit/textdata.cxx
@@ -211,9 +211,9 @@ void TEParaPortion::MarkSelectionInvalid( sal_Int32 nStart, sal_Int32 /*nEnd*/ )
     mbSimple = false;
 }
 
-sal_uInt16 TEParaPortion::GetLineNumber( sal_Int32 nChar, bool bInclEnd )
+std::vector<TextLine>::size_type TEParaPortion::GetLineNumber( sal_Int32 nChar, bool bInclEnd )
 {
-    for ( size_t nLine = 0; nLine < maLines.size(); nLine++ )
+    for ( std::vector<TextLine>::size_type nLine = 0; nLine < maLines.size(); nLine++ )
     {
         TextLine& rLine = maLines[ nLine ];
         if ( ( bInclEnd && ( rLine.GetEnd() >= nChar ) ) ||
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index 69caafd..2dd9e37 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -1064,7 +1064,7 @@ sal_Int32 TextEngine::ImpFindIndex( sal_uInt32 nPortion, const Point& rPosInPara
 
     long nY = 0;
     TextLine* pLine = nullptr;
-    sal_uInt16 nLine;
+    std::vector<TextLine>::size_type nLine;
     for ( nLine = 0; nLine < pPortion->GetLines().size(); nLine++ )
     {
         TextLine& rmpLine = pPortion->GetLines()[ nLine ];
@@ -1090,7 +1090,7 @@ sal_Int32 TextEngine::ImpFindIndex( sal_uInt32 nPortion, const Point& rPosInPara
     return nCurIndex;
 }
 
-sal_Int32 TextEngine::GetCharPos( sal_uInt32 nPortion, sal_uInt16 nLine, long nXPos, bool )
+sal_Int32 TextEngine::GetCharPos( sal_uInt32 nPortion, std::vector<TextLine>::size_type nLine, long nXPos, bool )
 {
 
     TEParaPortion* pPortion = mpTEParaPortions->GetObject( nPortion );
diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx
index 120b2ff..af34061 100644
--- a/vcl/source/edit/textview.cxx
+++ b/vcl/source/edit/textview.cxx
@@ -355,15 +355,15 @@ void TextView::ImpHighlight( const TextSelection& rSel )
             if ( ( nPara >= nStartPara ) && ( ( nY + nParaHeight ) > aVisArea.Top() ) )
             {
                 TEParaPortion* pTEParaPortion = mpImpl->mpTextEngine->mpTEParaPortions->GetObject( nPara );
-                sal_uInt16 nStartLine = 0;
-                sal_uInt16 nEndLine = pTEParaPortion->GetLines().size() -1;
+                std::vector<TextLine>::size_type nStartLine = 0;
+                std::vector<TextLine>::size_type nEndLine = pTEParaPortion->GetLines().size() -1;
                 if ( nPara == nStartPara )
                     nStartLine = pTEParaPortion->GetLineNumber( aSel.GetStart().GetIndex(), false );
                 if ( nPara == nEndPara )
                     nEndLine = pTEParaPortion->GetLineNumber( aSel.GetEnd().GetIndex(), true );
 
                 // iterate over all lines
-                for ( sal_uInt16 nLine = nStartLine; nLine <= nEndLine; nLine++ )
+                for ( std::vector<TextLine>::size_type nLine = nStartLine; nLine <= nEndLine; nLine++ )
                 {
                     TextLine& rLine = pTEParaPortion->GetLines()[ nLine ];
                     sal_Int32 nStartIndex = rLine.GetStart();
@@ -947,7 +947,7 @@ void TextView::Command( const CommandEvent& rCEvt )
                 mpImpl->mpTextEngine->FormatDoc();
 
             TEParaPortion* pParaPortion = mpImpl->mpTextEngine->mpTEParaPortions->GetObject( aPaM.GetPara() );
-            sal_uInt16 nLine = pParaPortion->GetLineNumber( aPaM.GetIndex(), true );
+            std::vector<TextLine>::size_type nLine = pParaPortion->GetLineNumber( aPaM.GetIndex(), true );
             TextLine& rLine = pParaPortion->GetLines()[ nLine ];
             if ( nInputEnd > rLine.GetEnd() )
                 nInputEnd = rLine.GetEnd();
@@ -1441,7 +1441,7 @@ TextPaM TextView::CursorUp( const TextPaM& rPaM )
         nX = mpImpl->mnTravelXPos;
 
     TEParaPortion* pPPortion = mpImpl->mpTextEngine->mpTEParaPortions->GetObject( rPaM.GetPara() );
-    sal_uInt16 nLine = pPPortion->GetLineNumber( rPaM.GetIndex(), false );
+    std::vector<TextLine>::size_type nLine = pPPortion->GetLineNumber( rPaM.GetIndex(), false );
     if ( nLine )    // same paragraph
     {
         aPaM.GetIndex() = mpImpl->mpTextEngine->GetCharPos( rPaM.GetPara(), nLine-1, nX );
@@ -1456,7 +1456,7 @@ TextPaM TextView::CursorUp( const TextPaM& rPaM )
     {
         aPaM.GetPara()--;
         pPPortion = mpImpl->mpTextEngine->mpTEParaPortions->GetObject( aPaM.GetPara() );
-        sal_uInt16 nL = pPPortion->GetLines().size() - 1;
+        std::vector<TextLine>::size_type nL = pPPortion->GetLines().size() - 1;
         aPaM.GetIndex() = mpImpl->mpTextEngine->GetCharPos( aPaM.GetPara(), nL, nX+1 );
     }
 
@@ -1477,7 +1477,7 @@ TextPaM TextView::CursorDown( const TextPaM& rPaM )
         nX = mpImpl->mnTravelXPos;
 
     TEParaPortion* pPPortion = mpImpl->mpTextEngine->mpTEParaPortions->GetObject( rPaM.GetPara() );
-    sal_uInt16 nLine = pPPortion->GetLineNumber( rPaM.GetIndex(), false );
+    std::vector<TextLine>::size_type nLine = pPPortion->GetLineNumber( rPaM.GetIndex(), false );
     if ( nLine < ( pPPortion->GetLines().size() - 1 ) )
     {
         aPaM.GetIndex() = mpImpl->mpTextEngine->GetCharPos( rPaM.GetPara(), nLine+1, nX );
@@ -1505,7 +1505,7 @@ TextPaM TextView::CursorStartOfLine( const TextPaM& rPaM )
     TextPaM aPaM( rPaM );
 
     TEParaPortion* pPPortion = mpImpl->mpTextEngine->mpTEParaPortions->GetObject( rPaM.GetPara() );
-    sal_uInt16 nLine = pPPortion->GetLineNumber( aPaM.GetIndex(), false );
+    std::vector<TextLine>::size_type nLine = pPPortion->GetLineNumber( aPaM.GetIndex(), false );
     TextLine& rLine = pPPortion->GetLines()[ nLine ];
     aPaM.GetIndex() = rLine.GetStart();
 
@@ -1517,7 +1517,7 @@ TextPaM TextView::CursorEndOfLine( const TextPaM& rPaM )
     TextPaM aPaM( rPaM );
 
     TEParaPortion* pPPortion = mpImpl->mpTextEngine->mpTEParaPortions->GetObject( rPaM.GetPara() );
-    sal_uInt16 nLine = pPPortion->GetLineNumber( aPaM.GetIndex(), false );
+    std::vector<TextLine>::size_type nLine = pPPortion->GetLineNumber( aPaM.GetIndex(), false );
     TextLine& rLine = pPPortion->GetLines()[ nLine ];
     aPaM.GetIndex() = rLine.GetEnd();
 
@@ -2153,6 +2153,7 @@ sal_Int32 TextView::GetLineNumberOfCursorInSelection() const
         TextPaM aPaM = GetSelection().GetEnd();
         TEParaPortion* pPPortion = mpImpl->mpTextEngine->mpTEParaPortions->GetObject( aPaM.GetPara() );
         nLineNo = pPPortion->GetLineNumber( aPaM.GetIndex(), false );
+            //TODO: std::vector<TextLine>::size_type -> sal_Int32!
         if( mpImpl->mbCursorAtEndOfLine )
             --nLineNo;
     }


More information about the Libreoffice-commits mailing list