merge the formfield patch from ooo-build
[ooovba.git] / dbaccess / source / core / inc / TableDeco.hxx
blob7231157bb1886ea4d489d8f9e9b9541a48e8c418
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: TableDeco.hxx,v $
10 * $Revision: 1.21 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _DBA_CORE_TABLEDECORATOR_HXX_
32 #define _DBA_CORE_TABLEDECORATOR_HXX_
34 #ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATSSUPPLIER_HPP_
35 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
36 #endif
37 #ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_
38 #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
39 #endif
40 #ifndef _COM_SUN_STAR_SDBCX_XDATADESCRIPTORFACTORY_HPP_
41 #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
42 #endif
43 #ifndef _COM_SUN_STAR_SDBCX_XINDEXESSUPPLIER_HPP_
44 #include <com/sun/star/sdbcx/XIndexesSupplier.hpp>
45 #endif
46 #ifndef _COM_SUN_STAR_SDBCX_XKEYSSUPPLIER_HPP_
47 #include <com/sun/star/sdbcx/XKeysSupplier.hpp>
48 #endif
49 #ifndef _COM_SUN_STAR_SDBCX_XRENAME_HPP_
50 #include <com/sun/star/sdbcx/XRename.hpp>
51 #endif
52 #ifndef _COM_SUN_STAR_SDBCX_XALTERTABLE_HPP_
53 #include <com/sun/star/sdbcx/XAlterTable.hpp>
54 #endif
55 #ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
56 #include <com/sun/star/lang/XServiceInfo.hpp>
57 #endif
58 #ifndef _COM_SUN_STAR_SDBC_XROW_HPP_
59 #include <com/sun/star/sdbc/XRow.hpp>
60 #endif
61 #ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
62 #include <com/sun/star/sdbc/XConnection.hpp>
63 #endif
64 #ifndef _CPPUHELPER_COMPBASE9_HXX_
65 #include <cppuhelper/compbase9.hxx>
66 #endif
67 #ifndef _CPPUHELPER_IMPLBASE5_HXX_
68 #include <cppuhelper/implbase5.hxx>
69 #endif
70 #ifndef _DBASHARED_APITOOLS_HXX_
71 #include "apitools.hxx"
72 #endif
73 #ifndef _DBA_CORE_DATASETTINGS_HXX_
74 #include "datasettings.hxx"
75 #endif
76 #ifndef _DBA_COREAPI_COLUMN_HXX_
77 #include "column.hxx"
78 #endif
80 #ifndef _CONNECTIVITY_COMMONTOOLS_HXX_
81 #include <connectivity/CommonTools.hxx>
82 #endif
83 #ifndef _CONNECTIVITY_SDBCX_IREFRESHABLE_HXX_
84 #include <connectivity/sdbcx/IRefreshable.hxx>
85 #endif
86 #ifndef COMPHELPER_IDPROPERTYARRAYUSAGEHELPER_HXX
87 #include <comphelper/IdPropArrayHelper.hxx>
88 #endif
90 namespace dbaccess
92 typedef ::cppu::WeakComponentImplHelper9< ::com::sun::star::sdbcx::XColumnsSupplier,
93 ::com::sun::star::sdbcx::XKeysSupplier,
94 ::com::sun::star::container::XNamed,
95 ::com::sun::star::lang::XServiceInfo,
96 ::com::sun::star::sdbcx::XDataDescriptorFactory,
97 ::com::sun::star::sdbcx::XIndexesSupplier,
98 ::com::sun::star::sdbcx::XRename,
99 ::com::sun::star::lang::XUnoTunnel,
100 ::com::sun::star::sdbcx::XAlterTable> OTableDescriptor_BASE;
101 //==========================================================================
102 //= OTables
103 //==========================================================================
104 class ODBTableDecorator;
105 typedef ::comphelper::OIdPropertyArrayUsageHelper< ODBTableDecorator > ODBTableDecorator_PROP;
107 class ODBTableDecorator :public comphelper::OBaseMutex
108 ,public OTableDescriptor_BASE
109 ,public ODataSettings //ODataSettings_Base
110 ,public IColumnFactory
111 ,public ::connectivity::sdbcx::IRefreshableColumns
112 ,public ODBTableDecorator_PROP
114 void fillPrivileges() const;
115 protected:
116 ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener > m_xColumnMediator;
117 ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier > m_xTable;
118 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xColumnDefinitions;
119 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xConnection;
120 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData;
121 ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > m_xNumberFormats;
123 // <properties>
124 mutable sal_Int32 m_nPrivileges;
125 // </properties>
126 ::connectivity::sdbcx::OCollection* m_pColumns;
127 ::connectivity::sdbcx::OCollection* m_pTables;
129 // IColumnFactory
130 virtual OColumn* createColumn(const ::rtl::OUString& _rName) const;
131 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createColumnDescriptor();
132 virtual void columnAppended( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxSourceDescriptor );
133 virtual void columnDropped(const ::rtl::OUString& _sName);
135 virtual void refreshColumns();
137 virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 _nId) const;
138 virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
140 // OPropertySetHelper
141 virtual sal_Bool SAL_CALL convertFastPropertyValue(
142 ::com::sun::star::uno::Any & rConvertedValue,
143 ::com::sun::star::uno::Any & rOldValue,
144 sal_Int32 nHandle,
145 const ::com::sun::star::uno::Any& rValue )
146 throw (::com::sun::star::lang::IllegalArgumentException);
147 virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle) const;
148 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
149 sal_Int32 nHandle,
150 const ::com::sun::star::uno::Any& rValue
153 throw (::com::sun::star::uno::Exception);
155 virtual ~ODBTableDecorator();
156 public:
157 /** constructs a wrapper supporting the com.sun.star.sdb.Table service.
159 @param _rxConn
160 the connection the table belongs to. Must not be <NULL/>
161 @param _rxTable
162 the table from the driver can be <NULL/>
164 ODBTableDecorator(
165 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConn,
166 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier >& _rxTable,
167 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& _rxNumberFormats,
168 const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxColumnDefinitions
169 ) throw(::com::sun::star::sdbc::SQLException);
173 // ODescriptor
174 virtual void construct();
176 //XInterface
177 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
178 virtual void SAL_CALL acquire() throw();
179 virtual void SAL_CALL release() throw();
180 //XTypeProvider
181 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
182 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
184 // OComponentHelper
185 virtual void SAL_CALL disposing(void);
187 // ::com::sun::star::lang::XServiceInfo
188 DECLARE_SERVICE_INFO();
189 // XPropertySet
190 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
191 // ::com::sun::star::sdbcx::XRename,
192 virtual void SAL_CALL rename( const ::rtl::OUString& _rNewName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException);
194 // ::com::sun::star::sdbcx::XAlterTable,
195 virtual void SAL_CALL alterColumnByName( const ::rtl::OUString& _rName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxDescriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
196 virtual void SAL_CALL alterColumnByIndex( sal_Int32 _nIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxDescriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
198 // XNamed
199 virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
200 virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException);
201 // com::sun::star::lang::XUnoTunnel
202 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
203 static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
205 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> getMetaData() const { return m_xMetaData; }
206 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection() const { return m_xMetaData.is() ? m_xMetaData->getConnection() : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>(); }
208 // XColumnsSupplier
209 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getColumns( ) throw (::com::sun::star::uno::RuntimeException);
210 // XKeysSupplier
211 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL getKeys( ) throw (::com::sun::star::uno::RuntimeException);
212 // XIndexesSupplier
213 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getIndexes( ) throw (::com::sun::star::uno::RuntimeException);
214 // XDataDescriptorFactory
215 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) throw (::com::sun::star::uno::RuntimeException);
217 protected:
218 using ODataSettings::getFastPropertyValue;
221 #endif // _DBA_CORE_TABLEDECORATOR_HXX_