sw/source/core/crsr/crsrsh.cxx | 5 +++-- sw/source/core/docnode/node.cxx | 18 ++---------------- sw/source/core/txtnode/ndtxt.cxx | 2 +- sw/source/core/txtnode/thints.cxx | 4 ++-- sw/source/core/txtnode/txtedt.cxx | 2 +- 5 files changed, 9 insertions(+), 22 deletions(-)
New commits: commit c854c09ed109b650b5b5faaafcc8c202860ff39e Author: Noel Grandin <[email protected]> AuthorDate: Mon Dec 30 09:42:45 2024 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Mon Dec 30 12:22:12 2024 +0100 simplify RES_UPDATE_ATTR handling make all call-sites pass the same pointer for pOld and pNew Change-Id: I81319fe91e56668d708b96c70ef9573531f35c77 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179512 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index 054176a7682a..e3e3c6a03edf 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -1164,23 +1164,9 @@ void SwContentNode::SwClientNotify( const SwModify&, const SfxHint& rHint) break; case RES_UPDATE_ATTR: - // RES_UPDATE_ATTR _should_ always contain a SwUpdateAttr hint in old and new. - // However, faking one with just a basic SfxPoolItem setting a WhichId has been observed. - // This makes the crude "WhichId" type divert from the true type, which is bad. - // Thus we are asserting here, but falling back to an proper - // hint instead. so that we at least will not spread such poison further. -#ifdef DBG_UTIL - if (!SfxPoolItem::areSame(pLegacyHint->m_pNew, pLegacyHint->m_pOld)) - { - auto pBT = sal::backtrace_get(20); - SAL_WARN("sw.core", "UpdateAttr not matching! " << sal::backtrace_to_string(pBT.get())); - } -#endif - assert(SfxPoolItem::areSame(pLegacyHint->m_pNew, pLegacyHint->m_pOld)); + assert(pLegacyHint->m_pNew && pLegacyHint->m_pNew == pLegacyHint->m_pOld); assert(dynamic_cast<const SwUpdateAttr*>(pLegacyHint->m_pNew)); - const SwUpdateAttr aFallbackHint(0,0,0); - const SwUpdateAttr& rUpdateAttr = pLegacyHint->m_pNew ? *static_cast<const SwUpdateAttr*>(pLegacyHint->m_pNew) : aFallbackHint; - UpdateAttr(rUpdateAttr); + UpdateAttr(*static_cast<const SwUpdateAttr*>(pLegacyHint->m_pNew)); return; } if(bCalcHidden) diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 74981b929be9..e4217a9b1079 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -2925,7 +2925,7 @@ void SwTextNode::GCAttr() nMax, 0); - CallSwClientNotify(sw::LegacyModifyHint(nullptr, &aHint)); + CallSwClientNotify(sw::LegacyModifyHint(&aHint, &aHint)); CallSwClientNotify(SwFormatChangeHint(nullptr, GetTextColl())); } } diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index 5285fd9e75cb..4068ed401e21 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -1802,7 +1802,7 @@ void SwTextNode::DeleteAttribute( SwTextAttr * const pAttr ) m_pSwpHints->Delete( pAttr ); SwTextAttr::Destroy( pAttr ); - CallSwClientNotify(sw::LegacyModifyHint(nullptr, &aHint)); + CallSwClientNotify(sw::LegacyModifyHint(&aHint, &aHint)); TryDeleteSwpHints(); } @@ -1877,7 +1877,7 @@ void SwTextNode::DeleteAttributes( m_pSwpHints->DeleteAtPos( nPos ); SwTextAttr::Destroy( pTextHt ); - CallSwClientNotify(sw::LegacyModifyHint(nullptr, &aHint)); + CallSwClientNotify(sw::LegacyModifyHint(&aHint, &aHint)); } } } diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index df0582e1f058..7f321e109518 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -668,7 +668,7 @@ void SwTextNode::RstTextAttr( nMax, 0); - CallSwClientNotify(sw::LegacyModifyHint(nullptr, &aHint)); + CallSwClientNotify(sw::LegacyModifyHint(&aHint, &aHint)); CallSwClientNotify(SwFormatChangeHint(nullptr, GetFormatColl())); } commit a3b378c3942aac2fab2ef506c80ee2c4fc741ae2 Author: Noel Grandin <[email protected]> AuthorDate: Mon Dec 30 09:19:18 2024 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Mon Dec 30 12:22:01 2024 +0100 clean up event handling in SwCursorShell::SwClientNotify Not a bug, just reads better this way. Change-Id: I089e60878b7748a5a91fd16cf15147c4c09e870b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179511 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index c00542f944b6..162196984e6b 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -2917,9 +2917,10 @@ SwContentFrame *SwCursorShell::GetCurrFrame( const bool bCalcFrame ) const */ void SwCursorShell::SwClientNotify(const SwModify&, const SfxHint& rHint) { - if (rHint.GetId() == SfxHintId::SwPostGraphicArrived && m_aGrfArrivedLnk.IsSet()) + if (rHint.GetId() == SfxHintId::SwPostGraphicArrived) { - m_aGrfArrivedLnk.Call(*this); + if (m_aGrfArrivedLnk.IsSet()) + m_aGrfArrivedLnk.Call(*this); return; } if (rHint.GetId() == SfxHintId::SwFormatChange)
