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