1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef DBAUI_RELATIONDIALOG_HXX
24 #define DBAUI_RELATIONDIALOG_HXX
25 
26 #ifndef _DIALOG_HXX //autogen
27 #include <vcl/dialog.hxx>
28 #endif
29 
30 #ifndef _BUTTON_HXX //autogen
31 #include <vcl/button.hxx>
32 #endif
33 #ifndef _FIXED_HXX //autogen
34 #include <vcl/fixed.hxx>
35 #endif
36 //#ifndef _EDIT_HXX //autogen
37 //#include <vcl/edit.hxx>
38 //#endif
39 #ifndef _SV_MSGBOX_HXX
40 #include <vcl/msgbox.hxx>
41 #endif
42 #ifndef DBAUI_JOINTABLEVIEW_HXX
43 #include "JoinTableView.hxx"
44 #endif
45 #ifndef DBAUI_RELCONTROLIFACE_HXX
46 #include "RelControliFace.hxx"
47 #endif
48 #ifndef _DBAUI_MODULE_DBU_HXX_
49 #include "moduledbu.hxx"
50 #endif
51 
52 
53 namespace dbaui
54 {
55 	class OJoinTableView;
56 	class OTableListBoxControl;
57 	class ORelationTableConnectionData;
58 	//========================================================================
59 	class ORelationDialog : public ModalDialog
60 							,public IRelationControlInterface
61 	{
62         OModuleClient                           m_aModuleClient;
63         ::std::auto_ptr<OTableListBoxControl>	m_pTableControl;
64 		OJoinTableView::OTableWindowMap*	    m_pTableMap;
65 
66         FixedLine   aFL_CascUpd;
67 		RadioButton aRB_NoCascUpd,
68 					aRB_CascUpd,
69 					aRB_CascUpdNull,
70 					aRB_CascUpdDefault;
71         FixedLine   aFL_CascDel;
72 		RadioButton	aRB_NoCascDel,
73 					aRB_CascDel,
74 					aRB_CascDelNull,
75 					aRB_CascDelDefault;
76 
77 		OKButton	aPB_OK;
78 		CancelButton aPB_CANCEL;
79 		HelpButton	aPB_HELP;
80 
81 
82 		TTableConnectionData::value_type 										m_pConnData;
83 		TTableConnectionData::value_type 										m_pOrigConnData;
84 		::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xConnection;
85 
86 		sal_Bool																	m_bTriedOneUpdate;
87 
88 	public:
89 		ORelationDialog(OJoinTableView* pParent,
90 						const TTableConnectionData::value_type& pConnectionData,
91 						sal_Bool bAllowTableSelect = sal_False );
92 		virtual ~ORelationDialog();
93 
getConnection()94 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > getConnection(){ return m_xConnection; }
95 
96 		virtual short Execute();
97 
98 		/** getTableMap gives acces to the table window map
99 			@retrun the table window from the join view
100 		*/
getTableMap() const101 		OJoinTableView::OTableWindowMap* getTableMap() const { return m_pTableMap; }
102 
103 		/** getConnectionData returns the current connection data
104 			@return the current connectiondata
105 		*/
106 		virtual TTableConnectionData::value_type getConnectionData() const;
107 
108 		/** setValid set the valid inside, can be used for OK buttons
109 			@param	_bValid	true when the using control allows an update
110 		*/
111 		virtual void setValid(sal_Bool _bValid);
112 
113 		/** notifyConnectionChange is callback which is called when the table selection has changed and a new connection exists
114 			@param	_pConnectionData	the connection which exists between the new tables
115 		*/
116 		virtual void notifyConnectionChange();
117 	protected:
118 		void Init(const TTableConnectionData::value_type& _pConnectionData);
119 
120 	private:
121 		DECL_LINK( OKClickHdl, Button* );
122 	};
123 }
124 #endif // DBAUI_RELATIONDIALOG_HXX
125 
126 
127