diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-03 10:49:26 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-03 14:53:23 +0200 |
commit | 516dc02998fd59035fb54f2c78b7891ac7c7578a (patch) | |
tree | bfa77a0efbf1d24fb5ed964bffd18e993ac1f00c /editeng | |
parent | dc119d12f03391c4c83a1819d09d5c046623cad5 (diff) |
avoid some sorting
Change-Id: I02aacffcac30d48f79fd8d2640392aa3f1214b41
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97826
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/editdoc.cxx | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index fbcb4c51ed41..0d5213355c5c 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -2420,6 +2420,7 @@ bool EditDoc::RemoveAttribs( ContentNode* pNode, sal_Int32 nStart, sal_Int32 nEn rpStarting = nullptr; bool bChanged = false; + bool bNeedsSorting = false; DBG_ASSERT( nStart <= nEnd, "Small miscalculations in InsertAttribInSelection" ); @@ -2443,6 +2444,7 @@ bool EditDoc::RemoveAttribs( ContentNode* pNode, sal_Int32 nStart, sal_Int32 nEn bChanged = true; if ( pAttr->GetEnd() > nEnd ) { + bNeedsSorting = true; pAttr->GetStart() = nEnd; // then it starts after this rpStarting = pAttr; if ( nWhich ) @@ -2476,6 +2478,7 @@ bool EditDoc::RemoveAttribs( ContentNode* pNode, sal_Int32 nStart, sal_Int32 nEn bChanged = true; if ( pAttr->GetStart() == nStart ) { + bNeedsSorting = true; pAttr->GetStart() = nEnd; rpStarting = pAttr; if ( nWhich ) @@ -2490,6 +2493,7 @@ bool EditDoc::RemoveAttribs( ContentNode* pNode, sal_Int32 nStart, sal_Int32 nEn } else // Attribute must be split ... { + bNeedsSorting = true; sal_Int32 nOldEnd = pAttr->GetEnd(); pAttr->GetEnd() = nStart; rpEnding = pAttr; @@ -2514,7 +2518,8 @@ bool EditDoc::RemoveAttribs( ContentNode* pNode, sal_Int32 nStart, sal_Int32 nEn if ( bChanged ) { // char attributes need to be sorted by start again - pNode->GetCharAttribs().ResortAttribs(); + if (bNeedsSorting) + pNode->GetCharAttribs().ResortAttribs(); SetModified(true); } |