1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_CONNECTIONLINEDATA_HXX
20 #define INCLUDED_DBACCESS_SOURCE_UI_INC_CONNECTIONLINEDATA_HXX
22 #include "QEnumTypes.hxx"
25 #include <rtl/ref.hxx>
26 #include <salhelper/simplereferenceobject.hxx>
27 #include "RefFunctor.hxx"
28 #include <rtl/ustring.hxx>
33 // ConnData ---------->* ConnLineData
36 // Conn ---------->* ConnLine
39 the class OConnectionLineData contains the data of a connection
40 e.g. the source and the destanation field
42 class OConnectionLineData
: public ::salhelper::SimpleReferenceObject
44 OUString m_aSourceFieldName
;
45 OUString m_aDestFieldName
;
47 friend bool operator==(const OConnectionLineData
& lhs
, const OConnectionLineData
& rhs
);
48 friend bool operator!=(const OConnectionLineData
& lhs
, const OConnectionLineData
& rhs
) { return !(lhs
== rhs
); }
50 virtual ~OConnectionLineData();
52 OConnectionLineData();
53 OConnectionLineData( const OUString
& rSourceFieldName
, const OUString
& rDestFieldName
);
54 OConnectionLineData( const OConnectionLineData
& rConnLineData
);
55 // provide a copy of own instance (this is somehow more acceptable for me compared to a virtual assignment operator
56 void CopyFrom(const OConnectionLineData
& rSource
);
58 // member access (write)
59 void SetFieldName(EConnectionSide nWhich
, const OUString
& strFieldName
)
61 if (nWhich
==JTCS_FROM
)
62 m_aSourceFieldName
= strFieldName
;
64 m_aDestFieldName
= strFieldName
;
66 void SetSourceFieldName( const OUString
& rSourceFieldName
){ SetFieldName(JTCS_FROM
, rSourceFieldName
); }
67 void SetDestFieldName( const OUString
& rDestFieldName
){ SetFieldName(JTCS_TO
, rDestFieldName
); }
69 inline bool clearSourceFieldName() { SetSourceFieldName(OUString()); return true;}
70 inline bool clearDestFieldName() { SetDestFieldName(OUString()); return true;}
72 // member access (read)
73 OUString
GetFieldName(EConnectionSide nWhich
) const { return (nWhich
== JTCS_FROM
) ? m_aSourceFieldName
: m_aDestFieldName
; }
74 OUString
GetSourceFieldName() const { return GetFieldName(JTCS_FROM
); }
75 OUString
GetDestFieldName() const { return GetFieldName(JTCS_TO
); }
78 OConnectionLineData
& operator=( const OConnectionLineData
& rConnLineData
);
81 typedef ::rtl::Reference
< OConnectionLineData
> OConnectionLineDataRef
;
82 typedef ::std::vector
< OConnectionLineDataRef
> OConnectionLineDataVec
;
84 #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_CONNECTIONLINEDATA_HXX
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */