sw/inc/unocrsr.hxx | 29 +++++++++++++++-------------- sw/source/core/doc/doccorr.cxx | 2 +- sw/source/core/doc/docnew.cxx | 2 +- sw/source/core/unocore/unocrsr.cxx | 3 +-- 4 files changed, 18 insertions(+), 18 deletions(-)
New commits: commit 27ec6d1cb96a0d3becf14309a26d1c024a0f8603 Author: Bjoern Michaelsen <[email protected]> Date: Mon Nov 28 09:12:16 2016 +0100 kill SwClient/Modify here, use sane(r) SfxBroadcaster/Listener Change-Id: I862d7cf5785dc838044351b6ecac71aa7e0b2669 Reviewed-on: https://gerrit.libreoffice.org/31305 Tested-by: Jenkins <[email protected]> Reviewed-by: Björn Michaelsen <[email protected]> diff --git a/sw/inc/unocrsr.hxx b/sw/inc/unocrsr.hxx index eeb1b4a..ac6b848 100644 --- a/sw/inc/unocrsr.hxx +++ b/sw/inc/unocrsr.hxx @@ -20,7 +20,8 @@ #define INCLUDED_SW_INC_UNOCRSR_HXX #include <swcrsr.hxx> -#include <calbck.hxx> +#include <svl/SfxBroadcaster.hxx> +#include <svl/lstner.hxx> namespace sw { @@ -39,7 +40,7 @@ namespace sw }; } -class SwUnoCursor : public virtual SwCursor, public SwModify +class SwUnoCursor : public virtual SwCursor { private: bool m_bRemainInSection : 1; @@ -47,6 +48,7 @@ private: bool m_bSkipOverProtectSections : 1; public: + SfxBroadcaster m_aNotifier; SwUnoCursor( const SwPosition &rPos ); virtual ~SwUnoCursor() override; @@ -111,7 +113,7 @@ public: namespace sw { - class UnoCursorPointer : public SwClient + class UnoCursorPointer : public SfxListener { public: UnoCursorPointer() @@ -120,30 +122,29 @@ namespace sw UnoCursorPointer(std::shared_ptr<SwUnoCursor> pCursor, bool bSectionRestricted=false) : m_pCursor(pCursor), m_bSectionRestricted(bSectionRestricted) { - m_pCursor->Add(this); + StartListening(m_pCursor->m_aNotifier); } UnoCursorPointer(const UnoCursorPointer& rOther) - : SwClient(nullptr) + : SfxListener() , m_pCursor(rOther.m_pCursor) , m_bSectionRestricted(rOther.m_bSectionRestricted) { if(m_pCursor) - m_pCursor->Add(this); + StartListening(m_pCursor->m_aNotifier); } virtual ~UnoCursorPointer() override { if(m_pCursor) - m_pCursor->Remove(this); + EndListening(m_pCursor->m_aNotifier); } - virtual void SwClientNotify(const SwModify& rModify, const SfxHint& rHint) override + virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override { - SwClient::SwClientNotify(rModify, rHint); if(m_pCursor) { if(typeid(rHint) == typeid(UnoCursorHint)) - m_pCursor->Remove(this); + EndListening(rBC); } - if(!GetRegisteredIn()) + if(!GetBroadcasterCount()) m_pCursor.reset(); }; SwUnoCursor* get() const @@ -155,7 +156,7 @@ namespace sw UnoCursorPointer& operator=(UnoCursorPointer aOther) { if(aOther.m_pCursor) - aOther.m_pCursor->Add(this); + StartListening(aOther.m_pCursor->m_aNotifier); m_pCursor = aOther.m_pCursor; return *this; } @@ -164,9 +165,9 @@ namespace sw void reset(std::shared_ptr<SwUnoCursor> pNew) { if(pNew) - pNew->Add(this); + StartListening(pNew->m_aNotifier); else if(m_pCursor) - m_pCursor->Remove(this); + EndListening(m_pCursor->m_aNotifier); m_pCursor = pNew; } private: diff --git a/sw/source/core/doc/doccorr.cxx b/sw/source/core/doc/doccorr.cxx index cb07e36..fee4a4d 100644 --- a/sw/source/core/doc/doccorr.cxx +++ b/sw/source/core/doc/doccorr.cxx @@ -160,7 +160,7 @@ void PaMCorrAbs( const SwPaM& rRange, { // the UNO cursor has left its section. We need to notify it! sw::UnoCursorHint aHint(sw::UnoCursorHintType::LEAVES_SECTION); - pUnoCursor->CallSwClientNotify(aHint); + pUnoCursor->m_aNotifier.Broadcast(aHint); } } } diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index ff5327d..6cc8e74 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -419,7 +419,7 @@ SwDoc::~SwDoc() { auto pCursor(pWeakCursor.lock()); if(pCursor) - pCursor->CallSwClientNotify(aHint); + pCursor->m_aNotifier.Broadcast(aHint); } delete mpACEWord; diff --git a/sw/source/core/unocore/unocrsr.cxx b/sw/source/core/unocore/unocrsr.cxx index de18ef4..4b5c286 100644 --- a/sw/source/core/unocore/unocrsr.cxx +++ b/sw/source/core/unocore/unocrsr.cxx @@ -31,7 +31,6 @@ IMPL_FIXEDMEMPOOL_NEWDEL( SwUnoCursor ) SwUnoCursor::SwUnoCursor( const SwPosition &rPos ) : SwCursor( rPos, nullptr ) - , SwModify(nullptr) , m_bRemainInSection(true) , m_bSkipOverHiddenSections(false) , m_bSkipOverProtectSections(false) @@ -42,7 +41,7 @@ SwUnoCursor::~SwUnoCursor() SwDoc* pDoc = GetDoc(); if( !pDoc->IsInDtor() ) { - assert(!static_cast<bool>(SwIterator<SwClient, SwUnoCursor>(*this).First())); + assert(!m_aNotifier.HasListeners()); } // delete the whole ring
_______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
