summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/hints.hxx13
-rw-r--r--sw/source/core/attr/hints.cxx9
-rw-r--r--sw/source/core/doc/docredln.cxx10
-rw-r--r--sw/source/core/text/txtfrm.cxx51
4 files changed, 77 insertions, 6 deletions
diff --git a/sw/inc/hints.hxx b/sw/inc/hints.hxx
index 4da6408dfe99..dc31d7424756 100644
--- a/sw/inc/hints.hxx
+++ b/sw/inc/hints.hxx
@@ -93,6 +93,19 @@ public:
SwDelText( sal_Int32 nS, sal_Int32 nL );
};
+namespace sw {
+
+class RedlineDelText : public SfxHint
+{
+public:
+ sal_Int32 nStart;
+ sal_Int32 nLen;
+
+ RedlineDelText(sal_Int32 nS, sal_Int32 nL);
+};
+
+}
+
class SwUpdateAttr : public SwMsgPoolItem
{
private:
diff --git a/sw/source/core/attr/hints.cxx b/sw/source/core/attr/hints.cxx
index 678db2590528..44c60ff0fd17 100644
--- a/sw/source/core/attr/hints.cxx
+++ b/sw/source/core/attr/hints.cxx
@@ -46,6 +46,15 @@ SwDelText::SwDelText( sal_Int32 nS, sal_Int32 nL )
{
}
+namespace sw {
+
+RedlineDelText::RedlineDelText(sal_Int32 const nS, sal_Int32 const nL)
+ : nStart(nS), nLen(nL)
+{
+}
+
+} // namespace sw
+
SwUpdateAttr::SwUpdateAttr( sal_Int32 nS, sal_Int32 nE, sal_uInt16 nW )
: SwMsgPoolItem( RES_UPDATE_ATTR ), m_nStart( nS ), m_nEnd( nE ), m_nWhichAttr( nW )
{
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index c5731c36c457..1e31e7150324 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -1269,12 +1269,22 @@ void SwRangeRedline::InvalidateRange() // trigger the Layout
if (pNode && pNode->IsTextNode())
{
SwTextNode* pNd = pNode->GetTextNode();
+
SwUpdateAttr aHt(
n == nSttNd ? nSttCnt : 0,
n == nEndNd ? nEndCnt : pNd->GetText().getLength(),
RES_FMT_CHG);
pNd->ModifyNotification(&aHt, &aHt);
+
+ // SwUpdateAttr must be handled first, otherwise indexes are off
+ if (GetType() == nsRedlineType_t::REDLINE_DELETE)
+ {
+ sal_Int32 const nStart(n == nSttNd ? nSttCnt : 0);
+ sw::RedlineDelText const hint(nStart,
+ (n == nEndNd ? nEndCnt : pNd->GetText().getLength()) - nStart);
+ pNd->CallSwClientNotify(hint);
+ }
}
}
}
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index bbfa87e52839..39a0c8262925 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -1543,18 +1543,30 @@ static bool isA11yRelevantAttribute(sal_uInt16 nWhich)
// SwContentFrame::Modify() when appropriate.
void SwTextFrame::SwClientNotify(SwModify const& rModify, SfxHint const& rHint)
{
- auto const pHint(dynamic_cast<sw::LegacyModifyHint const*>(&rHint));
- assert(pHint); // TODO this is the only type expected here for now
+ SfxPoolItem const* pOld(nullptr);
+ SfxPoolItem const* pNew(nullptr);
+ sw::RedlineDelText const* pRedlineDelText(nullptr);
- SfxPoolItem const*const pOld(pHint->m_pOld);
- SfxPoolItem const*const pNew(pHint->m_pNew);
- SwTextNode const& rNode(static_cast<SwTextNode const&>(rModify));
+ if (auto const pHint = dynamic_cast<sw::LegacyModifyHint const*>(&rHint))
+ {
+ pOld = pHint->m_pOld;
+ pNew = pHint->m_pNew;
+ }
+ else if (auto const pHynt = dynamic_cast<sw::RedlineDelText const*>(&rHint))
+ {
+ pRedlineDelText = pHynt;
+ }
+ else
+ {
+ assert(!"unexpected hint");
+ }
if (m_pMergedPara)
{
assert(m_pMergedPara->listener.IsListeningTo(&rModify));
}
+ SwTextNode const& rNode(static_cast<SwTextNode const&>(rModify));
const sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
// modifications concerning frame attributes are processed by the base class
@@ -1606,7 +1618,34 @@ void SwTextFrame::SwClientNotify(SwModify const& rModify, SfxHint const& rHint)
bool bSetFieldsDirty = false;
bool bRecalcFootnoteFlag = false;
- switch( nWhich )
+ if (pRedlineDelText)
+ {
+ if (m_pMergedPara)
+ {
+ sal_Int32 const nNPos = pRedlineDelText->nStart;
+ sal_Int32 const nNLen = pRedlineDelText->nLen;
+ nPos = MapModelToView(&rNode, nNPos);
+ // update merged before doing anything else
+ nLen = UpdateMergedParaForDelete(*m_pMergedPara, false, rNode, nNPos, nNLen);
+ const sal_Int32 m = -nNLen;
+ if (nLen && IsIdxInside(nPos, nLen))
+ {
+ if (!nLen)
+ InvalidateSize();
+ else
+ InvalidateRange( SwCharRange(nPos, TextFrameIndex(1)), m );
+ }
+ lcl_SetWrong( *this, rNode, nNPos, m, true );
+ if (nLen)
+ {
+ lcl_SetScriptInval( *this, nPos );
+ bSetFieldsDirty = bRecalcFootnoteFlag = true;
+ if (HasFollow())
+ lcl_ModifyOfst( this, nPos, nLen );
+ }
+ }
+ }
+ else switch (nWhich)
{
case RES_LINENUMBER:
{