Kaydet (Commit) ac378355 authored tarafından Bjoern Michaelsen's avatar Bjoern Michaelsen

refactor Notify

- check preconditions early
- SfxStyleSheetHintId::ERASED is already handled by first if() branch

Change-Id: I971eb460c3f006f19dde30f7aac30117be41a621
üst fdf28085
......@@ -2640,30 +2640,28 @@ uno::Any SwXStyle::getPropertyDefault(const OUString& rPropertyName)
return getPropertyDefaults(aSequence)[0];
}
void SwXStyle::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
void SwXStyle::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
{
const SfxSimpleHint* pHint = dynamic_cast<const SfxSimpleHint*>(&rHint);
if( pHint )
if(!pHint)
return;
if((pHint->GetId() & SFX_HINT_DYING) || (pHint->GetId() & SfxStyleSheetHintId::ERASED))
{
m_pBasePool = nullptr;
EndListening(rBC);
}
else if(pHint->GetId() & (SfxStyleSheetHintId::CHANGED))
{
if(( pHint->GetId() & SFX_HINT_DYING ) || ( pHint->GetId() & SfxStyleSheetHintId::ERASED))
static_cast<SfxStyleSheetBasePool&>(rBC).SetSearchMask(m_rEntry.m_eFamily);
SfxStyleSheetBase* pOwnBase = static_cast<SfxStyleSheetBasePool&>(rBC).Find(m_sStyleName);
if(!pOwnBase)
{
m_pBasePool = nullptr;
EndListening(rBC);
}
else if( pHint->GetId() &(SfxStyleSheetHintId::CHANGED|SfxStyleSheetHintId::ERASED) )
{
static_cast<SfxStyleSheetBasePool&>(rBC).SetSearchMask(m_rEntry.m_eFamily);
SfxStyleSheetBase* pOwnBase = static_cast<SfxStyleSheetBasePool&>(rBC).Find(m_sStyleName);
if(!pOwnBase)
{
EndListening(rBC);
Invalidate();
}
Invalidate();
}
}
}
void SwXStyle::Invalidate()
{
m_sStyleName.clear();
......
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