tdf#130857 qt weld: Implement QtInstanceWidget::get_text_height
[LibreOffice.git] / dbaccess / source / ui / inc / RTableConnectionData.hxx
blob0dd40e2fab103a74ddb1427146e1a0af9d8df9b0
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 .
19 #pragma once
21 #include "TableConnectionData.hxx"
22 #include <com/sun/star/beans/XPropertySet.hpp>
23 #include "QEnumTypes.hxx"
25 namespace dbaui
27 enum class Cardinality {
28 Undefined, OneMany, ManyOne, OneOne
31 class OConnectionLineData;
32 class ORelationTableConnectionData final : public OTableConnectionData
34 friend bool operator==(const ORelationTableConnectionData& lhs, const ORelationTableConnectionData& rhs);
36 ::osl::Mutex m_aMutex;
38 // @see com.sun.star.sdbc.KeyRule
39 sal_Int32 m_nUpdateRules;
40 sal_Int32 m_nDeleteRules;
41 Cardinality m_nCardinality;
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); }
47 ORelationTableConnectionData& operator=( const ORelationTableConnectionData& rConnData );
48 public:
49 ORelationTableConnectionData();
50 ORelationTableConnectionData( const ORelationTableConnectionData& rConnData );
51 ORelationTableConnectionData( const TTableWindowData::value_type& _pReferencingTable,
52 const TTableWindowData::value_type& _pReferencedTable,
53 const OUString& rConnName = OUString() );
54 virtual ~ORelationTableConnectionData() override;
56 virtual void CopyFrom(const OTableConnectionData& rSource) override;
57 virtual std::shared_ptr<OTableConnectionData> NewInstance() const override { return std::make_shared<ORelationTableConnectionData>(); }
59 /** Update create a new relation
61 @return true if successful
63 virtual bool Update() override;
65 void SetCardinality();
66 void SetUpdateRules( sal_Int32 nAttr ){ m_nUpdateRules = nAttr; }
67 void SetDeleteRules( sal_Int32 nAttr ){ m_nDeleteRules = nAttr; }
69 sal_Int32 GetUpdateRules() const { return m_nUpdateRules; }
70 sal_Int32 GetDeleteRules() const { return m_nDeleteRules; }
71 Cardinality GetCardinality() const { return m_nCardinality; }
73 void IsConnectionPossible();
74 void ChangeOrientation();
75 void DropRelation();
79 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */