summaryrefslogtreecommitdiff
path: root/dbaccess/source
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2009-11-16 12:01:50 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2009-11-16 12:01:50 +0100
commit8890bc19441c80d9313234bc87569d2bb0b9ee72 (patch)
treeab580581b35b90c869e2ecde7b55b4b7730a5382 /dbaccess/source
parent6ae29346a41b1c02cbeb37672291684d5f9b3e5f (diff)
in preparation of #i84012#:
introduced a dedicated interface (css.sdb.XDatabaseRegistrations) for dealing with data source registrations, this way hiding the concrete configuration details.
Diffstat (limited to 'dbaccess/source')
-rw-r--r--dbaccess/source/core/dataaccess/databasecontext.cxx192
-rw-r--r--dbaccess/source/core/dataaccess/databasecontext.hxx105
-rw-r--r--dbaccess/source/core/dataaccess/databaseregistrations.cxx309
-rw-r--r--dbaccess/source/core/dataaccess/databaseregistrations.hxx50
-rw-r--r--dbaccess/source/core/dataaccess/makefile.mk1
-rw-r--r--dbaccess/source/ui/browser/unodatbr.cxx286
-rw-r--r--dbaccess/source/ui/inc/unodatbr.hxx20
7 files changed, 617 insertions, 346 deletions
diff --git a/dbaccess/source/core/dataaccess/databasecontext.cxx b/dbaccess/source/core/dataaccess/databasecontext.cxx
index 22f3aa7c5bd7..cae64615b1de 100644
--- a/dbaccess/source/core/dataaccess/databasecontext.cxx
+++ b/dbaccess/source/core/dataaccess/databasecontext.cxx
@@ -36,6 +36,7 @@
#include "core_resource.hxx"
#include "databasecontext.hxx"
#include "databasedocument.hxx"
+#include "databaseregistrations.hxx"
#include "datasource.hxx"
#include "dbastrings.hrc"
#include "module_dba.hxx"
@@ -70,7 +71,6 @@
#include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <svtools/filenotation.hxx>
-#include <svtools/pathoptions.hxx>
#include <tools/debug.hxx>
#include <tools/diagnose_ex.h>
#include <tools/fsys.hxx>
@@ -114,30 +114,6 @@ namespace dbaccess
{
//........................................................................
- namespace
- {
- //--------------------------------------------------------------------
- const ::rtl::OUString& getDbRegisteredNamesNodeName()
- {
- static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("org.openoffice.Office.DataAccess/RegisteredNames");
- return s_sNodeName;
- }
-
- //--------------------------------------------------------------------
- const ::rtl::OUString& getDbNameNodeName()
- {
- static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("Name");
- return s_sNodeName;
- }
-
- //--------------------------------------------------------------------
- const ::rtl::OUString& getDbLocationNodeName()
- {
- static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("Location");
- return s_sNodeName;
- }
- // -----------------------------------------------------------------------------
- }
// .............................................................................
typedef ::cppu::WeakImplHelper1 < XTerminateListener
> DatabaseDocumentLoader_Base;
@@ -224,6 +200,15 @@ ODatabaseContext::ODatabaseContext( const Reference< XComponentContext >& _rxCon
{
m_pDatabaseDocumentLoader = new DatabaseDocumentLoader( m_aContext );
::basic::BasicManagerRepository::registerCreationListener( *this );
+
+ osl_incrementInterlockedCount( &m_refCount );
+ {
+ m_xDBRegistrationAggregate.set( createDataSourceRegistrations( m_aContext ), UNO_SET_THROW );
+ m_xDatabaseRegistrations.set( m_xDBRegistrationAggregate, UNO_QUERY_THROW );
+
+ m_xDBRegistrationAggregate->setDelegator( *this );
+ }
+ osl_decrementInterlockedCount( &m_refCount );
}
//--------------------------------------------------------------------------
@@ -232,6 +217,10 @@ ODatabaseContext::~ODatabaseContext()
::basic::BasicManagerRepository::revokeCreationListener( *this );
if ( m_pDatabaseDocumentLoader )
m_pDatabaseDocumentLoader->release();
+
+ m_xDBRegistrationAggregate->setDelegator( NULL );
+ m_xDBRegistrationAggregate.clear();
+ m_xDatabaseRegistrations.clear();
}
// Helper
@@ -327,25 +316,6 @@ void ODatabaseContext::disposing()
m_aDatabaseObjects.clear();
}
-//------------------------------------------------------------------------------
-bool ODatabaseContext::getURLForRegisteredObject( const ::rtl::OUString& _rRegisteredName, ::rtl::OUString& _rURL )
-{
- if ( !_rRegisteredName.getLength() )
- throw IllegalArgumentException();
-
- // the config node where all pooling relevant info are stored under
- OConfigurationTreeRoot aDbRegisteredNamesRoot = OConfigurationTreeRoot::createWithServiceFactory(
- m_aContext.getLegacyServiceFactory(), getDbRegisteredNamesNodeName(), -1, OConfigurationTreeRoot::CM_READONLY);
- if ( aDbRegisteredNamesRoot.isValid() && aDbRegisteredNamesRoot.hasByName( _rRegisteredName ) )
- {
- OConfigurationNode aRegisterObj = aDbRegisteredNamesRoot.openNode( _rRegisteredName );
- aRegisterObj.getNodeValue(getDbLocationNodeName()) >>= _rURL;
- _rURL = SvtPathOptions().SubstituteVariable( _rURL );
- return true;
- }
- return false;
-}
-
// XNamingService
//------------------------------------------------------------------------------
Reference< XInterface > ODatabaseContext::getRegisteredObject(const rtl::OUString& _rName) throw( Exception, RuntimeException )
@@ -353,9 +323,7 @@ Reference< XInterface > ODatabaseContext::getRegisteredObject(const rtl::OUStri
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(DatabaseAccessContext_Base::rBHelper.bDisposed);
- ::rtl::OUString sURL;
- if ( !getURLForRegisteredObject( _rName, sURL ) )
- throw NoSuchElementException(_rName, *this);
+ ::rtl::OUString sURL( getDatabaseLocation( _rName ) );
if ( !sURL.getLength() )
// there is a registration for this name, but no URL
@@ -500,23 +468,7 @@ void ODatabaseContext::registerObject(const rtl::OUString& _rName, const Referen
if ( !sURL.getLength() )
throw IllegalArgumentException( DBACORE_RESSTRING( RID_STR_DATASOURCE_NOT_STORED ), *this, 2 );
- OConfigurationTreeRoot aDbRegisteredNamesRoot = OConfigurationTreeRoot::createWithServiceFactory(
- ::comphelper::getProcessServiceFactory(), getDbRegisteredNamesNodeName(), -1, OConfigurationTreeRoot::CM_UPDATABLE);
-
- if ( aDbRegisteredNamesRoot.isValid() )
- {
- OConfigurationNode oDataSourceRegistration;
- // the sub-node for the concrete registration
- if (aDbRegisteredNamesRoot.hasByName(_rName))
- oDataSourceRegistration = aDbRegisteredNamesRoot.openNode(_rName);
- else
- oDataSourceRegistration = aDbRegisteredNamesRoot.createNode(_rName);
-
- // set the values
- oDataSourceRegistration.setNodeValue(getDbNameNodeName(), makeAny(_rName));
- oDataSourceRegistration.setNodeValue(getDbLocationNodeName(), makeAny(sURL));
- aDbRegisteredNamesRoot.commit();
- }
+ registerDatabaseLocation( _rName, sURL );
ODatabaseSource::setName( xDocDataSource, _rName, ODatabaseSource::DBContextAccess() );
@@ -601,30 +553,20 @@ void ODatabaseContext::revokeObject(const rtl::OUString& _rName) throw( Exceptio
Reference< XInterface > xExistent;
- OConfigurationTreeRoot aDbRegisteredNamesRoot = OConfigurationTreeRoot::createWithServiceFactory(
- m_aContext.getLegacyServiceFactory(), getDbRegisteredNamesNodeName(), -1, OConfigurationTreeRoot::CM_UPDATABLE);
- if ( aDbRegisteredNamesRoot.isValid() && aDbRegisteredNamesRoot.hasByName(_rName) )
- {
- OConfigurationNode aThisDriverSettings = aDbRegisteredNamesRoot.openNode(_rName);
- ::rtl::OUString sURL;
- aThisDriverSettings.getNodeValue(getDbLocationNodeName()) >>= sURL;
- sURL = SvtPathOptions().SubstituteVariable(sURL);
+ ::rtl::OUString sURL = getDatabaseLocation( _rName );
- if ( m_aDatabaseObjects.find( _rName ) != m_aDatabaseObjects.end() )
- {
- m_aDatasourceProperties[ sURL ] = m_aDatasourceProperties[ _rName ];
- }
+ revokeDatabaseLocation( _rName );
+ // will throw if something goes wrong
- // check if URL is already loaded
- ObjectCacheIterator aExistent = m_aDatabaseObjects.find(sURL);
- if ( aExistent != m_aDatabaseObjects.end() )
- m_aDatabaseObjects.erase(aExistent);
- if (!aDbRegisteredNamesRoot.removeNode(_rName))
- throw Exception(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("An unexpected und unknown error occured.")), static_cast<XNamingService*>(this));
- aDbRegisteredNamesRoot.commit();
+ if ( m_aDatabaseObjects.find( _rName ) != m_aDatabaseObjects.end() )
+ {
+ m_aDatasourceProperties[ sURL ] = m_aDatasourceProperties[ _rName ];
}
- else
- throw NoSuchElementException(_rName,*this);
+
+ // check if URL is already loaded
+ ObjectCacheIterator aExistent = m_aDatabaseObjects.find(sURL);
+ if ( aExistent != m_aDatabaseObjects.end() )
+ m_aDatabaseObjects.erase(aExistent);
// notify our container listeners
ContainerEvent aEvent(static_cast<XContainer*>(this), makeAny(_rName), Any(), makeAny(xExistent));
@@ -634,6 +576,60 @@ void ODatabaseContext::revokeObject(const rtl::OUString& _rName) throw( Exceptio
static_cast<XContainerListener*>(aListenerLoop.next())->elementRemoved(aEvent);
}
+//------------------------------------------------------------------------------
+::sal_Bool SAL_CALL ODatabaseContext::hasRegisteredDatabase( const ::rtl::OUString& _Name ) throw (IllegalArgumentException, RuntimeException)
+{
+ return m_xDatabaseRegistrations->hasRegisteredDatabase( _Name );
+}
+
+//------------------------------------------------------------------------------
+Sequence< ::rtl::OUString > SAL_CALL ODatabaseContext::getRegistrationNames() throw (RuntimeException)
+{
+ return m_xDatabaseRegistrations->getRegistrationNames();
+}
+
+//------------------------------------------------------------------------------
+::rtl::OUString SAL_CALL ODatabaseContext::getDatabaseLocation( const ::rtl::OUString& _Name ) throw (IllegalArgumentException, NoSuchElementException, RuntimeException)
+{
+ return m_xDatabaseRegistrations->getDatabaseLocation( _Name );
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL ODatabaseContext::registerDatabaseLocation( const ::rtl::OUString& _Name, const ::rtl::OUString& _Location ) throw (IllegalArgumentException, ElementExistException, RuntimeException)
+{
+ m_xDatabaseRegistrations->registerDatabaseLocation( _Name, _Location );
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL ODatabaseContext::revokeDatabaseLocation( const ::rtl::OUString& _Name ) throw (IllegalArgumentException, NoSuchElementException, IllegalAccessException, RuntimeException)
+{
+ m_xDatabaseRegistrations->revokeDatabaseLocation( _Name );
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL ODatabaseContext::changeDatabaseLocation( const ::rtl::OUString& _Name, const ::rtl::OUString& _NewLocation ) throw (IllegalArgumentException, NoSuchElementException, IllegalAccessException, RuntimeException)
+{
+ m_xDatabaseRegistrations->changeDatabaseLocation( _Name, _NewLocation );
+}
+
+//------------------------------------------------------------------------------
+::sal_Bool SAL_CALL ODatabaseContext::isDatabaseRegistrationReadOnly( const ::rtl::OUString& _Name ) throw (IllegalArgumentException, NoSuchElementException, RuntimeException)
+{
+ return m_xDatabaseRegistrations->isDatabaseRegistrationReadOnly( _Name );
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL ODatabaseContext::addDatabaseRegistrationsListener( const Reference< XDatabaseRegistrationsListener >& _Listener ) throw (RuntimeException)
+{
+ m_xDatabaseRegistrations->addDatabaseRegistrationsListener( _Listener );
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL ODatabaseContext::removeDatabaseRegistrationsListener( const Reference< XDatabaseRegistrationsListener >& _Listener ) throw (RuntimeException)
+{
+ m_xDatabaseRegistrations->removeDatabaseRegistrationsListener( _Listener );
+}
+
// ::com::sun::star::container::XElementAccess
//------------------------------------------------------------------------------
Type ODatabaseContext::getElementType( ) throw(RuntimeException)
@@ -676,8 +672,9 @@ Any ODatabaseContext::getByName(const rtl::OUString& _rName) throw( NoSuchElemen
// see whether this is an registered name
::rtl::OUString sURL;
- if ( getURLForRegisteredObject( _rName, sURL ) )
+ if ( hasRegisteredDatabase( _rName ) )
{
+ sURL = getDatabaseLocation( _rName );
// is the object cached under its URL?
xExistent = getObject( sURL );
}
@@ -704,7 +701,8 @@ Any ODatabaseContext::getByName(const rtl::OUString& _rName) throw( NoSuchElemen
}
catch (Exception& e)
{ // exceptions other than the speciafied ones -> wrap
- throw WrappedTargetException(_rName, *this, makeAny( e ) );
+ Any aError = ::cppu::getCaughtException();
+ throw WrappedTargetException(_rName, *this, aError );
}
}
@@ -714,19 +712,7 @@ Sequence< rtl::OUString > ODatabaseContext::getElementNames(void) throw( Runtime
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(DatabaseAccessContext_Base::rBHelper.bDisposed);
- DECLARE_STL_USTRINGACCESS_MAP( bool , TNameMap);
- TNameMap aRet;
-
- OConfigurationTreeRoot aDbRegisteredNamesRoot = OConfigurationTreeRoot::createWithServiceFactory(
- m_aContext.getLegacyServiceFactory(), getDbRegisteredNamesNodeName(), -1, OConfigurationTreeRoot::CM_READONLY);
-
- Sequence< ::rtl::OUString> aSeq;
- if ( aDbRegisteredNamesRoot.isValid() )
- {
- aSeq = aDbRegisteredNamesRoot.getNodeNames();
- } // if ( aDbRegisteredNamesRoot.isValid() )
-
- return aSeq;
+ return getRegistrationNames();
}
//------------------------------------------------------------------------------
@@ -735,11 +721,9 @@ sal_Bool ODatabaseContext::hasByName(const rtl::OUString& _rName) throw( Runtime
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(DatabaseAccessContext_Base::rBHelper.bDisposed);
- OConfigurationTreeRoot aDbRegisteredNamesRoot = OConfigurationTreeRoot::createWithServiceFactory(
- m_aContext.getLegacyServiceFactory(), getDbRegisteredNamesNodeName(), -1, OConfigurationTreeRoot::CM_READONLY);
-
- return aDbRegisteredNamesRoot.isValid() && aDbRegisteredNamesRoot.hasByName(_rName);
+ return hasRegisteredDatabase( _rName );
}
+
// -----------------------------------------------------------------------------
Reference< XInterface > ODatabaseContext::getObject(const ::rtl::OUString& _rName)
{
diff --git a/dbaccess/source/core/dataaccess/databasecontext.hxx b/dbaccess/source/core/dataaccess/databasecontext.hxx
index f09d54daf3f3..2eaf663e9796 100644
--- a/dbaccess/source/core/dataaccess/databasecontext.hxx
+++ b/dbaccess/source/core/dataaccess/databasecontext.hxx
@@ -31,57 +31,29 @@
#ifndef _DBA_COREDATAACCESS_DATABASECONTEXT_HXX_
#define _DBA_COREDATAACCESS_DATABASECONTEXT_HXX_
-#ifndef _COM_SUN_STAR_CONTAINER_XENUMERATIONACCESS_HPP_
+#include "ModelImpl.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/container/ElementExistException.hpp>
+#include <com/sun/star/container/XContainer.hpp>
#include <com/sun/star/container/XEnumerationAccess.hpp>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
+#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UNO_XNAMINGSERVICE_HPP_
-#include <com/sun/star/uno/XNamingService.hpp>
-#endif
-#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_
-#include <com/sun/star/lang/XUnoTunnel.hpp>
-#endif
-#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XEventListener.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDB_XDATABASEENVIRONMENT_HPP_
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/sdb/XDatabaseEnvironment.hpp>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XHIERARCHICALNAMEACCESS_HPP_
-#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XCONTAINER_HPP_
-#include <com/sun/star/container/XContainer.hpp>
-#endif
-#ifndef _CPPUHELPER_COMPBASE7_HXX_
-#include <cppuhelper/compbase7.hxx>
-#endif
-#ifndef _COMPHELPER_STLTYPES_HXX_
-#include <comphelper/stl_types.hxx>
-#endif
-#ifndef COMPHELPER_COMPONENTCONTEXT_HXX
+#include <com/sun/star/sdb/XDatabaseRegistrations.hpp>
+#include <com/sun/star/uno/XNamingService.hpp>
+#include <com/sun/star/uno/XAggregation.hpp>
+/** === end UNO includes === **/
+
+#include <basic/basicmanagerrepository.hxx>
#include <comphelper/componentcontext.hxx>
-#endif
-#ifndef _CPPUHELPER_INTERFACECONTAINER_HXX_
+#include <comphelper/stl_types.hxx>
+#include <cppuhelper/compbase8.hxx>
#include <cppuhelper/interfacecontainer.hxx>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_ELEMENTEXISTEXCEPTION_HPP_
-#include <com/sun/star/container/ElementExistException.hpp>
-#endif
-#ifndef _COM_SUN_STAR_LANG_XEVENTLISTENER_HPP_
-#include <com/sun/star/lang/XEventListener.hpp>
-#endif
-#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-#endif
-#ifndef _DBA_COREDATAACCESS_MODELIMPL_HXX_
-#include "ModelImpl.hxx"
-#endif
-#ifndef BASICMANAGERREPOSITORY_HXX
-#include <basic/basicmanagerrepository.hxx>
-#endif
#include <boost/shared_ptr.hpp>
@@ -105,13 +77,14 @@ class DatabaseDocumentLoader;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
ODatabaseContext_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&);
-typedef ::cppu::WeakComponentImplHelper7 < ::com::sun::star::lang::XServiceInfo
+typedef ::cppu::WeakComponentImplHelper8 < ::com::sun::star::lang::XServiceInfo
, ::com::sun::star::container::XEnumerationAccess
, ::com::sun::star::container::XNameAccess
, ::com::sun::star::uno::XNamingService
, ::com::sun::star::container::XContainer
, ::com::sun::star::lang::XSingleServiceFactory
, ::com::sun::star::lang::XUnoTunnel
+ , ::com::sun::star::sdb::XDatabaseRegistrations
> DatabaseAccessContext_Base;
class ODatabaseContext :public DatabaseAccessContext_Base
@@ -126,12 +99,6 @@ 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);
- /** retrieves the URL for a given registration name, if any
- @returns <FALSE/> if and only if there exists a registration for the given name
- @throws IllegalArgumentException if the name is empty
- */
- bool getURLForRegisteredObject( const ::rtl::OUString& _rRegisteredName, ::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
@param _xObject The data source itself.
@@ -147,6 +114,11 @@ protected:
::osl::Mutex m_aMutex;
::comphelper::ComponentContext m_aContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation >
+ m_xDBRegistrationAggregate;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XDatabaseRegistrations >
+ m_xDatabaseRegistrations;
+
DECLARE_STL_USTRINGACCESS_MAP( ODatabaseModelImpl*, ObjectCache );
ObjectCache m_aDatabaseObjects;
@@ -166,42 +138,53 @@ public:
virtual ~ODatabaseContext();
-// OComponentHelper
+ // OComponentHelper
virtual void SAL_CALL disposing(void);
-// ::com::sun::star::lang::XSingleServiceFactory
+ // XSingleServiceFactory
virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance( ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& _rArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
-// ::com::sun::star::lang::XServiceInfo
+ // XServiceInfo
virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
-// ::com::sun::star::lang::XServiceInfo - static methods
+ // XServiceInfo - static methods
static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static(void) throw( ::com::sun::star::uno::RuntimeException );
static ::rtl::OUString getImplementationName_static(void) throw( ::com::sun::star::uno::RuntimeException );
static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
SAL_CALL Create(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&);
-// ::com::sun::star::container::XElementAccess
+ // XElementAccess
virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
-// ::com::sun::star::container::XEnumerationAccess
+ // XEnumerationAccess
virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration( ) throw(::com::sun::star::uno::RuntimeException);
-// ::com::sun::star::container::XNameAccess
+ // XNameAccess
virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw(::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
-// ::com::sun::star::uno::XNamingService
+ // XNamingService
virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRegisteredObject( const ::rtl::OUString& Name ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL registerObject( const ::rtl::OUString& Name, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Object ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL revokeObject( const ::rtl::OUString& Name ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
-// ::com::sun::star::container::XContainer
+ // XDatabaseRegistrations
+ virtual ::sal_Bool SAL_CALL hasRegisteredDatabase( const ::rtl::OUString& Name ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getRegistrationNames() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getDatabaseLocation( const ::rtl::OUString& Name ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL registerDatabaseLocation( const ::rtl::OUString& Name, const ::rtl::OUString& Location ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL revokeDatabaseLocation( const ::rtl::OUString& Name ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL changeDatabaseLocation( const ::rtl::OUString& Name, const ::rtl::OUString& NewLocation ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isDatabaseRegistrationReadOnly( const ::rtl::OUString& Name ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addDatabaseRegistrationsListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XDatabaseRegistrationsListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeDatabaseRegistrationsListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XDatabaseRegistrationsListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XContainer
virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
diff --git a/dbaccess/source/core/dataaccess/databaseregistrations.cxx b/dbaccess/source/core/dataaccess/databaseregistrations.cxx
new file mode 100644
index 000000000000..b4d45e2204fa
--- /dev/null
+++ b/dbaccess/source/core/dataaccess/databaseregistrations.cxx
@@ -0,0 +1,309 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2009 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_dbaccess.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/sdb/XDatabaseRegistrations.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/componentcontext.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <svtools/pathoptions.hxx>
+#include <tools/urlobj.hxx>
+#include <unotools/confignode.hxx>
+
+//........................................................................
+namespace dbaccess
+{
+//........................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::container::NoSuchElementException;
+ using ::com::sun::star::lang::IllegalArgumentException;
+ using ::com::sun::star::lang::IllegalAccessException;
+ using ::com::sun::star::container::ElementExistException;
+ using ::com::sun::star::sdb::XDatabaseRegistrations;
+ using ::com::sun::star::sdb::XDatabaseRegistrationsListener;
+ using ::com::sun::star::sdb::DatabaseRegistrationEvent;
+ using ::com::sun::star::uno::XAggregation;
+ /** === end UNO using === **/
+
+ //--------------------------------------------------------------------
+ static const ::rtl::OUString& getConfigurationRootPath()
+ {
+ static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("org.openoffice.Office.DataAccess/RegisteredNames");
+ return s_sNodeName;
+ }
+
+ //--------------------------------------------------------------------
+ const ::rtl::OUString& getLocationNodeName()
+ {
+ static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii( "Location" );
+ return s_sNodeName;
+ }
+
+ //--------------------------------------------------------------------
+ const ::rtl::OUString& getNameNodeName()
+ {
+ static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii( "Name" );
+ return s_sNodeName;
+ }
+
+ //====================================================================
+ //= DatabaseRegistrations - declaration
+ //====================================================================
+ typedef ::cppu::WeakAggImplHelper1 < XDatabaseRegistrations
+ > DatabaseRegistrations_Base;
+ class DatabaseRegistrations :public ::cppu::BaseMutex
+ ,public DatabaseRegistrations_Base
+ {
+ public:
+ DatabaseRegistrations( const ::comphelper::ComponentContext& _rxContext );
+
+ protected:
+ ~DatabaseRegistrations();
+
+ public:
+ virtual ::sal_Bool SAL_CALL hasRegisteredDatabase( const ::rtl::OUString& _Name ) throw (IllegalArgumentException, RuntimeException);
+ virtual Sequence< ::rtl::OUString > SAL_CALL getRegistrationNames() throw (RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getDatabaseLocation( const ::rtl::OUString& _Name ) throw (IllegalArgumentException, NoSuchElementException, RuntimeException);
+ virtual void SAL_CALL registerDatabaseLocation( const ::rtl::OUString& _Name, const ::rtl::OUString& _Location ) throw (IllegalArgumentException, ElementExistException, RuntimeException);
+ virtual void SAL_CALL revokeDatabaseLocation( const ::rtl::OUString& _Name ) throw (IllegalArgumentException, NoSuchElementException, IllegalAccessException, RuntimeException);
+ virtual void SAL_CALL changeDatabaseLocation( const ::rtl::OUString& Name, const ::rtl::OUString& NewLocation ) throw (IllegalArgumentException, NoSuchElementException, IllegalAccessException, RuntimeException);
+ virtual ::sal_Bool SAL_CALL isDatabaseRegistrationReadOnly( const ::rtl::OUString& _Name ) throw (IllegalArgumentException, NoSuchElementException, RuntimeException);
+ virtual void SAL_CALL addDatabaseRegistrationsListener( const Reference< XDatabaseRegistrationsListener >& Listener ) throw (RuntimeException);
+ virtual void SAL_CALL removeDatabaseRegistrationsListener( const Reference< XDatabaseRegistrationsListener >& Listener ) throw (RuntimeException);
+
+ private:
+ void impl_checkValidName_throw( const ::rtl::OUString& _rName, const bool _bMustExist );
+ void impl_checkValidLocation_throw( const ::rtl::OUString& _rLocation );
+
+ private:
+ ::comphelper::ComponentContext m_aContext;
+ ::utl::OConfigurationTreeRoot m_aConfigurationRoot;
+ ::cppu::OInterfaceContainerHelper m_aRegistrationListeners;
+ };
+
+ //====================================================================
+ //= DatabaseRegistrations - implementation
+ //====================================================================
+ //--------------------------------------------------------------------
+ DatabaseRegistrations::DatabaseRegistrations( const ::comphelper::ComponentContext& _rxContext )
+ :m_aContext( _rxContext )
+ ,m_aConfigurationRoot()
+ ,m_aRegistrationListeners( m_aMutex )
+ {
+ m_aConfigurationRoot = ::utl::OConfigurationTreeRoot::createWithServiceFactory(
+ m_aContext.getLegacyServiceFactory(), getConfigurationRootPath(), -1, ::utl::OConfigurationTreeRoot::CM_UPDATABLE );
+ }
+
+ //--------------------------------------------------------------------
+ DatabaseRegistrations::~DatabaseRegistrations()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ void DatabaseRegistrations::impl_checkValidName_throw( const ::rtl::OUString& _rName, const bool _bMustExist )
+ {
+ if ( !m_aConfigurationRoot.isValid() )
+ throw RuntimeException( ::rtl::OUString(), *this );
+
+ if ( !_rName.getLength() )
+ throw IllegalArgumentException( ::rtl::OUString(), *this, 1 );
+
+ if ( _bMustExist && !m_aConfigurationRoot.hasByName( _rName ) )
+ throw NoSuchElementException( _rName, *this );
+
+ if ( !_bMustExist && m_aConfigurationRoot.hasByName( _rName ) )
+ throw ElementExistException( _rName, *this );
+ }
+
+ //--------------------------------------------------------------------
+ void DatabaseRegistrations::impl_checkValidLocation_throw( const ::rtl::OUString& _rLocation )
+ {
+ if ( !_rLocation.getLength() )
+ throw IllegalArgumentException( ::rtl::OUString(), *this, 2 );
+
+ INetURLObject aURL( _rLocation );
+ if ( aURL.GetProtocol() == INET_PROT_NOT_VALID )
+ throw IllegalArgumentException( ::rtl::OUString(), *this, 2 );
+ }
+
+ //--------------------------------------------------------------------
+ ::sal_Bool SAL_CALL DatabaseRegistrations::hasRegisteredDatabase( const ::rtl::OUString& _Name ) throw (IllegalArgumentException, RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ return m_aConfigurationRoot.isValid() && m_aConfigurationRoot.hasByName( _Name );
+ }
+
+ //------------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL DatabaseRegistrations::getRegistrationNames() throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( !m_aConfigurationRoot.isValid() )
+ throw RuntimeException( ::rtl::OUString(), *this );
+
+ Sequence< ::rtl::OUString > aNames( m_aConfigurationRoot.getNodeNames() );
+ return aNames;
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL DatabaseRegistrations::getDatabaseLocation( const ::rtl::OUString& _Name ) throw (IllegalArgumentException, NoSuchElementException, RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkValidName_throw( _Name, true );
+
+ ::rtl::OUString sLocation;
+
+ ::utl::OConfigurationNode aRegisterObj( m_aConfigurationRoot.openNode( _Name ) );
+ OSL_VERIFY( aRegisterObj.getNodeValue( getLocationNodeName() ) >>= sLocation );
+ sLocation = SvtPathOptions().SubstituteVariable( sLocation );
+
+ return sLocation;
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL DatabaseRegistrations::registerDatabaseLocation( const ::rtl::OUString& _Name, const ::rtl::OUString& _Location ) throw (IllegalArgumentException, ElementExistException, RuntimeException)
+ {
+ ::osl::ClearableMutexGuard aGuard( m_aMutex );
+
+ // check
+ impl_checkValidName_throw( _Name, false );
+ impl_checkValidLocation_throw( _Location );
+
+ // register
+ ::utl::OConfigurationNode aDataSourceRegistration = m_aConfigurationRoot.createNode( _Name );
+
+ aDataSourceRegistration.setNodeValue( getNameNodeName(), makeAny( _Name ) );
+ aDataSourceRegistration.setNodeValue( getLocationNodeName(), makeAny( _Location ) );
+
+ m_aConfigurationRoot.commit();
+
+ // notify
+ DatabaseRegistrationEvent aEvent( *this, _Name, ::rtl::OUString(), _Location );
+ aGuard.clear();
+ m_aRegistrationListeners.notifyEach( &XDatabaseRegistrationsListener::registeredDatabaseLocation, aEvent );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL DatabaseRegistrations::revokeDatabaseLocation( const ::rtl::OUString& _Name ) throw (IllegalArgumentException, NoSuchElementException, IllegalAccessException, RuntimeException)
+ {
+ ::osl::ClearableMutexGuard aGuard( m_aMutex );
+
+ // check
+ impl_checkValidName_throw( _Name, true );
+
+ const ::rtl::OUString sLocation( getDatabaseLocation( _Name ) );
+
+ // revoke
+ if ( isDatabaseRegistrationReadOnly( _Name )
+ || !m_aConfigurationRoot.removeNode( _Name )
+ )
+ throw IllegalAccessException( ::rtl::OUString(), *this );
+
+ m_aConfigurationRoot.commit();
+
+ // notify
+ DatabaseRegistrationEvent aEvent( *this, _Name, sLocation, ::rtl::OUString() );
+ aGuard.clear();
+ m_aRegistrationListeners.notifyEach( &XDatabaseRegistrationsListener::revokedDatabaseLocation, aEvent );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL DatabaseRegistrations::changeDatabaseLocation( const ::rtl::OUString& _Name, const ::rtl::OUString& _NewLocation ) throw (IllegalArgumentException, NoSuchElementException, IllegalAccessException, RuntimeException)
+ {
+ ::osl::ClearableMutexGuard aGuard( m_aMutex );
+
+ // check
+ impl_checkValidName_throw( _Name, true );
+ impl_checkValidLocation_throw( _NewLocation );
+
+ if ( isDatabaseRegistrationReadOnly( _Name ) )
+ throw IllegalAccessException( ::rtl::OUString(), *this );
+
+ const ::rtl::OUString sOldLocation( getDatabaseLocation( _Name ) );
+
+ // change
+ ::utl::OConfigurationNode aDataSourceRegistration = m_aConfigurationRoot.openNode( _Name );
+ aDataSourceRegistration.setNodeValue( getLocationNodeName(), makeAny( _NewLocation ) );
+ m_aConfigurationRoot.commit();
+
+ // notify
+ DatabaseRegistrationEvent aEvent( *this, _Name, sOldLocation, _NewLocation );
+ aGuard.clear();
+ m_aRegistrationListeners.notifyEach( &XDatabaseRegistrationsListener::changedDatabaseLocation, aEvent );
+ }
+
+ //--------------------------------------------------------------------
+ ::sal_Bool SAL_CALL DatabaseRegistrations::isDatabaseRegistrationReadOnly( const ::rtl::OUString& _Name ) throw (IllegalArgumentException, NoSuchElementException, RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkValidName_throw( _Name, true );
+
+ // TODO: place your code here
+ (void)_Name;
+ return sal_False;
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL DatabaseRegistrations::addDatabaseRegistrationsListener( const Reference< XDatabaseRegistrationsListener >& _Listener ) throw (RuntimeException)
+ {
+ if ( _Listener.is() )
+ m_aRegistrationListeners.addInterface( _Listener );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL DatabaseRegistrations::removeDatabaseRegistrationsListener( const Reference< XDatabaseRegistrationsListener >& _Listener ) throw (RuntimeException)
+ {
+ if ( _Listener.is() )
+ m_aRegistrationListeners.removeInterface( _Listener );
+ }
+
+ //====================================================================
+ //= DatabaseRegistrations - factory
+ //====================================================================
+ Reference< XAggregation > createDataSourceRegistrations( const ::comphelper::ComponentContext& _rxContext )
+ {
+ return new DatabaseRegistrations( _rxContext );
+ }
+
+//........................................................................
+} // namespace dbaccess
+//........................................................................
diff --git a/dbaccess/source/core/dataaccess/databaseregistrations.hxx b/dbaccess/source/core/dataaccess/databaseregistrations.hxx
new file mode 100644
index 000000000000..068f6ea975c9
--- /dev/null
+++ b/dbaccess/source/core/dataaccess/databaseregistrations.hxx
@@ -0,0 +1,50 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2009 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+#ifndef OOO_DATASOURCEREGISTRATIONS_HXX
+#define OOO_DATASOURCEREGISTRATIONS_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/uno/XAggregation.hpp>
+/** === end UNO includes === **/
+
+namespace comphelper
+{
+ class ComponentContext;
+}
+
+//........................................................................
+namespace dbaccess
+{
+//........................................................................
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation >
+ createDataSourceRegistrations( const ::comphelper::ComponentContext& _rxContext );
+
+//........................................................................
+} // namespace dbaccess
+//........................................................................
+
+#endif // OOO_DATASOURCEREGISTRATIONS_HXX
diff --git a/dbaccess/source/core/dataaccess/makefile.mk b/dbaccess/source/core/dataaccess/makefile.mk
index 580d62c08e55..aff531b3a388 100644
--- a/dbaccess/source/core/dataaccess/makefile.mk
+++ b/dbaccess/source/core/dataaccess/makefile.mk
@@ -56,6 +56,7 @@ SLOFILES= \
$(SLO)$/databasecontext.obj \
$(SLO)$/connection.obj \
$(SLO)$/datasource.obj \
+ $(SLO)$/databaseregistrations.obj \
$(SLO)$/intercept.obj \
$(SLO)$/myucp_datasupplier.obj \
$(SLO)$/myucp_resultset.obj \
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index 2a930f7fe573..9f3403b690c5 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -77,6 +77,7 @@
#include <com/sun/star/sdb/SQLContext.hpp>
#include <com/sun/star/sdb/XBookmarksSupplier.hpp>
#include <com/sun/star/sdb/XCompletedConnection.hpp>
+#include <com/sun/star/sdb/XDatabaseRegistrations.hpp>
#include <com/sun/star/sdb/XDocumentDataSource.hpp>
#include <com/sun/star/sdb/XParametersSupplier.hpp>
#include <com/sun/star/sdb/XQueriesSupplier.hpp>
@@ -198,25 +199,21 @@ void SafeRemovePropertyListener(const Reference< XPropertySet > & xSet, const ::
//-------------------------------------------------------------------------
::rtl::OUString SAL_CALL SbaTableQueryBrowser::getImplementationName() throw(RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getImplementationName" );
return getImplementationName_Static();
}
//-------------------------------------------------------------------------
::comphelper::StringSequence SAL_CALL SbaTableQueryBrowser::getSupportedServiceNames() throw(RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getSupportedServiceNames" );
return getSupportedServiceNames_Static();
}
// -------------------------------------------------------------------------
::rtl::OUString SbaTableQueryBrowser::getImplementationName_Static() throw(RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getImplementationName_Static" );
return ::rtl::OUString::createFromAscii("org.openoffice.comp.dbu.ODatasourceBrowser");
}
//-------------------------------------------------------------------------
::comphelper::StringSequence SbaTableQueryBrowser::getSupportedServiceNames_Static() throw(RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getSupportedServiceNames_Static" );
::comphelper::StringSequence aSupported(1);
aSupported.getArray()[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdb.DataSourceBrowser");
return aSupported;
@@ -224,7 +221,6 @@ void SafeRemovePropertyListener(const Reference< XPropertySet > & xSet, const ::
//-------------------------------------------------------------------------
Reference< XInterface > SAL_CALL SbaTableQueryBrowser::Create(const Reference<XMultiServiceFactory >& _rxFactory)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::Create" );
::vos::OGuard aGuard(Application::GetSolarMutex());
return *(new SbaTableQueryBrowser(_rxFactory));
}
@@ -247,7 +243,6 @@ SbaTableQueryBrowser::SbaTableQueryBrowser(const Reference< XMultiServiceFactory
,m_bInSuspend(sal_False)
,m_bEnableBrowser(sal_True)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::SbaTableQueryBrowser" );
DBG_CTOR(SbaTableQueryBrowser,NULL);
}
@@ -267,7 +262,6 @@ SbaTableQueryBrowser::~SbaTableQueryBrowser()
//------------------------------------------------------------------------------
Any SAL_CALL SbaTableQueryBrowser::queryInterface(const Type& _rType) throw (RuntimeException)
{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::queryInterface" );
if ( _rType.equals( XScriptInvocationContext::static_type() ) )
{
OSL_PRECOND( !!m_aDocScriptSupport, "SbaTableQueryBrowser::queryInterface: did not initialize this, yet!" );
@@ -285,7 +279,6 @@ Any SAL_CALL SbaTableQueryBrowser::queryInterface(const Type& _rType) throw (Run
//------------------------------------------------------------------------------
Sequence< Type > SAL_CALL SbaTableQueryBrowser::getTypes( ) throw (RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getTypes" );
Sequence< Type > aTypes( ::comphelper::concatSequences(
SbaXDataBrowserController::getTypes(),
SbaTableQueryBrowser_Base::getTypes()
@@ -309,7 +302,6 @@ Sequence< Type > SAL_CALL SbaTableQueryBrowser::getTypes( ) throw (RuntimeExcep
//------------------------------------------------------------------------------
Sequence< sal_Int8 > SAL_CALL SbaTableQueryBrowser::getImplementationId( ) throw (RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getImplementationId" );
static ::cppu::OImplementationId * pId = 0;
if (! pId)
{
@@ -326,7 +318,6 @@ Sequence< sal_Int8 > SAL_CALL SbaTableQueryBrowser::getImplementationId( ) thro
//------------------------------------------------------------------------------
void SAL_CALL SbaTableQueryBrowser::disposing()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::disposing" );
::vos::OGuard aGuard(Application::GetSolarMutex());
// doin' a lot of VCL stuff here -> lock the SolarMutex
@@ -351,9 +342,15 @@ void SAL_CALL SbaTableQueryBrowser::disposing()
implRemoveStatusListeners();
// remove the container listener from the database context
- Reference< XContainer > xDatasourceContainer(m_xDatabaseContext, UNO_QUERY);
- if (xDatasourceContainer.is())
- xDatasourceContainer->removeContainerListener(this);
+ try
+ {
+ Reference< XDatabaseRegistrations > xDatabaseRegistrations( m_xDatabaseContext, UNO_QUERY_THROW );
+ xDatabaseRegistrations->removeDatabaseRegistrationsListener( this );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
// check out from all the objects we are listening
// the frame
@@ -365,23 +362,17 @@ void SAL_CALL SbaTableQueryBrowser::disposing()
//------------------------------------------------------------------------------
sal_Bool SbaTableQueryBrowser::Construct(Window* pParent)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::Construct" );
- if (!SbaXDataBrowserController::Construct(pParent))
+ if ( !SbaXDataBrowserController::Construct( pParent ) )
return sal_False;
try
{
- Reference< XContainer > xDatasourceContainer(m_xDatabaseContext, UNO_QUERY);
- if (xDatasourceContainer.is())
- xDatasourceContainer->addContainerListener(this);
- else {
- DBG_ERROR("SbaTableQueryBrowser::Construct: the DatabaseContext should allow us to be a listener!");
- }
+ Reference< XDatabaseRegistrations > xDatabaseRegistrations( m_xDatabaseContext, UNO_QUERY_THROW );
+ xDatabaseRegistrations->addDatabaseRegistrationsListener( this );
// the collator for the string compares
- m_xCollator = Reference< XCollator >(getORB()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.i18n.Collator")), UNO_QUERY);
- if (m_xCollator.is())
- m_xCollator->loadDefaultCollator(Application::GetSettings().GetLocale(), 0);
+ m_xCollator = Reference< XCollator >( getORB()->createInstance(::rtl::OUString::createFromAscii( "com.sun.star.i18n.Collator" ) ), UNO_QUERY_THROW );
+ m_xCollator->loadDefaultCollator( Application::GetSettings().GetLocale(), 0 );
}
catch(Exception&)
{
@@ -434,7 +425,6 @@ sal_Bool SbaTableQueryBrowser::Construct(Window* pParent)
// -------------------------------------------------------------------------
sal_Bool SbaTableQueryBrowser::InitializeForm(const Reference< ::com::sun::star::sdbc::XRowSet > & _rxForm)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::InitializeForm" );
if(!m_pCurrentlyDisplayed)
return sal_True;
@@ -491,7 +481,6 @@ sal_Bool SbaTableQueryBrowser::InitializeForm(const Reference< ::com::sun::star:
//------------------------------------------------------------------------------
void SbaTableQueryBrowser::initializePreviewMode()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::initializePreviewMode" );
if ( getBrowserView() && getBrowserView()->getVclControl() )
{
getBrowserView()->getVclControl()->AlwaysEnableInput( FALSE );
@@ -510,7 +499,6 @@ void SbaTableQueryBrowser::initializePreviewMode()
//------------------------------------------------------------------------------
sal_Bool SbaTableQueryBrowser::InitializeGridModel(const Reference< ::com::sun::star::form::XFormComponent > & xGrid)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::InitializeGridModel" );
try
{
Reference< ::com::sun::star::form::XGridColumnFactory > xColFactory(xGrid, UNO_QUERY);
@@ -752,7 +740,6 @@ Reference<XPropertySet> getColumnHelper(SvLBoxEntry* _pCurrentlyDisplayed,const
// -----------------------------------------------------------------------
void SbaTableQueryBrowser::transferChangedControlProperty(const ::rtl::OUString& _rProperty, const Any& _rNewValue)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::transferChangedControlProperty" );
if(m_pCurrentlyDisplayed)
{
DBTreeListUserData* pData = static_cast<DBTreeListUserData*>(m_pCurrentlyDisplayed->GetUserData());
@@ -766,7 +753,6 @@ void SbaTableQueryBrowser::transferChangedControlProperty(const ::rtl::OUString&
// -----------------------------------------------------------------------
void SbaTableQueryBrowser::propertyChange(const PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::propertyChange" );
SbaXDataBrowserController::propertyChange(evt);
try
@@ -875,7 +861,6 @@ void SbaTableQueryBrowser::propertyChange(const PropertyChangeEvent& evt) throw(
// -----------------------------------------------------------------------
sal_Bool SbaTableQueryBrowser::suspend(sal_Bool bSuspend) throw( RuntimeException )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::suspend" );
vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::MutexGuard aGuard( getMutex() );
if ( getView() && getView()->IsInModalMode() )
@@ -900,7 +885,6 @@ sal_Bool SbaTableQueryBrowser::suspend(sal_Bool bSuspend) throw( RuntimeExceptio
// -------------------------------------------------------------------------
void SAL_CALL SbaTableQueryBrowser::statusChanged( const FeatureStateEvent& _rEvent ) throw(RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::statusChanged" );
// search the external dispatcher causing this call
Reference< XDispatch > xSource(_rEvent.Source, UNO_QUERY);
ExternalFeaturesMap::iterator aLoop;
@@ -955,7 +939,6 @@ void SAL_CALL SbaTableQueryBrowser::statusChanged( const FeatureStateEvent& _rEv
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::checkDocumentDataSource()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::checkDocumentDataSource" );
SvLBoxEntry* pDataSourceEntry = NULL;
SvLBoxEntry* pContainerEntry = NULL;
SvLBoxEntry* pObjectEntry = getObjectEntry( m_aDocumentDataSource, &pDataSourceEntry, &pContainerEntry, sal_False );
@@ -993,7 +976,6 @@ void SbaTableQueryBrowser::checkDocumentDataSource()
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::extractDescriptorProps(const ::svx::ODataAccessDescriptor& _rDescriptor, ::rtl::OUString& _rDataSource, ::rtl::OUString& _rCommand, sal_Int32& _rCommandType, sal_Bool& _rEscapeProcessing)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::extractDescriptorProps" );
_rDataSource = _rDescriptor.getDataSource();
if ( _rDescriptor.has(daCommand) )
_rDescriptor[daCommand] >>= _rCommand;
@@ -1045,7 +1027,6 @@ namespace
// -------------------------------------------------------------------------
String SbaTableQueryBrowser::getDataSourceAcessor( SvLBoxEntry* _pDataSourceEntry ) const
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getDataSourceAcessor" );
DBG_ASSERT( _pDataSourceEntry, "SbaTableQueryBrowser::getDataSourceAcessor: invalid entry!" );
DBTreeListUserData* pData = static_cast< DBTreeListUserData* >( _pDataSourceEntry->GetUserData() );
@@ -1059,7 +1040,6 @@ SvLBoxEntry* SbaTableQueryBrowser::getObjectEntry(const ::rtl::OUString& _rDataS
SvLBoxEntry** _ppDataSourceEntry, SvLBoxEntry** _ppContainerEntry, sal_Bool _bExpandAncestors,
const SharedConnection& _rxConnection )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getObjectEntry" );
if (_ppDataSourceEntry)
*_ppDataSourceEntry = NULL;
if (_ppContainerEntry)
@@ -1082,9 +1062,7 @@ SvLBoxEntry* SbaTableQueryBrowser::getObjectEntry(const ::rtl::OUString& _rDataS
{
// special case, the data source is a URL
// add new entries to the list box model
- Image a, b, c; // not interested in reusing them
- String e, f;
- implAddDatasource( _rDataSource, a, e, b, f, c, _rxConnection );
+ implAddDatasource( _rDataSource, _rxConnection );
pDataSource = m_pTreeView->getListBox().GetEntryPosByName( sDisplayName, NULL, &aFilter );
DBG_ASSERT( pDataSource, "SbaTableQueryBrowser::getObjectEntry: hmm - did not find it again!" );
}
@@ -1134,7 +1112,6 @@ SvLBoxEntry* SbaTableQueryBrowser::getObjectEntry(const ::svx::ODataAccessDescri
SvLBoxEntry** _ppDataSourceEntry, SvLBoxEntry** _ppContainerEntry,
sal_Bool _bExpandAncestors)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getObjectEntry" );
// extract the props from the descriptor
::rtl::OUString sDataSource;
::rtl::OUString sCommand;
@@ -1148,7 +1125,6 @@ SvLBoxEntry* SbaTableQueryBrowser::getObjectEntry(const ::svx::ODataAccessDescri
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::connectExternalDispatches()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::connectExternalDispatches" );
Reference< XDispatchProvider > xProvider( getFrame(), UNO_QUERY );
DBG_ASSERT(xProvider.is(), "SbaTableQueryBrowser::connectExternalDispatches: no DispatchProvider !");
if (xProvider.is())
@@ -1215,7 +1191,6 @@ void SbaTableQueryBrowser::connectExternalDispatches()
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::implCheckExternalSlot( sal_uInt16 _nId )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::implCheckExternalSlot" );
if ( !m_xMainToolbar.is() )
return;
@@ -1238,7 +1213,6 @@ void SbaTableQueryBrowser::implCheckExternalSlot( sal_uInt16 _nId )
// -------------------------------------------------------------------------
void SAL_CALL SbaTableQueryBrowser::disposing( const EventObject& _rSource ) throw(RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::disposing" );
// our frame ?
Reference< ::com::sun::star::frame::XFrame > xSourceFrame(_rSource.Source, UNO_QUERY);
if (m_xCurrentFrameParent.is() && (xSourceFrame == m_xCurrentFrameParent))
@@ -1301,7 +1275,6 @@ void SAL_CALL SbaTableQueryBrowser::disposing( const EventObject& _rSource ) thr
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::implRemoveStatusListeners()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::implRemoveStatusListeners" );
// clear all old dispatches
for ( ExternalFeaturesMap::const_iterator aLoop = m_aExternalFeatures.begin();
aLoop != m_aExternalFeatures.end();
@@ -1326,7 +1299,6 @@ void SbaTableQueryBrowser::implRemoveStatusListeners()
// -------------------------------------------------------------------------
sal_Bool SAL_CALL SbaTableQueryBrowser::select( const Any& _rSelection ) throw (IllegalArgumentException, RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::select" );
::vos::OGuard aGuard(Application::GetSolarMutex());
// doin' a lot of VCL stuff here -> lock the SolarMutex
@@ -1356,7 +1328,6 @@ sal_Bool SAL_CALL SbaTableQueryBrowser::select( const Any& _rSelection ) throw (
// -------------------------------------------------------------------------
Any SAL_CALL SbaTableQueryBrowser::getSelection( ) throw (RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getSelection" );
Any aReturn;
try
@@ -1384,21 +1355,18 @@ Any SAL_CALL SbaTableQueryBrowser::getSelection( ) throw (RuntimeException)
// -------------------------------------------------------------------------
void SAL_CALL SbaTableQueryBrowser::addSelectionChangeListener( const Reference< XSelectionChangeListener >& _rxListener ) throw (RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::addSelectionChangeListener" );
m_aSelectionListeners.addInterface(_rxListener);
}
// -------------------------------------------------------------------------
void SAL_CALL SbaTableQueryBrowser::removeSelectionChangeListener( const Reference< XSelectionChangeListener >& _rxListener ) throw (RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::removeSelectionChangeListener" );
m_aSelectionListeners.removeInterface(_rxListener);
}
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::attachFrame(const Reference< ::com::sun::star::frame::XFrame > & _xFrame) throw( RuntimeException )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::attachFrame" );
implRemoveStatusListeners();
if (m_xCurrentFrameParent.is())
@@ -1443,7 +1411,6 @@ void SbaTableQueryBrowser::attachFrame(const Reference< ::com::sun::star::frame:
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::addModelListeners(const Reference< ::com::sun::star::awt::XControlModel > & _xGridControlModel)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::addModelListeners" );
SbaXDataBrowserController::addModelListeners(_xGridControlModel);
Reference< XPropertySet > xSourceSet(_xGridControlModel, UNO_QUERY);
if (xSourceSet.is())
@@ -1461,7 +1428,6 @@ void SbaTableQueryBrowser::addModelListeners(const Reference< ::com::sun::star::
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::removeModelListeners(const Reference< ::com::sun::star::awt::XControlModel > & _xGridControlModel)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::removeModelListeners" );
SbaXDataBrowserController::removeModelListeners(_xGridControlModel);
Reference< XPropertySet > xSourceSet(_xGridControlModel, UNO_QUERY);
if (xSourceSet.is())
@@ -1477,7 +1443,6 @@ void SbaTableQueryBrowser::removeModelListeners(const Reference< ::com::sun::sta
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::RowChanged()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::RowChanged" );
if(getBrowserView())
{
SbaGridControl* pControl = getBrowserView()->getVclControl();
@@ -1490,7 +1455,6 @@ void SbaTableQueryBrowser::RowChanged()
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::ColumnChanged()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::ColumnChanged" );
if(getBrowserView())
{
SbaGridControl* pControl = getBrowserView()->getVclControl();
@@ -1502,7 +1466,6 @@ void SbaTableQueryBrowser::ColumnChanged()
//------------------------------------------------------------------------------
void SbaTableQueryBrowser::AddColumnListener(const Reference< XPropertySet > & xCol)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::AddColumnListener" );
SbaXDataBrowserController::AddColumnListener(xCol);
SafeAddPropertyListener(xCol, PROPERTY_WIDTH, static_cast<XPropertyChangeListener*>(this));
SafeAddPropertyListener(xCol, PROPERTY_HIDDEN, static_cast<XPropertyChangeListener*>(this));
@@ -1513,7 +1476,6 @@ void SbaTableQueryBrowser::AddColumnListener(const Reference< XPropertySet > & x
//------------------------------------------------------------------------------
void SbaTableQueryBrowser::RemoveColumnListener(const Reference< XPropertySet > & xCol)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::RemoveColumnListener" );
SbaXDataBrowserController::RemoveColumnListener(xCol);
SafeRemovePropertyListener(xCol, PROPERTY_WIDTH, static_cast<XPropertyChangeListener*>(this));
SafeRemovePropertyListener(xCol, PROPERTY_HIDDEN, static_cast<XPropertyChangeListener*>(this));
@@ -1524,7 +1486,6 @@ void SbaTableQueryBrowser::RemoveColumnListener(const Reference< XPropertySet >
//------------------------------------------------------------------------------
void SbaTableQueryBrowser::criticalFail()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::criticalFail" );
SbaXDataBrowserController::criticalFail();
unloadAndCleanup( sal_False );
}
@@ -1532,7 +1493,6 @@ void SbaTableQueryBrowser::criticalFail()
//------------------------------------------------------------------------------
void SbaTableQueryBrowser::LoadFinished(sal_Bool _bWasSynch)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::LoadFinished" );
SbaXDataBrowserController::LoadFinished(_bWasSynch);
m_sQueryCommand = ::rtl::OUString();
@@ -1554,7 +1514,6 @@ void SbaTableQueryBrowser::LoadFinished(sal_Bool _bWasSynch)
//------------------------------------------------------------------------------
sal_Bool SbaTableQueryBrowser::getExternalSlotState( sal_uInt16 _nId ) const
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getExternalSlotState" );
sal_Bool bEnabled = sal_False;
ExternalFeaturesMap::const_iterator aPos = m_aExternalFeatures.find( _nId );
if ( ( m_aExternalFeatures.end() != aPos ) && aPos->second.xDispatcher.is() )
@@ -1565,7 +1524,6 @@ sal_Bool SbaTableQueryBrowser::getExternalSlotState( sal_uInt16 _nId ) const
//------------------------------------------------------------------------------
FeatureState SbaTableQueryBrowser::GetState(sal_uInt16 nId) const
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::GetState" );
FeatureState aReturn;
// (disabled automatically)
@@ -1767,7 +1725,6 @@ FeatureState SbaTableQueryBrowser::GetState(sal_uInt16 nId) const
//------------------------------------------------------------------------------
void SbaTableQueryBrowser::Execute(sal_uInt16 nId, const Sequence< PropertyValue >& aArgs)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::Execute" );
switch (nId)
{
default:
@@ -1953,12 +1910,20 @@ void SbaTableQueryBrowser::Execute(sal_uInt16 nId, const Sequence< PropertyValue
break;
}
}
+
+// -------------------------------------------------------------------------
+void SbaTableQueryBrowser::implAddDatasource( const String& _rDataSourceName, const SharedConnection& _rxConnection )
+{
+ Image a, b, c;
+ String d, e;
+ implAddDatasource( _rDataSourceName, a, d, b, e, c, _rxConnection );
+}
+
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::implAddDatasource(const String& _rDbName, Image& _rDbImage,
String& _rQueryName, Image& _rQueryImage, String& _rTableName, Image& _rTableImage,
const SharedConnection& _rxConnection)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::implAddDatasource" );
vos::OGuard aGuard( Application::GetSolarMutex() );
// initialize the names/images if necessary
if (!_rQueryName.Len())
@@ -2012,7 +1977,6 @@ void SbaTableQueryBrowser::implAddDatasource(const String& _rDbName, Image& _rDb
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::initializeTreeModel()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::initializeTreeModel" );
if (m_xDatabaseContext.is())
{
Image aDBImage, aQueriesImage, aTablesImage;
@@ -2031,7 +1995,6 @@ sal_Bool SbaTableQueryBrowser::populateTree(const Reference<XNameAccess>& _xName
SvLBoxEntry* _pParent,
EntryType _eEntryType)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::populateTree" );
DBTreeListUserData* pData = static_cast<DBTreeListUserData*>(_pParent->GetUserData());
if(pData) // don't ask if the nameaccess is already set see OnExpandEntry views and tables
pData->xContainer = _xNameAccess;
@@ -2062,7 +2025,6 @@ sal_Bool SbaTableQueryBrowser::populateTree(const Reference<XNameAccess>& _xName
//------------------------------------------------------------------------------
void SbaTableQueryBrowser::implAppendEntry( SvLBoxEntry* _pParent, const String& _rName, void* _pUserData, EntryType _eEntryType )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::implAppendEntry" );
::std::auto_ptr< ImageProvider > pImageProvider( getImageProviderFor( _pParent ) );
Image aImage, aImageHC;
@@ -2079,7 +2041,6 @@ void SbaTableQueryBrowser::implAppendEntry( SvLBoxEntry* _pParent, const String&
//------------------------------------------------------------------------------
IMPL_LINK(SbaTableQueryBrowser, OnExpandEntry, SvLBoxEntry*, _pParent)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::OnExpandEntry" );
if (_pParent->HasChilds())
// nothing to to ...
return 1L;
@@ -2182,7 +2143,6 @@ IMPL_LINK(SbaTableQueryBrowser, OnExpandEntry, SvLBoxEntry*, _pParent)
//------------------------------------------------------------------------------
sal_Bool SbaTableQueryBrowser::ensureEntryObject( SvLBoxEntry* _pEntry )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::ensureEntryObject" );
DBG_ASSERT(_pEntry, "SbaTableQueryBrowser::ensureEntryObject: invalid argument!");
if (!_pEntry)
return sal_False;
@@ -2242,7 +2202,6 @@ sal_Bool SbaTableQueryBrowser::ensureEntryObject( SvLBoxEntry* _pEntry )
//------------------------------------------------------------------------------
sal_Bool SbaTableQueryBrowser::implSelect(const ::svx::ODataAccessDescriptor& _rDescriptor,sal_Bool _bSelectDirect)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::implSelect(_rDescriptor,_bSelectDirect)" );
// extract the props
::rtl::OUString sDataSource;
::rtl::OUString sCommand;
@@ -2258,7 +2217,6 @@ sal_Bool SbaTableQueryBrowser::implSelect(const ::svx::ODataAccessDescriptor& _r
sal_Bool SbaTableQueryBrowser::implLoadAnything(const ::rtl::OUString& _rDataSourceName, const ::rtl::OUString& _rCommand,
const sal_Int32 _nCommandType, const sal_Bool _bEscapeProcessing, const SharedConnection& _rxConnection)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::implLoadAnything" );
Reference<XPropertySet> xProp(getRowSet(),UNO_QUERY);
if(xProp.is())
{
@@ -2341,7 +2299,6 @@ sal_Bool SbaTableQueryBrowser::implSelect(const ::rtl::OUString& _rDataSourceNam
const SharedConnection& _rxConnection
,sal_Bool _bSelectDirect)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::implSelect(_rDataSourceName,_rCommand,...)" );
if (_rDataSourceName.getLength() && _rCommand.getLength() && (-1 != _nCommandType))
{
SvLBoxEntry* pDataSource = NULL;
@@ -2390,7 +2347,6 @@ IMPL_LINK(SbaTableQueryBrowser, OnSelectionChange, void*, /*NOINTERESTEDIN*/)
//------------------------------------------------------------------------------
bool SbaTableQueryBrowser::implSelect( SvLBoxEntry* _pEntry )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::implSelect(_pEntry)" );
if ( !_pEntry )
return false;
@@ -2584,7 +2540,6 @@ bool SbaTableQueryBrowser::implSelect( SvLBoxEntry* _pEntry )
// -----------------------------------------------------------------------------
SvLBoxEntry* SbaTableQueryBrowser::getEntryFromContainer(const Reference<XNameAccess>& _rxNameAccess)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getEntryFromContainer" );
DBTreeListBox& rListBox = m_pTreeView->getListBox();
SvLBoxEntry* pContainer = NULL;
SvLBoxEntry* pDSLoop = rListBox.FirstChild(NULL);
@@ -2609,7 +2564,6 @@ SvLBoxEntry* SbaTableQueryBrowser::getEntryFromContainer(const Reference<XNameAc
// -------------------------------------------------------------------------
void SAL_CALL SbaTableQueryBrowser::elementInserted( const ContainerEvent& _rEvent ) throw(RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::elementInserted" );
vos::OGuard aSolarGuard( Application::GetSolarMutex() );
Reference< XNameAccess > xNames(_rEvent.Source, UNO_QUERY);
@@ -2641,24 +2595,12 @@ void SAL_CALL SbaTableQueryBrowser::elementInserted( const ContainerEvent& _rEve
}
implAppendEntry( pEntry, ::comphelper::getString( _rEvent.Accessor ), pNewData, pNewData->eType );
}
- else if (xNames.get() == m_xDatabaseContext.get())
- { // a new datasource has been added to the context
- // the name of the new ds
- ::rtl::OUString sNewDS;
- _rEvent.Accessor >>= sNewDS;
-
- // add new entries to the list box model
- Image a, b, c; // not interested in reusing them
- String e, f;
- implAddDatasource( sNewDS, a, e, b, f, c, SharedConnection() );
- }
else
SbaXDataBrowserController::elementInserted(_rEvent);
}
// -------------------------------------------------------------------------
sal_Bool SbaTableQueryBrowser::isCurrentlyDisplayedChanged(const String& _sName,SvLBoxEntry* _pContainer)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::isCurrentlyDisplayedChanged" );
return m_pCurrentlyDisplayed
&& getEntryType(m_pCurrentlyDisplayed) == getChildType(_pContainer)
&& m_pTreeView->getListBox().GetParent(m_pCurrentlyDisplayed) == _pContainer
@@ -2667,7 +2609,6 @@ sal_Bool SbaTableQueryBrowser::isCurrentlyDisplayedChanged(const String& _sName,
// -------------------------------------------------------------------------
void SAL_CALL SbaTableQueryBrowser::elementRemoved( const ContainerEvent& _rEvent ) throw(RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::elementRemoved" );
::vos::OGuard aSolarGuard(Application::GetSolarMutex());
Reference< XNameAccess > xNames(_rEvent.Source, UNO_QUERY);
@@ -2714,62 +2655,6 @@ void SAL_CALL SbaTableQueryBrowser::elementRemoved( const ContainerEvent& _rEven
// maybe the object which is part of the document data source has been removed
checkDocumentDataSource();
}
- else if (xNames.get() == m_xDatabaseContext.get())
- { // a datasource has been removed from the context
-
- // the name
- ::rtl::OUString sNewDS;
- _rEvent.Accessor >>= sNewDS;
- String sNewDatasource = sNewDS;
-
- // get the top-level representing the removed data source
- SvLBoxEntry* pDSLoop = m_pTreeView->getListBox().FirstChild(NULL);
- while (pDSLoop)
- {
- if (m_pTreeView->getListBox().GetEntryText(pDSLoop) == sNewDatasource)
- break;
-
- pDSLoop = m_pTreeView->getListBox().NextSibling(pDSLoop);
- }
-
- if (pDSLoop)
- {
- if (isSelected(pDSLoop))
- { // a table or query belonging to the deleted data source is currently beeing displayed.
- OSL_ENSURE(m_pTreeView->getListBox().GetRootLevelParent(m_pCurrentlyDisplayed) == pDSLoop, "SbaTableQueryBrowser::elementRemoved: inconsistence (1)!");
- unloadAndCleanup( sal_True );
- }
- else
- OSL_ENSURE(
- (NULL == m_pCurrentlyDisplayed)
- || (m_pTreeView->getListBox().GetRootLevelParent(m_pCurrentlyDisplayed) != pDSLoop), "SbaTableQueryBrowser::elementRemoved: inconsistence (2)!");
-
- // look for user data to delete
- SvTreeEntryList* pList = m_pTreeModel->GetChildList(pDSLoop);
- if(pList)
- {
- SvLBoxEntry* pEntryLoop = static_cast<SvLBoxEntry*>(pList->First());
- while (pEntryLoop)
- {
- DBTreeListUserData* pData = static_cast<DBTreeListUserData*>(pEntryLoop->GetUserData());
- pEntryLoop->SetUserData(NULL);
- delete pData;
- pEntryLoop = static_cast<SvLBoxEntry*>(pList->Next());
- }
- }
- // remove the entry. This should remove all children, too.
- DBTreeListUserData* pData = static_cast<DBTreeListUserData*>(pDSLoop->GetUserData());
- pDSLoop->SetUserData(NULL);
- delete pData;
- m_pTreeModel->Remove(pDSLoop);
- }
- else {
- DBG_ERROR("SbaTableQueryBrowser::elementRemoved: unknown datasource name!");
- }
-
- // maybe the object which is part of the document data source has been removed
- checkDocumentDataSource();
- }
else
SbaXDataBrowserController::elementRemoved(_rEvent);
}
@@ -2777,7 +2662,6 @@ void SAL_CALL SbaTableQueryBrowser::elementRemoved( const ContainerEvent& _rEven
// -------------------------------------------------------------------------
void SAL_CALL SbaTableQueryBrowser::elementReplaced( const ContainerEvent& _rEvent ) throw(RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::elementReplaced" );
::vos::OGuard aSolarGuard(Application::GetSolarMutex());
Reference< XNameAccess > xNames(_rEvent.Source, UNO_QUERY);
@@ -2850,7 +2734,6 @@ void SAL_CALL SbaTableQueryBrowser::elementReplaced( const ContainerEvent& _rEve
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::impl_releaseConnection( SharedConnection& _rxConnection )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::impl_releaseConnection" );
// remove as event listener
Reference< XComponent > xComponent( _rxConnection, UNO_QUERY );
if ( xComponent.is() )
@@ -2879,7 +2762,6 @@ void SbaTableQueryBrowser::impl_releaseConnection( SharedConnection& _rxConnecti
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::disposeConnection( SvLBoxEntry* _pDSEntry )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::disposeConnection" );
DBG_ASSERT( _pDSEntry, "SbaTableQueryBrowser::disposeConnection: invalid entry (NULL)!" );
DBG_ASSERT( impl_isDataSourceEntry( _pDSEntry ), "SbaTableQueryBrowser::disposeConnection: invalid entry (not top-level)!" );
@@ -2894,7 +2776,6 @@ void SbaTableQueryBrowser::disposeConnection( SvLBoxEntry* _pDSEntry )
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::closeConnection(SvLBoxEntry* _pDSEntry,sal_Bool _bDisposeConnection)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::closeConnection" );
DBG_ASSERT(_pDSEntry, "SbaTableQueryBrowser::closeConnection: invalid entry (NULL)!");
DBG_ASSERT( impl_isDataSourceEntry( _pDSEntry ), "SbaTableQueryBrowser::closeConnection: invalid entry (not top-level)!");
@@ -2931,7 +2812,6 @@ void SbaTableQueryBrowser::closeConnection(SvLBoxEntry* _pDSEntry,sal_Bool _bDis
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::unloadAndCleanup( sal_Bool _bDisposeConnection )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::unloadAndCleanup" );
if (!m_pCurrentlyDisplayed)
// nothing to do
return;
@@ -3019,7 +2899,6 @@ namespace
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::impl_initialize()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::impl_initialize" );
::vos::OGuard aGuard(Application::GetSolarMutex());
// doin' a lot of VCL stuff here -> lock the SolarMutex
@@ -3153,12 +3032,7 @@ void SbaTableQueryBrowser::impl_initialize()
}
}
- Image aDBImage, aQueriesImage, aTablesImage;
- String sQueriesName, sTablesName;
-
- implAddDatasource( sInitialDataSourceName,
- aDBImage, sQueriesName, aQueriesImage, sTablesName, aTablesImage, xConnection
- );
+ implAddDatasource( sInitialDataSourceName, xConnection );
m_pTreeView->getListBox().Expand( m_pTreeView->getListBox().First() );
}
else
@@ -3199,14 +3073,12 @@ void SbaTableQueryBrowser::impl_initialize()
// -------------------------------------------------------------------------
sal_Bool SbaTableQueryBrowser::haveExplorer() const
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::haveExplorer" );
return m_pTreeView && m_pTreeView->IsVisible();
}
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::hideExplorer()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::hideExplorer" );
if (!haveExplorer())
return;
if (!getBrowserView())
@@ -3222,7 +3094,6 @@ void SbaTableQueryBrowser::hideExplorer()
// -------------------------------------------------------------------------
void SbaTableQueryBrowser::showExplorer()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::showExplorer" );
if (haveExplorer())
return;
@@ -3239,7 +3110,6 @@ void SbaTableQueryBrowser::showExplorer()
// -----------------------------------------------------------------------------
sal_Bool SbaTableQueryBrowser::ensureConnection(SvLBoxEntry* _pAnyEntry, SharedConnection& _rConnection)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::ensureConnection" );
SvLBoxEntry* pDSEntry = m_pTreeView->getListBox().GetRootLevelParent(_pAnyEntry);
DBTreeListUserData* pDSData =
pDSEntry
@@ -3252,7 +3122,6 @@ sal_Bool SbaTableQueryBrowser::ensureConnection(SvLBoxEntry* _pAnyEntry, SharedC
// -----------------------------------------------------------------------------
::std::auto_ptr< ImageProvider > SbaTableQueryBrowser::getImageProviderFor( SvLBoxEntry* _pAnyEntry )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getImageProviderFor" );
::std::auto_ptr< ImageProvider > pImageProvider( new ImageProvider );
SharedConnection xConnection;
if ( getExistentConnectionFor( _pAnyEntry, xConnection ) )
@@ -3263,7 +3132,6 @@ sal_Bool SbaTableQueryBrowser::ensureConnection(SvLBoxEntry* _pAnyEntry, SharedC
// -----------------------------------------------------------------------------
sal_Bool SbaTableQueryBrowser::getExistentConnectionFor( SvLBoxEntry* _pAnyEntry, SharedConnection& _rConnection )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getExistentConnectionFor" );
SvLBoxEntry* pDSEntry = m_pTreeView->getListBox().GetRootLevelParent( _pAnyEntry );
DBTreeListUserData* pDSData =
pDSEntry
@@ -3278,7 +3146,6 @@ sal_Bool SbaTableQueryBrowser::getExistentConnectionFor( SvLBoxEntry* _pAnyEntry
// -----------------------------------------------------------------------------
bool SbaTableQueryBrowser::impl_isDataSourceEntry( SvLBoxEntry* _pEntry ) const
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::impl_isDataSourceEntry" );
return m_pTreeModel->GetRootLevelParent( _pEntry ) == _pEntry;
}
#endif
@@ -3286,7 +3153,6 @@ bool SbaTableQueryBrowser::impl_isDataSourceEntry( SvLBoxEntry* _pEntry ) const
// -----------------------------------------------------------------------------
sal_Bool SbaTableQueryBrowser::ensureConnection( SvLBoxEntry* _pDSEntry, void* pDSData, SharedConnection& _rConnection )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::ensureConnection" );
DBG_ASSERT( impl_isDataSourceEntry( _pDSEntry ), "SbaTableQueryBrowser::ensureConnection: this entry does not denote a data source!" );
if(_pDSEntry)
{
@@ -3389,7 +3255,6 @@ IMPL_LINK( SbaTableQueryBrowser, OnTreeEntryCompare, const SvSortData*, _pSortDa
// -----------------------------------------------------------------------------
void SbaTableQueryBrowser::implAdministrate( SvLBoxEntry* _pApplyTo )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::implAdministrate" );
OSL_PRECOND( _pApplyTo, "SbaTableQueryBrowser::implAdministrate: illegal entry!" );
if ( !_pApplyTo )
return;
@@ -3447,7 +3312,6 @@ void SbaTableQueryBrowser::implAdministrate( SvLBoxEntry* _pApplyTo )
// -----------------------------------------------------------------------------
sal_Bool SbaTableQueryBrowser::requestQuickHelp( const SvLBoxEntry* _pEntry, String& _rText ) const
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::requestQuickHelp" );
const DBTreeListUserData* pData = static_cast< const DBTreeListUserData* >( _pEntry->GetUserData() );
if ( ( pData->eType == etDatasource ) && pData->sAccessor.Len() )
{
@@ -3460,7 +3324,6 @@ sal_Bool SbaTableQueryBrowser::requestQuickHelp( const SvLBoxEntry* _pEntry, Str
// -----------------------------------------------------------------------------
PopupMenu* SbaTableQueryBrowser::getContextMenu( Control& _rControl ) const
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getContextMenu" );
OSL_PRECOND( &m_pTreeView->getListBox() == &_rControl,
"SbaTableQueryBrowser::getContextMenu: where does this come from?" );
if ( &m_pTreeView->getListBox() != &_rControl )
@@ -3472,21 +3335,18 @@ PopupMenu* SbaTableQueryBrowser::getContextMenu( Control& _rControl ) const
// -----------------------------------------------------------------------------
IController& SbaTableQueryBrowser::getCommandController()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getCommandController" );
return *this;
}
// -----------------------------------------------------------------------------
::cppu::OInterfaceContainerHelper* SbaTableQueryBrowser::getContextMenuInterceptors()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getContextMenuInterceptors" );
return &m_aContextMenuInterceptors;
}
// -----------------------------------------------------------------------------
Any SbaTableQueryBrowser::getCurrentSelection( Control& _rControl ) const
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getCurrentSelection" );
OSL_PRECOND( &m_pTreeView->getListBox() == &_rControl,
"SbaTableQueryBrowser::getCurrentSelection: where does this come from?" );
@@ -3528,7 +3388,6 @@ Any SbaTableQueryBrowser::getCurrentSelection( Control& _rControl ) const
// -----------------------------------------------------------------------------
sal_Bool SbaTableQueryBrowser::implGetQuerySignature( ::rtl::OUString& _rCommand, sal_Bool& _bEscapeProcessing )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::implGetQuerySignature" );
_rCommand = ::rtl::OUString();
_bEscapeProcessing = sal_False;
@@ -3577,7 +3436,6 @@ sal_Bool SbaTableQueryBrowser::implGetQuerySignature( ::rtl::OUString& _rCommand
//------------------------------------------------------------------------------
void SbaTableQueryBrowser::frameAction(const ::com::sun::star::frame::FrameActionEvent& aEvent) throw( RuntimeException )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::frameAction" );
if (aEvent.Frame == m_xCurrentFrameParent)
{
if(aEvent.Action == FrameAction_COMPONENT_DETACHING)
@@ -3592,7 +3450,6 @@ void SbaTableQueryBrowser::frameAction(const ::com::sun::star::frame::FrameActio
// -----------------------------------------------------------------------------
void SbaTableQueryBrowser::clearGridColumns(const Reference< XNameContainer >& _xColContainer)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::clearGridColumns" );
// first we have to clear the grid
Sequence< ::rtl::OUString > aNames = _xColContainer->getElementNames();
const ::rtl::OUString* pIter = aNames.getConstArray();
@@ -3608,7 +3465,6 @@ void SbaTableQueryBrowser::clearGridColumns(const Reference< XNameContainer >& _
// -----------------------------------------------------------------------------
sal_Bool SbaTableQueryBrowser::isHiContrast() const
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::isHiContrast" );
sal_Bool bRet = sal_False;
if ( m_pTreeView )
bRet = m_pTreeView->getListBox().GetBackground().GetColor().IsDark();
@@ -3617,7 +3473,6 @@ sal_Bool SbaTableQueryBrowser::isHiContrast() const
// -----------------------------------------------------------------------------
void SbaTableQueryBrowser::loadMenu(const Reference< XFrame >& _xFrame)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::loadMenu" );
if ( m_bShowMenu )
{
OGenericUnoController::loadMenu(_xFrame);
@@ -3639,7 +3494,6 @@ void SbaTableQueryBrowser::loadMenu(const Reference< XFrame >& _xFrame)
// -----------------------------------------------------------------------------
::rtl::OUString SbaTableQueryBrowser::getPrivateTitle() const
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getPrivateTitle" );
::rtl::OUString sTitle;
if ( m_pCurrentlyDisplayed )
{
@@ -3664,7 +3518,6 @@ void SbaTableQueryBrowser::loadMenu(const Reference< XFrame >& _xFrame)
// -----------------------------------------------------------------------------
sal_Bool SbaTableQueryBrowser::preReloadForm()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::preReloadForm" );
sal_Bool bIni = sal_False;
if ( !m_pCurrentlyDisplayed )
{
@@ -3693,7 +3546,6 @@ sal_Bool SbaTableQueryBrowser::preReloadForm()
// -----------------------------------------------------------------------------
void SbaTableQueryBrowser::postReloadForm()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::postReloadForm" );
InitializeGridModel(getFormComponent());
LoadFinished(sal_True);
//updateTitle();
@@ -3702,7 +3554,6 @@ void SbaTableQueryBrowser::postReloadForm()
//------------------------------------------------------------------------------
Reference< XEmbeddedScripts > SAL_CALL SbaTableQueryBrowser::getScriptContainer() throw (RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getScriptContainer" );
// update our database document
Reference< XModel > xDocument;
try
@@ -3729,7 +3580,6 @@ Reference< XEmbeddedScripts > SAL_CALL SbaTableQueryBrowser::getScriptContainer(
//------------------------------------------------------------------------------
void SAL_CALL SbaTableQueryBrowser::registerContextMenuInterceptor( const Reference< XContextMenuInterceptor >& _Interceptor ) throw (RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::registerContextMenuInterceptor" );
if ( _Interceptor.is() )
m_aContextMenuInterceptors.addInterface( _Interceptor );
}
@@ -3737,10 +3587,90 @@ void SAL_CALL SbaTableQueryBrowser::registerContextMenuInterceptor( const Refere
//------------------------------------------------------------------------------
void SAL_CALL SbaTableQueryBrowser::releaseContextMenuInterceptor( const Reference< XContextMenuInterceptor >& _Interceptor ) throw (RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::releaseContextMenuInterceptor" );
- m_aContextMenuInterceptors.removeInterface( _Interceptor );
+ if ( _Interceptor.is() )
+ m_aContextMenuInterceptors.removeInterface( _Interceptor );
}
+//------------------------------------------------------------------------------
+void SAL_CALL SbaTableQueryBrowser::registeredDatabaseLocation( const DatabaseRegistrationEvent& _Event ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ implAddDatasource( _Event.Name, SharedConnection() );
+}
+
+//------------------------------------------------------------------------------
+void SbaTableQueryBrowser::impl_cleanupDataSourceEntry( const String& _rDataSourceName )
+{
+ // get the top-level representing the removed data source
+ SvLBoxEntry* pDataSourceEntry = m_pTreeView->getListBox().FirstChild( NULL );
+ while ( pDataSourceEntry )
+ {
+ if ( m_pTreeView->getListBox().GetEntryText( pDataSourceEntry ) == _rDataSourceName )
+ break;
+
+ pDataSourceEntry = m_pTreeView->getListBox().NextSibling( pDataSourceEntry );
+ }
+
+ OSL_ENSURE( pDataSourceEntry, "SbaTableQueryBrowser::impl_cleanupDataSourceEntry: do not know this data source!" );
+ if ( !pDataSourceEntry )
+ return;
+
+ if ( isSelected( pDataSourceEntry ) )
+ { // a table or query belonging to the deleted data source is currently beeing displayed.
+ OSL_ENSURE( m_pTreeView->getListBox().GetRootLevelParent( m_pCurrentlyDisplayed ) == pDataSourceEntry,
+ "SbaTableQueryBrowser::impl_cleanupDataSourceEntry: inconsistence (1)!" );
+ unloadAndCleanup( sal_True );
+ }
+ else
+ OSL_ENSURE(
+ ( NULL == m_pCurrentlyDisplayed )
+ || ( m_pTreeView->getListBox().GetRootLevelParent( m_pCurrentlyDisplayed ) != pDataSourceEntry ),
+ "SbaTableQueryBrowser::impl_cleanupDataSourceEntry: inconsistence (2)!");
+
+ // delete any user data of the child entries of the to-be-removed entry
+ SvTreeEntryList* pList = m_pTreeModel->GetChildList( pDataSourceEntry );
+ if ( pList )
+ {
+ SvLBoxEntry* pEntryLoop = static_cast<SvLBoxEntry*>( pList->First() );
+ while ( pEntryLoop )
+ {
+ DBTreeListUserData* pData = static_cast< DBTreeListUserData* >( pEntryLoop->GetUserData() );
+ pEntryLoop->SetUserData( NULL );
+ delete pData;
+ pEntryLoop = static_cast< SvLBoxEntry* >( pList->Next() );
+ }
+ }
+
+ // remove the entry
+ DBTreeListUserData* pData = static_cast< DBTreeListUserData* >( pDataSourceEntry->GetUserData() );
+ pDataSourceEntry->SetUserData( NULL );
+ delete pData;
+ m_pTreeModel->Remove( pDataSourceEntry );
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL SbaTableQueryBrowser::revokedDatabaseLocation( const DatabaseRegistrationEvent& _Event ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ impl_cleanupDataSourceEntry( _Event.Name );
+
+ // maybe the object which is part of the document data source has been removed
+ checkDocumentDataSource();
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL SbaTableQueryBrowser::changedDatabaseLocation( const DatabaseRegistrationEvent& _Event ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ // in case the data source was expanded, and connected, we need to clean it up
+ // for simplicity, just do as if the data source were completely removed and re-added
+ impl_cleanupDataSourceEntry( _Event.Name );
+ implAddDatasource( _Event.Name, SharedConnection() );
+}
+
+
// .........................................................................
} // namespace dbaui
// .........................................................................
diff --git a/dbaccess/source/ui/inc/unodatbr.hxx b/dbaccess/source/ui/inc/unodatbr.hxx
index c6315cc1db22..23d9cfd5b542 100644
--- a/dbaccess/source/ui/inc/unodatbr.hxx
+++ b/dbaccess/source/ui/inc/unodatbr.hxx
@@ -70,8 +70,11 @@
#ifndef _COM_SUN_STAR_SDB_APPLICATION_DATABASEOBJECTCONTAINER_HPP_
#include <com/sun/star/sdb/application/DatabaseObjectContainer.hpp>
#endif
-#ifndef _CPPUHELPER_IMPLBASE4_HXX_
-#include <cppuhelper/implbase4.hxx>
+#ifndef _COM_SUN_STAR_SDB_DATABASEOBJECTCONTAINER_HPP_
+#include <com/sun/star/sdb/XDatabaseRegistrationsListener.hpp>
+#endif
+#ifndef _CPPUHELPER_IMPLBASE5_HXX_
+#include <cppuhelper/implbase5.hxx>
#endif
#ifndef _DBACCESS_UI_CALLBACKS_HXX_
#include "callbacks.hxx"
@@ -113,10 +116,11 @@ namespace dbaui
class ImageProvider;
// =====================================================================
- typedef ::cppu::ImplHelper4 < ::com::sun::star::frame::XStatusListener
+ typedef ::cppu::ImplHelper5 < ::com::sun::star::frame::XStatusListener
, ::com::sun::star::view::XSelectionSupplier
, ::com::sun::star::document::XScriptInvocationContext
, ::com::sun::star::ui::XContextMenuInterception
+ , ::com::sun::star::sdb::XDatabaseRegistrationsListener
> SbaTableQueryBrowser_Base;
class SbaTableQueryBrowser
:public SbaXDataBrowserController
@@ -256,6 +260,11 @@ namespace dbaui
virtual void SAL_CALL registerContextMenuInterceptor( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XContextMenuInterceptor >& Interceptor ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL releaseContextMenuInterceptor( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XContextMenuInterceptor >& Interceptor ) throw (::com::sun::star::uno::RuntimeException);
+ // XDatabaseRegistrationsListener
+ virtual void SAL_CALL registeredDatabaseLocation( const ::com::sun::star::sdb::DatabaseRegistrationEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL revokedDatabaseLocation( const ::com::sun::star::sdb::DatabaseRegistrationEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL changedDatabaseLocation( const ::com::sun::star::sdb::DatabaseRegistrationEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+
protected:
// SbaXDataBrowserController overridables
virtual sal_Bool InitializeForm(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > & xForm);
@@ -339,6 +348,11 @@ namespace dbaui
const SharedConnection& _rxConnection
);
+ void implAddDatasource( const String& _rDataSourceName, const SharedConnection& _rxConnection );
+
+ /// removes (and cleans up) the entry for the given data source
+ void impl_cleanupDataSourceEntry( const String& _rDataSourceName );
+
/// clears the tree list box
void clearTreeModel();