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@libreoffice.org>
This commit is contained in:
@@ -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;
|
||||
|
@@ -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);
|
||||
|
@@ -181,7 +181,7 @@ void SwModify::NotifyClients( const SfxPoolItem* pOldValue, const SfxPoolItem* p
|
||||
return;
|
||||
|
||||
LockModify();
|
||||
ModifyBroadcast( pOldValue, pNewValue );
|
||||
CallSwClientNotify( sw::LegacyModifyHint{ pOldValue, pNewValue } );
|
||||
UnlockModify();
|
||||
}
|
||||
|
||||
|
@@ -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:
|
||||
|
Reference in New Issue
Block a user