summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-01-28 17:28:54 +0100
committerMiklos Vajna <vmiklos@collabora.com>2021-01-28 18:41:17 +0100
commit6de46444027d03b617d02b66434f626c5723501f (patch)
treef1495804b38b7b18a0b1fb48ef1bc7ead57805e2 /sw/source
parent4e84a42add9c8ac27feb5e49a96e00ffcc8f0bc8 (diff)
sw: don't repaint all text frames on text node delete for bullet numberings
The intention of the InvalidateNumRule() call is probably to make sure that generated number portions in e.g. Arabic numbering are up to date. But this is not necessary for bullets and causes not needed invalidations. Change-Id: Iad555727e5e2b069bbffae0e7650fb8c75a56770 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110079 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx50
1 files changed, 49 insertions, 1 deletions
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 9575652feec1..5516136db040 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -912,6 +912,45 @@ void CheckResetRedlineMergeFlag(SwTextNode & rNode, Recreate const eRecreateMerg
} // namespace
+namespace
+{
+/**
+ * Decides if rTextNode has a numbering which has layout-level values (e.g. Arabic, but not
+ * none or bullets).
+ */
+bool NeedsRenumbering(const SwTextNode& rTextNode)
+{
+ const SwNodeNum* pNodeNum = rTextNode.GetNum();
+ if (!pNodeNum)
+ {
+ return false;
+ }
+
+ const SwNumRule* pNumRule = pNodeNum->GetNumRule();
+ if (!pNumRule)
+ {
+ return false;
+ }
+
+ const SwNumFormat* pFormat
+ = pNumRule->GetNumFormat(static_cast<sal_uInt16>(rTextNode.GetAttrListLevel()));
+ if (!pFormat)
+ {
+ return false;
+ }
+
+ switch (pFormat->GetNumberingType())
+ {
+ case SVX_NUM_NUMBER_NONE:
+ case SVX_NUM_CHAR_SPECIAL:
+ case SVX_NUM_BITMAP:
+ return false;
+ default:
+ return true;
+ }
+}
+}
+
SwContentNode *SwTextNode::JoinNext()
{
SwNodes& rNds = GetNodes();
@@ -994,11 +1033,20 @@ SwContentNode *SwTextNode::JoinNext()
rDoc.CorrAbs( aIdx, SwPosition( *this ), nOldLen, true );
}
SwNode::Merge const eOldMergeFlag(pTextNode->GetRedlineMergeFlag());
+ bool bOldNeedsRenumbering = NeedsRenumbering(*pTextNode);
+
rNds.Delete(aIdx);
SetWrong( pList, false );
SetGrammarCheck( pList3, false );
SetSmartTags( pList2, false );
- InvalidateNumRule();
+
+ if (bOldNeedsRenumbering || NeedsRenumbering(*this))
+ {
+ // Repaint all text frames that belong to this numbering to avoid outdated generated
+ // numbers.
+ InvalidateNumRule();
+ }
+
CheckResetRedlineMergeFlag(*this, eOldMergeFlag == SwNode::Merge::First
? sw::Recreate::ThisNode
: sw::Recreate::No);