[Libreoffice-commits] core.git: editeng/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jul 3 12:54:08 UTC 2020
editeng/source/editeng/editdoc.cxx | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
New commits:
commit 516dc02998fd59035fb54f2c78b7891ac7c7578a
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Jul 3 10:49:26 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Jul 3 14:53:23 2020 +0200
avoid some sorting
Change-Id: I02aacffcac30d48f79fd8d2640392aa3f1214b41
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97826
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
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);
}
More information about the Libreoffice-commits
mailing list