Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_CONNECTIONLINEDATA_HXX
20 : #define INCLUDED_DBACCESS_SOURCE_UI_INC_CONNECTIONLINEDATA_HXX
21 :
22 : #include "QEnumTypes.hxx"
23 : #include <vector>
24 :
25 : #include <rtl/ref.hxx>
26 : #include <salhelper/simplereferenceobject.hxx>
27 : #include "RefFunctor.hxx"
28 : #include <rtl/ustring.hxx>
29 :
30 : namespace dbaui
31 : {
32 :
33 : // ConnData ---------->* ConnLineData
34 : // ^1 ^1
35 : // | |
36 : // Conn ---------->* ConnLine
37 :
38 : /**
39 : the class OConnectionLineData contains the data of a connection
40 : e.g. the source and the destanation field
41 : **/
42 : class OConnectionLineData : public ::salhelper::SimpleReferenceObject
43 : {
44 : OUString m_aSourceFieldName;
45 : OUString m_aDestFieldName;
46 :
47 : friend bool operator==(const OConnectionLineData& lhs, const OConnectionLineData& rhs);
48 0 : friend bool operator!=(const OConnectionLineData& lhs, const OConnectionLineData& rhs) { return !(lhs == rhs); }
49 : protected:
50 : virtual ~OConnectionLineData();
51 : public:
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);
57 :
58 : // member access (write)
59 0 : void SetFieldName(EConnectionSide nWhich, const OUString& strFieldName)
60 : {
61 0 : if (nWhich==JTCS_FROM)
62 0 : m_aSourceFieldName = strFieldName;
63 : else
64 0 : m_aDestFieldName = strFieldName;
65 0 : }
66 0 : void SetSourceFieldName( const OUString& rSourceFieldName){ SetFieldName(JTCS_FROM, rSourceFieldName); }
67 0 : void SetDestFieldName( const OUString& rDestFieldName ){ SetFieldName(JTCS_TO, rDestFieldName); }
68 :
69 : inline bool clearSourceFieldName() { SetSourceFieldName(OUString()); return true;}
70 : inline bool clearDestFieldName() { SetDestFieldName(OUString()); return true;}
71 :
72 : // member access (read)
73 0 : OUString GetFieldName(EConnectionSide nWhich) const { return (nWhich == JTCS_FROM) ? m_aSourceFieldName : m_aDestFieldName; }
74 0 : OUString GetSourceFieldName() const { return GetFieldName(JTCS_FROM); }
75 0 : OUString GetDestFieldName() const { return GetFieldName(JTCS_TO); }
76 :
77 : bool Reset();
78 : OConnectionLineData& operator=( const OConnectionLineData& rConnLineData );
79 : };
80 :
81 : typedef ::rtl::Reference< OConnectionLineData > OConnectionLineDataRef;
82 : typedef ::std::vector< OConnectionLineDataRef > OConnectionLineDataVec;
83 : }
84 : #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_CONNECTIONLINEDATA_HXX
85 :
86 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|