Update ooo320-m1
[ooovba.git] / dbaccess / source / core / inc / definitioncolumn.hxx
blob19515c07ddaaf08ba458dc8b945d0c23026107cb
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: definitioncolumn.hxx,v $
10 * $Revision: 1.7 $
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 ************************************************************************/
30 #ifndef _DBACORE_DEFINITIONCOLUMN_HXX_
31 #define _DBACORE_DEFINITIONCOLUMN_HXX_
33 #ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_
34 #include <com/sun/star/sdbc/DataType.hpp>
35 #endif
36 #ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_
37 #include <com/sun/star/sdbc/ColumnValue.hpp>
38 #endif
39 #ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_
40 #include <com/sun/star/container/XChild.hpp>
41 #endif
42 #ifndef _DBASHARED_APITOOLS_HXX_
43 #include "apitools.hxx"
44 #endif
45 #ifndef _DBA_COREAPI_COLUMN_HXX_
46 #include "column.hxx"
47 #endif
48 #ifndef COMPHELPER_IDPROPERTYARRAYUSAGEHELPER_HXX
49 #include <comphelper/IdPropArrayHelper.hxx>
50 #endif
51 #ifndef _COMPHELPER_UNO3_HXX_
52 #include <comphelper/uno3.hxx>
53 #endif
54 #ifndef _CPPUHELPER_IMPLBASE1_HXX_
55 #include <cppuhelper/implbase1.hxx>
56 #endif
59 namespace dbaccess
62 typedef ::cppu::ImplHelper1< ::com::sun::star::container::XChild > TXChild;
63 /**
64 * provides the properties for description. A descriptor could be used to create a new table column.
66 class OTableColumnDescriptor : public OColumn
67 ,public OColumnSettings
68 ,public ::comphelper::OPropertyArrayUsageHelper < OTableColumnDescriptor >
69 ,public TXChild
71 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xParent;
72 protected:
73 // <properties>
74 rtl::OUString m_aTypeName;
75 rtl::OUString m_aDescription;
76 rtl::OUString m_aDefaultValue;
77 rtl::OUString m_aAutoIncrementValue;
78 sal_Int32 m_nType;
79 sal_Int32 m_nPrecision;
80 sal_Int32 m_nScale;
81 sal_Int32 m_nIsNullable;
82 sal_Bool m_bAutoIncrement : 1;
83 sal_Bool m_bRowVersion : 1;
84 sal_Bool m_bCurrency : 1;
85 // </properties>
86 public:
87 OTableColumnDescriptor():m_nType(::com::sun::star::sdbc::DataType::SQLNULL)
88 ,m_nPrecision(0)
89 ,m_nScale(0)
90 ,m_nIsNullable(::com::sun::star::sdbc::ColumnValue::NULLABLE_UNKNOWN)
91 ,m_bAutoIncrement(sal_False)
92 ,m_bRowVersion(sal_False)
93 ,m_bCurrency(sal_False){}
95 DECLARE_XINTERFACE( )
96 // com::sun::star::lang::XTypeProvider
97 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
99 // ::com::sun::star::lang::XServiceInfo
100 virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
101 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
103 // ::com::sun::star::container::XChild
104 virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent( ) throw (::com::sun::star::uno::RuntimeException);
105 virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
107 // ::comphelper::OPropertyArrayUsageHelper
108 virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const;
110 // ::cppu::OPropertySetHelper
111 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
112 virtual void SAL_CALL getFastPropertyValue(
113 ::com::sun::star::uno::Any& rValue,
114 sal_Int32 nHandle
115 ) const;
116 virtual sal_Bool SAL_CALL convertFastPropertyValue(
117 ::com::sun::star::uno::Any & rConvertedValue,
118 ::com::sun::star::uno::Any & rOldValue,
119 sal_Int32 nHandle,
120 const ::com::sun::star::uno::Any& rValue )
121 throw (::com::sun::star::lang::IllegalArgumentException);
122 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
123 sal_Int32 nHandle,
124 const ::com::sun::star::uno::Any& rValue
126 throw (::com::sun::star::uno::Exception);
128 protected:
129 // XUnoTunnel
130 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
132 protected:
133 using OColumn::getFastPropertyValue;
137 * describes a column of an existing table. The informations for the column are
138 * retrieved in a generic way using the meta data of a connection.
140 class OTableColumn : public OTableColumnDescriptor,
141 public ::comphelper::OPropertyArrayUsageHelper < OTableColumn >
143 friend class ODBTable;
145 protected:
146 virtual ~OTableColumn();
147 public:
148 OTableColumn(const ::rtl::OUString& _rName);
149 OTableColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xColumn);
151 // com::sun::star::lang::XTypeProvider
152 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
154 // ::com::sun::star::lang::XServiceInfo
155 virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
156 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
158 // ::comphelper::OPropertyArrayUsageHelper
159 virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const;
160 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
164 * describes all properties for a columns of a table. Only the view parts are provided
165 * directly, all the other parts are derived from a driver implementation
167 class OColumnWrapper : public OColumn
169 protected:
170 // definition which is provided by a driver!
171 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
172 m_xAggregate;
174 sal_Int32 m_nColTypeID;
176 protected:
177 OColumnWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rCol);
178 virtual ~OColumnWrapper();
180 public:
181 virtual void SAL_CALL getFastPropertyValue(
182 ::com::sun::star::uno::Any& rValue,
183 sal_Int32 nHandle
184 ) const;
185 virtual sal_Bool SAL_CALL convertFastPropertyValue(
186 ::com::sun::star::uno::Any & rConvertedValue,
187 ::com::sun::star::uno::Any & rOldValue,
188 sal_Int32 nHandle,
189 const ::com::sun::star::uno::Any& rValue )
190 throw (::com::sun::star::lang::IllegalArgumentException);
191 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
192 sal_Int32 nHandle,
193 const ::com::sun::star::uno::Any& rValue
195 throw (::com::sun::star::uno::Exception);
197 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
198 // Helper
199 // sal_Int32 getColumnTypeID() const {return m_nColTypeID;}
201 protected:
202 using OColumn::getFastPropertyValue;
206 * provides the properties for description. A descriptor could be used to create a new table column.
208 class OTableColumnDescriptorWrapper : public OColumnWrapper,
209 public OColumnSettings,
210 public ::comphelper::OIdPropertyArrayUsageHelper < OTableColumnDescriptorWrapper >
212 sal_Bool m_bPureWrap;
213 public:
214 OTableColumnDescriptorWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rCol,sal_Bool _bPureWrap = sal_False)
215 :OColumnWrapper(rCol),m_bPureWrap(_bPureWrap){}
217 // com::sun::star::lang::XTypeProvider
218 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
220 // ::com::sun::star::lang::XServiceInfo
221 virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
222 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
224 // OIdPropertyArrayUsageHelper
225 virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 nId) const;
227 // cppu::OPropertySetHelper
228 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
229 virtual void SAL_CALL getFastPropertyValue(
230 ::com::sun::star::uno::Any& rValue,
231 sal_Int32 nHandle
232 ) const;
233 virtual sal_Bool SAL_CALL convertFastPropertyValue(
234 ::com::sun::star::uno::Any & rConvertedValue,
235 ::com::sun::star::uno::Any & rOldValue,
236 sal_Int32 nHandle,
237 const ::com::sun::star::uno::Any& rValue )
238 throw (::com::sun::star::lang::IllegalArgumentException);
239 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
240 sal_Int32 nHandle,
241 const ::com::sun::star::uno::Any& rValue
243 throw (::com::sun::star::uno::Exception);
245 protected:
246 // XUnoTunnel
247 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
249 protected:
250 using OColumnWrapper::getFastPropertyValue;
254 * describes all properties for a columns of a table. Only the view parts are provided
255 * directly, all the other parts are derived from a driver implementation
257 class OTableColumnWrapper : public OTableColumnDescriptorWrapper,
258 public ::comphelper::OIdPropertyArrayUsageHelper < OTableColumnWrapper >
260 protected:
261 ~OTableColumnWrapper();
262 public:
263 OTableColumnWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rCol
264 ,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rColDefintion
265 ,sal_Bool _bPureWrap = sal_False);
267 // ::com::sun::star::lang::XTypeProvider
268 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
270 // ::com::sun::star::lang::XServiceInfo
271 virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
272 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
274 // OIdPropertyArrayUsageHelper
275 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
276 virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 nId) const;
280 * describes all properties for a columns of an index.
282 class OIndexColumnWrapper : public OColumnWrapper,
283 public ::comphelper::OPropertyArrayUsageHelper < OIndexColumnWrapper >
285 protected:
286 // <properties>
287 sal_Bool m_bAscending;
288 // </properties>
290 public:
291 OIndexColumnWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rCol )
292 :OColumnWrapper(rCol) {}
294 // com::sun::star::lang::XTypeProvider
295 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
297 // ::com::sun::star::lang::XServiceInfo
298 virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
299 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
301 // OPropertyArrayUsageHelper
302 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
303 virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const;
305 virtual void SAL_CALL getFastPropertyValue(
306 ::com::sun::star::uno::Any& rValue,
307 sal_Int32 nHandle
308 ) const;
310 protected:
311 using OColumnWrapper::getFastPropertyValue;
315 * describes all properties for a columns of an key column.
317 class OKeyColumnWrapper : public OColumnWrapper,
318 public ::comphelper::OPropertyArrayUsageHelper < OKeyColumnWrapper >
320 protected:
321 // <properties>
322 rtl::OUString m_aRelatedColumn;
323 // </properties>
325 public:
326 OKeyColumnWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rCol)
327 :OColumnWrapper(rCol) {}
329 // com::sun::star::lang::XTypeProvider
330 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
332 // ::com::sun::star::lang::XServiceInfo
333 virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
334 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
336 // OPropertyArrayUsageHelper
337 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
338 virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const;
340 virtual void SAL_CALL getFastPropertyValue(
341 ::com::sun::star::uno::Any& rValue,
342 sal_Int32 nHandle
343 ) const;
345 protected:
346 using OColumnWrapper::getFastPropertyValue;
349 #endif // _DBACORE_DEFINITIONCOLUMN_HXX_