Bump version to 5.0-14
[LibreOffice.git] / dbaccess / source / ui / inc / RTableConnectionData.hxx
blobbf33e90c08c97c90c4762ae3ef181bb4c41801d6
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 #ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_RTABLECONNECTIONDATA_HXX
20 #define INCLUDED_DBACCESS_SOURCE_UI_INC_RTABLECONNECTIONDATA_HXX
22 #include "TableConnectionData.hxx"
23 #include <com/sun/star/beans/XPropertySet.hpp>
24 #include <com/sun/star/container/XNameAccess.hpp>
25 #include "QEnumTypes.hxx"
27 namespace dbaui
29 const sal_uInt16 CARDINAL_UNDEFINED = 0x0000;
30 const sal_uInt16 CARDINAL_ONE_MANY = 0x0001;
31 const sal_uInt16 CARDINAL_MANY_ONE = 0x0002;
32 const sal_uInt16 CARDINAL_ONE_ONE = 0x0004;
34 class OConnectionLineData;
35 class ORelationTableConnectionData : public OTableConnectionData
37 friend bool operator==(const ORelationTableConnectionData& lhs, const ORelationTableConnectionData& rhs);
38 friend bool operator!=(const ORelationTableConnectionData& lhs, const ORelationTableConnectionData& rhs) { return !(lhs == rhs); }
40 ::osl::Mutex m_aMutex;
42 // @see com.sun.star.sdbc.KeyRule
43 sal_Int32 m_nUpdateRules;
44 sal_Int32 m_nDeleteRules;
45 sal_Int32 m_nCardinality;
47 bool checkPrimaryKey(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& i_xTable, EConnectionSide _eEConnectionSide) const;
48 bool IsSourcePrimKey() const { return checkPrimaryKey(getReferencingTable()->getTable(),JTCS_FROM); }
49 bool IsDestPrimKey() const { return checkPrimaryKey(getReferencedTable()->getTable(),JTCS_TO); }
51 protected:
52 virtual OConnectionLineDataRef CreateLineDataObj() SAL_OVERRIDE;
53 virtual OConnectionLineDataRef CreateLineDataObj( const OConnectionLineData& rConnLineData ) SAL_OVERRIDE;
55 ORelationTableConnectionData& operator=( const ORelationTableConnectionData& rConnData );
56 public:
57 ORelationTableConnectionData();
58 ORelationTableConnectionData( const ORelationTableConnectionData& rConnData );
59 ORelationTableConnectionData( const TTableWindowData::value_type& _pReferencingTable,
60 const TTableWindowData::value_type& _pReferencedTable,
61 const OUString& rConnName = OUString() );
62 virtual ~ORelationTableConnectionData();
64 virtual void CopyFrom(const OTableConnectionData& rSource) SAL_OVERRIDE;
65 virtual OTableConnectionData* NewInstance() const SAL_OVERRIDE { return new ORelationTableConnectionData(); }
67 /** Update create a new relation
69 @return true if successful
71 virtual bool Update() SAL_OVERRIDE;
73 void SetCardinality();
74 inline void SetUpdateRules( sal_Int32 nAttr ){ m_nUpdateRules = nAttr; }
75 inline void SetDeleteRules( sal_Int32 nAttr ){ m_nDeleteRules = nAttr; }
77 inline sal_Int32 GetUpdateRules() const { return m_nUpdateRules; }
78 inline sal_Int32 GetDeleteRules() const { return m_nDeleteRules; }
79 inline sal_Int32 GetCardinality() const { return m_nCardinality; }
81 bool IsConnectionPossible();
82 void ChangeOrientation();
83 bool DropRelation();
87 #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_RTABLECONNECTIONDATA_HXX
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */