From 2ee60f02c456f39a80edb2dbfed48c3e0147a7f7 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Sun, 19 Apr 2020 11:10:43 +0200 Subject: loplugin:flatten in drawinglayer Change-Id: Ieb5f682ec627c8d8ddfc286ec0e4422104b4d847 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92494 Tested-by: Jenkins Reviewed-by: Noel Grandin --- .../source/processor2d/objectinfoextractor2d.cxx | 50 +++++++++++----------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'drawinglayer/source/processor2d/objectinfoextractor2d.cxx') diff --git a/drawinglayer/source/processor2d/objectinfoextractor2d.cxx b/drawinglayer/source/processor2d/objectinfoextractor2d.cxx index d15fc36523be..552406d53f68 100644 --- a/drawinglayer/source/processor2d/objectinfoextractor2d.cxx +++ b/drawinglayer/source/processor2d/objectinfoextractor2d.cxx @@ -27,37 +27,37 @@ namespace drawinglayer::processor2d { void ObjectInfoPrimitiveExtractor2D::processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate) { - if(!mpFound) + if(mpFound) + return; + + switch(rCandidate.getPrimitive2DID()) { - switch(rCandidate.getPrimitive2DID()) + case PRIMITIVE2D_ID_OBJECTINFOPRIMITIVE2D : + { + mpFound = dynamic_cast< const primitive2d::ObjectInfoPrimitive2D* >(&rCandidate); + break; + } + default : { - case PRIMITIVE2D_ID_OBJECTINFOPRIMITIVE2D : + // we look for an encapsulated primitive, so do not decompose primitives + // based on GroupPrimitive2D, just visit their children. It may be that more + // group-like primitives need to be added here, but all primitives with + // grouping functionality should be implemented based on the GroupPrimitive2D + // class and have their main content accessible as children + const primitive2d::GroupPrimitive2D* pGroupPrimitive2D = dynamic_cast< const primitive2d::GroupPrimitive2D* >(&rCandidate); + + if(pGroupPrimitive2D) { - mpFound = dynamic_cast< const primitive2d::ObjectInfoPrimitive2D* >(&rCandidate); - break; + // process group children recursively + process(pGroupPrimitive2D->getChildren()); } - default : + else { - // we look for an encapsulated primitive, so do not decompose primitives - // based on GroupPrimitive2D, just visit their children. It may be that more - // group-like primitives need to be added here, but all primitives with - // grouping functionality should be implemented based on the GroupPrimitive2D - // class and have their main content accessible as children - const primitive2d::GroupPrimitive2D* pGroupPrimitive2D = dynamic_cast< const primitive2d::GroupPrimitive2D* >(&rCandidate); - - if(pGroupPrimitive2D) - { - // process group children recursively - process(pGroupPrimitive2D->getChildren()); - } - else - { - // do not process recursively, we *only* want to find existing - // ObjectInfoPrimitive2D entries - } - - break; + // do not process recursively, we *only* want to find existing + // ObjectInfoPrimitive2D entries } + + break; } } } -- cgit