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_VTABLE_HXX
21 #define INCLUDED_CONNECTIVITY_SDBCX_VTABLE_HXX
23 #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
24 #include <com/sun/star/sdbcx/XIndexesSupplier.hpp>
25 #include <com/sun/star/sdbcx/XRename.hpp>
26 #include <com/sun/star/sdbcx/XAlterTable.hpp>
27 #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
28 #include <com/sun/star/sdbcx/XKeysSupplier.hpp>
29 #include <com/sun/star/lang/XServiceInfo.hpp>
30 #include <comphelper/IdPropArrayHelper.hxx>
31 #include <cppuhelper/compbase.hxx>
32 #include <cppuhelper/implbase4.hxx>
33 #include <cppuhelper/basemutex.hxx>
34 #include <com/sun/star/container/XNamed.hpp>
35 #include <connectivity/sdbcx/IRefreshable.hxx>
36 #include <connectivity/sdbcx/VDescriptor.hxx>
37 #include <connectivity/CommonTools.hxx>
38 #include <connectivity/dbtoolsdllapi.hxx>
40 namespace com::sun::star::sdbc
{ class XDatabaseMetaData
; }
42 namespace connectivity::sdbcx
48 typedef ::cppu::WeakComponentImplHelper
< css::sdbcx::XColumnsSupplier
,
49 css::sdbcx::XKeysSupplier
,
50 css::container::XNamed
,
51 css::lang::XServiceInfo
> OTableDescriptor_BASE
;
53 typedef ::cppu::ImplHelper4
< css::sdbcx::XDataDescriptorFactory
,
54 css::sdbcx::XIndexesSupplier
,
56 css::sdbcx::XAlterTable
> OTable_BASE
;
58 typedef ::comphelper::OIdPropertyArrayUsageHelper
<OTable
> OTable_PROP
;
61 class OOO_DLLPUBLIC_DBTOOLS OTable
:
62 public cppu::BaseMutex
,
64 public OTableDescriptor_BASE
,
65 public IRefreshableColumns
,
70 OUString m_CatalogName
;
71 OUString m_SchemaName
;
72 OUString m_Description
;
75 // no Reference! see OCollection::acquire
76 std::unique_ptr
<OCollection
> m_xKeys
;
77 std::unique_ptr
<OCollection
> m_xColumns
;
78 std::unique_ptr
<OCollection
> m_xIndexes
;
79 OCollection
* m_pTables
; // must hold his own container to notify him when renaming
81 using OTableDescriptor_BASE::rBHelper
;
83 // OPropertyArrayUsageHelper
84 virtual ::cppu::IPropertyArrayHelper
* createArrayHelper(sal_Int32 _nId
) const override
;
86 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper() override
;
88 OTable( OCollection
* _pTables
,
90 OTable( OCollection
* _pTables
,
94 OUString Description
= OUString(),
95 OUString SchemaName
= OUString(),
96 OUString CatalogName
= OUString());
98 virtual ~OTable() override
;
100 DECLARE_SERVICE_INFO();
102 virtual void SAL_CALL
acquire() noexcept override
;
103 virtual void SAL_CALL
release() noexcept override
;
104 virtual css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& rType
) override
;
106 virtual css::uno::Sequence
< css::uno::Type
> SAL_CALL
getTypes( ) override
;
109 virtual void construct() override
;
110 virtual void refreshColumns() override
;
111 virtual void refreshKeys();
112 virtual void refreshIndexes();
113 // ::cppu::OComponentHelper
114 virtual void SAL_CALL
disposing() override
;
116 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) override
;
118 virtual css::uno::Reference
< css::container::XNameAccess
> SAL_CALL
getColumns( ) override
;
120 virtual css::uno::Reference
< css::container::XIndexAccess
> SAL_CALL
getKeys( ) override
;
122 virtual OUString SAL_CALL
getName() override
;
123 virtual void SAL_CALL
setName( const OUString
& aName
) override
;
124 // XDataDescriptorFactory
125 virtual css::uno::Reference
< css::beans::XPropertySet
> SAL_CALL
createDataDescriptor() override
;
127 virtual css::uno::Reference
< css::container::XNameAccess
> SAL_CALL
getIndexes( ) override
;
129 virtual void SAL_CALL
rename( const OUString
& newName
) override
;
131 virtual void SAL_CALL
alterColumnByName( const OUString
& colName
, const css::uno::Reference
< css::beans::XPropertySet
>& descriptor
) override
;
132 virtual void SAL_CALL
alterColumnByIndex( sal_Int32 index
, const css::uno::Reference
< css::beans::XPropertySet
>& descriptor
) override
;
135 virtual css::uno::Reference
< css::sdbc::XDatabaseMetaData
> getMetaData() const;
140 #endif // INCLUDED_CONNECTIVITY_SDBCX_VTABLE_HXX
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */