xref: /AOO41X/main/dbaccess/source/ui/inc/ConnectionLineData.hxx (revision 2e2212a7c22e96cf6f6fab0dd042c34a45a64bd6)
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
10cdf0e10cSrcweir  *
11*2e2212a7SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
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.
19cdf0e10cSrcweir  *
20*2e2212a7SAndrew Rist  *************************************************************/
21*2e2212a7SAndrew Rist 
22*2e2212a7SAndrew Rist 
23cdf0e10cSrcweir #ifndef DBAUI_CONNECTIONLINEDATA_HXX
24cdf0e10cSrcweir #define DBAUI_CONNECTIONLINEDATA_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #ifndef DBAUI_ENUMTYPES_HXX
27cdf0e10cSrcweir #include "QEnumTypes.hxx"
28cdf0e10cSrcweir #endif
29cdf0e10cSrcweir #ifndef _VOS_REFERNCE_HXX_
30cdf0e10cSrcweir #include <vos/refernce.hxx>
31cdf0e10cSrcweir #endif
32cdf0e10cSrcweir #include <vector>
33cdf0e10cSrcweir 
34cdf0e10cSrcweir #ifndef _VOS_REF_HXX_
35cdf0e10cSrcweir #include <vos/ref.hxx>
36cdf0e10cSrcweir #endif
37cdf0e10cSrcweir 
38cdf0e10cSrcweir #ifndef DBAUI_REFFUNCTOR_HXX
39cdf0e10cSrcweir #include "RefFunctor.hxx"
40cdf0e10cSrcweir #endif
41cdf0e10cSrcweir #ifndef _RTL_USTRING_HXX_
42cdf0e10cSrcweir #include <rtl/ustring.hxx>
43cdf0e10cSrcweir #endif
44cdf0e10cSrcweir 
45cdf0e10cSrcweir namespace dbaui
46cdf0e10cSrcweir {
47cdf0e10cSrcweir 
48cdf0e10cSrcweir 	//==================================================================
49cdf0e10cSrcweir 	// ConnData		---------->*	ConnLineData
50cdf0e10cSrcweir 	//    ^1							^1
51cdf0e10cSrcweir 	//    |								|
52cdf0e10cSrcweir 	//	Conn		---------->*	ConnLine
53cdf0e10cSrcweir 	//==================================================================
54cdf0e10cSrcweir 
55cdf0e10cSrcweir 
56cdf0e10cSrcweir 	//==================================================================
57cdf0e10cSrcweir 	/**
58cdf0e10cSrcweir 		the class OConnectionLineData contains the data of a connection
59cdf0e10cSrcweir 		e.g. the source and the destanation field
60cdf0e10cSrcweir 	**/
61cdf0e10cSrcweir 	class OConnectionLineData : public ::vos::OReference
62cdf0e10cSrcweir 	{
63cdf0e10cSrcweir 		::rtl::OUString m_aSourceFieldName;
64cdf0e10cSrcweir 		::rtl::OUString m_aDestFieldName;
65cdf0e10cSrcweir 
66cdf0e10cSrcweir         friend bool operator==(const OConnectionLineData& lhs, const OConnectionLineData& rhs);
operator !=(const OConnectionLineData & lhs,const OConnectionLineData & rhs)67cdf0e10cSrcweir 		friend bool operator!=(const OConnectionLineData& lhs, const OConnectionLineData& rhs) { return !(lhs == rhs); }
68cdf0e10cSrcweir 	protected:
69cdf0e10cSrcweir 		virtual ~OConnectionLineData();
70cdf0e10cSrcweir 	public:
71cdf0e10cSrcweir 		OConnectionLineData();
72cdf0e10cSrcweir 		OConnectionLineData( const ::rtl::OUString& rSourceFieldName, const ::rtl::OUString& rDestFieldName );
73cdf0e10cSrcweir 		OConnectionLineData( const OConnectionLineData& rConnLineData );
74cdf0e10cSrcweir 
75cdf0e10cSrcweir 		// eine Kopie der eigenen Instanz liefern (das ist mir irgendwie angenehmer als ein virtueller Zuweisungsoperator)
76cdf0e10cSrcweir 		void CopyFrom(const OConnectionLineData& rSource);
77cdf0e10cSrcweir 
78cdf0e10cSrcweir 		// Memberzugriff (schreiben)
SetFieldName(EConnectionSide nWhich,const::rtl::OUString & strFieldName)79cdf0e10cSrcweir 		void SetFieldName(EConnectionSide nWhich, const ::rtl::OUString& strFieldName)
80cdf0e10cSrcweir 		{
81cdf0e10cSrcweir 			if (nWhich==JTCS_FROM)
82cdf0e10cSrcweir 				m_aSourceFieldName = strFieldName;
83cdf0e10cSrcweir 			else
84cdf0e10cSrcweir 				m_aDestFieldName = strFieldName;
85cdf0e10cSrcweir 		}
SetSourceFieldName(const::rtl::OUString & rSourceFieldName)86cdf0e10cSrcweir 		void SetSourceFieldName( const ::rtl::OUString& rSourceFieldName){ SetFieldName(JTCS_FROM, rSourceFieldName); }
SetDestFieldName(const::rtl::OUString & rDestFieldName)87cdf0e10cSrcweir 		void SetDestFieldName( const ::rtl::OUString& rDestFieldName ){ SetFieldName(JTCS_TO, rDestFieldName); }
88cdf0e10cSrcweir 
clearSourceFieldName()89cdf0e10cSrcweir 		inline bool clearSourceFieldName() { SetSourceFieldName(::rtl::OUString()); return true;}
clearDestFieldName()90cdf0e10cSrcweir 		inline bool clearDestFieldName() { SetDestFieldName(::rtl::OUString());		return true;}
91cdf0e10cSrcweir 
92cdf0e10cSrcweir 		// Memberzugriff (lesen)
GetFieldName(EConnectionSide nWhich) const93cdf0e10cSrcweir 		::rtl::OUString GetFieldName(EConnectionSide nWhich) const { return (nWhich == JTCS_FROM) ? m_aSourceFieldName : m_aDestFieldName; }
GetSourceFieldName() const94cdf0e10cSrcweir 		::rtl::OUString GetSourceFieldName() const { return GetFieldName(JTCS_FROM); }
GetDestFieldName() const95cdf0e10cSrcweir 		::rtl::OUString GetDestFieldName() const { return GetFieldName(JTCS_TO); }
96cdf0e10cSrcweir 
97cdf0e10cSrcweir 		bool Reset();
98cdf0e10cSrcweir 		OConnectionLineData& operator=( const OConnectionLineData& rConnLineData );
99cdf0e10cSrcweir 	};
100cdf0e10cSrcweir 
101cdf0e10cSrcweir     //-------------------------------------------------------------------------
102cdf0e10cSrcweir 	//------------------------------------------------------------------
103cdf0e10cSrcweir 	typedef ::vos::ORef< OConnectionLineData >		OConnectionLineDataRef;
104cdf0e10cSrcweir 	typedef ::std::vector< OConnectionLineDataRef >	OConnectionLineDataVec;
105cdf0e10cSrcweir }
106cdf0e10cSrcweir #endif // DBAUI_CONNECTIONLINEDATA_HXX
107cdf0e10cSrcweir 
108