sw/inc/txtatr.hxx | 5 ++--- sw/source/core/txtnode/txtatr2.cxx | 28 +++++++++++++--------------- 2 files changed, 15 insertions(+), 18 deletions(-)
New commits: commit e5dd526109377b9316c65aaa1f56405db9c5f5e5 Author: Bjoern Michaelsen <bjoern.michael...@libreoffice.org> AuthorDate: Sun Dec 6 00:54:27 2020 +0100 Commit: Bjoern Michaelsen <bjoern.michael...@libreoffice.org> CommitDate: Sun Dec 6 04:10:48 2020 +0100 SwTextRuby: Modify no more (also make it final along the way) Change-Id: I3c5eee9f9205347456f1a51338243276c1cb2b8a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107271 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michael...@libreoffice.org> diff --git a/sw/inc/txtatr.hxx b/sw/inc/txtatr.hxx index 0cbd82fb826e..55e094842c03 100644 --- a/sw/inc/txtatr.hxx +++ b/sw/inc/txtatr.hxx @@ -70,11 +70,10 @@ public: }; -class SW_DLLPUBLIC SwTextRuby : public SwTextAttrNesting, public SwClient +class SW_DLLPUBLIC SwTextRuby final: public SwTextAttrNesting, public SwClient { SwTextNode* m_pTextNode; -protected: - virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) override; + virtual void SwClientNotify(const SwModify&, const SfxHint&) override; public: SwTextRuby( SwFormatRuby& rAttr, sal_Int32 nStart, sal_Int32 nEnd ); virtual ~SwTextRuby() override; diff --git a/sw/source/core/txtnode/txtatr2.cxx b/sw/source/core/txtnode/txtatr2.cxx index d49ca8845a93..f9d23617ece3 100644 --- a/sw/source/core/txtnode/txtatr2.cxx +++ b/sw/source/core/txtnode/txtatr2.cxx @@ -199,22 +199,20 @@ SwTextRuby::~SwTextRuby() { } -void SwTextRuby::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) +void SwTextRuby::SwClientNotify(const SwModify&, const SfxHint& rHint) { - const sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0; - OSL_ENSURE( isCHRATR(nWhich) || (RES_OBJECTDYING == nWhich) - || (RES_ATTRSET_CHG == nWhich) || (RES_FMT_CHG == nWhich), - "SwTextRuby::Modify(): unknown Modify"); - - if ( m_pTextNode ) - { - SwUpdateAttr aUpdateAttr( - GetStart(), - *GetEnd(), - nWhich); - - m_pTextNode->TriggerNodeUpdate(sw::LegacyModifyHint(&aUpdateAttr, &aUpdateAttr)); - } + auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint); + if(!pLegacy) + return; + const auto nWhich = pLegacy->GetWhich(); + SAL_WARN_IF( !isCHRATR(nWhich) + && (RES_OBJECTDYING == nWhich) + && (RES_ATTRSET_CHG == nWhich) + && (RES_FMT_CHG == nWhich), "sw.core", "SwTextRuby::SwClientNotify(): unknown legacy hint"); + if(!m_pTextNode) + return; + SwUpdateAttr aUpdateAttr(GetStart(), *GetEnd(), nWhich); + m_pTextNode->TriggerNodeUpdate(sw::LegacyModifyHint(&aUpdateAttr, &aUpdateAttr)); } bool SwTextRuby::GetInfo( SfxPoolItem& rInfo ) const _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits