[Libreoffice-commits] core.git: sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Feb 27 06:56:17 UTC 2019


 sw/source/core/unocore/unotbl.cxx |   36 ++++++++++++++++--------------------
 1 file changed, 16 insertions(+), 20 deletions(-)

New commits:
commit bf03f0b9b7f1dfc054c0d985f38147c4e875bd9f
Author:     Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
AuthorDate: Tue Feb 26 21:16:13 2019 +0100
Commit:     Björn Michaelsen <bjoern.michaelsen at libreoffice.org>
CommitDate: Wed Feb 27 07:55:55 2019 +0100

    UNO SwXCellRange: uso SvtListener instead of SwClient
    
    Change-Id: Id4fbe6e16bb63e3df2768ce38161847ea6ff7eec
    Reviewed-on: https://gerrit.libreoffice.org/68406
    Tested-by: Jenkins
    Reviewed-by: Björn Michaelsen <bjoern.michaelsen at libreoffice.org>

diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 5cfd4d29a185..8b5405e53970 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -3141,10 +3141,11 @@ uno::Sequence<OUString> SwXTextTable::getSupportedServiceNames()
 
 
 class SwXCellRange::Impl
-    : public SwClient
+    : public SvtListener
 {
 private:
     ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2
+    SwFrameFormat* m_pFrameFormat;
 
 public:
     uno::WeakReference<uno::XInterface> m_wThis;
@@ -3158,9 +3159,8 @@ public:
     bool m_bFirstRowAsLabel;
     bool m_bFirstColumnAsLabel;
 
-    Impl(sw::UnoCursorPointer const& pCursor, SwFrameFormat& rFrameFormat,
-            SwRangeDescriptor const & rDesc)
-        : SwClient(&rFrameFormat)
+    Impl(sw::UnoCursorPointer const& pCursor, SwFrameFormat& rFrameFormat, SwRangeDescriptor const& rDesc)
+        : m_pFrameFormat(&rFrameFormat)
         , m_ChartListeners(m_Mutex)
         , m_pTableCursor(pCursor)
         , m_RangeDescriptor(rDesc)
@@ -3168,12 +3168,13 @@ public:
         , m_bFirstRowAsLabel(false)
         , m_bFirstColumnAsLabel(false)
     {
+        StartListening(rFrameFormat.GetNotifier());
         m_RangeDescriptor.Normalize();
     }
 
     SwFrameFormat* GetFrameFormat()
     {
-        return static_cast<SwFrameFormat*>(GetRegisteredIn());
+        return m_pFrameFormat;
     }
 
     std::tuple<sal_uInt32, sal_uInt32, sal_uInt32, sal_uInt32> GetLabelCoordinates(bool bRow);
@@ -3186,8 +3187,7 @@ public:
     sal_Int32 GetRowCount();
     sal_Int32 GetColumnCount();
 
-    // SwClient
-    virtual void Modify(const SfxPoolItem *pOld, const SfxPoolItem *pNew) override;
+    virtual void Notify(const SfxHint& ) override;
 
 };
 
@@ -3853,24 +3853,20 @@ const SwUnoCursor* SwXCellRange::GetTableCursor() const
     return pFormat ? &(*m_pImpl->m_pTableCursor) : nullptr;
 }
 
-void SwXCellRange::Impl::Modify(
-        SfxPoolItem const*const pOld, SfxPoolItem const*const pNew)
+void SwXCellRange::Impl::Notify( const SfxHint& rHint )
 {
-    ClientModify(this, pOld, pNew);
     uno::Reference<uno::XInterface> const xThis(m_wThis);
-    if (!xThis.is())
-    {   // fdo#72695: if UNO object is already dead, don't revive it with event
-        return;
-    }
-    if(!GetRegisteredIn() || !m_pTableCursor)
+    if(rHint.GetId() == SfxHintId::Dying)
     {
+        m_pFrameFormat = nullptr;
         m_pTableCursor.reset(nullptr);
-        lang::EventObject const ev(xThis);
-        m_ChartListeners.disposeAndClear(ev);
     }
-    else
-    {
-        lcl_SendChartEvent(xThis.get(), m_ChartListeners);
+    if (xThis.is())
+    {   // fdo#72695: if UNO object is already dead, don't revive it with event
+        if(m_pFrameFormat)
+            lcl_SendChartEvent(xThis.get(), m_ChartListeners);
+        else
+            m_ChartListeners.disposeAndClear(lang::EventObject(xThis));
     }
 }
 


More information about the Libreoffice-commits mailing list