Bump version to 5.0-14
[LibreOffice.git] / dbaccess / source / ui / inc / adtabdlg.hxx
blob815f8c4d566a2dd617f93a7711887cb841211bc4
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 #ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_ADTABDLG_HXX
20 #define INCLUDED_DBACCESS_SOURCE_UI_INC_ADTABDLG_HXX
22 #include <boost/scoped_ptr.hpp>
23 #include <com/sun/star/sdbc/XConnection.hpp>
24 #include <vcl/dialog.hxx>
25 #include <vcl/button.hxx>
26 #include <vcl/fixed.hxx>
27 #include <vcl/lstbox.hxx>
28 #include "tabletree.hxx"
30 namespace dbaui
32 /** unifies the access to a list of table/query objects
34 class TableObjectListFacade
36 public:
37 virtual void updateTableObjectList( bool _bAllowViews ) = 0;
38 virtual OUString getSelectedName( OUString& _out_rAliasName ) const = 0;
39 virtual bool isLeafSelected() const = 0;
41 virtual ~TableObjectListFacade();
44 class IAddTableDialogContext
46 public:
47 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
48 getConnection() const = 0;
49 virtual bool allowViews() const = 0;
50 virtual bool allowQueries() const = 0;
51 virtual bool allowAddition() const = 0;
52 virtual void addTableWindow( const OUString& _rQualifiedTableName, const OUString& _rAliasName ) = 0;
53 virtual void onWindowClosing( const vcl::Window* _pWindow ) = 0;
55 protected:
56 ~IAddTableDialogContext() {}
59 class OAddTableDlg : public ModelessDialog
61 VclPtr<RadioButton> m_pCaseTables;
62 VclPtr<RadioButton> m_pCaseQueries;
64 VclPtr<OTableTreeListBox> m_pTableList;
65 VclPtr<SvTreeListBox> m_pQueryList;
66 boost::scoped_ptr< TableObjectListFacade > m_xCurrentList;
68 VclPtr<PushButton> m_pAddButton;
69 VclPtr<PushButton> m_pCloseButton;
71 IAddTableDialogContext& m_rContext;
73 DECL_LINK( AddClickHdl, Button* );
74 DECL_LINK( CloseClickHdl, Button* );
75 DECL_LINK( TableListDoubleClickHdl, void* );
76 DECL_LINK( TableListSelectHdl, void* );
77 DECL_LINK( OnTypeSelected, void* );
79 public:
80 OAddTableDlg(
81 vcl::Window* _pParent,
82 IAddTableDialogContext& _rContext );
83 virtual ~OAddTableDlg();
84 virtual void dispose() SAL_OVERRIDE;
86 void DetermineAddTable() { m_pAddButton->Enable( impl_isAddAllowed() ); }
87 void Update();
89 static OUString getDialogTitleForContext(
90 IAddTableDialogContext& _rContext );
92 private:
93 virtual bool Close() SAL_OVERRIDE;
95 bool impl_isAddAllowed();
96 void impl_addTable();
98 enum ObjectList
100 Tables,
101 Queries
103 void impl_switchTo( ObjectList _eList );
106 #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_ADTABDLG_HXX
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */