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 .
20 #ifndef INCLUDED_CONNECTIVITY_SDBCX_VKEY_HXX
21 #define INCLUDED_CONNECTIVITY_SDBCX_VKEY_HXX
24 #include <comphelper/IdPropArrayHelper.hxx>
25 #include <connectivity/CommonTools.hxx>
26 #include <connectivity/sdbcx/VTypeDef.hxx>
27 #include <connectivity/sdbcx/IRefreshable.hxx>
28 #include <connectivity/sdbcx/VDescriptor.hxx>
29 #include <connectivity/dbtoolsdllapi.hxx>
30 #include <cppuhelper/implbase1.hxx>
31 #include <cppuhelper/basemutex.hxx>
32 #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
35 namespace connectivity
40 struct OOO_DLLPUBLIC_DBTOOLS KeyProperties
42 ::std::vector
< OUString
> m_aKeyColumnNames
;
43 OUString m_ReferencedTable
;
45 sal_Int32 m_UpdateRule
;
46 sal_Int32 m_DeleteRule
;
47 KeyProperties(const OUString
& ReferencedTable
,
51 :m_ReferencedTable(ReferencedTable
),
53 m_UpdateRule(UpdateRule
),
54 m_DeleteRule(DeleteRule
)
56 KeyProperties():m_Type(0),m_UpdateRule(0),m_DeleteRule(0){}
58 typedef ::cppu::ImplHelper1
< css::sdbcx::XDataDescriptorFactory
> OKey_BASE
;
61 class OOO_DLLPUBLIC_DBTOOLS OKey
:
62 public cppu::BaseMutex
,
63 public ODescriptor_BASE
,
64 public IRefreshableColumns
,
65 public ::comphelper::OIdPropertyArrayUsageHelper
<OKey
>,
70 std::shared_ptr
<KeyProperties
> m_aProps
;
71 // no Reference! see OCollection::acquire
72 std::unique_ptr
<OCollection
> m_pColumns
;
74 using ODescriptor_BASE::rBHelper
;
75 // OPropertyArrayUsageHelper
76 virtual ::cppu::IPropertyArrayHelper
* createArrayHelper( sal_Int32 _nId
) const override
;
78 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper() override
;
81 OKey(const OUString
& Name
,const std::shared_ptr
<KeyProperties
>& _rProps
,bool _bCase
);
83 virtual ~OKey( ) override
;
85 DECLARE_SERVICE_INFO();
87 virtual css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& rType
) override
;
88 virtual void SAL_CALL
acquire() throw() override
;
89 virtual void SAL_CALL
release() throw() override
;
91 virtual css::uno::Sequence
< css::uno::Type
> SAL_CALL
getTypes( ) override
;
93 virtual void construct() override
;
95 // ::cppu::OComponentHelper
96 virtual void SAL_CALL
disposing() override
;
98 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) override
;
100 virtual css::uno::Reference
< css::container::XNameAccess
> SAL_CALL
getColumns( ) override
;
103 virtual OUString SAL_CALL
getName( ) override
;
104 virtual void SAL_CALL
setName( const OUString
& aName
) override
;
105 // XDataDescriptorFactory
106 virtual css::uno::Reference
< css::beans::XPropertySet
> SAL_CALL
createDataDescriptor( ) override
;
111 #endif // INCLUDED_CONNECTIVITY_SDBCX_VKEY_HXX
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */