From 1f1f7b89d20f86a46b14674ad3747cbdb899c6ca Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 6 Aug 2020 09:02:30 +0200 Subject: loplugin:flatten in xmloff/draw Change-Id: I8eb9afc859727bd4d66d0a4415533d4012ed3c31 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100197 Tested-by: Jenkins Reviewed-by: Noel Grandin --- xmloff/source/draw/XMLImageMapExport.cxx | 46 ++++++++++++++++---------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'xmloff/source/draw/XMLImageMapExport.cxx') diff --git a/xmloff/source/draw/XMLImageMapExport.cxx b/xmloff/source/draw/XMLImageMapExport.cxx index 5a9827272836..85b29122f6ad 100644 --- a/xmloff/source/draw/XMLImageMapExport.cxx +++ b/xmloff/source/draw/XMLImageMapExport.cxx @@ -92,33 +92,33 @@ void XMLImageMapExport::Export( void XMLImageMapExport::Export( const Reference & rContainer) { - if (rContainer.is()) + if (!rContainer.is()) + return; + + if (!rContainer->hasElements()) + return; + + // image map container element + SvXMLElementExport aImageMapElement( + mrExport, XML_NAMESPACE_DRAW, XML_IMAGE_MAP, + true/*bWhiteSpace*/, true/*bWhiteSpace*/); + + // iterate over image map elements and call ExportMapEntry(...) + // for each + sal_Int32 nLength = rContainer->getCount(); + for(sal_Int32 i = 0; i < nLength; i++) { - if (rContainer->hasElements()) + Any aAny = rContainer->getByIndex(i); + Reference rElement; + aAny >>= rElement; + + DBG_ASSERT(rElement.is(), "Image map element is empty!"); + if (rElement.is()) { - // image map container element - SvXMLElementExport aImageMapElement( - mrExport, XML_NAMESPACE_DRAW, XML_IMAGE_MAP, - true/*bWhiteSpace*/, true/*bWhiteSpace*/); - - // iterate over image map elements and call ExportMapEntry(...) - // for each - sal_Int32 nLength = rContainer->getCount(); - for(sal_Int32 i = 0; i < nLength; i++) - { - Any aAny = rContainer->getByIndex(i); - Reference rElement; - aAny >>= rElement; - - DBG_ASSERT(rElement.is(), "Image map element is empty!"); - if (rElement.is()) - { - ExportMapEntry(rElement); - } - } + ExportMapEntry(rElement); } - // else: container is empty -> nothing to do } + // else: container is empty -> nothing to do // else: no container -> nothing to do } -- cgit