2010-10-12 15:59:03 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2001-02-05 08:26:47 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 15:17:55 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2001-02-05 08:26:47 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2001-02-05 08:26:47 +00:00
|
|
|
*
|
2008-04-10 15:17:55 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2001-02-05 08:26:47 +00:00
|
|
|
*
|
2008-04-10 15:17:55 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2001-02-05 08:26:47 +00:00
|
|
|
*
|
2008-04-10 15:17:55 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2001-02-05 08:26:47 +00:00
|
|
|
*
|
2008-04-10 15:17:55 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2001-02-05 08:26:47 +00:00
|
|
|
*
|
2008-04-10 15:17:55 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2001-02-05 08:26:47 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
2006-09-17 06:21:16 +00:00
|
|
|
|
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
2011-04-14 10:03:55 +02:00
|
|
|
#include "precompiled_dbui.hxx"
|
2001-02-05 08:26:47 +00:00
|
|
|
#include "QTableConnection.hxx"
|
2011-02-03 00:33:36 +01:00
|
|
|
#include <osl/diagnose.h>
|
2001-02-28 09:18:26 +00:00
|
|
|
#include "QueryTableView.hxx"
|
2002-02-06 07:15:30 +00:00
|
|
|
#include "ConnectionLine.hxx"
|
2001-02-05 08:26:47 +00:00
|
|
|
using namespace dbaui;
|
|
|
|
//========================================================================
|
|
|
|
// class OQueryTableConnection
|
|
|
|
//========================================================================
|
2007-11-05 08:06:13 +00:00
|
|
|
DBG_NAME(OQueryTableConnection)
|
2001-02-05 08:26:47 +00:00
|
|
|
|
|
|
|
//------------------------------------------------------------------------
|
2007-11-01 14:29:30 +00:00
|
|
|
OQueryTableConnection::OQueryTableConnection(OQueryTableView* pContainer, const TTableConnectionData::value_type& pTabConnData)
|
2001-02-05 08:26:47 +00:00
|
|
|
:OTableConnection(pContainer, pTabConnData)
|
2007-11-01 14:29:30 +00:00
|
|
|
,m_bVisited(sal_False)
|
2001-02-05 08:26:47 +00:00
|
|
|
{
|
|
|
|
DBG_CTOR(OQueryTableConnection,NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------
|
|
|
|
OQueryTableConnection::OQueryTableConnection(const OQueryTableConnection& rConn)
|
|
|
|
:OTableConnection( rConn )
|
|
|
|
{
|
|
|
|
DBG_CTOR(OQueryTableConnection,NULL);
|
|
|
|
// keine eigenen Members, also reicht die Basisklassenfunktionalitaet
|
|
|
|
}
|
|
|
|
//------------------------------------------------------------------------
|
|
|
|
OQueryTableConnection::~OQueryTableConnection()
|
|
|
|
{
|
|
|
|
DBG_DTOR(OQueryTableConnection,NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------
|
|
|
|
OQueryTableConnection& OQueryTableConnection::operator=(const OQueryTableConnection& rConn)
|
|
|
|
{
|
|
|
|
if (&rConn == this)
|
|
|
|
return *this;
|
|
|
|
|
|
|
|
OTableConnection::operator=(rConn);
|
|
|
|
// keine eigenen Members ...
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------
|
|
|
|
sal_Bool OQueryTableConnection::operator==(const OQueryTableConnection& rCompare)
|
|
|
|
{
|
2011-02-03 00:33:36 +01:00
|
|
|
OSL_ENSURE(GetData() && rCompare.GetData(), "OQueryTableConnection::operator== : einer der beiden Teilnehmer hat keine Daten !");
|
2001-02-05 08:26:47 +00:00
|
|
|
|
|
|
|
// allzuviel brauche ich nicht vergleichen (schon gar nicht alle Member) : lediglich die Fenster, an denen wir haengen, und
|
|
|
|
// die Indizies in der entsprechenden Tabelle muessen uebereinstimmen
|
2007-11-01 14:29:30 +00:00
|
|
|
OQueryTableConnectionData* pMyData = static_cast<OQueryTableConnectionData*>(GetData().get());
|
|
|
|
OQueryTableConnectionData* pCompData = static_cast<OQueryTableConnectionData*>(rCompare.GetData().get());
|
2001-02-05 08:26:47 +00:00
|
|
|
|
|
|
|
// Connections werden als gleich angesehen, wenn sie in Source-/Dest-Fenstername und Source-/Dest-FieldIndex uebereinstimmen ...
|
2007-11-01 14:29:30 +00:00
|
|
|
return ( ( (pMyData->getReferencedTable() == pCompData->getReferencedTable()) &&
|
|
|
|
(pMyData->getReferencingTable() == pCompData->getReferencingTable()) &&
|
2001-02-05 08:26:47 +00:00
|
|
|
(pMyData->GetFieldIndex(JTCS_TO) == pCompData->GetFieldIndex(JTCS_TO)) &&
|
|
|
|
(pMyData->GetFieldIndex(JTCS_FROM) == pCompData->GetFieldIndex(JTCS_FROM))
|
|
|
|
)
|
|
|
|
|| // ... oder diese Uebereinstimmung ueber Kreuz besteht
|
2007-11-01 14:29:30 +00:00
|
|
|
( (pMyData->getReferencingTable() == pCompData->getReferencedTable()) &&
|
|
|
|
(pMyData->getReferencedTable() == pCompData->getReferencingTable()) &&
|
2001-02-05 08:26:47 +00:00
|
|
|
(pMyData->GetFieldIndex(JTCS_TO) == pCompData->GetFieldIndex(JTCS_FROM)) &&
|
|
|
|
(pMyData->GetFieldIndex(JTCS_FROM) == pCompData->GetFieldIndex(JTCS_TO))
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2010-10-12 15:59:03 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|