sw/source/core/unocore/unobkm.cxx | 62 ++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 32 deletions(-)
New commits: commit 6e7e4d9f02f286ccb817cb2c1f54a951dcebffad Author: Bjoern Michaelsen <bjoern.michael...@libreoffice.org> Date: Thu May 10 10:51:42 2018 +0200 dont use SwClient/SwModify in unocore: Bookmark Change-Id: Iea03642c6b1de1160b98e3b61e831588bb6207b7 Reviewed-on: https://gerrit.libreoffice.org/54609 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Björn Michaelsen <bjoern.michael...@libreoffice.org> diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx index e113645bc4aa..2149ba0614f6 100644 --- a/sw/source/core/unocore/unobkm.cxx +++ b/sw/source/core/unocore/unobkm.cxx @@ -18,10 +18,16 @@ */ #include <unobookmark.hxx> -#include <osl/mutex.hxx> + #include <comphelper/interfacecontainer2.hxx> +#include <comphelper/sequence.hxx> +#include <comphelper/servicehelper.hxx> #include <cppuhelper/supportsservice.hxx> +#include <osl/mutex.hxx> +#include <svl/itemprop.hxx> +#include <svl/listener.hxx> #include <vcl/svapp.hxx> +#include <xmloff/odffields.hxx> #include <TextCursorHelper.hxx> #include <unotextrange.hxx> @@ -34,30 +40,25 @@ #include <docary.hxx> #include <swundo.hxx> #include <docsh.hxx> -#include <xmloff/odffields.hxx> -#include <comphelper/servicehelper.hxx> -#include <comphelper/sequence.hxx> -#include <svl/itemprop.hxx> using namespace ::sw::mark; using namespace ::com::sun::star; class SwXBookmark::Impl - : public SwClient + : public SvtListener { private: ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2 public: uno::WeakReference<uno::XInterface> m_wThis; - ::comphelper::OInterfaceContainerHelper2 m_EventListeners; - SwDoc * m_pDoc; - ::sw::mark::IMark * m_pRegisteredBookmark; - OUString m_sMarkName; + ::comphelper::OInterfaceContainerHelper2 m_EventListeners; + SwDoc* m_pDoc; + ::sw::mark::IMark* m_pRegisteredBookmark; + OUString m_sMarkName; Impl( SwDoc *const pDoc ) - : SwClient() - , m_EventListeners(m_Mutex) + : m_EventListeners(m_Mutex) , m_pDoc(pDoc) , m_pRegisteredBookmark(nullptr) { @@ -66,37 +67,34 @@ public: void registerInMark(SwXBookmark & rThis, ::sw::mark::IMark *const pBkmk); protected: - // SwClient - virtual void Modify( const SfxPoolItem *pOld, const SfxPoolItem *pNew) override; + virtual void Notify(const SfxHint&) override; }; -void SwXBookmark::Impl::Modify(const SfxPoolItem *pOld, const SfxPoolItem *pNew) +void SwXBookmark::Impl::Notify(const SfxHint& rHint) { - ClientModify(this, pOld, pNew); - if (GetRegisteredIn()) + if(rHint.GetId() == SfxHintId::Dying) { - return; // core object still alive - } - - m_pRegisteredBookmark = nullptr; - m_pDoc = nullptr; - uno::Reference<uno::XInterface> const xThis(m_wThis); - if (!xThis.is()) - { // fdo#72695: if UNO object is already dead, don't revive it with event - return; + m_pRegisteredBookmark = nullptr; + m_pDoc = nullptr; + uno::Reference<uno::XInterface> const xThis(m_wThis); + if (!xThis.is()) + { // fdo#72695: if UNO object is already dead, don't revive it with event + return; + } + lang::EventObject const ev(xThis); + m_EventListeners.disposeAndClear(ev); } - lang::EventObject const ev(xThis); - m_EventListeners.disposeAndClear(ev); } -void SwXBookmark::Impl::registerInMark(SwXBookmark & rThis, - ::sw::mark::IMark *const pBkmk) +void SwXBookmark::Impl::registerInMark(SwXBookmark& rThis, + ::sw::mark::IMark* const pBkmk) { - const uno::Reference<text::XTextContent> xBookmark(& rThis); + const uno::Reference<text::XTextContent> xBookmark(&rThis); if (pBkmk) { - pBkmk->Add(this); + EndListeningAll(); + StartListening(pBkmk->GetNotifier()); ::sw::mark::MarkBase *const pMarkBase(dynamic_cast< ::sw::mark::MarkBase * >(pBkmk)); OSL_ENSURE(pMarkBase, "registerInMark: no MarkBase?"); if (pMarkBase) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits