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 18:39:12 +0200
commit0c02f3c5d64bd6db96db0302169fb4c4b48dc27e (patch)
tree251b58fad36d1c6c25ce5d0f6fa6b19973394310 /sw
parent4da8aef20416d0e1320a1ee455e2edc2ae61f9ac (diff)
dont use SwClient/SwModify in unocore: RefMark
Change-Id: I021f410793c9debfe5e984d591144636d6793fd6 Reviewed-on: https://gerrit.libreoffice.org/54610 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Björn Michaelsen <bjoern.michaelsen@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/fmtrfmrk.hxx1
-rw-r--r--sw/source/core/unocore/unorefmk.cxx63
2 files changed, 30 insertions, 34 deletions
diff --git a/sw/inc/fmtrfmrk.hxx b/sw/inc/fmtrfmrk.hxx
index 9248e7353f84..b235961baf5b 100644
--- a/sw/inc/fmtrfmrk.hxx
+++ b/sw/inc/fmtrfmrk.hxx
@@ -36,6 +36,7 @@ class SwTextRefMark;
class SwFormatRefMark
: public SfxPoolItem
, public SwModify
+ , public sw::BroadcasterMixin
{
friend class SwTextRefMark;
SwTextRefMark* m_pTextAttr;
diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx
index 8560ef0ee8e9..162cb004cd45 100644
--- a/sw/source/core/unocore/unorefmk.cxx
+++ b/sw/source/core/unocore/unorefmk.cxx
@@ -18,13 +18,16 @@
*/
#include <memory>
-#include <sal/config.h>
-
#include <utility>
-#include <osl/mutex.hxx>
#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/servicehelper.hxx>
#include <cppuhelper/supportsservice.hxx>
+#include <cppuhelper/weak.hxx>
+#include <osl/mutex.hxx>
+#include <sal/config.h>
+#include <svl/listener.hxx>
#include <vcl/svapp.hxx>
#include <unomid.h>
@@ -39,7 +42,13 @@
#include <fmtrfmrk.hxx>
#include <txtrfmrk.hxx>
#include <hints.hxx>
-#include <comphelper/servicehelper.hxx>
+#include <unometa.hxx>
+#include <unotext.hxx>
+#include <unoport.hxx>
+#include <txtatr.hxx>
+#include <fmtmeta.hxx>
+#include <docsh.hxx>
+
#include <com/sun/star/lang/NoSupportException.hpp>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/rdf/Statement.hpp>
@@ -47,21 +56,12 @@
#include <com/sun/star/rdf/URIs.hpp>
#include <com/sun/star/rdf/XLiteral.hpp>
#include <com/sun/star/rdf/XRepositorySupplier.hpp>
-#include <comphelper/processfactory.hxx>
#include <com/sun/star/lang/DisposedException.hpp>
-#include <unometa.hxx>
-#include <unotext.hxx>
-#include <unoport.hxx>
-#include <txtatr.hxx>
-#include <fmtmeta.hxx>
-#include <docsh.hxx>
-#include <cppuhelper/weak.hxx>
-
using namespace ::com::sun::star;
class SwXReferenceMark::Impl
- : public SwClient
+ : public SvtListener
{
private:
::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2
@@ -69,30 +69,29 @@ private:
public:
uno::WeakReference<uno::XInterface> m_wThis;
::comphelper::OInterfaceContainerHelper2 m_EventListeners;
- bool m_bIsDescriptor;
- SwDoc * m_pDoc;
- const SwFormatRefMark * m_pMarkFormat;
- OUString m_sMarkName;
+ bool m_bIsDescriptor;
+ SwDoc* m_pDoc;
+ const SwFormatRefMark* m_pMarkFormat;
+ OUString m_sMarkName;
- Impl( SwDoc *const pDoc, SwFormatRefMark *const pRefMark)
- : SwClient(pRefMark)
- , m_EventListeners(m_Mutex)
+ Impl(SwDoc* const pDoc, SwFormatRefMark* const pRefMark)
+ : m_EventListeners(m_Mutex)
, m_bIsDescriptor(nullptr == pRefMark)
, m_pDoc(pDoc)
, m_pMarkFormat(pRefMark)
{
if (pRefMark)
{
+ StartListening(pRefMark->GetNotifier());
m_sMarkName = pRefMark->GetRefName();
}
}
- bool IsValid() const { return nullptr != GetRegisteredIn(); }
- void InsertRefMark( SwPaM & rPam, SwXTextCursor const*const pCursor );
- void Invalidate();
+ bool IsValid() const { return m_pMarkFormat; }
+ void InsertRefMark( SwPaM & rPam, SwXTextCursor const*const pCursor );
+ void Invalidate();
protected:
- // SwClient
- virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) override;
+ virtual void Notify(const SfxHint&) override;
};
@@ -110,14 +109,10 @@ void SwXReferenceMark::Impl::Invalidate()
m_EventListeners.disposeAndClear(ev);
}
-void SwXReferenceMark::Impl::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
+void SwXReferenceMark::Impl::Notify(const SfxHint& rHint)
{
- ClientModify(this, pOld, pNew);
-
- if (!IsValid()) // removed => dispose
- {
+ if(rHint.GetId() == SfxHintId::Dying)
Invalidate();
- }
}
SwXReferenceMark::SwXReferenceMark(
@@ -272,8 +267,8 @@ void SwXReferenceMark::Impl::InsertRefMark(SwPaM& rPam,
}
m_pMarkFormat = &pTextAttr->GetRefMark();
-
- const_cast<SwFormatRefMark*>(m_pMarkFormat)->Add(this);
+ EndListeningAll();
+ StartListening(const_cast<SwFormatRefMark*>(m_pMarkFormat)->GetNotifier());
}
void SAL_CALL