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/tabpagecontainer.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/tabpagecontainer.cxx')
-rw-r--r-- | toolkit/source/controls/tabpagecontainer.cxx | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/toolkit/source/controls/tabpagecontainer.cxx b/toolkit/source/controls/tabpagecontainer.cxx index 72e6f8a1c279..5a1fe1a6adc3 100644 --- a/toolkit/source/controls/tabpagecontainer.cxx +++ b/toolkit/source/controls/tabpagecontainer.cxx @@ -148,26 +148,25 @@ void SAL_CALL UnoControlTabPageContainerModel::insertByIndex( ::sal_Int32 nIndex { SolarMutexGuard aSolarGuard; uno::Reference < XTabPageModel > xTabPageModel; - if(aElement >>= xTabPageModel) + if(!(aElement >>= xTabPageModel)) + throw IllegalArgumentException( WRONG_TYPE_EXCEPTION, static_cast<OWeakObject *>(this), 2 ); + + if ( sal_Int32( m_aTabPageVector.size()) ==nIndex ) + m_aTabPageVector.push_back( xTabPageModel ); + else if ( sal_Int32( m_aTabPageVector.size()) > nIndex ) { - if ( sal_Int32( m_aTabPageVector.size()) ==nIndex ) - m_aTabPageVector.push_back( xTabPageModel ); - else if ( sal_Int32( m_aTabPageVector.size()) > nIndex ) - { - std::vector< uno::Reference< XTabPageModel > >::iterator aIter = m_aTabPageVector.begin(); - aIter += nIndex; - m_aTabPageVector.insert( aIter, xTabPageModel ); - } - else - throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) ); - ContainerEvent aEvent; - aEvent.Source = *this; - aEvent.Element = aElement; - aEvent.Accessor <<= OUString::number(nIndex); - maContainerListeners.elementInserted( aEvent ); + std::vector< uno::Reference< XTabPageModel > >::iterator aIter = m_aTabPageVector.begin(); + aIter += nIndex; + m_aTabPageVector.insert( aIter, xTabPageModel ); } else - throw IllegalArgumentException( WRONG_TYPE_EXCEPTION, static_cast<OWeakObject *>(this), 2 ); + throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) ); + ContainerEvent aEvent; + aEvent.Source = *this; + aEvent.Element = aElement; + aEvent.Accessor <<= OUString::number(nIndex); + maContainerListeners.elementInserted( aEvent ); + } void SAL_CALL UnoControlTabPageContainerModel::removeByIndex( ::sal_Int32 /*Index*/ ) |