Gtk-WARNING gtktreestore.c:1047: Invalid column number 1 added to iter
[LibreOffice.git] / dbaccess / source / ui / inc / adtabdlg.hxx
blob5fe1d7c1da423a6ca608eeba05892f77788bf9c5
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 .
19 #pragma once
21 #include <memory>
22 #include <com/sun/star/sdbc/XConnection.hpp>
23 #include <vcl/weld.hxx>
24 #include "tabletree.hxx"
26 namespace dbaui
28 /** unifies the access to a list of table/query objects
30 class TableObjectListFacade
32 public:
33 virtual void updateTableObjectList( bool _bAllowViews ) = 0;
34 virtual OUString getSelectedName( OUString& _out_rAliasName ) const = 0;
35 virtual bool isLeafSelected() const = 0;
37 virtual ~TableObjectListFacade();
40 class IAddTableDialogContext
42 public:
43 virtual css::uno::Reference< css::sdbc::XConnection >
44 getConnection() const = 0;
45 virtual bool allowViews() const = 0;
46 virtual bool allowQueries() const = 0;
47 virtual bool allowAddition() const = 0;
48 virtual void addTableWindow( const OUString& _rQualifiedTableName, const OUString& _rAliasName ) = 0;
49 virtual void onWindowClosing() = 0;
51 protected:
52 ~IAddTableDialogContext() {}
55 class OAddTableDlg : public weld::GenericDialogController
57 IAddTableDialogContext& m_rContext;
58 std::unique_ptr< TableObjectListFacade > m_xCurrentList;
60 std::unique_ptr<weld::RadioButton> m_xCaseTables;
61 std::unique_ptr<weld::RadioButton> m_xCaseQueries;
63 std::unique_ptr<OTableTreeListBox> m_xTableList;
64 std::unique_ptr<weld::TreeView> m_xQueryList;
66 std::unique_ptr<weld::Button> m_xAddButton;
67 std::unique_ptr<weld::Button> m_xCloseButton;
69 DECL_LINK( AddClickHdl, weld::Button&, void );
70 DECL_LINK( CloseClickHdl, weld::Button&, void);
71 DECL_LINK( TableListDoubleClickHdl, weld::TreeView&, bool );
72 DECL_LINK( TableListSelectHdl, weld::TreeView&, void );
73 DECL_LINK( OnTypeSelected, weld::Toggleable&, void );
75 public:
76 OAddTableDlg(weld::Window* _pParent,
77 IAddTableDialogContext& _rContext);
78 virtual ~OAddTableDlg() override;
80 void Update();
81 void OnClose();
83 static OUString getDialogTitleForContext(
84 IAddTableDialogContext const & _rContext );
86 private:
87 bool impl_isAddAllowed();
89 enum ObjectList
91 Tables,
92 Queries
94 void impl_switchTo( ObjectList _eList );
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */