LibreOffice Module dbaccess (master) 1
definitioncolumn.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19#pragma once
20
21#include "column.hxx"
22#include "columnsettings.hxx"
23
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>
28
31#include <comphelper/uno3.hxx>
33
34namespace dbaccess
35{
36
37 typedef ::cppu::ImplHelper1< css::container::XChild > TXChild;
38 // OTableColumnDescriptor
43 ,public OColumnSettings
44 ,public ::comphelper::OPropertyArrayUsageHelper < OTableColumnDescriptor >
45 ,public TXChild
46 {
47 css::uno::Reference< css::uno::XInterface > m_xParent;
49
50 protected:
51 // <properties>
52 OUString m_aTypeName;
56 sal_Int32 m_nType;
57 sal_Int32 m_nPrecision;
58 sal_Int32 m_nScale;
59 sal_Int32 m_nIsNullable;
63 // </properties>
64
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 )
76 {
78 }
79
81
82 // css::lang::XTypeProvider
83 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
84
85 // css::lang::XServiceInfo
86 virtual OUString SAL_CALL getImplementationName( ) override;
87 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
88
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;
92
93 // ::comphelper::OPropertyArrayUsageHelper
94 virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override;
95
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;
99
100 private:
102 };
103
104 // OTableColumn
105 class OTableColumn;
110 ,public OTableColumn_PBase
111 {
112 protected:
113 virtual ~OTableColumn() override;
114
115 public:
116 OTableColumn(const OUString& _rName);
117
118 // XTypeProvider
119 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
120
121 // XServiceInfo
122 virtual OUString SAL_CALL getImplementationName( ) override;
123
124 // OPropertyArrayUsageHelper
125 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
126 virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override;
127 };
128
129 // OQueryColumn
130 class OQueryColumn;
131 typedef ::comphelper::OPropertyArrayUsageHelper< OQueryColumn > OQueryColumn_PBase;
135 ,public OQueryColumn_PBase
136 {
137 // <properties>
140 OUString m_sTableName;
141 OUString m_sRealName;
142 OUString m_sLabel;
143 // </properties>
144
145 css::uno::Reference< css::beans::XPropertySet > m_xOriginalTableColumn;
146
147 protected:
148 virtual ~OQueryColumn() override;
149
150 public:
152 const css::uno::Reference< css::beans::XPropertySet>& _rxParserColumn,
153 const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
154 OUString i_sLabel
155 );
156
157 // XTypeProvider
158 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
159
160 // XServiceInfo
161 virtual OUString SAL_CALL getImplementationName( ) override;
162
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;
167
168 private:
169 css::uno::Reference< css::beans::XPropertySet >
170 impl_determineOriginalTableColumn(
171 const css::uno::Reference< css::sdbc::XConnection >& _rxConnection
172 );
173
174 using ::cppu::OPropertySetHelper::getFastPropertyValue;
175 };
176
177 // OColumnWrapper
183 {
184 protected:
185 // definition which is provided by a driver!
186 css::uno::Reference< css::beans::XPropertySet >
188
189 sal_Int32 m_nColTypeID;
190
191 protected:
192 OColumnWrapper( const css::uno::Reference< css::beans::XPropertySet >& _rCol, const bool _bNameIsReadOnly );
193 virtual ~OColumnWrapper() override;
194
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;
209
210 protected:
211 OUString impl_getPropertyNameFromHandle( const sal_Int32 _nHandle ) const;
212
213 protected:
214 using OColumn::getFastPropertyValue;
215 };
216
217 // OTableColumnDescriptorWrapper
222 ,public OColumnSettings
223 ,public ::comphelper::OIdPropertyArrayUsageHelper < OTableColumnDescriptorWrapper >
224 {
225 const bool m_bPureWrap;
226 const bool m_bIsDescriptor;
227
228 public:
229 OTableColumnDescriptorWrapper(const css::uno::Reference< css::beans::XPropertySet >& rCol,
230 const bool _bPureWrap, const bool _bIsDescriptor );
231
232 // css::lang::XTypeProvider
233 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
234
235 // css::lang::XServiceInfo
236 virtual OUString SAL_CALL getImplementationName( ) override;
237 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
238
239 // OIdPropertyArrayUsageHelper
240 virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 nId) const override;
241
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;
257
258 protected:
260 };
261
262 // OTableColumnWrapper
268 ,public ::comphelper::OIdPropertyArrayUsageHelper < OTableColumnWrapper >
269 {
270 protected:
271 virtual ~OTableColumnWrapper() override;
272
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 );
277
278 // css::lang::XTypeProvider
279 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
280
281 // css::lang::XServiceInfo
282 virtual OUString SAL_CALL getImplementationName( ) override;
283 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
284
285 // OIdPropertyArrayUsageHelper
286 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
287 virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 nId) const override;
288 };
289}
290
291/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
describes all properties for a columns of a table.
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &rValue, sal_Int32 nHandle) const override
css::uno::Reference< css::beans::XPropertySet > m_xAggregate
a column of a Query, with additional information obtained from parsing the query statement
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
css::uno::Reference< css::beans::XPropertySet > m_xOriginalTableColumn
provides the properties for description.
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
provides the properties for description.
OTableColumnDescriptor(const bool _bActAsDescriptor)
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &rValue) override
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
virtual void SAL_CALL setParent(const css::uno::Reference< css::uno::XInterface > &Parent) override
virtual ::cppu::IPropertyArrayHelper * createArrayHelper() const override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual OUString SAL_CALL getImplementationName() override
css::uno::Reference< css::uno::XInterface > m_xParent
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent() override
describes all properties for a columns of a table.
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
describes a column of a table
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
::comphelper::OPropertyArrayUsageHelper< OQueryColumn > OQueryColumn_PBase
::cppu::ImplHelper1< css::container::XChild > TXChild
Definition: column.hxx:122
DataType
unsigned char sal_Bool
signed char sal_Int8
#define DECLARE_XINTERFACE()