Files
libreoffice/dbaccess/source/ui/querydesign/QTableConnection.cxx

100 lines
4.5 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2001-02-05 08:26:47 +00:00
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2001-02-05 08:26:47 +00:00
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
2001-02-05 08:26:47 +00:00
*
* OpenOffice.org - a multi-platform office productivity suite
2001-02-05 08:26:47 +00:00
*
* This file is part of OpenOffice.org.
2001-02-05 08:26:47 +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
*
* 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
*
* 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
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#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"
#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
//------------------------------------------------------------------------
OQueryTableConnection::OQueryTableConnection(OQueryTableView* pContainer, const TTableConnectionData::value_type& pTabConnData)
2001-02-05 08:26:47 +00:00
:OTableConnection(pContainer, pTabConnData)
,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
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 ...
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
( (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))
)
);
}
// -----------------------------------------------------------------------------
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */