[Libreoffice-commits] core.git: sw/inc sw/source
Bjoern Michaelsen
bjoern.michaelsen at libreoffice.org
Sun May 20 08:44:57 UTC 2018
sw/inc/fmtftn.hxx | 1
sw/source/core/unocore/unoftn.cxx | 51 +++++++++++++++++---------------------
2 files changed, 25 insertions(+), 27 deletions(-)
New commits:
commit e73e726ab5afc418a5be70408c71afd08a3c15a4
Author: Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
Date: Thu May 10 10:51:42 2018 +0200
dont use SwClient/SwModify in unocore: Footnotes
Change-Id: I12000118f34b8b4e37fcc0b7d1b50a32784cc893
Reviewed-on: https://gerrit.libreoffice.org/54578
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Björn Michaelsen <bjoern.michaelsen at libreoffice.org>
diff --git a/sw/inc/fmtftn.hxx b/sw/inc/fmtftn.hxx
index ee22d3b8bc52..1aa2e6f315d9 100644
--- a/sw/inc/fmtftn.hxx
+++ b/sw/inc/fmtftn.hxx
@@ -38,6 +38,7 @@ class SwTextFootnote;
class SW_DLLPUBLIC SwFormatFootnote
: public SfxPoolItem
, public SwModify
+ , public sw::BroadcasterMixin
{
friend class SwTextFootnote;
SwTextFootnote* m_pTextAttr; ///< My TextAttribute.
diff --git a/sw/source/core/unocore/unoftn.cxx b/sw/source/core/unocore/unoftn.cxx
index 601314ffc99a..da5f24e9a46c 100644
--- a/sw/source/core/unocore/unoftn.cxx
+++ b/sw/source/core/unocore/unoftn.cxx
@@ -21,12 +21,13 @@
#include <utility>
-#include <osl/mutex.hxx>
#include <comphelper/interfacecontainer2.hxx>
-#include <cppuhelper/supportsservice.hxx>
-#include <vcl/svapp.hxx>
#include <comphelper/sequence.hxx>
#include <comphelper/servicehelper.hxx>
+#include <cppuhelper/supportsservice.hxx>
+#include <svl/listener.hxx>
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
#include <unomid.h>
#include <unofootnote.hxx>
@@ -47,31 +48,31 @@
using namespace ::com::sun::star;
class SwXFootnote::Impl
- : public SwClient
+ : public SvtListener
{
private:
::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2
public:
- SwXFootnote & m_rThis;
+ SwXFootnote& m_rThis;
uno::WeakReference<uno::XInterface> m_wThis;
- const bool m_bIsEndnote;
- ::comphelper::OInterfaceContainerHelper2 m_EventListeners;
- bool m_bIsDescriptor;
- const SwFormatFootnote * m_pFormatFootnote;
- OUString m_sLabel;
-
- Impl( SwXFootnote & rThis,
- SwFormatFootnote *const pFootnote,
+ const bool m_bIsEndnote;
+ ::comphelper::OInterfaceContainerHelper2 m_EventListeners;
+ bool m_bIsDescriptor;
+ SwFormatFootnote* m_pFormatFootnote;
+ OUString m_sLabel;
+
+ Impl(SwXFootnote& rThis,
+ SwFormatFootnote* const pFootnote,
const bool bIsEndnote)
- : SwClient(pFootnote)
- , m_rThis(rThis)
+ : m_rThis(rThis)
, m_bIsEndnote(bIsEndnote)
, m_EventListeners(m_Mutex)
, m_bIsDescriptor(nullptr == pFootnote)
, m_pFormatFootnote(pFootnote)
{
+ m_pFormatFootnote && StartListening(m_pFormatFootnote->GetNotifier());
}
const SwFormatFootnote* GetFootnoteFormat() const {
@@ -86,10 +87,9 @@ public:
return *pFootnote;
}
- void Invalidate();
+ void Invalidate();
protected:
- // SwClient
- virtual void Modify( const SfxPoolItem *pOld, const SfxPoolItem *pNew) override;
+ void Notify(const SfxHint& rHint) override;
};
@@ -107,14 +107,10 @@ void SwXFootnote::Impl::Invalidate()
m_EventListeners.disposeAndClear(ev);
}
-void SwXFootnote::Impl::Modify(const SfxPoolItem *pOld, const SfxPoolItem *pNew)
+void SwXFootnote::Impl::Notify(const SfxHint& rHint)
{
- ClientModify(this, pOld, pNew);
-
- if (!GetRegisteredIn()) // removed => dispose
- {
+ if(rHint.GetId() == SfxHintId::Dying)
Invalidate();
- }
}
SwXFootnote::SwXFootnote(const bool bEndnote)
@@ -332,9 +328,10 @@ SwXFootnote::attach(const uno::Reference< text::XTextRange > & xTextRange)
if (pTextAttr)
{
- const SwFormatFootnote& rFootnote = pTextAttr->GetFootnote();
- m_pImpl->m_pFormatFootnote = &rFootnote;
- const_cast<SwFormatFootnote*>(m_pImpl->m_pFormatFootnote)->Add(m_pImpl.get());
+ m_pImpl->EndListeningAll();
+ SwFormatFootnote* pFootnote = const_cast<SwFormatFootnote*>(&pTextAttr->GetFootnote());
+ m_pImpl->m_pFormatFootnote = pFootnote;
+ m_pImpl->StartListening(pFootnote->GetNotifier());
// force creation of sequence id - is used for references
if (pNewDoc->IsInReading())
{
More information about the Libreoffice-commits
mailing list