summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-12-16 19:11:06 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-12-17 00:00:37 +0100
commit77da600bf3f0b2279a21680169dc3136bdc2639c (patch)
tree51746b6516132a9f616354039a9a24c9441f10ac
parent9cca2ca9af012ff8f96699febba0dc860768ef3c (diff)
coverity#1426167 refactor to be less obscure
no logic change intended Change-Id: I10ef6038351b2808c2030aa55f05e078d80345ae Reviewed-on: https://gerrit.libreoffice.org/46609 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sw/source/core/layout/atrfrm.cxx83
1 files changed, 43 insertions, 40 deletions
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 2b15de1ffcd3..0673acad36cf 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -2546,58 +2546,61 @@ bool SwFrameFormat::supportsFullDrawingLayerFillAttributeSet() const
void SwFrameFormat::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
{
- SwFormatHeader const *pH = nullptr;
- SwFormatFooter const *pF = nullptr;
-
- const sal_uInt16 nWhich = pNew ? pNew->Which() : 0;
-
- if( RES_ATTRSET_CHG == nWhich )
+ if (pNew)
{
- static_cast<const SwAttrSetChg*>(pNew)->GetChgSet()->GetItemState(
- RES_HEADER, false, reinterpret_cast<const SfxPoolItem**>(&pH) );
- static_cast<const SwAttrSetChg*>(pNew)->GetChgSet()->GetItemState(
- RES_FOOTER, false, reinterpret_cast<const SfxPoolItem**>(&pF) );
+ SwFormatHeader const *pH = nullptr;
+ SwFormatFooter const *pF = nullptr;
+
+ const sal_uInt16 nWhich = pNew->Which();
- // reset fill information
- if (maFillAttributes.get() && supportsFullDrawingLayerFillAttributeSet())
+ if( RES_ATTRSET_CHG == nWhich )
{
- SfxItemIter aIter(*static_cast<const SwAttrSetChg*>(pNew)->GetChgSet());
- bool bReset(false);
+ static_cast<const SwAttrSetChg*>(pNew)->GetChgSet()->GetItemState(
+ RES_HEADER, false, reinterpret_cast<const SfxPoolItem**>(&pH) );
+ static_cast<const SwAttrSetChg*>(pNew)->GetChgSet()->GetItemState(
+ RES_FOOTER, false, reinterpret_cast<const SfxPoolItem**>(&pF) );
- for(const SfxPoolItem* pItem = aIter.FirstItem(); pItem && !bReset; pItem = aIter.NextItem())
+ // reset fill information
+ if (maFillAttributes.get() && supportsFullDrawingLayerFillAttributeSet())
{
- bReset = !IsInvalidItem(pItem) && pItem->Which() >= XATTR_FILL_FIRST && pItem->Which() <= XATTR_FILL_LAST;
- }
+ SfxItemIter aIter(*static_cast<const SwAttrSetChg*>(pNew)->GetChgSet());
+ bool bReset(false);
- if(bReset)
- {
- maFillAttributes.reset();
+ for(const SfxPoolItem* pItem = aIter.FirstItem(); pItem && !bReset; pItem = aIter.NextItem())
+ {
+ bReset = !IsInvalidItem(pItem) && pItem->Which() >= XATTR_FILL_FIRST && pItem->Which() <= XATTR_FILL_LAST;
+ }
+
+ if(bReset)
+ {
+ maFillAttributes.reset();
+ }
}
}
- }
- else if(RES_FMT_CHG == nWhich)
- {
- // reset fill information on format change (e.g. style changed)
- if (maFillAttributes.get() && supportsFullDrawingLayerFillAttributeSet())
+ else if(RES_FMT_CHG == nWhich)
{
- maFillAttributes.reset();
+ // reset fill information on format change (e.g. style changed)
+ if (maFillAttributes.get() && supportsFullDrawingLayerFillAttributeSet())
+ {
+ maFillAttributes.reset();
+ }
}
- }
- else if( RES_HEADER == nWhich )
- pH = static_cast<const SwFormatHeader*>(pNew);
- else if( RES_FOOTER == nWhich )
- pF = static_cast<const SwFormatFooter*>(pNew);
+ else if( RES_HEADER == nWhich )
+ pH = static_cast<const SwFormatHeader*>(pNew);
+ else if( RES_FOOTER == nWhich )
+ pF = static_cast<const SwFormatFooter*>(pNew);
- if( pH && pH->IsActive() && !pH->GetHeaderFormat() )
- { //If he doesn't have one, I'll add one
- SwFrameFormat *pFormat = GetDoc()->getIDocumentLayoutAccess().MakeLayoutFormat( RndStdIds::HEADER, nullptr );
- const_cast<SwFormatHeader *>(pH)->RegisterToFormat( *pFormat );
- }
+ if( pH && pH->IsActive() && !pH->GetHeaderFormat() )
+ { //If he doesn't have one, I'll add one
+ SwFrameFormat *pFormat = GetDoc()->getIDocumentLayoutAccess().MakeLayoutFormat( RndStdIds::HEADER, nullptr );
+ const_cast<SwFormatHeader *>(pH)->RegisterToFormat( *pFormat );
+ }
- if( pF && pF->IsActive() && !pF->GetFooterFormat() )
- { //If he doesn't have one, I'll add one
- SwFrameFormat *pFormat = GetDoc()->getIDocumentLayoutAccess().MakeLayoutFormat( RndStdIds::FOOTER, nullptr );
- const_cast<SwFormatFooter *>(pF)->RegisterToFormat( *pFormat );
+ if( pF && pF->IsActive() && !pF->GetFooterFormat() )
+ { //If he doesn't have one, I'll add one
+ SwFrameFormat *pFormat = GetDoc()->getIDocumentLayoutAccess().MakeLayoutFormat( RndStdIds::FOOTER, nullptr );
+ const_cast<SwFormatFooter *>(pF)->RegisterToFormat( *pFormat );
+ }
}
SwFormat::Modify( pOld, pNew );