1*96de5490SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*96de5490SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*96de5490SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*96de5490SAndrew Rist * distributed with this work for additional information 6*96de5490SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*96de5490SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*96de5490SAndrew Rist * "License"); you may not use this file except in compliance 9*96de5490SAndrew Rist * with the License. You may obtain a copy of the License at 10*96de5490SAndrew Rist * 11*96de5490SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*96de5490SAndrew Rist * 13*96de5490SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*96de5490SAndrew Rist * software distributed under the License is distributed on an 15*96de5490SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*96de5490SAndrew Rist * KIND, either express or implied. See the License for the 17*96de5490SAndrew Rist * specific language governing permissions and limitations 18*96de5490SAndrew Rist * under the License. 19*96de5490SAndrew Rist * 20*96de5490SAndrew Rist *************************************************************/ 21*96de5490SAndrew Rist 22*96de5490SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_dbaccess.hxx" 26cdf0e10cSrcweir #ifndef DBAUI_QTABLECONNECTIONDATA_HXX 27cdf0e10cSrcweir #include "QTableConnectionData.hxx" 28cdf0e10cSrcweir #endif 29cdf0e10cSrcweir #ifndef _TOOLS_DEBUG_HXX 30cdf0e10cSrcweir #include <tools/debug.hxx> 31cdf0e10cSrcweir #endif 32cdf0e10cSrcweir #ifndef DBAUI_QTABLECONNECTIONDATA_HXX 33cdf0e10cSrcweir #include "QTableConnectionData.hxx" 34cdf0e10cSrcweir #endif 35cdf0e10cSrcweir #ifndef DBAUI_QUERY_TABLEWINDOWDATA_HXX 36cdf0e10cSrcweir #include "QTableWindow.hxx" 37cdf0e10cSrcweir #endif 38cdf0e10cSrcweir 39cdf0e10cSrcweir using namespace dbaui; 40cdf0e10cSrcweir 41cdf0e10cSrcweir //======================================================================== 42cdf0e10cSrcweir // class OQueryTableConnectionData 43cdf0e10cSrcweir //======================================================================== 44cdf0e10cSrcweir DBG_NAME(OQueryTableConnectionData) 45cdf0e10cSrcweir //------------------------------------------------------------------------ 46cdf0e10cSrcweir OQueryTableConnectionData::OQueryTableConnectionData() 47cdf0e10cSrcweir :OTableConnectionData() 48cdf0e10cSrcweir ,m_eJoinType (INNER_JOIN) 49cdf0e10cSrcweir ,m_bNatural(false) 50cdf0e10cSrcweir { 51cdf0e10cSrcweir DBG_CTOR(OQueryTableConnectionData,NULL); 52cdf0e10cSrcweir } 53cdf0e10cSrcweir 54cdf0e10cSrcweir //------------------------------------------------------------------------ 55cdf0e10cSrcweir OQueryTableConnectionData::OQueryTableConnectionData( const OQueryTableConnectionData& rConnData ) 56cdf0e10cSrcweir :OTableConnectionData( rConnData ) 57cdf0e10cSrcweir { 58cdf0e10cSrcweir DBG_CTOR(OQueryTableConnectionData,NULL); 59cdf0e10cSrcweir m_nFromEntryIndex = rConnData.m_nFromEntryIndex; 60cdf0e10cSrcweir m_nDestEntryIndex = rConnData.m_nDestEntryIndex; 61cdf0e10cSrcweir 62cdf0e10cSrcweir m_eFromType = rConnData.m_eFromType; 63cdf0e10cSrcweir m_eDestType = rConnData.m_eDestType; 64cdf0e10cSrcweir m_eJoinType = rConnData.m_eJoinType; 65cdf0e10cSrcweir m_bNatural = rConnData.m_bNatural; 66cdf0e10cSrcweir } 67cdf0e10cSrcweir 68cdf0e10cSrcweir //------------------------------------------------------------------------ 69cdf0e10cSrcweir OQueryTableConnectionData::OQueryTableConnectionData(const TTableWindowData::value_type& _pReferencingTable 70cdf0e10cSrcweir ,const TTableWindowData::value_type& _pReferencedTable 71cdf0e10cSrcweir ,const ::rtl::OUString& rConnName) 72cdf0e10cSrcweir :OTableConnectionData( _pReferencingTable,_pReferencedTable, rConnName ) 73cdf0e10cSrcweir ,m_nFromEntryIndex(0) 74cdf0e10cSrcweir ,m_nDestEntryIndex(0) 75cdf0e10cSrcweir ,m_eJoinType (INNER_JOIN) 76cdf0e10cSrcweir ,m_bNatural(false) 77cdf0e10cSrcweir ,m_eFromType(TAB_NORMAL_FIELD) 78cdf0e10cSrcweir ,m_eDestType(TAB_NORMAL_FIELD) 79cdf0e10cSrcweir { 80cdf0e10cSrcweir DBG_CTOR(OQueryTableConnectionData,NULL); 81cdf0e10cSrcweir } 82cdf0e10cSrcweir 83cdf0e10cSrcweir //------------------------------------------------------------------------ 84cdf0e10cSrcweir OQueryTableConnectionData::~OQueryTableConnectionData() 85cdf0e10cSrcweir { 86cdf0e10cSrcweir DBG_DTOR(OQueryTableConnectionData,NULL); 87cdf0e10cSrcweir } 88cdf0e10cSrcweir 89cdf0e10cSrcweir //------------------------------------------------------------------------ 90cdf0e10cSrcweir OConnectionLineDataRef OQueryTableConnectionData::CreateLineDataObj() 91cdf0e10cSrcweir { 92cdf0e10cSrcweir DBG_CHKTHIS(OQueryTableConnectionData,NULL); 93cdf0e10cSrcweir // keine Spezialisierung bei den LineDatas, also eine Instanz der Standard-Klasse 94cdf0e10cSrcweir return new OConnectionLineData(); 95cdf0e10cSrcweir } 96cdf0e10cSrcweir 97cdf0e10cSrcweir //------------------------------------------------------------------------ 98cdf0e10cSrcweir OConnectionLineDataRef OQueryTableConnectionData::CreateLineDataObj( const OConnectionLineData& rConnLineData ) 99cdf0e10cSrcweir { 100cdf0e10cSrcweir DBG_CHKTHIS(OQueryTableConnectionData,NULL); 101cdf0e10cSrcweir return new OConnectionLineData( rConnLineData ); 102cdf0e10cSrcweir } 103cdf0e10cSrcweir 104cdf0e10cSrcweir //------------------------------------------------------------------------ 105cdf0e10cSrcweir void OQueryTableConnectionData::CopyFrom(const OTableConnectionData& rSource) 106cdf0e10cSrcweir { 107cdf0e10cSrcweir DBG_CHKTHIS(OQueryTableConnectionData,NULL); 108cdf0e10cSrcweir // wie in der Basisklasse zurueckziehen auf das (nicht-virtuelle) operator= 109cdf0e10cSrcweir *this = (const OQueryTableConnectionData&)rSource; 110cdf0e10cSrcweir } 111cdf0e10cSrcweir 112cdf0e10cSrcweir //------------------------------------------------------------------------ 113cdf0e10cSrcweir OQueryTableConnectionData& OQueryTableConnectionData::operator=(const OQueryTableConnectionData& rConnData) 114cdf0e10cSrcweir { 115cdf0e10cSrcweir DBG_CHKTHIS(OQueryTableConnectionData,NULL); 116cdf0e10cSrcweir if (&rConnData == this) 117cdf0e10cSrcweir return *this; 118cdf0e10cSrcweir 119cdf0e10cSrcweir OTableConnectionData::operator=(rConnData); 120cdf0e10cSrcweir 121cdf0e10cSrcweir m_nFromEntryIndex = rConnData.m_nFromEntryIndex; 122cdf0e10cSrcweir m_nDestEntryIndex = rConnData.m_nDestEntryIndex; 123cdf0e10cSrcweir 124cdf0e10cSrcweir m_eFromType = rConnData.m_eFromType; 125cdf0e10cSrcweir m_eDestType = rConnData.m_eDestType; 126cdf0e10cSrcweir m_eJoinType = rConnData.m_eJoinType; 127cdf0e10cSrcweir m_bNatural = rConnData.m_bNatural; 128cdf0e10cSrcweir 129cdf0e10cSrcweir return *this; 130cdf0e10cSrcweir } 131cdf0e10cSrcweir 132cdf0e10cSrcweir //------------------------------------------------------------------------------ 133cdf0e10cSrcweir ::rtl::OUString OQueryTableConnectionData::GetAliasName(EConnectionSide nWhich) const 134cdf0e10cSrcweir { 135cdf0e10cSrcweir DBG_CHKTHIS(OQueryTableConnectionData,NULL); 136cdf0e10cSrcweir return nWhich == JTCS_FROM ? m_pReferencingTable->GetWinName() : m_pReferencedTable->GetWinName(); 137cdf0e10cSrcweir } 138cdf0e10cSrcweir 139cdf0e10cSrcweir //------------------------------------------------------------------------------ 140cdf0e10cSrcweir void OQueryTableConnectionData::InitFromDrag(const OTableFieldDescRef& rDragLeft, const OTableFieldDescRef& rDragRight) 141cdf0e10cSrcweir { 142cdf0e10cSrcweir DBG_CHKTHIS(OQueryTableConnectionData,NULL); 143cdf0e10cSrcweir // die Infos in rDrag in Parameter fuer das Basisklassen-Init umsetzen ... 144cdf0e10cSrcweir OQueryTableWindow* pSourceWin = static_cast<OQueryTableWindow*>(rDragLeft->GetTabWindow()); 145cdf0e10cSrcweir OQueryTableWindow* pDestWin = static_cast<OQueryTableWindow*>(rDragRight->GetTabWindow()); 146cdf0e10cSrcweir OSL_ENSURE(pSourceWin,"NO Source window found!"); 147cdf0e10cSrcweir OSL_ENSURE(pDestWin,"NO Dest window found!"); 148cdf0e10cSrcweir m_pReferencingTable = pSourceWin->GetData(); 149cdf0e10cSrcweir m_pReferencedTable = pDestWin->GetData(); 150cdf0e10cSrcweir 151cdf0e10cSrcweir // und dann meine Members setzen 152cdf0e10cSrcweir SetFieldIndex(JTCS_FROM, rDragLeft->GetFieldIndex()); 153cdf0e10cSrcweir SetFieldIndex(JTCS_TO, rDragRight->GetFieldIndex()); 154cdf0e10cSrcweir 155cdf0e10cSrcweir SetFieldType(JTCS_FROM, rDragLeft->GetFieldType()); 156cdf0e10cSrcweir SetFieldType(JTCS_TO, rDragRight->GetFieldType()); 157cdf0e10cSrcweir 158cdf0e10cSrcweir AppendConnLine((::rtl::OUString)rDragLeft->GetField(),(::rtl::OUString)rDragRight->GetField()); 159cdf0e10cSrcweir } 160cdf0e10cSrcweir // ----------------------------------------------------------------------------- 161cdf0e10cSrcweir OTableConnectionData* OQueryTableConnectionData::NewInstance() const 162cdf0e10cSrcweir { 163cdf0e10cSrcweir return new OQueryTableConnectionData(); 164cdf0e10cSrcweir } 165cdf0e10cSrcweir // ----------------------------------------------------------------------------- 166cdf0e10cSrcweir sal_Bool OQueryTableConnectionData::Update() 167cdf0e10cSrcweir { 168cdf0e10cSrcweir return sal_True; 169cdf0e10cSrcweir } 170cdf0e10cSrcweir // ----------------------------------------------------------------------------- 171cdf0e10cSrcweir 172cdf0e10cSrcweir 173cdf0e10cSrcweir 174cdf0e10cSrcweir 175