Tag: cws_dev300_dba30d
User: fs      
Date: 2008-06-10 08:36:26+0000
Modified:
   dba/dbaccess/source/ui/browser/unodatbr.cxx

Log:
 #i80943# implement getCurrentSelection

File Changes:

Directory: /dba/dbaccess/source/ui/browser/
===========================================

File [changed]: unodatbr.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/browser/unodatbr.cxx?r1=1.200.8.4&r2=1.200.8.5
Delta lines:  +38 -4
--------------------
--- unodatbr.cxx        2008-06-10 06:41:11+0000        1.200.8.4
+++ unodatbr.cxx        2008-06-10 08:36:23+0000        1.200.8.5
@@ -7,7 +7,7 @@
  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: unodatbr.cxx,v $
- * $Revision: 1.200.8.4 $
+ * $Revision: 1.200.8.5 $
  *
  * This file is part of OpenOffice.org.
  *
@@ -81,6 +81,7 @@
 #include <com/sun/star/sdb/XQueryDefinitionsSupplier.hpp>
 #include <com/sun/star/sdb/XResultSetAccess.hpp>
 #include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
+#include <com/sun/star/sdb/application/NamedDatabaseObject.hpp>
 #include <com/sun/star/sdbc/DataType.hpp>
 #include <com/sun/star/sdbc/FetchDirection.hpp>
 #include <com/sun/star/sdbc/SQLWarning.hpp>
@@ -137,6 +138,7 @@
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::awt;
 using namespace ::com::sun::star::sdb;
+using namespace ::com::sun::star::sdb::application;
 using namespace ::com::sun::star::sdbc;
 using namespace ::com::sun::star::sdbcx;
 using namespace ::com::sun::star::beans;
@@ -157,6 +159,9 @@
 using namespace ::comphelper;
 using namespace ::svx;
 
+namespace DatabaseObject = ::com::sun::star::sdb::application::DatabaseObject;
+namespace DatabaseObjectContainer = 
::com::sun::star::sdb::application::DatabaseObjectContainer;
+
 // .........................................................................
 namespace dbaui
 {
@@ -3372,11 +3377,40 @@
 {
     OSL_PRECOND( &m_pTreeView->getListBox() == &_rControl,
         "SbaTableQueryBrowser::getCurrentSelection: where does this come 
from?" );
+
     if ( &m_pTreeView->getListBox() != &_rControl )
         return Any();
 
-    // TODO
+    SvLBoxEntry* pSelected = m_pTreeView->getListBox().FirstSelected();
+    if ( !pSelected )
     return Any();
+
+    OSL_ENSURE( m_pTreeView->getListBox().NextSelected( pSelected ) == NULL,
+        "SbaTableQueryBrowser::getCurrentSelection: single-selection is 
expected here!" );
+
+    NamedDatabaseObject aSelectedObject;
+       DBTreeListUserData* pData = static_cast< DBTreeListUserData* >( 
pSelected->GetUserData() );
+    aSelectedObject.Type = static_cast< sal_Int32 >( pData->eType );
+
+    switch ( aSelectedObject.Type )
+    {
+    case DatabaseObject::QUERY:
+    case DatabaseObject::TABLE:
+        aSelectedObject.Name = m_pTreeView->getListBox().GetEntryText( 
pSelected );
+        break;
+
+    case DatabaseObjectContainer::DATA_SOURCE:
+    case DatabaseObjectContainer::ALL_QUERIES:
+    case DatabaseObjectContainer::ALL_TABLES:
+        aSelectedObject.Name = getDataSourceAcessor( pSelected );
+        break;
+
+    default:
+        OSL_ENSURE( false, "SbaTableQueryBrowser::getCurrentSelection: invalid 
(unexpected) object type!" );
+        break;
+    }
+
+    return makeAny( aSelectedObject );
 }
 
 // 
-----------------------------------------------------------------------------




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

Reply via email to