LibreOffice Module dbaccess (master) 1
tabletree.hxx
Go to the documentation of this file.
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#pragma once
21
22#include "imageprovider.hxx"
23#include "dbtreelistbox.hxx"
24
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>
29
30namespace dbaui
31{
32
33// OTableTreeListBox
35{
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
43
44public:
45 OTableTreeListBox(std::unique_ptr<weld::TreeView> xTreeView, bool bShowToggles);
46
47 void init() { m_bVirtualRoot = true; }
48
49 typedef std::pair< OUString, bool > TTableViewName;
50 typedef std::vector< TTableViewName > TNames;
51
53
56 bool isFolderEntry(const weld::TreeIter& rEntry) const;
57
65 const css::uno::Reference< css::sdbc::XConnection >& _rxConnection
66 );
67
76 const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
77 const css::uno::Sequence< OUString>& _rTables,
78 const css::uno::Sequence< OUString>& _rViews
79 );
80
83 std::unique_ptr<weld::TreeIter> addedTable( const OUString& _rName );
84
87 void removedTable( const OUString& _rName );
88
89 std::unique_ptr<weld::TreeIter> getAllObjectsEntry() const;
90
96 void checkWildcard(const weld::TreeIter& rEntry);
97
101 bool isWildcardChecked(const weld::TreeIter& rEntry);
102
103 void CheckButtons(); // make the button states consistent (bottom-up)
104
105 void checkedButton_noBroadcast(const weld::TreeIter& rEntry);
106private:
108
109 void implEmphasize(const weld::TreeIter& rEntry, bool _bChecked, bool _bUpdateDescendants = true, bool _bUpdateAncestors = true);
110
116 std::unique_ptr<weld::TreeIter> implAddEntry(
117 const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _rxMeta,
118 const OUString& _rTableName,
119 bool _bCheckName = true
120 );
121
122 void implOnNewConnection( const css::uno::Reference< css::sdbc::XConnection >& _rxConnection );
123
124 bool impl_getAndAssertMetaData( css::uno::Reference< css::sdbc::XDatabaseMetaData >& _out_rMetaData ) const;
125
126 bool haveVirtualRoot() const { return m_bVirtualRoot; }
127
128public:
135 const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
136 const TNames& _rTables
137 );
138
141 css::sdb::application::NamedDatabaseObject
142 describeObject(const weld::TreeIter& rEntry);
143
148 OUString getQualifiedTableName(const weld::TreeIter& rEntry) const;
149
150 std::unique_ptr<weld::TreeIter> getEntryByQualifiedName(const OUString& rName);
151};
152
153} // namespace dbaui
154
155/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::vector< TTableViewName > TNames
Definition: tabletree.hxx:50
std::unique_ptr< weld::TreeIter > addedTable(const OUString &_rName)
to be used if a foreign instance added a table
Definition: tabletree.cxx:491
bool impl_getAndAssertMetaData(css::uno::Reference< css::sdbc::XDatabaseMetaData > &_out_rMetaData) const
Definition: tabletree.cxx:506
std::unique_ptr< weld::TreeIter > getEntryByQualifiedName(const OUString &rName)
Definition: tabletree.cxx:561
void implEmphasize(const weld::TreeIter &rEntry, bool _bChecked, bool _bUpdateDescendants=true, bool _bUpdateAncestors=true)
Definition: tabletree.cxx:343
void checkWildcard(const weld::TreeIter &rEntry)
does a wildcard check of the given entry
Definition: tabletree.cxx:277
OUString getQualifiedTableName(const weld::TreeIter &rEntry) const
returns the fully qualified name of a table entry
Definition: tabletree.cxx:514
void UpdateTableList(const css::uno::Reference< css::sdbc::XConnection > &_rxConnection)
fill the table list with the tables belonging to the connection described by the parameters
OTableTreeListBox(std::unique_ptr< weld::TreeView > xTreeView, bool bShowToggles)
Definition: tabletree.cxx:55
void removedTable(const OUString &_rName)
to be used if a foreign instance removed a table
Definition: tabletree.cxx:599
css::sdb::application::NamedDatabaseObject describeObject(const weld::TreeIter &rEntry)
returns a NamedDatabaseObject record which describes the given entry
Definition: tabletree.cxx:466
void UpdateTableList(const css::uno::Reference< css::sdbc::XConnection > &_rxConnection, const css::uno::Sequence< OUString > &_rTables, const css::uno::Sequence< OUString > &_rViews)
fill the table list with the tables and views determined by the two given containers.
bool haveVirtualRoot() const
Definition: tabletree.hxx:126
bool isWildcardChecked(const weld::TreeIter &rEntry)
determine if the given entry is 'wildcard checked'
Definition: tabletree.cxx:272
void checkedButton_noBroadcast(const weld::TreeIter &rEntry)
Definition: tabletree.cxx:295
css::uno::Reference< css::sdbc::XConnection > m_xConnection
Definition: tabletree.hxx:37
std::unique_ptr< weld::TreeIter > getAllObjectsEntry() const
Definition: tabletree.cxx:285
void UpdateTableList(const css::uno::Reference< css::sdbc::XConnection > &_rxConnection, const TNames &_rTables)
fill the table list with the tables and views determined by the two given containers
void implOnNewConnection(const css::uno::Reference< css::sdbc::XConnection > &_rxConnection)
Definition: tabletree.cxx:74
std::unique_ptr< weld::TreeIter > implAddEntry(const css::uno::Reference< css::sdbc::XDatabaseMetaData > &_rxMeta, const OUString &_rTableName, bool _bCheckName=true)
adds the given entry to our list @precond our image provider must already have been reset to the conn...
Definition: tabletree.cxx:376
std::unique_ptr< ImageProvider > m_xImageProvider
Definition: tabletree.hxx:39
std::pair< OUString, bool > TTableViewName
Definition: tabletree.hxx:49
TriState implDetermineState(const weld::TreeIter &rEntry)
Definition: tabletree.cxx:628
bool isFolderEntry(const weld::TreeIter &rEntry) const
determines whether the given entry denotes a tables folder
Definition: tabletree.cxx:66
TriState