summaryrefslogtreecommitdiff
path: root/toolkit/source/controls/tabpagecontainer.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/source/controls/tabpagecontainer.cxx')
-rw-r--r--toolkit/source/controls/tabpagecontainer.cxx33
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*/ )