diff options
author | Ocke Janssen [oj] <Ocke.Janssen@sun.com> | 2010-01-07 09:18:48 +0100 |
---|---|---|
committer | Ocke Janssen [oj] <Ocke.Janssen@sun.com> | 2010-01-07 09:18:48 +0100 |
commit | 339ff079289802afdc69207364bb987955819a27 (patch) | |
tree | 49f51efffd8a6d0452433ed1190bd96ff680a299 /dbaccess/source | |
parent | 1eac49df5c337a5832231514c7e352009f0295fd (diff) | |
parent | c2e5ecc21502279bc009185ecb17dfb3c9df65f6 (diff) |
Automated merge with http://hg.services.openoffice.org/cws/dba33e
Diffstat (limited to 'dbaccess/source')
-rw-r--r-- | dbaccess/source/core/api/RowSet.cxx | 4 | ||||
-rw-r--r-- | dbaccess/source/core/api/definitioncolumn.cxx | 11 | ||||
-rw-r--r-- | dbaccess/source/core/api/query.cxx | 27 | ||||
-rw-r--r-- | dbaccess/source/core/inc/definitioncolumn.hxx | 3 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/dsEntriesNoExp.cxx | 8 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/unodatbr.cxx | 34 |
6 files changed, 73 insertions, 14 deletions
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index 1adddab143c1..937bcbe82f37 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -1904,6 +1904,8 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi if(!xColumn.is()) { // no column found so we could look at the position i + //bReFetchName = sal_True; + //sColumnLabel = ::rtl::OUString(); Reference<XIndexAccess> xIndexAccess(m_xColumns,UNO_QUERY); if(xIndexAccess.is() && i <= xIndexAccess->getCount()) { @@ -1913,7 +1915,9 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi { Sequence< ::rtl::OUString> aSeq = m_xColumns->getElementNames(); if( i <= aSeq.getLength()) + { m_xColumns->getByName(aSeq.getConstArray()[i-1]) >>= xColumn; + } } } if(bReFetchName && xColumn.is()) diff --git a/dbaccess/source/core/api/definitioncolumn.cxx b/dbaccess/source/core/api/definitioncolumn.cxx index 9f9e511fc9b4..77a29812b105 100644 --- a/dbaccess/source/core/api/definitioncolumn.cxx +++ b/dbaccess/source/core/api/definitioncolumn.cxx @@ -192,7 +192,7 @@ rtl::OUString OTableColumn::getImplementationName( ) throw (RuntimeException) DBG_NAME( OQueryColumn ); // ------------------------------------------------------------------------- -OQueryColumn::OQueryColumn( const Reference< XPropertySet >& _rxParserColumn, const Reference< XConnection >& _rxConnection ) +OQueryColumn::OQueryColumn( const Reference< XPropertySet >& _rxParserColumn, const Reference< XConnection >& _rxConnection,const ::rtl::OUString& _sNewName ) :OTableColumnDescriptor( false /* do not act as descriptor */ ) { const sal_Int32 nPropAttr = PropertyAttribute::READONLY; @@ -210,7 +210,14 @@ OQueryColumn::OQueryColumn( const Reference< XPropertySet >& _rxParserColumn, co OSL_VERIFY( _rxParserColumn->getPropertyValue( PROPERTY_TYPE ) >>= m_nType ); OSL_VERIFY( _rxParserColumn->getPropertyValue( PROPERTY_ISAUTOINCREMENT ) >>= m_bAutoIncrement ); OSL_VERIFY( _rxParserColumn->getPropertyValue( PROPERTY_ISCURRENCY ) >>= m_bCurrency ); - OSL_VERIFY( _rxParserColumn->getPropertyValue( PROPERTY_NAME ) >>= m_sName ); + if ( _sNewName.getLength() ) + { + m_sName = _sNewName; + } + else + { + OSL_VERIFY( _rxParserColumn->getPropertyValue( PROPERTY_NAME ) >>= m_sName ); + } m_bRowVersion = sal_False; Reference< XPropertySetInfo > xPSI( _rxParserColumn->getPropertySetInfo(), UNO_SET_THROW ); diff --git a/dbaccess/source/core/api/query.cxx b/dbaccess/source/core/api/query.cxx index 7468e88f4fff..3f3ccc57db2e 100644 --- a/dbaccess/source/core/api/query.cxx +++ b/dbaccess/source/core/api/query.cxx @@ -191,9 +191,10 @@ void OQuery::rebuildColumns() m_pColumnMediator = NULL; Reference<XColumnsSupplier> xColSup(m_xCommandDefinition,UNO_QUERY); + Reference< XNameAccess > xColumnDefinitions; if ( xColSup.is() ) { - Reference< XNameAccess > xColumnDefinitions = xColSup->getColumns(); + xColumnDefinitions = xColSup->getColumns(); if ( xColumnDefinitions.is() ) m_pColumnMediator = new OContainerMediator( m_pColumns, xColumnDefinitions, m_xConnection, OContainerMediator::eColumns ); } @@ -236,19 +237,29 @@ void OQuery::rebuildColumns() } Sequence< ::rtl::OUString> aNames = xColumns->getElementNames(); - const ::rtl::OUString* pBegin = aNames.getConstArray(); - const ::rtl::OUString* pEnd = pBegin + aNames.getLength(); - for ( ;pBegin != pEnd; ++pBegin) + Sequence< ::rtl::OUString> aDefintionNames; + bool bApplyDefinitionNames = false; + //if ( xColumnDefinitions.is() ) + //{ + // aDefintionNames = xColumnDefinitions->getElementNames(); + // bApplyDefinitionNames = aDefintionNames.getLength() == aNames.getLength(); + //} + + ::rtl::OUString sEmpty; + const ::rtl::OUString* pIter = aNames.getConstArray(); + const ::rtl::OUString* pEnd = pIter + aNames.getLength(); + for ( sal_Int32 i = 0;pIter != pEnd; ++pIter,++i) { - Reference<XPropertySet> xSource(xColumns->getByName( *pBegin ),UNO_QUERY); - OQueryColumn* pColumn = new OQueryColumn( xSource, m_xConnection ); + Reference<XPropertySet> xSource(xColumns->getByName( *pIter ),UNO_QUERY); + OQueryColumn* pColumn = new OQueryColumn( xSource, m_xConnection, bApplyDefinitionNames ? aDefintionNames[i] : sEmpty); Reference< XChild > xChild( *pColumn, UNO_QUERY_THROW ); xChild->setParent( *this ); - implAppendColumn( *pBegin, pColumn ); + ::rtl::OUString sNewName = bApplyDefinitionNames ? aDefintionNames[i] : *pIter; + implAppendColumn( sNewName, pColumn ); Reference< XPropertySet > xDest( *pColumn, UNO_QUERY_THROW ); if ( m_pColumnMediator.is() ) - m_pColumnMediator->notifyElementCreated( *pBegin, xDest ); + m_pColumnMediator->notifyElementCreated( sNewName, xDest ); } } catch( const SQLContext& e ) diff --git a/dbaccess/source/core/inc/definitioncolumn.hxx b/dbaccess/source/core/inc/definitioncolumn.hxx index c5151e6bffd5..b67b0de70c59 100644 --- a/dbaccess/source/core/inc/definitioncolumn.hxx +++ b/dbaccess/source/core/inc/definitioncolumn.hxx @@ -167,7 +167,8 @@ namespace dbaccess public: OQueryColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxParserColumn, - const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection, + const ::rtl::OUString& _sNewName ); // XTypeProvider diff --git a/dbaccess/source/ui/browser/dsEntriesNoExp.cxx b/dbaccess/source/ui/browser/dsEntriesNoExp.cxx index 2af41d70cc13..6e522dd293f0 100644 --- a/dbaccess/source/ui/browser/dsEntriesNoExp.cxx +++ b/dbaccess/source/ui/browser/dsEntriesNoExp.cxx @@ -126,8 +126,14 @@ SbaTableQueryBrowser::EntryType SbaTableQueryBrowser::getEntryType( SvLBoxEntry* return etQuery; } + while( pEntryParent != pQueries ) + { + pEntryParent = m_pTreeView->getListBox().GetParent(pEntryParent); + if ( !pEntryParent ) + return etUnknown; + } - return etUnknown; + return etQueryContainer; } //------------------------------------------------------------------------------ void SbaTableQueryBrowser::select(SvLBoxEntry* _pEntry, sal_Bool _bSelect) diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index 8377edda3017..5b32eff98d25 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -1109,8 +1109,38 @@ SvLBoxEntry* SbaTableQueryBrowser::getObjectEntry(const ::rtl::OUString& _rDataS ::rtl::OUString sPath = sCommand.getToken( 0, '/', nIndex ); pObject = m_pTreeView->getListBox().GetEntryPosByName(sPath, pCommandType); pCommandType = pObject; - if (_bExpandAncestors && nIndex >= 0 ) - m_pTreeView->getListBox().Expand(pCommandType); + if ( nIndex >= 0 ) + { + if (ensureEntryObject(pObject)) + { + DBTreeListUserData* pParentData = static_cast< DBTreeListUserData* >( pObject->GetUserData() ); + Reference< XNameAccess > xCollection( pParentData->xContainer, UNO_QUERY ); + sal_Int32 nIndex2 = nIndex; + sPath = sCommand.getToken( 0, '/', nIndex2 ); + try + { + if ( xCollection->hasByName(sPath) ) + { + if(!m_pTreeView->getListBox().GetEntryPosByName(sPath,pObject)) + { + Reference<XNameAccess> xChild(xCollection->getByName(sPath),UNO_QUERY); + DBTreeListUserData* pEntryData = new DBTreeListUserData; + pEntryData->eType = etQuery; + if ( xChild.is() ) + { + pEntryData->eType = etQueryContainer; + } + implAppendEntry( pObject, sPath, pEntryData, pEntryData->eType ); + } + } + } + catch(Exception&) + { + DBG_ERROR("SbaTableQueryBrowser::populateTree: could not fill the tree"); + } + } + } + // m_pTreeView->getListBox().Expand(pCommandType); } while ( nIndex >= 0 ); } |