diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-02-01 10:09:19 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-02-01 13:56:28 +0100 |
commit | ca9a84f82d2b2790a0ffc49d1e0157ff93852817 (patch) | |
tree | e1d502b87fa9b819fad1fd1ffd7b10e6cc9b5622 /sw/source | |
parent | 46db5807b88547a7219db78f38932114ec483167 (diff) |
sw: don't repaint all text frames on selecting and deleting several bullets
This is similar to disabling bullets for a paragraph, but in this case
the text nodes are deleted as well.
It seems to me that both invalidations are only useful in the numberging
(e.g. Arabic) case, and not in the bullet case.
(cherry picked from commit e267fe1a3dffc39bf5076dd6413ed3b0e698378c)
Change-Id: Ie03e2847e5e50d9464399f4ea0840910e43a663a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110247
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/docnode/nodes.cxx | 13 | ||||
-rw-r--r-- | sw/source/core/inc/txtfrm.hxx | 6 | ||||
-rw-r--r-- | sw/source/core/txtnode/ndtxt.cxx | 18 |
3 files changed, 22 insertions, 15 deletions
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx index 2a2bef4f4488..26efe5401038 100644 --- a/sw/source/core/docnode/nodes.cxx +++ b/sw/source/core/docnode/nodes.cxx @@ -43,6 +43,7 @@ #include <fmtftn.hxx> #include <docsh.hxx> +#include <txtfrm.hxx> typedef std::vector<SwStartNode*> SwStartNodePointers; @@ -229,8 +230,13 @@ void SwNodes::ChgNode( SwNodeIndex const & rDelPos, sal_uLong nSz, } } else + { // if movement into the UndoNodes-array, update numbering - pTextNd->InvalidateNumRule(); + if (sw::HasNumberingWhichNeedsLayoutUpdate(*pTextNd)) + { + pTextNd->InvalidateNumRule(); + } + } pTextNd->RemoveFromList(); } @@ -1193,7 +1199,10 @@ void SwNodes::Delete(const SwNodeIndex &rIndex, sal_uLong nNodes) m_pOutlineNodes->erase( pTextNd ); bUpdateOutline = true; } - pTextNd->InvalidateNumRule(); + if (sw::HasNumberingWhichNeedsLayoutUpdate(*pTextNd)) + { + pTextNd->InvalidateNumRule(); + } } else if( pCurrentNode->IsContentNode() ) static_cast<SwContentNode*>(pCurrentNode)->InvalidateNumRule(); diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx index 6bf44794cbaf..06676950700a 100644 --- a/sw/source/core/inc/txtfrm.hxx +++ b/sw/source/core/inc/txtfrm.hxx @@ -144,6 +144,12 @@ bool IsMarkHintHidden(SwRootFrame const& rLayout, void RecreateStartTextFrames(SwTextNode & rNode); +/** + * Decides if rTextNode has a numbering which has layout-level values (e.g. Arabic, but not + * none or bullets). + */ +bool HasNumberingWhichNeedsLayoutUpdate(const SwTextNode& rTextNode); + } // namespace sw /// Represents the visualization of a paragraph. Typical upper is an diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index b511c00f98e7..5b662a990036 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -947,15 +947,7 @@ 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) +bool HasNumberingWhichNeedsLayoutUpdate(const SwTextNode& rTextNode) { const SwNodeNum* pNodeNum = rTextNode.GetNum(); if (!pNodeNum) @@ -986,7 +978,7 @@ bool NeedsRenumbering(const SwTextNode& rTextNode) return true; } } -} +} // namespace SwContentNode *SwTextNode::JoinNext() { @@ -1070,14 +1062,14 @@ SwContentNode *SwTextNode::JoinNext() pDoc->CorrAbs( aIdx, SwPosition( *this ), nOldLen, true ); } SwNode::Merge const eOldMergeFlag(pTextNode->GetRedlineMergeFlag()); - bool bOldNeedsRenumbering = NeedsRenumbering(*pTextNode); + bool bOldHasNumberingWhichNeedsLayoutUpdate = HasNumberingWhichNeedsLayoutUpdate(*pTextNode); rNds.Delete(aIdx); SetWrong( pList, false ); SetGrammarCheck( pList3, false ); SetSmartTags( pList2, false ); - if (bOldNeedsRenumbering || NeedsRenumbering(*this)) + if (bOldHasNumberingWhichNeedsLayoutUpdate || HasNumberingWhichNeedsLayoutUpdate(*this)) { // Repaint all text frames that belong to this numbering to avoid outdated generated // numbers. @@ -4911,7 +4903,7 @@ namespace { }); } - if (mbUpdateListCount && mrTextNode.IsInList() && NeedsRenumbering(mrTextNode)) + if (mbUpdateListCount && mrTextNode.IsInList() && HasNumberingWhichNeedsLayoutUpdate(mrTextNode)) { // Repaint all text frames that belong to this numbering to avoid outdated generated // numbers. |