Kaydet (Commit) bf03f0b9 authored tarafından Bjoern Michaelsen's avatar Bjoern Michaelsen Kaydeden (comit) Björn Michaelsen

UNO SwXCellRange: uso SvtListener instead of SwClient

Change-Id: Id4fbe6e16bb63e3df2768ce38161847ea6ff7eec
Reviewed-on: https://gerrit.libreoffice.org/68406
Tested-by: Jenkins
Reviewed-by: 's avatarBjörn Michaelsen <bjoern.michaelsen@libreoffice.org>
üst 8bfb9bcd
...@@ -3141,10 +3141,11 @@ uno::Sequence<OUString> SwXTextTable::getSupportedServiceNames() ...@@ -3141,10 +3141,11 @@ uno::Sequence<OUString> SwXTextTable::getSupportedServiceNames()
class SwXCellRange::Impl class SwXCellRange::Impl
: public SwClient : public SvtListener
{ {
private: private:
::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2 ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2
SwFrameFormat* m_pFrameFormat;
public: public:
uno::WeakReference<uno::XInterface> m_wThis; uno::WeakReference<uno::XInterface> m_wThis;
...@@ -3158,9 +3159,8 @@ public: ...@@ -3158,9 +3159,8 @@ public:
bool m_bFirstRowAsLabel; bool m_bFirstRowAsLabel;
bool m_bFirstColumnAsLabel; bool m_bFirstColumnAsLabel;
Impl(sw::UnoCursorPointer const& pCursor, SwFrameFormat& rFrameFormat, Impl(sw::UnoCursorPointer const& pCursor, SwFrameFormat& rFrameFormat, SwRangeDescriptor const& rDesc)
SwRangeDescriptor const & rDesc) : m_pFrameFormat(&rFrameFormat)
: SwClient(&rFrameFormat)
, m_ChartListeners(m_Mutex) , m_ChartListeners(m_Mutex)
, m_pTableCursor(pCursor) , m_pTableCursor(pCursor)
, m_RangeDescriptor(rDesc) , m_RangeDescriptor(rDesc)
...@@ -3168,12 +3168,13 @@ public: ...@@ -3168,12 +3168,13 @@ public:
, m_bFirstRowAsLabel(false) , m_bFirstRowAsLabel(false)
, m_bFirstColumnAsLabel(false) , m_bFirstColumnAsLabel(false)
{ {
StartListening(rFrameFormat.GetNotifier());
m_RangeDescriptor.Normalize(); m_RangeDescriptor.Normalize();
} }
SwFrameFormat* GetFrameFormat() SwFrameFormat* GetFrameFormat()
{ {
return static_cast<SwFrameFormat*>(GetRegisteredIn()); return m_pFrameFormat;
} }
std::tuple<sal_uInt32, sal_uInt32, sal_uInt32, sal_uInt32> GetLabelCoordinates(bool bRow); std::tuple<sal_uInt32, sal_uInt32, sal_uInt32, sal_uInt32> GetLabelCoordinates(bool bRow);
...@@ -3186,8 +3187,7 @@ public: ...@@ -3186,8 +3187,7 @@ public:
sal_Int32 GetRowCount(); sal_Int32 GetRowCount();
sal_Int32 GetColumnCount(); sal_Int32 GetColumnCount();
// SwClient virtual void Notify(const SfxHint& ) override;
virtual void Modify(const SfxPoolItem *pOld, const SfxPoolItem *pNew) override;
}; };
...@@ -3853,24 +3853,20 @@ const SwUnoCursor* SwXCellRange::GetTableCursor() const ...@@ -3853,24 +3853,20 @@ const SwUnoCursor* SwXCellRange::GetTableCursor() const
return pFormat ? &(*m_pImpl->m_pTableCursor) : nullptr; return pFormat ? &(*m_pImpl->m_pTableCursor) : nullptr;
} }
void SwXCellRange::Impl::Modify( void SwXCellRange::Impl::Notify( const SfxHint& rHint )
SfxPoolItem const*const pOld, SfxPoolItem const*const pNew)
{ {
ClientModify(this, pOld, pNew);
uno::Reference<uno::XInterface> const xThis(m_wThis); uno::Reference<uno::XInterface> const xThis(m_wThis);
if (!xThis.is()) if(rHint.GetId() == SfxHintId::Dying)
{ // fdo#72695: if UNO object is already dead, don't revive it with event
return;
}
if(!GetRegisteredIn() || !m_pTableCursor)
{ {
m_pFrameFormat = nullptr;
m_pTableCursor.reset(nullptr); m_pTableCursor.reset(nullptr);
lang::EventObject const ev(xThis);
m_ChartListeners.disposeAndClear(ev);
} }
else if (xThis.is())
{ { // fdo#72695: if UNO object is already dead, don't revive it with event
lcl_SendChartEvent(xThis.get(), m_ChartListeners); if(m_pFrameFormat)
lcl_SendChartEvent(xThis.get(), m_ChartListeners);
else
m_ChartListeners.disposeAndClear(lang::EventObject(xThis));
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment