sw/inc/calbck.hxx | 180 ++++++++++++++++++++++++++++----------- sw/inc/fmthdft.hxx | 18 ++- sw/inc/ring.hxx | 1 sw/source/core/attr/calbck.cxx | 120 +++++++------------------- sw/source/core/doc/docdesc.cxx | 2 sw/source/core/layout/atrfrm.cxx | 18 ++- 6 files changed, 187 insertions(+), 152 deletions(-)
New commits: commit d8e29e2697e90da6acf5858fd74d6054ed9e5aa3 Author: Bjoern Michaelsen <bjoern.michael...@libreoffice.org> AuthorDate: Sun Dec 29 12:57:17 2024 +0100 Commit: Bjoern Michaelsen <bjoern.michael...@libreoffice.org> CommitDate: Mon Dec 30 13:58:20 2024 +0100 Revert "Revert "stronger typing for SwClient::GetRegisteredIn"" and fix SwIterator cast - This reverts commit 9d69c20f8bcd9df4051e4f287c467efbdeae7eed. - adapt SwIterator specialization too Change-Id: Ieeb6f45019489494d2c778c52e0b88ea9e412b4c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179480 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michael...@libreoffice.org> diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx index 58a336bbc92b..7481fdaa5563 100644 --- a/sw/inc/calbck.hxx +++ b/sw/inc/calbck.hxx @@ -24,6 +24,7 @@ #include <svl/hint.hxx> #include <svl/broadcast.hxx> #include <svl/poolitem.hxx> +#include <tools/debug.hxx> #include "swdllapi.h" #include "ring.hxx" #include <type_traits> @@ -64,10 +65,18 @@ class SwFindNearestNode; This is still subject to refactoring. */ + namespace sw { class ClientIteratorBase; class ListenerEntry; + enum class IteratorMode { Exact, UnwrapMulti }; +} + +template<typename TElementType, typename TSource, sw::IteratorMode eMode> class SwIterator; + +namespace sw +{ void ClientNotifyAttrChg(SwModify& rModify, const SwAttrSet& aSet, SwAttrSet& aOld, SwAttrSet& aNew); struct SAL_DLLPUBLIC_RTTI LegacyModifyHint final: SfxHint { @@ -126,52 +135,58 @@ namespace sw virtual const SwRowFrame* DynCastRowFrame() const { return nullptr; } virtual const SwTable* DynCastTable() const { return nullptr; } }; - enum class IteratorMode { Exact, UnwrapMulti }; -} -// SwClient -class SW_DLLPUBLIC SwClient : public ::sw::WriterListener -{ - // avoids making the details of the linked list and the callback method public - friend class SwModify; - friend class sw::ClientIteratorBase; - friend class sw::ListenerEntry; - template<typename E, typename S, sw::IteratorMode> friend class SwIterator; + template<typename T> + class SW_DLLPUBLIC ClientBase : public ::sw::WriterListener + { + // avoids making the details of the linked list and the callback method public + friend class ::SwModify; + friend class sw::ClientIteratorBase; + friend class sw::ListenerEntry; + template<typename E, typename S, sw::IteratorMode> friend class ::SwIterator; - SwModify *m_pRegisteredIn; ///< event source + T *m_pRegisteredIn; ///< event source -protected: - // single argument ctors shall be explicit. - inline explicit SwClient( SwModify* pToRegisterIn ); + protected: + // single argument ctors shall be explicit. + inline explicit ClientBase( T* pToRegisterIn ) + : m_pRegisteredIn( nullptr ) + { + if(pToRegisterIn) + pToRegisterIn->Add(*this); + } - // write access to pRegisteredIn shall be granted only to the object itself (protected access) - SwModify* GetRegisteredInNonConst() const { return m_pRegisteredIn; } + // write access to pRegisteredIn shall be granted only to the object itself (protected access) + T* GetRegisteredInNonConst() const { return m_pRegisteredIn; } - // when overriding this, you MUST call SwClient::SwClientNotify() in the override! - virtual void SwClientNotify(const SwModify&, const SfxHint& rHint) override; + // when overriding this, you MUST call SwClient::SwClientNotify() in the override! + virtual void SwClientNotify(const SwModify&, const SfxHint& rHint) override; -public: - SwClient() : m_pRegisteredIn(nullptr) {} - SwClient(SwClient&&) noexcept; - virtual ~SwClient() override; + public: + ClientBase() : m_pRegisteredIn(nullptr) {} + ClientBase(ClientBase&&) noexcept; + virtual ~ClientBase() override; - // 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 - std::optional<sw::ModifyChangedHint> CheckRegistration( const SfxPoolItem* pOldValue ); - // SwFormat wants to die different than the rest: It wants to reparent every client to its parent - // and then send a SwFormatChg hint. - void CheckRegistrationFormat(SwFormat& rOld); + // 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 + std::optional<sw::ModifyChangedHint> CheckRegistration( const SfxPoolItem* pOldValue ); + // SwFormat wants to die different than the rest: It wants to reparent every client to its parent + // and then send a SwFormatChg hint. + void CheckRegistrationFormat(SwFormat& rOld); - const SwModify* GetRegisteredIn() const { return m_pRegisteredIn; } - SwModify* GetRegisteredIn() { return m_pRegisteredIn; } - void EndListeningAll(); - void StartListeningToSameModifyAs(const SwClient&); + const T* GetRegisteredIn() const { return m_pRegisteredIn; } + T* GetRegisteredIn() { return m_pRegisteredIn; } + void EndListeningAll(); + void StartListeningToSameModifyAs(const ClientBase&); - // get information about attribute - virtual bool GetInfo( SwFindNearestNode& ) const { return true; } -}; + // get information about attribute + virtual bool GetInfo( SwFindNearestNode& ) const { return true; } + }; +} + +typedef sw::ClientBase<SwModify> SwClient; // SwModify @@ -181,12 +196,13 @@ class SW_DLLPUBLIC SwModify: public SwClient { friend class sw::ClientIteratorBase; friend void sw::ClientNotifyAttrChg(SwModify&, const SwAttrSet&, SwAttrSet&, SwAttrSet&); - template<typename E, typename S, sw::IteratorMode> friend class SwIterator; + template<typename E, typename S, sw::IteratorMode> friend class ::SwIterator; sw::WriterListener* m_pWriterListeners; // the start of the linked list of clients bool m_bModifyLocked; // don't broadcast changes now SwModify(SwModify const &) = delete; SwModify &operator =(const SwModify&) = delete; + void EnsureBroadcasting(); protected: virtual void SwClientNotify(const SwModify&, const SfxHint& rHint) override; public: @@ -199,8 +215,8 @@ public: virtual ~SwModify() override; - void Add(SwClient& rDepend); - void Remove(SwClient& rDepend); + template<typename T> void Add(sw::ClientBase<T>& rDepend); + template<typename T> void Remove(sw::ClientBase<T>& rDepend); bool HasWriterListeners() const { return m_pWriterListeners; } bool HasOnlyOneListener() const { return m_pWriterListeners && m_pWriterListeners->IsLast(); } @@ -212,7 +228,6 @@ public: bool IsModifyLocked() const { return m_bModifyLocked; } }; -template<typename TElementType, typename TSource, sw::IteratorMode eMode> class SwIterator; namespace sw { @@ -276,8 +291,7 @@ namespace sw }; class ClientIteratorBase : public sw::Ring< ::sw::ClientIteratorBase > { - friend void SwModify::Remove(SwClient&); - friend void SwModify::Add(SwClient&); + friend class ::SwModify; protected: const SwModify& m_rRoot; // the current object in an iteration @@ -405,27 +419,93 @@ public: using sw::ClientIteratorBase::IsChanged; }; -template< typename TSource > class SwIterator<SwClient, TSource> final : private sw::ClientIteratorBase +template< typename T, typename TSource > class SwIterator<sw::ClientBase<T>, TSource> final : private sw::ClientIteratorBase { static_assert(std::is_base_of<SwModify,TSource>::value, "TSource needs to be derived from SwModify"); public: SwIterator( const TSource& rSrc ) : sw::ClientIteratorBase(rSrc) {} - SwClient* First() - { return static_cast<SwClient*>(GoStart()); } - SwClient* Next() + sw::ClientBase<T>* First() + { return static_cast<sw::ClientBase<T>*>(GoStart()); } + sw::ClientBase<T>* Next() { if(!IsChanged()) m_pPosition = GetRightOfPos(); - return static_cast<SwClient*>(Sync()); + return static_cast<sw::ClientBase<T>*>(Sync()); } using sw::ClientIteratorBase::IsChanged; }; -SwClient::SwClient( SwModify* pToRegisterIn ) - : m_pRegisteredIn( nullptr ) +template<typename T> +void SwModify::Add(sw::ClientBase<T>& rDepend) { - if(pToRegisterIn) - pToRegisterIn->Add(*this); + DBG_TESTSOLARMUTEX(); +#ifdef DBG_UTIL + EnsureBroadcasting(); + assert(dynamic_cast<T*>(this)); +#endif + + if (rDepend.GetRegisteredIn() == this) + return; + + // deregister new client in case it is already registered elsewhere + if( rDepend.GetRegisteredIn() != nullptr ) + rDepend.m_pRegisteredIn->Remove(rDepend); + + if( !m_pWriterListeners ) + { + // first client added + m_pWriterListeners = &rDepend; + m_pWriterListeners->m_pLeft = nullptr; + m_pWriterListeners->m_pRight = nullptr; + } + else + { + // append client + rDepend.m_pRight = m_pWriterListeners->m_pRight; + m_pWriterListeners->m_pRight = &rDepend; + rDepend.m_pLeft = m_pWriterListeners; + if( rDepend.m_pRight ) + rDepend.m_pRight->m_pLeft = &rDepend; + } + + // connect client to me + rDepend.m_pRegisteredIn = static_cast<T*>(this); } +template<typename T> +void SwModify::Remove(sw::ClientBase<T>& rDepend) +{ + DBG_TESTSOLARMUTEX(); + assert(rDepend.m_pRegisteredIn == this); + + // SwClient is my listener + // remove it from my list + ::sw::WriterListener* pR = rDepend.m_pRight; + ::sw::WriterListener* pL = rDepend.m_pLeft; + if( m_pWriterListeners == &rDepend ) + m_pWriterListeners = pL ? pL : pR; + + if( pL ) + pL->m_pRight = pR; + if( pR ) + pR->m_pLeft = pL; + + // update ClientIterators + if(sw::ClientIteratorBase::s_pClientIters) + { + for(auto& rIter : sw::ClientIteratorBase::s_pClientIters->GetRingContainer()) + { + if (&rIter.m_rRoot == this && + (rIter.m_pCurrent == &rDepend || rIter.m_pPosition == &rDepend)) + { + // if object being removed is the current or next object in an + // iterator, advance this iterator + rIter.m_pPosition = pR; + } + } + } + rDepend.m_pLeft = nullptr; + rDepend.m_pRight = nullptr; + rDepend.m_pRegisteredIn = nullptr; +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/fmthdft.hxx b/sw/inc/fmthdft.hxx index 731e46b490b2..2a0c48eb3f32 100644 --- a/sw/inc/fmthdft.hxx +++ b/sw/inc/fmthdft.hxx @@ -25,12 +25,16 @@ #include "calbck.hxx" #include "frmfmt.hxx" +namespace sw { + typedef ClientBase<::SwFrameFormat> FrameFormatClient; +} + class IntlWrapper; /** Header, for PageFormats Client of FrameFormat describing the header. */ -class SW_DLLPUBLIC SwFormatHeader final : public SfxPoolItem, public SwClient +class SW_DLLPUBLIC SwFormatHeader final : public SfxPoolItem, public sw::FrameFormatClient { bool m_bActive; ///< Only for controlling (creation of content). @@ -51,10 +55,10 @@ public: OUString &rText, const IntlWrapper& rIntl ) const override; - const SwFrameFormat *GetHeaderFormat() const { return static_cast<const SwFrameFormat*>(GetRegisteredIn()); } - SwFrameFormat *GetHeaderFormat() { return static_cast<SwFrameFormat*>(GetRegisteredIn()); } + const SwFrameFormat *GetHeaderFormat() const { return GetRegisteredIn(); } + SwFrameFormat *GetHeaderFormat() { return GetRegisteredIn(); } - void RegisterToFormat( SwFormat& rFormat ); + void RegisterToFormat( SwFrameFormat& rFormat ); bool IsActive() const { return m_bActive; } void dumpAsXml(xmlTextWriterPtr pWriter) const override; }; @@ -62,7 +66,7 @@ public: /**Footer, for pageformats Client of FrameFormat describing the footer */ -class SW_DLLPUBLIC SwFormatFooter final : public SfxPoolItem, public SwClient +class SW_DLLPUBLIC SwFormatFooter final : public SfxPoolItem, public sw::FrameFormatClient { bool m_bActive; // Only for controlling (creation of content). @@ -83,8 +87,8 @@ public: OUString &rText, const IntlWrapper& rIntl ) const override; - const SwFrameFormat *GetFooterFormat() const { return static_cast<const SwFrameFormat*>(GetRegisteredIn()); } - SwFrameFormat *GetFooterFormat() { return static_cast<SwFrameFormat*>(GetRegisteredIn()); } + const SwFrameFormat *GetFooterFormat() const { return GetRegisteredIn(); } + SwFrameFormat *GetFooterFormat() { return GetRegisteredIn(); } void RegisterToFormat( SwFormat& rFormat ); bool IsActive() const { return m_bActive; } diff --git a/sw/inc/ring.hxx b/sw/inc/ring.hxx index 194ed47db10b..f9ee213fc6e8 100644 --- a/sw/inc/ring.hxx +++ b/sw/inc/ring.hxx @@ -19,6 +19,7 @@ #ifndef INCLUDED_SW_INC_RING_HXX #define INCLUDED_SW_INC_RING_HXX +#include <cassert> #include <utility> #include <sal/types.h> #include <iterator> diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx index e4a1f437cef7..b7b552a885a4 100644 --- a/sw/source/core/attr/calbck.cxx +++ b/sw/source/core/attr/calbck.cxx @@ -20,6 +20,7 @@ #include <algorithm> #include <format.hxx> +#include <frmfmt.hxx> #include <hintids.hxx> #include <hints.hxx> #include <osl/diagnose.h> @@ -55,7 +56,8 @@ namespace sw sw::LegacyModifyHint::~LegacyModifyHint() {} -SwClient::SwClient(SwClient&& o) noexcept +template<typename T> +sw::ClientBase<T>::ClientBase(sw::ClientBase<T>&& o) noexcept : m_pRegisteredIn(nullptr) { if(o.m_pRegisteredIn) @@ -65,7 +67,8 @@ SwClient::SwClient(SwClient&& o) noexcept } } -SwClient::~SwClient() +template<typename T> +sw::ClientBase<T>::~ClientBase() { if(GetRegisteredIn()) DBG_TESTSOLARMUTEX(); @@ -74,7 +77,8 @@ SwClient::~SwClient() m_pRegisteredIn->Remove(*this); } -std::optional<sw::ModifyChangedHint> SwClient::CheckRegistration( const SfxPoolItem* pOld ) +template<typename T> +std::optional<sw::ModifyChangedHint> sw::ClientBase<T>::CheckRegistration( const SfxPoolItem* pOld ) { DBG_TESTSOLARMUTEX(); // this method only handles notification about dying SwModify objects @@ -104,7 +108,8 @@ std::optional<sw::ModifyChangedHint> SwClient::CheckRegistration( const SfxPoolI return sw::ModifyChangedHint(pAbove); } -void SwClient::CheckRegistrationFormat(SwFormat& rOld) +template<typename T> +void sw::ClientBase<T>::CheckRegistrationFormat(SwFormat& rOld) { assert(GetRegisteredIn() == &rOld); auto pNew = rOld.DerivedFrom(); @@ -115,7 +120,8 @@ void SwClient::CheckRegistrationFormat(SwFormat& rOld) SwClientNotify(rOld, aHint); } -void SwClient::SwClientNotify(const SwModify&, const SfxHint& rHint) +template<typename T> +void sw::ClientBase<T>::SwClientNotify(const SwModify&, const SfxHint& rHint) { if (rHint.GetId() != SfxHintId::SwLegacyModify) return; @@ -123,7 +129,8 @@ void SwClient::SwClientNotify(const SwModify&, const SfxHint& rHint) CheckRegistration(pLegacyHint->m_pOld); }; -void SwClient::StartListeningToSameModifyAs(const SwClient& other) +template<typename T> +void sw::ClientBase<T>::StartListeningToSameModifyAs(const sw::ClientBase<T>& other) { if(other.m_pRegisteredIn) other.m_pRegisteredIn->Add(*this); @@ -131,7 +138,8 @@ void SwClient::StartListeningToSameModifyAs(const SwClient& other) EndListeningAll(); } -void SwClient::EndListeningAll() +template<typename T> +void sw::ClientBase<T>::EndListeningAll() { if(m_pRegisteredIn) m_pRegisteredIn->Remove(*this); @@ -167,85 +175,6 @@ bool SwModify::GetInfo( SwFindNearestNode& rInfo ) const return true; } -void SwModify::Add(SwClient& rDepend) -{ - DBG_TESTSOLARMUTEX(); -#ifdef DBG_UTIL - // You should not EVER use SwModify directly in new code: - // - Preexisting SwModifys should only ever be used via sw::BroadcastingModify. - // This includes sw::BroadcastMixin, which is the long-term target (without - // SwModify). - // - New classes should use sw::BroadcastMixin alone. - if(!dynamic_cast<sw::BroadcastingModify*>(this)) - { - auto pBT = sal::backtrace_get(20); - SAL_WARN("sw.core", "Modify that is not broadcasting used! " << sal::backtrace_to_string(pBT.get())); - } -#endif - - if (rDepend.m_pRegisteredIn == this) - return; - - // deregister new client in case it is already registered elsewhere - if( rDepend.m_pRegisteredIn != nullptr ) - rDepend.m_pRegisteredIn->Remove(rDepend); - - if( !m_pWriterListeners ) - { - // first client added - m_pWriterListeners = &rDepend; - m_pWriterListeners->m_pLeft = nullptr; - m_pWriterListeners->m_pRight = nullptr; - } - else - { - // append client - rDepend.m_pRight = m_pWriterListeners->m_pRight; - m_pWriterListeners->m_pRight = &rDepend; - rDepend.m_pLeft = m_pWriterListeners; - if( rDepend.m_pRight ) - rDepend.m_pRight->m_pLeft = &rDepend; - } - - // connect client to me - rDepend.m_pRegisteredIn = this; -} - -void SwModify::Remove(SwClient& rDepend) -{ - DBG_TESTSOLARMUTEX(); - assert(rDepend.m_pRegisteredIn == this); - - // SwClient is my listener - // remove it from my list - ::sw::WriterListener* pR = rDepend.m_pRight; - ::sw::WriterListener* pL = rDepend.m_pLeft; - if( m_pWriterListeners == &rDepend ) - m_pWriterListeners = pL ? pL : pR; - - if( pL ) - pL->m_pRight = pR; - if( pR ) - pR->m_pLeft = pL; - - // update ClientIterators - if(sw::ClientIteratorBase::s_pClientIters) - { - for(auto& rIter : sw::ClientIteratorBase::s_pClientIters->GetRingContainer()) - { - if (&rIter.m_rRoot == this && - (rIter.m_pCurrent == &rDepend || rIter.m_pPosition == &rDepend)) - { - // if object being removed is the current or next object in an - // iterator, advance this iterator - rIter.m_pPosition = pR; - } - } - } - rDepend.m_pLeft = nullptr; - rDepend.m_pRight = nullptr; - rDepend.m_pRegisteredIn = nullptr; -} sw::WriterMultiListener::WriterMultiListener(SwClient& rToTell) : m_rToTell(rToTell) @@ -309,6 +238,22 @@ void SwModify::CallSwClientNotify( const SfxHint& rHint ) const pClient->SwClientNotify( *this, rHint ); } +void SwModify::EnsureBroadcasting() +{ +#ifdef DBG_UTIL + // You should not EVER use SwModify directly in new code: + // - Preexisting SwModifys should only ever be used via sw::BroadcastingModify. + // This includes sw::BroadcastMixin, which is the long-term target (without + // SwModify). + // - New classes should use sw::BroadcastMixin alone. + if(!dynamic_cast<sw::BroadcastingModify*>(this)) + { + auto pBT = sal::backtrace_get(20); + SAL_WARN("sw.core", "Modify that is not broadcasting used! " << sal::backtrace_to_string(pBT.get())); + } +#endif +} + void sw::BroadcastingModify::CallSwClientNotify(const SfxHint& rHint) const { SwModify::CallSwClientNotify(rHint); @@ -322,4 +267,7 @@ void sw::ClientNotifyAttrChg(SwModify& rModify, const SwAttrSet& aSet, SwAttrSet const sw::LegacyModifyHint aHint(&aChgOld, &aChgNew); rModify.SwClientNotify(rModify, aHint); } + +template class sw::ClientBase<SwModify>; +template class sw::ClientBase<SwFrameFormat>; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx index b03a3558baca..04c318cdbff1 100644 --- a/sw/source/core/doc/docdesc.cxx +++ b/sw/source/core/doc/docdesc.cxx @@ -458,7 +458,7 @@ void SwDoc::ChgPageDesc( size_t i, const SwPageDesc &rChged ) rDesc.GetLeft().ResetFormatAttr(RES_FOOTER); rDesc.GetFirstLeft().ResetFormatAttr(RES_FOOTER); - auto lDelHFFormat = [this](SwClient* pToRemove, SwFrameFormat* pFormat) + auto lDelHFFormat = [this](sw::ClientBase<SwFrameFormat>* pToRemove, SwFrameFormat* pFormat) { // Code taken from lcl_DelHFFormat pFormat->Remove(*pToRemove); diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index 937b30d74e7e..98f41721d89b 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -134,8 +134,10 @@ bool GetAtPageRelOrientation(sal_Int16 & rOrientation, bool const isIgnorePrintA } } + } // namespace sw + SfxPoolItem* SwFormatLineNumber::CreateDefault() { return new SwFormatLineNumber; } static sal_Int16 lcl_IntToRelation(const uno::Any& rVal) @@ -146,7 +148,7 @@ static sal_Int16 lcl_IntToRelation(const uno::Any& rVal) return nVal; } -static void lcl_DelHFFormat( SwClient *pToRemove, SwFrameFormat *pFormat ) +static void lcl_DelHFFormat( sw::FrameFormatClient *pToRemove, SwFrameFormat *pFormat ) { //If the client is the last one who uses this format, then we have to delete //it - before this is done, we may need to delete the content-section. @@ -509,21 +511,21 @@ sal_uInt16 SwFormatFillOrder::GetValueCount() const // Partially implemented inline in hxx SwFormatHeader::SwFormatHeader( SwFrameFormat *pHeaderFormat ) : SfxPoolItem( RES_HEADER, SfxItemType::SwFormatHeaderType ), - SwClient( pHeaderFormat ), + sw::FrameFormatClient( pHeaderFormat ), m_bActive( pHeaderFormat ) { } SwFormatHeader::SwFormatHeader( const SwFormatHeader &rCpy ) : SfxPoolItem( RES_HEADER, SfxItemType::SwFormatHeaderType ), - SwClient( const_cast<sw::BroadcastingModify*>(static_cast<const sw::BroadcastingModify*>(rCpy.GetRegisteredIn())) ), + sw::FrameFormatClient( const_cast<SwFrameFormat*>(rCpy.GetRegisteredIn()) ), m_bActive( rCpy.IsActive() ) { } SwFormatHeader::SwFormatHeader( bool bOn ) : SfxPoolItem( RES_HEADER, SfxItemType::SwFormatHeaderType ), - SwClient( nullptr ), + sw::FrameFormatClient( nullptr ), m_bActive( bOn ) { } @@ -546,7 +548,7 @@ SwFormatHeader* SwFormatHeader::Clone( SfxItemPool* ) const return new SwFormatHeader( *this ); } -void SwFormatHeader::RegisterToFormat( SwFormat& rFormat ) +void SwFormatHeader::RegisterToFormat( SwFrameFormat& rFormat ) { rFormat.Add(*this); } @@ -568,21 +570,21 @@ void SwFormatHeader::dumpAsXml(xmlTextWriterPtr pWriter) const // Partially implemented inline in hxx SwFormatFooter::SwFormatFooter( SwFrameFormat *pFooterFormat ) : SfxPoolItem( RES_FOOTER, SfxItemType::SwFormatFooterType ), - SwClient( pFooterFormat ), + sw::FrameFormatClient( pFooterFormat ), m_bActive( pFooterFormat ) { } SwFormatFooter::SwFormatFooter( const SwFormatFooter &rCpy ) : SfxPoolItem( RES_FOOTER, SfxItemType::SwFormatFooterType ), - SwClient( const_cast<sw::BroadcastingModify*>(static_cast<const sw::BroadcastingModify*>(rCpy.GetRegisteredIn())) ), + sw::FrameFormatClient( const_cast<SwFrameFormat*>(rCpy.GetRegisteredIn()) ), m_bActive( rCpy.IsActive() ) { } SwFormatFooter::SwFormatFooter( bool bOn ) : SfxPoolItem( RES_FOOTER, SfxItemType::SwFormatFooterType ), - SwClient( nullptr ), + sw::FrameFormatClient( nullptr ), m_bActive( bOn ) { }