Tag: cws_src680_utf2 User: kso Date: 05/04/08 10:39:25 Modified: /dba/dbaccess/source/ui/browser/ unodatbr.cxx
Log: RESYNC: (1.165-1.169); FILE MERGED 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.165.22.1&r2=1.165.22.2 Delta lines: +36 -38 --------------------- --- unodatbr.cxx 21 Feb 2005 15:32:22 -0000 1.165.22.1 +++ unodatbr.cxx 8 Apr 2005 17:39:22 -0000 1.165.22.2 @@ -110,8 +110,8 @@ #ifndef _COM_SUN_STAR_SDBCX_XRENAME_HPP_ #include <com/sun/star/sdbcx/XRename.hpp> #endif -#ifndef _DRAFTS_COM_SUN_STAR_FRAME_XLAYOUTMANAGER_HPP_ -#include <drafts/com/sun/star/frame/XLayoutManager.hpp> +#ifndef _COM_SUN_STAR_FRAME_XLAYOUTMANAGER_HPP_ +#include <com/sun/star/frame/XLayoutManager.hpp> #endif #ifndef _URLOBJ_HXX //autogen #include <tools/urlobj.hxx> @@ -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 @@ -351,8 +348,8 @@ using namespace ::dbtools; using namespace ::svx; -using ::drafts::com::sun::star::frame::XLayoutManager; // obsolete of interface is moved outside drafts -using ::drafts::com::sun::star::ui::XUIElement; // dito +using ::com::sun::star::frame::XLayoutManager; // obsolete of interface is moved outside drafts +using ::com::sun::star::ui::XUIElement; // dito // ......................................................................... namespace dbaui @@ -428,6 +425,7 @@ ,m_nBorder(1) ,m_aTableCopyHelper(this) ,m_nAsyncDrop(0) + ,m_bOwnConnection(sal_True) { DBG_CTOR(SbaTableQueryBrowser,NULL); } @@ -766,6 +764,7 @@ switch(nType) { case DataType::BIT: + case DataType::BOOLEAN: aCurrentModelType = ::rtl::OUString::createFromAscii("CheckBox"); sPropertyName = PROPERTY_DEFAULTSTATE; break; @@ -810,7 +809,7 @@ aDefault = xColumn->getPropertyValue(PROPERTY_CONTROLDEFAULT); // default value - if (nType == DataType::BIT) + if ( nType == DataType::BIT || nType == DataType::BOOLEAN ) { if(bDefault && aDefault.hasValue()) aDefault <<= (comphelper::getString(aDefault).toInt32() == 0) ? (sal_Int16)STATE_NOCHECK : (sal_Int16)STATE_CHECK; @@ -1159,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; @@ -1185,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!" ); } @@ -1995,7 +1995,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 @@ -2022,6 +2023,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 @@ -2054,7 +2056,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); } } // ------------------------------------------------------------------------- @@ -2362,7 +2364,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 { @@ -2689,7 +2691,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); @@ -2927,10 +2929,7 @@ { SvLBoxEntry* pElements = m_pTreeModel->FirstChild(pContainers); if ( pElements ) - { - m_pTreeView->getListBox()->SetCursor( pElements ); m_pTreeView->getListBox()->Collapse(pContainers); - } m_pTreeView->getListBox()->EnableExpandHandler(pContainers); // and delete their children (they are connection-relative) for (; pElements; ) @@ -3050,7 +3049,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)) @@ -3158,6 +3160,8 @@ } } + if ( xConnection.is() ) + startConnectionListening(xConnection); Reference<XChild> xChild(xConnection,UNO_QUERY); if ( !sInitialDataSourceName.getLength() && xChild.is() ) { @@ -3167,7 +3171,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()); } } @@ -3271,6 +3275,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; @@ -3377,7 +3382,6 @@ // get the desktop object sal_Int32 nFrameSearchFlag = FrameSearchFlag::ALL | FrameSearchFlag::GLOBAL ; Reference< XComponentLoader > xFrameLoader(getORB()->createInstance(SERVICE_FRAME_DESKTOP),UNO_QUERY); - ::rtl::OUString sTarget = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_default")); if ( xFrameLoader.is() ) { @@ -3389,25 +3393,19 @@ if (pTopLevelSelected) sInitialSelection = getDataSourceAcessor( pTopLevelSelected ); - INetURLObject aURLParser( sInitialSelection ); - ::rtl::OUString sURL; - if ( aURLParser.GetProtocol() != INET_PROT_NOT_VALID ) - sURL = aURLParser.GetMainURL( INetURLObject::NO_DECODE ); - else if ( m_xDatabaseContext->hasByName( sInitialSelection ) ) - { - Reference< XModel > xDocumentModel = - getDataSourceByName_displayError( m_xDatabaseContext, sInitialSelection, getView(), getORB(), true ); - if ( xDocumentModel.is() ) - sURL = xDocumentModel->getURL(); - } + Reference< XModel > xDocumentModel( + getDataSourceOrModel(getDataSourceByName_displayError( m_xDatabaseContext, sInitialSelection, getView(), getORB(), true )),UNO_QUERY); - if ( sURL.getLength() ) + if ( xDocumentModel.is() ) { + Sequence<PropertyValue > aArgs(1); + aArgs[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Model")); + aArgs[0].Value <<= xDocumentModel; xFrameLoader->loadComponentFromURL( - sURL, + xDocumentModel->getURL(), ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_default")), nFrameSearchFlag, - Sequence<PropertyValue >() + aArgs ); } } @@ -3726,7 +3724,7 @@ } else if ( !m_bPreview ) { - Reference< drafts::com::sun::star::frame::XLayoutManager > xLayoutManager = getLayoutManager(_xFrame); + Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager = getLayoutManager(_xFrame); if ( xLayoutManager.is() ) { --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
