1*2e2212a7SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*2e2212a7SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*2e2212a7SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*2e2212a7SAndrew Rist  * distributed with this work for additional information
6*2e2212a7SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*2e2212a7SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*2e2212a7SAndrew Rist  * "License"); you may not use this file except in compliance
9*2e2212a7SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*2e2212a7SAndrew Rist  *
11*2e2212a7SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*2e2212a7SAndrew Rist  *
13*2e2212a7SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*2e2212a7SAndrew Rist  * software distributed under the License is distributed on an
15*2e2212a7SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*2e2212a7SAndrew Rist  * KIND, either express or implied.  See the License for the
17*2e2212a7SAndrew Rist  * specific language governing permissions and limitations
18*2e2212a7SAndrew Rist  * under the License.
19*2e2212a7SAndrew Rist  *
20*2e2212a7SAndrew Rist  *************************************************************/
21*2e2212a7SAndrew Rist 
22*2e2212a7SAndrew Rist 
23cdf0e10cSrcweir #ifndef DBAUI_QTABLECONNECTIONDATA_HXX
24cdf0e10cSrcweir #define DBAUI_QTABLECONNECTIONDATA_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #ifndef DBAUI_TABLECONNECTIONDATA_HXX
27cdf0e10cSrcweir #include "TableConnectionData.hxx"
28cdf0e10cSrcweir #endif
29cdf0e10cSrcweir #ifndef DBAUI_TABLEFIELDDESC_HXX
30cdf0e10cSrcweir #include "TableFieldDescription.hxx"
31cdf0e10cSrcweir #endif
32cdf0e10cSrcweir #ifndef DBAUI_ENUMTYPES_HXX
33cdf0e10cSrcweir #include "QEnumTypes.hxx"
34cdf0e10cSrcweir #endif
35cdf0e10cSrcweir #ifndef _RTTI_HXX
36cdf0e10cSrcweir #include <tools/rtti.hxx>
37cdf0e10cSrcweir #endif
38cdf0e10cSrcweir //#ifndef DBAUI_QUERYCONTROLLER_HXX
39cdf0e10cSrcweir //#include "querycontroller.hxx"
40cdf0e10cSrcweir //#endif
41cdf0e10cSrcweir 
42cdf0e10cSrcweir namespace dbaui
43cdf0e10cSrcweir {
44cdf0e10cSrcweir 	class OQueryTableConnectionData : public OTableConnectionData
45cdf0e10cSrcweir 	{
46cdf0e10cSrcweir 		sal_Int32		m_nFromEntryIndex;
47cdf0e10cSrcweir 		sal_Int32		m_nDestEntryIndex;
48cdf0e10cSrcweir 		EJoinType		m_eJoinType;
49cdf0e10cSrcweir         bool            m_bNatural;
50cdf0e10cSrcweir 
51cdf0e10cSrcweir 		ETableFieldType	m_eFromType;
52cdf0e10cSrcweir 		ETableFieldType	m_eDestType;
53cdf0e10cSrcweir 
54cdf0e10cSrcweir 	protected:
55cdf0e10cSrcweir 		// fuer das Anlegen und Duplizieren von Lines vom eigenen Typ
56cdf0e10cSrcweir 		virtual OConnectionLineDataRef CreateLineDataObj();
57cdf0e10cSrcweir 		virtual OConnectionLineDataRef CreateLineDataObj( const OConnectionLineData& rConnLineData );
58cdf0e10cSrcweir 
59cdf0e10cSrcweir 		OQueryTableConnectionData& operator=( const OQueryTableConnectionData& rConnData );
60cdf0e10cSrcweir 	public:
61cdf0e10cSrcweir 		OQueryTableConnectionData();
62cdf0e10cSrcweir 		OQueryTableConnectionData( const OQueryTableConnectionData& rConnData );
63cdf0e10cSrcweir 		OQueryTableConnectionData( const TTableWindowData::value_type& _pReferencingTable,const TTableWindowData::value_type& _pReferencedTable,
64cdf0e10cSrcweir 			const ::rtl::OUString& rConnName=::rtl::OUString());
65cdf0e10cSrcweir 		virtual ~OQueryTableConnectionData();
66cdf0e10cSrcweir 
67cdf0e10cSrcweir 		virtual void CopyFrom(const OTableConnectionData& rSource);
68cdf0e10cSrcweir 		virtual OTableConnectionData* NewInstance() const;
69cdf0e10cSrcweir 
70cdf0e10cSrcweir 
71cdf0e10cSrcweir 		/** Update create a new connection
72cdf0e10cSrcweir 
73cdf0e10cSrcweir 			@return true if successful
74cdf0e10cSrcweir 		*/
75cdf0e10cSrcweir 		virtual sal_Bool Update();
76cdf0e10cSrcweir 
77cdf0e10cSrcweir 		::rtl::OUString	GetAliasName(EConnectionSide nWhich) const;
78cdf0e10cSrcweir 
GetFieldIndex(EConnectionSide nWhich) const79cdf0e10cSrcweir 		sal_Int32		GetFieldIndex(EConnectionSide nWhich) const { return nWhich==JTCS_TO ? m_nDestEntryIndex : m_nFromEntryIndex; }
SetFieldIndex(EConnectionSide nWhich,sal_Int32 nVal)80cdf0e10cSrcweir 		void			SetFieldIndex(EConnectionSide nWhich, sal_Int32 nVal) { if (nWhich==JTCS_TO) m_nDestEntryIndex=nVal; else m_nFromEntryIndex=nVal; }
81cdf0e10cSrcweir 
GetFieldType(EConnectionSide nWhich) const82cdf0e10cSrcweir 		ETableFieldType	GetFieldType(EConnectionSide nWhich) const { return nWhich==JTCS_TO ? m_eDestType : m_eFromType; }
SetFieldType(EConnectionSide nWhich,ETableFieldType eType)83cdf0e10cSrcweir 		void			SetFieldType(EConnectionSide nWhich, ETableFieldType eType) { if (nWhich==JTCS_TO) m_eDestType=eType; else m_eFromType=eType; }
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 		void			InitFromDrag(const OTableFieldDescRef& rDragLeft, const OTableFieldDescRef& rDragRight);
86cdf0e10cSrcweir 
GetJoinType() const87cdf0e10cSrcweir 		EJoinType		GetJoinType() const { return m_eJoinType; };
SetJoinType(const EJoinType & eJT)88cdf0e10cSrcweir 		void			SetJoinType(const EJoinType& eJT) { m_eJoinType = eJT; };
89cdf0e10cSrcweir 
setNatural(bool _bNatural)90cdf0e10cSrcweir         inline void setNatural(bool _bNatural) { m_bNatural = _bNatural; }
isNatural() const91cdf0e10cSrcweir         inline bool isNatural() const { return m_bNatural; }
92cdf0e10cSrcweir 	};
93cdf0e10cSrcweir 
94cdf0e10cSrcweir }
95cdf0e10cSrcweir #endif // DBAUI_QTABLECONNECTIONDATA_HXX
96