summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@libreoffice.org>2022-09-25 11:34:10 +0200
committerBjoern Michaelsen <bjoern.michaelsen@libreoffice.org>2022-09-25 20:01:53 +0200
commiteb1294a60783ceb450cefd6891d6eafa0021aadc (patch)
tree25470a6789c0bef04bf071f7e18e9194c78b1284 /sw
parentb0cab944460816b96921bf4efd76e25d1cf75816 (diff)
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.michaelsen@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/hintids.hxx2
-rw-r--r--sw/inc/hints.hxx15
-rw-r--r--sw/source/core/attr/hints.cxx10
-rw-r--r--sw/source/core/text/txtfrm.cxx47
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx13
5 files changed, 44 insertions, 43 deletions
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?");