1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_dbaccess.hxx"
30 
31 #ifndef _SBA_FORMADAPTER_HXX
32 #include "formadapter.hxx"
33 #endif
34 #ifndef _TOOLS_DEBUG_HXX //autogen
35 #include <tools/debug.hxx>
36 #endif
37 #ifndef _COMPHELPER_TYPES_HXX_
38 #include <comphelper/types.hxx>
39 #endif
40 #ifndef _COMPHELPER_ENUMHELPER_HXX_
41 #include <comphelper/enumhelper.hxx>
42 #endif
43 #ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
44 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
45 #endif
46 #ifndef _STRING_HXX
47 #include <tools/string.hxx>
48 #endif
49 #ifndef _DBU_BRW_HRC_
50 #include "dbu_brw.hrc"
51 #endif
52 #ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
53 #include "dbustrings.hrc"
54 #endif
55 #ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
56 #include <cppuhelper/typeprovider.hxx>
57 #endif
58 #ifndef _COMPHELPER_SEQUENCE_HXX_
59 #include <comphelper/sequence.hxx>
60 #endif
61 
62 using namespace dbaui;
63 using namespace ::com::sun::star::uno;
64 using namespace ::com::sun::star::sdb;
65 using namespace ::com::sun::star::sdbcx;
66 using namespace ::com::sun::star::beans;
67 using namespace ::com::sun::star::container;
68 
69 //==================================================================
70 // SbaXFormAdapter
71 //==================================================================
72 
73 DBG_NAME(SbaXFormAdapter)
74 // -------------------------------------------------------------------------
75 SbaXFormAdapter::SbaXFormAdapter()
76 			:m_aLoadListeners(*this, m_aMutex)
77 			,m_aRowSetListeners(*this, m_aMutex)
78 			,m_aRowSetApproveListeners(*this, m_aMutex)
79 			,m_aErrorListeners(*this, m_aMutex)
80 			,m_aParameterListeners(*this, m_aMutex)
81 			,m_aSubmitListeners(*this, m_aMutex)
82 			,m_aResetListeners(*this, m_aMutex)
83 			,m_aPropertyChangeListeners(*this, m_aMutex)
84 			,m_aVetoablePropertyChangeListeners(*this, m_aMutex)
85             ,m_aPropertiesChangeListeners(*this, m_aMutex)
86 			,m_aDisposeListeners(m_aMutex)
87 			,m_aContainerListeners(m_aMutex)
88 			,m_nNamePropHandle(-1)
89 {
90     DBG_CTOR(SbaXFormAdapter,NULL);
91 
92 }
93 
94 // -------------------------------------------------------------------------
95 SbaXFormAdapter::~SbaXFormAdapter()
96 {
97 
98     DBG_DTOR(SbaXFormAdapter,NULL);
99 }
100 
101 // -------------------------------------------------------------------------
102 Sequence< Type > SAL_CALL SbaXFormAdapter::getTypes(  ) throw (RuntimeException)
103 {
104 	return ::comphelper::concatSequences(
105 		SbaXFormAdapter_BASE1::getTypes(),
106 		SbaXFormAdapter_BASE2::getTypes(),
107 		SbaXFormAdapter_BASE3::getTypes()
108 	);
109 }
110 
111 // -------------------------------------------------------------------------
112 Sequence< sal_Int8 > SAL_CALL SbaXFormAdapter::getImplementationId(  ) throw (RuntimeException)
113 {
114 	static ::cppu::OImplementationId * pId = 0;
115 	if (! pId)
116 	{
117 		::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
118 		if (! pId)
119 		{
120 			static ::cppu::OImplementationId aId;
121 			pId = &aId;
122 		}
123 	}
124 	return pId->getImplementationId();
125 }
126 
127 // -------------------------------------------------------------------------
128 Any SAL_CALL SbaXFormAdapter::queryInterface(const Type& _rType) throw (RuntimeException)
129 {
130 	Any aReturn = SbaXFormAdapter_BASE1::queryInterface( _rType );
131 
132 	if (!aReturn.hasValue())
133 		aReturn = SbaXFormAdapter_BASE2::queryInterface( _rType );
134 
135 	if (!aReturn.hasValue())
136 		aReturn = SbaXFormAdapter_BASE3::queryInterface( _rType );
137 
138 	return aReturn;
139 }
140 
141 // -------------------------------------------------------------------------
142 void SbaXFormAdapter::StopListening()
143 {
144 	// log off all our multiplexers
145 	STOP_MULTIPLEXER_LISTENING(LoadListener, m_aLoadListeners, ::com::sun::star::form::XLoadable, m_xMainForm);
146 	STOP_MULTIPLEXER_LISTENING(RowSetListener, m_aRowSetListeners, ::com::sun::star::sdbc::XRowSet, m_xMainForm);
147 	STOP_MULTIPLEXER_LISTENING(RowSetApproveListener, m_aRowSetApproveListeners, ::com::sun::star::sdb::XRowSetApproveBroadcaster, m_xMainForm);
148 	STOP_MULTIPLEXER_LISTENING(SQLErrorListener, m_aErrorListeners, ::com::sun::star::sdb::XSQLErrorBroadcaster, m_xMainForm);
149 	STOP_MULTIPLEXER_LISTENING(SubmitListener, m_aSubmitListeners, ::com::sun::star::form::XSubmit, m_xMainForm);
150 	STOP_MULTIPLEXER_LISTENING(ResetListener, m_aResetListeners, ::com::sun::star::form::XReset, m_xMainForm);
151 
152 	if (m_aParameterListeners.getLength())
153 	{
154 		Reference< ::com::sun::star::form::XDatabaseParameterBroadcaster >  xBroadcaster(m_xMainForm, UNO_QUERY);
155 		if (xBroadcaster.is())
156 			xBroadcaster->removeParameterListener(&m_aParameterListeners);
157 	}
158 
159 	STOP_PROPERTY_MULTIPLEXER_LISTENING(PropertyChangeListener, m_aPropertyChangeListeners, ::com::sun::star::beans::XPropertySet, m_xMainForm);
160 	STOP_PROPERTY_MULTIPLEXER_LISTENING(VetoableChangeListener, m_aVetoablePropertyChangeListeners, ::com::sun::star::beans::XPropertySet, m_xMainForm);
161 	if (m_aPropertiesChangeListeners.getLength())
162 	{
163 		Reference< ::com::sun::star::beans::XMultiPropertySet >  xBroadcaster(m_xMainForm, UNO_QUERY);
164 		if (xBroadcaster.is())
165 			xBroadcaster->removePropertiesChangeListener(&m_aPropertiesChangeListeners);
166 	}
167 
168 	// log off ourself
169 	Reference< ::com::sun::star::lang::XComponent >  xComp(m_xMainForm, UNO_QUERY);
170 	if (xComp.is())
171 		xComp->removeEventListener((::com::sun::star::lang::XEventListener*)(::com::sun::star::beans::XPropertyChangeListener*)this);
172 }
173 
174 // -------------------------------------------------------------------------
175 void SbaXFormAdapter::StartListening()
176 {
177 	// log off all our multiplexers
178 	START_MULTIPLEXER_LISTENING(LoadListener, m_aLoadListeners, ::com::sun::star::form::XLoadable, m_xMainForm);
179 	START_MULTIPLEXER_LISTENING(RowSetListener, m_aRowSetListeners, ::com::sun::star::sdbc::XRowSet, m_xMainForm);
180 	START_MULTIPLEXER_LISTENING(RowSetApproveListener, m_aRowSetApproveListeners, ::com::sun::star::sdb::XRowSetApproveBroadcaster, m_xMainForm);
181 	START_MULTIPLEXER_LISTENING(SQLErrorListener, m_aErrorListeners, ::com::sun::star::sdb::XSQLErrorBroadcaster, m_xMainForm);
182 	START_MULTIPLEXER_LISTENING(SubmitListener, m_aSubmitListeners, ::com::sun::star::form::XSubmit, m_xMainForm);
183 	START_MULTIPLEXER_LISTENING(ResetListener, m_aResetListeners, ::com::sun::star::form::XReset, m_xMainForm);
184 
185 	if (m_aParameterListeners.getLength())
186 	{
187 		Reference< ::com::sun::star::form::XDatabaseParameterBroadcaster >  xBroadcaster(m_xMainForm, UNO_QUERY);
188 		if (xBroadcaster.is())
189 			xBroadcaster->addParameterListener(&m_aParameterListeners);
190 	}
191 
192 	START_PROPERTY_MULTIPLEXER_LISTENING(PropertyChangeListener, m_aPropertyChangeListeners, ::com::sun::star::beans::XPropertySet, m_xMainForm);
193 	START_PROPERTY_MULTIPLEXER_LISTENING(VetoableChangeListener, m_aVetoablePropertyChangeListeners, ::com::sun::star::beans::XPropertySet, m_xMainForm);
194 	if (m_aPropertiesChangeListeners.getLength())
195 	{
196 		Reference< ::com::sun::star::beans::XMultiPropertySet >  xBroadcaster(m_xMainForm, UNO_QUERY);
197 		::rtl::OUString sEmpty;
198 		if (xBroadcaster.is())
199 			xBroadcaster->addPropertiesChangeListener(::comphelper::StringSequence(&sEmpty, 1), &m_aPropertiesChangeListeners);
200 	}
201 
202 	// log off ourself
203 	Reference< ::com::sun::star::lang::XComponent >  xComp(m_xMainForm, UNO_QUERY);
204 	if (xComp.is())
205 		xComp->addEventListener((::com::sun::star::lang::XEventListener*)(::com::sun::star::beans::XPropertyChangeListener*)this);
206 }
207 
208 // -------------------------------------------------------------------------
209 void SbaXFormAdapter::AttachForm(const Reference< ::com::sun::star::sdbc::XRowSet >& xNewMaster)
210 {
211 	if (xNewMaster == m_xMainForm)
212 		return;
213 
214 	DBG_ASSERT(xNewMaster.get() != static_cast< ::com::sun::star::sdbc::XRowSet* >(this), "SbaXFormAdapter::AttachForm : invalid argument !");
215 
216 	if (m_xMainForm.is())
217 	{
218 		StopListening();
219 
220 		// if our old master is loaded we have to send an 'unloaded' event
221 		Reference< ::com::sun::star::form::XLoadable >  xLoadable(m_xMainForm, UNO_QUERY);
222 		if (xLoadable->isLoaded())
223 		{
224 			::com::sun::star::lang::EventObject aEvt(*this);
225 			::cppu::OInterfaceIteratorHelper aIt(m_aLoadListeners);
226 			while (aIt.hasMoreElements())
227 				((::com::sun::star::form::XLoadListener*)aIt.next())->unloaded(aEvt);
228 		}
229 	}
230 
231 	m_xMainForm = xNewMaster;
232 
233 	if (m_xMainForm.is())
234 	{
235 		StartListening();
236 
237 		// if our new master is loaded we have to send an 'loaded' event
238 		Reference< ::com::sun::star::form::XLoadable >  xLoadable(m_xMainForm, UNO_QUERY);
239 		if (xLoadable->isLoaded())
240 		{
241 			::com::sun::star::lang::EventObject aEvt(*this);
242 			::cppu::OInterfaceIteratorHelper aIt(m_aLoadListeners);
243 			while (aIt.hasMoreElements())
244 				((::com::sun::star::form::XLoadListener*)aIt.next())->loaded(aEvt);
245 		}
246 	}
247 
248 	// TODO : perhaps _all_ of our listeners should be notified about our new state
249 	// (nearly every aspect of us may have changed with new master form)
250 }
251 
252 // ::com::sun::star::sdbc::XCloseable
253 // -------------------------------------------------------------------------
254 void SAL_CALL SbaXFormAdapter::close() throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
255 {
256 	Reference< ::com::sun::star::sdbc::XCloseable >  xIface(m_xMainForm, UNO_QUERY);
257 	if (xIface.is())
258 		xIface->close();
259 }
260 
261 // ::com::sun::star::sdbc::XResultSetMetaDataSupplier
262 // -------------------------------------------------------------------------
263 Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL SbaXFormAdapter::getMetaData() throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
264 {
265 	Reference< ::com::sun::star::sdbc::XResultSetMetaDataSupplier >  xIface(m_xMainForm, UNO_QUERY);
266 	if (xIface.is())
267 		return xIface->getMetaData();
268 	return Reference< ::com::sun::star::sdbc::XResultSetMetaData > ();
269 }
270 
271 // ::com::sun::star::sdbc::XColumnLocate
272 // -------------------------------------------------------------------------
273 sal_Int32 SAL_CALL SbaXFormAdapter::findColumn(const ::rtl::OUString& columnName) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
274 {
275 	Reference< ::com::sun::star::sdbc::XColumnLocate >  xIface(m_xMainForm, UNO_QUERY);
276 	if (xIface.is())
277 		return xIface->findColumn(columnName);
278 	return 0;
279 }
280 
281 // ::com::sun::star::sdbcx::XColumnsSupplier
282 // -------------------------------------------------------------------------
283 Reference< ::com::sun::star::container::XNameAccess > SAL_CALL SbaXFormAdapter::getColumns() throw( RuntimeException )
284 {
285 	Reference< ::com::sun::star::sdbcx::XColumnsSupplier >  xIface(m_xMainForm, UNO_QUERY);
286 	if (xIface.is())
287 		return xIface->getColumns();
288 	return Reference< ::com::sun::star::container::XNameAccess > ();
289 }
290 
291 // ::com::sun::star::sdbc::XRow
292 // -------------------------------------------------------------------------
293 sal_Bool SAL_CALL SbaXFormAdapter::wasNull() throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
294 {
295 	Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
296 	if (xIface.is())
297 		return xIface->wasNull();
298 	return sal_True;
299 }
300 // -------------------------------------------------------------------------
301 ::rtl::OUString SAL_CALL SbaXFormAdapter::getString(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
302 {
303 	Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
304 	if (xIface.is())
305 		return xIface->getString(columnIndex);
306 	return ::rtl::OUString();
307 }
308 // -------------------------------------------------------------------------
309 sal_Bool SAL_CALL SbaXFormAdapter::getBoolean(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
310 {
311 	Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
312 	if (xIface.is())
313 		return xIface->getBoolean(columnIndex);
314 	return sal_False;
315 }
316 // -------------------------------------------------------------------------
317 sal_Int8 SAL_CALL SbaXFormAdapter::getByte(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
318 {
319 	Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
320 	if (xIface.is())
321 		return xIface->getByte(columnIndex);
322 	return 0;
323 }
324 // -------------------------------------------------------------------------
325 sal_Int16 SAL_CALL SbaXFormAdapter::getShort(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
326 {
327 	Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
328 	if (xIface.is())
329 		return xIface->getShort(columnIndex);
330 	return 0;
331 }
332 // -------------------------------------------------------------------------
333 sal_Int32 SAL_CALL SbaXFormAdapter::getInt(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
334 {
335 	Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
336 	if (xIface.is())
337 		return xIface->getInt(columnIndex);
338 	return 0;
339 }
340 // -------------------------------------------------------------------------
341 sal_Int64 SAL_CALL SbaXFormAdapter::getLong(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
342 {
343 	Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
344 	if (xIface.is())
345 		return xIface->getLong(columnIndex);
346 	return 0;
347 }
348 // -------------------------------------------------------------------------
349 float SAL_CALL SbaXFormAdapter::getFloat(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
350 {
351 	Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
352 	if (xIface.is())
353 		return xIface->getFloat(columnIndex);
354 	return 0.0;
355 }
356 // -------------------------------------------------------------------------
357 double SAL_CALL SbaXFormAdapter::getDouble(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
358 {
359 	Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
360 	if (xIface.is())
361 		return xIface->getDouble(columnIndex);
362 	return 0.0;
363 }
364 // -------------------------------------------------------------------------
365 Sequence< sal_Int8 > SAL_CALL SbaXFormAdapter::getBytes(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
366 {
367 	Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
368 	if (xIface.is())
369 		return xIface->getBytes(columnIndex);
370 	return Sequence <sal_Int8> ();
371 }
372 // -------------------------------------------------------------------------
373 ::com::sun::star::util::Date SAL_CALL SbaXFormAdapter::getDate(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
374 {
375 	Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
376 	if (xIface.is())
377 		return xIface->getDate(columnIndex);
378 	return ::com::sun::star::util::Date();
379 }
380 // -------------------------------------------------------------------------
381 ::com::sun::star::util::Time SAL_CALL SbaXFormAdapter::getTime(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
382 {
383 	Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
384 	if (xIface.is())
385 		return xIface->getTime(columnIndex);
386 	return ::com::sun::star::util::Time();
387 }
388 // -------------------------------------------------------------------------
389 ::com::sun::star::util::DateTime SAL_CALL SbaXFormAdapter::getTimestamp(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
390 {
391 	Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
392 	if (xIface.is())
393 		return xIface->getTimestamp(columnIndex);
394 	return ::com::sun::star::util::DateTime();
395 }
396 // -------------------------------------------------------------------------
397 Reference< ::com::sun::star::io::XInputStream > SAL_CALL SbaXFormAdapter::getBinaryStream(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
398 {
399 	Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
400 	if (xIface.is())
401 		return xIface->getBinaryStream(columnIndex);
402 	return Reference< ::com::sun::star::io::XInputStream > ();
403 }
404 // -------------------------------------------------------------------------
405 Reference< ::com::sun::star::io::XInputStream > SAL_CALL SbaXFormAdapter::getCharacterStream(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
406 {
407 	Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
408 	if (xIface.is())
409 		return xIface->getCharacterStream(columnIndex);
410 	return Reference< ::com::sun::star::io::XInputStream > ();
411 }
412 // -------------------------------------------------------------------------
413 Any SAL_CALL SbaXFormAdapter::getObject(sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& typeMap) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
414 {
415 	Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
416 	if (xIface.is())
417 		return xIface->getObject(columnIndex, typeMap);
418 	return Any();
419 }
420 // -------------------------------------------------------------------------
421 Reference< ::com::sun::star::sdbc::XRef > SAL_CALL SbaXFormAdapter::getRef(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
422 {
423 	Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
424 	if (xIface.is())
425 		return xIface->getRef(columnIndex);
426 	return Reference< ::com::sun::star::sdbc::XRef > ();
427 }
428 // -------------------------------------------------------------------------
429 Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL SbaXFormAdapter::getBlob(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
430 {
431 	Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
432 	if (xIface.is())
433 		return xIface->getBlob(columnIndex);
434 	return Reference< ::com::sun::star::sdbc::XBlob > ();
435 }
436 // -------------------------------------------------------------------------
437 Reference< ::com::sun::star::sdbc::XClob > SAL_CALL SbaXFormAdapter::getClob(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
438 {
439 	Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
440 	if (xIface.is())
441 		return xIface->getClob(columnIndex);
442 	return Reference< ::com::sun::star::sdbc::XClob > ();
443 }
444 // -------------------------------------------------------------------------
445 Reference< ::com::sun::star::sdbc::XArray > SAL_CALL SbaXFormAdapter::getArray(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
446 {
447 	Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
448 	if (xIface.is())
449 		return xIface->getArray(columnIndex);
450 	return Reference< ::com::sun::star::sdbc::XArray > ();
451 }
452 
453 // ::com::sun::star::sdbcx::XRowLocate
454 // -------------------------------------------------------------------------
455 Any SAL_CALL SbaXFormAdapter::getBookmark() throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
456 {
457 	Reference< ::com::sun::star::sdbcx::XRowLocate >  xIface(m_xMainForm, UNO_QUERY);
458 	if (xIface.is())
459 		return xIface->getBookmark();
460 	return Any();
461 }
462 // -------------------------------------------------------------------------
463 sal_Bool SAL_CALL SbaXFormAdapter::moveToBookmark(const Any& bookmark) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
464 {
465 	Reference< ::com::sun::star::sdbcx::XRowLocate >  xIface(m_xMainForm, UNO_QUERY);
466 	if (xIface.is())
467 		return xIface->moveToBookmark(bookmark);
468 	return sal_False;
469 }
470 // -------------------------------------------------------------------------
471 sal_Bool SAL_CALL SbaXFormAdapter::moveRelativeToBookmark(const Any& bookmark, sal_Int32 rows) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
472 {
473 	Reference< ::com::sun::star::sdbcx::XRowLocate >  xIface(m_xMainForm, UNO_QUERY);
474 	if (xIface.is())
475 		return xIface->moveRelativeToBookmark(bookmark,rows);
476 	return sal_False;
477 }
478 // -------------------------------------------------------------------------
479 sal_Int32 SAL_CALL SbaXFormAdapter::compareBookmarks(const Any& _first, const Any& _second) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
480 {
481 	Reference< ::com::sun::star::sdbcx::XRowLocate >  xIface(m_xMainForm, UNO_QUERY);
482 	if (xIface.is())
483 		return xIface->compareBookmarks(_first, _second);
484 	return 0;
485 }
486 
487 // -------------------------------------------------------------------------
488 sal_Bool SAL_CALL SbaXFormAdapter::hasOrderedBookmarks() throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
489 {
490 	Reference< ::com::sun::star::sdbcx::XRowLocate >  xIface(m_xMainForm, UNO_QUERY);
491 	if (xIface.is())
492 		return xIface->hasOrderedBookmarks();
493 	return sal_False;
494 }
495 
496 // -------------------------------------------------------------------------
497 sal_Int32 SAL_CALL SbaXFormAdapter::hashBookmark(const Any& bookmark) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
498 {
499 	Reference< ::com::sun::star::sdbcx::XRowLocate >  xIface(m_xMainForm, UNO_QUERY);
500 	if (xIface.is())
501 		return xIface->hashBookmark(bookmark);
502 	return 0;
503 }
504 
505 // ::com::sun::star::sdbc::XRowUpdate
506 // -------------------------------------------------------------------------
507 void SAL_CALL SbaXFormAdapter::updateNull(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
508 {
509 	Reference< ::com::sun::star::sdbc::XRowUpdate >  xIface(m_xMainForm, UNO_QUERY);
510 	if (xIface.is())
511 		xIface->updateNull(columnIndex);
512 }
513 // -------------------------------------------------------------------------
514 void SAL_CALL SbaXFormAdapter::updateBoolean(sal_Int32 columnIndex, sal_Bool x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
515 {
516 	Reference< ::com::sun::star::sdbc::XRowUpdate >  xIface(m_xMainForm, UNO_QUERY);
517 	if (xIface.is())
518 		xIface->updateBoolean(columnIndex, x);
519 }
520 // -------------------------------------------------------------------------
521 void SAL_CALL SbaXFormAdapter::updateByte(sal_Int32 columnIndex, sal_Int8 x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
522 {
523 	Reference< ::com::sun::star::sdbc::XRowUpdate >  xIface(m_xMainForm, UNO_QUERY);
524 	if (xIface.is())
525 		xIface->updateByte(columnIndex, x);
526 }
527 // -------------------------------------------------------------------------
528 void SAL_CALL SbaXFormAdapter::updateShort(sal_Int32 columnIndex, sal_Int16 x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
529 {
530 	Reference< ::com::sun::star::sdbc::XRowUpdate >  xIface(m_xMainForm, UNO_QUERY);
531 	if (xIface.is())
532 		xIface->updateShort(columnIndex, x);
533 }
534 // -------------------------------------------------------------------------
535 void SAL_CALL SbaXFormAdapter::updateInt(sal_Int32 columnIndex, sal_Int32 x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
536 {
537 	Reference< ::com::sun::star::sdbc::XRowUpdate >  xIface(m_xMainForm, UNO_QUERY);
538 	if (xIface.is())
539 		xIface->updateInt(columnIndex, x);
540 }
541 // -------------------------------------------------------------------------
542 void SAL_CALL SbaXFormAdapter::updateLong(sal_Int32 columnIndex, sal_Int64 x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
543 {
544 	Reference< ::com::sun::star::sdbc::XRowUpdate >  xIface(m_xMainForm, UNO_QUERY);
545 	if (xIface.is())
546 		xIface->updateLong(columnIndex, x);
547 }
548 // -------------------------------------------------------------------------
549 void SAL_CALL SbaXFormAdapter::updateFloat(sal_Int32 columnIndex, float x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
550 {
551 	Reference< ::com::sun::star::sdbc::XRowUpdate >  xIface(m_xMainForm, UNO_QUERY);
552 	if (xIface.is())
553 		xIface->updateFloat(columnIndex, x);
554 }
555 // -------------------------------------------------------------------------
556 void SAL_CALL SbaXFormAdapter::updateDouble(sal_Int32 columnIndex, double x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
557 {
558 	Reference< ::com::sun::star::sdbc::XRowUpdate >  xIface(m_xMainForm, UNO_QUERY);
559 	if (xIface.is())
560 		xIface->updateDouble(columnIndex, x);
561 }
562 // -------------------------------------------------------------------------
563 void SAL_CALL SbaXFormAdapter::updateString(sal_Int32 columnIndex, const ::rtl::OUString& x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
564 {
565 	Reference< ::com::sun::star::sdbc::XRowUpdate >  xIface(m_xMainForm, UNO_QUERY);
566 	if (xIface.is())
567 		xIface->updateString(columnIndex, x);
568 }
569 // -------------------------------------------------------------------------
570 void SAL_CALL SbaXFormAdapter::updateBytes(sal_Int32 columnIndex, const Sequence< sal_Int8 >& x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
571 {
572 	Reference< ::com::sun::star::sdbc::XRowUpdate >  xIface(m_xMainForm, UNO_QUERY);
573 	if (xIface.is())
574 		xIface->updateBytes(columnIndex, x);
575 }
576 // -------------------------------------------------------------------------
577 void SAL_CALL SbaXFormAdapter::updateDate(sal_Int32 columnIndex, const ::com::sun::star::util::Date& x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
578 {
579 	Reference< ::com::sun::star::sdbc::XRowUpdate >  xIface(m_xMainForm, UNO_QUERY);
580 	if (xIface.is())
581 		xIface->updateDate(columnIndex, x);
582 }
583 // -------------------------------------------------------------------------
584 void SAL_CALL SbaXFormAdapter::updateTime(sal_Int32 columnIndex, const ::com::sun::star::util::Time& x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
585 {
586 	Reference< ::com::sun::star::sdbc::XRowUpdate >  xIface(m_xMainForm, UNO_QUERY);
587 	if (xIface.is())
588 		xIface->updateTime(columnIndex, x);
589 }
590 // -------------------------------------------------------------------------
591 void SAL_CALL SbaXFormAdapter::updateTimestamp(sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
592 {
593 	Reference< ::com::sun::star::sdbc::XRowUpdate >  xIface(m_xMainForm, UNO_QUERY);
594 	if (xIface.is())
595 		xIface->updateTimestamp(columnIndex, x);
596 }
597 // -------------------------------------------------------------------------
598 void SAL_CALL SbaXFormAdapter::updateBinaryStream(sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
599 {
600 	Reference< ::com::sun::star::sdbc::XRowUpdate >  xIface(m_xMainForm, UNO_QUERY);
601 	if (xIface.is())
602 		xIface->updateBinaryStream(columnIndex, x, length);
603 }
604 // -------------------------------------------------------------------------
605 void SAL_CALL SbaXFormAdapter::updateCharacterStream(sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
606 {
607 	Reference< ::com::sun::star::sdbc::XRowUpdate >  xIface(m_xMainForm, UNO_QUERY);
608 	if (xIface.is())
609 		xIface->updateCharacterStream(columnIndex, x, length);
610 }
611 // -------------------------------------------------------------------------
612 void SAL_CALL SbaXFormAdapter::updateObject(sal_Int32 columnIndex, const Any& x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
613 {
614 	Reference< ::com::sun::star::sdbc::XRowUpdate >  xIface(m_xMainForm, UNO_QUERY);
615 	if (xIface.is())
616 		xIface->updateObject(columnIndex, x);
617 }
618 // -------------------------------------------------------------------------
619 void SAL_CALL SbaXFormAdapter::updateNumericObject(sal_Int32 columnIndex, const Any& x, sal_Int32 scale) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
620 {
621 	Reference< ::com::sun::star::sdbc::XRowUpdate >  xIface(m_xMainForm, UNO_QUERY);
622 	if (xIface.is())
623 		xIface->updateNumericObject(columnIndex, x, scale);
624 }
625 
626 // ::com::sun::star::sdbc::XResultSet
627 // -------------------------------------------------------------------------
628 sal_Bool SAL_CALL SbaXFormAdapter::next() throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
629 {
630 	if (m_xMainForm.is())
631 		return m_xMainForm->next();
632 	return sal_False;
633 }
634 // -------------------------------------------------------------------------
635 sal_Bool SAL_CALL SbaXFormAdapter::isBeforeFirst() throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
636 {
637 	if (m_xMainForm.is())
638 		return m_xMainForm->isBeforeFirst();
639 	return sal_False;
640 }
641 // -------------------------------------------------------------------------
642 sal_Bool SAL_CALL SbaXFormAdapter::isAfterLast() throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
643 {
644 	if (m_xMainForm.is())
645 		return m_xMainForm->isAfterLast();
646 	return sal_False;
647 }
648 // -------------------------------------------------------------------------
649 sal_Bool SAL_CALL SbaXFormAdapter::isFirst() throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
650 {
651 	if (m_xMainForm.is())
652 		return m_xMainForm->isFirst();
653 	return sal_False;
654 }
655 // -------------------------------------------------------------------------
656 sal_Bool SAL_CALL SbaXFormAdapter::isLast() throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
657 {
658 	if (m_xMainForm.is())
659 		return m_xMainForm->isLast();
660 	return sal_False;
661 }
662 // -------------------------------------------------------------------------
663 void SAL_CALL SbaXFormAdapter::beforeFirst() throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
664 {
665 	if (m_xMainForm.is())
666 		m_xMainForm->beforeFirst();
667 }
668 // -------------------------------------------------------------------------
669 void SAL_CALL SbaXFormAdapter::afterLast() throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
670 {
671 	if (m_xMainForm.is())
672 		m_xMainForm->afterLast();
673 }
674 // -------------------------------------------------------------------------
675 sal_Bool SAL_CALL SbaXFormAdapter::first() throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
676 {
677 	if (m_xMainForm.is())
678 		return m_xMainForm->first();
679 	return sal_False;
680 }
681 // -------------------------------------------------------------------------
682 sal_Bool SAL_CALL SbaXFormAdapter::last() throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
683 {
684 	if (m_xMainForm.is())
685 		return m_xMainForm->last();
686 	return sal_False;
687 }
688 // -------------------------------------------------------------------------
689 sal_Int32 SAL_CALL SbaXFormAdapter::getRow() throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
690 {
691 	if (m_xMainForm.is())
692 		return m_xMainForm->getRow();
693 	return sal_False;
694 }
695 // -------------------------------------------------------------------------
696 sal_Bool SAL_CALL SbaXFormAdapter::absolute(sal_Int32 row) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
697 {
698 	if (m_xMainForm.is())
699 		return m_xMainForm->absolute(row);
700 	return sal_False;
701 }
702 // -------------------------------------------------------------------------
703 sal_Bool SAL_CALL SbaXFormAdapter::relative(sal_Int32 rows) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
704 {
705 	if (m_xMainForm.is())
706 		return m_xMainForm->relative(rows);
707 	return sal_False;
708 }
709 // -------------------------------------------------------------------------
710 sal_Bool SAL_CALL SbaXFormAdapter::previous() throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
711 {
712 	if (m_xMainForm.is())
713 		return m_xMainForm->previous();
714 	return sal_False;
715 }
716 // -------------------------------------------------------------------------
717 void SAL_CALL SbaXFormAdapter::refreshRow() throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
718 {
719 	if (m_xMainForm.is())
720 		m_xMainForm->refreshRow();
721 }
722 
723 // -------------------------------------------------------------------------
724 sal_Bool SAL_CALL SbaXFormAdapter::rowUpdated() throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
725 {
726 	if (m_xMainForm.is())
727 		return m_xMainForm->rowUpdated();
728 	return sal_False;
729 }
730 // -------------------------------------------------------------------------
731 sal_Bool SAL_CALL SbaXFormAdapter::rowInserted() throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
732 {
733 	if (m_xMainForm.is())
734 		return m_xMainForm->rowInserted();
735 	return sal_False;
736 }
737 // -------------------------------------------------------------------------
738 sal_Bool SAL_CALL SbaXFormAdapter::rowDeleted() throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
739 {
740 	if (m_xMainForm.is())
741 		return m_xMainForm->rowDeleted();
742 	return sal_False;
743 }
744 // -------------------------------------------------------------------------
745 Reference< XInterface > SAL_CALL SbaXFormAdapter::getStatement() throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
746 {
747 	if (m_xMainForm.is())
748 		return m_xMainForm->getStatement();
749 	return NULL;
750 }
751 
752 // ::com::sun::star::sdbc::XResultSetUpdate
753 // -------------------------------------------------------------------------
754 void SAL_CALL SbaXFormAdapter::insertRow() throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
755 {
756 	Reference< ::com::sun::star::sdbc::XResultSetUpdate >  xIface(m_xMainForm, UNO_QUERY);
757 	if (xIface.is())
758 		xIface->insertRow();
759 }
760 // -------------------------------------------------------------------------
761 void SAL_CALL SbaXFormAdapter::updateRow() throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
762 {
763 	Reference< ::com::sun::star::sdbc::XResultSetUpdate >  xIface(m_xMainForm, UNO_QUERY);
764 	if (xIface.is())
765 		xIface->updateRow();
766 }
767 // -------------------------------------------------------------------------
768 void SAL_CALL SbaXFormAdapter::deleteRow() throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
769 {
770 	Reference< ::com::sun::star::sdbc::XResultSetUpdate >  xIface(m_xMainForm, UNO_QUERY);
771 	if (xIface.is())
772 		xIface->deleteRow();
773 }
774 // -------------------------------------------------------------------------
775 void SAL_CALL SbaXFormAdapter::cancelRowUpdates() throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
776 {
777 	Reference< ::com::sun::star::sdbc::XResultSetUpdate >  xIface(m_xMainForm, UNO_QUERY);
778 	if (xIface.is())
779 		xIface->cancelRowUpdates();
780 }
781 // -------------------------------------------------------------------------
782 void SAL_CALL SbaXFormAdapter::moveToInsertRow() throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
783 {
784 	Reference< ::com::sun::star::sdbc::XResultSetUpdate >  xIface(m_xMainForm, UNO_QUERY);
785 	if (xIface.is())
786 		xIface->moveToInsertRow();
787 }
788 // -------------------------------------------------------------------------
789 void SAL_CALL SbaXFormAdapter::moveToCurrentRow() throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
790 {
791 	Reference< ::com::sun::star::sdbc::XResultSetUpdate >  xIface(m_xMainForm, UNO_QUERY);
792 	if (xIface.is())
793 		xIface->moveToCurrentRow();
794 }
795 
796 // ::com::sun::star::sdbc::XRowSet
797 // -------------------------------------------------------------------------
798 void SAL_CALL SbaXFormAdapter::execute() throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
799 {
800 	if (m_xMainForm.is())
801 		m_xMainForm->execute();
802 }
803 // -------------------------------------------------------------------------
804 IMPLEMENT_LISTENER_ADMINISTRATION(SbaXFormAdapter, sdbc, RowSetListener, m_aRowSetListeners, ::com::sun::star::sdbc::XRowSet, m_xMainForm)
805 
806 // ::com::sun::star::sdbcx::XDeleteRows
807 // -------------------------------------------------------------------------
808 Sequence<sal_Int32> SAL_CALL SbaXFormAdapter::deleteRows(const Sequence< Any >& rows) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
809 {
810 	Reference< ::com::sun::star::sdbcx::XDeleteRows >  xIface(m_xMainForm, UNO_QUERY);
811 	if (xIface.is())
812 		return xIface->deleteRows(rows);
813 	return Sequence<sal_Int32>();
814 }
815 
816 // ::com::sun::star::sdbc::XWarningsSupplier
817 // -------------------------------------------------------------------------
818 Any SAL_CALL SbaXFormAdapter::getWarnings() throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
819 {
820 	Reference< ::com::sun::star::sdbc::XWarningsSupplier >  xIface(m_xMainForm, UNO_QUERY);
821 	if (xIface.is())
822 		return xIface->getWarnings();
823 	return Any();
824 }
825 // -------------------------------------------------------------------------
826 void SAL_CALL SbaXFormAdapter::clearWarnings() throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
827 {
828 	Reference< ::com::sun::star::sdbc::XWarningsSupplier >  xIface(m_xMainForm, UNO_QUERY);
829 	if (xIface.is())
830 		xIface->clearWarnings();
831 }
832 
833 // ::com::sun::star::sdb::XRowSetApproveBroadcaster
834 // -------------------------------------------------------------------------
835 IMPLEMENT_LISTENER_ADMINISTRATION(SbaXFormAdapter, sdb, RowSetApproveListener, m_aRowSetApproveListeners, ::com::sun::star::sdb::XRowSetApproveBroadcaster, m_xMainForm)
836 
837 // com::sun::star::sdbc::XSQLErrorBroadcaster
838 // -------------------------------------------------------------------------
839 IMPLEMENT_LISTENER_ADMINISTRATION(SbaXFormAdapter, sdb, SQLErrorListener, m_aErrorListeners, ::com::sun::star::sdb::XSQLErrorBroadcaster, m_xMainForm)
840 
841 // ::com::sun::star::sdb::XResultSetAccess
842 // -------------------------------------------------------------------------
843 Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL SbaXFormAdapter::createResultSet() throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
844 {
845 	Reference< ::com::sun::star::sdb::XResultSetAccess >  xIface(m_xMainForm, UNO_QUERY);
846 	if (xIface.is())
847 		return xIface->createResultSet();
848 	return Reference< ::com::sun::star::sdbc::XResultSet > ();
849 }
850 
851 // com::sun::star::form::XLoadable
852 // -------------------------------------------------------------------------
853 void SAL_CALL SbaXFormAdapter::load() throw( RuntimeException )
854 {
855 	Reference< ::com::sun::star::form::XLoadable >  xIface(m_xMainForm, UNO_QUERY);
856 	if (xIface.is())
857 		xIface->load();
858 }
859 // -------------------------------------------------------------------------
860 void SAL_CALL SbaXFormAdapter::unload() throw( RuntimeException )
861 {
862 	Reference< ::com::sun::star::form::XLoadable >  xIface(m_xMainForm, UNO_QUERY);
863 	if (xIface.is())
864 		xIface->unload();
865 }
866 // -------------------------------------------------------------------------
867 void SAL_CALL SbaXFormAdapter::reload() throw( RuntimeException )
868 {
869 	Reference< ::com::sun::star::form::XLoadable >  xIface(m_xMainForm, UNO_QUERY);
870 	if (xIface.is())
871 		xIface->reload();
872 }
873 // -------------------------------------------------------------------------
874 sal_Bool SAL_CALL SbaXFormAdapter::isLoaded() throw( RuntimeException )
875 {
876 	Reference< ::com::sun::star::form::XLoadable >  xIface(m_xMainForm, UNO_QUERY);
877 	if (xIface.is())
878 		return xIface->isLoaded();
879 	return sal_False;
880 }
881 // -------------------------------------------------------------------------
882 IMPLEMENT_LISTENER_ADMINISTRATION(SbaXFormAdapter, form, LoadListener, m_aLoadListeners, ::com::sun::star::form::XLoadable, m_xMainForm)
883 
884 // ::com::sun::star::sdbc::XParameters
885 // -------------------------------------------------------------------------
886 void SAL_CALL SbaXFormAdapter::setNull(sal_Int32 parameterIndex, sal_Int32 sqlType) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
887 {
888 	Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
889 	if (xIface.is())
890 		xIface->setNull(parameterIndex, sqlType);
891 }
892 // -------------------------------------------------------------------------
893 void SAL_CALL SbaXFormAdapter::setObjectNull(sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
894 {
895 	Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
896 	if (xIface.is())
897 		xIface->setObjectNull(parameterIndex, sqlType, typeName);
898 }
899 // -------------------------------------------------------------------------
900 void SAL_CALL SbaXFormAdapter::setBoolean(sal_Int32 parameterIndex, sal_Bool x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
901 {
902 	Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
903 	if (xIface.is())
904 		xIface->setBoolean(parameterIndex, x);
905 }
906 // -------------------------------------------------------------------------
907 void SAL_CALL SbaXFormAdapter::setByte(sal_Int32 parameterIndex, sal_Int8 x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
908 {
909 	Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
910 	if (xIface.is())
911 		xIface->setByte(parameterIndex, x);
912 }
913 // -------------------------------------------------------------------------
914 void SAL_CALL SbaXFormAdapter::setShort(sal_Int32 parameterIndex, sal_Int16 x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
915 {
916 	Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
917 	if (xIface.is())
918 		xIface->setShort(parameterIndex, x);
919 }
920 // -------------------------------------------------------------------------
921 void SAL_CALL SbaXFormAdapter::setInt(sal_Int32 parameterIndex, sal_Int32 x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
922 {
923 	Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
924 	if (xIface.is())
925 		xIface->setInt(parameterIndex, x);
926 }
927 // -------------------------------------------------------------------------
928 void SAL_CALL SbaXFormAdapter::setLong(sal_Int32 parameterIndex, sal_Int64 x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
929 {
930 	Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
931 	if (xIface.is())
932 		xIface->setLong(parameterIndex, x);
933 }
934 // -------------------------------------------------------------------------
935 void SAL_CALL SbaXFormAdapter::setFloat(sal_Int32 parameterIndex, float x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
936 {
937 	Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
938 	if (xIface.is())
939 		xIface->setFloat(parameterIndex, x);
940 }
941 // -------------------------------------------------------------------------
942 void SAL_CALL SbaXFormAdapter::setDouble(sal_Int32 parameterIndex, double x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
943 {
944 	Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
945 	if (xIface.is())
946 		xIface->setDouble(parameterIndex, x);
947 }
948 // -------------------------------------------------------------------------
949 void SAL_CALL SbaXFormAdapter::setString(sal_Int32 parameterIndex, const ::rtl::OUString& x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
950 {
951 	Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
952 	if (xIface.is())
953 		xIface->setString(parameterIndex, x);
954 }
955 // -------------------------------------------------------------------------
956 void SAL_CALL SbaXFormAdapter::setBytes(sal_Int32 parameterIndex, const Sequence< sal_Int8 >& x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
957 {
958 	Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
959 	if (xIface.is())
960 		xIface->setBytes(parameterIndex, x);
961 }
962 // -------------------------------------------------------------------------
963 void SAL_CALL SbaXFormAdapter::setDate(sal_Int32 parameterIndex, const ::com::sun::star::util::Date& x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
964 {
965 	Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
966 	if (xIface.is())
967 		xIface->setDate(parameterIndex, x);
968 }
969 // -------------------------------------------------------------------------
970 void SAL_CALL SbaXFormAdapter::setTime(sal_Int32 parameterIndex, const ::com::sun::star::util::Time& x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
971 {
972 	Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
973 	if (xIface.is())
974 		xIface->setTime(parameterIndex, x);
975 }
976 // -------------------------------------------------------------------------
977 void SAL_CALL SbaXFormAdapter::setTimestamp(sal_Int32 parameterIndex, const ::com::sun::star::util::DateTime& x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
978 {
979 	Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
980 	if (xIface.is())
981 		xIface->setTimestamp(parameterIndex, x);
982 }
983 // -------------------------------------------------------------------------
984 void SAL_CALL SbaXFormAdapter::setBinaryStream(sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
985 {
986 	Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
987 	if (xIface.is())
988 		xIface->setBinaryStream(parameterIndex, x, length);
989 }
990 // -------------------------------------------------------------------------
991 void SAL_CALL SbaXFormAdapter::setCharacterStream(sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
992 {
993 	Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
994 	if (xIface.is())
995 		xIface->setCharacterStream(parameterIndex, x, length);
996 }
997 // -------------------------------------------------------------------------
998 void SAL_CALL SbaXFormAdapter::setObject(sal_Int32 parameterIndex, const Any& x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
999 {
1000 	Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
1001 	if (xIface.is())
1002 		xIface->setObject(parameterIndex, x);
1003 }
1004 // -------------------------------------------------------------------------
1005 void SAL_CALL SbaXFormAdapter::setObjectWithInfo(sal_Int32 parameterIndex, const Any& x, sal_Int32 targetSqlType, sal_Int32 scale) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
1006 {
1007 	Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
1008 	if (xIface.is())
1009 		xIface->setObjectWithInfo(parameterIndex, x, targetSqlType, scale);
1010 }
1011 // -------------------------------------------------------------------------
1012 void SAL_CALL SbaXFormAdapter::setRef(sal_Int32 parameterIndex, const Reference< ::com::sun::star::sdbc::XRef >& x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
1013 {
1014 	Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
1015 	if (xIface.is())
1016 		xIface->setRef(parameterIndex, x);
1017 }
1018 // -------------------------------------------------------------------------
1019 void SAL_CALL SbaXFormAdapter::setBlob(sal_Int32 parameterIndex, const Reference< ::com::sun::star::sdbc::XBlob >& x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
1020 {
1021 	Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
1022 	if (xIface.is())
1023 		xIface->setBlob(parameterIndex, x);
1024 }
1025 // -------------------------------------------------------------------------
1026 void SAL_CALL SbaXFormAdapter::setClob(sal_Int32 parameterIndex, const Reference< ::com::sun::star::sdbc::XClob >& x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
1027 {
1028 	Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
1029 	if (xIface.is())
1030 		xIface->setClob(parameterIndex, x);
1031 }
1032 // -------------------------------------------------------------------------
1033 void SAL_CALL SbaXFormAdapter::setArray(sal_Int32 parameterIndex, const Reference< ::com::sun::star::sdbc::XArray >& x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
1034 {
1035 	Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
1036 	if (xIface.is())
1037 		xIface->setArray(parameterIndex, x);
1038 }
1039 // -------------------------------------------------------------------------
1040 void SAL_CALL SbaXFormAdapter::clearParameters() throw( ::com::sun::star::sdbc::SQLException, RuntimeException )
1041 {
1042 	Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
1043 	if (xIface.is())
1044 		xIface->clearParameters();
1045 }
1046 
1047 // ::com::sun::star::form::XDatabaseParameterBroadcaster
1048 // -------------------------------------------------------------------------
1049 void SAL_CALL SbaXFormAdapter::addParameterListener(const Reference< ::com::sun::star::form::XDatabaseParameterListener >& aListener) throw( RuntimeException )
1050 {
1051 	m_aParameterListeners.addInterface(aListener);
1052 	if (m_aParameterListeners.getLength() == 1)
1053 	{
1054 		Reference< ::com::sun::star::form::XDatabaseParameterBroadcaster >  xBroadcaster(m_xMainForm, UNO_QUERY);
1055 		if (xBroadcaster.is())
1056 			xBroadcaster->addParameterListener(&m_aParameterListeners);
1057 	}
1058 }
1059 
1060 // -------------------------------------------------------------------------
1061 void SAL_CALL SbaXFormAdapter::removeParameterListener(const Reference< ::com::sun::star::form::XDatabaseParameterListener >& aListener) throw( RuntimeException )
1062 {
1063 	if (m_aParameterListeners.getLength() == 1)
1064 	{
1065 		Reference< ::com::sun::star::form::XDatabaseParameterBroadcaster >  xBroadcaster(m_xMainForm, UNO_QUERY);
1066 		if (xBroadcaster.is())
1067 			xBroadcaster->removeParameterListener(&m_aParameterListeners);
1068 	}
1069 	m_aParameterListeners.removeInterface(aListener);
1070 }
1071 
1072 // ::com::sun::star::container::XChild
1073 // -------------------------------------------------------------------------
1074 Reference< XInterface > SAL_CALL SbaXFormAdapter::getParent() throw( RuntimeException )
1075 {
1076 	return m_xParent;
1077 }
1078 
1079 // -------------------------------------------------------------------------
1080 void SAL_CALL SbaXFormAdapter::setParent(const Reference< XInterface >& Parent) throw( ::com::sun::star::lang::NoSupportException, RuntimeException )
1081 {
1082 	m_xParent = Parent;
1083 }
1084 
1085 // ::com::sun::star::form::XSubmit
1086 // -------------------------------------------------------------------------
1087 void SAL_CALL SbaXFormAdapter::submit(const Reference< ::com::sun::star::awt::XControl >& aControl, const ::com::sun::star::awt::MouseEvent& aMouseEvt) throw( RuntimeException )
1088 {
1089 	Reference< ::com::sun::star::form::XSubmit >  xSubmit(m_xMainForm, UNO_QUERY);
1090 	if (xSubmit.is())
1091 		xSubmit->submit(aControl, aMouseEvt);
1092 }
1093 
1094 IMPLEMENT_LISTENER_ADMINISTRATION(SbaXFormAdapter, form, SubmitListener, m_aSubmitListeners, ::com::sun::star::form::XSubmit, m_xMainForm)
1095 
1096 // ::com::sun::star::awt::XTabControllerModel
1097 // -------------------------------------------------------------------------
1098 sal_Bool SAL_CALL SbaXFormAdapter::getGroupControl() throw( RuntimeException )
1099 {
1100 	DBG_ERROR("SAL_CALL SbaXFormAdapter::getGroupControl : not supported !");
1101 	return sal_False;
1102 }
1103 
1104 // -------------------------------------------------------------------------
1105 void SAL_CALL SbaXFormAdapter::setGroupControl(sal_Bool /*GroupControl*/) throw( RuntimeException )
1106 {
1107 	DBG_ERROR("SAL_CALL SbaXFormAdapter::setGroupControl : not supported !");
1108 }
1109 
1110 // -------------------------------------------------------------------------
1111 void SAL_CALL SbaXFormAdapter::setControlModels(const Sequence< Reference< ::com::sun::star::awt::XControlModel >  >& /*Controls*/) throw( RuntimeException )
1112 {
1113 	DBG_ERROR("SAL_CALL SbaXFormAdapter::setControlModels : not supported !");
1114 }
1115 
1116 // -------------------------------------------------------------------------
1117 Sequence< Reference< ::com::sun::star::awt::XControlModel > > SAL_CALL SbaXFormAdapter::getControlModels() throw( RuntimeException )
1118 {
1119 	DBG_ERROR("SAL_CALL SbaXFormAdapter::getControlModels : not supported !");
1120 	return Sequence< Reference< ::com::sun::star::awt::XControlModel > >();
1121 }
1122 
1123 // -------------------------------------------------------------------------
1124 void SAL_CALL SbaXFormAdapter::setGroup(const Sequence< Reference< ::com::sun::star::awt::XControlModel >  >& /*_rGroup*/, const ::rtl::OUString& /*GroupName*/) throw( RuntimeException )
1125 {
1126 	DBG_ERROR("SAL_CALL SbaXFormAdapter::setGroup : not supported !");
1127 }
1128 
1129 // -------------------------------------------------------------------------
1130 sal_Int32 SAL_CALL SbaXFormAdapter::getGroupCount() throw( RuntimeException )
1131 {
1132 	DBG_ERROR("SAL_CALL SbaXFormAdapter::getGroupCount : not supported !");
1133 	return 0;
1134 }
1135 
1136 // -------------------------------------------------------------------------
1137 void SAL_CALL SbaXFormAdapter::getGroup(sal_Int32 /*nGroup*/, Sequence< Reference< ::com::sun::star::awt::XControlModel >  >& /*_rGroup*/, ::rtl::OUString& /*Name*/) throw( RuntimeException )
1138 {
1139 	DBG_ERROR("SAL_CALL SbaXFormAdapter::getGroup : not supported !");
1140 }
1141 
1142 // -------------------------------------------------------------------------
1143 void SAL_CALL SbaXFormAdapter::getGroupByName(const ::rtl::OUString& /*Name*/, Sequence< Reference< ::com::sun::star::awt::XControlModel >  >& /*_rGroup*/) throw( RuntimeException )
1144 {
1145 	DBG_ERROR("SAL_CALL SbaXFormAdapter::getGroupByName : not supported !");
1146 }
1147 
1148 // ::com::sun::star::lang::XComponent
1149 // -------------------------------------------------------------------------
1150 void SAL_CALL SbaXFormAdapter::dispose() throw( RuntimeException )
1151 {
1152 	// log off all multiplexers
1153 	if (m_xMainForm.is())
1154 		StopListening();
1155 
1156 	::com::sun::star::lang::EventObject aEvt(*this);
1157 	m_aLoadListeners.disposeAndClear(aEvt);
1158 	m_aRowSetListeners.disposeAndClear(aEvt);
1159 	m_aRowSetApproveListeners.disposeAndClear(aEvt);
1160 	m_aErrorListeners.disposeAndClear(aEvt);
1161 	m_aParameterListeners.disposeAndClear(aEvt);
1162 	m_aSubmitListeners.disposeAndClear(aEvt);
1163 	m_aResetListeners.disposeAndClear(aEvt);
1164 
1165 	m_aVetoablePropertyChangeListeners.disposeAndClear();
1166 	m_aPropertyChangeListeners.disposeAndClear();
1167 	m_aPropertiesChangeListeners.disposeAndClear(aEvt);
1168 
1169 	m_aDisposeListeners.disposeAndClear(aEvt);
1170 	m_aContainerListeners.disposeAndClear(aEvt);
1171 
1172 	// dispose all childs
1173 	for (	::std::vector< Reference< ::com::sun::star::form::XFormComponent > >::iterator aIter = m_aChildren.begin();
1174 			aIter != m_aChildren.end();
1175 			++aIter
1176 		)
1177 	{
1178 		Reference< ::com::sun::star::beans::XPropertySet >  xSet(*aIter, UNO_QUERY);
1179 		if (xSet.is())
1180 			xSet->removePropertyChangeListener(PROPERTY_NAME, (::com::sun::star::beans::XPropertyChangeListener*)this);
1181 
1182 		Reference< ::com::sun::star::container::XChild >  xChild(*aIter, UNO_QUERY);
1183 		if (xChild.is())
1184 			xChild->setParent(Reference< XInterface > ());
1185 
1186 		Reference< ::com::sun::star::lang::XComponent >  xComp(*aIter, UNO_QUERY);
1187 		if (xComp.is())
1188 			xComp->dispose();
1189 	}
1190 	m_aChildren.clear();
1191 }
1192 
1193 // -------------------------------------------------------------------------
1194 void SAL_CALL SbaXFormAdapter::addEventListener(const Reference< ::com::sun::star::lang::XEventListener >& xListener) throw( RuntimeException )
1195 {
1196 	m_aDisposeListeners.addInterface(xListener);
1197 }
1198 
1199 // -------------------------------------------------------------------------
1200 void SAL_CALL SbaXFormAdapter::removeEventListener(const Reference< ::com::sun::star::lang::XEventListener >& aListener) throw( RuntimeException )
1201 {
1202 	m_aDisposeListeners.removeInterface(aListener);
1203 }
1204 
1205 // ::com::sun::star::beans::XFastPropertySet
1206 // -------------------------------------------------------------------------
1207 void SAL_CALL SbaXFormAdapter::setFastPropertyValue(sal_Int32 nHandle, const Any& aValue) throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, RuntimeException )
1208 {
1209 	Reference< ::com::sun::star::beans::XFastPropertySet >  xSet(m_xMainForm, UNO_QUERY);
1210 	DBG_ASSERT(xSet.is(), "SAL_CALL SbaXFormAdapter::setFastPropertyValue : have no master form !");
1211 
1212 	if (m_nNamePropHandle == nHandle)
1213 	{
1214 		if (aValue.getValueType().getTypeClass() != TypeClass_STRING)
1215 		{
1216 			throw ::com::sun::star::lang::IllegalArgumentException();
1217 		}
1218 
1219 		// for notifying property listeners
1220 		::com::sun::star::beans::PropertyChangeEvent aEvt;
1221 		aEvt.Source = *this;
1222 		aEvt.PropertyName = PROPERTY_NAME;
1223 		aEvt.PropertyHandle = m_nNamePropHandle;
1224 		aEvt.OldValue <<= m_sName;
1225 		aEvt.NewValue = aValue;
1226 
1227 		aValue >>= m_sName;
1228 
1229 		::cppu::OInterfaceIteratorHelper aIt(*m_aPropertyChangeListeners.getContainer(PROPERTY_NAME));
1230 		while (aIt.hasMoreElements())
1231 			((::com::sun::star::beans::XPropertyChangeListener*)aIt.next())->propertyChange(aEvt);
1232 
1233 		return;
1234 	}
1235 
1236 	xSet->setFastPropertyValue(nHandle, aValue);
1237 }
1238 
1239 // -------------------------------------------------------------------------
1240 Any SAL_CALL SbaXFormAdapter::getFastPropertyValue(sal_Int32 nHandle) throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, RuntimeException )
1241 {
1242 	Reference< ::com::sun::star::beans::XFastPropertySet >  xSet(m_xMainForm, UNO_QUERY);
1243 	DBG_ASSERT(xSet.is(), "SAL_CALL SbaXFormAdapter::getFastPropertyValue : have no master form !");
1244 
1245 	if (m_nNamePropHandle == nHandle)
1246 		return makeAny(m_sName);
1247 
1248 	return xSet->getFastPropertyValue(nHandle);
1249 }
1250 
1251 // ::com::sun::star::container::XNamed
1252 // -------------------------------------------------------------------------
1253 ::rtl::OUString SAL_CALL SbaXFormAdapter::getName() throw( RuntimeException )
1254 {
1255 	return ::comphelper::getString(getPropertyValue(PROPERTY_NAME));
1256 }
1257 
1258 // -------------------------------------------------------------------------
1259 void SAL_CALL SbaXFormAdapter::setName(const ::rtl::OUString& aName) throw( RuntimeException )
1260 {
1261 	setPropertyValue(PROPERTY_NAME, makeAny(aName));
1262 }
1263 
1264 // ::com::sun::star::io::XPersistObject
1265 // -------------------------------------------------------------------------
1266 ::rtl::OUString SAL_CALL SbaXFormAdapter::getServiceName() throw( RuntimeException )
1267 {
1268 	Reference< ::com::sun::star::io::XPersistObject >  xPersist(m_xMainForm, UNO_QUERY);
1269 	if (xPersist.is())
1270 		return xPersist->getServiceName();
1271 	return ::rtl::OUString();
1272 }
1273 
1274 // -------------------------------------------------------------------------
1275 void SAL_CALL SbaXFormAdapter::write(const Reference< ::com::sun::star::io::XObjectOutputStream >& _rxOutStream) throw( ::com::sun::star::io::IOException, RuntimeException )
1276 {
1277 	Reference< ::com::sun::star::io::XPersistObject >  xPersist(m_xMainForm, UNO_QUERY);
1278 	if (xPersist.is())
1279 		xPersist->write(_rxOutStream);
1280 }
1281 
1282 // -------------------------------------------------------------------------
1283 void SAL_CALL SbaXFormAdapter::read(const Reference< ::com::sun::star::io::XObjectInputStream >& _rxInStream) throw( ::com::sun::star::io::IOException, RuntimeException )
1284 {
1285 	Reference< ::com::sun::star::io::XPersistObject >  xPersist(m_xMainForm, UNO_QUERY);
1286 	if (xPersist.is())
1287 		xPersist->read(_rxInStream);
1288 }
1289 
1290 // ::com::sun::star::beans::XMultiPropertySet
1291 // -------------------------------------------------------------------------
1292 Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL SbaXFormAdapter::getPropertySetInfo() throw( RuntimeException )
1293 {
1294 	Reference< ::com::sun::star::beans::XMultiPropertySet >  xSet(m_xMainForm, UNO_QUERY);
1295 	if (!xSet.is())
1296 		return Reference< ::com::sun::star::beans::XPropertySetInfo > ();
1297 
1298 	Reference< ::com::sun::star::beans::XPropertySetInfo >  xReturn = xSet->getPropertySetInfo();
1299 	if (-1 == m_nNamePropHandle)
1300 	{
1301 		// we need to determine the handle for the NAME property
1302  Sequence< ::com::sun::star::beans::Property> aProps = xReturn->getProperties();
1303 		const ::com::sun::star::beans::Property* pProps = aProps.getConstArray();
1304 
1305 		for (sal_Int32 i=0; i<aProps.getLength(); ++i, ++pProps)
1306 		{
1307 			if (pProps->Name.equals(PROPERTY_NAME))
1308 			{
1309 				((SbaXFormAdapter*)this)->m_nNamePropHandle = pProps->Handle;
1310 				break;
1311 			}
1312 		}
1313 	}
1314 	return xReturn;
1315 }
1316 
1317 // -------------------------------------------------------------------------
1318 void SAL_CALL SbaXFormAdapter::setPropertyValues(const Sequence< ::rtl::OUString >& PropertyNames, const Sequence< Any >& Values) throw( ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, RuntimeException )
1319 {
1320 	Reference< ::com::sun::star::beans::XMultiPropertySet >  xSet(m_xMainForm, UNO_QUERY);
1321 	if (xSet.is())
1322 		xSet->setPropertyValues(PropertyNames, Values);
1323 }
1324 
1325 // -------------------------------------------------------------------------
1326 Sequence< Any > SAL_CALL SbaXFormAdapter::getPropertyValues(const Sequence< ::rtl::OUString >& aPropertyNames) throw( RuntimeException )
1327 {
1328 	Reference< ::com::sun::star::beans::XMultiPropertySet >  xSet(m_xMainForm, UNO_QUERY);
1329 	if (!xSet.is())
1330 		return Sequence< Any>(aPropertyNames.getLength());
1331 
1332  Sequence< Any> aReturn = xSet->getPropertyValues(aPropertyNames);
1333 
1334 	// search for (and fake) the NAME property
1335 	const ::rtl::OUString* pNames = aPropertyNames.getConstArray();
1336 	Any* pValues = aReturn.getArray();
1337 	DBG_ASSERT(aReturn.getLength() == aPropertyNames.getLength(), "SAL_CALL SbaXFormAdapter::getPropertyValues : the main form returned an invalid-length sequence !");
1338 	for (sal_Int32 i=0; i<aPropertyNames.getLength(); ++i, ++pNames, ++pValues)
1339 		if (pNames->equals(PROPERTY_NAME))
1340 		{
1341 			(*pValues) <<= m_sName;
1342 			break;
1343 		}
1344 
1345 	return aReturn;
1346 }
1347 
1348 // -------------------------------------------------------------------------
1349 void SAL_CALL SbaXFormAdapter::addPropertiesChangeListener(const Sequence< ::rtl::OUString>& /*aPropertyNames*/, const Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener) throw( RuntimeException )
1350 {
1351 	// we completely ignore the property names, _all_ changes of _all_ properties will be forwarded to _all_ listeners
1352 	m_aPropertiesChangeListeners.addInterface(xListener);
1353 	if (m_aPropertiesChangeListeners.getLength() == 1)
1354 	{
1355 		Reference< ::com::sun::star::beans::XMultiPropertySet >  xBroadcaster(m_xMainForm, UNO_QUERY);
1356 		::rtl::OUString sEmpty;
1357 		if (xBroadcaster.is())
1358 			xBroadcaster->addPropertiesChangeListener(Sequence< ::rtl::OUString>(&sEmpty, 1), &m_aPropertiesChangeListeners);
1359 	}
1360 }
1361 
1362 // -------------------------------------------------------------------------
1363 void SAL_CALL SbaXFormAdapter::removePropertiesChangeListener(const Reference< ::com::sun::star::beans::XPropertiesChangeListener >& Listener) throw( RuntimeException )
1364 {
1365 	if (m_aPropertiesChangeListeners.getLength() == 1)
1366 	{
1367 		Reference< ::com::sun::star::beans::XMultiPropertySet >  xBroadcaster(m_xMainForm, UNO_QUERY);
1368 		if (xBroadcaster.is())
1369 			xBroadcaster->removePropertiesChangeListener(&m_aPropertiesChangeListeners);
1370 	}
1371 	m_aPropertiesChangeListeners.removeInterface(Listener);
1372 }
1373 
1374 // -------------------------------------------------------------------------
1375 void SAL_CALL SbaXFormAdapter::firePropertiesChangeEvent(const Sequence< ::rtl::OUString >& aPropertyNames, const Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener) throw( RuntimeException )
1376 {
1377 	Reference< ::com::sun::star::beans::XMultiPropertySet >  xSet(m_xMainForm, UNO_QUERY);
1378 	if (xSet.is())
1379 		xSet->firePropertiesChangeEvent(aPropertyNames, xListener);
1380 }
1381 
1382 
1383 // ::com::sun::star::beans::XPropertySet
1384 // -------------------------------------------------------------------------
1385 void SAL_CALL SbaXFormAdapter::setPropertyValue(const ::rtl::OUString& aPropertyName, const Any& aValue) throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, RuntimeException )
1386 {
1387 	Reference< ::com::sun::star::beans::XPropertySet >  xSet(m_xMainForm, UNO_QUERY);
1388 	if (!xSet.is())
1389 		return;
1390 
1391 	// special handling for the "name" property
1392 	if (aPropertyName.equals(PROPERTY_NAME))
1393 		setFastPropertyValue(m_nNamePropHandle, aValue);
1394 
1395 	xSet->setPropertyValue(aPropertyName, aValue);
1396 }
1397 
1398 // -------------------------------------------------------------------------
1399 Any SAL_CALL SbaXFormAdapter::getPropertyValue(const ::rtl::OUString& PropertyName) throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, RuntimeException )
1400 {
1401 	Reference< ::com::sun::star::beans::XPropertySet >  xSet(m_xMainForm, UNO_QUERY);
1402 	if (!xSet.is())
1403 		return Any();
1404 
1405 	// special handling for the "name" property
1406 	if (PropertyName.equals(PROPERTY_NAME))
1407 		return getFastPropertyValue(m_nNamePropHandle);
1408 
1409 	return xSet->getPropertyValue(PropertyName);
1410 }
1411 
1412 IMPLEMENT_PROPERTY_LISTENER_ADMINISTRATION(SbaXFormAdapter, PropertyChangeListener, m_aPropertyChangeListeners, ::com::sun::star::beans::XPropertySet, m_xMainForm);
1413 IMPLEMENT_PROPERTY_LISTENER_ADMINISTRATION(SbaXFormAdapter, VetoableChangeListener, m_aVetoablePropertyChangeListeners, ::com::sun::star::beans::XPropertySet, m_xMainForm);
1414 
1415 // ::com::sun::star::util::XCancellable
1416 // -------------------------------------------------------------------------
1417 void SAL_CALL SbaXFormAdapter::cancel() throw( RuntimeException )
1418 {
1419 	Reference< ::com::sun::star::util::XCancellable >  xCancel(m_xMainForm, UNO_QUERY);
1420 	if (xCancel.is())
1421 		return;
1422 	xCancel->cancel();
1423 }
1424 
1425 // ::com::sun::star::beans::XPropertyState
1426 // -------------------------------------------------------------------------
1427 ::com::sun::star::beans::PropertyState SAL_CALL SbaXFormAdapter::getPropertyState(const ::rtl::OUString& PropertyName) throw( ::com::sun::star::beans::UnknownPropertyException, RuntimeException )
1428 {
1429 	Reference< ::com::sun::star::beans::XPropertyState >  xState(m_xMainForm, UNO_QUERY);
1430 	if (xState.is())
1431 		return xState->getPropertyState(PropertyName);
1432 	return ::com::sun::star::beans::PropertyState_DEFAULT_VALUE;
1433 }
1434 
1435 // -------------------------------------------------------------------------
1436 Sequence< ::com::sun::star::beans::PropertyState> SAL_CALL SbaXFormAdapter::getPropertyStates(const Sequence< ::rtl::OUString >& aPropertyName) throw( ::com::sun::star::beans::UnknownPropertyException, RuntimeException )
1437 {
1438 	Reference< ::com::sun::star::beans::XPropertyState >  xState(m_xMainForm, UNO_QUERY);
1439 	if (xState.is())
1440 		return xState->getPropertyStates(aPropertyName);
1441 
1442 	// set them all to DEFAULT
1443 	 Sequence< ::com::sun::star::beans::PropertyState> aReturn(aPropertyName.getLength());
1444 	::com::sun::star::beans::PropertyState* pStates = aReturn.getArray();
1445 	for (sal_uInt16 i=0; i<aPropertyName.getLength(); ++i, ++pStates)
1446 		*pStates = ::com::sun::star::beans::PropertyState_DEFAULT_VALUE;
1447 	return aReturn;
1448 }
1449 
1450 // -------------------------------------------------------------------------
1451 void SAL_CALL SbaXFormAdapter::setPropertyToDefault(const ::rtl::OUString& PropertyName) throw( ::com::sun::star::beans::UnknownPropertyException, RuntimeException )
1452 {
1453 	Reference< ::com::sun::star::beans::XPropertyState >  xState(m_xMainForm, UNO_QUERY);
1454 	if (xState.is())
1455 		xState->setPropertyToDefault(PropertyName);
1456 }
1457 
1458 // -------------------------------------------------------------------------
1459 Any SAL_CALL SbaXFormAdapter::getPropertyDefault(const ::rtl::OUString& aPropertyName) throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, RuntimeException )
1460 {
1461 	Reference< ::com::sun::star::beans::XPropertyState >  xState(m_xMainForm, UNO_QUERY);
1462 	if (xState.is())
1463 		return xState->getPropertyDefault(aPropertyName);
1464 	return Any();
1465 }
1466 
1467 // ::com::sun::star::form::XReset
1468 // -------------------------------------------------------------------------
1469 void SAL_CALL SbaXFormAdapter::reset() throw( RuntimeException )
1470 {
1471 	Reference< ::com::sun::star::form::XReset >  xReset(m_xMainForm, UNO_QUERY);
1472 	if (xReset.is())
1473 		xReset->reset();
1474 }
1475 
1476 IMPLEMENT_LISTENER_ADMINISTRATION(SbaXFormAdapter, form, ResetListener, m_aResetListeners, ::com::sun::star::form::XReset, m_xMainForm)
1477 
1478 // ::com::sun::star::container::XNameContainer
1479 // -------------------------------------------------------------------------
1480 void SbaXFormAdapter::implInsert(const Any& aElement, sal_Int32 nIndex, const ::rtl::OUString* pNewElName) throw( ::com::sun::star::lang::IllegalArgumentException )
1481 {
1482 	// extract the form component
1483 	if (aElement.getValueType().getTypeClass() != TypeClass_INTERFACE)
1484 	{
1485 		throw ::com::sun::star::lang::IllegalArgumentException();
1486 	}
1487 
1488 	Reference< ::com::sun::star::form::XFormComponent >  xElement(*(Reference< XInterface > *)aElement.getValue(), UNO_QUERY);
1489 	if (!xElement.is())
1490 	{
1491 		throw ::com::sun::star::lang::IllegalArgumentException();
1492 	}
1493 
1494 	// for the name we need the propset
1495 	Reference< ::com::sun::star::beans::XPropertySet >  xElementSet(xElement, UNO_QUERY);
1496 	if (!xElementSet.is())
1497 	{
1498 		throw ::com::sun::star::lang::IllegalArgumentException();
1499  	}
1500 	::rtl::OUString sName;
1501 	try
1502 	{
1503 		if (pNewElName)
1504 			xElementSet->setPropertyValue(PROPERTY_NAME, makeAny(*pNewElName));
1505 
1506 		xElementSet->getPropertyValue(PROPERTY_NAME) >>= sName;
1507 	}
1508 	catch(Exception&)
1509 	{
1510 		// the set didn't support the name prop
1511 		throw ::com::sun::star::lang::IllegalArgumentException();
1512 	}
1513 
1514 	// check the index
1515     OSL_ASSERT(nIndex >= 0);
1516 	if (sal::static_int_cast< sal_uInt32 >(nIndex) > m_aChildren.size())
1517 		nIndex = m_aChildren.size();
1518 
1519 	DBG_ASSERT(m_aChildren.size() == m_aChildNames.size(), "SAL_CALL SbaXFormAdapter::implInsert : inconsistent container state !");
1520 	m_aChildren.insert(m_aChildren.begin() + nIndex, xElement);
1521 	m_aChildNames.insert(m_aChildNames.begin() + nIndex, sName);
1522 
1523 	// listen for a changes of the name
1524 	xElementSet->addPropertyChangeListener(PROPERTY_NAME, (::com::sun::star::beans::XPropertyChangeListener*)this);
1525 
1526 	// we are now the parent of the new element
1527 	xElement->setParent((::com::sun::star::container::XContainer*)this);
1528 
1529 	// notify the container listeners
1530 	::com::sun::star::container::ContainerEvent aEvt;
1531 	aEvt.Source = *this;
1532 	aEvt.Accessor <<= nIndex;
1533 	aEvt.Element <<= xElement;
1534 	::cppu::OInterfaceIteratorHelper aIt(m_aContainerListeners);
1535 	while (aIt.hasMoreElements())
1536 		((::com::sun::star::container::XContainerListener*)aIt.next())->elementInserted(aEvt);
1537 }
1538 
1539 // -------------------------------------------------------------------------
1540 sal_Int32 SbaXFormAdapter::implGetPos(const ::rtl::OUString& rName)
1541 {
1542 	::std::vector< ::rtl::OUString>::iterator aIter = ::std::find_if(	m_aChildNames.begin(),
1543 																m_aChildNames.end(),
1544 																::std::bind2nd(::std::equal_to< rtl::OUString>(),rName));
1545 
1546 	if(aIter != m_aChildNames.end())
1547 		return aIter - m_aChildNames.begin();
1548 
1549 	return -1;
1550 }
1551 
1552 // -------------------------------------------------------------------------
1553 void SAL_CALL SbaXFormAdapter::insertByName(const ::rtl::OUString& aName, const Any& aElement) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, RuntimeException )
1554 {
1555 	implInsert(aElement, m_aChildren.size(), &aName);
1556 }
1557 
1558 // -------------------------------------------------------------------------
1559 void SAL_CALL SbaXFormAdapter::removeByName(const ::rtl::OUString& Name) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, RuntimeException )
1560 {
1561 	sal_Int32 nPos = implGetPos(Name);
1562 	if (-1 == nPos)
1563 	{
1564 		throw ::com::sun::star::container::NoSuchElementException();
1565 	}
1566 	removeByIndex(nPos);
1567 }
1568 
1569 // ::com::sun::star::container::XNameReplace
1570 // -------------------------------------------------------------------------
1571 void SAL_CALL SbaXFormAdapter::replaceByName(const ::rtl::OUString& aName, const Any& aElement) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, RuntimeException )
1572 {
1573 	sal_Int32 nPos = implGetPos(aName);
1574 	if (-1 == nPos)
1575 	{
1576 		throw ::com::sun::star::container::NoSuchElementException();
1577 	}
1578 	replaceByIndex(nPos, aElement);
1579 }
1580 
1581 // ::com::sun::star::container::XNameAccess
1582 // -------------------------------------------------------------------------
1583 Any SAL_CALL SbaXFormAdapter::getByName(const ::rtl::OUString& aName) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, RuntimeException )
1584 {
1585 	sal_Int32 nPos = implGetPos(aName);
1586 	if (-1 == nPos)
1587 	{
1588 		throw ::com::sun::star::container::NoSuchElementException();
1589 	}
1590 	return makeAny(m_aChildren[nPos]);
1591 }
1592 
1593 // -------------------------------------------------------------------------
1594 Sequence< ::rtl::OUString > SAL_CALL SbaXFormAdapter::getElementNames() throw( RuntimeException )
1595 {
1596 	::rtl::OUString *pChildNames = m_aChildNames.empty() ? 0 : &m_aChildNames[0];
1597 	return Sequence< ::rtl::OUString >(pChildNames, m_aChildNames.size());
1598 }
1599 
1600 // -------------------------------------------------------------------------
1601 sal_Bool SAL_CALL SbaXFormAdapter::hasByName(const ::rtl::OUString& aName) throw( RuntimeException )
1602 {
1603 	return (-1 != implGetPos(aName));
1604 }
1605 
1606 // ::com::sun::star::container::XElementAccess
1607 // -------------------------------------------------------------------------
1608 Type SAL_CALL SbaXFormAdapter::getElementType() throw(RuntimeException)
1609 {
1610 	return ::getCppuType(
1611 		static_cast< Reference< ::com::sun::star::form::XFormComponent >* >(NULL));
1612 }
1613 
1614 // -------------------------------------------------------------------------
1615 sal_Bool SAL_CALL SbaXFormAdapter::hasElements() throw(RuntimeException)
1616 {
1617 	return m_aChildren.size() > 0;
1618 }
1619 
1620 
1621 // ::com::sun::star::container::XIndexContainer
1622 // -------------------------------------------------------------------------
1623 void SAL_CALL SbaXFormAdapter::insertByIndex(sal_Int32 _rIndex, const Any& Element) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, RuntimeException )
1624 {
1625 	if ( ( _rIndex < 0 ) || ( (size_t)_rIndex >= m_aChildren.size() ) )
1626 		throw ::com::sun::star::lang::IndexOutOfBoundsException();
1627 	implInsert(Element, _rIndex);
1628 }
1629 
1630 // -------------------------------------------------------------------------
1631 void SAL_CALL SbaXFormAdapter::removeByIndex(sal_Int32 _rIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, RuntimeException )
1632 {
1633 	if ( ( _rIndex < 0 ) || ( (size_t)_rIndex >= m_aChildren.size() ) )
1634 		throw ::com::sun::star::lang::IndexOutOfBoundsException();
1635 
1636 	Reference< ::com::sun::star::form::XFormComponent >  xAffected = *(m_aChildren.begin() + _rIndex);
1637 
1638 	DBG_ASSERT(m_aChildren.size() == m_aChildNames.size(), "SAL_CALL SbaXFormAdapter::removeByIndex : inconsistent container state !");
1639 	m_aChildren.erase(m_aChildren.begin() + _rIndex);
1640 	m_aChildNames.erase(m_aChildNames.begin() + _rIndex);
1641 
1642 	// no need to listen anymore
1643 	Reference< ::com::sun::star::beans::XPropertySet >  xAffectedSet(xAffected, UNO_QUERY);
1644 	xAffectedSet->removePropertyChangeListener(PROPERTY_NAME, (::com::sun::star::beans::XPropertyChangeListener*)this);
1645 
1646 	// we are no longer the parent
1647 	xAffected->setParent(Reference< XInterface > ());
1648 
1649 	// notify container listeners
1650 	::com::sun::star::container::ContainerEvent aEvt;
1651 	aEvt.Source = *this;
1652 	aEvt.Element <<= xAffected;
1653 	::cppu::OInterfaceIteratorHelper aIt(m_aContainerListeners);
1654 	while (aIt.hasMoreElements())
1655 		((::com::sun::star::container::XContainerListener*)aIt.next())->elementRemoved(aEvt);
1656 
1657 }
1658 
1659 // ::com::sun::star::container::XIndexReplace
1660 // -------------------------------------------------------------------------
1661 void SAL_CALL SbaXFormAdapter::replaceByIndex(sal_Int32 _rIndex, const Any& Element) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, RuntimeException )
1662 {
1663 	if ( ( _rIndex < 0 ) || ( (size_t)_rIndex >= m_aChildren.size() ) )
1664 		throw ::com::sun::star::lang::IndexOutOfBoundsException();
1665 
1666 	// extract the form component
1667 	if (Element.getValueType().getTypeClass() != TypeClass_INTERFACE)
1668 	{
1669 		throw ::com::sun::star::lang::IllegalArgumentException();
1670 	}
1671 
1672 	Reference< ::com::sun::star::form::XFormComponent >  xElement(*(Reference< XInterface > *)Element.getValue(), UNO_QUERY);
1673 	if (!xElement.is())
1674 	{
1675 		throw ::com::sun::star::lang::IllegalArgumentException();
1676 	}
1677 
1678 	// for the name we need the propset
1679 	Reference< ::com::sun::star::beans::XPropertySet >  xElementSet(xElement, UNO_QUERY);
1680 	if (!xElementSet.is())
1681 	{
1682 		throw ::com::sun::star::lang::IllegalArgumentException();
1683  	}
1684 	::rtl::OUString sName;
1685 	try
1686 	{
1687 		xElementSet->getPropertyValue(PROPERTY_NAME) >>= sName;
1688 	}
1689 	catch(Exception&)
1690 	{
1691 		// the set didn't support the name prop
1692 		throw ::com::sun::star::lang::IllegalArgumentException();
1693 	}
1694 
1695 	Reference< ::com::sun::star::form::XFormComponent >  xOld = *(m_aChildren.begin() + _rIndex);
1696 
1697 	DBG_ASSERT(m_aChildren.size() == m_aChildNames.size(), "SAL_CALL SbaXFormAdapter::replaceByIndex : inconsistent container state !");
1698 	*(m_aChildren.begin() + _rIndex) = xElement;
1699 	*(m_aChildNames.begin() + _rIndex) = sName;
1700 
1701 	// correct property change listening
1702 	Reference< ::com::sun::star::beans::XPropertySet >  xOldSet(xOld, UNO_QUERY);
1703 	xOldSet->removePropertyChangeListener(PROPERTY_NAME, (::com::sun::star::beans::XPropertyChangeListener*)this);
1704 	xElementSet->addPropertyChangeListener(PROPERTY_NAME, (::com::sun::star::beans::XPropertyChangeListener*)this);
1705 
1706 	// parent reset
1707 	xOld->setParent(Reference< XInterface > ());
1708 	xElement->setParent((::com::sun::star::container::XContainer*)this);
1709 
1710 	// notify container listeners
1711 	::com::sun::star::container::ContainerEvent aEvt;
1712 	aEvt.Source = *this;
1713 	aEvt.Accessor <<= (sal_Int32)_rIndex;
1714 	aEvt.Element <<= xElement;
1715 	aEvt.ReplacedElement <<= xOld;
1716 
1717 	::cppu::OInterfaceIteratorHelper aIt(m_aContainerListeners);
1718 	while (aIt.hasMoreElements())
1719 		((::com::sun::star::container::XContainerListener*)aIt.next())->elementReplaced(aEvt);
1720 }
1721 
1722 // ::com::sun::star::container::XIndexAccess
1723 // -------------------------------------------------------------------------
1724 sal_Int32 SAL_CALL SbaXFormAdapter::getCount() throw( RuntimeException )
1725 {
1726 	return m_aChildren.size();
1727 }
1728 
1729 // -------------------------------------------------------------------------
1730 Any SAL_CALL SbaXFormAdapter::getByIndex(sal_Int32 _rIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, RuntimeException )
1731 {
1732 	if ( ( _rIndex < 0 ) || ( (size_t)_rIndex >= m_aChildren.size() ) )
1733 		throw ::com::sun::star::lang::IndexOutOfBoundsException();
1734 
1735     Reference< ::com::sun::star::form::XFormComponent >  xElement = *(m_aChildren.begin() + _rIndex);
1736 	return makeAny(xElement);
1737 }
1738 
1739 // ::com::sun::star::container::XContainer
1740 // -------------------------------------------------------------------------
1741 void SAL_CALL SbaXFormAdapter::addContainerListener(const Reference< ::com::sun::star::container::XContainerListener >& xListener) throw( RuntimeException )
1742 {
1743 	m_aContainerListeners.addInterface(xListener);
1744 }
1745 
1746 // -------------------------------------------------------------------------
1747 void SAL_CALL SbaXFormAdapter::removeContainerListener(const Reference< ::com::sun::star::container::XContainerListener >& xListener) throw( RuntimeException )
1748 {
1749 	m_aContainerListeners.removeInterface(xListener);
1750 }
1751 
1752 // ::com::sun::star::container::XEnumerationAccess
1753 // -------------------------------------------------------------------------
1754 Reference< ::com::sun::star::container::XEnumeration > SAL_CALL SbaXFormAdapter::createEnumeration() throw( RuntimeException )
1755 {
1756 	return new ::comphelper::OEnumerationByName(this);
1757 }
1758 
1759 // ::com::sun::star::beans::XPropertyChangeListener
1760 // -------------------------------------------------------------------------
1761 void SAL_CALL SbaXFormAdapter::propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw( RuntimeException )
1762 {
1763 	if (evt.PropertyName.equals(PROPERTY_NAME))
1764 	{
1765 		::std::vector<	::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > >::iterator aIter = ::std::find_if(	m_aChildren.begin(),
1766 																m_aChildren.end(),
1767 																::std::bind2nd(::std::equal_to< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >(),evt.Source));
1768 
1769 		if(aIter != m_aChildren.end())
1770 		{
1771 			sal_Int32 nPos = aIter - m_aChildren.begin();
1772 			DBG_ASSERT(*(m_aChildNames.begin() + nPos) == ::comphelper::getString(evt.OldValue), "SAL_CALL SbaXFormAdapter::propertyChange : object has a wrong name !");
1773 			*(m_aChildNames.begin() + nPos) = ::comphelper::getString(evt.NewValue);
1774 		}
1775 	}
1776 }
1777 
1778 // ::com::sun::star::lang::XEventListener
1779 // -------------------------------------------------------------------------
1780 void SAL_CALL SbaXFormAdapter::disposing(const ::com::sun::star::lang::EventObject& Source) throw( RuntimeException )
1781 {
1782 	// was it our main form ?
1783 	if (Source.Source == m_xMainForm)
1784 		dispose();
1785 
1786 	::std::vector<	::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > >::iterator aIter = ::std::find_if(	m_aChildren.begin(),
1787 																m_aChildren.end(),
1788 																::std::bind2nd(::std::equal_to< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >(),Source.Source));
1789 	if(aIter != m_aChildren.end())
1790 			removeByIndex(aIter - m_aChildren.begin());
1791 }
1792 // -----------------------------------------------------------------------------
1793 
1794 
1795