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
|
|
|
|
|
|
|
#ifndef _DBAUI_TABLETREE_HXX_
|
|
|
|
#define _DBAUI_TABLETREE_HXX_
|
|
|
|
|
|
|
|
#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>
|
2000-10-05 09:09:48 +00:00
|
|
|
|
2006-10-05 12:06:40 +00:00
|
|
|
#include <memory>
|
|
|
|
|
2000-10-05 09:09:48 +00:00
|
|
|
//.........................................................................
|
|
|
|
namespace dbaui
|
|
|
|
{
|
|
|
|
//.........................................................................
|
|
|
|
|
2006-10-05 12:06:40 +00:00
|
|
|
class ImageProvider;
|
|
|
|
|
2000-10-05 09:09:48 +00:00
|
|
|
//========================================================================
|
|
|
|
//= OTableTreeListBox
|
|
|
|
//========================================================================
|
|
|
|
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
|
|
|
|
::std::auto_ptr< ImageProvider >
|
|
|
|
m_pImageProvider; // provider for our images
|
2001-08-14 11:00:23 +00:00
|
|
|
sal_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:
|
2006-06-20 02:19:23 +00:00
|
|
|
OTableTreeListBox(
|
|
|
|
Window* pParent,
|
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
|
|
|
|
WinBits nWinStyle,
|
|
|
|
sal_Bool _bVirtualRoot );
|
|
|
|
|
|
|
|
OTableTreeListBox(
|
|
|
|
Window* pParent,
|
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
|
|
|
|
const ResId& rResId,
|
|
|
|
sal_Bool _bVirtualRoot );
|
2005-01-21 16:19:20 +00:00
|
|
|
|
2006-10-05 12:06:40 +00:00
|
|
|
~OTableTreeListBox();
|
|
|
|
|
2005-01-21 16:19:20 +00:00
|
|
|
typedef ::std::pair< ::rtl::OUString,sal_Bool> TTableViewName;
|
|
|
|
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
|
|
|
|
*/
|
|
|
|
bool isFolderEntry( const SvLBoxEntry* _pEntry ) const;
|
|
|
|
|
|
|
|
/** determines whether the given entry denotes a table or view
|
|
|
|
*/
|
|
|
|
bool isTableOrViewEntry( const SvLBoxEntry* _pEntry ) const
|
|
|
|
{
|
|
|
|
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,
|
2005-01-21 16:19:20 +00:00
|
|
|
const ::com::sun::star::uno::Sequence< ::rtl::OUString>& _rTables,
|
|
|
|
const ::com::sun::star::uno::Sequence< ::rtl::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
|
|
|
|
describeObject( SvLBoxEntry* _pEntry );
|
|
|
|
|
2001-08-14 11:00:23 +00:00
|
|
|
/** to be used if a foreign instance added a table
|
|
|
|
*/
|
2006-10-05 12:06:40 +00:00
|
|
|
SvLBoxEntry* addedTable( const ::rtl::OUString& _rName );
|
2001-08-14 11:00:23 +00:00
|
|
|
|
|
|
|
/** to be used if a foreign instance removed a table
|
|
|
|
*/
|
2006-10-05 12:06:40 +00:00
|
|
|
void removedTable( const ::rtl::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.
|
|
|
|
*/
|
|
|
|
String getQualifiedTableName( SvLBoxEntry* _pEntry ) const;
|
|
|
|
|
|
|
|
SvLBoxEntry* getEntryByQualifiedName( const ::rtl::OUString& _rName );
|
2004-08-02 15:03:08 +00:00
|
|
|
|
2001-01-30 07:29:43 +00:00
|
|
|
SvLBoxEntry* getAllObjectsEntry() const;
|
|
|
|
|
|
|
|
/** 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>
|
|
|
|
*/
|
|
|
|
void checkWildcard(SvLBoxEntry* _pEntry);
|
|
|
|
|
|
|
|
/** determine if the given entry is 'wildcard checked'
|
|
|
|
@see checkWildcard
|
|
|
|
*/
|
|
|
|
sal_Bool isWildcardChecked(SvLBoxEntry* _pEntry) const;
|
|
|
|
|
2000-10-05 09:09:48 +00:00
|
|
|
protected:
|
2006-12-20 13:14:46 +00:00
|
|
|
virtual void InitEntry(SvLBoxEntry* _pEntry, const XubString& _rString, const Image& _rCollapsedBitmap, const Image& _rExpandedBitmap, SvLBoxButtonKind _eButtonKind);
|
2001-01-30 07:29:43 +00:00
|
|
|
|
|
|
|
virtual void checkedButton_noBroadcast(SvLBoxEntry* _pEntry);
|
|
|
|
|
2001-06-05 11:39:02 +00:00
|
|
|
void implEmphasize(SvLBoxEntry* _pEntry, sal_Bool _bChecked, sal_Bool _bUpdateDescendants = sal_True, sal_Bool _bUpdateAncestors = sal_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.
|
|
|
|
*/
|
2004-08-02 15:03:08 +00:00
|
|
|
SvLBoxEntry* implAddEntry(
|
2006-10-05 12:06:40 +00:00
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rxMeta,
|
2001-08-14 11:00:23 +00:00
|
|
|
const ::rtl::OUString& _rTableName,
|
2004-08-02 15:03:08 +00:00
|
|
|
sal_Bool _bCheckName = sal_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;
|
|
|
|
|
2001-08-14 11:00:23 +00:00
|
|
|
sal_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
|
|
|
|
//.........................................................................
|
|
|
|
|
|
|
|
#endif // _DBAUI_TABLETREE_HXX_
|
|
|
|
|
2010-10-27 12:33:13 +01:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|