1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
30 #include "tabletree.hxx"
31 #include "tabletree.hrc"
32 #include "imageprovider.hxx"
33 #include "moduledbu.hxx"
34 #include "dbu_control.hrc"
35 #include <vcl/menu.hxx>
36 #include <connectivity/dbtools.hxx>
37 #include <comphelper/types.hxx>
38 #include "dbustrings.hrc"
39 #include <com/sun/star/sdb/application/DatabaseObject.hpp>
40 #include <com/sun/star/sdb/application/DatabaseObjectContainer.hpp>
41 #include <com/sun/star/sdbc/XDriverAccess.hpp>
42 #include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp>
43 #include <com/sun/star/sdbcx/XViewsSupplier.hpp>
44 #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
45 #include <com/sun/star/sdb/SQLContext.hpp>
46 #include <com/sun/star/sdbc/XRow.hpp>
47 #include <com/sun/star/beans/XPropertySet.hpp>
48 #include "commontypes.hxx"
49 #include "listviewitems.hxx"
50 #include <tools/diagnose_ex.h>
51 #include <osl/diagnose.h>
52 #include <rtl/ustrbuf.hxx>
53 #include <connectivity/dbmetadata.hxx>
56 #include <o3tl/compat_functional.hxx>
58 //.........................................................................
61 //.........................................................................
63 using namespace ::com::sun::star::uno
;
64 using namespace ::com::sun::star::sdb
;
65 using namespace ::com::sun::star::lang
;
66 using namespace ::com::sun::star::sdbc
;
67 using namespace ::com::sun::star::sdbcx
;
68 using namespace ::com::sun::star::beans
;
69 using namespace ::com::sun::star::container
;
70 using namespace ::com::sun::star::sdb::application
;
72 using namespace ::dbtools
;
73 using namespace ::comphelper
;
75 namespace DatabaseObject
= ::com::sun::star::sdb::application::DatabaseObject
;
76 namespace DatabaseObjectContainer
= ::com::sun::star::sdb::application::DatabaseObjectContainer
;
78 //========================================================================
80 //========================================================================
81 OTableTreeListBox::OTableTreeListBox( Window
* pParent
, const Reference
< XMultiServiceFactory
>& _rxORB
, WinBits nWinStyle
,sal_Bool _bVirtualRoot
)
82 :OMarkableTreeListBox(pParent
,_rxORB
,nWinStyle
)
83 ,m_pImageProvider( new ImageProvider
)
84 ,m_bVirtualRoot(_bVirtualRoot
)
85 ,m_bNoEmptyFolders( false )
87 implSetDefaultImages();
89 //------------------------------------------------------------------------
90 OTableTreeListBox::OTableTreeListBox( Window
* pParent
, const Reference
< XMultiServiceFactory
>& _rxORB
, const ResId
& rResId
,sal_Bool _bVirtualRoot
)
91 :OMarkableTreeListBox(pParent
,_rxORB
,rResId
)
92 ,m_pImageProvider( new ImageProvider
)
93 ,m_bVirtualRoot(_bVirtualRoot
)
94 ,m_bNoEmptyFolders( false )
96 implSetDefaultImages();
99 // -----------------------------------------------------------------------------
100 OTableTreeListBox::~OTableTreeListBox()
104 // -----------------------------------------------------------------------------
105 void OTableTreeListBox::implSetDefaultImages()
107 ImageProvider aImageProvider
;
108 SetDefaultExpandedEntryBmp( aImageProvider
.getFolderImage( DatabaseObject::TABLE
) );
109 SetDefaultCollapsedEntryBmp( aImageProvider
.getFolderImage( DatabaseObject::TABLE
) );
112 // -----------------------------------------------------------------------------
113 bool OTableTreeListBox::isFolderEntry( const SvLBoxEntry
* _pEntry
) const
115 sal_Int32 nEntryType
= reinterpret_cast< sal_IntPtr
>( _pEntry
->GetUserData() );
116 if ( ( nEntryType
== DatabaseObjectContainer::TABLES
)
117 || ( nEntryType
== DatabaseObjectContainer::CATALOG
)
118 || ( nEntryType
== DatabaseObjectContainer::SCHEMA
)
124 // -----------------------------------------------------------------------------
125 void OTableTreeListBox::notifyHiContrastChanged()
127 implSetDefaultImages();
129 SvLBoxEntry
* pEntryLoop
= First();
132 sal_uInt16 nCount
= pEntryLoop
->ItemCount();
133 for (sal_uInt16 i
=0;i
<nCount
;++i
)
135 SvLBoxItem
* pItem
= pEntryLoop
->GetItem(i
);
136 if ( pItem
&& pItem
->IsA() == SV_ITEM_ID_LBOXCONTEXTBMP
)
138 SvLBoxContextBmp
* pContextBitmapItem
= static_cast< SvLBoxContextBmp
* >( pItem
);
141 if ( isFolderEntry( pEntryLoop
) )
143 aImage
= m_pImageProvider
->getFolderImage( DatabaseObject::TABLE
);
147 String
sCompleteName( getQualifiedTableName( pEntryLoop
) );
148 m_pImageProvider
->getImages( sCompleteName
, DatabaseObject::TABLE
, aImage
);
151 pContextBitmapItem
->SetBitmap1( aImage
);
152 pContextBitmapItem
->SetBitmap2( aImage
);
156 pEntryLoop
= Next(pEntryLoop
);
160 //------------------------------------------------------------------------
161 void OTableTreeListBox::implOnNewConnection( const Reference
< XConnection
>& _rxConnection
)
163 m_xConnection
= _rxConnection
;
164 m_pImageProvider
.reset( new ImageProvider( m_xConnection
) );
167 //------------------------------------------------------------------------
168 void OTableTreeListBox::UpdateTableList( const Reference
< XConnection
>& _rxConnection
) throw(SQLException
)
170 Sequence
< ::rtl::OUString
> sTables
, sViews
;
172 String sCurrentActionError
;
175 Reference
< XTablesSupplier
> xTableSupp( _rxConnection
, UNO_QUERY_THROW
);
176 sCurrentActionError
= String(ModuleRes(STR_NOTABLEINFO
));
178 Reference
< XNameAccess
> xTables
,xViews
;
180 Reference
< XViewsSupplier
> xViewSupp( _rxConnection
, UNO_QUERY
);
181 if ( xViewSupp
.is() )
183 xViews
= xViewSupp
->getViews();
185 sViews
= xViews
->getElementNames();
188 xTables
= xTableSupp
->getTables();
190 sTables
= xTables
->getElementNames();
192 catch(RuntimeException
&)
194 OSL_FAIL("OTableTreeListBox::UpdateTableList : caught an RuntimeException!");
196 catch ( const SQLException
& )
202 // a non-SQLException exception occurred ... simply throw an SQLException
204 aInfo
.Message
= sCurrentActionError
;
208 UpdateTableList( _rxConnection
, sTables
, sViews
);
210 // -----------------------------------------------------------------------------
213 struct OViewSetter
: public ::std::unary_function
< OTableTreeListBox::TNames::value_type
, bool>
215 const Sequence
< ::rtl::OUString
> m_aViews
;
216 ::comphelper::TStringMixEqualFunctor m_aEqualFunctor
;
218 OViewSetter(const Sequence
< ::rtl::OUString
>& _rViews
,sal_Bool _bCase
) : m_aViews(_rViews
),m_aEqualFunctor(_bCase
){}
219 OTableTreeListBox::TNames::value_type
operator() (const ::rtl::OUString
& lhs
)
221 OTableTreeListBox::TNames::value_type aRet
;
223 const ::rtl::OUString
* pIter
= m_aViews
.getConstArray();
224 const ::rtl::OUString
* pEnd
= m_aViews
.getConstArray() + m_aViews
.getLength();
225 aRet
.second
= (::std::find_if(pIter
,pEnd
,::std::bind2nd(m_aEqualFunctor
,lhs
)) != pEnd
);
232 // -----------------------------------------------------------------------------
233 void OTableTreeListBox::UpdateTableList(
234 const Reference
< XConnection
>& _rxConnection
,
235 const Sequence
< ::rtl::OUString
>& _rTables
,
236 const Sequence
< ::rtl::OUString
>& _rViews
240 aTables
.resize(_rTables
.getLength());
241 const ::rtl::OUString
* pIter
= _rTables
.getConstArray();
242 const ::rtl::OUString
* pEnd
= _rTables
.getConstArray() + _rTables
.getLength();
245 Reference
< XDatabaseMetaData
> xMeta( _rxConnection
->getMetaData(), UNO_QUERY_THROW
);
246 ::std::transform( pIter
, pEnd
,
247 aTables
.begin(), OViewSetter( _rViews
, xMeta
->supportsMixedCaseQuotedIdentifiers() ) );
251 DBG_UNHANDLED_EXCEPTION();
253 UpdateTableList( _rxConnection
, aTables
);
256 //------------------------------------------------------------------------
259 ::std::vector
< ::rtl::OUString
> lcl_getMetaDataStrings_throw( const Reference
< XResultSet
>& _rxMetaDataResult
, sal_Int32 _nColumnIndex
)
261 ::std::vector
< ::rtl::OUString
> aStrings
;
262 Reference
< XRow
> xRow( _rxMetaDataResult
, UNO_QUERY_THROW
);
263 while ( _rxMetaDataResult
->next() )
264 aStrings
.push_back( xRow
->getString( _nColumnIndex
) );
268 bool lcl_shouldDisplayEmptySchemasAndCatalogs( const Reference
< XConnection
>& _rxConnection
)
270 ::dbtools::DatabaseMetaData
aMetaData( _rxConnection
);
271 return aMetaData
.displayEmptyTableFolders();
275 //------------------------------------------------------------------------
276 void OTableTreeListBox::UpdateTableList( const Reference
< XConnection
>& _rxConnection
, const TNames
& _rTables
)
278 implOnNewConnection( _rxConnection
);
280 // throw away all the old stuff
285 if (haveVirtualRoot())
287 String sRootEntryText
;
288 TNames::const_iterator aViews
= ::std::find_if(_rTables
.begin(),_rTables
.end(),
289 ::o3tl::compose1(::std::bind2nd(::std::equal_to
<sal_Bool
>(),sal_False
),::o3tl::select2nd
<TNames::value_type
>()));
290 TNames::const_iterator aTables
= ::std::find_if(_rTables
.begin(),_rTables
.end(),
291 ::o3tl::compose1(::std::bind2nd(::std::equal_to
<sal_Bool
>(),sal_True
),::o3tl::select2nd
<TNames::value_type
>()));
293 if ( aViews
== _rTables
.end() )
294 sRootEntryText
= String(ModuleRes(STR_ALL_TABLES
));
295 else if ( aTables
== _rTables
.end() )
296 sRootEntryText
= String(ModuleRes(STR_ALL_VIEWS
));
298 sRootEntryText
= String(ModuleRes(STR_ALL_TABLES_AND_VIEWS
));
299 InsertEntry( sRootEntryText
, NULL
, sal_False
, LIST_APPEND
, reinterpret_cast< void* >( DatabaseObjectContainer::TABLES
) );
302 if ( _rTables
.empty() )
303 // nothing to do (besides inserting the root entry)
306 // get the table/view names
307 TNames::const_iterator aIter
= _rTables
.begin();
308 TNames::const_iterator aEnd
= _rTables
.end();
310 Reference
< XDatabaseMetaData
> xMeta( _rxConnection
->getMetaData(), UNO_QUERY_THROW
);
311 for ( ; aIter
!= aEnd
; ++aIter
)
321 if ( !m_bNoEmptyFolders
&& lcl_shouldDisplayEmptySchemasAndCatalogs( _rxConnection
) )
323 sal_Bool bSupportsCatalogs
= xMeta
->supportsCatalogsInDataManipulation();
324 sal_Bool bSupportsSchemas
= xMeta
->supportsSchemasInDataManipulation();
326 if ( bSupportsCatalogs
|| bSupportsSchemas
)
328 // we display empty catalogs if the DB supports catalogs, and they're noted at the beginning of a
329 // composed name. Otherwise, we display empty schematas. (also see the tree structure explained in
331 bool bCatalogs
= bSupportsCatalogs
&& xMeta
->isCatalogAtStart();
333 ::std::vector
< ::rtl::OUString
> aFolderNames( lcl_getMetaDataStrings_throw(
334 bCatalogs
? xMeta
->getCatalogs() : xMeta
->getSchemas(), 1 ) );
335 sal_Int32 nFolderType
= bCatalogs
? DatabaseObjectContainer::CATALOG
: DatabaseObjectContainer::SCHEMA
;
337 SvLBoxEntry
* pRootEntry
= getAllObjectsEntry();
338 for ( ::std::vector
< ::rtl::OUString
>::const_iterator folder
= aFolderNames
.begin();
339 folder
!= aFolderNames
.end();
343 SvLBoxEntry
* pFolder
= GetEntryPosByName( *folder
, pRootEntry
);
345 pFolder
= InsertEntry( *folder
, pRootEntry
, sal_False
, LIST_APPEND
, reinterpret_cast< void* >( nFolderType
) );
350 catch ( const Exception
& )
352 DBG_UNHANDLED_EXCEPTION();
355 //------------------------------------------------------------------------
356 sal_Bool
OTableTreeListBox::isWildcardChecked(SvLBoxEntry
* _pEntry
) const
360 OBoldListboxString
* pTextItem
= static_cast<OBoldListboxString
*>(_pEntry
->GetFirstItem(SV_ITEM_ID_BOLDLBSTRING
));
362 return pTextItem
->isEmphasized();
367 //------------------------------------------------------------------------
368 void OTableTreeListBox::checkWildcard(SvLBoxEntry
* _pEntry
)
370 SetCheckButtonState(_pEntry
, SV_BUTTON_CHECKED
);
371 checkedButton_noBroadcast(_pEntry
);
374 //------------------------------------------------------------------------
375 SvLBoxEntry
* OTableTreeListBox::getAllObjectsEntry() const
377 return haveVirtualRoot() ? First() : NULL
;
380 //------------------------------------------------------------------------
381 void OTableTreeListBox::checkedButton_noBroadcast(SvLBoxEntry
* _pEntry
)
383 OMarkableTreeListBox::checkedButton_noBroadcast(_pEntry
);
385 // if an entry has children, it makes a difference if the entry is checked
386 // because all children are checked or if the user checked it explicitly.
387 // So we track explicit (un)checking
389 SvButtonState eState
= GetCheckButtonState(_pEntry
);
390 OSL_ENSURE(SV_BUTTON_TRISTATE
!= eState
, "OTableTreeListBox::CheckButtonHdl: user action which lead to TRISTATE?");
391 implEmphasize(_pEntry
, SV_BUTTON_CHECKED
== eState
);
394 //------------------------------------------------------------------------
395 void OTableTreeListBox::implEmphasize(SvLBoxEntry
* _pEntry
, sal_Bool _bChecked
, sal_Bool _bUpdateDescendants
, sal_Bool _bUpdateAncestors
)
397 OSL_ENSURE(_pEntry
, "OTableTreeListBox::implEmphasize: invalid entry (NULL)!");
399 // special emphasizing handling for the "all objects" entry
400 sal_Bool bAllObjectsEntryAffected
= haveVirtualRoot() && (getAllObjectsEntry() == _pEntry
);
401 if ( GetModel()->HasChildren(_pEntry
) // the entry has children
402 || bAllObjectsEntryAffected
// or it is the "all objects" entry
405 OBoldListboxString
* pTextItem
= static_cast<OBoldListboxString
*>(_pEntry
->GetFirstItem(SV_ITEM_ID_BOLDLBSTRING
));
407 pTextItem
->emphasize(_bChecked
);
409 if (bAllObjectsEntryAffected
)
410 InvalidateEntry(_pEntry
);
413 if (_bUpdateDescendants
)
415 // remove the mark for all children of the checked entry
416 SvLBoxEntry
* pChildLoop
= FirstChild(_pEntry
);
419 if (GetModel()->HasChildren(pChildLoop
))
420 implEmphasize(pChildLoop
, sal_False
, sal_True
, sal_False
);
421 pChildLoop
= NextSibling(pChildLoop
);
425 if (_bUpdateAncestors
)
427 // remove the mark for all ancestors of the entry
428 if (GetModel()->HasParent(_pEntry
))
429 implEmphasize(GetParent(_pEntry
), sal_False
, sal_False
, sal_True
);
433 //------------------------------------------------------------------------
434 void OTableTreeListBox::InitEntry(SvLBoxEntry
* _pEntry
, const XubString
& _rString
, const Image
& _rCollapsedBitmap
, const Image
& _rExpandedBitmap
, SvLBoxButtonKind _eButtonKind
)
436 OMarkableTreeListBox::InitEntry(_pEntry
, _rString
, _rCollapsedBitmap
, _rExpandedBitmap
, _eButtonKind
);
438 // replace the text item with our own one
439 SvLBoxItem
* pTextItem
= _pEntry
->GetFirstItem(SV_ITEM_ID_LBOXSTRING
);
440 OSL_ENSURE(pTextItem
, "OTableTreeListBox::InitEntry: no text item!?");
441 sal_uInt16 nTextPos
= _pEntry
->GetPos(pTextItem
);
442 OSL_ENSURE(((sal_uInt16
)-1) != nTextPos
, "OTableTreeListBox::InitEntry: no text item pos!");
444 _pEntry
->ReplaceItem(new OBoldListboxString(_pEntry
, 0, _rString
), nTextPos
);
447 //------------------------------------------------------------------------
448 SvLBoxEntry
* OTableTreeListBox::implAddEntry(
449 const Reference
< XDatabaseMetaData
>& _rxMeta
,
450 const ::rtl::OUString
& _rTableName
,
454 OSL_PRECOND( _rxMeta
.is(), "OTableTreeListBox::implAddEntry: invalid meta data!" );
458 // split the complete name into it's components
459 ::rtl::OUString sCatalog
, sSchema
, sName
;
460 qualifiedNameComponents( _rxMeta
, _rTableName
, sCatalog
, sSchema
, sName
, ::dbtools::eInDataManipulation
);
462 SvLBoxEntry
* pParentEntry
= getAllObjectsEntry();
464 // if the DB uses catalog at the start of identifiers, then our hierarchy is
472 sal_Bool bCatalogAtStart
= _rxMeta
->isCatalogAtStart();
473 const ::rtl::OUString
& rFirstName
= bCatalogAtStart
? sCatalog
: sSchema
;
474 const sal_Int32 nFirstFolderType
= bCatalogAtStart
? DatabaseObjectContainer::CATALOG
: DatabaseObjectContainer::SCHEMA
;
475 const ::rtl::OUString
& rSecondName
= bCatalogAtStart
? sSchema
: sCatalog
;
476 const sal_Int32 nSecondFolderType
= bCatalogAtStart
? DatabaseObjectContainer::SCHEMA
: DatabaseObjectContainer::CATALOG
;
478 if ( !rFirstName
.isEmpty() )
480 SvLBoxEntry
* pFolder
= GetEntryPosByName( rFirstName
, pParentEntry
);
482 pFolder
= InsertEntry( rFirstName
, pParentEntry
, sal_False
, LIST_APPEND
, reinterpret_cast< void* >( nFirstFolderType
) );
483 pParentEntry
= pFolder
;
486 if ( !rSecondName
.isEmpty() )
488 SvLBoxEntry
* pFolder
= GetEntryPosByName( rSecondName
, pParentEntry
);
490 pFolder
= InsertEntry( rSecondName
, pParentEntry
, sal_False
, LIST_APPEND
, reinterpret_cast< void* >( nSecondFolderType
) );
491 pParentEntry
= pFolder
;
494 SvLBoxEntry
* pRet
= NULL
;
495 if ( !_bCheckName
|| !GetEntryPosByName( sName
, pParentEntry
) )
497 pRet
= InsertEntry( sName
, pParentEntry
, sal_False
, LIST_APPEND
);
500 m_pImageProvider
->getImages( _rTableName
, DatabaseObject::TABLE
, aImage
);
502 SetExpandedEntryBmp( pRet
, aImage
);
503 SetCollapsedEntryBmp( pRet
, aImage
);
508 //------------------------------------------------------------------------
509 NamedDatabaseObject
OTableTreeListBox::describeObject( SvLBoxEntry
* _pEntry
)
511 NamedDatabaseObject aObject
;
513 sal_Int32 nEntryType
= reinterpret_cast< sal_IntPtr
>( _pEntry
->GetUserData() );
515 if ( nEntryType
== DatabaseObjectContainer::TABLES
)
517 aObject
.Type
= DatabaseObjectContainer::TABLES
;
519 else if ( ( nEntryType
== DatabaseObjectContainer::CATALOG
)
520 || ( nEntryType
== DatabaseObjectContainer::SCHEMA
)
523 SvLBoxEntry
* pParent
= GetParent( _pEntry
);
524 sal_Int32 nParentEntryType
= pParent
? reinterpret_cast< sal_IntPtr
>( pParent
->GetUserData() ) : -1;
526 ::rtl::OUStringBuffer buffer
;
527 if ( nEntryType
== DatabaseObjectContainer::CATALOG
)
529 if ( nParentEntryType
== DatabaseObjectContainer::SCHEMA
)
531 buffer
.append( GetEntryText( pParent
) );
532 buffer
.append( sal_Unicode( '.' ) );
534 buffer
.append( GetEntryText( _pEntry
) );
536 else if ( nEntryType
== DatabaseObjectContainer::SCHEMA
)
538 if ( nParentEntryType
== DatabaseObjectContainer::CATALOG
)
540 buffer
.append( GetEntryText( pParent
) );
541 buffer
.append( sal_Unicode( '.' ) );
543 buffer
.append( GetEntryText( _pEntry
) );
548 aObject
.Type
= DatabaseObject::TABLE
;
549 aObject
.Name
= getQualifiedTableName( _pEntry
);
555 //------------------------------------------------------------------------
556 SvLBoxEntry
* OTableTreeListBox::addedTable( const ::rtl::OUString
& _rName
)
560 Reference
< XDatabaseMetaData
> xMeta
;
561 if ( impl_getAndAssertMetaData( xMeta
) )
562 return implAddEntry( xMeta
, _rName
);
564 catch( const Exception
& )
566 DBG_UNHANDLED_EXCEPTION();
571 //------------------------------------------------------------------------
572 bool OTableTreeListBox::impl_getAndAssertMetaData( Reference
< XDatabaseMetaData
>& _out_rMetaData
) const
574 if ( m_xConnection
.is() )
575 _out_rMetaData
= m_xConnection
->getMetaData();
576 OSL_PRECOND( _out_rMetaData
.is(), "OTableTreeListBox::impl_getAndAssertMetaData: invalid current connection!" );
577 return _out_rMetaData
.is();
580 //------------------------------------------------------------------------
581 String
OTableTreeListBox::getQualifiedTableName( SvLBoxEntry
* _pEntry
) const
583 OSL_PRECOND( !isFolderEntry( _pEntry
), "OTableTreeListBox::getQualifiedTableName: folder entries not allowed here!" );
587 Reference
< XDatabaseMetaData
> xMeta
;
588 if ( !impl_getAndAssertMetaData( xMeta
) )
591 ::rtl::OUString sCatalog
;
592 ::rtl::OUString sSchema
;
593 ::rtl::OUString sTable
;
595 SvLBoxEntry
* pSchema
= GetParent( _pEntry
);
598 SvLBoxEntry
* pCatalog
= GetParent( pSchema
);
600 || ( xMeta
->supportsCatalogsInDataManipulation()
601 && !xMeta
->supportsSchemasInDataManipulation()
602 ) // here we support catalog but no schema
605 if ( pCatalog
== NULL
)
610 sCatalog
= GetEntryText( pCatalog
);
613 sSchema
= GetEntryText(pSchema
);
615 sTable
= GetEntryText( _pEntry
);
617 return ::dbtools::composeTableName( xMeta
, sCatalog
, sSchema
, sTable
, sal_False
, ::dbtools::eInDataManipulation
);
619 catch( const Exception
& )
621 DBG_UNHANDLED_EXCEPTION();
626 //------------------------------------------------------------------------
627 SvLBoxEntry
* OTableTreeListBox::getEntryByQualifiedName( const ::rtl::OUString
& _rName
)
631 Reference
< XDatabaseMetaData
> xMeta
;
632 if ( !impl_getAndAssertMetaData( xMeta
) )
635 // split the complete name into it's components
636 ::rtl::OUString sCatalog
, sSchema
, sName
;
637 qualifiedNameComponents(xMeta
, _rName
, sCatalog
, sSchema
, sName
,::dbtools::eInDataManipulation
);
639 SvLBoxEntry
* pParent
= getAllObjectsEntry();
640 SvLBoxEntry
* pCat
= NULL
;
641 SvLBoxEntry
* pSchema
= NULL
;
642 if ( !sCatalog
.isEmpty() )
644 pCat
= GetEntryPosByName(sCatalog
, pParent
);
649 if ( !sSchema
.isEmpty() )
651 pSchema
= GetEntryPosByName(sSchema
, pParent
);
656 return GetEntryPosByName(sName
, pParent
);
658 catch( const Exception
& )
660 DBG_UNHANDLED_EXCEPTION();
664 //------------------------------------------------------------------------
665 void OTableTreeListBox::removedTable( const ::rtl::OUString
& _rName
)
669 SvLBoxEntry
* pEntry
= getEntryByQualifiedName( _rName
);
671 GetModel()->Remove( pEntry
);
673 catch( const Exception
& )
675 DBG_UNHANDLED_EXCEPTION();
679 //.........................................................................
681 //.........................................................................
683 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */