User: rt Date: 2008-06-06 14:04:46+0000 Modified: dba/dbaccess/source/core/misc/ContainerMediator.cxx
Log: INTEGRATION: CWS dba30c (1.10.8); FILE MERGED 2008/05/05 11:10:25 oj 1.10.8.1: #i87131# rename impl File Changes: Directory: /dba/dbaccess/source/core/misc/ ========================================== File [changed]: ContainerMediator.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/misc/ContainerMediator.cxx?r1=1.10&r2=1.11 Delta lines: +34 -8 -------------------- --- ContainerMediator.cxx 2008-04-10 13:00:05+0000 1.10 +++ ContainerMediator.cxx 2008-06-06 14:04:43+0000 1.11 @@ -49,7 +49,7 @@ #ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_ #include <com/sun/star/sdbcx/XTablesSupplier.hpp> #endif - +#include <com/sun/star/sdbcx/XRename.hpp> #ifndef _CONNECTIVITY_DBTOOLS_HXX_ #include <connectivity/dbtools.hxx> #endif @@ -177,10 +177,36 @@ } } // ----------------------------------------------------------------------------- -void SAL_CALL OContainerMediator::elementReplaced( const ContainerEvent& /*_rEvent*/ ) throw(RuntimeException) +void SAL_CALL OContainerMediator::elementReplaced( const ContainerEvent& _rEvent ) throw(RuntimeException) { - OSL_ENSURE( false, "OContainerMediator::elementReplaced: not yet implemented!" ); - // we would need to update our PropertyForwarder with the new elements, and initially synchronize them + Reference< XContainer > xContainer = m_xContainer; + if ( _rEvent.Source == xContainer && xContainer.is() ) + { + ::rtl::OUString sElementName; + _rEvent.ReplacedElement >>= sElementName; + + PropertyForwardList::iterator aFind = m_aForwardList.find(sElementName); + if ( aFind != m_aForwardList.end() ) + { + ::rtl::OUString sNewName; + _rEvent.Accessor >>= sNewName; + try + { + Reference<XNameContainer> xNameContainer( m_xSettings, UNO_QUERY_THROW ); + if ( xNameContainer.is() && m_xSettings->hasByName( sElementName ) ) + { + Reference<XRename> xSource(m_xSettings->getByName(sElementName),UNO_QUERY_THROW); + xSource->rename(sNewName); + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + aFind->second->setName(sNewName); + } + } } // ----------------------------------------------------------------------------- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
