[Libreoffice-commits] core.git: sw/source
Bjoern Michaelsen
bjoern.michaelsen at libreoffice.org
Tue May 29 18:08:49 UTC 2018
sw/source/core/unocore/unofield.cxx | 41 ++++++++++++++----------------------
1 file changed, 17 insertions(+), 24 deletions(-)
New commits:
commit aec1f4a12c1b94339d6d9ed32ffa012002df3f9c
Author: Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
Date: Thu May 10 10:51:42 2018 +0200
dont use SwClient/SwModify in unocore: FieldEnumeration
Change-Id: Ia307836869e54ab8f5a9727c913979cee4f259f4
Reviewed-on: https://gerrit.libreoffice.org/54868
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Björn Michaelsen <bjoern.michaelsen at libreoffice.org>
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: */
More information about the Libreoffice-commits
mailing list