[Libreoffice-commits] core.git: sw/inc sw/source
Bjoern Michaelsen (via logerrit)
logerrit at kemper.freedesktop.org
Sun Nov 1 17:56:52 UTC 2020
sw/inc/fchrfmt.hxx | 2 +-
sw/inc/txtatr.hxx | 3 +--
sw/source/core/txtnode/fmtatr2.cxx | 7 ++++---
sw/source/core/txtnode/ndtxt.cxx | 19 ++++++++-----------
sw/source/core/txtnode/txtatr2.cxx | 17 +++++++++--------
5 files changed, 23 insertions(+), 25 deletions(-)
New commits:
commit 38a71843fab65fed60d799bc7572608608bb70e8
Author: Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
AuthorDate: Sun Nov 1 13:33:58 2020 +0100
Commit: Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
CommitDate: Sun Nov 1 18:56:13 2020 +0100
sw/source/core/txtnode: ModifyNotification no more ...
Change-Id: I380b6c173d35865188c6d65f356a6e5d1165bd1e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105138
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
diff --git a/sw/inc/fchrfmt.hxx b/sw/inc/fchrfmt.hxx
index acca285590ea..ef8719103f7c 100644
--- a/sw/inc/fchrfmt.hxx
+++ b/sw/inc/fchrfmt.hxx
@@ -41,7 +41,7 @@ public:
SwFormatCharFormat( const SwFormatCharFormat& rAttr );
private:
- virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) override;
+ virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
/// @@@ public copy ctor, but no copy assignment?
SwFormatCharFormat & operator= (const SwFormatCharFormat &) = delete;
diff --git a/sw/inc/txtatr.hxx b/sw/inc/txtatr.hxx
index fcc25811d63d..0cbd82fb826e 100644
--- a/sw/inc/txtatr.hxx
+++ b/sw/inc/txtatr.hxx
@@ -39,8 +39,7 @@ public:
SwTextCharFormat( SwFormatCharFormat& rAttr, sal_Int32 nStart, sal_Int32 nEnd );
virtual ~SwTextCharFormat( ) override;
- // Passed from SwFormatCharFormat (no derivation from SwClient!).
- void ModifyNotification( const SfxPoolItem*, const SfxPoolItem* );
+ void TriggerNodeUpdate(const sw::LegacyModifyHint&);
bool GetInfo( SfxPoolItem const & rInfo ) const;
// get and set TextNode pointer
diff --git a/sw/source/core/txtnode/fmtatr2.cxx b/sw/source/core/txtnode/fmtatr2.cxx
index 3a3694f3cd84..cf9d57dd79a9 100644
--- a/sw/source/core/txtnode/fmtatr2.cxx
+++ b/sw/source/core/txtnode/fmtatr2.cxx
@@ -84,10 +84,11 @@ SwFormatCharFormat* SwFormatCharFormat::Clone( SfxItemPool* ) const
}
// forward to the TextAttribute
-void SwFormatCharFormat::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
+void SwFormatCharFormat::SwClientNotify(const SwModify&, const SfxHint& rHint)
{
- if( m_pTextAttribute )
- m_pTextAttribute->ModifyNotification( pOld, pNew );
+ auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
+ if(m_pTextAttribute && pLegacy)
+ m_pTextAttribute->TriggerNodeUpdate(*pLegacy);
}
// forward to the TextAttribute
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 951fc6d63012..62cf217563a1 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -759,11 +759,8 @@ SwTextNode *SwTextNode::SplitContentNode(const SwPosition & rPos,
// pasting the frames, but that causes other problems that look
// expensive to solve.
const SfxPoolItem *pItem;
- if( HasWriterListeners() && SfxItemState::SET == pNode->GetSwAttrSet().
- GetItemState( RES_PAGEDESC, true, &pItem ) )
- {
- pNode->ModifyNotification( pItem, pItem );
- }
+ if(HasWriterListeners() && SfxItemState::SET == pNode->GetSwAttrSet().GetItemState(RES_PAGEDESC, true, &pItem))
+ pNode->TriggerNodeUpdate(sw::LegacyModifyHint(pItem, pItem));
}
return pNode;
}
@@ -2484,12 +2481,12 @@ void SwTextNode::CutImpl( SwTextNode * const pDest, const SwIndex & rDestStart,
// notify frames - before moving hints, because footnotes
// want to find their anchor text frame in the follow chain
- SwInsText aInsHint( nDestStart, nLen );
- pDest->ModifyNotification( nullptr, &aInsHint );
- sw::MoveText const moveHint(pDest, nDestStart, nTextStartIdx, nLen);
- CallSwClientNotify(moveHint);
- SwDelText aDelHint( nTextStartIdx, nLen );
- ModifyNotification( nullptr, &aDelHint );
+ SwInsText aInsHint(nDestStart, nLen);
+ pDest->TriggerNodeUpdate(sw::LegacyModifyHint(nullptr, &aInsHint));
+ const sw::MoveText aMoveHint(pDest, nDestStart, nTextStartIdx, nLen);
+ CallSwClientNotify(aMoveHint);
+ const SwDelText aDelHint(nTextStartIdx, nLen);
+ TriggerNodeUpdate(sw::LegacyModifyHint(nullptr, &aDelHint));
// 2. move attributes
// Iterate over attribute array until the start of the attribute
diff --git a/sw/source/core/txtnode/txtatr2.cxx b/sw/source/core/txtnode/txtatr2.cxx
index fff614058984..5c5875610431 100644
--- a/sw/source/core/txtnode/txtatr2.cxx
+++ b/sw/source/core/txtnode/txtatr2.cxx
@@ -49,20 +49,21 @@ SwTextCharFormat::~SwTextCharFormat( )
{
}
-void SwTextCharFormat::ModifyNotification( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
+void SwTextCharFormat::TriggerNodeUpdate(const sw::LegacyModifyHint& 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),
- "SwTextCharFormat::Modify(): unknown Modify");
-
- if ( m_pTextNode )
+ const auto nWhich = rHint.GetWhich();
+ SAL_WARN_IF(
+ !isCHRATR(nWhich) &&
+ RES_OBJECTDYING != nWhich &&
+ RES_ATTRSET_CHG != nWhich &&
+ RES_FMT_CHG != nWhich, "sw.core", "SwTextCharFormat::TriggerNodeUpdate: unknown hint type");
+
+ if(m_pTextNode)
{
SwUpdateAttr aUpdateAttr(
GetStart(),
*GetEnd(),
nWhich);
-
m_pTextNode->TriggerNodeUpdate(sw::LegacyModifyHint(&aUpdateAttr, &aUpdateAttr));
}
}
More information about the Libreoffice-commits
mailing list