User: obo     
Date: 05/03/18 02:08:43

Modified:
 /dba/dbaccess/source/ui/browser/
  unodatbr.cxx

Log:
 INTEGRATION: CWS dba25 (1.166.4); FILE MERGED
 2005/03/14 13:30:40 fs 1.166.4.4: RESYNC: (1.167-1.168); FILE MERGED
 2005/03/08 09:01:51 fs 1.166.4.3: RESYNC: (1.166-1.167); FILE MERGED
 2005/03/04 08:04:15 oj 1.166.4.2: #i43912# use set connection as 
activeconnection and add as listener
 2005/03/04 07:19:43 oj 1.166.4.1: #i43912# use set connection as 
activeconnection

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.168&r2=1.169
Delta lines:  +18 -11
---------------------
--- unodatbr.cxx        10 Mar 2005 16:45:54 -0000      1.168
+++ unodatbr.cxx        18 Mar 2005 10:08:40 -0000      1.169
@@ -144,9 +144,6 @@
 #ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_
 #include <com/sun/star/sdbc/DataType.hpp>
 #endif
-#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
-#include <com/sun/star/sdbc/XConnection.hpp>
-#endif
 #ifndef _COM_SUN_STAR_FORM_XGRIDCOLUMNFACTORY_HPP_
 #include <com/sun/star/form/XGridColumnFactory.hpp>
 #endif
@@ -428,6 +425,7 @@
        ,m_nBorder(1)
     ,m_aTableCopyHelper(this)
     ,m_nAsyncDrop(0)
+       ,m_bOwnConnection(sal_True)
 {
        DBG_CTOR(SbaTableQueryBrowser,NULL);
 }
@@ -1160,7 +1158,8 @@
 // -------------------------------------------------------------------------
 SvLBoxEntry* SbaTableQueryBrowser::getObjectEntry(const ::rtl::OUString& 
_rDataSource, const ::rtl::OUString& _rCommand, sal_Int32 _nCommandType,
                SvLBoxEntry** _ppDataSourceEntry, SvLBoxEntry** 
_ppContainerEntry,
-               sal_Bool _bExpandAncestors)
+               sal_Bool _bExpandAncestors
+               ,const Reference<XConnection>& _rxConnection)
 {
        if (_ppDataSourceEntry)
                *_ppDataSourceEntry = NULL;
@@ -1186,7 +1185,7 @@
                        // add new entries to the list box model
                                Image a, b, c;  // not interested in  reusing 
them
                                String e, f;
-                               implAddDatasource( _rDataSource, a, e, b, f, c 
);
+                               implAddDatasource( _rDataSource, a, e, b, f, c 
,_rxConnection);
                                pDataSource = 
m_pTreeView->getListBox()->GetEntryPosByName( sDisplayName, NULL, &aFilter );
                 DBG_ASSERT( pDataSource, 
"SbaTableQueryBrowser::getObjectEntry: hmm - did not find it again!" );
                        }
@@ -2000,7 +1999,8 @@
 }
 // -------------------------------------------------------------------------
 void SbaTableQueryBrowser::implAddDatasource(const String& _rDbName, Image& 
_rDbImage,
-               String& _rQueryName, Image& _rQueryImage, String& _rTableName, 
Image& _rTableImage)
+               String& _rQueryName, Image& _rQueryImage, String& _rTableName, 
Image& _rTableImage
+               ,const Reference<XConnection>& _rxConnection)
 {
        vos::OGuard aGuard( Application::GetSolarMutex() );
        // initialize the names/images if necessary
@@ -2027,6 +2027,7 @@
        DBTreeListModel::DBTreeListUserData* pDSData = new 
DBTreeListModel::DBTreeListUserData;
        pDSData->eType = etDatasource;
     pDSData->sAccessor = sDataSourceId;
+       pDSData->xObject = _rxConnection;
        pDatasourceEntry->SetUserData(pDSData);
 
        // the child for the queries container
@@ -2059,7 +2060,7 @@
                const ::rtl::OUString* pBegin   = aDatasources.getConstArray();
                const ::rtl::OUString* pEnd     = pBegin + 
aDatasources.getLength();
                for (; pBegin != pEnd; ++pBegin)
-                       implAddDatasource(*pBegin, aDBImage, sQueriesName, 
aQueriesImage, sTablesName, aTablesImage);
+                       implAddDatasource(*pBegin, aDBImage, sQueriesName, 
aQueriesImage, sTablesName, aTablesImage,NULL);
        }
 }
 // -------------------------------------------------------------------------
@@ -2367,7 +2368,7 @@
        {
                SvLBoxEntry* pDataSource = NULL;
                SvLBoxEntry* pCommandType = NULL;
-               SvLBoxEntry* pCommand = getObjectEntry(_rDataSourceName, 
_rCommand, _nCommandType, &pDataSource, &pCommandType, sal_True);
+               SvLBoxEntry* pCommand = getObjectEntry(_rDataSourceName, 
_rCommand, _nCommandType, &pDataSource, &pCommandType, sal_True,_rxConnection);
 
                //      if (pDataSource) // OJ change for the new app
                {
@@ -2694,7 +2695,7 @@
                // add new entries to the list box model
                Image a, b, c;  // not interested in  reusing them
                String e, f;
-               implAddDatasource(sNewDS, a, e, b, f, c);
+               implAddDatasource(sNewDS, a, e, b, f, c,NULL);
        }
        else
                SbaXDataBrowserController::elementInserted(_rEvent);
@@ -3052,7 +3053,10 @@
                else if (0 == aValue.Name.compareToAscii(PROPERTY_COMMAND))
                        aValue.Value >>= sInitialCommand;
                else if (0 == 
aValue.Name.compareToAscii(PROPERTY_ACTIVECONNECTION))
-                       ::cppu::extractInterface(xConnection,aValue.Value);
+               {
+                       xConnection.set(aValue.Value,UNO_QUERY);
+                       m_bOwnConnection = !xConnection.is();
+               }
                else if (0 == 
aValue.Name.compareToAscii(PROPERTY_UPDATE_CATALOGNAME))
                        aValue.Value >>= aCatalogName;
                else if (0 == 
aValue.Name.compareToAscii(PROPERTY_UPDATE_SCHEMANAME))
@@ -3160,6 +3164,8 @@
                }
        }
 
+    if ( xConnection.is() )
+        startConnectionListening(xConnection);
        Reference<XChild> xChild(xConnection,UNO_QUERY);
        if ( !sInitialDataSourceName.getLength() && xChild.is() )
        {
@@ -3169,7 +3175,7 @@
                        Image aDBImage, aQueriesImage, aTablesImage;
                        String sQueriesName, sTablesName;
 
-                       implAddDatasource(sInitialDataSourceName, aDBImage, 
sQueriesName, aQueriesImage, sTablesName, aTablesImage);
+                       implAddDatasource(sInitialDataSourceName, aDBImage, 
sQueriesName, aQueriesImage, sTablesName, aTablesImage,xConnection);
                        
m_pTreeView->getListBox()->Expand(m_pTreeView->getListBox()->First());
                }
        }
@@ -3273,6 +3279,7 @@
 
                        // connect
             _xConnection = connect( getDataSourceAcessor( _pDSEntry ), 
sConnectingContext, rtl::OUString(), sal_True);
+                       m_bOwnConnection = _xConnection.is();
 
                        // remember the connection
                        static_cast< DBTreeListModel::DBTreeListUserData* >( 
pData )->xObject = _xConnection;




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

Reply via email to