25#include <osl/diagnose.h>
39 if (rHint.
GetId() == SfxHintId::SwLegacyModify)
42 if (pLegacyHint->m_pNew && pLegacyHint->m_pNew->Which() ==
RES_OBJECTDYING)
59 : m_pRegisteredIn(
nullptr)
63 o.m_pRegisteredIn->Add(
this);
72 OSL_ENSURE( !m_pRegisteredIn || m_pRegisteredIn->HasWriterListeners(),
"SwModify still known, but Client already disconnected!" );
73 if( m_pRegisteredIn && m_pRegisteredIn->HasWriterListeners() )
74 m_pRegisteredIn->Remove(
this );
86 if(pDead->
pObject != m_pRegisteredIn)
109 assert(GetRegisteredIn() == &rOld);
111 SAL_INFO(
"sw.core",
"reparenting " <<
typeid(*this).name() <<
" at " <<
this <<
" from " <<
typeid(rOld).name() <<
" at " << &rOld <<
" to " <<
typeid(*pNew).name() <<
" at " << pNew);
117 SwClientNotify(rOld, aHint);
122 if (rHint.
GetId() != SfxHintId::SwLegacyModify)
125 CheckRegistration(pLegacyHint->m_pOld);
139 m_pRegisteredIn->Remove(
this);
145 OSL_ENSURE( !IsModifyLocked(),
"Modify destroyed but locked." );
151 const bool hasListenersOnDeath = m_pWriterListeners;
152 (void)hasListenersOnDeath;
153 while(m_pWriterListeners)
155 SAL_WARN(
"sw.core",
"lost a client of type: " <<
typeid(*m_pWriterListeners).name() <<
" at " << m_pWriterListeners <<
" still registered on type: " <<
typeid(*this).name() <<
" at " <<
this <<
".");
156 static_cast<SwClient*
>(m_pWriterListeners)->CheckRegistration(&aDyObject);
158 assert(!hasListenersOnDeath);
163 if(!m_pWriterListeners)
167 if(!pClient->GetInfo( rInfo ))
181 if(!
dynamic_cast<sw::BroadcastingModify*
>(
this))
183 auto pBT = sal::backtrace_get(20);
184 SAL_WARN(
"sw.core",
"Modify that is not broadcasting used!\n" << sal::backtrace_to_string(pBT.get()));
191#if OSL_DEBUG_LEVEL > 0
196 SAL_WARN_IF(&rIter.m_rRoot == m_pWriterListeners,
"sw.core",
"a " <<
typeid(*pDepend).name() <<
" client added as listener to a " <<
typeid(*this).name() <<
" during client iteration.");
204 if( !m_pWriterListeners )
207 m_pWriterListeners = pDepend;
208 m_pWriterListeners->
m_pLeft =
nullptr;
209 m_pWriterListeners->
m_pRight =
nullptr;
215 m_pWriterListeners->
m_pRight = pDepend;
216 pDepend->
m_pLeft = m_pWriterListeners;
234 if( m_pWriterListeners == pDepend )
235 m_pWriterListeners = pL ? pL : pR;
247 if (&rIter.m_rRoot ==
this &&
248 (rIter.m_pCurrent == pDepend || rIter.m_pPosition == pDepend))
252 rIter.m_pPosition = pR;
271 EndListening(
nullptr);
272 m_vDepends.emplace_back(&m_rToTell, pDepend);
278 return std::any_of(m_vDepends.begin(), m_vDepends.end(),
281 return aListener.GetRegisteredIn() == pBroadcaster;
288 std::remove_if( m_vDepends.begin(), m_vDepends.end(),
291 return aListener.GetRegisteredIn() == nullptr || aListener.GetRegisteredIn() == pBroadcaster;
305 if (rHint.
GetId() != SfxHintId::SwLegacyModify)
313 CallSwClientNotify(rHint);
322 pClient->SwClientNotify( *
this, rHint );
325void sw::BroadcastingModify::CallSwClientNotify(
const SfxHint& rHint)
const
328 const_cast<BroadcastingModify*
>(
this)->GetNotifier().Broadcast(rHint);
const SwModify * GetRegisteredIn() const
SwModify * m_pRegisteredIn
event source
virtual void SwClientNotify(const SwModify &, const SfxHint &rHint) override
virtual bool GetInfo(SfxPoolItem &) const
void StartListeningToSameModifyAs(const SwClient &)
std::optional< sw::ModifyChangedHint > CheckRegistration(const SfxPoolItem *pOldValue)
void CheckRegistrationFormat(SwFormat &rOld)
virtual ~SwClient() override
void Add(SwClient *pDepend)
virtual void SwClientNotify(const SwModify &, const SfxHint &rHint) override
virtual void CallSwClientNotify(const SfxHint &rHint) const
virtual ~SwModify() override
SwClient * Remove(SwClient *pDepend)
virtual bool GetInfo(SfxPoolItem &) const override
static SW_DLLPUBLIC ClientIteratorBase * s_pClientIters
virtual void SwClientNotify(const SwModify &rModify, const SfxHint &rHint) override
virtual bool GetInfo(SfxPoolItem &rInfo) const override
get Client information
refactoring out the same of the more sane SwClient functionality
WriterListener * m_pRight
double-linked list of other clients
void EndListening(SwModify *pDepend)
bool IsListeningTo(const SwModify *const pDepend) const
void StartListening(SwModify *pDepend)
WriterMultiListener(SwClient &rToTell)
#define DBG_TESTSOLARMUTEX()
constexpr TypedWhichId< SwPtrMsgPoolItem > RES_OBJECTDYING(RES_FORMAT_MSG_BEGIN)
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
Dialog to specify the properties of date form field.
void ClientNotifyAttrChg(SwModify &rModify, const SwAttrSet &aSet, SwAttrSet &aOld, SwAttrSet &aNew)
virtual ~LegacyModifyHint() override