Fix GNU C++ version check
[LibreOffice.git] / dbaccess / source / core / inc / definitioncolumn.hxx
blobb4c0a5c081a68cfc623ec229d8f8c43dce64ac1c
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 #pragma once
21 #include "column.hxx"
22 #include "columnsettings.hxx"
24 #include <com/sun/star/sdbc/DataType.hpp>
25 #include <com/sun/star/sdbc/ColumnValue.hpp>
26 #include <com/sun/star/sdbc/XConnection.hpp>
27 #include <com/sun/star/container/XChild.hpp>
29 #include <comphelper/IdPropArrayHelper.hxx>
30 #include <comphelper/proparrhlp.hxx>
31 #include <comphelper/uno3.hxx>
32 #include <cppuhelper/implbase1.hxx>
34 namespace dbaccess
37 typedef ::cppu::ImplHelper1< css::container::XChild > TXChild;
38 // OTableColumnDescriptor
39 /**
40 * provides the properties for description. A descriptor could be used to create a new table column.
42 class OTableColumnDescriptor : public OColumn
43 ,public OColumnSettings
44 ,public ::comphelper::OPropertyArrayUsageHelper < OTableColumnDescriptor >
45 ,public TXChild
47 css::uno::Reference< css::uno::XInterface > m_xParent;
48 const bool m_bActAsDescriptor;
50 protected:
51 // <properties>
52 OUString m_aTypeName;
53 OUString m_aDescription;
54 OUString m_aDefaultValue;
55 OUString m_aAutoIncrementValue;
56 sal_Int32 m_nType;
57 sal_Int32 m_nPrecision;
58 sal_Int32 m_nScale;
59 sal_Int32 m_nIsNullable;
60 bool m_bAutoIncrement;
61 bool m_bRowVersion;
62 bool m_bCurrency;
63 // </properties>
65 public:
66 OTableColumnDescriptor( const bool _bActAsDescriptor )
67 :OColumn( !_bActAsDescriptor )
68 ,m_bActAsDescriptor( _bActAsDescriptor )
69 ,m_nType( css::sdbc::DataType::SQLNULL )
70 ,m_nPrecision( 0 )
71 ,m_nScale( 0 )
72 ,m_nIsNullable( css::sdbc::ColumnValue::NULLABLE_UNKNOWN )
73 ,m_bAutoIncrement( false )
74 ,m_bRowVersion( false )
75 ,m_bCurrency( false )
77 impl_registerProperties();
80 DECLARE_XINTERFACE( )
82 // css::lang::XTypeProvider
83 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
85 // css::lang::XServiceInfo
86 virtual OUString SAL_CALL getImplementationName( ) override;
87 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
89 // css::container::XChild
90 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override;
91 virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override;
93 // ::comphelper::OPropertyArrayUsageHelper
94 virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override;
96 // ::cppu::OPropertySetHelper
97 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
98 virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const css::uno::Any& rValue ) override;
100 private:
101 void impl_registerProperties();
104 // OTableColumn
105 class OTableColumn;
106 typedef ::comphelper::OPropertyArrayUsageHelper < OTableColumn > OTableColumn_PBase;
107 /** describes a column of a table
109 class OTableColumn :public OTableColumnDescriptor
110 ,public OTableColumn_PBase
112 protected:
113 virtual ~OTableColumn() override;
115 public:
116 OTableColumn(const OUString& _rName);
118 // XTypeProvider
119 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
121 // XServiceInfo
122 virtual OUString SAL_CALL getImplementationName( ) override;
124 // OPropertyArrayUsageHelper
125 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
126 virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override;
129 // OQueryColumn
130 class OQueryColumn;
131 typedef ::comphelper::OPropertyArrayUsageHelper< OQueryColumn > OQueryColumn_PBase;
132 /** a column of a Query, with additional information obtained from parsing the query statement
134 class OQueryColumn :public OTableColumnDescriptor
135 ,public OQueryColumn_PBase
137 // <properties>
138 OUString m_sCatalogName;
139 OUString m_sSchemaName;
140 OUString m_sTableName;
141 OUString m_sRealName;
142 OUString m_sLabel;
143 // </properties>
145 css::uno::Reference< css::beans::XPropertySet > m_xOriginalTableColumn;
147 protected:
148 virtual ~OQueryColumn() override;
150 public:
151 OQueryColumn(
152 const css::uno::Reference< css::beans::XPropertySet>& _rxParserColumn,
153 const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
154 OUString i_sLabel
157 // XTypeProvider
158 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
160 // XServiceInfo
161 virtual OUString SAL_CALL getImplementationName( ) override;
163 // *Property*
164 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
165 virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override;
166 virtual void SAL_CALL getFastPropertyValue( css::uno::Any& rValue, sal_Int32 nHandle ) const override;
168 private:
169 css::uno::Reference< css::beans::XPropertySet >
170 impl_determineOriginalTableColumn(
171 const css::uno::Reference< css::sdbc::XConnection >& _rxConnection
174 using ::cppu::OPropertySetHelper::getFastPropertyValue;
177 // OColumnWrapper
179 * describes all properties for a columns of a table. Only the view parts are provided
180 * directly, all the other parts are derived from a driver implementation
182 class OColumnWrapper :public OColumn
184 protected:
185 // definition which is provided by a driver!
186 css::uno::Reference< css::beans::XPropertySet >
187 m_xAggregate;
189 sal_Int32 m_nColTypeID;
191 protected:
192 OColumnWrapper( const css::uno::Reference< css::beans::XPropertySet >& _rCol, const bool _bNameIsReadOnly );
193 virtual ~OColumnWrapper() override;
195 public:
196 virtual void SAL_CALL getFastPropertyValue(
197 css::uno::Any& rValue,
198 sal_Int32 nHandle
199 ) const override;
200 virtual sal_Bool SAL_CALL convertFastPropertyValue(
201 css::uno::Any & rConvertedValue,
202 css::uno::Any & rOldValue,
203 sal_Int32 nHandle,
204 const css::uno::Any& rValue ) override;
205 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
206 sal_Int32 nHandle,
207 const css::uno::Any& rValue
208 ) override;
210 protected:
211 OUString impl_getPropertyNameFromHandle( const sal_Int32 _nHandle ) const;
213 protected:
214 using OColumn::getFastPropertyValue;
217 // OTableColumnDescriptorWrapper
219 * provides the properties for description. A descriptor could be used to create a new table column.
221 class OTableColumnDescriptorWrapper :public OColumnWrapper
222 ,public OColumnSettings
223 ,public ::comphelper::OIdPropertyArrayUsageHelper < OTableColumnDescriptorWrapper >
225 const bool m_bPureWrap;
226 const bool m_bIsDescriptor;
228 public:
229 OTableColumnDescriptorWrapper(const css::uno::Reference< css::beans::XPropertySet >& rCol,
230 const bool _bPureWrap, const bool _bIsDescriptor );
232 // css::lang::XTypeProvider
233 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
235 // css::lang::XServiceInfo
236 virtual OUString SAL_CALL getImplementationName( ) override;
237 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
239 // OIdPropertyArrayUsageHelper
240 virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 nId) const override;
242 // cppu::OPropertySetHelper
243 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
244 virtual void SAL_CALL getFastPropertyValue(
245 css::uno::Any& rValue,
246 sal_Int32 nHandle
247 ) const override;
248 virtual sal_Bool SAL_CALL convertFastPropertyValue(
249 css::uno::Any & rConvertedValue,
250 css::uno::Any & rOldValue,
251 sal_Int32 nHandle,
252 const css::uno::Any& rValue ) override;
253 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
254 sal_Int32 nHandle,
255 const css::uno::Any& rValue
256 ) override;
258 protected:
259 using OColumnWrapper::getFastPropertyValue;
262 // OTableColumnWrapper
264 * describes all properties for a columns of a table. Only the view parts are provided
265 * directly, all the other parts are derived from a driver implementation
267 class OTableColumnWrapper :public OTableColumnDescriptorWrapper
268 ,public ::comphelper::OIdPropertyArrayUsageHelper < OTableColumnWrapper >
270 protected:
271 virtual ~OTableColumnWrapper() override;
273 public:
274 OTableColumnWrapper( const css::uno::Reference< css::beans::XPropertySet >& rCol,
275 const css::uno::Reference< css::beans::XPropertySet >& rColDefinition,
276 const bool _bPureWrap );
278 // css::lang::XTypeProvider
279 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
281 // css::lang::XServiceInfo
282 virtual OUString SAL_CALL getImplementationName( ) override;
283 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
285 // OIdPropertyArrayUsageHelper
286 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
287 virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 nId) const override;
291 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */