User: ihi Date: 2007-11-21 15:38:53+0000 Modified: dba/dbaccess/source/core/dataaccess/documentcontainer.cxx
Log: INTEGRATION: CWS dba24c (1.24.40); FILE MERGED 2007/10/30 16:28:28 fs 1.24.40.3: RESYNC: (1.24-1.25); FILE MERGED 2007/10/22 20:57:14 fs 1.24.40.2: during #i73705# #i52527#: m_aObjectList is unused / outsourced the 'forms' and 'reports' storage names to ODatabaseModelImpl 2007/09/20 18:34:05 fs 1.24.40.1: during #i80856#: m_xORB -> m_aContext 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.25&r2=1.26 Delta lines: +28 -15 --------------------- --- documentcontainer.cxx 2007-10-23 14:37:54+0000 1.25 +++ documentcontainer.cxx 2007-11-21 15:38:50+0000 1.26 @@ -72,12 +72,18 @@ #ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_ #include <com/sun/star/beans/PropertyAttribute.hpp> #endif +#ifndef _COM_SUN_STAR_SDB_ERRORCONDITION_HPP_ +#include <com/sun/star/sdb/ErrorCondition.hpp> +#endif #ifndef _DBA_COREDATAACCESS_DATASOURCE_HXX_ #include "datasource.hxx" #endif #ifndef _COMPHELPER_MIMECONFIGHELPER_HXX_ #include <comphelper/mimeconfighelper.hxx> #endif +#ifndef CONNECTIVITY_SQLERROR_HXX +#include <connectivity/sqlerror.hxx> +#endif using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; @@ -86,6 +92,7 @@ using namespace ::com::sun::star::container; using namespace ::com::sun::star::ucb; using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::sdb; using namespace ::com::sun::star::io; using namespace ::osl; using namespace ::comphelper; @@ -101,8 +108,17 @@ //========================================================================== class LocalNameApproval : public IContainerApprove { + ::connectivity::SQLError m_aErrors; + public: - LocalNameApproval() { } + LocalNameApproval( const Reference< XMultiServiceFactory >& _rxFactory ) + :m_aErrors( ::comphelper::ComponentContext( _rxFactory ) ) + { + } + virtual ~LocalNameApproval() + { + } + void SAL_CALL approveElement( const ::rtl::OUString& _rName, const Reference< XInterface >& _rxElement ); }; @@ -111,10 +127,10 @@ { if ( _rName.indexOf( '/' ) != -1 ) throw IllegalArgumentException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "The name must not contain any / characters." ) ), + m_aErrors.getErrorMessage( ErrorCondition::DB_OBJECT_NAME_WITH_SLASHES ), NULL, - 0 ); - // TODO: resource + 0 + ); } //========================================================================== @@ -135,7 +151,7 @@ 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 ) ); + setElementApproval( PContainerApprove( new LocalNameApproval ( _xORB ) ) ); } //-------------------------------------------------------------------------- @@ -170,8 +186,8 @@ ODefinitionContainer_Impl::const_iterator aFind = rDefinitions.find( _rName ); OSL_ENSURE( aFind != rDefinitions.end(), "ODocumentContainer::createObject:Invalid entry in map!" ); if ( aFind->second->m_aProps.bIsFolder ) - return new ODocumentContainer( m_xORB, *this, aFind->second, m_bFormsContainer ); - return new ODocumentDefinition( *this, m_xORB, aFind->second, m_bFormsContainer ); + return new ODocumentContainer( m_aContext.getLegacyServiceFactory(), *this, aFind->second, m_bFormsContainer ); + return new ODocumentDefinition( *this, m_aContext.getLegacyServiceFactory(), aFind->second, m_bFormsContainer ); } // ----------------------------------------------------------------------------- Reference< XInterface > SAL_CALL ODocumentContainer::createInstance( const ::rtl::OUString& aServiceSpecifier ) throw (Exception, RuntimeException) @@ -205,7 +221,6 @@ else if ( aValue.Name.equalsAscii(PROPERTY_PERSISTENT_NAME) ) { aValue.Value >>= sPersistentName; - m_aObjectList.insert(PersistentNames::value_type(sPersistentName,true)); } else if ( aValue.Name.equalsAscii(PROPERTY_EMBEDDEDOBJECT) ) { @@ -258,7 +273,7 @@ } if ( ( aClassID.getLength() == 0 ) && ( 0 == sURL.getLength() ) ) - ODocumentDefinition::GetDocumentServiceFromMediaType(getStorage(),sPersistentName,m_xORB,aClassID); + ODocumentDefinition::GetDocumentServiceFromMediaType( getStorage(), sPersistentName, m_aContext.getLegacyServiceFactory(), aClassID ); } ODefinitionContainer_Impl::const_iterator aFind = rDefinitions.find( sName ); @@ -276,7 +291,7 @@ else pElementImpl = aFind->second; - xContent = new ODocumentDefinition(*this, m_xORB,pElementImpl,m_bFormsContainer,aClassID,xConnection); + xContent = new ODocumentDefinition( *this, m_aContext.getLegacyServiceFactory(), pElementImpl, m_bFormsContainer, aClassID, xConnection ); if ( sURL.getLength() ) { @@ -326,7 +341,7 @@ else pElementImpl = aFind->second; OSL_ENSURE( pElementImpl ," Invalid entry in map!"); - xContent = new ODocumentContainer(m_xORB,*this,pElementImpl,ServiceSpecifier == SERVICE_NAME_FORM_COLLECTION); + xContent = new ODocumentContainer( m_aContext.getLegacyServiceFactory(), *this, pElementImpl, ServiceSpecifier == SERVICE_NAME_FORM_COLLECTION ); // copy children if ( xCopyFrom.is() ) @@ -417,7 +432,7 @@ // open as folder - return result set Reference< XDynamicResultSet > xSet - = new DynamicResultSet( m_xORB, + = new DynamicResultSet( m_aContext.getLegacyServiceFactory(), this, aOpenCommand, Environment ); @@ -684,10 +699,8 @@ // ----------------------------------------------------------------------------- Reference< XStorage> ODocumentContainer::getStorage() const { - static const ::rtl::OUString s_sForms = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("forms")); - static const ::rtl::OUString s_sReports = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("reports")); return m_pImpl->m_pDataSource - ? m_pImpl->m_pDataSource->getStorage( m_bFormsContainer ? s_sForms : s_sReports ) + ? m_pImpl->m_pDataSource->getStorage( ODatabaseModelImpl::getObjectContainerStorageName( m_bFormsContainer ? ODatabaseModelImpl::E_FORM : ODatabaseModelImpl::E_REPORT ) ) : Reference< XStorage>(); } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
