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