diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-05-25 14:23:55 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-05-26 05:41:30 +0000 |
commit | cbe78f817da8db78d226b3ad2b1a10d0c2dcf188 (patch) | |
tree | 5af79207ce98d3249c4ffeeece6fbf41584591d4 | |
parent | 31eda69d6b65f224209a100f3ed0801a5c305e1b (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.
Change-Id: I10351a6dbaa6d3fff883520c85701f60b05b4873
Reviewed-on: https://gerrit.libreoffice.org/25450
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
-rw-r--r-- | sw/source/uibase/inc/wrtsh.hxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxvw.cxx | 12 | ||||
-rw-r--r-- | sw/source/uibase/wrtsh/move.cxx | 8 |
3 files changed, 10 insertions, 14 deletions
diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx index 5a36e7e963b3..0f8ccdaf1d47 100644 --- a/sw/source/uibase/inc/wrtsh.hxx +++ b/sw/source/uibase/inc/wrtsh.hxx @@ -191,8 +191,8 @@ typedef bool (SwWrtShell:: *FNSimpleMove)(); sal_uInt16 nCount, bool bBasicCall, bool bVisual = false ); bool Right ( sal_uInt16 nMode, bool bSelect, sal_uInt16 nCount, bool bBasicCall, bool bVisual = false ); - bool Up ( bool bSelect, bool bBasicCall = false ); - bool Down ( bool bSelect, bool bBasicCall = false ); + bool Up ( bool bSelect, sal_uInt16 nCount = 1, bool bBasicCall = false ); + bool Down ( bool bSelect, sal_uInt16 nCount = 1, bool bBasicCall = false ); void NxtWrd ( bool bSelect = false ) { SimpleMove( &SwWrtShell::NxtWrd_, bSelect ); } bool PrvWrd ( bool bSelect = false ) { return SimpleMove( &SwWrtShell::PrvWrd_, bSelect ); } diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx index 2eb2f50b801f..ecbb9df8a620 100644 --- a/sw/source/uibase/uno/unotxvw.cxx +++ b/sw/source/uibase/uno/unotxvw.cxx @@ -1000,8 +1000,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(); @@ -1018,8 +1017,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(); @@ -1616,8 +1614,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, true ); + bRet = m_pView->GetWrtShell().Down( bExpand, nCount, true ); } else throw uno::RuntimeException(); @@ -1634,8 +1631,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, true ); + bRet = m_pView->GetWrtShell().Up( bExpand, nCount, true ); } else throw uno::RuntimeException(); diff --git a/sw/source/uibase/wrtsh/move.cxx b/sw/source/uibase/wrtsh/move.cxx index 81b9c7a2d400..7125044c7d13 100644 --- a/sw/source/uibase/wrtsh/move.cxx +++ b/sw/source/uibase/wrtsh/move.cxx @@ -127,7 +127,7 @@ bool SwWrtShell::Right( sal_uInt16 nMode, bool bSelect, } } -bool SwWrtShell::Up( bool bSelect, bool bBasicCall ) +bool SwWrtShell::Up( bool bSelect, sal_uInt16 nCount, bool bBasicCall ) { if ( !bSelect && !bBasicCall && IsCursorReadonly() && !GetViewOptions()->IsSelectionInReadonly()) { @@ -138,10 +138,10 @@ bool SwWrtShell::Up( bool bSelect, bool bBasicCall ) } ShellMoveCursor aTmp( this, bSelect ); - return SwCursorShell::Up(); + return SwCursorShell::Up(nCount); } -bool SwWrtShell::Down( bool bSelect, bool bBasicCall ) +bool SwWrtShell::Down( bool bSelect, sal_uInt16 nCount, bool bBasicCall ) { if ( !bSelect && !bBasicCall && IsCursorReadonly() && !GetViewOptions()->IsSelectionInReadonly()) { @@ -153,7 +153,7 @@ bool SwWrtShell::Down( bool bSelect, bool bBasicCall ) } ShellMoveCursor aTmp( this, bSelect ); - return SwCursorShell::Down(); + return SwCursorShell::Down(nCount); } bool SwWrtShell::LeftMargin( bool bSelect, bool bBasicCall ) |