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

no more SwClient/SwModify for SwXCell

Change-Id: I014d3e8eed3f65e4eb09ac53c6d34886a2d1086a
Reviewed-on: https://gerrit.libreoffice.org/63310
Tested-by: Jenkins
Reviewed-by: 's avatarBjörn Michaelsen <bjoern.michaelsen@libreoffice.org>
üst 9950e50a
......@@ -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;
};
......
......@@ -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);
}
......
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