merge the formfield patch from ooo-build
[ooovba.git] / dbaccess / source / ui / querydesign / QTableConnectionData.cxx
blob8bad3ab81cc0dde2b7d840df7991f707324a0c33
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: QTableConnectionData.cxx,v $
10 * $Revision: 1.13 $
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 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_dbaccess.hxx"
33 #ifndef DBAUI_QTABLECONNECTIONDATA_HXX
34 #include "QTableConnectionData.hxx"
35 #endif
36 #ifndef _TOOLS_DEBUG_HXX
37 #include <tools/debug.hxx>
38 #endif
39 #ifndef DBAUI_QTABLECONNECTIONDATA_HXX
40 #include "QTableConnectionData.hxx"
41 #endif
42 #ifndef DBAUI_QUERY_TABLEWINDOWDATA_HXX
43 #include "QTableWindow.hxx"
44 #endif
46 using namespace dbaui;
48 //========================================================================
49 // class OQueryTableConnectionData
50 //========================================================================
51 DBG_NAME(OQueryTableConnectionData)
52 //------------------------------------------------------------------------
53 OQueryTableConnectionData::OQueryTableConnectionData()
54 :OTableConnectionData()
55 ,m_eJoinType (INNER_JOIN)
56 ,m_bNatural(false)
58 DBG_CTOR(OQueryTableConnectionData,NULL);
61 //------------------------------------------------------------------------
62 OQueryTableConnectionData::OQueryTableConnectionData( const OQueryTableConnectionData& rConnData )
63 :OTableConnectionData( rConnData )
65 DBG_CTOR(OQueryTableConnectionData,NULL);
66 m_nFromEntryIndex = rConnData.m_nFromEntryIndex;
67 m_nDestEntryIndex = rConnData.m_nDestEntryIndex;
69 m_eFromType = rConnData.m_eFromType;
70 m_eDestType = rConnData.m_eDestType;
71 m_eJoinType = rConnData.m_eJoinType;
72 m_bNatural = rConnData.m_bNatural;
75 //------------------------------------------------------------------------
76 OQueryTableConnectionData::OQueryTableConnectionData(const TTableWindowData::value_type& _pReferencingTable
77 ,const TTableWindowData::value_type& _pReferencedTable
78 ,const ::rtl::OUString& rConnName)
79 :OTableConnectionData( _pReferencingTable,_pReferencedTable, rConnName )
80 ,m_nFromEntryIndex(0)
81 ,m_nDestEntryIndex(0)
82 ,m_eJoinType (INNER_JOIN)
83 ,m_bNatural(false)
84 ,m_eFromType(TAB_NORMAL_FIELD)
85 ,m_eDestType(TAB_NORMAL_FIELD)
87 DBG_CTOR(OQueryTableConnectionData,NULL);
90 //------------------------------------------------------------------------
91 OQueryTableConnectionData::~OQueryTableConnectionData()
93 DBG_DTOR(OQueryTableConnectionData,NULL);
96 //------------------------------------------------------------------------
97 OConnectionLineDataRef OQueryTableConnectionData::CreateLineDataObj()
99 DBG_CHKTHIS(OQueryTableConnectionData,NULL);
100 // keine Spezialisierung bei den LineDatas, also eine Instanz der Standard-Klasse
101 return new OConnectionLineData();
104 //------------------------------------------------------------------------
105 OConnectionLineDataRef OQueryTableConnectionData::CreateLineDataObj( const OConnectionLineData& rConnLineData )
107 DBG_CHKTHIS(OQueryTableConnectionData,NULL);
108 return new OConnectionLineData( rConnLineData );
111 //------------------------------------------------------------------------
112 void OQueryTableConnectionData::CopyFrom(const OTableConnectionData& rSource)
114 DBG_CHKTHIS(OQueryTableConnectionData,NULL);
115 // wie in der Basisklasse zurueckziehen auf das (nicht-virtuelle) operator=
116 *this = (const OQueryTableConnectionData&)rSource;
119 //------------------------------------------------------------------------
120 OQueryTableConnectionData& OQueryTableConnectionData::operator=(const OQueryTableConnectionData& rConnData)
122 DBG_CHKTHIS(OQueryTableConnectionData,NULL);
123 if (&rConnData == this)
124 return *this;
126 OTableConnectionData::operator=(rConnData);
128 m_nFromEntryIndex = rConnData.m_nFromEntryIndex;
129 m_nDestEntryIndex = rConnData.m_nDestEntryIndex;
131 m_eFromType = rConnData.m_eFromType;
132 m_eDestType = rConnData.m_eDestType;
133 m_eJoinType = rConnData.m_eJoinType;
134 m_bNatural = rConnData.m_bNatural;
136 return *this;
139 //------------------------------------------------------------------------------
140 ::rtl::OUString OQueryTableConnectionData::GetAliasName(EConnectionSide nWhich) const
142 DBG_CHKTHIS(OQueryTableConnectionData,NULL);
143 return nWhich == JTCS_FROM ? m_pReferencingTable->GetWinName() : m_pReferencedTable->GetWinName();
146 //------------------------------------------------------------------------------
147 void OQueryTableConnectionData::InitFromDrag(const OTableFieldDescRef& rDragLeft, const OTableFieldDescRef& rDragRight)
149 DBG_CHKTHIS(OQueryTableConnectionData,NULL);
150 // die Infos in rDrag in Parameter fuer das Basisklassen-Init umsetzen ...
151 OQueryTableWindow* pSourceWin = static_cast<OQueryTableWindow*>(rDragLeft->GetTabWindow());
152 OQueryTableWindow* pDestWin = static_cast<OQueryTableWindow*>(rDragRight->GetTabWindow());
153 OSL_ENSURE(pSourceWin,"NO Source window found!");
154 OSL_ENSURE(pDestWin,"NO Dest window found!");
155 m_pReferencingTable = pSourceWin->GetData();
156 m_pReferencedTable = pDestWin->GetData();
158 // und dann meine Members setzen
159 SetFieldIndex(JTCS_FROM, rDragLeft->GetFieldIndex());
160 SetFieldIndex(JTCS_TO, rDragRight->GetFieldIndex());
162 SetFieldType(JTCS_FROM, rDragLeft->GetFieldType());
163 SetFieldType(JTCS_TO, rDragRight->GetFieldType());
165 AppendConnLine((::rtl::OUString)rDragLeft->GetField(),(::rtl::OUString)rDragRight->GetField());
167 // -----------------------------------------------------------------------------
168 OTableConnectionData* OQueryTableConnectionData::NewInstance() const
170 return new OQueryTableConnectionData();
172 // -----------------------------------------------------------------------------
173 BOOL OQueryTableConnectionData::Update()
175 return TRUE;
177 // -----------------------------------------------------------------------------