tdf#119840 loop backwards in DocumentRedlineManager::SplitRedline
reduces load time by approx 20% Change-Id: Id1314ed640e54a104cfe26e4784c847f43ce64bf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137231 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
parent
65b29c5d38
commit
4701d17bfe
1 changed files with 7 additions and 4 deletions
|
@ -2490,12 +2490,15 @@ void DocumentRedlineManager::CompressRedlines()
|
|||
bool DocumentRedlineManager::SplitRedline( const SwPaM& rRange )
|
||||
{
|
||||
bool bChg = false;
|
||||
SwRedlineTable::size_type n = 0;
|
||||
const SwPosition* pStt = rRange.Start();
|
||||
const SwPosition* pEnd = rRange.End();
|
||||
//FIXME overlapping problem GetRedline( *pStt, &n );
|
||||
for ( ; n < maRedlineTable.size(); ++n)
|
||||
// Loop backwards, because we are mostly called with rRange pointing
|
||||
// something near the end of the table.
|
||||
SwRedlineTable::size_type n = maRedlineTable.size();
|
||||
while (n != 0)
|
||||
{
|
||||
--n;
|
||||
SwRangeRedline * pRedline = maRedlineTable[ n ];
|
||||
auto [pRedlineStart, pRedlineEnd] = pRedline->StartEnd();
|
||||
if (*pRedlineStart <= *pStt && *pEnd <= *pRedlineEnd)
|
||||
|
@ -2526,7 +2529,7 @@ bool DocumentRedlineManager::SplitRedline( const SwPaM& rRange )
|
|||
|
||||
case 3:
|
||||
pRedline->InvalidateRange(SwRangeRedline::Invalidation::Remove);
|
||||
maRedlineTable.DeleteAndDestroy( n-- );
|
||||
maRedlineTable.DeleteAndDestroy( n );
|
||||
pRedline = nullptr;
|
||||
break;
|
||||
}
|
||||
|
@ -2539,7 +2542,7 @@ bool DocumentRedlineManager::SplitRedline( const SwPaM& rRange )
|
|||
if( pNew )
|
||||
maRedlineTable.Insert( pNew, n );
|
||||
}
|
||||
else if (*pEnd < *pRedlineStart)
|
||||
else if (*pRedlineEnd < *pStt)
|
||||
break;
|
||||
}
|
||||
return bChg;
|
||||
|
|
Loading…
Reference in a new issue