[Libreoffice-commits] core.git: Branch 'feature/fixes21' - sw/source

Miklos Vajna vmiklos at collabora.co.uk
Tue May 24 15:39:49 UTC 2016


 sw/source/uibase/uno/unotxvw.cxx |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

New commits:
commit b8967027a4d9adb970f788e00ae7afa98eb0c19b
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue May 24 17:30:55 2016 +0200

    Partially revert "loplugin:constantparam in sw"
    
    This partially reverts commit 9585c8b8c8d8724cc1bad4a2060c828c15599929. Instead
    of removing the nCount parameters, make use of them in
    SwXTextViewCursor::go{Left,Right,Down,Up}.
    
    For the following testcase: a document with 1000 lines, and calling
    goDown(1000, true) the spent time goes from 4 secs to 1.8 secs with this for
    me.
    
    Change-Id: I18b83a150e3cc17a08a634b0c60776ee93cc31f0

diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx
index 1c61342..c83fd07 100644
--- a/sw/source/uibase/uno/unotxvw.cxx
+++ b/sw/source/uibase/uno/unotxvw.cxx
@@ -1006,8 +1006,7 @@ sal_Bool SwXTextViewCursor::goLeft(sal_Int16 nCount, sal_Bool bExpand)
         if (!IsTextSelection())
             throw  uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
 
-        for( sal_uInt16 i = 0; i < nCount; i++ )
-            bRet = m_pView->GetWrtShell().Left( CRSR_SKIP_CHARS, bExpand, 1, true );
+        bRet = m_pView->GetWrtShell().Left( CRSR_SKIP_CHARS, bExpand, nCount, true );
     }
     else
         throw uno::RuntimeException();
@@ -1024,8 +1023,7 @@ sal_Bool SwXTextViewCursor::goRight(sal_Int16 nCount, sal_Bool bExpand)
         if (!IsTextSelection())
             throw  uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
 
-        for( sal_uInt16 i = 0; i < nCount; i++ )
-            bRet = m_pView->GetWrtShell().Right( CRSR_SKIP_CHARS, bExpand, 1, true );
+        bRet = m_pView->GetWrtShell().Right( CRSR_SKIP_CHARS, bExpand, nCount, true );
     }
     else
         throw uno::RuntimeException();
@@ -1620,8 +1618,7 @@ sal_Bool SwXTextViewCursor::goDown(sal_Int16 nCount, sal_Bool bExpand)
         if (!IsTextSelection())
             throw  uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
 
-        for( sal_uInt16 i = 0; i < nCount; i++ )
-            bRet = m_pView->GetWrtShell().Down( bExpand, 1, true );
+        bRet = m_pView->GetWrtShell().Down( bExpand, nCount, true );
     }
     else
         throw uno::RuntimeException();
@@ -1638,8 +1635,7 @@ sal_Bool SwXTextViewCursor::goUp(sal_Int16 nCount, sal_Bool bExpand)
         if (!IsTextSelection())
             throw  uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
 
-        for( sal_uInt16 i = 0; i < nCount; i++ )
-            bRet = m_pView->GetWrtShell().Up( bExpand, 1, true );
+        bRet = m_pView->GetWrtShell().Up( bExpand, nCount, true );
     }
     else
         throw uno::RuntimeException();


More information about the Libreoffice-commits mailing list