[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sw/source

Miklos Vajna vmiklos at collabora.co.uk
Thu May 26 08:42:06 UTC 2016


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

New commits:
commit 360c8458eee259eb8ca46da395621c7ec48a49ba
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed May 25 14:23:55 2016 +0200

    tdf#100051 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.
    
    (cherry picked from commit cbe78f817da8db78d226b3ad2b1a10d0c2dcf188)
    
    Conflicts:
    	sw/source/uibase/inc/wrtsh.hxx
    	sw/source/uibase/uno/unotxvw.cxx
    	sw/source/uibase/wrtsh/move.cxx
    
    Change-Id: I10351a6dbaa6d3fff883520c85701f60b05b4873
    Reviewed-on: https://gerrit.libreoffice.org/25496
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

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