diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-12-21 15:22:06 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-12-21 17:14:14 +0100 |
commit | 489bce598626390d9c0aa5e5b8514e26070add61 (patch) | |
tree | 170ec95dcb393dbe4f7178bc08e6d96b6b76954b /filter/source/msfilter/escherex.cxx | |
parent | f19599c929ac6ae2708b19b9eff62ff70b44ee75 (diff) |
loplugin:flatten in filter..framework
Change-Id: I15a577b3c6da03001bbbf2c2b43b29b41c4007c1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127234
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'filter/source/msfilter/escherex.cxx')
-rw-r--r-- | filter/source/msfilter/escherex.cxx | 102 |
1 files changed, 50 insertions, 52 deletions
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index c85c51e41c95..b7ffd449cb22 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -1997,47 +1997,45 @@ bool EscherPropertyContainer::CreatePolygonProperties( } } - if(0 != nTotalPoints && aSegments.size() >= 6 && aVertices.size() >= 6) - { - // Little endian - aVertices[0] = static_cast<sal_uInt8>(nTotalPoints); - aVertices[1] = static_cast<sal_uInt8>(nTotalPoints >> 8); - aVertices[2] = static_cast<sal_uInt8>(nTotalPoints); - aVertices[3] = static_cast<sal_uInt8>(nTotalPoints >> 8); - - aSegments.push_back(static_cast<sal_uInt8>(0)); - aSegments.push_back(static_cast<sal_uInt8>(0x80)); - - const sal_uInt32 nSegmentBufSize(aSegments.size() - 6); - aSegments[0] = static_cast<sal_uInt8>(nSegmentBufSize >> 1); - aSegments[1] = static_cast<sal_uInt8>(nSegmentBufSize >> 9); - aSegments[2] = static_cast<sal_uInt8>(nSegmentBufSize >> 1); - aSegments[3] = static_cast<sal_uInt8>(nSegmentBufSize >> 9); - - AddOpt( - ESCHER_Prop_geoRight, - rGeoRect.Width); - AddOpt( - ESCHER_Prop_geoBottom, - rGeoRect.Height); - AddOpt( - ESCHER_Prop_shapePath, - ESCHER_ShapeComplex); - AddOpt( - ESCHER_Prop_pVertices, - true, - aVertices.size() - 6, - aVertices); - AddOpt( - ESCHER_Prop_pSegmentInfo, - true, - aSegments.size(), - aSegments); + if(0 == nTotalPoints || aSegments.size() < 6 || aVertices.size() < 6) + return false; - return true; - } + // Little endian + aVertices[0] = static_cast<sal_uInt8>(nTotalPoints); + aVertices[1] = static_cast<sal_uInt8>(nTotalPoints >> 8); + aVertices[2] = static_cast<sal_uInt8>(nTotalPoints); + aVertices[3] = static_cast<sal_uInt8>(nTotalPoints >> 8); + + aSegments.push_back(static_cast<sal_uInt8>(0)); + aSegments.push_back(static_cast<sal_uInt8>(0x80)); + + const sal_uInt32 nSegmentBufSize(aSegments.size() - 6); + aSegments[0] = static_cast<sal_uInt8>(nSegmentBufSize >> 1); + aSegments[1] = static_cast<sal_uInt8>(nSegmentBufSize >> 9); + aSegments[2] = static_cast<sal_uInt8>(nSegmentBufSize >> 1); + aSegments[3] = static_cast<sal_uInt8>(nSegmentBufSize >> 9); + + AddOpt( + ESCHER_Prop_geoRight, + rGeoRect.Width); + AddOpt( + ESCHER_Prop_geoBottom, + rGeoRect.Height); + AddOpt( + ESCHER_Prop_shapePath, + ESCHER_ShapeComplex); + AddOpt( + ESCHER_Prop_pVertices, + true, + aVertices.size() - 6, + aVertices); + AddOpt( + ESCHER_Prop_pSegmentInfo, + true, + aSegments.size(), + aSegments); - return false; + return true; } @@ -3751,22 +3749,22 @@ bool EscherPropertyContainer::CreateBlipPropertiesforOLEControl(const uno::Refer const uno::Reference<drawing::XShape> & rXShape) { SdrObject* pShape = SdrObject::getSdrObjectFromXShape(rXShape); - if ( pShape ) - { - const Graphic aGraphic(SdrExchangeView::GetObjGraphic(*pShape)); - const GraphicObject aGraphicObject(aGraphic); + if ( !pShape ) + return false; - if (!aGraphicObject.GetUniqueID().isEmpty()) + const Graphic aGraphic(SdrExchangeView::GetObjGraphic(*pShape)); + const GraphicObject aGraphicObject(aGraphic); + + if (!aGraphicObject.GetUniqueID().isEmpty()) + { + if ( pGraphicProvider && pPicOutStrm && pShapeBoundRect ) { - if ( pGraphicProvider && pPicOutStrm && pShapeBoundRect ) + sal_uInt32 nBlibId = pGraphicProvider->GetBlibID(*pPicOutStrm, aGraphicObject); + if ( nBlibId ) { - sal_uInt32 nBlibId = pGraphicProvider->GetBlibID(*pPicOutStrm, aGraphicObject); - if ( nBlibId ) - { - AddOpt( ESCHER_Prop_pib, nBlibId, true ); - ImplCreateGraphicAttributes( rXPropSet, nBlibId, false ); - return true; - } + AddOpt( ESCHER_Prop_pib, nBlibId, true ); + ImplCreateGraphicAttributes( rXPropSet, nBlibId, false ); + return true; } } } |