summaryrefslogtreecommitdiff
path: root/forms
diff options
context:
space:
mode:
authorFrank Schönheit <fs@openoffice.org>2001-10-29 14:26:20 +0000
committerFrank Schönheit <fs@openoffice.org>2001-10-29 14:26:20 +0000
commit6e2466e80a6eb999138b4e870d6731c718a0eda4 (patch)
treeb3c8d6afdea4431de5016a1bc00442ef214c25c9 /forms
parent0b7e8d6a6a65833f32b8c22ca43f346d31a06112 (diff)
#93905# insertByName: ensure that the object beeing inserted has the name given as access key
Diffstat (limited to 'forms')
-rw-r--r--forms/source/misc/InterfaceContainer.cxx30
1 files changed, 26 insertions, 4 deletions
diff --git a/forms/source/misc/InterfaceContainer.cxx b/forms/source/misc/InterfaceContainer.cxx
index 67fde0901f6e..54be77469aca 100644
--- a/forms/source/misc/InterfaceContainer.cxx
+++ b/forms/source/misc/InterfaceContainer.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: InterfaceContainer.cxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: hr $ $Date: 2001-10-26 11:21:56 $
+ * last change: $Author: fs $ $Date: 2001-10-29 15:26:20 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -870,9 +870,31 @@ void SAL_CALL OInterfaceContainer::removeByIndex(sal_Int32 _nIndex) throw( Index
}
//------------------------------------------------------------------------
-void SAL_CALL OInterfaceContainer::insertByName(const ::rtl::OUString& Name, const Any& _rElement) throw( IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException )
+void SAL_CALL OInterfaceContainer::insertByName(const ::rtl::OUString& _rName, const Any& _rElement) throw( IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException )
{
- insertByIndex( m_aItems.size(), _rElement );
+ Reference< XPropertySet > xElementProps;
+ // ensure the correct name of the element
+ try
+ {
+ _rElement >>= xElementProps;
+ approveNewElement( xElementProps );
+
+ xElementProps->setPropertyValue( PROPERTY_NAME, makeAny( _rName ) );
+ }
+ catch( const IllegalArgumentException& )
+ {
+ throw; // allowed to leave
+ }
+ catch( const ElementExistException& )
+ {
+ throw; // allowed to leave
+ }
+ catch( const Exception& )
+ {
+ DBG_ERROR( "OInterfaceContainer::insertByName: caught an exception!" );
+ }
+ implInsert( m_aItems.size(), xElementProps, sal_True, sal_False, sal_True );
+ // do not approve - we already did this
}
//------------------------------------------------------------------------