summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-05-25 14:23:55 +0200
committerCaolán McNamara <caolanm@redhat.com>2016-05-26 08:41:33 +0000
commit360c8458eee259eb8ca46da395621c7ec48a49ba (patch)
tree55564fb814f47f894b4d3efddb0c9a92b5f55f6a
parent97d0e7be1ad95adcd13fff507885047bdcd54d82 (diff)
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@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sw/source/uibase/uno/unotxvw.cxx12
1 files changed, 4 insertions, 8 deletions
diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx
index 1c61342daacc..c83fd07b855f 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();