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 "ConnectionLineData.hxx"
22 #include "TableWindowData.hxx"
28 //===========================================//
29 // ConnData ---------->* ConnLineData //
32 // Conn ---------->* ConnLine //
33 //===========================================//
35 /** Contains all connection data which exists between two windows */
36 class OTableConnectionData
39 TTableWindowData::value_type m_pReferencingTable
;
40 TTableWindowData::value_type m_pReferencedTable
;
43 OConnectionLineDataVec m_vConnLineData
;
47 OTableConnectionData
& operator=( const OTableConnectionData
& rConnData
);
49 OTableConnectionData();
50 OTableConnectionData( TTableWindowData::value_type _aReferencingTable
,
51 TTableWindowData::value_type _aReferencedTable
);
52 OTableConnectionData( const OTableConnectionData
& rConnData
);
53 virtual ~OTableConnectionData();
55 /// initialise from a source (more comfortable than a virtual assignment operator)
56 virtual void CopyFrom(const OTableConnectionData
& rSource
);
58 /** deliver a new instance of my own type
60 derived classes have to deliver an instance of their own type
62 @note does NOT have to be initialised
64 virtual std::shared_ptr
<OTableConnectionData
> NewInstance() const;
66 void SetConnLine( sal_uInt16 nIndex
, const OUString
& rSourceFieldName
, const OUString
& rDestFieldName
);
67 bool AppendConnLine( const OUString
& rSourceFieldName
, const OUString
& rDestFieldName
);
68 /** Deletes list of ConnLines
70 void ResetConnLines();
72 /** moves the empty lines to the back
73 removes duplicated empty lines
75 caller is responsible for repainting them
77 @return index of first changed line, or one-past-the-end if no change
79 OConnectionLineDataVec::size_type
normalizeLines();
81 const OConnectionLineDataVec
& GetConnLineDataList() const { return m_vConnLineData
; }
82 OConnectionLineDataVec
& GetConnLineDataList() { return m_vConnLineData
; }
84 const TTableWindowData::value_type
& getReferencingTable() const { return m_pReferencingTable
; }
85 const TTableWindowData::value_type
& getReferencedTable() const { return m_pReferencedTable
; }
87 void setReferencingTable(const TTableWindowData::value_type
& _pTable
) { m_pReferencingTable
= _pTable
; }
88 void setReferencedTable(const TTableWindowData::value_type
& _pTable
) { m_pReferencedTable
= _pTable
; }
90 /** Update create a new connection
92 @return true if successful
94 virtual bool Update(){ return true; }
97 typedef std::vector
< std::shared_ptr
<OTableConnectionData
> > TTableConnectionData
;
101 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */