summaryrefslogtreecommitdiff
path: root/toolkit/source
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/source')
-rw-r--r--toolkit/source/controls/controlmodelcontainerbase.cxx67
-rw-r--r--toolkit/source/controls/tabpagecontainer.cxx33
-rw-r--r--toolkit/source/controls/unocontrolmodel.cxx7
3 files changed, 53 insertions, 54 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: */
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*/ )
diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx
index 5697e1034d6d..e28a6d8aa2c4 100644
--- a/toolkit/source/controls/unocontrolmodel.cxx
+++ b/toolkit/source/controls/unocontrolmodel.cxx
@@ -1239,10 +1239,11 @@ void UnoControlModel::setPropertyValue( const OUString& rPropertyName, const css
nPropId = (sal_Int32) GetPropertyId( rPropertyName );
DBG_ASSERT( nPropId, "Invalid ID in UnoControlModel::setPropertyValue" );
}
- if( nPropId )
- setFastPropertyValue( nPropId, rValue );
- else
+ if( !nPropId )
throw css::beans::UnknownPropertyException();
+
+ setFastPropertyValue( nPropId, rValue );
+
}
// css::beans::XFastPropertySet