1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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"
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
);
39 ::osl::Mutex m_aMutex
;
41 // @see com.sun.star.sdbc.KeyRule
42 sal_Int32 m_nUpdateRules
;
43 sal_Int32 m_nDeleteRules
;
44 sal_Int32 m_nCardinality
;
46 bool checkPrimaryKey(const css::uno::Reference
< css::beans::XPropertySet
>& i_xTable
, EConnectionSide _eEConnectionSide
) const;
47 bool IsSourcePrimKey() const { return checkPrimaryKey(getReferencingTable()->getTable(),JTCS_FROM
); }
48 bool IsDestPrimKey() const { return checkPrimaryKey(getReferencedTable()->getTable(),JTCS_TO
); }
51 virtual OConnectionLineDataRef
CreateLineDataObj() override
;
53 ORelationTableConnectionData
& operator=( const ORelationTableConnectionData
& rConnData
);
55 ORelationTableConnectionData();
56 ORelationTableConnectionData( const ORelationTableConnectionData
& rConnData
);
57 ORelationTableConnectionData( const TTableWindowData::value_type
& _pReferencingTable
,
58 const TTableWindowData::value_type
& _pReferencedTable
,
59 const OUString
& rConnName
= OUString() );
60 virtual ~ORelationTableConnectionData();
62 virtual void CopyFrom(const OTableConnectionData
& rSource
) override
;
63 virtual OTableConnectionData
* NewInstance() const override
{ return new ORelationTableConnectionData(); }
65 /** Update create a new relation
67 @return true if successful
69 virtual bool Update() override
;
71 void SetCardinality();
72 inline void SetUpdateRules( sal_Int32 nAttr
){ m_nUpdateRules
= nAttr
; }
73 inline void SetDeleteRules( sal_Int32 nAttr
){ m_nDeleteRules
= nAttr
; }
75 inline sal_Int32
GetUpdateRules() const { return m_nUpdateRules
; }
76 inline sal_Int32
GetDeleteRules() const { return m_nDeleteRules
; }
77 inline sal_Int32
GetCardinality() const { return m_nCardinality
; }
79 bool IsConnectionPossible();
80 void ChangeOrientation();
85 #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_RTABLECONNECTIONDATA_HXX
87 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */