Tag: cws_src680_hsqlcsvstage1
User: fs      
Date: 2006/09/20 04:06:28

Added:
   dba/connectivity/source/drivers/hsqldb/hsqlui.hrc
   dba/connectivity/source/drivers/hsqldb/hsqlui.src

Modified:
   dba/connectivity/source/commontools/dbtools.cxx
   dba/connectivity/source/drivers/hsqldb/HConnection.cxx
   dba/connectivity/source/drivers/hsqldb/HDriver.cxx
   dba/connectivity/source/drivers/hsqldb/makefile.mk
   dba/connectivity/source/inc/hsqldb/HConnection.hxx

Log:
 #i69696#, being stage 1 of issue #i69526#: merging changes from CWS hsqlcsv 
herein

File Changes:

Directory: /dba/connectivity/source/commontools/
================================================

File [changed]: dbtools.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/commontools/dbtools.cxx?r1=1.64&r2=1.64.2.1
Delta lines:  +7 -7
-------------------
--- dbtools.cxx 17 Sep 2006 02:02:59 -0000      1.64
+++ dbtools.cxx 20 Sep 2006 11:06:19 -0000      1.64.2.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: dbtools.cxx,v $
  *
- *  $Revision: 1.64 $
+ *  $Revision: 1.64.2.1 $
  *
