summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@libreoffice.org>2018-11-12 22:29:39 +0100
committerBjörn Michaelsen <bjoern.michaelsen@libreoffice.org>2018-11-13 22:55:43 +0100
commit036e7d8ca0527fc6bebda2c1745750e04dbd3d1f (patch)
tree074843306299789eda5485c88992ab94a26c6a49
parent9950e50a0f304362f569d4dc0bd9ca30b7b6291d (diff)
no more SwClient/SwModify for SwXCell
Change-Id: I014d3e8eed3f65e4eb09ac53c6d34886a2d1086a Reviewed-on: https://gerrit.libreoffice.org/63310 Tested-by: Jenkins Reviewed-by: Björn Michaelsen <bjoern.michaelsen@libreoffice.org>
-rw-r--r--sw/inc/unotbl.hxx11
-rw-r--r--sw/source/core/unocore/unotbl.cxx23
2 files changed, 17 insertions, 17 deletions
diff --git a/sw/inc/unotbl.hxx b/sw/inc/unotbl.hxx
index 83dbb04c951c..59a762a6f4f4 100644
--- a/sw/inc/unotbl.hxx
+++ b/sw/inc/unotbl.hxx
@@ -34,6 +34,8 @@
#include <comphelper/uno3.hxx>
+#include <svl/listener.hxx>
+
#include "calbck.hxx"
#include "TextCursorHelper.hxx"
#include "unotext.hxx"
@@ -57,7 +59,7 @@ cppu::WeakImplHelper
SwXCellBaseClass;
class SwXCell final : public SwXCellBaseClass,
public SwXText,
- public SwClient
+ public SvtListener
{
friend void sw_setString( SwXCell &rCell, const OUString &rText,
bool bKeepNumberFormat );
@@ -66,6 +68,7 @@ class SwXCell final : public SwXCellBaseClass,
const SfxItemPropertySet* m_pPropSet;
SwTableBox* pBox; // only set in non-XML import
const SwStartNode* pStartNode; // only set in XML import
+ SwFrameFormat* m_pTableFormat;
// table position where pBox was found last
size_t nFndPos;
@@ -80,9 +83,7 @@ class SwXCell final : public SwXCellBaseClass,
virtual ~SwXCell() override;
- //SwClient
- virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) override;
- virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
+ virtual void Notify(const SfxHint&) override;
public:
SwXCell(SwFrameFormat* pTableFormat, SwTableBox* pBox, size_t nPos);
@@ -142,7 +143,7 @@ public:
SwTableBox* GetTableBox() const { return pBox; }
static SwXCell* CreateXCell(SwFrameFormat* pTableFormat, SwTableBox* pBox, SwTable *pTable = nullptr );
SwTableBox* FindBox(SwTable* pTable, SwTableBox* pBox);
- SwFrameFormat* GetFrameFormat() const { return const_cast<SwFrameFormat*>(static_cast<const SwFrameFormat*>(GetRegisteredIn())); }
+ SwFrameFormat* GetFrameFormat() const { return m_pTableFormat; }
double GetForcedNumericalValue() const;
css::uno::Any GetAny() const;
};
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 0d99f14f1b26..268b2f542622 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -757,22 +757,24 @@ void sw_setValue( SwXCell &rCell, double nVal )
SwXCell::SwXCell(SwFrameFormat* pTableFormat, SwTableBox* pBx, size_t const nPos) :
SwXText(pTableFormat->GetDoc(), CursorType::TableText),
- SwClient(pTableFormat),
m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TABLE_CELL)),
pBox(pBx),
pStartNode(nullptr),
+ m_pTableFormat(pTableFormat),
nFndPos(nPos)
{
+ StartListening(pTableFormat->GetNotifier());
}
SwXCell::SwXCell(SwFrameFormat* pTableFormat, const SwStartNode& rStartNode) :
SwXText(pTableFormat->GetDoc(), CursorType::TableText),
- SwClient(pTableFormat),
m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TABLE_CELL)),
pBox(nullptr),
pStartNode(&rStartNode),
+ m_pTableFormat(pTableFormat),
nFndPos(NOTFOUND)
{
+ StartListening(pTableFormat->GetNotifier());
}
SwXCell::~SwXCell()
@@ -1172,20 +1174,17 @@ sal_Bool SwXCell::hasElements()
return true;
}
-void SwXCell::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
+void SwXCell::Notify(const SfxHint& rHint)
{
- ClientModify(this, pOld, pNew);
-}
-
-void SwXCell::SwClientNotify(const SwModify& rModify, const SfxHint& rHint)
-{
- if(auto pFindHint = dynamic_cast<const FindUnoInstanceHint<SwTableBox, SwXCell>*>(&rHint))
+ if(rHint.GetId() == SfxHintId::Dying)
+ {
+ m_pTableFormat = nullptr;
+ }
+ else if(auto pFindHint = dynamic_cast<const FindUnoInstanceHint<SwTableBox, SwXCell>*>(&rHint))
{
if(!pFindHint->m_pResult && pFindHint->m_pCore == GetTableBox())
pFindHint->m_pResult = this;
}
- else
- SwClient::SwClientNotify(rModify, rHint);
}
SwXCell* SwXCell::CreateXCell(SwFrameFormat* pTableFormat, SwTableBox* pBox, SwTable *pTable )
@@ -1199,7 +1198,7 @@ SwXCell* SwXCell::CreateXCell(SwFrameFormat* pTableFormat, SwTableBox* pBox, SwT
return nullptr;
size_t const nPos = it - pTable->GetTabSortBoxes().begin();
FindUnoInstanceHint<SwTableBox, SwXCell> aHint{pBox};
- pTableFormat->CallSwClientNotify(aHint);
+ pTableFormat->GetNotifier().Broadcast(aHint);
return aHint.m_pResult ? aHint.m_pResult : new SwXCell(pTableFormat, pBox, nPos);
}