summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2016-03-16 11:50:47 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2016-03-17 23:54:43 +0100
commitac378355651a34bd0b88cdbea9de78beed6eac95 (patch)
tree354fa6ba536ddb6fb2a2da7c6fa7dc6f7543cc4a
parentfdf280853d54d6786479e15f231f5d447627fba1 (diff)
refactor Notify
- check preconditions early - SfxStyleSheetHintId::ERASED is already handled by first if() branch Change-Id: I971eb460c3f006f19dde30f7aac30117be41a621
-rw-r--r--sw/source/core/unocore/unostyle.cxx28
1 files changed, 13 insertions, 15 deletions
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index f28f32075033..24fec491d23b 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -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();