sw/source/core/layout/flycnt.cxx | 25 ++++++++++++++----------- sw/source/core/layout/flylay.cxx | 25 ++++++++++++++----------- 2 files changed, 28 insertions(+), 22 deletions(-)
New commits: commit 228105d870705878f366ca5b9a559662f2a840cb Author: Caolán McNamara <caol...@redhat.com> Date: Sat Dec 16 19:05:51 2017 +0000 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 <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx index 20c891af939a..7924e788b621 100644 --- a/sw/source/core/layout/flycnt.cxx +++ b/sw/source/core/layout/flycnt.cxx @@ -77,20 +77,23 @@ SwFlyAtContentFrame::SwFlyAtContentFrame( SwFlyFrameFormat *pFormat, SwFrame* pS void SwFlyAtContentFrame::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) )) - ; // The anchor pointer is set at GetItemState! - - else if( RES_ANCHOR == nWhich ) + if (pNew) { - //Change anchor, I move myself to a new place. - //The anchor type must not change, this is only possible using - //SwFEShell. - pAnch = static_cast<const SwFormatAnchor*>(pNew); + const sal_uInt16 nWhich = pNew->Which(); + if( RES_ATTRSET_CHG == nWhich && SfxItemState::SET == + static_cast<const SwAttrSetChg*>(pNew)->GetChgSet()->GetItemState( RES_ANCHOR, false, + reinterpret_cast<const SfxPoolItem**>(&pAnch) )) + ; // The anchor pointer is set at GetItemState! + + else if( RES_ANCHOR == nWhich ) + { + //Change anchor, I move myself to a new place. + //The anchor type must not change, this is only possible using + //SwFEShell. + pAnch = static_cast<const SwFormatAnchor*>(pNew); + } } if( pAnch ) 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 )
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits