1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: QTableConnection.cxx,v $
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_QUERYTABLECONNECTION_HXX
34 #include "QTableConnection.hxx"
36 #ifndef _TOOLS_DEBUG_HXX
37 #include <tools/debug.hxx>
39 #ifndef DBAUI_QUERYTABLEVIEW_HXX
40 #include "QueryTableView.hxx"
42 #ifndef DBAUI_CONNECTIONLINE_HXX
43 #include "ConnectionLine.hxx"
45 using namespace dbaui
;
46 //========================================================================
47 // class OQueryTableConnection
48 //========================================================================
49 DBG_NAME(OQueryTableConnection
)
51 //------------------------------------------------------------------------
52 OQueryTableConnection::OQueryTableConnection(OQueryTableView
* pContainer
, const TTableConnectionData::value_type
& pTabConnData
)
53 :OTableConnection(pContainer
, pTabConnData
)
54 ,m_bVisited(sal_False
)
56 DBG_CTOR(OQueryTableConnection
,NULL
);
60 //------------------------------------------------------------------------
61 OQueryTableConnection::OQueryTableConnection(const OQueryTableConnection
& rConn
)
62 :OTableConnection( rConn
)
64 DBG_CTOR(OQueryTableConnection
,NULL
);
65 // keine eigenen Members, also reicht die Basisklassenfunktionalitaet
67 //------------------------------------------------------------------------
68 OQueryTableConnection::~OQueryTableConnection()
70 DBG_DTOR(OQueryTableConnection
,NULL
);
73 //------------------------------------------------------------------------
74 OQueryTableConnection
& OQueryTableConnection::operator=(const OQueryTableConnection
& rConn
)
79 OTableConnection::operator=(rConn
);
80 // keine eigenen Members ...
84 //------------------------------------------------------------------------
85 sal_Bool
OQueryTableConnection::operator==(const OQueryTableConnection
& rCompare
)
87 DBG_ASSERT(GetData() && rCompare
.GetData(), "OQueryTableConnection::operator== : einer der beiden Teilnehmer hat keine Daten !");
89 // allzuviel brauche ich nicht vergleichen (schon gar nicht alle Member) : lediglich die Fenster, an denen wir haengen, und
90 // die Indizies in der entsprechenden Tabelle muessen uebereinstimmen
91 OQueryTableConnectionData
* pMyData
= static_cast<OQueryTableConnectionData
*>(GetData().get());
92 OQueryTableConnectionData
* pCompData
= static_cast<OQueryTableConnectionData
*>(rCompare
.GetData().get());
94 // Connections werden als gleich angesehen, wenn sie in Source-/Dest-Fenstername und Source-/Dest-FieldIndex uebereinstimmen ...
95 return ( ( (pMyData
->getReferencedTable() == pCompData
->getReferencedTable()) &&
96 (pMyData
->getReferencingTable() == pCompData
->getReferencingTable()) &&
97 (pMyData
->GetFieldIndex(JTCS_TO
) == pCompData
->GetFieldIndex(JTCS_TO
)) &&
98 (pMyData
->GetFieldIndex(JTCS_FROM
) == pCompData
->GetFieldIndex(JTCS_FROM
))
100 || // ... oder diese Uebereinstimmung ueber Kreuz besteht
101 ( (pMyData
->getReferencingTable() == pCompData
->getReferencedTable()) &&
102 (pMyData
->getReferencedTable() == pCompData
->getReferencingTable()) &&
103 (pMyData
->GetFieldIndex(JTCS_TO
) == pCompData
->GetFieldIndex(JTCS_FROM
)) &&
104 (pMyData
->GetFieldIndex(JTCS_FROM
) == pCompData
->GetFieldIndex(JTCS_TO
))
108 // -----------------------------------------------------------------------------