diff options
-rw-r--r-- | sw/inc/section.hxx | 3 | ||||
-rw-r--r-- | sw/source/core/docnode/section.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/inc/sectfrm.hxx | 4 | ||||
-rw-r--r-- | sw/source/core/layout/sectfrm.cxx | 11 |
4 files changed, 26 insertions, 0 deletions
diff --git a/sw/inc/section.hxx b/sw/inc/section.hxx index ed777e9e68e2..14f9429d572c 100644 --- a/sw/inc/section.hxx +++ b/sw/inc/section.hxx @@ -24,6 +24,7 @@ #include <tools/ref.hxx> #include <svl/hint.hxx> +#include <svl/listener.hxx> #include <sfx2/lnkbase.hxx> #include <sfx2/Metadatable.hxx> @@ -137,6 +138,7 @@ public: class SW_DLLPUBLIC SwSection : public SwClient + , public SvtListener // needed for SwClientNotify to be called from SwSectionFormat { // In order to correctly maintain the flag when creating/deleting frames. friend class SwSectionNode; @@ -153,6 +155,7 @@ private: bool const bHidden, bool const bCondition); protected: + virtual void Notify(SfxHint const& rHint) override; virtual void SwClientNotify(const SwModify&, const SfxHint&) override; public: diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index 5fa56e2eb00f..c4d498f05495 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -198,6 +198,8 @@ SwSection::SwSection( : SwClient(& rFormat) , m_Data(eType, rName) { + StartListening(rFormat.GetNotifier()); + SwSection *const pParentSect = GetParent(); if( pParentSect ) { @@ -230,6 +232,7 @@ SwSection::~SwSection() else { pFormat->Remove( this ); // remove + SvtListener::EndListeningAll(); if (SectionType::Content != m_Data.GetType()) { @@ -401,6 +404,11 @@ void SwSection::SetEditInReadonly(bool const bFlag) void SwSection::SwClientNotify(const SwModify&, const SfxHint& rHint) { + Notify(rHint); +} + +void SwSection::Notify(SfxHint const& rHint) +{ if (rHint.GetId() != SfxHintId::SwLegacyModify) return; auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint); diff --git a/sw/source/core/inc/sectfrm.hxx b/sw/source/core/inc/sectfrm.hxx index 276819dff7bf..09c742f8da79 100644 --- a/sw/source/core/inc/sectfrm.hxx +++ b/sw/source/core/inc/sectfrm.hxx @@ -22,6 +22,8 @@ #include "layfrm.hxx" #include "flowfrm.hxx" +#include <svl/listener.hxx> + class SwSection; class SwSectionFormat; class SwAttrSetChg; @@ -45,6 +47,7 @@ namespace o3tl { } class SwSectionFrame final: public SwLayoutFrame, public SwFlowFrame + , public SvtListener // TODO? { SwSection* m_pSection; bool m_bFootnoteAtEnd; // footnotes at the end of section @@ -70,6 +73,7 @@ class SwSectionFrame final: public SwLayoutFrame, public SwFlowFrame virtual void MakeAll(vcl::RenderContext* pRenderContext) override; virtual bool ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool &rReformat ) override; virtual void Format( vcl::RenderContext* pRenderContext, const SwBorderAttrs *pAttrs = nullptr ) override; + virtual void Notify(SfxHint const& rHint) override; virtual void SwClientNotify( const SwModify&, const SfxHint& ) override; public: diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx index bc529bd28708..e5ba5d242667 100644 --- a/sw/source/core/layout/sectfrm.cxx +++ b/sw/source/core/layout/sectfrm.cxx @@ -74,6 +74,8 @@ SwSectionFrame::SwSectionFrame( SwSection &rSect, SwFrame* pSib ) , m_bOwnFootnoteNum(false) , m_bFootnoteLock(false) { + StartListening(rSect.GetFormat()->GetNotifier()); + mnFrameType = SwFrameType::Section; CalcFootnoteAtEndFlag(); @@ -90,6 +92,8 @@ SwSectionFrame::SwSectionFrame( SwSectionFrame &rSect, bool bMaster ) : m_bOwnFootnoteNum( false ), m_bFootnoteLock( false ) { + StartListening(rSect.GetFormat()->GetNotifier()); + mnFrameType = SwFrameType::Section; PROTOCOL( this, PROT::Section, bMaster ? DbgAction::CreateMaster : DbgAction::CreateFollow, &rSect ) @@ -2566,6 +2570,13 @@ void SwSectionFrame::CalcEndAtEndFlag() } } +void SwSectionFrame::Notify(SfxHint const& rHint) +{ + SwSectionFormat *const pFormat(GetSection()->GetFormat()); + assert(pFormat); + SwClientNotify(*pFormat, rHint); +} + void SwSectionFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint) { if (rHint.GetId() == SfxHintId::SwLegacyModify) |