update dev300-m58
[ooovba.git] / dbaccess / source / ui / inc / adtabdlg.hxx
blobaa6802b187ed112c81b62b94efb7f12d2faabdef
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: adtabdlg.hxx,v $
10 * $Revision: 1.9 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef DBAUI_QYDLGTAB_HXX
31 #define DBAUI_QYDLGTAB_HXX
33 #ifndef _DIALOG_HXX //autogen
34 #include <vcl/dialog.hxx>
35 #endif
37 #ifndef _BUTTON_HXX //autogen
38 #include <vcl/button.hxx>
39 #endif
41 #ifndef _FIXED_HXX //autogen
42 #include <vcl/fixed.hxx>
43 #endif
45 #ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
46 #include <com/sun/star/sdbc/XConnection.hpp>
47 #endif
49 #ifndef _LSTBOX_HXX //autogen
50 #include <vcl/lstbox.hxx>
51 #endif
52 #ifndef _SV_DIALOG_HXX
53 #include <vcl/dialog.hxx>
54 #endif
55 #ifndef _STRING_HXX //autogen
56 #include <tools/string.hxx>
57 #endif
59 #ifndef _DBAUI_TABLETREE_HXX_
60 #include "tabletree.hxx"
61 #endif
63 #include <memory>
65 namespace dbaui
67 //========================================================================
68 /** unifies the access to a list of table/query objects
70 class TableObjectListFacade
72 public:
73 virtual void updateTableObjectList( bool _bAllowViews ) = 0;
74 virtual String getSelectedName( String& _out_rAliasName ) const = 0;
75 virtual bool isLeafSelected() const = 0;
77 virtual ~TableObjectListFacade();
80 //========================================================================
81 class IAddTableDialogContext
83 public:
84 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
85 getConnection() const = 0;
86 virtual bool allowViews() const = 0;
87 virtual bool allowQueries() const = 0;
88 virtual bool allowAddition() const = 0;
89 virtual void addTableWindow( const String& _rQualifiedTableName, const String& _rAliasName ) = 0;
90 virtual void onWindowClosing( const Window* _pWindow ) = 0;
93 //========================================================================
94 class OAddTableDlg : public ModelessDialog
96 RadioButton m_aCaseTables;
97 RadioButton m_aCaseQueries;
99 OTableTreeListBox m_aTableList;
100 SvTreeListBox m_aQueryList;
101 ::std::auto_ptr< TableObjectListFacade >
102 m_pCurrentList;
104 PushButton aAddButton;
105 CancelButton aCloseButton;
106 HelpButton aHelpButton;
108 IAddTableDialogContext&
109 m_rContext;
111 DECL_LINK( AddClickHdl, Button* );
112 DECL_LINK( CloseClickHdl, Button* );
113 DECL_LINK( TableListDoubleClickHdl, void* );
114 DECL_LINK( TableListSelectHdl, void* );
115 DECL_LINK( OnTypeSelected, void* );
117 public:
118 OAddTableDlg(
119 Window* _pParent,
120 IAddTableDialogContext& _rContext );
121 virtual ~OAddTableDlg();
123 void DetermineAddTable() { aAddButton.Enable( impl_isAddAllowed() ); }
124 void Update();
126 static String getDialogTitleForContext(
127 IAddTableDialogContext& _rContext );
129 private:
130 virtual BOOL Close();
132 bool impl_isAddAllowed();
133 void impl_addTable();
135 enum ObjectList
137 Tables,
138 Queries
140 void impl_switchTo( ObjectList _eList );
143 #endif // DBAUI_QYDLGTAB_HXX