diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-12-16 19:05:51 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-12-17 14:27:32 +0100 |
commit | 228105d870705878f366ca5b9a559662f2a840cb (patch) | |
tree | ab249b6bcc80d94d7f7e75bf584f5809a832bac2 /sw/source/core/layout/flylay.cxx | |
parent | 2f9360b58a358fefb86f474464e53f1ea5ffb52b (diff) |
coverity#1426169 refactor to be less obscure
and coverity#1426166
no logic changes intended
Change-Id: I241f3f09c6a4ab143b67eb9341e8a52acbae64e3
a026f03980fdf1c80d1c6cffbd8ad0325c8f5d02
Reviewed-on: https://gerrit.libreoffice.org/46619
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source/core/layout/flylay.cxx')
-rw-r--r-- | sw/source/core/layout/flylay.cxx | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx index 8a3af6c27006..92342f5928f6 100644 --- a/sw/source/core/layout/flylay.cxx +++ b/sw/source/core/layout/flylay.cxx @@ -713,20 +713,23 @@ SwFlyLayFrame::SwFlyLayFrame( SwFlyFrameFormat *pFormat, SwFrame* pSib, SwFrame void SwFlyLayFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) { - const sal_uInt16 nWhich = pNew ? pNew->Which() : 0; - const SwFormatAnchor *pAnch = nullptr; - if( RES_ATTRSET_CHG == nWhich && SfxItemState::SET == - static_cast<const SwAttrSetChg*>(pNew)->GetChgSet()->GetItemState( RES_ANCHOR, false, - reinterpret_cast<const SfxPoolItem**>(&pAnch) )) - ; // GetItemState sets the anchor pointer! - else if( RES_ANCHOR == nWhich ) + if (pNew) { - // Change of anchor. I'm attaching myself to the new place. - // It's not allowed to change the anchor type. This is only - // possible via SwFEShell. - pAnch = static_cast<const SwFormatAnchor*>(pNew); + const sal_uInt16 nWhich = pNew ? pNew->Which() : 0; + if( RES_ATTRSET_CHG == nWhich && SfxItemState::SET == + static_cast<const SwAttrSetChg*>(pNew)->GetChgSet()->GetItemState( RES_ANCHOR, false, + reinterpret_cast<const SfxPoolItem**>(&pAnch) )) + ; // GetItemState sets the anchor pointer! + + else if( RES_ANCHOR == nWhich ) + { + // Change of anchor. I'm attaching myself to the new place. + // It's not allowed to change the anchor type. This is only + // possible via SwFEShell. + pAnch = static_cast<const SwFormatAnchor*>(pNew); + } } if( pAnch ) |