LCOV - code coverage report
Current view: top level - libreoffice/dbaccess/source/ui/inc - tabletree.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 2 0.0 %
Date: 2012-12-27 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef _DBAUI_TABLETREE_HXX_
      21             : #define _DBAUI_TABLETREE_HXX_
      22             : 
      23             : #include "marktree.hxx"
      24             : 
      25             : #include <com/sun/star/beans/PropertyValue.hpp>
      26             : #include <com/sun/star/container/XNameAccess.hpp>
      27             : #include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
      28             : #include <com/sun/star/sdbc/XConnection.hpp>
      29             : #include <com/sun/star/sdbc/XDriver.hpp>
      30             : #include <com/sun/star/sdb/application/NamedDatabaseObject.hpp>
      31             : 
      32             : #include <memory>
      33             : 
      34             : //.........................................................................
      35             : namespace dbaui
      36             : {
      37             : //.........................................................................
      38             : 
      39             : class ImageProvider;
      40             : 
      41             : //========================================================================
      42             : //= OTableTreeListBox
      43             : //========================================================================
      44             : class OTableTreeListBox : public OMarkableTreeListBox
      45             : {
      46             : protected:
      47             :     ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
      48             :                     m_xConnection;      // the connection we're working for, set in implOnNewConnection, called by UpdateTableList
      49             :     ::std::auto_ptr< ImageProvider >
      50             :                     m_pImageProvider;   // provider for our images
      51             :     sal_Bool        m_bVirtualRoot; // should the first entry be visible
      52             :     bool            m_bNoEmptyFolders;  // should empty catalogs/schematas be prevented from being displayed?
      53             : 
      54             : public:
      55             :     OTableTreeListBox(
      56             :         Window* pParent,
      57             :         const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
      58             :         WinBits nWinStyle,
      59             :         sal_Bool _bVirtualRoot );
      60             : 
      61             :     OTableTreeListBox(
      62             :         Window* pParent,
      63             :         const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
      64             :         const ResId& rResId,
      65             :         sal_Bool _bVirtualRoot );
      66             : 
      67             :     ~OTableTreeListBox();
      68             : 
      69             :     typedef ::std::pair< ::rtl::OUString,sal_Bool>  TTableViewName;
      70             :     typedef ::std::vector< TTableViewName >         TNames;
      71             : 
      72           0 :     void    suppressEmptyFolders() { m_bNoEmptyFolders = true; }
      73             : 
      74             :     /** call when HiContrast change.
      75             :     */
      76             :     void notifyHiContrastChanged();
      77             : 
      78             :     /** determines whether the given entry denotes a tables folder
      79             :     */
      80             :     bool    isFolderEntry( const SvTreeListEntry* _pEntry ) const;
      81             : 
      82             :     /** determines whether the given entry denotes a table or view
      83             :     */
      84             :     bool    isTableOrViewEntry( const SvTreeListEntry* _pEntry ) const
      85             :     {
      86             :         return !isFolderEntry( _pEntry );
      87             :     }
      88             : 
      89             :     /** fill the table list with the tables belonging to the connection described by the parameters
      90             :         @param _rxConnection
      91             :             the connection, which must support the service com.sun.star.sdb.Connection
      92             :         @throws
      93             :             <type scope="com::sun::star::sdbc">SQLException</type> if no connection could be created
      94             :     */
      95             :     void    UpdateTableList(
      96             :                 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection
      97             :             )   throw(::com::sun::star::sdbc::SQLException);
      98             : 
      99             :     /** fill the table list with the tables and views determined by the two given containers.
     100             :         The views sequence is used to determine which table is of type view.
     101             :         @param      _rxConnection   the connection where you got the object names from. Must not be NULL.
     102             :                                     Used to split the full qualified names into it's parts.
     103             :         @param      _rTables        table/view sequence
     104             :         @param      _rViews         view sequence
     105             :     */
     106             :     void    UpdateTableList(
     107             :                 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
     108             :                 const ::com::sun::star::uno::Sequence< ::rtl::OUString>& _rTables,
     109             :                 const ::com::sun::star::uno::Sequence< ::rtl::OUString>& _rViews
     110             :             );
     111             : 
     112             :     /** returns a NamedDatabaseObject record which describes the given entry
     113             :     */
     114             :     ::com::sun::star::sdb::application::NamedDatabaseObject
     115             :             describeObject( SvTreeListEntry* _pEntry );
     116             : 
     117             :     /** to be used if a foreign instance added a table
     118             :     */
     119             :     SvTreeListEntry* addedTable( const ::rtl::OUString& _rName );
     120             : 
     121             :     /** to be used if a foreign instance removed a table
     122             :     */
     123             :     void    removedTable( const ::rtl::OUString& _rName );
     124             : 
     125             :     /** returns the fully qualified name of a table entry
     126             :         @param _pEntry
     127             :             the entry whose name is to be obtained. Must not denote a folder entry.
     128             :     */
     129             :     String getQualifiedTableName( SvTreeListEntry* _pEntry ) const;
     130             : 
     131             :     SvTreeListEntry*    getEntryByQualifiedName( const ::rtl::OUString& _rName );
     132             : 
     133             :     SvTreeListEntry*    getAllObjectsEntry() const;
     134             : 
     135             :     /** does a wildcard check of the given entry
     136             :         <p>There are two different 'checked' states: If the user checks all children of an entry, this is different
     137             :         from checking the entry itself. The second is called 'wildcard' checking, 'cause in the resulting
     138             :         table filter it's represented by a wildcard.</p>
     139             :     */
     140             :     void            checkWildcard(SvTreeListEntry* _pEntry);
     141             : 
     142             :     /** determine if the given entry is 'wildcard checked'
     143             :         @see checkWildcard
     144             :     */
     145             :     sal_Bool        isWildcardChecked(SvTreeListEntry* _pEntry) const;
     146             : 
     147             : protected:
     148             :     virtual void InitEntry(SvTreeListEntry* _pEntry, const OUString& _rString, const Image& _rCollapsedBitmap, const Image& _rExpandedBitmap, SvLBoxButtonKind _eButtonKind);
     149             : 
     150             :     virtual void checkedButton_noBroadcast(SvTreeListEntry* _pEntry);
     151             : 
     152             :     void implEmphasize(SvTreeListEntry* _pEntry, sal_Bool _bChecked, sal_Bool _bUpdateDescendants = sal_True, sal_Bool _bUpdateAncestors = sal_True);
     153             : 
     154             :     /** adds the given entry to our list
     155             :         @precond
     156             :             our image provider must already have been reset to the connection to which the meta data
     157             :             belong.
     158             :     */
     159             :     SvTreeListEntry* implAddEntry(
     160             :             const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rxMeta,
     161             :             const ::rtl::OUString& _rTableName,
     162             :             sal_Bool _bCheckName = sal_True
     163             :         );
     164             : 
     165             :     void    implSetDefaultImages();
     166             : 
     167             :     void    implOnNewConnection( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection );
     168             : 
     169             :     bool    impl_getAndAssertMetaData( ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _out_rMetaData ) const;
     170             : 
     171           0 :     sal_Bool haveVirtualRoot() const { return m_bVirtualRoot; }
     172             : 
     173             :     /** fill the table list with the tables and views determined by the two given containers
     174             :         @param      _rxConnection   the connection where you got the object names from. Must not be NULL.
     175             :                                     Used to split the full qualified names into it's parts.
     176             :         @param      _rTables        table/view sequence, the second argument is <TRUE/> if it is a table, otherwise it is a view.
     177             :     */
     178             :     void    UpdateTableList(
     179             :                 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
     180             :                 const TNames& _rTables
     181             :             );
     182             : 
     183             : };
     184             : 
     185             : //.........................................................................
     186             : }   // namespace dbaui
     187             : //.........................................................................
     188             : 
     189             : #endif // _DBAUI_TABLETREE_HXX_
     190             : 
     191             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10