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>
This commit is contained in:
@@ -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
|
||||
|
@@ -142,6 +142,7 @@ enum class SfxHintId {
|
||||
SwNameChanged, // this can possibly be replaced by the generic NameChanged above
|
||||
SwInsertText,
|
||||
SwDeleteText,
|
||||
SwDeleteChar,
|
||||
|
||||
ThisIsAnSdrHint
|
||||
};
|
||||
|
@@ -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
|
||||
|
@@ -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);
|
||||
|
@@ -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
|
||||
{
|
||||
|
@@ -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)
|
||||
{
|
||||
|
@@ -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);
|
||||
|
@@ -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?");
|
||||
|
Reference in New Issue
Block a user