- *  last change: $Author: obo $ $Date: 2006/09/17 02:02:59 $
+ *  last change: $Author: fs $ $Date: 2006/09/20 11:06:19 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -964,13 +964,13 @@
 void qualifiedNameComponents(const Reference< XDatabaseMetaData >& 
_rxConnMetaData, const ::rtl::OUString& _rQualifiedName, ::rtl::OUString& 
_rCatalog, ::rtl::OUString& _rSchema, ::rtl::OUString& _rName,EComposeRule 
_eComposeRule)
 {
        OSL_ENSURE(_rxConnMetaData.is(), "QualifiedNameComponents : invalid 
meta data!");
-    OSL_ENSURE( _eComposeRule == eInDataManipulation, 
"qualifiedNameComponents: un-implemented case!" );
-    OSL_UNUSED( _eComposeRule );
+    OSL_ENSURE( ( _eComposeRule == eInDataManipulation ) || ( _eComposeRule == 
eComplete ), "qualifiedNameComponents: un-implemented case!" );
+    bool bComplete = ( _eComposeRule == eComplete );
        ::rtl::OUString sSeparator = _rxConnMetaData->getCatalogSeparator();
 
        ::rtl::OUString sName(_rQualifiedName);
        // do we have catalogs ?
-       if ( _rxConnMetaData->supportsCatalogsInDataManipulation() )
+       if ( bComplete || _rxConnMetaData->supportsCatalogsInDataManipulation() 
)
        {
                if (_rxConnMetaData->isCatalogAtStart())
                {
@@ -994,7 +994,7 @@
                }
        }
 
-       if ( _rxConnMetaData->supportsSchemasInDataManipulation() )
+       if ( bComplete || _rxConnMetaData->supportsSchemasInDataManipulation() )
        {
                sal_Int32 nIndex = sName.indexOf((sal_Unicode)'.');
                //      OSL_ENSURE(-1 != nIndex, "QualifiedNameComponents : no 
schema separator!");

Directory: /dba/connectivity/source/drivers/hsqldb/
===================================================

File [changed]: HConnection.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/hsqldb/HConnection.cxx?r1=1.6&r2=1.6.2.1
Delta lines:  +399 -109
-----------------------
--- HConnection.cxx     17 Sep 2006 02:40:10 -0000      1.6
+++ HConnection.cxx     20 Sep 2006 11:06:19 -0000      1.6.2.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: HConnection.cxx,v $
  *
- *  $Revision: 1.6 $
+ *  $Revision: 1.6.2.1 $
  *
- *  last change: $Author: obo $ $Date: 2006/09/17 02:40:10 $
+ *  last change: $Author: fs $ $Date: 2006/09/20 11:06:19 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -35,7 +35,44 @@
 
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_connectivity.hxx"
+
+#ifndef CONNECTIVITY_HSQLDB_CONNECTION_HXX
 #include "hsqldb/HConnection.hxx"
+#endif
+#ifndef CONNECTIVITY_HSQLUI_HRC
+#include "hsqlui.hrc"
+#endif
+
+/** === begin UNO includes === **/
+#ifndef _COM_SUN_STAR_BEANS_NAMEDVALUE_HPP_
+#include <com/sun/star/beans/NamedValue.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
+#include <com/sun/star/container/XNameAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_XDATADEFINITIONSUPPLIER_HPP_
+#include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_SERVICENOTREGISTEREDEXCEPTION_HPP_
+#include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_
+#include <com/sun/star/sdbc/XRow.hpp>
+#endif
+#ifndef _COM_SUN_STAR_GRAPHIC_XGRAPHICPROVIDER_HPP_
+#include <com/sun/star/graphic/XGraphicProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_GRAPHIC_GRAPHICCOLORMODE_HPP_
+#include <com/sun/star/graphic/GraphicColorMode.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
+#include <com/sun/star/beans/PropertyValue.hpp>
+#endif
+/** === end UNO includes === **/
+
+#ifndef _CONNECTIVITY_DBTOOLS_HXX_
+#include <connectivity/dbtools.hxx>
+#endif
 
 #ifndef _COMPHELPER_SEQUENCE_HXX_
 #include <comphelper/sequence.hxx>
@@ -43,19 +80,54 @@
 #ifndef COMPHELPER_INC_COMPHELPER_LISTENERNOTIFICATION_HXX
 #include <comphelper/listenernotification.hxx>
 #endif
+#ifndef COMPHELPER_COMPONENTCONTEXT_HXX
+#include <comphelper/componentcontext.hxx>
+#endif
 
-using namespace connectivity::hsqldb;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::util;
+#ifndef TOOLS_DIAGNOSE_EX_H
+#include <tools/diagnose_ex.h>
+#endif
+
+#ifndef _RTL_USTRBUF_HXX_
+#include <rtl/ustrbuf.hxx>
+#endif
+
+/** === begin UNO using === **/
+using ::com::sun::star::util::XFlushListener;
+using ::com::sun::star::lang::EventObject;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::uno::RuntimeException;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::sdbc::XStatement;
+using ::com::sun::star::sdbc::XConnection;
+using ::com::sun::star::sdbcx::XDataDefinitionSupplier;
+using ::com::sun::star::sdbcx::XTablesSupplier;
+using ::com::sun::star::container::XNameAccess;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::beans::NamedValue;
+using ::com::sun::star::lang::WrappedTargetException;
+using ::com::sun::star::lang::ServiceNotRegisteredException;
+using ::com::sun::star::sdbc::XDriver;
+using ::com::sun::star::lang::XMultiServiceFactory;
+using ::com::sun::star::graphic::XGraphic;
+using ::com::sun::star::graphic::XGraphicProvider;
+using ::com::sun::star::uno::XInterface;
+using ::com::sun::star::lang::IllegalArgumentException;
+using ::com::sun::star::ui::dialogs::XExecutableDialog;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::makeAny;
+using ::com::sun::star::sdbc::XResultSet;
+using ::com::sun::star::sdbc::XDatabaseMetaData;
+using ::com::sun::star::sdbc::XRow;
+using ::com::sun::star::sdb::application::XDatabaseDocumentUI;
+using ::com::sun::star::beans::PropertyValue;
+/** === end UNO using === **/
+namespace GraphicColorMode = ::com::sun::star::graphic::GraphicColorMode;
 
-namespace connectivity
+namespace connectivity { namespace hsqldb
 {
-       namespace hsqldb
-       {
         // 
=============================================================================
         // = FlushListeners
         // 
=============================================================================
@@ -78,46 +150,58 @@
             _rxListener->flushed( _rEvent );
             return true;    // continue notifying the other listeners, if any
         }
-    }
-}
 
-// 
=============================================================================
-// = OConnectionWeakWrapper
-// 
=============================================================================
-// 
-----------------------------------------------------------------------------
-void SAL_CALL OConnectionWeakWrapper::disposing(void)
-{
-    m_pFlushListeners->disposing( EventObject( *this ) );
-       OConnectionWeakWrapper_BASE::disposing();
+    // 
=============================================================================
+    // = OHsqlConnection
+    // 
=============================================================================
+    // 
-----------------------------------------------------------------------------
+    void SAL_CALL OHsqlConnection::disposing(void)
+    {
+        m_aFlushListeners.disposeAndClear( EventObject( *this ) );
+           OHsqlConnection_BASE::disposing();
        OConnectionWrapper::disposing();
-}
-// 
-----------------------------------------------------------------------------
-OConnectionWeakWrapper::OConnectionWeakWrapper(
+    }
+    // 
-----------------------------------------------------------------------------
+    OHsqlConnection::OHsqlConnection( const Reference< XDriver > _rxDriver,
     const Reference< XConnection >& _xConnection ,const Reference< 
XMultiServiceFactory>& _xORB )
-    :OConnectionWeakWrapper_BASE( m_aMutex )
-    ,m_pFlushListeners( new FlushListeners( m_aMutex ) )
-{
+        :OHsqlConnection_BASE( m_aMutex )
+        ,m_aFlushListeners( m_aMutex )
+        ,m_xDriver( _rxDriver )
+        ,m_xORB( _xORB )
+    {
        setDelegation(_xConnection,_xORB,m_refCount);
-}
-// 
-----------------------------------------------------------------------------
-OConnectionWeakWrapper::~OConnectionWeakWrapper()
-{
-       if ( !OConnectionWeakWrapper_BASE::rBHelper.bDisposed )
+    }
+    // 
-----------------------------------------------------------------------------
+    OHsqlConnection::~OHsqlConnection()
+    {
+           if ( !OHsqlConnection_BASE::rBHelper.bDisposed )
        {
                osl_incrementInterlockedCount( &m_refCount );
                dispose();
        }
-}
-// 
-----------------------------------------------------------------------------
-IMPLEMENT_FORWARD_XINTERFACE2(OConnectionWeakWrapper,OConnectionWeakWrapper_BASE,OConnectionWrapper)
-IMPLEMENT_SERVICE_INFO(OConnectionWeakWrapper, 
"com.sun.star.sdbc.drivers.hsqldb.OConnectionWeakWrapper", 
"com.sun.star.sdbc.Connection")
-IMPLEMENT_FORWARD_XTYPEPROVIDER2(OConnectionWeakWrapper,OConnectionWeakWrapper_BASE,OConnectionWrapper)
-// XFlushable
-//--------------------------------------------------------------------
-void SAL_CALL OConnectionWeakWrapper::flush(  ) throw (RuntimeException)
-{
-       ::osl::MutexGuard aGuard( m_aMutex );
-       checkDisposed(rBHelper.bDisposed);
+    }
+    // 
-----------------------------------------------------------------------------
+    
IMPLEMENT_FORWARD_XINTERFACE2(OHsqlConnection,OHsqlConnection_BASE,OConnectionWrapper)
+    IMPLEMENT_SERVICE_INFO(OHsqlConnection, 
"com.sun.star.sdbc.drivers.hsqldb.OHsqlConnection", 
"com.sun.star.sdbc.Connection")
+    
IMPLEMENT_FORWARD_XTYPEPROVIDER2(OHsqlConnection,OHsqlConnection_BASE,OConnectionWrapper)
+
+    //--------------------------------------------------------------------
+    ::osl::Mutex& OHsqlConnection::getMutex() const
+    {
+        return m_aMutex;
+    }
+
+    //--------------------------------------------------------------------
+    void OHsqlConnection::checkDisposed() const
+    {
+        ::connectivity::checkDisposed( rBHelper.bDisposed );
+    }
+
+    // XFlushable
+    //--------------------------------------------------------------------
+    void SAL_CALL OHsqlConnection::flush(  ) throw (RuntimeException)
+    {
+        MethodGuard aGuard( *this );
                
        try
        {
@@ -136,25 +220,231 @@
                        Reference< XStatement > xStmt( 
m_xConnection->createStatement(), UNO_QUERY_THROW );
                        xStmt->execute( ::rtl::OUString( 
RTL_CONSTASCII_USTRINGPARAM( "CHECKPOINT" ) ) );
                }
-        m_pFlushListeners->notify( EventObject( *this ) );
+
+            EventObject aFlushedEvent( *this );
+            m_aFlushListeners.notifyEach( &XFlushListener::flushed, 
aFlushedEvent );
        }
        catch(::com::sun::star::uno::Exception&)
        {
-        OSL_ENSURE( false, "OConnectionWeakWrapper::flush: caught an 
exception!" );
+            OSL_ENSURE( false, "OHsqlConnection::flush: caught an exception!" 
);
+           }
        }
-}
 
-//--------------------------------------------------------------------
-void SAL_CALL OConnectionWeakWrapper::addFlushListener( const Reference< 
XFlushListener >& l ) throw (RuntimeException)
-{
-    m_pFlushListeners->addTypedListener( l );
-}
+    //--------------------------------------------------------------------
+    void SAL_CALL OHsqlConnection::addFlushListener( const Reference< 
XFlushListener >& l ) throw (RuntimeException)
+    {
+        MethodGuard aGuard( *this );
+        m_aFlushListeners.addInterface( l );
+    }
 
-//--------------------------------------------------------------------
-void SAL_CALL OConnectionWeakWrapper::removeFlushListener( const Reference< 
XFlushListener >& l ) throw (RuntimeException)
-{
-    m_pFlushListeners->removeTypedListener( l );
-}
+    //--------------------------------------------------------------------
+    void SAL_CALL OHsqlConnection::removeFlushListener( const Reference< 
XFlushListener >& l ) throw (RuntimeException)
+    {
+        MethodGuard aGuard( *this );
+        m_aFlushListeners.removeInterface( l );
+    }
+
+    // -------------------------------------------------------------------
+    Reference< XGraphic > SAL_CALL OHsqlConnection::getTableIcon( const 
::rtl::OUString& _TableName, ::sal_Int32 _ColorMode ) throw (RuntimeException)
+    {
+        MethodGuard aGuard( *this );
+
+        impl_checkExistingTable_throw( _TableName );
+        if ( !impl_isTextTable_nothrow( _TableName ) )
+            return NULL;
+
+        return impl_getTextTableIcon_nothrow( _ColorMode );
+    }
+
+    // -------------------------------------------------------------------
+    Reference< XInterface > SAL_CALL OHsqlConnection::getTableEditor( const 
Reference< XDatabaseDocumentUI >& _DocumentUI, const ::rtl::OUString& 
_TableName ) throw (IllegalArgumentException, WrappedTargetException, 
RuntimeException)
+    {
+        MethodGuard aGuard( *this );
+
+        impl_checkExistingTable_throw( _TableName );
+        if ( !impl_isTextTable_nothrow( _TableName ) )
+            return NULL;
+
+        if ( !_DocumentUI.is() )
+            throw IllegalArgumentException(
+                ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "The provided 
DocumentUI is not allowed to be NULL." ) ),
+                *this,
+                0
+            );
+        // TODO: resource
+
+        Reference< XExecutableDialog > xEditor = 
impl_createLinkedTableEditor_throw( _DocumentUI, _TableName );
+        return xEditor.get();
+    }
+
+    // -------------------------------------------------------------------
+    Reference< XNameAccess > OHsqlConnection::impl_getTableContainer_throw()
+    {
+        Reference< XNameAccess > xTables;
+        try
+        {
+            Reference< XConnection > xMe( *this, UNO_QUERY );
+            Reference< XDataDefinitionSupplier > xDefinitionsSupp( m_xDriver, 
UNO_QUERY_THROW );
+            Reference< XTablesSupplier > xTablesSupp( 
xDefinitionsSupp->getDataDefinitionByConnection( xMe ), UNO_QUERY_THROW );
+            xTables.set( xTablesSupp->getTables(), UNO_QUERY_THROW );
+        }
+        catch( const RuntimeException& ) { throw; }
+        catch( const Exception& )
+        {
+            throw WrappedTargetException( ::rtl::OUString::createFromAscii( 
"error while obtaining the connection's table container" ),
+                *this, ::cppu::getCaughtException() );
+            // TODO: resource
+        }
+
+        OSL_POSTCOND( xTables.is(), 
"OHsqlConnection::impl_getTableContainer_throw: post condition not met!" );
+        return xTables;
+    }
 
-// 
-----------------------------------------------------------------------------
+    // -------------------------------------------------------------------
+    Reference< XExecutableDialog > 
OHsqlConnection::impl_createLinkedTableEditor_throw( const Reference< 
XDatabaseDocumentUI >& _rxDocumentUI, const ::rtl::OUString& _rTableName )
+    {
+        OSL_PRECOND( _rxDocumentUI.is(), 
"OHsqlConnection::impl_createLinkedTableEditor_throw: illegal document UI!" );
+        Reference< XExecutableDialog > xDialog;
+        try
+        {
+            ::comphelper::ComponentContext aContext( m_xORB );
+            Sequence< Any > aArguments(3);
+            aArguments[0] <<= NamedValue(
+                ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TableContainer" 
) ),
+                makeAny( impl_getTableContainer_throw() )
+            );
+            aArguments[1] <<= NamedValue(
+                ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TableName" ) ),
+                makeAny( _rTableName )
+            );
+            aArguments[2] <<= NamedValue(
+                ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" ) 
),
+                makeAny( _rxDocumentUI->getApplicationMainWindow() )
+            );
+                
+            aContext.createComponentWithArguments( 
"com.sun.star.sdb.hsql.LinkedTableEditor", aArguments, xDialog );
+            if ( !xDialog.is() )
+                throw ServiceNotRegisteredException( 
::rtl::OUString::createFromAscii( "com.sun.star.sdb.hsql.LinkedTableEditor" ), 
*this );
+        }
+        catch( const RuntimeException& ) { throw; }
+        catch( const Exception& )
+        {
+            throw WrappedTargetException( ::rtl::OUString::createFromAscii( 
"error while creating the table editor dialog" ),
+                *this, ::cppu::getCaughtException() );
+            // TODO: resource
+        }
+        return xDialog;
+    }
+
+    // -------------------------------------------------------------------
+    void OHsqlConnection::impl_checkExistingTable_throw( const 
::rtl::OUString& _rTableName )
+    {
+        bool bDoesExist = false;
+        try
+        {
+            Reference< XNameAccess > xTables( impl_getTableContainer_throw(), 
UNO_QUERY_THROW );
+            if ( xTables.is() )
+                bDoesExist = xTables->hasByName( _rTableName );
+        }
+        catch( const Exception& )
+        {
+            // that's a serious error in impl_getTableContainer_throw, or 
hasByName, however, we're only
+            // allowed to throw an IllegalArgumentException ourself
+               DBG_UNHANDLED_EXCEPTION();
+        }
+
+        if ( !bDoesExist )
+            throw IllegalArgumentException( ::rtl::OUString( 
RTL_CONSTASCII_USTRINGPARAM( "There is no table named " ) ) + _rTableName,
+                *this, 0 );
+            // TODO: resource
+    }
+
+    // -------------------------------------------------------------------
+    bool OHsqlConnection::impl_isTextTable_nothrow( const ::rtl::OUString& 
_rTableName )
+    {
+        bool bIsTextTable = false;
+        try
+        {
+            Reference< XConnection > xMe( *this, UNO_QUERY_THROW );
+
+            // split the fully qualified name
+            Reference< XDatabaseMetaData > xMetaData( xMe->getMetaData(), 
UNO_QUERY_THROW );
+            ::rtl::OUString sCatalog, sSchema, sName;
+            ::dbtools::qualifiedNameComponents( xMetaData, _rTableName, 
sCatalog, sSchema, sName, ::dbtools::eComplete );
+
+            // get the table information
+            ::rtl::OUStringBuffer sSQL;
+            sSQL.appendAscii( "SELECT HSQLDB_TYPE FROM 
INFORMATION_SCHEMA.SYSTEM_TABLES" );
+            sSQL.appendAscii( " WHERE " );
+            if ( sCatalog.getLength() )
+            {
+                sSQL.appendAscii( "TABLE_CAT = '" );
+                sSQL.append     ( sCatalog );
+                sSQL.appendAscii( "' AND " );
+            }
+            if ( sSchema.getLength() )
+            {
+                sSQL.appendAscii( "' TABLE_SCHEM = '" );
+                sSQL.append     ( sSchema );
+                sSQL.appendAscii( "' AND " );
+            }
+            sSQL.appendAscii( "TABLE_NAME = '" );
+            sSQL.append     ( sName );
+            sSQL.appendAscii( "' AND TABLE_TYPE = '" );
+            sSQL.appendAscii( "TABLE'" );
+
+            Reference< XStatement > xStatement( xMe->createStatement(), 
UNO_QUERY_THROW );
+            Reference< XResultSet > xTableHsqlType( xStatement->executeQuery( 
sSQL.makeStringAndClear() ), UNO_QUERY_THROW );
+
+            if ( xTableHsqlType->next() )   // might not succeed in case of 
VIEWs
+            {
+                Reference< XRow > xValueAccess( xTableHsqlType, 
UNO_QUERY_THROW );
+                ::rtl::OUString sTableType = xValueAccess->getString( 1 );
+                bIsTextTable = sTableType.equalsAscii( "TEXT" );
+            }
+        }
+        catch( const Exception& )
+        {
+               DBG_UNHANDLED_EXCEPTION();
+        }
+
+        return bIsTextTable;
+    }
+
+    // -------------------------------------------------------------------
+    Reference< XGraphic > OHsqlConnection::impl_getTextTableIcon_nothrow( 
::sal_Int32 _ColorMode )
+    {
+        Reference< XGraphic > xGraphic;
+        try
+        {
+            // create a graphic provider
+            Reference< XGraphicProvider > xProvider;
+            if ( m_xORB.is() )
+                xProvider.set( m_xORB->createInstance( ::rtl::OUString( 
RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.graphic.GraphicProvider" ) ) ), 
UNO_QUERY_THROW );
+
+            // assemble the image URL
+            ::rtl::OUStringBuffer aImageURL;
+            aImageURL.appendAscii( "private:graphicrepository/" );  // load 
the graphic from the global graphic repository
+            aImageURL.appendAscii( "database/" );                   // the 
relative path within the images.zip
+            if ( _ColorMode == GraphicColorMode::NORMAL )
+                aImageURL.appendAscii( LINKED_TEXT_TABLE_IMAGE_RESOURCE );
+            else
+                aImageURL.appendAscii( LINKED_TEXT_TABLE_IMAGE_RESOURCE_HC );
+                                                                    // the 
name of the graphic to use
+            ::rtl::OUString sImageURL( aImageURL.makeStringAndClear() );
+
+            // ask the provider to obtain a graphic
+            Sequence< PropertyValue > aMediaProperties( 1 );
+            aMediaProperties[0].Name = ::rtl::OUString( 
RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
+            aMediaProperties[0].Value <<= sImageURL;
+            xGraphic = xProvider->queryGraphic( aMediaProperties );
+            OSL_ENSURE( xGraphic.is(), 
"OHsqlConnection::impl_getTextTableIcon_nothrow: the provider did not give us a 
graphic object!" );
+        }
+        catch( const Exception& )
+        {
+               DBG_UNHANDLED_EXCEPTION();
+        }
+        return xGraphic;
+    }
 
+} } // namespace connectivity::hsqldb

File [changed]: HDriver.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/hsqldb/HDriver.cxx?r1=1.20&r2=1.20.2.1
Delta lines:  +4 -4
-------------------
--- HDriver.cxx 17 Sep 2006 02:40:25 -0000      1.20
+++ HDriver.cxx 20 Sep 2006 11:06:20 -0000      1.20.2.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: HDriver.cxx,v $
  *
- *  $Revision: 1.20 $
+ *  $Revision: 1.20.2.1 $
  *
- *  last change: $Author: obo $ $Date: 2006/09/17 02:40:25 $
+ *  last change: $Author: fs $ $Date: 2006/09/20 11:06:20 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -316,7 +316,7 @@
                                        
xDesktop->addTerminateListener(s_xTerminateListener);
                         }
                        }
-                    Reference< XComponent> xIfc = new 
OConnectionWeakWrapper(xOrig,m_xFactory);
+                    Reference< XComponent> xIfc = new OHsqlConnection( this, 
xOrig, m_xFactory );
                                    xConnection.set(xIfc,UNO_QUERY);
                     
m_aConnections.push_back(TWeakPair(WeakReferenceHelper(xOrig),TWeakConnectionPair(sKey,TWeakRefPair(WeakReferenceHelper(xConnection),WeakReferenceHelper()))));
 

File [added]: hsqlui.hrc
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/hsqldb/hsqlui.hrc?rev=1.1.4.1&content-type=text/vnd.viewcvs-markup
Added lines: 0
--------------

File [added]: hsqlui.src
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/hsqldb/hsqlui.src?rev=1.1.4.1&content-type=text/vnd.viewcvs-markup
Added lines: 0
--------------

File [changed]: makefile.mk
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/hsqldb/makefile.mk?r1=1.8&r2=1.8.176.1
Delta lines:  +20 -3
--------------------
--- makefile.mk 8 Sep 2005 06:07:25 -0000       1.8
+++ makefile.mk 20 Sep 2006 11:06:20 -0000      1.8.176.1
@@ -4,9 +4,9 @@
 #
 #   $RCSfile: makefile.mk,v $
 #
-#   $Revision: 1.8 $
+#   $Revision: 1.8.176.1 $
 #
-#   last change: $Author: rt $ $Date: 2005/09/08 06:07:25 $
+#   last change: $Author: fs $ $Date: 2006/09/20 11:06:20 $
 #
 #   The Contents of this file are made available subject to
 #   the terms of GNU Lesser General Public License Version 2.1.
@@ -49,6 +49,23 @@
 nojava:
        @echo "Not building jurt because Java is disabled"
 .ENDIF
+
+# --- Resources ---------------------------------
+
+SRS1NAME=$(TARGET)
+SRC1FILES =    \
+               hsqlui.src
+               
+RES1FILELIST=\
+       $(SRS)$/$(TARGET).srs
+
+RESLIB1NAME=$(TARGET)
+RESLIB1IMAGES=$(SOLARSRC)$/$(RSCDEFIMG)$/database
+RESLIB1SRSFILES=$(RES1FILELIST)
+
+# Note that the resource file built here is currently *not* included
+# in installation sets. See hsqlui.src for an explanation
+
 # --- Files -------------------------------------
 
 SLOFILES=\

Directory: /dba/connectivity/source/inc/hsqldb/
===============================================

File [changed]: HConnection.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/inc/hsqldb/HConnection.hxx?r1=1.4&r2=1.4.166.1
Delta lines:  +146 -35
----------------------
--- HConnection.hxx     24 Oct 2005 08:21:37 -0000      1.4
+++ HConnection.hxx     20 Sep 2006 11:06:21 -0000      1.4.166.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: HConnection.hxx,v $
  *
- *  $Revision: 1.4 $
+ *  $Revision: 1.4.166.1 $
  *
- *  last change: $Author: rt $ $Date: 2005/10/24 08:21:37 $
+ *  last change: $Author: fs $ $Date: 2006/09/20 11:06:21 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -32,60 +32,171 @@
  *    MA  02111-1307  USA
  *
  ************************************************************************/
+
 #ifndef CONNECTIVITY_HSQLDB_CONNECTION_HXX
 #define CONNECTIVITY_HSQLDB_CONNECTION_HXX
 
 #ifndef _CONNECTIVITY_ZCONNECTIONWRAPPER_HXX_
 #include "connectivity/ConnectionWrapper.hxx"
 #endif
+/** === begin UNO includes === **/
 #ifndef _COM_SUN_STAR_UTIL_XFLUSHABLE_HPP_
 #include <com/sun/star/util/XFlushable.hpp>
 #endif
-#ifndef _CPPUHELPER_COMPBASE1_HXX_
-#include <cppuhelper/compbase1.hxx>
+#ifndef _COM_SUN_STAR_SDBC_XDRIVER_HPP_
+#include <com/sun/star/sdbc/XDriver.hpp>
+#endif
+#ifndef __com_sun_star_sdb_application_XTableUIProvider_hpp__
+#include <com/sun/star/sdb/application/XTableUIProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UI_DIALOGS_XEXECUTABLEDIALOG_HPP_
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#endif
+/** === end UNO includes === **/
+#ifndef _CPPUHELPER_COMPBASE2_HXX_
+#include <cppuhelper/compbase2.hxx>
 #endif
 #ifndef _COMPHELPER_UNO3_HXX_
 #include <comphelper/uno3.hxx>
 #endif
+#ifndef _CPPUHELPER_INTERFACECONTAINER_HXX_
+#include <cppuhelper/interfacecontainer.hxx>
+#endif
 #include <memory>
 
 namespace connectivity
 {
        namespace hsqldb
        {
-        class FlushListeners;
+        class SAL_NO_VTABLE IMethodGuardAccess
+        {
+        public:
+            virtual ::osl::Mutex&   getMutex() const = 0;
+            virtual void            checkDisposed() const = 0;
+        };
 
                
//==========================================================================
-               //= OConnectionWeakWrapper - wraps all methods to the real 
connection from the driver
+        //= OHsqlConnection - wraps all methods to the real connection from 
the driver
                //= but when disposed it doesn't dispose the real connection
                
//==========================================================================
-               typedef ::cppu::WeakComponentImplHelper1<   
::com::sun::star::util::XFlushable
-                                                                               
                >   OConnectionWeakWrapper_BASE;
+        typedef ::cppu::WeakComponentImplHelper2<   
::com::sun::star::util::XFlushable
+                                                ,   
::com::sun::star::sdb::application::XTableUIProvider
+                                                >   OHsqlConnection_BASE;
 
-               class OConnectionWeakWrapper    :public ::comphelper::OBaseMutex
-                                                                           
,public OConnectionWeakWrapper_BASE
+        class OHsqlConnection   :public ::comphelper::OBaseMutex
+                                ,public OHsqlConnection_BASE
                                                                            
,public OConnectionWrapper
+                                ,public IMethodGuardAccess
                {
         private:
-            ::std::auto_ptr< FlushListeners >   m_pFlushListeners;
+            ::cppu::OInterfaceContainerHelper                                  
                         m_aFlushListeners;
+            ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver 
>                         m_xDriver;
+            ::com::sun::star::uno::Reference< 
::com::sun::star::lang::XMultiServiceFactory >            m_xORB;
 
                protected:
                        virtual void SAL_CALL disposing(void);
-                       virtual ~OConnectionWeakWrapper();
+            virtual ~OHsqlConnection();
 
         public:
-                       OConnectionWeakWrapper(const 
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& 
_xConnection
-                                                                 ,const 
::com::sun::star::uno::Reference< 
::com::sun::star::lang::XMultiServiceFactory>& _xORB);
+            OHsqlConnection(
+                const ::com::sun::star::uno::Reference< 
::com::sun::star::sdbc::XDriver > _rxDriver,
+                const ::com::sun::star::uno::Reference< 
::com::sun::star::sdbc::XConnection >& _xConnection,
+                const ::com::sun::star::uno::Reference< 
::com::sun::star::lang::XMultiServiceFactory>& _xORB
+            );
                        
                        // XServiceInfo
                        DECLARE_SERVICE_INFO();
                        DECLARE_XTYPEPROVIDER()
                        DECLARE_XINTERFACE( )
 
-            // XTransactedObject
+            // IMethodGuardAccess
+            virtual ::osl::Mutex&   getMutex() const;
+            virtual void            checkDisposed() const;
+
+            // XFlushable
             virtual void SAL_CALL flush(  ) throw 
(::com::sun::star::uno::RuntimeException);
             virtual void SAL_CALL addFlushListener( const 
::com::sun::star::uno::Reference< ::com::sun::star::util::XFlushListener >& l ) 
throw (::com::sun::star::uno::RuntimeException);
             virtual void SAL_CALL removeFlushListener( const 
::com::sun::star::uno::Reference< ::com::sun::star::util::XFlushListener >& l ) 
throw (::com::sun::star::uno::RuntimeException);
+
+            // XTableUIProvider
+            virtual ::com::sun::star::uno::Reference< 
::com::sun::star::graphic::XGraphic > SAL_CALL getTableIcon( const 
::rtl::OUString& TableName, ::sal_Int32 ColorMode ) throw 
(::com::sun::star::uno::RuntimeException);
+            virtual ::com::sun::star::uno::Reference< 
::com::sun::star::uno::XInterface > SAL_CALL getTableEditor( const 
::com::sun::star::uno::Reference< 
::com::sun::star::sdb::application::XDatabaseDocumentUI >& DocumentUI, const 
::rtl::OUString& TableName ) throw 
(::com::sun::star::lang::IllegalArgumentException, 
::com::sun::star::lang::WrappedTargetException, 
::com::sun::star::uno::RuntimeException);
+
+        private:
+            /** creates the dialog used for editing a linked table
+
+                @param _rTableName
+                    the name of the table to create the editor for.
+
+                @param _rxDocumentUI
+                    the UI of the database document, for which the editor is 
to be created.
+                    Must not be <NULL/>.
+
+                @return
+                    the table editor dialog instance.
+
+                @throws ::com::sun::star::lang::WrappedTargetException
+                    if creating the dialog instance fails
+
+                @throws ::com::sun::star::uno::RuntimeException
+                    if a serious error occures
+
+                @precond
+                    Our mutex is locked.
+            */
+            ::com::sun::star::uno::Reference< 
::com::sun::star::ui::dialogs::XExecutableDialog >
+                    impl_createLinkedTableEditor_throw(
+                        const ::com::sun::star::uno::Reference< 
::com::sun::star::sdb::application::XDatabaseDocumentUI >& _rxDocumentUI,
+                        const ::rtl::OUString& _rTableName
+                    );
+
+            /** retrieves our table container
+                @return
+                    our table container. Guaranteed to not be <NULL/>.
+                @throws ::com::sun::star::lang::WrappedTargetException
+                    if a non-RuntimeException is caught during obtaining the 
container.
+                @throws ::com::sun::star::uno::RuntimeException
+                    if a serious error occurs
+                @precond
+                    We're not disposed.
+            */
+            ::com::sun::star::uno::Reference< 
::com::sun::star::container::XNameAccess >
+                    impl_getTableContainer_throw();
+
+            /** checks whether the given table name denotes an existing table
+                @param _rTableName
+                    the fully name of the table to check for existence
+                @throws ::com::sun::star::lang::IllegalArgumentException
+                    if the name does not denote an existing table
+                @precond
+                    We're not disposed.
+            */
+            void    impl_checkExistingTable_throw( const ::rtl::OUString& 
_rTableName );
+
+            /** checks whether the given table name refers to a HSQL TEXT TABLE
+            */
+            bool    impl_isTextTable_nothrow( const ::rtl::OUString& 
_rTableName );
+
+            /** retrieves the icon for HSQL TEXT TABLEs
+            */
+            ::com::sun::star::uno::Reference< 
::com::sun::star::graphic::XGraphic >
+                impl_getTextTableIcon_nothrow( ::sal_Int32 _ColorMode );
+        };
+
+        
//==========================================================================
+        //= OHsqlConnection
+        
//==========================================================================
+        class MethodGuard : public ::osl::MutexGuard
+        {
+        private:
+            typedef ::osl::MutexGuard   BaseGuard;
+
+        public:
+            MethodGuard( const IMethodGuardAccess& _rComponent )
+                :BaseGuard( _rComponent.getMutex() )
+            {
+                _rComponent.checkDisposed();
+            }
                };
        }
 }




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to