diff options
author | Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org> | 2018-05-10 10:51:42 +0200 |
---|---|---|
committer | Björn Michaelsen <bjoern.michaelsen@libreoffice.org> | 2018-05-12 23:20:31 +0200 |
commit | 877242c09e0c2aebb2c437c8733c4d4c6774b2eb (patch) | |
tree | 1b73d41370340486cae94de8e8e6725908a18aaf | |
parent | 4b6dcbbd4f4334538712b5d5140db6403b640cc6 (diff) |
dont use SwClient/SwModify in unocore: TextMarkup
Change-Id: I160ca544122609a5c35b6bf2739581769cd46295
Reviewed-on: https://gerrit.libreoffice.org/54157
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Björn Michaelsen <bjoern.michaelsen@libreoffice.org>
-rw-r--r-- | sw/inc/ndtxt.hxx | 5 | ||||
-rw-r--r-- | sw/source/core/unocore/unotextmarkup.cxx | 22 |
2 files changed, 17 insertions, 10 deletions
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx index 1fa043fcd44a..50cc3a75172f 100644 --- a/sw/inc/ndtxt.hxx +++ b/sw/inc/ndtxt.hxx @@ -70,7 +70,10 @@ namespace com { namespace sun { namespace star { typedef std::set< sal_Int32 > SwSoftPageBreakList; /// SwTextNode is a paragraph in the document model. -class SW_DLLPUBLIC SwTextNode: public SwContentNode, public ::sfx2::Metadatable +class SW_DLLPUBLIC SwTextNode + : public SwContentNode + , public ::sfx2::Metadatable + , public sw::BroadcasterMixin { friend class SwContentNode; /// For creating the first TextNode. diff --git a/sw/source/core/unocore/unotextmarkup.cxx b/sw/source/core/unocore/unotextmarkup.cxx index 094e5909613f..1cd5d76e779a 100644 --- a/sw/source/core/unocore/unotextmarkup.cxx +++ b/sw/source/core/unocore/unotextmarkup.cxx @@ -19,6 +19,7 @@ #include <unotextmarkup.hxx> +#include <svl/listener.hxx> #include <vcl/svapp.hxx> #include <SwSmartTagMgr.hxx> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> @@ -43,20 +44,20 @@ using namespace ::com::sun::star; struct SwXTextMarkup::Impl - : public SwClient + : public SvtListener { SwTextNode* m_pTextNode; ModelToViewHelper const m_ConversionMap; - Impl(SwTextNode *const pTextNode, const ModelToViewHelper& rMap) - : SwClient(pTextNode) - , m_pTextNode(pTextNode) + Impl(SwTextNode* const pTextNode, const ModelToViewHelper& rMap) + : m_pTextNode(pTextNode) , m_ConversionMap(rMap) { + if(m_pTextNode) + StartListening(pTextNode->GetNotifier()); } - // SwClient - virtual void Modify(const SfxPoolItem *pOld, const SfxPoolItem *pNew) override; + virtual void Notify(const SfxHint& rHint) override; }; SwXTextMarkup::SwXTextMarkup( @@ -77,6 +78,7 @@ SwTextNode* SwXTextMarkup::GetTextNode() void SwXTextMarkup::ClearTextNode() { m_pImpl->m_pTextNode = nullptr; + m_pImpl->EndListeningAll(); } const ModelToViewHelper& SwXTextMarkup::GetConversionMap() @@ -474,11 +476,13 @@ void SAL_CALL SwXTextMarkup::commitMultiTextMarkup( finishGrammarCheck(*m_pImpl->m_pTextNode); } -void SwXTextMarkup::Impl::Modify( const SfxPoolItem* /*pOld*/, const SfxPoolItem* /*pNew*/ ) +void SwXTextMarkup::Impl::Notify(const SfxHint& rHint) { DBG_TESTSOLARMUTEX(); - EndListeningAll(); - m_pTextNode = nullptr; + if(rHint.GetId() == SfxHintId::Dying) + { + m_pTextNode = nullptr; + } } SwXStringKeyMap::SwXStringKeyMap() |