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_RELATIONCONTROL_HXX
28 #define DBAUI_RELATIONCONTROL_HXX
29 
30 #ifndef _FIXED_HXX //autogen
31 #include <vcl/fixed.hxx>
32 #endif
33 #ifndef _SV_LSTBOX_HXX //autogen
34 #include <vcl/lstbox.hxx>
35 #endif
36 #ifndef DBAUI_JOINTABLEVIEW_HXX
37 #include "JoinTableView.hxx"
38 #endif
39 
40 namespace dbaui
41 {
42 	//========================================================================
43 	class OTableListBoxControl;
44 	class OTableConnectionData;
45 	class ORelationTableConnectionData;
46 	class IRelationControlInterface;
47 	class ORelationControl;
48 
49 	class OTableListBoxControl	: public Window
50 	{
51 		FixedLine								m_aFL_InvolvedTables;
52 		ListBox									m_lmbLeftTable,
53 												m_lmbRightTable;
54 		FixedLine								m_aFL_InvolvedFields;
55 
56 		ORelationControl*						m_pRC_Tables;
57 		const OJoinTableView::OTableWindowMap*	m_pTableMap;
58 		IRelationControlInterface*				m_pParentDialog;
59 		String									m_strCurrentLeft;
60 		String									m_strCurrentRight;
61 	private:
62 		DECL_LINK( OnTableChanged, ListBox* );
63 	public:
64 		OTableListBoxControl(Window* _pParent,
65 							 const ResId& _rResId,
66 							 const OJoinTableView::OTableWindowMap*	_pTableMap,
67 							 IRelationControlInterface* _pParentDialog);
68 		virtual ~OTableListBoxControl();
69 
70 		/** fillListBoxes fills the list boxes with the table windows
71 		*/
72 		void fillListBoxes();
73 
74 		/** fillAndDisable fill the listboxes only with one entry and then disable them
75 			@param	_pConnectionData
76 					contains the data which should be filled into the listboxes
77 		*/
78 		void fillAndDisable(const TTableConnectionData::value_type& _pConnectionData);
79 
80         /** enables the relation control
81         *
82         * \param _bEnable when sal_True enables it, otherwise disable it.
83         */
84         void enableRelation(bool _bEnable);
85 
86 		/** NotifyCellChange notifies the browse control that the conenction data has changed
87 		*/
88 		void NotifyCellChange();
89 
90 		/** Init is a call through to the control inside this one
91 			@param	_pConnData
92 					the connection data which is used to init the control
93 		*/
94 		void Init(const TTableConnectionData::value_type& _pConnData);
95 		void lateUIInit(Window* _pTableSeparator = NULL);
96         void lateInit();
97 
98 		sal_Bool SaveModified();
99 
100 		TTableWindowData::value_type getReferencingTable()	const;
101 
102 		/** getContainer returns the container interface
103 			@return the interface of the container
104 		*/
105 		IRelationControlInterface* getContainer() const { return m_pParentDialog; }
106 	};
107 }
108 #endif // DBAUI_RELATIONCONTROL_HXX
109