1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: definitioncolumn.hxx,v $
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>
36 #ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_
37 #include <com/sun/star/sdbc/ColumnValue.hpp>
39 #ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_
40 #include <com/sun/star/container/XChild.hpp>
42 #ifndef _DBASHARED_APITOOLS_HXX_
43 #include "apitools.hxx"
45 #ifndef _DBA_COREAPI_COLUMN_HXX_
48 #ifndef COMPHELPER_IDPROPERTYARRAYUSAGEHELPER_HXX
49 #include <comphelper/IdPropArrayHelper.hxx>
51 #ifndef _COMPHELPER_UNO3_HXX_
52 #include <comphelper/uno3.hxx>
54 #ifndef _CPPUHELPER_IMPLBASE1_HXX_
55 #include <cppuhelper/implbase1.hxx>
62 typedef ::cppu::ImplHelper1
< ::com::sun::star::container::XChild
> TXChild
;
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
>
71 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> m_xParent
;
74 rtl::OUString m_aTypeName
;
75 rtl::OUString m_aDescription
;
76 rtl::OUString m_aDefaultValue
;
77 rtl::OUString m_aAutoIncrementValue
;
79 sal_Int32 m_nPrecision
;
81 sal_Int32 m_nIsNullable
;
82 sal_Bool m_bAutoIncrement
: 1;
83 sal_Bool m_bRowVersion
: 1;
84 sal_Bool m_bCurrency
: 1;
87 OTableColumnDescriptor():m_nType(::com::sun::star::sdbc::DataType::SQLNULL
)
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
){}
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
,
116 virtual sal_Bool SAL_CALL
convertFastPropertyValue(
117 ::com::sun::star::uno::Any
& rConvertedValue
,
118 ::com::sun::star::uno::Any
& rOldValue
,
120 const ::com::sun::star::uno::Any
& rValue
)
121 throw (::com::sun::star::lang::IllegalArgumentException
);
122 virtual void SAL_CALL
setFastPropertyValue_NoBroadcast(
124 const ::com::sun::star::uno::Any
& rValue
126 throw (::com::sun::star::uno::Exception
);
130 virtual sal_Int64 SAL_CALL
getSomething( const ::com::sun::star::uno::Sequence
< sal_Int8
>& aIdentifier
) throw(::com::sun::star::uno::RuntimeException
);
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
;
146 virtual ~OTableColumn();
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
170 // definition which is provided by a driver!
171 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>
174 sal_Int32 m_nColTypeID
;
177 OColumnWrapper(const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& rCol
);
178 virtual ~OColumnWrapper();
181 virtual void SAL_CALL
getFastPropertyValue(
182 ::com::sun::star::uno::Any
& rValue
,
185 virtual sal_Bool SAL_CALL
convertFastPropertyValue(
186 ::com::sun::star::uno::Any
& rConvertedValue
,
187 ::com::sun::star::uno::Any
& rOldValue
,
189 const ::com::sun::star::uno::Any
& rValue
)
190 throw (::com::sun::star::lang::IllegalArgumentException
);
191 virtual void SAL_CALL
setFastPropertyValue_NoBroadcast(
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
);
199 // sal_Int32 getColumnTypeID() const {return m_nColTypeID;}
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
;
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
,
233 virtual sal_Bool SAL_CALL
convertFastPropertyValue(
234 ::com::sun::star::uno::Any
& rConvertedValue
,
235 ::com::sun::star::uno::Any
& rOldValue
,
237 const ::com::sun::star::uno::Any
& rValue
)
238 throw (::com::sun::star::lang::IllegalArgumentException
);
239 virtual void SAL_CALL
setFastPropertyValue_NoBroadcast(
241 const ::com::sun::star::uno::Any
& rValue
243 throw (::com::sun::star::uno::Exception
);
247 virtual sal_Int64 SAL_CALL
getSomething( const ::com::sun::star::uno::Sequence
< sal_Int8
>& aIdentifier
) throw(::com::sun::star::uno::RuntimeException
);
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
>
261 ~OTableColumnWrapper();
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
>
287 sal_Bool m_bAscending
;
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
,
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
>
322 rtl::OUString m_aRelatedColumn
;
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
,
346 using OColumnWrapper::getFastPropertyValue
;
349 #endif // _DBACORE_DEFINITIONCOLUMN_HXX_