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
50 typedef ::cppu::WeakComponentImplHelper
< css::sdbcx::XColumnsSupplier
,
51 css::sdbcx::XKeysSupplier
,
52 css::container::XNamed
,
53 css::lang::XServiceInfo
> OTableDescriptor_BASE
;
55 typedef ::cppu::ImplHelper4
< css::sdbcx::XDataDescriptorFactory
,
56 css::sdbcx::XIndexesSupplier
,
58 css::sdbcx::XAlterTable
> OTable_BASE
;
60 typedef ::comphelper::OIdPropertyArrayUsageHelper
<OTable
> OTable_PROP
;
63 class OOO_DLLPUBLIC_DBTOOLS OTable
:
64 public cppu::BaseMutex
,
66 public OTableDescriptor_BASE
,
67 public IRefreshableColumns
,
72 OUString m_CatalogName
;
73 OUString m_SchemaName
;
74 OUString m_Description
;
77 rtl::Reference
<OCollection
> m_xKeys
;
78 rtl::Reference
<OCollection
> m_xColumns
;
79 rtl::Reference
<OCollection
> m_xIndexes
;
80 OCollection
* m_pTables
; // must hold his own container to notify him when renaming
82 using OTableDescriptor_BASE::rBHelper
;
84 // OPropertyArrayUsageHelper
85 virtual ::cppu::IPropertyArrayHelper
* createArrayHelper(sal_Int32 _nId
) const override
;
87 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper() override
;
89 OTable( OCollection
* _pTables
,
91 OTable( OCollection
* _pTables
,
95 const OUString
& Description
= OUString(),
96 const OUString
& SchemaName
= OUString(),
97 const OUString
& CatalogName
= OUString());
99 virtual ~OTable() override
;
101 DECLARE_SERVICE_INFO();
103 virtual void SAL_CALL
acquire() throw() override
;
104 virtual void SAL_CALL
release() throw() override
;
105 virtual css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& rType
) override
;
107 virtual css::uno::Sequence
< css::uno::Type
> SAL_CALL
getTypes( ) override
;
110 virtual void construct() override
;
111 virtual void refreshColumns() override
;
112 virtual void refreshKeys();
113 virtual void refreshIndexes();
114 // ::cppu::OComponentHelper
115 virtual void SAL_CALL
disposing() override
;
117 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) override
;
119 virtual css::uno::Reference
< css::container::XNameAccess
> SAL_CALL
getColumns( ) override
;
121 virtual css::uno::Reference
< css::container::XIndexAccess
> SAL_CALL
getKeys( ) override
;
123 virtual OUString SAL_CALL
getName() override
;
124 virtual void SAL_CALL
setName( const OUString
& aName
) override
;
125 // XDataDescriptorFactory
126 virtual css::uno::Reference
< css::beans::XPropertySet
> SAL_CALL
createDataDescriptor() override
;
128 virtual css::uno::Reference
< css::container::XNameAccess
> SAL_CALL
getIndexes( ) override
;
130 virtual void SAL_CALL
rename( const OUString
& newName
) override
;
132 virtual void SAL_CALL
alterColumnByName( const OUString
& colName
, const css::uno::Reference
< css::beans::XPropertySet
>& descriptor
) override
;
133 virtual void SAL_CALL
alterColumnByIndex( sal_Int32 index
, const css::uno::Reference
< css::beans::XPropertySet
>& descriptor
) override
;
136 virtual css::uno::Reference
< css::sdbc::XDatabaseMetaData
> getMetaData() const;
141 #endif // INCLUDED_CONNECTIVITY_SDBCX_VTABLE_HXX
143 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */