merge the formfield patch from ooo-build
[ooovba.git] / dbaccess / source / ui / inc / tabletree.hxx
blobb12c73fee21ab1e336f30747d46a1e02d00bf0cc
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: tabletree.hxx,v $
10 * $Revision: 1.19 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _DBAUI_TABLETREE_HXX_
32 #define _DBAUI_TABLETREE_HXX_
34 #ifndef _DBAUI_MARKTREE_HXX_
35 #include "marktree.hxx"
36 #endif
38 #ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
39 #include <com/sun/star/beans/PropertyValue.hpp>
40 #endif
41 #ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
42 #include <com/sun/star/container/XNameAccess.hpp>
43 #endif
44 #ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_
45 #include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
46 #endif
47 #ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
48 #include <com/sun/star/sdbc/XConnection.hpp>
49 #endif
50 #ifndef _COM_SUN_STAR_SDBC_XDRIVER_HPP_
51 #include <com/sun/star/sdbc/XDriver.hpp>
52 #endif
53 #ifndef _COM_SUN_STAR_SDB_APPLICATION_NAMEDDATABASEOBJECT_HPP_
54 #include <com/sun/star/sdb/application/NamedDatabaseObject.hpp>
55 #endif
57 #include <memory>
59 //.........................................................................
60 namespace dbaui
62 //.........................................................................
64 class ImageProvider;
66 //========================================================================
67 //= OTableTreeListBox
68 //========================================================================
69 class OTableTreeListBox : public OMarkableTreeListBox
71 protected:
72 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
73 m_xConnection; // the connection we're working for, set in implOnNewConnection, called by UpdateTableList
74 ::std::auto_ptr< ImageProvider >
75 m_pImageProvider; // provider for our images
76 sal_Bool m_bVirtualRoot; // should the first entry be visible
77 bool m_bNoEmptyFolders; // should empty catalogs/schematas be prevented from being displayed?
79 public:
80 OTableTreeListBox(
81 Window* pParent,
82 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
83 WinBits nWinStyle,
84 sal_Bool _bVirtualRoot );
86 OTableTreeListBox(
87 Window* pParent,
88 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
89 const ResId& rResId,
90 sal_Bool _bVirtualRoot );
92 ~OTableTreeListBox();
94 typedef ::std::pair< ::rtl::OUString,sal_Bool> TTableViewName;
95 typedef ::std::vector< TTableViewName > TNames;
97 void suppressEmptyFolders() { m_bNoEmptyFolders = true; }
99 /** call when HiContrast change.
101 void notifyHiContrastChanged();
103 /** determines whether the given entry denotes a tables folder
105 bool isFolderEntry( const SvLBoxEntry* _pEntry ) const;
107 /** determines whether the given entry denotes a table or view
109 bool isTableOrViewEntry( const SvLBoxEntry* _pEntry ) const
111 return !isFolderEntry( _pEntry );
114 /** fill the table list with the tables belonging to the connection described by the parameters
115 @param _rxConnection
116 the connection, which must support the service com.sun.star.sdb.Connection
117 @throws
118 <type scope="com::sun::star::sdbc">SQLException</type> if no connection could be created
120 void UpdateTableList(
121 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection
122 ) throw(::com::sun::star::sdbc::SQLException);
124 /** fill the table list with the tables and views determined by the two given containers.
125 The views sequence is used to determine which table is of type view.
126 @param _rxConnection the connection where you got the object names from. Must not be NULL.
127 Used to split the full qualified names into it's parts.
128 @param _rTables table/view sequence
129 @param _rViews view sequence
131 void UpdateTableList(
132 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
133 const ::com::sun::star::uno::Sequence< ::rtl::OUString>& _rTables,
134 const ::com::sun::star::uno::Sequence< ::rtl::OUString>& _rViews
137 /** returns a NamedDatabaseObject record which describes the given entry
139 ::com::sun::star::sdb::application::NamedDatabaseObject
140 describeObject( SvLBoxEntry* _pEntry );
142 /** to be used if a foreign instance added a table
144 SvLBoxEntry* addedTable( const ::rtl::OUString& _rName );
146 /** to be used if a foreign instance removed a table
148 void removedTable( const ::rtl::OUString& _rName );
150 /** returns the fully qualified name of a table entry
151 @param _pEntry
152 the entry whose name is to be obtained. Must not denote a folder entry.
154 String getQualifiedTableName( SvLBoxEntry* _pEntry ) const;
156 SvLBoxEntry* getEntryByQualifiedName( const ::rtl::OUString& _rName );
158 SvLBoxEntry* getAllObjectsEntry() const;
160 /** does a wildcard check of the given entry
161 <p>There are two different 'checked' states: If the user checks all children of an entry, this is different
162 from checking the entry itself. The second is called 'wildcard' checking, 'cause in the resulting
163 table filter it's represented by a wildcard.</p>
165 void checkWildcard(SvLBoxEntry* _pEntry);
167 /** determine if the given entry is 'wildcard checked'
168 @see checkWildcard
170 sal_Bool isWildcardChecked(SvLBoxEntry* _pEntry) const;
172 protected:
173 virtual void InitEntry(SvLBoxEntry* _pEntry, const XubString& _rString, const Image& _rCollapsedBitmap, const Image& _rExpandedBitmap, SvLBoxButtonKind _eButtonKind);
175 virtual void checkedButton_noBroadcast(SvLBoxEntry* _pEntry);
177 void implEmphasize(SvLBoxEntry* _pEntry, sal_Bool _bChecked, sal_Bool _bUpdateDescendants = sal_True, sal_Bool _bUpdateAncestors = sal_True);
179 /** adds the given entry to our list
180 @precond
181 our image provider must already have been reset to the connection to which the meta data
182 belong.
184 SvLBoxEntry* implAddEntry(
185 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rxMeta,
186 const ::rtl::OUString& _rTableName,
187 sal_Bool _bCheckName = sal_True
190 void implSetDefaultImages();
192 void implOnNewConnection( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection );
194 bool impl_getAndAssertMetaData( ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _out_rMetaData ) const;
196 sal_Bool haveVirtualRoot() const { return m_bVirtualRoot; }
198 /** fill the table list with the tables and views determined by the two given containers
199 @param _rxConnection the connection where you got the object names from. Must not be NULL.
200 Used to split the full qualified names into it's parts.
201 @param _rTables table/view sequence, the second argument is <TRUE/> if it is a table, otherwise it is a view.
203 void UpdateTableList(
204 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
205 const TNames& _rTables
210 //.........................................................................
211 } // namespace dbaui
212 //.........................................................................
214 #endif // _DBAUI_TABLETREE_HXX_