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-29 20:08:23 +0200 |
commit | aec1f4a12c1b94339d6d9ed32ffa012002df3f9c (patch) | |
tree | 569b58e08a8d0a29991df9f21ba9f7b0dd7d7f84 /sw | |
parent | 46ac529c44d513c31942f13dd5b40f3e5d7c363f (diff) |
dont use SwClient/SwModify in unocore: FieldEnumeration
Change-Id: Ia307836869e54ab8f5a9727c913979cee4f259f4
Reviewed-on: https://gerrit.libreoffice.org/54868
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/unofield.cxx | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index 030125a8f44b..d87a4539742b 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -86,6 +86,7 @@ #include <scriptinfo.hxx> #include <tools/datetime.hxx> #include <tools/urlobj.hxx> +#include <svl/listener.hxx> #include <svx/dataaccessdescriptor.hxx> #include <o3tl/any.hxx> #include <osl/mutex.hxx> @@ -2895,24 +2896,25 @@ void SAL_CALL SwXTextFieldTypes::removeRefreshListener( } class SwXFieldEnumeration::Impl - : public SwClient + : public SvtListener { - public: - SwDoc * m_pDoc; - - std::vector< uno::Reference<text::XTextField> > m_Items; - sal_Int32 m_nNextIndex; ///< index of next element to be returned + SwDoc* m_pDoc; + std::vector<uno::Reference<text::XTextField>> m_Items; + sal_Int32 m_nNextIndex; ///< index of next element to be returned - explicit Impl(SwDoc & rDoc) - : SwClient(rDoc.getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)) - , m_pDoc(& rDoc) + explicit Impl(SwDoc& rDoc) + : m_pDoc(&rDoc) , m_nNextIndex(0) - { } + { + StartListening(rDoc.getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->GetNotifier()); + } -protected: - // SwClient - virtual void Modify(SfxPoolItem const* pOld, SfxPoolItem const* pNew) override; + virtual void Notify(const SfxHint& rHint) override + { + if(rHint.GetId() == SfxHintId::Dying) + m_pDoc = nullptr; + } }; OUString SAL_CALL @@ -2926,11 +2928,10 @@ sal_Bool SAL_CALL SwXFieldEnumeration::supportsService(const OUString& rServiceN return cppu::supportsService(this, rServiceName); } -uno::Sequence< OUString > SAL_CALL +uno::Sequence<OUString> SAL_CALL SwXFieldEnumeration::getSupportedServiceNames() { - uno::Sequence<OUString> aRet { "com.sun.star.text.FieldEnumeration" }; - return aRet; + return { "com.sun.star.text.FieldEnumeration" }; } SwXFieldEnumeration::SwXFieldEnumeration(SwDoc & rDoc) @@ -2996,12 +2997,4 @@ uno::Any SAL_CALL SwXFieldEnumeration::nextElement() return aRet; } -void SwXFieldEnumeration::Impl::Modify( - SfxPoolItem const*const pOld, SfxPoolItem const*const pNew) -{ - ClientModify(this, pOld, pNew); - if(!GetRegisteredIn()) - m_pDoc = nullptr; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |