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_QTABLECONNECTIONDATA_HXX
24 #define DBAUI_QTABLECONNECTIONDATA_HXX
25 
26 #ifndef DBAUI_TABLECONNECTIONDATA_HXX
27 #include "TableConnectionData.hxx"
28 #endif
29 #ifndef DBAUI_TABLEFIELDDESC_HXX
30 #include "TableFieldDescription.hxx"
31 #endif
32 #ifndef DBAUI_ENUMTYPES_HXX
33 #include "QEnumTypes.hxx"
34 #endif
35 #ifndef _RTTI_HXX
36 #include <tools/rtti.hxx>
37 #endif
38 //#ifndef DBAUI_QUERYCONTROLLER_HXX
39 //#include "querycontroller.hxx"
40 //#endif
41 
42 namespace dbaui
43 {
44 	class OQueryTableConnectionData : public OTableConnectionData
45 	{
46 		sal_Int32		m_nFromEntryIndex;
47 		sal_Int32		m_nDestEntryIndex;
48 		EJoinType		m_eJoinType;
49         bool            m_bNatural;
50 
51 		ETableFieldType	m_eFromType;
52 		ETableFieldType	m_eDestType;
53 
54 	protected:
55 		// fuer das Anlegen und Duplizieren von Lines vom eigenen Typ
56 		virtual OConnectionLineDataRef CreateLineDataObj();
57 		virtual OConnectionLineDataRef CreateLineDataObj( const OConnectionLineData& rConnLineData );
58 
59 		OQueryTableConnectionData& operator=( const OQueryTableConnectionData& rConnData );
60 	public:
61 		OQueryTableConnectionData();
62 		OQueryTableConnectionData( const OQueryTableConnectionData& rConnData );
63 		OQueryTableConnectionData( const TTableWindowData::value_type& _pReferencingTable,const TTableWindowData::value_type& _pReferencedTable,
64 			const ::rtl::OUString& rConnName=::rtl::OUString());
65 		virtual ~OQueryTableConnectionData();
66 
67 		virtual void CopyFrom(const OTableConnectionData& rSource);
68 		virtual OTableConnectionData* NewInstance() const;
69 
70 
71 		/** Update create a new connection
72 
73 			@return true if successful
74 		*/
75 		virtual sal_Bool Update();
76 
77 		::rtl::OUString	GetAliasName(EConnectionSide nWhich) const;
78 
GetFieldIndex(EConnectionSide nWhich) const79 		sal_Int32		GetFieldIndex(EConnectionSide nWhich) const { return nWhich==JTCS_TO ? m_nDestEntryIndex : m_nFromEntryIndex; }
SetFieldIndex(EConnectionSide nWhich,sal_Int32 nVal)80 		void			SetFieldIndex(EConnectionSide nWhich, sal_Int32 nVal) { if (nWhich==JTCS_TO) m_nDestEntryIndex=nVal; else m_nFromEntryIndex=nVal; }
81 
GetFieldType(EConnectionSide nWhich) const82 		ETableFieldType	GetFieldType(EConnectionSide nWhich) const { return nWhich==JTCS_TO ? m_eDestType : m_eFromType; }
SetFieldType(EConnectionSide nWhich,ETableFieldType eType)83 		void			SetFieldType(EConnectionSide nWhich, ETableFieldType eType) { if (nWhich==JTCS_TO) m_eDestType=eType; else m_eFromType=eType; }
84 
85 		void			InitFromDrag(const OTableFieldDescRef& rDragLeft, const OTableFieldDescRef& rDragRight);
86 
GetJoinType() const87 		EJoinType		GetJoinType() const { return m_eJoinType; };
SetJoinType(const EJoinType & eJT)88 		void			SetJoinType(const EJoinType& eJT) { m_eJoinType = eJT; };
89 
setNatural(bool _bNatural)90         inline void setNatural(bool _bNatural) { m_bNatural = _bNatural; }
isNatural() const91         inline bool isNatural() const { return m_bNatural; }
92 	};
93 
94 }
95 #endif // DBAUI_QTABLECONNECTIONDATA_HXX
96