diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2022-03-18 21:30:07 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2022-06-16 19:18:40 +0200 |
commit | 3707c0b4ff683ac6f0942a176ebcb8d824b567ee (patch) | |
tree | 97b753d1af48c3c7c7bf7fa3c6cc8d4d4dca27fd /sw | |
parent | c0c0e33c4e74f62e77d54460595bcf0b3abb01a6 (diff) |
tdf#134759 sw: clear items in SwAttrSet::CopyToModify()
Setting new items but not clearing existing items smells like an
obvious omission. Why would we want a union of two nodes' items?
This improves things a bit for the bugdoc, but now it ends up with a
different wrong list on the node 254.
Change-Id: I3f5db0a4f81ac6e9af56d1faaefc2cb107dff597
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131841
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/attr/swatrset.cxx | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sw/source/core/attr/swatrset.cxx b/sw/source/core/attr/swatrset.cxx index e50116d58459..de014a521d2e 100644 --- a/sw/source/core/attr/swatrset.cxx +++ b/sw/source/core/attr/swatrset.cxx @@ -423,6 +423,23 @@ void SwAttrSet::CopyToModify( sw::BroadcastingModify& rMod ) const pFormat->SetFormatAttr( *this ); } } + if (pCNd && pCNd->HasSwAttrSet()) + { + SfxWhichIter it(*this); + std::vector<sal_uInt16> toClear; + for (sal_uInt16 nWhich = it.FirstWhich(); nWhich != 0; nWhich = it.NextWhich()) + { + if (GetItemState(nWhich, false) != SfxItemState::SET + && pCNd->GetSwAttrSet().GetItemState(nWhich, false) == SfxItemState::SET) + { + toClear.emplace_back(nWhich); + } + } + if (!toClear.empty()) + { + pCNd->ResetAttr(toClear); + } + } } #if OSL_DEBUG_LEVEL > 0 else |