[Libreoffice-commits] core.git: sw/inc sw/qa sw/source
Bjoern Michaelsen (via logerrit)
logerrit at kemper.freedesktop.org
Thu Nov 5 07:01:49 UTC 2020
sw/inc/calbck.hxx | 4 ----
sw/qa/core/uwriter.cxx | 10 +++++-----
sw/source/core/attr/calbck.cxx | 2 +-
sw/source/core/docnode/section.cxx | 33 +++++++++++++--------------------
4 files changed, 19 insertions(+), 30 deletions(-)
New commits:
commit 2e32f4ed5af16a68c97a50806a42ffa2d10f1d7a
Author: Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
AuthorDate: Wed Nov 4 21:55:31 2020 +0100
Commit: Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
CommitDate: Thu Nov 5 08:01:12 2020 +0100
get rid of long deprecated SwModify::BroadcastModify
Change-Id: I9c65de16bf1f1a604c0045444203a16f30f2833e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105318
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index ee142fd871fe..8550a3be543f 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -192,10 +192,6 @@ public:
// broadcasting: send notifications to all clients
// DO NOT USE IN NEW CODE! use CallSwClientNotify instead.
void NotifyClients( const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue );
- // the same, but without setting m_bModifyLocked or checking for any of the flags
- // DO NOT USE IN NEW CODE! use CallSwClientNotify instead.
- void ModifyBroadcast( const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue)
- { CallSwClientNotify( sw::LegacyModifyHint{ pOldValue, pNewValue } ); };
// a more universal broadcasting mechanism
virtual void CallSwClientNotify( const SfxHint& rHint ) const;
diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx
index 4975d4dde2c5..676811c5baf3 100644
--- a/sw/qa/core/uwriter.cxx
+++ b/sw/qa/core/uwriter.cxx
@@ -1817,7 +1817,7 @@ void SwDocTest::testIntrusiveRing()
namespace
{
struct TestHint final : SfxHint {};
- struct TestModify : SwModify
+ struct TestModify : sw::BroadcastingModify
{
};
struct TestClient : SwClient
@@ -1880,12 +1880,12 @@ void SwDocTest::testClientModify()
CPPUNIT_ASSERT(aMod.HasWriterListeners());
CPPUNIT_ASSERT(!aMod.HasOnlyOneListener());
// test broadcast
- aMod.ModifyBroadcast(nullptr, nullptr);
+ aMod.CallSwClientNotify(sw::LegacyModifyHint(nullptr, nullptr));
CPPUNIT_ASSERT_EQUAL(1,aClient1.m_nModifyCount);
CPPUNIT_ASSERT_EQUAL(1,aClient2.m_nModifyCount);
CPPUNIT_ASSERT_EQUAL(0,aClient1.m_nNotifyCount);
CPPUNIT_ASSERT_EQUAL(0,aClient2.m_nNotifyCount);
- aMod.ModifyBroadcast(nullptr, nullptr);
+ aMod.CallSwClientNotify(sw::LegacyModifyHint(nullptr, nullptr));
CPPUNIT_ASSERT_EQUAL(2,aClient1.m_nModifyCount);
CPPUNIT_ASSERT_EQUAL(2,aClient2.m_nModifyCount);
CPPUNIT_ASSERT_EQUAL(0,aClient1.m_nNotifyCount);
@@ -1953,7 +1953,7 @@ void SwDocTest::testClientModify()
CPPUNIT_ASSERT(false);
}
}
- aMod.ModifyBroadcast(nullptr, nullptr);
+ aMod.CallSwClientNotify(sw::LegacyModifyHint(nullptr, nullptr));
CPPUNIT_ASSERT_EQUAL(2,aClient1.m_nModifyCount);
CPPUNIT_ASSERT_EQUAL(2,aClient2.m_nModifyCount);
CPPUNIT_ASSERT_EQUAL(1,aClient1.m_nNotifyCount);
@@ -1968,7 +1968,7 @@ void SwDocTest::testBroadcastingModify()
aMod.Add(&aClient);
aListener.StartListening(aMod.GetNotifier());
- aMod.ModifyBroadcast(nullptr, nullptr);
+ aMod.CallSwClientNotify(sw::LegacyModifyHint(nullptr, nullptr));
CPPUNIT_ASSERT_EQUAL(1,aClient.m_nModifyCount);
CPPUNIT_ASSERT_EQUAL(1,aClient.m_nModifyCount);
CPPUNIT_ASSERT_EQUAL(1,aListener.m_nNotifyCount);
diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx
index b799f21bbb11..999085404da1 100644
--- a/sw/source/core/attr/calbck.cxx
+++ b/sw/source/core/attr/calbck.cxx
@@ -181,7 +181,7 @@ void SwModify::NotifyClients( const SfxPoolItem* pOldValue, const SfxPoolItem* p
return;
LockModify();
- ModifyBroadcast( pOldValue, pNewValue );
+ CallSwClientNotify( sw::LegacyModifyHint{ pOldValue, pNewValue } );
UnlockModify();
}
diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx
index 430e696c8ab1..e3c20c5230ef 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -743,7 +743,6 @@ void SwSectionFormat::SwClientNotify(const SwModify&, const SfxHint& rHint)
auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
if(!pLegacy)
return;
- bool bClients = false;
sal_uInt16 nWhich = pLegacy->GetWhich();
auto pOld = pLegacy->m_pOld;
auto pNew = pLegacy->m_pNew;
@@ -758,7 +757,7 @@ void SwSectionFormat::SwClientNotify(const SwModify&, const SfxHint& rHint)
if( SfxItemState::SET == pNewSet->GetItemState(
RES_PROTECT, false, &pItem ))
{
- ModifyBroadcast( pItem, pItem );
+ GetNotifier().Broadcast(sw::LegacyModifyHint(pItem, pItem));
pNewSet->ClearItem( RES_PROTECT );
pOldSet->ClearItem( RES_PROTECT );
}
@@ -767,7 +766,7 @@ void SwSectionFormat::SwClientNotify(const SwModify&, const SfxHint& rHint)
if( SfxItemState::SET == pNewSet->GetItemState(
RES_EDIT_IN_READONLY, false, &pItem ) )
{
- ModifyBroadcast( pItem, pItem );
+ GetNotifier().Broadcast(sw::LegacyModifyHint(pItem, pItem));
pNewSet->ClearItem( RES_EDIT_IN_READONLY );
pOldSet->ClearItem( RES_EDIT_IN_READONLY );
}
@@ -775,14 +774,14 @@ void SwSectionFormat::SwClientNotify(const SwModify&, const SfxHint& rHint)
if( SfxItemState::SET == pNewSet->GetItemState(
RES_FTN_AT_TXTEND, false, &pItem ))
{
- ModifyBroadcast( &pOldSet->Get( RES_FTN_AT_TXTEND ), pItem );
+ GetNotifier().Broadcast(sw::LegacyModifyHint(pItem, pItem));
pNewSet->ClearItem( RES_FTN_AT_TXTEND );
pOldSet->ClearItem( RES_FTN_AT_TXTEND );
}
if( SfxItemState::SET == pNewSet->GetItemState(
RES_END_AT_TXTEND, false, &pItem ))
{
- ModifyBroadcast( &pOldSet->Get( RES_END_AT_TXTEND ), pItem );
+ GetNotifier().Broadcast(sw::LegacyModifyHint(pItem, pItem));
pNewSet->ClearItem( RES_END_AT_TXTEND );
pOldSet->ClearItem( RES_END_AT_TXTEND );
}
@@ -791,28 +790,22 @@ void SwSectionFormat::SwClientNotify(const SwModify&, const SfxHint& rHint)
}
break;
- case RES_FTN_AT_TXTEND:
- case RES_END_AT_TXTEND : bClients = true;
- [[fallthrough]];
case RES_SECTION_HIDDEN:
case RES_SECTION_NOT_HIDDEN:
{
- SwSection* pSect = GetSection();
- if( pSect && ( bClients || ( RES_SECTION_HIDDEN == nWhich ?
- !pSect->IsHiddenFlag() : pSect->IsHiddenFlag() ) ) )
- {
- ModifyBroadcast( pOld, pNew );
- }
+ auto pSect = GetSection();
+ if(!pSect || (RES_SECTION_HIDDEN == nWhich) == pSect->IsHiddenFlag()) // already at target state, skipping.
+ return;
}
- return ;
-
+ [[fallthrough]];
+ case RES_FTN_AT_TXTEND:
+ case RES_END_AT_TXTEND:
+ GetNotifier().Broadcast(sw::LegacyModifyHint(pOld, pNew));
+ return;
case RES_PROTECT:
case RES_EDIT_IN_READONLY: // edit in readonly sections
// Pass through these Messages until the End of the tree!
- if( HasWriterListeners() )
- {
- ModifyBroadcast( pOld, pNew );
- }
+ GetNotifier().Broadcast(sw::LegacyModifyHint(pOld, pNew));
return; // That's it!
case RES_OBJECTDYING:
More information about the Libreoffice-commits
mailing list