Branch libreoffice-5-0-4
[LibreOffice.git] / include / connectivity / sdbcx / VTable.hxx
blob4f1882cfb5393bee46d337a4233543aafd283e16
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 .
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 <comphelper/IdPropArrayHelper.hxx>
30 #include <cppuhelper/compbase4.hxx>
31 #include <cppuhelper/implbase4.hxx>
32 #include <comphelper/broadcasthelper.hxx>
33 #include <com/sun/star/container/XNamed.hpp>
34 #include <connectivity/sdbcx/IRefreshable.hxx>
35 #include <connectivity/sdbcx/VDescriptor.hxx>
36 #include <connectivity/CommonTools.hxx>
37 #include <connectivity/dbtoolsdllapi.hxx>
38 #include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
40 namespace connectivity
42 namespace sdbcx
45 class OTable;
46 class OCollection;
48 typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::sdbcx::XColumnsSupplier,
49 ::com::sun::star::sdbcx::XKeysSupplier,
50 ::com::sun::star::container::XNamed,
51 ::com::sun::star::lang::XServiceInfo> OTableDescriptor_BASE;
53 typedef ::cppu::ImplHelper4< ::com::sun::star::sdbcx::XDataDescriptorFactory,
54 ::com::sun::star::sdbcx::XIndexesSupplier,
55 ::com::sun::star::sdbcx::XRename,
56 ::com::sun::star::sdbcx::XAlterTable > OTable_BASE;
58 typedef ::comphelper::OIdPropertyArrayUsageHelper<OTable> OTable_PROP;
61 class OOO_DLLPUBLIC_DBTOOLS OTable :
62 public comphelper::OBaseMutex,
63 public OTable_BASE,
64 public OTableDescriptor_BASE,
65 public IRefreshableColumns,
66 public OTable_PROP,
67 public ODescriptor
69 protected:
70 OUString m_CatalogName;
71 OUString m_SchemaName;
72 OUString m_Description;
73 OUString m_Type;
75 OCollection* m_pKeys;
76 OCollection* m_pColumns;
77 OCollection* m_pIndexes;
78 OCollection* m_pTables; // must hold his own container to notify him when renaming
80 using OTableDescriptor_BASE::rBHelper;
82 // OPropertyArrayUsageHelper
83 virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 _nId ) const SAL_OVERRIDE;
84 // OPropertySetHelper
85 virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() SAL_OVERRIDE;
86 public:
87 OTable( OCollection* _pTables,
88 bool _bCase);
89 OTable( OCollection* _pTables,
90 bool _bCase,
91 const OUString& _Name,
92 const OUString& _Type,
93 const OUString& _Description = OUString(),
94 const OUString& _SchemaName = OUString(),
95 const OUString& _CatalogName = OUString());
97 virtual ~OTable();
99 DECLARE_SERVICE_INFO();
100 //XInterface
101 virtual void SAL_CALL acquire() throw() SAL_OVERRIDE;
102 virtual void SAL_CALL release() throw() SAL_OVERRIDE;
103 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
104 //XTypeProvider
105 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
107 // ODescriptor
108 virtual void construct() SAL_OVERRIDE;
109 virtual void refreshColumns() SAL_OVERRIDE;
110 virtual void refreshKeys();
111 virtual void refreshIndexes();
112 // ::cppu::OComponentHelper
113 virtual void SAL_CALL disposing() SAL_OVERRIDE;
114 // XPropertySet
115 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
116 // XColumnsSupplier
117 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getColumns( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
118 // XKeysSupplier
119 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL getKeys( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
120 // XNamed
121 virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
122 virtual void SAL_CALL setName( const OUString& aName ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
123 // XDataDescriptorFactory
124 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
125 // XIndexesSupplier
126 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getIndexes( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
127 // XRename
128 virtual void SAL_CALL rename( const OUString& newName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
129 // XAlterTable
130 virtual void SAL_CALL alterColumnByName( const OUString& colName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
131 virtual void SAL_CALL alterColumnByIndex( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
133 // helper method
134 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> getMetaData() const;
139 #endif // INCLUDED_CONNECTIVITY_SDBCX_VTABLE_HXX
141 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */