compilerplugins/clang/unusedmethods.results | 2 - include/svl/hint.hxx | 1 svl/source/items/poolitem.cxx | 1 sw/inc/hintids.hxx | 2 - sw/inc/hints.hxx | 15 ++++---- sw/source/core/attr/hints.cxx | 10 ++--- sw/source/core/text/txtfrm.cxx | 47 ++++++++++++++-------------- sw/source/core/txtnode/ndtxt.cxx | 13 +++---- 8 files changed, 45 insertions(+), 46 deletions(-)
New commits: commit eb1294a60783ceb450cefd6891d6eafa0021aadc Author: Bjoern Michaelsen <bjoern.michael...@libreoffice.org> AuthorDate: Sun Sep 25 11:34:10 2022 +0200 Commit: Bjoern Michaelsen <bjoern.michael...@libreoffice.org> CommitDate: Sun Sep 25 20:01:53 2022 +0200 unwrap SwDelChr to plain SfxHint Change-Id: Ief37a8025181b6cc8a6e484e2726d8a8d92f57ea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140567 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michael...@libreoffice.org> diff --git a/compilerplugins/clang/unusedmethods.results b/compilerplugins/clang/unusedmethods.results index be732177c36b..524af6ade80c 100644 --- a/compilerplugins/clang/unusedmethods.results +++ b/compilerplugins/clang/unusedmethods.results @@ -1592,8 +1592,6 @@ include/svl/typedwhich.hxx:31 TypedWhichId::TypedWhichId(TypedWhichId<type-parameter-?-?>,typename enable_if<std::is_base_of_v<SwContrastGrf, derived_type>, int>::type) include/svl/typedwhich.hxx:31 TypedWhichId::TypedWhichId(TypedWhichId<type-parameter-?-?>,typename enable_if<std::is_base_of_v<SwCropGrf, derived_type>, int>::type) -include/svl/typedwhich.hxx:31 - TypedWhichId::TypedWhichId(TypedWhichId<type-parameter-?-?>,typename enable_if<std::is_base_of_v<SwDelChr, derived_type>, int>::type) include/svl/typedwhich.hxx:31 TypedWhichId::TypedWhichId(TypedWhichId<type-parameter-?-?>,typename enable_if<std::is_base_of_v<SwDocDisplayItem, derived_type>, int>::type) include/svl/typedwhich.hxx:31 diff --git a/include/svl/hint.hxx b/include/svl/hint.hxx index 4b4677cd768d..22f0bb8eb7e2 100644 --- a/include/svl/hint.hxx +++ b/include/svl/hint.hxx @@ -142,6 +142,7 @@ enum class SfxHintId { SwNameChanged, // this can possibly be replaced by the generic NameChanged above SwInsertText, SwDeleteText, + SwDeleteChar, ThisIsAnSdrHint }; diff --git a/svl/source/items/poolitem.cxx b/svl/source/items/poolitem.cxx index 32dfebb51747..225678340a1c 100644 --- a/svl/source/items/poolitem.cxx +++ b/svl/source/items/poolitem.cxx @@ -434,7 +434,6 @@ // class SwMsgPoolItem : public SfxPoolItem // class SwPtrMsgPoolItem : public SwMsgPoolItem // class SwFormatChg: public SwMsgPoolItem -// class SwDelChr: public SwMsgPoolItem // class SwUpdateAttr : public SwMsgPoolItem // class SwRefMarkFieldUpdate : public SwMsgPoolItem // class SwDocPosUpdate : public SwMsgPoolItem diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx index afe2df275aaa..497635f71f5b 100644 --- a/sw/inc/hintids.hxx +++ b/sw/inc/hintids.hxx @@ -133,7 +133,6 @@ class SwTableBoxNumFormat; class SwTextGridItem; class SwTransparencyGrf; class SwFormatRuby; -class SwDelChr; class SwRefMarkFieldUpdate; class SwTableFormulaUpdate; class SwAutoFormatGetDocNode; @@ -422,7 +421,6 @@ constexpr sal_uInt16 RES_MSG_BEGIN(RES_FMT_END); constexpr TypedWhichId<SwPtrMsgPoolItem> RES_OBJECTDYING(RES_MSG_BEGIN); // 161 constexpr TypedWhichId<SwFormatChg> RES_FMT_CHG(162); constexpr TypedWhichId<SwAttrSetChg> RES_ATTRSET_CHG(163); -constexpr TypedWhichId<SwDelChr> RES_DEL_CHR(165); constexpr TypedWhichId<SwUpdateAttr> RES_UPDATE_ATTR(167); constexpr TypedWhichId<SwRefMarkFieldUpdate> RES_REFMARKFLD_UPDATE(168); constexpr TypedWhichId<SwDocPosUpdate> RES_DOCPOS_UPDATE(169); diff --git a/sw/inc/hints.hxx b/sw/inc/hints.hxx index 78952b288193..777825ae4969 100644 --- a/sw/inc/hints.hxx +++ b/sw/inc/hints.hxx @@ -76,13 +76,6 @@ public: SwFormatChg( SwFormat *pFormat ); }; -class SwDelChr final : public SwMsgPoolItem -{ -public: - sal_Int32 nPos; - - SwDelChr( sal_Int32 nP ); -}; namespace sw { @@ -119,6 +112,14 @@ public: DeleteText( sal_Int32 nS, sal_Int32 nL ); }; +class DeleteChar final : public SfxHint +{ +public: + const sal_Int32 m_nPos; + + DeleteChar( const sal_Int32 nPos ); +}; + /// new delete redline is created class RedlineDelText final : public SfxHint { diff --git a/sw/source/core/attr/hints.cxx b/sw/source/core/attr/hints.cxx index 76a5113eed46..3257d5736900 100644 --- a/sw/source/core/attr/hints.cxx +++ b/sw/source/core/attr/hints.cxx @@ -33,11 +33,6 @@ SwFormatChg::SwFormatChg( SwFormat* pFormat ) } -SwDelChr::SwDelChr( sal_Int32 nP ) - : SwMsgPoolItem( RES_DEL_CHR ), nPos( nP ) -{ -} - namespace sw { @@ -59,6 +54,11 @@ DeleteText::DeleteText( const sal_Int32 nS, const sal_Int32 nL ) { } +DeleteChar::DeleteChar( const sal_Int32 nPos ) + : SfxHint( SfxHintId::SwDeleteChar ), m_nPos( nPos ) +{ +} + RedlineDelText::RedlineDelText(sal_Int32 const nS, sal_Int32 const nL) : nStart(nS), nLen(nL) { diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index 1de6c91cc633..22a8a0bc0ae1 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -1977,6 +1977,7 @@ void SwTextFrame::SwClientNotify(SwModify const& rModify, SfxHint const& rHint) sw::MoveText const* pMoveText(nullptr); sw::InsertText const* pInsertText(nullptr); sw::DeleteText const* pDeleteText(nullptr); + sw::DeleteChar const* pDeleteChar(nullptr); sw::RedlineDelText const* pRedlineDelText(nullptr); sw::RedlineUnDelText const* pRedlineUnDelText(nullptr); @@ -1996,6 +1997,10 @@ void SwTextFrame::SwClientNotify(SwModify const& rModify, SfxHint const& rHint) { pDeleteText = static_cast<const sw::DeleteText*>(&rHint); } + else if (rHint.GetId() == SfxHintId::SwDeleteChar) + { + pDeleteChar = static_cast<const sw::DeleteChar*>(&rHint); + } else if (auto const pHt = dynamic_cast<sw::MoveText const*>(&rHint)) { pMoveText = pHt; @@ -2211,6 +2216,26 @@ void SwTextFrame::SwClientNotify(SwModify const& rModify, SfxHint const& rHint) lcl_ModifyOfst(*this, nPos, nLen, &o3tl::operator-<sal_Int32, Tag_TextFrameIndex>); } } + else if (pDeleteChar) + { + nPos = MapModelToView(&rNode, pDeleteChar->m_nPos); + if (m_pMergedPara) + { + nLen = UpdateMergedParaForDelete(*m_pMergedPara, true, rNode, pDeleteChar->m_nPos, 1); + } + else + { + nLen = TextFrameIndex(1); + } + lcl_SetWrong( *this, rNode, pDeleteChar->m_nPos, -1, true ); + if (nLen) + { + InvalidateRange( SwCharRange(nPos, nLen), -1 ); + lcl_SetScriptInval( *this, nPos ); + bSetFieldsDirty = bRecalcFootnoteFlag = true; + lcl_ModifyOfst(*this, nPos, nLen, &o3tl::operator-<sal_Int32, Tag_TextFrameIndex>); + } + } else switch (nWhich) { case RES_LINENUMBER: @@ -2219,28 +2244,6 @@ void SwTextFrame::SwClientNotify(SwModify const& rModify, SfxHint const& rHint) InvalidateLineNum(); } break; - case RES_DEL_CHR: - { - sal_Int32 const nNPos = static_cast<const SwDelChr*>(pNew)->nPos; - nPos = MapModelToView(&rNode, nNPos); - if (m_pMergedPara) - { - nLen = UpdateMergedParaForDelete(*m_pMergedPara, true, rNode, nNPos, 1); - } - else - { - nLen = TextFrameIndex(1); - } - lcl_SetWrong( *this, rNode, nNPos, -1, true ); - if (nLen) - { - InvalidateRange( SwCharRange(nPos, nLen), -1 ); - lcl_SetScriptInval( *this, nPos ); - bSetFieldsDirty = bRecalcFootnoteFlag = true; - lcl_ModifyOfst(*this, nPos, nLen, &o3tl::operator-<sal_Int32, Tag_TextFrameIndex>); - } - } - break; case RES_UPDATE_ATTR: { const SwUpdateAttr* pNewUpdate = static_cast<const SwUpdateAttr*>(pNew); diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index d232e3beca7b..12f0a219a8bd 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -2819,14 +2819,13 @@ void SwTextNode::EraseText(const SwContentIndex &rIdx, const sal_Int32 nCount, Update(rIdx, nCnt, UpdateMode::Negative); - if( 1 == nCnt ) + if(1 == nCnt) { - SwDelChr aHint( nStartIdx ); - CallSwClientNotify(sw::LegacyModifyHint(nullptr, &aHint)); - } - else - { - CallSwClientNotify(sw::DeleteText(nStartIdx, nCnt)); + const auto aHint = sw::DeleteChar(nStartIdx); + CallSwClientNotify(aHint); + } else { + const auto aHint = sw::DeleteText(nStartIdx, nCnt); + CallSwClientNotify(aHint); } OSL_ENSURE(rIdx.GetIndex() == nStartIdx, "huh? start index has changed?");