LibreOffice Module dbaccess (master) 1
RTableConnectionData.hxx
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#pragma once
20
22#include <com/sun/star/beans/XPropertySet.hpp>
23#include "QEnumTypes.hxx"
24
25namespace dbaui
26{
27 enum class Cardinality {
29 };
30
31 class OConnectionLineData;
33 {
35
36 ::osl::Mutex m_aMutex;
37
38 // @see com.sun.star.sdbc.KeyRule
39 sal_Int32 m_nUpdateRules;
40 sal_Int32 m_nDeleteRules;
42
43 bool checkPrimaryKey(const css::uno::Reference< css::beans::XPropertySet>& i_xTable, EConnectionSide _eEConnectionSide) const;
44 bool IsSourcePrimKey() const { return checkPrimaryKey(getReferencingTable()->getTable(),JTCS_FROM); }
45 bool IsDestPrimKey() const { return checkPrimaryKey(getReferencedTable()->getTable(),JTCS_TO); }
46
48 public:
51 ORelationTableConnectionData( const TTableWindowData::value_type& _pReferencingTable,
52 const TTableWindowData::value_type& _pReferencedTable,
53 const OUString& rConnName = OUString() );
54 virtual ~ORelationTableConnectionData() override;
55
56 virtual void CopyFrom(const OTableConnectionData& rSource) override;
57 virtual std::shared_ptr<OTableConnectionData> NewInstance() const override { return std::make_shared<ORelationTableConnectionData>(); }
58
63 virtual bool Update() override;
64
65 void SetCardinality();
66 void SetUpdateRules( sal_Int32 nAttr ){ m_nUpdateRules = nAttr; }
67 void SetDeleteRules( sal_Int32 nAttr ){ m_nDeleteRules = nAttr; }
68
69 sal_Int32 GetUpdateRules() const { return m_nUpdateRules; }
70 sal_Int32 GetDeleteRules() const { return m_nDeleteRules; }
72
74 void ChangeOrientation();
75 void DropRelation();
76 };
77}
78
79/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ORelationTableConnectionData & operator=(const ORelationTableConnectionData &rConnData)
friend bool operator==(const ORelationTableConnectionData &lhs, const ORelationTableConnectionData &rhs)
virtual bool Update() override
Update create a new relation.
virtual std::shared_ptr< OTableConnectionData > NewInstance() const override
deliver a new instance of my own type
bool checkPrimaryKey(const css::uno::Reference< css::beans::XPropertySet > &i_xTable, EConnectionSide _eEConnectionSide) const
virtual void CopyFrom(const OTableConnectionData &rSource) override
initialise from a source (more comfortable than a virtual assignment operator)
Contains all connection data which exists between two windows.
const TTableWindowData::value_type & getReferencingTable() const
const TTableWindowData::value_type & getReferencedTable() const
EConnectionSide
Definition: QEnumTypes.hxx:42
@ JTCS_TO
Definition: QEnumTypes.hxx:44
@ JTCS_FROM
Definition: QEnumTypes.hxx:43