1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_dbaccess.hxx" 26 #ifndef DBAUI_QUERYTABLECONNECTION_HXX 27 #include "QTableConnection.hxx" 28 #endif 29 #ifndef _TOOLS_DEBUG_HXX 30 #include <tools/debug.hxx> 31 #endif 32 #ifndef DBAUI_QUERYTABLEVIEW_HXX 33 #include "QueryTableView.hxx" 34 #endif 35 #ifndef DBAUI_CONNECTIONLINE_HXX 36 #include "ConnectionLine.hxx" 37 #endif 38 using namespace dbaui; 39 //======================================================================== 40 // class OQueryTableConnection 41 //======================================================================== 42 DBG_NAME(OQueryTableConnection) 43 44 //------------------------------------------------------------------------ 45 OQueryTableConnection::OQueryTableConnection(OQueryTableView* pContainer, const TTableConnectionData::value_type& pTabConnData) 46 :OTableConnection(pContainer, pTabConnData) 47 ,m_bVisited(sal_False) 48 { 49 DBG_CTOR(OQueryTableConnection,NULL); 50 } 51 52 53 //------------------------------------------------------------------------ 54 OQueryTableConnection::OQueryTableConnection(const OQueryTableConnection& rConn) 55 :OTableConnection( rConn ) 56 { 57 DBG_CTOR(OQueryTableConnection,NULL); 58 // keine eigenen Members, also reicht die Basisklassenfunktionalitaet 59 } 60 //------------------------------------------------------------------------ 61 OQueryTableConnection::~OQueryTableConnection() 62 { 63 DBG_DTOR(OQueryTableConnection,NULL); 64 } 65 66 //------------------------------------------------------------------------ 67 OQueryTableConnection& OQueryTableConnection::operator=(const OQueryTableConnection& rConn) 68 { 69 if (&rConn == this) 70 return *this; 71 72 OTableConnection::operator=(rConn); 73 // keine eigenen Members ... 74 return *this; 75 } 76 77 //------------------------------------------------------------------------ 78 sal_Bool OQueryTableConnection::operator==(const OQueryTableConnection& rCompare) 79 { 80 DBG_ASSERT(GetData() && rCompare.GetData(), "OQueryTableConnection::operator== : einer der beiden Teilnehmer hat keine Daten !"); 81 82 // allzuviel brauche ich nicht vergleichen (schon gar nicht alle Member) : lediglich die Fenster, an denen wir haengen, und 83 // die Indizies in der entsprechenden Tabelle muessen uebereinstimmen 84 OQueryTableConnectionData* pMyData = static_cast<OQueryTableConnectionData*>(GetData().get()); 85 OQueryTableConnectionData* pCompData = static_cast<OQueryTableConnectionData*>(rCompare.GetData().get()); 86 87 // Connections werden als gleich angesehen, wenn sie in Source-/Dest-Fenstername und Source-/Dest-FieldIndex uebereinstimmen ... 88 return ( ( (pMyData->getReferencedTable() == pCompData->getReferencedTable()) && 89 (pMyData->getReferencingTable() == pCompData->getReferencingTable()) && 90 (pMyData->GetFieldIndex(JTCS_TO) == pCompData->GetFieldIndex(JTCS_TO)) && 91 (pMyData->GetFieldIndex(JTCS_FROM) == pCompData->GetFieldIndex(JTCS_FROM)) 92 ) 93 || // ... oder diese Uebereinstimmung ueber Kreuz besteht 94 ( (pMyData->getReferencingTable() == pCompData->getReferencedTable()) && 95 (pMyData->getReferencedTable() == pCompData->getReferencingTable()) && 96 (pMyData->GetFieldIndex(JTCS_TO) == pCompData->GetFieldIndex(JTCS_FROM)) && 97 (pMyData->GetFieldIndex(JTCS_FROM) == pCompData->GetFieldIndex(JTCS_TO)) 98 ) 99 ); 100 } 101 // ----------------------------------------------------------------------------- 102 103 104 105 106 107 108