LibreOffice Module ucb (master) 1
contentresultsetwrapper.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22#include <rtl/ustring.hxx>
23#include <rtl/ref.hxx>
24#include <osl/mutex.hxx>
25#include <cppuhelper/weak.hxx>
26#include <com/sun/star/lang/XComponent.hpp>
27#include <com/sun/star/sdbc/XCloseable.hpp>
28#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
29#include <com/sun/star/sdbc/XResultSet.hpp>
30#include <com/sun/star/sdbc/XRow.hpp>
31#include <com/sun/star/ucb/XContentAccess.hpp>
32#include <com/sun/star/beans/XPropertySet.hpp>
35#include <memory>
36
37
40 : public cppu::OWeakObject
41 , public css::lang::XComponent
42 , public css::sdbc::XCloseable
43 , public css::sdbc::XResultSetMetaDataSupplier
44 , public css::beans::XPropertySet
45 , public css::ucb::XContentAccess
46 , public css::sdbc::XResultSet
47 , public css::sdbc::XRow
48{
49protected:
54
55 //members
56
57 //my Mutex
58 osl::Mutex m_aMutex;
59
60 //different Interfaces from Origin:
61 css::uno::Reference< css::sdbc::XResultSet >
63 css::uno::Reference< css::sdbc::XRow >
64 m_xRowOrigin; //XRow-interface from m_xOrigin
66 css::uno::Reference< css::ucb::XContentAccess >
67 m_xContentAccessOrigin; //XContentAccess-interface from m_xOrigin
69 css::uno::Reference< css::beans::XPropertySet >
70 m_xPropertySetOrigin; //XPropertySet-interface from m_xOrigin
72
73 css::uno::Reference< css::beans::XPropertySetInfo >
75 //call impl_initPropertySetInfo() bevor you access this member
76
77 sal_Int32 m_nForwardOnly;
78
79private:
82
83 css::uno::Reference< css::sdbc::XResultSetMetaData >
84 m_xMetaDataFromOrigin; //XResultSetMetaData from m_xOrigin
85
86 //management of listeners
90 std::unique_ptr<comphelper::OInterfaceContainerHelper3<css::lang::XEventListener>>
92 std::unique_ptr<PropertyChangeListenerContainer_Impl>
94 std::unique_ptr<VetoableChangeListenerContainer_Impl>
96
97
98 //methods:
99private:
100 void
102
103 void
105
106 void verifyGet();
107
108protected:
109
110
111 ContentResultSetWrapper( css::uno::Reference< css::sdbc::XResultSet > const & xOrigin );
112
113 virtual ~ContentResultSetWrapper() override;
114
115 void impl_init();
116 void impl_deinit();
117
118 //--
119
123
124 //--
125
126 virtual void impl_initPropertySetInfo(); //helping XPropertySet
127
130 void
132
133 void
135 const css::beans::PropertyChangeEvent& rEvt );
136
139 void
141 const css::beans::PropertyChangeEvent& rEvt );
142
143 bool impl_isForwardOnly();
144
145public:
146
147
148 // XInterface
149
150 virtual css::uno::Any SAL_CALL
151 queryInterface( const css::uno::Type & rType ) override;
152
153
154 // XComponent
155
156 virtual void SAL_CALL
157 dispose() override;
158
159 virtual void SAL_CALL
160 addEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) override;
161
162 virtual void SAL_CALL
163 removeEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) override;
164
165
166 //XCloseable
167
168 virtual void SAL_CALL
169 close() override;
170
171
172 //XResultSetMetaDataSupplier
173
174 virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL
175 getMetaData() override;
176
177
178 // XPropertySet
179
180 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
181 getPropertySetInfo() override;
182
183 virtual void SAL_CALL
184 setPropertyValue( const OUString& aPropertyName,
185 const css::uno::Any& aValue ) override;
186
187 virtual css::uno::Any SAL_CALL
188 getPropertyValue( const OUString& PropertyName ) override;
189
190 virtual void SAL_CALL
191 addPropertyChangeListener( const OUString& aPropertyName,
192 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
193
194 virtual void SAL_CALL
195 removePropertyChangeListener( const OUString& aPropertyName,
196 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
197
198 virtual void SAL_CALL
199 addVetoableChangeListener( const OUString& PropertyName,
200 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
201
202 virtual void SAL_CALL
203 removeVetoableChangeListener( const OUString& PropertyName,
204 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
205
206
207 // own methods
208
210 virtual void
211 impl_disposing( const css::lang::EventObject& Source );
212
214 virtual void
215 impl_propertyChange( const css::beans::PropertyChangeEvent& evt );
216
219 virtual void
220 impl_vetoableChange( const css::beans::PropertyChangeEvent& aEvent );
221
222
223 // XContentAccess
224
225 virtual OUString SAL_CALL
227
228 virtual css::uno::Reference< css::ucb::XContentIdentifier > SAL_CALL
229 queryContentIdentifier() override;
230
231 virtual css::uno::Reference< css::ucb::XContent > SAL_CALL
232 queryContent() override;
233
234
235 // XResultSet
236
237 virtual sal_Bool SAL_CALL
238 next() override;
239 virtual sal_Bool SAL_CALL
240 isBeforeFirst() override;
241 virtual sal_Bool SAL_CALL
242 isAfterLast() override;
243 virtual sal_Bool SAL_CALL
244 isFirst() override;
245 virtual sal_Bool SAL_CALL
246 isLast() override;
247 virtual void SAL_CALL
248 beforeFirst() override;
249 virtual void SAL_CALL
250 afterLast() override;
251 virtual sal_Bool SAL_CALL
252 first() override;
253 virtual sal_Bool SAL_CALL
254 last() override;
255 virtual sal_Int32 SAL_CALL
256 getRow() override;
257 virtual sal_Bool SAL_CALL
258 absolute( sal_Int32 row ) override;
259 virtual sal_Bool SAL_CALL
260 relative( sal_Int32 rows ) override;
261 virtual sal_Bool SAL_CALL
262 previous() override;
263 virtual void SAL_CALL
264 refreshRow() override;
265 virtual sal_Bool SAL_CALL
266 rowUpdated() override;
267 virtual sal_Bool SAL_CALL
268 rowInserted() override;
269 virtual sal_Bool SAL_CALL
270 rowDeleted() override;
271 virtual css::uno::Reference<
272 css::uno::XInterface > SAL_CALL
273 getStatement() override;
274
275
276 // XRow
277
278 virtual sal_Bool SAL_CALL
279 wasNull() override;
280
281 virtual OUString SAL_CALL
282 getString( sal_Int32 columnIndex ) override;
283
284 virtual sal_Bool SAL_CALL
285 getBoolean( sal_Int32 columnIndex ) override;
286
287 virtual sal_Int8 SAL_CALL
288 getByte( sal_Int32 columnIndex ) override;
289
290 virtual sal_Int16 SAL_CALL
291 getShort( sal_Int32 columnIndex ) override;
292
293 virtual sal_Int32 SAL_CALL
294 getInt( sal_Int32 columnIndex ) override;
295
296 virtual sal_Int64 SAL_CALL
297 getLong( sal_Int32 columnIndex ) override;
298
299 virtual float SAL_CALL
300 getFloat( sal_Int32 columnIndex ) override;
301
302 virtual double SAL_CALL
303 getDouble( sal_Int32 columnIndex ) override;
304
305 virtual css::uno::Sequence< sal_Int8 > SAL_CALL
306 getBytes( sal_Int32 columnIndex ) override;
307
308 virtual css::util::Date SAL_CALL
309 getDate( sal_Int32 columnIndex ) override;
310
311 virtual css::util::Time SAL_CALL
312 getTime( sal_Int32 columnIndex ) override;
313
314 virtual css::util::DateTime SAL_CALL
315 getTimestamp( sal_Int32 columnIndex ) override;
316
317 virtual css::uno::Reference< css::io::XInputStream > SAL_CALL
318 getBinaryStream( sal_Int32 columnIndex ) override;
319
320 virtual css::uno::Reference< css::io::XInputStream > SAL_CALL
321 getCharacterStream( sal_Int32 columnIndex ) override;
322
323 virtual css::uno::Any SAL_CALL
324 getObject( sal_Int32 columnIndex,
325 const css::uno::Reference< css::container::XNameAccess >& typeMap ) override;
326
327 virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL
328 getRef( sal_Int32 columnIndex ) override;
329
330 virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL
331 getBlob( sal_Int32 columnIndex ) override;
332
333 virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL
334 getClob( sal_Int32 columnIndex ) override;
335
336 virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL
337 getArray( sal_Int32 columnIndex ) override;
338};
339
340
342 : public cppu::OWeakObject
343 , public css::beans::XPropertyChangeListener
344 , public css::beans::XVetoableChangeListener
345{
347
348public:
350
351 virtual ~ContentResultSetWrapperListener() override;
352
353
354 // XInterface
355 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
356 virtual void SAL_CALL acquire()
357 noexcept override;
358 virtual void SAL_CALL release()
359 noexcept override;
360
361 //XEventListener
362
363 virtual void SAL_CALL
364 disposing( const css::lang::EventObject& Source ) override;
365
366
367 //XPropertyChangeListener
368
369 virtual void SAL_CALL
370 propertyChange( const css::beans::PropertyChangeEvent& evt ) override;
371
372
373 //XVetoableChangeListener
374
375 virtual void SAL_CALL
376 vetoableChange( const css::beans::PropertyChangeEvent& aEvent ) override;
377
378
379 // own methods:
380 void impl_OwnerDies();
381};
382
383/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ContentResultSetWrapperListener(ContentResultSetWrapper *pOwner)
virtual void SAL_CALL propertyChange(const css::beans::PropertyChangeEvent &evt) override
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual void SAL_CALL vetoableChange(const css::beans::PropertyChangeEvent &aEvent) override
virtual void SAL_CALL acquire() noexcept override
virtual void SAL_CALL release() noexcept override
virtual void impl_disposing(const css::lang::EventObject &Source)
virtual sal_Bool SAL_CALL first() override
virtual sal_Bool SAL_CALL isLast() override
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
ContentResultSetWrapper(css::uno::Reference< css::sdbc::XResultSet > const &xOrigin)
virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray(sal_Int32 columnIndex) override
css::uno::Reference< css::sdbc::XResultSet > m_xResultSetOrigin
comphelper::OMultiTypeInterfaceContainerHelperVar3< css::beans::XVetoableChangeListener, OUString > VetoableChangeListenerContainer_Impl
virtual void SAL_CALL dispose() override
virtual sal_Bool SAL_CALL absolute(sal_Int32 row) override
std::unique_ptr< PropertyChangeListenerContainer_Impl > m_pPropertyChangeListeners
std::unique_ptr< VetoableChangeListenerContainer_Impl > m_pVetoableChangeListeners
virtual void SAL_CALL afterLast() override
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
virtual sal_Int16 SAL_CALL getShort(sal_Int32 columnIndex) override
css::uno::Reference< css::sdbc::XResultSetMetaData > m_xMetaDataFromOrigin
virtual sal_Int64 SAL_CALL getLong(sal_Int32 columnIndex) override
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
void impl_notifyVetoableChangeListeners(const css::beans::PropertyChangeEvent &rEvt)
virtual sal_Bool SAL_CALL rowDeleted() override
virtual css::uno::Any SAL_CALL getObject(sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess > &typeMap) override
virtual css::uno::Reference< css::ucb::XContent > SAL_CALL queryContent() override
css::uno::Reference< css::beans::XPropertySetInfo > m_xPropertySetInfo
! call impl_init_xPropertySetOrigin() bevor you access this member
virtual sal_Bool SAL_CALL rowInserted() override
virtual sal_Bool SAL_CALL getBoolean(sal_Int32 columnIndex) override
virtual ~ContentResultSetWrapper() override
virtual sal_Bool SAL_CALL relative(sal_Int32 rows) override
virtual sal_Bool SAL_CALL isAfterLast() override
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
comphelper::OMultiTypeInterfaceContainerHelperVar3< css::beans::XPropertyChangeListener, OUString > PropertyChangeListenerContainer_Impl
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &Listener) override
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream(sal_Int32 columnIndex) override
virtual void SAL_CALL refreshRow() override
virtual sal_Bool SAL_CALL next() override
virtual sal_Bool SAL_CALL isBeforeFirst() override
rtl::Reference< ContentResultSetWrapperListener > m_xMyListenerImpl
osl::Mutex m_aContainerMutex
In dispose call.
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual OUString SAL_CALL getString(sal_Int32 columnIndex) override
virtual css::uno::Reference< css::ucb::XContentIdentifier > SAL_CALL queryContentIdentifier() override
virtual sal_Bool SAL_CALL wasNull() override
virtual OUString SAL_CALL queryContentIdentifierString() override
virtual void impl_propertyChange(const css::beans::PropertyChangeEvent &evt)
css::uno::Reference< css::beans::XPropertySet > m_xPropertySetOrigin
! call impl_init_xContentAccessOrigin() bevor you access this member
virtual void SAL_CALL close() override
virtual css::util::Date SAL_CALL getDate(sal_Int32 columnIndex) override
css::uno::Reference< css::sdbc::XRow > m_xRowOrigin
virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef(sal_Int32 columnIndex) override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes(sal_Int32 columnIndex) override
virtual css::util::DateTime SAL_CALL getTimestamp(sal_Int32 columnIndex) override
virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob(sal_Int32 columnIndex) override
virtual sal_Int8 SAL_CALL getByte(sal_Int32 columnIndex) override
virtual sal_Bool SAL_CALL last() override
virtual sal_Bool SAL_CALL rowUpdated() override
std::unique_ptr< comphelper::OInterfaceContainerHelper3< css::lang::XEventListener > > m_pDisposeEventListeners
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream(sal_Int32 columnIndex) override
virtual css::util::Time SAL_CALL getTime(sal_Int32 columnIndex) override
virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob(sal_Int32 columnIndex) override
virtual sal_Int32 SAL_CALL getInt(sal_Int32 columnIndex) override
virtual void impl_vetoableChange(const css::beans::PropertyChangeEvent &aEvent)
css::uno::Reference< css::ucb::XContentAccess > m_xContentAccessOrigin
! call impl_init_xRowOrigin() bevor you access this member
virtual double SAL_CALL getDouble(sal_Int32 columnIndex) override
virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData() override
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &Listener) override
virtual sal_Bool SAL_CALL previous() override
bool m_bInDispose
Dispose call ready.
virtual sal_Int32 SAL_CALL getRow() override
virtual sal_Bool SAL_CALL isFirst() override
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getStatement() override
void impl_notifyPropertyChangeListeners(const css::beans::PropertyChangeEvent &rEvt)
virtual void SAL_CALL beforeFirst() override
virtual float SAL_CALL getFloat(sal_Int32 columnIndex) override
unsigned char sal_Bool
signed char sal_Int8