summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@libreoffice.org>2019-02-27 20:55:26 +0100
committerBjörn Michaelsen <bjoern.michaelsen@libreoffice.org>2019-03-16 13:51:20 +0100
commit65fde448d391195e5fcf942f8dd541ab6023ff9a (patch)
tree75c8432c0f786fd7d90e074e63ce6f23cd6134e5 /sw
parent368059f7f6abd6eed2a5a1bd142d406f14cf9ecb (diff)
UNO SwXTableTextCursor: uso SvtListener instead of SwClient
Change-Id: Ie026909a1822c0e928f022e61b14e785224f5d17 Reviewed-on: https://gerrit.libreoffice.org/68472 Tested-by: Jenkins Reviewed-by: Björn Michaelsen <bjoern.michaelsen@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/unotbl.hxx28
-rw-r--r--sw/source/core/unocore/unotbl.cxx23
2 files changed, 28 insertions, 23 deletions
diff --git a/sw/inc/unotbl.hxx b/sw/inc/unotbl.hxx
index d96a969f333e..f3061f309faf 100644
--- a/sw/inc/unotbl.hxx
+++ b/sw/inc/unotbl.hxx
@@ -184,20 +184,20 @@ public:
};
typedef cppu::WeakImplHelper<
- css::text::XTextTableCursor,
- css::lang::XServiceInfo,
- css::beans::XPropertySet
- > SwXTextTableCursor_Base;
-class SW_DLLPUBLIC SwXTextTableCursor : public SwXTextTableCursor_Base
- ,public SwClient
- ,public OTextCursorHelper
+ css::text::XTextTableCursor,
+ css::lang::XServiceInfo,
+ css::beans::XPropertySet> SwXTextTableCursor_Base;
+class SW_DLLPUBLIC SwXTextTableCursor
+ : public SwXTextTableCursor_Base
+ , public SvtListener
+ , public OTextCursorHelper
{
- const SfxItemPropertySet* m_pPropSet;
+ SwFrameFormat* m_pFrameFormat;
+ const SfxItemPropertySet* m_pPropSet;
public:
- SwXTextTableCursor(SwFrameFormat* pFormat, SwTableBox const * pBox);
- SwXTextTableCursor(SwFrameFormat& rTableFormat,
- const SwTableCursor* pTableSelection);
+ SwXTextTableCursor(SwFrameFormat* pFormat, SwTableBox const* pBox);
+ SwXTextTableCursor(SwFrameFormat& rTableFormat, const SwTableCursor* pTableSelection);
DECLARE_XINTERFACE()
//XTextTableCursor
@@ -226,8 +226,6 @@ public:
virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
- //SwClient
- virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) override;
// ITextCursorHelper
virtual const SwPaM* GetPaM() const override;
@@ -235,10 +233,12 @@ public:
virtual const SwDoc* GetDoc() const override;
virtual SwDoc* GetDoc() override;
+ virtual void Notify( const SfxHint& ) override;
+
const SwUnoCursor& GetCursor() const;
SwUnoCursor& GetCursor();
sw::UnoCursorPointer m_pUnoCursor;
- SwFrameFormat* GetFrameFormat() const { return const_cast<SwFrameFormat*>(static_cast<const SwFrameFormat*>(GetRegisteredIn())); }
+ SwFrameFormat* GetFrameFormat() const { return m_pFrameFormat; }
};
struct SwRangeDescriptor
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 2db210758520..8badc4d54978 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -1479,11 +1479,12 @@ SwUnoCursor& SwXTextTableCursor::GetCursor() { return *m_pUnoCurs
uno::Sequence<OUString> SwXTextTableCursor::getSupportedServiceNames()
{ return {"com.sun.star.text.TextTableCursor"}; }
-SwXTextTableCursor::SwXTextTableCursor(SwFrameFormat* pFormat, SwTableBox const * pBox) :
- SwClient(pFormat),
- m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_TABLE_CURSOR))
+SwXTextTableCursor::SwXTextTableCursor(SwFrameFormat* pFrameFormat, SwTableBox const* pBox)
+ : m_pFrameFormat(pFrameFormat)
+ , m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_TABLE_CURSOR))
{
- SwDoc* pDoc = pFormat->GetDoc();
+ StartListening(m_pFrameFormat->GetNotifier());
+ SwDoc* pDoc = m_pFrameFormat->GetDoc();
const SwStartNode* pSttNd = pBox->GetSttNd();
SwPosition aPos(*pSttNd);
m_pUnoCursor = pDoc->CreateUnoCursor(aPos, true);
@@ -1492,10 +1493,11 @@ SwXTextTableCursor::SwXTextTableCursor(SwFrameFormat* pFormat, SwTableBox const
rTableCursor.MakeBoxSels();
}
-SwXTextTableCursor::SwXTextTableCursor(SwFrameFormat& rTableFormat, const SwTableCursor* pTableSelection) :
- SwClient(&rTableFormat),
- m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_TABLE_CURSOR))
+SwXTextTableCursor::SwXTextTableCursor(SwFrameFormat& rTableFormat, const SwTableCursor* pTableSelection)
+ : m_pFrameFormat(&rTableFormat)
+ , m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_TABLE_CURSOR))
{
+ StartListening(m_pFrameFormat->GetNotifier());
m_pUnoCursor = pTableSelection->GetDoc()->CreateUnoCursor(*pTableSelection->GetPoint(), true);
if(pTableSelection->HasMark())
{
@@ -1768,8 +1770,11 @@ void SwXTextTableCursor::addVetoableChangeListener(const OUString& /*rPropertyNa
void SwXTextTableCursor::removeVetoableChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/)
{ throw uno::RuntimeException("not implemented", static_cast<cppu::OWeakObject*>(this)); };
-void SwXTextTableCursor::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
- { ClientModify(this, pOld, pNew); }
+void SwXTextTableCursor::Notify( const SfxHint& rHint )
+{
+ if(rHint.GetId() == SfxHintId::Dying)
+ m_pFrameFormat = nullptr;
+}
// SwXTextTable ===========================================================