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:
SwNumRule *GetNumRule(bool bInParent = true) const;
const SwNodeNum* GetNum(SwRootFrame const* pLayout = nullptr) const;
void DoNum(std::function<void (SwNodeNum &)> const&);
SwNumberTree::tNumberVector GetNumberVector(SwRootFrame const* pLayout = nullptr) const;
......
......@@ -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(); });
}
}
}
......
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