Update ooo320-m1
[ooovba.git] / dbaccess / source / core / api / RowSetBase.hxx
blobb21c053b33d52fcce2a744db25539a3c56ec6e57
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: RowSetBase.hxx,v $
10 * $Revision: 1.39.68.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef DBACCESS_CORE_API_ROWSETBASE_HXX
31 #define DBACCESS_CORE_API_ROWSETBASE_HXX
33 #ifndef _CPPUHELPER_IMPLBASE10_HXX_
34 #include <cppuhelper/implbase10.hxx>
35 #endif
36 #ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_
37 #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
38 #endif
39 #ifndef _COM_SUN_STAR_SDBC_XROW_HPP_
40 #include <com/sun/star/sdbc/XRow.hpp>
41 #endif
42 #ifndef _COM_SUN_STAR_SDBC_XCOLUMNLOCATE_HPP_
43 #include <com/sun/star/sdbc/XColumnLocate.hpp>
44 #endif
45 #ifndef _COM_SUN_STAR_SDBC_XCLOSEABLE_HPP_
46 #include <com/sun/star/sdbc/XCloseable.hpp>
47 #endif
48 #ifndef _COM_SUN_STAR_SDBCX_XROWLOCATE_HPP_
49 #include <com/sun/star/sdbcx/XRowLocate.hpp>
50 #endif
51 #ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATASUPPLIER_HPP_
52 #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
53 #endif
54 #ifndef _COM_SUN_STAR_SDBC_XWARNINGSSUPPLIER_HPP_
55 #include <com/sun/star/sdbc/XWarningsSupplier.hpp>
56 #endif
57 #ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
58 #include <com/sun/star/lang/XServiceInfo.hpp>
59 #endif
60 #ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_
61 #include <com/sun/star/lang/XUnoTunnel.hpp>
62 #endif
63 #ifndef _CPPUHELPER_INTERFACECONTAINER_H_
64 #include <cppuhelper/interfacecontainer.h>
65 #endif
66 #ifndef CONNECTIVITY_SQLERROR_HXX
67 #include <connectivity/sqlerror.hxx>
68 #endif
69 #ifndef _CONNECTIVITY_COMMONTOOLS_HXX_
70 #include <connectivity/CommonTools.hxx>
71 #endif
72 #ifndef COMPHELPER_PROPERTYSTATECONTAINER_HXX
73 #include <comphelper/propertystatecontainer.hxx>
74 #endif
75 #ifndef _COMPHELPER_PROPERTY_ARRAY_HELPER_HXX_
76 #include <comphelper/proparrhlp.hxx>
77 #endif
78 #ifndef _COM_SUN_STAR_SDBC_XROWSET_HPP_
79 #include <com/sun/star/sdbc/XRowSet.hpp>
80 #endif
81 #ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATTYPES_HPP_
82 #include <com/sun/star/util/XNumberFormatTypes.hpp>
83 #endif
84 #ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
85 #include <com/sun/star/container/XNameAccess.hpp>
86 #endif
87 #ifndef DBACCESS_CORE_API_ROWSETROW_HXX
88 #include "RowSetRow.hxx"
89 #endif
90 #ifndef _COMPHELPER_BROADCASTHELPER_HXX_
91 #include <comphelper/broadcasthelper.hxx>
92 #endif
93 #ifndef DBACCESS_ROWSETCACHEITERATOR_HXX
94 #include "RowSetCacheIterator.hxx"
95 #endif
96 #include "core_resource.hxx"
97 #include <comphelper/componentcontext.hxx>
99 #include <functional>
102 namespace com { namespace sun { namespace star {
103 namespace sdb { struct RowChangeEvent; }
104 namespace lang { struct Locale; }
105 } } }
107 namespace dbaccess
109 class OEmptyCollection;
111 typedef ::cppu::ImplHelper10< ::com::sun::star::sdbcx::XRowLocate,
112 ::com::sun::star::sdbc::XRow,
113 ::com::sun::star::sdbc::XResultSetMetaDataSupplier,
114 ::com::sun::star::sdbc::XWarningsSupplier,
115 ::com::sun::star::sdbc::XColumnLocate,
116 ::com::sun::star::sdbcx::XColumnsSupplier,
117 ::com::sun::star::lang::XServiceInfo,
118 ::com::sun::star::sdbc::XRowSet,
119 ::com::sun::star::sdbc::XCloseable,
120 ::com::sun::star::lang::XUnoTunnel> ORowSetBase_BASE;
122 class ORowSetCache;
123 class ORowSetDataColumns;
124 class ORowSetCacheIterator;
125 class ORowSetDataColumn;
126 class ORowSetBase : public ORowSetBase_BASE,
127 public ::comphelper::OPropertyStateContainer,
128 public ::comphelper::OPropertyArrayUsageHelper<ORowSetBase> // this class hold the static property info
130 OModuleClient m_aModuleClient;
131 protected:
132 typedef ::std::vector<ORowSetDataColumn*> TDataColumns;
133 ::osl::Mutex* m_pMutex; // this the mutex form the rowset itself
134 ::osl::Mutex m_aRowCountMutex, // mutex for rowcount changes
135 // we need a extra mutex for columns to prevend deadlock when setting new values
136 // for a row
137 m_aColumnsMutex;
139 ::com::sun::star::uno::Any m_aBookmark;
140 ORowSetCacheIterator m_aCurrentRow; // contains the actual fetched row
141 TORowSetOldRowHelperRef m_aOldRow;
142 TDataColumns m_aDataColumns; // holds the columns as m_pColumns but know the implementation class
143 connectivity::ORowSetValue m_aEmptyValue; // only for error case
145 ::cppu::OWeakObject* m_pMySelf; // set by derived classes
146 ORowSetCache* m_pCache; // the cache is used by the rowset and his clone (shared)
147 ORowSetDataColumns* m_pColumns; // represent the select columns
148 ::cppu::OBroadcastHelper& m_rBHelper; // must be set from the derived classes
149 // is used when the formatkey for database types is set
150 ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatTypes> m_xNumberFormatTypes;
151 OEmptyCollection* m_pEmptyCollection;
153 ::comphelper::ComponentContext m_aContext;
154 ::connectivity::SQLError m_aErrors;
156 sal_Int32 m_nLastColumnIndex; // the last column ask for, used for wasNull()
157 sal_Int32 m_nDeletedPosition; // is set only when a row was deleted
158 sal_Int32 m_nResultSetType; // fetch property
159 sal_Int32 m_nResultSetConcurrency;
160 sal_Bool m_bClone; // I'm clone or not
161 sal_Bool m_bIgnoreResult ;
162 sal_Bool m_bBeforeFirst : 1;
163 sal_Bool m_bAfterLast : 1;
165 protected:
166 ORowSetBase(
167 const ::comphelper::ComponentContext& _rContext,
168 ::cppu::OBroadcastHelper& _rBHelper,
169 ::osl::Mutex* _pMutex
172 // fire a notification for all that are listening on column::VALUE property
173 void firePropertyChange(const ORowSetRow& _rOldRow);
175 // fire if rowcount changed
176 virtual void fireRowcount();
177 // notify row changed
178 virtual sal_Bool notifyAllListenersCursorBeforeMove(::osl::ResettableMutexGuard& _rGuard);
179 // notify cursor moved
180 virtual void notifyAllListenersCursorMoved(::osl::ResettableMutexGuard& _rGuard);
181 // notify all that rowset changed
182 virtual void notifyAllListeners(::osl::ResettableMutexGuard& _rGuard);
184 // cancel the insertion, if necessary (means if we're on the insert row)
185 virtual void doCancelModification( ) = 0;
186 // return <TRUE/> if and only if we're using the insert row (means: we're updating _or_ inserting)
187 virtual sal_Bool isModification( ) = 0;
188 // return <TRUE/> if and only if the current row is modified
189 // TODO: isn't this the same as isModification?
190 virtual sal_Bool isModified( ) = 0;
191 // return <TRUE/> if and only if the current row is the insert row
192 virtual sal_Bool isNew( ) = 0;
193 // notify the change of a boolean property
194 void fireProperty( sal_Int32 _nProperty, sal_Bool _bNew, sal_Bool _bOld );
196 // OPropertyStateContainer
197 virtual void getPropertyDefaultByHandle( sal_Int32 _nHandle, ::com::sun::star::uno::Any& _rDefault ) const;
198 virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue,sal_Int32 nHandle) const;
200 enum CursorMoveDirection
202 /// denotes a cursor move forward
203 MOVE_FORWARD,
204 /// denotes a cursor move backwards
205 MOVE_BACKWARD,
206 /// denotes no cursor move at all, used when the current row is to be refreshed only
207 MOVE_NONE_REFRESH_ONLY
209 /** positions the cache in preparation of a cursor move
211 Normally, the cache is simply moved to our bookmark (m_aBookmark). If however the current
212 row is deleted, then the cache is properly positioned for a following cursor movement in the
213 given direction.
215 @param _ePrepareForDirection
216 the direction into which the cursor should be moved after the call. If we're currently not on
217 a deleted row, this parameter is ignored, since in this case the cache is simply moved to
218 m_aBookmark.</br>
219 If, however, we're currently on a deleted row, this is used to properly position the cache
220 using <member>m_nDeletedPosition</member>.<br/>
221 In this case, MOVE_NONE_REFRESH_ONLY is not supported. This is because the deleted row
222 (to which the RowSet currently points to) is not present in the cache. So, you cannot move the
223 cache to this row.
225 void positionCache( CursorMoveDirection _ePrepareForDirection );
227 // returns a value of a column of the current row
228 const connectivity::ORowSetValue& getValue(sal_Int32 columnIndex);
229 // the cache has to be checked before calling this method
230 const connectivity::ORowSetValue& impl_getValue(sal_Int32 columnIndex);
231 // sets the current and the bookmark
232 void setCurrentRow( sal_Bool _bMoved, sal_Bool _bDoNotify, const ORowSetRow& _rOldValues, ::osl::ResettableMutexGuard& _rGuard);
233 void checkPositioningAllowed() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
234 // checks if the cache is null
235 void checkCache();
236 // sets the bookmark to Any()
237 // m_aCurrentRow to end of matrix
238 // m_aOldRow to NULL
239 void movementFailed();
241 ORowSetRow getOldRow(sal_Bool _bWasNew);
242 /** move the cache the postion defined by the member functor
243 @param _aCheckFunctor
244 Return <TRUE/> when we already stand on the row we want to.
245 @param _aMovementFunctor
246 The mehtod used to move.
247 @return
248 <TRUE/> if movement was successful.
250 sal_Bool SAL_CALL move( ::std::mem_fun_t<sal_Bool,ORowSetBase>& _aCheckFunctor,
251 ::std::mem_fun_t<sal_Bool,ORowSetCache>& _aMovementFunctor);
253 /** same meaning as isFirst. Only need by mem_fun
254 @return
255 <TRUE/> if so.
257 sal_Bool isOnFirst();
258 /** same meaning as isLast. Only need by mem_fun
259 @return
260 <TRUE/> if so.
262 sal_Bool isOnLast();
264 /** returns the current row count
266 This function takes into account that we might actually be positioned on a
267 deleted row, so that m_pCache->m_nRowCount does not really reflect the actual
268 count.
270 @precond
271 Our mutext is locked.
273 sal_Int32 impl_getRowCount() const;
275 // the checkCache has to be called before calling this methods
276 sal_Bool impl_wasNull();
277 sal_Int32 impl_getRow();
278 sal_Bool impl_rowDeleted();
280 public:
281 virtual ~ORowSetBase();
283 // OComponentHelper
284 virtual void SAL_CALL disposing(void);
286 // com::sun::star::beans::XPropertySet
287 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
289 return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
292 // comphelper::OPropertyArrayUsageHelper
293 virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
295 // cppu::OPropertySetHelper
296 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
298 // com::sun::star::lang::XTypeProvider
299 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException);
301 // com::sun::star::uno::XInterface
302 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw (::com::sun::star::uno::RuntimeException);
304 // ::com::sun::star::sdbc::XWarningsSupplier
305 virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
306 virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
308 // ::com::sun::star::sdbc::XResultSetMetaDataSupplier
309 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
311 // ::com::sun::star::sdbc::XColumnLocate
312 virtual sal_Int32 SAL_CALL findColumn( const ::rtl::OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
314 // ::com::sun::star::sdbcx::XColumnsSupplier
315 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getColumns( ) throw(::com::sun::star::uno::RuntimeException);
317 // ::com::sun::star::sdbc::XRow
318 virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
319 virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
320 virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
321 virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
322 virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
323 virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
324 virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
325 virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
326 virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
327 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
328 virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
329 virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
330 virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
331 virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
332 virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
333 virtual ::com::sun::star::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
334 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
335 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
336 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
337 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
339 // ::com::sun::star::sdbcx::XRowLocate
340 virtual ::com::sun::star::uno::Any SAL_CALL getBookmark( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
341 virtual sal_Bool SAL_CALL moveToBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
342 virtual sal_Bool SAL_CALL moveRelativeToBookmark( const ::com::sun::star::uno::Any& bookmark, sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
343 virtual sal_Int32 SAL_CALL compareBookmarks( const ::com::sun::star::uno::Any& first, const ::com::sun::star::uno::Any& second ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
344 virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
345 virtual sal_Int32 SAL_CALL hashBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
347 // ::com::sun::star::sdbc::XResultSet
348 virtual sal_Bool SAL_CALL next( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
349 virtual sal_Bool SAL_CALL isBeforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
350 virtual sal_Bool SAL_CALL isAfterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
351 virtual sal_Bool SAL_CALL isFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
352 virtual sal_Bool SAL_CALL isLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
353 virtual void SAL_CALL beforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
354 virtual void SAL_CALL afterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
355 virtual sal_Bool SAL_CALL first( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
356 virtual sal_Bool SAL_CALL last( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
357 virtual sal_Int32 SAL_CALL getRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
358 virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
359 virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
360 virtual sal_Bool SAL_CALL previous( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
361 virtual void SAL_CALL refreshRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
362 virtual sal_Bool SAL_CALL rowUpdated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
363 virtual sal_Bool SAL_CALL rowInserted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
364 virtual sal_Bool SAL_CALL rowDeleted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
365 virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
367 // ::com::sun::star::sdbc::XRowSet
368 virtual void SAL_CALL execute( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) = 0;
369 virtual void SAL_CALL addRowSetListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSetListener >& listener ) throw(::com::sun::star::uno::RuntimeException) = 0;
370 virtual void SAL_CALL removeRowSetListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSetListener >& listener ) throw(::com::sun::star::uno::RuntimeException) = 0;
372 // is called when the rowset is going to delete this bookmark _rBookmark
373 void onDeleteRow( const ::com::sun::star::uno::Any& _rBookmark );
374 // is called when the rowset has deleted this bookmark _rBookmark
375 void onDeletedRow( const ::com::sun::star::uno::Any& _rBookmark, sal_Int32 _nPos );
377 // ==========================================================
378 // granular access control
379 struct GrantNotifierAccess { friend class ORowSetNotifier; private: GrantNotifierAccess () { } };
381 // cancel the insertion, if necessary (means if we're on the insert row)
382 inline void doCancelModification( const GrantNotifierAccess& ) { doCancelModification(); }
383 inline sal_Bool isModification( const GrantNotifierAccess& ) { return isModification(); }
384 inline sal_Bool isModified( const GrantNotifierAccess& ) { return isModified(); }
385 inline sal_Bool isNew( const GrantNotifierAccess& ) { return isNew(); }
386 inline sal_Bool isInsertRow() { return isNew() || isModified(); }
387 inline void fireProperty( sal_Int32 _nProperty, sal_Bool _bNew, sal_Bool _bOld, const GrantNotifierAccess& )
389 fireProperty( _nProperty, _bNew, _bOld );
391 using ::comphelper::OPropertyStateContainer::getFastPropertyValue;
393 ::osl::Mutex* getMutex() const { return m_pMutex; }
396 // ========================================================================
397 /** eases the handling of the doCancelModification and notifyCancelInsert methods
399 <p>The class can only be used on the stack, within a method of ORowSetBase (or derivees)</p>
401 class ORowSetNotifier
403 private:
404 ORowSetBase* m_pRowSet;
405 // not aquired! This is not necessary because this class here is to be used on the stack within
406 // a method of ORowSetBase (or derivees)
407 sal_Bool m_bWasNew;
408 sal_Bool m_bWasModified;
409 #ifdef DBG_UTIL
410 sal_Bool m_bNotifyCalled;
411 #endif
413 public:
414 /** constructs the object, and cancels the insertion
416 @see ORowSetBase::doCancelModification
418 ORowSetNotifier( ORowSetBase* m_pRowSet );
420 // destructs the object. <member>fire</member> has to be called before.
421 ~ORowSetNotifier( );
423 /** notifies the insertion
425 <p>This has <em>not</em> been put into the destructor by intention!<br/>
427 The destructor is called during stack unwinding in case of an exception, so if we would do
428 listener notification there, this would have the potential of another exception during stack
429 unwinding, which would terminate the application.</p>
431 @see ORowSetBase::notifyCancelInsert
433 void fire();
436 } // end of namespace
438 #endif // DBACCESS_CORE_API_ROWSETBASE_HXX