Branch data Line data Source code
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 : : #ifndef DBAUI_QYDLGTAB_HXX
20 : : #define DBAUI_QYDLGTAB_HXX
21 : :
22 : : #include <vcl/dialog.hxx>
23 : :
24 : : #include <vcl/button.hxx>
25 : :
26 : : #include <vcl/fixed.hxx>
27 : :
28 : : #include <com/sun/star/sdbc/XConnection.hpp>
29 : :
30 : : #include <vcl/lstbox.hxx>
31 : : #include <tools/string.hxx>
32 : :
33 : : #include "tabletree.hxx"
34 : :
35 : : #include <memory>
36 : :
37 : : namespace dbaui
38 : : {
39 : : //========================================================================
40 : : /** unifies the access to a list of table/query objects
41 : : */
42 : 0 : class TableObjectListFacade
43 : : {
44 : : public:
45 : : virtual void updateTableObjectList( bool _bAllowViews ) = 0;
46 : : virtual String getSelectedName( String& _out_rAliasName ) const = 0;
47 : : virtual bool isLeafSelected() const = 0;
48 : :
49 : : virtual ~TableObjectListFacade();
50 : : };
51 : :
52 : : //========================================================================
53 : 0 : class IAddTableDialogContext
54 : : {
55 : : public:
56 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
57 : : getConnection() const = 0;
58 : : virtual bool allowViews() const = 0;
59 : : virtual bool allowQueries() const = 0;
60 : : virtual bool allowAddition() const = 0;
61 : : virtual void addTableWindow( const String& _rQualifiedTableName, const String& _rAliasName ) = 0;
62 : : virtual void onWindowClosing( const Window* _pWindow ) = 0;
63 : :
64 : : protected:
65 : 0 : ~IAddTableDialogContext() {}
66 : : };
67 : :
68 : : //========================================================================
69 : : class OAddTableDlg : public ModelessDialog
70 : : {
71 : : RadioButton m_aCaseTables;
72 : : RadioButton m_aCaseQueries;
73 : :
74 : : OTableTreeListBox m_aTableList;
75 : : SvTreeListBox m_aQueryList;
76 : : ::std::auto_ptr< TableObjectListFacade >
77 : : m_pCurrentList;
78 : :
79 : : PushButton aAddButton;
80 : : CancelButton aCloseButton;
81 : : HelpButton aHelpButton;
82 : :
83 : : IAddTableDialogContext&
84 : : m_rContext;
85 : :
86 : : DECL_LINK( AddClickHdl, Button* );
87 : : DECL_LINK( CloseClickHdl, Button* );
88 : : DECL_LINK( TableListDoubleClickHdl, void* );
89 : : DECL_LINK( TableListSelectHdl, void* );
90 : : DECL_LINK( OnTypeSelected, void* );
91 : :
92 : : public:
93 : : OAddTableDlg(
94 : : Window* _pParent,
95 : : IAddTableDialogContext& _rContext );
96 : : virtual ~OAddTableDlg();
97 : :
98 : : void DetermineAddTable() { aAddButton.Enable( impl_isAddAllowed() ); }
99 : : void Update();
100 : :
101 : : static String getDialogTitleForContext(
102 : : IAddTableDialogContext& _rContext );
103 : :
104 : : private:
105 : : virtual sal_Bool Close();
106 : :
107 : : bool impl_isAddAllowed();
108 : : void impl_addTable();
109 : :
110 : : enum ObjectList
111 : : {
112 : : Tables,
113 : : Queries
114 : : };
115 : : void impl_switchTo( ObjectList _eList );
116 : : };
117 : : }
118 : : #endif // DBAUI_QYDLGTAB_HXX
119 : :
120 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|