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 @@ ...@@ -34,6 +34,8 @@
#include <comphelper/uno3.hxx> #include <comphelper/uno3.hxx>
#include <svl/listener.hxx>
#include "calbck.hxx" #include "calbck.hxx"
#include "TextCursorHelper.hxx" #include "TextCursorHelper.hxx"
#include "unotext.hxx" #include "unotext.hxx"
...@@ -57,7 +59,7 @@ cppu::WeakImplHelper ...@@ -57,7 +59,7 @@ cppu::WeakImplHelper
SwXCellBaseClass; SwXCellBaseClass;
class SwXCell final : public SwXCellBaseClass, class SwXCell final : public SwXCellBaseClass,
public SwXText, public SwXText,
public SwClient public SvtListener
{ {
friend void sw_setString( SwXCell &rCell, const OUString &rText, friend void sw_setString( SwXCell &rCell, const OUString &rText,
bool bKeepNumberFormat ); bool bKeepNumberFormat );
...@@ -66,6 +68,7 @@ class SwXCell final : public SwXCellBaseClass, ...@@ -66,6 +68,7 @@ class SwXCell final : public SwXCellBaseClass,
const SfxItemPropertySet* m_pPropSet; const SfxItemPropertySet* m_pPropSet;
SwTableBox* pBox; // only set in non-XML import SwTableBox* pBox; // only set in non-XML import
const SwStartNode* pStartNode; // only set in XML import const SwStartNode* pStartNode; // only set in XML import
SwFrameFormat* m_pTableFormat;
// table position where pBox was found last // table position where pBox was found last
size_t nFndPos; size_t nFndPos;
...@@ -80,9 +83,7 @@ class SwXCell final : public SwXCellBaseClass, ...@@ -80,9 +83,7 @@ class SwXCell final : public SwXCellBaseClass,
virtual ~SwXCell() override; virtual ~SwXCell() override;
//SwClient virtual void Notify(const SfxHint&) override;
virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) override;
virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
public: public:
SwXCell(SwFrameFormat* pTableFormat, SwTableBox* pBox, size_t nPos); SwXCell(SwFrameFormat* pTableFormat, SwTableBox* pBox, size_t nPos);
...@@ -142,7 +143,7 @@ public: ...@@ -142,7 +143,7 @@ public:
SwTableBox* GetTableBox() const { return pBox; } SwTableBox* GetTableBox() const { return pBox; }
static SwXCell* CreateXCell(SwFrameFormat* pTableFormat, SwTableBox* pBox, SwTable *pTable = nullptr ); static SwXCell* CreateXCell(SwFrameFormat* pTableFormat, SwTableBox* pBox, SwTable *pTable = nullptr );
SwTableBox* FindBox(SwTable* pTable, SwTableBox* pBox); 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; double GetForcedNumericalValue() const;
css::uno::Any GetAny() const; css::uno::Any GetAny() const;
}; };
......
...@@ -757,22 +757,24 @@ void sw_setValue( SwXCell &rCell, double nVal ) ...@@ -757,22 +757,24 @@ void sw_setValue( SwXCell &rCell, double nVal )
SwXCell::SwXCell(SwFrameFormat* pTableFormat, SwTableBox* pBx, size_t const nPos) : SwXCell::SwXCell(SwFrameFormat* pTableFormat, SwTableBox* pBx, size_t const nPos) :
SwXText(pTableFormat->GetDoc(), CursorType::TableText), SwXText(pTableFormat->GetDoc(), CursorType::TableText),
SwClient(pTableFormat),
m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TABLE_CELL)), m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TABLE_CELL)),
pBox(pBx), pBox(pBx),
pStartNode(nullptr), pStartNode(nullptr),
m_pTableFormat(pTableFormat),
nFndPos(nPos) nFndPos(nPos)
{ {
StartListening(pTableFormat->GetNotifier());
} }
SwXCell::SwXCell(SwFrameFormat* pTableFormat, const SwStartNode& rStartNode) : SwXCell::SwXCell(SwFrameFormat* pTableFormat, const SwStartNode& rStartNode) :
SwXText(pTableFormat->GetDoc(), CursorType::TableText), SwXText(pTableFormat->GetDoc(), CursorType::TableText),
SwClient(pTableFormat),
m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TABLE_CELL)), m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TABLE_CELL)),
pBox(nullptr), pBox(nullptr),
pStartNode(&rStartNode), pStartNode(&rStartNode),
m_pTableFormat(pTableFormat),
nFndPos(NOTFOUND) nFndPos(NOTFOUND)
{ {
StartListening(pTableFormat->GetNotifier());
} }
SwXCell::~SwXCell() SwXCell::~SwXCell()
...@@ -1172,20 +1174,17 @@ sal_Bool SwXCell::hasElements() ...@@ -1172,20 +1174,17 @@ sal_Bool SwXCell::hasElements()
return true; return true;
} }
void SwXCell::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) void SwXCell::Notify(const SfxHint& rHint)
{ {
ClientModify(this, pOld, pNew); if(rHint.GetId() == SfxHintId::Dying)
} {
m_pTableFormat = nullptr;
void SwXCell::SwClientNotify(const SwModify& rModify, const SfxHint& rHint) }
{ else if(auto pFindHint = dynamic_cast<const FindUnoInstanceHint<SwTableBox, SwXCell>*>(&rHint))
if(auto pFindHint = dynamic_cast<const FindUnoInstanceHint<SwTableBox, SwXCell>*>(&rHint))
{ {
if(!pFindHint->m_pResult && pFindHint->m_pCore == GetTableBox()) if(!pFindHint->m_pResult && pFindHint->m_pCore == GetTableBox())
pFindHint->m_pResult = this; pFindHint->m_pResult = this;
} }
else
SwClient::SwClientNotify(rModify, rHint);
} }
SwXCell* SwXCell::CreateXCell(SwFrameFormat* pTableFormat, SwTableBox* pBox, SwTable *pTable ) SwXCell* SwXCell::CreateXCell(SwFrameFormat* pTableFormat, SwTableBox* pBox, SwTable *pTable )
...@@ -1199,7 +1198,7 @@ SwXCell* SwXCell::CreateXCell(SwFrameFormat* pTableFormat, SwTableBox* pBox, SwT ...@@ -1199,7 +1198,7 @@ SwXCell* SwXCell::CreateXCell(SwFrameFormat* pTableFormat, SwTableBox* pBox, SwT
return nullptr; return nullptr;
size_t const nPos = it - pTable->GetTabSortBoxes().begin(); size_t const nPos = it - pTable->GetTabSortBoxes().begin();
FindUnoInstanceHint<SwTableBox, SwXCell> aHint{pBox}; FindUnoInstanceHint<SwTableBox, SwXCell> aHint{pBox};
pTableFormat->CallSwClientNotify(aHint); pTableFormat->GetNotifier().Broadcast(aHint);
return aHint.m_pResult ? aHint.m_pResult : new SwXCell(pTableFormat, pBox, nPos); 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