summaryrefslogtreecommitdiff
path: root/sw/source/core/txtnode
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2018-10-22 16:37:08 +0200
committerMichael Stahl <Michael.Stahl@cib.de>2018-11-15 15:10:01 +0100
commit0067dec2d25fee2b4f0067bea968c518448f1298 (patch)
tree79d289fda9aac5335f29c0ecf36a6132678f9164 /sw/source/core/txtnode
parent1e6ee2bf10c7c42942725a18b8c097f668829e65 (diff)
sw_redlinehide_3: adapt number tree updates in SetAttr/ResetAttr
Update both of the SwNodeNums. Change-Id: Iba8aa6cda460099f4a1086d6aaa08ac98c78f097
Diffstat (limited to 'sw/source/core/txtnode')
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx48
1 files changed, 35 insertions, 13 deletions
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 657547c7766d..cf8ec5bbeccd 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -3967,6 +3967,21 @@ const SwNodeNum* SwTextNode::GetNum(SwRootFrame const*const pLayout) const
return pLayout && pLayout->IsHideRedlines() ? mpNodeNumRLHidden : mpNodeNum;
}
+void SwTextNode::DoNum(std::function<void (SwNodeNum &)> const& rFunc)
+{
+ // temp. clear because GetActualListLevel() may be called and the assert
+ // there triggered during update, which is unhelpful
+ SwNodeNum * pBackup(mpNodeNumRLHidden);
+ mpNodeNumRLHidden = nullptr;
+ assert(mpNodeNum);
+ rFunc(*mpNodeNum);
+ if (pBackup)
+ {
+ mpNodeNumRLHidden = pBackup;
+ rFunc(*mpNodeNumRLHidden);
+ }
+}
+
SwNumberTree::tNumberVector
SwTextNode::GetNumberVector(SwRootFrame const*const pLayout) const
{
@@ -4830,20 +4845,24 @@ namespace {
{
if ( mbUpdateListLevel && mrTextNode.IsInList() )
{
- const_cast<SwNodeNum*>(mrTextNode.GetNum())->SetLevelInListTree(
- mrTextNode.GetAttrListLevel() );
+ auto const nLevel(mrTextNode.GetAttrListLevel());
+ mrTextNode.DoNum(
+ [nLevel](SwNodeNum & rNum) { rNum.SetLevelInListTree(nLevel); });
}
if ( mbUpdateListRestart && mrTextNode.IsInList() )
{
- SwNodeNum* pNodeNum = const_cast<SwNodeNum*>(mrTextNode.GetNum());
- pNodeNum->InvalidateMe();
- pNodeNum->NotifyInvalidSiblings();
+ mrTextNode.DoNum(
+ [](SwNodeNum & rNum) {
+ rNum.InvalidateMe();
+ rNum.NotifyInvalidSiblings();
+ });
}
if ( mbUpdateListCount && mrTextNode.IsInList() )
{
- const_cast<SwNodeNum*>(mrTextNode.GetNum())->InvalidateAndNotifyTree();
+ mrTextNode.DoNum(
+ [](SwNodeNum & rNum) { rNum.InvalidateAndNotifyTree(); });
}
}
@@ -5155,21 +5174,24 @@ namespace {
{
if ( mbUpdateListLevel )
{
- SwNodeNum* pNodeNum = const_cast<SwNodeNum*>(mrTextNode.GetNum());
- pNodeNum->SetLevelInListTree( mrTextNode.GetAttrListLevel() );
+ auto const nLevel(mrTextNode.GetAttrListLevel());
+ mrTextNode.DoNum(
+ [nLevel](SwNodeNum & rNum) { rNum.SetLevelInListTree(nLevel); });
}
if ( mbUpdateListRestart )
{
- SwNodeNum* pNodeNum = const_cast<SwNodeNum*>(mrTextNode.GetNum());
- pNodeNum->InvalidateMe();
- pNodeNum->NotifyInvalidSiblings();
+ mrTextNode.DoNum(
+ [](SwNodeNum & rNum) {
+ rNum.InvalidateMe();
+ rNum.NotifyInvalidSiblings();
+ });
}
if ( mbUpdateListCount )
{
- SwNodeNum* pNodeNum = const_cast<SwNodeNum*>(mrTextNode.GetNum());
- pNodeNum->InvalidateAndNotifyTree();
+ mrTextNode.DoNum(
+ [](SwNodeNum & rNum) { rNum.InvalidateAndNotifyTree(); });
}
}
}