2010-10-27 12:33:13 +01:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-06-14 17:39:53 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2000-10-05 09:09:48 +00:00
|
|
|
|
2013-11-05 02:18:53 +01:00
|
|
|
#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_TABLETREE_HXX
|
|
|
|
#define INCLUDED_DBACCESS_SOURCE_UI_INC_TABLETREE_HXX
|
2000-10-05 09:09:48 +00:00
|
|
|
|
2014-01-21 12:17:38 +00:00
|
|
|
#include "imageprovider.hxx"
|
2000-10-05 09:09:48 +00:00
|
|
|
#include "marktree.hxx"
|
|
|
|
|
|
|
|
#include <com/sun/star/beans/PropertyValue.hpp>
|
|
|
|
#include <com/sun/star/container/XNameAccess.hpp>
|
|
|
|
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
|
|
|
|
#include <com/sun/star/sdbc/XConnection.hpp>
|
2001-08-28 07:21:51 +00:00
|
|
|
#include <com/sun/star/sdbc/XDriver.hpp>
|
2008-06-25 11:50:22 +00:00
|
|
|
#include <com/sun/star/sdb/application/NamedDatabaseObject.hpp>
|
2014-01-21 12:17:38 +00:00
|
|
|
#include <boost/scoped_ptr.hpp>
|
2006-10-05 12:06:40 +00:00
|
|
|
|
2000-10-05 09:09:48 +00:00
|
|
|
namespace dbaui
|
|
|
|
{
|
|
|
|
|
2013-08-17 23:43:14 +02:00
|
|
|
// OTableTreeListBox
|
2000-10-05 09:09:48 +00:00
|
|
|
class OTableTreeListBox : public OMarkableTreeListBox
|
|
|
|
{
|
|
|
|
protected:
|
2006-10-05 12:06:40 +00:00
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
|
|
|
|
m_xConnection; // the connection we're working for, set in implOnNewConnection, called by UpdateTableList
|
2014-01-21 12:17:38 +00:00
|
|
|
boost::scoped_ptr< ImageProvider >
|
|
|
|
m_xImageProvider; // provider for our images
|
2014-04-17 11:16:55 +02:00
|
|
|
bool m_bVirtualRoot; // should the first entry be visible
|
2009-02-16 07:31:09 +00:00
|
|
|
bool m_bNoEmptyFolders; // should empty catalogs/schematas be prevented from being displayed?
|
2000-10-05 09:09:48 +00:00
|
|
|
|
|
|
|
public:
|
2014-09-23 11:20:40 +02:00
|
|
|
OTableTreeListBox(vcl::Window* pParent, WinBits nWinStyle);
|
2014-01-21 12:17:38 +00:00
|
|
|
|
|
|
|
void init(bool bVirtualRoot) { m_bVirtualRoot = bVirtualRoot; }
|
2006-06-20 02:19:23 +00:00
|
|
|
|
2015-04-17 11:40:23 +02:00
|
|
|
typedef ::std::pair< OUString, bool > TTableViewName;
|
2005-01-21 16:19:20 +00:00
|
|
|
typedef ::std::vector< TTableViewName > TNames;
|
2006-10-05 12:06:40 +00:00
|
|
|
|
2009-02-16 07:31:09 +00:00
|
|
|
void suppressEmptyFolders() { m_bNoEmptyFolders = true; }
|
|
|
|
|
2002-04-29 07:19:08 +00:00
|
|
|
/** call when HiContrast change.
|
|
|
|
*/
|
2006-10-05 12:06:40 +00:00
|
|
|
void notifyHiContrastChanged();
|
|
|
|
|
|
|
|
/** determines whether the given entry denotes a tables folder
|
|
|
|
*/
|
2015-04-24 15:29:31 +02:00
|
|
|
static bool isFolderEntry( const SvTreeListEntry* _pEntry );
|
2006-10-05 12:06:40 +00:00
|
|
|
|
|
|
|
/** determines whether the given entry denotes a table or view
|
|
|
|
*/
|
2015-04-24 15:29:31 +02:00
|
|
|
static bool isTableOrViewEntry( const SvTreeListEntry* _pEntry )
|
2006-10-05 12:06:40 +00:00
|
|
|
{
|
|
|
|
return !isFolderEntry( _pEntry );
|
|
|
|
}
|
2002-04-29 07:19:08 +00:00
|
|
|
|
2000-10-05 09:09:48 +00:00
|
|
|
/** fill the table list with the tables belonging to the connection described by the parameters
|
2006-10-05 12:06:40 +00:00
|
|
|
@param _rxConnection
|
2004-11-09 11:35:33 +00:00
|
|
|
the connection, which must support the service com.sun.star.sdb.Connection
|
2001-08-28 07:21:51 +00:00
|
|
|
@throws
|
|
|
|
<type scope="com::sun::star::sdbc">SQLException</type> if no connection could be created
|
2000-10-05 09:09:48 +00:00
|
|
|
*/
|
2006-10-05 12:06:40 +00:00
|
|
|
void UpdateTableList(
|
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection
|
2001-08-14 11:00:23 +00:00
|
|
|
) throw(::com::sun::star::sdbc::SQLException);
|
2000-10-05 09:09:48 +00:00
|
|
|
|
2005-01-21 16:19:20 +00:00
|
|
|
/** fill the table list with the tables and views determined by the two given containers.
|
|
|
|
The views sequence is used to determine which table is of type view.
|
2006-10-05 12:06:40 +00:00
|
|
|
@param _rxConnection the connection where you got the object names from. Must not be NULL.
|
2000-10-05 09:09:48 +00:00
|
|
|
Used to split the full qualified names into it's parts.
|
2005-01-21 16:19:20 +00:00
|
|
|
@param _rTables table/view sequence
|
|
|
|
@param _rViews view sequence
|
2000-10-05 09:09:48 +00:00
|
|
|
*/
|
2001-08-14 11:00:23 +00:00
|
|
|
void UpdateTableList(
|
2006-10-05 12:06:40 +00:00
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
|
2013-04-07 12:06:47 +02:00
|
|
|
const ::com::sun::star::uno::Sequence< OUString>& _rTables,
|
|
|
|
const ::com::sun::star::uno::Sequence< OUString>& _rViews
|
2001-08-14 11:00:23 +00:00
|
|
|
);
|
|
|
|
|
2008-06-25 11:50:22 +00:00
|
|
|
/** returns a NamedDatabaseObject record which describes the given entry
|
|
|
|
*/
|
|
|
|
::com::sun::star::sdb::application::NamedDatabaseObject
|
2012-10-18 16:28:20 +02:00
|
|
|
describeObject( SvTreeListEntry* _pEntry );
|
2008-06-25 11:50:22 +00:00
|
|
|
|
2001-08-14 11:00:23 +00:00
|
|
|
/** to be used if a foreign instance added a table
|
|
|
|
*/
|
2013-04-07 12:06:47 +02:00
|
|
|
SvTreeListEntry* addedTable( const OUString& _rName );
|
2001-08-14 11:00:23 +00:00
|
|
|
|
|
|
|
/** to be used if a foreign instance removed a table
|
|
|
|
*/
|
2013-04-07 12:06:47 +02:00
|
|
|
void removedTable( const OUString& _rName );
|
2000-10-05 09:09:48 +00:00
|
|
|
|
2006-10-05 12:06:40 +00:00
|
|
|
/** returns the fully qualified name of a table entry
|
|
|
|
@param _pEntry
|
|
|
|
the entry whose name is to be obtained. Must not denote a folder entry.
|
|
|
|
*/
|
2013-09-26 12:17:53 +02:00
|
|
|
OUString getQualifiedTableName( SvTreeListEntry* _pEntry ) const;
|
2006-10-05 12:06:40 +00:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
SvTreeListEntry* getEntryByQualifiedName( const OUString& _rName );
|
2004-08-02 15:03:08 +00:00
|
|
|
|
2012-10-18 16:28:20 +02:00
|
|
|
SvTreeListEntry* getAllObjectsEntry() const;
|
2001-01-30 07:29:43 +00:00
|
|
|
|
|
|
|
/** does a wildcard check of the given entry
|
|
|
|
<p>There are two different 'checked' states: If the user checks all children of an entry, this is different
|
|
|
|
from checking the entry itself. The second is called 'wildcard' checking, 'cause in the resulting
|
|
|
|
table filter it's represented by a wildcard.</p>
|
|
|
|
*/
|
2012-10-18 16:28:20 +02:00
|
|
|
void checkWildcard(SvTreeListEntry* _pEntry);
|
2001-01-30 07:29:43 +00:00
|
|
|
|
|
|
|
/** determine if the given entry is 'wildcard checked'
|
|
|
|
@see checkWildcard
|
|
|
|
*/
|
2015-04-24 15:29:31 +02:00
|
|
|
static bool isWildcardChecked(SvTreeListEntry* _pEntry);
|
2001-01-30 07:29:43 +00:00
|
|
|
|
2000-10-05 09:09:48 +00:00
|
|
|
protected:
|
2014-03-27 18:12:18 +01:00
|
|
|
virtual void InitEntry(SvTreeListEntry* _pEntry, const OUString& _rString, const Image& _rCollapsedBitmap, const Image& _rExpandedBitmap, SvLBoxButtonKind _eButtonKind) SAL_OVERRIDE;
|
2001-01-30 07:29:43 +00:00
|
|
|
|
2014-03-27 18:12:18 +01:00
|
|
|
virtual void checkedButton_noBroadcast(SvTreeListEntry* _pEntry) SAL_OVERRIDE;
|
2001-01-30 07:29:43 +00:00
|
|
|
|
2014-04-17 11:16:55 +02:00
|
|
|
void implEmphasize(SvTreeListEntry* _pEntry, bool _bChecked, bool _bUpdateDescendants = true, bool _bUpdateAncestors = true);
|
2001-08-14 11:00:23 +00:00
|
|
|
|
2006-10-05 12:06:40 +00:00
|
|
|
/** adds the given entry to our list
|
|
|
|
@precond
|
|
|
|
our image provider must already have been reset to the connection to which the meta data
|
|
|
|
belong.
|
|
|
|
*/
|
2012-10-18 16:28:20 +02:00
|
|
|
SvTreeListEntry* implAddEntry(
|
2006-10-05 12:06:40 +00:00
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rxMeta,
|
2013-04-07 12:06:47 +02:00
|
|
|
const OUString& _rTableName,
|
2014-04-17 11:16:55 +02:00
|
|
|
bool _bCheckName = true
|
2001-08-14 11:00:23 +00:00
|
|
|
);
|
|
|
|
|
2006-10-05 12:06:40 +00:00
|
|
|
void implSetDefaultImages();
|
|
|
|
|
|
|
|
void implOnNewConnection( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection );
|
|
|
|
|
|
|
|
bool impl_getAndAssertMetaData( ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _out_rMetaData ) const;
|
|
|
|
|
2014-04-17 11:16:55 +02:00
|
|
|
bool haveVirtualRoot() const { return m_bVirtualRoot; }
|
2005-01-21 16:19:20 +00:00
|
|
|
|
|
|
|
/** fill the table list with the tables and views determined by the two given containers
|
2006-10-05 12:06:40 +00:00
|
|
|
@param _rxConnection the connection where you got the object names from. Must not be NULL.
|
2005-01-21 16:19:20 +00:00
|
|
|
Used to split the full qualified names into it's parts.
|
|
|
|
@param _rTables table/view sequence, the second argument is <TRUE/> if it is a table, otherwise it is a view.
|
|
|
|
*/
|
|
|
|
void UpdateTableList(
|
2006-10-05 12:06:40 +00:00
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
|
2005-01-21 16:19:20 +00:00
|
|
|
const TNames& _rTables
|
|
|
|
);
|
|
|
|
|
2000-10-05 09:09:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dbaui
|
|
|
|
|
2013-11-05 02:18:53 +01:00
|
|
|
#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_TABLETREE_HXX
|
2000-10-05 09:09:48 +00:00
|
|
|
|
2010-10-27 12:33:13 +01:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|