1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: TableConnectionData.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef DBAUI_TABLECONNECTIONDATA_HXX
31 #define DBAUI_TABLECONNECTIONDATA_HXX
33 #ifndef DBAUI_CONNECTIONLINEDATA_HXX
34 #include "ConnectionLineData.hxx"
36 #include "TableWindowData.hxx"
39 #include <tools/rtti.hxx>
42 #include <tools/string.hxx>
44 #include <boost/shared_ptr.hpp>
48 #define MAX_CONN_COUNT 2
49 //==================================================================
50 // ConnData ---------->* ConnLineData
53 // Conn ---------->* ConnLine
54 //==================================================================
57 //==================================================================
59 the class OTableConnectionData contains all connection data which exists between two windows
61 class OTableConnectionData
65 TTableWindowData::value_type m_pReferencingTable
;
66 TTableWindowData::value_type m_pReferencedTable
;
69 OConnectionLineDataVec m_vConnLineData
;
73 virtual OConnectionLineDataRef
CreateLineDataObj();
74 virtual OConnectionLineDataRef
CreateLineDataObj( const OConnectionLineData
& rConnLineData
);
76 OTableConnectionData
& operator=( const OTableConnectionData
& rConnData
);
78 OTableConnectionData();
79 OTableConnectionData(const TTableWindowData::value_type
& _pReferencingTable
,const TTableWindowData::value_type
& _pReferencedTable
, const String
& rConnName
= String() );
80 OTableConnectionData( const OTableConnectionData
& rConnData
);
81 virtual ~OTableConnectionData();
83 // sich aus einer Quelle initialisieren (das ist mir irgendwie angenehmer als ein virtueller Zuweisungsoperator)
84 virtual void CopyFrom(const OTableConnectionData
& rSource
);
86 // eine neue Instanz meines eigenen Typs liefern (braucht NICHT initialisiert sein)
87 virtual OTableConnectionData
* NewInstance() const;
88 // (von OTableConnectionData abgeleitete Klasse muessen entsprechend eine Instanz ihrer Klasse liefern)
90 BOOL
SetConnLine( USHORT nIndex
, const String
& rSourceFieldName
, const String
& rDestFieldName
);
91 BOOL
AppendConnLine( const ::rtl::OUString
& rSourceFieldName
, const ::rtl::OUString
& rDestFieldName
);
92 void ResetConnLines( BOOL bUseDefaults
= TRUE
);
94 /** normalizeLines moves the empty lines to the back
96 void normalizeLines();
97 // loescht die Liste der ConnLines, bei bUseDefaults == TRUE werden danach MAX_CONN_COUNT neue Dummy-Linien eingefuegt
99 OConnectionLineDataVec
* GetConnLineDataList(){ return &m_vConnLineData
; }
101 inline TTableWindowData::value_type
getReferencingTable() const { return m_pReferencingTable
; }
102 inline TTableWindowData::value_type
getReferencedTable() const { return m_pReferencedTable
; }
104 inline void setReferencingTable(const TTableWindowData::value_type
& _pTable
) { m_pReferencingTable
= _pTable
; }
105 inline void setReferencedTable(const TTableWindowData::value_type
& _pTable
) { m_pReferencedTable
= _pTable
; }
107 String
GetConnName() const { return m_aConnName
; }
109 virtual void SetConnName( const String
& rConnName
){ m_aConnName
= rConnName
; }
110 /** Update create a new connection
112 @return true if successful
114 virtual BOOL
Update(){ return TRUE
; }
117 typedef ::std::vector
< ::boost::shared_ptr
<OTableConnectionData
> > TTableConnectionData
;
120 #endif // DBAUI_TABLECONNECTIONDATA_HXX