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"
25 #include <tools/rtti.hxx>
26 #include <boost/shared_ptr.hpp>
30 //===========================================//
31 // ConnData ---------->* ConnLineData //
34 // Conn ---------->* ConnLine //
35 //===========================================//
37 /** Contains all connection data which exists between two windows */
38 class OTableConnectionData
41 TTableWindowData::value_type m_pReferencingTable
;
42 TTableWindowData::value_type m_pReferencedTable
;
45 OConnectionLineDataVec m_vConnLineData
;
49 virtual OConnectionLineDataRef
CreateLineDataObj();
50 virtual OConnectionLineDataRef
CreateLineDataObj( const OConnectionLineData
& rConnLineData
);
52 OTableConnectionData
& operator=( const OTableConnectionData
& rConnData
);
54 OTableConnectionData();
55 OTableConnectionData( const TTableWindowData::value_type
& _pReferencingTable
,
56 const TTableWindowData::value_type
& _pReferencedTable
,
57 const OUString
& rConnName
= OUString() );
58 OTableConnectionData( const OTableConnectionData
& rConnData
);
59 virtual ~OTableConnectionData();
61 /// initialise from a source (more comfortable than a virtual assignment operator)
62 virtual void CopyFrom(const OTableConnectionData
& rSource
);
64 /** deliver a new instance of my own type
66 derived classes have to deliver an instance of their own type
68 @note does NOT have to be initialised
70 virtual OTableConnectionData
* NewInstance() const;
72 bool SetConnLine( sal_uInt16 nIndex
, const OUString
& rSourceFieldName
, const OUString
& rDestFieldName
);
73 bool AppendConnLine( const OUString
& rSourceFieldName
, const OUString
& rDestFieldName
);
74 /** Deletes list of ConnLines
76 void ResetConnLines();
78 /** moves the empty lines to the back
79 removes duplicated empty lines
81 caller is responsible for repainting them
83 @return infex of first changed line, or one-past-the-end if no change
85 OConnectionLineDataVec::size_type
normalizeLines();
87 const OConnectionLineDataVec
& GetConnLineDataList() const { return m_vConnLineData
; }
88 OConnectionLineDataVec
& GetConnLineDataList() { return m_vConnLineData
; }
90 inline TTableWindowData::value_type
getReferencingTable() const { return m_pReferencingTable
; }
91 inline TTableWindowData::value_type
getReferencedTable() const { return m_pReferencedTable
; }
93 inline void setReferencingTable(const TTableWindowData::value_type
& _pTable
) { m_pReferencingTable
= _pTable
; }
94 inline void setReferencedTable(const TTableWindowData::value_type
& _pTable
) { m_pReferencedTable
= _pTable
; }
96 OUString
GetConnName() const { return m_aConnName
; }
98 void SetConnName( const OUString
& rConnName
){ m_aConnName
= rConnName
; }
99 /** Update create a new connection
101 @return true if successful
103 virtual bool Update(){ return true; }
106 typedef ::std::vector
< ::boost::shared_ptr
<OTableConnectionData
> > TTableConnectionData
;
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */