Version 4.0.0.1, tag libreoffice-4.0.0.1
[LibreOffice.git] / dbaccess / source / core / inc / definitioncolumn.hxx
blob44d198cd431ca2acd51ef6c3f702e62d81374693
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 .
19 #ifndef _DBACORE_DEFINITIONCOLUMN_HXX_
20 #define _DBACORE_DEFINITIONCOLUMN_HXX_
22 #include "apitools.hxx"
23 #include "column.hxx"
24 #include "columnsettings.hxx"
26 #include <com/sun/star/sdbc/DataType.hpp>
27 #include <com/sun/star/sdbc/ColumnValue.hpp>
28 #include <com/sun/star/container/XChild.hpp>
30 #include <comphelper/IdPropArrayHelper.hxx>
31 #include <comphelper/uno3.hxx>
32 #include <cppuhelper/implbase1.hxx>
35 namespace dbaccess
38 typedef ::cppu::ImplHelper1< ::com::sun::star::container::XChild > TXChild;
39 // =========================================================================
40 //= OTableColumnDescriptor
41 // =========================================================================
42 /**
43 * provides the properties for description. A descriptor could be used to create a new table column.
45 class OTableColumnDescriptor : public OColumn
46 ,public OColumnSettings
47 ,public ::comphelper::OPropertyArrayUsageHelper < OTableColumnDescriptor >
48 ,public TXChild
50 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xParent;
51 const bool m_bActAsDescriptor;
53 protected:
54 // <properties>
55 rtl::OUString m_aTypeName;
56 rtl::OUString m_aDescription;
57 rtl::OUString m_aDefaultValue;
58 rtl::OUString m_aAutoIncrementValue;
59 sal_Int32 m_nType;
60 sal_Int32 m_nPrecision;
61 sal_Int32 m_nScale;
62 sal_Int32 m_nIsNullable;
63 sal_Bool m_bAutoIncrement;
64 sal_Bool m_bRowVersion;
65 sal_Bool m_bCurrency;
66 // </properties>
68 public:
69 OTableColumnDescriptor( const bool _bActAsDescriptor )
70 :OColumn( !_bActAsDescriptor )
71 ,m_bActAsDescriptor( _bActAsDescriptor )
72 ,m_nType( ::com::sun::star::sdbc::DataType::SQLNULL )
73 ,m_nPrecision( 0 )
74 ,m_nScale( 0 )
75 ,m_nIsNullable( ::com::sun::star::sdbc::ColumnValue::NULLABLE_UNKNOWN )
76 ,m_bAutoIncrement( sal_False )
77 ,m_bRowVersion( sal_False )
78 ,m_bCurrency( sal_False )
80 impl_registerProperties();
83 DECLARE_XINTERFACE( )
85 // com::sun::star::lang::XTypeProvider
86 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
88 // ::com::sun::star::lang::XServiceInfo
89 virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
90 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
92 // ::com::sun::star::container::XChild
93 virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent( ) throw (::com::sun::star::uno::RuntimeException);
94 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);
96 // ::comphelper::OPropertyArrayUsageHelper
97 virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const;
99 // ::cppu::OPropertySetHelper
100 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
101 virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception);
103 private:
104 void impl_registerProperties();
107 // =========================================================================
108 // = OTableColumn
109 // =========================================================================
110 class OTableColumn;
111 typedef ::comphelper::OPropertyArrayUsageHelper < OTableColumn > OTableColumn_PBase;
112 /** describes a column of a table
114 class OTableColumn :public OTableColumnDescriptor
115 ,public OTableColumn_PBase
117 protected:
118 virtual ~OTableColumn();
120 public:
121 OTableColumn(const ::rtl::OUString& _rName);
123 // XTypeProvider
124 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
126 // XServiceInfo
127 virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
129 // OPropertyArrayUsageHelper
130 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
131 virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const;
134 // =========================================================================
135 // = OQueryColumn
136 // =========================================================================
137 class OQueryColumn;
138 typedef ::comphelper::OPropertyArrayUsageHelper< OQueryColumn > OQueryColumn_PBase;
139 /** a column of a Query, with additional information obtained from parsing the query statement
141 class OQueryColumn :public OTableColumnDescriptor
142 ,public OQueryColumn_PBase
144 // <properties>
145 ::rtl::OUString m_sCatalogName;
146 ::rtl::OUString m_sSchemaName;
147 ::rtl::OUString m_sTableName;
148 ::rtl::OUString m_sRealName;
149 ::rtl::OUString m_sLabel;
150 // </properties>
152 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xOriginalTableColumn;
154 protected:
155 ~OQueryColumn();
157 public:
158 OQueryColumn(
159 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxParserColumn,
160 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
161 const ::rtl::OUString &i_sLabel
164 // XTypeProvider
165 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
167 // XServiceInfo
168 virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
170 // *Property*
171 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
172 virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const;
173 virtual void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const;
175 private:
176 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
177 impl_determineOriginalTableColumn(
178 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection
181 using ::cppu::OPropertySetHelper::getFastPropertyValue;
184 // =========================================================================
185 // = OColumnWrapper
186 // =========================================================================
188 * describes all properties for a columns of a table. Only the view parts are provided
189 * directly, all the other parts are derived from a driver implementation
191 class OColumnWrapper :public OColumn
193 protected:
194 // definition which is provided by a driver!
195 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
196 m_xAggregate;
198 sal_Int32 m_nColTypeID;
200 protected:
201 OColumnWrapper( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rCol, const bool _bNameIsReadOnly );
202 virtual ~OColumnWrapper();
204 public:
205 virtual void SAL_CALL getFastPropertyValue(
206 ::com::sun::star::uno::Any& rValue,
207 sal_Int32 nHandle
208 ) const;
209 virtual sal_Bool SAL_CALL convertFastPropertyValue(
210 ::com::sun::star::uno::Any & rConvertedValue,
211 ::com::sun::star::uno::Any & rOldValue,
212 sal_Int32 nHandle,
213 const ::com::sun::star::uno::Any& rValue )
214 throw (::com::sun::star::lang::IllegalArgumentException);
215 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
216 sal_Int32 nHandle,
217 const ::com::sun::star::uno::Any& rValue
219 throw (::com::sun::star::uno::Exception);
221 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
223 protected:
224 ::rtl::OUString impl_getPropertyNameFromHandle( const sal_Int32 _nHandle ) const;
226 protected:
227 using OColumn::getFastPropertyValue;
230 // =========================================================================
231 // = OTableColumnDescriptorWrapper
232 // =========================================================================
234 * provides the properties for description. A descriptor could be used to create a new table column.
236 class OTableColumnDescriptorWrapper :public OColumnWrapper
237 ,public OColumnSettings
238 ,public ::comphelper::OIdPropertyArrayUsageHelper < OTableColumnDescriptorWrapper >
240 const bool m_bPureWrap;
241 const bool m_bIsDescriptor;
243 public:
244 OTableColumnDescriptorWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rCol,
245 const bool _bPureWrap, const bool _bIsDescriptor );
247 // com::sun::star::lang::XTypeProvider
248 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
250 // ::com::sun::star::lang::XServiceInfo
251 virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
252 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
254 // OIdPropertyArrayUsageHelper
255 virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 nId) const;
257 // cppu::OPropertySetHelper
258 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
259 virtual void SAL_CALL getFastPropertyValue(
260 ::com::sun::star::uno::Any& rValue,
261 sal_Int32 nHandle
262 ) const;
263 virtual sal_Bool SAL_CALL convertFastPropertyValue(
264 ::com::sun::star::uno::Any & rConvertedValue,
265 ::com::sun::star::uno::Any & rOldValue,
266 sal_Int32 nHandle,
267 const ::com::sun::star::uno::Any& rValue )
268 throw (::com::sun::star::lang::IllegalArgumentException);
269 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
270 sal_Int32 nHandle,
271 const ::com::sun::star::uno::Any& rValue
273 throw (::com::sun::star::uno::Exception);
275 protected:
276 using OColumnWrapper::getFastPropertyValue;
279 // =========================================================================
280 // = OTableColumnWrapper
281 // =========================================================================
283 * describes all properties for a columns of a table. Only the view parts are provided
284 * directly, all the other parts are derived from a driver implementation
286 class OTableColumnWrapper :public OTableColumnDescriptorWrapper
287 ,public ::comphelper::OIdPropertyArrayUsageHelper < OTableColumnWrapper >
289 protected:
290 ~OTableColumnWrapper();
292 public:
293 OTableColumnWrapper( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rCol,
294 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rColDefintion,
295 const bool _bPureWrap );
297 // ::com::sun::star::lang::XTypeProvider
298 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
300 // ::com::sun::star::lang::XServiceInfo
301 virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
302 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
304 // OIdPropertyArrayUsageHelper
305 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
306 virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 nId) const;
309 #endif // _DBACORE_DEFINITIONCOLUMN_HXX_
311 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */