1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "formadapter.hxx"
21 #include <tools/debug.hxx>
22 #include <osl/diagnose.h>
23 #include <comphelper/types.hxx>
24 #include <comphelper/enumhelper.hxx>
25 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
26 #include "dbu_brw.hrc"
27 #include "dbustrings.hrc"
28 #include <connectivity/dbexception.hxx>
29 #include <cppuhelper/typeprovider.hxx>
30 #include <comphelper/sequence.hxx>
32 using namespace dbaui
;
33 using namespace ::com::sun::star::uno
;
34 using namespace ::com::sun::star::sdb
;
35 using namespace ::com::sun::star::sdbcx
;
36 using namespace ::com::sun::star::beans
;
37 using namespace ::com::sun::star::container
;
41 SbaXFormAdapter::SbaXFormAdapter()
42 :m_aLoadListeners(*this, m_aMutex
)
43 ,m_aRowSetListeners(*this, m_aMutex
)
44 ,m_aRowSetApproveListeners(*this, m_aMutex
)
45 ,m_aErrorListeners(*this, m_aMutex
)
46 ,m_aParameterListeners(*this, m_aMutex
)
47 ,m_aSubmitListeners(*this, m_aMutex
)
48 ,m_aResetListeners(*this, m_aMutex
)
49 ,m_aPropertyChangeListeners(*this, m_aMutex
)
50 ,m_aVetoablePropertyChangeListeners(*this, m_aMutex
)
51 ,m_aPropertiesChangeListeners(*this, m_aMutex
)
52 ,m_aDisposeListeners(m_aMutex
)
53 ,m_aContainerListeners(m_aMutex
)
54 ,m_nNamePropHandle(-1)
59 SbaXFormAdapter::~SbaXFormAdapter()
64 Sequence
< Type
> SAL_CALL
SbaXFormAdapter::getTypes( ) throw (RuntimeException
, std::exception
)
66 return ::comphelper::concatSequences(
67 SbaXFormAdapter_BASE1::getTypes(),
68 SbaXFormAdapter_BASE2::getTypes(),
69 SbaXFormAdapter_BASE3::getTypes()
73 Sequence
< sal_Int8
> SAL_CALL
SbaXFormAdapter::getImplementationId( ) throw (RuntimeException
, std::exception
)
75 return css::uno::Sequence
<sal_Int8
>();
78 Any SAL_CALL
SbaXFormAdapter::queryInterface(const Type
& _rType
) throw (RuntimeException
, std::exception
)
80 Any aReturn
= SbaXFormAdapter_BASE1::queryInterface( _rType
);
82 if (!aReturn
.hasValue())
83 aReturn
= SbaXFormAdapter_BASE2::queryInterface( _rType
);
85 if (!aReturn
.hasValue())
86 aReturn
= SbaXFormAdapter_BASE3::queryInterface( _rType
);
91 void SbaXFormAdapter::StopListening()
93 // log off all our multiplexers
94 STOP_MULTIPLEXER_LISTENING(LoadListener
, m_aLoadListeners
, css::form::XLoadable
, m_xMainForm
);
95 STOP_MULTIPLEXER_LISTENING(RowSetListener
, m_aRowSetListeners
, css::sdbc::XRowSet
, m_xMainForm
);
96 STOP_MULTIPLEXER_LISTENING(RowSetApproveListener
, m_aRowSetApproveListeners
, css::sdb::XRowSetApproveBroadcaster
, m_xMainForm
);
97 STOP_MULTIPLEXER_LISTENING(SQLErrorListener
, m_aErrorListeners
, css::sdb::XSQLErrorBroadcaster
, m_xMainForm
);
98 STOP_MULTIPLEXER_LISTENING(SubmitListener
, m_aSubmitListeners
, css::form::XSubmit
, m_xMainForm
);
99 STOP_MULTIPLEXER_LISTENING(ResetListener
, m_aResetListeners
, css::form::XReset
, m_xMainForm
);
101 if (m_aParameterListeners
.getLength())
103 Reference
< css::form::XDatabaseParameterBroadcaster
> xBroadcaster(m_xMainForm
, UNO_QUERY
);
104 if (xBroadcaster
.is())
105 xBroadcaster
->removeParameterListener(&m_aParameterListeners
);
108 STOP_PROPERTY_MULTIPLEXER_LISTENING(PropertyChangeListener
, m_aPropertyChangeListeners
, css::beans::XPropertySet
, m_xMainForm
);
109 STOP_PROPERTY_MULTIPLEXER_LISTENING(VetoableChangeListener
, m_aVetoablePropertyChangeListeners
, css::beans::XPropertySet
, m_xMainForm
);
110 if (m_aPropertiesChangeListeners
.getLength())
112 Reference
< css::beans::XMultiPropertySet
> xBroadcaster(m_xMainForm
, UNO_QUERY
);
113 if (xBroadcaster
.is())
114 xBroadcaster
->removePropertiesChangeListener(&m_aPropertiesChangeListeners
);
118 Reference
< css::lang::XComponent
> xComp(m_xMainForm
, UNO_QUERY
);
120 xComp
->removeEventListener(static_cast<css::lang::XEventListener
*>(static_cast<css::beans::XPropertyChangeListener
*>(this)));
123 void SbaXFormAdapter::StartListening()
125 // log off all our multiplexers
126 START_MULTIPLEXER_LISTENING(LoadListener
, m_aLoadListeners
, css::form::XLoadable
, m_xMainForm
);
127 START_MULTIPLEXER_LISTENING(RowSetListener
, m_aRowSetListeners
, css::sdbc::XRowSet
, m_xMainForm
);
128 START_MULTIPLEXER_LISTENING(RowSetApproveListener
, m_aRowSetApproveListeners
, css::sdb::XRowSetApproveBroadcaster
, m_xMainForm
);
129 START_MULTIPLEXER_LISTENING(SQLErrorListener
, m_aErrorListeners
, css::sdb::XSQLErrorBroadcaster
, m_xMainForm
);
130 START_MULTIPLEXER_LISTENING(SubmitListener
, m_aSubmitListeners
, css::form::XSubmit
, m_xMainForm
);
131 START_MULTIPLEXER_LISTENING(ResetListener
, m_aResetListeners
, css::form::XReset
, m_xMainForm
);
133 if (m_aParameterListeners
.getLength())
135 Reference
< css::form::XDatabaseParameterBroadcaster
> xBroadcaster(m_xMainForm
, UNO_QUERY
);
136 if (xBroadcaster
.is())
137 xBroadcaster
->addParameterListener(&m_aParameterListeners
);
140 START_PROPERTY_MULTIPLEXER_LISTENING(PropertyChangeListener
, m_aPropertyChangeListeners
, css::beans::XPropertySet
, m_xMainForm
);
141 START_PROPERTY_MULTIPLEXER_LISTENING(VetoableChangeListener
, m_aVetoablePropertyChangeListeners
, css::beans::XPropertySet
, m_xMainForm
);
142 if (m_aPropertiesChangeListeners
.getLength())
144 Reference
< css::beans::XMultiPropertySet
> xBroadcaster(m_xMainForm
, UNO_QUERY
);
145 if (xBroadcaster
.is())
146 xBroadcaster
->addPropertiesChangeListener(css::uno::Sequence
<OUString
>{""}, &m_aPropertiesChangeListeners
);
150 Reference
< css::lang::XComponent
> xComp(m_xMainForm
, UNO_QUERY
);
152 xComp
->addEventListener(static_cast<css::lang::XEventListener
*>(static_cast<css::beans::XPropertyChangeListener
*>(this)));
155 void SbaXFormAdapter::AttachForm(const Reference
< css::sdbc::XRowSet
>& xNewMaster
)
157 if (xNewMaster
== m_xMainForm
)
160 OSL_ENSURE(xNewMaster
.get() != static_cast< css::sdbc::XRowSet
* >(this), "SbaXFormAdapter::AttachForm : invalid argument !");
162 if (m_xMainForm
.is())
166 // if our old master is loaded we have to send an 'unloaded' event
167 Reference
< css::form::XLoadable
> xLoadable(m_xMainForm
, UNO_QUERY
);
168 if (xLoadable
->isLoaded())
170 css::lang::EventObject
aEvt(*this);
171 ::comphelper::OInterfaceIteratorHelper2
aIt(m_aLoadListeners
);
172 while (aIt
.hasMoreElements())
173 static_cast< css::form::XLoadListener
*>(aIt
.next())->unloaded(aEvt
);
177 m_xMainForm
= xNewMaster
;
179 if (m_xMainForm
.is())
183 // if our new master is loaded we have to send an 'loaded' event
184 Reference
< css::form::XLoadable
> xLoadable(m_xMainForm
, UNO_QUERY
);
185 if (xLoadable
->isLoaded())
187 css::lang::EventObject
aEvt(*this);
188 ::comphelper::OInterfaceIteratorHelper2
aIt(m_aLoadListeners
);
189 while (aIt
.hasMoreElements())
190 static_cast< css::form::XLoadListener
*>(aIt
.next())->loaded(aEvt
);
194 // TODO : perhaps _all_ of our listeners should be notified about our new state
195 // (nearly every aspect of us may have changed with new master form)
198 // css::sdbc::XCloseable
199 void SAL_CALL
SbaXFormAdapter::close() throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
201 Reference
< css::sdbc::XCloseable
> xIface(m_xMainForm
, UNO_QUERY
);
206 // css::sdbc::XResultSetMetaDataSupplier
207 Reference
< css::sdbc::XResultSetMetaData
> SAL_CALL
SbaXFormAdapter::getMetaData() throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
209 Reference
< css::sdbc::XResultSetMetaDataSupplier
> xIface(m_xMainForm
, UNO_QUERY
);
211 return xIface
->getMetaData();
212 return Reference
< css::sdbc::XResultSetMetaData
> ();
215 // css::sdbc::XColumnLocate
216 sal_Int32 SAL_CALL
SbaXFormAdapter::findColumn(const OUString
& columnName
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
218 Reference
< css::sdbc::XColumnLocate
> xIface(m_xMainForm
, UNO_QUERY
);
220 return xIface
->findColumn(columnName
);
222 ::dbtools::throwInvalidColumnException( columnName
, *this );
224 return 0; // Never reached
227 // css::sdbcx::XColumnsSupplier
228 Reference
< css::container::XNameAccess
> SAL_CALL
SbaXFormAdapter::getColumns() throw( RuntimeException
, std::exception
)
230 Reference
< css::sdbcx::XColumnsSupplier
> xIface(m_xMainForm
, UNO_QUERY
);
232 return xIface
->getColumns();
233 return Reference
< css::container::XNameAccess
> ();
237 sal_Bool SAL_CALL
SbaXFormAdapter::wasNull() throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
239 Reference
< css::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
241 return xIface
->wasNull();
245 OUString SAL_CALL
SbaXFormAdapter::getString(sal_Int32 columnIndex
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
247 Reference
< css::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
249 return xIface
->getString(columnIndex
);
253 sal_Bool SAL_CALL
SbaXFormAdapter::getBoolean(sal_Int32 columnIndex
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
255 Reference
< css::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
257 return xIface
->getBoolean(columnIndex
);
261 sal_Int8 SAL_CALL
SbaXFormAdapter::getByte(sal_Int32 columnIndex
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
264 Reference
< css::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
266 return xIface
->getByte(columnIndex
);
270 sal_Int16 SAL_CALL
SbaXFormAdapter::getShort(sal_Int32 columnIndex
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
272 Reference
< css::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
274 return xIface
->getShort(columnIndex
);
278 sal_Int32 SAL_CALL
SbaXFormAdapter::getInt(sal_Int32 columnIndex
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
280 Reference
< css::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
282 return xIface
->getInt(columnIndex
);
286 sal_Int64 SAL_CALL
SbaXFormAdapter::getLong(sal_Int32 columnIndex
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
288 Reference
< css::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
290 return xIface
->getLong(columnIndex
);
294 float SAL_CALL
SbaXFormAdapter::getFloat(sal_Int32 columnIndex
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
296 Reference
< css::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
298 return xIface
->getFloat(columnIndex
);
302 double SAL_CALL
SbaXFormAdapter::getDouble(sal_Int32 columnIndex
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
304 Reference
< css::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
306 return xIface
->getDouble(columnIndex
);
310 Sequence
< sal_Int8
> SAL_CALL
SbaXFormAdapter::getBytes(sal_Int32 columnIndex
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
312 Reference
< css::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
314 return xIface
->getBytes(columnIndex
);
315 return Sequence
<sal_Int8
> ();
318 css::util::Date SAL_CALL
SbaXFormAdapter::getDate(sal_Int32 columnIndex
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
320 Reference
< css::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
322 return xIface
->getDate(columnIndex
);
323 return css::util::Date();
326 css::util::Time SAL_CALL
SbaXFormAdapter::getTime(sal_Int32 columnIndex
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
328 Reference
< css::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
330 return xIface
->getTime(columnIndex
);
331 return css::util::Time();
334 css::util::DateTime SAL_CALL
SbaXFormAdapter::getTimestamp(sal_Int32 columnIndex
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
336 Reference
< css::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
338 return xIface
->getTimestamp(columnIndex
);
339 return css::util::DateTime();
342 Reference
< css::io::XInputStream
> SAL_CALL
SbaXFormAdapter::getBinaryStream(sal_Int32 columnIndex
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
344 Reference
< css::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
346 return xIface
->getBinaryStream(columnIndex
);
347 return Reference
< css::io::XInputStream
> ();
350 Reference
< css::io::XInputStream
> SAL_CALL
SbaXFormAdapter::getCharacterStream(sal_Int32 columnIndex
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
352 Reference
< css::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
354 return xIface
->getCharacterStream(columnIndex
);
355 return Reference
< css::io::XInputStream
> ();
358 Any SAL_CALL
SbaXFormAdapter::getObject(sal_Int32 columnIndex
, const Reference
< css::container::XNameAccess
>& typeMap
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
360 Reference
< css::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
362 return xIface
->getObject(columnIndex
, typeMap
);
366 Reference
< css::sdbc::XRef
> SAL_CALL
SbaXFormAdapter::getRef(sal_Int32 columnIndex
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
368 Reference
< css::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
370 return xIface
->getRef(columnIndex
);
371 return Reference
< css::sdbc::XRef
> ();
374 Reference
< css::sdbc::XBlob
> SAL_CALL
SbaXFormAdapter::getBlob(sal_Int32 columnIndex
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
376 Reference
< css::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
378 return xIface
->getBlob(columnIndex
);
379 return Reference
< css::sdbc::XBlob
> ();
382 Reference
< css::sdbc::XClob
> SAL_CALL
SbaXFormAdapter::getClob(sal_Int32 columnIndex
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
384 Reference
< css::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
386 return xIface
->getClob(columnIndex
);
387 return Reference
< css::sdbc::XClob
> ();
390 Reference
< css::sdbc::XArray
> SAL_CALL
SbaXFormAdapter::getArray(sal_Int32 columnIndex
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
392 Reference
< css::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
394 return xIface
->getArray(columnIndex
);
395 return Reference
< css::sdbc::XArray
> ();
398 // css::sdbcx::XRowLocate
399 Any SAL_CALL
SbaXFormAdapter::getBookmark() throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
401 Reference
< css::sdbcx::XRowLocate
> xIface(m_xMainForm
, UNO_QUERY
);
403 return xIface
->getBookmark();
407 sal_Bool SAL_CALL
SbaXFormAdapter::moveToBookmark(const Any
& bookmark
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
409 Reference
< css::sdbcx::XRowLocate
> xIface(m_xMainForm
, UNO_QUERY
);
411 return xIface
->moveToBookmark(bookmark
);
415 sal_Bool SAL_CALL
SbaXFormAdapter::moveRelativeToBookmark(const Any
& bookmark
, sal_Int32 rows
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
417 Reference
< css::sdbcx::XRowLocate
> xIface(m_xMainForm
, UNO_QUERY
);
419 return xIface
->moveRelativeToBookmark(bookmark
,rows
);
423 sal_Int32 SAL_CALL
SbaXFormAdapter::compareBookmarks(const Any
& _first
, const Any
& _second
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
425 Reference
< css::sdbcx::XRowLocate
> xIface(m_xMainForm
, UNO_QUERY
);
427 return xIface
->compareBookmarks(_first
, _second
);
431 sal_Bool SAL_CALL
SbaXFormAdapter::hasOrderedBookmarks() throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
433 Reference
< css::sdbcx::XRowLocate
> xIface(m_xMainForm
, UNO_QUERY
);
435 return xIface
->hasOrderedBookmarks();
439 sal_Int32 SAL_CALL
SbaXFormAdapter::hashBookmark(const Any
& bookmark
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
441 Reference
< css::sdbcx::XRowLocate
> xIface(m_xMainForm
, UNO_QUERY
);
443 return xIface
->hashBookmark(bookmark
);
447 // css::sdbc::XRowUpdate
448 void SAL_CALL
SbaXFormAdapter::updateNull(sal_Int32 columnIndex
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
450 Reference
< css::sdbc::XRowUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
452 xIface
->updateNull(columnIndex
);
455 void SAL_CALL
SbaXFormAdapter::updateBoolean(sal_Int32 columnIndex
, sal_Bool x
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
457 Reference
< css::sdbc::XRowUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
459 xIface
->updateBoolean(columnIndex
, x
);
462 void SAL_CALL
SbaXFormAdapter::updateByte(sal_Int32 columnIndex
, sal_Int8 x
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
464 Reference
< css::sdbc::XRowUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
466 xIface
->updateByte(columnIndex
, x
);
469 void SAL_CALL
SbaXFormAdapter::updateShort(sal_Int32 columnIndex
, sal_Int16 x
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
471 Reference
< css::sdbc::XRowUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
473 xIface
->updateShort(columnIndex
, x
);
476 void SAL_CALL
SbaXFormAdapter::updateInt(sal_Int32 columnIndex
, sal_Int32 x
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
478 Reference
< css::sdbc::XRowUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
480 xIface
->updateInt(columnIndex
, x
);
483 void SAL_CALL
SbaXFormAdapter::updateLong(sal_Int32 columnIndex
, sal_Int64 x
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
485 Reference
< css::sdbc::XRowUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
487 xIface
->updateLong(columnIndex
, x
);
490 void SAL_CALL
SbaXFormAdapter::updateFloat(sal_Int32 columnIndex
, float x
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
492 Reference
< css::sdbc::XRowUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
494 xIface
->updateFloat(columnIndex
, x
);
497 void SAL_CALL
SbaXFormAdapter::updateDouble(sal_Int32 columnIndex
, double x
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
499 Reference
< css::sdbc::XRowUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
501 xIface
->updateDouble(columnIndex
, x
);
504 void SAL_CALL
SbaXFormAdapter::updateString(sal_Int32 columnIndex
, const OUString
& x
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
506 Reference
< css::sdbc::XRowUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
508 xIface
->updateString(columnIndex
, x
);
511 void SAL_CALL
SbaXFormAdapter::updateBytes(sal_Int32 columnIndex
, const Sequence
< sal_Int8
>& x
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
513 Reference
< css::sdbc::XRowUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
515 xIface
->updateBytes(columnIndex
, x
);
518 void SAL_CALL
SbaXFormAdapter::updateDate(sal_Int32 columnIndex
, const css::util::Date
& x
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
520 Reference
< css::sdbc::XRowUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
522 xIface
->updateDate(columnIndex
, x
);
525 void SAL_CALL
SbaXFormAdapter::updateTime(sal_Int32 columnIndex
, const css::util::Time
& x
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
527 Reference
< css::sdbc::XRowUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
529 xIface
->updateTime(columnIndex
, x
);
532 void SAL_CALL
SbaXFormAdapter::updateTimestamp(sal_Int32 columnIndex
, const css::util::DateTime
& x
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
534 Reference
< css::sdbc::XRowUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
536 xIface
->updateTimestamp(columnIndex
, x
);
539 void SAL_CALL
SbaXFormAdapter::updateBinaryStream(sal_Int32 columnIndex
, const Reference
< css::io::XInputStream
>& x
, sal_Int32 length
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
541 Reference
< css::sdbc::XRowUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
543 xIface
->updateBinaryStream(columnIndex
, x
, length
);
546 void SAL_CALL
SbaXFormAdapter::updateCharacterStream(sal_Int32 columnIndex
, const Reference
< css::io::XInputStream
>& x
, sal_Int32 length
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
548 Reference
< css::sdbc::XRowUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
550 xIface
->updateCharacterStream(columnIndex
, x
, length
);
553 void SAL_CALL
SbaXFormAdapter::updateObject(sal_Int32 columnIndex
, const Any
& x
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
555 Reference
< css::sdbc::XRowUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
557 xIface
->updateObject(columnIndex
, x
);
560 void SAL_CALL
SbaXFormAdapter::updateNumericObject(sal_Int32 columnIndex
, const Any
& x
, sal_Int32 scale
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
562 Reference
< css::sdbc::XRowUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
564 xIface
->updateNumericObject(columnIndex
, x
, scale
);
567 // css::sdbc::XResultSet
568 sal_Bool SAL_CALL
SbaXFormAdapter::next() throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
570 if (m_xMainForm
.is())
571 return m_xMainForm
->next();
575 sal_Bool SAL_CALL
SbaXFormAdapter::isBeforeFirst() throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
577 if (m_xMainForm
.is())
578 return m_xMainForm
->isBeforeFirst();
582 sal_Bool SAL_CALL
SbaXFormAdapter::isAfterLast() throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
584 if (m_xMainForm
.is())
585 return m_xMainForm
->isAfterLast();
589 sal_Bool SAL_CALL
SbaXFormAdapter::isFirst() throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
591 if (m_xMainForm
.is())
592 return m_xMainForm
->isFirst();
596 sal_Bool SAL_CALL
SbaXFormAdapter::isLast() throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
598 if (m_xMainForm
.is())
599 return m_xMainForm
->isLast();
603 void SAL_CALL
SbaXFormAdapter::beforeFirst() throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
605 if (m_xMainForm
.is())
606 m_xMainForm
->beforeFirst();
609 void SAL_CALL
SbaXFormAdapter::afterLast() throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
611 if (m_xMainForm
.is())
612 m_xMainForm
->afterLast();
615 sal_Bool SAL_CALL
SbaXFormAdapter::first() throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
617 if (m_xMainForm
.is())
618 return m_xMainForm
->first();
622 sal_Bool SAL_CALL
SbaXFormAdapter::last() throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
624 if (m_xMainForm
.is())
625 return m_xMainForm
->last();
629 sal_Int32 SAL_CALL
SbaXFormAdapter::getRow() throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
631 if (m_xMainForm
.is())
632 return m_xMainForm
->getRow();
636 sal_Bool SAL_CALL
SbaXFormAdapter::absolute(sal_Int32 row
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
638 if (m_xMainForm
.is())
639 return m_xMainForm
->absolute(row
);
643 sal_Bool SAL_CALL
SbaXFormAdapter::relative(sal_Int32 rows
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
645 if (m_xMainForm
.is())
646 return m_xMainForm
->relative(rows
);
650 sal_Bool SAL_CALL
SbaXFormAdapter::previous() throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
652 if (m_xMainForm
.is())
653 return m_xMainForm
->previous();
657 void SAL_CALL
SbaXFormAdapter::refreshRow() throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
659 if (m_xMainForm
.is())
660 m_xMainForm
->refreshRow();
663 sal_Bool SAL_CALL
SbaXFormAdapter::rowUpdated() throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
665 if (m_xMainForm
.is())
666 return m_xMainForm
->rowUpdated();
670 sal_Bool SAL_CALL
SbaXFormAdapter::rowInserted() throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
672 if (m_xMainForm
.is())
673 return m_xMainForm
->rowInserted();
677 sal_Bool SAL_CALL
SbaXFormAdapter::rowDeleted() throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
679 if (m_xMainForm
.is())
680 return m_xMainForm
->rowDeleted();
684 Reference
< XInterface
> SAL_CALL
SbaXFormAdapter::getStatement() throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
686 if (m_xMainForm
.is())
687 return m_xMainForm
->getStatement();
691 // css::sdbc::XResultSetUpdate
692 void SAL_CALL
SbaXFormAdapter::insertRow() throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
694 Reference
< css::sdbc::XResultSetUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
699 void SAL_CALL
SbaXFormAdapter::updateRow() throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
701 Reference
< css::sdbc::XResultSetUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
706 void SAL_CALL
SbaXFormAdapter::deleteRow() throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
708 Reference
< css::sdbc::XResultSetUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
713 void SAL_CALL
SbaXFormAdapter::cancelRowUpdates() throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
715 Reference
< css::sdbc::XResultSetUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
717 xIface
->cancelRowUpdates();
720 void SAL_CALL
SbaXFormAdapter::moveToInsertRow() throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
722 Reference
< css::sdbc::XResultSetUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
724 xIface
->moveToInsertRow();
727 void SAL_CALL
SbaXFormAdapter::moveToCurrentRow() throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
729 Reference
< css::sdbc::XResultSetUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
731 xIface
->moveToCurrentRow();
734 // css::sdbc::XRowSet
735 void SAL_CALL
SbaXFormAdapter::execute() throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
737 if (m_xMainForm
.is())
738 m_xMainForm
->execute();
741 IMPLEMENT_LISTENER_ADMINISTRATION(SbaXFormAdapter
, sdbc
, RowSetListener
, m_aRowSetListeners
, css::sdbc::XRowSet
, m_xMainForm
)
743 // css::sdbcx::XDeleteRows
744 Sequence
<sal_Int32
> SAL_CALL
SbaXFormAdapter::deleteRows(const Sequence
< Any
>& rows
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
746 Reference
< css::sdbcx::XDeleteRows
> xIface(m_xMainForm
, UNO_QUERY
);
748 return xIface
->deleteRows(rows
);
749 return Sequence
<sal_Int32
>();
752 // css::sdbc::XWarningsSupplier
753 Any SAL_CALL
SbaXFormAdapter::getWarnings() throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
755 Reference
< css::sdbc::XWarningsSupplier
> xIface(m_xMainForm
, UNO_QUERY
);
757 return xIface
->getWarnings();
761 void SAL_CALL
SbaXFormAdapter::clearWarnings() throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
763 Reference
< css::sdbc::XWarningsSupplier
> xIface(m_xMainForm
, UNO_QUERY
);
765 xIface
->clearWarnings();
768 // css::sdb::XRowSetApproveBroadcaster
769 IMPLEMENT_LISTENER_ADMINISTRATION(SbaXFormAdapter
, sdb
, RowSetApproveListener
, m_aRowSetApproveListeners
, css::sdb::XRowSetApproveBroadcaster
, m_xMainForm
)
771 // css::sdbc::XSQLErrorBroadcaster
772 IMPLEMENT_LISTENER_ADMINISTRATION(SbaXFormAdapter
, sdb
, SQLErrorListener
, m_aErrorListeners
, css::sdb::XSQLErrorBroadcaster
, m_xMainForm
)
774 // css::sdb::XResultSetAccess
775 Reference
< css::sdbc::XResultSet
> SAL_CALL
SbaXFormAdapter::createResultSet() throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
777 Reference
< css::sdb::XResultSetAccess
> xIface(m_xMainForm
, UNO_QUERY
);
779 return xIface
->createResultSet();
780 return Reference
< css::sdbc::XResultSet
> ();
783 // css::form::XLoadable
784 void SAL_CALL
SbaXFormAdapter::load() throw( RuntimeException
, std::exception
)
786 Reference
< css::form::XLoadable
> xIface(m_xMainForm
, UNO_QUERY
);
791 void SAL_CALL
SbaXFormAdapter::unload() throw( RuntimeException
, std::exception
)
793 Reference
< css::form::XLoadable
> xIface(m_xMainForm
, UNO_QUERY
);
798 void SAL_CALL
SbaXFormAdapter::reload() throw( RuntimeException
, std::exception
)
800 Reference
< css::form::XLoadable
> xIface(m_xMainForm
, UNO_QUERY
);
805 sal_Bool SAL_CALL
SbaXFormAdapter::isLoaded() throw( RuntimeException
, std::exception
)
807 Reference
< css::form::XLoadable
> xIface(m_xMainForm
, UNO_QUERY
);
809 return xIface
->isLoaded();
813 IMPLEMENT_LISTENER_ADMINISTRATION(SbaXFormAdapter
, form
, LoadListener
, m_aLoadListeners
, css::form::XLoadable
, m_xMainForm
)
815 // css::sdbc::XParameters
816 void SAL_CALL
SbaXFormAdapter::setNull(sal_Int32 parameterIndex
, sal_Int32 sqlType
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
818 Reference
< css::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
820 xIface
->setNull(parameterIndex
, sqlType
);
823 void SAL_CALL
SbaXFormAdapter::setObjectNull(sal_Int32 parameterIndex
, sal_Int32 sqlType
, const OUString
& typeName
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
825 Reference
< css::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
827 xIface
->setObjectNull(parameterIndex
, sqlType
, typeName
);
830 void SAL_CALL
SbaXFormAdapter::setBoolean(sal_Int32 parameterIndex
, sal_Bool x
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
832 Reference
< css::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
834 xIface
->setBoolean(parameterIndex
, x
);
837 void SAL_CALL
SbaXFormAdapter::setByte(sal_Int32 parameterIndex
, sal_Int8 x
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
839 Reference
< css::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
841 xIface
->setByte(parameterIndex
, x
);
844 void SAL_CALL
SbaXFormAdapter::setShort(sal_Int32 parameterIndex
, sal_Int16 x
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
846 Reference
< css::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
848 xIface
->setShort(parameterIndex
, x
);
851 void SAL_CALL
SbaXFormAdapter::setInt(sal_Int32 parameterIndex
, sal_Int32 x
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
853 Reference
< css::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
855 xIface
->setInt(parameterIndex
, x
);
858 void SAL_CALL
SbaXFormAdapter::setLong(sal_Int32 parameterIndex
, sal_Int64 x
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
860 Reference
< css::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
862 xIface
->setLong(parameterIndex
, x
);
865 void SAL_CALL
SbaXFormAdapter::setFloat(sal_Int32 parameterIndex
, float x
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
867 Reference
< css::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
869 xIface
->setFloat(parameterIndex
, x
);
872 void SAL_CALL
SbaXFormAdapter::setDouble(sal_Int32 parameterIndex
, double x
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
874 Reference
< css::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
876 xIface
->setDouble(parameterIndex
, x
);
879 void SAL_CALL
SbaXFormAdapter::setString(sal_Int32 parameterIndex
, const OUString
& x
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
881 Reference
< css::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
883 xIface
->setString(parameterIndex
, x
);
886 void SAL_CALL
SbaXFormAdapter::setBytes(sal_Int32 parameterIndex
, const Sequence
< sal_Int8
>& x
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
888 Reference
< css::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
890 xIface
->setBytes(parameterIndex
, x
);
893 void SAL_CALL
SbaXFormAdapter::setDate(sal_Int32 parameterIndex
, const css::util::Date
& x
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
895 Reference
< css::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
897 xIface
->setDate(parameterIndex
, x
);
900 void SAL_CALL
SbaXFormAdapter::setTime(sal_Int32 parameterIndex
, const css::util::Time
& x
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
902 Reference
< css::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
904 xIface
->setTime(parameterIndex
, x
);
907 void SAL_CALL
SbaXFormAdapter::setTimestamp(sal_Int32 parameterIndex
, const css::util::DateTime
& x
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
909 Reference
< css::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
911 xIface
->setTimestamp(parameterIndex
, x
);
914 void SAL_CALL
SbaXFormAdapter::setBinaryStream(sal_Int32 parameterIndex
, const Reference
< css::io::XInputStream
>& x
, sal_Int32 length
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
916 Reference
< css::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
918 xIface
->setBinaryStream(parameterIndex
, x
, length
);
921 void SAL_CALL
SbaXFormAdapter::setCharacterStream(sal_Int32 parameterIndex
, const Reference
< css::io::XInputStream
>& x
, sal_Int32 length
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
923 Reference
< css::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
925 xIface
->setCharacterStream(parameterIndex
, x
, length
);
928 void SAL_CALL
SbaXFormAdapter::setObject(sal_Int32 parameterIndex
, const Any
& x
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
930 Reference
< css::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
932 xIface
->setObject(parameterIndex
, x
);
935 void SAL_CALL
SbaXFormAdapter::setObjectWithInfo(sal_Int32 parameterIndex
, const Any
& x
, sal_Int32 targetSqlType
, sal_Int32 scale
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
937 Reference
< css::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
939 xIface
->setObjectWithInfo(parameterIndex
, x
, targetSqlType
, scale
);
942 void SAL_CALL
SbaXFormAdapter::setRef(sal_Int32 parameterIndex
, const Reference
< css::sdbc::XRef
>& x
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
944 Reference
< css::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
946 xIface
->setRef(parameterIndex
, x
);
949 void SAL_CALL
SbaXFormAdapter::setBlob(sal_Int32 parameterIndex
, const Reference
< css::sdbc::XBlob
>& x
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
951 Reference
< css::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
953 xIface
->setBlob(parameterIndex
, x
);
956 void SAL_CALL
SbaXFormAdapter::setClob(sal_Int32 parameterIndex
, const Reference
< css::sdbc::XClob
>& x
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
958 Reference
< css::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
960 xIface
->setClob(parameterIndex
, x
);
963 void SAL_CALL
SbaXFormAdapter::setArray(sal_Int32 parameterIndex
, const Reference
< css::sdbc::XArray
>& x
) throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
965 Reference
< css::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
967 xIface
->setArray(parameterIndex
, x
);
970 void SAL_CALL
SbaXFormAdapter::clearParameters() throw( css::sdbc::SQLException
, RuntimeException
, std::exception
)
972 Reference
< css::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
974 xIface
->clearParameters();
977 // css::form::XDatabaseParameterBroadcaster
978 void SAL_CALL
SbaXFormAdapter::addParameterListener(const Reference
< css::form::XDatabaseParameterListener
>& aListener
) throw( RuntimeException
, std::exception
)
980 m_aParameterListeners
.addInterface(aListener
);
981 if (m_aParameterListeners
.getLength() == 1)
983 Reference
< css::form::XDatabaseParameterBroadcaster
> xBroadcaster(m_xMainForm
, UNO_QUERY
);
984 if (xBroadcaster
.is())
985 xBroadcaster
->addParameterListener(&m_aParameterListeners
);
989 void SAL_CALL
SbaXFormAdapter::removeParameterListener(const Reference
< css::form::XDatabaseParameterListener
>& aListener
) throw( RuntimeException
, std::exception
)
991 if (m_aParameterListeners
.getLength() == 1)
993 Reference
< css::form::XDatabaseParameterBroadcaster
> xBroadcaster(m_xMainForm
, UNO_QUERY
);
994 if (xBroadcaster
.is())
995 xBroadcaster
->removeParameterListener(&m_aParameterListeners
);
997 m_aParameterListeners
.removeInterface(aListener
);
1000 // css::container::XChild
1001 Reference
< XInterface
> SAL_CALL
SbaXFormAdapter::getParent() throw( RuntimeException
, std::exception
)
1006 void SAL_CALL
SbaXFormAdapter::setParent(const Reference
< XInterface
>& Parent
) throw( css::lang::NoSupportException
, RuntimeException
, std::exception
)
1011 // css::form::XSubmit
1012 void SAL_CALL
SbaXFormAdapter::submit(const Reference
< css::awt::XControl
>& aControl
, const css::awt::MouseEvent
& aMouseEvt
) throw( RuntimeException
, std::exception
)
1014 Reference
< css::form::XSubmit
> xSubmit(m_xMainForm
, UNO_QUERY
);
1016 xSubmit
->submit(aControl
, aMouseEvt
);
1019 IMPLEMENT_LISTENER_ADMINISTRATION(SbaXFormAdapter
, form
, SubmitListener
, m_aSubmitListeners
, css::form::XSubmit
, m_xMainForm
)
1021 // css::awt::XTabControllerModel
1022 sal_Bool SAL_CALL
SbaXFormAdapter::getGroupControl() throw( RuntimeException
, std::exception
)
1024 OSL_FAIL("SAL_CALL SbaXFormAdapter::getGroupControl : not supported !");
1028 void SAL_CALL
SbaXFormAdapter::setGroupControl(sal_Bool
/*GroupControl*/) throw( RuntimeException
, std::exception
)
1030 OSL_FAIL("SAL_CALL SbaXFormAdapter::setGroupControl : not supported !");
1033 void SAL_CALL
SbaXFormAdapter::setControlModels(const Sequence
< Reference
< css::awt::XControlModel
> >& /*Controls*/) throw( RuntimeException
, std::exception
)
1035 OSL_FAIL("SAL_CALL SbaXFormAdapter::setControlModels : not supported !");
1038 Sequence
< Reference
< css::awt::XControlModel
> > SAL_CALL
SbaXFormAdapter::getControlModels() throw( RuntimeException
, std::exception
)
1040 OSL_FAIL("SAL_CALL SbaXFormAdapter::getControlModels : not supported !");
1041 return Sequence
< Reference
< css::awt::XControlModel
> >();
1044 void SAL_CALL
SbaXFormAdapter::setGroup(const Sequence
< Reference
< css::awt::XControlModel
> >& /*_rGroup*/, const OUString
& /*GroupName*/) throw( RuntimeException
, std::exception
)
1046 OSL_FAIL("SAL_CALL SbaXFormAdapter::setGroup : not supported !");
1049 sal_Int32 SAL_CALL
SbaXFormAdapter::getGroupCount() throw( RuntimeException
, std::exception
)
1051 OSL_FAIL("SAL_CALL SbaXFormAdapter::getGroupCount : not supported !");
1055 void SAL_CALL
SbaXFormAdapter::getGroup(sal_Int32
/*nGroup*/, Sequence
< Reference
< css::awt::XControlModel
> >& /*_rGroup*/, OUString
& /*Name*/) throw( RuntimeException
, std::exception
)
1057 OSL_FAIL("SAL_CALL SbaXFormAdapter::getGroup : not supported !");
1060 void SAL_CALL
SbaXFormAdapter::getGroupByName(const OUString
& /*Name*/, Sequence
< Reference
< css::awt::XControlModel
> >& /*_rGroup*/) throw( RuntimeException
, std::exception
)
1062 OSL_FAIL("SAL_CALL SbaXFormAdapter::getGroupByName : not supported !");
1065 // css::lang::XComponent
1066 void SAL_CALL
SbaXFormAdapter::dispose() throw( RuntimeException
, std::exception
)
1068 // log off all multiplexers
1069 if (m_xMainForm
.is())
1072 css::lang::EventObject
aEvt(*this);
1073 m_aLoadListeners
.disposeAndClear(aEvt
);
1074 m_aRowSetListeners
.disposeAndClear(aEvt
);
1075 m_aRowSetApproveListeners
.disposeAndClear(aEvt
);
1076 m_aErrorListeners
.disposeAndClear(aEvt
);
1077 m_aParameterListeners
.disposeAndClear(aEvt
);
1078 m_aSubmitListeners
.disposeAndClear(aEvt
);
1079 m_aResetListeners
.disposeAndClear(aEvt
);
1081 m_aVetoablePropertyChangeListeners
.disposeAndClear();
1082 m_aPropertyChangeListeners
.disposeAndClear();
1083 m_aPropertiesChangeListeners
.disposeAndClear(aEvt
);
1085 m_aDisposeListeners
.disposeAndClear(aEvt
);
1086 m_aContainerListeners
.disposeAndClear(aEvt
);
1088 // dispose all children
1089 for ( ::std::vector
< Reference
< css::form::XFormComponent
> >::const_iterator aIter
= m_aChildren
.begin();
1090 aIter
!= m_aChildren
.end();
1094 Reference
< css::beans::XPropertySet
> xSet(*aIter
, UNO_QUERY
);
1096 xSet
->removePropertyChangeListener(PROPERTY_NAME
, static_cast<css::beans::XPropertyChangeListener
*>(this));
1098 Reference
< css::container::XChild
> xChild(*aIter
, UNO_QUERY
);
1100 xChild
->setParent(Reference
< XInterface
> ());
1102 Reference
< css::lang::XComponent
> xComp(*aIter
, UNO_QUERY
);
1106 m_aChildren
.clear();
1109 void SAL_CALL
SbaXFormAdapter::addEventListener(const Reference
< css::lang::XEventListener
>& xListener
) throw( RuntimeException
, std::exception
)
1111 m_aDisposeListeners
.addInterface(xListener
);
1114 void SAL_CALL
SbaXFormAdapter::removeEventListener(const Reference
< css::lang::XEventListener
>& aListener
) throw( RuntimeException
, std::exception
)
1116 m_aDisposeListeners
.removeInterface(aListener
);
1119 // css::beans::XFastPropertySet
1120 void SAL_CALL
SbaXFormAdapter::setFastPropertyValue(sal_Int32 nHandle
, const Any
& aValue
) throw( css::beans::UnknownPropertyException
, css::beans::PropertyVetoException
, css::lang::IllegalArgumentException
, css::lang::WrappedTargetException
, RuntimeException
, std::exception
)
1122 Reference
< css::beans::XFastPropertySet
> xSet(m_xMainForm
, UNO_QUERY
);
1123 OSL_ENSURE(xSet
.is(), "SAL_CALL SbaXFormAdapter::setFastPropertyValue : have no master form !");
1125 if (m_nNamePropHandle
== nHandle
)
1127 if (aValue
.getValueType().getTypeClass() != TypeClass_STRING
)
1129 throw css::lang::IllegalArgumentException();
1132 // for notifying property listeners
1133 css::beans::PropertyChangeEvent aEvt
;
1134 aEvt
.Source
= *this;
1135 aEvt
.PropertyName
= PROPERTY_NAME
;
1136 aEvt
.PropertyHandle
= m_nNamePropHandle
;
1137 aEvt
.OldValue
<<= m_sName
;
1138 aEvt
.NewValue
= aValue
;
1142 ::cppu::OInterfaceIteratorHelper
aIt(*m_aPropertyChangeListeners
.getContainer(PROPERTY_NAME
));
1143 while (aIt
.hasMoreElements())
1144 static_cast< css::beans::XPropertyChangeListener
*>(aIt
.next())->propertyChange(aEvt
);
1149 xSet
->setFastPropertyValue(nHandle
, aValue
);
1152 Any SAL_CALL
SbaXFormAdapter::getFastPropertyValue(sal_Int32 nHandle
) throw( css::beans::UnknownPropertyException
, css::lang::WrappedTargetException
, RuntimeException
, std::exception
)
1154 Reference
< css::beans::XFastPropertySet
> xSet(m_xMainForm
, UNO_QUERY
);
1155 OSL_ENSURE(xSet
.is(), "SAL_CALL SbaXFormAdapter::getFastPropertyValue : have no master form !");
1157 if (m_nNamePropHandle
== nHandle
)
1158 return makeAny(m_sName
);
1160 return xSet
->getFastPropertyValue(nHandle
);
1163 // css::container::XNamed
1164 OUString SAL_CALL
SbaXFormAdapter::getName() throw( RuntimeException
, std::exception
)
1166 return ::comphelper::getString(getPropertyValue(PROPERTY_NAME
));
1169 void SAL_CALL
SbaXFormAdapter::setName(const OUString
& aName
) throw( RuntimeException
, std::exception
)
1171 setPropertyValue(PROPERTY_NAME
, makeAny(aName
));
1174 // css::io::XPersistObject
1175 OUString SAL_CALL
SbaXFormAdapter::getServiceName() throw( RuntimeException
, std::exception
)
1177 Reference
< css::io::XPersistObject
> xPersist(m_xMainForm
, UNO_QUERY
);
1179 return xPersist
->getServiceName();
1183 void SAL_CALL
SbaXFormAdapter::write(const Reference
< css::io::XObjectOutputStream
>& _rxOutStream
) throw( css::io::IOException
, RuntimeException
, std::exception
)
1185 Reference
< css::io::XPersistObject
> xPersist(m_xMainForm
, UNO_QUERY
);
1187 xPersist
->write(_rxOutStream
);
1190 void SAL_CALL
SbaXFormAdapter::read(const Reference
< css::io::XObjectInputStream
>& _rxInStream
) throw( css::io::IOException
, RuntimeException
, std::exception
)
1192 Reference
< css::io::XPersistObject
> xPersist(m_xMainForm
, UNO_QUERY
);
1194 xPersist
->read(_rxInStream
);
1197 // css::beans::XMultiPropertySet
1198 Reference
< css::beans::XPropertySetInfo
> SAL_CALL
SbaXFormAdapter::getPropertySetInfo() throw( RuntimeException
, std::exception
)
1200 Reference
< css::beans::XMultiPropertySet
> xSet(m_xMainForm
, UNO_QUERY
);
1202 return Reference
< css::beans::XPropertySetInfo
> ();
1204 Reference
< css::beans::XPropertySetInfo
> xReturn
= xSet
->getPropertySetInfo();
1205 if (-1 == m_nNamePropHandle
)
1207 // we need to determine the handle for the NAME property
1208 Sequence
< css::beans::Property
> aProps
= xReturn
->getProperties();
1209 const css::beans::Property
* pProps
= aProps
.getConstArray();
1211 for (sal_Int32 i
=0; i
<aProps
.getLength(); ++i
, ++pProps
)
1213 if (pProps
->Name
== PROPERTY_NAME
)
1215 m_nNamePropHandle
= pProps
->Handle
;
1223 void SAL_CALL
SbaXFormAdapter::setPropertyValues(const Sequence
< OUString
>& PropertyNames
, const Sequence
< Any
>& Values
) throw( css::beans::PropertyVetoException
, css::lang::IllegalArgumentException
, css::lang::WrappedTargetException
, RuntimeException
, std::exception
)
1225 Reference
< css::beans::XMultiPropertySet
> xSet(m_xMainForm
, UNO_QUERY
);
1227 xSet
->setPropertyValues(PropertyNames
, Values
);
1230 Sequence
< Any
> SAL_CALL
SbaXFormAdapter::getPropertyValues(const Sequence
< OUString
>& aPropertyNames
) throw( RuntimeException
, std::exception
)
1232 Reference
< css::beans::XMultiPropertySet
> xSet(m_xMainForm
, UNO_QUERY
);
1234 return Sequence
< Any
>(aPropertyNames
.getLength());
1236 Sequence
< Any
> aReturn
= xSet
->getPropertyValues(aPropertyNames
);
1238 // search for (and fake) the NAME property
1239 const OUString
* pNames
= aPropertyNames
.getConstArray();
1240 Any
* pValues
= aReturn
.getArray();
1241 OSL_ENSURE(aReturn
.getLength() == aPropertyNames
.getLength(), "SAL_CALL SbaXFormAdapter::getPropertyValues : the main form returned an invalid-length sequence !");
1242 for (sal_Int32 i
=0; i
<aPropertyNames
.getLength(); ++i
, ++pNames
, ++pValues
)
1243 if (*pNames
== PROPERTY_NAME
)
1245 (*pValues
) <<= m_sName
;
1252 void SAL_CALL
SbaXFormAdapter::addPropertiesChangeListener(const Sequence
< OUString
>& /*aPropertyNames*/, const Reference
< css::beans::XPropertiesChangeListener
>& xListener
) throw( RuntimeException
, std::exception
)
1254 // we completely ignore the property names, _all_ changes of _all_ properties will be forwarded to _all_ listeners
1255 m_aPropertiesChangeListeners
.addInterface(xListener
);
1256 if (m_aPropertiesChangeListeners
.getLength() == 1)
1258 Reference
< css::beans::XMultiPropertySet
> xBroadcaster(m_xMainForm
, UNO_QUERY
);
1259 if (xBroadcaster
.is())
1260 xBroadcaster
->addPropertiesChangeListener(Sequence
< OUString
>{""}, &m_aPropertiesChangeListeners
);
1264 void SAL_CALL
SbaXFormAdapter::removePropertiesChangeListener(const Reference
< css::beans::XPropertiesChangeListener
>& Listener
) throw( RuntimeException
, std::exception
)
1266 if (m_aPropertiesChangeListeners
.getLength() == 1)
1268 Reference
< css::beans::XMultiPropertySet
> xBroadcaster(m_xMainForm
, UNO_QUERY
);
1269 if (xBroadcaster
.is())
1270 xBroadcaster
->removePropertiesChangeListener(&m_aPropertiesChangeListeners
);
1272 m_aPropertiesChangeListeners
.removeInterface(Listener
);
1275 void SAL_CALL
SbaXFormAdapter::firePropertiesChangeEvent(const Sequence
< OUString
>& aPropertyNames
, const Reference
< css::beans::XPropertiesChangeListener
>& xListener
) throw( RuntimeException
, std::exception
)
1277 Reference
< css::beans::XMultiPropertySet
> xSet(m_xMainForm
, UNO_QUERY
);
1279 xSet
->firePropertiesChangeEvent(aPropertyNames
, xListener
);
1282 // css::beans::XPropertySet
1283 void SAL_CALL
SbaXFormAdapter::setPropertyValue(const OUString
& aPropertyName
, const Any
& aValue
) throw( css::beans::UnknownPropertyException
, css::beans::PropertyVetoException
, css::lang::IllegalArgumentException
, css::lang::WrappedTargetException
, RuntimeException
, std::exception
)
1285 Reference
< css::beans::XPropertySet
> xSet(m_xMainForm
, UNO_QUERY
);
1289 // special handling for the "name" property
1290 if (aPropertyName
== PROPERTY_NAME
)
1291 setFastPropertyValue(m_nNamePropHandle
, aValue
);
1293 xSet
->setPropertyValue(aPropertyName
, aValue
);
1296 Any SAL_CALL
SbaXFormAdapter::getPropertyValue(const OUString
& PropertyName
) throw( css::beans::UnknownPropertyException
, css::lang::WrappedTargetException
, RuntimeException
, std::exception
)
1298 Reference
< css::beans::XPropertySet
> xSet(m_xMainForm
, UNO_QUERY
);
1302 // special handling for the "name" property
1303 if (PropertyName
== PROPERTY_NAME
)
1304 return getFastPropertyValue(m_nNamePropHandle
);
1306 return xSet
->getPropertyValue(PropertyName
);
1309 IMPLEMENT_PROPERTY_LISTENER_ADMINISTRATION(SbaXFormAdapter
, PropertyChangeListener
, m_aPropertyChangeListeners
, css::beans::XPropertySet
, m_xMainForm
);
1310 IMPLEMENT_PROPERTY_LISTENER_ADMINISTRATION(SbaXFormAdapter
, VetoableChangeListener
, m_aVetoablePropertyChangeListeners
, css::beans::XPropertySet
, m_xMainForm
);
1312 // css::util::XCancellable
1313 void SAL_CALL
SbaXFormAdapter::cancel() throw( RuntimeException
, std::exception
)
1315 Reference
< css::util::XCancellable
> xCancel(m_xMainForm
, UNO_QUERY
);
1321 // css::beans::XPropertyState
1322 css::beans::PropertyState SAL_CALL
SbaXFormAdapter::getPropertyState(const OUString
& PropertyName
) throw( css::beans::UnknownPropertyException
, RuntimeException
, std::exception
)
1324 Reference
< css::beans::XPropertyState
> xState(m_xMainForm
, UNO_QUERY
);
1326 return xState
->getPropertyState(PropertyName
);
1327 return css::beans::PropertyState_DEFAULT_VALUE
;
1330 Sequence
< css::beans::PropertyState
> SAL_CALL
SbaXFormAdapter::getPropertyStates(const Sequence
< OUString
>& aPropertyName
) throw( css::beans::UnknownPropertyException
, RuntimeException
, std::exception
)
1332 Reference
< css::beans::XPropertyState
> xState(m_xMainForm
, UNO_QUERY
);
1334 return xState
->getPropertyStates(aPropertyName
);
1336 // set them all to DEFAULT
1337 Sequence
< css::beans::PropertyState
> aReturn(aPropertyName
.getLength());
1338 css::beans::PropertyState
* pStates
= aReturn
.getArray();
1339 for (sal_Int32 i
=0; i
<aPropertyName
.getLength(); ++i
, ++pStates
)
1340 *pStates
= css::beans::PropertyState_DEFAULT_VALUE
;
1344 void SAL_CALL
SbaXFormAdapter::setPropertyToDefault(const OUString
& PropertyName
) throw( css::beans::UnknownPropertyException
, RuntimeException
, std::exception
)
1346 Reference
< css::beans::XPropertyState
> xState(m_xMainForm
, UNO_QUERY
);
1348 xState
->setPropertyToDefault(PropertyName
);
1351 Any SAL_CALL
SbaXFormAdapter::getPropertyDefault(const OUString
& aPropertyName
) throw( css::beans::UnknownPropertyException
, css::lang::WrappedTargetException
, RuntimeException
, std::exception
)
1353 Reference
< css::beans::XPropertyState
> xState(m_xMainForm
, UNO_QUERY
);
1355 return xState
->getPropertyDefault(aPropertyName
);
1359 // css::form::XReset
1360 void SAL_CALL
SbaXFormAdapter::reset() throw( RuntimeException
, std::exception
)
1362 Reference
< css::form::XReset
> xReset(m_xMainForm
, UNO_QUERY
);
1367 IMPLEMENT_LISTENER_ADMINISTRATION(SbaXFormAdapter
, form
, ResetListener
, m_aResetListeners
, css::form::XReset
, m_xMainForm
)
1369 // css::container::XNameContainer
1370 void SbaXFormAdapter::implInsert(const Any
& aElement
, sal_Int32 nIndex
, const OUString
* pNewElName
) throw( css::lang::IllegalArgumentException
)
1372 // extract the form component
1373 if (aElement
.getValueType().getTypeClass() != TypeClass_INTERFACE
)
1375 throw css::lang::IllegalArgumentException();
1378 Reference
< css::form::XFormComponent
> xElement(aElement
, UNO_QUERY
);
1381 throw css::lang::IllegalArgumentException();
1384 // for the name we need the propset
1385 Reference
< css::beans::XPropertySet
> xElementSet(xElement
, UNO_QUERY
);
1386 if (!xElementSet
.is())
1388 throw css::lang::IllegalArgumentException();
1394 xElementSet
->setPropertyValue(PROPERTY_NAME
, makeAny(*pNewElName
));
1396 xElementSet
->getPropertyValue(PROPERTY_NAME
) >>= sName
;
1400 // the set didn't support the name prop
1401 throw css::lang::IllegalArgumentException();
1405 OSL_ASSERT(nIndex
>= 0);
1406 if (sal::static_int_cast
< sal_uInt32
>(nIndex
) > m_aChildren
.size())
1407 nIndex
= m_aChildren
.size();
1409 OSL_ENSURE(m_aChildren
.size() == m_aChildNames
.size(), "SAL_CALL SbaXFormAdapter::implInsert : inconsistent container state !");
1410 m_aChildren
.insert(m_aChildren
.begin() + nIndex
, xElement
);
1411 m_aChildNames
.insert(m_aChildNames
.begin() + nIndex
, sName
);
1413 // listen for a changes of the name
1414 xElementSet
->addPropertyChangeListener(PROPERTY_NAME
, static_cast<css::beans::XPropertyChangeListener
*>(this));
1416 // we are now the parent of the new element
1417 xElement
->setParent(static_cast<css::container::XContainer
*>(this));
1419 // notify the container listeners
1420 css::container::ContainerEvent aEvt
;
1421 aEvt
.Source
= *this;
1422 aEvt
.Accessor
<<= nIndex
;
1423 aEvt
.Element
<<= xElement
;
1424 ::comphelper::OInterfaceIteratorHelper2
aIt(m_aContainerListeners
);
1425 while (aIt
.hasMoreElements())
1426 static_cast< css::container::XContainerListener
*>(aIt
.next())->elementInserted(aEvt
);
1429 sal_Int32
SbaXFormAdapter::implGetPos(const OUString
& rName
)
1431 ::std::vector
< OUString
>::const_iterator aIter
= ::std::find_if( m_aChildNames
.begin(),
1432 m_aChildNames
.end(),
1433 ::std::bind2nd(::std::equal_to
< OUString
>(),rName
));
1435 if(aIter
!= m_aChildNames
.end())
1436 return aIter
- m_aChildNames
.begin();
1441 void SAL_CALL
SbaXFormAdapter::insertByName(const OUString
& aName
, const Any
& aElement
) throw( css::lang::IllegalArgumentException
, css::container::ElementExistException
, css::lang::WrappedTargetException
, RuntimeException
, std::exception
)
1443 implInsert(aElement
, m_aChildren
.size(), &aName
);
1446 void SAL_CALL
SbaXFormAdapter::removeByName(const OUString
& Name
) throw( css::container::NoSuchElementException
, css::lang::WrappedTargetException
, RuntimeException
, std::exception
)
1448 sal_Int32 nPos
= implGetPos(Name
);
1451 throw css::container::NoSuchElementException();
1453 removeByIndex(nPos
);
1456 // css::container::XNameReplace
1457 void SAL_CALL
SbaXFormAdapter::replaceByName(const OUString
& aName
, const Any
& aElement
) throw( css::lang::IllegalArgumentException
, css::container::NoSuchElementException
, css::lang::WrappedTargetException
, RuntimeException
, std::exception
)
1459 sal_Int32 nPos
= implGetPos(aName
);
1462 throw css::container::NoSuchElementException();
1464 replaceByIndex(nPos
, aElement
);
1467 // css::container::XNameAccess
1468 Any SAL_CALL
SbaXFormAdapter::getByName(const OUString
& aName
) throw( css::container::NoSuchElementException
, css::lang::WrappedTargetException
, RuntimeException
, std::exception
)
1470 sal_Int32 nPos
= implGetPos(aName
);
1473 throw css::container::NoSuchElementException();
1475 return makeAny(m_aChildren
[nPos
]);
1478 Sequence
< OUString
> SAL_CALL
SbaXFormAdapter::getElementNames() throw( RuntimeException
, std::exception
)
1480 return Sequence
< OUString
>(m_aChildNames
.data(), m_aChildNames
.size());
1483 sal_Bool SAL_CALL
SbaXFormAdapter::hasByName(const OUString
& aName
) throw( RuntimeException
, std::exception
)
1485 return (-1 != implGetPos(aName
));
1488 // css::container::XElementAccess
1489 Type SAL_CALL
SbaXFormAdapter::getElementType() throw(RuntimeException
, std::exception
)
1491 return cppu::UnoType
<css::form::XFormComponent
>::get();
1494 sal_Bool SAL_CALL
SbaXFormAdapter::hasElements() throw(RuntimeException
, std::exception
)
1496 return m_aChildren
.size() > 0;
1499 // css::container::XIndexContainer
1500 void SAL_CALL
SbaXFormAdapter::insertByIndex(sal_Int32 _rIndex
, const Any
& Element
) throw( css::lang::IllegalArgumentException
, css::lang::IndexOutOfBoundsException
, css::lang::WrappedTargetException
, RuntimeException
, std::exception
)
1502 if ( ( _rIndex
< 0 ) || ( (size_t)_rIndex
>= m_aChildren
.size() ) )
1503 throw css::lang::IndexOutOfBoundsException();
1504 implInsert(Element
, _rIndex
);
1507 void SAL_CALL
SbaXFormAdapter::removeByIndex(sal_Int32 _rIndex
) throw( css::lang::IndexOutOfBoundsException
, css::lang::WrappedTargetException
, RuntimeException
, std::exception
)
1509 if ( ( _rIndex
< 0 ) || ( (size_t)_rIndex
>= m_aChildren
.size() ) )
1510 throw css::lang::IndexOutOfBoundsException();
1512 Reference
< css::form::XFormComponent
> xAffected
= *(m_aChildren
.begin() + _rIndex
);
1514 OSL_ENSURE(m_aChildren
.size() == m_aChildNames
.size(), "SAL_CALL SbaXFormAdapter::removeByIndex : inconsistent container state !");
1515 m_aChildren
.erase(m_aChildren
.begin() + _rIndex
);
1516 m_aChildNames
.erase(m_aChildNames
.begin() + _rIndex
);
1518 // no need to listen anymore
1519 Reference
< css::beans::XPropertySet
> xAffectedSet(xAffected
, UNO_QUERY
);
1520 xAffectedSet
->removePropertyChangeListener(PROPERTY_NAME
, static_cast<css::beans::XPropertyChangeListener
*>(this));
1522 // we are no longer the parent
1523 xAffected
->setParent(Reference
< XInterface
> ());
1525 // notify container listeners
1526 css::container::ContainerEvent aEvt
;
1527 aEvt
.Source
= *this;
1528 aEvt
.Element
<<= xAffected
;
1529 ::comphelper::OInterfaceIteratorHelper2
aIt(m_aContainerListeners
);
1530 while (aIt
.hasMoreElements())
1531 static_cast< css::container::XContainerListener
*>(aIt
.next())->elementRemoved(aEvt
);
1535 // css::container::XIndexReplace
1536 void SAL_CALL
SbaXFormAdapter::replaceByIndex(sal_Int32 _rIndex
, const Any
& Element
) throw( css::lang::IllegalArgumentException
, css::lang::IndexOutOfBoundsException
, css::lang::WrappedTargetException
, RuntimeException
, std::exception
)
1538 if ( ( _rIndex
< 0 ) || ( (size_t)_rIndex
>= m_aChildren
.size() ) )
1539 throw css::lang::IndexOutOfBoundsException();
1541 // extract the form component
1542 if (Element
.getValueType().getTypeClass() != TypeClass_INTERFACE
)
1544 throw css::lang::IllegalArgumentException();
1547 Reference
< css::form::XFormComponent
> xElement(Element
, UNO_QUERY
);
1550 throw css::lang::IllegalArgumentException();
1553 // for the name we need the propset
1554 Reference
< css::beans::XPropertySet
> xElementSet(xElement
, UNO_QUERY
);
1555 if (!xElementSet
.is())
1557 throw css::lang::IllegalArgumentException();
1562 xElementSet
->getPropertyValue(PROPERTY_NAME
) >>= sName
;
1566 // the set didn't support the name prop
1567 throw css::lang::IllegalArgumentException();
1570 Reference
< css::form::XFormComponent
> xOld
= *(m_aChildren
.begin() + _rIndex
);
1572 OSL_ENSURE(m_aChildren
.size() == m_aChildNames
.size(), "SAL_CALL SbaXFormAdapter::replaceByIndex : inconsistent container state !");
1573 *(m_aChildren
.begin() + _rIndex
) = xElement
;
1574 *(m_aChildNames
.begin() + _rIndex
) = sName
;
1576 // correct property change listening
1577 Reference
< css::beans::XPropertySet
> xOldSet(xOld
, UNO_QUERY
);
1578 xOldSet
->removePropertyChangeListener(PROPERTY_NAME
, static_cast<css::beans::XPropertyChangeListener
*>(this));
1579 xElementSet
->addPropertyChangeListener(PROPERTY_NAME
, static_cast<css::beans::XPropertyChangeListener
*>(this));
1582 xOld
->setParent(Reference
< XInterface
> ());
1583 xElement
->setParent(static_cast<css::container::XContainer
*>(this));
1585 // notify container listeners
1586 css::container::ContainerEvent aEvt
;
1587 aEvt
.Source
= *this;
1588 aEvt
.Accessor
<<= (sal_Int32
)_rIndex
;
1589 aEvt
.Element
<<= xElement
;
1590 aEvt
.ReplacedElement
<<= xOld
;
1592 ::comphelper::OInterfaceIteratorHelper2
aIt(m_aContainerListeners
);
1593 while (aIt
.hasMoreElements())
1594 static_cast< css::container::XContainerListener
*>(aIt
.next())->elementReplaced(aEvt
);
1597 // css::container::XIndexAccess
1598 sal_Int32 SAL_CALL
SbaXFormAdapter::getCount() throw( RuntimeException
, std::exception
)
1600 return m_aChildren
.size();
1603 Any SAL_CALL
SbaXFormAdapter::getByIndex(sal_Int32 _rIndex
) throw( css::lang::IndexOutOfBoundsException
, css::lang::WrappedTargetException
, RuntimeException
, std::exception
)
1605 if ( ( _rIndex
< 0 ) || ( (size_t)_rIndex
>= m_aChildren
.size() ) )
1606 throw css::lang::IndexOutOfBoundsException();
1608 Reference
< css::form::XFormComponent
> xElement
= *(m_aChildren
.begin() + _rIndex
);
1609 return makeAny(xElement
);
1612 // css::container::XContainer
1613 void SAL_CALL
SbaXFormAdapter::addContainerListener(const Reference
< css::container::XContainerListener
>& xListener
) throw( RuntimeException
, std::exception
)
1615 m_aContainerListeners
.addInterface(xListener
);
1618 void SAL_CALL
SbaXFormAdapter::removeContainerListener(const Reference
< css::container::XContainerListener
>& xListener
) throw( RuntimeException
, std::exception
)
1620 m_aContainerListeners
.removeInterface(xListener
);
1623 // css::container::XEnumerationAccess
1624 Reference
< css::container::XEnumeration
> SAL_CALL
SbaXFormAdapter::createEnumeration() throw( RuntimeException
, std::exception
)
1626 return new ::comphelper::OEnumerationByName(this);
1629 // css::beans::XPropertyChangeListener
1630 void SAL_CALL
SbaXFormAdapter::propertyChange(const css::beans::PropertyChangeEvent
& evt
) throw( RuntimeException
, std::exception
)
1632 if (evt
.PropertyName
== PROPERTY_NAME
)
1634 ::std::vector
< css::uno::Reference
< css::form::XFormComponent
> >::const_iterator aIter
= ::std::find_if( m_aChildren
.begin(),
1636 ::std::bind2nd(::std::equal_to
< css::uno::Reference
< css::uno::XInterface
> >(),evt
.Source
));
1638 if(aIter
!= m_aChildren
.end())
1640 sal_Int32 nPos
= aIter
- m_aChildren
.begin();
1641 OSL_ENSURE(*(m_aChildNames
.begin() + nPos
) == ::comphelper::getString(evt
.OldValue
), "SAL_CALL SbaXFormAdapter::propertyChange : object has a wrong name !");
1642 *(m_aChildNames
.begin() + nPos
) = ::comphelper::getString(evt
.NewValue
);
1647 // css::lang::XEventListener
1648 void SAL_CALL
SbaXFormAdapter::disposing(const css::lang::EventObject
& Source
) throw( RuntimeException
, std::exception
)
1650 // was it our main form ?
1651 if (Source
.Source
== m_xMainForm
)
1654 ::std::vector
< css::uno::Reference
< css::form::XFormComponent
> >::const_iterator aIter
= ::std::find_if( m_aChildren
.begin(),
1656 ::std::bind2nd(::std::equal_to
< css::uno::Reference
< css::uno::XInterface
> >(),Source
.Source
));
1657 if(aIter
!= m_aChildren
.end())
1658 removeByIndex(aIter
- m_aChildren
.begin());
1661 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */