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