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

no more SwClient/SwModify for SwTextTableRows

Change-Id: I267904c751c9b32b9b64b0cf1b7f9d922bc7e1f7
Reviewed-on: https://gerrit.libreoffice.org/63529
Tested-by: Jenkins
Reviewed-by: 's avatarBjörn Michaelsen <bjoern.michaelsen@libreoffice.org>
üst 29505908
......@@ -148,22 +148,17 @@ public:
css::uno::Any GetAny() const;
};
class SwXTextTableRow final : public cppu::WeakImplHelper
<
css::beans::XPropertySet,
css::lang::XServiceInfo
>,
public SwClient
class SwXTextTableRow final
: public cppu::WeakImplHelper<css::beans::XPropertySet, css::lang::XServiceInfo>
, public SvtListener
{
const SfxItemPropertySet* m_pPropSet;
SwTableLine* pLine;
SwFrameFormat* m_pFormat;
SwTableLine* pLine;
const SfxItemPropertySet* m_pPropSet;
SwFrameFormat* GetFrameFormat() { return static_cast<SwFrameFormat*>(GetRegisteredIn()); }
const SwFrameFormat* GetFrameFormat() const { return const_cast<SwXTextTableRow*>(this)->GetFrameFormat(); }
SwFrameFormat* GetFrameFormat() { return m_pFormat; }
const SwFrameFormat* GetFrameFormat() const { return m_pFormat; }
virtual ~SwXTextTableRow() override;
//SwClient
virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) override;
virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
public:
SwXTextTableRow(SwFrameFormat* pFormat, SwTableLine* pLine);
......@@ -184,6 +179,8 @@ public:
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
static SwTableLine* FindLine(SwTable* pTable, SwTableLine const * pLine);
void Notify(const SfxHint&) override;
};
typedef cppu::WeakImplHelper<
......
......@@ -1300,10 +1300,12 @@ uno::Sequence< OUString > SwXTextTableRow::getSupportedServiceNames()
SwXTextTableRow::SwXTextTableRow(SwFrameFormat* pFormat, SwTableLine* pLn) :
SwClient(pFormat),
m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_TABLE_ROW)),
pLine(pLn)
{ }
m_pFormat(pFormat),
pLine(pLn),
m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_TABLE_ROW))
{
StartListening(m_pFormat->GetNotifier());
}
SwXTextTableRow::~SwXTextTableRow()
{
......@@ -1452,18 +1454,16 @@ void SwXTextTableRow::addVetoableChangeListener(const OUString& /*rPropertyName*
void SwXTextTableRow::removeVetoableChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/)
{ throw uno::RuntimeException("not implemented", static_cast<cppu::OWeakObject*>(this)); };
void SwXTextTableRow::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
{ ClientModify(this, pOld, pNew); }
void SwXTextTableRow::SwClientNotify(const SwModify& rModify, const SfxHint& rHint)
void SwXTextTableRow::Notify(const SfxHint& rHint)
{
if(auto pFindHint = dynamic_cast<const FindUnoInstanceHint<SwTableLine, SwXTextTableRow>*>(&rHint))
if(rHint.GetId() == SfxHintId::Dying)
{
m_pFormat = nullptr;
} else if(auto pFindHint = dynamic_cast<const FindUnoInstanceHint<SwTableLine, SwXTextTableRow>*>(&rHint))
{
if(!pFindHint->m_pCore && pFindHint->m_pCore == pLine)
pFindHint->m_pResult = this;
}
else
SwClient::SwClientNotify(rModify, rHint);
}
SwTableLine* SwXTextTableRow::FindLine(SwTable* pTable, SwTableLine const * pLine)
......@@ -3961,7 +3961,7 @@ uno::Any SwXTableRows::getByIndex(sal_Int32 nIndex)
throw lang::IndexOutOfBoundsException();
SwTableLine* pLine = pTable->GetTabLines()[nIndex];
FindUnoInstanceHint<SwTableLine,SwXTextTableRow> aHint{pLine};
pFrameFormat->CallSwClientNotify(aHint);
pFrameFormat->GetNotifier().Broadcast(aHint);
if(!aHint.m_pResult)
aHint.m_pResult = new SwXTextTableRow(pFrameFormat, pLine);
uno::Reference<beans::XPropertySet> xRet = static_cast<beans::XPropertySet*>(aHint.m_pResult);
......
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