summaryrefslogtreecommitdiff
path: root/framework/source/xml
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-04-07 20:32:26 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-08 11:01:31 +0200
commitff25a4a6f4b9763b09abbbd6a711fa4d18f40ade (patch)
treeded29238e8fb782c20b429f6d5df6c40a3bb2604 /framework/source/xml
parent32343bcbb786168df62f85a57e30c620c3d3bdb4 (diff)
loplugin:flatten in framework
Change-Id: I2a74a7543b5edd853396efa31a3e2568e6607778 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91848 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'framework/source/xml')
-rw-r--r--framework/source/xml/imagesdocumenthandler.cxx146
1 files changed, 73 insertions, 73 deletions
diff --git a/framework/source/xml/imagesdocumenthandler.cxx b/framework/source/xml/imagesdocumenthandler.cxx
index 45a5387186b9..51352b0296d4 100644
--- a/framework/source/xml/imagesdocumenthandler.cxx
+++ b/framework/source/xml/imagesdocumenthandler.cxx
@@ -144,87 +144,87 @@ void SAL_CALL OReadImagesDocumentHandler::startElement(
SolarMutexGuard g;
ImageHashMap::const_iterator pImageEntry = m_aImageMap.find( aName );
- if ( pImageEntry != m_aImageMap.end() )
+ if ( pImageEntry == m_aImageMap.end() )
+ return;
+
+ switch ( pImageEntry->second )
{
- switch ( pImageEntry->second )
+ case IMG_ELEMENT_IMAGECONTAINER:
{
- case IMG_ELEMENT_IMAGECONTAINER:
+ // image:imagecontainer element (container element for all further image elements)
+ if ( m_bImageContainerStartFound )
{
- // image:imagecontainer element (container element for all further image elements)
- if ( m_bImageContainerStartFound )
- {
- OUString aErrorMessage = getErrorLineString() + "Element 'image:imagecontainer' cannot be embedded into 'image:imagecontainer'!";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
-
- m_bImageContainerStartFound = true;
+ OUString aErrorMessage = getErrorLineString() + "Element 'image:imagecontainer' cannot be embedded into 'image:imagecontainer'!";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
}
- break;
- case IMG_ELEMENT_IMAGES:
- {
- if ( !m_bImageContainerStartFound )
- {
- OUString aErrorMessage = getErrorLineString() + "Element 'image:images' must be embedded into element 'image:imagecontainer'!";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
+ m_bImageContainerStartFound = true;
+ }
+ break;
- if ( m_bImagesStartFound )
- {
- OUString aErrorMessage = getErrorLineString() + "Element 'image:images' cannot be embedded into 'image:images'!";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
+ case IMG_ELEMENT_IMAGES:
+ {
+ if ( !m_bImageContainerStartFound )
+ {
+ OUString aErrorMessage = getErrorLineString() + "Element 'image:images' must be embedded into element 'image:imagecontainer'!";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
+ }
- m_bImagesStartFound = true;
+ if ( m_bImagesStartFound )
+ {
+ OUString aErrorMessage = getErrorLineString() + "Element 'image:images' cannot be embedded into 'image:images'!";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
}
- break;
- case IMG_ELEMENT_ENTRY:
+ m_bImagesStartFound = true;
+ }
+ break;
+
+ case IMG_ELEMENT_ENTRY:
+ {
+ // Check that image:entry is embedded into image:images!
+ if ( !m_bImagesStartFound )
{
- // Check that image:entry is embedded into image:images!
- if ( !m_bImagesStartFound )
- {
- OUString aErrorMessage = getErrorLineString() + "Element 'image:entry' must be embedded into element 'image:images'!";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
+ OUString aErrorMessage = getErrorLineString() + "Element 'image:entry' must be embedded into element 'image:images'!";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
+ }
- // Create new image item descriptor
- ImageItemDescriptor aItem;
+ // Create new image item descriptor
+ ImageItemDescriptor aItem;
- // Read attributes for this image definition
- for ( sal_Int16 n = 0; n < xAttribs->getLength(); n++ )
+ // Read attributes for this image definition
+ for ( sal_Int16 n = 0; n < xAttribs->getLength(); n++ )
+ {
+ pImageEntry = m_aImageMap.find( xAttribs->getNameByIndex( n ) );
+ if ( pImageEntry != m_aImageMap.end() )
{
- pImageEntry = m_aImageMap.find( xAttribs->getNameByIndex( n ) );
- if ( pImageEntry != m_aImageMap.end() )
+ switch ( pImageEntry->second )
{
- switch ( pImageEntry->second )
+ case IMG_ATTRIBUTE_COMMAND:
{
- case IMG_ATTRIBUTE_COMMAND:
- {
- aItem.aCommandURL = xAttribs->getValueByIndex( n );
- }
- break;
-
- default:
- break;
+ aItem.aCommandURL = xAttribs->getValueByIndex( n );
}
- }
- }
+ break;
- // Check required attribute "command"
- if ( aItem.aCommandURL.isEmpty() )
- {
- OUString aErrorMessage = getErrorLineString() + "Required attribute 'image:command' must have a value!";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
+ default:
+ break;
+ }
}
+ }
- m_rImageList.push_back( aItem );
+ // Check required attribute "command"
+ if ( aItem.aCommandURL.isEmpty() )
+ {
+ OUString aErrorMessage = getErrorLineString() + "Required attribute 'image:command' must have a value!";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
}
- break;
- default:
- break;
+ m_rImageList.push_back( aItem );
}
+ break;
+
+ default:
+ break;
}
}
@@ -233,24 +233,24 @@ void SAL_CALL OReadImagesDocumentHandler::endElement(const OUString& aName)
SolarMutexGuard g;
ImageHashMap::const_iterator pImageEntry = m_aImageMap.find( aName );
- if ( pImageEntry != m_aImageMap.end() )
+ if ( pImageEntry == m_aImageMap.end() )
+ return;
+
+ switch ( pImageEntry->second )
{
- switch ( pImageEntry->second )
+ case IMG_ELEMENT_IMAGECONTAINER:
{
- case IMG_ELEMENT_IMAGECONTAINER:
- {
- m_bImageContainerEndFound = true;
- }
- break;
-
- case IMG_ELEMENT_IMAGES:
- {
- m_bImagesStartFound = false;
- }
- break;
+ m_bImageContainerEndFound = true;
+ }
+ break;
- default: break;
+ case IMG_ELEMENT_IMAGES:
+ {
+ m_bImagesStartFound = false;
}
+ break;
+
+ default: break;
}
}