Tag: cws_src680_qiq User: fs Date: 06/05/24 07:58:39 Modified: /dba/dbaccess/source/core/dataaccess/ documentcontainer.cxx, documentcontainer.hxx
Log: #i51143# approveNewObject superseded by some abstract interface File Changes: Directory: /dba/dbaccess/source/core/dataaccess/ ================================================ File [changed]: documentcontainer.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/documentcontainer.cxx?r1=1.17.52.1&r2=1.17.52.2 Delta lines: +44 -32 --------------------- --- documentcontainer.cxx 24 May 2006 09:11:50 -0000 1.17.52.1 +++ documentcontainer.cxx 24 May 2006 14:58:35 -0000 1.17.52.2 @@ -4,9 +4,9 @@ * * $RCSfile: documentcontainer.cxx,v $ * - * $Revision: 1.17.52.1 $ + * $Revision: 1.17.52.2 $ * - * last change: $Author: fs $ $Date: 2006/05/24 09:11:50 $ + * last change: $Author: fs $ $Date: 2006/05/24 14:58:35 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -92,6 +92,26 @@ //........................................................................ //========================================================================== +//= LocalNameApproval +//========================================================================== +class LocalNameApproval : public IContainerApprove +{ +public: + LocalNameApproval() { } + void SAL_CALL approveElement( const ::rtl::OUString& _rName, const Reference< XInterface >& _rxElement ); +}; + +//-------------------------------------------------------------------------- +void SAL_CALL LocalNameApproval::approveElement( const ::rtl::OUString& _rName, const Reference< XInterface >& /*_rxElement*/ ) +{ + if ( _rName.indexOf( '/' ) != -1 ) + throw IllegalArgumentException( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "The name must not contain any / characters." ) ), + NULL, + 0 ); +} + +//========================================================================== //= ODocumentContainer //========================================================================== DBG_NAME(ODocumentContainer) @@ -108,6 +128,8 @@ DBG_CTOR(ODocumentContainer, NULL); registerProperty(PROPERTY_NAME, PROPERTY_ID_NAME, PropertyAttribute::BOUND | PropertyAttribute::READONLY | PropertyAttribute::CONSTRAINED, &m_pImpl->m_aProps.aTitle, ::getCppuType(&m_pImpl->m_aProps.aTitle)); + + setElementApproval( PContainerApprove( new LocalNameApproval ) ); } //-------------------------------------------------------------------------- @@ -596,7 +618,7 @@ ::rtl::Reference<OContentHelper> pContent = NULL; try { - Reference<XUnoTunnel> xUnoTunnel(const_cast<ODocumentContainer*>(this)->implGetByName(_sName),UNO_QUERY); + Reference<XUnoTunnel> xUnoTunnel(const_cast<ODocumentContainer*>(this)->implGetByName( _sName, sal_True ), UNO_QUERY ); if ( xUnoTunnel.is() ) pContent = reinterpret_cast<OContentHelper*>(xUnoTunnel->getSomething(OContentHelper::getUnoTunnelImplementationId())); } @@ -651,23 +673,12 @@ ? m_pImpl->m_pDataSource->getStorage( m_bFormsContainer ? s_sForms : s_sReports ) : Reference< XStorage>(); } -// ----------------------------------------------------------------------------- -void ODocumentContainer::approveNewObject(const ::rtl::OUString& _sName,const Reference< XContent >& _rxObject) const -{ - ODefinitionContainer::approveNewObject( _sName, _rxObject ); - if ( _sName.indexOf( '/' ) != -1 ) - throw IllegalArgumentException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "The name must not contain any / characters." ) ), - *this, - 0 ); -} // ----------------------------------------------------------------------------- void SAL_CALL ODocumentContainer::removeByName( const ::rtl::OUString& _rName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException) { - Reference< XContent > xOldElement; - ClearableMutexGuard aGuard(m_aMutex); - { + ResettableMutexGuard aGuard(m_aMutex); + // check the arguments if (!_rName.getLength()) throw IllegalArgumentException(); @@ -675,7 +686,7 @@ if (!checkExistence(_rName)) throw NoSuchElementException(_rName,*this); - Reference< XCommandProcessor > xContent(implGetByName(_rName),UNO_QUERY); + Reference< XCommandProcessor > xContent( implGetByName( _rName, sal_True ), UNO_QUERY ); if ( xContent.is() ) { Command aCommand; @@ -683,12 +694,13 @@ aCommand.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("delete")); xContent->execute(aCommand,xContent->createCommandIdentifier(),Reference< XCommandEnvironment >()); } + // do the removal implRemove(_rName); - // disposeComponent(xOldElement); // no dispose here, the object amy be inserted again unde a different name - } - notifyByName(aGuard,_rName,NULL,NULL,E_REMOVED); + // disposeComponent(xContent); // no dispose here, the object may be inserted again under a different name + + notifyByName( aGuard, _rName, NULL, NULL, E_REMOVED, ContainerListemers ); } //........................................................................ } // namespace dbaccess File [changed]: documentcontainer.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/documentcontainer.hxx?r1=1.8.122.1&r2=1.8.122.2 Delta lines: +2 -4 ------------------- --- documentcontainer.hxx 24 May 2006 09:11:51 -0000 1.8.122.1 +++ documentcontainer.hxx 24 May 2006 14:58:36 -0000 1.8.122.2 @@ -4,9 +4,9 @@ * * $RCSfile: documentcontainer.hxx,v $ * - * $Revision: 1.8.122.1 $ + * $Revision: 1.8.122.2 $ * - * last change: $Author: fs $ $Date: 2006/05/24 09:11:51 $ + * last change: $Author: fs $ $Date: 2006/05/24 14:58:36 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -148,8 +148,6 @@ // OPropertyArrayUsageHelper virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; - // ODefinitionContainer - virtual void approveNewObject(const ::rtl::OUString& _sName,const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent >& _rxObject) const; }; //........................................................................ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
