xref: /trunk/main/dbaccess/source/ui/inc/RelationDlg.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef DBAUI_RELATIONDIALOG_HXX
28 #define DBAUI_RELATIONDIALOG_HXX
29 
30 #ifndef _DIALOG_HXX //autogen
31 #include <vcl/dialog.hxx>
32 #endif
33 
34 #ifndef _BUTTON_HXX //autogen
35 #include <vcl/button.hxx>
36 #endif
37 #ifndef _FIXED_HXX //autogen
38 #include <vcl/fixed.hxx>
39 #endif
40 //#ifndef _EDIT_HXX //autogen
41 //#include <vcl/edit.hxx>
42 //#endif
43 #ifndef _SV_MSGBOX_HXX
44 #include <vcl/msgbox.hxx>
45 #endif
46 #ifndef DBAUI_JOINTABLEVIEW_HXX
47 #include "JoinTableView.hxx"
48 #endif
49 #ifndef DBAUI_RELCONTROLIFACE_HXX
50 #include "RelControliFace.hxx"
51 #endif
52 #ifndef _DBAUI_MODULE_DBU_HXX_
53 #include "moduledbu.hxx"
54 #endif
55 
56 
57 namespace dbaui
58 {
59     class OJoinTableView;
60     class OTableListBoxControl;
61     class ORelationTableConnectionData;
62     //========================================================================
63     class ORelationDialog : public ModalDialog
64                             ,public IRelationControlInterface
65     {
66         OModuleClient                           m_aModuleClient;
67         ::std::auto_ptr<OTableListBoxControl>   m_pTableControl;
68         OJoinTableView::OTableWindowMap*        m_pTableMap;
69 
70         FixedLine   aFL_CascUpd;
71         RadioButton aRB_NoCascUpd,
72                     aRB_CascUpd,
73                     aRB_CascUpdNull,
74                     aRB_CascUpdDefault;
75         FixedLine   aFL_CascDel;
76         RadioButton aRB_NoCascDel,
77                     aRB_CascDel,
78                     aRB_CascDelNull,
79                     aRB_CascDelDefault;
80 
81         OKButton    aPB_OK;
82         CancelButton aPB_CANCEL;
83         HelpButton  aPB_HELP;
84 
85 
86         TTableConnectionData::value_type                                        m_pConnData;
87         TTableConnectionData::value_type                                        m_pOrigConnData;
88         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xConnection;
89 
90         sal_Bool                                                                    m_bTriedOneUpdate;
91 
92     public:
93         ORelationDialog(OJoinTableView* pParent,
94                         const TTableConnectionData::value_type& pConnectionData,
95                         sal_Bool bAllowTableSelect = sal_False );
96         virtual ~ORelationDialog();
97 
98         virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > getConnection(){ return m_xConnection; }
99 
100         virtual short Execute();
101 
102         /** getTableMap gives acces to the table window map
103             @retrun the table window from the join view
104         */
105         OJoinTableView::OTableWindowMap* getTableMap() const { return m_pTableMap; }
106 
107         /** getConnectionData returns the current connection data
108             @return the current connectiondata
109         */
110         virtual TTableConnectionData::value_type getConnectionData() const;
111 
112         /** setValid set the valid inside, can be used for OK buttons
113             @param  _bValid true when the using control allows an update
114         */
115         virtual void setValid(sal_Bool _bValid);
116 
117         /** notifyConnectionChange is callback which is called when the table selection has changed and a new connection exists
118             @param  _pConnectionData    the connection which exists between the new tables
119         */
120         virtual void notifyConnectionChange();
121     protected:
122         void Init(const TTableConnectionData::value_type& _pConnectionData);
123 
124     private:
125         DECL_LINK( OKClickHdl, Button* );
126     };
127 }
128 #endif // DBAUI_RELATIONDIALOG_HXX
129 
130 
131