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 .
21 #include "QEnumTypes.hxx"
24 #include <rtl/ref.hxx>
25 #include <salhelper/simplereferenceobject.hxx>
26 #include <rtl/ustring.hxx>
31 // ConnData ---------->* ConnLineData
34 // Conn ---------->* ConnLine
37 the class OConnectionLineData contains the data of a connection
38 e.g. the source and the destination field
40 class OConnectionLineData
: public ::salhelper::SimpleReferenceObject
42 OUString m_aSourceFieldName
;
43 OUString m_aDestFieldName
;
45 friend bool operator==(const OConnectionLineData
& lhs
, const OConnectionLineData
& rhs
);
46 friend bool operator!=(const OConnectionLineData
& lhs
, const OConnectionLineData
& rhs
) { return !(lhs
== rhs
); }
48 virtual ~OConnectionLineData() override
;
50 OConnectionLineData();
51 OConnectionLineData( OUString sSourceFieldName
, OUString sDestFieldName
);
52 OConnectionLineData( const OConnectionLineData
& rConnLineData
);
53 // provide a copy of own instance (this is somehow more acceptable for me compared to a virtual assignment operator
54 void CopyFrom(const OConnectionLineData
& rSource
);
56 // member access (write)
57 void SetFieldName(EConnectionSide nWhich
, const OUString
& strFieldName
)
59 if (nWhich
==JTCS_FROM
)
60 m_aSourceFieldName
= strFieldName
;
62 m_aDestFieldName
= strFieldName
;
64 void SetSourceFieldName( const OUString
& rSourceFieldName
){ SetFieldName(JTCS_FROM
, rSourceFieldName
); }
65 void SetDestFieldName( const OUString
& rDestFieldName
){ SetFieldName(JTCS_TO
, rDestFieldName
); }
67 // member access (read)
68 const OUString
& GetFieldName(EConnectionSide nWhich
) const { return (nWhich
== JTCS_FROM
) ? m_aSourceFieldName
: m_aDestFieldName
; }
69 OUString
const & GetSourceFieldName() const { return GetFieldName(JTCS_FROM
); }
70 OUString
const & GetDestFieldName() const { return GetFieldName(JTCS_TO
); }
73 OConnectionLineData
& operator=( const OConnectionLineData
& rConnLineData
);
76 typedef ::rtl::Reference
< OConnectionLineData
> OConnectionLineDataRef
;
77 typedef std::vector
< OConnectionLineDataRef
> OConnectionLineDataVec
;
80 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */