1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ConnectionLineData.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef DBAUI_CONNECTIONLINEDATA_HXX
31 #define DBAUI_CONNECTIONLINEDATA_HXX
33 #ifndef DBAUI_ENUMTYPES_HXX
34 #include "QEnumTypes.hxx"
36 #ifndef _VOS_REFERNCE_HXX_
37 #include <vos/refernce.hxx>
42 #include <vos/ref.hxx>
45 #ifndef DBAUI_REFFUNCTOR_HXX
46 #include "RefFunctor.hxx"
48 #ifndef _RTL_USTRING_HXX_
49 #include <rtl/ustring.hxx>
55 //==================================================================
56 // ConnData ---------->* ConnLineData
59 // Conn ---------->* ConnLine
60 //==================================================================
63 //==================================================================
65 the class OConnectionLineData contains the data of a connection
66 e.g. the source and the destanation field
68 class OConnectionLineData
: public ::vos::OReference
70 ::rtl::OUString m_aSourceFieldName
;
71 ::rtl::OUString m_aDestFieldName
;
73 friend bool operator==(const OConnectionLineData
& lhs
, const OConnectionLineData
& rhs
);
74 friend bool operator!=(const OConnectionLineData
& lhs
, const OConnectionLineData
& rhs
) { return !(lhs
== rhs
); }
76 virtual ~OConnectionLineData();
78 OConnectionLineData();
79 OConnectionLineData( const ::rtl::OUString
& rSourceFieldName
, const ::rtl::OUString
& rDestFieldName
);
80 OConnectionLineData( const OConnectionLineData
& rConnLineData
);
82 // eine Kopie der eigenen Instanz liefern (das ist mir irgendwie angenehmer als ein virtueller Zuweisungsoperator)
83 void CopyFrom(const OConnectionLineData
& rSource
);
85 // Memberzugriff (schreiben)
86 void SetFieldName(EConnectionSide nWhich
, const ::rtl::OUString
& strFieldName
)
88 if (nWhich
==JTCS_FROM
)
89 m_aSourceFieldName
= strFieldName
;
91 m_aDestFieldName
= strFieldName
;
93 void SetSourceFieldName( const ::rtl::OUString
& rSourceFieldName
){ SetFieldName(JTCS_FROM
, rSourceFieldName
); }
94 void SetDestFieldName( const ::rtl::OUString
& rDestFieldName
){ SetFieldName(JTCS_TO
, rDestFieldName
); }
96 inline bool clearSourceFieldName() { SetSourceFieldName(::rtl::OUString()); return true;}
97 inline bool clearDestFieldName() { SetDestFieldName(::rtl::OUString()); return true;}
99 // Memberzugriff (lesen)
100 ::rtl::OUString
GetFieldName(EConnectionSide nWhich
) const { return (nWhich
== JTCS_FROM
) ? m_aSourceFieldName
: m_aDestFieldName
; }
101 ::rtl::OUString
GetSourceFieldName() const { return GetFieldName(JTCS_FROM
); }
102 ::rtl::OUString
GetDestFieldName() const { return GetFieldName(JTCS_TO
); }
105 OConnectionLineData
& operator=( const OConnectionLineData
& rConnLineData
);
108 //-------------------------------------------------------------------------
109 //------------------------------------------------------------------
110 typedef ::vos::ORef
< OConnectionLineData
> OConnectionLineDataRef
;
111 typedef ::std::vector
< OConnectionLineDataRef
> OConnectionLineDataVec
;
113 #endif // DBAUI_CONNECTIONLINEDATA_HXX