summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@libreoffice.org>2018-05-10 10:51:42 +0200
committerBjörn Michaelsen <bjoern.michaelsen@libreoffice.org>2018-05-21 02:18:33 +0200
commit6e7e4d9f02f286ccb817cb2c1f54a951dcebffad (patch)
treeb41ed7cf80928747dc8c6c91beb14af3304e1022 /sw
parent1e9304e2b0a7f28254831ca47f108de28f6999c9 (diff)
dont use SwClient/SwModify in unocore: Bookmark
Change-Id: Iea03642c6b1de1160b98e3b61e831588bb6207b7 Reviewed-on: https://gerrit.libreoffice.org/54609 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Björn Michaelsen <bjoern.michaelsen@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/unocore/unobkm.cxx62
1 files changed, 30 insertions, 32 deletions
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)