bump product version to 4.1.6.2
[LibreOffice.git] / dbaccess / source / ui / querydesign / QTableConnection.cxx
blob849cd9c30482515700d6d6a9e3f86fcf942c83f2
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "QTableConnection.hxx"
21 #include <osl/diagnose.h>
22 #include "QueryTableView.hxx"
23 #include "ConnectionLine.hxx"
24 using namespace dbaui;
25 //========================================================================
26 // class OQueryTableConnection
27 //========================================================================
28 DBG_NAME(OQueryTableConnection)
30 //------------------------------------------------------------------------
31 OQueryTableConnection::OQueryTableConnection(OQueryTableView* pContainer, const TTableConnectionData::value_type& pTabConnData)
32 :OTableConnection(pContainer, pTabConnData)
33 ,m_bVisited(sal_False)
35 DBG_CTOR(OQueryTableConnection,NULL);
38 //------------------------------------------------------------------------
39 OQueryTableConnection::OQueryTableConnection(const OQueryTableConnection& rConn)
40 :OTableConnection( rConn )
42 DBG_CTOR(OQueryTableConnection,NULL);
43 // no own members, so base class functionality is sufficient
45 //------------------------------------------------------------------------
46 OQueryTableConnection::~OQueryTableConnection()
48 DBG_DTOR(OQueryTableConnection,NULL);
51 //------------------------------------------------------------------------
52 OQueryTableConnection& OQueryTableConnection::operator=(const OQueryTableConnection& rConn)
54 if (&rConn == this)
55 return *this;
57 OTableConnection::operator=(rConn);
58 // no own members ...
59 return *this;
62 //------------------------------------------------------------------------
63 sal_Bool OQueryTableConnection::operator==(const OQueryTableConnection& rCompare)
65 OSL_ENSURE(GetData() && rCompare.GetData(), "OQueryTableConnection::operator== : one of the two participants has no data!");
67 // I don't have to compare all too much (especially not all the members) : merely the windows, which we are connected to, and the indices in the corresponding table have to match.
68 OQueryTableConnectionData* pMyData = static_cast<OQueryTableConnectionData*>(GetData().get());
69 OQueryTableConnectionData* pCompData = static_cast<OQueryTableConnectionData*>(rCompare.GetData().get());
71 // Connections are seen as equal, if source and destination window names and source and destination field Indices match...
72 return ( ( (pMyData->getReferencedTable() == pCompData->getReferencedTable()) &&
73 (pMyData->getReferencingTable() == pCompData->getReferencingTable()) &&
74 (pMyData->GetFieldIndex(JTCS_TO) == pCompData->GetFieldIndex(JTCS_TO)) &&
75 (pMyData->GetFieldIndex(JTCS_FROM) == pCompData->GetFieldIndex(JTCS_FROM))
77 || // ... or this cross matching is given
78 ( (pMyData->getReferencingTable() == pCompData->getReferencedTable()) &&
79 (pMyData->getReferencedTable() == pCompData->getReferencingTable()) &&
80 (pMyData->GetFieldIndex(JTCS_TO) == pCompData->GetFieldIndex(JTCS_FROM)) &&
81 (pMyData->GetFieldIndex(JTCS_FROM) == pCompData->GetFieldIndex(JTCS_TO))
85 // -----------------------------------------------------------------------------
87 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */