bump product version to 4.2.0.1
[LibreOffice.git] / include / ucbhelper / propertyvalueset.hxx
blob694fd41183b649c66111f2bb05038f1ee7175b6d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_UCBHELPER_PROPERTYVALUESET_HXX
21 #define INCLUDED_UCBHELPER_PROPERTYVALUESET_HXX
23 #include <com/sun/star/lang/XTypeProvider.hpp>
24 #include <com/sun/star/sdbc/XColumnLocate.hpp>
25 #include <com/sun/star/sdbc/XRow.hpp>
26 #include <com/sun/star/beans/Property.hpp>
27 #include <cppuhelper/weak.hxx>
29 #include <osl/mutex.hxx>
30 #include <ucbhelper/macros.hxx>
31 #include <ucbhelper/ucbhelperdllapi.h>
33 namespace com { namespace sun { namespace star { namespace script {
34 class XTypeConverter;
35 } } } }
37 namespace com { namespace sun { namespace star { namespace beans {
38 struct PropertyValue;
39 class XPropertySet;
40 } } } }
42 namespace ucbhelper {
44 class PropertyValues;
46 //=========================================================================
48 /**
49 * This class implements the interface XRow. After construction of a valueset
50 * the user can append properties ( incl. its values ) to the set. This class
51 * is useful when implementing the command "getPropertyValues", because the
52 * values to return can easyly appended to a valueset object. That object can
53 * directly be returned by the implementation of the command.
55 class UCBHELPER_DLLPUBLIC PropertyValueSet :
56 public cppu::OWeakObject,
57 public com::sun::star::lang::XTypeProvider,
58 public com::sun::star::sdbc::XRow,
59 public com::sun::star::sdbc::XColumnLocate
61 com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
62 m_xContext;
63 com::sun::star::uno::Reference< com::sun::star::script::XTypeConverter >
64 m_xTypeConverter;
65 osl::Mutex m_aMutex;
66 PropertyValues* m_pValues;
67 sal_Bool m_bWasNull;
68 sal_Bool m_bTriedToGetTypeConverter;
70 private:
71 UCBHELPER_DLLPRIVATE const com::sun::star::uno::Reference<
72 com::sun::star::script::XTypeConverter >&
73 getTypeConverter();
75 public:
76 PropertyValueSet(
77 const com::sun::star::uno::Reference<
78 com::sun::star::uno::XComponentContext >& rxContext );
79 virtual ~PropertyValueSet();
81 // XInterface
82 XINTERFACE_DECL()
84 // XTypeProvider
85 XTYPEPROVIDER_DECL()
87 // XRow
88 virtual sal_Bool SAL_CALL
89 wasNull()
90 throw( ::com::sun::star::sdbc::SQLException,
91 ::com::sun::star::uno::RuntimeException );
92 virtual OUString SAL_CALL
93 getString( sal_Int32 columnIndex )
94 throw( ::com::sun::star::sdbc::SQLException,
95 ::com::sun::star::uno::RuntimeException );
96 virtual sal_Bool SAL_CALL
97 getBoolean( sal_Int32 columnIndex )
98 throw( ::com::sun::star::sdbc::SQLException,
99 ::com::sun::star::uno::RuntimeException );
100 virtual sal_Int8 SAL_CALL
101 getByte( sal_Int32 columnIndex )
102 throw( ::com::sun::star::sdbc::SQLException,
103 ::com::sun::star::uno::RuntimeException );
104 virtual sal_Int16 SAL_CALL
105 getShort( sal_Int32 columnIndex )
106 throw( ::com::sun::star::sdbc::SQLException,
107 ::com::sun::star::uno::RuntimeException );
108 virtual sal_Int32 SAL_CALL
109 getInt( sal_Int32 columnIndex )
110 throw( ::com::sun::star::sdbc::SQLException,
111 ::com::sun::star::uno::RuntimeException );
112 virtual sal_Int64 SAL_CALL
113 getLong( sal_Int32 columnIndex )
114 throw( ::com::sun::star::sdbc::SQLException,
115 ::com::sun::star::uno::RuntimeException );
116 virtual float SAL_CALL
117 getFloat( sal_Int32 columnIndex )
118 throw( ::com::sun::star::sdbc::SQLException,
119 ::com::sun::star::uno::RuntimeException );
120 virtual double SAL_CALL
121 getDouble( sal_Int32 columnIndex )
122 throw( ::com::sun::star::sdbc::SQLException,
123 ::com::sun::star::uno::RuntimeException );
124 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
125 getBytes( sal_Int32 columnIndex )
126 throw( ::com::sun::star::sdbc::SQLException,
127 ::com::sun::star::uno::RuntimeException );
128 virtual ::com::sun::star::util::Date SAL_CALL
129 getDate( sal_Int32 columnIndex )
130 throw( ::com::sun::star::sdbc::SQLException,
131 ::com::sun::star::uno::RuntimeException );
132 virtual ::com::sun::star::util::Time SAL_CALL
133 getTime( sal_Int32 columnIndex )
134 throw( ::com::sun::star::sdbc::SQLException,
135 ::com::sun::star::uno::RuntimeException );
136 virtual ::com::sun::star::util::DateTime SAL_CALL
137 getTimestamp( sal_Int32 columnIndex )
138 throw( ::com::sun::star::sdbc::SQLException,
139 ::com::sun::star::uno::RuntimeException );
140 virtual ::com::sun::star::uno::Reference<
141 ::com::sun::star::io::XInputStream > SAL_CALL
142 getBinaryStream( sal_Int32 columnIndex )
143 throw( ::com::sun::star::sdbc::SQLException,
144 ::com::sun::star::uno::RuntimeException );
145 virtual ::com::sun::star::uno::Reference<
146 ::com::sun::star::io::XInputStream > SAL_CALL
147 getCharacterStream( sal_Int32 columnIndex )
148 throw( ::com::sun::star::sdbc::SQLException,
149 ::com::sun::star::uno::RuntimeException );
150 virtual ::com::sun::star::uno::Any SAL_CALL
151 getObject( sal_Int32 columnIndex,
152 const ::com::sun::star::uno::Reference<
153 ::com::sun::star::container::XNameAccess >& typeMap )
154 throw( ::com::sun::star::sdbc::SQLException,
155 ::com::sun::star::uno::RuntimeException );
156 virtual ::com::sun::star::uno::Reference<
157 ::com::sun::star::sdbc::XRef > SAL_CALL
158 getRef( sal_Int32 columnIndex )
159 throw( ::com::sun::star::sdbc::SQLException,
160 ::com::sun::star::uno::RuntimeException );
161 virtual ::com::sun::star::uno::Reference<
162 ::com::sun::star::sdbc::XBlob > SAL_CALL
163 getBlob( sal_Int32 columnIndex )
164 throw( ::com::sun::star::sdbc::SQLException,
165 ::com::sun::star::uno::RuntimeException );
166 virtual ::com::sun::star::uno::Reference<
167 ::com::sun::star::sdbc::XClob > SAL_CALL
168 getClob( sal_Int32 columnIndex )
169 throw( ::com::sun::star::sdbc::SQLException,
170 ::com::sun::star::uno::RuntimeException );
171 virtual ::com::sun::star::uno::Reference<
172 ::com::sun::star::sdbc::XArray > SAL_CALL
173 getArray( sal_Int32 columnIndex )
174 throw( ::com::sun::star::sdbc::SQLException,
175 ::com::sun::star::uno::RuntimeException );
177 // XColumnLocate
178 virtual sal_Int32 SAL_CALL
179 findColumn( const OUString& columnName )
180 throw( ::com::sun::star::sdbc::SQLException,
181 ::com::sun::star::uno::RuntimeException );
183 //////////////////////////////////////////////////////////////////////
184 // Non-interface methods
185 //////////////////////////////////////////////////////////////////////
187 void appendString( const OUString& rPropName, const OUString& rValue );
188 void appendString( const sal_Char* pAsciiPropName, const OUString& rValue )
190 appendString( OUString::createFromAscii( pAsciiPropName ), rValue );
192 void appendString( const ::com::sun::star::beans::Property& rProp, const OUString& rValue )
194 appendString( rProp.Name, rValue );
197 void appendBoolean( const OUString& rPropName, sal_Bool bValue );
198 void appendBoolean( const sal_Char* pAsciiPropName, sal_Bool bValue )
200 appendBoolean( OUString::createFromAscii( pAsciiPropName ), bValue );
202 void appendBoolean( const ::com::sun::star::beans::Property& rProp, sal_Bool bValue )
204 appendBoolean( rProp.Name, bValue );
207 void appendLong( const OUString& rPropName, sal_Int64 nValue );
208 void appendLong( const sal_Char* pAsciiPropName, sal_Int64 nValue )
210 appendLong( OUString::createFromAscii( pAsciiPropName ), nValue );
212 void appendLong( const ::com::sun::star::beans::Property& rProp, sal_Int64 nValue )
214 appendLong( rProp.Name, nValue );
217 void appendTimestamp( const OUString& rPropName, const ::com::sun::star::util::DateTime& rValue );
218 void appendTimestamp( const sal_Char* pAsciiPropName, const ::com::sun::star::util::DateTime& rValue )
220 appendTimestamp( OUString::createFromAscii( pAsciiPropName ), rValue );
222 void appendTimestamp( const ::com::sun::star::beans::Property& rProp, const ::com::sun::star::util::DateTime& rValue )
224 appendTimestamp( rProp.Name, rValue );
227 void appendObject( const OUString& rPropName, const ::com::sun::star::uno::Any& rValue );
228 void appendObject( const sal_Char* pAsciiPropName, const ::com::sun::star::uno::Any& rValue )
230 appendObject( OUString::createFromAscii( pAsciiPropName ), rValue );
232 void appendObject( const ::com::sun::star::beans::Property& rProp, const ::com::sun::star::uno::Any& rValue )
234 appendObject( rProp.Name, rValue );
237 void appendVoid( const OUString& rPropName );
238 void appendVoid( const sal_Char* pAsciiPropName)
240 appendVoid( OUString::createFromAscii( pAsciiPropName ) );
242 void appendVoid( const ::com::sun::star::beans::Property& rProp )
244 appendVoid( rProp.Name );
248 * This method tries to append all property values contained in a
249 * property set to the value set.
251 * @param rSet is a property set containing the property values.
253 void appendPropertySet( const ::com::sun::star::uno::Reference<
254 ::com::sun::star::beans::XPropertySet >& rSet );
256 /** This method tries to append a single property value contained in a
257 * property set to the value set.
259 * @param rSet is a property set containing the property values.
260 * @param rProperty is the property for that the value shall be obtained
261 * from the given property set.
262 * @return False, if the property value cannot be obtained from the
263 * given property pet. True, otherwise.
265 sal_Bool appendPropertySetValue(
266 const ::com::sun::star::uno::Reference<
267 ::com::sun::star::beans::XPropertySet >& rSet,
268 const ::com::sun::star::beans::Property& rProperty );
273 #endif /* ! INCLUDED_UCBHELPER_PROPERTYVALUESET_HXX */
275 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */