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

Caolán McNamara caolanm at redhat.com
Sat Jan 11 07:51:28 PST 2014


 vcl/source/edit/textview.cxx |   51 ++++++++++---------------------------------
 1 file changed, 12 insertions(+), 39 deletions(-)

New commits:
commit b4bff4a978247e19f2a9ff02718ef87148f78d01
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Jan 11 15:33:15 2014 +0000

    longparas: shouldn't need to split strings in textview anymore
    
    Change-Id: Ide2d0ba95e4ef8bf1500f086bd03b7a1590a2848

diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx
index cd614f1..cd5a9b3 100644
--- a/vcl/source/edit/textview.cxx
+++ b/vcl/source/edit/textview.cxx
@@ -1335,43 +1335,22 @@ TextSelection TextView::ImpMoveCursor( const KeyEvent& rKeyEvent )
 
 void TextView::InsertText( const OUString& rStr, sal_Bool bSelect )
 {
-//  HideSelection();
     mpImpl->mpTextEngine->UndoActionStart();
 
-    /* #i87633#
-    break inserted text into chunks that fit into the underlying String
-    based API (which has a maximum length of 65534 elements
+    TextSelection aNewSel( mpImpl->maSelection );
+    TextPaM aPaM = mpImpl->mpTextEngine->ImpInsertText( mpImpl->maSelection, rStr );
 
-    note: this will of course still cause problems for lines longer than those
-    65534 elements, but those cases will hopefully be few.
-    In the long run someone should switch the TextEngine to OUString instead of String
-    */
-    sal_Int32 nLen = rStr.getLength();
-    sal_Int32 nPos = 0;
-    do
+    if ( bSelect )
     {
-        sal_Int32 nChunkLen = nLen > 65534 ? 65534 : nLen;
-        OUString aChunk( rStr.copy( nPos, nChunkLen ) );
-
-        TextSelection aNewSel( mpImpl->maSelection );
-
-        TextPaM aPaM = mpImpl->mpTextEngine->ImpInsertText( mpImpl->maSelection, aChunk );
-
-        if ( bSelect )
-        {
-            aNewSel.Justify();
-            aNewSel.GetEnd() = aPaM;
-        }
-        else
-        {
-            aNewSel = aPaM;
-        }
-
-        ImpSetSelection( aNewSel );
-        nLen -= nChunkLen;
-        nPos += nChunkLen;
+        aNewSel.Justify();
+        aNewSel.GetEnd() = aPaM;
+    }
+    else
+    {
+        aNewSel = aPaM;
     }
-    while( nLen );
+
+    ImpSetSelection( aNewSel );
 
     mpImpl->mpTextEngine->UndoActionEnd();
 
@@ -1952,14 +1931,8 @@ bool TextView::ImplTruncateNewText( OUString& rNewText ) const
 {
     bool bTruncated = false;
 
-    if( rNewText.getLength() > 65534 ) // limit to String API
-    {
-        rNewText = rNewText.copy( 0, 65534 );
-        bTruncated = true;
-    }
-
     sal_uLong nMaxLen = mpImpl->mpTextEngine->GetMaxTextLen();
-    // 0 means unlimited, there is just the String API limit handled above
+    // 0 means unlimited
     if( nMaxLen != 0 )
     {
         sal_uLong nCurLen = mpImpl->mpTextEngine->GetTextLen();


More information about the Libreoffice-commits mailing list