xref: /AOO41X/main/svx/source/inc/sdbdatacolumn.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef SVX_FORM_SDBDATACOLUMN_HXX
29*cdf0e10cSrcweir #define SVX_FORM_SDBDATACOLUMN_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
32*cdf0e10cSrcweir #include <com/sun/star/sdb/XColumn.hpp>
33*cdf0e10cSrcweir #include <com/sun/star/sdb/XColumnUpdate.hpp>
34*cdf0e10cSrcweir #include <osl/diagnose.h>
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir //..............................................................................
37*cdf0e10cSrcweir namespace svxform
38*cdf0e10cSrcweir {
39*cdf0e10cSrcweir //..............................................................................
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir 	//==========================================================================
42*cdf0e10cSrcweir 	//= DataColumn - a class wrapping an object implementing a sdb::DataColumn service
43*cdf0e10cSrcweir 	//==========================================================================
44*cdf0e10cSrcweir 	class DataColumn
45*cdf0e10cSrcweir 	{
46*cdf0e10cSrcweir 		// interfaces needed for sddb::Column
47*cdf0e10cSrcweir 		::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>	m_xPropertySet;
48*cdf0e10cSrcweir 		// interfaces needed for sdb::DataColumn
49*cdf0e10cSrcweir 		::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn>			m_xColumn;
50*cdf0e10cSrcweir 		::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumnUpdate> 	m_xColumnUpdate;
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir 	public:
53*cdf0e10cSrcweir 		DataColumn() { };
54*cdf0e10cSrcweir 		DataColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxIFace);
55*cdf0e10cSrcweir 		// if the object behind _rxIFace doesn't fully support the DataColumn service,
56*cdf0e10cSrcweir 		// (which is checked via the supported interfaces) _all_ members will be set to
57*cdf0e10cSrcweir 		// void !, even if the object has some of the needed interfaces.
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir 		sal_Bool is() const { return m_xColumn.is(); }
60*cdf0e10cSrcweir 		sal_Bool Is() const { return m_xColumn.is(); }
61*cdf0e10cSrcweir 		sal_Bool supportsUpdate() const { return m_xColumnUpdate.is(); }
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir 		DataColumn* operator ->() { return this; }
64*cdf0e10cSrcweir 		operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> () const{ return m_xColumn.get(); }
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir 		// 'conversions'
67*cdf0e10cSrcweir 		inline const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& getPropertySet() const
68*cdf0e10cSrcweir 		{
69*cdf0e10cSrcweir 			return m_xPropertySet;
70*cdf0e10cSrcweir 		}
71*cdf0e10cSrcweir 		inline const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn>& getColumn() const
72*cdf0e10cSrcweir 		{
73*cdf0e10cSrcweir 			return m_xColumn;
74*cdf0e10cSrcweir 		}
75*cdf0e10cSrcweir 		inline const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumnUpdate>& getColumnUpdate() const
76*cdf0e10cSrcweir 		{
77*cdf0e10cSrcweir 			OSL_ENSURE(m_xColumnUpdate.is() , "DataColumn::getColumnUpdate: NULL!");
78*cdf0e10cSrcweir 			return m_xColumnUpdate;
79*cdf0e10cSrcweir 		}
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir 		// das normale queryInterface
82*cdf0e10cSrcweir 		::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& type) throw ( ::com::sun::star::uno::RuntimeException )
83*cdf0e10cSrcweir 		{ return m_xColumn->queryInterface(type); }
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir 		// ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>
86*cdf0e10cSrcweir 		inline ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> getPropertySetInfo() const throw( ::com::sun::star::uno::RuntimeException );
87*cdf0e10cSrcweir 		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 );
88*cdf0e10cSrcweir 		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 );
89*cdf0e10cSrcweir 		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 );
90*cdf0e10cSrcweir 		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 );
91*cdf0e10cSrcweir 		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 );
92*cdf0e10cSrcweir 		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 );
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir 		// ::com::sun::star::sdb::XColumn
95*cdf0e10cSrcweir 		inline sal_Bool wasNull() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
96*cdf0e10cSrcweir 		inline ::rtl::OUString getString() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
97*cdf0e10cSrcweir 		inline sal_Bool getBoolean() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
98*cdf0e10cSrcweir 		inline sal_Int8 getByte() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
99*cdf0e10cSrcweir 		inline sal_Int16 getShort() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
100*cdf0e10cSrcweir 		inline sal_Int32 getInt() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
101*cdf0e10cSrcweir 		inline sal_Int64 getLong() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
102*cdf0e10cSrcweir 		inline float getFloat() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
103*cdf0e10cSrcweir 		inline double getDouble() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
104*cdf0e10cSrcweir 		inline ::com::sun::star::uno::Sequence< sal_Int8 > getBytes() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
105*cdf0e10cSrcweir 		inline ::com::sun::star::util::Date getDate() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
106*cdf0e10cSrcweir 		inline ::com::sun::star::util::Time getTime() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
107*cdf0e10cSrcweir 		inline ::com::sun::star::util::DateTime  getTimestamp() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
108*cdf0e10cSrcweir 		inline ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream> getBinaryStream() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
109*cdf0e10cSrcweir 		inline ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream> getCharacterStream() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
110*cdf0e10cSrcweir 		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 );
111*cdf0e10cSrcweir 		inline ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef> getRef() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
112*cdf0e10cSrcweir 		inline ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob> getBlob() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
113*cdf0e10cSrcweir 		inline ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob> getClob() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
114*cdf0e10cSrcweir 		inline ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray> getArray() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir 		// XColumnUpdate
117*cdf0e10cSrcweir 		inline void updateNull(void) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
118*cdf0e10cSrcweir 		inline void updateBoolean(sal_Bool x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
119*cdf0e10cSrcweir 		inline void updateByte(sal_Int8 x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
120*cdf0e10cSrcweir 		inline void updateShort(sal_Int16 x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
121*cdf0e10cSrcweir 		inline void updateInt(sal_Int32 x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
122*cdf0e10cSrcweir 		inline void updateLong(sal_Int64 x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
123*cdf0e10cSrcweir 		inline void updateFloat(float x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
124*cdf0e10cSrcweir 		inline void updateDouble(double x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
125*cdf0e10cSrcweir 		inline void updateString(const ::rtl::OUString& x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
126*cdf0e10cSrcweir 		inline void updateBytes(const ::com::sun::star::uno::Sequence< sal_Int8 >& x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
127*cdf0e10cSrcweir 		inline void updateDate(const com::sun::star::util::Date& x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
128*cdf0e10cSrcweir 		inline void updateTime(const ::com::sun::star::util::Time& x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
129*cdf0e10cSrcweir 		inline void updateTimestamp(const ::com::sun::star::util::DateTime& x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
130*cdf0e10cSrcweir 		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 );
131*cdf0e10cSrcweir 		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 );
132*cdf0e10cSrcweir 		inline void updateObject(const ::com::sun::star::uno::Any& x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
133*cdf0e10cSrcweir 		inline void updateNumericObject(const ::com::sun::star::uno::Any& x, sal_Int32 scale) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
134*cdf0e10cSrcweir 	};
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir #endif // SVX_FORM_SDBDATACOLUMN_HXX
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir //..............................................................................
139*cdf0e10cSrcweir }	// namespace svxform
140*cdf0e10cSrcweir //..............................................................................
141