update dev300-m58
[ooovba.git] / dbaccess / source / core / api / CRowSetColumn.cxx
blobbfa770cf2c866134435276bae04247aef4d52d89
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: CRowSetColumn.cxx,v $
10 * $Revision: 1.16 $
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 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_dbaccess.hxx"
34 #ifndef DBACCESS_SHARED_DBASTRINGS_HRC
35 #include "dbastrings.hrc"
36 #endif
37 #ifndef _DBASHARED_APITOOLS_HXX_
38 #include "apitools.hxx"
39 #endif
40 #ifndef _COMPHELPER_TYPES_HXX_
41 #include <comphelper/types.hxx>
42 #endif
43 #ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
44 #include <cppuhelper/typeprovider.hxx>
45 #endif
46 #ifndef DBACCESS_CORE_API_CROWSETCOLUMN_HXX
47 #include "CRowSetColumn.hxx"
48 #endif
49 #ifndef _COM_SUN_STAR_SDB_XCOLUMN_HPP_
50 #include <com/sun/star/sdb/XColumn.hpp>
51 #endif
52 #ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
53 #include <com/sun/star/beans/PropertyAttribute.hpp>
54 #endif
57 using namespace dbaccess;
58 // using namespace connectivity;
59 using namespace ::com::sun::star::uno;
60 using namespace ::com::sun::star::beans;
61 // using namespace ::com::sun::star::sdbcx;
62 using namespace ::com::sun::star::sdbc;
63 using namespace ::com::sun::star::sdb;
64 using namespace ::com::sun::star::container;
65 using namespace ::com::sun::star::lang;
66 // using namespace ::com::sun::star::util;
67 using namespace cppu;
68 using namespace osl;
71 // -------------------------------------------------------------------------
72 //ORowSetColumn::ORowSetColumn( const Reference < XResultSetMetaData >& _xMetaData,
73 // const ::com::sun::star::uno::Reference < ::com::sun::star::sdbc::XRow >& _xRow,
74 // sal_Int32 _nPos,
75 // ORowSetMatrix::iterator& _rColumnValue,
76 // ORowSetMatrix::iterator& _rEnd)
77 // : ORowSetDataColumn(_xMetaData,_xRow,NULL,_nPos,_rColumnValue,_rEnd)
78 //{
80 //}
81 //------------------------------------------------------------------------------
82 Any SAL_CALL ORowSetColumn::queryInterface( const Type & _rType ) throw (RuntimeException)
84 Any aReturn = OResultColumn::queryInterface(_rType);
85 if (!aReturn.hasValue())
86 aReturn = ::cppu::queryInterface(_rType,static_cast< XColumn* >(this));
87 return aReturn;
89 // -------------------------------------------------------------------------
90 // comphelper::OPropertyArrayUsageHelper
91 //------------------------------------------------------------------------------
92 ::cppu::IPropertyArrayHelper* ORowSetColumn::createArrayHelper( ) const
94 BEGIN_PROPERTY_HELPER(30)
95 DECL_PROP2(ALIGN, sal_Int32, BOUND,MAYBEVOID);
96 DECL_PROP1(CATALOGNAME, ::rtl::OUString, READONLY);
97 DECL_PROP2(CONTROLDEFAULT, ::rtl::OUString, BOUND,MAYBEVOID);
98 DECL_PROP1_IFACE(CONTROLMODEL, XPropertySet, BOUND );
99 DECL_PROP1(DISPLAYSIZE, sal_Int32, READONLY);
100 DECL_PROP2(NUMBERFORMAT, sal_Int32, BOUND,MAYBEVOID);
101 DECL_PROP2(HELPTEXT, ::rtl::OUString, BOUND,MAYBEVOID);
102 DECL_PROP1_BOOL(HIDDEN, BOUND);
103 DECL_PROP1_BOOL(ISAUTOINCREMENT, READONLY);
104 DECL_PROP1_BOOL(ISCASESENSITIVE, READONLY);
105 DECL_PROP1_BOOL(ISCURRENCY, READONLY);
106 DECL_PROP1_BOOL(ISDEFINITELYWRITABLE, READONLY);
107 DECL_PROP1(ISNULLABLE, sal_Int32, READONLY);
108 DECL_PROP1_BOOL(ISREADONLY, READONLY);
109 DECL_PROP1_BOOL(ISROWVERSION, READONLY);
110 DECL_PROP1_BOOL(ISSEARCHABLE, READONLY);
111 DECL_PROP1_BOOL(ISSIGNED, READONLY);
112 DECL_PROP1_BOOL(ISWRITABLE, READONLY);
113 DECL_PROP1(LABEL, ::rtl::OUString, READONLY);
114 DECL_PROP1(NAME, ::rtl::OUString, READONLY);
115 DECL_PROP1(PRECISION, sal_Int32, READONLY);
116 DECL_PROP2(RELATIVEPOSITION, sal_Int32, BOUND, MAYBEVOID);
117 DECL_PROP1(SCALE, sal_Int32, READONLY);
118 DECL_PROP1(SCHEMANAME, ::rtl::OUString, READONLY);
119 DECL_PROP1(SERVICENAME, ::rtl::OUString, READONLY);
120 DECL_PROP1(TABLENAME, ::rtl::OUString, READONLY);
121 DECL_PROP1(TYPE, sal_Int32, READONLY);
122 DECL_PROP1(TYPENAME, ::rtl::OUString, READONLY);
123 DECL_PROP2(VALUE, Any, READONLY,BOUND);
124 DECL_PROP1(WIDTH, sal_Int32, MAYBEVOID);
125 END_PROPERTY_HELPER();
128 // cppu::OPropertySetHelper
129 //------------------------------------------------------------------------------
130 ::cppu::IPropertyArrayHelper& ORowSetColumn::getInfoHelper()
132 return *static_cast< ::comphelper::OPropertyArrayUsageHelper< ORowSetColumn >* >(this)->getArrayHelper();
134 // -------------------------------------------------------------------------
135 void SAL_CALL ORowSetColumn::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
137 switch(nHandle)
139 case PROPERTY_ID_ALIGN:
140 case PROPERTY_ID_NUMBERFORMAT:
141 case PROPERTY_ID_RELATIVEPOSITION:
142 case PROPERTY_ID_WIDTH:
143 case PROPERTY_ID_HIDDEN:
144 case PROPERTY_ID_CONTROLMODEL:
145 case PROPERTY_ID_HELPTEXT:
146 case PROPERTY_ID_CONTROLDEFAULT:
147 OColumnSettings::getFastPropertyValue( rValue, nHandle );
148 break;
149 case PROPERTY_ID_VALUE:
150 if ( !m_aColumnValue.isNull() && (*m_aColumnValue).isValid() )
151 rValue = ((*m_aColumnValue)->get())[m_nPos].makeAny();
152 break;
153 default:
154 ORowSetDataColumn::getFastPropertyValue(rValue,nHandle);
157 // -------------------------------------------------------------------------
158 void SAL_CALL ORowSetColumn::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue )throw (Exception)
160 switch(nHandle)
162 case PROPERTY_ID_ALIGN:
163 case PROPERTY_ID_NUMBERFORMAT:
164 case PROPERTY_ID_RELATIVEPOSITION:
165 case PROPERTY_ID_WIDTH:
166 case PROPERTY_ID_HIDDEN:
167 case PROPERTY_ID_CONTROLMODEL:
168 case PROPERTY_ID_HELPTEXT:
169 case PROPERTY_ID_CONTROLDEFAULT:
170 OColumnSettings::setFastPropertyValue_NoBroadcast( nHandle, rValue );
171 break;
172 case PROPERTY_ID_VALUE:
173 break;
174 default:
175 ORowSetDataColumn::setFastPropertyValue_NoBroadcast(nHandle,rValue );
178 // -------------------------------------------------------------------------
179 sal_Bool SAL_CALL ORowSetColumn::convertFastPropertyValue( Any & rConvertedValue,
180 Any & rOldValue,
181 sal_Int32 nHandle,
182 const Any& rValue ) throw (IllegalArgumentException)
184 sal_Bool bModified = sal_False;
185 switch(nHandle)
187 case PROPERTY_ID_ALIGN:
188 case PROPERTY_ID_NUMBERFORMAT:
189 case PROPERTY_ID_RELATIVEPOSITION:
190 case PROPERTY_ID_WIDTH:
191 case PROPERTY_ID_HIDDEN:
192 case PROPERTY_ID_CONTROLMODEL:
193 case PROPERTY_ID_HELPTEXT:
194 case PROPERTY_ID_CONTROLDEFAULT:
195 bModified = OColumnSettings::convertFastPropertyValue( rConvertedValue, rOldValue, nHandle, rValue );
196 break;
197 case PROPERTY_ID_VALUE:
198 rConvertedValue = rValue;
199 getFastPropertyValue(rOldValue, PROPERTY_ID_VALUE);
200 bModified = !::comphelper::compare(rConvertedValue, rOldValue);
201 break;
202 default:
203 bModified = ORowSetDataColumn::convertFastPropertyValue(rConvertedValue, rOldValue, nHandle, rValue);
207 return bModified;
209 // com::sun::star::lang::XTypeProvider
210 //--------------------------------------------------------------------------
211 Sequence< Type > ORowSetColumn::getTypes() throw (RuntimeException)
213 OTypeCollection aTypes(::getCppuType( (const Reference< XColumn > *)0 ),OColumn::getTypes());
214 return aTypes.getTypes();
216 //--------------------------------------------------------------------------