1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
20 #ifndef INCLUDED_SVX_SOURCE_INC_SDBDATACOLUMN_HXX
21 #define INCLUDED_SVX_SOURCE_INC_SDBDATACOLUMN_HXX
23 #include <com/sun/star/beans/XPropertySet.hpp>
24 #include <com/sun/star/sdb/XColumn.hpp>
25 #include <com/sun/star/sdb/XColumnUpdate.hpp>
26 #include <osl/diagnose.h>
34 //= DataColumn - a class wrapping an object implementing a sdb::DataColumn service
38 // interfaces needed for sddb::Column
39 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> m_xPropertySet
;
40 // interfaces needed for sdb::DataColumn
41 ::com::sun::star::uno::Reference
< ::com::sun::star::sdb::XColumn
> m_xColumn
;
42 ::com::sun::star::uno::Reference
< ::com::sun::star::sdb::XColumnUpdate
> m_xColumnUpdate
;
46 DataColumn(const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxIFace
);
47 // if the object behind _rxIFace doesn't fully support the DataColumn service,
48 // (which is checked via the supported interfaces) _all_ members will be set to
49 // void !, even if the object has some of the needed interfaces.
51 bool is() const { return m_xColumn
.is(); }
52 bool Is() const { return m_xColumn
.is(); }
53 bool supportsUpdate() const { return m_xColumnUpdate
.is(); }
55 DataColumn
* operator ->() { return this; }
56 operator ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> () const{ return m_xColumn
.get(); }
59 inline const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& getPropertySet() const
61 return m_xPropertySet
;
63 inline const ::com::sun::star::uno::Reference
< ::com::sun::star::sdb::XColumn
>& getColumn() const
67 inline const ::com::sun::star::uno::Reference
< ::com::sun::star::sdb::XColumnUpdate
>& getColumnUpdate() const
69 OSL_ENSURE(m_xColumnUpdate
.is() , "DataColumn::getColumnUpdate: NULL!");
70 return m_xColumnUpdate
;
73 // das normale queryInterface
74 ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& type
) throw ( ::com::sun::star::uno::RuntimeException
)
75 { return m_xColumn
->queryInterface(type
); }
77 // ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>
78 inline ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> getPropertySetInfo() const throw( ::com::sun::star::uno::RuntimeException
);
79 inline void setPropertyValue(const 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
);
80 inline ::com::sun::star::uno::Any
getPropertyValue(const OUString
& PropertyName
) const throw( ::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
81 inline void addPropertyChangeListener(const 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
);
82 inline void removePropertyChangeListener(const 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
);
83 inline void addVetoableChangeListener(const 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
);
84 inline void removeVetoableChangeListener(const 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
);
86 // ::com::sun::star::sdb::XColumn
87 inline bool wasNull() throw( ::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
88 inline OUString
getString() throw( ::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
89 inline bool getBoolean() throw( ::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
90 inline sal_Int8
getByte() throw( ::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
91 inline sal_Int16
getShort() throw( ::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
92 inline sal_Int32
getInt() throw( ::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
93 inline sal_Int64
getLong() throw( ::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
94 inline float getFloat() throw( ::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
95 inline double getDouble() throw( ::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
96 inline ::com::sun::star::uno::Sequence
< sal_Int8
> getBytes() throw( ::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
97 inline ::com::sun::star::util::Date
getDate() throw( ::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
98 inline ::com::sun::star::util::Time
getTime() throw( ::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
99 inline ::com::sun::star::util::DateTime
getTimestamp() throw( ::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
100 inline ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
> getBinaryStream() throw( ::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
101 inline ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
> getCharacterStream() throw( ::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
102 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
);
103 inline ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XRef
> getRef() throw( ::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
104 inline ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XBlob
> getBlob() throw( ::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
105 inline ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XClob
> getClob() throw( ::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
106 inline ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XArray
> getArray() throw( ::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
109 inline void updateNull() throw( ::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
110 inline void updateBoolean(bool x
) throw( ::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
111 inline void updateByte(sal_Int8 x
) throw( ::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
112 inline void updateShort(sal_Int16 x
) throw( ::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
113 inline void updateInt(sal_Int32 x
) throw( ::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
114 inline void updateLong(sal_Int64 x
) throw( ::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
115 inline void updateFloat(float x
) throw( ::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
116 inline void updateDouble(double x
) throw( ::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
117 inline void updateString(const OUString
& x
) throw( ::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
118 inline void updateBytes(const ::com::sun::star::uno::Sequence
< sal_Int8
>& x
) throw( ::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
119 inline void updateDate(const com::sun::star::util::Date
& x
) throw( ::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
120 inline void updateTime(const ::com::sun::star::util::Time
& x
) throw( ::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
121 inline void updateTimestamp(const ::com::sun::star::util::DateTime
& x
) throw( ::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
122 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
);
123 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
);
124 inline void updateObject(const ::com::sun::star::uno::Any
& x
) throw( ::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
125 inline void updateNumericObject(const ::com::sun::star::uno::Any
& x
, sal_Int32 scale
) throw( ::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
128 #endif // INCLUDED_SVX_SOURCE_INC_SDBDATACOLUMN_HXX
134 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */