sw/source/core/attr/swatrset.cxx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
New commits: commit cdf48e57da6b8a6a5eb4131340fa2c14be135714 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Fri Mar 18 21:30:07 2022 +0100 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Fri Jun 17 09:41:54 2022 +0200 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.st...@allotropia.de> (cherry picked from commit 3707c0b4ff683ac6f0942a176ebcb8d824b567ee) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136015 Tested-by: Michael Stahl <michael.st...@allotropia.de> 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