android: Update app icon to new startcenter icon
[LibreOffice.git] / dbaccess / source / ui / inc / tabletree.hxx
blobebfbf7d29c4ad66b5fac1caf019b8854edbe863f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include "imageprovider.hxx"
23 #include "dbtreelistbox.hxx"
25 #include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
26 #include <com/sun/star/sdbc/XConnection.hpp>
27 #include <com/sun/star/sdb/application/NamedDatabaseObject.hpp>
28 #include <memory>
30 namespace dbaui
33 // OTableTreeListBox
34 class OTableTreeListBox : public TreeListBox
36 css::uno::Reference< css::sdbc::XConnection >
37 m_xConnection; // the connection we're working for, set in implOnNewConnection, called by UpdateTableList
38 std::unique_ptr< ImageProvider >
39 m_xImageProvider; // provider for our images
40 bool m_bVirtualRoot; // should the first entry be visible
41 bool m_bNoEmptyFolders; // should empty catalogs/schematas be prevented from being displayed?
42 bool m_bShowToggles; // show toggle buttons
44 public:
45 OTableTreeListBox(std::unique_ptr<weld::TreeView> xTreeView, bool bShowToggles);
47 void init() { m_bVirtualRoot = true; }
49 typedef std::pair< OUString, bool > TTableViewName;
50 typedef std::vector< TTableViewName > TNames;
52 void SuppressEmptyFolders() { m_bNoEmptyFolders = true; }
54 /** determines whether the given entry denotes a tables folder
56 bool isFolderEntry(const weld::TreeIter& rEntry) const;
58 /** fill the table list with the tables belonging to the connection described by the parameters
59 @param _rxConnection
60 the connection, which must support the service com.sun.star.sdb.Connection
61 @throws
62 <type scope="css::sdbc">SQLException</type> if no connection could be created
64 void UpdateTableList(
65 const css::uno::Reference< css::sdbc::XConnection >& _rxConnection
68 /** fill the table list with the tables and views determined by the two given containers.
69 The views sequence is used to determine which table is of type view.
70 @param _rxConnection the connection where you got the object names from. Must not be NULL.
71 Used to split the full qualified names into its parts.
72 @param _rTables table/view sequence
73 @param _rViews view sequence
75 void UpdateTableList(
76 const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
77 const css::uno::Sequence< OUString>& _rTables,
78 const css::uno::Sequence< OUString>& _rViews
81 /** to be used if a foreign instance added a table
83 std::unique_ptr<weld::TreeIter> addedTable( const OUString& _rName );
85 /** to be used if a foreign instance removed a table
87 void removedTable( const OUString& _rName );
89 std::unique_ptr<weld::TreeIter> getAllObjectsEntry() const;
91 /** does a wildcard check of the given entry
92 <p>There are two different 'checked' states: If the user checks all children of an entry, this is different
93 from checking the entry itself. The second is called 'wildcard' checking, 'cause in the resulting
94 table filter it's represented by a wildcard.</p>
96 void checkWildcard(const weld::TreeIter& rEntry);
98 /** determine if the given entry is 'wildcard checked'
99 @see checkWildcard
101 bool isWildcardChecked(const weld::TreeIter& rEntry);
103 void CheckButtons(); // make the button states consistent (bottom-up)
105 void checkedButton_noBroadcast(const weld::TreeIter& rEntry);
106 private:
107 TriState implDetermineState(const weld::TreeIter& rEntry);
109 void implEmphasize(const weld::TreeIter& rEntry, bool _bChecked, bool _bUpdateDescendants = true, bool _bUpdateAncestors = true);
111 /** adds the given entry to our list
112 @precond
113 our image provider must already have been reset to the connection to which the meta data
114 belong.
116 std::unique_ptr<weld::TreeIter> implAddEntry(
117 const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _rxMeta,
118 const OUString& _rTableName,
119 bool _bCheckName = true
122 void implOnNewConnection( const css::uno::Reference< css::sdbc::XConnection >& _rxConnection );
124 bool impl_getAndAssertMetaData( css::uno::Reference< css::sdbc::XDatabaseMetaData >& _out_rMetaData ) const;
126 bool haveVirtualRoot() const { return m_bVirtualRoot; }
128 public:
129 /** fill the table list with the tables and views determined by the two given containers
130 @param _rxConnection the connection where you got the object names from. Must not be NULL.
131 Used to split the full qualified names into its parts.
132 @param _rTables table/view sequence, the second argument is <TRUE/> if it is a table, otherwise it is a view.
134 void UpdateTableList(
135 const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
136 const TNames& _rTables
139 /** returns a NamedDatabaseObject record which describes the given entry
141 css::sdb::application::NamedDatabaseObject
142 describeObject(const weld::TreeIter& rEntry);
144 /** returns the fully qualified name of a table entry
145 @param _pEntry
146 the entry whose name is to be obtained. Must not denote a folder entry.
148 OUString getQualifiedTableName(const weld::TreeIter& rEntry) const;
150 std::unique_ptr<weld::TreeIter> getEntryByQualifiedName(const OUString& rName);
153 } // namespace dbaui
155 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */