sw/inc/calbck.hxx | 98 ++++++++++++++++++-------------------- sw/inc/switerator.hxx | 41 +++++++++++++-- sw/source/core/fields/ddetbl.cxx | 3 - sw/source/core/layout/atrfrm.cxx | 3 - sw/source/core/layout/sectfrm.cxx | 1 sw/source/core/txtnode/atrfld.cxx | 3 - sw/source/core/txtnode/ndtxt.cxx | 1 7 files changed, 90 insertions(+), 60 deletions(-)
New commits: commit 7ea33ed5622961342a793d6df2dba0f2e962999a Author: Bjoern Michaelsen <bjoern.michael...@canonical.com> Date: Sat Mar 14 21:21:04 2015 +0100 remove 'shortcut' that is longer than the original Change-Id: Id038f22e4c334cdcd56e1638d9d212b0dd1fa8b3 diff --git a/sw/inc/switerator.hxx b/sw/inc/switerator.hxx index 440c4e6..499c6e18 100644 --- a/sw/inc/switerator.hxx +++ b/sw/inc/switerator.hxx @@ -62,7 +62,6 @@ public: aClientIter.m_pPosition = aClientIter.GetLeftOfPos(); return PTR_CAST(TElementType,aClientIter.m_pCurrent = aClientIter.m_pPosition); } - static TElementType* FirstElement( const TSource& rMod ) { return SwIterator<TElementType, TSource>(rMod).First(); } bool IsChanged() { return aClientIter.IsChanged(); } }; commit b0dae8c4c57aa50bbff7b3fd4d84476636bf1677 Author: Bjoern Michaelsen <bjoern.michael...@canonical.com> Date: Sat Mar 14 19:56:49 2015 +0100 Fixes for moving stuff to SwIterator Change-Id: I834afb711920e480045a9f932770dab27dd1f3ad diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx index 5aab4dd..88a9cb0 100644 --- a/sw/inc/calbck.hxx +++ b/sw/inc/calbck.hxx @@ -257,6 +257,8 @@ class SwClientIter SAL_FINAL : public sw::Ring<SwClientIter> // is marked down to become the current object in the next step // this is necessary because iteration requires access to members of the current object SwClient* m_pPosition; + SwClient* GetLeftOfPos() { return static_cast<SwClient*>(m_pPosition->m_pLeft); } + SwClient* GetRighOfPos() { return static_cast<SwClient*>(m_pPosition->m_pRight); } // iterator can be limited to return only SwClient objects of a certain type TypeId m_aSearchType; @@ -330,8 +332,16 @@ SwClient::SwClient( SwModify* pToRegisterIn ) void SwModify::ModifyBroadcast( const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue, TypeId nType) { SwClientIter aIter(*this); - for(aIter.First(nType); aIter; aIter.Next()) + aIter.GoStart(); + while(aIter) + { + if( aIter.m_pPosition == aIter.m_pCurrent ) + aIter.m_pPosition = static_cast<SwClient*>(aIter.m_pPosition->m_pRight); + while(aIter.m_pPosition && !aIter.m_pPosition->IsA( nType ) ) + aIter.m_pPosition = static_cast<SwClient*>(aIter.m_pPosition->m_pRight); + aIter.m_pCurrent = aIter.m_pPosition; aIter->Modify( pOldValue, pNewValue ); + } } void SwModify::CallSwClientNotify( const SfxHint& rHint ) const diff --git a/sw/inc/switerator.hxx b/sw/inc/switerator.hxx index 4a9f277..440c4e6 100644 --- a/sw/inc/switerator.hxx +++ b/sw/inc/switerator.hxx @@ -35,34 +35,34 @@ public: if(!aClientIter.m_pPosition) return nullptr; aClientIter.m_pCurrent = nullptr; - return PTR_CAST(TElementType,aClientIter.Next()); + return Next(); } TElementType* Last() { aClientIter.m_aSearchType = TYPE(TElementType); - GoEnd(); + aClientIter.GoEnd(); if(!aClientIter.m_pPosition) return nullptr; - if(aClientIter.m_pPosition->IsA(TYPE(TElementType)) + if(aClientIter.m_pPosition->IsA(TYPE(TElementType))) return PTR_CAST(TElementType,aClientIter.m_pPosition); - return PTR_CAST(TElementType,aClientIter.Previous()); + return Previous(); } TElementType* Next() { if( aClientIter.m_pPosition == aClientIter.m_pCurrent ) - aClientIter.m_pPosition = static_cast<SwClient*>(aClientIter.m_pPosition->m_pRight); + aClientIter.m_pPosition = aClientIter.GetRighOfPos(); while(aClientIter.m_pPosition && !aClientIter.m_pPosition->IsA( TYPE(TElementType) ) ) - aClientIter.m_pPosition = static_cast<SwClient*>(aClientIter.m_pPosition->m_pRight); + aClientIter.m_pPosition = aClientIter.GetRighOfPos(); return PTR_CAST(TElementType,aClientIter.m_pCurrent = aClientIter.m_pPosition); } TElementType* Previous() { - aClientIter.m_pPosition = static_cast<SwClient*>(aClientIter.m_pPosition->m_pLeft); + aClientIter.m_pPosition = aClientIter.GetLeftOfPos(); while(aClientIter.m_pPosition && !aClientIter.m_pPosition->IsA( TYPE(TElementType) ) ) - aClientIter.m_pPosition = static_cast<SwClient*>(aClientIter.m_pPosition->m_pLeft); + aClientIter.m_pPosition = aClientIter.GetLeftOfPos(); return PTR_CAST(TElementType,aClientIter.m_pCurrent = aClientIter.m_pPosition); } - static TElementType* FirstElement( const TSource& rMod ) { SwClient* p = SwClientIter(rMod).First(TYPE(TElementType)); return PTR_CAST(TElementType,p); } + static TElementType* FirstElement( const TSource& rMod ) { return SwIterator<TElementType, TSource>(rMod).First(); } bool IsChanged() { return aClientIter.IsChanged(); } }; commit 059b2b0385e632459c3f0a7c110b7a5ab6b6ce51 Author: Bjoern Michaelsen <bjoern.michael...@canonical.com> Date: Sat Mar 14 19:06:29 2015 +0100 Move SwClientIter::Previous() to SwIterator Change-Id: Idd1f794f81612d7593095a230580234cdce30725 diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx index bde2e5b..5aab4dd 100644 --- a/sw/inc/calbck.hxx +++ b/sw/inc/calbck.hxx @@ -263,14 +263,6 @@ class SwClientIter SAL_FINAL : public sw::Ring<SwClientIter> static SW_DLLPUBLIC SwClientIter* our_pClientIters; - SwClient* Previous() - { - m_pPosition = static_cast<SwClient*>(m_pPosition->m_pLeft); - while(m_pPosition && !m_pPosition->IsA( m_aSearchType ) ) - m_pPosition = static_cast<SwClient*>(m_pPosition->m_pLeft); - return m_pCurrent = m_pPosition; - } - public: SwClientIter( const SwModify& rModify ) : m_rRoot(rModify) diff --git a/sw/inc/switerator.hxx b/sw/inc/switerator.hxx index fd943ba..4a9f277 100644 --- a/sw/inc/switerator.hxx +++ b/sw/inc/switerator.hxx @@ -55,7 +55,13 @@ public: aClientIter.m_pPosition = static_cast<SwClient*>(aClientIter.m_pPosition->m_pRight); return PTR_CAST(TElementType,aClientIter.m_pCurrent = aClientIter.m_pPosition); } - TElementType* Previous() { SwClient* p = aClientIter.Previous(); return PTR_CAST(TElementType,p); } + TElementType* Previous() + { + aClientIter.m_pPosition = static_cast<SwClient*>(aClientIter.m_pPosition->m_pLeft); + while(aClientIter.m_pPosition && !aClientIter.m_pPosition->IsA( TYPE(TElementType) ) ) + aClientIter.m_pPosition = static_cast<SwClient*>(aClientIter.m_pPosition->m_pLeft); + return PTR_CAST(TElementType,aClientIter.m_pCurrent = aClientIter.m_pPosition); + } static TElementType* FirstElement( const TSource& rMod ) { SwClient* p = SwClientIter(rMod).First(TYPE(TElementType)); return PTR_CAST(TElementType,p); } bool IsChanged() { return aClientIter.IsChanged(); } }; commit 32d322a133960a0533403581df1ba7251b7dc700 Author: Bjoern Michaelsen <bjoern.michael...@canonical.com> Date: Sat Mar 14 19:01:48 2015 +0100 Move SwClientIter::Next() to SwIterator Change-Id: I7e0a9d1a02fa91fd2d685c3c6c1c3340be5cf41d diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx index 81dc181..bde2e5b 100644 --- a/sw/inc/calbck.hxx +++ b/sw/inc/calbck.hxx @@ -263,15 +263,6 @@ class SwClientIter SAL_FINAL : public sw::Ring<SwClientIter> static SW_DLLPUBLIC SwClientIter* our_pClientIters; - SwClient* Next() - { - if( m_pPosition == m_pCurrent ) - m_pPosition = static_cast<SwClient*>(m_pPosition->m_pRight); - while(m_pPosition && !m_pPosition->IsA( m_aSearchType ) ) - m_pPosition = static_cast<SwClient*>(m_pPosition->m_pRight); - return m_pCurrent = m_pPosition; - } - SwClient* Previous() { m_pPosition = static_cast<SwClient*>(m_pPosition->m_pLeft); diff --git a/sw/inc/switerator.hxx b/sw/inc/switerator.hxx index a054d07..fd943ba 100644 --- a/sw/inc/switerator.hxx +++ b/sw/inc/switerator.hxx @@ -47,7 +47,14 @@ public: return PTR_CAST(TElementType,aClientIter.m_pPosition); return PTR_CAST(TElementType,aClientIter.Previous()); } - TElementType* Next() { SwClient* p = aClientIter.Next(); return PTR_CAST(TElementType,p); } + TElementType* Next() + { + if( aClientIter.m_pPosition == aClientIter.m_pCurrent ) + aClientIter.m_pPosition = static_cast<SwClient*>(aClientIter.m_pPosition->m_pRight); + while(aClientIter.m_pPosition && !aClientIter.m_pPosition->IsA( TYPE(TElementType) ) ) + aClientIter.m_pPosition = static_cast<SwClient*>(aClientIter.m_pPosition->m_pRight); + return PTR_CAST(TElementType,aClientIter.m_pCurrent = aClientIter.m_pPosition); + } TElementType* Previous() { SwClient* p = aClientIter.Previous(); return PTR_CAST(TElementType,p); } static TElementType* FirstElement( const TSource& rMod ) { SwClient* p = SwClientIter(rMod).First(TYPE(TElementType)); return PTR_CAST(TElementType,p); } bool IsChanged() { return aClientIter.IsChanged(); } commit a583f445cfca85bd9a8692154774d08f28d9a508 Author: Bjoern Michaelsen <bjoern.michael...@canonical.com> Date: Sat Mar 14 18:52:36 2015 +0100 Move SwClientIter::Last() to SwIterator Change-Id: I7ec3feaec7a07871a3470f7f41dd203fa0f83fd0 diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx index 798b4b6..81dc181 100644 --- a/sw/inc/calbck.hxx +++ b/sw/inc/calbck.hxx @@ -263,16 +263,6 @@ class SwClientIter SAL_FINAL : public sw::Ring<SwClientIter> static SW_DLLPUBLIC SwClientIter* our_pClientIters; - SwClient* Last( TypeId nType ) - { - m_aSearchType = nType; - GoEnd(); - if(!m_pPosition) - return nullptr; - if( m_pPosition->IsA( m_aSearchType ) ) - return m_pPosition; - return Previous(); - } SwClient* Next() { if( m_pPosition == m_pCurrent ) diff --git a/sw/inc/switerator.hxx b/sw/inc/switerator.hxx index 3a6a126..a054d07 100644 --- a/sw/inc/switerator.hxx +++ b/sw/inc/switerator.hxx @@ -37,7 +37,16 @@ public: aClientIter.m_pCurrent = nullptr; return PTR_CAST(TElementType,aClientIter.Next()); } - TElementType* Last() { SwClient* p = aClientIter.Last( TYPE(TElementType)); return PTR_CAST(TElementType,p); } + TElementType* Last() + { + aClientIter.m_aSearchType = TYPE(TElementType); + GoEnd(); + if(!aClientIter.m_pPosition) + return nullptr; + if(aClientIter.m_pPosition->IsA(TYPE(TElementType)) + return PTR_CAST(TElementType,aClientIter.m_pPosition); + return PTR_CAST(TElementType,aClientIter.Previous()); + } TElementType* Next() { SwClient* p = aClientIter.Next(); return PTR_CAST(TElementType,p); } TElementType* Previous() { SwClient* p = aClientIter.Previous(); return PTR_CAST(TElementType,p); } static TElementType* FirstElement( const TSource& rMod ) { SwClient* p = SwClientIter(rMod).First(TYPE(TElementType)); return PTR_CAST(TElementType,p); } commit 82a0260f9e9ea88301ace2cf8dfa15368f089c74 Author: Bjoern Michaelsen <bjoern.michael...@canonical.com> Date: Sat Mar 14 18:46:41 2015 +0100 move SwClientIter::First() to SwIterator Change-Id: I165dfaf2894352ad6610855ae9a18bd553ef07be diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx index f2ea656..798b4b6 100644 --- a/sw/inc/calbck.hxx +++ b/sw/inc/calbck.hxx @@ -263,15 +263,6 @@ class SwClientIter SAL_FINAL : public sw::Ring<SwClientIter> static SW_DLLPUBLIC SwClientIter* our_pClientIters; - SwClient* First( TypeId nType ) - { - m_aSearchType = nType; - GoStart(); - if(!m_pPosition) - return nullptr; - m_pCurrent = nullptr; - return Next(); - } SwClient* Last( TypeId nType ) { m_aSearchType = nType; diff --git a/sw/inc/switerator.hxx b/sw/inc/switerator.hxx index 9cefc92..3a6a126 100644 --- a/sw/inc/switerator.hxx +++ b/sw/inc/switerator.hxx @@ -28,7 +28,15 @@ template< class TElementType, class TSource > class SwIterator SAL_FINAL public: SwIterator( const TSource& rSrc ) : aClientIter(rSrc) { assert(TElementType::IsOf( TYPE(SwClient) )); } - TElementType* First() { SwClient* p = aClientIter.First(TYPE(TElementType)); return PTR_CAST(TElementType,p); } + TElementType* First() + { + aClientIter.m_aSearchType = TYPE(TElementType); + aClientIter.GoStart(); + if(!aClientIter.m_pPosition) + return nullptr; + aClientIter.m_pCurrent = nullptr; + return PTR_CAST(TElementType,aClientIter.Next()); + } TElementType* Last() { SwClient* p = aClientIter.Last( TYPE(TElementType)); return PTR_CAST(TElementType,p); } TElementType* Next() { SwClient* p = aClientIter.Next(); return PTR_CAST(TElementType,p); } TElementType* Previous() { SwClient* p = aClientIter.Previous(); return PTR_CAST(TElementType,p); } commit 0c2731410ebd8b4414d07b9daf11b3e70f48e1fb Author: Bjoern Michaelsen <bjoern.michael...@canonical.com> Date: Sat Mar 14 18:40:57 2015 +0100 assert hard here Change-Id: Ie8eba16f0696f80748ed6ea64bef02d6f015a5ff diff --git a/sw/inc/switerator.hxx b/sw/inc/switerator.hxx index 9df5906..9cefc92 100644 --- a/sw/inc/switerator.hxx +++ b/sw/inc/switerator.hxx @@ -27,7 +27,7 @@ template< class TElementType, class TSource > class SwIterator SAL_FINAL SwClientIter aClientIter; public: - SwIterator( const TSource& rSrc ) : aClientIter(rSrc) { SAL_WARN_IF( !TElementType::IsOf( TYPE(SwClient) ), "sw", "Incompatible types!" ); } + SwIterator( const TSource& rSrc ) : aClientIter(rSrc) { assert(TElementType::IsOf( TYPE(SwClient) )); } TElementType* First() { SwClient* p = aClientIter.First(TYPE(TElementType)); return PTR_CAST(TElementType,p); } TElementType* Last() { SwClient* p = aClientIter.Last( TYPE(TElementType)); return PTR_CAST(TElementType,p); } TElementType* Next() { SwClient* p = aClientIter.Next(); return PTR_CAST(TElementType,p); } commit d7ab0bc37ee62d6006abe8c2a281ba9975c08770 Author: Bjoern Michaelsen <bjoern.michael...@canonical.com> Date: Sat Mar 14 18:37:17 2015 +0100 make typed iteration private in SwClientIter now Change-Id: If3887cd7a126834a8c3bfd156dc25335229d929b diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx index 6e1a1cc..f2ea656 100644 --- a/sw/inc/calbck.hxx +++ b/sw/inc/calbck.hxx @@ -64,6 +64,8 @@ class SfxHint; class SwModify; class SwClient; class SwClientIter; +template<typename E, typename S> class SwIterator; + namespace sw { struct LegacyModifyHint SAL_FINAL: SfxHint @@ -241,8 +243,10 @@ protected: class SwClientIter SAL_FINAL : public sw::Ring<SwClientIter> { - friend SwClient* SwModify::Remove(SwClient *); ///< for pointer adjustments - friend void SwModify::Add(SwClient *pDepend); ///< for pointer adjustments + friend SwClient* SwModify::Remove(SwClient*); ///< for pointer adjustments + friend void SwModify::Add(SwClient*); ///< for pointer adjustments + template<typename E, typename S> friend class SwIterator; ///< for typed interation + friend void SwModify::ModifyBroadcast( const SfxPoolItem*, const SfxPoolItem*, TypeId); ///< for typed iteration const SwModify& m_rRoot; @@ -259,6 +263,42 @@ class SwClientIter SAL_FINAL : public sw::Ring<SwClientIter> static SW_DLLPUBLIC SwClientIter* our_pClientIters; + SwClient* First( TypeId nType ) + { + m_aSearchType = nType; + GoStart(); + if(!m_pPosition) + return nullptr; + m_pCurrent = nullptr; + return Next(); + } + SwClient* Last( TypeId nType ) + { + m_aSearchType = nType; + GoEnd(); + if(!m_pPosition) + return nullptr; + if( m_pPosition->IsA( m_aSearchType ) ) + return m_pPosition; + return Previous(); + } + SwClient* Next() + { + if( m_pPosition == m_pCurrent ) + m_pPosition = static_cast<SwClient*>(m_pPosition->m_pRight); + while(m_pPosition && !m_pPosition->IsA( m_aSearchType ) ) + m_pPosition = static_cast<SwClient*>(m_pPosition->m_pRight); + return m_pCurrent = m_pPosition; + } + + SwClient* Previous() + { + m_pPosition = static_cast<SwClient*>(m_pPosition->m_pLeft); + while(m_pPosition && !m_pPosition->IsA( m_aSearchType ) ) + m_pPosition = static_cast<SwClient*>(m_pPosition->m_pLeft); + return m_pCurrent = m_pPosition; + } + public: SwClientIter( const SwModify& rModify ) : m_rRoot(rModify) @@ -314,42 +354,6 @@ public: // adding objects to a client chain in iteration is forbidden // SwModify::Add() asserts this bool IsChanged() const { return m_pPosition != m_pCurrent; } - - SwClient* First( TypeId nType ) - { - m_aSearchType = nType; - GoStart(); - if(!m_pPosition) - return nullptr; - m_pCurrent = nullptr; - return Next(); - } - SwClient* Last( TypeId nType ) - { - m_aSearchType = nType; - GoEnd(); - if(!m_pPosition) - return nullptr; - if( m_pPosition->IsA( m_aSearchType ) ) - return m_pPosition; - return Previous(); - } - SwClient* Next() - { - if( m_pPosition == m_pCurrent ) - m_pPosition = static_cast<SwClient*>(m_pPosition->m_pRight); - while(m_pPosition && !m_pPosition->IsA( m_aSearchType ) ) - m_pPosition = static_cast<SwClient*>(m_pPosition->m_pRight); - return m_pCurrent = m_pPosition; - } - - SwClient* Previous() - { - m_pPosition = static_cast<SwClient*>(m_pPosition->m_pLeft); - while(m_pPosition && !m_pPosition->IsA( m_aSearchType ) ) - m_pPosition = static_cast<SwClient*>(m_pPosition->m_pLeft); - return m_pCurrent = m_pPosition; - } }; SwClient::SwClient( SwModify* pToRegisterIn ) commit 1fb1016eca1d8e9f43baad18bf7228913aa29715 Author: Bjoern Michaelsen <bjoern.michael...@canonical.com> Date: Sat Mar 14 17:41:46 2015 +0100 Pipe legacy Modify calls through SwClientModify Change-Id: Ic55abdee0486021d8361271fabec9fcaa06c3502 diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx index 89f9f75..6e1a1cc 100644 --- a/sw/inc/calbck.hxx +++ b/sw/inc/calbck.hxx @@ -26,6 +26,7 @@ #include <ring.hxx> #include <hintids.hxx> #include <hints.hxx> +#include <typeinfo> class SwModify; @@ -65,6 +66,12 @@ class SwClient; class SwClientIter; namespace sw { + struct LegacyModifyHint SAL_FINAL: SfxHint + { + LegacyModifyHint(const SfxPoolItem* pOld, const SfxPoolItem* pNew) : m_pOld(pOld), m_pNew(pNew) {}; + const SfxPoolItem* m_pOld; + const SfxPoolItem* m_pNew; + }; /// refactoring out the some of the more sane SwClient functionality class SW_DLLPUBLIC WriterListener : ::boost::noncopyable { @@ -79,11 +86,7 @@ namespace sw : m_pLeft(nullptr), m_pRight(nullptr) {} virtual ~WriterListener() {}; - // callbacks received from SwModify (friend class - so these methods can be private) - // should be called only from SwModify the client is registered in - // mba: IMHO these methods should be pure virtual - virtual void Modify(const SfxPoolItem*, const SfxPoolItem*) {}; - virtual void SwClientNotify( const SwModify&, const SfxHint&) {}; + virtual void SwClientNotify( const SwModify&, const SfxHint& rHint) =0; public: bool IsLast() const { return !m_pLeft && !m_pRight; } }; @@ -108,8 +111,20 @@ public: SwClient() : pRegisteredIn(nullptr) {} virtual ~SwClient() SAL_OVERRIDE; + // callbacks received from SwModify (friend class - so these methods can be private) + // should be called only from SwModify the client is registered in + // mba: IMHO this method should be pure virtual + // DO NOT USE IN NEW CODE! use SwClientNotify instead. virtual void Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue ) SAL_OVERRIDE { CheckRegistration( pOldValue, pNewValue ); } + // when overriding this, you MUST call SwClient::SwClientModify() in the override! + virtual void SwClientNotify( const SwModify&, const SfxHint& rHint) + { + // assuming the compiler to realize that a dynamic_cast to a final class is just a pointer compare ... + auto pLegacyHint(dynamic_cast<const sw::LegacyModifyHint*>(&rHint)); + if(pLegacyHint) + Modify(pLegacyHint->m_pOld, pLegacyHint->m_pNew); + }; // in case an SwModify object is destroyed that itself is registered in another SwModify, // its SwClient objects can decide to get registered to the latter instead by calling this method @@ -144,6 +159,7 @@ class SW_DLLPUBLIC SwModify: public SwClient bool bInSwFntCache : 1; // mba: IMHO this method should be pure virtual + // DO NOT USE IN NEW CODE! use CallSwClientNotify instead. virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) SAL_OVERRIDE { NotifyClients( pOld, pNew ); }; @@ -151,23 +167,25 @@ public: SwModify() : SwClient(nullptr), pRoot(nullptr), bModifyLocked(false), bLockClientList(false), bInDocDTOR(false), bInCache(false), bInSwFntCache(false) {} + explicit SwModify( SwModify* pToRegisterIn ) + : SwClient(pToRegisterIn), pRoot(nullptr), bModifyLocked(false), bLockClientList(false), bInDocDTOR(false), bInCache(false), bInSwFntCache(false) + {} // broadcasting: send notifications to all clients + // DO NOT USE IN NEW CODE! use CallSwClientNotify instead. void NotifyClients( const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue ); - + // DO NOT USE IN NEW CODE! use CallSwClientNotify instead. + void ModifyBroadcast( const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue) + { CallSwClientNotify( sw::LegacyModifyHint{ pOldValue, pNewValue } ); }; // the same, but without setting bModifyLocked or checking for any of the flags // mba: it would be interesting to know why this is necessary // also allows to limit callback to certain type (HACK) - inline void ModifyBroadcast( const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue, TypeId nType = TYPE(SwClient) ); + // DO NOT USE IN NEW CODE! use CallSwClientNotify instead. + inline void ModifyBroadcast( const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue, TypeId nType ); // a more universal broadcasting mechanism inline void CallSwClientNotify( const SfxHint& rHint ) const; - // single argument ctors shall be explicit. - explicit SwModify( SwModify* pToRegisterIn ) - : SwClient(pToRegisterIn), pRoot(nullptr), bModifyLocked(false), bLockClientList(false), bInDocDTOR(false), bInCache(false), bInSwFntCache(false) - {} - virtual ~SwModify(); void Add(SwClient *pDepend); diff --git a/sw/source/core/fields/ddetbl.cxx b/sw/source/core/fields/ddetbl.cxx index be1212d..277438e 100644 --- a/sw/source/core/fields/ddetbl.cxx +++ b/sw/source/core/fields/ddetbl.cxx @@ -86,8 +86,9 @@ void SwDDETable::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) SwTable::Modify( pOld, pNew ); } -void SwDDETable::SwClientNotify( const SwModify&, const SfxHint& rHint ) +void SwDDETable::SwClientNotify( const SwModify& rModify, const SfxHint& rHint ) { + SwClient::SwClientNotify(rModify, rHint); const SwFieldHint* pHint = dynamic_cast<const SwFieldHint*>( &rHint ); if ( pHint ) // replace DDETable by real table diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index d93118f..c1d3ae6 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -628,8 +628,9 @@ SfxPoolItem* SwFmtPageDesc::Clone( SfxItemPool* ) const return new SwFmtPageDesc( *this ); } -void SwFmtPageDesc::SwClientNotify( const SwModify&, const SfxHint& rHint ) +void SwFmtPageDesc::SwClientNotify( const SwModify& rModify, const SfxHint& rHint ) { + SwClient::SwClientNotify(rModify, rHint); const SwPageDescHint* pHint = dynamic_cast<const SwPageDescHint*>(&rHint); if ( pHint ) { diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx index f0a6c85..e719b88 100644 --- a/sw/source/core/layout/sectfrm.cxx +++ b/sw/source/core/layout/sectfrm.cxx @@ -2283,6 +2283,7 @@ void SwSectionFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew ) void SwSectionFrm::SwClientNotify( const SwModify& rMod, const SfxHint& rHint ) { + SwClient::SwClientNotify(rMod, rHint); // #i117863# const SwSectionFrmMoveAndDeleteHint* pHint = dynamic_cast<const SwSectionFrmMoveAndDeleteHint*>(&rHint); diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx index bf45bba..34aee5e 100644 --- a/sw/source/core/txtnode/atrfld.cxx +++ b/sw/source/core/txtnode/atrfld.cxx @@ -204,8 +204,9 @@ void SwFmtFld::InvalidateField() NotifyClients(&item, &item); } -void SwFmtFld::SwClientNotify( const SwModify&, const SfxHint& rHint ) +void SwFmtFld::SwClientNotify( const SwModify& rModify, const SfxHint& rHint ) { + SwClient::SwClientNotify(rModify, rHint); if( !mpTxtFld ) return; diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 55bdf18..308004b 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -5069,6 +5069,7 @@ bool SwTxtNode::IsInContent() const void SwTxtNode::SwClientNotify( const SwModify& rModify, const SfxHint& rHint ) { + SwClient::SwClientNotify(rModify, rHint); const SwAttrHint* pHint = dynamic_cast<const SwAttrHint*>(&rHint); if ( pHint && pHint->GetId() == RES_CONDTXTFMTCOLL && &rModify == GetRegisteredIn() ) ChkCondColl(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits