summaryrefslogtreecommitdiffstats
path: root/dbaccess/source
diff options
context:
space:
mode:
authorOcke Janssen <oj@openoffice.org>2001-09-25 12:28:23 +0000
committerOcke Janssen <oj@openoffice.org>2001-09-25 12:28:23 +0000
commitfe6066d957a51186f8578502e6651b55161d9b8f (patch)
tree0848d216d3739bdb287e1d8f77849599bac57627 /dbaccess/source
parent#65293# exception solaris (diff)
downloadcore-fe6066d957a51186f8578502e6651b55161d9b8f.tar.gz
core-fe6066d957a51186f8578502e6651b55161d9b8f.zip
#91719# implementing the XRename handling
Diffstat (limited to 'dbaccess/source')
-rw-r--r--dbaccess/source/core/api/TableDeco.cxx19
-rw-r--r--dbaccess/source/core/api/query.cxx16
-rw-r--r--dbaccess/source/core/api/query.hxx21
-rw-r--r--dbaccess/source/core/api/querycontainer.cxx27
-rw-r--r--dbaccess/source/core/api/querydescriptor.cxx6
-rw-r--r--dbaccess/source/core/api/table.cxx12
-rw-r--r--dbaccess/source/core/api/tablecontainer.cxx105
-rw-r--r--dbaccess/source/core/dataaccess/commandcontainer.cxx17
-rw-r--r--dbaccess/source/core/dataaccess/commanddefinition.cxx29
-rw-r--r--dbaccess/source/core/dataaccess/commanddefinition.hxx19
-rw-r--r--dbaccess/source/core/dataaccess/definitioncontainer.cxx85
-rw-r--r--dbaccess/source/core/inc/TableDeco.hxx5
-rw-r--r--dbaccess/source/core/inc/querycontainer.hxx16
-rw-r--r--dbaccess/source/core/inc/table.hxx8
-rw-r--r--dbaccess/source/shared/dbustrings.cxx4
-rw-r--r--dbaccess/source/ui/browser/dbtreemodel.hxx9
-rw-r--r--dbaccess/source/ui/browser/dbtreeview.cxx28
-rw-r--r--dbaccess/source/ui/browser/dbtreeview.hxx8
-rw-r--r--dbaccess/source/ui/browser/dsbrowserDnD.cxx181
-rw-r--r--dbaccess/source/ui/browser/sbabrw.src11
-rw-r--r--dbaccess/source/ui/browser/sbagrid.src18
-rw-r--r--dbaccess/source/ui/browser/unodatbr.cxx69
-rw-r--r--dbaccess/source/ui/dlg/dbadmin.src12
-rw-r--r--dbaccess/source/ui/inc/browserids.hxx5
-rw-r--r--dbaccess/source/ui/inc/dbu_resource.hrc8
-rw-r--r--dbaccess/source/ui/inc/unodatbr.hxx13
-rw-r--r--dbaccess/source/ui/misc/UITools.cxx7
-rw-r--r--dbaccess/source/ui/querydesign/querycontroller.cxx17
-rw-r--r--dbaccess/source/ui/tabledesign/TableController.cxx7
29 files changed, 568 insertions, 214 deletions
diff --git a/dbaccess/source/core/api/TableDeco.cxx b/dbaccess/source/core/api/TableDeco.cxx
index 86d9cd2778bb..c0487c5f53ac 100644
--- a/dbaccess/source/core/api/TableDeco.cxx
+++ b/dbaccess/source/core/api/TableDeco.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: TableDeco.cxx,v $
*
- * $Revision: 1.13 $
+ * $Revision: 1.14 $
*
- * last change: $Author: fs $ $Date: 2001-08-30 08:03:17 $
+ * last change: $Author: oj $ $Date: 2001-09-25 13:28:23 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -162,14 +162,12 @@ ODBTableDecorator::ODBTableDecorator(
m_nPrivileges = -1;
osl_decrementInterlockedCount( &m_refCount );
- // TODO : think about collecting the privileges here, as we can't ensure that in getFastPropertyValue, where
- // we do this at the moment, the statement needed can be supplied by the connection (for example the SQL-Server
- // ODBC driver does not allow more than one statement per connection, and in getFastPropertyValue it's more
- // likely that it's already used up than it's here.)
}
// -----------------------------------------------------------------------------
-ODBTableDecorator::ODBTableDecorator( const Reference< XDatabaseMetaData >& _rxMetaData,
- const Reference< XColumnsSupplier >& _rxNewTable, const Reference< XNumberFormatsSupplier >& _rxNumberFormats ) throw(SQLException)
+ODBTableDecorator::ODBTableDecorator(
+ const Reference< XDatabaseMetaData >& _rxMetaData,
+ const Reference< XColumnsSupplier >& _rxNewTable,
+ const Reference< XNumberFormatsSupplier >& _rxNumberFormats ) throw(SQLException)
:OTableDescriptor_BASE(m_aMutex)
,ODataSettings(OTableDescriptor_BASE::rBHelper)
,OConfigurationFlushable(m_aMutex)
@@ -216,6 +214,7 @@ void SAL_CALL ODBTableDecorator::disposing()
MutexGuard aGuard(m_aMutex);
m_xTable = NULL;
m_xMetaData = NULL;
+ m_pTables = NULL;
}
// -----------------------------------------------------------------------------
sal_Bool SAL_CALL ODBTableDecorator::convertFastPropertyValue(
@@ -450,7 +449,11 @@ void SAL_CALL ODBTableDecorator::rename( const ::rtl::OUString& _rNewName ) thro
Reference<XRename> xRename(m_xTable,UNO_QUERY);
if(xRename.is())
{
+// ::rtl::OUString sOldName;
+// Reference<XPropertySet> xProp(m_xTable,UNO_QUERY);
+// xProp->getPropertyValue(PROPERTY_NAME) >>= sOldName;
xRename->rename(_rNewName);
+ // m_pTables->renameObject(_rNewName);
}
else // not supported
throw SQLException(::rtl::OUString::createFromAscii("Driver does not support this function!"),*this,::rtl::OUString::createFromAscii("IM001"),0,Any());
diff --git a/dbaccess/source/core/api/query.cxx b/dbaccess/source/core/api/query.cxx
index babc8323f667..51fe26107fc1 100644
--- a/dbaccess/source/core/api/query.cxx
+++ b/dbaccess/source/core/api/query.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: query.cxx,v $
*
- * $Revision: 1.21 $
+ * $Revision: 1.22 $
*
- * last change: $Author: hr $ $Date: 2001-09-13 10:45:27 $
+ * last change: $Author: oj $ $Date: 2001-09-25 13:28:23 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -160,6 +160,7 @@ OQuery::OQuery(const Reference< XPropertySet >& _rxCommandDefinition, const Refe
if (m_xCommandDefinition.is())
{
m_xCommandDefinition->addPropertyChangeListener(::rtl::OUString(), this);
+ // m_xCommandDefinition->addPropertyChangeListener(PROPERTY_NAME, this);
m_xCommandPropInfo = m_xCommandDefinition->getPropertySetInfo();
// TODO : be a listener on the configuration node which is responsible for my properties not belonging
@@ -308,7 +309,7 @@ void SAL_CALL OQuery::propertyChange( const PropertyChangeEvent& _rSource ) thro
}
//--------------------------------------------------------------------------
-void SAL_CALL OQuery::disposing( const EventObject& _rSource ) throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL OQuery::disposing( const EventObject& _rSource ) throw (RuntimeException)
{
MutexGuard aGuard(m_aMutex);
@@ -420,6 +421,15 @@ OColumn* OQuery::createColumn(const ::rtl::OUString& _rName) const
{
return m_aConfigurationNode;
}
+// -----------------------------------------------------------------------------
+void SAL_CALL OQuery::rename( const ::rtl::OUString& newName ) throw (SQLException, ElementExistException, RuntimeException)
+{
+ MutexGuard aGuard(m_aMutex);
+ Reference<XRename> xRename(m_xCommandDefinition,UNO_QUERY);
+ OSL_ENSURE(xRename.is(),"No XRename interface!");
+ if(xRename.is())
+ xRename->rename(newName);
+}
// -----------------------------------------------------------------------------
//........................................................................
diff --git a/dbaccess/source/core/api/query.hxx b/dbaccess/source/core/api/query.hxx
index 83433f71ddbf..1788a525a5f5 100644
--- a/dbaccess/source/core/api/query.hxx
+++ b/dbaccess/source/core/api/query.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: query.hxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: obo $ $Date: 2001-09-24 14:03:49 $
+ * last change: $Author: oj $ $Date: 2001-09-25 13:28:23 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -69,8 +69,8 @@
#include "configurationflushable.hxx"
#endif
-#ifndef _CPPUHELPER_IMPLBASE2_HXX_
-#include <cppuhelper/implbase2.hxx>
+#ifndef _CPPUHELPER_IMPLBASE3_HXX_
+#include <cppuhelper/implbase3.hxx>
#endif
#ifndef _COM_SUN_STAR_SDBCX_XDATADESCRIPTORFACTORY_HPP_
@@ -82,7 +82,10 @@
#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
#include <com/sun/star/sdbc/XConnection.hpp>
#endif
-#ifndef _MAP_
+#ifndef _COM_SUN_STAR_SDBCX_XRENAME_HPP_
+#include <com/sun/star/sdbcx/XRename.hpp>
+#endif
+#ifndef INCLUDED_MAP
#include <map>
#endif
@@ -95,8 +98,9 @@ namespace dbaccess
//==========================================================================
//= OQuery - an object implementing the sdb.Query service
//==========================================================================
-typedef ::cppu::ImplHelper2 < ::com::sun::star::sdbcx::XDataDescriptorFactory,
- ::com::sun::star::beans::XPropertyChangeListener
+typedef ::cppu::ImplHelper3 < ::com::sun::star::sdbcx::XDataDescriptorFactory,
+ ::com::sun::star::beans::XPropertyChangeListener,
+ ::com::sun::star::sdbcx::XRename
> OQuery_Base;
class OQuery;
class OColumn;
@@ -201,6 +205,9 @@ public:
void storeTo( const ::utl::OConfigurationNode& _rConfigLocation );
void loadFrom( const ::utl::OConfigurationNode& _rConfigLocation );
+ // XRename
+ virtual void SAL_CALL rename( const ::rtl::OUString& newName ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException);
+
protected:
// OConfigurationFlushable
virtual void flush_NoBroadcast_NoCommit();
diff --git a/dbaccess/source/core/api/querycontainer.cxx b/dbaccess/source/core/api/querycontainer.cxx
index 23e252bdc892..6f36888180b9 100644
--- a/dbaccess/source/core/api/querycontainer.cxx
+++ b/dbaccess/source/core/api/querycontainer.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: querycontainer.cxx,v $
*
- * $Revision: 1.15 $
+ * $Revision: 1.16 $
*
- * last change: $Author: fs $ $Date: 2001-08-30 08:04:40 $
+ * last change: $Author: oj $ $Date: 2001-09-25 13:28:23 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -365,7 +365,7 @@ Type OQueryContainer::getElementType( ) throw(RuntimeException)
//------------------------------------------------------------------------------
sal_Bool OQueryContainer::hasElements(void) throw( RuntimeException )
{
- return getCount() != 0;
+ return !m_aQueriesIndexed.empty();
}
// ::com::sun::star::container::XEnumerationAccess
@@ -613,7 +613,26 @@ void SAL_CALL OQueryContainer::removeContainerListener( const Reference< XContai
if (_rxListener.is())
m_aContainerListeners.removeInterface(_rxListener);
}
+// -----------------------------------------------------------------------------
+// XPropertyChangeListener
+void SAL_CALL OQueryContainer::propertyChange( const PropertyChangeEvent& evt ) throw (RuntimeException)
+{
+ MutexGuard aGuard(m_rMutex);
+ ::rtl::OUString sNewName,sOldName;
+ evt.OldValue >>= sOldName;
+ evt.NewValue >>= sNewName;
+ // the index within my structures
+ sal_Int32 nMyIndex = implGetIndex(sOldName);
+ QueriesIterator aMapPos = m_aQueriesIndexed[ nMyIndex ];
+ OQuery* pQuery = aMapPos->second;
+ implRemove(nMyIndex);
+ pQuery->setWarningsContainer( m_pWarnings );
+ pQuery->setConfigurationNode(implGetObjectKey(sNewName,sal_True).cloneAsRoot());
+
+ // insert an own new element
+ m_aQueriesIndexed.push_back(m_aQueries.insert(Queries::value_type(sNewName, pQuery)).first);
+}
//--------------------------------------------------------------------------
void OQueryContainer::flush_NoBroadcast_NoCommit()
{
@@ -671,6 +690,8 @@ OQuery* OQueryContainer::implCreateWrapper(const Reference< XPropertySet >& _rxC
pNewObject->getPropertyValue(PROPERTY_NAME) >>= sName;
pNewObject->loadFrom( implGetObjectKey( sName, sal_True ) );
+ pNewObject->addPropertyChangeListener(PROPERTY_NAME, this);
+
return pNewObject;
}
diff --git a/dbaccess/source/core/api/querydescriptor.cxx b/dbaccess/source/core/api/querydescriptor.cxx
index 236c9c5fba15..5200c09bde88 100644
--- a/dbaccess/source/core/api/querydescriptor.cxx
+++ b/dbaccess/source/core/api/querydescriptor.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: querydescriptor.cxx,v $
*
- * $Revision: 1.18 $
+ * $Revision: 1.19 $
*
- * last change: $Author: fs $ $Date: 2001-08-30 08:06:37 $
+ * last change: $Author: oj $ $Date: 2001-09-25 13:28:23 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -115,7 +115,7 @@ void OQueryDescriptor::registerProperties()
{
// the properties which OCommandBase supplies (it has no own registration, as it's not derived from
// a OPropertyContainer)
- registerProperty(PROPERTY_NAME, PROPERTY_ID_NAME, PropertyAttribute::BOUND,
+ registerProperty(PROPERTY_NAME, PROPERTY_ID_NAME, PropertyAttribute::BOUND|PropertyAttribute::CONSTRAINED,
&m_sElementName, ::getCppuType(&m_sElementName));
registerProperty(PROPERTY_COMMAND, PROPERTY_ID_COMMAND, PropertyAttribute::BOUND,
diff --git a/dbaccess/source/core/api/table.cxx b/dbaccess/source/core/api/table.cxx
index 5658ec9b99cd..c9b9588ec960 100644
--- a/dbaccess/source/core/api/table.cxx
+++ b/dbaccess/source/core/api/table.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: table.cxx,v $
*
- * $Revision: 1.33 $
+ * $Revision: 1.34 $
*
- * last change: $Author: fs $ $Date: 2001-08-30 08:03:17 $
+ * last change: $Author: oj $ $Date: 2001-09-25 13:28:23 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -142,14 +142,14 @@ typedef ::std::map <sal_Int32, OTableColumn*, std::less <sal_Int32> > OColMap;
//==========================================================================
DBG_NAME(ODBTable)
//--------------------------------------------------------------------------
-ODBTable::ODBTable(const OConfigurationNode& _rTableConfig,
+ODBTable::ODBTable(connectivity::sdbcx::OCollection* _pTables,const OConfigurationNode& _rTableConfig,
const Reference< XConnection >& _rxConn,
const ::rtl::OUString& _rCatalog,
const ::rtl::OUString& _rSchema,
const ::rtl::OUString& _rName,
const ::rtl::OUString& _rType,
const ::rtl::OUString& _rDesc) throw(SQLException)
- :connectivity::sdbcx::OTable( _rxConn->getMetaData()->storesMixedCaseQuotedIdentifiers(), _rName, _rType, _rDesc, _rSchema, _rCatalog )
+ :connectivity::sdbcx::OTable(_pTables, _rxConn->getMetaData()->storesMixedCaseQuotedIdentifiers(), _rName, _rType, _rDesc, _rSchema, _rCatalog )
,OConfigurationFlushable(m_aMutex,_rTableConfig.isValid() ? _rTableConfig.cloneAsRoot() : OConfigurationTreeRoot())
,m_nPrivileges(0)
,m_xConnection( _rxConn )
@@ -182,9 +182,9 @@ ODBTable::ODBTable(const OConfigurationNode& _rTableConfig,
// likely that it's already used up than it's here.)
}
// -----------------------------------------------------------------------------
-ODBTable::ODBTable( const Reference< XConnection >& _rxConn )
+ODBTable::ODBTable(connectivity::sdbcx::OCollection* _pTables, const Reference< XConnection >& _rxConn )
throw(SQLException)
- :connectivity::sdbcx::OTable( _rxConn->getMetaData()->storesMixedCaseQuotedIdentifiers())
+ :connectivity::sdbcx::OTable(_pTables, _rxConn->getMetaData()->storesMixedCaseQuotedIdentifiers())
,OConfigurationFlushable(m_aMutex)
,m_nPrivileges(-1)
,m_xConnection( _rxConn )
diff --git a/dbaccess/source/core/api/tablecontainer.cxx b/dbaccess/source/core/api/tablecontainer.cxx
index dfe795ad9e14..d85979866740 100644
--- a/dbaccess/source/core/api/tablecontainer.cxx
+++ b/dbaccess/source/core/api/tablecontainer.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: tablecontainer.cxx,v $
*
- * $Revision: 1.36 $
+ * $Revision: 1.37 $
*
- * last change: $Author: oj $ $Date: 2001-09-20 12:56:18 $
+ * last change: $Author: oj $ $Date: 2001-09-25 13:28:23 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -516,7 +516,7 @@ Reference< XNamed > OTableContainer::createObject(const ::rtl::OUString& _rName)
}
}
::comphelper::disposeComponent(xRes);
- return new ODBTable(aTableConfig,
+ return new ODBTable(this,aTableConfig,
m_xConnection,
sCatalog,
sSchema,
@@ -539,7 +539,7 @@ Reference< XPropertySet > OTableContainer::createEmptyObject()
xRet = new ODBTableDecorator( m_xMetaData, xMasterColumnsSup, getDataSourceNumberFormats( m_xConnection ) );
}
else
- xRet = new ODBTable( m_xConnection );
+ xRet = new ODBTable(this, m_xConnection );
return xRet;
}
// -----------------------------------------------------------------------------
@@ -771,42 +771,41 @@ void SAL_CALL OTableContainer::appendByDescriptor( const Reference< XPropertySet
Reference< XStatement > xStmt = m_xConnection->createStatement( );
if(xStmt.is())
xStmt->execute(aSql);
+ OCollection::appendByDescriptor(descriptor);
+ }
+ // create a new config entry
+ if(m_aTablesConfig.isValid())
+ {
+ ::rtl::OUString sCatalog,sSchema,sTable,sComposedName;
+ descriptor->getPropertyValue(PROPERTY_CATALOGNAME) >>= sCatalog;
+ descriptor->getPropertyValue(PROPERTY_SCHEMANAME) >>= sSchema;
+ descriptor->getPropertyValue(PROPERTY_NAME) >>= sTable;
- // create a new config entry
- if(m_aTablesConfig.isValid())
- {
- ::rtl::OUString sCatalog,sSchema,sTable,sComposedName;
- descriptor->getPropertyValue(PROPERTY_CATALOGNAME) >>= sCatalog;
- descriptor->getPropertyValue(PROPERTY_SCHEMANAME) >>= sSchema;
- descriptor->getPropertyValue(PROPERTY_NAME) >>= sTable;
-
- ::dbtools::composeTableName(m_xMetaData,sCatalog,sSchema,sTable,sComposedName,sal_False);
+ ::dbtools::composeTableName(m_xMetaData,sCatalog,sSchema,sTable,sComposedName,sal_False);
- OConfigurationNode aTableConfig;
- if(m_aTablesConfig.hasByName(sComposedName))
- aTableConfig = m_aTablesConfig.openNode(sComposedName);
- else
+ OConfigurationNode aTableConfig;
+ if(m_aTablesConfig.hasByName(sComposedName))
+ aTableConfig = m_aTablesConfig.openNode(sComposedName);
+ else
+ {
+ aTableConfig = m_aTablesConfig.createNode(sComposedName);
+ m_aCommitLocation.commit();
+ }
+ Reference<XUnoTunnel> xTunnel(descriptor,UNO_QUERY);
+ if(xTunnel.is())
+ {
+ ODBTableDecorator* pDecoTable = (ODBTableDecorator*)xTunnel->getSomething(ODBTableDecorator::getUnoTunnelImplementationId());
+ if(pDecoTable)
{
- aTableConfig = m_aTablesConfig.createNode(sComposedName);
- m_aCommitLocation.commit();
+ pDecoTable->setContext( aTableConfig.cloneAsRoot(), getDataSourceNumberFormats( m_xConnection ) );
}
- Reference<XUnoTunnel> xTunnel(descriptor,UNO_QUERY);
- if(xTunnel.is())
+ else
{
- ODBTableDecorator* pDecoTable = (ODBTableDecorator*)xTunnel->getSomething(ODBTableDecorator::getUnoTunnelImplementationId());
- if(pDecoTable)
- {
- pDecoTable->setContext( aTableConfig.cloneAsRoot(), getDataSourceNumberFormats( m_xConnection ) );
- }
- else
- {
- ODBTable* pTable = (ODBTable*)xTunnel->getSomething(ODBTable::getUnoTunnelImplementationId());
- if ( pTable )
- pTable->setConfigurationNode( aTableConfig.cloneAsRoot() );
- }
+ ODBTable* pTable = (ODBTable*)xTunnel->getSomething(ODBTable::getUnoTunnelImplementationId());
+ if ( pTable )
+ pTable->setConfigurationNode( aTableConfig.cloneAsRoot() );
}
}
- OCollection::appendByDescriptor(descriptor);
}
}
// -------------------------------------------------------------------------
@@ -900,6 +899,46 @@ void SAL_CALL OTableContainer::elementRemoved( const ContainerEvent& Event ) thr
// -----------------------------------------------------------------------------
void SAL_CALL OTableContainer::elementReplaced( const ContainerEvent& Event ) throw (RuntimeException)
{
+ // create a new config entry
+ if(m_aTablesConfig.isValid())
+ {
+ ::rtl::OUString sOldComposedName,sNewComposedName;
+ Reference<XPropertySet> xObject;
+ Event.ReplacedElement >>= sOldComposedName;
+ Event.Accessor >>= sNewComposedName;
+ Event.Element >>= xObject;
+
+ if(m_aTablesConfig.hasByName(sOldComposedName))
+ m_aTablesConfig.removeNode(sOldComposedName);
+
+ OSL_ENSURE(!m_aTablesConfig.hasByName(sNewComposedName),"TableName already exists!");
+ OConfigurationNode aTableConfig;
+ if(m_aTablesConfig.hasByName(sNewComposedName))
+ aTableConfig = m_aTablesConfig.openNode(sNewComposedName);
+ else
+ aTableConfig = m_aTablesConfig.createNode(sNewComposedName);
+ m_aCommitLocation.commit();
+ renameObject(sOldComposedName,sNewComposedName);
+ if(hasByName(sNewComposedName))
+ {
+ Reference<XUnoTunnel> xTunnel;
+ getByName(sNewComposedName) >>= xTunnel;
+ if(xTunnel.is())
+ {
+ ODBTableDecorator* pDecoTable = (ODBTableDecorator*)xTunnel->getSomething(ODBTableDecorator::getUnoTunnelImplementationId());
+ if(pDecoTable)
+ {
+ pDecoTable->setContext( aTableConfig.cloneAsRoot(), getDataSourceNumberFormats( m_xConnection ) );
+ }
+ else
+ {
+ ODBTable* pTable = (ODBTable*)xTunnel->getSomething(ODBTable::getUnoTunnelImplementationId());
+ if ( pTable )
+ pTable->setConfigurationNode( aTableConfig.cloneAsRoot() );
+ }
+ }
+ }
+ }
}
// -----------------------------------------------------------------------------
void SAL_CALL OTableContainer::disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException)
diff --git a/dbaccess/source/core/dataaccess/commandcontainer.cxx b/dbaccess/source/core/dataaccess/commandcontainer.cxx
index 3b330778a871..7edf776e0cd6 100644
--- a/dbaccess/source/core/dataaccess/commandcontainer.cxx
+++ b/dbaccess/source/core/dataaccess/commandcontainer.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: commandcontainer.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: fs $ $Date: 2001-08-30 07:58:20 $
+ * last change: $Author: oj $ $Date: 2001-09-25 13:28:23 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -69,6 +69,9 @@
#ifndef _TOOLS_DEBUG_HXX
#include <tools/debug.hxx>
#endif
+#ifndef DBACCESS_SHARED_DBASTRINGS_HRC
+#include "dbastrings.hrc"
+#endif
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
@@ -104,13 +107,19 @@ OCommandContainer::~OCommandContainer()
//--------------------------------------------------------------------------
Reference< XPropertySet > OCommandContainer::createObject()
{
- return new OCommandDefinition(OCommandDefinition::AccessControl());
+ Reference< XPropertySet > xProp = new OCommandDefinition(OCommandDefinition::AccessControl());
+ xProp->addPropertyChangeListener(PROPERTY_NAME, this);
+ xProp->addVetoableChangeListener(PROPERTY_NAME, this);
+ return xProp;
}
//--------------------------------------------------------------------------
Reference< XPropertySet > OCommandContainer::createObject( const ::rtl::OUString& _rName, const OConfigurationNode& _rObjectNode)
{
- return new OCommandDefinition(static_cast<OWeakObject*>(this), _rName, _rObjectNode.cloneAsRoot());
+ Reference< XPropertySet > xProp = new OCommandDefinition(static_cast<OWeakObject*>(this), _rName, _rObjectNode.cloneAsRoot());
+ xProp->addPropertyChangeListener(PROPERTY_NAME, this);
+ xProp->addVetoableChangeListener(PROPERTY_NAME, this);
+ return xProp;
}
//........................................................................
diff --git a/dbaccess/source/core/dataaccess/commanddefinition.cxx b/dbaccess/source/core/dataaccess/commanddefinition.cxx
index f17a9ff1618c..3fa6c748ce83 100644
--- a/dbaccess/source/core/dataaccess/commanddefinition.cxx
+++ b/dbaccess/source/core/dataaccess/commanddefinition.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: commanddefinition.cxx,v $
*
- * $Revision: 1.11 $
+ * $Revision: 1.12 $
*
- * last change: $Author: fs $ $Date: 2001-08-30 07:58:20 $
+ * last change: $Author: oj $ $Date: 2001-09-25 13:28:23 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -83,9 +83,12 @@
#include <com/sun/star/beans/PropertyAttribute.hpp>
#endif
+
using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
using namespace ::osl;
using namespace ::comphelper;
using namespace ::cppu;
@@ -109,7 +112,7 @@ DBG_NAME(OCommandDefinition)
//--------------------------------------------------------------------------
void OCommandDefinition::registerProperties()
{
- registerProperty(PROPERTY_NAME, PROPERTY_ID_NAME, PropertyAttribute::BOUND | PropertyAttribute::READONLY,
+ registerProperty(PROPERTY_NAME, PROPERTY_ID_NAME, PropertyAttribute::BOUND | PropertyAttribute::READONLY|PropertyAttribute::CONSTRAINED,
&m_sElementName, ::getCppuType(&m_sElementName));
registerProperty(PROPERTY_COMMAND, PROPERTY_ID_COMMAND, PropertyAttribute::BOUND,
@@ -305,6 +308,26 @@ void OCommandDefinition::initializeFromConfiguration()
OCommandBase::loadFrom( m_aConfigurationNode );
}
+// -----------------------------------------------------------------------------
+void SAL_CALL OCommandDefinition::rename( const ::rtl::OUString& newName ) throw (SQLException, ElementExistException, RuntimeException)
+{
+ MutexGuard aGuard(m_aMutex);
+
+ try
+ {
+ sal_Int32 nHandle = PROPERTY_ID_NAME;
+ Any aOld = makeAny(m_sElementName);
+ Any aNew = makeAny(newName);
+ fire(&nHandle, &aNew, &aOld, 1, sal_True );
+ fire(&nHandle, &aNew, &aOld, 1, sal_False );
+ }
+ catch(const PropertyVetoException&)
+ {
+ throw ElementExistException(newName,*this);
+ }
+
+}
+// -----------------------------------------------------------------------------
//........................................................................
} // namespace dbaccess
diff --git a/dbaccess/source/core/dataaccess/commanddefinition.hxx b/dbaccess/source/core/dataaccess/commanddefinition.hxx
index fcc4a134bd1c..155a4411339d 100644
--- a/dbaccess/source/core/dataaccess/commanddefinition.hxx
+++ b/dbaccess/source/core/dataaccess/commanddefinition.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: commanddefinition.hxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: fs $ $Date: 2001-06-18 11:48:33 $
+ * last change: $Author: oj $ $Date: 2001-09-25 13:28:23 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -81,6 +81,9 @@
#include "apitools.hxx"
#endif
+#ifndef _COM_SUN_STAR_SDBCX_XRENAME_HPP_
+#include <com/sun/star/sdbcx/XRename.hpp>
+#endif
#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_
#include <com/sun/star/lang/XUnoTunnel.hpp>
#endif
@@ -88,8 +91,8 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#endif
-#ifndef _CPPUHELPER_IMPLBASE2_HXX_
-#include <cppuhelper/implbase2.hxx>
+#ifndef _CPPUHELPER_IMPLBASE3_HXX_
+#include <cppuhelper/implbase3.hxx>
#endif
#ifndef _COMPHELPER_PROPERTY_ARRAY_HELPER_HXX_
#include <comphelper/proparrhlp.hxx>
@@ -107,9 +110,10 @@ namespace dbaccess
//= OCommandDefinition - a database "document" which describes a query
//=========================================================================
-typedef ::cppu::WeakImplHelper2<
+typedef ::cppu::WeakImplHelper3<
::com::sun::star::lang::XUnoTunnel,
- ::com::sun::star::lang::XServiceInfo
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::sdbcx::XRename
> OCommandDefinition_Base;
class OCommandDefinition :public OCommandDefinition_Base
@@ -162,6 +166,9 @@ public:
static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&);
+ // XRename
+ virtual void SAL_CALL rename( const ::rtl::OUString& newName ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException);
+
// ::com::sun::star::lang::XUnoTunnel
virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
diff --git a/dbaccess/source/core/dataaccess/definitioncontainer.cxx b/dbaccess/source/core/dataaccess/definitioncontainer.cxx
index ea26b4f7403d..9a190c18c6a0 100644
--- a/dbaccess/source/core/dataaccess/definitioncontainer.cxx
+++ b/dbaccess/source/core/dataaccess/definitioncontainer.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: definitioncontainer.cxx,v $
*
- * $Revision: 1.11 $
+ * $Revision: 1.12 $
*
- * last change: $Author: fs $ $Date: 2001-08-30 07:58:20 $
+ * last change: $Author: oj $ $Date: 2001-09-25 13:28:23 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -171,7 +171,7 @@ void ODefinitionContainer::dispose()
Reference< XComponent > xComp(aLoop->xObject, UNO_QUERY);
if (xComp.is())
{
- xComp->removeEventListener(this);
+ xComp->removeEventListener(static_cast<XPropertyChangeListener*>(this));
xComp->dispose();
}
}
@@ -249,6 +249,24 @@ Sequence< ::rtl::OUString > SAL_CALL ODefinitionContainer::getSupportedServiceNa
void SAL_CALL ODefinitionContainer::insertByName( const ::rtl::OUString& _rName, const Any& aElement ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
{
MutexGuard aGuard(m_rMutex);
+
+ implInsert(_rName,aElement);
+
+ // notify the listeners
+ if (m_aContainerListeners.getLength())
+ {
+ Reference< XPropertySet > xNewElement;
+ aElement >>= xNewElement;
+
+ ContainerEvent aEvent(*this, makeAny(_rName), makeAny(xNewElement), Any());
+ OInterfaceIteratorHelper aListenerIterator(m_aContainerListeners);
+ while (aListenerIterator.hasMoreElements())
+ static_cast< XContainerListener* >(aListenerIterator.next())->elementInserted(aEvent);
+ }
+}
+// -----------------------------------------------------------------------------
+void ODefinitionContainer::implInsert(const ::rtl::OUString& _rName, const Any& aElement)
+{
checkValid(sal_True);
if (checkExistence(_rName))
@@ -286,17 +304,7 @@ void SAL_CALL ODefinitionContainer::insertByName( const ::rtl::OUString& _rName,
pNewElement->inserted(static_cast<OWeakObject*>(this), _rName, aObjectNode.cloneAsRoot());
xNewFlushable->flush();
-
- // notify the listeners
- if (m_aContainerListeners.getLength())
- {
- ContainerEvent aEvent(*this, makeAny(_rName), makeAny(xNewElement), Any());
- OInterfaceIteratorHelper aListenerIterator(m_aContainerListeners);
- while (aListenerIterator.hasMoreElements())
- static_cast< XContainerListener* >(aListenerIterator.next())->elementInserted(aEvent);
- }
}
-
//--------------------------------------------------------------------------
void SAL_CALL ODefinitionContainer::removeByName( const ::rtl::OUString& _rName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
{
@@ -513,7 +521,7 @@ Reference< XPropertySet > ODefinitionContainer::implGetByName(const ::rtl::OUStr
aSearch->xObject = aMapPos->second;
Reference< XComponent > xComp(aSearch->xObject, UNO_QUERY);
if (xComp.is())
- xComp->addEventListener(this);
+ xComp->addEventListener(static_cast<XPropertyChangeListener*>(this));
break;
}
}
@@ -566,7 +574,7 @@ void SAL_CALL ODefinitionContainer::disposing( const EventObject& _rSource ) thr
Reference< XComponent > xComp(aLoop->xObject, UNO_QUERY);
DBG_ASSERT(xComp.is(), "ODefinitionContainer::disposing : a 'disposing' call from a non-XCompoent object ?");
// stop all listening
- xComp->removeEventListener(this);
+ xComp->removeEventListener(static_cast<XPropertyChangeListener*>(this));
// and clear our document map/vector, so the object will be recreated on next access
aLoop->xObject.clear();
m_aDocumentMap[aLoop->sName].clear();
@@ -646,7 +654,7 @@ void ODefinitionContainer::implAppend(const ::rtl::OUString& _rName, const Refer
Reference< XComponent > xComp(_rxNewObject, UNO_QUERY);
if (xComp.is())
- xComp->addEventListener(this);
+ xComp->addEventListener(static_cast<XPropertyChangeListener*>(this));
}
catch(Exception&)
{
@@ -669,13 +677,13 @@ void ODefinitionContainer::implReplace(const ::rtl::OUString& _rName, const Refe
{
Reference< XComponent > xComp(aSearch->xObject, UNO_QUERY);
if (xComp.is())
- xComp->removeEventListener(this);
+ xComp->removeEventListener(static_cast<XPropertyChangeListener*>(this));
aSearch->xObject = _rxNewObject;
xComp = Reference< XComponent >(_rxNewObject, UNO_QUERY);
if (xComp.is())
- xComp->addEventListener(this);
+ xComp->addEventListener(static_cast<XPropertyChangeListener*>(this));
break;
}
@@ -742,6 +750,47 @@ void SAL_CALL ODefinitionContainer::setParent( const Reference< XInterface >& Pa
{
throw NoSupportException();
}
+// -----------------------------------------------------------------------------
+// XPropertyChangeListener
+void SAL_CALL ODefinitionContainer::propertyChange( const PropertyChangeEvent& evt ) throw (RuntimeException)
+{
+ MutexGuard aGuard(m_rMutex);
+ checkValid(sal_True);
+ if(evt.PropertyName == PROPERTY_NAME)
+ {
+ try
+ {
+ ::rtl::OUString sNewName,sOldName;
+ evt.OldValue >>= sOldName;
+ evt.NewValue >>= sNewName;
+ Reference< XComponent > xComp(evt.Source, UNO_QUERY);
+ if (xComp.is())
+ xComp->removeEventListener(static_cast<XPropertyChangeListener*>(this));
+ implRemove(sOldName);
+ implInsert(sNewName,makeAny(evt.Source));
+ }
+ catch(const Exception&)
+ {
+ OSL_ENSURE(0,"Exception catched!");
+ throw RuntimeException();
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+// XVetoableChangeListener
+void SAL_CALL ODefinitionContainer::vetoableChange( const PropertyChangeEvent& aEvent ) throw (PropertyVetoException, RuntimeException)
+{
+ MutexGuard aGuard(m_rMutex);
+ checkValid(sal_True);
+ if(aEvent.PropertyName == PROPERTY_NAME)
+ {
+ ::rtl::OUString sNewName;
+ aEvent.NewValue >>= sNewName;
+ if(hasByName(sNewName))
+ throw PropertyVetoException();
+ }
+}
+// -----------------------------------------------------------------------------
//........................................................................
} // namespace dbaccess
diff --git a/dbaccess/source/core/inc/TableDeco.hxx b/dbaccess/source/core/inc/TableDeco.hxx
index f7a386e8694c..24d73ce296c1 100644
--- a/dbaccess/source/core/inc/TableDeco.hxx
+++ b/dbaccess/source/core/inc/TableDeco.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: TableDeco.hxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: fs $ $Date: 2001-08-30 07:53:40 $
+ * last change: $Author: oj $ $Date: 2001-09-25 13:28:23 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -153,6 +153,7 @@ namespace dbaccess
sal_Int32 m_nPrivileges;
// </properties>
::connectivity::sdbcx::OCollection* m_pColumns;
+ ::connectivity::sdbcx::OCollection* m_pTables;
// IColumnFactory
virtual OColumn* createColumn(const ::rtl::OUString& _rName) const;
diff --git a/dbaccess/source/core/inc/querycontainer.hxx b/dbaccess/source/core/inc/querycontainer.hxx
index 8c0cc74f77d0..7edb08e07bb3 100644
--- a/dbaccess/source/core/inc/querycontainer.hxx
+++ b/dbaccess/source/core/inc/querycontainer.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: querycontainer.hxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: fs $ $Date: 2001-08-24 13:13:37 $
+ * last change: $Author: oj $ $Date: 2001-09-25 13:28:23 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -62,8 +62,8 @@
#ifndef _DBA_CORE_QUERYCONTAINER_HXX_
#define _DBA_CORE_QUERYCONTAINER_HXX_
-#ifndef _CPPUHELPER_IMPLBASE9_HXX_
-#include <cppuhelper/implbase9.hxx>
+#ifndef _CPPUHELPER_IMPLBASE10_HXX_
+#include <cppuhelper/implbase10.hxx>
#endif
#ifndef _COMPHELPER_STLTYPES_HXX_
#include <comphelper/stl_types.hxx>
@@ -114,6 +114,9 @@
#ifndef _COM_SUN_STAR_SDBCX_XDROP_HPP_
#include <com/sun/star/sdbcx/XDrop.hpp>
#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYCHANGELISTENER_HPP_
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#endif
#ifndef _DBASHARED_APITOOLS_HXX_
#include "apitools.hxx"
@@ -130,7 +133,7 @@ namespace dbaccess
{
//........................................................................
- typedef ::cppu::WeakImplHelper9< ::com::sun::star::container::XEnumerationAccess,
+ typedef ::cppu::WeakImplHelper10< ::com::sun::star::container::XEnumerationAccess,
::com::sun::star::container::XContainerListener,
::com::sun::star::container::XNameAccess,
::com::sun::star::container::XIndexAccess,
@@ -138,6 +141,7 @@ namespace dbaccess
::com::sun::star::sdbcx::XDataDescriptorFactory,
::com::sun::star::sdbcx::XAppend,
::com::sun::star::sdbcx::XDrop,
+ ::com::sun::star::beans::XPropertyChangeListener,
::com::sun::star::lang::XServiceInfo > OQueryContainer_Base;
//==========================================================================
@@ -266,6 +270,8 @@ namespace dbaccess
// ::com::sun::star::sdbcx::XDrop
virtual void SAL_CALL dropByName( const ::rtl::OUString& elementName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL dropByIndex( sal_Int32 index ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ // XPropertyChangeListener
+ virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw (::com::sun::star::uno::RuntimeException);
// sets the new confignode at his children
void setNewConfigNode(const ::utl::OConfigurationTreeRoot& _aConfigTreeNode);
diff --git a/dbaccess/source/core/inc/table.hxx b/dbaccess/source/core/inc/table.hxx
index 5470b9918aa6..51e1548d4591 100644
--- a/dbaccess/source/core/inc/table.hxx
+++ b/dbaccess/source/core/inc/table.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: table.hxx,v $
*
- * $Revision: 1.18 $
+ * $Revision: 1.19 $
*
- * last change: $Author: fs $ $Date: 2001-08-30 07:53:40 $
+ * last change: $Author: oj $ $Date: 2001-09-25 13:28:23 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -159,13 +159,13 @@ namespace dbaccess
@param _rType the type of the table, as supplied by the driver
@param _rDesc the description of the table, as supplied by the driver
*/
- ODBTable(const ::utl::OConfigurationNode& _rTableConfig,
+ ODBTable(connectivity::sdbcx::OCollection* _pTables,const ::utl::OConfigurationNode& _rTableConfig,
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConn,
const ::rtl::OUString& _rCatalog, const ::rtl::OUString& _rSchema, const ::rtl::OUString& _rName,
const ::rtl::OUString& _rType, const ::rtl::OUString& _rDesc)
throw(::com::sun::star::sdbc::SQLException);
- ODBTable(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConn)
+ ODBTable(connectivity::sdbcx::OCollection* _pTables,const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConn)
throw(::com::sun::star::sdbc::SQLException);
virtual ~ODBTable();
diff --git a/dbaccess/source/shared/dbustrings.cxx b/dbaccess/source/shared/dbustrings.cxx
index 488f25cf574b..a30b8419ec95 100644
--- a/dbaccess/source/shared/dbustrings.cxx
+++ b/dbaccess/source/shared/dbustrings.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: dbustrings.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: fs $ $Date: 2001-06-08 08:39:42 $
+ * last change: $Author: oj $ $Date: 2001-09-25 13:28:23 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
diff --git a/dbaccess/source/ui/browser/dbtreemodel.hxx b/dbaccess/source/ui/browser/dbtreemodel.hxx
index 0875fd848b31..ce3a4dc8f785 100644
--- a/dbaccess/source/ui/browser/dbtreemodel.hxx
+++ b/dbaccess/source/ui/browser/dbtreemodel.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: dbtreemodel.hxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: oj $ $Date: 2001-08-15 13:14:59 $
+ * last change: $Author: oj $ $Date: 2001-09-25 13:24:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -92,6 +92,11 @@ namespace com { namespace sun { namespace star { namespace lang { class XMultiSe
namespace dbaui
{
+ struct DBTreeEditedEntry
+ {
+ SvLBoxEntry* pEntry;
+ XubString aNewText;
+ };
//========================================================================
//= DBTreeListModel
//========================================================================
diff --git a/dbaccess/source/ui/browser/dbtreeview.cxx b/dbaccess/source/ui/browser/dbtreeview.cxx
index b0c900e2746b..cf40bb103e76 100644
--- a/dbaccess/source/ui/browser/dbtreeview.cxx
+++ b/dbaccess/source/ui/browser/dbtreeview.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: dbtreeview.cxx,v $
*
- * $Revision: 1.15 $
+ * $Revision: 1.16 $
*
- * last change: $Author: fs $ $Date: 2001-09-06 12:40:39 $
+ * last change: $Author: oj $ $Date: 2001-09-25 13:24:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -94,7 +94,7 @@ DBTreeView::DBTreeView( Window* pParent, const Reference< XMultiServiceFactory >
m_pTreeListBox = new DBTreeListBox(this, _rxORB ,WB_BORDER | WB_HASLINES | WB_HASLINESATROOT | WB_SORT | WB_HASBUTTONS | WB_HSCROLL |WB_HASBUTTONSATROOT);
m_pTreeListBox->EnableCheckButton(NULL);
m_pTreeListBox->SetDragDropMode( 0 );
- m_pTreeListBox->EnableInplaceEditing( sal_False );
+ m_pTreeListBox->EnableInplaceEditing( sal_True );
m_pTreeListBox->SetHelpId(HID_TLB_TREELISTBOX);
m_pTreeListBox->Show();
}
@@ -169,6 +169,26 @@ Link DBTreeView::getDeleteHandler() const
return m_pTreeListBox->getDeleteHandler();
}
// -----------------------------------------------------------------------------
+void DBTreeView::setEditingHandler(const Link& _rHdl)
+{
+ m_pTreeListBox->setEditingHandler(_rHdl);
+}
+// -----------------------------------------------------------------------------
+Link DBTreeView::getEditingHandler() const
+{
+ return m_pTreeListBox->getEditingHandler();
+}
+// -----------------------------------------------------------------------------
+void DBTreeView::setEditedHandler(const Link& _rHdl)
+{
+ m_pTreeListBox->setEditedHandler(_rHdl);
+}
+// -----------------------------------------------------------------------------
+Link DBTreeView::getEditedHandler() const
+{
+ return m_pTreeListBox->getEditedHandler();
+}
+// -----------------------------------------------------------------------------
void DBTreeView::Resize()
{
Window::Resize();
@@ -204,7 +224,7 @@ void DBTreeView::setSelectHdl(const Link& _rHdl)
long DBTreeView::PreNotify( NotifyEvent& rNEvt )
{
long nDone = 0L;
- if(rNEvt.GetType() == EVENT_GETFOCUS && m_pTreeListBox)
+ if(rNEvt.GetType() == EVENT_GETFOCUS && m_pTreeListBox && !m_pTreeListBox->HasChildPathFocus())
{
m_pTreeListBox->GrabFocus();
nDone = 1L;
diff --git a/dbaccess/source/ui/browser/dbtreeview.hxx b/dbaccess/source/ui/browser/dbtreeview.hxx
index af1979834f04..9ff1549f5efb 100644
--- a/dbaccess/source/ui/browser/dbtreeview.hxx
+++ b/dbaccess/source/ui/browser/dbtreeview.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: dbtreeview.hxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: oj $ $Date: 2001-07-18 11:33:57 $
+ * last change: $Author: oj $ $Date: 2001-09-25 13:24:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -109,6 +109,10 @@ namespace dbaui
Link getPasteHandler() const;
void setDeleteHandler(const Link& _rHdl);
Link getDeleteHandler() const;
+ void setEditingHandler(const Link& _rHdl);
+ Link getEditingHandler() const;
+ void setEditedHandler(const Link& _rHdl);
+ Link getEditedHandler() const;
DBTreeListModel* getModel() const;
diff --git a/dbaccess/source/ui/browser/dsbrowserDnD.cxx b/dbaccess/source/ui/browser/dsbrowserDnD.cxx
index 19107812f01b..127446ff5f63 100644
--- a/dbaccess/source/ui/browser/dsbrowserDnD.cxx
+++ b/dbaccess/source/ui/browser/dsbrowserDnD.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: dsbrowserDnD.cxx,v $
*
- * $Revision: 1.28 $
+ * $Revision: 1.29 $
*
- * last change: $Author: oj $ $Date: 2001-09-20 12:56:17 $
+ * last change: $Author: oj $ $Date: 2001-09-25 13:24:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -81,6 +81,9 @@
#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_
#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
#endif
+#ifndef _COM_SUN_STAR_SDBCX_XRENAME_HPP_
+#include <com/sun/star/sdbcx/XRename.hpp>
+#endif
#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
#include <com/sun/star/container/XNameContainer.hpp>
#endif
@@ -932,6 +935,117 @@ namespace dbaui
return 0;
}
// -----------------------------------------------------------------------------
+ IMPL_LINK(SbaTableQueryBrowser, OnEditingEntry, SvLBoxEntry*, _pEntry)
+ {
+ EntryType eType = getEntryType(_pEntry);
+ long nRet = 0;
+ switch(eType)
+ {
+ case etQuery:
+ case etView:
+ case etTable:
+ try
+ {
+ if(eType == etQuery || isConnectionWriteAble(_pEntry))
+ {
+ ensureObjectExists(_pEntry);
+ DBTreeListModel::DBTreeListUserData* pData = static_cast<DBTreeListModel::DBTreeListUserData*>(_pEntry->GetUserData());
+ if(pData && pData->xObject.is())
+ {
+ Reference<XRename> xRename(pData->xObject,UNO_QUERY);
+ if(xRename.is())
+ {
+ ::rtl::OUString sName;
+ Reference<XPropertySet> xProp(pData->xObject,UNO_QUERY);
+ xProp->getPropertyValue(PROPERTY_NAME) >>= sName;
+ m_pTreeView->getListBox()->SetEntryText(_pEntry,sName);
+ nRet = 1;
+ }
+ }
+ }
+ }
+ catch(const Exception&)
+ {
+ OSL_ENSURE(0,"Exception catched!");
+ }
+ break;
+ default:
+ OSL_ENSURE(0,"Try to rename wrong entry!");
+ }
+ return nRet;
+ }
+ // -----------------------------------------------------------------------------
+ IMPL_LINK(SbaTableQueryBrowser, OnEditedEntry, DBTreeEditedEntry*, _aEntry)
+ {
+ EntryType eType = getEntryType(_aEntry->pEntry);
+ ::rtl::OUString sOldName;
+ long nRet = 0;
+ try
+ {
+ switch(eType)
+ {
+ case etView:
+ case etTable:
+ case etQuery:
+ if(etQuery == eType || isConnectionWriteAble(_aEntry->pEntry))
+ {
+ DBTreeListModel::DBTreeListUserData* pData = static_cast<DBTreeListModel::DBTreeListUserData*>(_aEntry->pEntry->GetUserData());
+ OSL_ENSURE(pData && pData->xObject.is(),"Error in editing!");
+ if(pData && pData->xObject.is())
+ {
+ ::rtl::OUString sName,sSchema,sCatalog;
+ ::rtl::OUString sNewName = _aEntry->aNewText;
+ Reference<XPropertySet> xProp(pData->xObject,UNO_QUERY);
+ xProp->getPropertyValue(PROPERTY_NAME) >>= sName;
+ Reference<XConnection> xConnection = getConnectionFromEntry(_aEntry->pEntry);
+ Reference<XDatabaseMetaData> xMeta = xConnection.is() ? xConnection->getMetaData() : Reference<XDatabaseMetaData>();
+ if(etQuery == eType)
+ sOldName = sName;
+ else
+ ::dbaui::composeTableName(xMeta,xProp,sOldName,sal_False);
+
+ if((etQuery == eType || (xMeta.is() && xMeta->storesMixedCaseQuotedIdentifiers())) ? sName != sNewName : !sNewName.equalsIgnoreAsciiCase(sName))
+ {
+ Reference<XRename> xRename(pData->xObject,UNO_QUERY);
+ OSL_ENSURE(xRename.is(),"No Xrename interface!");
+ if(xRename.is())
+ {
+ xRename->rename(sNewName);
+ nRet = 1;
+ if(etQuery != eType)
+ {// special handling for tables and views
+ xProp->getPropertyValue(PROPERTY_SCHEMANAME) >>= sSchema;
+ xProp->getPropertyValue(PROPERTY_CATALOGNAME) >>= sCatalog;
+ ::dbtools::composeTableName(xMeta,sCatalog,sSchema,sNewName,sName,sal_False);
+ sOldName = sName;
+ }
+ }
+ }
+ }
+ }
+ break;
+ }
+ }
+ catch(const SQLException& e)
+ {
+ showError(SQLExceptionInfo(e));
+ }
+ catch(const ElementExistException& e)
+ {
+ static ::rtl::OUString sStatus = ::rtl::OUString::createFromAscii("S1000");
+ String sMsg = String(ModuleRes(STR_OBJECT_ALREADY_EXISTS));
+ sMsg.SearchAndReplace('#',e.Message);
+ showError(SQLExceptionInfo(SQLException(sMsg, e.Context, sStatus, 0, Any())));
+ }
+ catch(const Exception& )
+ {
+ OSL_ENSURE(0,"Exception catched!");
+ }
+ _aEntry->aNewText = sOldName;
+
+ return nRet;
+ }
+ // -----------------------------------------------------------------------------
IMPL_LINK(SbaTableQueryBrowser, OnDeleteEntry, SvLBoxEntry*, _pEntry)
{
EntryType eType = getEntryType(_pEntry);
@@ -944,22 +1058,7 @@ namespace dbaui
case etTable:
{
// check if connection is readonly
- DBTreeListModel::DBTreeListUserData* pDSData = NULL;
- DBTreeListModel::DBTreeListUserData* pEntryData = NULL;
- SvLBoxEntry* pDSEntry = NULL;
- pDSEntry = m_pTreeView->getListBox()->GetRootLevelParent(_pEntry);
- pDSData = pDSEntry
- ? static_cast<DBTreeListModel::DBTreeListUserData*>(pDSEntry->GetUserData())
- : NULL;
-
- sal_Bool bIsConnectionWriteAble = sal_False;
- if(pDSData && pDSData->xObject.is())
- {
- Reference<XConnection> xCon(pDSData->xObject,UNO_QUERY);
- if(xCon.is())
- bIsConnectionWriteAble = !xCon->getMetaData()->isReadOnly();
- }
- if(bIsConnectionWriteAble && (eType == etTable || eType == etView))
+ if(isConnectionWriteAble(_pEntry))
implDropTable(_pEntry);
}
break;
@@ -1014,22 +1113,7 @@ namespace dbaui
case etTableContainer:
{
// check if connection is readonly
- DBTreeListModel::DBTreeListUserData* pDSData = NULL;
- DBTreeListModel::DBTreeListUserData* pEntryData = NULL;
- SvLBoxEntry* pDSEntry = NULL;
- pDSEntry = m_pTreeView->getListBox()->GetRootLevelParent(_pEntry);
- pDSData = pDSEntry
- ? static_cast<DBTreeListModel::DBTreeListUserData*>(pDSEntry->GetUserData())
- : NULL;
-
- sal_Bool bIsConnectionWriteAble = sal_False;
- if(pDSData && pDSData->xObject.is())
- {
- Reference<XConnection> xCon(pDSData->xObject,UNO_QUERY);
- if(xCon.is())
- bIsConnectionWriteAble = !xCon->getMetaData()->isReadOnly();
- }
- bAllowed = bIsConnectionWriteAble && ((eType == etTable || eType == etView || eType == etTableContainer) && isTableFormat());
+ bAllowed = isConnectionWriteAble(_pEntry) && isTableFormat();
}
break;
}
@@ -1071,6 +1155,32 @@ namespace dbaui
}
}
// -----------------------------------------------------------------------------
+ Reference<XConnection> SbaTableQueryBrowser::getConnectionFromEntry(SvLBoxEntry* _pEntry) const
+ {
+ DBTreeListModel::DBTreeListUserData* pDSData = NULL;
+ DBTreeListModel::DBTreeListUserData* pEntryData = NULL;
+ SvLBoxEntry* pDSEntry = NULL;
+ pDSEntry = m_pTreeView->getListBox()->GetRootLevelParent(_pEntry);
+ pDSData = pDSEntry
+ ? static_cast<DBTreeListModel::DBTreeListUserData*>(pDSEntry->GetUserData())
+ : NULL;
+
+ sal_Bool bIsConnectionWriteAble = sal_False;
+ Reference<XConnection> xCon;
+ if(pDSData && pDSData->xObject.is())
+ xCon = Reference<XConnection>(pDSData->xObject,UNO_QUERY);
+ return xCon;
+ }
+ // -----------------------------------------------------------------------------
+ sal_Bool SbaTableQueryBrowser::isConnectionWriteAble(SvLBoxEntry* _pEntry) const
+ {
+ // check if connection is readonly
+ sal_Bool bIsConnectionWriteAble = sal_False;
+ Reference<XConnection> xCon = getConnectionFromEntry(_pEntry);
+ if(xCon.is())
+ bIsConnectionWriteAble = !xCon->getMetaData()->isReadOnly();
+ return bIsConnectionWriteAble;
+ }
// .........................................................................
} // namespace dbaui
// .........................................................................
@@ -1078,6 +1188,9 @@ namespace dbaui
/*************************************************************************
* history:
* $Log: not supported by cvs2svn $
+ * Revision 1.28 2001/09/20 12:56:17 oj
+ * #92232# fixes for BIGINT type and new property HELPTEXT
+ *
* Revision 1.27 2001/08/27 06:57:24 oj
* #90015# some speedup's
*
diff --git a/dbaccess/source/ui/browser/sbabrw.src b/dbaccess/source/ui/browser/sbabrw.src
index 7506de800baa..089d2b5dfa0a 100644
--- a/dbaccess/source/ui/browser/sbabrw.src
+++ b/dbaccess/source/ui/browser/sbabrw.src
@@ -2,9 +2,9 @@
*
* $RCSfile: sbabrw.src,v $
*
- * $Revision: 1.56 $
+ * $Revision: 1.57 $
*
- * last change: $Author: kz $ $Date: 2001-09-06 20:18:32 $
+ * last change: $Author: oj $ $Date: 2001-09-25 13:24:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -68,7 +68,9 @@
#include "browserids.hxx"
#endif
// #include <sfx2/sfx.hrc>
+#ifndef _GLOBLMN_HRC
#include <svx/globlmn.hrc>
+#endif
#ifndef DBAUI_TOOLBOX_HXX
#include "toolbox.hrc"
@@ -806,6 +808,7 @@ Menu MENU_BROWSER_QUERYCONTEXT
{
Separator = TRUE;
};
+ MenuItem { MID_RENAME_ENTRY };
MenuItem
{
MID_QUERY_DROP
@@ -881,6 +884,7 @@ Menu MENU_BROWSER_TABLECONTEXT
Separator = TRUE;
};
MenuItem { MID_DROP_TABLE };
+ MenuItem { MID_RENAME_ENTRY };
MenuItem
{
Identifier = ID_TREE_TABLE_COPY ;
@@ -980,7 +984,8 @@ Menu MENU_BROWSER_VIEWCONTEXT
{
Separator = TRUE;
};
- MenuItem { MID_DBAUI_DROP_VIEW };
+ MenuItem { MID_DBAUI_DROP_VIEW };
+ MenuItem { MID_RENAME_ENTRY };
MenuItem
{
Identifier = ID_TREE_VIEW_COPY ;
diff --git a/dbaccess/source/ui/browser/sbagrid.src b/dbaccess/source/ui/browser/sbagrid.src
index 67df74d832ee..6fa70dc09999 100644
--- a/dbaccess/source/ui/browser/sbagrid.src
+++ b/dbaccess/source/ui/browser/sbagrid.src
@@ -2,9 +2,9 @@
*
* $RCSfile: sbagrid.src,v $
*
- * $Revision: 1.26 $
+ * $Revision: 1.27 $
*
- * last change: $Author: rt $ $Date: 2001-08-24 10:59:44 $
+ * last change: $Author: oj $ $Date: 2001-09-25 13:24:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -356,13 +356,9 @@ String STR_VIEW_TITLE
Text[ finnish ] = "Ansicht #";
};
-
-
-
-
-
-
-
-
-
+String STR_OBJECT_ALREADY_EXISTS
+{
+ Text = "Der Name # existiert bereits." ;
+ Text [ ENGLISH ] = "The name # already exists." ;
+};
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index ffc339ecdbe7..b8372e7a80a3 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: unodatbr.cxx,v $
*
- * $Revision: 1.108 $
+ * $Revision: 1.109 $
*
- * last change: $Author: oj $ $Date: 2001-09-20 12:56:17 $
+ * last change: $Author: oj $ $Date: 2001-09-25 13:24:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -542,6 +542,8 @@ sal_Bool SbaTableQueryBrowser::Construct(Window* pParent)
m_pTreeView->setCopyHandler(LINK(this, SbaTableQueryBrowser, OnCopyEntry));
m_pTreeView->setPasteHandler(LINK(this, SbaTableQueryBrowser, OnPasteEntry));
m_pTreeView->setDeleteHandler(LINK(this, SbaTableQueryBrowser, OnDeleteEntry));
+ m_pTreeView->setEditingHandler(LINK(this, SbaTableQueryBrowser, OnEditingEntry));
+ m_pTreeView->setEditedHandler(LINK(this, SbaTableQueryBrowser, OnEditedEntry));
m_pTreeView->getListBox()->setControlActionListener(this);
m_pTreeView->SetHelpId(HID_CTL_TREEVIEW);
@@ -3268,32 +3270,7 @@ void SbaTableQueryBrowser::implCreateObject( SvLBoxEntry* _pApplyTo, sal_uInt16
if (pQueryTextItem)
sCurrentObject = static_cast<SvLBoxString*>(pQueryTextItem)->GetText();
- DBTreeListModel::DBTreeListUserData* pData = static_cast<DBTreeListModel::DBTreeListUserData*>(_pApplyTo->GetUserData());
- if(!pData->xObject.is())
- {
- // the query has not been accessed before -> create it's user data
-
- Reference<XNameAccess> xNameAccess;
- if(ID_EDIT_TABLE == _nAction)
- {
- Reference<XTablesSupplier> xSup(xConnection,UNO_QUERY);
- if(xSup.is())
- xNameAccess = xSup->getTables();
- }
- else
- {
- Reference<XQueriesSupplier> xSup(xConnection,UNO_QUERY);
- if(xSup.is())
- xNameAccess = xSup->getQueries();
- }
-
- SvLBoxItem* pTextItem = _pApplyTo->GetFirstItem(SV_ITEM_ID_BOLDLBSTRING);
- if (pTextItem)
- sCurrentObject = static_cast<SvLBoxString*>(pTextItem)->GetText();
-
- if(xNameAccess.is() && xNameAccess->hasByName(sCurrentObject)) // remember the table or query object
- xNameAccess->getByName(sCurrentObject) >>= pData->xObject;
- }
+ ensureObjectExists(_pApplyTo);
}
ODesignAccess* pDispatcher = NULL;
@@ -3398,7 +3375,11 @@ void SbaTableQueryBrowser::implRemoveQuery( SvLBoxEntry* _pApplyTo )
}
}
}
-
+// -----------------------------------------------------------------------------
+void SbaTableQueryBrowser::implRenameEntry( SvLBoxEntry* _pApplyTo )
+{
+ m_pTreeView->getListBox()->EditEntry(_pApplyTo);
+}
// -----------------------------------------------------------------------------
void SbaTableQueryBrowser::implDropTable( SvLBoxEntry* _pApplyTo )
{
@@ -3589,6 +3570,7 @@ sal_Bool SbaTableQueryBrowser::requestContextMenu( const CommandEvent& _rEvent )
// 1.3 actions on existing tables
aContextMenu.EnableItem(ID_EDIT_TABLE, etTable == eType && bIsConnectionWriteAble);
aContextMenu.EnableItem(ID_DROP_TABLE, etTable == eType && bIsConnectionWriteAble);
+ aContextMenu.EnableItem(ID_RENAME_ENTRY, etTable == eType && bIsConnectionWriteAble);
aContextMenu.EnableItem(ID_TREE_TABLE_COPY, etTable == eType);
// these have to be disabled if the connection is readonly
if(!bIsConnectionWriteAble)
@@ -3607,6 +3589,7 @@ sal_Bool SbaTableQueryBrowser::requestContextMenu( const CommandEvent& _rEvent )
// 2.3 actions on existing tables
aContextMenu.EnableItem(ID_DROP_VIEW, bIsConnectionWriteAble);
+ aContextMenu.EnableItem(ID_RENAME_ENTRY, bIsConnectionWriteAble);
aContextMenu.EnableItem(ID_TREE_VIEW_COPY, sal_True);
// these have to be disabled if the connection is readonly
@@ -3629,6 +3612,7 @@ sal_Bool SbaTableQueryBrowser::requestContextMenu( const CommandEvent& _rEvent )
aContextMenu.EnableItem(ID_EDIT_QUERY_DESIGN, etQuery == eType);
aContextMenu.EnableItem(ID_DROP_QUERY, etQuery == eType);
aContextMenu.EnableItem(ID_TREE_QUERY_COPY, etQuery == eType);
+ aContextMenu.EnableItem(ID_RENAME_ENTRY, etQuery == eType);
}
break;
@@ -3708,6 +3692,9 @@ sal_Bool SbaTableQueryBrowser::requestContextMenu( const CommandEvent& _rEvent )
case ID_DROP_VIEW:
implDropTable( pEntry );
break;
+ case ID_RENAME_ENTRY:
+ implRenameEntry(pEntry);
+ break;
case ID_TREE_QUERY_COPY:
{
@@ -3901,6 +3888,30 @@ sal_Bool SbaTableQueryBrowser::implGetQuerySignature( ::rtl::OUString& _rCommand
return sal_False;
}
+// -----------------------------------------------------------------------------
+void SbaTableQueryBrowser::ensureObjectExists(SvLBoxEntry* _pApplyTo)
+{
+ // get the name of the object
+ DBTreeListModel::DBTreeListUserData* pData = static_cast<DBTreeListModel::DBTreeListUserData*>(_pApplyTo->GetUserData());
+ if(!pData->xObject.is())
+ {
+ // the object has not been accessed before -> create it's user data
+ SvLBoxEntry* pEntryParent = m_pTreeView->getListBox()->GetParent(_pApplyTo);
+ DBTreeListModel::DBTreeListUserData* pParentData = static_cast<DBTreeListModel::DBTreeListUserData*>(pEntryParent->GetUserData());
+ if(pParentData && pParentData->xObject.is())
+ {
+ Reference<XNameAccess> xNameAccess(pParentData->xObject,UNO_QUERY);
+
+ ::rtl::OUString sCurrentObject;
+ SvLBoxItem* pTextItem = _pApplyTo->GetFirstItem(SV_ITEM_ID_BOLDLBSTRING);
+ if (pTextItem)
+ sCurrentObject = static_cast<SvLBoxString*>(pTextItem)->GetText();
+
+ if(xNameAccess.is() && xNameAccess->hasByName(sCurrentObject)) // remember the table or query object
+ xNameAccess->getByName(sCurrentObject) >>= pData->xObject;
+ }
+ }
+}
// .........................................................................
} // namespace dbaui
diff --git a/dbaccess/source/ui/dlg/dbadmin.src b/dbaccess/source/ui/dlg/dbadmin.src
index 937f07a7cef2..d5de10e9633f 100644
--- a/dbaccess/source/ui/dlg/dbadmin.src
+++ b/dbaccess/source/ui/dlg/dbadmin.src
@@ -2,9 +2,9 @@
*
* $RCSfile: dbadmin.src,v $
*
- * $Revision: 1.71 $
+ * $Revision: 1.72 $
*
- * last change: $Author: kz $ $Date: 2001-09-06 20:22:00 $
+ * last change: $Author: oj $ $Date: 2001-09-25 13:24:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -2444,6 +2444,11 @@ TabPage PAGE_QUERYADMINISTRATION
MID_QUERY_DROP
ItemBitmap = Bitmap { File = "querydrop_sc.bmp"; };
};
+ ToolBoxItem
+ {
+ MID_RENAME_ENTRY
+ ItemBitmap = Bitmap { File = "rename_sc.bmp"; };
+ };
};
};
Control CTL_COLLECTION
@@ -3356,6 +3361,9 @@ String STR_HINT_CONNECTION_NOT_CAPABLE
/*************************************************************************
* history:
* $Log: not supported by cvs2svn $
+ * Revision 1.71 2001/09/06 20:22:00 kz
+ * Merge SRC640: 06.09.01 - 22:22:04 (NoBranch)
+ *
* Revision 1.70 2001/08/28 08:21:37 fs
* #91573# STR_HINT_READONLY_CONNECTION / STR_HINT_CONNECTION_NOT_CAPABL
*
diff --git a/dbaccess/source/ui/inc/browserids.hxx b/dbaccess/source/ui/inc/browserids.hxx
index ff6540b4ef18..a6f51a35f042 100644
--- a/dbaccess/source/ui/inc/browserids.hxx
+++ b/dbaccess/source/ui/inc/browserids.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: browserids.hxx,v $
*
- * $Revision: 1.19 $
+ * $Revision: 1.20 $
*
- * last change: $Author: fs $ $Date: 2001-08-16 10:34:02 $
+ * last change: $Author: oj $ $Date: 2001-09-25 13:24:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -140,6 +140,7 @@
#define ID_DIRECT_SQL 32
#define ID_TREE_QUERY_PASTE 33
#define ID_BROWSER_REFRESH_REBUILD 34
+#define ID_RENAME_ENTRY 35
diff --git a/dbaccess/source/ui/inc/dbu_resource.hrc b/dbaccess/source/ui/inc/dbu_resource.hrc
index e41f3f1c0b14..fd45aa79e2ba 100644
--- a/dbaccess/source/ui/inc/dbu_resource.hrc
+++ b/dbaccess/source/ui/inc/dbu_resource.hrc
@@ -2,9 +2,9 @@
*
* $RCSfile: dbu_resource.hrc,v $
*
- * $Revision: 1.61 $
+ * $Revision: 1.62 $
*
- * last change: $Author: fs $ $Date: 2001-08-28 08:19:41 $
+ * last change: $Author: oj $ $Date: 2001-09-25 13:24:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -451,6 +451,7 @@
#define STR_COULDNOTCONNECT_DATASOURCE RID_STRING_START + 188
#define STR_HINT_READONLY_CONNECTION RID_STRING_START + 189
#define STR_HINT_CONNECTION_NOT_CAPABLE RID_STRING_START + 190
+#define STR_OBJECT_ALREADY_EXISTS RID_STRING_START + 191
//========================================================================
// untyped resources
@@ -465,6 +466,9 @@
/*************************************************************************
* history:
* $Log: not supported by cvs2svn $
+ * Revision 1.61 2001/08/28 08:19:41 fs
+ * #91573# STR_HINT_READONLY_CONNECTION / STR_HINT_CONNECTION_NOT_CAPABL
+ *
* Revision 1.60 2001/08/16 10:37:03 fs
* #90573# +RID_MENU_REFRESH_DATA
*
diff --git a/dbaccess/source/ui/inc/unodatbr.hxx b/dbaccess/source/ui/inc/unodatbr.hxx
index 307db3dfa801..e5b92a67125f 100644
--- a/dbaccess/source/ui/inc/unodatbr.hxx
+++ b/dbaccess/source/ui/inc/unodatbr.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: unodatbr.hxx,v $
*
- * $Revision: 1.36 $
+ * $Revision: 1.37 $
*
- * last change: $Author: hr $ $Date: 2001-09-13 14:14:47 $
+ * last change: $Author: oj $ $Date: 2001-09-25 13:24:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -116,6 +116,7 @@ namespace dbaui
class DBTreeView;
class DBTreeListModel;
+ struct DBTreeEditedEntry;
// =====================================================================
typedef ::cppu::ImplHelper2 < ::com::sun::star::frame::XStatusListener
, ::com::sun::star::view::XSelectionSupplier
@@ -332,6 +333,7 @@ namespace dbaui
void implCreateObject( SvLBoxEntry* _pApplyTo, sal_uInt16 _nAction );
void implRemoveQuery( SvLBoxEntry* _pApplyTo );
void implDropTable( SvLBoxEntry* _pApplyTo );
+ void implRenameEntry( SvLBoxEntry* _pApplyTo );
void implPasteTable( SvLBoxEntry* _pApplyTo, const TransferableDataHelper& _rPasteData );
void implPasteQuery( SvLBoxEntry* _pApplyTo, const TransferableDataHelper& _rPasteData );
@@ -359,6 +361,8 @@ namespace dbaui
DECL_LINK( OnCopyEntry, SvLBoxEntry* );
DECL_LINK( OnPasteEntry, SvLBoxEntry* );
DECL_LINK( OnDeleteEntry, SvLBoxEntry* );
+ DECL_LINK( OnEditingEntry, SvLBoxEntry* );
+ DECL_LINK( OnEditedEntry, DBTreeEditedEntry* );
DECL_LINK( OnTreeEntryCompare, const SvSortData* );
DECL_LINK( OnAsyncDrop, void* );
@@ -450,6 +454,11 @@ namespace dbaui
void cutEntry(SvLBoxEntry* _pEntry);
void copyEntry(SvLBoxEntry* _pEntry);
void pasteEntry(SvLBoxEntry* _pEntry);
+ // check if the connection where this entry belongs to is writeable
+ // Entry must be table or view type
+ sal_Bool isConnectionWriteAble(SvLBoxEntry* _pEntry) const;
+ void ensureObjectExists(SvLBoxEntry* _pApplyTo);
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnectionFromEntry(SvLBoxEntry* _pEntry) const;
};
// .........................................................................
diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx
index fcf244438774..1473ff86875e 100644
--- a/dbaccess/source/ui/misc/UITools.cxx
+++ b/dbaccess/source/ui/misc/UITools.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: UITools.cxx,v $
*
- * $Revision: 1.17 $
+ * $Revision: 1.18 $
*
- * last change: $Author: oj $ $Date: 2001-09-24 12:17:41 $
+ * last change: $Author: oj $ $Date: 2001-09-25 13:24:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -141,9 +141,6 @@
#ifndef DBAUI_FIELDDESCRIPTIONS_HXX
#include "FieldDescriptions.hxx"
#endif
-#ifndef _SVX_SVXENUM_HXX
-#include <svx/svxenum.hxx>
-#endif
// .........................................................................
namespace dbaui
diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx
index 109c544bcccd..c8e2c0198376 100644
--- a/dbaccess/source/ui/querydesign/querycontroller.cxx
+++ b/dbaccess/source/ui/querydesign/querycontroller.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: querycontroller.cxx,v $
*
- * $Revision: 1.54 $
+ * $Revision: 1.55 $
*
- * last change: $Author: oj $ $Date: 2001-08-29 12:43:18 $
+ * last change: $Author: oj $ $Date: 2001-09-25 13:24:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -672,7 +672,7 @@ void SAL_CALL OQueryController::initialize( const Sequence< Any >& aArguments )
}
}
- else
+ if(!m_pSqlIterator)
setQueryComposer();
if(!m_xFormatter.is() && haveDataSource())
{
@@ -686,6 +686,9 @@ void SAL_CALL OQueryController::initialize( const Sequence< Any >& aArguments )
}
OSL_ENSURE(m_xFormatter.is(),"No NumberFormatter!");
}
+
+ OSL_ENSURE(m_pSqlIterator,"No SQLIterator set!");
+
getContainer()->initialize();
getUndoMgr()->Clear();
if(m_bDesign && !m_sName.getLength())
@@ -1038,7 +1041,7 @@ String OQueryController::getMenu() const
void OQueryController::askForNewName(const Reference<XNameAccess>& _xElements,sal_Bool _bSaveAs)
{
sal_Bool bNew = 0 == m_sName.getLength();
- bNew = bNew || _bSaveAs;
+ bNew = bNew || _bSaveAs || (_xElements.is() && !_xElements->hasByName(m_sName));
if(bNew)
{
Reference<XDatabaseMetaData> xMetaData;
@@ -1072,6 +1075,8 @@ void OQueryController::askForNewName(const Reference<XNameAccess>& _xElements,sa
m_sUpdateSchemaName = aDlg.getSchema();
}
}
+ else
+ m_sName = ::rtl::OUString(); // reset the name because we don't want to save it
}
}
// -----------------------------------------------------------------------------
@@ -1095,7 +1100,7 @@ void OQueryController::doSaveAsDoc(sal_Bool _bSaveAs)
if(sTranslatedStmt.getLength())
{
sal_Bool bNew = 0 == m_sName.getLength();
- bNew = bNew || _bSaveAs;
+ bNew = bNew || _bSaveAs || !xElements->hasByName(m_sName);
// first we need a name for our query so ask the user
askForNewName(xElements,_bSaveAs);
@@ -1106,7 +1111,7 @@ void OQueryController::doSaveAsDoc(sal_Bool _bSaveAs)
try
{
Reference<XPropertySet> xProp;
- if(bNew || !xElements->hasByName(m_sName)) // just to make sure the query already exists
+ if(bNew) // just to make sure the query already exists
{
if(xElements->hasByName(m_sName))
{
diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx
index d03f0c6e3881..8a1f0e6f4c44 100644
--- a/dbaccess/source/ui/tabledesign/TableController.cxx
+++ b/dbaccess/source/ui/tabledesign/TableController.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: TableController.cxx,v $
*
- * $Revision: 1.53 $
+ * $Revision: 1.54 $
*
- * last change: $Author: oj $ $Date: 2001-09-20 12:56:16 $
+ * last change: $Author: oj $ $Date: 2001-09-25 13:24:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -412,7 +412,8 @@ sal_Bool OTableController::doSaveDoc(sal_Bool _bSaveAs)
try
{
xTables = xTablesSup->getTables();
- OSL_ENSURE(xTables.is(),"The queries can't be null!");
+ OSL_ENSURE(xTables.is(),"The tables can't be null!");
+ bNew = bNew || (xTables.is() && !xTables->hasByName(m_sName));
// first we need a name for our query so ask the user
if(bNew)