diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-08-29 15:30:12 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-08-29 18:00:38 +0200 |
commit | 8c64a4fe576c5fb09334faba8f6cefec9d6e72a1 (patch) | |
tree | 31286f26e38285bbd1eadd3371d1a8553ad5742e /sw/source/uibase/docvw | |
parent | 6ef8762c74ae296b867966b4535243e822aafb05 (diff) |
use more SwPosition::GetContentIndex
and convert an unnecessary loop into a simple calculation
Change-Id: I79fb07770fdac787a95c65e5ff0d86d905f03cb6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138999
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/uibase/docvw')
-rw-r--r-- | sw/source/uibase/docvw/edtwin.cxx | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index bfa5d91db8ee..e169a5b44299 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -5864,11 +5864,7 @@ void SwEditWin::Command( const CommandEvent& rCEvt ) { const SwPosition& rStart = *pInput->Start(); const SwPosition& rEnd = *pInput->End(); - int nSize = 0; - for ( SwContentIndex nIndex = rStart.nContent; nIndex < rEnd.nContent; ++nIndex ) - { - ++nSize; - } + sal_Int32 nSize = rEnd.GetContentIndex() - rStart.GetContentIndex(); vcl::Window& rWin = rSh.GetView().GetEditWin(); if ( nSize == 0 ) { @@ -5881,9 +5877,9 @@ void SwEditWin::Command( const CommandEvent& rCEvt ) { std::unique_ptr<tools::Rectangle[]> aRects(new tools::Rectangle[ nSize ]); int nRectIndex = 0; - for ( SwContentIndex nIndex = rStart.nContent; nIndex < rEnd.nContent; ++nIndex ) + for ( sal_Int32 nIndex = rStart.GetContentIndex(); nIndex < rEnd.GetContentIndex(); ++nIndex ) { - const SwPosition aPos( rStart.nNode, nIndex ); + const SwPosition aPos( rStart.GetNode(), rStart.GetNode().GetContentNode(), nIndex ); SwRect aRect ( rSh.GetCharRect() ); rSh.GetCharRectAt( aRect, &aPos ); aRects[ nRectIndex ] = tools::Rectangle( aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom() ); |