xref: /aoo41x/main/svx/source/inc/sdbdatacolumn.hxx (revision 3334a7e6)
1*3334a7e6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*3334a7e6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*3334a7e6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*3334a7e6SAndrew Rist  * distributed with this work for additional information
6*3334a7e6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*3334a7e6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*3334a7e6SAndrew Rist  * "License"); you may not use this file except in compliance
9*3334a7e6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*3334a7e6SAndrew Rist  *
11*3334a7e6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*3334a7e6SAndrew Rist  *
13*3334a7e6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*3334a7e6SAndrew Rist  * software distributed under the License is distributed on an
15*3334a7e6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*3334a7e6SAndrew Rist  * KIND, either express or implied.  See the License for the
17*3334a7e6SAndrew Rist  * specific language governing permissions and limitations
18*3334a7e6SAndrew Rist  * under the License.
19*3334a7e6SAndrew Rist  *
20*3334a7e6SAndrew Rist  *************************************************************/
21*3334a7e6SAndrew Rist 
22*3334a7e6SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef SVX_FORM_SDBDATACOLUMN_HXX
25cdf0e10cSrcweir #define SVX_FORM_SDBDATACOLUMN_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
28cdf0e10cSrcweir #include <com/sun/star/sdb/XColumn.hpp>
29cdf0e10cSrcweir #include <com/sun/star/sdb/XColumnUpdate.hpp>
30cdf0e10cSrcweir #include <osl/diagnose.h>
31cdf0e10cSrcweir 
32cdf0e10cSrcweir //..............................................................................
33cdf0e10cSrcweir namespace svxform
34cdf0e10cSrcweir {
35cdf0e10cSrcweir //..............................................................................
36cdf0e10cSrcweir 
37cdf0e10cSrcweir 	//==========================================================================
38cdf0e10cSrcweir 	//= DataColumn - a class wrapping an object implementing a sdb::DataColumn service
39cdf0e10cSrcweir 	//==========================================================================
40cdf0e10cSrcweir 	class DataColumn
41cdf0e10cSrcweir 	{
42cdf0e10cSrcweir 		// interfaces needed for sddb::Column
43cdf0e10cSrcweir 		::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>	m_xPropertySet;
44cdf0e10cSrcweir 		// interfaces needed for sdb::DataColumn
45cdf0e10cSrcweir 		::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn>			m_xColumn;
46cdf0e10cSrcweir 		::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumnUpdate> 	m_xColumnUpdate;
47cdf0e10cSrcweir 
48cdf0e10cSrcweir 	public:
DataColumn()49cdf0e10cSrcweir 		DataColumn() { };
50cdf0e10cSrcweir 		DataColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxIFace);
51cdf0e10cSrcweir 		// if the object behind _rxIFace doesn't fully support the DataColumn service,
52cdf0e10cSrcweir 		// (which is checked via the supported interfaces) _all_ members will be set to
53cdf0e10cSrcweir 		// void !, even if the object has some of the needed interfaces.
54cdf0e10cSrcweir 
is() const55cdf0e10cSrcweir 		sal_Bool is() const { return m_xColumn.is(); }
Is() const56cdf0e10cSrcweir 		sal_Bool Is() const { return m_xColumn.is(); }
supportsUpdate() const57cdf0e10cSrcweir 		sal_Bool supportsUpdate() const { return m_xColumnUpdate.is(); }
58cdf0e10cSrcweir 
operator ->()59cdf0e10cSrcweir 		DataColumn* operator ->() { return this; }
operator ::com::sun::star::uno::Reference<::com::sun::star::uno::XInterface>() const60cdf0e10cSrcweir 		operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> () const{ return m_xColumn.get(); }
61cdf0e10cSrcweir 
62cdf0e10cSrcweir 		// 'conversions'
getPropertySet() const63cdf0e10cSrcweir 		inline const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& getPropertySet() const
64cdf0e10cSrcweir 		{
65cdf0e10cSrcweir 			return m_xPropertySet;
66cdf0e10cSrcweir 		}
getColumn() const67cdf0e10cSrcweir 		inline const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn>& getColumn() const
68cdf0e10cSrcweir 		{
69cdf0e10cSrcweir 			return m_xColumn;
70cdf0e10cSrcweir 		}
getColumnUpdate() const71cdf0e10cSrcweir 		inline const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumnUpdate>& getColumnUpdate() const
72cdf0e10cSrcweir 		{
73cdf0e10cSrcweir 			OSL_ENSURE(m_xColumnUpdate.is() , "DataColumn::getColumnUpdate: NULL!");
74cdf0e10cSrcweir 			return m_xColumnUpdate;
75cdf0e10cSrcweir 		}
76cdf0e10cSrcweir 
77cdf0e10cSrcweir 		// das normale queryInterface
queryInterface(const::com::sun::star::uno::Type & type)78cdf0e10cSrcweir 		::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& type) throw ( ::com::sun::star::uno::RuntimeException )
79cdf0e10cSrcweir 		{ return m_xColumn->queryInterface(type); }
80cdf0e10cSrcweir 
81cdf0e10cSrcweir 		// ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>
82cdf0e10cSrcweir 		inline ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> getPropertySetInfo() const throw( ::com::sun::star::uno::RuntimeException );
83cdf0e10cSrcweir 		inline void setPropertyValue(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue) throw( ::com::sun::star::beans::UnknownPropertyException,	::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
84cdf0e10cSrcweir 		inline ::com::sun::star::uno::Any getPropertyValue(const ::rtl::OUString& PropertyName) const throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
85cdf0e10cSrcweir 		inline void addPropertyChangeListener(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener>& xListener) throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
86cdf0e10cSrcweir 		inline void removePropertyChangeListener(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener>& aListener) throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
87cdf0e10cSrcweir 		inline void addVetoableChangeListener(const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener>& aListener) throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
88cdf0e10cSrcweir 		inline void removeVetoableChangeListener(const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener>& aListener) throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
89cdf0e10cSrcweir 
90cdf0e10cSrcweir 		// ::com::sun::star::sdb::XColumn
91cdf0e10cSrcweir 		inline sal_Bool wasNull() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
92cdf0e10cSrcweir 		inline ::rtl::OUString getString() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
93cdf0e10cSrcweir 		inline sal_Bool getBoolean() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
94cdf0e10cSrcweir 		inline sal_Int8 getByte() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
95cdf0e10cSrcweir 		inline sal_Int16 getShort() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
96cdf0e10cSrcweir 		inline sal_Int32 getInt() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
97cdf0e10cSrcweir 		inline sal_Int64 getLong() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
98cdf0e10cSrcweir 		inline float getFloat() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
99cdf0e10cSrcweir 		inline double getDouble() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
100cdf0e10cSrcweir 		inline ::com::sun::star::uno::Sequence< sal_Int8 > getBytes() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
101cdf0e10cSrcweir 		inline ::com::sun::star::util::Date getDate() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
102cdf0e10cSrcweir 		inline ::com::sun::star::util::Time getTime() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
103cdf0e10cSrcweir 		inline ::com::sun::star::util::DateTime  getTimestamp() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
104cdf0e10cSrcweir 		inline ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream> getBinaryStream() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
105cdf0e10cSrcweir 		inline ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream> getCharacterStream() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
106cdf0e10cSrcweir 		inline ::com::sun::star::uno::Any getObject(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& typeMap) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
107cdf0e10cSrcweir 		inline ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef> getRef() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
108cdf0e10cSrcweir 		inline ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob> getBlob() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
109cdf0e10cSrcweir 		inline ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob> getClob() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
110cdf0e10cSrcweir 		inline ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray> getArray() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
111cdf0e10cSrcweir 
112cdf0e10cSrcweir 		// XColumnUpdate
113cdf0e10cSrcweir 		inline void updateNull(void) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
114cdf0e10cSrcweir 		inline void updateBoolean(sal_Bool x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
115cdf0e10cSrcweir 		inline void updateByte(sal_Int8 x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
116cdf0e10cSrcweir 		inline void updateShort(sal_Int16 x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
117cdf0e10cSrcweir 		inline void updateInt(sal_Int32 x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
118cdf0e10cSrcweir 		inline void updateLong(sal_Int64 x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
119cdf0e10cSrcweir 		inline void updateFloat(float x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
120cdf0e10cSrcweir 		inline void updateDouble(double x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
121cdf0e10cSrcweir 		inline void updateString(const ::rtl::OUString& x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
122cdf0e10cSrcweir 		inline void updateBytes(const ::com::sun::star::uno::Sequence< sal_Int8 >& x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
123cdf0e10cSrcweir 		inline void updateDate(const com::sun::star::util::Date& x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
124cdf0e10cSrcweir 		inline void updateTime(const ::com::sun::star::util::Time& x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
125cdf0e10cSrcweir 		inline void updateTimestamp(const ::com::sun::star::util::DateTime& x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
126cdf0e10cSrcweir 		inline void updateBinaryStream(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream>& x, sal_Int32 length) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
127cdf0e10cSrcweir 		inline void updateCharacterStream(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream>& x, sal_Int32 length) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
128cdf0e10cSrcweir 		inline void updateObject(const ::com::sun::star::uno::Any& x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
129cdf0e10cSrcweir 		inline void updateNumericObject(const ::com::sun::star::uno::Any& x, sal_Int32 scale) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
130cdf0e10cSrcweir 	};
131cdf0e10cSrcweir 
132cdf0e10cSrcweir #endif // SVX_FORM_SDBDATACOLUMN_HXX
133cdf0e10cSrcweir 
134cdf0e10cSrcweir //..............................................................................
135cdf0e10cSrcweir }	// namespace svxform
136cdf0e10cSrcweir //..............................................................................
137