Tag: cws_src680_dba201b User: fs Date: 05/07/20 03:13:18 Modified: /dba/dbaccess/source/ui/browser/ dsbrowserDnD.cxx
Log: #i51255# XConnection replaced with SharedConnection File Changes: Directory: /dba/dbaccess/source/ui/browser/ =========================================== File [changed]: dsbrowserDnD.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/browser/dsbrowserDnD.cxx?r1=1.69.38.1&r2=1.69.38.2 Delta lines: +25 -27 --------------------- --- dsbrowserDnD.cxx 11 Jul 2005 13:37:13 -0000 1.69.38.1 +++ dsbrowserDnD.cxx 20 Jul 2005 10:13:15 -0000 1.69.38.2 @@ -2,9 +2,9 @@ * * $RCSfile: dsbrowserDnD.cxx,v $ * - * $Revision: 1.69.38.1 $ + * $Revision: 1.69.38.2 $ * - * last change: $Author: fs $ $Date: 2005/07/11 13:37:13 $ + * last change: $Author: fs $ $Date: 2005/07/20 10:13:15 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -142,10 +142,10 @@ ::rtl::OUString aDSName = getDataSourceAcessor( m_pTreeView->getListBox()->GetRootLevelParent( _pApplyTo ) ); ODataClipboard* pData = NULL; - Reference<XConnection> xConnection; // supports the service sdb::connection + SharedConnection xConnection; if ( CommandType::QUERY != _nCommandType ) { - if (_bAllowConnection && !ensureConnection(_pApplyTo, xConnection)) + if ( _bAllowConnection && !ensureConnection( _pApplyTo, xConnection) ) return NULL; pData = new ODataClipboard(aDSName, _nCommandType, aName, xConnection, getNumberFormatter(), getORB()); } @@ -175,8 +175,8 @@ { // it must be a container EntryType eEntryType = getEntryType( pHitEntry ); - Reference<XConnection> xConnection; - if ( eEntryType == etTableContainer && ensureConnection(pHitEntry,xConnection) && xConnection.is() ) + SharedConnection xConnection; + if ( eEntryType == etTableContainer && ensureConnection( pHitEntry, xConnection ) && xConnection.is() ) { Reference<XChild> xChild(xConnection,UNO_QUERY); Reference<XStorable> xStore(xChild.is() ? getDataSourceOrModel(xChild->getParent()) : Reference<XInterface>(),UNO_QUERY); @@ -231,8 +231,11 @@ } else { - Reference<XConnection> xDestConnection; // supports the service sdb::connection - if ( ensureConnection(pHitEntry, xDestConnection) && xDestConnection.is() && m_aTableCopyHelper.copyTagTable(aDroppedData,m_aAsyncDrop,xDestConnection) ) + SharedConnection xDestConnection; + if ( ensureConnection( pHitEntry, xDestConnection ) + && xDestConnection.is() + && m_aTableCopyHelper.copyTagTable( aDroppedData, m_aAsyncDrop, xDestConnection ) + ) { m_aAsyncDrop.pDroppedAt = pHitEntry; @@ -309,11 +312,11 @@ // first get the dest connection ::osl::MutexGuard aGuard(m_aMutex); - Reference<XConnection> xDestConnection; // supports the service sdb::connection - if (!ensureConnection(_rDesc.pDroppedAt, xDestConnection) ) + SharedConnection xDestConnection; + if ( !ensureConnection( _rDesc.pDroppedAt, xDestConnection ) ) return sal_False; - return m_aTableCopyHelper.copyTagTable(_rDesc, _bCheck,xDestConnection); + return m_aTableCopyHelper.copyTagTable( _rDesc, _bCheck, xDestConnection ); } // ----------------------------------------------------------------------------- IMPL_LINK( SbaTableQueryBrowser, OnAsyncDrop, void*, NOTINTERESTEDIN ) @@ -325,11 +328,11 @@ if ( m_aAsyncDrop.nType == E_TABLE ) { - Reference<XConnection> xDestConnection; // supports the service sdb::connection - if ( ensureConnection(m_aAsyncDrop.pDroppedAt, xDestConnection) && xDestConnection.is() ) + SharedConnection xDestConnection; + if ( ensureConnection( m_aAsyncDrop.pDroppedAt, xDestConnection ) && xDestConnection.is() ) { SvLBoxEntry* pDataSourceEntry = m_pTreeView->getListBox()->GetRootLevelParent(m_aAsyncDrop.pDroppedAt); - m_aTableCopyHelper.asyncCopyTagTable(m_aAsyncDrop,getDataSourceAcessor( pDataSourceEntry ),xDestConnection); + m_aTableCopyHelper.asyncCopyTagTable( m_aAsyncDrop, getDataSourceAcessor( pDataSourceEntry ), xDestConnection ); } } @@ -350,30 +353,25 @@ if(pData) { pEntryLoop->SetUserData(NULL); - Reference< XContainer > xContainer(pData->xObject, UNO_QUERY); + Reference< XContainer > xContainer(pData->xContainer, UNO_QUERY); if (xContainer.is()) xContainer->removeContainerListener(this); - Reference<XConnection> xCon(pData->xObject,UNO_QUERY); - if(xCon.is()) + if ( pData->xConnection.is() ) { - Reference< XComponent > xComponent(xCon, UNO_QUERY); + DBG_ASSERT( impl_isDataSourceEntry( pEntryLoop ), "SbaTableQueryBrowser::clearTreeModel: no data source entry, but a connection?" ); + // without this, pData->aController might not really be a valid ModelControllerConnector + + Reference< XComponent > xComponent( pData->xConnection, UNO_QUERY ); if (xComponent.is()) { Reference< ::com::sun::star::lang::XEventListener> xEvtL((::cppu::OWeakObject*)this,UNO_QUERY); xComponent->removeEventListener(xEvtL); } - if ( m_bOwnConnection ) - { - Reference< XModel > xModel(getDataSourceOrModel(::dbtools::findDataSource(pData->xObject)),UNO_QUERY); - ::comphelper::disposeComponent(pData->xObject); - - if ( xModel.is() ) - xModel->disconnectController(this); - } } - pData->xObject.clear(); + pData->xConnection.clear(); + pData->aController.swap( ModelControllerConnector() ); delete pData; } pEntryLoop = m_pTreeModel->Next(pEntryLoop); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
