xref: /trunk/main/dbaccess/source/ui/querydesign/QTableConnectionData.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef DBAUI_QTABLECONNECTIONDATA_HXX
28 #define DBAUI_QTABLECONNECTIONDATA_HXX
29 
30 #ifndef DBAUI_TABLECONNECTIONDATA_HXX
31 #include "TableConnectionData.hxx"
32 #endif
33 #ifndef DBAUI_TABLEFIELDDESC_HXX
34 #include "TableFieldDescription.hxx"
35 #endif
36 #ifndef DBAUI_ENUMTYPES_HXX
37 #include "QEnumTypes.hxx"
38 #endif
39 #ifndef _RTTI_HXX
40 #include <tools/rtti.hxx>
41 #endif
42 //#ifndef DBAUI_QUERYCONTROLLER_HXX
43 //#include "querycontroller.hxx"
44 //#endif
45 
46 namespace dbaui
47 {
48     class OQueryTableConnectionData : public OTableConnectionData
49     {
50         sal_Int32       m_nFromEntryIndex;
51         sal_Int32       m_nDestEntryIndex;
52         EJoinType       m_eJoinType;
53         bool            m_bNatural;
54 
55         ETableFieldType m_eFromType;
56         ETableFieldType m_eDestType;
57 
58     protected:
59         // fuer das Anlegen und Duplizieren von Lines vom eigenen Typ
60         virtual OConnectionLineDataRef CreateLineDataObj();
61         virtual OConnectionLineDataRef CreateLineDataObj( const OConnectionLineData& rConnLineData );
62 
63         OQueryTableConnectionData& operator=( const OQueryTableConnectionData& rConnData );
64     public:
65         OQueryTableConnectionData();
66         OQueryTableConnectionData( const OQueryTableConnectionData& rConnData );
67         OQueryTableConnectionData( const TTableWindowData::value_type& _pReferencingTable,const TTableWindowData::value_type& _pReferencedTable,
68             const ::rtl::OUString& rConnName=::rtl::OUString());
69         virtual ~OQueryTableConnectionData();
70 
71         virtual void CopyFrom(const OTableConnectionData& rSource);
72         virtual OTableConnectionData* NewInstance() const;
73 
74 
75         /** Update create a new connection
76 
77             @return true if successful
78         */
79         virtual sal_Bool Update();
80 
81         ::rtl::OUString GetAliasName(EConnectionSide nWhich) const;
82 
83         sal_Int32       GetFieldIndex(EConnectionSide nWhich) const { return nWhich==JTCS_TO ? m_nDestEntryIndex : m_nFromEntryIndex; }
84         void            SetFieldIndex(EConnectionSide nWhich, sal_Int32 nVal) { if (nWhich==JTCS_TO) m_nDestEntryIndex=nVal; else m_nFromEntryIndex=nVal; }
85 
86         ETableFieldType GetFieldType(EConnectionSide nWhich) const { return nWhich==JTCS_TO ? m_eDestType : m_eFromType; }
87         void            SetFieldType(EConnectionSide nWhich, ETableFieldType eType) { if (nWhich==JTCS_TO) m_eDestType=eType; else m_eFromType=eType; }
88 
89         void            InitFromDrag(const OTableFieldDescRef& rDragLeft, const OTableFieldDescRef& rDragRight);
90 
91         EJoinType       GetJoinType() const { return m_eJoinType; };
92         void            SetJoinType(const EJoinType& eJT) { m_eJoinType = eJT; };
93 
94         inline void setNatural(bool _bNatural) { m_bNatural = _bNatural; }
95         inline bool isNatural() const { return m_bNatural; }
96     };
97 
98 }
99 #endif // DBAUI_QTABLECONNECTIONDATA_HXX
100