SwTextRuby: SwClient no more
Change-Id: I2ff5a5af710302dff5de5bc42e514f3838a13655 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181757 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org> Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
+2
-2
@@ -80,10 +80,10 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class SW_DLLPUBLIC SwTextRuby final: public SwTextAttrNesting, public SwClient
|
||||
class SW_DLLPUBLIC SwTextRuby final: public SwTextAttrNesting, public SvtListener
|
||||
{
|
||||
SwTextNode* m_pTextNode;
|
||||
virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
|
||||
virtual void Notify(const SfxHint&) override;
|
||||
public:
|
||||
SwTextRuby(
|
||||
const SfxPoolItemHolder& rAttr,
|
||||
|
||||
@@ -229,7 +229,8 @@ void SwTextRuby::InitRuby(SwTextNode & rNode)
|
||||
ChgTextNode(&rNode);
|
||||
SwCharFormat * const pFormat(
|
||||
rNode.GetDoc().getIDocumentStylePoolAccess().GetCharFormatFromPool(RES_POOLCHR_RUBYTEXT) );
|
||||
pFormat->Add(*this);
|
||||
EndListeningAll();
|
||||
StartListening(pFormat->GetNotifier());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -257,7 +257,6 @@ SwTextRuby::SwTextRuby(
|
||||
sal_Int32 nEnd )
|
||||
: SwTextAttr( rAttr, nStart )
|
||||
, SwTextAttrNesting( rAttr, nStart, nEnd )
|
||||
, SwClient( nullptr )
|
||||
, m_pTextNode( nullptr )
|
||||
{
|
||||
SwFormatRuby& rSwFormatRuby(static_cast<SwFormatRuby&>(GetAttr()));
|
||||
@@ -268,41 +267,29 @@ SwTextRuby::~SwTextRuby()
|
||||
{
|
||||
}
|
||||
|
||||
void SwTextRuby::SwClientNotify(const SwModify&, const SfxHint& rHint)
|
||||
void SwTextRuby::Notify(const SfxHint& rHint)
|
||||
{
|
||||
if(lcl_CheckAutoFormatHint(rHint, m_pTextNode))
|
||||
return;
|
||||
if (rHint.GetId() == SfxHintId::SwFormatChange)
|
||||
sal_uInt16 nWhich = 0;
|
||||
switch(rHint.GetId())
|
||||
{
|
||||
if(!m_pTextNode)
|
||||
return;
|
||||
SwUpdateAttr aUpdateAttr(GetStart(), *GetEnd(), RES_UPDATEATTR_FMT_CHG);
|
||||
m_pTextNode->TriggerNodeUpdate(sw::UpdateAttrHint(&aUpdateAttr, &aUpdateAttr));
|
||||
}
|
||||
else if (rHint.GetId() == SfxHintId::SwAttrSetChange)
|
||||
{
|
||||
if(!m_pTextNode)
|
||||
return;
|
||||
SwUpdateAttr aUpdateAttr(GetStart(), *GetEnd(), RES_UPDATEATTR_ATTRSET_CHG);
|
||||
m_pTextNode->TriggerNodeUpdate(sw::UpdateAttrHint(&aUpdateAttr, &aUpdateAttr));
|
||||
}
|
||||
else if (rHint.GetId() == SfxHintId::SwObjectDying)
|
||||
{
|
||||
if(!m_pTextNode)
|
||||
return;
|
||||
SwUpdateAttr aUpdateAttr(GetStart(), *GetEnd(), RES_UPDATEATTR_OBJECTDYING);
|
||||
m_pTextNode->TriggerNodeUpdate(sw::UpdateAttrHint(&aUpdateAttr, &aUpdateAttr));
|
||||
}
|
||||
else if (rHint.GetId() == SfxHintId::SwLegacyModify)
|
||||
{
|
||||
auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
|
||||
const auto nWhich = pLegacy->GetWhich();
|
||||
assert( isCHRATR(nWhich) && "SwTextRuby::SwClientNotify(): unknown legacy hint");
|
||||
if(!m_pTextNode)
|
||||
return;
|
||||
SwUpdateAttr aUpdateAttr(GetStart(), *GetEnd(), nWhich);
|
||||
m_pTextNode->TriggerNodeUpdate(sw::UpdateAttrHint(&aUpdateAttr, &aUpdateAttr));
|
||||
case SfxHintId::SwAttrSetChange: nWhich = RES_UPDATEATTR_ATTRSET_CHG; break;
|
||||
case SfxHintId::SwFormatChange: nWhich = RES_UPDATEATTR_FMT_CHG; break;
|
||||
case SfxHintId::SwObjectDying: nWhich = RES_UPDATEATTR_OBJECTDYING; break;
|
||||
case SfxHintId::SwLegacyModify:
|
||||
{
|
||||
auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
|
||||
nWhich = pLegacy->GetWhich();
|
||||
assert( isCHRATR(nWhich) && "SwTextRuby::SwClientNotify(): unknown legacy hint");
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
if(!m_pTextNode || !nWhich)
|
||||
return;
|
||||
SwUpdateAttr aUpdateAttr(GetStart(), *GetEnd(), nWhich);
|
||||
m_pTextNode->TriggerNodeUpdate(sw::UpdateAttrHint(&aUpdateAttr, &aUpdateAttr));
|
||||
}
|
||||
|
||||
SwCharFormat* SwTextRuby::GetCharFormat()
|
||||
@@ -339,10 +326,9 @@ SwCharFormat* SwTextRuby::GetCharFormat()
|
||||
}
|
||||
}
|
||||
|
||||
if( pRet )
|
||||
pRet->Add(*this);
|
||||
else
|
||||
EndListeningAll();
|
||||
EndListeningAll();
|
||||
if(pRet)
|
||||
StartListening(pRet->GetNotifier());
|
||||
|
||||
return pRet;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user