diff options
author | Ocke Janssen [oj] <Ocke.Janssen@sun.com> | 2009-12-10 07:40:02 +0100 |
---|---|---|
committer | Ocke Janssen [oj] <Ocke.Janssen@sun.com> | 2009-12-10 07:40:02 +0100 |
commit | c66201b66deeb77d630a583557c41f8b9b7381bd (patch) | |
tree | f6d4ea37528b604ce61e312490fc1f3498cd0c1a /dbaccess/source | |
parent | c3e481a39ddd7de472cdb2ffdf0b44b3746d4240 (diff) | |
parent | f17e58864db1476a09cc5156e85f745a9286da63 (diff) |
dba33d: merge with DEV300_m67
Diffstat (limited to 'dbaccess/source')
51 files changed, 491 insertions, 631 deletions
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index 461929f68141..fbe8eee4c500 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -36,104 +36,55 @@ #include "sdbcoretools.hxx" #include "SingleSelectQueryComposer.hxx" #include "module_dba.hxx" +#include "sdbcoretools.hxx" +#include "CRowSetColumn.hxx" +#include "CRowSetDataColumn.hxx" +#include "RowSetCache.hxx" +#include "core_resource.hrc" +#include "core_resource.hxx" +#include "tablecontainer.hxx" -#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_ +/** === begin UNO includes === **/ #include <com/sun/star/beans/PropertyAttribute.hpp> -#endif -#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/container/XChild.hpp> #include <com/sun/star/lang/DisposedException.hpp> -#endif -#ifndef _CPPUHELPER_INTERFACECONTAINER_H_ -#include <cppuhelper/interfacecontainer.h> -#endif -#ifndef _CPPUHELPER_EXC_HLP_HXX_ -#include <cppuhelper/exc_hlp.hxx> -#endif -#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ -#include <cppuhelper/typeprovider.hxx> -#endif -#ifndef _COMPHELPER_SEQUENCE_HXX_ -#include <comphelper/sequence.hxx> -#endif -#ifndef COMPHELPER_COMPONENTCONTEXT_HXX -#include <comphelper/componentcontext.hxx> -#endif -#ifndef _COM_SUN_STAR_SDB_XCOMPLETEDCONNECTION_HPP_ -#include <com/sun/star/sdb/XCompletedConnection.hpp> -#endif -#ifndef _COM_SUN_STAR_SDB_ROWSETVETOEXCEPTION_HPP_ +#include <com/sun/star/sdb/CommandType.hpp> +#include <com/sun/star/sdb/ErrorCondition.hpp> +#include <com/sun/star/sdb/RowChangeAction.hpp> #include <com/sun/star/sdb/RowSetVetoException.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_FETCHDIRECTION_HPP_ +#include <com/sun/star/sdb/XCompletedConnection.hpp> +#include <com/sun/star/sdb/XParametersSupplier.hpp> +#include <com/sun/star/sdb/XQueriesSupplier.hpp> #include <com/sun/star/sdbc/FetchDirection.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_RESULTSETCONCURRENCY_HPP_ #include <com/sun/star/sdbc/ResultSetConcurrency.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_PRIVILEGE_HPP_ -#include <com/sun/star/sdbcx/Privilege.hpp> -#endif -#ifndef _COM_SUN_STAR_SDB_COMMANDTYPE_HPP_ -#include <com/sun/star/sdb/CommandType.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XDATASOURCE_HPP_ #include <com/sun/star/sdbc/XDataSource.hpp> -#endif -#ifndef _COM_SUN_STAR_SDB_XQUERIESSUPPLIER_HPP_ -#include <com/sun/star/sdb/XQueriesSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDB_ROWCHANGEACTION_HPP_ -#include <com/sun/star/sdb/RowChangeAction.hpp> -#endif -#ifndef _COM_SUN_STAR_SDB_ERRORCONDITION_HPP_ -#include <com/sun/star/sdb/ErrorCondition.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XDRIVERACCESS_HPP_ #include <com/sun/star/sdbc/XDriverAccess.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XDATADEFINITIONSUPPLIER_HPP_ -#include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_COMPAREBOOKMARK_HPP_ #include <com/sun/star/sdbcx/CompareBookmark.hpp> -#endif -#ifndef _COM_SUN_STAR_UNO_XNAMINGSERVICE_HPP_ -#include <com/sun/star/uno/XNamingService.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_PRIVILEGE_HPP_ #include <com/sun/star/sdbcx/Privilege.hpp> -#endif -#ifndef _CONNECTIVITY_DBTOOLS_HXX_ -#include <connectivity/dbtools.hxx> -#endif -#ifndef _COMPHELPER_EXTRACT_HXX_ +#include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp> +#include <com/sun/star/uno/XNamingService.hpp> +#include <com/sun/star/util/XNumberFormatsSupplier.hpp> +/** === end UNO includes === **/ + +#include <comphelper/componentcontext.hxx> #include <comphelper/extract.hxx> -#endif -#ifndef DBACCESS_CORE_API_ROWSETCACHE_HXX -#include "RowSetCache.hxx" -#endif -#if OSL_DEBUG_LEVEL > 1 -#ifndef _COM_SUN_STAR_SDBC_XDRIVERMANAGER_HPP_ -#include <com/sun/star/sdbc/XDriverManager.hpp> -#endif -#endif -#ifndef _DBACORE_DATACOLUMN_HXX_ -#include "CRowSetDataColumn.hxx" -#endif -#ifndef DBACCESS_CORE_API_CROWSETCOLUMN_HXX -#include "CRowSetColumn.hxx" -#endif -#ifndef _COMPHELPER_TYPES_HXX_ -#include <comphelper/types.hxx> -#endif -#ifndef _COMPHELPER_SEQSTREAM_HXX +#include <comphelper/interaction.hxx> +#include <comphelper/property.hxx> #include <comphelper/seqstream.hxx> -#endif -#ifndef _TOOLS_DEBUG_HXX +#include <comphelper/sequence.hxx> +#include <comphelper/types.hxx> +#include <comphelper/uno3.hxx> +#include <connectivity/dbconversion.hxx> +#include <connectivity/dbexception.hxx> +#include <connectivity/dbtools.hxx> +#include <cppuhelper/exc_hlp.hxx> +#include <cppuhelper/interfacecontainer.h> +#include <cppuhelper/typeprovider.hxx> +#include <rtl/logfile.hxx> +#include <svtools/syslocale.hxx> #include <tools/debug.hxx> -#endif -#ifndef TOOLS_DIAGNOSE_EX_H #include <tools/diagnose_ex.h> +<<<<<<< local #endif #ifndef _DBHELPER_DBEXCEPTION_HXX_ #include <connectivity/dbexception.hxx> @@ -164,29 +115,9 @@ #include <comphelper/property.hxx> #endif #ifndef _UTL_CONFIGMGR_HXX_ +======= +>>>>>>> other #include <unotools/configmgr.hxx> -#endif -#ifndef _COMPHELPER_UNO3_HXX_ -#include <comphelper/uno3.hxx> -#endif -#ifndef _COM_SUN_STAR_SDBCX_COMPAREBOOKMARK_HPP_ -#include <com/sun/star/sdbcx/CompareBookmark.hpp> -#endif -#ifndef _DBA_CORE_RESOURCE_HXX_ -#include "core_resource.hxx" -#endif -#ifndef _DBA_CORE_RESOURCE_HRC_ -#include "core_resource.hrc" -#endif -#ifndef _DBHELPER_DBCONVERSION_HXX_ -#include <connectivity/dbconversion.hxx> -#endif -#ifndef INCLUDED_SVTOOLS_SYSLOCALE_HXX -#include <svtools/syslocale.hxx> -#endif -#ifndef _RTL_LOGFILE_HXX_ -#include <rtl/logfile.hxx> -#endif using namespace utl; using namespace dbaccess; @@ -2202,37 +2133,37 @@ Reference< XConnection > ORowSet::calcConnection(const Reference< XInteractionH if (!m_xActiveConnection.is()) { Reference< XConnection > xNewConn; - if (m_aDataSourceName.getLength()) + if ( m_aDataSourceName.getLength() ) { - // is it a file url? - Reference< XNameAccess > xNamingContext; - if ( m_aContext.createComponent( (::rtl::OUString)SERVICE_SDB_DATABASECONTEXT, xNamingContext ) ) - if (xNamingContext.is() ) + Reference< XNameAccess > xDatabaseContext( + m_aContext.createComponent( (::rtl::OUString)SERVICE_SDB_DATABASECONTEXT ), + UNO_QUERY_THROW ); + try { - try - { - if(_rxHandler.is()) - { - Reference< XCompletedConnection> xComplConn(xNamingContext->getByName(m_aDataSourceName), UNO_QUERY); - if(xComplConn.is()) - xNewConn = xComplConn->connectWithCompletion(_rxHandler); - } - else - { - Reference< XDataSource > xDataSource(xNamingContext->getByName(m_aDataSourceName), UNO_QUERY); - if (xDataSource.is()) - xNewConn = xDataSource->getConnection(m_aUser, m_aPassword); - } - } - catch (SQLException &e) + Reference< XDataSource > xDataSource( xDatabaseContext->getByName( m_aDataSourceName ), UNO_QUERY_THROW ); + + // try connecting with the interaction handler + Reference< XCompletedConnection > xComplConn( xDataSource, UNO_QUERY ); + if ( _rxHandler.is() && xComplConn.is() ) { - throw e; + xNewConn = xComplConn->connectWithCompletion( _rxHandler ); } - catch (Exception&) + else { - throw SQLException(); + xNewConn = xDataSource->getConnection( m_aUser, m_aPassword ); } } + catch ( const SQLException& e ) + { + throw; + } + catch ( const Exception& e ) + { + Any aError = ::cppu::getCaughtException(); + ::rtl::OUString sMessage = ResourceManager::loadString( RID_NO_SUCH_DATA_SOURCE, + "$name$", m_aDataSourceName, "$error$", extractExceptionMessage( m_aContext, aError ) ); + ::dbtools::throwGenericSQLException( sMessage, *this ); + } } setActiveConnection(xNewConn); m_bOwnConnection = sal_True; @@ -2256,7 +2187,7 @@ Reference< XNameAccess > ORowSet::impl_getTables_throw() else { if ( !m_xActiveConnection.is() ) - throw SQLException(DBA_RES(RID_STR_CONNECTION_INVALID),*this,SQLSTATE_GENERAL,1000,Any() ); + throw SQLException(DBA_RES(RID_STR_CONNECTION_INVALID),*this,SQLSTATE_GENERAL,1000,Any() ); sal_Bool bCase = sal_True; try diff --git a/dbaccess/source/core/api/querydescriptor.cxx b/dbaccess/source/core/api/querydescriptor.cxx index 00b3a247aed5..2dfb6714ee63 100644 --- a/dbaccess/source/core/api/querydescriptor.cxx +++ b/dbaccess/source/core/api/querydescriptor.cxx @@ -89,29 +89,6 @@ OQueryDescriptor::OQueryDescriptor() } //-------------------------------------------------------------------------- -OQueryDescriptor::OQueryDescriptor(const Reference< XPropertySet >& _rxCommandDefinition) - :OQueryDescriptor_Base(m_aMutex,*this) - ,ODataSettings(m_aBHelper,sal_True) -{ - DBG_CTOR(OQueryDescriptor,NULL); - registerProperties(); - ODataSettings::registerPropertiesFor(this); - - osl_incrementInterlockedCount(&m_refCount); - - OSL_ENSURE(_rxCommandDefinition.is(), "OQueryDescriptor_Base::OQueryDescriptor_Base : invalid source property set !"); - try - { - ::comphelper::copyProperties(_rxCommandDefinition,this); - } - catch(Exception&) - { - OSL_ENSURE(sal_False, "OQueryDescriptor_Base::OQueryDescriptor_Base: caught an exception!"); - } - osl_decrementInterlockedCount(&m_refCount); -} - -//-------------------------------------------------------------------------- OQueryDescriptor::OQueryDescriptor(const OQueryDescriptor_Base& _rSource) :OQueryDescriptor_Base(_rSource,*this) ,ODataSettings(m_aBHelper,sal_True) diff --git a/dbaccess/source/core/api/querydescriptor.hxx b/dbaccess/source/core/api/querydescriptor.hxx index 958ef8e184aa..4d20bcc71199 100644 --- a/dbaccess/source/core/api/querydescriptor.hxx +++ b/dbaccess/source/core/api/querydescriptor.hxx @@ -165,10 +165,6 @@ protected: virtual ~OQueryDescriptor(); public: OQueryDescriptor(); - /** constructs the object with a UNO QueryDescriptor. If you use this ctor, the resulting object - won't have any column informations (the column container will be empty) - */ - OQueryDescriptor(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxForeignDescriptor); OQueryDescriptor(const OQueryDescriptor_Base& _rSource); // com::sun::star::lang::XTypeProvider diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx index 8b050effc894..fef47f68145a 100644 --- a/dbaccess/source/core/dataaccess/ModelImpl.cxx +++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx @@ -143,11 +143,13 @@ class DocumentStorageAccess : public ::cppu::WeakImplHelper2< XDocumentSubStor NamedStorages m_aExposedStorages; ODatabaseModelImpl* m_pModelImplementation; bool m_bPropagateCommitToRoot; + bool m_bDisposingSubStorages; public: DocumentStorageAccess( ODatabaseModelImpl& _rModelImplementation ) :m_pModelImplementation( &_rModelImplementation ) ,m_bPropagateCommitToRoot( true ) + ,m_bDisposingSubStorages( false ) { DBG_CTOR( DocumentStorageAccess, NULL ); } @@ -161,19 +163,8 @@ protected: public: void dispose(); - void suspendCommitPropagation() - { - DBG_ASSERT( m_bPropagateCommitToRoot, "DocumentStorageAccess:: suspendCommitPropagation: already suspended" ); - m_bPropagateCommitToRoot = false; - } - void resumeCommitPropagation() - { - DBG_ASSERT( !m_bPropagateCommitToRoot, "DocumentStorageAccess:: suspendCommitPropagation: already suspended" ); - m_bPropagateCommitToRoot = true; - } - // XDocumentSubStorageSupplier - virtual Reference< XStorage > SAL_CALL getDocumentSubStorage( const ::rtl::OUString& aStorageName, ::sal_Int32 nMode ) throw (RuntimeException); + virtual Reference< XStorage > SAL_CALL getDocumentSubStorage( const ::rtl::OUString& aStorageName, ::sal_Int32 _nMode ) throw (RuntimeException); virtual Sequence< ::rtl::OUString > SAL_CALL getDocumentSubStoragesNames( ) throw (IOException, RuntimeException); // XTransactionListener @@ -184,6 +175,32 @@ public: // XEventListener virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); + + /// disposes all storages managed by this instance + void disposeStorages(); + + /// disposes all known sub storages + void commitStorages() SAL_THROW(( IOException, RuntimeException )); + + /// commits the dedicated "database" storage + bool commitEmbeddedStorage( bool _bPreventRootCommits ); + +private: + /** opens the sub storage with the given name, in the given mode + */ + Reference< XStorage > impl_openSubStorage_nothrow( const ::rtl::OUString& _rStorageName, sal_Int32 _nMode ); + + void impl_suspendCommitPropagation() + { + OSL_ENSURE( m_bPropagateCommitToRoot, "DocumentStorageAccess::impl_suspendCommitPropagation: already suspended" ); + m_bPropagateCommitToRoot = false; + } + void impl_resumeCommitPropagation() + { + OSL_ENSURE( !m_bPropagateCommitToRoot, "DocumentStorageAccess::impl_resumeCommitPropagation: not suspended" ); + m_bPropagateCommitToRoot = true; + } + }; //-------------------------------------------------------------------------- @@ -214,17 +231,117 @@ void DocumentStorageAccess::dispose() } //-------------------------------------------------------------------------- -Reference< XStorage > SAL_CALL DocumentStorageAccess::getDocumentSubStorage( const ::rtl::OUString& aStorageName, ::sal_Int32 nMode ) throw (RuntimeException) +Reference< XStorage > DocumentStorageAccess::impl_openSubStorage_nothrow( const ::rtl::OUString& _rStorageName, sal_Int32 _nDesiredMode ) +{ + OSL_ENSURE( _rStorageName.getLength(),"ODatabaseModelImpl::impl_openSubStorage_nothrow: Invalid storage name!" ); + + Reference< XStorage > xStorage; + try + { + Reference< XStorage > xRootStorage( m_pModelImplementation->getOrCreateRootStorage() ); + if ( xRootStorage.is() ) + { + sal_Int32 nRealMode = m_pModelImplementation->m_bDocumentReadOnly ? ElementModes::READ : _nDesiredMode; + if ( nRealMode == ElementModes::READ ) + { + Reference< XNameAccess > xSubStorageNames( xRootStorage, UNO_QUERY ); + if ( xSubStorageNames.is() && !xSubStorageNames->hasByName( _rStorageName ) ) + return xStorage; + } + + xStorage = xRootStorage->openStorageElement( _rStorageName, nRealMode ); + + Reference< XTransactionBroadcaster > xBroad( xStorage, UNO_QUERY ); + if ( xBroad.is() ) + xBroad->addTransactionListener( this ); + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + return xStorage; +} + +//-------------------------------------------------------------------------- +void DocumentStorageAccess::disposeStorages() +{ + m_bDisposingSubStorages = true; + + NamedStorages::iterator aEnd = m_aExposedStorages.end(); + for ( NamedStorages::iterator aIter = m_aExposedStorages.begin(); + aIter != aEnd ; + ++aIter + ) + { + try + { + ::comphelper::disposeComponent( aIter->second ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + m_aExposedStorages.clear(); + + m_bDisposingSubStorages = false; +} + +//-------------------------------------------------------------------------- +void DocumentStorageAccess::commitStorages() SAL_THROW(( IOException, RuntimeException )) +{ + try + { + for ( NamedStorages::const_iterator aIter = m_aExposedStorages.begin(); + aIter != m_aExposedStorages.end(); + ++aIter + ) + { + m_pModelImplementation->commitStorageIfWriteable( aIter->second ); + } + } + catch(const WrappedTargetException&) + { + // WrappedTargetException not allowed to leave + throw IOException(); + } +} + +//-------------------------------------------------------------------------- +bool DocumentStorageAccess::commitEmbeddedStorage( bool _bPreventRootCommits ) +{ + if ( _bPreventRootCommits ) + impl_suspendCommitPropagation(); + + bool bSuccess = false; + try + { + NamedStorages::const_iterator pos = m_aExposedStorages.find( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "database" ) ) ); + if ( pos != m_aExposedStorages.end() ) + bSuccess = m_pModelImplementation->commitStorageIfWriteable( pos->second ); + } + catch( Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + if ( _bPreventRootCommits ) + impl_resumeCommitPropagation(); + + return bSuccess; + +} + +//-------------------------------------------------------------------------- +Reference< XStorage > SAL_CALL DocumentStorageAccess::getDocumentSubStorage( const ::rtl::OUString& aStorageName, ::sal_Int32 _nDesiredMode ) throw (RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); NamedStorages::iterator pos = m_aExposedStorages.find( aStorageName ); if ( pos == m_aExposedStorages.end() ) { - Reference< XStorage > xResult = m_pModelImplementation->getStorage( aStorageName, nMode ); - Reference< XTransactionBroadcaster > xBroadcaster( xResult, UNO_QUERY ); - if ( xBroadcaster.is() ) - xBroadcaster->addTransactionListener( this ); - + Reference< XStorage > xResult = impl_openSubStorage_nothrow( aStorageName, _nDesiredMode ); pos = m_aExposedStorages.insert( NamedStorages::value_type( aStorageName, xResult ) ).first; } @@ -269,8 +386,14 @@ void SAL_CALL DocumentStorageAccess::commited( const css::lang::EventObject& aEv if ( m_pModelImplementation && m_bPropagateCommitToRoot ) { Reference< XStorage > xStorage( aEvent.Source, UNO_QUERY ); - if ( m_pModelImplementation->isDatabaseStorage( xStorage ) ) + + // check if this is the dedicated "database" sub storage + NamedStorages::const_iterator pos = m_aExposedStorages.find( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "database" ) ) ); + if ( ( pos != m_aExposedStorages.end() ) + && ( pos->second == xStorage ) + ) { + // if so, also commit the root storage m_pModelImplementation->commitRootStorage(); } } @@ -291,9 +414,10 @@ void SAL_CALL DocumentStorageAccess::reverted( const css::lang::EventObject& /*a //-------------------------------------------------------------------------- void SAL_CALL DocumentStorageAccess::disposing( const css::lang::EventObject& Source ) throw ( RuntimeException ) { - ODatabaseModelImpl* pImpl = m_pModelImplementation; - if ( pImpl ) - pImpl->disposing( Source ); + OSL_ENSURE( Reference< XStorage >( Source.Source, UNO_QUERY ).is(), "DocumentStorageAccess::disposing: No storage? What's this?" ); + + if ( m_bDisposingSubStorages ) + return; for ( NamedStorages::iterator find = m_aExposedStorages.begin(); find != m_aExposedStorages.end(); @@ -318,7 +442,6 @@ ODatabaseModelImpl::ODatabaseModelImpl( const Reference< XMultiServiceFactory >& ,m_aMutex() ,m_aMutexFacade( m_aMutex ) ,m_aContainer(4) - ,m_aStorages() ,m_aMacroMode( *this ) ,m_nImposedMacroExecMode( MacroExecMode::NEVER_EXECUTE ) ,m_pDBContext( &_rDBContext ) @@ -333,7 +456,6 @@ ODatabaseModelImpl::ODatabaseModelImpl( const Reference< XMultiServiceFactory >& ,m_bSuppressVersionColumns(sal_True) ,m_bModified(sal_False) ,m_bDocumentReadOnly(sal_False) - ,m_bDisposingSubStorages( sal_False ) ,m_pSharedConnectionManager(NULL) ,m_nControllerLockCount(0) { @@ -357,7 +479,6 @@ ODatabaseModelImpl::ODatabaseModelImpl( ,m_aMutex() ,m_aMutexFacade( m_aMutex ) ,m_aContainer(4) - ,m_aStorages() ,m_aMacroMode( *this ) ,m_nImposedMacroExecMode( MacroExecMode::NEVER_EXECUTE ) ,m_pDBContext( &_rDBContext ) @@ -373,7 +494,6 @@ ODatabaseModelImpl::ODatabaseModelImpl( ,m_bSuppressVersionColumns(sal_True) ,m_bModified(sal_False) ,m_bDocumentReadOnly(sal_False) - ,m_bDisposingSubStorages( sal_False ) ,m_pSharedConnectionManager(NULL) ,m_nControllerLockCount(0) { @@ -506,8 +626,7 @@ namespace try { - Reference< XStorage > xContainerStorage( _rModel.getStorage( - _rModel.getObjectContainerStorageName( _eType ), ElementModes::READWRITE ) ); + Reference< XStorage > xContainerStorage( _rModel.getStorage( _eType, ElementModes::READWRITE ) ); // note the READWRITE here: If the storage already existed before, then the OpenMode will // be ignored, anyway. // If the storage did not yet exist, then it will be created. If the database document @@ -589,16 +708,9 @@ void SAL_CALL ODatabaseModelImpl::disposing( const ::com::sun::star::lang::Event if ( bStore ) commitRootStorage(); } - else // storage + else { - if ( !m_bDisposingSubStorages ) - { - Reference<XStorage> xStorage(Source.Source,UNO_QUERY); - TStorages::iterator aFind = ::std::find_if(m_aStorages.begin(),m_aStorages.end(), - ::std::compose1(::std::bind2nd(::std::equal_to<Reference<XStorage> >(),xStorage),::std::select2nd<TStorages::value_type>())); - if ( aFind != m_aStorages.end() ) - m_aStorages.erase(aFind); - } + OSL_ENSURE( false, "ODatabaseModelImpl::disposing: where does this come from?" ); } } //------------------------------------------------------------------------------ @@ -662,9 +774,11 @@ void ODatabaseModelImpl::dispose() try { - sal_Bool bStore = commitEmbeddedStorage(); + sal_Bool bCouldStore = commitEmbeddedStorage( true ); + // "true" means that committing the embedded storage should not trigger committing the root + // storage. This is because we are going to commit the root storage ourself, anyway disposeStorages(); - if ( bStore ) + if ( bCouldStore ) commitRootStorage(); impl_switchToStorage_throw( NULL ); @@ -731,27 +845,9 @@ Sequence< PropertyValue > ODatabaseModelImpl::stripLoadArguments( const ::comphe // ----------------------------------------------------------------------------- void ODatabaseModelImpl::disposeStorages() SAL_THROW(()) { - m_bDisposingSubStorages = sal_True; - - TStorages::iterator aEnd = m_aStorages.end(); - for ( TStorages::iterator aIter = m_aStorages.begin(); - aIter != aEnd ; - ++aIter - ) - { - try - { - ::comphelper::disposeComponent( aIter->second ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - m_aStorages.clear(); - - m_bDisposingSubStorages = sal_False; + getDocumentStorageAccess()->disposeStorages(); } + // ----------------------------------------------------------------------------- Reference< XSingleServiceFactory > ODatabaseModelImpl::createStorageFactory() const { @@ -849,68 +945,11 @@ Reference< XDocumentSubStorageSupplier > ODatabaseModelImpl::getDocumentSubStora { return getDocumentStorageAccess(); } -// ----------------------------------------------------------------------------- -Reference<XStorage> ODatabaseModelImpl::getStorage( const ::rtl::OUString& _sStorageName, sal_Int32 _nMode ) -{ - OSL_ENSURE(_sStorageName.getLength(),"ODatabaseModelImpl::getStorage: Invalid storage name!"); - Reference<XStorage> xStorage; - TStorages::iterator aFind = m_aStorages.find(_sStorageName); - if ( aFind == m_aStorages.end() ) - { - try - { - Reference< XStorage > xMyStorage( getOrCreateRootStorage() ); - if ( xMyStorage.is() ) - { - sal_Int32 nMode = m_bDocumentReadOnly ? ElementModes::READ : _nMode; - if ( nMode == ElementModes::READ ) - { - Reference< XNameAccess > xSubStorageNames( xMyStorage, UNO_QUERY ); - if ( xSubStorageNames.is() && !xSubStorageNames->hasByName( _sStorageName ) ) - return xStorage; - } - xStorage = xMyStorage->openStorageElement( _sStorageName, nMode ); - Reference< XTransactionBroadcaster > xBroad( xStorage, UNO_QUERY ); - if ( xBroad.is() ) - xBroad->addTransactionListener( getDocumentStorageAccess() ); - aFind = m_aStorages.insert( TStorages::value_type( _sStorageName, xStorage ) ).first; - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - if ( aFind != m_aStorages.end() ) - xStorage = aFind->second; - - return xStorage; -} // ----------------------------------------------------------------------------- -sal_Bool ODatabaseModelImpl::commitEmbeddedStorage( sal_Bool _bPreventRootCommits ) +bool ODatabaseModelImpl::commitEmbeddedStorage( bool _bPreventRootCommits ) { - if ( _bPreventRootCommits && m_pStorageAccess ) - m_pStorageAccess->suspendCommitPropagation(); - - sal_Bool bStore = sal_False; - try - { - TStorages::iterator aFind = m_aStorages.find(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("database"))); - if ( aFind != m_aStorages.end() ) - bStore = commitStorageIfWriteable(aFind->second); - } - catch(Exception&) - { - OSL_ENSURE(0,"Exception Caught: Could not store embedded database!"); - } - - if ( _bPreventRootCommits && m_pStorageAccess ) - m_pStorageAccess->resumeCommitPropagation(); - - return bStore; - + return getDocumentStorageAccess()->commitEmbeddedStorage( _bPreventRootCommits ); } // ----------------------------------------------------------------------------- @@ -1072,18 +1111,13 @@ oslInterlockedCount SAL_CALL ODatabaseModelImpl::release() // ----------------------------------------------------------------------------- void ODatabaseModelImpl::commitStorages() SAL_THROW(( IOException, RuntimeException )) { - try - { - TStorages::iterator aIter = m_aStorages.begin(); - TStorages::iterator aEnd = m_aStorages.end(); - for (; aIter != aEnd ; ++aIter) - commitStorageIfWriteable( aIter->second ); - } - catch(const WrappedTargetException&) - { - // WrappedTargetException not allowed to leave - throw IOException(); - } + getDocumentStorageAccess()->commitStorages(); +} + +// ----------------------------------------------------------------------------- +Reference< XStorage > ODatabaseModelImpl::getStorage( const ObjectType _eType, const sal_Int32 _nDesiredMode ) +{ + return getDocumentStorageAccess()->getDocumentSubStorage( getObjectContainerStorageName( _eType ), _nDesiredMode ); } // ----------------------------------------------------------------------------- @@ -1173,7 +1207,7 @@ TContentPtr& ODatabaseModelImpl::getObjectContainer( ObjectType _eType ) void ODatabaseModelImpl::revokeDataSource() const { if ( m_pDBContext && m_sDocumentURL.getLength() ) - m_pDBContext->deregisterPrivate( m_sDocumentURL ); + m_pDBContext->revokeDatabaseDocument( *this ); } // ----------------------------------------------------------------------------- @@ -1323,16 +1357,10 @@ Reference< XStorage > ODatabaseModelImpl::impl_switchToStorage_throw( const Refe void ODatabaseModelImpl::switchToURL( const ::rtl::OUString& _rDocumentLocation, const ::rtl::OUString& _rDocumentURL ) { // register at the database context, or change registration - if ( _rDocumentURL != m_sDocumentURL ) + const bool bURLChanged = ( _rDocumentURL != m_sDocumentURL ); + const ::rtl::OUString sOldURL( m_sDocumentURL ); + if ( bURLChanged ) { - if ( m_pDBContext ) - { - if ( m_sDocumentURL.getLength() ) - m_pDBContext->nameChangePrivate( m_sDocumentURL, _rDocumentURL ); - else - m_pDBContext->registerPrivate( _rDocumentURL, this ); - } - if ( ( m_sName == m_sDocumentURL ) // our name is our old URL || ( !m_sName.getLength() ) // we do not have a name, yet (i.e. are not registered at the database context) ) @@ -1349,19 +1377,14 @@ void ODatabaseModelImpl::switchToURL( const ::rtl::OUString& _rDocumentLocation, // remember both m_sDocFileLocation = _rDocumentLocation.getLength() ? _rDocumentLocation : _rDocumentURL; m_sDocumentURL = _rDocumentURL; -} -// ----------------------------------------------------------------------------- -bool ODatabaseModelImpl::isDatabaseStorage( const Reference< XStorage >& _rxStorage ) const -{ - TStorages::const_iterator pos = m_aStorages.find( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "database" ) ) ); - if ( ( pos != m_aStorages.end() ) - && ( pos->second == _rxStorage ) - ) + if ( bURLChanged && m_pDBContext ) { - return true; + if ( sOldURL.getLength() ) + m_pDBContext->databaseDocumentURLChange( sOldURL, m_sDocumentURL ); + else + m_pDBContext->registerDatabaseDocument( *this ); } - return false; } // ----------------------------------------------------------------------------- diff --git a/dbaccess/source/core/dataaccess/ModelImpl.hxx b/dbaccess/source/core/dataaccess/ModelImpl.hxx index dd194829bb51..4dd72cf5b319 100644 --- a/dbaccess/source/core/dataaccess/ModelImpl.hxx +++ b/dbaccess/source/core/dataaccess/ModelImpl.hxx @@ -162,8 +162,6 @@ private: //============================================================ //= ODatabaseModelImpl //============================================================ -DECLARE_STL_USTRINGACCESS_MAP(::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >,TStorages); - typedef ::utl::SharedUNOComponent< ::com::sun::star::embed::XStorage > SharedStorage; class ODatabaseContext; @@ -201,7 +199,6 @@ private: ::comphelper::SharedMutex m_aMutex; VosMutexFacade m_aMutexFacade; ::std::vector< TContentPtr > m_aContainer; // one for each ObjectType - TStorages m_aStorages; ::sfx2::DocumentMacroMode m_aMacroMode; sal_Int16 m_nImposedMacroExecMode; @@ -261,7 +258,6 @@ public: sal_Bool m_bSuppressVersionColumns : 1; sal_Bool m_bModified : 1; sal_Bool m_bDocumentReadOnly : 1; - sal_Bool m_bDisposingSubStorages; ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyAccess > m_xSettings; ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aTableFilter; @@ -286,10 +282,9 @@ public: call. @return <TRUE/> if the storage could be commited, otherwise <FALSE/> */ - sal_Bool commitEmbeddedStorage( sal_Bool _bPreventRootCommits = sal_False ); + bool commitEmbeddedStorage( bool _bPreventRootCommits = false ); - /** commits all storages storages which have been obtained via getStorage - */ + /// commits all sub storages void commitStorages() SAL_THROW(( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException )); @@ -315,7 +310,10 @@ public: inline ::rtl::OUString getURL() const { return m_sDocumentURL; } inline ::rtl::OUString getDocFileLocation() const { return m_sDocFileLocation; } - ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage> getStorage(const ::rtl::OUString& _sStorageName,sal_Int32 nMode = ::com::sun::star::embed::ElementModes::READWRITE); + ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > + getStorage( + const ObjectType _eType, const sal_Int32 _nDesiredMode = ::com::sun::star::embed::ElementModes::READWRITE ); + // helper const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& getNumberFormatsSupplier(); @@ -422,10 +420,6 @@ public: */ TContentPtr& getObjectContainer( const ObjectType _eType ); - /** determines whether the given storage is the storage of our embedded database (named "database"), if any - */ - bool isDatabaseStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& _rxStorage ) const; - /** returns the name of the storage which is used to stored objects of the given type, if applicable */ static ::rtl::OUString diff --git a/dbaccess/source/core/dataaccess/databasecontext.cxx b/dbaccess/source/core/dataaccess/databasecontext.cxx index cae64615b1de..4cdb81d2eafa 100644 --- a/dbaccess/source/core/dataaccess/databasecontext.cxx +++ b/dbaccess/source/core/dataaccess/databasecontext.cxx @@ -340,12 +340,12 @@ Reference< XInterface > ODatabaseContext::getRegisteredObject(const rtl::OUStri Reference< XInterface > ODatabaseContext::loadObjectFromURL(const ::rtl::OUString& _rName,const ::rtl::OUString& _sURL) { INetURLObject aURL( _sURL ); - if( aURL.GetProtocol() == INET_PROT_NOT_VALID ) - throw NoSuchElementException(_rName, *this); + if ( aURL.GetProtocol() == INET_PROT_NOT_VALID ) + throw NoSuchElementException( _rName, *this ); try { - ::ucbhelper::Content aContent(_sURL,Reference< ::com::sun::star::ucb::XCommandEnvironment >()); + ::ucbhelper::Content aContent( _sURL, NULL ); if ( !aContent.isDocument() ) throw InteractiveIOException( _sURL, *this, InteractionClassification_ERROR, IOErrorCode_NO_FILE @@ -366,30 +366,23 @@ Reference< XInterface > ODatabaseContext::loadObjectFromURL(const ::rtl::OUStrin SQLException aError; aError.Message = sErrorMessage; - throw WrappedTargetException( _sURL, Reference< XNamingService >( this ), makeAny( aError ) ); + throw WrappedTargetException( _sURL, *this, makeAny( aError ) ); } - throw WrappedTargetException( _sURL, Reference< XNamingService >( this ), ::cppu::getCaughtException() ); + throw WrappedTargetException( _sURL, *this, ::cppu::getCaughtException() ); } catch( const Exception& ) { - throw WrappedTargetException( _sURL, Reference<XNamingService>(this), ::cppu::getCaughtException() ); + throw WrappedTargetException( _sURL, *this, ::cppu::getCaughtException() ); } - ::rtl::Reference< ODatabaseModelImpl > pExistent; - ObjectCache::iterator aFind = m_aDatabaseObjects.find(_sURL); - - if ( aFind != m_aDatabaseObjects.end() ) // we found a object registered under the URL - { // register it under the new name - pExistent = aFind->second; - m_aDatabaseObjects.insert( ObjectCache::value_type( _rName, pExistent.get() ) ); - m_aDatabaseObjects.erase( aFind ); - } + OSL_ENSURE( m_aDatabaseObjects.find( _sURL ) == m_aDatabaseObjects.end(), + "ODatabaseContext::loadObjectFromURL: not intended for already-cached objects!" ); - if ( !pExistent.get() ) + ::rtl::Reference< ODatabaseModelImpl > pModelImpl; { - pExistent.set( new ODatabaseModelImpl( _rName, m_aContext.getLegacyServiceFactory(), *this ) ); + pModelImpl.set( new ODatabaseModelImpl( _rName, m_aContext.getLegacyServiceFactory(), *this ) ); - Reference< XModel > xModel( pExistent->createNewModel_deliverOwnership( false ), UNO_SET_THROW ); + Reference< XModel > xModel( pModelImpl->createNewModel_deliverOwnership( false ), UNO_SET_THROW ); Reference< XLoadable > xLoad( xModel, UNO_QUERY_THROW ); ::comphelper::NamedValueCollection aArgs; @@ -402,11 +395,11 @@ Reference< XInterface > ODatabaseContext::loadObjectFromURL(const ::rtl::OUStrin xModel->attachResource( _sURL, aResource ); ::utl::CloseableComponent aEnsureClose( xModel ); - } // if ( !pExistent.get() ) + } - setTransientProperties( _sURL, *pExistent ); + setTransientProperties( _sURL, *pModelImpl ); - return pExistent->getOrCreateDataSource().get(); + return pModelImpl->getOrCreateDataSource().get(); } // ----------------------------------------------------------------------------- void ODatabaseContext::appendAtTerminateListener(const ODatabaseModelImpl& _rDataSourceModel) @@ -524,6 +517,8 @@ void ODatabaseContext::storeTransientProperties( ODatabaseModelImpl& _rModelImpl } else if ( m_aDatabaseObjects.find( _rModelImpl.m_sName ) != m_aDatabaseObjects.end() ) { + OSL_ENSURE( false, "ODatabaseContext::storeTransientProperties: a database document register by name? This shouldn't happen anymore!" ); + // all the code should have been changed so that registration is by URL only m_aDatasourceProperties[ _rModelImpl.m_sName ] = aRememberProps.getPropertyValues(); } else @@ -548,11 +543,21 @@ void SAL_CALL ODatabaseContext::removeContainerListener( const Reference< XConta //------------------------------------------------------------------------------ void ODatabaseContext::revokeObject(const rtl::OUString& _rName) throw( Exception, RuntimeException ) { - MutexGuard aGuard(m_aMutex); + ClearableMutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(DatabaseAccessContext_Base::rBHelper.bDisposed); - Reference< XInterface > xExistent; + ::rtl::OUString sURL; + if ( !getURLForRegisteredObject( _rName, sURL ) ) + throw NoSuchElementException( _rName, *this ); + if ( m_aDatabaseObjects.find( _rName ) != m_aDatabaseObjects.end() ) + { + OSL_ENSURE( false, "ODatabaseContext::revokeObject: a database document register by name? This shouldn't happen anymore!" ); + // all the code should have been changed so that registration is by URL only + m_aDatasourceProperties[ sURL ] = m_aDatasourceProperties[ _rName ]; + } + +<<<<<<< local ::rtl::OUString sURL = getDatabaseLocation( _rName ); revokeDatabaseLocation( _rName ); @@ -567,13 +572,18 @@ void ODatabaseContext::revokeObject(const rtl::OUString& _rName) throw( Exceptio ObjectCacheIterator aExistent = m_aDatabaseObjects.find(sURL); if ( aExistent != m_aDatabaseObjects.end() ) m_aDatabaseObjects.erase(aExistent); +======= + OConfigurationTreeRoot aDbRegisteredNamesRoot = OConfigurationTreeRoot::createWithServiceFactory( + ::comphelper::getProcessServiceFactory(), getDbRegisteredNamesNodeName(), -1, OConfigurationTreeRoot::CM_UPDATABLE ); + if ( !aDbRegisteredNamesRoot.removeNode( _rName ) ) + throw Exception( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "An unexpected und unknown error occured." ) ), *this ); + aDbRegisteredNamesRoot.commit(); +>>>>>>> other // notify our container listeners - ContainerEvent aEvent(static_cast<XContainer*>(this), makeAny(_rName), Any(), makeAny(xExistent)); - // note that xExistent may be empty, in case somebody removed the data source while it is not alive at this moment - OInterfaceIteratorHelper aListenerLoop(m_aContainerListeners); - while (aListenerLoop.hasMoreElements()) - static_cast<XContainerListener*>(aListenerLoop.next())->elementRemoved(aEvent); + ContainerEvent aEvent( *this, makeAny( _rName ), Any(), Any() ); + aGuard.clear(); + m_aContainerListeners.notifyEach( &XContainerListener::elementRemoved, aEvent ); } //------------------------------------------------------------------------------ @@ -666,9 +676,9 @@ Any ODatabaseContext::getByName(const rtl::OUString& _rName) throw( NoSuchElemen try { - Reference< XInterface > xExistent = getObject(_rName); + Reference< XInterface > xExistent = getObject( _rName ); if ( xExistent.is() ) - return makeAny(xExistent); + return makeAny( xExistent ); // see whether this is an registered name ::rtl::OUString sURL; @@ -725,36 +735,53 @@ sal_Bool ODatabaseContext::hasByName(const rtl::OUString& _rName) throw( Runtime } // ----------------------------------------------------------------------------- -Reference< XInterface > ODatabaseContext::getObject(const ::rtl::OUString& _rName) +Reference< XInterface > ODatabaseContext::getObject( const ::rtl::OUString& _rURL ) { - ObjectCacheIterator aFind = m_aDatabaseObjects.find(_rName); + ObjectCacheIterator aFind = m_aDatabaseObjects.find( _rURL ); Reference< XInterface > xExistent; if ( aFind != m_aDatabaseObjects.end() ) xExistent = aFind->second->getOrCreateDataSource(); return xExistent; } // ----------------------------------------------------------------------------- -void ODatabaseContext::registerPrivate(const ::rtl::OUString& _sName - ,const ::rtl::Reference<ODatabaseModelImpl>& _pModelImpl) +void ODatabaseContext::registerDatabaseDocument( ODatabaseModelImpl& _rModelImpl ) { - // OSL_ENSURE(m_aDatabaseObjects.find(_sName) == m_aDatabaseObjects.end(),"Name already exists!"); - if ( m_aDatabaseObjects.find(_sName) == m_aDatabaseObjects.end() ) + ::rtl::OUString sURL( _rModelImpl.getURL() ); +#if OSL_DEBUG_LEVEL > 1 + OSL_TRACE( "DatabaseContext: registering %s", ::rtl::OUStringToOString( sURL, RTL_TEXTENCODING_UTF8 ).getStr() ); +#endif + if ( m_aDatabaseObjects.find( sURL ) == m_aDatabaseObjects.end() ) { - m_aDatabaseObjects.insert(ObjectCache::value_type(_sName,_pModelImpl.get())); - setTransientProperties( _sName, *_pModelImpl ); + m_aDatabaseObjects[ sURL ] = &_rModelImpl; + setTransientProperties( sURL, _rModelImpl ); } + else + OSL_ENSURE( false, "ODatabaseContext::registerDatabaseDocument: already have an object registered for this URL!" ); } // ----------------------------------------------------------------------------- -void ODatabaseContext::deregisterPrivate(const ::rtl::OUString& _sName) +void ODatabaseContext::revokeDatabaseDocument( const ODatabaseModelImpl& _rModelImpl ) { - m_aDatabaseObjects.erase(_sName); + ::rtl::OUString sURL( _rModelImpl.getURL() ); +#if OSL_DEBUG_LEVEL > 1 + OSL_TRACE( "DatabaseContext: deregistering %s", ::rtl::OUStringToOString( sURL, RTL_TEXTENCODING_UTF8 ).getStr() ); +#endif + m_aDatabaseObjects.erase( sURL ); } // ----------------------------------------------------------------------------- -void ODatabaseContext::nameChangePrivate(const ::rtl::OUString& _sOldName, const ::rtl::OUString& _sNewName) -{ - ObjectCache::iterator aFind = m_aDatabaseObjects.find(_sOldName); - registerPrivate(_sNewName,aFind->second); - m_aDatabaseObjects.erase(aFind); +void ODatabaseContext::databaseDocumentURLChange( const ::rtl::OUString& _rOldURL, const ::rtl::OUString& _rNewURL ) +{ +#if OSL_DEBUG_LEVEL > 1 + OSL_TRACE( "DatabaseContext: changing registration from %s to %s", + ::rtl::OUStringToOString( _rOldURL, RTL_TEXTENCODING_UTF8 ).getStr(), + ::rtl::OUStringToOString( _rNewURL, RTL_TEXTENCODING_UTF8 ).getStr() ); +#endif + ObjectCache::iterator oldPos = m_aDatabaseObjects.find( _rOldURL ); + ENSURE_OR_THROW( oldPos != m_aDatabaseObjects.end(), "illegal old database document URL" ); + ObjectCache::iterator newPos = m_aDatabaseObjects.find( _rNewURL ); + ENSURE_OR_THROW( newPos == m_aDatabaseObjects.end(), "illegal new database document URL" ); + + m_aDatabaseObjects[ _rNewURL ] = oldPos->second; + m_aDatabaseObjects.erase( oldPos ); } // ----------------------------------------------------------------------------- sal_Int64 SAL_CALL ODatabaseContext::getSomething( const Sequence< sal_Int8 >& rId ) throw(RuntimeException) diff --git a/dbaccess/source/core/dataaccess/databasecontext.hxx b/dbaccess/source/core/dataaccess/databasecontext.hxx index 2eaf663e9796..5d05c2091fd1 100644 --- a/dbaccess/source/core/dataaccess/databasecontext.hxx +++ b/dbaccess/source/core/dataaccess/databasecontext.hxx @@ -97,7 +97,7 @@ private: */ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > loadObjectFromURL(const ::rtl::OUString& _rName,const ::rtl::OUString& _sURL); - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getObject(const ::rtl::OUString& _rName); + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getObject( const ::rtl::OUString& _rURL ); /** sets all properties which were transient at the data source. e.g. password @param _sURL The file URL of the data source @@ -192,10 +192,9 @@ public: virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); - void registerPrivate(const ::rtl::OUString& _sName - ,const ::rtl::Reference<ODatabaseModelImpl>& _pModelImpl); - void deregisterPrivate(const ::rtl::OUString& _sName); - void nameChangePrivate(const ::rtl::OUString& _sOldName, const ::rtl::OUString& _sNewName); + void registerDatabaseDocument( ODatabaseModelImpl& _rModelImpl); + void revokeDatabaseDocument( const ODatabaseModelImpl& _rModelImpl); + void databaseDocumentURLChange(const ::rtl::OUString& _sOldName, const ::rtl::OUString& _sNewName); void storeTransientProperties( ODatabaseModelImpl& _rModelImpl); void appendAtTerminateListener(const ODatabaseModelImpl& _rDataSourceModel); void removeFromTerminateListener(const ODatabaseModelImpl& _rDataSourceModel); diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index 6708dbfa56bb..5b6593261e1a 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -40,18 +40,10 @@ #include "documenteventexecutor.hxx" #include "databasecontext.hxx" #include "documentcontainer.hxx" - -#include <comphelper/documentconstants.hxx> -#include <comphelper/namedvaluecollection.hxx> -#include <comphelper/enumhelper.hxx> -#include <comphelper/numberedcollection.hxx> -#include <comphelper/genericpropertyset.hxx> -#include <comphelper/property.hxx> -#include <svtools/saveopt.hxx> - -#include <framework/titlehelper.hxx> +#include "sdbcoretools.hxx" /** === begin UNO includes === **/ +#include <com/sun/star/beans/Optional.hpp> #include <com/sun/star/document/XExporter.hpp> #include <com/sun/star/document/XFilter.hpp> #include <com/sun/star/document/XImporter.hpp> @@ -74,14 +66,17 @@ /** === end UNO includes === **/ #include <comphelper/documentconstants.hxx> -#include <comphelper/interaction.hxx> #include <comphelper/enumhelper.hxx> +#include <comphelper/genericpropertyset.hxx> +#include <comphelper/interaction.hxx> #include <comphelper/mediadescriptor.hxx> #include <comphelper/namedvaluecollection.hxx> #include <comphelper/numberedcollection.hxx> +#include <comphelper/property.hxx> #include <comphelper/storagehelper.hxx> #include <cppuhelper/exc_hlp.hxx> #include <framework/titlehelper.hxx> +#include <svtools/saveopt.hxx> #include <tools/debug.hxx> #include <tools/diagnose_ex.h> #include <tools/errcode.hxx> @@ -178,6 +173,7 @@ ODatabaseDocument::ODatabaseDocument(const ::rtl::Reference<ODatabaseModelImpl>& ,m_bAllowDocumentScripting( false ) { DBG_CTOR(ODatabaseDocument,NULL); + OSL_TRACE( "DD: ctor: %p: %p", this, m_pImpl.get() ); osl_incrementInterlockedCount( &m_refCount ); { @@ -204,6 +200,7 @@ ODatabaseDocument::ODatabaseDocument(const ::rtl::Reference<ODatabaseModelImpl>& { // if the previous incarnation of the DatabaseDocument already had an URL, then creating this incarnation // here is effectively loading the document. + // #i105505# / 2009-10-01 / frank.schoenheit@sun.com m_aViewMonitor.onLoadedDocument(); } } @@ -212,6 +209,7 @@ ODatabaseDocument::ODatabaseDocument(const ::rtl::Reference<ODatabaseModelImpl>& //-------------------------------------------------------------------------- ODatabaseDocument::~ODatabaseDocument() { + OSL_TRACE( "DD: dtor: %p: %p", this, m_pImpl.get() ); DBG_DTOR(ODatabaseDocument,NULL); if ( !ODatabaseDocument_OfficeDocument::rBHelper.bInDispose && !ODatabaseDocument_OfficeDocument::rBHelper.bDisposed ) { @@ -818,13 +816,11 @@ void ODatabaseDocument::impl_storeAs_throw( const ::rtl::OUString& _rURL, const throw; } - Exception aExcept; - aError >>= aExcept; - - ::rtl::OUString sErrorMessage = ResourceManager::loadString( + ::rtl::OUString sErrorMessage = extractExceptionMessage( m_pImpl->m_aContext, aError ); + sErrorMessage = ResourceManager::loadString( RID_STR_ERROR_WHILE_SAVING, - "$except$", aError.getValueTypeName(), - "$message$", aExcept.Message + "$location$", _rURL, + "$message$", sErrorMessage ); throw IOException( sErrorMessage, *this ); } @@ -990,10 +986,11 @@ void SAL_CALL ODatabaseDocument::storeToURL( const ::rtl::OUString& _rURL, const Exception aExcept; aError >>= aExcept; - ::rtl::OUString sErrorMessage = ResourceManager::loadString( + ::rtl::OUString sErrorMessage = extractExceptionMessage( m_pImpl->m_aContext, aError ); + sErrorMessage = ResourceManager::loadString( RID_STR_ERROR_WHILE_SAVING, - "$except$", aError.getValueTypeName(), - "$message$", aExcept.Message + "$location$", _rURL, + "$message$", sErrorMessage ); throw IOException( sErrorMessage, *this ); } @@ -1473,6 +1470,7 @@ void ODatabaseDocument::impl_notifyStorageChange_nolck_nothrow( const Reference< //------------------------------------------------------------------------------ void ODatabaseDocument::disposing() { + OSL_TRACE( "DD: disp: %p: %p", this, m_pImpl.get() ); if ( !m_pImpl.is() ) { // this means that we're already disposed diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx index f7fc11a5d80a..4fe5101863db 100644 --- a/dbaccess/source/core/dataaccess/datasource.cxx +++ b/dbaccess/source/core/dataaccess/datasource.cxx @@ -200,8 +200,6 @@ void SAL_CALL FlushNotificationAdapter::flushed( const EventObject& rEvent ) thr //-------------------------------------------------------------------- void SAL_CALL FlushNotificationAdapter::disposing( const EventObject& Source ) throw (RuntimeException) { - DBG_ASSERT( Source.Source == m_aBroadcaster.get(), "FlushNotificationAdapter::disposing: where did this come from?" ); - Reference< XFlushListener > xListener( m_aListener ); if ( xListener.is() ) xListener->disposing( Source ); @@ -562,21 +560,22 @@ extern "C" void SAL_CALL createRegistryInfo_ODatabaseSource() //-------------------------------------------------------------------------- ODatabaseSource::ODatabaseSource(const ::rtl::Reference<ODatabaseModelImpl>& _pImpl) :ModelDependentComponent( _pImpl ) - ,OSubComponent( getMutex(), Reference< XInterface >() ) - ,OPropertySetHelper(OComponentHelper::rBHelper) + ,ODatabaseSource_Base( getMutex() ) + ,OPropertySetHelper( ODatabaseSource_Base::rBHelper ) ,m_aBookmarks( *this, getMutex() ) ,m_aFlushListeners( getMutex() ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::ODatabaseSource" ); // some kind of default DBG_CTOR(ODatabaseSource,NULL); + OSL_TRACE( "DS: ctor: %p: %p", this, m_pImpl.get() ); } //-------------------------------------------------------------------------- ODatabaseSource::~ODatabaseSource() { + OSL_TRACE( "DS: dtor: %p: %p", this, m_pImpl.get() ); DBG_DTOR(ODatabaseSource,NULL); - if ( !OComponentHelper::rBHelper.bInDispose && !OComponentHelper::rBHelper.bDisposed ) + if ( !ODatabaseSource_Base::rBHelper.bInDispose && !ODatabaseSource_Base::rBHelper.bDisposed ) { acquire(); dispose(); @@ -604,11 +603,8 @@ Sequence< Type > ODatabaseSource::getTypes() throw (RuntimeException) ::getCppuType( (const Reference< XMultiPropertySet > *)0 )); return ::comphelper::concatSequences( - ::comphelper::concatSequences( - OSubComponent::getTypes(), - aPropertyHelperTypes.getTypes() - ), - ODatabaseSource_Base::getTypes() + ODatabaseSource_Base::getTypes(), + aPropertyHelperTypes.getTypes() ); } @@ -634,39 +630,26 @@ Sequence< sal_Int8 > ODatabaseSource::getImplementationId() throw (RuntimeExcept Any ODatabaseSource::queryInterface( const Type & rType ) throw (RuntimeException) { //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::queryInterface" ); - Any aIface = OSubComponent::queryInterface( rType ); - if (!aIface.hasValue()) - { - aIface = ODatabaseSource_Base::queryInterface( rType ); - if ( !aIface.hasValue() ) - { - aIface = ::cppu::queryInterface( - rType, - static_cast< XPropertySet* >( this ), - static_cast< XFastPropertySet* >( this ), - static_cast< XMultiPropertySet* >( this )); - } - } + Any aIface = ODatabaseSource_Base::queryInterface( rType ); + if ( !aIface.hasValue() ) + aIface = ::cppu::OPropertySetHelper::queryInterface( rType ); return aIface; } //-------------------------------------------------------------------------- void ODatabaseSource::acquire() throw () { - //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::acquire" ); - OSubComponent::acquire(); + ODatabaseSource_Base::acquire(); } //-------------------------------------------------------------------------- void ODatabaseSource::release() throw () { - //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::release" ); - OSubComponent::release(); + ODatabaseSource_Base::release(); } // ----------------------------------------------------------------------------- void SAL_CALL ODatabaseSource::disposing( const ::com::sun::star::lang::EventObject& Source ) throw(RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::disposing" ); if ( m_pImpl.is() ) m_pImpl->disposing(Source); } @@ -720,8 +703,8 @@ sal_Bool ODatabaseSource::supportsService( const ::rtl::OUString& _rServiceName //------------------------------------------------------------------------------ void ODatabaseSource::disposing() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::disposing" ); - OSubComponent::disposing(); + OSL_TRACE( "DS: disp: %p, %p", this, m_pImpl.get() ); + ODatabaseSource_Base::WeakComponentImplHelperBase::disposing(); OPropertySetHelper::disposing(); EventObject aDisposeEvent(static_cast<XWeak*>(this)); diff --git a/dbaccess/source/core/dataaccess/datasource.hxx b/dbaccess/source/core/dataaccess/datasource.hxx index 4fa86beccfef..5e4dd7dc8ab5 100644 --- a/dbaccess/source/core/dataaccess/datasource.hxx +++ b/dbaccess/source/core/dataaccess/datasource.hxx @@ -70,11 +70,8 @@ #ifndef _CPPUHELPER_WEAKREF_HXX_ #include <cppuhelper/weakref.hxx> #endif -#ifndef _CPPUHELPER_IMPLBASE11_HXX_ -#include <cppuhelper/implbase11.hxx> -#endif -#ifndef _CPPUHELPER_IMPLBASE12_HXX_ -#include <cppuhelper/implbase12.hxx> +#ifndef _CPPUHELPER_COMPBASE11_HXX_ +#include <cppuhelper/compbase11.hxx> #endif #ifndef _COM_SUN_STAR_EMBED_XTRANSACTIONLISTENER_HPP_ #include <com/sun/star/embed/XTransactionListener.hpp> @@ -142,32 +139,31 @@ class OChildCommitListen_Impl; //============================================================ //= ODatabaseSource //============================================================ -typedef ::cppu::ImplHelper11 < ::com::sun::star::lang::XServiceInfo - , ::com::sun::star::sdbc::XDataSource - , ::com::sun::star::sdb::XBookmarksSupplier - , ::com::sun::star::sdb::XQueryDefinitionsSupplier - , ::com::sun::star::sdb::XCompletedConnection - , ::com::sun::star::container::XContainerListener - , ::com::sun::star::sdbc::XIsolatedConnection - , ::com::sun::star::sdbcx::XTablesSupplier - , ::com::sun::star::util::XFlushable - , ::com::sun::star::util::XFlushListener - , ::com::sun::star::sdb::XDocumentDataSource - > ODatabaseSource_Base; +typedef ::cppu::WeakComponentImplHelper11 < ::com::sun::star::lang::XServiceInfo + , ::com::sun::star::sdbc::XDataSource + , ::com::sun::star::sdb::XBookmarksSupplier + , ::com::sun::star::sdb::XQueryDefinitionsSupplier + , ::com::sun::star::sdb::XCompletedConnection + , ::com::sun::star::container::XContainerListener + , ::com::sun::star::sdbc::XIsolatedConnection + , ::com::sun::star::sdbcx::XTablesSupplier + , ::com::sun::star::util::XFlushable + , ::com::sun::star::util::XFlushListener + , ::com::sun::star::sdb::XDocumentDataSource + > ODatabaseSource_Base; class ODatabaseSource :public ModelDependentComponent // must be first - ,public OSubComponent + ,public ODatabaseSource_Base ,public ::cppu::OPropertySetHelper ,public ::comphelper::OPropertyArrayUsageHelper < ODatabaseSource > - ,public ODatabaseSource_Base { friend class ODatabaseContext; friend class OConnection; friend class OSharedConnectionManager; private: - + using ODatabaseSource_Base::rBHelper; OBookmarkContainer m_aBookmarks; ::cppu::OInterfaceContainerHelper m_aFlushListeners; diff --git a/dbaccess/source/core/dataaccess/documentcontainer.cxx b/dbaccess/source/core/dataaccess/documentcontainer.cxx index 3229aa80a45e..c8fe0c49ec4a 100644 --- a/dbaccess/source/core/dataaccess/documentcontainer.cxx +++ b/dbaccess/source/core/dataaccess/documentcontainer.cxx @@ -723,7 +723,7 @@ void SAL_CALL ODocumentContainer::revert( ) throw (::com::sun::star::io::IOExce Reference< XStorage> ODocumentContainer::getContainerStorage() const { return m_pImpl->m_pDataSource - ? m_pImpl->m_pDataSource->getStorage( ODatabaseModelImpl::getObjectContainerStorageName( m_bFormsContainer ? ODatabaseModelImpl::E_FORM : ODatabaseModelImpl::E_REPORT ) ) + ? m_pImpl->m_pDataSource->getStorage( m_bFormsContainer ? ODatabaseModelImpl::E_FORM : ODatabaseModelImpl::E_REPORT ) : Reference< XStorage>(); } diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index 563344f19789..20d1ce157b45 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -2051,7 +2051,7 @@ void SAL_CALL ODocumentDefinition::rename( const ::rtl::OUString& _rNewName ) th Reference< XStorage> ODocumentDefinition::getContainerStorage() const { return m_pImpl->m_pDataSource - ? m_pImpl->m_pDataSource->getStorage( ODatabaseModelImpl::getObjectContainerStorageName( m_bForm ? ODatabaseModelImpl::E_FORM : ODatabaseModelImpl::E_REPORT ) ) + ? m_pImpl->m_pDataSource->getStorage( m_bForm ? ODatabaseModelImpl::E_FORM : ODatabaseModelImpl::E_REPORT ) : Reference< XStorage>(); } // ----------------------------------------------------------------------------- diff --git a/dbaccess/source/core/inc/core_resource.hrc b/dbaccess/source/core/inc/core_resource.hrc index 309a17124c42..cdcdfbd87107 100644 --- a/dbaccess/source/core/inc/core_resource.hrc +++ b/dbaccess/source/core/inc/core_resource.hrc @@ -37,7 +37,6 @@ //------------------------------------------------------------------------------ #define RID_CORE_STRINGS_START RID_DBACCESS_START -#define RID_CORE_OTHER_START RID_DBACCESS_START //------------------------------------------------------------------------------ //- String-IDs @@ -89,6 +88,7 @@ #define RID_STR_NAME_NOT_FOUND ( RID_CORE_STRINGS_START + 45 ) #define RID_STR_QUERY_DOES_NOT_EXIST ( RID_CORE_STRINGS_START + 46 ) #define RID_STR_ERROR_WHILE_SAVING ( RID_CORE_STRINGS_START + 47 ) +<<<<<<< local #define RID_STR_NO_SUB_FOLDER ( RID_CORE_STRINGS_START + 48 ) #define RID_STR_NO_DELETE_BEFORE_AFTER ( RID_CORE_STRINGS_START + 49 ) @@ -111,6 +111,9 @@ #define RID_STR_CONNECTION_REQUEST ( RID_CORE_STRINGS_START + 65 ) #define RID_STR_MISSING_EXTENSION ( RID_CORE_STRINGS_START + 66 ) +======= +#define RID_NO_SUCH_DATA_SOURCE ( RID_CORE_STRINGS_START + 48 ) +>>>>>>> other #endif // _DBA_CORE_RESOURCE_HRC_ diff --git a/dbaccess/source/core/inc/core_resource.hxx b/dbaccess/source/core/inc/core_resource.hxx index 8778bf0204b7..f54df29a6517 100644 --- a/dbaccess/source/core/inc/core_resource.hxx +++ b/dbaccess/source/core/inc/core_resource.hxx @@ -110,8 +110,6 @@ namespace dbaccess const sal_Char* _pPlaceholderAscii2, const ::rtl::OUString& _rReplace2 ); - - static ResMgr* getResManager(); }; //========================================================================= diff --git a/dbaccess/source/core/inc/sdbcoretools.hxx b/dbaccess/source/core/inc/sdbcoretools.hxx index a7e2b9986f7e..92a163b3d24e 100644 --- a/dbaccess/source/core/inc/sdbcoretools.hxx +++ b/dbaccess/source/core/inc/sdbcoretools.hxx @@ -31,12 +31,13 @@ #ifndef DBACORE_SDBCORETOOLS_HXX #define DBACORE_SDBCORETOOLS_HXX -#ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATSSUPPLIER_HPP_ #include <com/sun/star/util/XNumberFormatsSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_ #include <com/sun/star/sdbc/XConnection.hpp> -#endif + +namespace comphelper +{ + class ComponentContext; +} //......................................................................... namespace dbaccess @@ -71,6 +72,11 @@ namespace dbaccess ::com::sun::star::uno::Any& /* [out] */ _rSettingsValue ); + // ----------------------------------------------------------------------------- + /** retrieves a to-be-displayed string for a given caught exception; + */ + ::rtl::OUString extractExceptionMessage( const ::comphelper::ComponentContext& _rContext, const ::com::sun::star::uno::Any& _rError ); + //......................................................................... } // namespace dbaccess //......................................................................... diff --git a/dbaccess/source/core/misc/apitools.cxx b/dbaccess/source/core/misc/apitools.cxx index 33dd640770e3..f956f26b9071 100644 --- a/dbaccess/source/core/misc/apitools.cxx +++ b/dbaccess/source/core/misc/apitools.cxx @@ -101,11 +101,14 @@ void OSubComponent::release() throw ( ) Reference< XInterface > x( xDelegator ); if (! x.is()) { - if (osl_decrementInterlockedCount( &m_refCount ) == 0 && m_refCount == 0 ) + if (osl_decrementInterlockedCount( &m_refCount ) == 0 ) { - OSL_ENSURE( m_refCount == 0, "OSubComponent::release: why the hell is this false!" ); if (! rBHelper.bDisposed) { + // *before* again incrementing our ref count, ensure that our weak connection point + // will not create references to us anymore (via XAdapter::queryAdapted) + disposeWeakConnectionPoint(); + Reference< XInterface > xHoldAlive( *this ); // remember the parent Reference< XInterface > xParent; @@ -115,13 +118,13 @@ void OSubComponent::release() throw ( ) m_xParent = NULL; } - OSL_ENSURE( m_refCount == 1, "OSubComponent::release: invalid ref count!" ); + OSL_ENSURE( m_refCount == 1, "OSubComponent::release: invalid ref count (before dispose)!" ); // First dispose dispose(); // only the alive ref holds the object - OSL_ENSURE( m_refCount == 1, "OSubComponent::release: invalid ref count!" ); + OSL_ENSURE( m_refCount == 1, "OSubComponent::release: invalid ref count (after dispose)!" ); // release the parent in the ~ if (xParent.is()) diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx index 242d5e27e54b..9793da690a2e 100644 --- a/dbaccess/source/core/misc/dsntypes.cxx +++ b/dbaccess/source/core/misc/dsntypes.cxx @@ -299,12 +299,6 @@ Sequence<PropertyValue> ODsnTypeCollection::getDefaultDBSettings( const ::rtl::O return aProperties.getPropertyValues(); } -// ----------------------------------------------------------------------------- -String ODsnTypeCollection::getTypeExtension(const ::rtl::OUString& _sURL) const -{ - const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL); - return aFeatures.getOrDefault("Extension",::rtl::OUString()); -} //------------------------------------------------------------------------- bool ODsnTypeCollection::isEmbeddedDatabase( const ::rtl::OUString& _sURL ) const { diff --git a/dbaccess/source/core/misc/sdbcoretools.cxx b/dbaccess/source/core/misc/sdbcoretools.cxx index 75a1cd6b36eb..48e08b7ff7e4 100644 --- a/dbaccess/source/core/misc/sdbcoretools.cxx +++ b/dbaccess/source/core/misc/sdbcoretools.cxx @@ -31,30 +31,24 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef DBACORE_SDBCORETOOLS_HXX #include "sdbcoretools.hxx" -#endif -#ifndef _TOOLS_DEBUG_HXX -#include <tools/debug.hxx> -#endif -#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ +#include "dbastrings.hrc" + +/** === begin UNO includes === **/ #include <com/sun/star/beans/XPropertySet.hpp> -#endif -#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_ #include <com/sun/star/beans/PropertyValue.hpp> -#endif -#ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_ #include <com/sun/star/container/XChild.hpp> -#endif -#ifndef _COM_SUN_STAR_UTIL_XMODIFIABLE_HPP_ #include <com/sun/star/util/XModifiable.hpp> -#endif -#ifndef _COM_SUN_STAR_SDB_XDOCUMENTDATASOURCE_HPP_ #include <com/sun/star/sdb/XDocumentDataSource.hpp> -#endif -#ifndef DBACCESS_SHARED_DBASTRINGS_HRC -#include "dbastrings.hrc" -#endif +#include <com/sun/star/task/XInteractionRequestStringResolver.hpp> +/** === end UNO includes === **/ + +#include <tools/diagnose_ex.h> +#include <tools/debug.hxx> +#include <comphelper/componentcontext.hxx> +#include <comphelper/interaction.hxx> +#include <rtl/ref.hxx> +#include <rtl/ustrbuf.hxx> //......................................................................... namespace dbaccess @@ -67,6 +61,7 @@ namespace dbaccess using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::sdb; using namespace ::com::sun::star::beans; + using namespace ::com::sun::star::task; using namespace ::com::sun::star::container; // ========================================================================= @@ -130,6 +125,45 @@ namespace dbaccess } // ----------------------------------------------------------------------------- + ::rtl::OUString extractExceptionMessage( const ::comphelper::ComponentContext& _rContext, const Any& _rError ) + { + ::rtl::OUString sDisplayMessage; + + try + { + Reference< XInteractionRequestStringResolver > xStringResolver; + if ( _rContext.createComponent( "com.sun.star.task.InteractionRequestStringResolver", xStringResolver ) ) + { + ::rtl::Reference< ::comphelper::OInteractionRequest > pRequest( new ::comphelper::OInteractionRequest( _rError ) ); + ::rtl::Reference< ::comphelper::OInteractionApprove > pApprove( new ::comphelper::OInteractionApprove ); + pRequest->addContinuation( pApprove.get() ); + Optional< ::rtl::OUString > aMessage = xStringResolver->getStringFromInformationalRequest( pRequest.get() ); + if ( aMessage.IsPresent ) + sDisplayMessage = aMessage.Value; + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + if ( !sDisplayMessage.getLength() ) + { + Exception aExcept; + _rError >>= aExcept; + + ::rtl::OUStringBuffer aBuffer; + aBuffer.append( _rError.getValueTypeName() ); + aBuffer.appendAscii( ":\n" ); + aBuffer.append( aExcept.Message ); + + sDisplayMessage = aBuffer.makeStringAndClear(); + } + + return sDisplayMessage; + } + +// ----------------------------------------------------------------------------- //......................................................................... } // namespace dbaccess //......................................................................... diff --git a/dbaccess/source/core/resource/core_resource.cxx b/dbaccess/source/core/resource/core_resource.cxx index dea6ea6b9d9d..ba605eb8ddfe 100644 --- a/dbaccess/source/core/resource/core_resource.cxx +++ b/dbaccess/source/core/resource/core_resource.cxx @@ -116,12 +116,6 @@ namespace dbaccess m_pImpl = NULL; } } - ResMgr* ResourceManager::getResManager() - { - ensureImplExists(); - return m_pImpl; - } - //......................................................................... } //......................................................................... diff --git a/dbaccess/source/core/resource/strings.src b/dbaccess/source/core/resource/strings.src index 5b3c64e5316b..33243e199330 100644 --- a/dbaccess/source/core/resource/strings.src +++ b/dbaccess/source/core/resource/strings.src @@ -243,7 +243,12 @@ String RID_STR_NAME_NOT_FOUND String RID_STR_ERROR_WHILE_SAVING { - Text [ en-US ] = "Could not save the document:\n\n$except$:\n$message$"; + Text [ en-US ] = "Could not save the document to $location$:\n$message$"; +}; + +String RID_NO_SUCH_DATA_SOURCE +{ + Text [ en-US ] = "Error accessing data source '$name$':\n$error$"; }; String RID_STR_NO_SUB_FOLDER { diff --git a/dbaccess/source/ext/macromigration/docinteraction.cxx b/dbaccess/source/ext/macromigration/docinteraction.cxx index 9f7ded185553..77fba3e97a04 100644 --- a/dbaccess/source/ext/macromigration/docinteraction.cxx +++ b/dbaccess/source/ext/macromigration/docinteraction.cxx @@ -89,18 +89,6 @@ namespace dbmm //= InteractionHandler //==================================================================== //-------------------------------------------------------------------- - InteractionHandler::InteractionHandler( const ::comphelper::ComponentContext& _rContext ) - :m_pData( new InteractionHandler_Data( _rContext ) ) - { - } - - //-------------------------------------------------------------------- - InteractionHandler::InteractionHandler( const Reference< XInteractionHandler >& _rxHandler ) - :m_pData( new InteractionHandler_Data( _rxHandler ) ) - { - } - - //-------------------------------------------------------------------- InteractionHandler::InteractionHandler( const ::comphelper::ComponentContext& _rContext, const Reference< XModel >& _rxDocument ) :m_pData( new InteractionHandler_Data( _rContext ) ) { diff --git a/dbaccess/source/ext/macromigration/docinteraction.hxx b/dbaccess/source/ext/macromigration/docinteraction.hxx index f24bfea7842f..9e9dd73b4651 100644 --- a/dbaccess/source/ext/macromigration/docinteraction.hxx +++ b/dbaccess/source/ext/macromigration/docinteraction.hxx @@ -57,15 +57,6 @@ namespace dbmm { public: /** creates an interaction handler by instantiating a css.task.InteractionHandler - component at the given component context. - */ - InteractionHandler( const ::comphelper::ComponentContext& _rContext ); - - /** creates an InteractionHandler instance, using the given existing UNO handler. - */ - InteractionHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxHandler ); - - /** creates an interaction handler by instantiating a css.task.InteractionHandler component at the given component context, or using the given document's interaction handler, if one is specified in the document's media descriptor. */ diff --git a/dbaccess/source/ext/macromigration/progressmixer.cxx b/dbaccess/source/ext/macromigration/progressmixer.cxx index a59e1a59b7fe..b738376fb051 100644 --- a/dbaccess/source/ext/macromigration/progressmixer.cxx +++ b/dbaccess/source/ext/macromigration/progressmixer.cxx @@ -108,12 +108,13 @@ namespace dbmm //-------------------------------------------------------------------- namespace { +#if OSL_DEBUG_LEVEL > 0 //---------------------------------------------------------------- bool lcl_isRunning( const ProgressMixer_Data& _rData ) { return _rData.pCurrentPhase != _rData.aPhases.end(); } - +#endif //---------------------------------------------------------------- void lcl_ensureInitialized( ProgressMixer_Data& _rData ) { diff --git a/dbaccess/source/inc/dsntypes.hxx b/dbaccess/source/inc/dsntypes.hxx index 79d5156affd3..4e9153a6a216 100644 --- a/dbaccess/source/inc/dsntypes.hxx +++ b/dbaccess/source/inc/dsntypes.hxx @@ -139,9 +139,6 @@ public: /// get the datasource type display name from a DSN string String getTypeDisplayName(const ::rtl::OUString& _sURL) const; - /// returns the extension of the user defined type - String getTypeExtension(const ::rtl::OUString& _sURL) const; - /// on a given string, cut the type prefix and return the result String cutPrefix(const ::rtl::OUString& _sURL) const; diff --git a/dbaccess/source/ui/app/AppController.hxx b/dbaccess/source/ui/app/AppController.hxx index 96ca58d6f428..a8c5d5a97054 100644 --- a/dbaccess/source/ui/app/AppController.hxx +++ b/dbaccess/source/ui/app/AppController.hxx @@ -295,15 +295,6 @@ namespace dbaui /// returns <TRUE/> if the clipboard supports a table format, otherwise <FALSE/>. sal_Bool isTableFormat() const; - /** copies a table which was constructed by tags like HTML or RTF - @param _rDesc - The Drop descriptor - @param _bCheck - If set to <TRUE/> than the controller checks only if a copy is possible. - */ - sal_Bool copyTagTable( OTableCopyHelper::DropDescriptor& _rDesc - , sal_Bool _bCheck); - /** fills the vector with all supported formats @param _eType The type for which we need the formats diff --git a/dbaccess/source/ui/app/AppControllerDnD.cxx b/dbaccess/source/ui/app/AppControllerDnD.cxx index a509986e8849..2d39783cdb87 100644 --- a/dbaccess/source/ui/app/AppControllerDnD.cxx +++ b/dbaccess/source/ui/app/AppControllerDnD.cxx @@ -902,18 +902,6 @@ sal_Bool OApplicationController::isTableFormat() const return m_aTableCopyHelper.isTableFormat(getViewClipboard()); } // ----------------------------------------------------------------------------- -sal_Bool OApplicationController::copyTagTable(OTableCopyHelper::DropDescriptor& _rDesc, sal_Bool _bCheck) -{ - // first get the dest connection - ::osl::MutexGuard aGuard( getMutex() ); - - SharedConnection xConnection( ensureConnection() ); - if ( !xConnection.is() ) - return sal_False; - - return m_aTableCopyHelper.copyTagTable( _rDesc, _bCheck, xConnection ); -} -// ----------------------------------------------------------------------------- IMPL_LINK( OApplicationController, OnAsyncDrop, void*, /*NOTINTERESTEDIN*/ ) { m_nAsyncDrop = 0; diff --git a/dbaccess/source/ui/app/subcomponentmanager.cxx b/dbaccess/source/ui/app/subcomponentmanager.cxx index 8ef4f77f20c7..a24fe29b5974 100644 --- a/dbaccess/source/ui/app/subcomponentmanager.cxx +++ b/dbaccess/source/ui/app/subcomponentmanager.cxx @@ -125,8 +125,9 @@ namespace dbaui xModel.set( _rxComponent, UNO_QUERY ); if ( xModel.is() ) { - xController.set( xModel->getCurrentController(), UNO_SET_THROW ); - xFrame.set( xController->getFrame(), UNO_SET_THROW ); + xController.set( xModel->getCurrentController() ); + if ( xController.is() ) + xFrame.set( xController->getFrame(), UNO_SET_THROW ); } else { @@ -468,13 +469,15 @@ namespace dbaui // put into map SubComponentAccessor aKey( _rName, _nComponentType, _eOpenMode ); SubComponentDescriptor aElement( _rxComponent ); + ENSURE_OR_THROW( aElement.xModel.is() || aElement.xController.is(), "illegal component" ); m_pData->m_aComponents.insert( SubComponentMap::value_type( aKey, aElement ) ) ; // add as listener - aElement.xController->addEventListener( this ); + if ( aElement.xController.is() ) + aElement.xController->addEventListener( this ); if ( aElement.xModel.is() ) aElement.xModel->addEventListener( this ); diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx index f82839664973..8db327fb8b85 100644 --- a/dbaccess/source/ui/browser/brwctrlr.cxx +++ b/dbaccess/source/ui/browser/brwctrlr.cxx @@ -1495,7 +1495,10 @@ void SbaXDataBrowserController::errorOccured(const ::com::sun::star::sdb::SQLErr m_aCurrentError = aInfo; } else + { + m_aCurrentError = aInfo; m_aAsyncDisplayError.Call(); + } } //------------------------------------------------------------------------------ diff --git a/dbaccess/source/ui/browser/dbloader.cxx b/dbaccess/source/ui/browser/dbloader.cxx index 87f924129c16..913dea5c54fe 100644 --- a/dbaccess/source/ui/browser/dbloader.cxx +++ b/dbaccess/source/ui/browser/dbloader.cxx @@ -324,7 +324,16 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const :: } catch(const Exception&) { - DBG_UNHANDLED_EXCEPTION(); + // Does this need to be shown to the user? + bSuccess = false; + try + { + ::comphelper::disposeComponent( xController ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } } } @@ -342,7 +351,7 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const :: } else if ( rListener.is() ) - rListener->loadCancelled( this ); + rListener->loadCancelled( this ); } // ----------------------------------------------------------------------- diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx index a24c2d4e30dc..9d81d9c47c86 100644 --- a/dbaccess/source/ui/browser/genericcontroller.cxx +++ b/dbaccess/source/ui/browser/genericcontroller.cxx @@ -282,6 +282,7 @@ OGenericUnoController::OGenericUnoController(const Reference< XMultiServiceFacto } } +#ifdef WNT // ----------------------------------------------------------------------------- OGenericUnoController::OGenericUnoController() :OGenericUnoController_Base( getMutex() ) @@ -302,6 +303,7 @@ OGenericUnoController::OGenericUnoController() // we simply abort here. abort(); } +#endif // ----------------------------------------------------------------------------- OGenericUnoController::~OGenericUnoController() diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index 9f3403b690c5..b2cfbe04a515 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -3467,7 +3467,7 @@ sal_Bool SbaTableQueryBrowser::isHiContrast() const { sal_Bool bRet = sal_False; if ( m_pTreeView ) - bRet = m_pTreeView->getListBox().GetBackground().GetColor().IsDark(); + bRet = m_pTreeView->getListBox().GetSettings().GetStyleSettings().GetHighContrastMode(); return bRet; } // ----------------------------------------------------------------------------- diff --git a/dbaccess/source/ui/control/dbtreelistbox.cxx b/dbaccess/source/ui/control/dbtreelistbox.cxx index a11d39bdba04..b5bc5f817198 100644 --- a/dbaccess/source/ui/control/dbtreelistbox.cxx +++ b/dbaccess/source/ui/control/dbtreelistbox.cxx @@ -568,7 +568,7 @@ namespace void lcl_insertMenuItemImages( Menu& _rMenu, IController& _rCommandController ) { const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); - const BOOL bHiContrast = rSettings.GetMenuColor().IsDark(); + const BOOL bHiContrast = rSettings.GetHighContrastMode(); uno::Reference< frame::XController > xController = _rCommandController.getXController(); uno::Reference< frame::XFrame> xFrame; if ( xController.is() ) diff --git a/dbaccess/source/ui/control/listviewitems.cxx b/dbaccess/source/ui/control/listviewitems.cxx index dbcdc4dc5138..8fe75d85d57f 100644 --- a/dbaccess/source/ui/control/listviewitems.cxx +++ b/dbaccess/source/ui/control/listviewitems.cxx @@ -45,7 +45,9 @@ namespace dbaui //------------------------------------------------------------------------ void OBoldListboxString::InitViewData( SvLBox* pView,SvLBoxEntry* pEntry, SvViewDataItem* _pViewData) { - SvLBoxString::InitViewData(pView,pEntry, _pViewData); + SvLBoxString::InitViewData( pView, pEntry, _pViewData ); + if ( !m_bEmphasized ) + return; if (!_pViewData) _pViewData = pView->GetViewDataItem( pEntry, this ); pView->Push(PUSH_ALL); diff --git a/dbaccess/source/ui/control/opendoccontrols.cxx b/dbaccess/source/ui/control/opendoccontrols.cxx index 5b089f764337..12c25ef58a87 100644 --- a/dbaccess/source/ui/control/opendoccontrols.cxx +++ b/dbaccess/source/ui/control/opendoccontrols.cxx @@ -210,13 +210,6 @@ namespace dbaui //= OpenButton //==================================================================== //-------------------------------------------------------------------- - OpenDocumentButton::OpenDocumentButton( Window* _pParent, const sal_Char* _pAsciiModuleName, WinBits _nStyle ) - :PushButton( _pParent, _nStyle ) - { - impl_init( _pAsciiModuleName ); - } - - //-------------------------------------------------------------------- OpenDocumentButton::OpenDocumentButton( Window* _pParent, const sal_Char* _pAsciiModuleName, const ResId& _rResId ) :PushButton( _pParent, _rResId ) { @@ -247,13 +240,6 @@ namespace dbaui //= OpenDocumentListBox //==================================================================== //-------------------------------------------------------------------- - OpenDocumentListBox::OpenDocumentListBox( Window* _pParent, const sal_Char* _pAsciiModuleName, WinBits _nStyle ) - :ListBox( _pParent, _nStyle ) - { - impl_init( _pAsciiModuleName ); - } - - //-------------------------------------------------------------------- OpenDocumentListBox::OpenDocumentListBox( Window* _pParent, const sal_Char* _pAsciiModuleName, const ResId& _rResId ) :ListBox( _pParent, _rResId ) { diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx index 2e155dfb4572..759054d4495e 100644 --- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx +++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx @@ -952,14 +952,8 @@ DBG_NAME(OFinalDBPageSetup) aPos.X() = pWindows[i].first->GetPosPixel().X(); Size aSize = pWindows[i].first->GetSizePixel(); FixedText* pText = dynamic_cast<FixedText*>(pWindows[i].first); - CheckBox* pCheck = dynamic_cast<CheckBox*>(pWindows[i].first); - RadioButton* pRadio = dynamic_cast<RadioButton*>(pWindows[i].first); if ( pText ) aSize = pText->CalcMinimumSize(aSize.Width()); - else if ( pRadio ) - aSize = pRadio->CalcMinimumSize(aSize.Width()); - else if ( pCheck ) - aSize = pCheck->CalcMinimumSize(aSize.Width()); pWindows[i].first->SetPosSizePixel(aPos,aSize); aPos.Y() += aSize.Height() + pWindows[i].second; } diff --git a/dbaccess/source/ui/dlg/dbadmin.cxx b/dbaccess/source/ui/dlg/dbadmin.cxx index ccb904994c23..22d055f13a36 100644 --- a/dbaccess/source/ui/dlg/dbadmin.cxx +++ b/dbaccess/source/ui/dlg/dbadmin.cxx @@ -121,16 +121,6 @@ void ODbAdminDialog::PageCreated(USHORT _nId, SfxTabPage& _rPage) SfxTabDialog::PageCreated(_nId, _rPage); } -// ----------------------------------------------------------------------------- -void ODbAdminDialog::removeDetailPages() -{ - // remove all current detail pages - while (m_aCurrentDetailPages.size()) - { - RemoveTabPage((USHORT)m_aCurrentDetailPages.top()); - m_aCurrentDetailPages.pop(); - } -} // ----------------------------------------------------------------------------- void ODbAdminDialog::addDetailPage(USHORT _nPageId, USHORT _nTextId, CreateTabPage _pCreateFunc) diff --git a/dbaccess/source/ui/dlg/dbadminsetup.src b/dbaccess/source/ui/dlg/dbadminsetup.src index 6f6020d966e9..b26f2eee2e3a 100644 --- a/dbaccess/source/ui/dlg/dbadminsetup.src +++ b/dbaccess/source/ui/dlg/dbadminsetup.src @@ -315,7 +315,7 @@ TabPage PAGE_DBWIZARD_FINAL { Pos = MAP_APPFONT (START_X , 100 ) ; Size = MAP_APPFONT ( WIZARD_PAGE_X - START_X - 6 , 8 ) ; - Text[ en-US ] = "~After the database file has been saved, what do you want to do?" ; + Text[ en-US ] = "After the database file has been saved, what do you want to do?" ; }; CheckBox CB_OPENAFTERWARDS diff --git a/dbaccess/source/ui/dlg/directsql.cxx b/dbaccess/source/ui/dlg/directsql.cxx index 4f713e27f277..aa0157174e3d 100644 --- a/dbaccess/source/ui/dlg/directsql.cxx +++ b/dbaccess/source/ui/dlg/directsql.cxx @@ -171,13 +171,6 @@ DBG_NAME(DirectSQLDialog) } //-------------------------------------------------------------------- - void DirectSQLDialog::addHistoryEntry(const String& _rStatement) - { - CHECK_INVARIANTS("DirectSQLDialog::addHistoryEntry"); - implAddToStatementHistory(_rStatement); - } - - //-------------------------------------------------------------------- sal_Int32 DirectSQLDialog::getHistorySize() const { CHECK_INVARIANTS("DirectSQLDialog::getHistorySize"); diff --git a/dbaccess/source/ui/dlg/indexdialog.cxx b/dbaccess/source/ui/dlg/indexdialog.cxx index ea082491e85b..1d9dfba5623e 100644 --- a/dbaccess/source/ui/dlg/indexdialog.cxx +++ b/dbaccess/source/ui/dlg/indexdialog.cxx @@ -342,7 +342,7 @@ DBG_NAME(DbaIndexDialog) //------------------------------------------------------------------ void DbaIndexDialog::fillIndexList() { - sal_Bool bHiContrast = GetBackground().GetColor().IsDark(); + sal_Bool bHiContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); Image aPKeyIcon(ModuleRes( bHiContrast ? IMG_PKEYICON_SCH : IMG_PKEYICON)); // fill the list with the index names m_aIndexes.Clear(); diff --git a/dbaccess/source/ui/inc/databaseobjectview.hxx b/dbaccess/source/ui/inc/databaseobjectview.hxx index ed6e9a37ec55..07c77e388196 100644 --- a/dbaccess/source/ui/inc/databaseobjectview.hxx +++ b/dbaccess/source/ui/inc/databaseobjectview.hxx @@ -280,18 +280,6 @@ namespace dbaui const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxParentFrame ); }; - //====================================================================== - //= ReportDesigner - //====================================================================== - class ReportDesigner : public DatabaseObjectView - { - public: - ReportDesigner( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, - const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI >& _rxApplication, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxParentFrame - ); - }; // ......................................................................... } // namespace dbaui // ......................................................................... diff --git a/dbaccess/source/ui/inc/dbadmin.hxx b/dbaccess/source/ui/inc/dbadmin.hxx index 5c002747a1cc..86e8ef63352c 100644 --- a/dbaccess/source/ui/inc/dbadmin.hxx +++ b/dbaccess/source/ui/inc/dbadmin.hxx @@ -114,8 +114,6 @@ public: protected: // adds a new detail page and remove all the old ones void addDetailPage(USHORT _nPageId,USHORT _nTextId,CreateTabPage pCreateFunc); - // removes all detail pages - void removeDetailPages(); virtual void PageCreated(USHORT _nId, SfxTabPage& _rPage); virtual short Ok(); diff --git a/dbaccess/source/ui/inc/directsql.hxx b/dbaccess/source/ui/inc/directsql.hxx index a6574a26f1f9..89743f92f26e 100644 --- a/dbaccess/source/ui/inc/directsql.hxx +++ b/dbaccess/source/ui/inc/directsql.hxx @@ -108,9 +108,6 @@ namespace dbaui const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConn); ~DirectSQLDialog(); - /// add an history entry - void addHistoryEntry(const String& _rStatement); - /// number of history entries sal_Int32 getHistorySize() const; diff --git a/dbaccess/source/ui/inc/dsmeta.hxx b/dbaccess/source/ui/inc/dsmeta.hxx index 1052ec7c536c..78ba0db1272e 100644 --- a/dbaccess/source/ui/inc/dsmeta.hxx +++ b/dbaccess/source/ui/inc/dsmeta.hxx @@ -78,8 +78,6 @@ namespace dbaui const FeatureSet& getFeatureSet() const; /// determines whether or not the data source requires authentication - AuthenticationMode getAuthentication() const; - static AuthenticationMode getAuthentication( const ::rtl::OUString& _sURL ); private: diff --git a/dbaccess/source/ui/inc/opendoccontrols.hxx b/dbaccess/source/ui/inc/opendoccontrols.hxx index 4333b91db0a9..d363b9a91e48 100644 --- a/dbaccess/source/ui/inc/opendoccontrols.hxx +++ b/dbaccess/source/ui/inc/opendoccontrols.hxx @@ -61,7 +61,6 @@ namespace dbaui ::rtl::OUString m_sModule; public: - OpenDocumentButton( Window* _pParent, const sal_Char* _pAsciiModuleName, WinBits _nStyle = 0 ); OpenDocumentButton( Window* _pParent, const sal_Char* _pAsciiModuleName, const ResId& _rResId ); protected: @@ -81,7 +80,6 @@ namespace dbaui MapIndexToStringPair m_aURLs; public: - OpenDocumentListBox( Window* _pParent, const sal_Char* _pAsciiModuleName, WinBits _nStyle = WB_BORDER ); OpenDocumentListBox( Window* _pParent, const sal_Char* _pAsciiModuleName, const ResId& _rResId ); String GetSelectedDocumentURL() const; diff --git a/dbaccess/source/ui/misc/ToolBoxHelper.cxx b/dbaccess/source/ui/misc/ToolBoxHelper.cxx index bfb5f9cf4dab..8982ae4571da 100644 --- a/dbaccess/source/ui/misc/ToolBoxHelper.cxx +++ b/dbaccess/source/ui/misc/ToolBoxHelper.cxx @@ -79,10 +79,10 @@ namespace dbaui { sal_Int16 nCurSymbolsSize = SvtMiscOptions().GetCurrentSymbolsSize(); if ( nCurSymbolsSize != m_nSymbolsSize || - m_bIsHiContrast != m_pToolBox->GetBackground().GetColor().IsDark() ) + m_bIsHiContrast != m_pToolBox->GetSettings().GetStyleSettings().GetHighContrastMode() ) { m_nSymbolsSize = nCurSymbolsSize; - m_bIsHiContrast = m_pToolBox->GetBackground().GetColor().IsDark(); + m_bIsHiContrast = m_pToolBox->GetSettings().GetStyleSettings().GetHighContrastMode(); m_pToolBox->SetImageList( getImageList(m_nSymbolsSize,m_bIsHiContrast) ); @@ -131,7 +131,7 @@ namespace dbaui m_pToolBox = _pTB; if ( m_pToolBox ) { - // m_bIsHiContrast = m_pToolBox->GetBackground().GetColor().IsDark(); + // m_bIsHiContrast = m_pToolBox->GetSettings().GetStyleSettings().GetHighContrastMode(); ConfigOptionsChanged(NULL); if ( bFirstTime ) adjustToolBoxSize(m_pToolBox); diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx index 8d97d4829173..73976b28ca5b 100644 --- a/dbaccess/source/ui/misc/UITools.cxx +++ b/dbaccess/source/ui/misc/UITools.cxx @@ -1332,7 +1332,7 @@ sal_Bool isHiContrast(Window* _pWindow) else break; } - return pIter && pIter->GetBackground().GetColor().IsDark(); + return pIter && pIter->GetSettings().GetStyleSettings().GetHighContrastMode(); } // ----------------------------------------------------------------------------- diff --git a/dbaccess/source/ui/misc/databaseobjectview.cxx b/dbaccess/source/ui/misc/databaseobjectview.cxx index 26e5b5bafd98..24debbe9bf7d 100644 --- a/dbaccess/source/ui/misc/databaseobjectview.cxx +++ b/dbaccess/source/ui/misc/databaseobjectview.cxx @@ -378,16 +378,6 @@ namespace dbaui :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, static_cast< ::rtl::OUString >( URL_COMPONENT_RELATIONDESIGN ) ) { } - //====================================================================== - //= ReportDesigner - //====================================================================== - //---------------------------------------------------------------------- - ReportDesigner::ReportDesigner( const Reference< XMultiServiceFactory >& _rxORB, const Reference< XDatabaseDocumentUI >& _rxApplication , const Reference< XFrame >& _rxParentFrame) - :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame,static_cast< ::rtl::OUString >( URL_COMPONENT_REPORTDESIGN ) ) - { - } - - // ......................................................................... } // namespace dbaui // ......................................................................... diff --git a/dbaccess/source/ui/misc/documentcontroller.cxx b/dbaccess/source/ui/misc/documentcontroller.cxx index 523307d55013..62400fdf1269 100644 --- a/dbaccess/source/ui/misc/documentcontroller.cxx +++ b/dbaccess/source/ui/misc/documentcontroller.cxx @@ -58,16 +58,6 @@ namespace dbaui } //-------------------------------------------------------------------- - ModelControllerConnector::ModelControllerConnector( const Reference< XModel >& _rxModel, const Reference< XController >& _rxController ) - :m_xModel( _rxModel ) - ,m_xController( _rxController ) - { - DBG_CTOR( ModelControllerConnector, NULL ); - DBG_ASSERT( _rxModel.is() && m_xController.is(), "ModelControllerConnector::ModelControllerConnector: invalid model or controller!" ); - impl_connect(); - } - - //-------------------------------------------------------------------- ModelControllerConnector::ModelControllerConnector( const ModelControllerConnector& _rSource ) { DBG_CTOR( ModelControllerConnector, NULL ); diff --git a/dbaccess/source/ui/misc/dsmeta.cxx b/dbaccess/source/ui/misc/dsmeta.cxx index 6f348742afd4..7d299c7f5910 100644 --- a/dbaccess/source/ui/misc/dsmeta.cxx +++ b/dbaccess/source/ui/misc/dsmeta.cxx @@ -206,12 +206,6 @@ namespace dbaui } //-------------------------------------------------------------------- - AuthenticationMode DataSourceMetaData::getAuthentication() const - { - return getAuthenticationMode( m_pImpl->getType() ); - } - - //-------------------------------------------------------------------- AuthenticationMode DataSourceMetaData::getAuthentication( const ::rtl::OUString& _sURL ) { return getAuthenticationMode( _sURL ); diff --git a/dbaccess/source/ui/misc/linkeddocuments.cxx b/dbaccess/source/ui/misc/linkeddocuments.cxx index 9d32d70e2c31..32b10a35bdb0 100644 --- a/dbaccess/source/ui/misc/linkeddocuments.cxx +++ b/dbaccess/source/ui/misc/linkeddocuments.cxx @@ -279,10 +279,11 @@ namespace dbaui { ::svx::ODataAccessDescriptor aDesc; aDesc.setDataSource(m_sDataSourceName); - if ( _nCommandType != -1 ) + if ( _rObjectName.getLength() && ( _nCommandType != -1 ) ) + { aDesc[::svx::daCommandType] <<= _nCommandType; - if ( _rObjectName.getLength() ) aDesc[::svx::daCommand] <<= _rObjectName; + } if ( m_xConnection.is() ) aDesc[::svx::daConnection] <<= m_xConnection; diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index 966c3e313673..eacf142872d5 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -325,6 +325,7 @@ namespace return eErrorCode; } +<<<<<<< local //------------------------------------------------------------------------------ ::rtl::OUString QuoteField( const OQueryDesignView* _pView,const ::rtl::OUString& rValue, sal_Int32 aType ) { @@ -407,6 +408,8 @@ namespace } return rNewValue; } +======= +>>>>>>> other // ----------------------------------------------------------------------------- /** FillDragInfo fills the field description out of the table @@ -1384,7 +1387,11 @@ namespace GetInnerJoinCriteria(_pView,pNodeTmp); // now simplify again, join are checked in ComparisonPredicate ::connectivity::OSQLParseNode::absorptions(pNodeTmp); +<<<<<<< local pNodeTmp = pNode->getChild(1); +======= + pNodeTmp = pNode->getChild(1); +>>>>>>> other // it could happen that pCondition is not more valid eErrorCode = GetORCriteria(_pView,_pSelectionBrw,pNodeTmp, rLevel); |