Branch data 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 DBAUI_TABLECONNECTIONDATA_HXX
20 : : #define DBAUI_TABLECONNECTIONDATA_HXX
21 : :
22 : : #include "ConnectionLineData.hxx"
23 : : #include "TableWindowData.hxx"
24 : : #include <vector>
25 : : #include <tools/rtti.hxx>
26 : : #include <tools/string.hxx>
27 : : #include <boost/shared_ptr.hpp>
28 : :
29 : : namespace dbaui
30 : : {
31 : : //===========================================//
32 : : // ConnData ---------->* ConnLineData //
33 : : // ^1 ^1 //
34 : : // | | //
35 : : // Conn ---------->* ConnLine //
36 : : //===========================================//
37 : :
38 : : /** Contains all connection data which exists between two windows */
39 : : class OTableConnectionData
40 : : {
41 : : protected:
42 : : TTableWindowData::value_type m_pReferencingTable;
43 : : TTableWindowData::value_type m_pReferencedTable;
44 : : String m_aConnName;
45 : :
46 : : OConnectionLineDataVec m_vConnLineData;
47 : :
48 : : void Init();
49 : :
50 : : virtual OConnectionLineDataRef CreateLineDataObj();
51 : : virtual OConnectionLineDataRef CreateLineDataObj( const OConnectionLineData& rConnLineData );
52 : :
53 : : OTableConnectionData& operator=( const OTableConnectionData& rConnData );
54 : : public:
55 : : OTableConnectionData();
56 : : OTableConnectionData( const TTableWindowData::value_type& _pReferencingTable,
57 : : const TTableWindowData::value_type& _pReferencedTable,
58 : : const String& rConnName = String() );
59 : : OTableConnectionData( const OTableConnectionData& rConnData );
60 : : virtual ~OTableConnectionData();
61 : :
62 : : /// initialise from a source (more comfortable than a virtual assignment operator)
63 : : virtual void CopyFrom(const OTableConnectionData& rSource);
64 : :
65 : : /** deliver a new instance of my own type
66 : :
67 : : derived classes have to deliver an instance of their own type
68 : :
69 : : @note does NOT have to be initialised
70 : : */
71 : : virtual OTableConnectionData* NewInstance() const;
72 : :
73 : : sal_Bool SetConnLine( sal_uInt16 nIndex, const String& rSourceFieldName, const String& rDestFieldName );
74 : : sal_Bool AppendConnLine( const ::rtl::OUString& rSourceFieldName, const ::rtl::OUString& rDestFieldName );
75 : : void ResetConnLines( sal_Bool bUseDefaults = sal_True );
76 : :
77 : : /** moves the empty lines to the back
78 : :
79 : : Deletes list of ConnLines; if bUseDefaults == true
80 : : MAX_CONN_COUNT new dummy lines will be inserted.
81 : : */
82 : : void normalizeLines();
83 : :
84 : 0 : OConnectionLineDataVec* GetConnLineDataList(){ return &m_vConnLineData; }
85 : :
86 : 0 : inline TTableWindowData::value_type getReferencingTable() const { return m_pReferencingTable; }
87 : 0 : inline TTableWindowData::value_type getReferencedTable() const { return m_pReferencedTable; }
88 : :
89 : 0 : inline void setReferencingTable(const TTableWindowData::value_type& _pTable) { m_pReferencingTable = _pTable; }
90 : 0 : inline void setReferencedTable(const TTableWindowData::value_type& _pTable) { m_pReferencedTable = _pTable; }
91 : :
92 : 0 : String GetConnName() const { return m_aConnName; }
93 : :
94 : 0 : virtual void SetConnName( const String& rConnName ){ m_aConnName = rConnName; }
95 : : /** Update create a new connection
96 : :
97 : : @return true if successful
98 : : */
99 : 0 : virtual sal_Bool Update(){ return sal_True; }
100 : : };
101 : :
102 : : typedef ::std::vector< ::boost::shared_ptr<OTableConnectionData> > TTableConnectionData;
103 : :
104 : : }
105 : : #endif
106 : :
107 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|