diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-26 12:01:53 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-27 09:05:39 +0200 |
commit | 467724410dc470ec259131f97abd836fe9b021a1 (patch) | |
tree | c4af76c0132cc6a4638eace0ccebe5ae1bd9e305 /toolkit/source/controls/controlmodelcontainerbase.cxx | |
parent | e827d227c92c338fb75f076b6d3f3a7b52b9f767 (diff) |
loplugin:flatten in toolkit..vbahelper
Change-Id: I6d4be3e1cc29b2b91d5c39b757ff3b903c47112d
Reviewed-on: https://gerrit.libreoffice.org/42794
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'toolkit/source/controls/controlmodelcontainerbase.cxx')
-rw-r--r-- | toolkit/source/controls/controlmodelcontainerbase.cxx | 67 |
1 files changed, 33 insertions, 34 deletions
diff --git a/toolkit/source/controls/controlmodelcontainerbase.cxx b/toolkit/source/controls/controlmodelcontainerbase.cxx index 551dda47a63c..291894605b49 100644 --- a/toolkit/source/controls/controlmodelcontainerbase.cxx +++ b/toolkit/source/controls/controlmodelcontainerbase.cxx @@ -1827,48 +1827,47 @@ ControlModelContainerBase::updateUserFormChildren( const Reference< XNameContain if ( Operation < Insert || Operation > Remove ) throw IllegalArgumentException(); - if ( xAllChildren.is() ) + if ( !xAllChildren.is() ) + throw IllegalArgumentException(); + + if ( Operation == Remove ) { - if ( Operation == Remove ) - { - Reference< XControlModel > xOldModel( xAllChildren->getByName( aName ), UNO_QUERY ); - xAllChildren->removeByName( aName ); + Reference< XControlModel > xOldModel( xAllChildren->getByName( aName ), UNO_QUERY ); + xAllChildren->removeByName( aName ); - Reference< XNameContainer > xChildContainer( xOldModel, UNO_QUERY ); - if ( xChildContainer.is() ) - { - Reference< XPropertySet > xProps( xChildContainer, UNO_QUERY ); - // container control is being removed from this container, reset the - // global list of containees - if ( xProps.is() ) - xProps->setPropertyValue( GetPropertyName( BASEPROPERTY_USERFORMCONTAINEES ), uno::makeAny( uno::Reference< XNameContainer >() ) ); - Sequence< OUString > aChildNames = xChildContainer->getElementNames(); - for ( sal_Int32 index=0; index< aChildNames.getLength(); ++index ) - updateUserFormChildren( xAllChildren, aChildNames[ index ], Operation, Reference< XControlModel > () ); - } + Reference< XNameContainer > xChildContainer( xOldModel, UNO_QUERY ); + if ( xChildContainer.is() ) + { + Reference< XPropertySet > xProps( xChildContainer, UNO_QUERY ); + // container control is being removed from this container, reset the + // global list of containees + if ( xProps.is() ) + xProps->setPropertyValue( GetPropertyName( BASEPROPERTY_USERFORMCONTAINEES ), uno::makeAny( uno::Reference< XNameContainer >() ) ); + Sequence< OUString > aChildNames = xChildContainer->getElementNames(); + for ( sal_Int32 index=0; index< aChildNames.getLength(); ++index ) + updateUserFormChildren( xAllChildren, aChildNames[ index ], Operation, Reference< XControlModel > () ); } - else if ( Operation == Insert ) + } + else if ( Operation == Insert ) + { + xAllChildren->insertByName( aName, uno::makeAny( xTarget ) ); + Reference< XNameContainer > xChildContainer( xTarget, UNO_QUERY ); + if ( xChildContainer.is() ) { - xAllChildren->insertByName( aName, uno::makeAny( xTarget ) ); - Reference< XNameContainer > xChildContainer( xTarget, UNO_QUERY ); - if ( xChildContainer.is() ) + // container control is being added from this container, reset the + // global list of containees to point to the correct global list + Reference< XPropertySet > xProps( xChildContainer, UNO_QUERY ); + if ( xProps.is() ) + xProps->setPropertyValue( GetPropertyName( BASEPROPERTY_USERFORMCONTAINEES ), uno::makeAny( xAllChildren ) ); + Sequence< OUString > aChildNames = xChildContainer->getElementNames(); + for ( sal_Int32 index=0; index< aChildNames.getLength(); ++index ) { - // container control is being added from this container, reset the - // global list of containees to point to the correct global list - Reference< XPropertySet > xProps( xChildContainer, UNO_QUERY ); - if ( xProps.is() ) - xProps->setPropertyValue( GetPropertyName( BASEPROPERTY_USERFORMCONTAINEES ), uno::makeAny( xAllChildren ) ); - Sequence< OUString > aChildNames = xChildContainer->getElementNames(); - for ( sal_Int32 index=0; index< aChildNames.getLength(); ++index ) - { - Reference< XControlModel > xChildTarget( xChildContainer->getByName( aChildNames[ index ] ), UNO_QUERY ); - updateUserFormChildren( xAllChildren, aChildNames[ index ], Operation, xChildTarget ); - } + Reference< XControlModel > xChildTarget( xChildContainer->getByName( aChildNames[ index ] ), UNO_QUERY ); + updateUserFormChildren( xAllChildren, aChildNames[ index ], Operation, xChildTarget ); } } } - else - throw IllegalArgumentException(); + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |