summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-05-25 14:23:55 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-05-26 07:39:57 +0000
commitde9ae2ffab45bf6a2ddb2dcba961591bd9b693da (patch)
tree71e4fc22c100dfc6407d6da0a792ca3d792e7a7f
parente7dab0b098515bafcfe4a392d442cd5280046fed (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) Change-Id: I10351a6dbaa6d3fff883520c85701f60b05b4873 Reviewed-on: https://gerrit.libreoffice.org/25495 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r--sw/source/uibase/inc/wrtsh.hxx4
-rw-r--r--sw/source/uibase/uno/unotxvw.cxx12
-rw-r--r--sw/source/uibase/wrtsh/move.cxx8
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 )