bump product version to 4.1.6.2
[LibreOffice.git] / dbaccess / source / ui / inc / adtabdlg.hxx
blobd66f20dcded18cf48d6b4df4b732cbec173b8ab5
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 DBAUI_QYDLGTAB_HXX
20 #define DBAUI_QYDLGTAB_HXX
22 #include <vcl/dialog.hxx>
24 #include <vcl/button.hxx>
26 #include <vcl/fixed.hxx>
28 #include <com/sun/star/sdbc/XConnection.hpp>
30 #include <vcl/lstbox.hxx>
31 #include <tools/string.hxx>
33 #include "tabletree.hxx"
35 #include <memory>
37 namespace dbaui
39 //========================================================================
40 /** unifies the access to a list of table/query objects
42 class TableObjectListFacade
44 public:
45 virtual void updateTableObjectList( bool _bAllowViews ) = 0;
46 virtual String getSelectedName( String& _out_rAliasName ) const = 0;
47 virtual bool isLeafSelected() const = 0;
49 virtual ~TableObjectListFacade();
52 //========================================================================
53 class IAddTableDialogContext
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;
64 protected:
65 ~IAddTableDialogContext() {}
68 //========================================================================
69 class OAddTableDlg : public ModelessDialog
71 RadioButton m_aCaseTables;
72 RadioButton m_aCaseQueries;
74 OTableTreeListBox m_aTableList;
75 SvTreeListBox m_aQueryList;
76 ::std::auto_ptr< TableObjectListFacade >
77 m_pCurrentList;
79 PushButton aAddButton;
80 CancelButton aCloseButton;
81 HelpButton aHelpButton;
83 IAddTableDialogContext&
84 m_rContext;
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* );
92 public:
93 OAddTableDlg(
94 Window* _pParent,
95 IAddTableDialogContext& _rContext );
96 virtual ~OAddTableDlg();
98 void DetermineAddTable() { aAddButton.Enable( impl_isAddAllowed() ); }
99 void Update();
101 static String getDialogTitleForContext(
102 IAddTableDialogContext& _rContext );
104 private:
105 virtual sal_Bool Close();
107 bool impl_isAddAllowed();
108 void impl_addTable();
110 enum ObjectList
112 Tables,
113 Queries
115 void impl_switchTo( ObjectList _eList );
118 #endif // DBAUI_QYDLGTAB_HXX
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */