LibreOffice Module dbaccess (master) 1
QTableConnection.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include "QTableConnection.hxx"
21#include <osl/diagnose.h>
22#include <QueryTableView.hxx>
23
24using namespace dbaui;
25
26OQueryTableConnection::OQueryTableConnection(OQueryTableView* pContainer, const TTableConnectionData::value_type& pTabConnData)
27 : OTableConnection(pContainer, pTabConnData)
28 , m_bVisited(false)
29{
30}
31
34 OTableConnection( rConn )
35 , m_bVisited(false)
36{
37 // no own members, so base class functionality is sufficient
38}
39
41{
42 if (&rConn == this)
43 return *this;
44
46 // no own members ...
47 return *this;
48}
49
51{
52 OSL_ENSURE(GetData() && rCompare.GetData(), "OQueryTableConnection::operator== : one of the two participants has no data!");
53
54 // 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.
55 OQueryTableConnectionData* pMyData = static_cast<OQueryTableConnectionData*>(GetData().get());
56 OQueryTableConnectionData* pCompData = static_cast<OQueryTableConnectionData*>(rCompare.GetData().get());
57
58 // Connections are seen as equal, if source and destination window names and source and destination field Indices match...
59 return ( ( (pMyData->getReferencedTable() == pCompData->getReferencedTable()) &&
60 (pMyData->getReferencingTable() == pCompData->getReferencingTable()) &&
61 (pMyData->GetFieldIndex(JTCS_TO) == pCompData->GetFieldIndex(JTCS_TO)) &&
62 (pMyData->GetFieldIndex(JTCS_FROM) == pCompData->GetFieldIndex(JTCS_FROM))
63 )
64 || // ... or this cross matching is given
65 ( (pMyData->getReferencingTable() == pCompData->getReferencedTable()) &&
66 (pMyData->getReferencedTable() == pCompData->getReferencingTable()) &&
67 (pMyData->GetFieldIndex(JTCS_TO) == pCompData->GetFieldIndex(JTCS_FROM)) &&
68 (pMyData->GetFieldIndex(JTCS_FROM) == pCompData->GetFieldIndex(JTCS_TO))
69 )
70 );
71}
72
73/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int32 GetFieldIndex(EConnectionSide nWhich) const
OQueryTableConnection(OQueryTableView *pContainer, const TTableConnectionData::value_type &pTabConnData)
bool operator==(const OQueryTableConnection &rCompare) const
OQueryTableConnection & operator=(const OQueryTableConnection &rConn)
const TTableWindowData::value_type & getReferencingTable() const
const TTableWindowData::value_type & getReferencedTable() const
const TTableConnectionData::value_type & GetData() const
OTableConnection & operator=(const OTableConnection &rConn)
@ JTCS_TO
Definition: QEnumTypes.hxx:44
@ JTCS_FROM
Definition: QEnumTypes.hxx:43