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_TABLECONNECTIONDATA_HXX
20 #define INCLUDED_DBACCESS_SOURCE_UI_INC_TABLECONNECTIONDATA_HXX
22 #include "ConnectionLineData.hxx"
23 #include "TableWindowData.hxx"
29 //===========================================//
30 // ConnData ---------->* ConnLineData //
33 // Conn ---------->* ConnLine //
34 //===========================================//
36 /** Contains all connection data which exists between two windows */
37 class OTableConnectionData
40 TTableWindowData::value_type m_pReferencingTable
;
41 TTableWindowData::value_type m_pReferencedTable
;
44 OConnectionLineDataVec m_vConnLineData
;
48 virtual OConnectionLineDataRef
CreateLineDataObj();
50 OTableConnectionData
& operator=( const OTableConnectionData
& rConnData
);
52 OTableConnectionData();
53 OTableConnectionData( const TTableWindowData::value_type
& _pReferencingTable
,
54 const TTableWindowData::value_type
& _pReferencedTable
,
55 const OUString
& rConnName
= OUString() );
56 OTableConnectionData( const OTableConnectionData
& rConnData
);
57 virtual ~OTableConnectionData();
59 /// initialise from a source (more comfortable than a virtual assignment operator)
60 virtual void CopyFrom(const OTableConnectionData
& rSource
);
62 /** deliver a new instance of my own type
64 derived classes have to deliver an instance of their own type
66 @note does NOT have to be initialised
68 virtual OTableConnectionData
* NewInstance() const;
70 void SetConnLine( sal_uInt16 nIndex
, const OUString
& rSourceFieldName
, const OUString
& rDestFieldName
);
71 bool AppendConnLine( const OUString
& rSourceFieldName
, const OUString
& rDestFieldName
);
72 /** Deletes list of ConnLines
74 void ResetConnLines();
76 /** moves the empty lines to the back
77 removes duplicated empty lines
79 caller is responsible for repainting them
81 @return index of first changed line, or one-past-the-end if no change
83 OConnectionLineDataVec::size_type
normalizeLines();
85 const OConnectionLineDataVec
& GetConnLineDataList() const { return m_vConnLineData
; }
86 OConnectionLineDataVec
& GetConnLineDataList() { return m_vConnLineData
; }
88 const TTableWindowData::value_type
& getReferencingTable() const { return m_pReferencingTable
; }
89 const TTableWindowData::value_type
& getReferencedTable() const { return m_pReferencedTable
; }
91 inline void setReferencingTable(const TTableWindowData::value_type
& _pTable
) { m_pReferencingTable
= _pTable
; }
92 inline void setReferencedTable(const TTableWindowData::value_type
& _pTable
) { m_pReferencedTable
= _pTable
; }
94 const OUString
& GetConnName() const { return m_aConnName
; }
96 /** Update create a new connection
98 @return true if successful
100 virtual bool Update(){ return true; }
103 typedef ::std::vector
< ::std::shared_ptr
<OTableConnectionData
> > TTableConnectionData
;
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */