Kaydet (Commit) 0067dec2 authored tarafından Michael Stahl's avatar Michael Stahl

sw_redlinehide_3: adapt number tree updates in SetAttr/ResetAttr

Update both of the SwNodeNums.

Change-Id: Iba8aa6cda460099f4a1086d6aaa08ac98c78f097
üst 1e6ee2bf
...@@ -424,6 +424,7 @@ public: ...@@ -424,6 +424,7 @@ public:
SwNumRule *GetNumRule(bool bInParent = true) const; SwNumRule *GetNumRule(bool bInParent = true) const;
const SwNodeNum* GetNum(SwRootFrame const* pLayout = nullptr) const; const SwNodeNum* GetNum(SwRootFrame const* pLayout = nullptr) const;
void DoNum(std::function<void (SwNodeNum &)> const&);
SwNumberTree::tNumberVector GetNumberVector(SwRootFrame const* pLayout = nullptr) const; SwNumberTree::tNumberVector GetNumberVector(SwRootFrame const* pLayout = nullptr) const;
......
...@@ -3967,6 +3967,21 @@ const SwNodeNum* SwTextNode::GetNum(SwRootFrame const*const pLayout) const ...@@ -3967,6 +3967,21 @@ const SwNodeNum* SwTextNode::GetNum(SwRootFrame const*const pLayout) const
return pLayout && pLayout->IsHideRedlines() ? mpNodeNumRLHidden : mpNodeNum; 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 SwNumberTree::tNumberVector
SwTextNode::GetNumberVector(SwRootFrame const*const pLayout) const SwTextNode::GetNumberVector(SwRootFrame const*const pLayout) const
{ {
...@@ -4830,20 +4845,24 @@ namespace { ...@@ -4830,20 +4845,24 @@ namespace {
{ {
if ( mbUpdateListLevel && mrTextNode.IsInList() ) if ( mbUpdateListLevel && mrTextNode.IsInList() )
{ {
const_cast<SwNodeNum*>(mrTextNode.GetNum())->SetLevelInListTree( auto const nLevel(mrTextNode.GetAttrListLevel());
mrTextNode.GetAttrListLevel() ); mrTextNode.DoNum(
[nLevel](SwNodeNum & rNum) { rNum.SetLevelInListTree(nLevel); });
} }
if ( mbUpdateListRestart && mrTextNode.IsInList() ) if ( mbUpdateListRestart && mrTextNode.IsInList() )
{ {
SwNodeNum* pNodeNum = const_cast<SwNodeNum*>(mrTextNode.GetNum()); mrTextNode.DoNum(
pNodeNum->InvalidateMe(); [](SwNodeNum & rNum) {
pNodeNum->NotifyInvalidSiblings(); rNum.InvalidateMe();
rNum.NotifyInvalidSiblings();
});
} }
if ( mbUpdateListCount && mrTextNode.IsInList() ) if ( mbUpdateListCount && mrTextNode.IsInList() )
{ {
const_cast<SwNodeNum*>(mrTextNode.GetNum())->InvalidateAndNotifyTree(); mrTextNode.DoNum(
[](SwNodeNum & rNum) { rNum.InvalidateAndNotifyTree(); });
} }
} }
...@@ -5155,21 +5174,24 @@ namespace { ...@@ -5155,21 +5174,24 @@ namespace {
{ {
if ( mbUpdateListLevel ) if ( mbUpdateListLevel )
{ {
SwNodeNum* pNodeNum = const_cast<SwNodeNum*>(mrTextNode.GetNum()); auto const nLevel(mrTextNode.GetAttrListLevel());
pNodeNum->SetLevelInListTree( mrTextNode.GetAttrListLevel() ); mrTextNode.DoNum(
[nLevel](SwNodeNum & rNum) { rNum.SetLevelInListTree(nLevel); });
} }
if ( mbUpdateListRestart ) if ( mbUpdateListRestart )
{ {
SwNodeNum* pNodeNum = const_cast<SwNodeNum*>(mrTextNode.GetNum()); mrTextNode.DoNum(
pNodeNum->InvalidateMe(); [](SwNodeNum & rNum) {
pNodeNum->NotifyInvalidSiblings(); rNum.InvalidateMe();
rNum.NotifyInvalidSiblings();
});
} }
if ( mbUpdateListCount ) if ( mbUpdateListCount )
{ {
SwNodeNum* pNodeNum = const_cast<SwNodeNum*>(mrTextNode.GetNum()); mrTextNode.DoNum(
pNodeNum->InvalidateAndNotifyTree(); [](SwNodeNum & rNum) { rNum.InvalidateAndNotifyTree(); });
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment